tycono 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -8
- package/bin/tycono.ts +0 -9
- package/package.json +1 -1
- package/src/api/src/routes/git.ts +179 -0
- package/src/api/src/routes/speech.ts +29 -0
- package/src/api/src/routes/sync.ts +165 -0
- package/src/api/src/services/scaffold.ts +1 -1
- package/src/api/src/utils/role-level.ts +30 -0
- package/src/web/dist/assets/index-BxDf0CSf.css +1 -0
- package/src/web/dist/assets/index-FesWAu2a.js +95 -0
- package/src/web/dist/assets/{preview-app-pniQIcGk.js → preview-app-DfJ0nbgX.js} +1 -1
- package/src/web/dist/index.html +2 -2
- package/bin/init.ts +0 -306
- package/src/web/dist/assets/index-CZtcQkJ_.js +0 -95
- package/src/web/dist/assets/index-DIjVGqFh.css +0 -1
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
var Sb=Object.defineProperty;var jb=(t,l,a)=>l in t?Sb(t,l,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[l]=a;var Qp=(t,l,a)=>jb(t,typeof l!="symbol"?l+"":l,a);(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&i(f)}).observe(document,{childList:!0,subtree:!0});function a(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(o){if(o.ep)return;o.ep=!0;const u=a(o);fetch(o.href,u)}})();function _y(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Of={exports:{}},Pi={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Zp;function Eb(){if(Zp)return Pi;Zp=1;var t=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function a(i,o,u){var f=null;if(u!==void 0&&(f=""+u),o.key!==void 0&&(f=""+o.key),"key"in o){u={};for(var m in o)m!=="key"&&(u[m]=o[m])}else u=o;return o=u.ref,{$$typeof:t,type:i,key:f,ref:o!==void 0?o:null,props:u}}return Pi.Fragment=l,Pi.jsx=a,Pi.jsxs=a,Pi}var Wp;function Cb(){return Wp||(Wp=1,Of.exports=Eb()),Of.exports}var c=Cb(),Bf={exports:{}},Xe={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react.production.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Jp;function Nb(){if(Jp)return Xe;Jp=1;var t=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),f=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function v(_){return _===null||typeof _!="object"?null:(_=b&&_[b]||_["@@iterator"],typeof _=="function"?_:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,C={};function E(_,P,A){this.props=_,this.context=P,this.refs=C,this.updater=A||S}E.prototype.isReactComponent={},E.prototype.setState=function(_,P){if(typeof _!="object"&&typeof _!="function"&&_!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,_,P,"setState")},E.prototype.forceUpdate=function(_){this.updater.enqueueForceUpdate(this,_,"forceUpdate")};function M(){}M.prototype=E.prototype;function $(_,P,A){this.props=_,this.context=P,this.refs=C,this.updater=A||S}var O=$.prototype=new M;O.constructor=$,k(O,E.prototype),O.isPureReactComponent=!0;var B=Array.isArray;function T(){}var Y={H:null,A:null,T:null,S:null},V=Object.prototype.hasOwnProperty;function te(_,P,A){var pe=A.ref;return{$$typeof:t,type:_,key:P,ref:pe!==void 0?pe:null,props:A}}function D(_,P){return te(_.type,P,_.props)}function I(_){return typeof _=="object"&&_!==null&&_.$$typeof===t}function L(_){var P={"=":"=0",":":"=2"};return"$"+_.replace(/[=:]/g,function(A){return P[A]})}var ee=/\/+/g;function ae(_,P){return typeof _=="object"&&_!==null&&_.key!=null?L(""+_.key):P.toString(36)}function X(_){switch(_.status){case"fulfilled":return _.value;case"rejected":throw _.reason;default:switch(typeof _.status=="string"?_.then(T,T):(_.status="pending",_.then(function(P){_.status==="pending"&&(_.status="fulfilled",_.value=P)},function(P){_.status==="pending"&&(_.status="rejected",_.reason=P)})),_.status){case"fulfilled":return _.value;case"rejected":throw _.reason}}throw _}function U(_,P,A,pe,Se){var Ce=typeof _;(Ce==="undefined"||Ce==="boolean")&&(_=null);var Fe=!1;if(_===null)Fe=!0;else switch(Ce){case"bigint":case"string":case"number":Fe=!0;break;case"object":switch(_.$$typeof){case t:case l:Fe=!0;break;case g:return Fe=_._init,U(Fe(_._payload),P,A,pe,Se)}}if(Fe)return Se=Se(_),Fe=pe===""?"."+ae(_,0):pe,B(Se)?(A="",Fe!=null&&(A=Fe.replace(ee,"$&/")+"/"),U(Se,P,A,"",function(K){return K})):Se!=null&&(I(Se)&&(Se=D(Se,A+(Se.key==null||_&&_.key===Se.key?"":(""+Se.key).replace(ee,"$&/")+"/")+Fe)),P.push(Se)),1;Fe=0;var Ye=pe===""?".":pe+":";if(B(_))for(var se=0;se<_.length;se++)pe=_[se],Ce=Ye+ae(pe,se),Fe+=U(pe,P,A,Ce,Se);else if(se=v(_),typeof se=="function")for(_=se.call(_),se=0;!(pe=_.next()).done;)pe=pe.value,Ce=Ye+ae(pe,se++),Fe+=U(pe,P,A,Ce,Se);else if(Ce==="object"){if(typeof _.then=="function")return U(X(_),P,A,pe,Se);throw P=String(_),Error("Objects are not valid as a React child (found: "+(P==="[object Object]"?"object with keys {"+Object.keys(_).join(", ")+"}":P)+"). If you meant to render a collection of children, use an array instead.")}return Fe}function Q(_,P,A){if(_==null)return _;var pe=[],Se=0;return U(_,pe,"","",function(Ce){return P.call(A,Ce,Se++)}),pe}function ie(_){if(_._status===-1){var P=_._result;P=P(),P.then(function(A){(_._status===0||_._status===-1)&&(_._status=1,_._result=A)},function(A){(_._status===0||_._status===-1)&&(_._status=2,_._result=A)}),_._status===-1&&(_._status=0,_._result=P)}if(_._status===1)return _._result.default;throw _._result}var ve=typeof reportError=="function"?reportError:function(_){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var P=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof _=="object"&&_!==null&&typeof _.message=="string"?String(_.message):String(_),error:_});if(!window.dispatchEvent(P))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",_);return}console.error(_)},z={map:Q,forEach:function(_,P,A){Q(_,function(){P.apply(this,arguments)},A)},count:function(_){var P=0;return Q(_,function(){P++}),P},toArray:function(_){return Q(_,function(P){return P})||[]},only:function(_){if(!I(_))throw Error("React.Children.only expected to receive a single React element child.");return _}};return Xe.Activity=y,Xe.Children=z,Xe.Component=E,Xe.Fragment=a,Xe.Profiler=o,Xe.PureComponent=$,Xe.StrictMode=i,Xe.Suspense=p,Xe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Y,Xe.__COMPILER_RUNTIME={__proto__:null,c:function(_){return Y.H.useMemoCache(_)}},Xe.cache=function(_){return function(){return _.apply(null,arguments)}},Xe.cacheSignal=function(){return null},Xe.cloneElement=function(_,P,A){if(_==null)throw Error("The argument must be a React element, but you passed "+_+".");var pe=k({},_.props),Se=_.key;if(P!=null)for(Ce in P.key!==void 0&&(Se=""+P.key),P)!V.call(P,Ce)||Ce==="key"||Ce==="__self"||Ce==="__source"||Ce==="ref"&&P.ref===void 0||(pe[Ce]=P[Ce]);var Ce=arguments.length-2;if(Ce===1)pe.children=A;else if(1<Ce){for(var Fe=Array(Ce),Ye=0;Ye<Ce;Ye++)Fe[Ye]=arguments[Ye+2];pe.children=Fe}return te(_.type,Se,pe)},Xe.createContext=function(_){return _={$$typeof:f,_currentValue:_,_currentValue2:_,_threadCount:0,Provider:null,Consumer:null},_.Provider=_,_.Consumer={$$typeof:u,_context:_},_},Xe.createElement=function(_,P,A){var pe,Se={},Ce=null;if(P!=null)for(pe in P.key!==void 0&&(Ce=""+P.key),P)V.call(P,pe)&&pe!=="key"&&pe!=="__self"&&pe!=="__source"&&(Se[pe]=P[pe]);var Fe=arguments.length-2;if(Fe===1)Se.children=A;else if(1<Fe){for(var Ye=Array(Fe),se=0;se<Fe;se++)Ye[se]=arguments[se+2];Se.children=Ye}if(_&&_.defaultProps)for(pe in Fe=_.defaultProps,Fe)Se[pe]===void 0&&(Se[pe]=Fe[pe]);return te(_,Ce,Se)},Xe.createRef=function(){return{current:null}},Xe.forwardRef=function(_){return{$$typeof:m,render:_}},Xe.isValidElement=I,Xe.lazy=function(_){return{$$typeof:g,_payload:{_status:-1,_result:_},_init:ie}},Xe.memo=function(_,P){return{$$typeof:h,type:_,compare:P===void 0?null:P}},Xe.startTransition=function(_){var P=Y.T,A={};Y.T=A;try{var pe=_(),Se=Y.S;Se!==null&&Se(A,pe),typeof pe=="object"&&pe!==null&&typeof pe.then=="function"&&pe.then(T,ve)}catch(Ce){ve(Ce)}finally{P!==null&&A.types!==null&&(P.types=A.types),Y.T=P}},Xe.unstable_useCacheRefresh=function(){return Y.H.useCacheRefresh()},Xe.use=function(_){return Y.H.use(_)},Xe.useActionState=function(_,P,A){return Y.H.useActionState(_,P,A)},Xe.useCallback=function(_,P){return Y.H.useCallback(_,P)},Xe.useContext=function(_){return Y.H.useContext(_)},Xe.useDebugValue=function(){},Xe.useDeferredValue=function(_,P){return Y.H.useDeferredValue(_,P)},Xe.useEffect=function(_,P){return Y.H.useEffect(_,P)},Xe.useEffectEvent=function(_){return Y.H.useEffectEvent(_)},Xe.useId=function(){return Y.H.useId()},Xe.useImperativeHandle=function(_,P,A){return Y.H.useImperativeHandle(_,P,A)},Xe.useInsertionEffect=function(_,P){return Y.H.useInsertionEffect(_,P)},Xe.useLayoutEffect=function(_,P){return Y.H.useLayoutEffect(_,P)},Xe.useMemo=function(_,P){return Y.H.useMemo(_,P)},Xe.useOptimistic=function(_,P){return Y.H.useOptimistic(_,P)},Xe.useReducer=function(_,P,A){return Y.H.useReducer(_,P,A)},Xe.useRef=function(_){return Y.H.useRef(_)},Xe.useState=function(_){return Y.H.useState(_)},Xe.useSyncExternalStore=function(_,P,A){return Y.H.useSyncExternalStore(_,P,A)},Xe.useTransition=function(){return Y.H.useTransition()},Xe.version="19.2.4",Xe}var Pp;function qd(){return Pp||(Pp=1,Bf.exports=Nb()),Bf.exports}var j=qd(),$f={exports:{}},es={},Lf={exports:{}},Hf={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var e1;function Ab(){return e1||(e1=1,(function(t){function l(U,Q){var ie=U.length;U.push(Q);e:for(;0<ie;){var ve=ie-1>>>1,z=U[ve];if(0<o(z,Q))U[ve]=Q,U[ie]=z,ie=ve;else break e}}function a(U){return U.length===0?null:U[0]}function i(U){if(U.length===0)return null;var Q=U[0],ie=U.pop();if(ie!==Q){U[0]=ie;e:for(var ve=0,z=U.length,_=z>>>1;ve<_;){var P=2*(ve+1)-1,A=U[P],pe=P+1,Se=U[pe];if(0>o(A,ie))pe<z&&0>o(Se,A)?(U[ve]=Se,U[pe]=ie,ve=pe):(U[ve]=A,U[P]=ie,ve=P);else if(pe<z&&0>o(Se,ie))U[ve]=Se,U[pe]=ie,ve=pe;else break e}}return Q}function o(U,Q){var ie=U.sortIndex-Q.sortIndex;return ie!==0?ie:U.id-Q.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var f=Date,m=f.now();t.unstable_now=function(){return f.now()-m}}var p=[],h=[],g=1,y=null,b=3,v=!1,S=!1,k=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;function O(U){for(var Q=a(h);Q!==null;){if(Q.callback===null)i(h);else if(Q.startTime<=U)i(h),Q.sortIndex=Q.expirationTime,l(p,Q);else break;Q=a(h)}}function B(U){if(k=!1,O(U),!S)if(a(p)!==null)S=!0,T||(T=!0,L());else{var Q=a(h);Q!==null&&X(B,Q.startTime-U)}}var T=!1,Y=-1,V=5,te=-1;function D(){return C?!0:!(t.unstable_now()-te<V)}function I(){if(C=!1,T){var U=t.unstable_now();te=U;var Q=!0;try{e:{S=!1,k&&(k=!1,M(Y),Y=-1),v=!0;var ie=b;try{t:{for(O(U),y=a(p);y!==null&&!(y.expirationTime>U&&D());){var ve=y.callback;if(typeof ve=="function"){y.callback=null,b=y.priorityLevel;var z=ve(y.expirationTime<=U);if(U=t.unstable_now(),typeof z=="function"){y.callback=z,O(U),Q=!0;break t}y===a(p)&&i(p),O(U)}else i(p);y=a(p)}if(y!==null)Q=!0;else{var _=a(h);_!==null&&X(B,_.startTime-U),Q=!1}}break e}finally{y=null,b=ie,v=!1}Q=void 0}}finally{Q?L():T=!1}}}var L;if(typeof $=="function")L=function(){$(I)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,ae=ee.port2;ee.port1.onmessage=I,L=function(){ae.postMessage(null)}}else L=function(){E(I,0)};function X(U,Q){Y=E(function(){U(t.unstable_now())},Q)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(U){U.callback=null},t.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<U?Math.floor(1e3/U):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(U){switch(b){case 1:case 2:case 3:var Q=3;break;default:Q=b}var ie=b;b=Q;try{return U()}finally{b=ie}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(U,Q){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var ie=b;b=U;try{return Q()}finally{b=ie}},t.unstable_scheduleCallback=function(U,Q,ie){var ve=t.unstable_now();switch(typeof ie=="object"&&ie!==null?(ie=ie.delay,ie=typeof ie=="number"&&0<ie?ve+ie:ve):ie=ve,U){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=ie+z,U={id:g++,callback:Q,priorityLevel:U,startTime:ie,expirationTime:z,sortIndex:-1},ie>ve?(U.sortIndex=ie,l(h,U),a(p)===null&&U===a(h)&&(k?(M(Y),Y=-1):k=!0,X(B,ie-ve))):(U.sortIndex=z,l(p,U),S||v||(S=!0,T||(T=!0,L()))),U},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(U){var Q=b;return function(){var ie=b;b=Q;try{return U.apply(this,arguments)}finally{b=ie}}}})(Hf)),Hf}var t1;function Db(){return t1||(t1=1,Lf.exports=Ab()),Lf.exports}var Uf={exports:{}},hn={};/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var n1;function Tb(){if(n1)return hn;n1=1;var t=qd();function l(p){var h="https://react.dev/errors/"+p;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+p+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var i={d:{f:a,r:function(){throw Error(l(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},o=Symbol.for("react.portal");function u(p,h,g){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:p,containerInfo:h,implementation:g}}var f=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(p,h){if(p==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return hn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,hn.createPortal=function(p,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(l(299));return u(p,h,null,g)},hn.flushSync=function(p){var h=f.T,g=i.p;try{if(f.T=null,i.p=2,p)return p()}finally{f.T=h,i.p=g,i.d.f()}},hn.preconnect=function(p,h){typeof p=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,i.d.C(p,h))},hn.prefetchDNS=function(p){typeof p=="string"&&i.d.D(p)},hn.preinit=function(p,h){if(typeof p=="string"&&h&&typeof h.as=="string"){var g=h.as,y=m(g,h.crossOrigin),b=typeof h.integrity=="string"?h.integrity:void 0,v=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?i.d.S(p,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:v}):g==="script"&&i.d.X(p,{crossOrigin:y,integrity:b,fetchPriority:v,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},hn.preinitModule=function(p,h){if(typeof p=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=m(h.as,h.crossOrigin);i.d.M(p,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&i.d.M(p)},hn.preload=function(p,h){if(typeof p=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,y=m(g,h.crossOrigin);i.d.L(p,g,{crossOrigin:y,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},hn.preloadModule=function(p,h){if(typeof p=="string")if(h){var g=m(h.as,h.crossOrigin);i.d.m(p,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else i.d.m(p)},hn.requestFormReset=function(p){i.d.r(p)},hn.unstable_batchedUpdates=function(p,h){return p(h)},hn.useFormState=function(p,h,g){return f.H.useFormState(p,h,g)},hn.useFormStatus=function(){return f.H.useHostTransitionStatus()},hn.version="19.2.4",hn}var l1;function zb(){if(l1)return Uf.exports;l1=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(l){console.error(l)}}return t(),Uf.exports=Tb(),Uf.exports}/**
|
|
34
|
-
* @license React
|
|
35
|
-
* react-dom-client.production.js
|
|
36
|
-
*
|
|
37
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the MIT license found in the
|
|
40
|
-
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var a1;function Mb(){if(a1)return es;a1=1;var t=Db(),l=qd(),a=zb();function i(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)n+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var n=e,r=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(r=n.return),e=n.return;while(e)}return n.tag===3?r:null}function f(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(u(e)!==e)throw Error(i(188))}function h(e){var n=e.alternate;if(!n){if(n=u(e),n===null)throw Error(i(188));return n!==e?null:e}for(var r=e,s=n;;){var d=r.return;if(d===null)break;var x=d.alternate;if(x===null){if(s=d.return,s!==null){r=s;continue}break}if(d.child===x.child){for(x=d.child;x;){if(x===r)return p(d),e;if(x===s)return p(d),n;x=x.sibling}throw Error(i(188))}if(r.return!==s.return)r=d,s=x;else{for(var w=!1,N=d.child;N;){if(N===r){w=!0,r=d,s=x;break}if(N===s){w=!0,s=d,r=x;break}N=N.sibling}if(!w){for(N=x.child;N;){if(N===r){w=!0,r=x,s=d;break}if(N===s){w=!0,s=x,r=d;break}N=N.sibling}if(!w)throw Error(i(189))}}if(r.alternate!==s)throw Error(i(190))}if(r.tag!==3)throw Error(i(188));return r.stateNode.current===r?e:n}function g(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=g(e),n!==null)return n;e=e.sibling}return null}var y=Object.assign,b=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),$=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),te=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function L(e){return e===null||typeof e!="object"?null:(e=I&&e[I]||e["@@iterator"],typeof e=="function"?e:null)}var ee=Symbol.for("react.client.reference");function ae(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ee?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case k:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case B:return"Suspense";case T:return"SuspenseList";case te:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case S:return"Portal";case $:return e.displayName||"Context";case M:return(e._context.displayName||"Context")+".Consumer";case O:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Y:return n=e.displayName||null,n!==null?n:ae(e.type)||"Memo";case V:n=e._payload,e=e._init;try{return ae(e(n))}catch{}}return null}var X=Array.isArray,U=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},ve=[],z=-1;function _(e){return{current:e}}function P(e){0>z||(e.current=ve[z],ve[z]=null,z--)}function A(e,n){z++,ve[z]=e.current,e.current=n}var pe=_(null),Se=_(null),Ce=_(null),Fe=_(null);function Ye(e,n){switch(A(Ce,n),A(Se,e),A(pe,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?gp(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=gp(n),e=bp(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}P(pe),A(pe,e)}function se(){P(pe),P(Se),P(Ce)}function K(e){e.memoizedState!==null&&A(Fe,e);var n=pe.current,r=bp(n,e.type);n!==r&&(A(Se,e),A(pe,r))}function ue(e){Se.current===e&&(P(pe),P(Se)),Fe.current===e&&(P(Fe),Qi._currentValue=ie)}var we,ne;function xe(e){if(we===void 0)try{throw Error()}catch(r){var n=r.stack.trim().match(/\n( *(at )?)/);we=n&&n[1]||"",ne=-1<r.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+we+e+ne}var je=!1;function Ae(e,n){if(!e||je)return"";je=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(n){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(le){var J=le}Reflect.construct(e,[],fe)}else{try{fe.call()}catch(le){J=le}e.call(fe.prototype)}}else{try{throw Error()}catch(le){J=le}(fe=e())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(le){if(le&&J&&typeof le.stack=="string")return[le.stack,J.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=s.DetermineComponentFrameRoot(),w=x[0],N=x[1];if(w&&N){var R=w.split(`
|
|
44
|
-
`),W=N.split(`
|
|
45
|
-
`);for(d=s=0;s<R.length&&!R[s].includes("DetermineComponentFrameRoot");)s++;for(;d<W.length&&!W[d].includes("DetermineComponentFrameRoot");)d++;if(s===R.length||d===W.length)for(s=R.length-1,d=W.length-1;1<=s&&0<=d&&R[s]!==W[d];)d--;for(;1<=s&&0<=d;s--,d--)if(R[s]!==W[d]){if(s!==1||d!==1)do if(s--,d--,0>d||R[s]!==W[d]){var oe=`
|
|
46
|
-
`+R[s].replace(" at new "," at ");return e.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",e.displayName)),oe}while(1<=s&&0<=d);break}}}finally{je=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?xe(r):""}function Re(e,n){switch(e.tag){case 26:case 27:case 5:return xe(e.type);case 16:return xe("Lazy");case 13:return e.child!==n&&n!==null?xe("Suspense Fallback"):xe("Suspense");case 19:return xe("SuspenseList");case 0:case 15:return Ae(e.type,!1);case 11:return Ae(e.type.render,!1);case 1:return Ae(e.type,!0);case 31:return xe("Activity");default:return""}}function Ve(e){try{var n="",r=null;do n+=Re(e,r),r=e,e=e.return;while(e);return n}catch(s){return`
|
|
47
|
-
Error generating stack: `+s.message+`
|
|
48
|
-
`+s.stack}}var jt=Object.prototype.hasOwnProperty,$t=t.unstable_scheduleCallback,ct=t.unstable_cancelCallback,Dt=t.unstable_shouldYield,on=t.unstable_requestPaint,gt=t.unstable_now,Pt=t.unstable_getCurrentPriorityLevel,re=t.unstable_ImmediatePriority,ye=t.unstable_UserBlockingPriority,_e=t.unstable_NormalPriority,me=t.unstable_LowPriority,be=t.unstable_IdlePriority,ot=t.log,bt=t.unstable_setDisableYieldValue,Ze=null,de=null;function Oe(e){if(typeof ot=="function"&&bt(e),de&&typeof de.setStrictMode=="function")try{de.setStrictMode(Ze,e)}catch{}}var ut=Math.clz32?Math.clz32:ai,kn=Math.log,an=Math.LN2;function ai(e){return e>>>=0,e===0?32:31-(kn(e)/an|0)|0}var tl=256,nl=262144,ll=4194304;function hl(e){var n=e&42;if(n!==0)return n;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function al(e,n,r){var s=e.pendingLanes;if(s===0)return 0;var d=0,x=e.suspendedLanes,w=e.pingedLanes;e=e.warmLanes;var N=s&134217727;return N!==0?(s=N&~x,s!==0?d=hl(s):(w&=N,w!==0?d=hl(w):r||(r=N&~e,r!==0&&(d=hl(r))))):(N=s&~x,N!==0?d=hl(N):w!==0?d=hl(w):r||(r=s&~e,r!==0&&(d=hl(r)))),d===0?0:n!==0&&n!==d&&(n&x)===0&&(x=d&-d,r=n&-n,x>=r||x===32&&(r&4194048)!==0)?n:d}function Jl(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function As(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function cr(){var e=ll;return ll<<=1,(ll&62914560)===0&&(ll=4194304),e}function ur(e){for(var n=[],r=0;31>r;r++)n.push(e);return n}function Mn(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ri(e,n,r,s,d,x){var w=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var N=e.entanglements,R=e.expirationTimes,W=e.hiddenUpdates;for(r=w&~r;0<r;){var oe=31-ut(r),fe=1<<oe;N[oe]=0,R[oe]=-1;var J=W[oe];if(J!==null)for(W[oe]=null,oe=0;oe<J.length;oe++){var le=J[oe];le!==null&&(le.lane&=-536870913)}r&=~fe}s!==0&&ii(e,s,0),x!==0&&d===0&&e.tag!==0&&(e.suspendedLanes|=x&~(w&~n))}function ii(e,n,r){e.pendingLanes|=n,e.suspendedLanes&=~n;var s=31-ut(n);e.entangledLanes|=n,e.entanglements[s]=e.entanglements[s]|1073741824|r&261930}function si(e,n){var r=e.entangledLanes|=n;for(e=e.entanglements;r;){var s=31-ut(r),d=1<<s;d&n|e[s]&n&&(e[s]|=n),r&=~d}}function Ds(e,n){var r=n&-n;return r=(r&42)!==0?1:Ra(r),(r&(e.suspendedLanes|n))!==0?0:r}function Ra(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Sn(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Al(){var e=Q.p;return e!==0?e:(e=window.event,e===void 0?32:Ip(e.type))}function Pl(e,n){var r=Q.p;try{return Q.p=e,n()}finally{Q.p=r}}var ml=Math.random().toString(36).slice(2),Ht="__reactFiber$"+ml,vt="__reactProps$"+ml,rl="__reactContainer$"+ml,_n="__reactEvents$"+ml,Ts="__reactListeners$"+ml,oi="__reactHandles$"+ml,zs="__reactResources$"+ml,il="__reactMarker$"+ml;function ci(e){delete e[Ht],delete e[vt],delete e[_n],delete e[Ts],delete e[oi]}function Ot(e){var n=e[Ht];if(n)return n;for(var r=e.parentNode;r;){if(n=r[rl]||r[Ht]){if(r=n.alternate,n.child!==null||r!==null&&r.child!==null)for(e=Cp(e);e!==null;){if(r=e[Ht])return r;e=Cp(e)}return n}e=r,r=e.parentNode}return null}function ea(e){if(e=e[Ht]||e[rl]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Oa(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(i(33))}function Dl(e){var n=e[zs];return n||(n=e[zs]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Ut(e){e[il]=!0}var Ms=new Set,_s={};function xl(e,n){ta(e,n),ta(e+"Capture",n)}function ta(e,n){for(_s[e]=n,e=0;e<n.length;e++)Ms.add(n[e])}var Ac=RegExp("^[: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]*$"),Fs={},Rs={};function Dc(e){return jt.call(Rs,e)?!0:jt.call(Fs,e)?!1:Ac.test(e)?Rs[e]=!0:(Fs[e]=!0,!1)}function fr(e,n,r){if(Dc(n))if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var s=n.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+r)}}function dr(e,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+r)}}function rn(e,n,r,s){if(s===null)e.removeAttribute(r);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttributeNS(n,r,""+s)}}function yn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Os(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Tc(e,n,r){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var d=s.get,x=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return d.call(this)},set:function(w){r=""+w,x.call(this,w)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return r},setValue:function(w){r=""+w},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function Xn(e){if(!e._valueTracker){var n=Os(e)?"checked":"value";e._valueTracker=Tc(e,n,""+e[n])}}function ui(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var r=n.getValue(),s="";return e&&(s=Os(e)?e.checked?"true":"false":e.value),e=s,e!==r?(n.setValue(e),!0):!1}function hr(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}}var zc=/[\n"\\]/g;function wt(e){return e.replace(zc,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Tl(e,n,r,s,d,x,w,N){e.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.type=w:e.removeAttribute("type"),n!=null?w==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+yn(n)):e.value!==""+yn(n)&&(e.value=""+yn(n)):w!=="submit"&&w!=="reset"||e.removeAttribute("value"),n!=null?mr(e,w,yn(n)):r!=null?mr(e,w,yn(r)):s!=null&&e.removeAttribute("value"),d==null&&x!=null&&(e.defaultChecked=!!x),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+yn(N):e.removeAttribute("name")}function fi(e,n,r,s,d,x,w,N){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.type=x),n!=null||r!=null){if(!(x!=="submit"&&x!=="reset"||n!=null)){Xn(e);return}r=r!=null?""+yn(r):"",n=n!=null?""+yn(n):r,N||n===e.value||(e.value=n),e.defaultValue=n}s=s??d,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=N?e.checked:!!s,e.defaultChecked=!!s,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(e.name=w),Xn(e)}function mr(e,n,r){n==="number"&&hr(e.ownerDocument)===e||e.defaultValue===""+r||(e.defaultValue=""+r)}function zl(e,n,r,s){if(e=e.options,n){n={};for(var d=0;d<r.length;d++)n["$"+r[d]]=!0;for(r=0;r<e.length;r++)d=n.hasOwnProperty("$"+e[r].value),e[r].selected!==d&&(e[r].selected=d),d&&s&&(e[r].defaultSelected=!0)}else{for(r=""+yn(r),n=null,d=0;d<e.length;d++){if(e[d].value===r){e[d].selected=!0,s&&(e[d].defaultSelected=!0);return}n!==null||e[d].disabled||(n=e[d])}n!==null&&(n.selected=!0)}}function H(e,n,r){if(n!=null&&(n=""+yn(n),n!==e.value&&(e.value=n),r==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=r!=null?""+yn(r):""}function he(e,n,r,s){if(n==null){if(s!=null){if(r!=null)throw Error(i(92));if(X(s)){if(1<s.length)throw Error(i(93));s=s[0]}r=s}r==null&&(r=""),n=r}r=yn(n),e.defaultValue=r,s=e.textContent,s===r&&s!==""&&s!==null&&(e.value=s),Xn(e)}function ke(e,n){if(n){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=n;return}}e.textContent=n}var Ne=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Ee(e,n,r){var s=n.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?s?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":s?e.setProperty(n,r):typeof r!="number"||r===0||Ne.has(n)?n==="float"?e.cssFloat=r:e[n]=(""+r).trim():e[n]=r+"px"}function $e(e,n,r){if(n!=null&&typeof n!="object")throw Error(i(62));if(e=e.style,r!=null){for(var s in r)!r.hasOwnProperty(s)||n!=null&&n.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var d in n)s=n[d],n.hasOwnProperty(d)&&r[d]!==s&&Ee(e,d,s)}else for(var x in n)n.hasOwnProperty(x)&&Ee(e,x,n[x])}function Ie(e){if(e.indexOf("-")===-1)return!1;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 nt=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),ft=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function qe(e){return ft.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function yt(){}var Mc=null;function _c(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var xr=null,pr=null;function yh(e){var n=ea(e);if(n&&(e=n.stateNode)){var r=e[vt]||null;e:switch(e=n.stateNode,n.type){case"input":if(Tl(e,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),n=r.name,r.type==="radio"&&n!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+wt(""+n)+'"][type="radio"]'),n=0;n<r.length;n++){var s=r[n];if(s!==e&&s.form===e.form){var d=s[vt]||null;if(!d)throw Error(i(90));Tl(s,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(n=0;n<r.length;n++)s=r[n],s.form===e.form&&ui(s)}break e;case"textarea":H(e,r.value,r.defaultValue);break e;case"select":n=r.value,n!=null&&zl(e,!!r.multiple,n,!1)}}}var Fc=!1;function gh(e,n,r){if(Fc)return e(n,r);Fc=!0;try{var s=e(n);return s}finally{if(Fc=!1,(xr!==null||pr!==null)&&(jo(),xr&&(n=xr,e=pr,pr=xr=null,yh(n),e)))for(n=0;n<e.length;n++)yh(e[n])}}function di(e,n){var r=e.stateNode;if(r===null)return null;var s=r[vt]||null;if(s===null)return null;r=s[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(i(231,n,typeof r));return r}var Ml=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Rc=!1;if(Ml)try{var hi={};Object.defineProperty(hi,"passive",{get:function(){Rc=!0}}),window.addEventListener("test",hi,hi),window.removeEventListener("test",hi,hi)}catch{Rc=!1}var na=null,Oc=null,Bs=null;function bh(){if(Bs)return Bs;var e,n=Oc,r=n.length,s,d="value"in na?na.value:na.textContent,x=d.length;for(e=0;e<r&&n[e]===d[e];e++);var w=r-e;for(s=1;s<=w&&n[r-s]===d[x-s];s++);return Bs=d.slice(e,1<s?1-s:void 0)}function $s(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Ls(){return!0}function vh(){return!1}function jn(e){function n(r,s,d,x,w){this._reactName=r,this._targetInst=d,this.type=s,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(r=e[N],this[N]=r?r(x):x[N]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Ls:vh,this.isPropagationStopped=vh,this}return y(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Ls)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Ls)},persist:function(){},isPersistent:Ls}),n}var Ba={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hs=jn(Ba),mi=y({},Ba,{view:0,detail:0}),wg=jn(mi),Bc,$c,xi,Us=y({},mi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Hc,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!==xi&&(xi&&e.type==="mousemove"?(Bc=e.screenX-xi.screenX,$c=e.screenY-xi.screenY):$c=Bc=0,xi=e),Bc)},movementY:function(e){return"movementY"in e?e.movementY:$c}}),wh=jn(Us),kg=y({},Us,{dataTransfer:0}),Sg=jn(kg),jg=y({},mi,{relatedTarget:0}),Lc=jn(jg),Eg=y({},Ba,{animationName:0,elapsedTime:0,pseudoElement:0}),Cg=jn(Eg),Ng=y({},Ba,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ag=jn(Ng),Dg=y({},Ba,{data:0}),kh=jn(Dg),Tg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},zg={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"},Mg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _g(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Mg[e])?!!n[e]:!1}function Hc(){return _g}var Fg=y({},mi,{key:function(e){if(e.key){var n=Tg[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=$s(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?zg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Hc,charCode:function(e){return e.type==="keypress"?$s(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?$s(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Rg=jn(Fg),Og=y({},Us,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Sh=jn(Og),Bg=y({},mi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Hc}),$g=jn(Bg),Lg=y({},Ba,{propertyName:0,elapsedTime:0,pseudoElement:0}),Hg=jn(Lg),Ug=y({},Us,{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}),Ig=jn(Ug),Yg=y({},Ba,{newState:0,oldState:0}),qg=jn(Yg),Xg=[9,13,27,32],Uc=Ml&&"CompositionEvent"in window,pi=null;Ml&&"documentMode"in document&&(pi=document.documentMode);var Vg=Ml&&"TextEvent"in window&&!pi,jh=Ml&&(!Uc||pi&&8<pi&&11>=pi),Eh=" ",Ch=!1;function Nh(e,n){switch(e){case"keyup":return Xg.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ah(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var yr=!1;function Gg(e,n){switch(e){case"compositionend":return Ah(n);case"keypress":return n.which!==32?null:(Ch=!0,Eh);case"textInput":return e=n.data,e===Eh&&Ch?null:e;default:return null}}function Kg(e,n){if(yr)return e==="compositionend"||!Uc&&Nh(e,n)?(e=bh(),Bs=Oc=na=null,yr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return jh&&n.locale!=="ko"?null:n.data;default:return null}}var Qg={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 Dh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Qg[e.type]:n==="textarea"}function Th(e,n,r,s){xr?pr?pr.push(s):pr=[s]:xr=s,n=zo(n,"onChange"),0<n.length&&(r=new Hs("onChange","change",null,r,s),e.push({event:r,listeners:n}))}var yi=null,gi=null;function Zg(e){dp(e,0)}function Is(e){var n=Oa(e);if(ui(n))return e}function zh(e,n){if(e==="change")return n}var Mh=!1;if(Ml){var Ic;if(Ml){var Yc="oninput"in document;if(!Yc){var _h=document.createElement("div");_h.setAttribute("oninput","return;"),Yc=typeof _h.oninput=="function"}Ic=Yc}else Ic=!1;Mh=Ic&&(!document.documentMode||9<document.documentMode)}function Fh(){yi&&(yi.detachEvent("onpropertychange",Rh),gi=yi=null)}function Rh(e){if(e.propertyName==="value"&&Is(gi)){var n=[];Th(n,gi,e,_c(e)),gh(Zg,n)}}function Wg(e,n,r){e==="focusin"?(Fh(),yi=n,gi=r,yi.attachEvent("onpropertychange",Rh)):e==="focusout"&&Fh()}function Jg(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Is(gi)}function Pg(e,n){if(e==="click")return Is(n)}function e2(e,n){if(e==="input"||e==="change")return Is(n)}function t2(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Fn=typeof Object.is=="function"?Object.is:t2;function bi(e,n){if(Fn(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var r=Object.keys(e),s=Object.keys(n);if(r.length!==s.length)return!1;for(s=0;s<r.length;s++){var d=r[s];if(!jt.call(n,d)||!Fn(e[d],n[d]))return!1}return!0}function Oh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Bh(e,n){var r=Oh(e);e=0;for(var s;r;){if(r.nodeType===3){if(s=e+r.textContent.length,e<=n&&s>=n)return{node:r,offset:n-e};e=s}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Oh(r)}}function $h(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?$h(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Lh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=hr(e.document);n instanceof e.HTMLIFrameElement;){try{var r=typeof n.contentWindow.location.href=="string"}catch{r=!1}if(r)e=n.contentWindow;else break;n=hr(e.document)}return n}function qc(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var n2=Ml&&"documentMode"in document&&11>=document.documentMode,gr=null,Xc=null,vi=null,Vc=!1;function Hh(e,n,r){var s=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Vc||gr==null||gr!==hr(s)||(s=gr,"selectionStart"in s&&qc(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),vi&&bi(vi,s)||(vi=s,s=zo(Xc,"onSelect"),0<s.length&&(n=new Hs("onSelect","select",null,n,r),e.push({event:n,listeners:s}),n.target=gr)))}function $a(e,n){var r={};return r[e.toLowerCase()]=n.toLowerCase(),r["Webkit"+e]="webkit"+n,r["Moz"+e]="moz"+n,r}var br={animationend:$a("Animation","AnimationEnd"),animationiteration:$a("Animation","AnimationIteration"),animationstart:$a("Animation","AnimationStart"),transitionrun:$a("Transition","TransitionRun"),transitionstart:$a("Transition","TransitionStart"),transitioncancel:$a("Transition","TransitionCancel"),transitionend:$a("Transition","TransitionEnd")},Gc={},Uh={};Ml&&(Uh=document.createElement("div").style,"AnimationEvent"in window||(delete br.animationend.animation,delete br.animationiteration.animation,delete br.animationstart.animation),"TransitionEvent"in window||delete br.transitionend.transition);function La(e){if(Gc[e])return Gc[e];if(!br[e])return e;var n=br[e],r;for(r in n)if(n.hasOwnProperty(r)&&r in Uh)return Gc[e]=n[r];return e}var Ih=La("animationend"),Yh=La("animationiteration"),qh=La("animationstart"),l2=La("transitionrun"),a2=La("transitionstart"),r2=La("transitioncancel"),Xh=La("transitionend"),Vh=new Map,Kc="abort auxClick beforeToggle 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(" ");Kc.push("scrollEnd");function sl(e,n){Vh.set(e,n),xl(n,[e])}var Ys=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Vn=[],vr=0,Qc=0;function qs(){for(var e=vr,n=Qc=vr=0;n<e;){var r=Vn[n];Vn[n++]=null;var s=Vn[n];Vn[n++]=null;var d=Vn[n];Vn[n++]=null;var x=Vn[n];if(Vn[n++]=null,s!==null&&d!==null){var w=s.pending;w===null?d.next=d:(d.next=w.next,w.next=d),s.pending=d}x!==0&&Gh(r,d,x)}}function Xs(e,n,r,s){Vn[vr++]=e,Vn[vr++]=n,Vn[vr++]=r,Vn[vr++]=s,Qc|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Zc(e,n,r,s){return Xs(e,n,r,s),Vs(e)}function Ha(e,n){return Xs(e,null,null,n),Vs(e)}function Gh(e,n,r){e.lanes|=r;var s=e.alternate;s!==null&&(s.lanes|=r);for(var d=!1,x=e.return;x!==null;)x.childLanes|=r,s=x.alternate,s!==null&&(s.childLanes|=r),x.tag===22&&(e=x.stateNode,e===null||e._visibility&1||(d=!0)),e=x,x=x.return;return e.tag===3?(x=e.stateNode,d&&n!==null&&(d=31-ut(r),e=x.hiddenUpdates,s=e[d],s===null?e[d]=[n]:s.push(n),n.lane=r|536870912),x):null}function Vs(e){if(50<Ii)throw Ii=0,rf=null,Error(i(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var wr={};function i2(e,n,r,s){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Rn(e,n,r,s){return new i2(e,n,r,s)}function Wc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _l(e,n){var r=e.alternate;return r===null?(r=Rn(e.tag,n,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=n,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,n=e.dependencies,r.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function Kh(e,n){e.flags&=65011714;var r=e.alternate;return r===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=r.childLanes,e.lanes=r.lanes,e.child=r.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=r.memoizedProps,e.memoizedState=r.memoizedState,e.updateQueue=r.updateQueue,e.type=r.type,n=r.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Gs(e,n,r,s,d,x){var w=0;if(s=e,typeof e=="function")Wc(e)&&(w=1);else if(typeof e=="string")w=fb(e,r,pe.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case te:return e=Rn(31,r,n,d),e.elementType=te,e.lanes=x,e;case k:return Ua(r.children,d,x,n);case C:w=8,d|=24;break;case E:return e=Rn(12,r,n,d|2),e.elementType=E,e.lanes=x,e;case B:return e=Rn(13,r,n,d),e.elementType=B,e.lanes=x,e;case T:return e=Rn(19,r,n,d),e.elementType=T,e.lanes=x,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case $:w=10;break e;case M:w=9;break e;case O:w=11;break e;case Y:w=14;break e;case V:w=16,s=null;break e}w=29,r=Error(i(130,e===null?"null":typeof e,"")),s=null}return n=Rn(w,r,n,d),n.elementType=e,n.type=s,n.lanes=x,n}function Ua(e,n,r,s){return e=Rn(7,e,s,n),e.lanes=r,e}function Jc(e,n,r){return e=Rn(6,e,null,n),e.lanes=r,e}function Qh(e){var n=Rn(18,null,null,0);return n.stateNode=e,n}function Pc(e,n,r){return n=Rn(4,e.children!==null?e.children:[],e.key,n),n.lanes=r,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Zh=new WeakMap;function Gn(e,n){if(typeof e=="object"&&e!==null){var r=Zh.get(e);return r!==void 0?r:(n={value:e,source:n,stack:Ve(n)},Zh.set(e,n),n)}return{value:e,source:n,stack:Ve(n)}}var kr=[],Sr=0,Ks=null,wi=0,Kn=[],Qn=0,la=null,pl=1,yl="";function Fl(e,n){kr[Sr++]=wi,kr[Sr++]=Ks,Ks=e,wi=n}function Wh(e,n,r){Kn[Qn++]=pl,Kn[Qn++]=yl,Kn[Qn++]=la,la=e;var s=pl;e=yl;var d=32-ut(s)-1;s&=~(1<<d),r+=1;var x=32-ut(n)+d;if(30<x){var w=d-d%5;x=(s&(1<<w)-1).toString(32),s>>=w,d-=w,pl=1<<32-ut(n)+d|r<<d|s,yl=x+e}else pl=1<<x|r<<d|s,yl=e}function eu(e){e.return!==null&&(Fl(e,1),Wh(e,1,0))}function tu(e){for(;e===Ks;)Ks=kr[--Sr],kr[Sr]=null,wi=kr[--Sr],kr[Sr]=null;for(;e===la;)la=Kn[--Qn],Kn[Qn]=null,yl=Kn[--Qn],Kn[Qn]=null,pl=Kn[--Qn],Kn[Qn]=null}function Jh(e,n){Kn[Qn++]=pl,Kn[Qn++]=yl,Kn[Qn++]=la,pl=n.id,yl=n.overflow,la=e}var cn=null,_t=null,it=!1,aa=null,Zn=!1,nu=Error(i(519));function ra(e){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ki(Gn(n,e)),nu}function Ph(e){var n=e.stateNode,r=e.type,s=e.memoizedProps;switch(n[Ht]=e,n[vt]=s,r){case"dialog":et("cancel",n),et("close",n);break;case"iframe":case"object":case"embed":et("load",n);break;case"video":case"audio":for(r=0;r<qi.length;r++)et(qi[r],n);break;case"source":et("error",n);break;case"img":case"image":case"link":et("error",n),et("load",n);break;case"details":et("toggle",n);break;case"input":et("invalid",n),fi(n,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":et("invalid",n);break;case"textarea":et("invalid",n),he(n,s.value,s.defaultValue,s.children)}r=s.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||n.textContent===""+r||s.suppressHydrationWarning===!0||pp(n.textContent,r)?(s.popover!=null&&(et("beforetoggle",n),et("toggle",n)),s.onScroll!=null&&et("scroll",n),s.onScrollEnd!=null&&et("scrollend",n),s.onClick!=null&&(n.onclick=yt),n=!0):n=!1,n||ra(e,!0)}function em(e){for(cn=e.return;cn;)switch(cn.tag){case 5:case 31:case 13:Zn=!1;return;case 27:case 3:Zn=!0;return;default:cn=cn.return}}function jr(e){if(e!==cn)return!1;if(!it)return em(e),it=!0,!1;var n=e.tag,r;if((r=n!==3&&n!==27)&&((r=n===5)&&(r=e.type,r=!(r!=="form"&&r!=="button")||wf(e.type,e.memoizedProps)),r=!r),r&&_t&&ra(e),em(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));_t=Ep(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));_t=Ep(e)}else n===27?(n=_t,ba(e.type)?(e=Cf,Cf=null,_t=e):_t=n):_t=cn?Jn(e.stateNode.nextSibling):null;return!0}function Ia(){_t=cn=null,it=!1}function lu(){var e=aa;return e!==null&&(An===null?An=e:An.push.apply(An,e),aa=null),e}function ki(e){aa===null?aa=[e]:aa.push(e)}var au=_(null),Ya=null,Rl=null;function ia(e,n,r){A(au,n._currentValue),n._currentValue=r}function Ol(e){e._currentValue=au.current,P(au)}function ru(e,n,r){for(;e!==null;){var s=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,s!==null&&(s.childLanes|=n)):s!==null&&(s.childLanes&n)!==n&&(s.childLanes|=n),e===r)break;e=e.return}}function iu(e,n,r,s){var d=e.child;for(d!==null&&(d.return=e);d!==null;){var x=d.dependencies;if(x!==null){var w=d.child;x=x.firstContext;e:for(;x!==null;){var N=x;x=d;for(var R=0;R<n.length;R++)if(N.context===n[R]){x.lanes|=r,N=x.alternate,N!==null&&(N.lanes|=r),ru(x.return,r,e),s||(w=null);break e}x=N.next}}else if(d.tag===18){if(w=d.return,w===null)throw Error(i(341));w.lanes|=r,x=w.alternate,x!==null&&(x.lanes|=r),ru(w,r,e),w=null}else w=d.child;if(w!==null)w.return=d;else for(w=d;w!==null;){if(w===e){w=null;break}if(d=w.sibling,d!==null){d.return=w.return,w=d;break}w=w.return}d=w}}function Er(e,n,r,s){e=null;for(var d=n,x=!1;d!==null;){if(!x){if((d.flags&524288)!==0)x=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var w=d.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var N=d.type;Fn(d.pendingProps.value,w.value)||(e!==null?e.push(N):e=[N])}}else if(d===Fe.current){if(w=d.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(e!==null?e.push(Qi):e=[Qi])}d=d.return}e!==null&&iu(n,e,r,s),n.flags|=262144}function Qs(e){for(e=e.firstContext;e!==null;){if(!Fn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function qa(e){Ya=e,Rl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function un(e){return tm(Ya,e)}function Zs(e,n){return Ya===null&&qa(e),tm(e,n)}function tm(e,n){var r=n._currentValue;if(n={context:n,memoizedValue:r,next:null},Rl===null){if(e===null)throw Error(i(308));Rl=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Rl=Rl.next=n;return r}var s2=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(r,s){e.push(s)}};this.abort=function(){n.aborted=!0,e.forEach(function(r){return r()})}},o2=t.unstable_scheduleCallback,c2=t.unstable_NormalPriority,Kt={$$typeof:$,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function su(){return{controller:new s2,data:new Map,refCount:0}}function Si(e){e.refCount--,e.refCount===0&&o2(c2,function(){e.controller.abort()})}var ji=null,ou=0,Cr=0,Nr=null;function u2(e,n){if(ji===null){var r=ji=[];ou=0,Cr=df(),Nr={status:"pending",value:void 0,then:function(s){r.push(s)}}}return ou++,n.then(nm,nm),n}function nm(){if(--ou===0&&ji!==null){Nr!==null&&(Nr.status="fulfilled");var e=ji;ji=null,Cr=0,Nr=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function f2(e,n){var r=[],s={status:"pending",value:null,reason:null,then:function(d){r.push(d)}};return e.then(function(){s.status="fulfilled",s.value=n;for(var d=0;d<r.length;d++)(0,r[d])(n)},function(d){for(s.status="rejected",s.reason=d,d=0;d<r.length;d++)(0,r[d])(void 0)}),s}var lm=U.S;U.S=function(e,n){Hx=gt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&u2(e,n),lm!==null&&lm(e,n)};var Xa=_(null);function cu(){var e=Xa.current;return e!==null?e:Tt.pooledCache}function Ws(e,n){n===null?A(Xa,Xa.current):A(Xa,n.pool)}function am(){var e=cu();return e===null?null:{parent:Kt._currentValue,pool:e}}var Ar=Error(i(460)),uu=Error(i(474)),Js=Error(i(542)),Ps={then:function(){}};function rm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function im(e,n,r){switch(r=e[r],r===void 0?e.push(n):r!==n&&(n.then(yt,yt),n=r),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,om(e),e;default:if(typeof n.status=="string")n.then(yt,yt);else{if(e=Tt,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=n,e.status="pending",e.then(function(s){if(n.status==="pending"){var d=n;d.status="fulfilled",d.value=s}},function(s){if(n.status==="pending"){var d=n;d.status="rejected",d.reason=s}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,om(e),e}throw Ga=n,Ar}}function Va(e){try{var n=e._init;return n(e._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Ga=r,Ar):r}}var Ga=null;function sm(){if(Ga===null)throw Error(i(459));var e=Ga;return Ga=null,e}function om(e){if(e===Ar||e===Js)throw Error(i(483))}var Dr=null,Ei=0;function eo(e){var n=Ei;return Ei+=1,Dr===null&&(Dr=[]),im(Dr,e,n)}function Ci(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function to(e,n){throw n.$$typeof===b?Error(i(525)):(e=Object.prototype.toString.call(n),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function cm(e){function n(G,q){if(e){var Z=G.deletions;Z===null?(G.deletions=[q],G.flags|=16):Z.push(q)}}function r(G,q){if(!e)return null;for(;q!==null;)n(G,q),q=q.sibling;return null}function s(G){for(var q=new Map;G!==null;)G.key!==null?q.set(G.key,G):q.set(G.index,G),G=G.sibling;return q}function d(G,q){return G=_l(G,q),G.index=0,G.sibling=null,G}function x(G,q,Z){return G.index=Z,e?(Z=G.alternate,Z!==null?(Z=Z.index,Z<q?(G.flags|=67108866,q):Z):(G.flags|=67108866,q)):(G.flags|=1048576,q)}function w(G){return e&&G.alternate===null&&(G.flags|=67108866),G}function N(G,q,Z,ce){return q===null||q.tag!==6?(q=Jc(Z,G.mode,ce),q.return=G,q):(q=d(q,Z),q.return=G,q)}function R(G,q,Z,ce){var Be=Z.type;return Be===k?oe(G,q,Z.props.children,ce,Z.key):q!==null&&(q.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===V&&Va(Be)===q.type)?(q=d(q,Z.props),Ci(q,Z),q.return=G,q):(q=Gs(Z.type,Z.key,Z.props,null,G.mode,ce),Ci(q,Z),q.return=G,q)}function W(G,q,Z,ce){return q===null||q.tag!==4||q.stateNode.containerInfo!==Z.containerInfo||q.stateNode.implementation!==Z.implementation?(q=Pc(Z,G.mode,ce),q.return=G,q):(q=d(q,Z.children||[]),q.return=G,q)}function oe(G,q,Z,ce,Be){return q===null||q.tag!==7?(q=Ua(Z,G.mode,ce,Be),q.return=G,q):(q=d(q,Z),q.return=G,q)}function fe(G,q,Z){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Jc(""+q,G.mode,Z),q.return=G,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case v:return Z=Gs(q.type,q.key,q.props,null,G.mode,Z),Ci(Z,q),Z.return=G,Z;case S:return q=Pc(q,G.mode,Z),q.return=G,q;case V:return q=Va(q),fe(G,q,Z)}if(X(q)||L(q))return q=Ua(q,G.mode,Z,null),q.return=G,q;if(typeof q.then=="function")return fe(G,eo(q),Z);if(q.$$typeof===$)return fe(G,Zs(G,q),Z);to(G,q)}return null}function J(G,q,Z,ce){var Be=q!==null?q.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Be!==null?null:N(G,q,""+Z,ce);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case v:return Z.key===Be?R(G,q,Z,ce):null;case S:return Z.key===Be?W(G,q,Z,ce):null;case V:return Z=Va(Z),J(G,q,Z,ce)}if(X(Z)||L(Z))return Be!==null?null:oe(G,q,Z,ce,null);if(typeof Z.then=="function")return J(G,q,eo(Z),ce);if(Z.$$typeof===$)return J(G,q,Zs(G,Z),ce);to(G,Z)}return null}function le(G,q,Z,ce,Be){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return G=G.get(Z)||null,N(q,G,""+ce,Be);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case v:return G=G.get(ce.key===null?Z:ce.key)||null,R(q,G,ce,Be);case S:return G=G.get(ce.key===null?Z:ce.key)||null,W(q,G,ce,Be);case V:return ce=Va(ce),le(G,q,Z,ce,Be)}if(X(ce)||L(ce))return G=G.get(Z)||null,oe(q,G,ce,Be,null);if(typeof ce.then=="function")return le(G,q,Z,eo(ce),Be);if(ce.$$typeof===$)return le(G,q,Z,Zs(q,ce),Be);to(q,ce)}return null}function De(G,q,Z,ce){for(var Be=null,dt=null,ze=q,Ke=q=0,at=null;ze!==null&&Ke<Z.length;Ke++){ze.index>Ke?(at=ze,ze=null):at=ze.sibling;var ht=J(G,ze,Z[Ke],ce);if(ht===null){ze===null&&(ze=at);break}e&&ze&&ht.alternate===null&&n(G,ze),q=x(ht,q,Ke),dt===null?Be=ht:dt.sibling=ht,dt=ht,ze=at}if(Ke===Z.length)return r(G,ze),it&&Fl(G,Ke),Be;if(ze===null){for(;Ke<Z.length;Ke++)ze=fe(G,Z[Ke],ce),ze!==null&&(q=x(ze,q,Ke),dt===null?Be=ze:dt.sibling=ze,dt=ze);return it&&Fl(G,Ke),Be}for(ze=s(ze);Ke<Z.length;Ke++)at=le(ze,G,Ke,Z[Ke],ce),at!==null&&(e&&at.alternate!==null&&ze.delete(at.key===null?Ke:at.key),q=x(at,q,Ke),dt===null?Be=at:dt.sibling=at,dt=at);return e&&ze.forEach(function(ja){return n(G,ja)}),it&&Fl(G,Ke),Be}function He(G,q,Z,ce){if(Z==null)throw Error(i(151));for(var Be=null,dt=null,ze=q,Ke=q=0,at=null,ht=Z.next();ze!==null&&!ht.done;Ke++,ht=Z.next()){ze.index>Ke?(at=ze,ze=null):at=ze.sibling;var ja=J(G,ze,ht.value,ce);if(ja===null){ze===null&&(ze=at);break}e&&ze&&ja.alternate===null&&n(G,ze),q=x(ja,q,Ke),dt===null?Be=ja:dt.sibling=ja,dt=ja,ze=at}if(ht.done)return r(G,ze),it&&Fl(G,Ke),Be;if(ze===null){for(;!ht.done;Ke++,ht=Z.next())ht=fe(G,ht.value,ce),ht!==null&&(q=x(ht,q,Ke),dt===null?Be=ht:dt.sibling=ht,dt=ht);return it&&Fl(G,Ke),Be}for(ze=s(ze);!ht.done;Ke++,ht=Z.next())ht=le(ze,G,Ke,ht.value,ce),ht!==null&&(e&&ht.alternate!==null&&ze.delete(ht.key===null?Ke:ht.key),q=x(ht,q,Ke),dt===null?Be=ht:dt.sibling=ht,dt=ht);return e&&ze.forEach(function(kb){return n(G,kb)}),it&&Fl(G,Ke),Be}function Nt(G,q,Z,ce){if(typeof Z=="object"&&Z!==null&&Z.type===k&&Z.key===null&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case v:e:{for(var Be=Z.key;q!==null;){if(q.key===Be){if(Be=Z.type,Be===k){if(q.tag===7){r(G,q.sibling),ce=d(q,Z.props.children),ce.return=G,G=ce;break e}}else if(q.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===V&&Va(Be)===q.type){r(G,q.sibling),ce=d(q,Z.props),Ci(ce,Z),ce.return=G,G=ce;break e}r(G,q);break}else n(G,q);q=q.sibling}Z.type===k?(ce=Ua(Z.props.children,G.mode,ce,Z.key),ce.return=G,G=ce):(ce=Gs(Z.type,Z.key,Z.props,null,G.mode,ce),Ci(ce,Z),ce.return=G,G=ce)}return w(G);case S:e:{for(Be=Z.key;q!==null;){if(q.key===Be)if(q.tag===4&&q.stateNode.containerInfo===Z.containerInfo&&q.stateNode.implementation===Z.implementation){r(G,q.sibling),ce=d(q,Z.children||[]),ce.return=G,G=ce;break e}else{r(G,q);break}else n(G,q);q=q.sibling}ce=Pc(Z,G.mode,ce),ce.return=G,G=ce}return w(G);case V:return Z=Va(Z),Nt(G,q,Z,ce)}if(X(Z))return De(G,q,Z,ce);if(L(Z)){if(Be=L(Z),typeof Be!="function")throw Error(i(150));return Z=Be.call(Z),He(G,q,Z,ce)}if(typeof Z.then=="function")return Nt(G,q,eo(Z),ce);if(Z.$$typeof===$)return Nt(G,q,Zs(G,Z),ce);to(G,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,q!==null&&q.tag===6?(r(G,q.sibling),ce=d(q,Z),ce.return=G,G=ce):(r(G,q),ce=Jc(Z,G.mode,ce),ce.return=G,G=ce),w(G)):r(G,q)}return function(G,q,Z,ce){try{Ei=0;var Be=Nt(G,q,Z,ce);return Dr=null,Be}catch(ze){if(ze===Ar||ze===Js)throw ze;var dt=Rn(29,ze,null,G.mode);return dt.lanes=ce,dt.return=G,dt}finally{}}}var Ka=cm(!0),um=cm(!1),sa=!1;function fu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function du(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function oa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ca(e,n,r){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(xt&2)!==0){var d=s.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),s.pending=n,n=Vs(e),Gh(e,null,r),n}return Xs(e,s,n,r),Vs(e)}function Ni(e,n,r){if(n=n.updateQueue,n!==null&&(n=n.shared,(r&4194048)!==0)){var s=n.lanes;s&=e.pendingLanes,r|=s,n.lanes=r,si(e,r)}}function hu(e,n){var r=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,r===s)){var d=null,x=null;if(r=r.firstBaseUpdate,r!==null){do{var w={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};x===null?d=x=w:x=x.next=w,r=r.next}while(r!==null);x===null?d=x=n:x=x.next=n}else d=x=n;r={baseState:s.baseState,firstBaseUpdate:d,lastBaseUpdate:x,shared:s.shared,callbacks:s.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=n:e.next=n,r.lastBaseUpdate=n}var mu=!1;function Ai(){if(mu){var e=Nr;if(e!==null)throw e}}function Di(e,n,r,s){mu=!1;var d=e.updateQueue;sa=!1;var x=d.firstBaseUpdate,w=d.lastBaseUpdate,N=d.shared.pending;if(N!==null){d.shared.pending=null;var R=N,W=R.next;R.next=null,w===null?x=W:w.next=W,w=R;var oe=e.alternate;oe!==null&&(oe=oe.updateQueue,N=oe.lastBaseUpdate,N!==w&&(N===null?oe.firstBaseUpdate=W:N.next=W,oe.lastBaseUpdate=R))}if(x!==null){var fe=d.baseState;w=0,oe=W=R=null,N=x;do{var J=N.lane&-536870913,le=J!==N.lane;if(le?(lt&J)===J:(s&J)===J){J!==0&&J===Cr&&(mu=!0),oe!==null&&(oe=oe.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var De=e,He=N;J=n;var Nt=r;switch(He.tag){case 1:if(De=He.payload,typeof De=="function"){fe=De.call(Nt,fe,J);break e}fe=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=He.payload,J=typeof De=="function"?De.call(Nt,fe,J):De,J==null)break e;fe=y({},fe,J);break e;case 2:sa=!0}}J=N.callback,J!==null&&(e.flags|=64,le&&(e.flags|=8192),le=d.callbacks,le===null?d.callbacks=[J]:le.push(J))}else le={lane:J,tag:N.tag,payload:N.payload,callback:N.callback,next:null},oe===null?(W=oe=le,R=fe):oe=oe.next=le,w|=J;if(N=N.next,N===null){if(N=d.shared.pending,N===null)break;le=N,N=le.next,le.next=null,d.lastBaseUpdate=le,d.shared.pending=null}}while(!0);oe===null&&(R=fe),d.baseState=R,d.firstBaseUpdate=W,d.lastBaseUpdate=oe,x===null&&(d.shared.lanes=0),ma|=w,e.lanes=w,e.memoizedState=fe}}function fm(e,n){if(typeof e!="function")throw Error(i(191,e));e.call(n)}function dm(e,n){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;e<r.length;e++)fm(r[e],n)}var Tr=_(null),no=_(0);function hm(e,n){e=Xl,A(no,e),A(Tr,n),Xl=e|n.baseLanes}function xu(){A(no,Xl),A(Tr,Tr.current)}function pu(){Xl=no.current,P(Tr),P(no)}var On=_(null),Wn=null;function ua(e){var n=e.alternate;A(Xt,Xt.current&1),A(On,e),Wn===null&&(n===null||Tr.current!==null||n.memoizedState!==null)&&(Wn=e)}function yu(e){A(Xt,Xt.current),A(On,e),Wn===null&&(Wn=e)}function mm(e){e.tag===22?(A(Xt,Xt.current),A(On,e),Wn===null&&(Wn=e)):fa()}function fa(){A(Xt,Xt.current),A(On,On.current)}function Bn(e){P(On),Wn===e&&(Wn=null),P(Xt)}var Xt=_(0);function lo(e){for(var n=e;n!==null;){if(n.tag===13){var r=n.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||jf(r)||Ef(r)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Bl=0,Ge=null,Et=null,Qt=null,ao=!1,zr=!1,Qa=!1,ro=0,Ti=0,Mr=null,d2=0;function It(){throw Error(i(321))}function gu(e,n){if(n===null)return!1;for(var r=0;r<n.length&&r<e.length;r++)if(!Fn(e[r],n[r]))return!1;return!0}function bu(e,n,r,s,d,x){return Bl=x,Ge=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,U.H=e===null||e.memoizedState===null?Wm:Fu,Qa=!1,x=r(s,d),Qa=!1,zr&&(x=pm(n,r,s,d)),xm(e),x}function xm(e){U.H=_i;var n=Et!==null&&Et.next!==null;if(Bl=0,Qt=Et=Ge=null,ao=!1,Ti=0,Mr=null,n)throw Error(i(300));e===null||Zt||(e=e.dependencies,e!==null&&Qs(e)&&(Zt=!0))}function pm(e,n,r,s){Ge=e;var d=0;do{if(zr&&(Mr=null),Ti=0,zr=!1,25<=d)throw Error(i(301));if(d+=1,Qt=Et=null,e.updateQueue!=null){var x=e.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}U.H=Jm,x=n(r,s)}while(zr);return x}function h2(){var e=U.H,n=e.useState()[0];return n=typeof n.then=="function"?zi(n):n,e=e.useState()[0],(Et!==null?Et.memoizedState:null)!==e&&(Ge.flags|=1024),n}function vu(){var e=ro!==0;return ro=0,e}function wu(e,n,r){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~r}function ku(e){if(ao){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}ao=!1}Bl=0,Qt=Et=Ge=null,zr=!1,Ti=ro=0,Mr=null}function gn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qt===null?Ge.memoizedState=Qt=e:Qt=Qt.next=e,Qt}function Vt(){if(Et===null){var e=Ge.alternate;e=e!==null?e.memoizedState:null}else e=Et.next;var n=Qt===null?Ge.memoizedState:Qt.next;if(n!==null)Qt=n,Et=e;else{if(e===null)throw Ge.alternate===null?Error(i(467)):Error(i(310));Et=e,e={memoizedState:Et.memoizedState,baseState:Et.baseState,baseQueue:Et.baseQueue,queue:Et.queue,next:null},Qt===null?Ge.memoizedState=Qt=e:Qt=Qt.next=e}return Qt}function io(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function zi(e){var n=Ti;return Ti+=1,Mr===null&&(Mr=[]),e=im(Mr,e,n),n=Ge,(Qt===null?n.memoizedState:Qt.next)===null&&(n=n.alternate,U.H=n===null||n.memoizedState===null?Wm:Fu),e}function so(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return zi(e);if(e.$$typeof===$)return un(e)}throw Error(i(438,String(e)))}function Su(e){var n=null,r=Ge.updateQueue;if(r!==null&&(n=r.memoCache),n==null){var s=Ge.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(n={data:s.data.map(function(d){return d.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),r===null&&(r=io(),Ge.updateQueue=r),r.memoCache=n,r=n.data[n.index],r===void 0)for(r=n.data[n.index]=Array(e),s=0;s<e;s++)r[s]=D;return n.index++,r}function $l(e,n){return typeof n=="function"?n(e):n}function oo(e){var n=Vt();return ju(n,Et,e)}function ju(e,n,r){var s=e.queue;if(s===null)throw Error(i(311));s.lastRenderedReducer=r;var d=e.baseQueue,x=s.pending;if(x!==null){if(d!==null){var w=d.next;d.next=x.next,x.next=w}n.baseQueue=d=x,s.pending=null}if(x=e.baseState,d===null)e.memoizedState=x;else{n=d.next;var N=w=null,R=null,W=n,oe=!1;do{var fe=W.lane&-536870913;if(fe!==W.lane?(lt&fe)===fe:(Bl&fe)===fe){var J=W.revertLane;if(J===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null}),fe===Cr&&(oe=!0);else if((Bl&J)===J){W=W.next,J===Cr&&(oe=!0);continue}else fe={lane:0,revertLane:W.revertLane,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},R===null?(N=R=fe,w=x):R=R.next=fe,Ge.lanes|=J,ma|=J;fe=W.action,Qa&&r(x,fe),x=W.hasEagerState?W.eagerState:r(x,fe)}else J={lane:fe,revertLane:W.revertLane,gesture:W.gesture,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},R===null?(N=R=J,w=x):R=R.next=J,Ge.lanes|=fe,ma|=fe;W=W.next}while(W!==null&&W!==n);if(R===null?w=x:R.next=N,!Fn(x,e.memoizedState)&&(Zt=!0,oe&&(r=Nr,r!==null)))throw r;e.memoizedState=x,e.baseState=w,e.baseQueue=R,s.lastRenderedState=x}return d===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Eu(e){var n=Vt(),r=n.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=e;var s=r.dispatch,d=r.pending,x=n.memoizedState;if(d!==null){r.pending=null;var w=d=d.next;do x=e(x,w.action),w=w.next;while(w!==d);Fn(x,n.memoizedState)||(Zt=!0),n.memoizedState=x,n.baseQueue===null&&(n.baseState=x),r.lastRenderedState=x}return[x,s]}function ym(e,n,r){var s=Ge,d=Vt(),x=it;if(x){if(r===void 0)throw Error(i(407));r=r()}else r=n();var w=!Fn((Et||d).memoizedState,r);if(w&&(d.memoizedState=r,Zt=!0),d=d.queue,Au(vm.bind(null,s,d,e),[e]),d.getSnapshot!==n||w||Qt!==null&&Qt.memoizedState.tag&1){if(s.flags|=2048,_r(9,{destroy:void 0},bm.bind(null,s,d,r,n),null),Tt===null)throw Error(i(349));x||(Bl&127)!==0||gm(s,n,r)}return r}function gm(e,n,r){e.flags|=16384,e={getSnapshot:n,value:r},n=Ge.updateQueue,n===null?(n=io(),Ge.updateQueue=n,n.stores=[e]):(r=n.stores,r===null?n.stores=[e]:r.push(e))}function bm(e,n,r,s){n.value=r,n.getSnapshot=s,wm(n)&&km(e)}function vm(e,n,r){return r(function(){wm(n)&&km(e)})}function wm(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!Fn(e,r)}catch{return!0}}function km(e){var n=Ha(e,2);n!==null&&Dn(n,e,2)}function Cu(e){var n=gn();if(typeof e=="function"){var r=e;if(e=r(),Qa){Oe(!0);try{r()}finally{Oe(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$l,lastRenderedState:e},n}function Sm(e,n,r,s){return e.baseState=r,ju(e,Et,typeof s=="function"?s:$l)}function m2(e,n,r,s,d){if(fo(e))throw Error(i(485));if(e=n.action,e!==null){var x={payload:d,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};U.T!==null?r(!0):x.isTransition=!1,s(x),r=n.pending,r===null?(x.next=n.pending=x,jm(n,x)):(x.next=r.next,n.pending=r.next=x)}}function jm(e,n){var r=n.action,s=n.payload,d=e.state;if(n.isTransition){var x=U.T,w={};U.T=w;try{var N=r(d,s),R=U.S;R!==null&&R(w,N),Em(e,n,N)}catch(W){Nu(e,n,W)}finally{x!==null&&w.types!==null&&(x.types=w.types),U.T=x}}else try{x=r(d,s),Em(e,n,x)}catch(W){Nu(e,n,W)}}function Em(e,n,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(s){Cm(e,n,s)},function(s){return Nu(e,n,s)}):Cm(e,n,r)}function Cm(e,n,r){n.status="fulfilled",n.value=r,Nm(n),e.state=r,n=e.pending,n!==null&&(r=n.next,r===n?e.pending=null:(r=r.next,n.next=r,jm(e,r)))}function Nu(e,n,r){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do n.status="rejected",n.reason=r,Nm(n),n=n.next;while(n!==s)}e.action=null}function Nm(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Am(e,n){return n}function Dm(e,n){if(it){var r=Tt.formState;if(r!==null){e:{var s=Ge;if(it){if(_t){t:{for(var d=_t,x=Zn;d.nodeType!==8;){if(!x){d=null;break t}if(d=Jn(d.nextSibling),d===null){d=null;break t}}x=d.data,d=x==="F!"||x==="F"?d:null}if(d){_t=Jn(d.nextSibling),s=d.data==="F!";break e}}ra(s)}s=!1}s&&(n=r[0])}}return r=gn(),r.memoizedState=r.baseState=n,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Am,lastRenderedState:n},r.queue=s,r=Km.bind(null,Ge,s),s.dispatch=r,s=Cu(!1),x=_u.bind(null,Ge,!1,s.queue),s=gn(),d={state:n,dispatch:null,action:e,pending:null},s.queue=d,r=m2.bind(null,Ge,d,x,r),d.dispatch=r,s.memoizedState=e,[n,r,!1]}function Tm(e){var n=Vt();return zm(n,Et,e)}function zm(e,n,r){if(n=ju(e,n,Am)[0],e=oo($l)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var s=zi(n)}catch(w){throw w===Ar?Js:w}else s=n;n=Vt();var d=n.queue,x=d.dispatch;return r!==n.memoizedState&&(Ge.flags|=2048,_r(9,{destroy:void 0},x2.bind(null,d,r),null)),[s,x,e]}function x2(e,n){e.action=n}function Mm(e){var n=Vt(),r=Et;if(r!==null)return zm(n,r,e);Vt(),n=n.memoizedState,r=Vt();var s=r.queue.dispatch;return r.memoizedState=e,[n,s,!1]}function _r(e,n,r,s){return e={tag:e,create:r,deps:s,inst:n,next:null},n=Ge.updateQueue,n===null&&(n=io(),Ge.updateQueue=n),r=n.lastEffect,r===null?n.lastEffect=e.next=e:(s=r.next,r.next=e,e.next=s,n.lastEffect=e),e}function _m(){return Vt().memoizedState}function co(e,n,r,s){var d=gn();Ge.flags|=e,d.memoizedState=_r(1|n,{destroy:void 0},r,s===void 0?null:s)}function uo(e,n,r,s){var d=Vt();s=s===void 0?null:s;var x=d.memoizedState.inst;Et!==null&&s!==null&&gu(s,Et.memoizedState.deps)?d.memoizedState=_r(n,x,r,s):(Ge.flags|=e,d.memoizedState=_r(1|n,x,r,s))}function Fm(e,n){co(8390656,8,e,n)}function Au(e,n){uo(2048,8,e,n)}function p2(e){Ge.flags|=4;var n=Ge.updateQueue;if(n===null)n=io(),Ge.updateQueue=n,n.events=[e];else{var r=n.events;r===null?n.events=[e]:r.push(e)}}function Rm(e){var n=Vt().memoizedState;return p2({ref:n,nextImpl:e}),function(){if((xt&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function Om(e,n){return uo(4,2,e,n)}function Bm(e,n){return uo(4,4,e,n)}function $m(e,n){if(typeof n=="function"){e=e();var r=n(e);return function(){typeof r=="function"?r():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Lm(e,n,r){r=r!=null?r.concat([e]):null,uo(4,4,$m.bind(null,n,e),r)}function Du(){}function Hm(e,n){var r=Vt();n=n===void 0?null:n;var s=r.memoizedState;return n!==null&&gu(n,s[1])?s[0]:(r.memoizedState=[e,n],e)}function Um(e,n){var r=Vt();n=n===void 0?null:n;var s=r.memoizedState;if(n!==null&&gu(n,s[1]))return s[0];if(s=e(),Qa){Oe(!0);try{e()}finally{Oe(!1)}}return r.memoizedState=[s,n],s}function Tu(e,n,r){return r===void 0||(Bl&1073741824)!==0&&(lt&261930)===0?e.memoizedState=n:(e.memoizedState=r,e=Ix(),Ge.lanes|=e,ma|=e,r)}function Im(e,n,r,s){return Fn(r,n)?r:Tr.current!==null?(e=Tu(e,r,s),Fn(e,n)||(Zt=!0),e):(Bl&42)===0||(Bl&1073741824)!==0&&(lt&261930)===0?(Zt=!0,e.memoizedState=r):(e=Ix(),Ge.lanes|=e,ma|=e,n)}function Ym(e,n,r,s,d){var x=Q.p;Q.p=x!==0&&8>x?x:8;var w=U.T,N={};U.T=N,_u(e,!1,n,r);try{var R=d(),W=U.S;if(W!==null&&W(N,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var oe=f2(R,s);Mi(e,n,oe,Hn(e))}else Mi(e,n,s,Hn(e))}catch(fe){Mi(e,n,{then:function(){},status:"rejected",reason:fe},Hn())}finally{Q.p=x,w!==null&&N.types!==null&&(w.types=N.types),U.T=w}}function y2(){}function zu(e,n,r,s){if(e.tag!==5)throw Error(i(476));var d=qm(e).queue;Ym(e,d,n,ie,r===null?y2:function(){return Xm(e),r(s)})}function qm(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$l,lastRenderedState:ie},next:null};var r={};return n.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$l,lastRenderedState:r},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Xm(e){var n=qm(e);n.next===null&&(n=e.alternate.memoizedState),Mi(e,n.next.queue,{},Hn())}function Mu(){return un(Qi)}function Vm(){return Vt().memoizedState}function Gm(){return Vt().memoizedState}function g2(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var r=Hn();e=oa(r);var s=ca(n,e,r);s!==null&&(Dn(s,n,r),Ni(s,n,r)),n={cache:su()},e.payload=n;return}n=n.return}}function b2(e,n,r){var s=Hn();r={lane:s,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},fo(e)?Qm(n,r):(r=Zc(e,n,r,s),r!==null&&(Dn(r,e,s),Zm(r,n,s)))}function Km(e,n,r){var s=Hn();Mi(e,n,r,s)}function Mi(e,n,r,s){var d={lane:s,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(fo(e))Qm(n,d);else{var x=e.alternate;if(e.lanes===0&&(x===null||x.lanes===0)&&(x=n.lastRenderedReducer,x!==null))try{var w=n.lastRenderedState,N=x(w,r);if(d.hasEagerState=!0,d.eagerState=N,Fn(N,w))return Xs(e,n,d,0),Tt===null&&qs(),!1}catch{}finally{}if(r=Zc(e,n,d,s),r!==null)return Dn(r,e,s),Zm(r,n,s),!0}return!1}function _u(e,n,r,s){if(s={lane:2,revertLane:df(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},fo(e)){if(n)throw Error(i(479))}else n=Zc(e,r,s,2),n!==null&&Dn(n,e,2)}function fo(e){var n=e.alternate;return e===Ge||n!==null&&n===Ge}function Qm(e,n){zr=ao=!0;var r=e.pending;r===null?n.next=n:(n.next=r.next,r.next=n),e.pending=n}function Zm(e,n,r){if((r&4194048)!==0){var s=n.lanes;s&=e.pendingLanes,r|=s,n.lanes=r,si(e,r)}}var _i={readContext:un,use:so,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useLayoutEffect:It,useInsertionEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useSyncExternalStore:It,useId:It,useHostTransitionStatus:It,useFormState:It,useActionState:It,useOptimistic:It,useMemoCache:It,useCacheRefresh:It};_i.useEffectEvent=It;var Wm={readContext:un,use:so,useCallback:function(e,n){return gn().memoizedState=[e,n===void 0?null:n],e},useContext:un,useEffect:Fm,useImperativeHandle:function(e,n,r){r=r!=null?r.concat([e]):null,co(4194308,4,$m.bind(null,n,e),r)},useLayoutEffect:function(e,n){return co(4194308,4,e,n)},useInsertionEffect:function(e,n){co(4,2,e,n)},useMemo:function(e,n){var r=gn();n=n===void 0?null:n;var s=e();if(Qa){Oe(!0);try{e()}finally{Oe(!1)}}return r.memoizedState=[s,n],s},useReducer:function(e,n,r){var s=gn();if(r!==void 0){var d=r(n);if(Qa){Oe(!0);try{r(n)}finally{Oe(!1)}}}else d=n;return s.memoizedState=s.baseState=d,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:d},s.queue=e,e=e.dispatch=b2.bind(null,Ge,e),[s.memoizedState,e]},useRef:function(e){var n=gn();return e={current:e},n.memoizedState=e},useState:function(e){e=Cu(e);var n=e.queue,r=Km.bind(null,Ge,n);return n.dispatch=r,[e.memoizedState,r]},useDebugValue:Du,useDeferredValue:function(e,n){var r=gn();return Tu(r,e,n)},useTransition:function(){var e=Cu(!1);return e=Ym.bind(null,Ge,e.queue,!0,!1),gn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,r){var s=Ge,d=gn();if(it){if(r===void 0)throw Error(i(407));r=r()}else{if(r=n(),Tt===null)throw Error(i(349));(lt&127)!==0||gm(s,n,r)}d.memoizedState=r;var x={value:r,getSnapshot:n};return d.queue=x,Fm(vm.bind(null,s,x,e),[e]),s.flags|=2048,_r(9,{destroy:void 0},bm.bind(null,s,x,r,n),null),r},useId:function(){var e=gn(),n=Tt.identifierPrefix;if(it){var r=yl,s=pl;r=(s&~(1<<32-ut(s)-1)).toString(32)+r,n="_"+n+"R_"+r,r=ro++,0<r&&(n+="H"+r.toString(32)),n+="_"}else r=d2++,n="_"+n+"r_"+r.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Mu,useFormState:Dm,useActionState:Dm,useOptimistic:function(e){var n=gn();n.memoizedState=n.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=r,n=_u.bind(null,Ge,!0,r),r.dispatch=n,[e,n]},useMemoCache:Su,useCacheRefresh:function(){return gn().memoizedState=g2.bind(null,Ge)},useEffectEvent:function(e){var n=gn(),r={impl:e};return n.memoizedState=r,function(){if((xt&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}},Fu={readContext:un,use:so,useCallback:Hm,useContext:un,useEffect:Au,useImperativeHandle:Lm,useInsertionEffect:Om,useLayoutEffect:Bm,useMemo:Um,useReducer:oo,useRef:_m,useState:function(){return oo($l)},useDebugValue:Du,useDeferredValue:function(e,n){var r=Vt();return Im(r,Et.memoizedState,e,n)},useTransition:function(){var e=oo($l)[0],n=Vt().memoizedState;return[typeof e=="boolean"?e:zi(e),n]},useSyncExternalStore:ym,useId:Vm,useHostTransitionStatus:Mu,useFormState:Tm,useActionState:Tm,useOptimistic:function(e,n){var r=Vt();return Sm(r,Et,e,n)},useMemoCache:Su,useCacheRefresh:Gm};Fu.useEffectEvent=Rm;var Jm={readContext:un,use:so,useCallback:Hm,useContext:un,useEffect:Au,useImperativeHandle:Lm,useInsertionEffect:Om,useLayoutEffect:Bm,useMemo:Um,useReducer:Eu,useRef:_m,useState:function(){return Eu($l)},useDebugValue:Du,useDeferredValue:function(e,n){var r=Vt();return Et===null?Tu(r,e,n):Im(r,Et.memoizedState,e,n)},useTransition:function(){var e=Eu($l)[0],n=Vt().memoizedState;return[typeof e=="boolean"?e:zi(e),n]},useSyncExternalStore:ym,useId:Vm,useHostTransitionStatus:Mu,useFormState:Mm,useActionState:Mm,useOptimistic:function(e,n){var r=Vt();return Et!==null?Sm(r,Et,e,n):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:Su,useCacheRefresh:Gm};Jm.useEffectEvent=Rm;function Ru(e,n,r,s){n=e.memoizedState,r=r(s,n),r=r==null?n:y({},n,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var Ou={enqueueSetState:function(e,n,r){e=e._reactInternals;var s=Hn(),d=oa(s);d.payload=n,r!=null&&(d.callback=r),n=ca(e,d,s),n!==null&&(Dn(n,e,s),Ni(n,e,s))},enqueueReplaceState:function(e,n,r){e=e._reactInternals;var s=Hn(),d=oa(s);d.tag=1,d.payload=n,r!=null&&(d.callback=r),n=ca(e,d,s),n!==null&&(Dn(n,e,s),Ni(n,e,s))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var r=Hn(),s=oa(r);s.tag=2,n!=null&&(s.callback=n),n=ca(e,s,r),n!==null&&(Dn(n,e,r),Ni(n,e,r))}};function Pm(e,n,r,s,d,x,w){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,x,w):n.prototype&&n.prototype.isPureReactComponent?!bi(r,s)||!bi(d,x):!0}function ex(e,n,r,s){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(r,s),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(r,s),n.state!==e&&Ou.enqueueReplaceState(n,n.state,null)}function Za(e,n){var r=n;if("ref"in n){r={};for(var s in n)s!=="ref"&&(r[s]=n[s])}if(e=e.defaultProps){r===n&&(r=y({},r));for(var d in e)r[d]===void 0&&(r[d]=e[d])}return r}function tx(e){Ys(e)}function nx(e){console.error(e)}function lx(e){Ys(e)}function ho(e,n){try{var r=e.onUncaughtError;r(n.value,{componentStack:n.stack})}catch(s){setTimeout(function(){throw s})}}function ax(e,n,r){try{var s=e.onCaughtError;s(r.value,{componentStack:r.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function Bu(e,n,r){return r=oa(r),r.tag=3,r.payload={element:null},r.callback=function(){ho(e,n)},r}function rx(e){return e=oa(e),e.tag=3,e}function ix(e,n,r,s){var d=r.type.getDerivedStateFromError;if(typeof d=="function"){var x=s.value;e.payload=function(){return d(x)},e.callback=function(){ax(n,r,s)}}var w=r.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(e.callback=function(){ax(n,r,s),typeof d!="function"&&(xa===null?xa=new Set([this]):xa.add(this));var N=s.stack;this.componentDidCatch(s.value,{componentStack:N!==null?N:""})})}function v2(e,n,r,s,d){if(r.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(n=r.alternate,n!==null&&Er(n,r,d,!0),r=On.current,r!==null){switch(r.tag){case 31:case 13:return Wn===null?Eo():r.alternate===null&&Yt===0&&(Yt=3),r.flags&=-257,r.flags|=65536,r.lanes=d,s===Ps?r.flags|=16384:(n=r.updateQueue,n===null?r.updateQueue=new Set([s]):n.add(s),cf(e,s,d)),!1;case 22:return r.flags|=65536,s===Ps?r.flags|=16384:(n=r.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([s])},r.updateQueue=n):(r=n.retryQueue,r===null?n.retryQueue=new Set([s]):r.add(s)),cf(e,s,d)),!1}throw Error(i(435,r.tag))}return cf(e,s,d),Eo(),!1}if(it)return n=On.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=d,s!==nu&&(e=Error(i(422),{cause:s}),ki(Gn(e,r)))):(s!==nu&&(n=Error(i(423),{cause:s}),ki(Gn(n,r))),e=e.current.alternate,e.flags|=65536,d&=-d,e.lanes|=d,s=Gn(s,r),d=Bu(e.stateNode,s,d),hu(e,d),Yt!==4&&(Yt=2)),!1;var x=Error(i(520),{cause:s});if(x=Gn(x,r),Ui===null?Ui=[x]:Ui.push(x),Yt!==4&&(Yt=2),n===null)return!0;s=Gn(s,r),r=n;do{switch(r.tag){case 3:return r.flags|=65536,e=d&-d,r.lanes|=e,e=Bu(r.stateNode,s,e),hu(r,e),!1;case 1:if(n=r.type,x=r.stateNode,(r.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(xa===null||!xa.has(x))))return r.flags|=65536,d&=-d,r.lanes|=d,d=rx(d),ix(d,e,r,s),hu(r,d),!1}r=r.return}while(r!==null);return!1}var $u=Error(i(461)),Zt=!1;function fn(e,n,r,s){n.child=e===null?um(n,null,r,s):Ka(n,e.child,r,s)}function sx(e,n,r,s,d){r=r.render;var x=n.ref;if("ref"in s){var w={};for(var N in s)N!=="ref"&&(w[N]=s[N])}else w=s;return qa(n),s=bu(e,n,r,w,x,d),N=vu(),e!==null&&!Zt?(wu(e,n,d),Ll(e,n,d)):(it&&N&&eu(n),n.flags|=1,fn(e,n,s,d),n.child)}function ox(e,n,r,s,d){if(e===null){var x=r.type;return typeof x=="function"&&!Wc(x)&&x.defaultProps===void 0&&r.compare===null?(n.tag=15,n.type=x,cx(e,n,x,s,d)):(e=Gs(r.type,null,s,n,n.mode,d),e.ref=n.ref,e.return=n,n.child=e)}if(x=e.child,!Vu(e,d)){var w=x.memoizedProps;if(r=r.compare,r=r!==null?r:bi,r(w,s)&&e.ref===n.ref)return Ll(e,n,d)}return n.flags|=1,e=_l(x,s),e.ref=n.ref,e.return=n,n.child=e}function cx(e,n,r,s,d){if(e!==null){var x=e.memoizedProps;if(bi(x,s)&&e.ref===n.ref)if(Zt=!1,n.pendingProps=s=x,Vu(e,d))(e.flags&131072)!==0&&(Zt=!0);else return n.lanes=e.lanes,Ll(e,n,d)}return Lu(e,n,r,s,d)}function ux(e,n,r,s){var d=s.children,x=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((n.flags&128)!==0){if(x=x!==null?x.baseLanes|r:r,e!==null){for(s=n.child=e.child,d=0;s!==null;)d=d|s.lanes|s.childLanes,s=s.sibling;s=d&~x}else s=0,n.child=null;return fx(e,n,x,r,s)}if((r&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ws(n,x!==null?x.cachePool:null),x!==null?hm(n,x):xu(),mm(n);else return s=n.lanes=536870912,fx(e,n,x!==null?x.baseLanes|r:r,r,s)}else x!==null?(Ws(n,x.cachePool),hm(n,x),fa(),n.memoizedState=null):(e!==null&&Ws(n,null),xu(),fa());return fn(e,n,d,r),n.child}function Fi(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function fx(e,n,r,s,d){var x=cu();return x=x===null?null:{parent:Kt._currentValue,pool:x},n.memoizedState={baseLanes:r,cachePool:x},e!==null&&Ws(n,null),xu(),mm(n),e!==null&&Er(e,n,s,!0),n.childLanes=d,null}function mo(e,n){return n=po({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function dx(e,n,r){return Ka(n,e.child,null,r),e=mo(n,n.pendingProps),e.flags|=2,Bn(n),n.memoizedState=null,e}function w2(e,n,r){var s=n.pendingProps,d=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(it){if(s.mode==="hidden")return e=mo(n,s),n.lanes=536870912,Fi(null,e);if(yu(n),(e=_t)?(e=jp(e,Zn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:la!==null?{id:pl,overflow:yl}:null,retryLane:536870912,hydrationErrors:null},r=Qh(e),r.return=n,n.child=r,cn=n,_t=null)):e=null,e===null)throw ra(n);return n.lanes=536870912,null}return mo(n,s)}var x=e.memoizedState;if(x!==null){var w=x.dehydrated;if(yu(n),d)if(n.flags&256)n.flags&=-257,n=dx(e,n,r);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(i(558));else if(Zt||Er(e,n,r,!1),d=(r&e.childLanes)!==0,Zt||d){if(s=Tt,s!==null&&(w=Ds(s,r),w!==0&&w!==x.retryLane))throw x.retryLane=w,Ha(e,w),Dn(s,e,w),$u;Eo(),n=dx(e,n,r)}else e=x.treeContext,_t=Jn(w.nextSibling),cn=n,it=!0,aa=null,Zn=!1,e!==null&&Jh(n,e),n=mo(n,s),n.flags|=4096;return n}return e=_l(e.child,{mode:s.mode,children:s.children}),e.ref=n.ref,n.child=e,e.return=n,e}function xo(e,n){var r=n.ref;if(r===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(i(284));(e===null||e.ref!==r)&&(n.flags|=4194816)}}function Lu(e,n,r,s,d){return qa(n),r=bu(e,n,r,s,void 0,d),s=vu(),e!==null&&!Zt?(wu(e,n,d),Ll(e,n,d)):(it&&s&&eu(n),n.flags|=1,fn(e,n,r,d),n.child)}function hx(e,n,r,s,d,x){return qa(n),n.updateQueue=null,r=pm(n,s,r,d),xm(e),s=vu(),e!==null&&!Zt?(wu(e,n,x),Ll(e,n,x)):(it&&s&&eu(n),n.flags|=1,fn(e,n,r,x),n.child)}function mx(e,n,r,s,d){if(qa(n),n.stateNode===null){var x=wr,w=r.contextType;typeof w=="object"&&w!==null&&(x=un(w)),x=new r(s,x),n.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Ou,n.stateNode=x,x._reactInternals=n,x=n.stateNode,x.props=s,x.state=n.memoizedState,x.refs={},fu(n),w=r.contextType,x.context=typeof w=="object"&&w!==null?un(w):wr,x.state=n.memoizedState,w=r.getDerivedStateFromProps,typeof w=="function"&&(Ru(n,r,w,s),x.state=n.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(w=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),w!==x.state&&Ou.enqueueReplaceState(x,x.state,null),Di(n,s,x,d),Ai(),x.state=n.memoizedState),typeof x.componentDidMount=="function"&&(n.flags|=4194308),s=!0}else if(e===null){x=n.stateNode;var N=n.memoizedProps,R=Za(r,N);x.props=R;var W=x.context,oe=r.contextType;w=wr,typeof oe=="object"&&oe!==null&&(w=un(oe));var fe=r.getDerivedStateFromProps;oe=typeof fe=="function"||typeof x.getSnapshotBeforeUpdate=="function",N=n.pendingProps!==N,oe||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(N||W!==w)&&ex(n,x,s,w),sa=!1;var J=n.memoizedState;x.state=J,Di(n,s,x,d),Ai(),W=n.memoizedState,N||J!==W||sa?(typeof fe=="function"&&(Ru(n,r,fe,s),W=n.memoizedState),(R=sa||Pm(n,r,R,s,J,W,w))?(oe||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(n.flags|=4194308)):(typeof x.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=s,n.memoizedState=W),x.props=s,x.state=W,x.context=w,s=R):(typeof x.componentDidMount=="function"&&(n.flags|=4194308),s=!1)}else{x=n.stateNode,du(e,n),w=n.memoizedProps,oe=Za(r,w),x.props=oe,fe=n.pendingProps,J=x.context,W=r.contextType,R=wr,typeof W=="object"&&W!==null&&(R=un(W)),N=r.getDerivedStateFromProps,(W=typeof N=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==fe||J!==R)&&ex(n,x,s,R),sa=!1,J=n.memoizedState,x.state=J,Di(n,s,x,d),Ai();var le=n.memoizedState;w!==fe||J!==le||sa||e!==null&&e.dependencies!==null&&Qs(e.dependencies)?(typeof N=="function"&&(Ru(n,r,N,s),le=n.memoizedState),(oe=sa||Pm(n,r,oe,s,J,le,R)||e!==null&&e.dependencies!==null&&Qs(e.dependencies))?(W||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(s,le,R),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(s,le,R)),typeof x.componentDidUpdate=="function"&&(n.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===e.memoizedProps&&J===e.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&J===e.memoizedState||(n.flags|=1024),n.memoizedProps=s,n.memoizedState=le),x.props=s,x.state=le,x.context=R,s=oe):(typeof x.componentDidUpdate!="function"||w===e.memoizedProps&&J===e.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&J===e.memoizedState||(n.flags|=1024),s=!1)}return x=s,xo(e,n),s=(n.flags&128)!==0,x||s?(x=n.stateNode,r=s&&typeof r.getDerivedStateFromError!="function"?null:x.render(),n.flags|=1,e!==null&&s?(n.child=Ka(n,e.child,null,d),n.child=Ka(n,null,r,d)):fn(e,n,r,d),n.memoizedState=x.state,e=n.child):e=Ll(e,n,d),e}function xx(e,n,r,s){return Ia(),n.flags|=256,fn(e,n,r,s),n.child}var Hu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Uu(e){return{baseLanes:e,cachePool:am()}}function Iu(e,n,r){return e=e!==null?e.childLanes&~r:0,n&&(e|=Ln),e}function px(e,n,r){var s=n.pendingProps,d=!1,x=(n.flags&128)!==0,w;if((w=x)||(w=e!==null&&e.memoizedState===null?!1:(Xt.current&2)!==0),w&&(d=!0,n.flags&=-129),w=(n.flags&32)!==0,n.flags&=-33,e===null){if(it){if(d?ua(n):fa(),(e=_t)?(e=jp(e,Zn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:la!==null?{id:pl,overflow:yl}:null,retryLane:536870912,hydrationErrors:null},r=Qh(e),r.return=n,n.child=r,cn=n,_t=null)):e=null,e===null)throw ra(n);return Ef(e)?n.lanes=32:n.lanes=536870912,null}var N=s.children;return s=s.fallback,d?(fa(),d=n.mode,N=po({mode:"hidden",children:N},d),s=Ua(s,d,r,null),N.return=n,s.return=n,N.sibling=s,n.child=N,s=n.child,s.memoizedState=Uu(r),s.childLanes=Iu(e,w,r),n.memoizedState=Hu,Fi(null,s)):(ua(n),Yu(n,N))}var R=e.memoizedState;if(R!==null&&(N=R.dehydrated,N!==null)){if(x)n.flags&256?(ua(n),n.flags&=-257,n=qu(e,n,r)):n.memoizedState!==null?(fa(),n.child=e.child,n.flags|=128,n=null):(fa(),N=s.fallback,d=n.mode,s=po({mode:"visible",children:s.children},d),N=Ua(N,d,r,null),N.flags|=2,s.return=n,N.return=n,s.sibling=N,n.child=s,Ka(n,e.child,null,r),s=n.child,s.memoizedState=Uu(r),s.childLanes=Iu(e,w,r),n.memoizedState=Hu,n=Fi(null,s));else if(ua(n),Ef(N)){if(w=N.nextSibling&&N.nextSibling.dataset,w)var W=w.dgst;w=W,s=Error(i(419)),s.stack="",s.digest=w,ki({value:s,source:null,stack:null}),n=qu(e,n,r)}else if(Zt||Er(e,n,r,!1),w=(r&e.childLanes)!==0,Zt||w){if(w=Tt,w!==null&&(s=Ds(w,r),s!==0&&s!==R.retryLane))throw R.retryLane=s,Ha(e,s),Dn(w,e,s),$u;jf(N)||Eo(),n=qu(e,n,r)}else jf(N)?(n.flags|=192,n.child=e.child,n=null):(e=R.treeContext,_t=Jn(N.nextSibling),cn=n,it=!0,aa=null,Zn=!1,e!==null&&Jh(n,e),n=Yu(n,s.children),n.flags|=4096);return n}return d?(fa(),N=s.fallback,d=n.mode,R=e.child,W=R.sibling,s=_l(R,{mode:"hidden",children:s.children}),s.subtreeFlags=R.subtreeFlags&65011712,W!==null?N=_l(W,N):(N=Ua(N,d,r,null),N.flags|=2),N.return=n,s.return=n,s.sibling=N,n.child=s,Fi(null,s),s=n.child,N=e.child.memoizedState,N===null?N=Uu(r):(d=N.cachePool,d!==null?(R=Kt._currentValue,d=d.parent!==R?{parent:R,pool:R}:d):d=am(),N={baseLanes:N.baseLanes|r,cachePool:d}),s.memoizedState=N,s.childLanes=Iu(e,w,r),n.memoizedState=Hu,Fi(e.child,s)):(ua(n),r=e.child,e=r.sibling,r=_l(r,{mode:"visible",children:s.children}),r.return=n,r.sibling=null,e!==null&&(w=n.deletions,w===null?(n.deletions=[e],n.flags|=16):w.push(e)),n.child=r,n.memoizedState=null,r)}function Yu(e,n){return n=po({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function po(e,n){return e=Rn(22,e,null,n),e.lanes=0,e}function qu(e,n,r){return Ka(n,e.child,null,r),e=Yu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function yx(e,n,r){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n),ru(e.return,n,r)}function Xu(e,n,r,s,d,x){var w=e.memoizedState;w===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:s,tail:r,tailMode:d,treeForkCount:x}:(w.isBackwards=n,w.rendering=null,w.renderingStartTime=0,w.last=s,w.tail=r,w.tailMode=d,w.treeForkCount=x)}function gx(e,n,r){var s=n.pendingProps,d=s.revealOrder,x=s.tail;s=s.children;var w=Xt.current,N=(w&2)!==0;if(N?(w=w&1|2,n.flags|=128):w&=1,A(Xt,w),fn(e,n,s,r),s=it?wi:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&yx(e,r,n);else if(e.tag===19)yx(e,r,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(d){case"forwards":for(r=n.child,d=null;r!==null;)e=r.alternate,e!==null&&lo(e)===null&&(d=r),r=r.sibling;r=d,r===null?(d=n.child,n.child=null):(d=r.sibling,r.sibling=null),Xu(n,!1,d,r,x,s);break;case"backwards":case"unstable_legacy-backwards":for(r=null,d=n.child,n.child=null;d!==null;){if(e=d.alternate,e!==null&&lo(e)===null){n.child=d;break}e=d.sibling,d.sibling=r,r=d,d=e}Xu(n,!0,r,null,x,s);break;case"together":Xu(n,!1,null,null,void 0,s);break;default:n.memoizedState=null}return n.child}function Ll(e,n,r){if(e!==null&&(n.dependencies=e.dependencies),ma|=n.lanes,(r&n.childLanes)===0)if(e!==null){if(Er(e,n,r,!1),(r&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(i(153));if(n.child!==null){for(e=n.child,r=_l(e,e.pendingProps),n.child=r,r.return=n;e.sibling!==null;)e=e.sibling,r=r.sibling=_l(e,e.pendingProps),r.return=n;r.sibling=null}return n.child}function Vu(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Qs(e)))}function k2(e,n,r){switch(n.tag){case 3:Ye(n,n.stateNode.containerInfo),ia(n,Kt,e.memoizedState.cache),Ia();break;case 27:case 5:K(n);break;case 4:Ye(n,n.stateNode.containerInfo);break;case 10:ia(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,yu(n),null;break;case 13:var s=n.memoizedState;if(s!==null)return s.dehydrated!==null?(ua(n),n.flags|=128,null):(r&n.child.childLanes)!==0?px(e,n,r):(ua(n),e=Ll(e,n,r),e!==null?e.sibling:null);ua(n);break;case 19:var d=(e.flags&128)!==0;if(s=(r&n.childLanes)!==0,s||(Er(e,n,r,!1),s=(r&n.childLanes)!==0),d){if(s)return gx(e,n,r);n.flags|=128}if(d=n.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),A(Xt,Xt.current),s)break;return null;case 22:return n.lanes=0,ux(e,n,r,n.pendingProps);case 24:ia(n,Kt,e.memoizedState.cache)}return Ll(e,n,r)}function bx(e,n,r){if(e!==null)if(e.memoizedProps!==n.pendingProps)Zt=!0;else{if(!Vu(e,r)&&(n.flags&128)===0)return Zt=!1,k2(e,n,r);Zt=(e.flags&131072)!==0}else Zt=!1,it&&(n.flags&1048576)!==0&&Wh(n,wi,n.index);switch(n.lanes=0,n.tag){case 16:e:{var s=n.pendingProps;if(e=Va(n.elementType),n.type=e,typeof e=="function")Wc(e)?(s=Za(e,s),n.tag=1,n=mx(null,n,e,s,r)):(n.tag=0,n=Lu(null,n,e,s,r));else{if(e!=null){var d=e.$$typeof;if(d===O){n.tag=11,n=sx(null,n,e,s,r);break e}else if(d===Y){n.tag=14,n=ox(null,n,e,s,r);break e}}throw n=ae(e)||e,Error(i(306,n,""))}}return n;case 0:return Lu(e,n,n.type,n.pendingProps,r);case 1:return s=n.type,d=Za(s,n.pendingProps),mx(e,n,s,d,r);case 3:e:{if(Ye(n,n.stateNode.containerInfo),e===null)throw Error(i(387));s=n.pendingProps;var x=n.memoizedState;d=x.element,du(e,n),Di(n,s,null,r);var w=n.memoizedState;if(s=w.cache,ia(n,Kt,s),s!==x.cache&&iu(n,[Kt],r,!0),Ai(),s=w.element,x.isDehydrated)if(x={element:s,isDehydrated:!1,cache:w.cache},n.updateQueue.baseState=x,n.memoizedState=x,n.flags&256){n=xx(e,n,s,r);break e}else if(s!==d){d=Gn(Error(i(424)),n),ki(d),n=xx(e,n,s,r);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(_t=Jn(e.firstChild),cn=n,it=!0,aa=null,Zn=!0,r=um(n,null,s,r),n.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling}else{if(Ia(),s===d){n=Ll(e,n,r);break e}fn(e,n,s,r)}n=n.child}return n;case 26:return xo(e,n),e===null?(r=Tp(n.type,null,n.pendingProps,null))?n.memoizedState=r:it||(r=n.type,e=n.pendingProps,s=Mo(Ce.current).createElement(r),s[Ht]=n,s[vt]=e,dn(s,r,e),Ut(s),n.stateNode=s):n.memoizedState=Tp(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return K(n),e===null&&it&&(s=n.stateNode=Np(n.type,n.pendingProps,Ce.current),cn=n,Zn=!0,d=_t,ba(n.type)?(Cf=d,_t=Jn(s.firstChild)):_t=d),fn(e,n,n.pendingProps.children,r),xo(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&it&&((d=s=_t)&&(s=J2(s,n.type,n.pendingProps,Zn),s!==null?(n.stateNode=s,cn=n,_t=Jn(s.firstChild),Zn=!1,d=!0):d=!1),d||ra(n)),K(n),d=n.type,x=n.pendingProps,w=e!==null?e.memoizedProps:null,s=x.children,wf(d,x)?s=null:w!==null&&wf(d,w)&&(n.flags|=32),n.memoizedState!==null&&(d=bu(e,n,h2,null,null,r),Qi._currentValue=d),xo(e,n),fn(e,n,s,r),n.child;case 6:return e===null&&it&&((e=r=_t)&&(r=P2(r,n.pendingProps,Zn),r!==null?(n.stateNode=r,cn=n,_t=null,e=!0):e=!1),e||ra(n)),null;case 13:return px(e,n,r);case 4:return Ye(n,n.stateNode.containerInfo),s=n.pendingProps,e===null?n.child=Ka(n,null,s,r):fn(e,n,s,r),n.child;case 11:return sx(e,n,n.type,n.pendingProps,r);case 7:return fn(e,n,n.pendingProps,r),n.child;case 8:return fn(e,n,n.pendingProps.children,r),n.child;case 12:return fn(e,n,n.pendingProps.children,r),n.child;case 10:return s=n.pendingProps,ia(n,n.type,s.value),fn(e,n,s.children,r),n.child;case 9:return d=n.type._context,s=n.pendingProps.children,qa(n),d=un(d),s=s(d),n.flags|=1,fn(e,n,s,r),n.child;case 14:return ox(e,n,n.type,n.pendingProps,r);case 15:return cx(e,n,n.type,n.pendingProps,r);case 19:return gx(e,n,r);case 31:return w2(e,n,r);case 22:return ux(e,n,r,n.pendingProps);case 24:return qa(n),s=un(Kt),e===null?(d=cu(),d===null&&(d=Tt,x=su(),d.pooledCache=x,x.refCount++,x!==null&&(d.pooledCacheLanes|=r),d=x),n.memoizedState={parent:s,cache:d},fu(n),ia(n,Kt,d)):((e.lanes&r)!==0&&(du(e,n),Di(n,null,null,r),Ai()),d=e.memoizedState,x=n.memoizedState,d.parent!==s?(d={parent:s,cache:s},n.memoizedState=d,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=d),ia(n,Kt,s)):(s=x.cache,ia(n,Kt,s),s!==d.cache&&iu(n,[Kt],r,!0))),fn(e,n,n.pendingProps.children,r),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function Hl(e){e.flags|=4}function Gu(e,n,r,s,d){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(d&335544128)===d)if(e.stateNode.complete)e.flags|=8192;else if(Vx())e.flags|=8192;else throw Ga=Ps,uu}else e.flags&=-16777217}function vx(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Rp(n))if(Vx())e.flags|=8192;else throw Ga=Ps,uu}function yo(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?cr():536870912,e.lanes|=n,Br|=n)}function Ri(e,n){if(!it)switch(e.tailMode){case"hidden":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var s=null;r!==null;)r.alternate!==null&&(s=r),r=r.sibling;s===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Ft(e){var n=e.alternate!==null&&e.alternate.child===e.child,r=0,s=0;if(n)for(var d=e.child;d!==null;)r|=d.lanes|d.childLanes,s|=d.subtreeFlags&65011712,s|=d.flags&65011712,d.return=e,d=d.sibling;else for(d=e.child;d!==null;)r|=d.lanes|d.childLanes,s|=d.subtreeFlags,s|=d.flags,d.return=e,d=d.sibling;return e.subtreeFlags|=s,e.childLanes=r,n}function S2(e,n,r){var s=n.pendingProps;switch(tu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ft(n),null;case 1:return Ft(n),null;case 3:return r=n.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),n.memoizedState.cache!==s&&(n.flags|=2048),Ol(Kt),se(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(jr(n)?Hl(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,lu())),Ft(n),null;case 26:var d=n.type,x=n.memoizedState;return e===null?(Hl(n),x!==null?(Ft(n),vx(n,x)):(Ft(n),Gu(n,d,null,s,r))):x?x!==e.memoizedState?(Hl(n),Ft(n),vx(n,x)):(Ft(n),n.flags&=-16777217):(e=e.memoizedProps,e!==s&&Hl(n),Ft(n),Gu(n,d,e,s,r)),null;case 27:if(ue(n),r=Ce.current,d=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Hl(n);else{if(!s){if(n.stateNode===null)throw Error(i(166));return Ft(n),null}e=pe.current,jr(n)?Ph(n):(e=Np(d,s,r),n.stateNode=e,Hl(n))}return Ft(n),null;case 5:if(ue(n),d=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Hl(n);else{if(!s){if(n.stateNode===null)throw Error(i(166));return Ft(n),null}if(x=pe.current,jr(n))Ph(n);else{var w=Mo(Ce.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":x=w.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof s.is=="string"?w.createElement("select",{is:s.is}):w.createElement("select"),s.multiple?x.multiple=!0:s.size&&(x.size=s.size);break;default:x=typeof s.is=="string"?w.createElement(d,{is:s.is}):w.createElement(d)}}x[Ht]=n,x[vt]=s;e:for(w=n.child;w!==null;){if(w.tag===5||w.tag===6)x.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===n)break e;for(;w.sibling===null;){if(w.return===null||w.return===n)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}n.stateNode=x;e:switch(dn(x,d,s),d){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Hl(n)}}return Ft(n),Gu(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,r),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==s&&Hl(n);else{if(typeof s!="string"&&n.stateNode===null)throw Error(i(166));if(e=Ce.current,jr(n)){if(e=n.stateNode,r=n.memoizedProps,s=null,d=cn,d!==null)switch(d.tag){case 27:case 5:s=d.memoizedProps}e[Ht]=n,e=!!(e.nodeValue===r||s!==null&&s.suppressHydrationWarning===!0||pp(e.nodeValue,r)),e||ra(n,!0)}else e=Mo(e).createTextNode(s),e[Ht]=n,n.stateNode=e}return Ft(n),null;case 31:if(r=n.memoizedState,e===null||e.memoizedState!==null){if(s=jr(n),r!==null){if(e===null){if(!s)throw Error(i(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(557));e[Ht]=n}else Ia(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ft(n),e=!1}else r=lu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return n.flags&256?(Bn(n),n):(Bn(n),null);if((n.flags&128)!==0)throw Error(i(558))}return Ft(n),null;case 13:if(s=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(d=jr(n),s!==null&&s.dehydrated!==null){if(e===null){if(!d)throw Error(i(318));if(d=n.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(i(317));d[Ht]=n}else Ia(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ft(n),d=!1}else d=lu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return n.flags&256?(Bn(n),n):(Bn(n),null)}return Bn(n),(n.flags&128)!==0?(n.lanes=r,n):(r=s!==null,e=e!==null&&e.memoizedState!==null,r&&(s=n.child,d=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(d=s.alternate.memoizedState.cachePool.pool),x=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(x=s.memoizedState.cachePool.pool),x!==d&&(s.flags|=2048)),r!==e&&r&&(n.child.flags|=8192),yo(n,n.updateQueue),Ft(n),null);case 4:return se(),e===null&&pf(n.stateNode.containerInfo),Ft(n),null;case 10:return Ol(n.type),Ft(n),null;case 19:if(P(Xt),s=n.memoizedState,s===null)return Ft(n),null;if(d=(n.flags&128)!==0,x=s.rendering,x===null)if(d)Ri(s,!1);else{if(Yt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(x=lo(e),x!==null){for(n.flags|=128,Ri(s,!1),e=x.updateQueue,n.updateQueue=e,yo(n,e),n.subtreeFlags=0,e=r,r=n.child;r!==null;)Kh(r,e),r=r.sibling;return A(Xt,Xt.current&1|2),it&&Fl(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&>()>ko&&(n.flags|=128,d=!0,Ri(s,!1),n.lanes=4194304)}else{if(!d)if(e=lo(x),e!==null){if(n.flags|=128,d=!0,e=e.updateQueue,n.updateQueue=e,yo(n,e),Ri(s,!0),s.tail===null&&s.tailMode==="hidden"&&!x.alternate&&!it)return Ft(n),null}else 2*gt()-s.renderingStartTime>ko&&r!==536870912&&(n.flags|=128,d=!0,Ri(s,!1),n.lanes=4194304);s.isBackwards?(x.sibling=n.child,n.child=x):(e=s.last,e!==null?e.sibling=x:n.child=x,s.last=x)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=gt(),e.sibling=null,r=Xt.current,A(Xt,d?r&1|2:r&1),it&&Fl(n,s.treeForkCount),e):(Ft(n),null);case 22:case 23:return Bn(n),pu(),s=n.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(n.flags|=8192):s&&(n.flags|=8192),s?(r&536870912)!==0&&(n.flags&128)===0&&(Ft(n),n.subtreeFlags&6&&(n.flags|=8192)):Ft(n),r=n.updateQueue,r!==null&&yo(n,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==r&&(n.flags|=2048),e!==null&&P(Xa),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),n.memoizedState.cache!==r&&(n.flags|=2048),Ol(Kt),Ft(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function j2(e,n){switch(tu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Ol(Kt),se(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return ue(n),null;case 31:if(n.memoizedState!==null){if(Bn(n),n.alternate===null)throw Error(i(340));Ia()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Bn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));Ia()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return P(Xt),null;case 4:return se(),null;case 10:return Ol(n.type),null;case 22:case 23:return Bn(n),pu(),e!==null&&P(Xa),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Ol(Kt),null;case 25:return null;default:return null}}function wx(e,n){switch(tu(n),n.tag){case 3:Ol(Kt),se();break;case 26:case 27:case 5:ue(n);break;case 4:se();break;case 31:n.memoizedState!==null&&Bn(n);break;case 13:Bn(n);break;case 19:P(Xt);break;case 10:Ol(n.type);break;case 22:case 23:Bn(n),pu(),e!==null&&P(Xa);break;case 24:Ol(Kt)}}function Oi(e,n){try{var r=n.updateQueue,s=r!==null?r.lastEffect:null;if(s!==null){var d=s.next;r=d;do{if((r.tag&e)===e){s=void 0;var x=r.create,w=r.inst;s=x(),w.destroy=s}r=r.next}while(r!==d)}}catch(N){St(n,n.return,N)}}function da(e,n,r){try{var s=n.updateQueue,d=s!==null?s.lastEffect:null;if(d!==null){var x=d.next;s=x;do{if((s.tag&e)===e){var w=s.inst,N=w.destroy;if(N!==void 0){w.destroy=void 0,d=n;var R=r,W=N;try{W()}catch(oe){St(d,R,oe)}}}s=s.next}while(s!==x)}}catch(oe){St(n,n.return,oe)}}function kx(e){var n=e.updateQueue;if(n!==null){var r=e.stateNode;try{dm(n,r)}catch(s){St(e,e.return,s)}}}function Sx(e,n,r){r.props=Za(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(s){St(e,n,s)}}function Bi(e,n){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof r=="function"?e.refCleanup=r(s):r.current=s}}catch(d){St(e,n,d)}}function gl(e,n){var r=e.ref,s=e.refCleanup;if(r!==null)if(typeof s=="function")try{s()}catch(d){St(e,n,d)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(d){St(e,n,d)}else r.current=null}function jx(e){var n=e.type,r=e.memoizedProps,s=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":r.autoFocus&&s.focus();break e;case"img":r.src?s.src=r.src:r.srcSet&&(s.srcset=r.srcSet)}}catch(d){St(e,e.return,d)}}function Ku(e,n,r){try{var s=e.stateNode;V2(s,e.type,r,n),s[vt]=n}catch(d){St(e,e.return,d)}}function Ex(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ba(e.type)||e.tag===4}function Qu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ex(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.tag===27&&ba(e.type)||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 Zu(e,n,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(e,n):(n=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,n.appendChild(e),r=r._reactRootContainer,r!=null||n.onclick!==null||(n.onclick=yt));else if(s!==4&&(s===27&&ba(e.type)&&(r=e.stateNode,n=null),e=e.child,e!==null))for(Zu(e,n,r),e=e.sibling;e!==null;)Zu(e,n,r),e=e.sibling}function go(e,n,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?r.insertBefore(e,n):r.appendChild(e);else if(s!==4&&(s===27&&ba(e.type)&&(r=e.stateNode),e=e.child,e!==null))for(go(e,n,r),e=e.sibling;e!==null;)go(e,n,r),e=e.sibling}function Cx(e){var n=e.stateNode,r=e.memoizedProps;try{for(var s=e.type,d=n.attributes;d.length;)n.removeAttributeNode(d[0]);dn(n,s,r),n[Ht]=e,n[vt]=r}catch(x){St(e,e.return,x)}}var Ul=!1,Wt=!1,Wu=!1,Nx=typeof WeakSet=="function"?WeakSet:Set,sn=null;function E2(e,n){if(e=e.containerInfo,bf=Lo,e=Lh(e),qc(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var s=r.getSelection&&r.getSelection();if(s&&s.rangeCount!==0){r=s.anchorNode;var d=s.anchorOffset,x=s.focusNode;s=s.focusOffset;try{r.nodeType,x.nodeType}catch{r=null;break e}var w=0,N=-1,R=-1,W=0,oe=0,fe=e,J=null;t:for(;;){for(var le;fe!==r||d!==0&&fe.nodeType!==3||(N=w+d),fe!==x||s!==0&&fe.nodeType!==3||(R=w+s),fe.nodeType===3&&(w+=fe.nodeValue.length),(le=fe.firstChild)!==null;)J=fe,fe=le;for(;;){if(fe===e)break t;if(J===r&&++W===d&&(N=w),J===x&&++oe===s&&(R=w),(le=fe.nextSibling)!==null)break;fe=J,J=fe.parentNode}fe=le}r=N===-1||R===-1?null:{start:N,end:R}}else r=null}r=r||{start:0,end:0}}else r=null;for(vf={focusedElem:e,selectionRange:r},Lo=!1,sn=n;sn!==null;)if(n=sn,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,sn=e;else for(;sn!==null;){switch(n=sn,x=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(r=0;r<e.length;r++)d=e[r],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&x!==null){e=void 0,r=n,d=x.memoizedProps,x=x.memoizedState,s=r.stateNode;try{var De=Za(r.type,d);e=s.getSnapshotBeforeUpdate(De,x),s.__reactInternalSnapshotBeforeUpdate=e}catch(He){St(r,r.return,He)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,r=e.nodeType,r===9)Sf(e);else if(r===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Sf(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(i(163))}if(e=n.sibling,e!==null){e.return=n.return,sn=e;break}sn=n.return}}function Ax(e,n,r){var s=r.flags;switch(r.tag){case 0:case 11:case 15:Yl(e,r),s&4&&Oi(5,r);break;case 1:if(Yl(e,r),s&4)if(e=r.stateNode,n===null)try{e.componentDidMount()}catch(w){St(r,r.return,w)}else{var d=Za(r.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(d,n,e.__reactInternalSnapshotBeforeUpdate)}catch(w){St(r,r.return,w)}}s&64&&kx(r),s&512&&Bi(r,r.return);break;case 3:if(Yl(e,r),s&64&&(e=r.updateQueue,e!==null)){if(n=null,r.child!==null)switch(r.child.tag){case 27:case 5:n=r.child.stateNode;break;case 1:n=r.child.stateNode}try{dm(e,n)}catch(w){St(r,r.return,w)}}break;case 27:n===null&&s&4&&Cx(r);case 26:case 5:Yl(e,r),n===null&&s&4&&jx(r),s&512&&Bi(r,r.return);break;case 12:Yl(e,r);break;case 31:Yl(e,r),s&4&&zx(e,r);break;case 13:Yl(e,r),s&4&&Mx(e,r),s&64&&(e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(r=F2.bind(null,r),eb(e,r))));break;case 22:if(s=r.memoizedState!==null||Ul,!s){n=n!==null&&n.memoizedState!==null||Wt,d=Ul;var x=Wt;Ul=s,(Wt=n)&&!x?ql(e,r,(r.subtreeFlags&8772)!==0):Yl(e,r),Ul=d,Wt=x}break;case 30:break;default:Yl(e,r)}}function Dx(e){var n=e.alternate;n!==null&&(e.alternate=null,Dx(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&ci(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Bt=null,En=!1;function Il(e,n,r){for(r=r.child;r!==null;)Tx(e,n,r),r=r.sibling}function Tx(e,n,r){if(de&&typeof de.onCommitFiberUnmount=="function")try{de.onCommitFiberUnmount(Ze,r)}catch{}switch(r.tag){case 26:Wt||gl(r,n),Il(e,n,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:Wt||gl(r,n);var s=Bt,d=En;ba(r.type)&&(Bt=r.stateNode,En=!1),Il(e,n,r),Vi(r.stateNode),Bt=s,En=d;break;case 5:Wt||gl(r,n);case 6:if(s=Bt,d=En,Bt=null,Il(e,n,r),Bt=s,En=d,Bt!==null)if(En)try{(Bt.nodeType===9?Bt.body:Bt.nodeName==="HTML"?Bt.ownerDocument.body:Bt).removeChild(r.stateNode)}catch(x){St(r,n,x)}else try{Bt.removeChild(r.stateNode)}catch(x){St(r,n,x)}break;case 18:Bt!==null&&(En?(e=Bt,kp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,r.stateNode),Xr(e)):kp(Bt,r.stateNode));break;case 4:s=Bt,d=En,Bt=r.stateNode.containerInfo,En=!0,Il(e,n,r),Bt=s,En=d;break;case 0:case 11:case 14:case 15:da(2,r,n),Wt||da(4,r,n),Il(e,n,r);break;case 1:Wt||(gl(r,n),s=r.stateNode,typeof s.componentWillUnmount=="function"&&Sx(r,n,s)),Il(e,n,r);break;case 21:Il(e,n,r);break;case 22:Wt=(s=Wt)||r.memoizedState!==null,Il(e,n,r),Wt=s;break;default:Il(e,n,r)}}function zx(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Xr(e)}catch(r){St(n,n.return,r)}}}function Mx(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Xr(e)}catch(r){St(n,n.return,r)}}function C2(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Nx),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Nx),n;default:throw Error(i(435,e.tag))}}function bo(e,n){var r=C2(e);n.forEach(function(s){if(!r.has(s)){r.add(s);var d=R2.bind(null,e,s);s.then(d,d)}})}function Cn(e,n){var r=n.deletions;if(r!==null)for(var s=0;s<r.length;s++){var d=r[s],x=e,w=n,N=w;e:for(;N!==null;){switch(N.tag){case 27:if(ba(N.type)){Bt=N.stateNode,En=!1;break e}break;case 5:Bt=N.stateNode,En=!1;break e;case 3:case 4:Bt=N.stateNode.containerInfo,En=!0;break e}N=N.return}if(Bt===null)throw Error(i(160));Tx(x,w,d),Bt=null,En=!1,x=d.alternate,x!==null&&(x.return=null),d.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)_x(n,e),n=n.sibling}var ol=null;function _x(e,n){var r=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Cn(n,e),Nn(e),s&4&&(da(3,e,e.return),Oi(3,e),da(5,e,e.return));break;case 1:Cn(n,e),Nn(e),s&512&&(Wt||r===null||gl(r,r.return)),s&64&&Ul&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(r=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=r===null?s:r.concat(s))));break;case 26:var d=ol;if(Cn(n,e),Nn(e),s&512&&(Wt||r===null||gl(r,r.return)),s&4){var x=r!==null?r.memoizedState:null;if(s=e.memoizedState,r===null)if(s===null)if(e.stateNode===null){e:{s=e.type,r=e.memoizedProps,d=d.ownerDocument||d;t:switch(s){case"title":x=d.getElementsByTagName("title")[0],(!x||x[il]||x[Ht]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=d.createElement(s),d.head.insertBefore(x,d.querySelector("head > title"))),dn(x,s,r),x[Ht]=e,Ut(x),s=x;break e;case"link":var w=_p("link","href",d).get(s+(r.href||""));if(w){for(var N=0;N<w.length;N++)if(x=w[N],x.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&x.getAttribute("rel")===(r.rel==null?null:r.rel)&&x.getAttribute("title")===(r.title==null?null:r.title)&&x.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){w.splice(N,1);break t}}x=d.createElement(s),dn(x,s,r),d.head.appendChild(x);break;case"meta":if(w=_p("meta","content",d).get(s+(r.content||""))){for(N=0;N<w.length;N++)if(x=w[N],x.getAttribute("content")===(r.content==null?null:""+r.content)&&x.getAttribute("name")===(r.name==null?null:r.name)&&x.getAttribute("property")===(r.property==null?null:r.property)&&x.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&x.getAttribute("charset")===(r.charSet==null?null:r.charSet)){w.splice(N,1);break t}}x=d.createElement(s),dn(x,s,r),d.head.appendChild(x);break;default:throw Error(i(468,s))}x[Ht]=e,Ut(x),s=x}e.stateNode=s}else Fp(d,e.type,e.stateNode);else e.stateNode=Mp(d,s,e.memoizedProps);else x!==s?(x===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):x.count--,s===null?Fp(d,e.type,e.stateNode):Mp(d,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Ku(e,e.memoizedProps,r.memoizedProps)}break;case 27:Cn(n,e),Nn(e),s&512&&(Wt||r===null||gl(r,r.return)),r!==null&&s&4&&Ku(e,e.memoizedProps,r.memoizedProps);break;case 5:if(Cn(n,e),Nn(e),s&512&&(Wt||r===null||gl(r,r.return)),e.flags&32){d=e.stateNode;try{ke(d,"")}catch(De){St(e,e.return,De)}}s&4&&e.stateNode!=null&&(d=e.memoizedProps,Ku(e,d,r!==null?r.memoizedProps:d)),s&1024&&(Wu=!0);break;case 6:if(Cn(n,e),Nn(e),s&4){if(e.stateNode===null)throw Error(i(162));s=e.memoizedProps,r=e.stateNode;try{r.nodeValue=s}catch(De){St(e,e.return,De)}}break;case 3:if(Ro=null,d=ol,ol=_o(n.containerInfo),Cn(n,e),ol=d,Nn(e),s&4&&r!==null&&r.memoizedState.isDehydrated)try{Xr(n.containerInfo)}catch(De){St(e,e.return,De)}Wu&&(Wu=!1,Fx(e));break;case 4:s=ol,ol=_o(e.stateNode.containerInfo),Cn(n,e),Nn(e),ol=s;break;case 12:Cn(n,e),Nn(e);break;case 31:Cn(n,e),Nn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bo(e,s)));break;case 13:Cn(n,e),Nn(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(wo=gt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bo(e,s)));break;case 22:d=e.memoizedState!==null;var R=r!==null&&r.memoizedState!==null,W=Ul,oe=Wt;if(Ul=W||d,Wt=oe||R,Cn(n,e),Wt=oe,Ul=W,Nn(e),s&8192)e:for(n=e.stateNode,n._visibility=d?n._visibility&-2:n._visibility|1,d&&(r===null||R||Ul||Wt||Wa(e)),r=null,n=e;;){if(n.tag===5||n.tag===26){if(r===null){R=r=n;try{if(x=R.stateNode,d)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{N=R.stateNode;var fe=R.memoizedProps.style,J=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;N.style.display=J==null||typeof J=="boolean"?"":(""+J).trim()}}catch(De){St(R,R.return,De)}}}else if(n.tag===6){if(r===null){R=n;try{R.stateNode.nodeValue=d?"":R.memoizedProps}catch(De){St(R,R.return,De)}}}else if(n.tag===18){if(r===null){R=n;try{var le=R.stateNode;d?Sp(le,!0):Sp(R.stateNode,!1)}catch(De){St(R,R.return,De)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;r===n&&(r=null),n=n.return}r===n&&(r=null),n.sibling.return=n.return,n=n.sibling}s&4&&(s=e.updateQueue,s!==null&&(r=s.retryQueue,r!==null&&(s.retryQueue=null,bo(e,r))));break;case 19:Cn(n,e),Nn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bo(e,s)));break;case 30:break;case 21:break;default:Cn(n,e),Nn(e)}}function Nn(e){var n=e.flags;if(n&2){try{for(var r,s=e.return;s!==null;){if(Ex(s)){r=s;break}s=s.return}if(r==null)throw Error(i(160));switch(r.tag){case 27:var d=r.stateNode,x=Qu(e);go(e,x,d);break;case 5:var w=r.stateNode;r.flags&32&&(ke(w,""),r.flags&=-33);var N=Qu(e);go(e,N,w);break;case 3:case 4:var R=r.stateNode.containerInfo,W=Qu(e);Zu(e,W,R);break;default:throw Error(i(161))}}catch(oe){St(e,e.return,oe)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Fx(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Fx(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Yl(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Ax(e,n.alternate,n),n=n.sibling}function Wa(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:da(4,n,n.return),Wa(n);break;case 1:gl(n,n.return);var r=n.stateNode;typeof r.componentWillUnmount=="function"&&Sx(n,n.return,r),Wa(n);break;case 27:Vi(n.stateNode);case 26:case 5:gl(n,n.return),Wa(n);break;case 22:n.memoizedState===null&&Wa(n);break;case 30:Wa(n);break;default:Wa(n)}e=e.sibling}}function ql(e,n,r){for(r=r&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var s=n.alternate,d=e,x=n,w=x.flags;switch(x.tag){case 0:case 11:case 15:ql(d,x,r),Oi(4,x);break;case 1:if(ql(d,x,r),s=x,d=s.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(W){St(s,s.return,W)}if(s=x,d=s.updateQueue,d!==null){var N=s.stateNode;try{var R=d.shared.hiddenCallbacks;if(R!==null)for(d.shared.hiddenCallbacks=null,d=0;d<R.length;d++)fm(R[d],N)}catch(W){St(s,s.return,W)}}r&&w&64&&kx(x),Bi(x,x.return);break;case 27:Cx(x);case 26:case 5:ql(d,x,r),r&&s===null&&w&4&&jx(x),Bi(x,x.return);break;case 12:ql(d,x,r);break;case 31:ql(d,x,r),r&&w&4&&zx(d,x);break;case 13:ql(d,x,r),r&&w&4&&Mx(d,x);break;case 22:x.memoizedState===null&&ql(d,x,r),Bi(x,x.return);break;case 30:break;default:ql(d,x,r)}n=n.sibling}}function Ju(e,n){var r=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==r&&(e!=null&&e.refCount++,r!=null&&Si(r))}function Pu(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Si(e))}function cl(e,n,r,s){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Rx(e,n,r,s),n=n.sibling}function Rx(e,n,r,s){var d=n.flags;switch(n.tag){case 0:case 11:case 15:cl(e,n,r,s),d&2048&&Oi(9,n);break;case 1:cl(e,n,r,s);break;case 3:cl(e,n,r,s),d&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Si(e)));break;case 12:if(d&2048){cl(e,n,r,s),e=n.stateNode;try{var x=n.memoizedProps,w=x.id,N=x.onPostCommit;typeof N=="function"&&N(w,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){St(n,n.return,R)}}else cl(e,n,r,s);break;case 31:cl(e,n,r,s);break;case 13:cl(e,n,r,s);break;case 23:break;case 22:x=n.stateNode,w=n.alternate,n.memoizedState!==null?x._visibility&2?cl(e,n,r,s):$i(e,n):x._visibility&2?cl(e,n,r,s):(x._visibility|=2,Fr(e,n,r,s,(n.subtreeFlags&10256)!==0||!1)),d&2048&&Ju(w,n);break;case 24:cl(e,n,r,s),d&2048&&Pu(n.alternate,n);break;default:cl(e,n,r,s)}}function Fr(e,n,r,s,d){for(d=d&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var x=e,w=n,N=r,R=s,W=w.flags;switch(w.tag){case 0:case 11:case 15:Fr(x,w,N,R,d),Oi(8,w);break;case 23:break;case 22:var oe=w.stateNode;w.memoizedState!==null?oe._visibility&2?Fr(x,w,N,R,d):$i(x,w):(oe._visibility|=2,Fr(x,w,N,R,d)),d&&W&2048&&Ju(w.alternate,w);break;case 24:Fr(x,w,N,R,d),d&&W&2048&&Pu(w.alternate,w);break;default:Fr(x,w,N,R,d)}n=n.sibling}}function $i(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var r=e,s=n,d=s.flags;switch(s.tag){case 22:$i(r,s),d&2048&&Ju(s.alternate,s);break;case 24:$i(r,s),d&2048&&Pu(s.alternate,s);break;default:$i(r,s)}n=n.sibling}}var Li=8192;function Rr(e,n,r){if(e.subtreeFlags&Li)for(e=e.child;e!==null;)Ox(e,n,r),e=e.sibling}function Ox(e,n,r){switch(e.tag){case 26:Rr(e,n,r),e.flags&Li&&e.memoizedState!==null&&db(r,ol,e.memoizedState,e.memoizedProps);break;case 5:Rr(e,n,r);break;case 3:case 4:var s=ol;ol=_o(e.stateNode.containerInfo),Rr(e,n,r),ol=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Li,Li=16777216,Rr(e,n,r),Li=s):Rr(e,n,r));break;default:Rr(e,n,r)}}function Bx(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function Hi(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];sn=s,Lx(s,e)}Bx(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)$x(e),e=e.sibling}function $x(e){switch(e.tag){case 0:case 11:case 15:Hi(e),e.flags&2048&&da(9,e,e.return);break;case 3:Hi(e);break;case 12:Hi(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,vo(e)):Hi(e);break;default:Hi(e)}}function vo(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];sn=s,Lx(s,e)}Bx(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:da(8,n,n.return),vo(n);break;case 22:r=n.stateNode,r._visibility&2&&(r._visibility&=-3,vo(n));break;default:vo(n)}e=e.sibling}}function Lx(e,n){for(;sn!==null;){var r=sn;switch(r.tag){case 0:case 11:case 15:da(8,r,n);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var s=r.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:Si(r.memoizedState.cache)}if(s=r.child,s!==null)s.return=r,sn=s;else e:for(r=e;sn!==null;){s=sn;var d=s.sibling,x=s.return;if(Dx(s),s===r){sn=null;break e}if(d!==null){d.return=x,sn=d;break e}sn=x}}}var N2={getCacheForType:function(e){var n=un(Kt),r=n.data.get(e);return r===void 0&&(r=e(),n.data.set(e,r)),r},cacheSignal:function(){return un(Kt).controller.signal}},A2=typeof WeakMap=="function"?WeakMap:Map,xt=0,Tt=null,Pe=null,lt=0,kt=0,$n=null,ha=!1,Or=!1,ef=!1,Xl=0,Yt=0,ma=0,Ja=0,tf=0,Ln=0,Br=0,Ui=null,An=null,nf=!1,wo=0,Hx=0,ko=1/0,So=null,xa=null,en=0,pa=null,$r=null,Vl=0,lf=0,af=null,Ux=null,Ii=0,rf=null;function Hn(){return(xt&2)!==0&<!==0?lt&-lt:U.T!==null?df():Al()}function Ix(){if(Ln===0)if((lt&536870912)===0||it){var e=nl;nl<<=1,(nl&3932160)===0&&(nl=262144),Ln=e}else Ln=536870912;return e=On.current,e!==null&&(e.flags|=32),Ln}function Dn(e,n,r){(e===Tt&&(kt===2||kt===9)||e.cancelPendingCommit!==null)&&(Lr(e,0),ya(e,lt,Ln,!1)),Mn(e,r),((xt&2)===0||e!==Tt)&&(e===Tt&&((xt&2)===0&&(Ja|=r),Yt===4&&ya(e,lt,Ln,!1)),bl(e))}function Yx(e,n,r){if((xt&6)!==0)throw Error(i(327));var s=!r&&(n&127)===0&&(n&e.expiredLanes)===0||Jl(e,n),d=s?z2(e,n):of(e,n,!0),x=s;do{if(d===0){Or&&!s&&ya(e,n,0,!1);break}else{if(r=e.current.alternate,x&&!D2(r)){d=of(e,n,!1),x=!1;continue}if(d===2){if(x=n,e.errorRecoveryDisabledLanes&x)var w=0;else w=e.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){n=w;e:{var N=e;d=Ui;var R=N.current.memoizedState.isDehydrated;if(R&&(Lr(N,w).flags|=256),w=of(N,w,!1),w!==2){if(ef&&!R){N.errorRecoveryDisabledLanes|=x,Ja|=x,d=4;break e}x=An,An=d,x!==null&&(An===null?An=x:An.push.apply(An,x))}d=w}if(x=!1,d!==2)continue}}if(d===1){Lr(e,0),ya(e,n,0,!0);break}e:{switch(s=e,x=d,x){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:ya(s,n,Ln,!ha);break e;case 2:An=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(d=wo+300-gt(),10<d)){if(ya(s,n,Ln,!ha),al(s,0,!0)!==0)break e;Vl=n,s.timeoutHandle=vp(qx.bind(null,s,r,An,So,nf,n,Ln,Ja,Br,ha,x,"Throttled",-0,0),d);break e}qx(s,r,An,So,nf,n,Ln,Ja,Br,ha,x,null,-0,0)}}break}while(!0);bl(e)}function qx(e,n,r,s,d,x,w,N,R,W,oe,fe,J,le){if(e.timeoutHandle=-1,fe=n.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:yt},Ox(n,x,fe);var De=(x&62914560)===x?wo-gt():(x&4194048)===x?Hx-gt():0;if(De=hb(fe,De),De!==null){Vl=x,e.cancelPendingCommit=De(Jx.bind(null,e,n,x,r,s,d,w,N,R,oe,fe,null,J,le)),ya(e,x,w,!W);return}}Jx(e,n,x,r,s,d,w,N,R)}function D2(e){for(var n=e;;){var r=n.tag;if((r===0||r===11||r===15)&&n.flags&16384&&(r=n.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var s=0;s<r.length;s++){var d=r[s],x=d.getSnapshot;d=d.value;try{if(!Fn(x(),d))return!1}catch{return!1}}if(r=n.child,n.subtreeFlags&16384&&r!==null)r.return=n,n=r;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function ya(e,n,r,s){n&=~tf,n&=~Ja,e.suspendedLanes|=n,e.pingedLanes&=~n,s&&(e.warmLanes|=n),s=e.expirationTimes;for(var d=n;0<d;){var x=31-ut(d),w=1<<x;s[x]=-1,d&=~w}r!==0&&ii(e,r,n)}function jo(){return(xt&6)===0?(Yi(0),!1):!0}function sf(){if(Pe!==null){if(kt===0)var e=Pe.return;else e=Pe,Rl=Ya=null,ku(e),Dr=null,Ei=0,e=Pe;for(;e!==null;)wx(e.alternate,e),e=e.return;Pe=null}}function Lr(e,n){var r=e.timeoutHandle;r!==-1&&(e.timeoutHandle=-1,Q2(r)),r=e.cancelPendingCommit,r!==null&&(e.cancelPendingCommit=null,r()),Vl=0,sf(),Tt=e,Pe=r=_l(e.current,null),lt=n,kt=0,$n=null,ha=!1,Or=Jl(e,n),ef=!1,Br=Ln=tf=Ja=ma=Yt=0,An=Ui=null,nf=!1,(n&8)!==0&&(n|=n&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=n;0<s;){var d=31-ut(s),x=1<<d;n|=e[d],s&=~x}return Xl=n,qs(),r}function Xx(e,n){Ge=null,U.H=_i,n===Ar||n===Js?(n=sm(),kt=3):n===uu?(n=sm(),kt=4):kt=n===$u?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,$n=n,Pe===null&&(Yt=1,ho(e,Gn(n,e.current)))}function Vx(){var e=On.current;return e===null?!0:(lt&4194048)===lt?Wn===null:(lt&62914560)===lt||(lt&536870912)!==0?e===Wn:!1}function Gx(){var e=U.H;return U.H=_i,e===null?_i:e}function Kx(){var e=U.A;return U.A=N2,e}function Eo(){Yt=4,ha||(lt&4194048)!==lt&&On.current!==null||(Or=!0),(ma&134217727)===0&&(Ja&134217727)===0||Tt===null||ya(Tt,lt,Ln,!1)}function of(e,n,r){var s=xt;xt|=2;var d=Gx(),x=Kx();(Tt!==e||lt!==n)&&(So=null,Lr(e,n)),n=!1;var w=Yt;e:do try{if(kt!==0&&Pe!==null){var N=Pe,R=$n;switch(kt){case 8:sf(),w=6;break e;case 3:case 2:case 9:case 6:On.current===null&&(n=!0);var W=kt;if(kt=0,$n=null,Hr(e,N,R,W),r&&Or){w=0;break e}break;default:W=kt,kt=0,$n=null,Hr(e,N,R,W)}}T2(),w=Yt;break}catch(oe){Xx(e,oe)}while(!0);return n&&e.shellSuspendCounter++,Rl=Ya=null,xt=s,U.H=d,U.A=x,Pe===null&&(Tt=null,lt=0,qs()),w}function T2(){for(;Pe!==null;)Qx(Pe)}function z2(e,n){var r=xt;xt|=2;var s=Gx(),d=Kx();Tt!==e||lt!==n?(So=null,ko=gt()+500,Lr(e,n)):Or=Jl(e,n);e:do try{if(kt!==0&&Pe!==null){n=Pe;var x=$n;t:switch(kt){case 1:kt=0,$n=null,Hr(e,n,x,1);break;case 2:case 9:if(rm(x)){kt=0,$n=null,Zx(n);break}n=function(){kt!==2&&kt!==9||Tt!==e||(kt=7),bl(e)},x.then(n,n);break e;case 3:kt=7;break e;case 4:kt=5;break e;case 7:rm(x)?(kt=0,$n=null,Zx(n)):(kt=0,$n=null,Hr(e,n,x,7));break;case 5:var w=null;switch(Pe.tag){case 26:w=Pe.memoizedState;case 5:case 27:var N=Pe;if(w?Rp(w):N.stateNode.complete){kt=0,$n=null;var R=N.sibling;if(R!==null)Pe=R;else{var W=N.return;W!==null?(Pe=W,Co(W)):Pe=null}break t}}kt=0,$n=null,Hr(e,n,x,5);break;case 6:kt=0,$n=null,Hr(e,n,x,6);break;case 8:sf(),Yt=6;break e;default:throw Error(i(462))}}M2();break}catch(oe){Xx(e,oe)}while(!0);return Rl=Ya=null,U.H=s,U.A=d,xt=r,Pe!==null?0:(Tt=null,lt=0,qs(),Yt)}function M2(){for(;Pe!==null&&!Dt();)Qx(Pe)}function Qx(e){var n=bx(e.alternate,e,Xl);e.memoizedProps=e.pendingProps,n===null?Co(e):Pe=n}function Zx(e){var n=e,r=n.alternate;switch(n.tag){case 15:case 0:n=hx(r,n,n.pendingProps,n.type,void 0,lt);break;case 11:n=hx(r,n,n.pendingProps,n.type.render,n.ref,lt);break;case 5:ku(n);default:wx(r,n),n=Pe=Kh(n,Xl),n=bx(r,n,Xl)}e.memoizedProps=e.pendingProps,n===null?Co(e):Pe=n}function Hr(e,n,r,s){Rl=Ya=null,ku(n),Dr=null,Ei=0;var d=n.return;try{if(v2(e,d,n,r,lt)){Yt=1,ho(e,Gn(r,e.current)),Pe=null;return}}catch(x){if(d!==null)throw Pe=d,x;Yt=1,ho(e,Gn(r,e.current)),Pe=null;return}n.flags&32768?(it||s===1?e=!0:Or||(lt&536870912)!==0?e=!1:(ha=e=!0,(s===2||s===9||s===3||s===6)&&(s=On.current,s!==null&&s.tag===13&&(s.flags|=16384))),Wx(n,e)):Co(n)}function Co(e){var n=e;do{if((n.flags&32768)!==0){Wx(n,ha);return}e=n.return;var r=S2(n.alternate,n,Xl);if(r!==null){Pe=r;return}if(n=n.sibling,n!==null){Pe=n;return}Pe=n=e}while(n!==null);Yt===0&&(Yt=5)}function Wx(e,n){do{var r=j2(e.alternate,e);if(r!==null){r.flags&=32767,Pe=r;return}if(r=e.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!n&&(e=e.sibling,e!==null)){Pe=e;return}Pe=e=r}while(e!==null);Yt=6,Pe=null}function Jx(e,n,r,s,d,x,w,N,R){e.cancelPendingCommit=null;do No();while(en!==0);if((xt&6)!==0)throw Error(i(327));if(n!==null){if(n===e.current)throw Error(i(177));if(x=n.lanes|n.childLanes,x|=Qc,ri(e,r,x,w,N,R),e===Tt&&(Pe=Tt=null,lt=0),$r=n,pa=e,Vl=r,lf=x,af=d,Ux=s,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,O2(_e,function(){return lp(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||s){s=U.T,U.T=null,d=Q.p,Q.p=2,w=xt,xt|=4;try{E2(e,n,r)}finally{xt=w,Q.p=d,U.T=s}}en=1,Px(),ep(),tp()}}function Px(){if(en===1){en=0;var e=pa,n=$r,r=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||r){r=U.T,U.T=null;var s=Q.p;Q.p=2;var d=xt;xt|=4;try{_x(n,e);var x=vf,w=Lh(e.containerInfo),N=x.focusedElem,R=x.selectionRange;if(w!==N&&N&&N.ownerDocument&&$h(N.ownerDocument.documentElement,N)){if(R!==null&&qc(N)){var W=R.start,oe=R.end;if(oe===void 0&&(oe=W),"selectionStart"in N)N.selectionStart=W,N.selectionEnd=Math.min(oe,N.value.length);else{var fe=N.ownerDocument||document,J=fe&&fe.defaultView||window;if(J.getSelection){var le=J.getSelection(),De=N.textContent.length,He=Math.min(R.start,De),Nt=R.end===void 0?He:Math.min(R.end,De);!le.extend&&He>Nt&&(w=Nt,Nt=He,He=w);var G=Bh(N,He),q=Bh(N,Nt);if(G&&q&&(le.rangeCount!==1||le.anchorNode!==G.node||le.anchorOffset!==G.offset||le.focusNode!==q.node||le.focusOffset!==q.offset)){var Z=fe.createRange();Z.setStart(G.node,G.offset),le.removeAllRanges(),He>Nt?(le.addRange(Z),le.extend(q.node,q.offset)):(Z.setEnd(q.node,q.offset),le.addRange(Z))}}}}for(fe=[],le=N;le=le.parentNode;)le.nodeType===1&&fe.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<fe.length;N++){var ce=fe[N];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Lo=!!bf,vf=bf=null}finally{xt=d,Q.p=s,U.T=r}}e.current=n,en=2}}function ep(){if(en===2){en=0;var e=pa,n=$r,r=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||r){r=U.T,U.T=null;var s=Q.p;Q.p=2;var d=xt;xt|=4;try{Ax(e,n.alternate,n)}finally{xt=d,Q.p=s,U.T=r}}en=3}}function tp(){if(en===4||en===3){en=0,on();var e=pa,n=$r,r=Vl,s=Ux;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?en=5:(en=0,$r=pa=null,np(e,e.pendingLanes));var d=e.pendingLanes;if(d===0&&(xa=null),Sn(r),n=n.stateNode,de&&typeof de.onCommitFiberRoot=="function")try{de.onCommitFiberRoot(Ze,n,void 0,(n.current.flags&128)===128)}catch{}if(s!==null){n=U.T,d=Q.p,Q.p=2,U.T=null;try{for(var x=e.onRecoverableError,w=0;w<s.length;w++){var N=s[w];x(N.value,{componentStack:N.stack})}}finally{U.T=n,Q.p=d}}(Vl&3)!==0&&No(),bl(e),d=e.pendingLanes,(r&261930)!==0&&(d&42)!==0?e===rf?Ii++:(Ii=0,rf=e):Ii=0,Yi(0)}}function np(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Si(n)))}function No(){return Px(),ep(),tp(),lp()}function lp(){if(en!==5)return!1;var e=pa,n=lf;lf=0;var r=Sn(Vl),s=U.T,d=Q.p;try{Q.p=32>r?32:r,U.T=null,r=af,af=null;var x=pa,w=Vl;if(en=0,$r=pa=null,Vl=0,(xt&6)!==0)throw Error(i(331));var N=xt;if(xt|=4,$x(x.current),Rx(x,x.current,w,r),xt=N,Yi(0,!1),de&&typeof de.onPostCommitFiberRoot=="function")try{de.onPostCommitFiberRoot(Ze,x)}catch{}return!0}finally{Q.p=d,U.T=s,np(e,n)}}function ap(e,n,r){n=Gn(r,n),n=Bu(e.stateNode,n,2),e=ca(e,n,2),e!==null&&(Mn(e,2),bl(e))}function St(e,n,r){if(e.tag===3)ap(e,e,r);else for(;n!==null;){if(n.tag===3){ap(n,e,r);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(xa===null||!xa.has(s))){e=Gn(r,e),r=rx(2),s=ca(n,r,2),s!==null&&(ix(r,s,n,e),Mn(s,2),bl(s));break}}n=n.return}}function cf(e,n,r){var s=e.pingCache;if(s===null){s=e.pingCache=new A2;var d=new Set;s.set(n,d)}else d=s.get(n),d===void 0&&(d=new Set,s.set(n,d));d.has(r)||(ef=!0,d.add(r),e=_2.bind(null,e,n,r),n.then(e,e))}function _2(e,n,r){var s=e.pingCache;s!==null&&s.delete(n),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,Tt===e&&(lt&r)===r&&(Yt===4||Yt===3&&(lt&62914560)===lt&&300>gt()-wo?(xt&2)===0&&Lr(e,0):tf|=r,Br===lt&&(Br=0)),bl(e)}function rp(e,n){n===0&&(n=cr()),e=Ha(e,n),e!==null&&(Mn(e,n),bl(e))}function F2(e){var n=e.memoizedState,r=0;n!==null&&(r=n.retryLane),rp(e,r)}function R2(e,n){var r=0;switch(e.tag){case 31:case 13:var s=e.stateNode,d=e.memoizedState;d!==null&&(r=d.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(i(314))}s!==null&&s.delete(n),rp(e,r)}function O2(e,n){return $t(e,n)}var Ao=null,Ur=null,uf=!1,Do=!1,ff=!1,ga=0;function bl(e){e!==Ur&&e.next===null&&(Ur===null?Ao=Ur=e:Ur=Ur.next=e),Do=!0,uf||(uf=!0,$2())}function Yi(e,n){if(!ff&&Do){ff=!0;do for(var r=!1,s=Ao;s!==null;){if(e!==0){var d=s.pendingLanes;if(d===0)var x=0;else{var w=s.suspendedLanes,N=s.pingedLanes;x=(1<<31-ut(42|e)+1)-1,x&=d&~(w&~N),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(r=!0,cp(s,x))}else x=lt,x=al(s,s===Tt?x:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(x&3)===0||Jl(s,x)||(r=!0,cp(s,x));s=s.next}while(r);ff=!1}}function B2(){ip()}function ip(){Do=uf=!1;var e=0;ga!==0&&K2()&&(e=ga);for(var n=gt(),r=null,s=Ao;s!==null;){var d=s.next,x=sp(s,n);x===0?(s.next=null,r===null?Ao=d:r.next=d,d===null&&(Ur=r)):(r=s,(e!==0||(x&3)!==0)&&(Do=!0)),s=d}en!==0&&en!==5||Yi(e),ga!==0&&(ga=0)}function sp(e,n){for(var r=e.suspendedLanes,s=e.pingedLanes,d=e.expirationTimes,x=e.pendingLanes&-62914561;0<x;){var w=31-ut(x),N=1<<w,R=d[w];R===-1?((N&r)===0||(N&s)!==0)&&(d[w]=As(N,n)):R<=n&&(e.expiredLanes|=N),x&=~N}if(n=Tt,r=lt,r=al(e,e===n?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,r===0||e===n&&(kt===2||kt===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&ct(s),e.callbackNode=null,e.callbackPriority=0;if((r&3)===0||Jl(e,r)){if(n=r&-r,n===e.callbackPriority)return n;switch(s!==null&&ct(s),Sn(r)){case 2:case 8:r=ye;break;case 32:r=_e;break;case 268435456:r=be;break;default:r=_e}return s=op.bind(null,e),r=$t(r,s),e.callbackPriority=n,e.callbackNode=r,n}return s!==null&&s!==null&&ct(s),e.callbackPriority=2,e.callbackNode=null,2}function op(e,n){if(en!==0&&en!==5)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if(No()&&e.callbackNode!==r)return null;var s=lt;return s=al(e,e===Tt?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Yx(e,s,n),sp(e,gt()),e.callbackNode!=null&&e.callbackNode===r?op.bind(null,e):null)}function cp(e,n){if(No())return null;Yx(e,n,!0)}function $2(){Z2(function(){(xt&6)!==0?$t(re,B2):ip()})}function df(){if(ga===0){var e=Cr;e===0&&(e=tl,tl<<=1,(tl&261888)===0&&(tl=256)),ga=e}return ga}function up(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:qe(""+e)}function fp(e,n){var r=n.ownerDocument.createElement("input");return r.name=n.name,r.value=n.value,e.id&&r.setAttribute("form",e.id),n.parentNode.insertBefore(r,n),e=new FormData(e),r.parentNode.removeChild(r),e}function L2(e,n,r,s,d){if(n==="submit"&&r&&r.stateNode===d){var x=up((d[vt]||null).action),w=s.submitter;w&&(n=(n=w[vt]||null)?up(n.formAction):w.getAttribute("formAction"),n!==null&&(x=n,w=null));var N=new Hs("action","action",null,s,d);e.push({event:N,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(ga!==0){var R=w?fp(d,w):new FormData(d);zu(r,{pending:!0,data:R,method:d.method,action:x},null,R)}}else typeof x=="function"&&(N.preventDefault(),R=w?fp(d,w):new FormData(d),zu(r,{pending:!0,data:R,method:d.method,action:x},x,R))},currentTarget:d}]})}}for(var hf=0;hf<Kc.length;hf++){var mf=Kc[hf],H2=mf.toLowerCase(),U2=mf[0].toUpperCase()+mf.slice(1);sl(H2,"on"+U2)}sl(Ih,"onAnimationEnd"),sl(Yh,"onAnimationIteration"),sl(qh,"onAnimationStart"),sl("dblclick","onDoubleClick"),sl("focusin","onFocus"),sl("focusout","onBlur"),sl(l2,"onTransitionRun"),sl(a2,"onTransitionStart"),sl(r2,"onTransitionCancel"),sl(Xh,"onTransitionEnd"),ta("onMouseEnter",["mouseout","mouseover"]),ta("onMouseLeave",["mouseout","mouseover"]),ta("onPointerEnter",["pointerout","pointerover"]),ta("onPointerLeave",["pointerout","pointerover"]),xl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),xl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),xl("onBeforeInput",["compositionend","keypress","textInput","paste"]),xl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),xl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),xl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qi="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(" "),I2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(qi));function dp(e,n){n=(n&4)!==0;for(var r=0;r<e.length;r++){var s=e[r],d=s.event;s=s.listeners;e:{var x=void 0;if(n)for(var w=s.length-1;0<=w;w--){var N=s[w],R=N.instance,W=N.currentTarget;if(N=N.listener,R!==x&&d.isPropagationStopped())break e;x=N,d.currentTarget=W;try{x(d)}catch(oe){Ys(oe)}d.currentTarget=null,x=R}else for(w=0;w<s.length;w++){if(N=s[w],R=N.instance,W=N.currentTarget,N=N.listener,R!==x&&d.isPropagationStopped())break e;x=N,d.currentTarget=W;try{x(d)}catch(oe){Ys(oe)}d.currentTarget=null,x=R}}}}function et(e,n){var r=n[_n];r===void 0&&(r=n[_n]=new Set);var s=e+"__bubble";r.has(s)||(hp(n,e,2,!1),r.add(s))}function xf(e,n,r){var s=0;n&&(s|=4),hp(r,e,s,n)}var To="_reactListening"+Math.random().toString(36).slice(2);function pf(e){if(!e[To]){e[To]=!0,Ms.forEach(function(r){r!=="selectionchange"&&(I2.has(r)||xf(r,!1,e),xf(r,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[To]||(n[To]=!0,xf("selectionchange",!1,n))}}function hp(e,n,r,s){switch(Ip(n)){case 2:var d=pb;break;case 8:d=yb;break;default:d=zf}r=d.bind(null,n,r,e),d=void 0,!Rc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(d=!0),s?d!==void 0?e.addEventListener(n,r,{capture:!0,passive:d}):e.addEventListener(n,r,!0):d!==void 0?e.addEventListener(n,r,{passive:d}):e.addEventListener(n,r,!1)}function yf(e,n,r,s,d){var x=s;if((n&1)===0&&(n&2)===0&&s!==null)e:for(;;){if(s===null)return;var w=s.tag;if(w===3||w===4){var N=s.stateNode.containerInfo;if(N===d)break;if(w===4)for(w=s.return;w!==null;){var R=w.tag;if((R===3||R===4)&&w.stateNode.containerInfo===d)return;w=w.return}for(;N!==null;){if(w=Ot(N),w===null)return;if(R=w.tag,R===5||R===6||R===26||R===27){s=x=w;continue e}N=N.parentNode}}s=s.return}gh(function(){var W=x,oe=_c(r),fe=[];e:{var J=Vh.get(e);if(J!==void 0){var le=Hs,De=e;switch(e){case"keypress":if($s(r)===0)break e;case"keydown":case"keyup":le=Rg;break;case"focusin":De="focus",le=Lc;break;case"focusout":De="blur",le=Lc;break;case"beforeblur":case"afterblur":le=Lc;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=wh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=Sg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=$g;break;case Ih:case Yh:case qh:le=Cg;break;case Xh:le=Hg;break;case"scroll":case"scrollend":le=wg;break;case"wheel":le=Ig;break;case"copy":case"cut":case"paste":le=Ag;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=Sh;break;case"toggle":case"beforetoggle":le=qg}var He=(n&4)!==0,Nt=!He&&(e==="scroll"||e==="scrollend"),G=He?J!==null?J+"Capture":null:J;He=[];for(var q=W,Z;q!==null;){var ce=q;if(Z=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||Z===null||G===null||(ce=di(q,G),ce!=null&&He.push(Xi(q,ce,Z))),Nt)break;q=q.return}0<He.length&&(J=new le(J,De,null,r,oe),fe.push({event:J,listeners:He}))}}if((n&7)===0){e:{if(J=e==="mouseover"||e==="pointerover",le=e==="mouseout"||e==="pointerout",J&&r!==Mc&&(De=r.relatedTarget||r.fromElement)&&(Ot(De)||De[rl]))break e;if((le||J)&&(J=oe.window===oe?oe:(J=oe.ownerDocument)?J.defaultView||J.parentWindow:window,le?(De=r.relatedTarget||r.toElement,le=W,De=De?Ot(De):null,De!==null&&(Nt=u(De),He=De.tag,De!==Nt||He!==5&&He!==27&&He!==6)&&(De=null)):(le=null,De=W),le!==De)){if(He=wh,ce="onMouseLeave",G="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(He=Sh,ce="onPointerLeave",G="onPointerEnter",q="pointer"),Nt=le==null?J:Oa(le),Z=De==null?J:Oa(De),J=new He(ce,q+"leave",le,r,oe),J.target=Nt,J.relatedTarget=Z,ce=null,Ot(oe)===W&&(He=new He(G,q+"enter",De,r,oe),He.target=Z,He.relatedTarget=Nt,ce=He),Nt=ce,le&&De)t:{for(He=Y2,G=le,q=De,Z=0,ce=G;ce;ce=He(ce))Z++;ce=0;for(var Be=q;Be;Be=He(Be))ce++;for(;0<Z-ce;)G=He(G),Z--;for(;0<ce-Z;)q=He(q),ce--;for(;Z--;){if(G===q||q!==null&&G===q.alternate){He=G;break t}G=He(G),q=He(q)}He=null}else He=null;le!==null&&mp(fe,J,le,He,!1),De!==null&&Nt!==null&&mp(fe,Nt,De,He,!0)}}e:{if(J=W?Oa(W):window,le=J.nodeName&&J.nodeName.toLowerCase(),le==="select"||le==="input"&&J.type==="file")var dt=zh;else if(Dh(J))if(Mh)dt=e2;else{dt=Jg;var ze=Wg}else le=J.nodeName,!le||le.toLowerCase()!=="input"||J.type!=="checkbox"&&J.type!=="radio"?W&&Ie(W.elementType)&&(dt=zh):dt=Pg;if(dt&&(dt=dt(e,W))){Th(fe,dt,r,oe);break e}ze&&ze(e,J,W),e==="focusout"&&W&&J.type==="number"&&W.memoizedProps.value!=null&&mr(J,"number",J.value)}switch(ze=W?Oa(W):window,e){case"focusin":(Dh(ze)||ze.contentEditable==="true")&&(gr=ze,Xc=W,vi=null);break;case"focusout":vi=Xc=gr=null;break;case"mousedown":Vc=!0;break;case"contextmenu":case"mouseup":case"dragend":Vc=!1,Hh(fe,r,oe);break;case"selectionchange":if(n2)break;case"keydown":case"keyup":Hh(fe,r,oe)}var Ke;if(Uc)e:{switch(e){case"compositionstart":var at="onCompositionStart";break e;case"compositionend":at="onCompositionEnd";break e;case"compositionupdate":at="onCompositionUpdate";break e}at=void 0}else yr?Nh(e,r)&&(at="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(at="onCompositionStart");at&&(jh&&r.locale!=="ko"&&(yr||at!=="onCompositionStart"?at==="onCompositionEnd"&&yr&&(Ke=bh()):(na=oe,Oc="value"in na?na.value:na.textContent,yr=!0)),ze=zo(W,at),0<ze.length&&(at=new kh(at,e,null,r,oe),fe.push({event:at,listeners:ze}),Ke?at.data=Ke:(Ke=Ah(r),Ke!==null&&(at.data=Ke)))),(Ke=Vg?Gg(e,r):Kg(e,r))&&(at=zo(W,"onBeforeInput"),0<at.length&&(ze=new kh("onBeforeInput","beforeinput",null,r,oe),fe.push({event:ze,listeners:at}),ze.data=Ke)),L2(fe,e,W,r,oe)}dp(fe,n)})}function Xi(e,n,r){return{instance:e,listener:n,currentTarget:r}}function zo(e,n){for(var r=n+"Capture",s=[];e!==null;){var d=e,x=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||x===null||(d=di(e,r),d!=null&&s.unshift(Xi(e,d,x)),d=di(e,n),d!=null&&s.push(Xi(e,d,x))),e.tag===3)return s;e=e.return}return[]}function Y2(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function mp(e,n,r,s,d){for(var x=n._reactName,w=[];r!==null&&r!==s;){var N=r,R=N.alternate,W=N.stateNode;if(N=N.tag,R!==null&&R===s)break;N!==5&&N!==26&&N!==27||W===null||(R=W,d?(W=di(r,x),W!=null&&w.unshift(Xi(r,W,R))):d||(W=di(r,x),W!=null&&w.push(Xi(r,W,R)))),r=r.return}w.length!==0&&e.push({event:n,listeners:w})}var q2=/\r\n?/g,X2=/\u0000|\uFFFD/g;function xp(e){return(typeof e=="string"?e:""+e).replace(q2,`
|
|
49
|
-
`).replace(X2,"")}function pp(e,n){return n=xp(n),xp(e)===n}function Ct(e,n,r,s,d,x){switch(r){case"children":typeof s=="string"?n==="body"||n==="textarea"&&s===""||ke(e,s):(typeof s=="number"||typeof s=="bigint")&&n!=="body"&&ke(e,""+s);break;case"className":dr(e,"class",s);break;case"tabIndex":dr(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":dr(e,r,s);break;case"style":$e(e,s,x);break;case"data":if(n!=="object"){dr(e,"data",s);break}case"src":case"href":if(s===""&&(n!=="a"||r!=="href")){e.removeAttribute(r);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(r);break}s=qe(""+s),e.setAttribute(r,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(r,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(r==="formAction"?(n!=="input"&&Ct(e,n,"name",d.name,d,null),Ct(e,n,"formEncType",d.formEncType,d,null),Ct(e,n,"formMethod",d.formMethod,d,null),Ct(e,n,"formTarget",d.formTarget,d,null)):(Ct(e,n,"encType",d.encType,d,null),Ct(e,n,"method",d.method,d,null),Ct(e,n,"target",d.target,d,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(r);break}s=qe(""+s),e.setAttribute(r,s);break;case"onClick":s!=null&&(e.onclick=yt);break;case"onScroll":s!=null&&et("scroll",e);break;case"onScrollEnd":s!=null&&et("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(i(61));if(r=s.__html,r!=null){if(d.children!=null)throw Error(i(60));e.innerHTML=r}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}r=qe(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(r,""+s):e.removeAttribute(r);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(r,""):e.removeAttribute(r);break;case"capture":case"download":s===!0?e.setAttribute(r,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(r,s):e.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(r,s):e.removeAttribute(r);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(r):e.setAttribute(r,s);break;case"popover":et("beforetoggle",e),et("toggle",e),fr(e,"popover",s);break;case"xlinkActuate":rn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":rn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":rn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":rn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":rn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":rn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":rn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":rn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":rn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":fr(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=nt.get(r)||r,fr(e,r,s))}}function gf(e,n,r,s,d,x){switch(r){case"style":$e(e,s,x);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(i(61));if(r=s.__html,r!=null){if(d.children!=null)throw Error(i(60));e.innerHTML=r}}break;case"children":typeof s=="string"?ke(e,s):(typeof s=="number"||typeof s=="bigint")&&ke(e,""+s);break;case"onScroll":s!=null&&et("scroll",e);break;case"onScrollEnd":s!=null&&et("scrollend",e);break;case"onClick":s!=null&&(e.onclick=yt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!_s.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(d=r.endsWith("Capture"),n=r.slice(2,d?r.length-7:void 0),x=e[vt]||null,x=x!=null?x[r]:null,typeof x=="function"&&e.removeEventListener(n,x,d),typeof s=="function")){typeof x!="function"&&x!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(n,s,d);break e}r in e?e[r]=s:s===!0?e.setAttribute(r,""):fr(e,r,s)}}}function dn(e,n,r){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":et("error",e),et("load",e);var s=!1,d=!1,x;for(x in r)if(r.hasOwnProperty(x)){var w=r[x];if(w!=null)switch(x){case"src":s=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Ct(e,n,x,w,r,null)}}d&&Ct(e,n,"srcSet",r.srcSet,r,null),s&&Ct(e,n,"src",r.src,r,null);return;case"input":et("invalid",e);var N=x=w=d=null,R=null,W=null;for(s in r)if(r.hasOwnProperty(s)){var oe=r[s];if(oe!=null)switch(s){case"name":d=oe;break;case"type":w=oe;break;case"checked":R=oe;break;case"defaultChecked":W=oe;break;case"value":x=oe;break;case"defaultValue":N=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(i(137,n));break;default:Ct(e,n,s,oe,r,null)}}fi(e,x,N,R,W,w,d,!1);return;case"select":et("invalid",e),s=w=x=null;for(d in r)if(r.hasOwnProperty(d)&&(N=r[d],N!=null))switch(d){case"value":x=N;break;case"defaultValue":w=N;break;case"multiple":s=N;default:Ct(e,n,d,N,r,null)}n=x,r=w,e.multiple=!!s,n!=null?zl(e,!!s,n,!1):r!=null&&zl(e,!!s,r,!0);return;case"textarea":et("invalid",e),x=d=s=null;for(w in r)if(r.hasOwnProperty(w)&&(N=r[w],N!=null))switch(w){case"value":s=N;break;case"defaultValue":d=N;break;case"children":x=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(i(91));break;default:Ct(e,n,w,N,r,null)}he(e,s,d,x);return;case"option":for(R in r)if(r.hasOwnProperty(R)&&(s=r[R],s!=null))switch(R){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:Ct(e,n,R,s,r,null)}return;case"dialog":et("beforetoggle",e),et("toggle",e),et("cancel",e),et("close",e);break;case"iframe":case"object":et("load",e);break;case"video":case"audio":for(s=0;s<qi.length;s++)et(qi[s],e);break;case"image":et("error",e),et("load",e);break;case"details":et("toggle",e);break;case"embed":case"source":case"link":et("error",e),et("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(W in r)if(r.hasOwnProperty(W)&&(s=r[W],s!=null))switch(W){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Ct(e,n,W,s,r,null)}return;default:if(Ie(n)){for(oe in r)r.hasOwnProperty(oe)&&(s=r[oe],s!==void 0&&gf(e,n,oe,s,r,void 0));return}}for(N in r)r.hasOwnProperty(N)&&(s=r[N],s!=null&&Ct(e,n,N,s,r,null))}function V2(e,n,r,s){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,x=null,w=null,N=null,R=null,W=null,oe=null;for(le in r){var fe=r[le];if(r.hasOwnProperty(le)&&fe!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":R=fe;default:s.hasOwnProperty(le)||Ct(e,n,le,null,s,fe)}}for(var J in s){var le=s[J];if(fe=r[J],s.hasOwnProperty(J)&&(le!=null||fe!=null))switch(J){case"type":x=le;break;case"name":d=le;break;case"checked":W=le;break;case"defaultChecked":oe=le;break;case"value":w=le;break;case"defaultValue":N=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(i(137,n));break;default:le!==fe&&Ct(e,n,J,le,s,fe)}}Tl(e,w,N,R,W,oe,x,d);return;case"select":le=w=N=J=null;for(x in r)if(R=r[x],r.hasOwnProperty(x)&&R!=null)switch(x){case"value":break;case"multiple":le=R;default:s.hasOwnProperty(x)||Ct(e,n,x,null,s,R)}for(d in s)if(x=s[d],R=r[d],s.hasOwnProperty(d)&&(x!=null||R!=null))switch(d){case"value":J=x;break;case"defaultValue":N=x;break;case"multiple":w=x;default:x!==R&&Ct(e,n,d,x,s,R)}n=N,r=w,s=le,J!=null?zl(e,!!r,J,!1):!!s!=!!r&&(n!=null?zl(e,!!r,n,!0):zl(e,!!r,r?[]:"",!1));return;case"textarea":le=J=null;for(N in r)if(d=r[N],r.hasOwnProperty(N)&&d!=null&&!s.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:Ct(e,n,N,null,s,d)}for(w in s)if(d=s[w],x=r[w],s.hasOwnProperty(w)&&(d!=null||x!=null))switch(w){case"value":J=d;break;case"defaultValue":le=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(i(91));break;default:d!==x&&Ct(e,n,w,d,s,x)}H(e,J,le);return;case"option":for(var De in r)if(J=r[De],r.hasOwnProperty(De)&&J!=null&&!s.hasOwnProperty(De))switch(De){case"selected":e.selected=!1;break;default:Ct(e,n,De,null,s,J)}for(R in s)if(J=s[R],le=r[R],s.hasOwnProperty(R)&&J!==le&&(J!=null||le!=null))switch(R){case"selected":e.selected=J&&typeof J!="function"&&typeof J!="symbol";break;default:Ct(e,n,R,J,s,le)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var He in r)J=r[He],r.hasOwnProperty(He)&&J!=null&&!s.hasOwnProperty(He)&&Ct(e,n,He,null,s,J);for(W in s)if(J=s[W],le=r[W],s.hasOwnProperty(W)&&J!==le&&(J!=null||le!=null))switch(W){case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(i(137,n));break;default:Ct(e,n,W,J,s,le)}return;default:if(Ie(n)){for(var Nt in r)J=r[Nt],r.hasOwnProperty(Nt)&&J!==void 0&&!s.hasOwnProperty(Nt)&&gf(e,n,Nt,void 0,s,J);for(oe in s)J=s[oe],le=r[oe],!s.hasOwnProperty(oe)||J===le||J===void 0&&le===void 0||gf(e,n,oe,J,s,le);return}}for(var G in r)J=r[G],r.hasOwnProperty(G)&&J!=null&&!s.hasOwnProperty(G)&&Ct(e,n,G,null,s,J);for(fe in s)J=s[fe],le=r[fe],!s.hasOwnProperty(fe)||J===le||J==null&&le==null||Ct(e,n,fe,J,s,le)}function yp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function G2(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,r=performance.getEntriesByType("resource"),s=0;s<r.length;s++){var d=r[s],x=d.transferSize,w=d.initiatorType,N=d.duration;if(x&&N&&yp(w)){for(w=0,N=d.responseEnd,s+=1;s<r.length;s++){var R=r[s],W=R.startTime;if(W>N)break;var oe=R.transferSize,fe=R.initiatorType;oe&&yp(fe)&&(R=R.responseEnd,w+=oe*(R<N?1:(N-W)/(R-W)))}if(--s,n+=8*(x+w)/(d.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var bf=null,vf=null;function Mo(e){return e.nodeType===9?e:e.ownerDocument}function gp(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function bp(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function wf(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var kf=null;function K2(){var e=window.event;return e&&e.type==="popstate"?e===kf?!1:(kf=e,!0):(kf=null,!1)}var vp=typeof setTimeout=="function"?setTimeout:void 0,Q2=typeof clearTimeout=="function"?clearTimeout:void 0,wp=typeof Promise=="function"?Promise:void 0,Z2=typeof queueMicrotask=="function"?queueMicrotask:typeof wp<"u"?function(e){return wp.resolve(null).then(e).catch(W2)}:vp;function W2(e){setTimeout(function(){throw e})}function ba(e){return e==="head"}function kp(e,n){var r=n,s=0;do{var d=r.nextSibling;if(e.removeChild(r),d&&d.nodeType===8)if(r=d.data,r==="/$"||r==="/&"){if(s===0){e.removeChild(d),Xr(n);return}s--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")s++;else if(r==="html")Vi(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,Vi(r);for(var x=r.firstChild;x;){var w=x.nextSibling,N=x.nodeName;x[il]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&x.rel.toLowerCase()==="stylesheet"||r.removeChild(x),x=w}}else r==="body"&&Vi(e.ownerDocument.body);r=d}while(r);Xr(n)}function Sp(e,n){var r=e;e=0;do{var s=r.nextSibling;if(r.nodeType===1?n?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(n?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),s&&s.nodeType===8)if(r=s.data,r==="/$"){if(e===0)break;e--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||e++;r=s}while(r)}function Sf(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var r=n;switch(n=n.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":Sf(r),ci(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function J2(e,n,r,s){for(;e.nodeType===1;){var d=r;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[il])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(x=e.getAttribute("rel"),x==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(x!==d.rel||e.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||e.getAttribute("title")!==(d.title==null?null:d.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(x=e.getAttribute("src"),(x!==(d.src==null?null:d.src)||e.getAttribute("type")!==(d.type==null?null:d.type)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&x&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var x=d.name==null?null:""+d.name;if(d.type==="hidden"&&e.getAttribute("name")===x)return e}else return e;if(e=Jn(e.nextSibling),e===null)break}return null}function P2(e,n,r){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=Jn(e.nextSibling),e===null))return null;return e}function jp(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Jn(e.nextSibling),e===null))return null;return e}function jf(e){return e.data==="$?"||e.data==="$~"}function Ef(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function eb(e,n){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||r.readyState!=="loading")n();else{var s=function(){n(),r.removeEventListener("DOMContentLoaded",s)};r.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function Jn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Cf=null;function Ep(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(n===0)return Jn(e.nextSibling);n--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||n++}e=e.nextSibling}return null}function Cp(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(n===0)return e;n--}else r!=="/$"&&r!=="/&"||n++}e=e.previousSibling}return null}function Np(e,n,r){switch(n=Mo(r),e){case"html":if(e=n.documentElement,!e)throw Error(i(452));return e;case"head":if(e=n.head,!e)throw Error(i(453));return e;case"body":if(e=n.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Vi(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);ci(e)}var Pn=new Map,Ap=new Set;function _o(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Gl=Q.d;Q.d={f:tb,r:nb,D:lb,C:ab,L:rb,m:ib,X:ob,S:sb,M:cb};function tb(){var e=Gl.f(),n=jo();return e||n}function nb(e){var n=ea(e);n!==null&&n.tag===5&&n.type==="form"?Xm(n):Gl.r(e)}var Ir=typeof document>"u"?null:document;function Dp(e,n,r){var s=Ir;if(s&&typeof n=="string"&&n){var d=wt(n);d='link[rel="'+e+'"][href="'+d+'"]',typeof r=="string"&&(d+='[crossorigin="'+r+'"]'),Ap.has(d)||(Ap.add(d),e={rel:e,crossOrigin:r,href:n},s.querySelector(d)===null&&(n=s.createElement("link"),dn(n,"link",e),Ut(n),s.head.appendChild(n)))}}function lb(e){Gl.D(e),Dp("dns-prefetch",e,null)}function ab(e,n){Gl.C(e,n),Dp("preconnect",e,n)}function rb(e,n,r){Gl.L(e,n,r);var s=Ir;if(s&&e&&n){var d='link[rel="preload"][as="'+wt(n)+'"]';n==="image"&&r&&r.imageSrcSet?(d+='[imagesrcset="'+wt(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(d+='[imagesizes="'+wt(r.imageSizes)+'"]')):d+='[href="'+wt(e)+'"]';var x=d;switch(n){case"style":x=Yr(e);break;case"script":x=qr(e)}Pn.has(x)||(e=y({rel:"preload",href:n==="image"&&r&&r.imageSrcSet?void 0:e,as:n},r),Pn.set(x,e),s.querySelector(d)!==null||n==="style"&&s.querySelector(Gi(x))||n==="script"&&s.querySelector(Ki(x))||(n=s.createElement("link"),dn(n,"link",e),Ut(n),s.head.appendChild(n)))}}function ib(e,n){Gl.m(e,n);var r=Ir;if(r&&e){var s=n&&typeof n.as=="string"?n.as:"script",d='link[rel="modulepreload"][as="'+wt(s)+'"][href="'+wt(e)+'"]',x=d;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=qr(e)}if(!Pn.has(x)&&(e=y({rel:"modulepreload",href:e},n),Pn.set(x,e),r.querySelector(d)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Ki(x)))return}s=r.createElement("link"),dn(s,"link",e),Ut(s),r.head.appendChild(s)}}}function sb(e,n,r){Gl.S(e,n,r);var s=Ir;if(s&&e){var d=Dl(s).hoistableStyles,x=Yr(e);n=n||"default";var w=d.get(x);if(!w){var N={loading:0,preload:null};if(w=s.querySelector(Gi(x)))N.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},r),(r=Pn.get(x))&&Nf(e,r);var R=w=s.createElement("link");Ut(R),dn(R,"link",e),R._p=new Promise(function(W,oe){R.onload=W,R.onerror=oe}),R.addEventListener("load",function(){N.loading|=1}),R.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Fo(w,n,s)}w={type:"stylesheet",instance:w,count:1,state:N},d.set(x,w)}}}function ob(e,n){Gl.X(e,n);var r=Ir;if(r&&e){var s=Dl(r).hoistableScripts,d=qr(e),x=s.get(d);x||(x=r.querySelector(Ki(d)),x||(e=y({src:e,async:!0},n),(n=Pn.get(d))&&Af(e,n),x=r.createElement("script"),Ut(x),dn(x,"link",e),r.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},s.set(d,x))}}function cb(e,n){Gl.M(e,n);var r=Ir;if(r&&e){var s=Dl(r).hoistableScripts,d=qr(e),x=s.get(d);x||(x=r.querySelector(Ki(d)),x||(e=y({src:e,async:!0,type:"module"},n),(n=Pn.get(d))&&Af(e,n),x=r.createElement("script"),Ut(x),dn(x,"link",e),r.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},s.set(d,x))}}function Tp(e,n,r,s){var d=(d=Ce.current)?_o(d):null;if(!d)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(n=Yr(r.href),r=Dl(d).hoistableStyles,s=r.get(n),s||(s={type:"style",instance:null,count:0,state:null},r.set(n,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=Yr(r.href);var x=Dl(d).hoistableStyles,w=x.get(e);if(w||(d=d.ownerDocument||d,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(e,w),(x=d.querySelector(Gi(e)))&&!x._p&&(w.instance=x,w.state.loading=5),Pn.has(e)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},Pn.set(e,r),x||ub(d,e,r,w.state))),n&&s===null)throw Error(i(528,""));return w}if(n&&s!==null)throw Error(i(529,""));return null;case"script":return n=r.async,r=r.src,typeof r=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=qr(r),r=Dl(d).hoistableScripts,s=r.get(n),s||(s={type:"script",instance:null,count:0,state:null},r.set(n,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Yr(e){return'href="'+wt(e)+'"'}function Gi(e){return'link[rel="stylesheet"]['+e+"]"}function zp(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function ub(e,n,r,s){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?s.loading=1:(n=e.createElement("link"),s.preload=n,n.addEventListener("load",function(){return s.loading|=1}),n.addEventListener("error",function(){return s.loading|=2}),dn(n,"link",r),Ut(n),e.head.appendChild(n))}function qr(e){return'[src="'+wt(e)+'"]'}function Ki(e){return"script[async]"+e}function Mp(e,n,r){if(n.count++,n.instance===null)switch(n.type){case"style":var s=e.querySelector('style[data-href~="'+wt(r.href)+'"]');if(s)return n.instance=s,Ut(s),s;var d=y({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Ut(s),dn(s,"style",d),Fo(s,r.precedence,e),n.instance=s;case"stylesheet":d=Yr(r.href);var x=e.querySelector(Gi(d));if(x)return n.state.loading|=4,n.instance=x,Ut(x),x;s=zp(r),(d=Pn.get(d))&&Nf(s,d),x=(e.ownerDocument||e).createElement("link"),Ut(x);var w=x;return w._p=new Promise(function(N,R){w.onload=N,w.onerror=R}),dn(x,"link",s),n.state.loading|=4,Fo(x,r.precedence,e),n.instance=x;case"script":return x=qr(r.src),(d=e.querySelector(Ki(x)))?(n.instance=d,Ut(d),d):(s=r,(d=Pn.get(x))&&(s=y({},r),Af(s,d)),e=e.ownerDocument||e,d=e.createElement("script"),Ut(d),dn(d,"link",s),e.head.appendChild(d),n.instance=d);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(s=n.instance,n.state.loading|=4,Fo(s,r.precedence,e));return n.instance}function Fo(e,n,r){for(var s=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=s.length?s[s.length-1]:null,x=d,w=0;w<s.length;w++){var N=s[w];if(N.dataset.precedence===n)x=N;else if(x!==d)break}x?x.parentNode.insertBefore(e,x.nextSibling):(n=r.nodeType===9?r.head:r,n.insertBefore(e,n.firstChild))}function Nf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Af(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Ro=null;function _p(e,n,r){if(Ro===null){var s=new Map,d=Ro=new Map;d.set(r,s)}else d=Ro,s=d.get(r),s||(s=new Map,d.set(r,s));if(s.has(e))return s;for(s.set(e,null),r=r.getElementsByTagName(e),d=0;d<r.length;d++){var x=r[d];if(!(x[il]||x[Ht]||e==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(n)||"";w=e+w;var N=s.get(w);N?N.push(x):s.set(w,[x])}}return s}function Fp(e,n,r){e=e.ownerDocument||e,e.head.insertBefore(r,n==="title"?e.querySelector("head > title"):null)}function fb(e,n,r){if(r===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Rp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function db(e,n,r,s){if(r.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var d=Yr(s.href),x=n.querySelector(Gi(d));if(x){n=x._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Oo.bind(e),n.then(e,e)),r.state.loading|=4,r.instance=x,Ut(x);return}x=n.ownerDocument||n,s=zp(s),(d=Pn.get(d))&&Nf(s,d),x=x.createElement("link"),Ut(x);var w=x;w._p=new Promise(function(N,R){w.onload=N,w.onerror=R}),dn(x,"link",s),r.instance=x}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,n),(n=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=Oo.bind(e),n.addEventListener("load",r),n.addEventListener("error",r))}}var Df=0;function hb(e,n){return e.stylesheets&&e.count===0&&$o(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var s=setTimeout(function(){if(e.stylesheets&&$o(e,e.stylesheets),e.unsuspend){var x=e.unsuspend;e.unsuspend=null,x()}},6e4+n);0<e.imgBytes&&Df===0&&(Df=62500*G2());var d=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&$o(e,e.stylesheets),e.unsuspend)){var x=e.unsuspend;e.unsuspend=null,x()}},(e.imgBytes>Df?50:800)+n);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(d)}}:null}function Oo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)$o(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Bo=null;function $o(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Bo=new Map,n.forEach(mb,e),Bo=null,Oo.call(e))}function mb(e,n){if(!(n.state.loading&4)){var r=Bo.get(e);if(r)var s=r.get(null);else{r=new Map,Bo.set(e,r);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<d.length;x++){var w=d[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(r.set(w.dataset.precedence,w),s=w)}s&&r.set(null,s)}d=n.instance,w=d.getAttribute("data-precedence"),x=r.get(w)||s,x===s&&r.set(null,d),r.set(w,d),this.count++,s=Oo.bind(this),d.addEventListener("load",s),d.addEventListener("error",s),x?x.parentNode.insertBefore(d,x.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(d,e.firstChild)),n.state.loading|=4}}var Qi={$$typeof:$,Provider:null,Consumer:null,_currentValue:ie,_currentValue2:ie,_threadCount:0};function xb(e,n,r,s,d,x,w,N,R){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ur(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ur(0),this.hiddenUpdates=ur(null),this.identifierPrefix=s,this.onUncaughtError=d,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Op(e,n,r,s,d,x,w,N,R,W,oe,fe){return e=new xb(e,n,r,w,R,W,oe,fe,N),n=1,x===!0&&(n|=24),x=Rn(3,null,null,n),e.current=x,x.stateNode=e,n=su(),n.refCount++,e.pooledCache=n,n.refCount++,x.memoizedState={element:s,isDehydrated:r,cache:n},fu(x),e}function Bp(e){return e?(e=wr,e):wr}function $p(e,n,r,s,d,x){d=Bp(d),s.context===null?s.context=d:s.pendingContext=d,s=oa(n),s.payload={element:r},x=x===void 0?null:x,x!==null&&(s.callback=x),r=ca(e,s,n),r!==null&&(Dn(r,e,n),Ni(r,e,n))}function Lp(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<n?r:n}}function Tf(e,n){Lp(e,n),(e=e.alternate)&&Lp(e,n)}function Hp(e){if(e.tag===13||e.tag===31){var n=Ha(e,67108864);n!==null&&Dn(n,e,67108864),Tf(e,67108864)}}function Up(e){if(e.tag===13||e.tag===31){var n=Hn();n=Ra(n);var r=Ha(e,n);r!==null&&Dn(r,e,n),Tf(e,n)}}var Lo=!0;function pb(e,n,r,s){var d=U.T;U.T=null;var x=Q.p;try{Q.p=2,zf(e,n,r,s)}finally{Q.p=x,U.T=d}}function yb(e,n,r,s){var d=U.T;U.T=null;var x=Q.p;try{Q.p=8,zf(e,n,r,s)}finally{Q.p=x,U.T=d}}function zf(e,n,r,s){if(Lo){var d=Mf(s);if(d===null)yf(e,n,s,Ho,r),Yp(e,s);else if(bb(d,e,n,r,s))s.stopPropagation();else if(Yp(e,s),n&4&&-1<gb.indexOf(e)){for(;d!==null;){var x=ea(d);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=hl(x.pendingLanes);if(w!==0){var N=x;for(N.pendingLanes|=2,N.entangledLanes|=2;w;){var R=1<<31-ut(w);N.entanglements[1]|=R,w&=~R}bl(x),(xt&6)===0&&(ko=gt()+500,Yi(0))}}break;case 31:case 13:N=Ha(x,2),N!==null&&Dn(N,x,2),jo(),Tf(x,2)}if(x=Mf(s),x===null&&yf(e,n,s,Ho,r),x===d)break;d=x}d!==null&&s.stopPropagation()}else yf(e,n,s,null,r)}}function Mf(e){return e=_c(e),_f(e)}var Ho=null;function _f(e){if(Ho=null,e=Ot(e),e!==null){var n=u(e);if(n===null)e=null;else{var r=n.tag;if(r===13){if(e=f(n),e!==null)return e;e=null}else if(r===31){if(e=m(n),e!==null)return e;e=null}else if(r===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Ho=e,null}function Ip(e){switch(e){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Pt()){case re:return 2;case ye:return 8;case _e:case me:return 32;case be:return 268435456;default:return 32}default:return 32}}var Ff=!1,va=null,wa=null,ka=null,Zi=new Map,Wi=new Map,Sa=[],gb="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".split(" ");function Yp(e,n){switch(e){case"focusin":case"focusout":va=null;break;case"dragenter":case"dragleave":wa=null;break;case"mouseover":case"mouseout":ka=null;break;case"pointerover":case"pointerout":Zi.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Wi.delete(n.pointerId)}}function Ji(e,n,r,s,d,x){return e===null||e.nativeEvent!==x?(e={blockedOn:n,domEventName:r,eventSystemFlags:s,nativeEvent:x,targetContainers:[d]},n!==null&&(n=ea(n),n!==null&&Hp(n)),e):(e.eventSystemFlags|=s,n=e.targetContainers,d!==null&&n.indexOf(d)===-1&&n.push(d),e)}function bb(e,n,r,s,d){switch(n){case"focusin":return va=Ji(va,e,n,r,s,d),!0;case"dragenter":return wa=Ji(wa,e,n,r,s,d),!0;case"mouseover":return ka=Ji(ka,e,n,r,s,d),!0;case"pointerover":var x=d.pointerId;return Zi.set(x,Ji(Zi.get(x)||null,e,n,r,s,d)),!0;case"gotpointercapture":return x=d.pointerId,Wi.set(x,Ji(Wi.get(x)||null,e,n,r,s,d)),!0}return!1}function qp(e){var n=Ot(e.target);if(n!==null){var r=u(n);if(r!==null){if(n=r.tag,n===13){if(n=f(r),n!==null){e.blockedOn=n,Pl(e.priority,function(){Up(r)});return}}else if(n===31){if(n=m(r),n!==null){e.blockedOn=n,Pl(e.priority,function(){Up(r)});return}}else if(n===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Uo(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var r=Mf(e.nativeEvent);if(r===null){r=e.nativeEvent;var s=new r.constructor(r.type,r);Mc=s,r.target.dispatchEvent(s),Mc=null}else return n=ea(r),n!==null&&Hp(n),e.blockedOn=r,!1;n.shift()}return!0}function Xp(e,n,r){Uo(e)&&r.delete(n)}function vb(){Ff=!1,va!==null&&Uo(va)&&(va=null),wa!==null&&Uo(wa)&&(wa=null),ka!==null&&Uo(ka)&&(ka=null),Zi.forEach(Xp),Wi.forEach(Xp)}function Io(e,n){e.blockedOn===n&&(e.blockedOn=null,Ff||(Ff=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,vb)))}var Yo=null;function Vp(e){Yo!==e&&(Yo=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Yo===e&&(Yo=null);for(var n=0;n<e.length;n+=3){var r=e[n],s=e[n+1],d=e[n+2];if(typeof s!="function"){if(_f(s||r)===null)continue;break}var x=ea(r);x!==null&&(e.splice(n,3),n-=3,zu(x,{pending:!0,data:d,method:r.method,action:s},s,d))}}))}function Xr(e){function n(R){return Io(R,e)}va!==null&&Io(va,e),wa!==null&&Io(wa,e),ka!==null&&Io(ka,e),Zi.forEach(n),Wi.forEach(n);for(var r=0;r<Sa.length;r++){var s=Sa[r];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Sa.length&&(r=Sa[0],r.blockedOn===null);)qp(r),r.blockedOn===null&&Sa.shift();if(r=(e.ownerDocument||e).$$reactFormReplay,r!=null)for(s=0;s<r.length;s+=3){var d=r[s],x=r[s+1],w=d[vt]||null;if(typeof x=="function")w||Vp(r);else if(w){var N=null;if(x&&x.hasAttribute("formAction")){if(d=x,w=x[vt]||null)N=w.formAction;else if(_f(d)!==null)continue}else N=w.action;typeof N=="function"?r[s+1]=N:(r.splice(s,3),s-=3),Vp(r)}}}function Gp(){function e(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return d=w})},focusReset:"manual",scroll:"manual"})}function n(){d!==null&&(d(),d=null),s||setTimeout(r,20)}function r(){if(!s&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,d=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(r,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),d!==null&&(d(),d=null)}}}function Rf(e){this._internalRoot=e}qo.prototype.render=Rf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(i(409));var r=n.current,s=Hn();$p(r,s,e,n,null,null)},qo.prototype.unmount=Rf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;$p(e.current,2,null,e,null,null),jo(),n[rl]=null}};function qo(e){this._internalRoot=e}qo.prototype.unstable_scheduleHydration=function(e){if(e){var n=Al();e={blockedOn:null,target:e,priority:n};for(var r=0;r<Sa.length&&n!==0&&n<Sa[r].priority;r++);Sa.splice(r,0,e),r===0&&qp(e)}};var Kp=l.version;if(Kp!=="19.2.4")throw Error(i(527,Kp,"19.2.4"));Q.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=h(n),e=e!==null?g(e):null,e=e===null?null:e.stateNode,e};var wb={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:U,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xo.isDisabled&&Xo.supportsFiber)try{Ze=Xo.inject(wb),de=Xo}catch{}}return es.createRoot=function(e,n){if(!o(e))throw Error(i(299));var r=!1,s="",d=tx,x=nx,w=lx;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(d=n.onUncaughtError),n.onCaughtError!==void 0&&(x=n.onCaughtError),n.onRecoverableError!==void 0&&(w=n.onRecoverableError)),n=Op(e,1,!1,null,null,r,s,null,d,x,w,Gp),e[rl]=n.current,pf(e),new Rf(n)},es.hydrateRoot=function(e,n,r){if(!o(e))throw Error(i(299));var s=!1,d="",x=tx,w=nx,N=lx,R=null;return r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(d=r.identifierPrefix),r.onUncaughtError!==void 0&&(x=r.onUncaughtError),r.onCaughtError!==void 0&&(w=r.onCaughtError),r.onRecoverableError!==void 0&&(N=r.onRecoverableError),r.formState!==void 0&&(R=r.formState)),n=Op(e,1,!0,n,r??null,s,d,R,x,w,N,Gp),n.context=Bp(null),r=n.current,s=Hn(),s=Ra(s),d=oa(s),d.callback=null,ca(r,d,s),r=s,n.current.lanes=r,Mn(n,r),bl(n),e[rl]=n.current,pf(e),new qo(n)},es.version="19.2.4",es}var r1;function _b(){if(r1)return $f.exports;r1=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(l){console.error(l)}}return t(),$f.exports=Mb(),$f.exports}var Fb=_b();const Rb="modulepreload",Ob=function(t){return"/"+t},i1={},Bb=function(l,a,i){let o=Promise.resolve();if(a&&a.length>0){let f=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),p=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));o=f(a.map(h=>{if(h=Ob(h),h in i1)return;i1[h]=!0;const g=h.endsWith(".css"),y=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${y}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":Rb,g||(b.as="script"),b.crossOrigin="",b.href=h,p&&b.setAttribute("nonce",p),document.head.appendChild(b),g)return new Promise((v,S)=>{b.addEventListener("load",v),b.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function u(f){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=f,window.dispatchEvent(m),!m.defaultPrevented)throw f}return o.then(f=>{for(const m of f||[])m.status==="rejected"&&u(m.reason);return l().catch(u)})};class $b extends j.Component{constructor(){super(...arguments);Qp(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(a){return{hasError:!0,error:a}}render(){var a;return this.state.hasError?c.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:c.jsxs("div",{className:"text-center max-w-md",children:[c.jsx("div",{className:"text-4xl mb-3",children:"🚨"}),c.jsx("div",{className:"text-gray-800 font-semibold mb-2",children:"Something went wrong"}),c.jsx("div",{className:"text-gray-500 text-sm mb-4",children:((a=this.state.error)==null?void 0:a.message)??"An unexpected error occurred."}),c.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-gray-800 text-white rounded-lg text-sm hover:bg-gray-700",children:"Reload"})]})}):this.props.children}}const Ss="/api";async function Gt(t){const l=await fetch(`${Ss}${t}`);if(!l.ok)throw new Error(`API error: ${l.status}`);return l.json()}async function Un(t,l){const a=await fetch(`${Ss}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}async function If(t,l){const a=await fetch(`${Ss}${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}async function Vr(t,l){const a={method:"DELETE"};l!==void 0&&(a.headers={"Content-Type":"application/json"},a.body=JSON.stringify(l));const i=await fetch(`${Ss}${t}`,a);if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()}const Te={getCompany:()=>Gt("/company"),getRoles:()=>Gt("/roles"),getRole:t=>Gt(`/roles/${t}`),getProjects:()=>Gt("/projects"),getProject:t=>Gt(`/projects/${t}`),getStandups:()=>Gt("/operations/standups"),getWaves:()=>Gt("/operations/waves"),getDecisions:()=>Gt("/operations/decisions"),getOrgTree:()=>Gt("/engine/org"),getSkills:()=>Gt("/skills"),createRole:t=>Un("/engine/roles",t),updateRole:(t,l)=>If(`/engine/roles/${t}`,l),deleteRole:t=>Vr(`/engine/roles/${t}`),getSessions:()=>Gt("/sessions"),getSession:t=>Gt(`/sessions/${t}`),createSession:(t,l="talk")=>Un("/sessions",{roleId:t,mode:l}),deleteSession:t=>Vr(`/sessions/${t}`),deleteSessions:t=>Vr("/sessions",{ids:t}),deleteEmptySessions:()=>Vr("/sessions?empty=true"),updateSession:(t,l)=>If(`/sessions/${t}`,l),startJob:t=>Un("/jobs",t),getJob:t=>Gt(`/jobs/${t}`),listJobs:t=>{const l=new URLSearchParams;t!=null&&t.status&&l.set("status",t.status),t!=null&&t.roleId&&l.set("roleId",t.roleId);const a=l.toString();return Gt(`/jobs${a?"?"+a:""}`)},abortJob:t=>Vr(`/jobs/${t}`),getStatus:()=>Gt("/status"),detectEngine:()=>Un("/setup/detect-engine",{}),validatePath:t=>Un("/setup/validate-path",{path:t}),scaffold:t=>Un("/setup/scaffold",t),getTeams:()=>Gt("/setup/teams"),browse:t=>Un("/setup/browse",{path:t}),connectAkb:t=>Un("/setup/connect-akb",{path:t}),getKnowledge:()=>Gt("/knowledge"),getKnowledgeDoc:t=>Gt(`/knowledge/${t}`),createKnowledgeDoc:t=>Un("/knowledge",t),updateKnowledgeDoc:(t,l)=>fetch(`${Ss}/knowledge/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:l})}).then(a=>{if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}),deleteKnowledgeDoc:t=>Vr(`/knowledge/${t}`),getPreferences:()=>Gt("/preferences"),updatePreferences:t=>If("/preferences",t),chatInChannel:t=>Un("/speech/chat",t),getSaveStatus:()=>Gt("/save/status"),save:t=>Un("/save",{message:t}),getSaveHistory:(t=20)=>Gt(`/save/history?limit=${t}`),restoreSave:(t,l)=>Un("/save/restore",{sha:t,paths:l}),initGit:()=>Un("/save/init",{})};function Fy(t){const[l,a]=j.useState([]),[i,o]=j.useState("idle"),[u,f]=j.useState(""),[m,p]=j.useState([]),h=j.useRef(-1),g=j.useRef(null),y=j.useRef(0),b=j.useCallback(()=>{var E;if(!t)return;(E=g.current)==null||E.abort();const S=new AbortController;g.current=S,o("connecting");const k=h.current+1,C=`/api/jobs/${t}/stream?from=${k}`;fetch(C,{signal:S.signal}).then(async M=>{if(!M.ok||!M.body){o("error");return}o("streaming");const $=M.body.getReader(),O=new TextDecoder;let B="";for(;;){const{done:T,value:Y}=await $.read();if(T)break;B+=O.decode(Y,{stream:!0});const V=B.split(`
|
|
50
|
-
`);B=V.pop()??"";let te="";for(const D of V)if(D.startsWith("event: "))te=D.slice(7).trim();else if(D.startsWith("data: ")){try{const I=JSON.parse(D.slice(6));if(te==="activity"){const L=I;L.seq>h.current&&(h.current=L.seq),a(ee=>ee.some(ae=>ae.seq===L.seq)?ee:[...ee,L]),L.type==="text"&&f(ee=>ee+(L.data.text??"")),L.type==="dispatch:start"&&L.data.childJobId&&p(ee=>[...ee,L.data.childJobId]),L.type==="job:done"?o("done"):L.type==="job:error"&&o("error")}else if(te==="stream:end"){const L=I.reason;o(L==="done"?"done":L==="error"?"error":"done")}}catch{}te=""}}i==="streaming"&&o("done")}).catch(M=>{M.name!=="AbortError"&&(o("error"),y.current<3&&(y.current++,setTimeout(b,1e3*y.current)))})},[t]),v=j.useCallback(()=>{y.current=0,b()},[b]);return j.useEffect(()=>{if(!t){a([]),o("idle"),f(""),p([]),h.current=-1;return}return a([]),f(""),p([]),h.current=-1,y.current=0,b(),()=>{var S;(S=g.current)==null||S.abort()}},[t,b]),{events:l,status:i,textOutput:u,childJobIds:m,reconnect:v}}function Lb(t,l){const a={};return(t[t.length-1]===""?[...t,""]:t).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const Hb=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ub=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ib={};function s1(t,l){return(Ib.jsx?Ub:Hb).test(t)}const Yb=/[ \t\n\f\r]/g;function qb(t){return typeof t=="object"?t.type==="text"?o1(t.value):!1:o1(t)}function o1(t){return t.replace(Yb,"")===""}class js{constructor(l,a,i){this.normal=a,this.property=l,i&&(this.space=i)}}js.prototype.normal={};js.prototype.property={};js.prototype.space=void 0;function Ry(t,l){const a={},i={};for(const o of t)Object.assign(a,o.property),Object.assign(i,o.normal);return new js(a,i,l)}function Cd(t){return t.toLowerCase()}class zn{constructor(l,a){this.attribute=a,this.property=l}}zn.prototype.attribute="";zn.prototype.booleanish=!1;zn.prototype.boolean=!1;zn.prototype.commaOrSpaceSeparated=!1;zn.prototype.commaSeparated=!1;zn.prototype.defined=!1;zn.prototype.mustUseProperty=!1;zn.prototype.number=!1;zn.prototype.overloadedBoolean=!1;zn.prototype.property="";zn.prototype.spaceSeparated=!1;zn.prototype.space=void 0;let Xb=0;const Qe=or(),Jt=or(),Nd=or(),ge=or(),Mt=or(),Wr=or(),In=or();function or(){return 2**++Xb}const Ad=Object.freeze(Object.defineProperty({__proto__:null,boolean:Qe,booleanish:Jt,commaOrSpaceSeparated:In,commaSeparated:Wr,number:ge,overloadedBoolean:Nd,spaceSeparated:Mt},Symbol.toStringTag,{value:"Module"})),Yf=Object.keys(Ad);class Xd extends zn{constructor(l,a,i,o){let u=-1;if(super(l,a),c1(this,"space",o),typeof i=="number")for(;++u<Yf.length;){const f=Yf[u];c1(this,Yf[u],(i&Ad[f])===Ad[f])}}}Xd.prototype.defined=!0;function c1(t,l,a){a&&(t[l]=a)}function ti(t){const l={},a={};for(const[i,o]of Object.entries(t.properties)){const u=new Xd(i,t.transform(t.attributes||{},i),o,t.space);t.mustUseProperty&&t.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),l[i]=u,a[Cd(i)]=i,a[Cd(u.attribute)]=i}return new js(l,a,t.space)}const Oy=ti({properties:{ariaActiveDescendant:null,ariaAtomic:Jt,ariaAutoComplete:null,ariaBusy:Jt,ariaChecked:Jt,ariaColCount:ge,ariaColIndex:ge,ariaColSpan:ge,ariaControls:Mt,ariaCurrent:null,ariaDescribedBy:Mt,ariaDetails:null,ariaDisabled:Jt,ariaDropEffect:Mt,ariaErrorMessage:null,ariaExpanded:Jt,ariaFlowTo:Mt,ariaGrabbed:Jt,ariaHasPopup:null,ariaHidden:Jt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Mt,ariaLevel:ge,ariaLive:null,ariaModal:Jt,ariaMultiLine:Jt,ariaMultiSelectable:Jt,ariaOrientation:null,ariaOwns:Mt,ariaPlaceholder:null,ariaPosInSet:ge,ariaPressed:Jt,ariaReadOnly:Jt,ariaRelevant:null,ariaRequired:Jt,ariaRoleDescription:Mt,ariaRowCount:ge,ariaRowIndex:ge,ariaRowSpan:ge,ariaSelected:Jt,ariaSetSize:ge,ariaSort:null,ariaValueMax:ge,ariaValueMin:ge,ariaValueNow:ge,ariaValueText:null,role:null},transform(t,l){return l==="role"?l:"aria-"+l.slice(4).toLowerCase()}});function By(t,l){return l in t?t[l]:l}function $y(t,l){return By(t,l.toLowerCase())}const Vb=ti({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Wr,acceptCharset:Mt,accessKey:Mt,action:null,allow:null,allowFullScreen:Qe,allowPaymentRequest:Qe,allowUserMedia:Qe,alt:null,as:null,async:Qe,autoCapitalize:null,autoComplete:Mt,autoFocus:Qe,autoPlay:Qe,blocking:Mt,capture:null,charSet:null,checked:Qe,cite:null,className:Mt,cols:ge,colSpan:null,content:null,contentEditable:Jt,controls:Qe,controlsList:Mt,coords:ge|Wr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Qe,defer:Qe,dir:null,dirName:null,disabled:Qe,download:Nd,draggable:Jt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Qe,formTarget:null,headers:Mt,height:ge,hidden:Nd,high:ge,href:null,hrefLang:null,htmlFor:Mt,httpEquiv:Mt,id:null,imageSizes:null,imageSrcSet:null,inert:Qe,inputMode:null,integrity:null,is:null,isMap:Qe,itemId:null,itemProp:Mt,itemRef:Mt,itemScope:Qe,itemType:Mt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Qe,low:ge,manifest:null,max:null,maxLength:ge,media:null,method:null,min:null,minLength:ge,multiple:Qe,muted:Qe,name:null,nonce:null,noModule:Qe,noValidate:Qe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Qe,optimum:ge,pattern:null,ping:Mt,placeholder:null,playsInline:Qe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Qe,referrerPolicy:null,rel:Mt,required:Qe,reversed:Qe,rows:ge,rowSpan:ge,sandbox:Mt,scope:null,scoped:Qe,seamless:Qe,selected:Qe,shadowRootClonable:Qe,shadowRootDelegatesFocus:Qe,shadowRootMode:null,shape:null,size:ge,sizes:null,slot:null,span:ge,spellCheck:Jt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ge,step:null,style:null,tabIndex:ge,target:null,title:null,translate:null,type:null,typeMustMatch:Qe,useMap:null,value:Jt,width:ge,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Mt,axis:null,background:null,bgColor:null,border:ge,borderColor:null,bottomMargin:ge,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Qe,declare:Qe,event:null,face:null,frame:null,frameBorder:null,hSpace:ge,leftMargin:ge,link:null,longDesc:null,lowSrc:null,marginHeight:ge,marginWidth:ge,noResize:Qe,noHref:Qe,noShade:Qe,noWrap:Qe,object:null,profile:null,prompt:null,rev:null,rightMargin:ge,rules:null,scheme:null,scrolling:Jt,standby:null,summary:null,text:null,topMargin:ge,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ge,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Qe,disableRemotePlayback:Qe,prefix:null,property:null,results:ge,security:null,unselectable:null},space:"html",transform:$y}),Gb=ti({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:In,accentHeight:ge,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ge,amplitude:ge,arabicForm:null,ascent:ge,attributeName:null,attributeType:null,azimuth:ge,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ge,by:null,calcMode:null,capHeight:ge,className:Mt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ge,diffuseConstant:ge,direction:null,display:null,dur:null,divisor:ge,dominantBaseline:null,download:Qe,dx:null,dy:null,edgeMode:null,editable:null,elevation:ge,enableBackground:null,end:null,event:null,exponent:ge,externalResourcesRequired:null,fill:null,fillOpacity:ge,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Wr,g2:Wr,glyphName:Wr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ge,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ge,horizOriginX:ge,horizOriginY:ge,id:null,ideographic:ge,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ge,k:ge,k1:ge,k2:ge,k3:ge,k4:ge,kernelMatrix:In,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ge,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ge,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ge,overlineThickness:ge,paintOrder:null,panose1:null,path:null,pathLength:ge,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Mt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ge,pointsAtY:ge,pointsAtZ:ge,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:In,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:In,rev:In,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:In,requiredFeatures:In,requiredFonts:In,requiredFormats:In,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ge,specularExponent:ge,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ge,strikethroughThickness:ge,string:null,stroke:null,strokeDashArray:In,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ge,strokeOpacity:ge,strokeWidth:null,style:null,surfaceScale:ge,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:In,tabIndex:ge,tableValues:null,target:null,targetX:ge,targetY:ge,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:In,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ge,underlineThickness:ge,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ge,values:null,vAlphabetic:ge,vMathematical:ge,vectorEffect:null,vHanging:ge,vIdeographic:ge,version:null,vertAdvY:ge,vertOriginX:ge,vertOriginY:ge,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ge,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:By}),Ly=ti({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,l){return"xlink:"+l.slice(5).toLowerCase()}}),Hy=ti({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:$y}),Uy=ti({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,l){return"xml:"+l.slice(3).toLowerCase()}}),Kb={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Qb=/[A-Z]/g,u1=/-[a-z]/g,Zb=/^data[-\w.:]+$/i;function Wb(t,l){const a=Cd(l);let i=l,o=zn;if(a in t.normal)return t.property[t.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&Zb.test(l)){if(l.charAt(4)==="-"){const u=l.slice(5).replace(u1,Pb);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=l.slice(4);if(!u1.test(u)){let f=u.replace(Qb,Jb);f.charAt(0)!=="-"&&(f="-"+f),l="data"+f}}o=Xd}return new o(i,l)}function Jb(t){return"-"+t.toLowerCase()}function Pb(t){return t.charAt(1).toUpperCase()}const ev=Ry([Oy,Vb,Ly,Hy,Uy],"html"),Vd=Ry([Oy,Gb,Ly,Hy,Uy],"svg");function tv(t){return t.join(" ").trim()}var Gr={},qf,f1;function nv(){if(f1)return qf;f1=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,l=/\n/g,a=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,m=/^\s+|\s+$/g,p=`
|
|
51
|
-
`,h="/",g="*",y="",b="comment",v="declaration";function S(C,E){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];E=E||{};var M=1,$=1;function O(ae){var X=ae.match(l);X&&(M+=X.length);var U=ae.lastIndexOf(p);$=~U?ae.length-U:$+ae.length}function B(){var ae={line:M,column:$};return function(X){return X.position=new T(ae),te(),X}}function T(ae){this.start=ae,this.end={line:M,column:$},this.source=E.source}T.prototype.content=C;function Y(ae){var X=new Error(E.source+":"+M+":"+$+": "+ae);if(X.reason=ae,X.filename=E.source,X.line=M,X.column=$,X.source=C,!E.silent)throw X}function V(ae){var X=ae.exec(C);if(X){var U=X[0];return O(U),C=C.slice(U.length),X}}function te(){V(a)}function D(ae){var X;for(ae=ae||[];X=I();)X!==!1&&ae.push(X);return ae}function I(){var ae=B();if(!(h!=C.charAt(0)||g!=C.charAt(1))){for(var X=2;y!=C.charAt(X)&&(g!=C.charAt(X)||h!=C.charAt(X+1));)++X;if(X+=2,y===C.charAt(X-1))return Y("End of comment missing");var U=C.slice(2,X-2);return $+=2,O(U),C=C.slice(X),$+=2,ae({type:b,comment:U})}}function L(){var ae=B(),X=V(i);if(X){if(I(),!V(o))return Y("property missing ':'");var U=V(u),Q=ae({type:v,property:k(X[0].replace(t,y)),value:U?k(U[0].replace(t,y)):y});return V(f),Q}}function ee(){var ae=[];D(ae);for(var X;X=L();)X!==!1&&(ae.push(X),D(ae));return ae}return te(),ee()}function k(C){return C?C.replace(m,y):y}return qf=S,qf}var d1;function lv(){if(d1)return Gr;d1=1;var t=Gr&&Gr.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.default=a;const l=t(nv());function a(i,o){let u=null;if(!i||typeof i!="string")return u;const f=(0,l.default)(i),m=typeof o=="function";return f.forEach(p=>{if(p.type!=="declaration")return;const{property:h,value:g}=p;m?o(h,g,p):g&&(u=u||{},u[h]=g)}),u}return Gr}var ts={},h1;function av(){if(h1)return ts;h1=1,Object.defineProperty(ts,"__esModule",{value:!0}),ts.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,l=/-([a-z])/g,a=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,u=function(h){return!h||a.test(h)||t.test(h)},f=function(h,g){return g.toUpperCase()},m=function(h,g){return"".concat(g,"-")},p=function(h,g){return g===void 0&&(g={}),u(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(o,m):h=h.replace(i,m),h.replace(l,f))};return ts.camelCase=p,ts}var ns,m1;function rv(){if(m1)return ns;m1=1;var t=ns&&ns.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},l=t(lv()),a=av();function i(o,u){var f={};return!o||typeof o!="string"||(0,l.default)(o,function(m,p){m&&p&&(f[(0,a.camelCase)(m,u)]=p)}),f}return i.default=i,ns=i,ns}var iv=rv();const sv=_y(iv),Iy=Yy("end"),Gd=Yy("start");function Yy(t){return l;function l(a){const i=a&&a.position&&a.position[t]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function ov(t){const l=Gd(t),a=Iy(t);if(l&&a)return{start:l,end:a}}function ms(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?x1(t.position):"start"in t||"end"in t?x1(t):"line"in t||"column"in t?Dd(t):""}function Dd(t){return p1(t&&t.line)+":"+p1(t&&t.column)}function x1(t){return Dd(t&&t.start)+"-"+Dd(t&&t.end)}function p1(t){return t&&typeof t=="number"?t:1}class pn extends Error{constructor(l,a,i){super(),typeof a=="string"&&(i=a,a=void 0);let o="",u={},f=!1;if(a&&("line"in a&&"column"in a?u={place:a}:"start"in a&&"end"in a?u={place:a}:"type"in a?u={ancestors:[a],place:a.position}:u={...a}),typeof l=="string"?o=l:!u.cause&&l&&(f=!0,o=l.message,u.cause=l),!u.ruleId&&!u.source&&typeof i=="string"){const p=i.indexOf(":");p===-1?u.ruleId=i:(u.source=i.slice(0,p),u.ruleId=i.slice(p+1))}if(!u.place&&u.ancestors&&u.ancestors){const p=u.ancestors[u.ancestors.length-1];p&&(u.place=p.position)}const m=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=m?m.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=m?m.line:void 0,this.name=ms(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=f&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}pn.prototype.file="";pn.prototype.name="";pn.prototype.reason="";pn.prototype.message="";pn.prototype.stack="";pn.prototype.column=void 0;pn.prototype.line=void 0;pn.prototype.ancestors=void 0;pn.prototype.cause=void 0;pn.prototype.fatal=void 0;pn.prototype.place=void 0;pn.prototype.ruleId=void 0;pn.prototype.source=void 0;const Kd={}.hasOwnProperty,cv=new Map,uv=/[A-Z]/g,fv=new Set(["table","tbody","thead","tfoot","tr"]),dv=new Set(["td","th"]),qy="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function hv(t,l){if(!l||l.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=l.filePath||void 0;let i;if(l.development){if(typeof l.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=wv(a,l.jsxDEV)}else{if(typeof l.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof l.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=vv(a,l.jsx,l.jsxs)}const o={Fragment:l.Fragment,ancestors:[],components:l.components||{},create:i,elementAttributeNameCase:l.elementAttributeNameCase||"react",evaluater:l.createEvaluater?l.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:l.ignoreInvalidStyle||!1,passKeys:l.passKeys!==!1,passNode:l.passNode||!1,schema:l.space==="svg"?Vd:ev,stylePropertyNameCase:l.stylePropertyNameCase||"dom",tableCellAlignToStyle:l.tableCellAlignToStyle!==!1},u=Xy(o,t,void 0);return u&&typeof u!="string"?u:o.create(t,o.Fragment,{children:u||void 0},void 0)}function Xy(t,l,a){if(l.type==="element")return mv(t,l,a);if(l.type==="mdxFlowExpression"||l.type==="mdxTextExpression")return xv(t,l);if(l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement")return yv(t,l,a);if(l.type==="mdxjsEsm")return pv(t,l);if(l.type==="root")return gv(t,l,a);if(l.type==="text")return bv(t,l)}function mv(t,l,a){const i=t.schema;let o=i;l.tagName.toLowerCase()==="svg"&&i.space==="html"&&(o=Vd,t.schema=o),t.ancestors.push(l);const u=Gy(t,l.tagName,!1),f=kv(t,l);let m=Zd(t,l);return fv.has(l.tagName)&&(m=m.filter(function(p){return typeof p=="string"?!qb(p):!0})),Vy(t,f,u,l),Qd(f,m),t.ancestors.pop(),t.schema=i,t.create(l,u,f,a)}function xv(t,l){if(l.data&&l.data.estree&&t.evaluater){const i=l.data.estree.body[0];return i.type,t.evaluater.evaluateExpression(i.expression)}gs(t,l.position)}function pv(t,l){if(l.data&&l.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(l.data.estree);gs(t,l.position)}function yv(t,l,a){const i=t.schema;let o=i;l.name==="svg"&&i.space==="html"&&(o=Vd,t.schema=o),t.ancestors.push(l);const u=l.name===null?t.Fragment:Gy(t,l.name,!0),f=Sv(t,l),m=Zd(t,l);return Vy(t,f,u,l),Qd(f,m),t.ancestors.pop(),t.schema=i,t.create(l,u,f,a)}function gv(t,l,a){const i={};return Qd(i,Zd(t,l)),t.create(l,t.Fragment,i,a)}function bv(t,l){return l.value}function Vy(t,l,a,i){typeof a!="string"&&a!==t.Fragment&&t.passNode&&(l.node=i)}function Qd(t,l){if(l.length>0){const a=l.length>1?l:l[0];a&&(t.children=a)}}function vv(t,l,a){return i;function i(o,u,f,m){const h=Array.isArray(f.children)?a:l;return m?h(u,f,m):h(u,f)}}function wv(t,l){return a;function a(i,o,u,f){const m=Array.isArray(u.children),p=Gd(i);return l(o,u,f,m,{columnNumber:p?p.column-1:void 0,fileName:t,lineNumber:p?p.line:void 0},void 0)}}function kv(t,l){const a={};let i,o;for(o in l.properties)if(o!=="children"&&Kd.call(l.properties,o)){const u=jv(t,o,l.properties[o]);if(u){const[f,m]=u;t.tableCellAlignToStyle&&f==="align"&&typeof m=="string"&&dv.has(l.tagName)?i=m:a[f]=m}}if(i){const u=a.style||(a.style={});u[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return a}function Sv(t,l){const a={};for(const i of l.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&t.evaluater){const u=i.data.estree.body[0];u.type;const f=u.expression;f.type;const m=f.properties[0];m.type,Object.assign(a,t.evaluater.evaluateExpression(m.argument))}else gs(t,l.position);else{const o=i.name;let u;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&t.evaluater){const m=i.value.data.estree.body[0];m.type,u=t.evaluater.evaluateExpression(m.expression)}else gs(t,l.position);else u=i.value===null?!0:i.value;a[o]=u}return a}function Zd(t,l){const a=[];let i=-1;const o=t.passKeys?new Map:cv;for(;++i<l.children.length;){const u=l.children[i];let f;if(t.passKeys){const p=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(p){const h=o.get(p)||0;f=p+"-"+h,o.set(p,h+1)}}const m=Xy(t,u,f);m!==void 0&&a.push(m)}return a}function jv(t,l,a){const i=Wb(t.schema,l);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=i.commaSeparated?Lb(a):tv(a)),i.property==="style"){let o=typeof a=="object"?a:Ev(t,String(a));return t.stylePropertyNameCase==="css"&&(o=Cv(o)),["style",o]}return[t.elementAttributeNameCase==="react"&&i.space?Kb[i.property]||i.property:i.attribute,a]}}function Ev(t,l){try{return sv(l,{reactCompat:!0})}catch(a){if(t.ignoreInvalidStyle)return{};const i=a,o=new pn("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=t.filePath||void 0,o.url=qy+"#cannot-parse-style-attribute",o}}function Gy(t,l,a){let i;if(!a)i={type:"Literal",value:l};else if(l.includes(".")){const o=l.split(".");let u=-1,f;for(;++u<o.length;){const m=s1(o[u])?{type:"Identifier",name:o[u]}:{type:"Literal",value:o[u]};f=f?{type:"MemberExpression",object:f,property:m,computed:!!(u&&m.type==="Literal"),optional:!1}:m}i=f}else i=s1(l)&&!/^[a-z]/.test(l)?{type:"Identifier",name:l}:{type:"Literal",value:l};if(i.type==="Literal"){const o=i.value;return Kd.call(t.components,o)?t.components[o]:o}if(t.evaluater)return t.evaluater.evaluateExpression(i);gs(t)}function gs(t,l){const a=new pn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:l,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw a.file=t.filePath||void 0,a.url=qy+"#cannot-handle-mdx-estrees-without-createevaluater",a}function Cv(t){const l={};let a;for(a in t)Kd.call(t,a)&&(l[Nv(a)]=t[a]);return l}function Nv(t){let l=t.replace(uv,Av);return l.slice(0,3)==="ms-"&&(l="-"+l),l}function Av(t){return"-"+t.toLowerCase()}const Xf={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Dv={};function Wd(t,l){const a=Dv,i=typeof a.includeImageAlt=="boolean"?a.includeImageAlt:!0,o=typeof a.includeHtml=="boolean"?a.includeHtml:!0;return Ky(t,i,o)}function Ky(t,l,a){if(Tv(t)){if("value"in t)return t.type==="html"&&!a?"":t.value;if(l&&"alt"in t&&t.alt)return t.alt;if("children"in t)return y1(t.children,l,a)}return Array.isArray(t)?y1(t,l,a):""}function y1(t,l,a){const i=[];let o=-1;for(;++o<t.length;)i[o]=Ky(t[o],l,a);return i.join("")}function Tv(t){return!!(t&&typeof t=="object")}const g1=document.createElement("i");function Jd(t){const l="&"+t+";";g1.innerHTML=l;const a=g1.textContent;return a.charCodeAt(a.length-1)===59&&t!=="semi"||a===l?!1:a}function qn(t,l,a,i){const o=t.length;let u=0,f;if(l<0?l=-l>o?0:o+l:l=l>o?o:l,a=a>0?a:0,i.length<1e4)f=Array.from(i),f.unshift(l,a),t.splice(...f);else for(a&&t.splice(l,a);u<i.length;)f=i.slice(u,u+1e4),f.unshift(l,0),t.splice(...f),u+=1e4,l+=1e4}function el(t,l){return t.length>0?(qn(t,t.length,0,l),t):l}const b1={}.hasOwnProperty;function Qy(t){const l={};let a=-1;for(;++a<t.length;)zv(l,t[a]);return l}function zv(t,l){let a;for(a in l){const o=(b1.call(t,a)?t[a]:void 0)||(t[a]={}),u=l[a];let f;if(u)for(f in u){b1.call(o,f)||(o[f]=[]);const m=u[f];Mv(o[f],Array.isArray(m)?m:m?[m]:[])}}}function Mv(t,l){let a=-1;const i=[];for(;++a<l.length;)(l[a].add==="after"?t:i).push(l[a]);qn(t,0,0,i)}function Zy(t,l){const a=Number.parseInt(t,l);return a<9||a===11||a>13&&a<32||a>126&&a<160||a>55295&&a<57344||a>64975&&a<65008||(a&65535)===65535||(a&65535)===65534||a>1114111?"�":String.fromCodePoint(a)}function dl(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const bn=Ma(/[A-Za-z]/),xn=Ma(/[\dA-Za-z]/),_v=Ma(/[#-'*+\--9=?A-Z^-~]/);function uc(t){return t!==null&&(t<32||t===127)}const Td=Ma(/\d/),Fv=Ma(/[\dA-Fa-f]/),Rv=Ma(/[!-/:-@[-`{-~]/);function Le(t){return t!==null&&t<-2}function zt(t){return t!==null&&(t<0||t===32)}function tt(t){return t===-2||t===-1||t===32}const vc=Ma(new RegExp("\\p{P}|\\p{S}","u")),ir=Ma(/\s/);function Ma(t){return l;function l(a){return a!==null&&a>-1&&t.test(String.fromCharCode(a))}}function ni(t){const l=[];let a=-1,i=0,o=0;for(;++a<t.length;){const u=t.charCodeAt(a);let f="";if(u===37&&xn(t.charCodeAt(a+1))&&xn(t.charCodeAt(a+2)))o=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(f=String.fromCharCode(u));else if(u>55295&&u<57344){const m=t.charCodeAt(a+1);u<56320&&m>56319&&m<57344?(f=String.fromCharCode(u,m),o=1):f="�"}else f=String.fromCharCode(u);f&&(l.push(t.slice(i,a),encodeURIComponent(f)),i=a+o+1,f=""),o&&(a+=o,o=0)}return l.join("")+t.slice(i)}function st(t,l,a,i){const o=i?i-1:Number.POSITIVE_INFINITY;let u=0;return f;function f(p){return tt(p)?(t.enter(a),m(p)):l(p)}function m(p){return tt(p)&&u++<o?(t.consume(p),m):(t.exit(a),l(p))}}const Ov={tokenize:Bv};function Bv(t){const l=t.attempt(this.parser.constructs.contentInitial,i,o);let a;return l;function i(m){if(m===null){t.consume(m);return}return t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),st(t,l,"linePrefix")}function o(m){return t.enter("paragraph"),u(m)}function u(m){const p=t.enter("chunkText",{contentType:"text",previous:a});return a&&(a.next=p),a=p,f(m)}function f(m){if(m===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(m);return}return Le(m)?(t.consume(m),t.exit("chunkText"),u):(t.consume(m),f)}}const $v={tokenize:Lv},v1={tokenize:Hv};function Lv(t){const l=this,a=[];let i=0,o,u,f;return m;function m($){if(i<a.length){const O=a[i];return l.containerState=O[1],t.attempt(O[0].continuation,p,h)($)}return h($)}function p($){if(i++,l.containerState._closeFlow){l.containerState._closeFlow=void 0,o&&M();const O=l.events.length;let B=O,T;for(;B--;)if(l.events[B][0]==="exit"&&l.events[B][1].type==="chunkFlow"){T=l.events[B][1].end;break}E(i);let Y=O;for(;Y<l.events.length;)l.events[Y][1].end={...T},Y++;return qn(l.events,B+1,0,l.events.slice(O)),l.events.length=Y,h($)}return m($)}function h($){if(i===a.length){if(!o)return b($);if(o.currentConstruct&&o.currentConstruct.concrete)return S($);l.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return l.containerState={},t.check(v1,g,y)($)}function g($){return o&&M(),E(i),b($)}function y($){return l.parser.lazy[l.now().line]=i!==a.length,f=l.now().offset,S($)}function b($){return l.containerState={},t.attempt(v1,v,S)($)}function v($){return i++,a.push([l.currentConstruct,l.containerState]),b($)}function S($){if($===null){o&&M(),E(0),t.consume($);return}return o=o||l.parser.flow(l.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:u}),k($)}function k($){if($===null){C(t.exit("chunkFlow"),!0),E(0),t.consume($);return}return Le($)?(t.consume($),C(t.exit("chunkFlow")),i=0,l.interrupt=void 0,m):(t.consume($),k)}function C($,O){const B=l.sliceStream($);if(O&&B.push(null),$.previous=u,u&&(u.next=$),u=$,o.defineSkip($.start),o.write(B),l.parser.lazy[$.start.line]){let T=o.events.length;for(;T--;)if(o.events[T][1].start.offset<f&&(!o.events[T][1].end||o.events[T][1].end.offset>f))return;const Y=l.events.length;let V=Y,te,D;for(;V--;)if(l.events[V][0]==="exit"&&l.events[V][1].type==="chunkFlow"){if(te){D=l.events[V][1].end;break}te=!0}for(E(i),T=Y;T<l.events.length;)l.events[T][1].end={...D},T++;qn(l.events,V+1,0,l.events.slice(Y)),l.events.length=T}}function E($){let O=a.length;for(;O-- >$;){const B=a[O];l.containerState=B[1],B[0].exit.call(l,t)}a.length=$}function M(){o.write([null]),u=void 0,o=void 0,l.containerState._closeFlow=void 0}}function Hv(t,l,a){return st(t,t.attempt(this.parser.constructs.document,l,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Jr(t){if(t===null||zt(t)||ir(t))return 1;if(vc(t))return 2}function wc(t,l,a){const i=[];let o=-1;for(;++o<t.length;){const u=t[o].resolveAll;u&&!i.includes(u)&&(l=u(l,a),i.push(u))}return l}const zd={name:"attention",resolveAll:Uv,tokenize:Iv};function Uv(t,l){let a=-1,i,o,u,f,m,p,h,g;for(;++a<t.length;)if(t[a][0]==="enter"&&t[a][1].type==="attentionSequence"&&t[a][1]._close){for(i=a;i--;)if(t[i][0]==="exit"&&t[i][1].type==="attentionSequence"&&t[i][1]._open&&l.sliceSerialize(t[i][1]).charCodeAt(0)===l.sliceSerialize(t[a][1]).charCodeAt(0)){if((t[i][1]._close||t[a][1]._open)&&(t[a][1].end.offset-t[a][1].start.offset)%3&&!((t[i][1].end.offset-t[i][1].start.offset+t[a][1].end.offset-t[a][1].start.offset)%3))continue;p=t[i][1].end.offset-t[i][1].start.offset>1&&t[a][1].end.offset-t[a][1].start.offset>1?2:1;const y={...t[i][1].end},b={...t[a][1].start};w1(y,-p),w1(b,p),f={type:p>1?"strongSequence":"emphasisSequence",start:y,end:{...t[i][1].end}},m={type:p>1?"strongSequence":"emphasisSequence",start:{...t[a][1].start},end:b},u={type:p>1?"strongText":"emphasisText",start:{...t[i][1].end},end:{...t[a][1].start}},o={type:p>1?"strong":"emphasis",start:{...f.start},end:{...m.end}},t[i][1].end={...f.start},t[a][1].start={...m.end},h=[],t[i][1].end.offset-t[i][1].start.offset&&(h=el(h,[["enter",t[i][1],l],["exit",t[i][1],l]])),h=el(h,[["enter",o,l],["enter",f,l],["exit",f,l],["enter",u,l]]),h=el(h,wc(l.parser.constructs.insideSpan.null,t.slice(i+1,a),l)),h=el(h,[["exit",u,l],["enter",m,l],["exit",m,l],["exit",o,l]]),t[a][1].end.offset-t[a][1].start.offset?(g=2,h=el(h,[["enter",t[a][1],l],["exit",t[a][1],l]])):g=0,qn(t,i-1,a-i+3,h),a=i+h.length-g-2;break}}for(a=-1;++a<t.length;)t[a][1].type==="attentionSequence"&&(t[a][1].type="data");return t}function Iv(t,l){const a=this.parser.constructs.attentionMarkers.null,i=this.previous,o=Jr(i);let u;return f;function f(p){return u=p,t.enter("attentionSequence"),m(p)}function m(p){if(p===u)return t.consume(p),m;const h=t.exit("attentionSequence"),g=Jr(p),y=!g||g===2&&o||a.includes(p),b=!o||o===2&&g||a.includes(i);return h._open=!!(u===42?y:y&&(o||!b)),h._close=!!(u===42?b:b&&(g||!y)),l(p)}}function w1(t,l){t.column+=l,t.offset+=l,t._bufferIndex+=l}const Yv={name:"autolink",tokenize:qv};function qv(t,l,a){let i=0;return o;function o(v){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),u}function u(v){return bn(v)?(t.consume(v),f):v===64?a(v):h(v)}function f(v){return v===43||v===45||v===46||xn(v)?(i=1,m(v)):h(v)}function m(v){return v===58?(t.consume(v),i=0,p):(v===43||v===45||v===46||xn(v))&&i++<32?(t.consume(v),m):(i=0,h(v))}function p(v){return v===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),l):v===null||v===32||v===60||uc(v)?a(v):(t.consume(v),p)}function h(v){return v===64?(t.consume(v),g):_v(v)?(t.consume(v),h):a(v)}function g(v){return xn(v)?y(v):a(v)}function y(v){return v===46?(t.consume(v),i=0,g):v===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),l):b(v)}function b(v){if((v===45||xn(v))&&i++<63){const S=v===45?b:y;return t.consume(v),S}return a(v)}}const Es={partial:!0,tokenize:Xv};function Xv(t,l,a){return i;function i(u){return tt(u)?st(t,o,"linePrefix")(u):o(u)}function o(u){return u===null||Le(u)?l(u):a(u)}}const Wy={continuation:{tokenize:Gv},exit:Kv,name:"blockQuote",tokenize:Vv};function Vv(t,l,a){const i=this;return o;function o(f){if(f===62){const m=i.containerState;return m.open||(t.enter("blockQuote",{_container:!0}),m.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(f),t.exit("blockQuoteMarker"),u}return a(f)}function u(f){return tt(f)?(t.enter("blockQuotePrefixWhitespace"),t.consume(f),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),l):(t.exit("blockQuotePrefix"),l(f))}}function Gv(t,l,a){const i=this;return o;function o(f){return tt(f)?st(t,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):u(f)}function u(f){return t.attempt(Wy,l,a)(f)}}function Kv(t){t.exit("blockQuote")}const Jy={name:"characterEscape",tokenize:Qv};function Qv(t,l,a){return i;function i(u){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(u),t.exit("escapeMarker"),o}function o(u){return Rv(u)?(t.enter("characterEscapeValue"),t.consume(u),t.exit("characterEscapeValue"),t.exit("characterEscape"),l):a(u)}}const Py={name:"characterReference",tokenize:Zv};function Zv(t,l,a){const i=this;let o=0,u,f;return m;function m(y){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),p}function p(y){return y===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(y),t.exit("characterReferenceMarkerNumeric"),h):(t.enter("characterReferenceValue"),u=31,f=xn,g(y))}function h(y){return y===88||y===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(y),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),u=6,f=Fv,g):(t.enter("characterReferenceValue"),u=7,f=Td,g(y))}function g(y){if(y===59&&o){const b=t.exit("characterReferenceValue");return f===xn&&!Jd(i.sliceSerialize(b))?a(y):(t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),t.exit("characterReference"),l)}return f(y)&&o++<u?(t.consume(y),g):a(y)}}const k1={partial:!0,tokenize:Jv},S1={concrete:!0,name:"codeFenced",tokenize:Wv};function Wv(t,l,a){const i=this,o={partial:!0,tokenize:B};let u=0,f=0,m;return p;function p(T){return h(T)}function h(T){const Y=i.events[i.events.length-1];return u=Y&&Y[1].type==="linePrefix"?Y[2].sliceSerialize(Y[1],!0).length:0,m=T,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),g(T)}function g(T){return T===m?(f++,t.consume(T),g):f<3?a(T):(t.exit("codeFencedFenceSequence"),tt(T)?st(t,y,"whitespace")(T):y(T))}function y(T){return T===null||Le(T)?(t.exit("codeFencedFence"),i.interrupt?l(T):t.check(k1,k,O)(T)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),b(T))}function b(T){return T===null||Le(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),y(T)):tt(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),st(t,v,"whitespace")(T)):T===96&&T===m?a(T):(t.consume(T),b)}function v(T){return T===null||Le(T)?y(T):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),S(T))}function S(T){return T===null||Le(T)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),y(T)):T===96&&T===m?a(T):(t.consume(T),S)}function k(T){return t.attempt(o,O,C)(T)}function C(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),E}function E(T){return u>0&&tt(T)?st(t,M,"linePrefix",u+1)(T):M(T)}function M(T){return T===null||Le(T)?t.check(k1,k,O)(T):(t.enter("codeFlowValue"),$(T))}function $(T){return T===null||Le(T)?(t.exit("codeFlowValue"),M(T)):(t.consume(T),$)}function O(T){return t.exit("codeFenced"),l(T)}function B(T,Y,V){let te=0;return D;function D(X){return T.enter("lineEnding"),T.consume(X),T.exit("lineEnding"),I}function I(X){return T.enter("codeFencedFence"),tt(X)?st(T,L,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(X):L(X)}function L(X){return X===m?(T.enter("codeFencedFenceSequence"),ee(X)):V(X)}function ee(X){return X===m?(te++,T.consume(X),ee):te>=f?(T.exit("codeFencedFenceSequence"),tt(X)?st(T,ae,"whitespace")(X):ae(X)):V(X)}function ae(X){return X===null||Le(X)?(T.exit("codeFencedFence"),Y(X)):V(X)}}}function Jv(t,l,a){const i=this;return o;function o(f){return f===null?a(f):(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u)}function u(f){return i.parser.lazy[i.now().line]?a(f):l(f)}}const Vf={name:"codeIndented",tokenize:ew},Pv={partial:!0,tokenize:tw};function ew(t,l,a){const i=this;return o;function o(h){return t.enter("codeIndented"),st(t,u,"linePrefix",5)(h)}function u(h){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?f(h):a(h)}function f(h){return h===null?p(h):Le(h)?t.attempt(Pv,f,p)(h):(t.enter("codeFlowValue"),m(h))}function m(h){return h===null||Le(h)?(t.exit("codeFlowValue"),f(h)):(t.consume(h),m)}function p(h){return t.exit("codeIndented"),l(h)}}function tw(t,l,a){const i=this;return o;function o(f){return i.parser.lazy[i.now().line]?a(f):Le(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),o):st(t,u,"linePrefix",5)(f)}function u(f){const m=i.events[i.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(f):Le(f)?o(f):a(f)}}const nw={name:"codeText",previous:aw,resolve:lw,tokenize:rw};function lw(t){let l=t.length-4,a=3,i,o;if((t[a][1].type==="lineEnding"||t[a][1].type==="space")&&(t[l][1].type==="lineEnding"||t[l][1].type==="space")){for(i=a;++i<l;)if(t[i][1].type==="codeTextData"){t[a][1].type="codeTextPadding",t[l][1].type="codeTextPadding",a+=2,l-=2;break}}for(i=a-1,l++;++i<=l;)o===void 0?i!==l&&t[i][1].type!=="lineEnding"&&(o=i):(i===l||t[i][1].type==="lineEnding")&&(t[o][1].type="codeTextData",i!==o+2&&(t[o][1].end=t[i-1][1].end,t.splice(o+2,i-o-2),l-=i-o-2,i=o+2),o=void 0);return t}function aw(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function rw(t,l,a){let i=0,o,u;return f;function f(y){return t.enter("codeText"),t.enter("codeTextSequence"),m(y)}function m(y){return y===96?(t.consume(y),i++,m):(t.exit("codeTextSequence"),p(y))}function p(y){return y===null?a(y):y===32?(t.enter("space"),t.consume(y),t.exit("space"),p):y===96?(u=t.enter("codeTextSequence"),o=0,g(y)):Le(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),p):(t.enter("codeTextData"),h(y))}function h(y){return y===null||y===32||y===96||Le(y)?(t.exit("codeTextData"),p(y)):(t.consume(y),h)}function g(y){return y===96?(t.consume(y),o++,g):o===i?(t.exit("codeTextSequence"),t.exit("codeText"),l(y)):(u.type="codeTextData",h(y))}}class iw{constructor(l){this.left=l?[...l]:[],this.right=[]}get(l){if(l<0||l>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+l+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return l<this.left.length?this.left[l]:this.right[this.right.length-l+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(l,a){const i=a??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(l,i):l>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-l+this.left.length).reverse():this.left.slice(l).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(l,a,i){const o=a||0;this.setCursor(Math.trunc(l));const u=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return i&&ls(this.left,i),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(l){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(l)}pushMany(l){this.setCursor(Number.POSITIVE_INFINITY),ls(this.left,l)}unshift(l){this.setCursor(0),this.right.push(l)}unshiftMany(l){this.setCursor(0),ls(this.right,l.reverse())}setCursor(l){if(!(l===this.left.length||l>this.left.length&&this.right.length===0||l<0&&this.left.length===0))if(l<this.left.length){const a=this.left.splice(l,Number.POSITIVE_INFINITY);ls(this.right,a.reverse())}else{const a=this.right.splice(this.left.length+this.right.length-l,Number.POSITIVE_INFINITY);ls(this.left,a.reverse())}}}function ls(t,l){let a=0;if(l.length<1e4)t.push(...l);else for(;a<l.length;)t.push(...l.slice(a,a+1e4)),a+=1e4}function e0(t){const l={};let a=-1,i,o,u,f,m,p,h;const g=new iw(t);for(;++a<g.length;){for(;a in l;)a=l[a];if(i=g.get(a),a&&i[1].type==="chunkFlow"&&g.get(a-1)[1].type==="listItemPrefix"&&(p=i[1]._tokenizer.events,u=0,u<p.length&&p[u][1].type==="lineEndingBlank"&&(u+=2),u<p.length&&p[u][1].type==="content"))for(;++u<p.length&&p[u][1].type!=="content";)p[u][1].type==="chunkText"&&(p[u][1]._isInFirstContentOfListItem=!0,u++);if(i[0]==="enter")i[1].contentType&&(Object.assign(l,sw(g,a)),a=l[a],h=!0);else if(i[1]._container){for(u=a,o=void 0;u--;)if(f=g.get(u),f[1].type==="lineEnding"||f[1].type==="lineEndingBlank")f[0]==="enter"&&(o&&(g.get(o)[1].type="lineEndingBlank"),f[1].type="lineEnding",o=u);else if(!(f[1].type==="linePrefix"||f[1].type==="listItemIndent"))break;o&&(i[1].end={...g.get(o)[1].start},m=g.slice(o,a),m.unshift(i),g.splice(o,a-o+1,m))}}return qn(t,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function sw(t,l){const a=t.get(l)[1],i=t.get(l)[2];let o=l-1;const u=[];let f=a._tokenizer;f||(f=i.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(f._contentTypeTextTrailing=!0));const m=f.events,p=[],h={};let g,y,b=-1,v=a,S=0,k=0;const C=[k];for(;v;){for(;t.get(++o)[1]!==v;);u.push(o),v._tokenizer||(g=i.sliceStream(v),v.next||g.push(null),y&&f.defineSkip(v.start),v._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=!0),f.write(g),v._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=void 0)),y=v,v=v.next}for(v=a;++b<m.length;)m[b][0]==="exit"&&m[b-1][0]==="enter"&&m[b][1].type===m[b-1][1].type&&m[b][1].start.line!==m[b][1].end.line&&(k=b+1,C.push(k),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(f.events=[],v?(v._tokenizer=void 0,v.previous=void 0):C.pop(),b=C.length;b--;){const E=m.slice(C[b],C[b+1]),M=u.pop();p.push([M,M+E.length-1]),t.splice(M,2,E)}for(p.reverse(),b=-1;++b<p.length;)h[S+p[b][0]]=S+p[b][1],S+=p[b][1]-p[b][0]-1;return h}const ow={resolve:uw,tokenize:fw},cw={partial:!0,tokenize:dw};function uw(t){return e0(t),t}function fw(t,l){let a;return i;function i(m){return t.enter("content"),a=t.enter("chunkContent",{contentType:"content"}),o(m)}function o(m){return m===null?u(m):Le(m)?t.check(cw,f,u)(m):(t.consume(m),o)}function u(m){return t.exit("chunkContent"),t.exit("content"),l(m)}function f(m){return t.consume(m),t.exit("chunkContent"),a.next=t.enter("chunkContent",{contentType:"content",previous:a}),a=a.next,o}}function dw(t,l,a){const i=this;return o;function o(f){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),st(t,u,"linePrefix")}function u(f){if(f===null||Le(f))return a(f);const m=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(f):t.interrupt(i.parser.constructs.flow,a,l)(f)}}function t0(t,l,a,i,o,u,f,m,p){const h=p||Number.POSITIVE_INFINITY;let g=0;return y;function y(E){return E===60?(t.enter(i),t.enter(o),t.enter(u),t.consume(E),t.exit(u),b):E===null||E===32||E===41||uc(E)?a(E):(t.enter(i),t.enter(f),t.enter(m),t.enter("chunkString",{contentType:"string"}),k(E))}function b(E){return E===62?(t.enter(u),t.consume(E),t.exit(u),t.exit(o),t.exit(i),l):(t.enter(m),t.enter("chunkString",{contentType:"string"}),v(E))}function v(E){return E===62?(t.exit("chunkString"),t.exit(m),b(E)):E===null||E===60||Le(E)?a(E):(t.consume(E),E===92?S:v)}function S(E){return E===60||E===62||E===92?(t.consume(E),v):v(E)}function k(E){return!g&&(E===null||E===41||zt(E))?(t.exit("chunkString"),t.exit(m),t.exit(f),t.exit(i),l(E)):g<h&&E===40?(t.consume(E),g++,k):E===41?(t.consume(E),g--,k):E===null||E===32||E===40||uc(E)?a(E):(t.consume(E),E===92?C:k)}function C(E){return E===40||E===41||E===92?(t.consume(E),k):k(E)}}function n0(t,l,a,i,o,u){const f=this;let m=0,p;return h;function h(v){return t.enter(i),t.enter(o),t.consume(v),t.exit(o),t.enter(u),g}function g(v){return m>999||v===null||v===91||v===93&&!p||v===94&&!m&&"_hiddenFootnoteSupport"in f.parser.constructs?a(v):v===93?(t.exit(u),t.enter(o),t.consume(v),t.exit(o),t.exit(i),l):Le(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),g):(t.enter("chunkString",{contentType:"string"}),y(v))}function y(v){return v===null||v===91||v===93||Le(v)||m++>999?(t.exit("chunkString"),g(v)):(t.consume(v),p||(p=!tt(v)),v===92?b:y)}function b(v){return v===91||v===92||v===93?(t.consume(v),m++,y):y(v)}}function l0(t,l,a,i,o,u){let f;return m;function m(b){return b===34||b===39||b===40?(t.enter(i),t.enter(o),t.consume(b),t.exit(o),f=b===40?41:b,p):a(b)}function p(b){return b===f?(t.enter(o),t.consume(b),t.exit(o),t.exit(i),l):(t.enter(u),h(b))}function h(b){return b===f?(t.exit(u),p(f)):b===null?a(b):Le(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),st(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===f||b===null||Le(b)?(t.exit("chunkString"),h(b)):(t.consume(b),b===92?y:g)}function y(b){return b===f||b===92?(t.consume(b),g):g(b)}}function xs(t,l){let a;return i;function i(o){return Le(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),a=!0,i):tt(o)?st(t,i,a?"linePrefix":"lineSuffix")(o):l(o)}}const hw={name:"definition",tokenize:xw},mw={partial:!0,tokenize:pw};function xw(t,l,a){const i=this;let o;return u;function u(v){return t.enter("definition"),f(v)}function f(v){return n0.call(i,t,m,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function m(v){return o=dl(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),p):a(v)}function p(v){return zt(v)?xs(t,h)(v):h(v)}function h(v){return t0(t,g,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function g(v){return t.attempt(mw,y,y)(v)}function y(v){return tt(v)?st(t,b,"whitespace")(v):b(v)}function b(v){return v===null||Le(v)?(t.exit("definition"),i.parser.defined.push(o),l(v)):a(v)}}function pw(t,l,a){return i;function i(m){return zt(m)?xs(t,o)(m):a(m)}function o(m){return l0(t,u,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(m)}function u(m){return tt(m)?st(t,f,"whitespace")(m):f(m)}function f(m){return m===null||Le(m)?l(m):a(m)}}const yw={name:"hardBreakEscape",tokenize:gw};function gw(t,l,a){return i;function i(u){return t.enter("hardBreakEscape"),t.consume(u),o}function o(u){return Le(u)?(t.exit("hardBreakEscape"),l(u)):a(u)}}const bw={name:"headingAtx",resolve:vw,tokenize:ww};function vw(t,l){let a=t.length-2,i=3,o,u;return t[i][1].type==="whitespace"&&(i+=2),a-2>i&&t[a][1].type==="whitespace"&&(a-=2),t[a][1].type==="atxHeadingSequence"&&(i===a-1||a-4>i&&t[a-2][1].type==="whitespace")&&(a-=i+1===a?2:4),a>i&&(o={type:"atxHeadingText",start:t[i][1].start,end:t[a][1].end},u={type:"chunkText",start:t[i][1].start,end:t[a][1].end,contentType:"text"},qn(t,i,a-i+1,[["enter",o,l],["enter",u,l],["exit",u,l],["exit",o,l]])),t}function ww(t,l,a){let i=0;return o;function o(g){return t.enter("atxHeading"),u(g)}function u(g){return t.enter("atxHeadingSequence"),f(g)}function f(g){return g===35&&i++<6?(t.consume(g),f):g===null||zt(g)?(t.exit("atxHeadingSequence"),m(g)):a(g)}function m(g){return g===35?(t.enter("atxHeadingSequence"),p(g)):g===null||Le(g)?(t.exit("atxHeading"),l(g)):tt(g)?st(t,m,"whitespace")(g):(t.enter("atxHeadingText"),h(g))}function p(g){return g===35?(t.consume(g),p):(t.exit("atxHeadingSequence"),m(g))}function h(g){return g===null||g===35||zt(g)?(t.exit("atxHeadingText"),m(g)):(t.consume(g),h)}}const kw=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],j1=["pre","script","style","textarea"],Sw={concrete:!0,name:"htmlFlow",resolveTo:Cw,tokenize:Nw},jw={partial:!0,tokenize:Dw},Ew={partial:!0,tokenize:Aw};function Cw(t){let l=t.length;for(;l--&&!(t[l][0]==="enter"&&t[l][1].type==="htmlFlow"););return l>1&&t[l-2][1].type==="linePrefix"&&(t[l][1].start=t[l-2][1].start,t[l+1][1].start=t[l-2][1].start,t.splice(l-2,2)),t}function Nw(t,l,a){const i=this;let o,u,f,m,p;return h;function h(A){return g(A)}function g(A){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(A),y}function y(A){return A===33?(t.consume(A),b):A===47?(t.consume(A),u=!0,k):A===63?(t.consume(A),o=3,i.interrupt?l:z):bn(A)?(t.consume(A),f=String.fromCharCode(A),C):a(A)}function b(A){return A===45?(t.consume(A),o=2,v):A===91?(t.consume(A),o=5,m=0,S):bn(A)?(t.consume(A),o=4,i.interrupt?l:z):a(A)}function v(A){return A===45?(t.consume(A),i.interrupt?l:z):a(A)}function S(A){const pe="CDATA[";return A===pe.charCodeAt(m++)?(t.consume(A),m===pe.length?i.interrupt?l:L:S):a(A)}function k(A){return bn(A)?(t.consume(A),f=String.fromCharCode(A),C):a(A)}function C(A){if(A===null||A===47||A===62||zt(A)){const pe=A===47,Se=f.toLowerCase();return!pe&&!u&&j1.includes(Se)?(o=1,i.interrupt?l(A):L(A)):kw.includes(f.toLowerCase())?(o=6,pe?(t.consume(A),E):i.interrupt?l(A):L(A)):(o=7,i.interrupt&&!i.parser.lazy[i.now().line]?a(A):u?M(A):$(A))}return A===45||xn(A)?(t.consume(A),f+=String.fromCharCode(A),C):a(A)}function E(A){return A===62?(t.consume(A),i.interrupt?l:L):a(A)}function M(A){return tt(A)?(t.consume(A),M):D(A)}function $(A){return A===47?(t.consume(A),D):A===58||A===95||bn(A)?(t.consume(A),O):tt(A)?(t.consume(A),$):D(A)}function O(A){return A===45||A===46||A===58||A===95||xn(A)?(t.consume(A),O):B(A)}function B(A){return A===61?(t.consume(A),T):tt(A)?(t.consume(A),B):$(A)}function T(A){return A===null||A===60||A===61||A===62||A===96?a(A):A===34||A===39?(t.consume(A),p=A,Y):tt(A)?(t.consume(A),T):V(A)}function Y(A){return A===p?(t.consume(A),p=null,te):A===null||Le(A)?a(A):(t.consume(A),Y)}function V(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||zt(A)?B(A):(t.consume(A),V)}function te(A){return A===47||A===62||tt(A)?$(A):a(A)}function D(A){return A===62?(t.consume(A),I):a(A)}function I(A){return A===null||Le(A)?L(A):tt(A)?(t.consume(A),I):a(A)}function L(A){return A===45&&o===2?(t.consume(A),U):A===60&&o===1?(t.consume(A),Q):A===62&&o===4?(t.consume(A),_):A===63&&o===3?(t.consume(A),z):A===93&&o===5?(t.consume(A),ve):Le(A)&&(o===6||o===7)?(t.exit("htmlFlowData"),t.check(jw,P,ee)(A)):A===null||Le(A)?(t.exit("htmlFlowData"),ee(A)):(t.consume(A),L)}function ee(A){return t.check(Ew,ae,P)(A)}function ae(A){return t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),X}function X(A){return A===null||Le(A)?ee(A):(t.enter("htmlFlowData"),L(A))}function U(A){return A===45?(t.consume(A),z):L(A)}function Q(A){return A===47?(t.consume(A),f="",ie):L(A)}function ie(A){if(A===62){const pe=f.toLowerCase();return j1.includes(pe)?(t.consume(A),_):L(A)}return bn(A)&&f.length<8?(t.consume(A),f+=String.fromCharCode(A),ie):L(A)}function ve(A){return A===93?(t.consume(A),z):L(A)}function z(A){return A===62?(t.consume(A),_):A===45&&o===2?(t.consume(A),z):L(A)}function _(A){return A===null||Le(A)?(t.exit("htmlFlowData"),P(A)):(t.consume(A),_)}function P(A){return t.exit("htmlFlow"),l(A)}}function Aw(t,l,a){const i=this;return o;function o(f){return Le(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u):a(f)}function u(f){return i.parser.lazy[i.now().line]?a(f):l(f)}}function Dw(t,l,a){return i;function i(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(Es,l,a)}}const Tw={name:"htmlText",tokenize:zw};function zw(t,l,a){const i=this;let o,u,f;return m;function m(z){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(z),p}function p(z){return z===33?(t.consume(z),h):z===47?(t.consume(z),B):z===63?(t.consume(z),$):bn(z)?(t.consume(z),V):a(z)}function h(z){return z===45?(t.consume(z),g):z===91?(t.consume(z),u=0,S):bn(z)?(t.consume(z),M):a(z)}function g(z){return z===45?(t.consume(z),v):a(z)}function y(z){return z===null?a(z):z===45?(t.consume(z),b):Le(z)?(f=y,Q(z)):(t.consume(z),y)}function b(z){return z===45?(t.consume(z),v):y(z)}function v(z){return z===62?U(z):z===45?b(z):y(z)}function S(z){const _="CDATA[";return z===_.charCodeAt(u++)?(t.consume(z),u===_.length?k:S):a(z)}function k(z){return z===null?a(z):z===93?(t.consume(z),C):Le(z)?(f=k,Q(z)):(t.consume(z),k)}function C(z){return z===93?(t.consume(z),E):k(z)}function E(z){return z===62?U(z):z===93?(t.consume(z),E):k(z)}function M(z){return z===null||z===62?U(z):Le(z)?(f=M,Q(z)):(t.consume(z),M)}function $(z){return z===null?a(z):z===63?(t.consume(z),O):Le(z)?(f=$,Q(z)):(t.consume(z),$)}function O(z){return z===62?U(z):$(z)}function B(z){return bn(z)?(t.consume(z),T):a(z)}function T(z){return z===45||xn(z)?(t.consume(z),T):Y(z)}function Y(z){return Le(z)?(f=Y,Q(z)):tt(z)?(t.consume(z),Y):U(z)}function V(z){return z===45||xn(z)?(t.consume(z),V):z===47||z===62||zt(z)?te(z):a(z)}function te(z){return z===47?(t.consume(z),U):z===58||z===95||bn(z)?(t.consume(z),D):Le(z)?(f=te,Q(z)):tt(z)?(t.consume(z),te):U(z)}function D(z){return z===45||z===46||z===58||z===95||xn(z)?(t.consume(z),D):I(z)}function I(z){return z===61?(t.consume(z),L):Le(z)?(f=I,Q(z)):tt(z)?(t.consume(z),I):te(z)}function L(z){return z===null||z===60||z===61||z===62||z===96?a(z):z===34||z===39?(t.consume(z),o=z,ee):Le(z)?(f=L,Q(z)):tt(z)?(t.consume(z),L):(t.consume(z),ae)}function ee(z){return z===o?(t.consume(z),o=void 0,X):z===null?a(z):Le(z)?(f=ee,Q(z)):(t.consume(z),ee)}function ae(z){return z===null||z===34||z===39||z===60||z===61||z===96?a(z):z===47||z===62||zt(z)?te(z):(t.consume(z),ae)}function X(z){return z===47||z===62||zt(z)?te(z):a(z)}function U(z){return z===62?(t.consume(z),t.exit("htmlTextData"),t.exit("htmlText"),l):a(z)}function Q(z){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),ie}function ie(z){return tt(z)?st(t,ve,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):ve(z)}function ve(z){return t.enter("htmlTextData"),f(z)}}const Pd={name:"labelEnd",resolveAll:Rw,resolveTo:Ow,tokenize:Bw},Mw={tokenize:$w},_w={tokenize:Lw},Fw={tokenize:Hw};function Rw(t){let l=-1;const a=[];for(;++l<t.length;){const i=t[l][1];if(a.push(t[l]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const o=i.type==="labelImage"?4:2;i.type="data",l+=o}}return t.length!==a.length&&qn(t,0,t.length,a),t}function Ow(t,l){let a=t.length,i=0,o,u,f,m;for(;a--;)if(o=t[a][1],u){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;t[a][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(f){if(t[a][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(u=a,o.type!=="labelLink")){i=2;break}}else o.type==="labelEnd"&&(f=a);const p={type:t[u][1].type==="labelLink"?"link":"image",start:{...t[u][1].start},end:{...t[t.length-1][1].end}},h={type:"label",start:{...t[u][1].start},end:{...t[f][1].end}},g={type:"labelText",start:{...t[u+i+2][1].end},end:{...t[f-2][1].start}};return m=[["enter",p,l],["enter",h,l]],m=el(m,t.slice(u+1,u+i+3)),m=el(m,[["enter",g,l]]),m=el(m,wc(l.parser.constructs.insideSpan.null,t.slice(u+i+4,f-3),l)),m=el(m,[["exit",g,l],t[f-2],t[f-1],["exit",h,l]]),m=el(m,t.slice(f+1)),m=el(m,[["exit",p,l]]),qn(t,u,t.length,m),t}function Bw(t,l,a){const i=this;let o=i.events.length,u,f;for(;o--;)if((i.events[o][1].type==="labelImage"||i.events[o][1].type==="labelLink")&&!i.events[o][1]._balanced){u=i.events[o][1];break}return m;function m(b){return u?u._inactive?y(b):(f=i.parser.defined.includes(dl(i.sliceSerialize({start:u.end,end:i.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(b),t.exit("labelMarker"),t.exit("labelEnd"),p):a(b)}function p(b){return b===40?t.attempt(Mw,g,f?g:y)(b):b===91?t.attempt(_w,g,f?h:y)(b):f?g(b):y(b)}function h(b){return t.attempt(Fw,g,y)(b)}function g(b){return l(b)}function y(b){return u._balanced=!0,a(b)}}function $w(t,l,a){return i;function i(y){return t.enter("resource"),t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),o}function o(y){return zt(y)?xs(t,u)(y):u(y)}function u(y){return y===41?g(y):t0(t,f,m,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function f(y){return zt(y)?xs(t,p)(y):g(y)}function m(y){return a(y)}function p(y){return y===34||y===39||y===40?l0(t,h,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function h(y){return zt(y)?xs(t,g)(y):g(y)}function g(y){return y===41?(t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),t.exit("resource"),l):a(y)}}function Lw(t,l,a){const i=this;return o;function o(m){return n0.call(i,t,u,f,"reference","referenceMarker","referenceString")(m)}function u(m){return i.parser.defined.includes(dl(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?l(m):a(m)}function f(m){return a(m)}}function Hw(t,l,a){return i;function i(u){return t.enter("reference"),t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),o}function o(u){return u===93?(t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),t.exit("reference"),l):a(u)}}const Uw={name:"labelStartImage",resolveAll:Pd.resolveAll,tokenize:Iw};function Iw(t,l,a){const i=this;return o;function o(m){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(m),t.exit("labelImageMarker"),u}function u(m){return m===91?(t.enter("labelMarker"),t.consume(m),t.exit("labelMarker"),t.exit("labelImage"),f):a(m)}function f(m){return m===94&&"_hiddenFootnoteSupport"in i.parser.constructs?a(m):l(m)}}const Yw={name:"labelStartLink",resolveAll:Pd.resolveAll,tokenize:qw};function qw(t,l,a){const i=this;return o;function o(f){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(f),t.exit("labelMarker"),t.exit("labelLink"),u}function u(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?a(f):l(f)}}const Gf={name:"lineEnding",tokenize:Xw};function Xw(t,l){return a;function a(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),st(t,l,"linePrefix")}}const ac={name:"thematicBreak",tokenize:Vw};function Vw(t,l,a){let i=0,o;return u;function u(h){return t.enter("thematicBreak"),f(h)}function f(h){return o=h,m(h)}function m(h){return h===o?(t.enter("thematicBreakSequence"),p(h)):i>=3&&(h===null||Le(h))?(t.exit("thematicBreak"),l(h)):a(h)}function p(h){return h===o?(t.consume(h),i++,p):(t.exit("thematicBreakSequence"),tt(h)?st(t,m,"whitespace")(h):m(h))}}const Tn={continuation:{tokenize:Zw},exit:Jw,name:"list",tokenize:Qw},Gw={partial:!0,tokenize:Pw},Kw={partial:!0,tokenize:Ww};function Qw(t,l,a){const i=this,o=i.events[i.events.length-1];let u=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,f=0;return m;function m(v){const S=i.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!i.containerState.marker||v===i.containerState.marker:Td(v)){if(i.containerState.type||(i.containerState.type=S,t.enter(S,{_container:!0})),S==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(ac,a,h)(v):h(v);if(!i.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),p(v)}return a(v)}function p(v){return Td(v)&&++f<10?(t.consume(v),p):(!i.interrupt||f<2)&&(i.containerState.marker?v===i.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),h(v)):a(v)}function h(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||v,t.check(Es,i.interrupt?a:g,t.attempt(Gw,b,y))}function g(v){return i.containerState.initialBlankLine=!0,u++,b(v)}function y(v){return tt(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),b):a(v)}function b(v){return i.containerState.size=u+i.sliceSerialize(t.exit("listItemPrefix"),!0).length,l(v)}}function Zw(t,l,a){const i=this;return i.containerState._closeFlow=void 0,t.check(Es,o,u);function o(m){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,st(t,l,"listItemIndent",i.containerState.size+1)(m)}function u(m){return i.containerState.furtherBlankLines||!tt(m)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,f(m)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,t.attempt(Kw,l,f)(m))}function f(m){return i.containerState._closeFlow=!0,i.interrupt=void 0,st(t,t.attempt(Tn,l,a),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m)}}function Ww(t,l,a){const i=this;return st(t,o,"listItemIndent",i.containerState.size+1);function o(u){const f=i.events[i.events.length-1];return f&&f[1].type==="listItemIndent"&&f[2].sliceSerialize(f[1],!0).length===i.containerState.size?l(u):a(u)}}function Jw(t){t.exit(this.containerState.type)}function Pw(t,l,a){const i=this;return st(t,o,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(u){const f=i.events[i.events.length-1];return!tt(u)&&f&&f[1].type==="listItemPrefixWhitespace"?l(u):a(u)}}const E1={name:"setextUnderline",resolveTo:e5,tokenize:t5};function e5(t,l){let a=t.length,i,o,u;for(;a--;)if(t[a][0]==="enter"){if(t[a][1].type==="content"){i=a;break}t[a][1].type==="paragraph"&&(o=a)}else t[a][1].type==="content"&&t.splice(a,1),!u&&t[a][1].type==="definition"&&(u=a);const f={type:"setextHeading",start:{...t[i][1].start},end:{...t[t.length-1][1].end}};return t[o][1].type="setextHeadingText",u?(t.splice(o,0,["enter",f,l]),t.splice(u+1,0,["exit",t[i][1],l]),t[i][1].end={...t[u][1].end}):t[i][1]=f,t.push(["exit",f,l]),t}function t5(t,l,a){const i=this;let o;return u;function u(h){let g=i.events.length,y;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){y=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||y)?(t.enter("setextHeadingLine"),o=h,f(h)):a(h)}function f(h){return t.enter("setextHeadingLineSequence"),m(h)}function m(h){return h===o?(t.consume(h),m):(t.exit("setextHeadingLineSequence"),tt(h)?st(t,p,"lineSuffix")(h):p(h))}function p(h){return h===null||Le(h)?(t.exit("setextHeadingLine"),l(h)):a(h)}}const n5={tokenize:l5};function l5(t){const l=this,a=t.attempt(Es,i,t.attempt(this.parser.constructs.flowInitial,o,st(t,t.attempt(this.parser.constructs.flow,o,t.attempt(ow,o)),"linePrefix")));return a;function i(u){if(u===null){t.consume(u);return}return t.enter("lineEndingBlank"),t.consume(u),t.exit("lineEndingBlank"),l.currentConstruct=void 0,a}function o(u){if(u===null){t.consume(u);return}return t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),l.currentConstruct=void 0,a}}const a5={resolveAll:r0()},r5=a0("string"),i5=a0("text");function a0(t){return{resolveAll:r0(t==="text"?s5:void 0),tokenize:l};function l(a){const i=this,o=this.parser.constructs[t],u=a.attempt(o,f,m);return f;function f(g){return h(g)?u(g):m(g)}function m(g){if(g===null){a.consume(g);return}return a.enter("data"),a.consume(g),p}function p(g){return h(g)?(a.exit("data"),u(g)):(a.consume(g),p)}function h(g){if(g===null)return!0;const y=o[g];let b=-1;if(y)for(;++b<y.length;){const v=y[b];if(!v.previous||v.previous.call(i,i.previous))return!0}return!1}}}function r0(t){return l;function l(a,i){let o=-1,u;for(;++o<=a.length;)u===void 0?a[o]&&a[o][1].type==="data"&&(u=o,o++):(!a[o]||a[o][1].type!=="data")&&(o!==u+2&&(a[u][1].end=a[o-1][1].end,a.splice(u+2,o-u-2),o=u+2),u=void 0);return t?t(a,i):a}}function s5(t,l){let a=0;for(;++a<=t.length;)if((a===t.length||t[a][1].type==="lineEnding")&&t[a-1][1].type==="data"){const i=t[a-1][1],o=l.sliceStream(i);let u=o.length,f=-1,m=0,p;for(;u--;){const h=o[u];if(typeof h=="string"){for(f=h.length;h.charCodeAt(f-1)===32;)m++,f--;if(f)break;f=-1}else if(h===-2)p=!0,m++;else if(h!==-1){u++;break}}if(l._contentTypeTextTrailing&&a===t.length&&(m=0),m){const h={type:a===t.length||p||m<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?f:i.start._bufferIndex+f,_index:i.start._index+u,line:i.end.line,column:i.end.column-m,offset:i.end.offset-m},end:{...i.end}};i.end={...h.start},i.start.offset===i.end.offset?Object.assign(i,h):(t.splice(a,0,["enter",h,l],["exit",h,l]),a+=2)}a++}return t}const o5={42:Tn,43:Tn,45:Tn,48:Tn,49:Tn,50:Tn,51:Tn,52:Tn,53:Tn,54:Tn,55:Tn,56:Tn,57:Tn,62:Wy},c5={91:hw},u5={[-2]:Vf,[-1]:Vf,32:Vf},f5={35:bw,42:ac,45:[E1,ac],60:Sw,61:E1,95:ac,96:S1,126:S1},d5={38:Py,92:Jy},h5={[-5]:Gf,[-4]:Gf,[-3]:Gf,33:Uw,38:Py,42:zd,60:[Yv,Tw],91:Yw,92:[yw,Jy],93:Pd,95:zd,96:nw},m5={null:[zd,a5]},x5={null:[42,95]},p5={null:[]},y5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:x5,contentInitial:c5,disable:p5,document:o5,flow:f5,flowInitial:u5,insideSpan:m5,string:d5,text:h5},Symbol.toStringTag,{value:"Module"}));function g5(t,l,a){let i={_bufferIndex:-1,_index:0,line:a&&a.line||1,column:a&&a.column||1,offset:a&&a.offset||0};const o={},u=[];let f=[],m=[];const p={attempt:Y(B),check:Y(T),consume:M,enter:$,exit:O,interrupt:Y(T,{interrupt:!0})},h={code:null,containerState:{},defineSkip:k,events:[],now:S,parser:t,previous:null,sliceSerialize:b,sliceStream:v,write:y};let g=l.tokenize.call(h,p);return l.resolveAll&&u.push(l),h;function y(I){return f=el(f,I),C(),f[f.length-1]!==null?[]:(V(l,0),h.events=wc(u,h.events,h),h.events)}function b(I,L){return v5(v(I),L)}function v(I){return b5(f,I)}function S(){const{_bufferIndex:I,_index:L,line:ee,column:ae,offset:X}=i;return{_bufferIndex:I,_index:L,line:ee,column:ae,offset:X}}function k(I){o[I.line]=I.column,D()}function C(){let I;for(;i._index<f.length;){const L=f[i._index];if(typeof L=="string")for(I=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===I&&i._bufferIndex<L.length;)E(L.charCodeAt(i._bufferIndex));else E(L)}}function E(I){g=g(I)}function M(I){Le(I)?(i.line++,i.column=1,i.offset+=I===-3?2:1,D()):I!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===f[i._index].length&&(i._bufferIndex=-1,i._index++)),h.previous=I}function $(I,L){const ee=L||{};return ee.type=I,ee.start=S(),h.events.push(["enter",ee,h]),m.push(ee),ee}function O(I){const L=m.pop();return L.end=S(),h.events.push(["exit",L,h]),L}function B(I,L){V(I,L.from)}function T(I,L){L.restore()}function Y(I,L){return ee;function ee(ae,X,U){let Q,ie,ve,z;return Array.isArray(ae)?P(ae):"tokenize"in ae?P([ae]):_(ae);function _(Ce){return Fe;function Fe(Ye){const se=Ye!==null&&Ce[Ye],K=Ye!==null&&Ce.null,ue=[...Array.isArray(se)?se:se?[se]:[],...Array.isArray(K)?K:K?[K]:[]];return P(ue)(Ye)}}function P(Ce){return Q=Ce,ie=0,Ce.length===0?U:A(Ce[ie])}function A(Ce){return Fe;function Fe(Ye){return z=te(),ve=Ce,Ce.partial||(h.currentConstruct=Ce),Ce.name&&h.parser.constructs.disable.null.includes(Ce.name)?Se():Ce.tokenize.call(L?Object.assign(Object.create(h),L):h,p,pe,Se)(Ye)}}function pe(Ce){return I(ve,z),X}function Se(Ce){return z.restore(),++ie<Q.length?A(Q[ie]):U}}}function V(I,L){I.resolveAll&&!u.includes(I)&&u.push(I),I.resolve&&qn(h.events,L,h.events.length-L,I.resolve(h.events.slice(L),h)),I.resolveTo&&(h.events=I.resolveTo(h.events,h))}function te(){const I=S(),L=h.previous,ee=h.currentConstruct,ae=h.events.length,X=Array.from(m);return{from:ae,restore:U};function U(){i=I,h.previous=L,h.currentConstruct=ee,h.events.length=ae,m=X,D()}}function D(){i.line in o&&i.column<2&&(i.column=o[i.line],i.offset+=o[i.line]-1)}}function b5(t,l){const a=l.start._index,i=l.start._bufferIndex,o=l.end._index,u=l.end._bufferIndex;let f;if(a===o)f=[t[a].slice(i,u)];else{if(f=t.slice(a,o),i>-1){const m=f[0];typeof m=="string"?f[0]=m.slice(i):f.shift()}u>0&&f.push(t[o].slice(0,u))}return f}function v5(t,l){let a=-1;const i=[];let o;for(;++a<t.length;){const u=t[a];let f;if(typeof u=="string")f=u;else switch(u){case-5:{f="\r";break}case-4:{f=`
|
|
52
|
-
`;break}case-3:{f=`\r
|
|
53
|
-
`;break}case-2:{f=l?" ":" ";break}case-1:{if(!l&&o)continue;f=" ";break}default:f=String.fromCharCode(u)}o=u===-2,i.push(f)}return i.join("")}function w5(t){const i={constructs:Qy([y5,...(t||{}).extensions||[]]),content:o(Ov),defined:[],document:o($v),flow:o(n5),lazy:{},string:o(r5),text:o(i5)};return i;function o(u){return f;function f(m){return g5(i,u,m)}}}function k5(t){for(;!e0(t););return t}const C1=/[\0\t\n\r]/g;function S5(){let t=1,l="",a=!0,i;return o;function o(u,f,m){const p=[];let h,g,y,b,v;for(u=l+(typeof u=="string"?u.toString():new TextDecoder(f||void 0).decode(u)),y=0,l="",a&&(u.charCodeAt(0)===65279&&y++,a=void 0);y<u.length;){if(C1.lastIndex=y,h=C1.exec(u),b=h&&h.index!==void 0?h.index:u.length,v=u.charCodeAt(b),!h){l=u.slice(y);break}if(v===10&&y===b&&i)p.push(-3),i=void 0;else switch(i&&(p.push(-5),i=void 0),y<b&&(p.push(u.slice(y,b)),t+=b-y),v){case 0:{p.push(65533),t++;break}case 9:{for(g=Math.ceil(t/4)*4,p.push(-2);t++<g;)p.push(-1);break}case 10:{p.push(-4),t=1;break}default:i=!0,t=1}y=b+1}return m&&(i&&p.push(-5),l&&p.push(l),p.push(null)),p}}const j5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function E5(t){return t.replace(j5,C5)}function C5(t,l,a){if(l)return l;if(a.charCodeAt(0)===35){const o=a.charCodeAt(1),u=o===120||o===88;return Zy(a.slice(u?2:1),u?16:10)}return Jd(a)||t}const i0={}.hasOwnProperty;function N5(t,l,a){return l&&typeof l=="object"&&(a=l,l=void 0),A5(a)(k5(w5(a).document().write(S5()(t,l,!0))))}function A5(t){const l={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(jt),autolinkProtocol:te,autolinkEmail:te,atxHeading:u(je),blockQuote:u(K),characterEscape:te,characterReference:te,codeFenced:u(ue),codeFencedFenceInfo:f,codeFencedFenceMeta:f,codeIndented:u(ue,f),codeText:u(we,f),codeTextData:te,data:te,codeFlowValue:te,definition:u(ne),definitionDestinationString:f,definitionLabelString:f,definitionTitleString:f,emphasis:u(xe),hardBreakEscape:u(Ae),hardBreakTrailing:u(Ae),htmlFlow:u(Re,f),htmlFlowData:te,htmlText:u(Re,f),htmlTextData:te,image:u(Ve),label:f,link:u(jt),listItem:u(ct),listItemValue:b,listOrdered:u($t,y),listUnordered:u($t),paragraph:u(Dt),reference:A,referenceString:f,resourceDestinationString:f,resourceTitleString:f,setextHeading:u(je),strong:u(on),thematicBreak:u(Pt)},exit:{atxHeading:p(),atxHeadingSequence:B,autolink:p(),autolinkEmail:se,autolinkProtocol:Ye,blockQuote:p(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:Se,characterReferenceMarkerNumeric:Se,characterReferenceValue:Ce,characterReference:Fe,codeFenced:p(C),codeFencedFence:k,codeFencedFenceInfo:v,codeFencedFenceMeta:S,codeFlowValue:D,codeIndented:p(E),codeText:p(X),codeTextData:D,data:D,definition:p(),definitionDestinationString:O,definitionLabelString:M,definitionTitleString:$,emphasis:p(),hardBreakEscape:p(L),hardBreakTrailing:p(L),htmlFlow:p(ee),htmlFlowData:D,htmlText:p(ae),htmlTextData:D,image:p(Q),label:ve,labelText:ie,lineEnding:I,link:p(U),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:pe,resourceDestinationString:z,resourceTitleString:_,resource:P,setextHeading:p(V),setextHeadingLineSequence:Y,setextHeadingText:T,strong:p(),thematicBreak:p()}};s0(l,(t||{}).mdastExtensions||[]);const a={};return i;function i(re){let ye={type:"root",children:[]};const _e={stack:[ye],tokenStack:[],config:l,enter:m,exit:h,buffer:f,resume:g,data:a},me=[];let be=-1;for(;++be<re.length;)if(re[be][1].type==="listOrdered"||re[be][1].type==="listUnordered")if(re[be][0]==="enter")me.push(be);else{const ot=me.pop();be=o(re,ot,be)}for(be=-1;++be<re.length;){const ot=l[re[be][0]];i0.call(ot,re[be][1].type)&&ot[re[be][1].type].call(Object.assign({sliceSerialize:re[be][2].sliceSerialize},_e),re[be][1])}if(_e.tokenStack.length>0){const ot=_e.tokenStack[_e.tokenStack.length-1];(ot[1]||N1).call(_e,void 0,ot[0])}for(ye.position={start:Ea(re.length>0?re[0][1].start:{line:1,column:1,offset:0}),end:Ea(re.length>0?re[re.length-2][1].end:{line:1,column:1,offset:0})},be=-1;++be<l.transforms.length;)ye=l.transforms[be](ye)||ye;return ye}function o(re,ye,_e){let me=ye-1,be=-1,ot=!1,bt,Ze,de,Oe;for(;++me<=_e;){const ut=re[me];switch(ut[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ut[0]==="enter"?be++:be--,Oe=void 0;break}case"lineEndingBlank":{ut[0]==="enter"&&(bt&&!Oe&&!be&&!de&&(de=me),Oe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Oe=void 0}if(!be&&ut[0]==="enter"&&ut[1].type==="listItemPrefix"||be===-1&&ut[0]==="exit"&&(ut[1].type==="listUnordered"||ut[1].type==="listOrdered")){if(bt){let kn=me;for(Ze=void 0;kn--;){const an=re[kn];if(an[1].type==="lineEnding"||an[1].type==="lineEndingBlank"){if(an[0]==="exit")continue;Ze&&(re[Ze][1].type="lineEndingBlank",ot=!0),an[1].type="lineEnding",Ze=kn}else if(!(an[1].type==="linePrefix"||an[1].type==="blockQuotePrefix"||an[1].type==="blockQuotePrefixWhitespace"||an[1].type==="blockQuoteMarker"||an[1].type==="listItemIndent"))break}de&&(!Ze||de<Ze)&&(bt._spread=!0),bt.end=Object.assign({},Ze?re[Ze][1].start:ut[1].end),re.splice(Ze||me,0,["exit",bt,ut[2]]),me++,_e++}if(ut[1].type==="listItemPrefix"){const kn={type:"listItem",_spread:!1,start:Object.assign({},ut[1].start),end:void 0};bt=kn,re.splice(me,0,["enter",kn,ut[2]]),me++,_e++,de=void 0,Oe=!0}}}return re[ye][1]._spread=ot,_e}function u(re,ye){return _e;function _e(me){m.call(this,re(me),me),ye&&ye.call(this,me)}}function f(){this.stack.push({type:"fragment",children:[]})}function m(re,ye,_e){this.stack[this.stack.length-1].children.push(re),this.stack.push(re),this.tokenStack.push([ye,_e||void 0]),re.position={start:Ea(ye.start),end:void 0}}function p(re){return ye;function ye(_e){re&&re.call(this,_e),h.call(this,_e)}}function h(re,ye){const _e=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==re.type&&(ye?ye.call(this,re,me[0]):(me[1]||N1).call(this,re,me[0]));else throw new Error("Cannot close `"+re.type+"` ("+ms({start:re.start,end:re.end})+"): it’s not open");_e.position.end=Ea(re.end)}function g(){return Wd(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function b(re){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(re),10),this.data.expectingFirstListItemValue=void 0}}function v(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=re}function S(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=re}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re.replace(/(\r?\n|\r)$/g,"")}function M(re){const ye=this.resume(),_e=this.stack[this.stack.length-1];_e.label=ye,_e.identifier=dl(this.sliceSerialize(re)).toLowerCase()}function $(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.title=re}function O(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.url=re}function B(re){const ye=this.stack[this.stack.length-1];if(!ye.depth){const _e=this.sliceSerialize(re).length;ye.depth=_e}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function Y(re){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(re).codePointAt(0)===61?1:2}function V(){this.data.setextHeadingSlurpLineEnding=void 0}function te(re){const _e=this.stack[this.stack.length-1].children;let me=_e[_e.length-1];(!me||me.type!=="text")&&(me=gt(),me.position={start:Ea(re.start),end:void 0},_e.push(me)),this.stack.push(me)}function D(re){const ye=this.stack.pop();ye.value+=this.sliceSerialize(re),ye.position.end=Ea(re.end)}function I(re){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const _e=ye.children[ye.children.length-1];_e.position.end=Ea(re.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&l.canContainEols.includes(ye.type)&&(te.call(this,re),D.call(this,re))}function L(){this.data.atHardBreak=!0}function ee(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re}function ae(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re}function X(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re}function U(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=ye,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function Q(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=ye,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function ie(re){const ye=this.sliceSerialize(re),_e=this.stack[this.stack.length-2];_e.label=E5(ye),_e.identifier=dl(ye).toLowerCase()}function ve(){const re=this.stack[this.stack.length-1],ye=this.resume(),_e=this.stack[this.stack.length-1];if(this.data.inReference=!0,_e.type==="link"){const me=re.children;_e.children=me}else _e.alt=ye}function z(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.url=re}function _(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.title=re}function P(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function pe(re){const ye=this.resume(),_e=this.stack[this.stack.length-1];_e.label=ye,_e.identifier=dl(this.sliceSerialize(re)).toLowerCase(),this.data.referenceType="full"}function Se(re){this.data.characterReferenceType=re.type}function Ce(re){const ye=this.sliceSerialize(re),_e=this.data.characterReferenceType;let me;_e?(me=Zy(ye,_e==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=Jd(ye);const be=this.stack[this.stack.length-1];be.value+=me}function Fe(re){const ye=this.stack.pop();ye.position.end=Ea(re.end)}function Ye(re){D.call(this,re);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(re)}function se(re){D.call(this,re);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(re)}function K(){return{type:"blockquote",children:[]}}function ue(){return{type:"code",lang:null,meta:null,value:""}}function we(){return{type:"inlineCode",value:""}}function ne(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function xe(){return{type:"emphasis",children:[]}}function je(){return{type:"heading",depth:0,children:[]}}function Ae(){return{type:"break"}}function Re(){return{type:"html",value:""}}function Ve(){return{type:"image",title:null,url:"",alt:null}}function jt(){return{type:"link",title:null,url:"",children:[]}}function $t(re){return{type:"list",ordered:re.type==="listOrdered",start:null,spread:re._spread,children:[]}}function ct(re){return{type:"listItem",spread:re._spread,checked:null,children:[]}}function Dt(){return{type:"paragraph",children:[]}}function on(){return{type:"strong",children:[]}}function gt(){return{type:"text",value:""}}function Pt(){return{type:"thematicBreak"}}}function Ea(t){return{line:t.line,column:t.column,offset:t.offset}}function s0(t,l){let a=-1;for(;++a<l.length;){const i=l[a];Array.isArray(i)?s0(t,i):D5(t,i)}}function D5(t,l){let a;for(a in l)if(i0.call(l,a))switch(a){case"canContainEols":{const i=l[a];i&&t[a].push(...i);break}case"transforms":{const i=l[a];i&&t[a].push(...i);break}case"enter":case"exit":{const i=l[a];i&&Object.assign(t[a],i);break}}}function N1(t,l){throw t?new Error("Cannot close `"+t.type+"` ("+ms({start:t.start,end:t.end})+"): a different token (`"+l.type+"`, "+ms({start:l.start,end:l.end})+") is open"):new Error("Cannot close document, a token (`"+l.type+"`, "+ms({start:l.start,end:l.end})+") is still open")}function T5(t){const l=this;l.parser=a;function a(i){return N5(i,{...l.data("settings"),...t,extensions:l.data("micromarkExtensions")||[],mdastExtensions:l.data("fromMarkdownExtensions")||[]})}}function z5(t,l){const a={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(l),!0)};return t.patch(l,a),t.applyData(l,a)}function M5(t,l){const a={type:"element",tagName:"br",properties:{},children:[]};return t.patch(l,a),[t.applyData(l,a),{type:"text",value:`
|
|
54
|
-
`}]}function _5(t,l){const a=l.value?l.value+`
|
|
55
|
-
`:"",i={},o=l.lang?l.lang.split(/\s+/):[];o.length>0&&(i.className=["language-"+o[0]]);let u={type:"element",tagName:"code",properties:i,children:[{type:"text",value:a}]};return l.meta&&(u.data={meta:l.meta}),t.patch(l,u),u=t.applyData(l,u),u={type:"element",tagName:"pre",properties:{},children:[u]},t.patch(l,u),u}function F5(t,l){const a={type:"element",tagName:"del",properties:{},children:t.all(l)};return t.patch(l,a),t.applyData(l,a)}function R5(t,l){const a={type:"element",tagName:"em",properties:{},children:t.all(l)};return t.patch(l,a),t.applyData(l,a)}function O5(t,l){const a=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",i=String(l.identifier).toUpperCase(),o=ni(i.toLowerCase()),u=t.footnoteOrder.indexOf(i);let f,m=t.footnoteCounts.get(i);m===void 0?(m=0,t.footnoteOrder.push(i),f=t.footnoteOrder.length):f=u+1,m+=1,t.footnoteCounts.set(i,m);const p={type:"element",tagName:"a",properties:{href:"#"+a+"fn-"+o,id:a+"fnref-"+o+(m>1?"-"+m:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(f)}]};t.patch(l,p);const h={type:"element",tagName:"sup",properties:{},children:[p]};return t.patch(l,h),t.applyData(l,h)}function B5(t,l){const a={type:"element",tagName:"h"+l.depth,properties:{},children:t.all(l)};return t.patch(l,a),t.applyData(l,a)}function $5(t,l){if(t.options.allowDangerousHtml){const a={type:"raw",value:l.value};return t.patch(l,a),t.applyData(l,a)}}function o0(t,l){const a=l.referenceType;let i="]";if(a==="collapsed"?i+="[]":a==="full"&&(i+="["+(l.label||l.identifier)+"]"),l.type==="imageReference")return[{type:"text",value:"!["+l.alt+i}];const o=t.all(l),u=o[0];u&&u.type==="text"?u.value="["+u.value:o.unshift({type:"text",value:"["});const f=o[o.length-1];return f&&f.type==="text"?f.value+=i:o.push({type:"text",value:i}),o}function L5(t,l){const a=String(l.identifier).toUpperCase(),i=t.definitionById.get(a);if(!i)return o0(t,l);const o={src:ni(i.url||""),alt:l.alt};i.title!==null&&i.title!==void 0&&(o.title=i.title);const u={type:"element",tagName:"img",properties:o,children:[]};return t.patch(l,u),t.applyData(l,u)}function H5(t,l){const a={src:ni(l.url)};l.alt!==null&&l.alt!==void 0&&(a.alt=l.alt),l.title!==null&&l.title!==void 0&&(a.title=l.title);const i={type:"element",tagName:"img",properties:a,children:[]};return t.patch(l,i),t.applyData(l,i)}function U5(t,l){const a={type:"text",value:l.value.replace(/\r?\n|\r/g," ")};t.patch(l,a);const i={type:"element",tagName:"code",properties:{},children:[a]};return t.patch(l,i),t.applyData(l,i)}function I5(t,l){const a=String(l.identifier).toUpperCase(),i=t.definitionById.get(a);if(!i)return o0(t,l);const o={href:ni(i.url||"")};i.title!==null&&i.title!==void 0&&(o.title=i.title);const u={type:"element",tagName:"a",properties:o,children:t.all(l)};return t.patch(l,u),t.applyData(l,u)}function Y5(t,l){const a={href:ni(l.url)};l.title!==null&&l.title!==void 0&&(a.title=l.title);const i={type:"element",tagName:"a",properties:a,children:t.all(l)};return t.patch(l,i),t.applyData(l,i)}function q5(t,l,a){const i=t.all(l),o=a?X5(a):c0(l),u={},f=[];if(typeof l.checked=="boolean"){const g=i[0];let y;g&&g.type==="element"&&g.tagName==="p"?y=g:(y={type:"element",tagName:"p",properties:{},children:[]},i.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:l.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let m=-1;for(;++m<i.length;){const g=i[m];(o||m!==0||g.type!=="element"||g.tagName!=="p")&&f.push({type:"text",value:`
|
|
56
|
-
`}),g.type==="element"&&g.tagName==="p"&&!o?f.push(...g.children):f.push(g)}const p=i[i.length-1];p&&(o||p.type!=="element"||p.tagName!=="p")&&f.push({type:"text",value:`
|
|
57
|
-
`});const h={type:"element",tagName:"li",properties:u,children:f};return t.patch(l,h),t.applyData(l,h)}function X5(t){let l=!1;if(t.type==="list"){l=t.spread||!1;const a=t.children;let i=-1;for(;!l&&++i<a.length;)l=c0(a[i])}return l}function c0(t){const l=t.spread;return l??t.children.length>1}function V5(t,l){const a={},i=t.all(l);let o=-1;for(typeof l.start=="number"&&l.start!==1&&(a.start=l.start);++o<i.length;){const f=i[o];if(f.type==="element"&&f.tagName==="li"&&f.properties&&Array.isArray(f.properties.className)&&f.properties.className.includes("task-list-item")){a.className=["contains-task-list"];break}}const u={type:"element",tagName:l.ordered?"ol":"ul",properties:a,children:t.wrap(i,!0)};return t.patch(l,u),t.applyData(l,u)}function G5(t,l){const a={type:"element",tagName:"p",properties:{},children:t.all(l)};return t.patch(l,a),t.applyData(l,a)}function K5(t,l){const a={type:"root",children:t.wrap(t.all(l))};return t.patch(l,a),t.applyData(l,a)}function Q5(t,l){const a={type:"element",tagName:"strong",properties:{},children:t.all(l)};return t.patch(l,a),t.applyData(l,a)}function Z5(t,l){const a=t.all(l),i=a.shift(),o=[];if(i){const f={type:"element",tagName:"thead",properties:{},children:t.wrap([i],!0)};t.patch(l.children[0],f),o.push(f)}if(a.length>0){const f={type:"element",tagName:"tbody",properties:{},children:t.wrap(a,!0)},m=Gd(l.children[1]),p=Iy(l.children[l.children.length-1]);m&&p&&(f.position={start:m,end:p}),o.push(f)}const u={type:"element",tagName:"table",properties:{},children:t.wrap(o,!0)};return t.patch(l,u),t.applyData(l,u)}function W5(t,l,a){const i=a?a.children:void 0,u=(i?i.indexOf(l):1)===0?"th":"td",f=a&&a.type==="table"?a.align:void 0,m=f?f.length:l.children.length;let p=-1;const h=[];for(;++p<m;){const y=l.children[p],b={},v=f?f[p]:void 0;v&&(b.align=v);let S={type:"element",tagName:u,properties:b,children:[]};y&&(S.children=t.all(y),t.patch(y,S),S=t.applyData(y,S)),h.push(S)}const g={type:"element",tagName:"tr",properties:{},children:t.wrap(h,!0)};return t.patch(l,g),t.applyData(l,g)}function J5(t,l){const a={type:"element",tagName:"td",properties:{},children:t.all(l)};return t.patch(l,a),t.applyData(l,a)}const A1=9,D1=32;function P5(t){const l=String(t),a=/\r?\n|\r/g;let i=a.exec(l),o=0;const u=[];for(;i;)u.push(T1(l.slice(o,i.index),o>0,!0),i[0]),o=i.index+i[0].length,i=a.exec(l);return u.push(T1(l.slice(o),o>0,!1)),u.join("")}function T1(t,l,a){let i=0,o=t.length;if(l){let u=t.codePointAt(i);for(;u===A1||u===D1;)i++,u=t.codePointAt(i)}if(a){let u=t.codePointAt(o-1);for(;u===A1||u===D1;)o--,u=t.codePointAt(o-1)}return o>i?t.slice(i,o):""}function e3(t,l){const a={type:"text",value:P5(String(l.value))};return t.patch(l,a),t.applyData(l,a)}function t3(t,l){const a={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(l,a),t.applyData(l,a)}const n3={blockquote:z5,break:M5,code:_5,delete:F5,emphasis:R5,footnoteReference:O5,heading:B5,html:$5,imageReference:L5,image:H5,inlineCode:U5,linkReference:I5,link:Y5,listItem:q5,list:V5,paragraph:G5,root:K5,strong:Q5,table:Z5,tableCell:J5,tableRow:W5,text:e3,thematicBreak:t3,toml:Vo,yaml:Vo,definition:Vo,footnoteDefinition:Vo};function Vo(){}const u0=-1,kc=0,ps=1,fc=2,eh=3,th=4,nh=5,lh=6,f0=7,d0=8,z1=typeof self=="object"?self:globalThis,l3=(t,l)=>{const a=(o,u)=>(t.set(u,o),o),i=o=>{if(t.has(o))return t.get(o);const[u,f]=l[o];switch(u){case kc:case u0:return a(f,o);case ps:{const m=a([],o);for(const p of f)m.push(i(p));return m}case fc:{const m=a({},o);for(const[p,h]of f)m[i(p)]=i(h);return m}case eh:return a(new Date(f),o);case th:{const{source:m,flags:p}=f;return a(new RegExp(m,p),o)}case nh:{const m=a(new Map,o);for(const[p,h]of f)m.set(i(p),i(h));return m}case lh:{const m=a(new Set,o);for(const p of f)m.add(i(p));return m}case f0:{const{name:m,message:p}=f;return a(new z1[m](p),o)}case d0:return a(BigInt(f),o);case"BigInt":return a(Object(BigInt(f)),o);case"ArrayBuffer":return a(new Uint8Array(f).buffer,f);case"DataView":{const{buffer:m}=new Uint8Array(f);return a(new DataView(m),f)}}return a(new z1[u](f),o)};return i},M1=t=>l3(new Map,t)(0),Kr="",{toString:a3}={},{keys:r3}=Object,as=t=>{const l=typeof t;if(l!=="object"||!t)return[kc,l];const a=a3.call(t).slice(8,-1);switch(a){case"Array":return[ps,Kr];case"Object":return[fc,Kr];case"Date":return[eh,Kr];case"RegExp":return[th,Kr];case"Map":return[nh,Kr];case"Set":return[lh,Kr];case"DataView":return[ps,a]}return a.includes("Array")?[ps,a]:a.includes("Error")?[f0,a]:[fc,a]},Go=([t,l])=>t===kc&&(l==="function"||l==="symbol"),i3=(t,l,a,i)=>{const o=(f,m)=>{const p=i.push(f)-1;return a.set(m,p),p},u=f=>{if(a.has(f))return a.get(f);let[m,p]=as(f);switch(m){case kc:{let g=f;switch(p){case"bigint":m=d0,g=f.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+p);g=null;break;case"undefined":return o([u0],f)}return o([m,g],f)}case ps:{if(p){let b=f;return p==="DataView"?b=new Uint8Array(f.buffer):p==="ArrayBuffer"&&(b=new Uint8Array(f)),o([p,[...b]],f)}const g=[],y=o([m,g],f);for(const b of f)g.push(u(b));return y}case fc:{if(p)switch(p){case"BigInt":return o([p,f.toString()],f);case"Boolean":case"Number":case"String":return o([p,f.valueOf()],f)}if(l&&"toJSON"in f)return u(f.toJSON());const g=[],y=o([m,g],f);for(const b of r3(f))(t||!Go(as(f[b])))&&g.push([u(b),u(f[b])]);return y}case eh:return o([m,f.toISOString()],f);case th:{const{source:g,flags:y}=f;return o([m,{source:g,flags:y}],f)}case nh:{const g=[],y=o([m,g],f);for(const[b,v]of f)(t||!(Go(as(b))||Go(as(v))))&&g.push([u(b),u(v)]);return y}case lh:{const g=[],y=o([m,g],f);for(const b of f)(t||!Go(as(b)))&&g.push(u(b));return y}}const{message:h}=f;return o([m,{name:p,message:h}],f)};return u},_1=(t,{json:l,lossy:a}={})=>{const i=[];return i3(!(l||a),!!l,new Map,i)(t),i},dc=typeof structuredClone=="function"?(t,l)=>l&&("json"in l||"lossy"in l)?M1(_1(t,l)):structuredClone(t):(t,l)=>M1(_1(t,l));function s3(t,l){const a=[{type:"text",value:"↩"}];return l>1&&a.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(l)}]}),a}function o3(t,l){return"Back to reference "+(t+1)+(l>1?"-"+l:"")}function c3(t){const l=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",a=t.options.footnoteBackContent||s3,i=t.options.footnoteBackLabel||o3,o=t.options.footnoteLabel||"Footnotes",u=t.options.footnoteLabelTagName||"h2",f=t.options.footnoteLabelProperties||{className:["sr-only"]},m=[];let p=-1;for(;++p<t.footnoteOrder.length;){const h=t.footnoteById.get(t.footnoteOrder[p]);if(!h)continue;const g=t.all(h),y=String(h.identifier).toUpperCase(),b=ni(y.toLowerCase());let v=0;const S=[],k=t.footnoteCounts.get(y);for(;k!==void 0&&++v<=k;){S.length>0&&S.push({type:"text",value:" "});let M=typeof a=="string"?a:a(p,v);typeof M=="string"&&(M={type:"text",value:M}),S.push({type:"element",tagName:"a",properties:{href:"#"+l+"fnref-"+b+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(p,v),className:["data-footnote-backref"]},children:Array.isArray(M)?M:[M]})}const C=g[g.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const M=C.children[C.children.length-1];M&&M.type==="text"?M.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...S)}else g.push(...S);const E={type:"element",tagName:"li",properties:{id:l+"fn-"+b},children:t.wrap(g,!0)};t.patch(h,E),m.push(E)}if(m.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...dc(f),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
58
|
-
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(m,!0)},{type:"text",value:`
|
|
59
|
-
`}]}}const Sc=(function(t){if(t==null)return h3;if(typeof t=="function")return jc(t);if(typeof t=="object")return Array.isArray(t)?u3(t):f3(t);if(typeof t=="string")return d3(t);throw new Error("Expected function, string, or object as test")});function u3(t){const l=[];let a=-1;for(;++a<t.length;)l[a]=Sc(t[a]);return jc(i);function i(...o){let u=-1;for(;++u<l.length;)if(l[u].apply(this,o))return!0;return!1}}function f3(t){const l=t;return jc(a);function a(i){const o=i;let u;for(u in t)if(o[u]!==l[u])return!1;return!0}}function d3(t){return jc(l);function l(a){return a&&a.type===t}}function jc(t){return l;function l(a,i,o){return!!(m3(a)&&t.call(this,a,typeof i=="number"?i:void 0,o||void 0))}}function h3(){return!0}function m3(t){return t!==null&&typeof t=="object"&&"type"in t}const h0=[],x3=!0,Md=!1,p3="skip";function m0(t,l,a,i){let o;typeof l=="function"&&typeof a!="function"?(i=a,a=l):o=l;const u=Sc(o),f=i?-1:1;m(t,void 0,[])();function m(p,h,g){const y=p&&typeof p=="object"?p:{};if(typeof y.type=="string"){const v=typeof y.tagName=="string"?y.tagName:typeof y.name=="string"?y.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(p.type+(v?"<"+v+">":""))+")"})}return b;function b(){let v=h0,S,k,C;if((!l||u(p,h,g[g.length-1]||void 0))&&(v=y3(a(p,g)),v[0]===Md))return v;if("children"in p&&p.children){const E=p;if(E.children&&v[0]!==p3)for(k=(i?E.children.length:-1)+f,C=g.concat(E);k>-1&&k<E.children.length;){const M=E.children[k];if(S=m(M,k,C)(),S[0]===Md)return S;k=typeof S[1]=="number"?S[1]:k+f}}return v}}}function y3(t){return Array.isArray(t)?t:typeof t=="number"?[x3,t]:t==null?h0:[t]}function ah(t,l,a,i){let o,u,f;typeof l=="function"&&typeof a!="function"?(u=void 0,f=l,o=a):(u=l,f=a,o=i),m0(t,u,m,o);function m(p,h){const g=h[h.length-1],y=g?g.children.indexOf(p):void 0;return f(p,y,g)}}const _d={}.hasOwnProperty,g3={};function b3(t,l){const a=l||g3,i=new Map,o=new Map,u=new Map,f={...n3,...a.handlers},m={all:h,applyData:w3,definitionById:i,footnoteById:o,footnoteCounts:u,footnoteOrder:[],handlers:f,one:p,options:a,patch:v3,wrap:S3};return ah(t,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const y=g.type==="definition"?i:o,b=String(g.identifier).toUpperCase();y.has(b)||y.set(b,g)}}),m;function p(g,y){const b=g.type,v=m.handlers[b];if(_d.call(m.handlers,b)&&v)return v(m,g,y);if(m.options.passThrough&&m.options.passThrough.includes(b)){if("children"in g){const{children:k,...C}=g,E=dc(C);return E.children=m.all(g),E}return dc(g)}return(m.options.unknownHandler||k3)(m,g,y)}function h(g){const y=[];if("children"in g){const b=g.children;let v=-1;for(;++v<b.length;){const S=m.one(b[v],g);if(S){if(v&&b[v-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=F1(S.value)),!Array.isArray(S)&&S.type==="element")){const k=S.children[0];k&&k.type==="text"&&(k.value=F1(k.value))}Array.isArray(S)?y.push(...S):y.push(S)}}}return y}}function v3(t,l){t.position&&(l.position=ov(t))}function w3(t,l){let a=l;if(t&&t.data){const i=t.data.hName,o=t.data.hChildren,u=t.data.hProperties;if(typeof i=="string")if(a.type==="element")a.tagName=i;else{const f="children"in a?a.children:[a];a={type:"element",tagName:i,properties:{},children:f}}a.type==="element"&&u&&Object.assign(a.properties,dc(u)),"children"in a&&a.children&&o!==null&&o!==void 0&&(a.children=o)}return a}function k3(t,l){const a=l.data||{},i="value"in l&&!(_d.call(a,"hProperties")||_d.call(a,"hChildren"))?{type:"text",value:l.value}:{type:"element",tagName:"div",properties:{},children:t.all(l)};return t.patch(l,i),t.applyData(l,i)}function S3(t,l){const a=[];let i=-1;for(l&&a.push({type:"text",value:`
|
|
60
|
-
`});++i<t.length;)i&&a.push({type:"text",value:`
|
|
61
|
-
`}),a.push(t[i]);return l&&t.length>0&&a.push({type:"text",value:`
|
|
62
|
-
`}),a}function F1(t){let l=0,a=t.charCodeAt(l);for(;a===9||a===32;)l++,a=t.charCodeAt(l);return t.slice(l)}function R1(t,l){const a=b3(t,l),i=a.one(t,void 0),o=c3(a),u=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return o&&u.children.push({type:"text",value:`
|
|
63
|
-
`},o),u}function j3(t,l){return t&&"run"in t?async function(a,i){const o=R1(a,{file:i,...l});await t.run(o,i)}:function(a,i){return R1(a,{file:i,...t||l})}}function O1(t){if(t)throw t}var Kf,B1;function E3(){if(B1)return Kf;B1=1;var t=Object.prototype.hasOwnProperty,l=Object.prototype.toString,a=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=function(h){return typeof Array.isArray=="function"?Array.isArray(h):l.call(h)==="[object Array]"},u=function(h){if(!h||l.call(h)!=="[object Object]")return!1;var g=t.call(h,"constructor"),y=h.constructor&&h.constructor.prototype&&t.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!y)return!1;var b;for(b in h);return typeof b>"u"||t.call(h,b)},f=function(h,g){a&&g.name==="__proto__"?a(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},m=function(h,g){if(g==="__proto__")if(t.call(h,g)){if(i)return i(h,g).value}else return;return h[g]};return Kf=function p(){var h,g,y,b,v,S,k=arguments[0],C=1,E=arguments.length,M=!1;for(typeof k=="boolean"&&(M=k,k=arguments[1]||{},C=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});C<E;++C)if(h=arguments[C],h!=null)for(g in h)y=m(k,g),b=m(h,g),k!==b&&(M&&b&&(u(b)||(v=o(b)))?(v?(v=!1,S=y&&o(y)?y:[]):S=y&&u(y)?y:{},f(k,{name:g,newValue:p(M,S,b)})):typeof b<"u"&&f(k,{name:g,newValue:b}));return k},Kf}var C3=E3();const Qf=_y(C3);function Fd(t){if(typeof t!="object"||t===null)return!1;const l=Object.getPrototypeOf(t);return(l===null||l===Object.prototype||Object.getPrototypeOf(l)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function N3(){const t=[],l={run:a,use:i};return l;function a(...o){let u=-1;const f=o.pop();if(typeof f!="function")throw new TypeError("Expected function as last argument, not "+f);m(null,...o);function m(p,...h){const g=t[++u];let y=-1;if(p){f(p);return}for(;++y<o.length;)(h[y]===null||h[y]===void 0)&&(h[y]=o[y]);o=h,g?A3(g,m)(...h):f(null,...h)}}function i(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return t.push(o),l}}function A3(t,l){let a;return i;function i(...f){const m=t.length>f.length;let p;m&&f.push(o);try{p=t.apply(this,f)}catch(h){const g=h;if(m&&a)throw g;return o(g)}m||(p&&p.then&&typeof p.then=="function"?p.then(u,o):p instanceof Error?o(p):u(p))}function o(f,...m){a||(a=!0,l(f,...m))}function u(f){o(null,f)}}const kl={basename:D3,dirname:T3,extname:z3,join:M3,sep:"/"};function D3(t,l){if(l!==void 0&&typeof l!="string")throw new TypeError('"ext" argument must be a string');Cs(t);let a=0,i=-1,o=t.length,u;if(l===void 0||l.length===0||l.length>t.length){for(;o--;)if(t.codePointAt(o)===47){if(u){a=o+1;break}}else i<0&&(u=!0,i=o+1);return i<0?"":t.slice(a,i)}if(l===t)return"";let f=-1,m=l.length-1;for(;o--;)if(t.codePointAt(o)===47){if(u){a=o+1;break}}else f<0&&(u=!0,f=o+1),m>-1&&(t.codePointAt(o)===l.codePointAt(m--)?m<0&&(i=o):(m=-1,i=f));return a===i?i=f:i<0&&(i=t.length),t.slice(a,i)}function T3(t){if(Cs(t),t.length===0)return".";let l=-1,a=t.length,i;for(;--a;)if(t.codePointAt(a)===47){if(i){l=a;break}}else i||(i=!0);return l<0?t.codePointAt(0)===47?"/":".":l===1&&t.codePointAt(0)===47?"//":t.slice(0,l)}function z3(t){Cs(t);let l=t.length,a=-1,i=0,o=-1,u=0,f;for(;l--;){const m=t.codePointAt(l);if(m===47){if(f){i=l+1;break}continue}a<0&&(f=!0,a=l+1),m===46?o<0?o=l:u!==1&&(u=1):o>-1&&(u=-1)}return o<0||a<0||u===0||u===1&&o===a-1&&o===i+1?"":t.slice(o,a)}function M3(...t){let l=-1,a;for(;++l<t.length;)Cs(t[l]),t[l]&&(a=a===void 0?t[l]:a+"/"+t[l]);return a===void 0?".":_3(a)}function _3(t){Cs(t);const l=t.codePointAt(0)===47;let a=F3(t,!l);return a.length===0&&!l&&(a="."),a.length>0&&t.codePointAt(t.length-1)===47&&(a+="/"),l?"/"+a:a}function F3(t,l){let a="",i=0,o=-1,u=0,f=-1,m,p;for(;++f<=t.length;){if(f<t.length)m=t.codePointAt(f);else{if(m===47)break;m=47}if(m===47){if(!(o===f-1||u===1))if(o!==f-1&&u===2){if(a.length<2||i!==2||a.codePointAt(a.length-1)!==46||a.codePointAt(a.length-2)!==46){if(a.length>2){if(p=a.lastIndexOf("/"),p!==a.length-1){p<0?(a="",i=0):(a=a.slice(0,p),i=a.length-1-a.lastIndexOf("/")),o=f,u=0;continue}}else if(a.length>0){a="",i=0,o=f,u=0;continue}}l&&(a=a.length>0?a+"/..":"..",i=2)}else a.length>0?a+="/"+t.slice(o+1,f):a=t.slice(o+1,f),i=f-o-1;o=f,u=0}else m===46&&u>-1?u++:u=-1}return a}function Cs(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const R3={cwd:O3};function O3(){return"/"}function Rd(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function B3(t){if(typeof t=="string")t=new URL(t);else if(!Rd(t)){const l=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw l.code="ERR_INVALID_ARG_TYPE",l}if(t.protocol!=="file:"){const l=new TypeError("The URL must be of scheme file");throw l.code="ERR_INVALID_URL_SCHEME",l}return $3(t)}function $3(t){if(t.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const l=t.pathname;let a=-1;for(;++a<l.length;)if(l.codePointAt(a)===37&&l.codePointAt(a+1)===50){const i=l.codePointAt(a+2);if(i===70||i===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(l)}const Zf=["history","path","basename","stem","extname","dirname"];class x0{constructor(l){let a;l?Rd(l)?a={path:l}:typeof l=="string"||L3(l)?a={value:l}:a=l:a={},this.cwd="cwd"in a?"":R3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Zf.length;){const u=Zf[i];u in a&&a[u]!==void 0&&a[u]!==null&&(this[u]=u==="history"?[...a[u]]:a[u])}let o;for(o in a)Zf.includes(o)||(this[o]=a[o])}get basename(){return typeof this.path=="string"?kl.basename(this.path):void 0}set basename(l){Jf(l,"basename"),Wf(l,"basename"),this.path=kl.join(this.dirname||"",l)}get dirname(){return typeof this.path=="string"?kl.dirname(this.path):void 0}set dirname(l){$1(this.basename,"dirname"),this.path=kl.join(l||"",this.basename)}get extname(){return typeof this.path=="string"?kl.extname(this.path):void 0}set extname(l){if(Wf(l,"extname"),$1(this.dirname,"extname"),l){if(l.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(l.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=kl.join(this.dirname,this.stem+(l||""))}get path(){return this.history[this.history.length-1]}set path(l){Rd(l)&&(l=B3(l)),Jf(l,"path"),this.path!==l&&this.history.push(l)}get stem(){return typeof this.path=="string"?kl.basename(this.path,this.extname):void 0}set stem(l){Jf(l,"stem"),Wf(l,"stem"),this.path=kl.join(this.dirname||"",l+(this.extname||""))}fail(l,a,i){const o=this.message(l,a,i);throw o.fatal=!0,o}info(l,a,i){const o=this.message(l,a,i);return o.fatal=void 0,o}message(l,a,i){const o=new pn(l,a,i);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(l){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(l||void 0).decode(this.value)}}function Wf(t,l){if(t&&t.includes(kl.sep))throw new Error("`"+l+"` cannot be a path: did not expect `"+kl.sep+"`")}function Jf(t,l){if(!t)throw new Error("`"+l+"` cannot be empty")}function $1(t,l){if(!t)throw new Error("Setting `"+l+"` requires `path` to be set too")}function L3(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const H3=(function(t){const i=this.constructor.prototype,o=i[t],u=function(){return o.apply(u,arguments)};return Object.setPrototypeOf(u,i),u}),U3={}.hasOwnProperty;class rh extends H3{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=N3()}copy(){const l=new rh;let a=-1;for(;++a<this.attachers.length;){const i=this.attachers[a];l.use(...i)}return l.data(Qf(!0,{},this.namespace)),l}data(l,a){return typeof l=="string"?arguments.length===2?(td("data",this.frozen),this.namespace[l]=a,this):U3.call(this.namespace,l)&&this.namespace[l]||void 0:l?(td("data",this.frozen),this.namespace=l,this):this.namespace}freeze(){if(this.frozen)return this;const l=this;for(;++this.freezeIndex<this.attachers.length;){const[a,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const o=a.call(l,...i);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(l){this.freeze();const a=Ko(l),i=this.parser||this.Parser;return Pf("parse",i),i(String(a),a)}process(l,a){const i=this;return this.freeze(),Pf("process",this.parser||this.Parser),ed("process",this.compiler||this.Compiler),a?o(void 0,a):new Promise(o);function o(u,f){const m=Ko(l),p=i.parse(m);i.run(p,m,function(g,y,b){if(g||!y||!b)return h(g);const v=y,S=i.stringify(v,b);q3(S)?b.value=S:b.result=S,h(g,b)});function h(g,y){g||!y?f(g):u?u(y):a(void 0,y)}}}processSync(l){let a=!1,i;return this.freeze(),Pf("processSync",this.parser||this.Parser),ed("processSync",this.compiler||this.Compiler),this.process(l,o),H1("processSync","process",a),i;function o(u,f){a=!0,O1(u),i=f}}run(l,a,i){L1(l),this.freeze();const o=this.transformers;return!i&&typeof a=="function"&&(i=a,a=void 0),i?u(void 0,i):new Promise(u);function u(f,m){const p=Ko(a);o.run(l,p,h);function h(g,y,b){const v=y||l;g?m(g):f?f(v):i(void 0,v,b)}}}runSync(l,a){let i=!1,o;return this.run(l,a,u),H1("runSync","run",i),o;function u(f,m){O1(f),o=m,i=!0}}stringify(l,a){this.freeze();const i=Ko(a),o=this.compiler||this.Compiler;return ed("stringify",o),L1(l),o(l,i)}use(l,...a){const i=this.attachers,o=this.namespace;if(td("use",this.frozen),l!=null)if(typeof l=="function")p(l,a);else if(typeof l=="object")Array.isArray(l)?m(l):f(l);else throw new TypeError("Expected usable value, not `"+l+"`");return this;function u(h){if(typeof h=="function")p(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,...y]=h;p(g,y)}else f(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function f(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");m(h.plugins),h.settings&&(o.settings=Qf(!0,o.settings,h.settings))}function m(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const y=h[g];u(y)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function p(h,g){let y=-1,b=-1;for(;++y<i.length;)if(i[y][0]===h){b=y;break}if(b===-1)i.push([h,...g]);else if(g.length>0){let[v,...S]=g;const k=i[b][1];Fd(k)&&Fd(v)&&(v=Qf(!0,k,v)),i[b]=[h,v,...S]}}}}const I3=new rh().freeze();function Pf(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function ed(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function td(t,l){if(l)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function L1(t){if(!Fd(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function H1(t,l,a){if(!a)throw new Error("`"+t+"` finished async. Use `"+l+"` instead")}function Ko(t){return Y3(t)?t:new x0(t)}function Y3(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function q3(t){return typeof t=="string"||X3(t)}function X3(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const V3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",U1=[],I1={allowDangerousHtml:!0},G3=/^(https?|ircs?|mailto|xmpp)$/i,K3=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function p0(t){const l=Q3(t),a=Z3(t);return W3(l.runSync(l.parse(a),a),t)}function Q3(t){const l=t.rehypePlugins||U1,a=t.remarkPlugins||U1,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...I1}:I1;return I3().use(T5).use(a).use(j3,i).use(l)}function Z3(t){const l=t.children||"",a=new x0;return typeof l=="string"&&(a.value=l),a}function W3(t,l){const a=l.allowedElements,i=l.allowElement,o=l.components,u=l.disallowedElements,f=l.skipHtml,m=l.unwrapDisallowed,p=l.urlTransform||J3;for(const g of K3)Object.hasOwn(l,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+V3+g.id,void 0);return ah(t,h),hv(t,{Fragment:c.Fragment,components:o,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function h(g,y,b){if(g.type==="raw"&&b&&typeof y=="number")return f?b.children.splice(y,1):b.children[y]={type:"text",value:g.value},y;if(g.type==="element"){let v;for(v in Xf)if(Object.hasOwn(Xf,v)&&Object.hasOwn(g.properties,v)){const S=g.properties[v],k=Xf[v];(k===null||k.includes(g.tagName))&&(g.properties[v]=p(String(S||""),v,g))}}if(g.type==="element"){let v=a?!a.includes(g.tagName):u?u.includes(g.tagName):!1;if(!v&&i&&typeof y=="number"&&(v=!i(g,y,b)),v&&b&&typeof y=="number")return m&&g.children?b.children.splice(y,1,...g.children):b.children.splice(y,1),y}}}function J3(t){const l=t.indexOf(":"),a=t.indexOf("?"),i=t.indexOf("#"),o=t.indexOf("/");return l===-1||o!==-1&&l>o||a!==-1&&l>a||i!==-1&&l>i||G3.test(t.slice(0,l))?t:""}function Y1(t,l){const a=String(t);if(typeof l!="string")throw new TypeError("Expected character");let i=0,o=a.indexOf(l);for(;o!==-1;)i++,o=a.indexOf(l,o+l.length);return i}function P3(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function ek(t,l,a){const o=Sc((a||{}).ignore||[]),u=tk(l);let f=-1;for(;++f<u.length;)m0(t,"text",m);function m(h,g){let y=-1,b;for(;++y<g.length;){const v=g[y],S=b?b.children:void 0;if(o(v,S?S.indexOf(v):void 0,b))return;b=v}if(b)return p(h,g)}function p(h,g){const y=g[g.length-1],b=u[f][0],v=u[f][1];let S=0;const C=y.children.indexOf(h);let E=!1,M=[];b.lastIndex=0;let $=b.exec(h.value);for(;$;){const O=$.index,B={index:$.index,input:$.input,stack:[...g,h]};let T=v(...$,B);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?b.lastIndex=O+1:(S!==O&&M.push({type:"text",value:h.value.slice(S,O)}),Array.isArray(T)?M.push(...T):T&&M.push(T),S=O+$[0].length,E=!0),!b.global)break;$=b.exec(h.value)}return E?(S<h.value.length&&M.push({type:"text",value:h.value.slice(S)}),y.children.splice(C,1,...M)):M=[h],C+M.length}}function tk(t){const l=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const a=!t[0]||Array.isArray(t[0])?t:[t];let i=-1;for(;++i<a.length;){const o=a[i];l.push([nk(o[0]),lk(o[1])])}return l}function nk(t){return typeof t=="string"?new RegExp(P3(t),"g"):t}function lk(t){return typeof t=="function"?t:function(){return t}}const nd="phrasing",ld=["autolink","link","image","label"];function ak(){return{transforms:[fk],enter:{literalAutolink:ik,literalAutolinkEmail:ad,literalAutolinkHttp:ad,literalAutolinkWww:ad},exit:{literalAutolink:uk,literalAutolinkEmail:ck,literalAutolinkHttp:sk,literalAutolinkWww:ok}}}function rk(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:nd,notInConstruct:ld},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:nd,notInConstruct:ld},{character:":",before:"[ps]",after:"\\/",inConstruct:nd,notInConstruct:ld}]}}function ik(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function ad(t){this.config.enter.autolinkProtocol.call(this,t)}function sk(t){this.config.exit.autolinkProtocol.call(this,t)}function ok(t){this.config.exit.data.call(this,t);const l=this.stack[this.stack.length-1];l.type,l.url="http://"+this.sliceSerialize(t)}function ck(t){this.config.exit.autolinkEmail.call(this,t)}function uk(t){this.exit(t)}function fk(t){ek(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,dk],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),hk]],{ignore:["link","linkReference"]})}function dk(t,l,a,i,o){let u="";if(!y0(o)||(/^w/i.test(l)&&(a=l+a,l="",u="http://"),!mk(a)))return!1;const f=xk(a+i);if(!f[0])return!1;const m={type:"link",title:null,url:u+l+f[0],children:[{type:"text",value:l+f[0]}]};return f[1]?[m,{type:"text",value:f[1]}]:m}function hk(t,l,a,i){return!y0(i,!0)||/[-\d_]$/.test(a)?!1:{type:"link",title:null,url:"mailto:"+l+"@"+a,children:[{type:"text",value:l+"@"+a}]}}function mk(t){const l=t.split(".");return!(l.length<2||l[l.length-1]&&(/_/.test(l[l.length-1])||!/[a-zA-Z\d]/.test(l[l.length-1]))||l[l.length-2]&&(/_/.test(l[l.length-2])||!/[a-zA-Z\d]/.test(l[l.length-2])))}function xk(t){const l=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!l)return[t,void 0];t=t.slice(0,l.index);let a=l[0],i=a.indexOf(")");const o=Y1(t,"(");let u=Y1(t,")");for(;i!==-1&&o>u;)t+=a.slice(0,i+1),a=a.slice(i+1),i=a.indexOf(")"),u++;return[t,a]}function y0(t,l){const a=t.input.charCodeAt(t.index-1);return(t.index===0||ir(a)||vc(a))&&(!l||a!==47)}g0.peek=jk;function pk(){this.buffer()}function yk(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function gk(){this.buffer()}function bk(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function vk(t){const l=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=dl(this.sliceSerialize(t)).toLowerCase(),a.label=l}function wk(t){this.exit(t)}function kk(t){const l=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=dl(this.sliceSerialize(t)).toLowerCase(),a.label=l}function Sk(t){this.exit(t)}function jk(){return"["}function g0(t,l,a,i){const o=a.createTracker(i);let u=o.move("[^");const f=a.enter("footnoteReference"),m=a.enter("reference");return u+=o.move(a.safe(a.associationId(t),{after:"]",before:u})),m(),f(),u+=o.move("]"),u}function Ek(){return{enter:{gfmFootnoteCallString:pk,gfmFootnoteCall:yk,gfmFootnoteDefinitionLabelString:gk,gfmFootnoteDefinition:bk},exit:{gfmFootnoteCallString:vk,gfmFootnoteCall:wk,gfmFootnoteDefinitionLabelString:kk,gfmFootnoteDefinition:Sk}}}function Ck(t){let l=!1;return t&&t.firstLineBlank&&(l=!0),{handlers:{footnoteDefinition:a,footnoteReference:g0},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function a(i,o,u,f){const m=u.createTracker(f);let p=m.move("[^");const h=u.enter("footnoteDefinition"),g=u.enter("label");return p+=m.move(u.safe(u.associationId(i),{before:p,after:"]"})),g(),p+=m.move("]:"),i.children&&i.children.length>0&&(m.shift(4),p+=m.move((l?`
|
|
64
|
-
`:" ")+u.indentLines(u.containerFlow(i,m.current()),l?b0:Nk))),h(),p}}function Nk(t,l,a){return l===0?t:b0(t,l,a)}function b0(t,l,a){return(a?"":" ")+t}const Ak=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];v0.peek=_k;function Dk(){return{canContainEols:["delete"],enter:{strikethrough:zk},exit:{strikethrough:Mk}}}function Tk(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Ak}],handlers:{delete:v0}}}function zk(t){this.enter({type:"delete",children:[]},t)}function Mk(t){this.exit(t)}function v0(t,l,a,i){const o=a.createTracker(i),u=a.enter("strikethrough");let f=o.move("~~");return f+=a.containerPhrasing(t,{...o.current(),before:f,after:"~"}),f+=o.move("~~"),u(),f}function _k(){return"~"}function Fk(t){return t.length}function Rk(t,l){const a=l||{},i=(a.align||[]).concat(),o=a.stringLength||Fk,u=[],f=[],m=[],p=[];let h=0,g=-1;for(;++g<t.length;){const k=[],C=[];let E=-1;for(t[g].length>h&&(h=t[g].length);++E<t[g].length;){const M=Ok(t[g][E]);if(a.alignDelimiters!==!1){const $=o(M);C[E]=$,(p[E]===void 0||$>p[E])&&(p[E]=$)}k.push(M)}f[g]=k,m[g]=C}let y=-1;if(typeof i=="object"&&"length"in i)for(;++y<h;)u[y]=q1(i[y]);else{const k=q1(i);for(;++y<h;)u[y]=k}y=-1;const b=[],v=[];for(;++y<h;){const k=u[y];let C="",E="";k===99?(C=":",E=":"):k===108?C=":":k===114&&(E=":");let M=a.alignDelimiters===!1?1:Math.max(1,p[y]-C.length-E.length);const $=C+"-".repeat(M)+E;a.alignDelimiters!==!1&&(M=C.length+M+E.length,M>p[y]&&(p[y]=M),v[y]=M),b[y]=$}f.splice(1,0,b),m.splice(1,0,v),g=-1;const S=[];for(;++g<f.length;){const k=f[g],C=m[g];y=-1;const E=[];for(;++y<h;){const M=k[y]||"";let $="",O="";if(a.alignDelimiters!==!1){const B=p[y]-(C[y]||0),T=u[y];T===114?$=" ".repeat(B):T===99?B%2?($=" ".repeat(B/2+.5),O=" ".repeat(B/2-.5)):($=" ".repeat(B/2),O=$):O=" ".repeat(B)}a.delimiterStart!==!1&&!y&&E.push("|"),a.padding!==!1&&!(a.alignDelimiters===!1&&M==="")&&(a.delimiterStart!==!1||y)&&E.push(" "),a.alignDelimiters!==!1&&E.push($),E.push(M),a.alignDelimiters!==!1&&E.push(O),a.padding!==!1&&E.push(" "),(a.delimiterEnd!==!1||y!==h-1)&&E.push("|")}S.push(a.delimiterEnd===!1?E.join("").replace(/ +$/,""):E.join(""))}return S.join(`
|
|
65
|
-
`)}function Ok(t){return t==null?"":String(t)}function q1(t){const l=typeof t=="string"?t.codePointAt(0):0;return l===67||l===99?99:l===76||l===108?108:l===82||l===114?114:0}function Bk(t,l,a,i){const o=a.enter("blockquote"),u=a.createTracker(i);u.move("> "),u.shift(2);const f=a.indentLines(a.containerFlow(t,u.current()),$k);return o(),f}function $k(t,l,a){return">"+(a?"":" ")+t}function Lk(t,l){return X1(t,l.inConstruct,!0)&&!X1(t,l.notInConstruct,!1)}function X1(t,l,a){if(typeof l=="string"&&(l=[l]),!l||l.length===0)return a;let i=-1;for(;++i<l.length;)if(t.includes(l[i]))return!0;return!1}function V1(t,l,a,i){let o=-1;for(;++o<a.unsafe.length;)if(a.unsafe[o].character===`
|
|
66
|
-
`&&Lk(a.stack,a.unsafe[o]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
67
|
-
`}function Hk(t,l){const a=String(t);let i=a.indexOf(l),o=i,u=0,f=0;if(typeof l!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===o?++u>f&&(f=u):u=1,o=i+l.length,i=a.indexOf(l,o);return f}function Uk(t,l){return!!(l.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function Ik(t){const l=t.options.fence||"`";if(l!=="`"&&l!=="~")throw new Error("Cannot serialize code with `"+l+"` for `options.fence`, expected `` ` `` or `~`");return l}function Yk(t,l,a,i){const o=Ik(a),u=t.value||"",f=o==="`"?"GraveAccent":"Tilde";if(Uk(t,a)){const y=a.enter("codeIndented"),b=a.indentLines(u,qk);return y(),b}const m=a.createTracker(i),p=o.repeat(Math.max(Hk(u,o)+1,3)),h=a.enter("codeFenced");let g=m.move(p);if(t.lang){const y=a.enter(`codeFencedLang${f}`);g+=m.move(a.safe(t.lang,{before:g,after:" ",encode:["`"],...m.current()})),y()}if(t.lang&&t.meta){const y=a.enter(`codeFencedMeta${f}`);g+=m.move(" "),g+=m.move(a.safe(t.meta,{before:g,after:`
|
|
68
|
-
`,encode:["`"],...m.current()})),y()}return g+=m.move(`
|
|
69
|
-
`),u&&(g+=m.move(u+`
|
|
70
|
-
`)),g+=m.move(p),h(),g}function qk(t,l,a){return(a?"":" ")+t}function ih(t){const l=t.options.quote||'"';if(l!=='"'&&l!=="'")throw new Error("Cannot serialize title with `"+l+"` for `options.quote`, expected `\"`, or `'`");return l}function Xk(t,l,a,i){const o=ih(a),u=o==='"'?"Quote":"Apostrophe",f=a.enter("definition");let m=a.enter("label");const p=a.createTracker(i);let h=p.move("[");return h+=p.move(a.safe(a.associationId(t),{before:h,after:"]",...p.current()})),h+=p.move("]: "),m(),!t.url||/[\0- \u007F]/.test(t.url)?(m=a.enter("destinationLiteral"),h+=p.move("<"),h+=p.move(a.safe(t.url,{before:h,after:">",...p.current()})),h+=p.move(">")):(m=a.enter("destinationRaw"),h+=p.move(a.safe(t.url,{before:h,after:t.title?" ":`
|
|
71
|
-
`,...p.current()}))),m(),t.title&&(m=a.enter(`title${u}`),h+=p.move(" "+o),h+=p.move(a.safe(t.title,{before:h,after:o,...p.current()})),h+=p.move(o),m()),f(),h}function Vk(t){const l=t.options.emphasis||"*";if(l!=="*"&&l!=="_")throw new Error("Cannot serialize emphasis with `"+l+"` for `options.emphasis`, expected `*`, or `_`");return l}function bs(t){return"&#x"+t.toString(16).toUpperCase()+";"}function hc(t,l,a){const i=Jr(t),o=Jr(l);return i===void 0?o===void 0?a==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}w0.peek=Gk;function w0(t,l,a,i){const o=Vk(a),u=a.enter("emphasis"),f=a.createTracker(i),m=f.move(o);let p=f.move(a.containerPhrasing(t,{after:o,before:m,...f.current()}));const h=p.charCodeAt(0),g=hc(i.before.charCodeAt(i.before.length-1),h,o);g.inside&&(p=bs(h)+p.slice(1));const y=p.charCodeAt(p.length-1),b=hc(i.after.charCodeAt(0),y,o);b.inside&&(p=p.slice(0,-1)+bs(y));const v=f.move(o);return u(),a.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},m+p+v}function Gk(t,l,a){return a.options.emphasis||"*"}function Kk(t,l){let a=!1;return ah(t,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return a=!0,Md}),!!((!t.depth||t.depth<3)&&Wd(t)&&(l.options.setext||a))}function Qk(t,l,a,i){const o=Math.max(Math.min(6,t.depth||1),1),u=a.createTracker(i);if(Kk(t,a)){const g=a.enter("headingSetext"),y=a.enter("phrasing"),b=a.containerPhrasing(t,{...u.current(),before:`
|
|
72
|
-
`,after:`
|
|
73
|
-
`});return y(),g(),b+`
|
|
74
|
-
`+(o===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
75
|
-
`))+1))}const f="#".repeat(o),m=a.enter("headingAtx"),p=a.enter("phrasing");u.move(f+" ");let h=a.containerPhrasing(t,{before:"# ",after:`
|
|
76
|
-
`,...u.current()});return/^[\t ]/.test(h)&&(h=bs(h.charCodeAt(0))+h.slice(1)),h=h?f+" "+h:f,a.options.closeAtx&&(h+=" "+f),p(),m(),h}k0.peek=Zk;function k0(t){return t.value||""}function Zk(){return"<"}S0.peek=Wk;function S0(t,l,a,i){const o=ih(a),u=o==='"'?"Quote":"Apostrophe",f=a.enter("image");let m=a.enter("label");const p=a.createTracker(i);let h=p.move("![");return h+=p.move(a.safe(t.alt,{before:h,after:"]",...p.current()})),h+=p.move("]("),m(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(m=a.enter("destinationLiteral"),h+=p.move("<"),h+=p.move(a.safe(t.url,{before:h,after:">",...p.current()})),h+=p.move(">")):(m=a.enter("destinationRaw"),h+=p.move(a.safe(t.url,{before:h,after:t.title?" ":")",...p.current()}))),m(),t.title&&(m=a.enter(`title${u}`),h+=p.move(" "+o),h+=p.move(a.safe(t.title,{before:h,after:o,...p.current()})),h+=p.move(o),m()),h+=p.move(")"),f(),h}function Wk(){return"!"}j0.peek=Jk;function j0(t,l,a,i){const o=t.referenceType,u=a.enter("imageReference");let f=a.enter("label");const m=a.createTracker(i);let p=m.move("![");const h=a.safe(t.alt,{before:p,after:"]",...m.current()});p+=m.move(h+"]["),f();const g=a.stack;a.stack=[],f=a.enter("reference");const y=a.safe(a.associationId(t),{before:p,after:"]",...m.current()});return f(),a.stack=g,u(),o==="full"||!h||h!==y?p+=m.move(y+"]"):o==="shortcut"?p=p.slice(0,-1):p+=m.move("]"),p}function Jk(){return"!"}E0.peek=Pk;function E0(t,l,a){let i=t.value||"",o="`",u=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(i);)o+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++u<a.unsafe.length;){const f=a.unsafe[u],m=a.compilePattern(f);let p;if(f.atBreak)for(;p=m.exec(i);){let h=p.index;i.charCodeAt(h)===10&&i.charCodeAt(h-1)===13&&h--,i=i.slice(0,h)+" "+i.slice(p.index+1)}}return o+i+o}function Pk(){return"`"}function C0(t,l){const a=Wd(t);return!!(!l.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(a===t.url||"mailto:"+a===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}N0.peek=e4;function N0(t,l,a,i){const o=ih(a),u=o==='"'?"Quote":"Apostrophe",f=a.createTracker(i);let m,p;if(C0(t,a)){const g=a.stack;a.stack=[],m=a.enter("autolink");let y=f.move("<");return y+=f.move(a.containerPhrasing(t,{before:y,after:">",...f.current()})),y+=f.move(">"),m(),a.stack=g,y}m=a.enter("link"),p=a.enter("label");let h=f.move("[");return h+=f.move(a.containerPhrasing(t,{before:h,after:"](",...f.current()})),h+=f.move("]("),p(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(p=a.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(a.safe(t.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(p=a.enter("destinationRaw"),h+=f.move(a.safe(t.url,{before:h,after:t.title?" ":")",...f.current()}))),p(),t.title&&(p=a.enter(`title${u}`),h+=f.move(" "+o),h+=f.move(a.safe(t.title,{before:h,after:o,...f.current()})),h+=f.move(o),p()),h+=f.move(")"),m(),h}function e4(t,l,a){return C0(t,a)?"<":"["}A0.peek=t4;function A0(t,l,a,i){const o=t.referenceType,u=a.enter("linkReference");let f=a.enter("label");const m=a.createTracker(i);let p=m.move("[");const h=a.containerPhrasing(t,{before:p,after:"]",...m.current()});p+=m.move(h+"]["),f();const g=a.stack;a.stack=[],f=a.enter("reference");const y=a.safe(a.associationId(t),{before:p,after:"]",...m.current()});return f(),a.stack=g,u(),o==="full"||!h||h!==y?p+=m.move(y+"]"):o==="shortcut"?p=p.slice(0,-1):p+=m.move("]"),p}function t4(){return"["}function sh(t){const l=t.options.bullet||"*";if(l!=="*"&&l!=="+"&&l!=="-")throw new Error("Cannot serialize items with `"+l+"` for `options.bullet`, expected `*`, `+`, or `-`");return l}function n4(t){const l=sh(t),a=t.options.bulletOther;if(!a)return l==="*"?"-":"*";if(a!=="*"&&a!=="+"&&a!=="-")throw new Error("Cannot serialize items with `"+a+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(a===l)throw new Error("Expected `bullet` (`"+l+"`) and `bulletOther` (`"+a+"`) to be different");return a}function l4(t){const l=t.options.bulletOrdered||".";if(l!=="."&&l!==")")throw new Error("Cannot serialize items with `"+l+"` for `options.bulletOrdered`, expected `.` or `)`");return l}function D0(t){const l=t.options.rule||"*";if(l!=="*"&&l!=="-"&&l!=="_")throw new Error("Cannot serialize rules with `"+l+"` for `options.rule`, expected `*`, `-`, or `_`");return l}function a4(t,l,a,i){const o=a.enter("list"),u=a.bulletCurrent;let f=t.ordered?l4(a):sh(a);const m=t.ordered?f==="."?")":".":n4(a);let p=l&&a.bulletLastUsed?f===a.bulletLastUsed:!1;if(!t.ordered){const g=t.children?t.children[0]:void 0;if((f==="*"||f==="-")&&g&&(!g.children||!g.children[0])&&a.stack[a.stack.length-1]==="list"&&a.stack[a.stack.length-2]==="listItem"&&a.stack[a.stack.length-3]==="list"&&a.stack[a.stack.length-4]==="listItem"&&a.indexStack[a.indexStack.length-1]===0&&a.indexStack[a.indexStack.length-2]===0&&a.indexStack[a.indexStack.length-3]===0&&(p=!0),D0(a)===f&&g){let y=-1;for(;++y<t.children.length;){const b=t.children[y];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){p=!0;break}}}}p&&(f=m),a.bulletCurrent=f;const h=a.containerFlow(t,i);return a.bulletLastUsed=f,a.bulletCurrent=u,o(),h}function r4(t){const l=t.options.listItemIndent||"one";if(l!=="tab"&&l!=="one"&&l!=="mixed")throw new Error("Cannot serialize items with `"+l+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return l}function i4(t,l,a,i){const o=r4(a);let u=a.bulletCurrent||sh(a);l&&l.type==="list"&&l.ordered&&(u=(typeof l.start=="number"&&l.start>-1?l.start:1)+(a.options.incrementListMarker===!1?0:l.children.indexOf(t))+u);let f=u.length+1;(o==="tab"||o==="mixed"&&(l&&l.type==="list"&&l.spread||t.spread))&&(f=Math.ceil(f/4)*4);const m=a.createTracker(i);m.move(u+" ".repeat(f-u.length)),m.shift(f);const p=a.enter("listItem"),h=a.indentLines(a.containerFlow(t,m.current()),g);return p(),h;function g(y,b,v){return b?(v?"":" ".repeat(f))+y:(v?u:u+" ".repeat(f-u.length))+y}}function s4(t,l,a,i){const o=a.enter("paragraph"),u=a.enter("phrasing"),f=a.containerPhrasing(t,i);return u(),o(),f}const o4=Sc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function c4(t,l,a,i){return(t.children.some(function(f){return o4(f)})?a.containerPhrasing:a.containerFlow).call(a,t,i)}function u4(t){const l=t.options.strong||"*";if(l!=="*"&&l!=="_")throw new Error("Cannot serialize strong with `"+l+"` for `options.strong`, expected `*`, or `_`");return l}T0.peek=f4;function T0(t,l,a,i){const o=u4(a),u=a.enter("strong"),f=a.createTracker(i),m=f.move(o+o);let p=f.move(a.containerPhrasing(t,{after:o,before:m,...f.current()}));const h=p.charCodeAt(0),g=hc(i.before.charCodeAt(i.before.length-1),h,o);g.inside&&(p=bs(h)+p.slice(1));const y=p.charCodeAt(p.length-1),b=hc(i.after.charCodeAt(0),y,o);b.inside&&(p=p.slice(0,-1)+bs(y));const v=f.move(o+o);return u(),a.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},m+p+v}function f4(t,l,a){return a.options.strong||"*"}function d4(t,l,a,i){return a.safe(t.value,i)}function h4(t){const l=t.options.ruleRepetition||3;if(l<3)throw new Error("Cannot serialize rules with repetition `"+l+"` for `options.ruleRepetition`, expected `3` or more");return l}function m4(t,l,a){const i=(D0(a)+(a.options.ruleSpaces?" ":"")).repeat(h4(a));return a.options.ruleSpaces?i.slice(0,-1):i}const z0={blockquote:Bk,break:V1,code:Yk,definition:Xk,emphasis:w0,hardBreak:V1,heading:Qk,html:k0,image:S0,imageReference:j0,inlineCode:E0,link:N0,linkReference:A0,list:a4,listItem:i4,paragraph:s4,root:c4,strong:T0,text:d4,thematicBreak:m4};function x4(){return{enter:{table:p4,tableData:G1,tableHeader:G1,tableRow:g4},exit:{codeText:b4,table:y4,tableData:rd,tableHeader:rd,tableRow:rd}}}function p4(t){const l=t._align;this.enter({type:"table",align:l.map(function(a){return a==="none"?null:a}),children:[]},t),this.data.inTable=!0}function y4(t){this.exit(t),this.data.inTable=void 0}function g4(t){this.enter({type:"tableRow",children:[]},t)}function rd(t){this.exit(t)}function G1(t){this.enter({type:"tableCell",children:[]},t)}function b4(t){let l=this.resume();this.data.inTable&&(l=l.replace(/\\([\\|])/g,v4));const a=this.stack[this.stack.length-1];a.type,a.value=l,this.exit(t)}function v4(t,l){return l==="|"?l:t}function w4(t){const l=t||{},a=l.tableCellPadding,i=l.tablePipeAlign,o=l.stringLength,u=a?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
77
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:f,tableCell:p,tableRow:m}};function f(v,S,k,C){return h(g(v,k,C),v.align)}function m(v,S,k,C){const E=y(v,k,C),M=h([E]);return M.slice(0,M.indexOf(`
|
|
78
|
-
`))}function p(v,S,k,C){const E=k.enter("tableCell"),M=k.enter("phrasing"),$=k.containerPhrasing(v,{...C,before:u,after:u});return M(),E(),$}function h(v,S){return Rk(v,{align:S,alignDelimiters:i,padding:a,stringLength:o})}function g(v,S,k){const C=v.children;let E=-1;const M=[],$=S.enter("table");for(;++E<C.length;)M[E]=y(C[E],S,k);return $(),M}function y(v,S,k){const C=v.children;let E=-1;const M=[],$=S.enter("tableRow");for(;++E<C.length;)M[E]=p(C[E],v,S,k);return $(),M}function b(v,S,k){let C=z0.inlineCode(v,S,k);return k.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function k4(){return{exit:{taskListCheckValueChecked:K1,taskListCheckValueUnchecked:K1,paragraph:j4}}}function S4(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:E4}}}function K1(t){const l=this.stack[this.stack.length-2];l.type,l.checked=t.type==="taskListCheckValueChecked"}function j4(t){const l=this.stack[this.stack.length-2];if(l&&l.type==="listItem"&&typeof l.checked=="boolean"){const a=this.stack[this.stack.length-1];a.type;const i=a.children[0];if(i&&i.type==="text"){const o=l.children;let u=-1,f;for(;++u<o.length;){const m=o[u];if(m.type==="paragraph"){f=m;break}}f===a&&(i.value=i.value.slice(1),i.value.length===0?a.children.shift():a.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,a.position.start=Object.assign({},i.position.start)))}}this.exit(t)}function E4(t,l,a,i){const o=t.children[0],u=typeof t.checked=="boolean"&&o&&o.type==="paragraph",f="["+(t.checked?"x":" ")+"] ",m=a.createTracker(i);u&&m.move(f);let p=z0.listItem(t,l,a,{...i,...m.current()});return u&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),p;function h(g){return g+f}}function C4(){return[ak(),Ek(),Dk(),x4(),k4()]}function N4(t){return{extensions:[rk(),Ck(t),Tk(),w4(t),S4()]}}const A4={tokenize:F4,partial:!0},M0={tokenize:R4,partial:!0},_0={tokenize:O4,partial:!0},F0={tokenize:B4,partial:!0},D4={tokenize:$4,partial:!0},R0={name:"wwwAutolink",tokenize:M4,previous:B0},O0={name:"protocolAutolink",tokenize:_4,previous:$0},Wl={name:"emailAutolink",tokenize:z4,previous:L0},Cl={};function T4(){return{text:Cl}}let Pa=48;for(;Pa<123;)Cl[Pa]=Wl,Pa++,Pa===58?Pa=65:Pa===91&&(Pa=97);Cl[43]=Wl;Cl[45]=Wl;Cl[46]=Wl;Cl[95]=Wl;Cl[72]=[Wl,O0];Cl[104]=[Wl,O0];Cl[87]=[Wl,R0];Cl[119]=[Wl,R0];function z4(t,l,a){const i=this;let o,u;return f;function f(y){return!Od(y)||!L0.call(i,i.previous)||oh(i.events)?a(y):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),m(y))}function m(y){return Od(y)?(t.consume(y),m):y===64?(t.consume(y),p):a(y)}function p(y){return y===46?t.check(D4,g,h)(y):y===45||y===95||xn(y)?(u=!0,t.consume(y),p):g(y)}function h(y){return t.consume(y),o=!0,p}function g(y){return u&&o&&bn(i.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),l(y)):a(y)}}function M4(t,l,a){const i=this;return o;function o(f){return f!==87&&f!==119||!B0.call(i,i.previous)||oh(i.events)?a(f):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(A4,t.attempt(M0,t.attempt(_0,u),a),a)(f))}function u(f){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),l(f)}}function _4(t,l,a){const i=this;let o="",u=!1;return f;function f(y){return(y===72||y===104)&&$0.call(i,i.previous)&&!oh(i.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),o+=String.fromCodePoint(y),t.consume(y),m):a(y)}function m(y){if(bn(y)&&o.length<5)return o+=String.fromCodePoint(y),t.consume(y),m;if(y===58){const b=o.toLowerCase();if(b==="http"||b==="https")return t.consume(y),p}return a(y)}function p(y){return y===47?(t.consume(y),u?h:(u=!0,p)):a(y)}function h(y){return y===null||uc(y)||zt(y)||ir(y)||vc(y)?a(y):t.attempt(M0,t.attempt(_0,g),a)(y)}function g(y){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),l(y)}}function F4(t,l,a){let i=0;return o;function o(f){return(f===87||f===119)&&i<3?(i++,t.consume(f),o):f===46&&i===3?(t.consume(f),u):a(f)}function u(f){return f===null?a(f):l(f)}}function R4(t,l,a){let i,o,u;return f;function f(h){return h===46||h===95?t.check(F0,p,m)(h):h===null||zt(h)||ir(h)||h!==45&&vc(h)?p(h):(u=!0,t.consume(h),f)}function m(h){return h===95?i=!0:(o=i,i=void 0),t.consume(h),f}function p(h){return o||i||!u?a(h):l(h)}}function O4(t,l){let a=0,i=0;return o;function o(f){return f===40?(a++,t.consume(f),o):f===41&&i<a?u(f):f===33||f===34||f===38||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===60||f===63||f===93||f===95||f===126?t.check(F0,l,u)(f):f===null||zt(f)||ir(f)?l(f):(t.consume(f),o)}function u(f){return f===41&&i++,t.consume(f),o}}function B4(t,l,a){return i;function i(m){return m===33||m===34||m===39||m===41||m===42||m===44||m===46||m===58||m===59||m===63||m===95||m===126?(t.consume(m),i):m===38?(t.consume(m),u):m===93?(t.consume(m),o):m===60||m===null||zt(m)||ir(m)?l(m):a(m)}function o(m){return m===null||m===40||m===91||zt(m)||ir(m)?l(m):i(m)}function u(m){return bn(m)?f(m):a(m)}function f(m){return m===59?(t.consume(m),i):bn(m)?(t.consume(m),f):a(m)}}function $4(t,l,a){return i;function i(u){return t.consume(u),o}function o(u){return xn(u)?a(u):l(u)}}function B0(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||zt(t)}function $0(t){return!bn(t)}function L0(t){return!(t===47||Od(t))}function Od(t){return t===43||t===45||t===46||t===95||xn(t)}function oh(t){let l=t.length,a=!1;for(;l--;){const i=t[l][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){a=!0;break}if(i._gfmAutolinkLiteralWalkedInto){a=!1;break}}return t.length>0&&!a&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const L4={tokenize:G4,partial:!0};function H4(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:q4,continuation:{tokenize:X4},exit:V4}},text:{91:{name:"gfmFootnoteCall",tokenize:Y4},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:U4,resolveTo:I4}}}}function U4(t,l,a){const i=this;let o=i.events.length;const u=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let f;for(;o--;){const p=i.events[o][1];if(p.type==="labelImage"){f=p;break}if(p.type==="gfmFootnoteCall"||p.type==="labelLink"||p.type==="label"||p.type==="image"||p.type==="link")break}return m;function m(p){if(!f||!f._balanced)return a(p);const h=dl(i.sliceSerialize({start:f.end,end:i.now()}));return h.codePointAt(0)!==94||!u.includes(h.slice(1))?a(p):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),l(p))}}function I4(t,l){let a=t.length;for(;a--;)if(t[a][1].type==="labelImage"&&t[a][0]==="enter"){t[a][1];break}t[a+1][1].type="data",t[a+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},t[a+3][1].start),end:Object.assign({},t[t.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},t[a+3][1].end),end:Object.assign({},t[a+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},t[t.length-1][1].start)},f={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},m=[t[a+1],t[a+2],["enter",i,l],t[a+3],t[a+4],["enter",o,l],["exit",o,l],["enter",u,l],["enter",f,l],["exit",f,l],["exit",u,l],t[t.length-2],t[t.length-1],["exit",i,l]];return t.splice(a,t.length-a+1,...m),t}function Y4(t,l,a){const i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u=0,f;return m;function m(y){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),p}function p(y){return y!==94?a(y):(t.enter("gfmFootnoteCallMarker"),t.consume(y),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(y){if(u>999||y===93&&!f||y===null||y===91||zt(y))return a(y);if(y===93){t.exit("chunkString");const b=t.exit("gfmFootnoteCallString");return o.includes(dl(i.sliceSerialize(b)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),l):a(y)}return zt(y)||(f=!0),u++,t.consume(y),y===92?g:h}function g(y){return y===91||y===92||y===93?(t.consume(y),u++,h):h(y)}}function q4(t,l,a){const i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u,f=0,m;return p;function p(S){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(S),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(S){return S===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(S),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",g):a(S)}function g(S){if(f>999||S===93&&!m||S===null||S===91||zt(S))return a(S);if(S===93){t.exit("chunkString");const k=t.exit("gfmFootnoteDefinitionLabelString");return u=dl(i.sliceSerialize(k)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(S),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),b}return zt(S)||(m=!0),f++,t.consume(S),S===92?y:g}function y(S){return S===91||S===92||S===93?(t.consume(S),f++,g):g(S)}function b(S){return S===58?(t.enter("definitionMarker"),t.consume(S),t.exit("definitionMarker"),o.includes(u)||o.push(u),st(t,v,"gfmFootnoteDefinitionWhitespace")):a(S)}function v(S){return l(S)}}function X4(t,l,a){return t.check(Es,l,t.attempt(L4,l,a))}function V4(t){t.exit("gfmFootnoteDefinition")}function G4(t,l,a){const i=this;return st(t,o,"gfmFootnoteDefinitionIndent",5);function o(u){const f=i.events[i.events.length-1];return f&&f[1].type==="gfmFootnoteDefinitionIndent"&&f[2].sliceSerialize(f[1],!0).length===4?l(u):a(u)}}function K4(t){let a=(t||{}).singleTilde;const i={name:"strikethrough",tokenize:u,resolveAll:o};return a==null&&(a=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function o(f,m){let p=-1;for(;++p<f.length;)if(f[p][0]==="enter"&&f[p][1].type==="strikethroughSequenceTemporary"&&f[p][1]._close){let h=p;for(;h--;)if(f[h][0]==="exit"&&f[h][1].type==="strikethroughSequenceTemporary"&&f[h][1]._open&&f[p][1].end.offset-f[p][1].start.offset===f[h][1].end.offset-f[h][1].start.offset){f[p][1].type="strikethroughSequence",f[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},f[h][1].start),end:Object.assign({},f[p][1].end)},y={type:"strikethroughText",start:Object.assign({},f[h][1].end),end:Object.assign({},f[p][1].start)},b=[["enter",g,m],["enter",f[h][1],m],["exit",f[h][1],m],["enter",y,m]],v=m.parser.constructs.insideSpan.null;v&&qn(b,b.length,0,wc(v,f.slice(h+1,p),m)),qn(b,b.length,0,[["exit",y,m],["enter",f[p][1],m],["exit",f[p][1],m],["exit",g,m]]),qn(f,h-1,p-h+3,b),p=h+b.length-2;break}}for(p=-1;++p<f.length;)f[p][1].type==="strikethroughSequenceTemporary"&&(f[p][1].type="data");return f}function u(f,m,p){const h=this.previous,g=this.events;let y=0;return b;function b(S){return h===126&&g[g.length-1][1].type!=="characterEscape"?p(S):(f.enter("strikethroughSequenceTemporary"),v(S))}function v(S){const k=Jr(h);if(S===126)return y>1?p(S):(f.consume(S),y++,v);if(y<2&&!a)return p(S);const C=f.exit("strikethroughSequenceTemporary"),E=Jr(S);return C._open=!E||E===2&&!!k,C._close=!k||k===2&&!!E,m(S)}}}class Q4{constructor(){this.map=[]}add(l,a,i){Z4(this,l,a,i)}consume(l){if(this.map.sort(function(u,f){return u[0]-f[0]}),this.map.length===0)return;let a=this.map.length;const i=[];for(;a>0;)a-=1,i.push(l.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),l.length=this.map[a][0];i.push(l.slice()),l.length=0;let o=i.pop();for(;o;){for(const u of o)l.push(u);o=i.pop()}this.map.length=0}}function Z4(t,l,a,i){let o=0;if(!(a===0&&i.length===0)){for(;o<t.map.length;){if(t.map[o][0]===l){t.map[o][1]+=a,t.map[o][2].push(...i);return}o+=1}t.map.push([l,a,i])}}function W4(t,l){let a=!1;const i=[];for(;l<t.length;){const o=t[l];if(a){if(o[0]==="enter")o[1].type==="tableContent"&&i.push(t[l+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(t[l-1][1].type==="tableDelimiterMarker"){const u=i.length-1;i[u]=i[u]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(a=!0);l+=1}return i}function J4(){return{flow:{null:{name:"table",tokenize:P4,resolveAll:eS}}}}function P4(t,l,a){const i=this;let o=0,u=0,f;return m;function m(D){let I=i.events.length-1;for(;I>-1;){const ae=i.events[I][1].type;if(ae==="lineEnding"||ae==="linePrefix")I--;else break}const L=I>-1?i.events[I][1].type:null,ee=L==="tableHead"||L==="tableRow"?T:p;return ee===T&&i.parser.lazy[i.now().line]?a(D):ee(D)}function p(D){return t.enter("tableHead"),t.enter("tableRow"),h(D)}function h(D){return D===124||(f=!0,u+=1),g(D)}function g(D){return D===null?a(D):Le(D)?u>1?(u=0,i.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),v):a(D):tt(D)?st(t,g,"whitespace")(D):(u+=1,f&&(f=!1,o+=1),D===124?(t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),f=!0,g):(t.enter("data"),y(D)))}function y(D){return D===null||D===124||zt(D)?(t.exit("data"),g(D)):(t.consume(D),D===92?b:y)}function b(D){return D===92||D===124?(t.consume(D),y):y(D)}function v(D){return i.interrupt=!1,i.parser.lazy[i.now().line]?a(D):(t.enter("tableDelimiterRow"),f=!1,tt(D)?st(t,S,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):S(D))}function S(D){return D===45||D===58?C(D):D===124?(f=!0,t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),k):B(D)}function k(D){return tt(D)?st(t,C,"whitespace")(D):C(D)}function C(D){return D===58?(u+=1,f=!0,t.enter("tableDelimiterMarker"),t.consume(D),t.exit("tableDelimiterMarker"),E):D===45?(u+=1,E(D)):D===null||Le(D)?O(D):B(D)}function E(D){return D===45?(t.enter("tableDelimiterFiller"),M(D)):B(D)}function M(D){return D===45?(t.consume(D),M):D===58?(f=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(D),t.exit("tableDelimiterMarker"),$):(t.exit("tableDelimiterFiller"),$(D))}function $(D){return tt(D)?st(t,O,"whitespace")(D):O(D)}function O(D){return D===124?S(D):D===null||Le(D)?!f||o!==u?B(D):(t.exit("tableDelimiterRow"),t.exit("tableHead"),l(D)):B(D)}function B(D){return a(D)}function T(D){return t.enter("tableRow"),Y(D)}function Y(D){return D===124?(t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),Y):D===null||Le(D)?(t.exit("tableRow"),l(D)):tt(D)?st(t,Y,"whitespace")(D):(t.enter("data"),V(D))}function V(D){return D===null||D===124||zt(D)?(t.exit("data"),Y(D)):(t.consume(D),D===92?te:V)}function te(D){return D===92||D===124?(t.consume(D),V):V(D)}}function eS(t,l){let a=-1,i=!0,o=0,u=[0,0,0,0],f=[0,0,0,0],m=!1,p=0,h,g,y;const b=new Q4;for(;++a<t.length;){const v=t[a],S=v[1];v[0]==="enter"?S.type==="tableHead"?(m=!1,p!==0&&(Q1(b,l,p,h,g),g=void 0,p=0),h={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},b.add(a,0,[["enter",h,l]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(i=!0,y=void 0,u=[0,0,0,0],f=[0,a+1,0,0],m&&(m=!1,g={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},b.add(a,0,[["enter",g,l]])),o=S.type==="tableDelimiterRow"?2:g?3:1):o&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(i=!1,f[2]===0&&(u[1]!==0&&(f[0]=f[1],y=Qo(b,l,u,o,void 0,y),u=[0,0,0,0]),f[2]=a)):S.type==="tableCellDivider"&&(i?i=!1:(u[1]!==0&&(f[0]=f[1],y=Qo(b,l,u,o,void 0,y)),u=f,f=[u[1],a,0,0])):S.type==="tableHead"?(m=!0,p=a):S.type==="tableRow"||S.type==="tableDelimiterRow"?(p=a,u[1]!==0?(f[0]=f[1],y=Qo(b,l,u,o,a,y)):f[1]!==0&&(y=Qo(b,l,f,o,a,y)),o=0):o&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(f[3]=a)}for(p!==0&&Q1(b,l,p,h,g),b.consume(l.events),a=-1;++a<l.events.length;){const v=l.events[a];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=W4(l.events,a))}return t}function Qo(t,l,a,i,o,u){const f=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",m="tableContent";a[0]!==0&&(u.end=Object.assign({},Zr(l.events,a[0])),t.add(a[0],0,[["exit",u,l]]));const p=Zr(l.events,a[1]);if(u={type:f,start:Object.assign({},p),end:Object.assign({},p)},t.add(a[1],0,[["enter",u,l]]),a[2]!==0){const h=Zr(l.events,a[2]),g=Zr(l.events,a[3]),y={type:m,start:Object.assign({},h),end:Object.assign({},g)};if(t.add(a[2],0,[["enter",y,l]]),i!==2){const b=l.events[a[2]],v=l.events[a[3]];if(b[1].end=Object.assign({},v[1].end),b[1].type="chunkText",b[1].contentType="text",a[3]>a[2]+1){const S=a[2]+1,k=a[3]-a[2]-1;t.add(S,k,[])}}t.add(a[3]+1,0,[["exit",y,l]])}return o!==void 0&&(u.end=Object.assign({},Zr(l.events,o)),t.add(o,0,[["exit",u,l]]),u=void 0),u}function Q1(t,l,a,i,o){const u=[],f=Zr(l.events,a);o&&(o.end=Object.assign({},f),u.push(["exit",o,l])),i.end=Object.assign({},f),u.push(["exit",i,l]),t.add(a+1,0,u)}function Zr(t,l){const a=t[l],i=a[0]==="enter"?"start":"end";return a[1][i]}const tS={name:"tasklistCheck",tokenize:lS};function nS(){return{text:{91:tS}}}function lS(t,l,a){const i=this;return o;function o(p){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?a(p):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(p),t.exit("taskListCheckMarker"),u)}function u(p){return zt(p)?(t.enter("taskListCheckValueUnchecked"),t.consume(p),t.exit("taskListCheckValueUnchecked"),f):p===88||p===120?(t.enter("taskListCheckValueChecked"),t.consume(p),t.exit("taskListCheckValueChecked"),f):a(p)}function f(p){return p===93?(t.enter("taskListCheckMarker"),t.consume(p),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),m):a(p)}function m(p){return Le(p)?l(p):tt(p)?t.check({tokenize:aS},l,a)(p):a(p)}}function aS(t,l,a){return st(t,i,"whitespace");function i(o){return o===null?a(o):l(o)}}function rS(t){return Qy([T4(),H4(),K4(t),J4(),nS()])}const iS={};function H0(t){const l=this,a=t||iS,i=l.data(),o=i.micromarkExtensions||(i.micromarkExtensions=[]),u=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),f=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);o.push(rS(a)),u.push(C4()),f.push(N4(a))}function Ns({content:t,className:l=""}){return c.jsx("div",{className:`office-markdown ${l}`,children:c.jsx(p0,{remarkPlugins:[H0],components:{code:sS,table:({children:a})=>c.jsx("div",{className:"overflow-x-auto my-2",children:c.jsx("table",{className:"office-table",children:a})})},children:t})})}function sS({className:t,children:l,...a}){const i=/language-(\w+)/.exec(t??"");return i||typeof l=="string"&&l.includes(`
|
|
79
|
-
`)?c.jsx(oS,{language:i==null?void 0:i[1],children:l}):c.jsx("code",{className:"bg-gray-100 text-gray-700 px-1 py-0.5 rounded text-[0.9em] font-mono",...a,children:l})}function oS({children:t,language:l}){const[a,i]=j.useState(!1),o=String(t).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(o),i(!0),setTimeout(()=>i(!1),1500)};return c.jsxs("div",{className:"office-code-block group relative my-2",children:[l&&c.jsx("div",{className:"text-[10px] text-gray-400 px-3 pt-1.5",children:l}),c.jsx("button",{onClick:u,className:"absolute top-1.5 right-2 text-[10px] text-gray-400 hover:text-gray-600 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:a?"Copied!":"Copy"}),c.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:c.jsx("code",{children:o})})]})}const Z1={$skin:"skinColor",$hair:"hairColor",$shirt:"shirtColor",$pants:"pantsColor",$shoes:"shoeColor"},cS=/^(darken|lighten)\((\$\w+),\s*(\d+)\)$/;function uS(t,l){const a=parseInt(t.replace("#",""),16),i=Math.max(0,(a>>16&255)-l),o=Math.max(0,(a>>8&255)-l),u=Math.max(0,(a&255)-l);return`#${(i<<16|o<<8|u).toString(16).padStart(6,"0")}`}function fS(t,l){const a=parseInt(t.replace("#",""),16),i=Math.min(255,(a>>16&255)+l),o=Math.min(255,(a>>8&255)+l),u=Math.min(255,(a&255)+l);return`#${(i<<16|o<<8|u).toString(16).padStart(6,"0")}`}function U0(t,l){const a=Z1[t];if(a&&l)return l[a];const i=cS.exec(t);if(i){const[,o,u,f]=i,m=Z1[u],p=m&&l?l[m]:u,h=parseInt(f,10);return o==="darken"?uS(p,h):fS(p,h)}return t}function W1(t,l=12){return t.map(a=>({...a,x:l-a.x-a.w}))}function dS(t,l){return l==="down"?t.down:l==="up"&&t.up?t.up:l==="left"&&t.left?t.left:l==="right"&&t.right?t.right:l==="right"&&t.left?{name:t.left.name,pixels:W1(t.left.pixels)}:l==="left"&&t.right?{name:t.right.name,pixels:W1(t.right.pixels)}:t.down}function hS(t,l){return Bd(t,"hair",l,1)}function Bd(t,l,a,i){const o=t.layers.findIndex(f=>f.name===l),u=[...t.layers];if(o>=0)u[o]={...a,name:l};else{const f=i??u.length;u.splice(f,0,{...a,name:l})}return{...t,layers:u}}const ch=new Map,uh=new Map;function I0(t,l){ch.set(t,l)}function Ec(t,l){uh.set(t,l)}function $d(t){return ch.get(t)}function mS(t){return uh.get(t)}function QC(){return Array.from(ch.keys())}function ZC(){return Array.from(uh.keys())}function xS(t,l,a,i,o=2){t.clearRect(0,0,l.width*o,l.height*o);for(const u of l.layers)Y0(t,u.pixels,o,a,i)}function Ld(t,l,a,i,o){for(const u of l){const f=U0(u.c,o);u.a!==void 0&&u.a!==1&&(t.globalAlpha=u.a),t.fillStyle=f,t.fillRect(a+u.x,i+u.y,u.w,u.h),u.a!==void 0&&u.a!==1&&(t.globalAlpha=1)}}function pS(t,l){const a=l.scale;t.clearRect(0,0,l.canvasWidth,l.canvasHeight),Y0(t,l.pixels,a,0)}function Y0(t,l,a,i,o){for(const u of l){const f=U0(u.c,o);u.a!==void 0&&u.a!==1&&(t.globalAlpha=u.a),t.fillStyle=f,t.fillRect(u.x*a,(u.y+i)*a,u.w*a,u.h*a),u.a!==void 0&&u.a!==1&&(t.globalAlpha=1)}}const mc=new Map;function _a(t,l,a){if("down"in a&&!("pixels"in a)){const o=a;mc.set(t,{id:t,name:l,layer:{...o.down,name:"hair"},directions:{down:{...o.down,name:"hair"},up:o.up?{...o.up,name:"hair"}:void 0,left:o.left?{...o.left,name:"hair"}:void 0,right:o.right?{...o.right,name:"hair"}:void 0}})}else{const o=a;mc.set(t,{id:t,name:l,layer:{...o,name:"hair"}})}}function yS(t){return mc.get(t)}function q0(){return Array.from(mc.values())}_a("short","Short",{down:{name:"hair",pixels:[{x:1,y:0,w:10,h:2,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:10,y:1,w:2,h:2,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3}]},up:{name:"hair",pixels:[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:10,y:1,w:2,h:2,c:"$hair"}]},left:{name:"hair",pixels:[{x:1,y:0,w:9,h:2,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:2,y:0,w:6,h:1,c:"lighten($hair, 25)",a:.3}]}});_a("messy","Messy",{down:{name:"hair",pixels:[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:10,y:0,w:2,h:4,c:"$hair"},{x:3,y:-1,w:3,h:2,c:"$hair"},{x:7,y:-1,w:2,h:2,c:"lighten($hair, 20)"},{x:2,y:0,w:4,h:1,c:"lighten($hair, 30)",a:.3}]},up:{name:"hair",pixels:[{x:1,y:0,w:10,h:4,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:10,y:0,w:2,h:4,c:"$hair"},{x:3,y:-1,w:3,h:2,c:"$hair"},{x:7,y:-1,w:2,h:2,c:"$hair"}]},left:{name:"hair",pixels:[{x:1,y:0,w:9,h:3,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:3,y:-1,w:3,h:2,c:"$hair"},{x:2,y:0,w:4,h:1,c:"lighten($hair, 30)",a:.3}]}});_a("bun","Bun",{down:{name:"hair",pixels:[{x:1,y:0,w:10,h:2,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:10,y:1,w:2,h:2,c:"$hair"},{x:4,y:-2,w:4,h:3,c:"$hair"},{x:5,y:-2,w:2,h:1,c:"lighten($hair, 30)",a:.4}]},up:{name:"hair",pixels:[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:10,y:1,w:2,h:2,c:"$hair"},{x:4,y:-2,w:4,h:3,c:"$hair"},{x:5,y:-2,w:2,h:1,c:"lighten($hair, 30)",a:.4}]},left:{name:"hair",pixels:[{x:1,y:0,w:9,h:2,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:4,y:-2,w:4,h:3,c:"$hair"},{x:5,y:-2,w:2,h:1,c:"lighten($hair, 30)",a:.4}]}});_a("long","Long",{down:{name:"hair",pixels:[{x:0,y:0,w:12,h:3,c:"$hair"},{x:-1,y:1,w:2,h:7,c:"$hair"},{x:11,y:1,w:2,h:7,c:"$hair"},{x:-1,y:6,w:2,h:3,c:"darken($hair, 15)",a:.5},{x:11,y:6,w:2,h:3,c:"darken($hair, 15)",a:.5},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3}]},up:{name:"hair",pixels:[{x:0,y:0,w:12,h:3,c:"$hair"},{x:-1,y:1,w:2,h:7,c:"$hair"},{x:11,y:1,w:2,h:7,c:"$hair"},{x:1,y:2,w:10,h:6,c:"$hair"},{x:2,y:6,w:8,h:2,c:"darken($hair, 10)",a:.3}]},left:{name:"hair",pixels:[{x:0,y:0,w:10,h:3,c:"$hair"},{x:-1,y:1,w:2,h:7,c:"$hair"},{x:-1,y:6,w:2,h:3,c:"darken($hair, 15)",a:.5},{x:2,y:0,w:6,h:1,c:"lighten($hair, 25)",a:.3}]}});_a("mohawk","Mohawk",{down:{name:"hair",pixels:[{x:4,y:-2,w:4,h:4,c:"$hair"},{x:5,y:-3,w:2,h:2,c:"lighten($hair, 20)"},{x:1,y:1,w:3,h:2,c:"$hair"},{x:8,y:1,w:3,h:2,c:"$hair"}]},up:{name:"hair",pixels:[{x:4,y:-2,w:4,h:4,c:"$hair"},{x:5,y:-3,w:2,h:2,c:"lighten($hair, 20)"},{x:1,y:1,w:3,h:2,c:"$hair"},{x:8,y:1,w:3,h:2,c:"$hair"}]},left:{name:"hair",pixels:[{x:4,y:-2,w:3,h:4,c:"$hair"},{x:5,y:-3,w:2,h:2,c:"lighten($hair, 20)"},{x:1,y:1,w:3,h:2,c:"$hair"}]}});_a("slicked","Slicked Back",{down:{name:"hair",pixels:[{x:1,y:0,w:10,h:2,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:10,y:1,w:2,h:2,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 15)",a:.4},{x:3,y:1,w:6,h:1,c:"lighten($hair, 10)",a:.2}]},up:{name:"hair",pixels:[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:10,y:1,w:2,h:2,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 15)",a:.4}]},left:{name:"hair",pixels:[{x:1,y:0,w:9,h:2,c:"$hair"},{x:0,y:1,w:2,h:2,c:"$hair"},{x:2,y:0,w:6,h:1,c:"lighten($hair, 15)",a:.4}]}});_a("bob","Bob Cut",{down:{name:"hair",pixels:[{x:0,y:0,w:12,h:3,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:11,y:1,w:2,h:5,c:"$hair"},{x:-1,y:5,w:2,h:1,c:"darken($hair, 15)",a:.4},{x:11,y:5,w:2,h:1,c:"darken($hair, 15)",a:.4},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3}]},up:{name:"hair",pixels:[{x:0,y:0,w:12,h:3,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:11,y:1,w:2,h:5,c:"$hair"},{x:1,y:2,w:10,h:4,c:"$hair"},{x:2,y:5,w:8,h:1,c:"darken($hair, 10)",a:.3}]},left:{name:"hair",pixels:[{x:0,y:0,w:10,h:3,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:-1,y:5,w:2,h:1,c:"darken($hair, 15)",a:.4},{x:2,y:0,w:6,h:1,c:"lighten($hair, 25)",a:.3}]}});_a("curly","Curly",{down:{name:"hair",pixels:[{x:0,y:0,w:12,h:4,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:11,y:1,w:2,h:5,c:"$hair"},{x:2,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:6,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:4,y:2,w:2,h:1,c:"lighten($hair, 15)",a:.3},{x:8,y:2,w:2,h:1,c:"lighten($hair, 15)",a:.3}]},up:{name:"hair",pixels:[{x:0,y:0,w:12,h:4,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:11,y:1,w:2,h:5,c:"$hair"},{x:1,y:2,w:10,h:4,c:"$hair"},{x:3,y:1,w:2,h:1,c:"lighten($hair, 15)",a:.3},{x:7,y:1,w:2,h:1,c:"lighten($hair, 15)",a:.3}]},left:{name:"hair",pixels:[{x:0,y:0,w:10,h:4,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:2,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:5,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:3,y:2,w:2,h:1,c:"lighten($hair, 15)",a:.3}]}});const xc=new Map;function Nl(t,l,a){if("down"in a&&!("pixels"in a)){const o=a;xc.set(t,{id:t,name:l,layer:{...o.down,name:"torso"},directions:{down:{...o.down,name:"torso"},up:o.up?{...o.up,name:"torso"}:void 0,left:o.left?{...o.left,name:"torso"}:void 0,right:o.right?{...o.right,name:"torso"}:void 0}})}else{const o=a;xc.set(t,{id:t,name:l,layer:{...o,name:"torso"}})}}function gS(t){return xc.get(t)}function X0(){return Array.from(xc.values())}Nl("tshirt","T-Shirt",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:5,y:10,w:2,h:3,c:"darken($shirt, 10)",a:.15},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:2,y:10,w:7,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Nl("suit","Suit",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 12)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:10,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:2,y:10,w:3,h:3,c:"darken($shirt, 20)",a:.3},{x:7,y:10,w:3,h:3,c:"darken($shirt, 20)",a:.3},{x:5,y:10,w:2,h:5,c:"#E8E8E8",a:.5},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:11,w:2,h:1,c:"darken($shirt, 20)",a:.2},{x:11,y:11,w:2,h:1,c:"darken($shirt, 20)",a:.2},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:10,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:5,y:12,w:2,h:4,c:"darken($shirt, 10)",a:.15},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:2,y:10,w:3,h:3,c:"darken($shirt, 20)",a:.3},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:11,w:3,h:1,c:"darken($shirt, 20)",a:.2},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Nl("hoodie","Hoodie",{down:{name:"torso",pixels:[{x:0,y:10,w:12,h:6,c:"$shirt"},{x:1,y:10,w:10,h:1,c:"lighten($shirt, 15)",a:.25},{x:0,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:2,y:8,w:8,h:2,c:"$shirt",a:.4},{x:3,y:13,w:6,h:2,c:"darken($shirt, 15)",a:.2},{x:5,y:10,w:1,h:2,c:"#DDD",a:.3},{x:6,y:10,w:1,h:2,c:"#DDD",a:.3},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:0,y:10,w:12,h:6,c:"$shirt"},{x:0,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:2,y:7,w:8,h:3,c:"$shirt",a:.5},{x:3,y:7,w:6,h:1,c:"darken($shirt, 10)",a:.3},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:0,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:8,h:1,c:"lighten($shirt, 15)",a:.25},{x:0,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:2,y:8,w:6,h:2,c:"$shirt",a:.4},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Nl("vest","Vest",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:5,y:10,w:2,h:2,c:"$skin",a:.6},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:3,h:5,c:"$skin"},{x:-1,y:15,w:3,h:1,c:"darken($skin, 10)"}]}});Nl("tank","Tank Top",{down:{name:"torso",pixels:[{x:2,y:10,w:8,h:6,c:"$shirt"},{x:3,y:10,w:6,h:1,c:"lighten($shirt, 18)",a:.3},{x:2,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:9,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:0,y:10,w:2,h:2,c:"$skin"},{x:10,y:10,w:2,h:2,c:"$skin"},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},up:{name:"torso",pixels:[{x:2,y:10,w:8,h:6,c:"$shirt"},{x:2,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:9,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:0,y:10,w:2,h:2,c:"$skin"},{x:10,y:10,w:2,h:2,c:"$skin"},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},left:{name:"torso",pixels:[{x:2,y:10,w:7,h:6,c:"$shirt"},{x:2,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:0,y:10,w:2,h:2,c:"$skin"},{x:-1,y:11,w:3,h:5,c:"$skin"},{x:-1,y:15,w:3,h:1,c:"darken($skin, 10)"}]}});Nl("polo","Polo",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:9,w:6,h:2,c:"lighten($shirt, 25)",a:.5},{x:5,y:9,w:2,h:1,c:"$skin",a:.4},{x:5,y:10,w:2,h:3,c:"darken($shirt, 15)",a:.15},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:9,w:6,h:1,c:"lighten($shirt, 25)",a:.5},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:9,w:4,h:2,c:"lighten($shirt, 25)",a:.5},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Nl("labcoat","Lab Coat",{down:{name:"torso",pixels:[{x:4,y:10,w:4,h:5,c:"$shirt"},{x:0,y:10,w:4,h:7,c:"#F0F0F0"},{x:8,y:10,w:4,h:7,c:"#F0F0F0"},{x:1,y:10,w:10,h:1,c:"#FAFAFA"},{x:0,y:10,w:1,h:7,c:"#DDD",a:.5},{x:11,y:10,w:1,h:7,c:"#DDD",a:.5},{x:1,y:13,w:2,h:2,c:"#E0E0E0",a:.4},{x:9,y:13,w:2,h:2,c:"#E0E0E0",a:.4},{x:-1,y:11,w:2,h:5,c:"#F0F0F0"},{x:11,y:11,w:2,h:5,c:"#F0F0F0"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:0,y:10,w:12,h:7,c:"#F0F0F0"},{x:0,y:10,w:1,h:7,c:"#DDD",a:.5},{x:11,y:10,w:1,h:7,c:"#DDD",a:.5},{x:5,y:11,w:2,h:5,c:"#E8E8E8",a:.3},{x:-1,y:11,w:2,h:5,c:"#F0F0F0"},{x:11,y:11,w:2,h:5,c:"#F0F0F0"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:3,y:10,w:3,h:5,c:"$shirt"},{x:0,y:10,w:3,h:7,c:"#F0F0F0"},{x:6,y:10,w:4,h:7,c:"#F0F0F0"},{x:1,y:10,w:8,h:1,c:"#FAFAFA"},{x:0,y:10,w:1,h:7,c:"#DDD",a:.5},{x:1,y:13,w:2,h:2,c:"#E0E0E0",a:.4},{x:-1,y:11,w:3,h:5,c:"#F0F0F0"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Nl("overalls","Overalls",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:3,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:3,y:11,w:6,h:5,c:"#3D6B99"},{x:3,y:10,w:2,h:1,c:"#3D6B99"},{x:7,y:10,w:2,h:1,c:"#3D6B99"},{x:3,y:11,w:1,h:1,c:"#FFD700",a:.6},{x:8,y:11,w:1,h:1,c:"#FFD700",a:.6},{x:1,y:13,w:2,h:3,c:"#3D6B99"},{x:9,y:13,w:2,h:3,c:"#3D6B99"},{x:5,y:13,w:2,h:2,c:"#345E87",a:.4},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:3,c:"$shirt"},{x:3,y:10,w:2,h:1,c:"#3D6B99"},{x:7,y:10,w:2,h:1,c:"#3D6B99"},{x:1,y:13,w:10,h:3,c:"#3D6B99"},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:3,c:"$shirt"},{x:3,y:11,w:5,h:5,c:"#3D6B99"},{x:3,y:10,w:2,h:1,c:"#3D6B99"},{x:3,y:11,w:1,h:1,c:"#FFD700",a:.6},{x:1,y:13,w:2,h:3,c:"#3D6B99"},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Nl("turtleneck","Turtleneck",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:8,w:6,h:2,c:"$shirt"},{x:4,y:8,w:4,h:1,c:"lighten($shirt, 12)",a:.3},{x:3,y:9,w:1,h:1,c:"darken($shirt, 15)",a:.2},{x:8,y:9,w:1,h:1,c:"darken($shirt, 15)",a:.2},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:8,w:6,h:2,c:"$shirt"},{x:4,y:8,w:4,h:1,c:"lighten($shirt, 12)",a:.3},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:8,w:4,h:2,c:"$shirt"},{x:3,y:8,w:3,h:1,c:"lighten($shirt, 12)",a:.3},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Nl("robe","Robe",{down:{name:"torso",pixels:[{x:0,y:10,w:12,h:7,c:"$shirt"},{x:0,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:3,y:10,w:3,h:4,c:"lighten($shirt, 15)",a:.25},{x:6,y:10,w:3,h:4,c:"darken($shirt, 10)",a:.2},{x:1,y:14,w:10,h:1,c:"darken($shirt, 35)"},{x:2,y:14,w:8,h:1,c:"darken($shirt, 25)",a:.4},{x:-2,y:11,w:3,h:5,c:"$shirt"},{x:11,y:11,w:3,h:5,c:"$shirt"},{x:-2,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:11,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:0,y:10,w:12,h:7,c:"$shirt"},{x:0,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:1,y:14,w:10,h:1,c:"darken($shirt, 35)"},{x:-2,y:11,w:3,h:5,c:"$shirt"},{x:11,y:11,w:3,h:5,c:"$shirt"},{x:-2,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:11,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:0,y:10,w:10,h:7,c:"$shirt"},{x:0,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:1,y:14,w:8,h:1,c:"darken($shirt, 35)"},{x:-2,y:11,w:4,h:5,c:"$shirt"},{x:-2,y:15,w:4,h:1,c:"darken($shirt, 15)",a:.3},{x:-1,y:15,w:2,h:1,c:"$skin"}]}});const vs=new Map;function pt(t,l,a){if("down"in a&&!("pixels"in a)){const o=a;vs.set(t,{id:t,name:l,layer:{...o.down,name:"accessory"},directions:{down:{...o.down,name:"accessory"},up:o.up?{...o.up,name:"accessory"}:void 0,left:o.left?{...o.left,name:"accessory"}:void 0,right:o.right?{...o.right,name:"accessory"}:void 0}})}else{const o=a;vs.set(t,{id:t,name:l,layer:{...o,name:"accessory"}})}}function bS(t){return vs.get(t)}function vS(t,l){const a=vs.get(t);if(!a)return;if(a.directions)return dS(a.directions,l);if(l==="down")return a.layer;const i=a.layer.pixels.filter(u=>u.y<2);if(i.length===0)return;const o=l==="right"?1:l==="left"?-1:0;return{name:a.layer.name,pixels:o?i.map(u=>({...u,x:u.x+o})):i}}function V0(){return Array.from(vs.values())}pt("none","None",{name:"accessory",pixels:[]});pt("glasses","Glasses",{down:{name:"accessory",pixels:[{x:2,y:4,w:3,h:2,c:"#2A3A50",a:.5},{x:7,y:4,w:3,h:2,c:"#2A3A50",a:.5},{x:5,y:4,w:2,h:1,c:"#2A3A50",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:3,w:2,h:1,c:"#2A3A50",a:.4},{x:10,y:3,w:2,h:1,c:"#2A3A50",a:.4}]},left:{name:"accessory",pixels:[{x:2,y:4,w:3,h:2,c:"#2A3A50",a:.5},{x:5,y:4,w:6,h:1,c:"#2A3A50",a:.3}]}});pt("round-glasses","Round Glasses",{down:{name:"accessory",pixels:[{x:2,y:3,w:3,h:3,c:"#8B7355",a:.4},{x:7,y:3,w:3,h:3,c:"#8B7355",a:.4},{x:3,y:4,w:1,h:1,c:"#B0E0FF",a:.15},{x:8,y:4,w:1,h:1,c:"#B0E0FF",a:.15},{x:5,y:4,w:2,h:1,c:"#8B7355",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:3,w:2,h:1,c:"#8B7355",a:.3},{x:10,y:3,w:2,h:1,c:"#8B7355",a:.3}]},left:{name:"accessory",pixels:[{x:2,y:3,w:3,h:3,c:"#8B7355",a:.4},{x:3,y:4,w:1,h:1,c:"#B0E0FF",a:.15},{x:5,y:4,w:6,h:1,c:"#8B7355",a:.25}]}});pt("sunglasses","Sunglasses",{down:{name:"accessory",pixels:[{x:2,y:4,w:3,h:2,c:"#1A1A2E",a:.7},{x:7,y:4,w:3,h:2,c:"#1A1A2E",a:.7},{x:5,y:4,w:2,h:1,c:"#1A1A2E",a:.4},{x:3,y:4,w:1,h:1,c:"#334",a:.3},{x:8,y:4,w:1,h:1,c:"#334",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:3,w:2,h:1,c:"#1A1A2E",a:.4},{x:10,y:3,w:2,h:1,c:"#1A1A2E",a:.4}]},left:{name:"accessory",pixels:[{x:2,y:4,w:3,h:2,c:"#1A1A2E",a:.7},{x:3,y:4,w:1,h:1,c:"#334",a:.3},{x:5,y:4,w:6,h:1,c:"#1A1A2E",a:.35}]}});pt("headphones","Headphones",{down:{name:"accessory",pixels:[{x:0,y:0,w:12,h:1,c:"#333",a:.7},{x:-1,y:1,w:2,h:5,c:"#444"},{x:11,y:1,w:2,h:5,c:"#444"},{x:-1,y:2,w:2,h:3,c:"#555",a:.3},{x:11,y:2,w:2,h:3,c:"#555",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:0,w:12,h:1,c:"#333",a:.7},{x:-1,y:1,w:2,h:5,c:"#444"},{x:11,y:1,w:2,h:5,c:"#444"},{x:-1,y:2,w:2,h:3,c:"#555",a:.3},{x:11,y:2,w:2,h:3,c:"#555",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:0,w:10,h:1,c:"#333",a:.7},{x:-1,y:1,w:3,h:5,c:"#444"},{x:-1,y:2,w:3,h:3,c:"#555",a:.3}]}});pt("beret","Beret",{down:{name:"accessory",pixels:[{x:2,y:-1,w:8,h:2,c:"#E91E63"},{x:1,y:0,w:2,h:1,c:"#E91E63",a:.6},{x:4,y:-1,w:4,h:1,c:"#F06292",a:.3}]},up:{name:"accessory",pixels:[{x:2,y:-1,w:8,h:2,c:"#E91E63"},{x:9,y:0,w:2,h:1,c:"#E91E63",a:.6}]},left:{name:"accessory",pixels:[{x:0,y:-1,w:8,h:2,c:"#E91E63"},{x:2,y:-1,w:4,h:1,c:"#F06292",a:.3}]}});pt("cap","Cap",{down:{name:"accessory",pixels:[{x:1,y:-1,w:10,h:2,c:"#1565C0"},{x:0,y:1,w:12,h:1,c:"#0D47A1"},{x:3,y:-1,w:6,h:1,c:"#1E88E5",a:.3}]},up:{name:"accessory",pixels:[{x:1,y:-1,w:10,h:2,c:"#1565C0"},{x:3,y:-1,w:6,h:1,c:"#1E88E5",a:.3},{x:5,y:1,w:2,h:1,c:"#0D47A1",a:.5}]},left:{name:"accessory",pixels:[{x:0,y:-1,w:9,h:2,c:"#1565C0"},{x:-2,y:1,w:6,h:1,c:"#0D47A1"},{x:2,y:-1,w:5,h:1,c:"#1E88E5",a:.3}]}});pt("badge","Badge",{down:{name:"accessory",pixels:[{x:5,y:8,w:2,h:3,c:"#2196F3",a:.4},{x:4,y:11,w:4,h:3,c:"#FFF",a:.5},{x:5,y:12,w:2,h:1,c:"#333",a:.3}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:3,y:8,w:1,h:3,c:"#2196F3",a:.4},{x:2,y:11,w:3,h:3,c:"#FFF",a:.5}]}});pt("lapels","Lapels",{down:{name:"accessory",pixels:[{x:1,y:10,w:3,h:2,c:"#1A1A2E",a:.4},{x:8,y:10,w:3,h:2,c:"#1A1A2E",a:.4}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:1,y:10,w:3,h:2,c:"#1A1A2E",a:.4}]}});pt("blush","Blush",{down:{name:"accessory",pixels:[{x:2,y:6,w:1,h:1,c:"#FFCDD2",a:.3},{x:9,y:6,w:1,h:1,c:"#FFCDD2",a:.3}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:2,y:6,w:1,h:1,c:"#FFCDD2",a:.3}]}});pt("scarf","Scarf",{down:{name:"accessory",pixels:[{x:2,y:9,w:8,h:2,c:"#E53935",a:.6},{x:3,y:9,w:6,h:1,c:"#EF5350",a:.3},{x:3,y:11,w:2,h:3,c:"#E53935",a:.5}]},up:{name:"accessory",pixels:[{x:2,y:9,w:8,h:2,c:"#E53935",a:.6},{x:3,y:9,w:6,h:1,c:"#EF5350",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:9,w:8,h:2,c:"#E53935",a:.6},{x:2,y:9,w:5,h:1,c:"#EF5350",a:.3},{x:1,y:11,w:2,h:3,c:"#E53935",a:.5}]}});pt("tie","Tie",{down:{name:"accessory",pixels:[{x:5,y:9,w:2,h:1,c:"#B71C1C"},{x:5,y:10,w:2,h:4,c:"#D32F2F"},{x:5,y:10,w:1,h:4,c:"#E53935",a:.3},{x:5,y:14,w:2,h:1,c:"#B71C1C",a:.8}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:4,y:9,w:2,h:1,c:"#B71C1C"},{x:4,y:10,w:2,h:4,c:"#D32F2F"},{x:4,y:14,w:2,h:1,c:"#B71C1C",a:.8}]}});pt("bowtie","Bowtie",{down:{name:"accessory",pixels:[{x:3,y:9,w:2,h:1,c:"#D32F2F"},{x:7,y:9,w:2,h:1,c:"#D32F2F"},{x:5,y:9,w:2,h:1,c:"#B71C1C"},{x:4,y:9,w:1,h:1,c:"#E53935",a:.3},{x:7,y:9,w:1,h:1,c:"#E53935",a:.3}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:3,y:9,w:3,h:1,c:"#D32F2F"},{x:4,y:9,w:1,h:1,c:"#B71C1C"}]}});pt("cat-ears","Cat Ears",{down:{name:"accessory",pixels:[{x:1,y:-3,w:2,h:1,c:"#555"},{x:0,y:-2,w:3,h:1,c:"#555"},{x:0,y:-1,w:3,h:1,c:"#555"},{x:1,y:-2,w:1,h:1,c:"#FFB0C0",a:.6},{x:9,y:-3,w:2,h:1,c:"#555"},{x:9,y:-2,w:3,h:1,c:"#555"},{x:9,y:-1,w:3,h:1,c:"#555"},{x:10,y:-2,w:1,h:1,c:"#FFB0C0",a:.6}]},up:{name:"accessory",pixels:[{x:1,y:-3,w:2,h:1,c:"#555"},{x:0,y:-2,w:3,h:1,c:"#555"},{x:0,y:-1,w:3,h:1,c:"#555"},{x:9,y:-3,w:2,h:1,c:"#555"},{x:9,y:-2,w:3,h:1,c:"#555"},{x:9,y:-1,w:3,h:1,c:"#555"}]},left:{name:"accessory",pixels:[{x:2,y:-3,w:2,h:1,c:"#555"},{x:1,y:-2,w:3,h:1,c:"#555"},{x:1,y:-1,w:3,h:1,c:"#555"},{x:2,y:-2,w:1,h:1,c:"#FFB0C0",a:.6}]}});pt("bear-ears","Bear Ears",{down:{name:"accessory",pixels:[{x:0,y:-2,w:3,h:2,c:"#8B6914"},{x:1,y:-1,w:1,h:1,c:"#C4A24A",a:.5},{x:9,y:-2,w:3,h:2,c:"#8B6914"},{x:10,y:-1,w:1,h:1,c:"#C4A24A",a:.5}]},up:{name:"accessory",pixels:[{x:0,y:-2,w:3,h:2,c:"#8B6914"},{x:9,y:-2,w:3,h:2,c:"#8B6914"}]},left:{name:"accessory",pixels:[{x:1,y:-2,w:3,h:2,c:"#8B6914"},{x:2,y:-1,w:1,h:1,c:"#C4A24A",a:.5}]}});pt("bunny-ears","Bunny Ears",{down:{name:"accessory",pixels:[{x:2,y:-5,w:2,h:4,c:"#F5F5F5"},{x:2,y:-4,w:1,h:2,c:"#FFB0C0",a:.5},{x:8,y:-5,w:2,h:4,c:"#F5F5F5"},{x:9,y:-4,w:1,h:2,c:"#FFB0C0",a:.5},{x:9,y:-6,w:2,h:1,c:"#F5F5F5"}]},up:{name:"accessory",pixels:[{x:2,y:-5,w:2,h:4,c:"#F5F5F5"},{x:8,y:-5,w:2,h:4,c:"#F5F5F5"},{x:9,y:-6,w:2,h:1,c:"#F5F5F5"}]},left:{name:"accessory",pixels:[{x:3,y:-5,w:2,h:4,c:"#F5F5F5"},{x:3,y:-4,w:1,h:2,c:"#FFB0C0",a:.5},{x:4,y:-6,w:2,h:1,c:"#F5F5F5"}]}});pt("dog-nose","Dog Nose",{down:{name:"accessory",pixels:[{x:4,y:5,w:4,h:3,c:"#D2B48C",a:.5},{x:5,y:5,w:2,h:1,c:"#222"},{x:6,y:7,w:1,h:1,c:"#FF6B8A",a:.7}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:0,y:5,w:4,h:2,c:"#D2B48C",a:.5},{x:0,y:5,w:2,h:1,c:"#222"},{x:1,y:7,w:1,h:1,c:"#FF6B8A",a:.7}]}});pt("fox-mask","Fox Mask",{down:{name:"accessory",pixels:[{x:0,y:-3,w:2,h:1,c:"#E65100"},{x:-1,y:-2,w:3,h:1,c:"#E65100"},{x:0,y:-1,w:3,h:1,c:"#E65100"},{x:10,y:-3,w:2,h:1,c:"#E65100"},{x:10,y:-2,w:3,h:1,c:"#E65100"},{x:9,y:-1,w:3,h:1,c:"#E65100"},{x:0,y:-2,w:1,h:1,c:"#FFF",a:.4},{x:11,y:-2,w:1,h:1,c:"#FFF",a:.4},{x:1,y:5,w:2,h:2,c:"#FFF",a:.25},{x:9,y:5,w:2,h:2,c:"#FFF",a:.25},{x:5,y:6,w:2,h:1,c:"#222",a:.6}]},up:{name:"accessory",pixels:[{x:0,y:-3,w:2,h:1,c:"#E65100"},{x:-1,y:-2,w:3,h:1,c:"#E65100"},{x:0,y:-1,w:3,h:1,c:"#E65100"},{x:10,y:-3,w:2,h:1,c:"#E65100"},{x:10,y:-2,w:3,h:1,c:"#E65100"},{x:9,y:-1,w:3,h:1,c:"#E65100"}]},left:{name:"accessory",pixels:[{x:1,y:-3,w:2,h:1,c:"#E65100"},{x:0,y:-2,w:3,h:1,c:"#E65100"},{x:1,y:-1,w:3,h:1,c:"#E65100"},{x:1,y:-2,w:1,h:1,c:"#FFF",a:.4},{x:1,y:5,w:2,h:2,c:"#FFF",a:.25},{x:1,y:6,w:2,h:1,c:"#222",a:.6}]}});pt("crown","Crown",{down:{name:"accessory",pixels:[{x:2,y:-1,w:8,h:2,c:"#FFD700"},{x:3,y:-3,w:2,h:2,c:"#FFD700"},{x:5,y:-2,w:2,h:1,c:"#FFD700"},{x:7,y:-3,w:2,h:2,c:"#FFD700"},{x:4,y:-2,w:1,h:1,c:"#E53935",a:.8},{x:6,y:-1,w:1,h:1,c:"#42A5F5",a:.8},{x:8,y:-2,w:1,h:1,c:"#66BB6A",a:.8},{x:3,y:-1,w:6,h:1,c:"#FFF",a:.15}]},up:{name:"accessory",pixels:[{x:2,y:-1,w:8,h:2,c:"#FFD700"},{x:3,y:-3,w:2,h:2,c:"#FFD700"},{x:5,y:-2,w:2,h:1,c:"#FFD700"},{x:7,y:-3,w:2,h:2,c:"#FFD700"},{x:3,y:-1,w:6,h:1,c:"#FFF",a:.15}]},left:{name:"accessory",pixels:[{x:1,y:-1,w:7,h:2,c:"#FFD700"},{x:2,y:-3,w:2,h:2,c:"#FFD700"},{x:5,y:-2,w:2,h:1,c:"#FFD700"},{x:3,y:-2,w:1,h:1,c:"#E53935",a:.8},{x:5,y:-1,w:1,h:1,c:"#42A5F5",a:.8},{x:2,y:-1,w:5,h:1,c:"#FFF",a:.15}]}});pt("halo","Halo",{down:{name:"accessory",pixels:[{x:2,y:-3,w:8,h:1,c:"#FFE082",a:.7},{x:1,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:10,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:3,y:-4,w:6,h:1,c:"#FFF9C4",a:.4},{x:3,y:-3,w:6,h:1,c:"#FFF",a:.15}]},up:{name:"accessory",pixels:[{x:2,y:-3,w:8,h:1,c:"#FFE082",a:.7},{x:1,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:10,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:3,y:-4,w:6,h:1,c:"#FFF9C4",a:.4},{x:3,y:-3,w:6,h:1,c:"#FFF",a:.15}]},left:{name:"accessory",pixels:[{x:1,y:-3,w:7,h:1,c:"#FFE082",a:.7},{x:0,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:8,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:2,y:-4,w:5,h:1,c:"#FFF9C4",a:.4},{x:2,y:-3,w:5,h:1,c:"#FFF",a:.15}]}});pt("horns","Horns",{down:{name:"accessory",pixels:[{x:1,y:-1,w:2,h:2,c:"#8B0000"},{x:0,y:-3,w:2,h:2,c:"#A00"},{x:0,y:-4,w:1,h:1,c:"#C62828"},{x:9,y:-1,w:2,h:2,c:"#8B0000"},{x:10,y:-3,w:2,h:2,c:"#A00"},{x:11,y:-4,w:1,h:1,c:"#C62828"}]},up:{name:"accessory",pixels:[{x:1,y:-1,w:2,h:2,c:"#8B0000"},{x:0,y:-3,w:2,h:2,c:"#A00"},{x:0,y:-4,w:1,h:1,c:"#C62828"},{x:9,y:-1,w:2,h:2,c:"#8B0000"},{x:10,y:-3,w:2,h:2,c:"#A00"},{x:11,y:-4,w:1,h:1,c:"#C62828"}]},left:{name:"accessory",pixels:[{x:2,y:-1,w:2,h:2,c:"#8B0000"},{x:1,y:-3,w:2,h:2,c:"#A00"},{x:1,y:-4,w:1,h:1,c:"#C62828"}]}});pt("mask","Mask",{down:{name:"accessory",pixels:[{x:1,y:3,w:10,h:3,c:"#1A1A2E",a:.75},{x:3,y:4,w:2,h:1,c:"#000",a:0},{x:7,y:4,w:2,h:1,c:"#000",a:0},{x:1,y:3,w:10,h:1,c:"#FFD700",a:.3},{x:1,y:5,w:10,h:1,c:"#FFD700",a:.2}]},up:{name:"accessory",pixels:[{x:0,y:4,w:12,h:1,c:"#1A1A2E",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:3,w:6,h:3,c:"#1A1A2E",a:.75},{x:2,y:4,w:2,h:1,c:"#000",a:0},{x:1,y:3,w:6,h:1,c:"#FFD700",a:.3},{x:1,y:5,w:6,h:1,c:"#FFD700",a:.2}]}});pt("bandana","Bandana",{down:{name:"accessory",pixels:[{x:0,y:1,w:12,h:2,c:"#E53935"},{x:1,y:1,w:10,h:1,c:"#EF5350",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:1,w:12,h:2,c:"#E53935"},{x:1,y:1,w:10,h:1,c:"#EF5350",a:.3},{x:11,y:2,w:2,h:2,c:"#E53935",a:.7},{x:12,y:3,w:1,h:1,c:"#C62828",a:.5}]},left:{name:"accessory",pixels:[{x:0,y:1,w:10,h:2,c:"#E53935"},{x:1,y:1,w:8,h:1,c:"#EF5350",a:.3}]}});pt("eyepatch","Eye Patch",{down:{name:"accessory",pixels:[{x:0,y:3,w:12,h:1,c:"#222",a:.5},{x:2,y:3,w:3,h:3,c:"#1A1A1A"},{x:3,y:4,w:1,h:1,c:"#333",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:3,w:12,h:1,c:"#222",a:.5}]},left:{name:"accessory",pixels:[{x:0,y:3,w:10,h:1,c:"#222",a:.5},{x:1,y:3,w:3,h:3,c:"#1A1A1A"},{x:2,y:4,w:1,h:1,c:"#333",a:.3}]}});pt("cat-face","Cat Face",{down:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#555"},{x:2,y:0,w:8,h:1,c:"#555"},{x:0,y:-2,w:3,h:2,c:"#555"},{x:1,y:-3,w:2,h:1,c:"#555"},{x:9,y:-2,w:3,h:2,c:"#555"},{x:9,y:-3,w:2,h:1,c:"#555"},{x:1,y:-1,w:1,h:1,c:"#FFB0C0",a:.7},{x:10,y:-1,w:1,h:1,c:"#FFB0C0",a:.7},{x:2,y:3,w:3,h:3,c:"#222"},{x:7,y:3,w:3,h:3,c:"#222"},{x:3,y:3,w:1,h:2,c:"#4FC3F7",a:.8},{x:8,y:3,w:1,h:2,c:"#4FC3F7",a:.8},{x:3,y:4,w:1,h:1,c:"#111"},{x:8,y:4,w:1,h:1,c:"#111"},{x:5,y:5,w:2,h:1,c:"#FFB0C0"},{x:4,y:6,w:1,h:1,c:"#444",a:.6},{x:7,y:6,w:1,h:1,c:"#444",a:.6},{x:0,y:5,w:2,h:1,c:"#888",a:.4},{x:10,y:5,w:2,h:1,c:"#888",a:.4},{x:0,y:6,w:2,h:1,c:"#888",a:.3},{x:10,y:6,w:2,h:1,c:"#888",a:.3}]},up:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#555"},{x:2,y:0,w:8,h:1,c:"#555"},{x:0,y:-2,w:3,h:2,c:"#555"},{x:1,y:-3,w:2,h:1,c:"#555"},{x:9,y:-2,w:3,h:2,c:"#555"},{x:9,y:-3,w:2,h:1,c:"#555"},{x:5,y:1,w:2,h:5,c:"#4A4A4A",a:.3},{x:9,y:8,w:2,h:2,c:"#555"},{x:10,y:7,w:1,h:1,c:"#555"}]},left:{name:"accessory",pixels:[{x:1,y:1,w:9,h:8,c:"#555"},{x:2,y:0,w:7,h:1,c:"#555"},{x:2,y:-2,w:3,h:2,c:"#555"},{x:3,y:-3,w:2,h:1,c:"#555"},{x:3,y:-1,w:1,h:1,c:"#FFB0C0",a:.7},{x:2,y:3,w:3,h:3,c:"#222"},{x:3,y:3,w:1,h:2,c:"#4FC3F7",a:.8},{x:3,y:4,w:1,h:1,c:"#111"},{x:0,y:5,w:3,h:2,c:"#555"},{x:0,y:5,w:2,h:1,c:"#FFB0C0"},{x:-1,y:5,w:2,h:1,c:"#888",a:.4},{x:-1,y:6,w:2,h:1,c:"#888",a:.3}]}});pt("bear-face","Bear Face",{down:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#8B6914"},{x:2,y:-1,w:8,h:1,c:"#8B6914"},{x:0,y:-1,w:3,h:3,c:"#8B6914"},{x:9,y:-1,w:3,h:3,c:"#8B6914"},{x:1,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:10,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:3,y:5,w:6,h:4,c:"#C4A24A",a:.7},{x:3,y:3,w:2,h:2,c:"#111"},{x:7,y:3,w:2,h:2,c:"#111"},{x:3,y:3,w:1,h:1,c:"#FFF",a:.3},{x:7,y:3,w:1,h:1,c:"#FFF",a:.3},{x:5,y:5,w:2,h:1,c:"#222"},{x:5,y:7,w:2,h:1,c:"#6B4F10",a:.5}]},up:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#8B6914"},{x:2,y:-1,w:8,h:1,c:"#8B6914"},{x:0,y:-1,w:3,h:3,c:"#8B6914"},{x:9,y:-1,w:3,h:3,c:"#8B6914"},{x:1,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:10,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:5,y:1,w:2,h:5,c:"#7A5B10",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:0,w:9,h:9,c:"#8B6914"},{x:2,y:-1,w:7,h:1,c:"#8B6914"},{x:0,y:-1,w:3,h:3,c:"#8B6914"},{x:0,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:0,y:4,w:3,h:4,c:"#C4A24A",a:.7},{x:3,y:3,w:2,h:2,c:"#111"},{x:3,y:3,w:1,h:1,c:"#FFF",a:.3},{x:1,y:5,w:2,h:1,c:"#222"}]}});pt("panda-face","Panda Face",{down:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#F5F5F5"},{x:2,y:-1,w:8,h:1,c:"#F5F5F5"},{x:0,y:-2,w:3,h:3,c:"#222"},{x:9,y:-2,w:3,h:3,c:"#222"},{x:2,y:2,w:3,h:4,c:"#222"},{x:7,y:2,w:3,h:4,c:"#222"},{x:3,y:3,w:1,h:2,c:"#FFF"},{x:8,y:3,w:1,h:2,c:"#FFF"},{x:3,y:4,w:1,h:1,c:"#111"},{x:8,y:4,w:1,h:1,c:"#111"},{x:5,y:6,w:2,h:1,c:"#222"},{x:5,y:7,w:1,h:1,c:"#CCC",a:.4},{x:6,y:7,w:1,h:1,c:"#CCC",a:.4}]},up:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#F5F5F5"},{x:2,y:-1,w:8,h:1,c:"#F5F5F5"},{x:0,y:-2,w:3,h:3,c:"#222"},{x:9,y:-2,w:3,h:3,c:"#222"},{x:5,y:1,w:2,h:5,c:"#EEE",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:0,w:9,h:9,c:"#F5F5F5"},{x:2,y:-1,w:7,h:1,c:"#F5F5F5"},{x:0,y:-2,w:3,h:3,c:"#222"},{x:2,y:2,w:3,h:4,c:"#222"},{x:3,y:3,w:1,h:2,c:"#FFF"},{x:3,y:4,w:1,h:1,c:"#111"},{x:0,y:5,w:3,h:2,c:"#F5F5F5"},{x:1,y:6,w:1,h:1,c:"#222"}]}});pt("frog-face","Frog Face",{down:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#4CAF50"},{x:2,y:0,w:8,h:1,c:"#4CAF50"},{x:1,y:-2,w:4,h:3,c:"#4CAF50"},{x:7,y:-2,w:4,h:3,c:"#4CAF50"},{x:2,y:-1,w:2,h:2,c:"#FFF"},{x:8,y:-1,w:2,h:2,c:"#FFF"},{x:3,y:0,w:1,h:1,c:"#111"},{x:9,y:0,w:1,h:1,c:"#111"},{x:3,y:5,w:6,h:3,c:"#81C784",a:.5},{x:2,y:7,w:8,h:1,c:"#388E3C",a:.6},{x:4,y:4,w:1,h:1,c:"#388E3C",a:.5},{x:7,y:4,w:1,h:1,c:"#388E3C",a:.5},{x:1,y:5,w:2,h:1,c:"#FF8A80",a:.25},{x:9,y:5,w:2,h:1,c:"#FF8A80",a:.25}]},up:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#4CAF50"},{x:2,y:0,w:8,h:1,c:"#4CAF50"},{x:1,y:-2,w:4,h:2,c:"#4CAF50"},{x:7,y:-2,w:4,h:2,c:"#4CAF50"},{x:5,y:2,w:2,h:4,c:"#388E3C",a:.2}]},left:{name:"accessory",pixels:[{x:1,y:1,w:9,h:8,c:"#4CAF50"},{x:2,y:0,w:7,h:1,c:"#4CAF50"},{x:0,y:-2,w:4,h:3,c:"#4CAF50"},{x:1,y:-1,w:2,h:2,c:"#FFF"},{x:2,y:0,w:1,h:1,c:"#111"},{x:0,y:5,w:3,h:3,c:"#81C784",a:.5},{x:0,y:7,w:8,h:1,c:"#388E3C",a:.6},{x:1,y:5,w:1,h:1,c:"#FF8A80",a:.25}]}});pt("rabbit-face","Rabbit Face",{down:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#F5F5F5"},{x:2,y:0,w:8,h:1,c:"#F5F5F5"},{x:2,y:-6,w:3,h:6,c:"#F5F5F5"},{x:7,y:-6,w:3,h:6,c:"#F5F5F5"},{x:3,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:8,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:2,y:3,w:3,h:3,c:"#E57373",a:.7},{x:7,y:3,w:3,h:3,c:"#E57373",a:.7},{x:3,y:3,w:1,h:1,c:"#FFF",a:.4},{x:8,y:3,w:1,h:1,c:"#FFF",a:.4},{x:5,y:5,w:2,h:1,c:"#FFB0C0"},{x:5,y:6,w:1,h:1,c:"#DDD",a:.4},{x:6,y:6,w:1,h:1,c:"#DDD",a:.4},{x:0,y:4,w:2,h:3,c:"#F5F5F5",a:.6},{x:10,y:4,w:2,h:3,c:"#F5F5F5",a:.6}]},up:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#F5F5F5"},{x:2,y:0,w:8,h:1,c:"#F5F5F5"},{x:2,y:-6,w:3,h:6,c:"#F5F5F5"},{x:7,y:-6,w:3,h:6,c:"#F5F5F5"},{x:3,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:8,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:5,y:8,w:3,h:2,c:"#FFF"}]},left:{name:"accessory",pixels:[{x:1,y:1,w:9,h:8,c:"#F5F5F5"},{x:2,y:0,w:7,h:1,c:"#F5F5F5"},{x:3,y:-6,w:3,h:6,c:"#F5F5F5"},{x:4,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:2,y:3,w:3,h:3,c:"#E57373",a:.7},{x:3,y:3,w:1,h:1,c:"#FFF",a:.4},{x:0,y:4,w:3,h:3,c:"#F5F5F5"},{x:1,y:5,w:1,h:1,c:"#FFB0C0"},{x:0,y:4,w:2,h:3,c:"#F5F5F5",a:.6}]}});pt("dog-face","Dog Face",{down:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#D2A25C"},{x:2,y:-1,w:8,h:1,c:"#D2A25C"},{x:-1,y:1,w:3,h:6,c:"#A67B3D"},{x:10,y:1,w:3,h:6,c:"#A67B3D"},{x:3,y:5,w:6,h:4,c:"#F5E6D0",a:.8},{x:3,y:2,w:2,h:3,c:"#3E2723"},{x:7,y:2,w:2,h:3,c:"#3E2723"},{x:3,y:2,w:1,h:1,c:"#FFF",a:.4},{x:7,y:2,w:1,h:1,c:"#FFF",a:.4},{x:5,y:5,w:2,h:2,c:"#222"},{x:5,y:7,w:2,h:2,c:"#FF6B8A",a:.8},{x:5,y:7,w:1,h:1,c:"#FF8A9E",a:.4}]},up:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#D2A25C"},{x:2,y:-1,w:8,h:1,c:"#D2A25C"},{x:-1,y:1,w:3,h:6,c:"#A67B3D"},{x:10,y:1,w:3,h:6,c:"#A67B3D"},{x:5,y:0,w:2,h:6,c:"#B8883C",a:.3},{x:2,y:8,w:8,h:1,c:"#A67B3D",a:.5}]},left:{name:"accessory",pixels:[{x:1,y:0,w:9,h:9,c:"#D2A25C"},{x:2,y:-1,w:7,h:1,c:"#D2A25C"},{x:-1,y:1,w:3,h:6,c:"#A67B3D"},{x:-1,y:4,w:3,h:4,c:"#D2A25C"},{x:-1,y:5,w:2,h:3,c:"#F5E6D0",a:.8},{x:3,y:2,w:2,h:3,c:"#3E2723"},{x:3,y:2,w:1,h:1,c:"#FFF",a:.4},{x:0,y:5,w:2,h:1,c:"#222"},{x:0,y:7,w:2,h:1,c:"#FF6B8A",a:.7}]}});pt("star-glasses","Star Glasses",{down:{name:"accessory",pixels:[{x:1,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:2,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:2,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:7,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:8,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:8,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:5,y:4,w:2,h:1,c:"#FF4081",a:.4}]},up:{name:"accessory",pixels:[{x:0,y:3,w:2,h:1,c:"#FF4081",a:.3},{x:10,y:3,w:2,h:1,c:"#FF4081",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:2,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:2,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:5,y:4,w:6,h:1,c:"#FF4081",a:.3}]}});function rs({r:t,g:l,b:a}){return`#${(t<<16|l<<8|a).toString(16).padStart(6,"0")}`}function rc(t,l){const a=t.r-l.r,i=t.g-l.g,o=t.b-l.b;return a*a+i*i+o*o}function wS(t,l){const a=[];a.push(t[Math.floor(Math.random()*t.length)]);for(let i=1;i<l;i++){const o=t.map(m=>{let p=1/0;for(const h of a)p=Math.min(p,rc(m,h));return p}),u=o.reduce((m,p)=>m+p,0);let f=Math.random()*u;for(let m=0;m<t.length;m++)if(f-=o[m],f<=0){a.push(t[m]);break}a.length<=i&&a.push(t[Math.floor(Math.random()*t.length)])}return a}function kS(t,l,a=20){if(t.length===0)return[];const i=wS(t,l);for(let u=0;u<a;u++){const f=Array.from({length:l},()=>[]);for(const p of t){let h=1/0,g=0;for(let y=0;y<l;y++){const b=rc(p,i[y]);b<h&&(h=b,g=y)}f[g].push(p)}let m=!0;for(let p=0;p<l;p++){if(f[p].length===0)continue;const h={r:0,g:0,b:0};for(const b of f[p])h.r+=b.r,h.g+=b.g,h.b+=b.b;const g=f[p].length,y={r:Math.round(h.r/g),g:Math.round(h.g/g),b:Math.round(h.b/g)};rc(y,i[p])>1&&(m=!1),i[p]=y}if(m)break}const o=new Array(l).fill(0);for(const u of t){let f=1/0,m=0;for(let p=0;p<l;p++){const h=rc(u,i[p]);h<f&&(f=h,m=p)}o[m]++}return i.map((u,f)=>({c:u,count:o[f]})).sort((u,f)=>f.count-u.count).map(u=>u.c)}function SS(t,l=1e4){const a=document.createElement("canvas"),i=t instanceof HTMLImageElement?t.naturalWidth:t.width,o=t instanceof HTMLImageElement?t.naturalHeight:t.height;a.width=i,a.height=o;const u=a.getContext("2d");u.drawImage(t,0,0);const f=u.getImageData(0,0,i,o).data,m=i*o,p=Math.max(1,Math.floor(m/l)),h=[];for(let g=0;g<m;g+=p){const y=g*4;f[y+3]<128||h.push({r:f[y],g:f[y+1],b:f[y+2]})}return h}function J1(t){return .299*t.r+.587*t.g+.114*t.b}function P1(t){const l=Math.max(t.r,t.g,t.b),a=Math.min(t.r,t.g,t.b);return l===0?0:(l-a)/l*255}function jS(t,l=8){const a=SS(t),i=kS(a,l);if(i.length<5)return{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121"};const o=[...i].sort((y,b)=>J1(b)-J1(y)),u=[...i].sort((y,b)=>P1(b)-P1(y)),f=o[0],m=o[o.length-1],p=u[0],h=o[o.length-2],g=o[o.length-1];return{skinColor:rs(f),hairColor:rs(m),shirtColor:rs(p),pantsColor:rs(h),shoeColor:rs(g)}}const ES=[{x:1,y:19,w:10,h:2,c:"#100A06",a:.15},{x:2,y:15,w:3,h:4,c:"$pants"},{x:7,y:15,w:3,h:4,c:"$pants"},{x:2,y:19,w:3,h:2,c:"$shoes"},{x:7,y:19,w:3,h:2,c:"$shoes"},{x:2,y:19,w:3,h:1,c:"lighten($shoes, 20)",a:.4},{x:7,y:19,w:3,h:1,c:"lighten($shoes, 20)",a:.4}],CS=[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:4,y:10,w:4,h:2,c:"darken($shirt, 25)",a:.2},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}],NS=[{x:4,y:8,w:4,h:3,c:"$skin"},{x:1,y:1,w:10,h:8,c:"$skin"},{x:3,y:4,w:2,h:2,c:"#1A1A2E"},{x:7,y:4,w:2,h:2,c:"#1A1A2E"},{x:3,y:4,w:1,h:1,c:"#FFF",a:.35},{x:7,y:4,w:1,h:1,c:"#FFF",a:.35},{x:5,y:7,w:2,h:1,c:"darken($skin, 25)",a:.4},{x:0,y:4,w:1,h:1,c:"$skin"},{x:11,y:4,w:1,h:1,c:"$skin"}],AS=[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:10,y:1,w:2,h:3,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:2,y:2,w:8,h:1,c:"darken($hair, 20)",a:.2}];function DS(){return{width:12,height:22,layers:[{name:"lower",pixels:ES},{name:"torso",pixels:CS},{name:"head",pixels:NS},{name:"hair",pixels:AS},{name:"accessory",pixels:[]}]}}const TS=["cto","cbo","pm","engineer","designer","qa","data-analyst","default"];for(const t of TS)I0(`mini:${t}`,DS());const zS=[{x:1,y:10,w:10,h:8,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:7,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:7,c:"darken($shirt, 25)",a:.25},{x:4,y:10,w:4,h:2,c:"darken($shirt, 25)",a:.2},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"}],MS=[{x:4,y:8,w:4,h:3,c:"$skin"},{x:1,y:1,w:10,h:8,c:"$skin"},{x:3,y:4,w:2,h:2,c:"#1A1A2E"},{x:7,y:4,w:2,h:2,c:"#1A1A2E"},{x:3,y:4,w:1,h:1,c:"#FFF",a:.35},{x:7,y:4,w:1,h:1,c:"#FFF",a:.35},{x:5,y:7,w:2,h:1,c:"darken($skin, 25)",a:.4},{x:0,y:4,w:1,h:1,c:"$skin"},{x:11,y:4,w:1,h:1,c:"$skin"}],_S=[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:10,y:1,w:2,h:3,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:2,y:2,w:8,h:1,c:"darken($hair, 20)",a:.2}];function FS(){return{width:12,height:22,layers:[{name:"torso",pixels:zS},{name:"head",pixels:MS},{name:"hair",pixels:_S},{name:"accessory",pixels:[]}]}}I0("mini-seated:default",FS());const RS={canvasWidth:160,canvasHeight:80,scale:2,pixels:[{x:0,y:0,w:80,h:40,c:"#1e2030"},{x:10,y:2,w:10,h:6,c:"#78889c"},{x:10,y:2,w:10,h:1,c:"#8899ad"},{x:24,y:0,w:10,h:6,c:"#78889c"},{x:24,y:0,w:10,h:1,c:"#8899ad"},{x:38,y:2,w:10,h:6,c:"#78889c"},{x:38,y:2,w:10,h:1,c:"#8899ad"},{x:54,y:2,w:10,h:6,c:"#78889c"},{x:54,y:2,w:10,h:1,c:"#8899ad"},{x:11,y:7,w:2,h:2,c:"#2a2a2a"},{x:17,y:7,w:2,h:2,c:"#2a2a2a"},{x:25,y:5,w:2,h:2,c:"#2a2a2a"},{x:31,y:5,w:2,h:2,c:"#2a2a2a"},{x:39,y:7,w:2,h:2,c:"#2a2a2a"},{x:45,y:7,w:2,h:2,c:"#2a2a2a"},{x:55,y:7,w:2,h:2,c:"#2a2a2a"},{x:61,y:7,w:2,h:2,c:"#2a2a2a"},{x:8,y:8,w:64,h:24,c:"#6b5b4b"},{x:4,y:10,w:72,h:20,c:"#7d6d5d"},{x:2,y:12,w:76,h:16,c:"#7d6d5d"},{x:2,y:12,w:76,h:2,c:"#8b7b6b"},{x:2,y:26,w:76,h:2,c:"#4b3b2b"},{x:2,y:28,w:76,h:3,c:"#4b3b2b"},{x:4,y:28,w:72,h:1,c:"#5b4b3b"},{x:6,y:30,w:3,h:2,c:"#3a2a1a"},{x:71,y:30,w:3,h:2,c:"#3a2a1a"},{x:18,y:14,w:44,h:12,c:"#6b5b4b",a:.5},{x:28,y:14,w:14,h:8,c:"#1a1a2e"},{x:29,y:15,w:12,h:6,c:"#1565C0",a:.5},{x:30,y:16,w:8,h:1,c:"#60A5FA",a:.45},{x:30,y:18,w:5,h:1,c:"#60A5FA",a:.3},{x:58,y:16,w:5,h:5,c:"#795548"},{x:59,y:17,w:3,h:3,c:"#A67C52"},{x:63,y:18,w:2,h:2,c:"#795548"},{x:10,y:16,w:10,h:8,c:"#FFEE58",a:.7},{x:11,y:17,w:8,h:1,c:"#9E9E9E",a:.5},{x:11,y:19,w:8,h:1,c:"#9E9E9E",a:.5},{x:11,y:21,w:6,h:1,c:"#9E9E9E",a:.5},{x:10,y:32,w:10,h:6,c:"#78889c"},{x:10,y:32,w:10,h:1,c:"#8899ad"},{x:24,y:34,w:10,h:6,c:"#78889c"},{x:24,y:34,w:10,h:1,c:"#8899ad"},{x:38,y:32,w:10,h:6,c:"#78889c"},{x:38,y:32,w:10,h:1,c:"#8899ad"},{x:54,y:32,w:10,h:6,c:"#78889c"},{x:54,y:32,w:10,h:1,c:"#8899ad"},{x:11,y:37,w:2,h:2,c:"#2a2a2a"},{x:17,y:37,w:2,h:2,c:"#2a2a2a"},{x:25,y:39,w:2,h:2,c:"#2a2a2a"},{x:31,y:39,w:2,h:2,c:"#2a2a2a"},{x:39,y:37,w:2,h:2,c:"#2a2a2a"},{x:45,y:37,w:2,h:2,c:"#2a2a2a"},{x:55,y:37,w:2,h:2,c:"#2a2a2a"},{x:61,y:37,w:2,h:2,c:"#2a2a2a"}]},OS={canvasWidth:128,canvasHeight:96,scale:2,pixels:[{x:0,y:0,w:64,h:48,c:"#4b3b2b"},{x:3,y:3,w:58,h:42,c:"#8B7355"},{x:4,y:4,w:10,h:10,c:"#A0845C",a:.5},{x:20,y:8,w:8,h:8,c:"#A0845C",a:.4},{x:40,y:6,w:12,h:6,c:"#A0845C",a:.3},{x:8,y:30,w:14,h:10,c:"#A0845C",a:.25},{x:44,y:32,w:10,h:8,c:"#A0845C",a:.3},{x:6,y:8,w:18,h:12,c:"#FFEE58"},{x:5,y:7,w:3,h:3,c:"#EF5350"},{x:6,y:7,w:2,h:2,c:"#C62828"},{x:8,y:10,w:14,h:1,c:"#9E9E9E"},{x:8,y:12,w:12,h:1,c:"#9E9E9E"},{x:8,y:14,w:10,h:1,c:"#9E9E9E"},{x:28,y:6,w:16,h:14,c:"#B3E5FC"},{x:35,y:5,w:3,h:3,c:"#42A5F5"},{x:36,y:5,w:2,h:2,c:"#1565C0"},{x:30,y:9,w:12,h:1,c:"#9E9E9E"},{x:30,y:11,w:10,h:1,c:"#9E9E9E"},{x:30,y:13,w:11,h:1,c:"#9E9E9E"},{x:8,y:24,w:16,h:14,c:"#C8E6C9"},{x:15,y:23,w:3,h:3,c:"#66BB6A"},{x:16,y:23,w:2,h:2,c:"#388E3C"},{x:10,y:27,w:12,h:1,c:"#9E9E9E"},{x:10,y:29,w:8,h:1,c:"#9E9E9E"},{x:10,y:31,w:10,h:1,c:"#9E9E9E"},{x:28,y:24,w:28,h:16,c:"#FFCDD2"},{x:43,y:23,w:3,h:3,c:"#EF5350"},{x:44,y:23,w:2,h:2,c:"#B71C1C"},{x:32,y:27,w:24,h:1,c:"#9E9E9E"},{x:32,y:29,w:20,h:1,c:"#9E9E9E"},{x:32,y:31,w:22,h:1,c:"#9E9E9E"},{x:32,y:33,w:15,h:1,c:"#9E9E9E"},{x:0,y:0,w:64,h:3,c:"#5a4a3a"},{x:0,y:45,w:64,h:3,c:"#3a2a1a"}]},BS={canvasWidth:128,canvasHeight:96,scale:2,pixels:[{x:2,y:0,w:60,h:48,c:"#3b1f0a"},{x:4,y:2,w:56,h:44,c:"#5a3310"},{x:4,y:13,w:56,h:2,c:"#2d1508"},{x:4,y:27,w:56,h:2,c:"#2d1508"},{x:4,y:41,w:56,h:2,c:"#2d1508"},{x:5,y:3,w:4,h:10,c:"#2563EB"},{x:5,y:3,w:4,h:2,c:"#1D4ED8"},{x:10,y:4,w:3,h:9,c:"#DC2626"},{x:10,y:4,w:3,h:2,c:"#B91C1C"},{x:14,y:3,w:5,h:10,c:"#16A34A"},{x:14,y:3,w:5,h:2,c:"#15803D"},{x:20,y:4,w:3,h:9,c:"#9333EA"},{x:20,y:4,w:3,h:2,c:"#7E22CE"},{x:24,y:3,w:4,h:10,c:"#D97706"},{x:24,y:3,w:4,h:2,c:"#B45309"},{x:29,y:4,w:3,h:9,c:"#0891B2"},{x:29,y:4,w:3,h:2,c:"#0E7490"},{x:33,y:3,w:5,h:10,c:"#BE123C"},{x:33,y:3,w:5,h:2,c:"#9F1239"},{x:39,y:4,w:4,h:9,c:"#4F46E5"},{x:39,y:4,w:4,h:2,c:"#3730A3"},{x:44,y:3,w:3,h:10,c:"#065F46"},{x:44,y:3,w:3,h:2,c:"#064E3B"},{x:48,y:4,w:4,h:9,c:"#92400E"},{x:48,y:4,w:4,h:2,c:"#78350F"},{x:53,y:3,w:5,h:10,c:"#1E3A5F"},{x:53,y:3,w:5,h:2,c:"#1e3060"},{x:6,y:6,w:2,h:1,c:"#BFDBFE",a:.7},{x:11,y:7,w:1,h:1,c:"#FCA5A5",a:.7},{x:16,y:6,w:3,h:1,c:"#BBF7D0",a:.7},{x:21,y:7,w:1,h:1,c:"#D8B4FE",a:.7},{x:25,y:6,w:2,h:1,c:"#FDE68A",a:.7},{x:5,y:16,w:5,h:11,c:"#0F766E"},{x:5,y:16,w:5,h:2,c:"#0D6056"},{x:11,y:17,w:3,h:10,c:"#C2410C"},{x:11,y:17,w:3,h:2,c:"#9A3412"},{x:15,y:16,w:4,h:11,c:"#7C3AED"},{x:15,y:16,w:4,h:2,c:"#6D28D9"},{x:20,y:17,w:3,h:10,c:"#1D4ED8"},{x:20,y:17,w:3,h:2,c:"#1E40AF"},{x:24,y:16,w:5,h:11,c:"#166534"},{x:24,y:16,w:5,h:2,c:"#14532D"},{x:30,y:17,w:4,h:10,c:"#991B1B"},{x:30,y:17,w:4,h:2,c:"#7F1D1D"},{x:35,y:16,w:3,h:11,c:"#854D0E"},{x:35,y:16,w:3,h:2,c:"#713F12"},{x:39,y:17,w:4,h:10,c:"#1E40AF"},{x:39,y:17,w:4,h:2,c:"#1E3A8A"},{x:44,y:16,w:5,h:11,c:"#065F46"},{x:44,y:16,w:5,h:2,c:"#064E3B"},{x:50,y:17,w:3,h:10,c:"#831843"},{x:50,y:17,w:3,h:2,c:"#6B21A8"},{x:54,y:16,w:5,h:11,c:"#374151"},{x:54,y:16,w:5,h:2,c:"#1F2937"},{x:5,y:30,w:4,h:11,c:"#0E7490"},{x:5,y:30,w:4,h:2,c:"#0C6B7E"},{x:10,y:31,w:3,h:10,c:"#B45309"},{x:10,y:31,w:3,h:2,c:"#92400E"},{x:14,y:30,w:5,h:11,c:"#6D28D9"},{x:14,y:30,w:5,h:2,c:"#5B21B6"},{x:20,y:30,w:7,h:8,c:"#1e293b"},{x:22,y:32,w:3,h:3,c:"#3b82f6",a:.9},{x:22,y:32,w:1,h:3,c:"#60a5fa",a:.6},{x:28,y:31,w:4,h:10,c:"#DC2626"},{x:28,y:31,w:4,h:2,c:"#B91C1C"},{x:33,y:30,w:3,h:11,c:"#065F46"},{x:33,y:30,w:3,h:2,c:"#064E3B"},{x:37,y:31,w:4,h:10,c:"#1D4ED8"},{x:37,y:31,w:4,h:2,c:"#1E40AF"},{x:42,y:35,w:6,h:6,c:"#92400E"},{x:43,y:30,w:4,h:6,c:"#16a34a",a:.8},{x:43,y:29,w:2,h:3,c:"#15803d",a:.7},{x:45,y:28,w:2,h:4,c:"#16a34a",a:.6},{x:49,y:30,w:3,h:11,c:"#7C3AED"},{x:49,y:30,w:3,h:2,c:"#6D28D9"},{x:53,y:31,w:5,h:10,c:"#B45309"},{x:53,y:31,w:5,h:2,c:"#92400E"},{x:2,y:46,w:60,h:2,c:"#1a0a03"},{x:2,y:0,w:60,h:2,c:"#4a2510"},{x:2,y:0,w:2,h:48,c:"#2d1508"},{x:60,y:0,w:2,h:48,c:"#2d1508"}]},$S={canvasWidth:96,canvasHeight:120,scale:2,pixels:[{x:2,y:0,w:44,h:60,c:"#546E7A"},{x:2,y:0,w:44,h:3,c:"#78909C"},{x:2,y:57,w:44,h:3,c:"#37474F"},{x:2,y:0,w:2,h:60,c:"#455A64"},{x:44,y:0,w:2,h:60,c:"#37474F"},{x:5,y:4,w:38,h:3,c:"#FFD54F",a:.5},{x:6,y:1,w:2,h:4,c:"#FFFDE7"},{x:10,y:0,w:2,h:5,c:"#FFF9C4"},{x:14,y:1,w:2,h:3,c:"#FFFDE7"},{x:18,y:0,w:2,h:4,c:"#FFF8E1"},{x:5,y:5,w:38,h:16,c:"#607D8B"},{x:5,y:5,w:38,h:2,c:"#78909C"},{x:15,y:12,w:18,h:4,c:"#37474F"},{x:22,y:11,w:4,h:6,c:"#455A64"},{x:23,y:13,w:2,h:2,c:"#B0BEC5"},{x:7,y:14,w:8,h:5,c:"#B0BEC5"},{x:8,y:15,w:6,h:1,c:"#607D8B"},{x:8,y:17,w:5,h:1,c:"#607D8B"},{x:5,y:23,w:38,h:16,c:"#607D8B"},{x:5,y:23,w:38,h:2,c:"#78909C"},{x:15,y:30,w:18,h:4,c:"#37474F"},{x:22,y:29,w:4,h:6,c:"#455A64"},{x:23,y:31,w:2,h:2,c:"#B0BEC5"},{x:7,y:32,w:8,h:5,c:"#B0BEC5"},{x:8,y:33,w:6,h:1,c:"#607D8B"},{x:8,y:35,w:4,h:1,c:"#607D8B"},{x:5,y:41,w:38,h:16,c:"#607D8B"},{x:5,y:41,w:38,h:2,c:"#78909C"},{x:15,y:48,w:18,h:4,c:"#37474F"},{x:22,y:47,w:4,h:6,c:"#455A64"},{x:23,y:49,w:2,h:2,c:"#B0BEC5"},{x:7,y:50,w:8,h:5,c:"#B0BEC5"},{x:8,y:51,w:6,h:1,c:"#607D8B"},{x:8,y:53,w:3,h:1,c:"#607D8B"}]};Ec("meeting",RS);Ec("bulletin",OS);Ec("decision",$S);Ec("knowledge",BS);const id=16,sd=24,LS=60,HS={cbo:0,cto:8,pm:15,engineer:22,designer:5,qa:12};function G0(t,l){if(!t)return t;let a=t;if(l!=null&&l.hairStyle){const i=yS(l.hairStyle);i&&(a=hS(a,i.layer))}if(l!=null&&l.outfitStyle){const i=gS(l.outfitStyle);i&&(a=Bd(a,"torso",i.layer,1))}if(l!=null&&l.accessory&&l.accessory!=="none"){const i=bS(l.accessory);i&&(a=Bd(a,"accessory",i.layer))}return a}function Cc({roleId:t,className:l,appearance:a,scale:i}){const o=j.useRef(null),u=j.useRef(0),f=j.useRef(0),m=j.useRef(a);m.current=a;const p=i??4,h=id*p,g=sd*p,y=j.useMemo(()=>{const b=$d(`mini:${t}`)??$d("mini:default");return G0(b,a)},[t,a==null?void 0:a.hairStyle,a==null?void 0:a.outfitStyle,a==null?void 0:a.accessory]);return j.useEffect(()=>{const b=o.current;if(!b)return;const v=b.getContext("2d");if(!v)return;const S=HS[t]??0,k=()=>{f.current++;const C=m.current;if(!C||!y){u.current=requestAnimationFrame(k);return}const M=(f.current+S)%LS<30?1:0;v.clearRect(0,0,id,sd),v.save(),v.translate(2,1),xS(v,y,M,C,1),v.restore(),u.current=requestAnimationFrame(k)};return u.current=requestAnimationFrame(k),()=>cancelAnimationFrame(u.current)},[t,y]),c.jsx("canvas",{ref:o,width:id,height:sd,className:l,style:{imageRendering:"pixelated",display:"block",width:h,height:g}})}const US={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"},od={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},IS={cto:8,cbo:7,pm:6,engineer:5,designer:5,qa:4,"data-analyst":4},YS={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},qS=500,ey=360,ty=700,XS=t=>`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`;function VS({role:t,allRoles:l,recentActivity:a,onClose:i,onFireRole:o,terminalWidth:u=0,activeJobId:f,activeTask:m,isWorking:p,jobStartedAt:h,onStopJob:g,sessions:y,streamingSessionId:b,onCreateSessionSilent:v,onSendMessage:S,onFocusTerminal:k,onCustomize:C,onUpdateRole:E,appearance:M,relationships:$}){var ye,_e;const[O,B]=j.useState(qS),[T,Y]=j.useState(!1),V=j.useRef(0),te=j.useRef(0),[D,I]=j.useState(!1),[L,ee]=j.useState(!1),[ae,X]=j.useState(!1),[U,Q]=j.useState(!1),[ie,ve]=j.useState("talk"),[z,_]=j.useState(!1),[P,A]=j.useState(""),[pe,Se]=j.useState(!1),Ce=j.useRef(null),{events:Fe,status:Ye}=Fy(f??null),[se,K]=j.useState(0);j.useEffect(()=>{if(!p||!h){K(0);return}const me=new Date(h).getTime(),be=()=>K(Math.floor((Date.now()-me)/1e3));be();const ot=setInterval(be,1e3);return()=>clearInterval(ot)},[p,h]);const ue=u>0,we=ue?u:0,ne=ue?Math.max(ey,window.innerWidth-u-100):ty,xe=Math.min(O,ne),je=j.useCallback(me=>{me.preventDefault(),V.current=me.clientX,te.current=xe,Y(!0);const be=bt=>{const Ze=V.current-bt.clientX,de=Math.min(ty,Math.max(ey,te.current+Ze));B(de)},ot=()=>{Y(!1),document.removeEventListener("mousemove",be),document.removeEventListener("mouseup",ot)};document.addEventListener("mousemove",be),document.addEventListener("mouseup",ot)},[xe]),Ae=j.useRef(null),Re=t?y.find(me=>me.roleId===t.id):null,Ve=me=>{if(!t)return;const be=p?"talk":ie;Re?(S(Re.id,me,be),k(t.id)):(Ae.current={content:me,mode:be},v(t.id))};j.useEffect(()=>{if(Re&&Ae.current){const{content:me,mode:be}=Ae.current;Ae.current=null,S(Re.id,me,be),t&&k(t.id)}},[Re==null?void 0:Re.id]);const jt=(()=>{if(!Fe.length)return null;const me=[];let be=0,ot=0,bt=0;for(const Ze of Fe)if(Ze.type==="thinking")be++;else if(Ze.type==="text")ot++;else if(Ze.type==="tool:start"){const de=String(Ze.data.name??"");me.includes(de)||me.push(de)}else Ze.type==="dispatch:start"&&bt++;return{tools:me,thinkCount:be,textCount:ot,dispatchCount:bt,total:Fe.length}})(),$t=m||(()=>{if(!Re)return null;const me=Re.messages;for(let be=me.length-1;be>=0;be--)if(me[be].from==="ceo")return me[be].content;return null})(),ct=(()=>{if(!Re)return null;const me=Re.messages;for(let be=me.length-1;be>=0;be--)if(me[be].from==="role"&&me[be].content)return me[be].content;return null})();if(!t)return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:we},onClick:i}),c.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px]",style:{right:we,width:xe,background:"var(--terminal-bg)",borderLeftColor:"var(--pixel-border)"},children:c.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading role..."})})]});const Dt=od[t.id]??"#666",on=US[t.id]??"👤",gt=l.filter(me=>me.reportsTo===t.id),Pt=Re&&b===Re.id,re=t.name||YS[t.id]||t.id;return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:we},onClick:i}),c.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${T?"resizing":""}`,style:{borderLeftColor:Dt,right:we,width:xe,background:"var(--terminal-bg)"},children:[c.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${T?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:je}),c.jsxs("div",{className:"relative shrink-0 overflow-hidden",style:{background:`linear-gradient(135deg, ${Dt}ee, ${Dt}99)`},children:[c.jsx("div",{className:"absolute inset-0 opacity-[0.06]",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 8px, white 8px, white 9px)"}}),c.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-1.5 z-10",children:[C&&c.jsx("button",{onClick:()=>C(t.id),className:"w-7 h-7 rounded-full bg-black/20 text-white flex items-center justify-center text-sm hover:bg-black/30 cursor-pointer backdrop-blur-sm",title:"Customize",children:"🎨"}),c.jsx("button",{onClick:i,className:"w-7 h-7 rounded-full bg-black/20 text-white flex items-center justify-center text-lg hover:bg-black/30 cursor-pointer backdrop-blur-sm",children:"×"})]}),c.jsxs("div",{className:"relative flex items-end gap-4 px-4 pt-4 pb-3",children:[c.jsx("div",{className:"shrink-0 relative",style:{marginBottom:-2},children:c.jsx("div",{className:"rounded-lg p-1",style:{background:"rgba(0,0,0,0.2)"},children:c.jsx(Cc,{roleId:t.id,appearance:M,scale:8})})}),c.jsxs("div",{className:"flex-1 min-w-0 text-white pb-1",children:[c.jsxs("div",{className:"text-lg font-bold flex items-center gap-2",style:{fontFamily:"var(--pixel-font)"},children:[on," ",t.id.toUpperCase(),p&&c.jsx("span",{className:"text-[9px] font-semibold px-2 py-0.5 rounded-full animate-pulse",style:{background:"rgba(251,191,36,0.25)",color:"#fde68a"},children:"WORKING"})]}),z?c.jsxs("form",{className:"flex items-center gap-1.5 mt-0.5",onSubmit:async me=>{me.preventDefault();const be=P.trim();if(!be||be===re||!E){_(!1);return}Se(!0);try{await E(t.id,{name:be})}catch{}Se(!1),_(!1)},children:[c.jsx("input",{ref:Ce,value:P,onChange:me=>A(me.target.value),onKeyDown:me=>{me.key==="Escape"&&_(!1)},disabled:pe,autoFocus:!0,className:"bg-white/20 text-white text-xs rounded px-1.5 py-0.5 outline-none focus:bg-white/30 w-full",style:{fontFamily:"inherit"}}),c.jsx("button",{type:"submit",disabled:pe,className:"text-white/80 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✓"}),c.jsx("button",{type:"button",onClick:()=>_(!1),className:"text-white/60 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✕"})]}):c.jsxs("div",{className:"text-xs opacity-75 mt-0.5 group/name flex items-center gap-1 cursor-pointer hover:opacity-100 transition-opacity",onClick:()=>{E&&(A(re),_(!0))},title:E?"Click to edit name":void 0,children:[re,E&&c.jsx("span",{className:"opacity-0 group-hover/name:opacity-60 text-[10px]",children:"✎"})]})]})]}),c.jsxs("div",{className:"relative flex items-center gap-3 px-4 py-2 text-[10px] font-bold text-white/80",style:{background:"rgba(0,0,0,0.2)",fontFamily:"var(--pixel-font)"},children:[c.jsxs("span",{children:["Lv.",IS[t.id]??1]}),c.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),c.jsxs("span",{className:"flex items-center gap-1.5",children:[c.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:p?"var(--idle-amber)":"var(--active-green)"}}),p?"Working":"Idle"]}),c.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),c.jsx("span",{children:t.level}),t.reportsTo&&c.jsxs(c.Fragment,{children:[c.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),c.jsxs("span",{className:"opacity-60",children:["→"," ",t.reportsTo]})]})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:[p&&c.jsxs("div",{className:"px-4 py-3 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"var(--idle-amber)"}}),c.jsxs("span",{className:"text-xs font-semibold",style:{color:"var(--idle-amber)"},children:["Working",se>0?` · ${XS(se)}`:""]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{onClick:()=>k(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"}),f&&g&&c.jsx("button",{onClick:()=>g(f),className:"text-[10px] px-2 py-0.5 rounded cursor-pointer font-semibold transition-colors",style:{background:"rgba(239,68,68,0.15)",color:"#ef4444"},children:"Stop"})]})]}),$t&&c.jsx("div",{className:"text-xs truncate",style:{color:"var(--terminal-text-secondary)"},children:$t})]}),p&&f&&jt&&c.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[c.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Activity"}),c.jsx("button",{onClick:()=>k(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"View details ↗"})]}),c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[jt.thinkCount>0&&c.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(168,85,247,0.15)",color:"#c084fc"},children:[c.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:"#a855f7"}}),"thinking ×",jt.thinkCount]}),jt.tools.map(me=>c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa"},children:me},me)),jt.dispatchCount>0&&c.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(249,115,22,0.15)",color:"#fb923c"},children:["dispatch ×",jt.dispatchCount]}),jt.textCount>0&&c.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(34,197,94,0.15)",color:"#4ade80"},children:["output ×",jt.textCount]}),(Ye==="streaming"||Ye==="connecting")&&c.jsx("span",{className:"inline-block w-1.5 h-3 animate-pulse rounded-sm",style:{background:"var(--active-green)"}})]}),c.jsxs("div",{className:"text-[10px] mt-1",style:{color:"var(--terminal-text-muted)"},children:[jt.total," events"]})]}),p&&ct&&c.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[c.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Last Message"}),c.jsx("button",{onClick:()=>k(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"})]}),c.jsxs("div",{className:"rounded-lg p-2.5 text-xs leading-relaxed line-clamp-3 overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:[ct.slice(0,200),ct.length>200&&"..."]})]}),p&&c.jsx("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:c.jsx(ny,{onSend:Ve,disabled:!!Pt,placeholder:"Ask something...",color:Dt})}),!p&&c.jsxs("div",{className:"px-4 pt-4 pb-2",children:[c.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-secondary)"},children:"Latest"}),c.jsx(GS,{icon:on,roleId:t.id,roleName:re,color:Dt,text:a})]}),!p&&c.jsx("div",{className:"px-4 py-3",style:{borderBottom:"1px solid var(--terminal-border)"},children:c.jsxs("div",{className:"rounded-xl overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[ct&&c.jsxs("div",{className:"px-3 pt-2.5 pb-2 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--terminal-border)"},onClick:()=>k(t.id),children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Last response"}),c.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"View ↗"})]}),c.jsxs("div",{className:"text-xs leading-relaxed line-clamp-2 overflow-hidden",style:{color:"var(--terminal-text-secondary)"},children:[ct.slice(0,150),ct.length>150&&"..."]})]}),c.jsx("div",{className:"p-2",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("div",{className:"flex rounded-lg overflow-hidden shrink-0",style:{border:"1px solid var(--pixel-border)"},children:[c.jsx("button",{onClick:()=>ve("talk"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:ie==="talk"?"var(--accent)":"transparent",color:ie==="talk"?"#fff":"var(--terminal-text-secondary)"},children:"Talk"}),c.jsx("button",{onClick:()=>ve("do"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:ie==="do"?"var(--idle-amber)":"transparent",color:ie==="do"?"#fff":"var(--terminal-text-secondary)"},children:"Do"})]}),c.jsx(ny,{onSend:Ve,disabled:!!Pt,placeholder:ie==="talk"?"Ask something...":"Give a directive...",color:Dt})]})})]})}),c.jsxs("div",{className:"px-4 py-2 space-y-1",children:[c.jsxs(Zo,{title:`Profile${t.persona?"":" (empty)"}`,open:D,onToggle:()=>I(me=>!me),children:[t.persona&&c.jsx("div",{className:"text-xs leading-relaxed rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:t.persona}),c.jsxs("div",{className:"space-y-0 mt-2",children:[c.jsx(cd,{label:"Level",value:t.level}),c.jsx(cd,{label:"Reports to",value:t.reportsTo}),c.jsx(cd,{label:"Status",value:t.status})]}),gt.length>0&&c.jsxs("div",{className:"mt-3",children:[c.jsx("div",{className:"text-[11px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Direct Reports"}),c.jsx("div",{className:"space-y-1",children:gt.map(me=>c.jsxs("div",{className:"flex items-center gap-2 p-1.5 rounded-lg",style:{background:"var(--hud-bg-alt)"},children:[c.jsx("div",{className:"w-6 h-6 rounded flex items-center justify-center text-white text-[10px] font-bold",style:{background:od[me.id]??"#666"},children:me.id.slice(0,2).toUpperCase()}),c.jsx("div",{className:"text-xs",style:{color:"var(--terminal-text)"},children:me.name})]},me.id))})]})]}),t.authority&&c.jsxs(Zo,{title:"Authority",open:L,onToggle:()=>ee(me=>!me),children:[((ye=t.authority.autonomous)==null?void 0:ye.length)>0&&c.jsxs("div",{className:"mb-2",children:[c.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--active-green)"},children:"Autonomous"}),t.authority.autonomous.map((me,be)=>c.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",me]},be))]}),((_e=t.authority.needsApproval)==null?void 0:_e.length)>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--idle-amber)"},children:"Needs Approval"}),t.authority.needsApproval.map((me,be)=>c.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",me]},be))]})]}),t&&$&&(()=>{const me=$.filter(be=>be.roleA===t.id||be.roleB===t.id).filter(be=>be.familiarity>0).sort((be,ot)=>ot.familiarity-be.familiarity);return me.length===0?null:c.jsx(Zo,{title:`Relationships (${me.length})`,open:ae,onToggle:()=>X(be=>!be),children:c.jsx("div",{className:"space-y-1.5",children:me.map((be,ot)=>{const bt=be.roleA===t.id?be.roleB:be.roleA,Ze=l.find(ut=>ut.id===bt),de=be.familiarity>=80?"Best Partner":be.familiarity>=50?"Friend":be.familiarity>=20?"Colleague":"Acquaintance",Oe=be.familiarity>=80?"#4CAF50":be.familiarity>=50?"#2196F3":be.familiarity>=20?"#FF9800":"#9E9E9E";return c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs w-20 truncate",style:{color:od[bt]??"var(--terminal-text-secondary)"},children:(Ze==null?void 0:Ze.name)??bt}),c.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-white/10",children:c.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${be.familiarity}%`,background:Oe}})}),c.jsx("span",{className:"text-[10px] w-16 text-right",style:{color:"var(--terminal-text-muted)"},children:de})]},ot)})})})})(),t.journal&&c.jsx(Zo,{title:`Journal (${(t.journal.match(/### /g)??[]).length})`,open:U,onToggle:()=>Q(me=>!me),children:c.jsxs("div",{className:"text-xs leading-relaxed rounded-lg p-3 max-h-[300px] overflow-y-auto",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:[c.jsx(Ns,{content:t.journal.slice(0,3e3)}),t.journal.length>3e3&&c.jsx("div",{className:"italic mt-2",style:{color:"var(--terminal-text-muted)"},children:"... (truncated)"})]})})]}),o&&c.jsx("div",{className:"px-4 pb-4 mt-auto shrink-0",children:c.jsx("button",{onClick:()=>{o(t.id,t.name),i()},className:"w-full p-2 text-center text-xs font-medium border-2 border-dashed rounded-lg cursor-pointer transition-colors",style:{borderColor:"rgba(239,68,68,0.3)",color:"rgba(239,68,68,0.5)"},children:"Fire Role"})})]})]})]})}function GS({icon:t,roleId:l,roleName:a,color:i,text:o}){const u=!!o;return c.jsx("div",{className:"relative",children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsxs("div",{className:"shrink-0",children:[c.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center text-xl shadow-sm",style:{background:`${i}18`,border:`2px solid ${i}44`},children:t}),c.jsx("div",{className:"text-[9px] font-bold text-center mt-0.5 uppercase tracking-wide",style:{color:i},children:l})]}),c.jsx("div",{className:"flex-1 min-w-0",children:c.jsxs("div",{className:"relative",children:[c.jsx("div",{className:"absolute top-3 -left-2 w-0 h-0",style:{borderTop:"6px solid transparent",borderBottom:"6px solid transparent",borderRight:`8px solid ${i}12`}}),c.jsxs("div",{className:"rounded-xl rounded-tl-sm p-4 border",style:{background:`${i}08`,borderColor:`${i}22`},children:[c.jsx("div",{className:"text-[10px] font-semibold mb-1.5 uppercase tracking-wider",style:{color:i},children:a}),u?c.jsx("div",{className:"text-sm leading-relaxed",style:{color:"var(--terminal-text)"},children:c.jsx(Ns,{content:o})}):c.jsx("div",{className:"text-sm italic",style:{color:"var(--terminal-text-muted)"},children:"No recent activity."})]})]})})]})})}function Zo({title:t,open:l,onToggle:a,children:i}){return c.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:[c.jsxs("button",{onClick:a,className:"w-full px-3 py-2.5 flex items-center justify-between cursor-pointer transition-colors group",style:{background:"var(--hud-bg-alt)"},children:[c.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:t}),c.jsx("span",{className:"text-[10px] transition-transform",style:{color:"var(--terminal-text-muted)",transform:l?"rotate(0deg)":"rotate(-90deg)"},children:"▼"})]}),l&&c.jsx("div",{className:"px-3 pb-3 pt-2",style:{borderTop:"1px solid var(--terminal-border)"},children:i})]})}function ny({onSend:t,disabled:l,placeholder:a,color:i}){const[o,u]=j.useState(""),f=()=>{const m=o.trim();!m||l||(t(m),u(""))};return c.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[c.jsx("input",{type:"text",value:o,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),f())},placeholder:l?"Waiting...":a,disabled:l,className:"flex-1 rounded-lg px-2.5 py-1.5 text-xs focus:outline-none disabled:opacity-40",style:{background:"var(--hud-bg)",border:"1px solid var(--pixel-border)",color:"var(--terminal-text)"}}),c.jsx("button",{onClick:f,disabled:l||!o.trim(),className:"w-7 h-7 rounded-lg flex items-center justify-center shrink-0 cursor-pointer text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",style:{background:l||!o.trim()?"#666":i},children:c.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("path",{d:"M22 2L11 13"}),c.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})}function cd({label:t,value:l}){return c.jsxs("div",{className:"flex justify-between py-1.5 text-xs",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:t}),c.jsx("span",{className:"font-semibold",style:{color:"var(--terminal-text)"},children:l})]})}function KS(t,l){var a,i=1;t==null&&(t=0),l==null&&(l=0);function o(){var u,f=a.length,m,p=0,h=0;for(u=0;u<f;++u)m=a[u],p+=m.x,h+=m.y;for(p=(p/f-t)*i,h=(h/f-l)*i,u=0;u<f;++u)m=a[u],m.x-=p,m.y-=h}return o.initialize=function(u){a=u},o.x=function(u){return arguments.length?(t=+u,o):t},o.y=function(u){return arguments.length?(l=+u,o):l},o.strength=function(u){return arguments.length?(i=+u,o):i},o}function QS(t){const l=+this._x.call(null,t),a=+this._y.call(null,t);return K0(this.cover(l,a),l,a,t)}function K0(t,l,a,i){if(isNaN(l)||isNaN(a))return t;var o,u=t._root,f={data:i},m=t._x0,p=t._y0,h=t._x1,g=t._y1,y,b,v,S,k,C,E,M;if(!u)return t._root=f,t;for(;u.length;)if((k=l>=(y=(m+h)/2))?m=y:h=y,(C=a>=(b=(p+g)/2))?p=b:g=b,o=u,!(u=u[E=C<<1|k]))return o[E]=f,t;if(v=+t._x.call(null,u.data),S=+t._y.call(null,u.data),l===v&&a===S)return f.next=u,o?o[E]=f:t._root=f,t;do o=o?o[E]=new Array(4):t._root=new Array(4),(k=l>=(y=(m+h)/2))?m=y:h=y,(C=a>=(b=(p+g)/2))?p=b:g=b;while((E=C<<1|k)===(M=(S>=b)<<1|v>=y));return o[M]=u,o[E]=f,t}function ZS(t){var l,a,i=t.length,o,u,f=new Array(i),m=new Array(i),p=1/0,h=1/0,g=-1/0,y=-1/0;for(a=0;a<i;++a)isNaN(o=+this._x.call(null,l=t[a]))||isNaN(u=+this._y.call(null,l))||(f[a]=o,m[a]=u,o<p&&(p=o),o>g&&(g=o),u<h&&(h=u),u>y&&(y=u));if(p>g||h>y)return this;for(this.cover(p,h).cover(g,y),a=0;a<i;++a)K0(this,f[a],m[a],t[a]);return this}function WS(t,l){if(isNaN(t=+t)||isNaN(l=+l))return this;var a=this._x0,i=this._y0,o=this._x1,u=this._y1;if(isNaN(a))o=(a=Math.floor(t))+1,u=(i=Math.floor(l))+1;else{for(var f=o-a||1,m=this._root,p,h;a>t||t>=o||i>l||l>=u;)switch(h=(l<i)<<1|t<a,p=new Array(4),p[h]=m,m=p,f*=2,h){case 0:o=a+f,u=i+f;break;case 1:a=o-f,u=i+f;break;case 2:o=a+f,i=u-f;break;case 3:a=o-f,i=u-f;break}this._root&&this._root.length&&(this._root=m)}return this._x0=a,this._y0=i,this._x1=o,this._y1=u,this}function JS(){var t=[];return this.visit(function(l){if(!l.length)do t.push(l.data);while(l=l.next)}),t}function PS(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function vn(t,l,a,i,o){this.node=t,this.x0=l,this.y0=a,this.x1=i,this.y1=o}function ej(t,l,a){var i,o=this._x0,u=this._y0,f,m,p,h,g=this._x1,y=this._y1,b=[],v=this._root,S,k;for(v&&b.push(new vn(v,o,u,g,y)),a==null?a=1/0:(o=t-a,u=l-a,g=t+a,y=l+a,a*=a);S=b.pop();)if(!(!(v=S.node)||(f=S.x0)>g||(m=S.y0)>y||(p=S.x1)<o||(h=S.y1)<u))if(v.length){var C=(f+p)/2,E=(m+h)/2;b.push(new vn(v[3],C,E,p,h),new vn(v[2],f,E,C,h),new vn(v[1],C,m,p,E),new vn(v[0],f,m,C,E)),(k=(l>=E)<<1|t>=C)&&(S=b[b.length-1],b[b.length-1]=b[b.length-1-k],b[b.length-1-k]=S)}else{var M=t-+this._x.call(null,v.data),$=l-+this._y.call(null,v.data),O=M*M+$*$;if(O<a){var B=Math.sqrt(a=O);o=t-B,u=l-B,g=t+B,y=l+B,i=v.data}}return i}function tj(t){if(isNaN(g=+this._x.call(null,t))||isNaN(y=+this._y.call(null,t)))return this;var l,a=this._root,i,o,u,f=this._x0,m=this._y0,p=this._x1,h=this._y1,g,y,b,v,S,k,C,E;if(!a)return this;if(a.length)for(;;){if((S=g>=(b=(f+p)/2))?f=b:p=b,(k=y>=(v=(m+h)/2))?m=v:h=v,l=a,!(a=a[C=k<<1|S]))return this;if(!a.length)break;(l[C+1&3]||l[C+2&3]||l[C+3&3])&&(i=l,E=C)}for(;a.data!==t;)if(o=a,!(a=a.next))return this;return(u=a.next)&&delete a.next,o?(u?o.next=u:delete o.next,this):l?(u?l[C]=u:delete l[C],(a=l[0]||l[1]||l[2]||l[3])&&a===(l[3]||l[2]||l[1]||l[0])&&!a.length&&(i?i[E]=a:this._root=a),this):(this._root=u,this)}function nj(t){for(var l=0,a=t.length;l<a;++l)this.remove(t[l]);return this}function lj(){return this._root}function aj(){var t=0;return this.visit(function(l){if(!l.length)do++t;while(l=l.next)}),t}function rj(t){var l=[],a,i=this._root,o,u,f,m,p;for(i&&l.push(new vn(i,this._x0,this._y0,this._x1,this._y1));a=l.pop();)if(!t(i=a.node,u=a.x0,f=a.y0,m=a.x1,p=a.y1)&&i.length){var h=(u+m)/2,g=(f+p)/2;(o=i[3])&&l.push(new vn(o,h,g,m,p)),(o=i[2])&&l.push(new vn(o,u,g,h,p)),(o=i[1])&&l.push(new vn(o,h,f,m,g)),(o=i[0])&&l.push(new vn(o,u,f,h,g))}return this}function ij(t){var l=[],a=[],i;for(this._root&&l.push(new vn(this._root,this._x0,this._y0,this._x1,this._y1));i=l.pop();){var o=i.node;if(o.length){var u,f=i.x0,m=i.y0,p=i.x1,h=i.y1,g=(f+p)/2,y=(m+h)/2;(u=o[0])&&l.push(new vn(u,f,m,g,y)),(u=o[1])&&l.push(new vn(u,g,m,p,y)),(u=o[2])&&l.push(new vn(u,f,y,g,h)),(u=o[3])&&l.push(new vn(u,g,y,p,h))}a.push(i)}for(;i=a.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function sj(t){return t[0]}function oj(t){return arguments.length?(this._x=t,this):this._x}function cj(t){return t[1]}function uj(t){return arguments.length?(this._y=t,this):this._y}function fh(t,l,a){var i=new dh(l??sj,a??cj,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function dh(t,l,a,i,o,u){this._x=t,this._y=l,this._x0=a,this._y0=i,this._x1=o,this._y1=u,this._root=void 0}function ly(t){for(var l={data:t.data},a=l;t=t.next;)a=a.next={data:t.data};return l}var wn=fh.prototype=dh.prototype;wn.copy=function(){var t=new dh(this._x,this._y,this._x0,this._y0,this._x1,this._y1),l=this._root,a,i;if(!l)return t;if(!l.length)return t._root=ly(l),t;for(a=[{source:l,target:t._root=new Array(4)}];l=a.pop();)for(var o=0;o<4;++o)(i=l.source[o])&&(i.length?a.push({source:i,target:l.target[o]=new Array(4)}):l.target[o]=ly(i));return t};wn.add=QS;wn.addAll=ZS;wn.cover=WS;wn.data=JS;wn.extent=PS;wn.find=ej;wn.remove=tj;wn.removeAll=nj;wn.root=lj;wn.size=aj;wn.visit=rj;wn.visitAfter=ij;wn.x=oj;wn.y=uj;function rr(t){return function(){return t}}function Ta(t){return(t()-.5)*1e-6}function fj(t){return t.x+t.vx}function dj(t){return t.y+t.vy}function hj(t){var l,a,i,o=1,u=1;typeof t!="function"&&(t=rr(t==null?1:+t));function f(){for(var h,g=l.length,y,b,v,S,k,C,E=0;E<u;++E)for(y=fh(l,fj,dj).visitAfter(m),h=0;h<g;++h)b=l[h],k=a[b.index],C=k*k,v=b.x+b.vx,S=b.y+b.vy,y.visit(M);function M($,O,B,T,Y){var V=$.data,te=$.r,D=k+te;if(V){if(V.index>b.index){var I=v-V.x-V.vx,L=S-V.y-V.vy,ee=I*I+L*L;ee<D*D&&(I===0&&(I=Ta(i),ee+=I*I),L===0&&(L=Ta(i),ee+=L*L),ee=(D-(ee=Math.sqrt(ee)))/ee*o,b.vx+=(I*=ee)*(D=(te*=te)/(C+te)),b.vy+=(L*=ee)*D,V.vx-=I*(D=1-D),V.vy-=L*D)}return}return O>v+D||T<v-D||B>S+D||Y<S-D}}function m(h){if(h.data)return h.r=a[h.data.index];for(var g=h.r=0;g<4;++g)h[g]&&h[g].r>h.r&&(h.r=h[g].r)}function p(){if(l){var h,g=l.length,y;for(a=new Array(g),h=0;h<g;++h)y=l[h],a[y.index]=+t(y,h,l)}}return f.initialize=function(h,g){l=h,i=g,p()},f.iterations=function(h){return arguments.length?(u=+h,f):u},f.strength=function(h){return arguments.length?(o=+h,f):o},f.radius=function(h){return arguments.length?(t=typeof h=="function"?h:rr(+h),p(),f):t},f}function mj(t){return t.index}function ay(t,l){var a=t.get(l);if(!a)throw new Error("node not found: "+l);return a}function xj(t){var l=mj,a=y,i,o=rr(30),u,f,m,p,h,g=1;t==null&&(t=[]);function y(C){return 1/Math.min(m[C.source.index],m[C.target.index])}function b(C){for(var E=0,M=t.length;E<g;++E)for(var $=0,O,B,T,Y,V,te,D;$<M;++$)O=t[$],B=O.source,T=O.target,Y=T.x+T.vx-B.x-B.vx||Ta(h),V=T.y+T.vy-B.y-B.vy||Ta(h),te=Math.sqrt(Y*Y+V*V),te=(te-u[$])/te*C*i[$],Y*=te,V*=te,T.vx-=Y*(D=p[$]),T.vy-=V*D,B.vx+=Y*(D=1-D),B.vy+=V*D}function v(){if(f){var C,E=f.length,M=t.length,$=new Map(f.map((B,T)=>[l(B,T,f),B])),O;for(C=0,m=new Array(E);C<M;++C)O=t[C],O.index=C,typeof O.source!="object"&&(O.source=ay($,O.source)),typeof O.target!="object"&&(O.target=ay($,O.target)),m[O.source.index]=(m[O.source.index]||0)+1,m[O.target.index]=(m[O.target.index]||0)+1;for(C=0,p=new Array(M);C<M;++C)O=t[C],p[C]=m[O.source.index]/(m[O.source.index]+m[O.target.index]);i=new Array(M),S(),u=new Array(M),k()}}function S(){if(f)for(var C=0,E=t.length;C<E;++C)i[C]=+a(t[C],C,t)}function k(){if(f)for(var C=0,E=t.length;C<E;++C)u[C]=+o(t[C],C,t)}return b.initialize=function(C,E){f=C,h=E,v()},b.links=function(C){return arguments.length?(t=C,v(),b):t},b.id=function(C){return arguments.length?(l=C,b):l},b.iterations=function(C){return arguments.length?(g=+C,b):g},b.strength=function(C){return arguments.length?(a=typeof C=="function"?C:rr(+C),S(),b):a},b.distance=function(C){return arguments.length?(o=typeof C=="function"?C:rr(+C),k(),b):o},b}var pj={value:()=>{}};function Q0(){for(var t=0,l=arguments.length,a={},i;t<l;++t){if(!(i=arguments[t]+"")||i in a||/[\s.]/.test(i))throw new Error("illegal type: "+i);a[i]=[]}return new ic(a)}function ic(t){this._=t}function yj(t,l){return t.trim().split(/^|\s+/).map(function(a){var i="",o=a.indexOf(".");if(o>=0&&(i=a.slice(o+1),a=a.slice(0,o)),a&&!l.hasOwnProperty(a))throw new Error("unknown type: "+a);return{type:a,name:i}})}ic.prototype=Q0.prototype={constructor:ic,on:function(t,l){var a=this._,i=yj(t+"",a),o,u=-1,f=i.length;if(arguments.length<2){for(;++u<f;)if((o=(t=i[u]).type)&&(o=gj(a[o],t.name)))return o;return}if(l!=null&&typeof l!="function")throw new Error("invalid callback: "+l);for(;++u<f;)if(o=(t=i[u]).type)a[o]=ry(a[o],t.name,l);else if(l==null)for(o in a)a[o]=ry(a[o],t.name,null);return this},copy:function(){var t={},l=this._;for(var a in l)t[a]=l[a].slice();return new ic(t)},call:function(t,l){if((o=arguments.length-2)>0)for(var a=new Array(o),i=0,o,u;i<o;++i)a[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(u=this._[t],i=0,o=u.length;i<o;++i)u[i].value.apply(l,a)},apply:function(t,l,a){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],o=0,u=i.length;o<u;++o)i[o].value.apply(l,a)}};function gj(t,l){for(var a=0,i=t.length,o;a<i;++a)if((o=t[a]).name===l)return o.value}function ry(t,l,a){for(var i=0,o=t.length;i<o;++i)if(t[i].name===l){t[i]=pj,t=t.slice(0,i).concat(t.slice(i+1));break}return a!=null&&t.push({name:l,value:a}),t}var Pr=0,us=0,is=0,Z0=1e3,pc,fs,yc=0,sr=0,Nc=0,ws=typeof performance=="object"&&performance.now?performance:Date,W0=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function J0(){return sr||(W0(bj),sr=ws.now()+Nc)}function bj(){sr=0}function Hd(){this._call=this._time=this._next=null}Hd.prototype=P0.prototype={constructor:Hd,restart:function(t,l,a){if(typeof t!="function")throw new TypeError("callback is not a function");a=(a==null?J0():+a)+(l==null?0:+l),!this._next&&fs!==this&&(fs?fs._next=this:pc=this,fs=this),this._call=t,this._time=a,Ud()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ud())}};function P0(t,l,a){var i=new Hd;return i.restart(t,l,a),i}function vj(){J0(),++Pr;for(var t=pc,l;t;)(l=sr-t._time)>=0&&t._call.call(void 0,l),t=t._next;--Pr}function iy(){sr=(yc=ws.now())+Nc,Pr=us=0;try{vj()}finally{Pr=0,kj(),sr=0}}function wj(){var t=ws.now(),l=t-yc;l>Z0&&(Nc-=l,yc=t)}function kj(){for(var t,l=pc,a,i=1/0;l;)l._call?(i>l._time&&(i=l._time),t=l,l=l._next):(a=l._next,l._next=null,l=t?t._next=a:pc=a);fs=t,Ud(i)}function Ud(t){if(!Pr){us&&(us=clearTimeout(us));var l=t-sr;l>24?(t<1/0&&(us=setTimeout(iy,t-ws.now()-Nc)),is&&(is=clearInterval(is))):(is||(yc=ws.now(),is=setInterval(wj,Z0)),Pr=1,W0(iy))}}const Sj=1664525,jj=1013904223,sy=4294967296;function Ej(){let t=1;return()=>(t=(Sj*t+jj)%sy)/sy}function Cj(t){return t.x}function Nj(t){return t.y}var Aj=10,Dj=Math.PI*(3-Math.sqrt(5));function Tj(t){var l,a=1,i=.001,o=1-Math.pow(i,1/300),u=0,f=.6,m=new Map,p=P0(y),h=Q0("tick","end"),g=Ej();t==null&&(t=[]);function y(){b(),h.call("tick",l),a<i&&(p.stop(),h.call("end",l))}function b(k){var C,E=t.length,M;k===void 0&&(k=1);for(var $=0;$<k;++$)for(a+=(u-a)*o,m.forEach(function(O){O(a)}),C=0;C<E;++C)M=t[C],M.fx==null?M.x+=M.vx*=f:(M.x=M.fx,M.vx=0),M.fy==null?M.y+=M.vy*=f:(M.y=M.fy,M.vy=0);return l}function v(){for(var k=0,C=t.length,E;k<C;++k){if(E=t[k],E.index=k,E.fx!=null&&(E.x=E.fx),E.fy!=null&&(E.y=E.fy),isNaN(E.x)||isNaN(E.y)){var M=Aj*Math.sqrt(.5+k),$=k*Dj;E.x=M*Math.cos($),E.y=M*Math.sin($)}(isNaN(E.vx)||isNaN(E.vy))&&(E.vx=E.vy=0)}}function S(k){return k.initialize&&k.initialize(t,g),k}return v(),l={tick:b,restart:function(){return p.restart(y),l},stop:function(){return p.stop(),l},nodes:function(k){return arguments.length?(t=k,v(),m.forEach(S),l):t},alpha:function(k){return arguments.length?(a=+k,l):a},alphaMin:function(k){return arguments.length?(i=+k,l):i},alphaDecay:function(k){return arguments.length?(o=+k,l):+o},alphaTarget:function(k){return arguments.length?(u=+k,l):u},velocityDecay:function(k){return arguments.length?(f=1-k,l):1-f},randomSource:function(k){return arguments.length?(g=k,m.forEach(S),l):g},force:function(k,C){return arguments.length>1?(C==null?m.delete(k):m.set(k,S(C)),l):m.get(k)},find:function(k,C,E){var M=0,$=t.length,O,B,T,Y,V;for(E==null?E=1/0:E*=E,M=0;M<$;++M)Y=t[M],O=k-Y.x,B=C-Y.y,T=O*O+B*B,T<E&&(V=Y,E=T);return V},on:function(k,C){return arguments.length>1?(h.on(k,C),l):h.on(k)}}}function zj(){var t,l,a,i,o=rr(-30),u,f=1,m=1/0,p=.81;function h(v){var S,k=t.length,C=fh(t,Cj,Nj).visitAfter(y);for(i=v,S=0;S<k;++S)l=t[S],C.visit(b)}function g(){if(t){var v,S=t.length,k;for(u=new Array(S),v=0;v<S;++v)k=t[v],u[k.index]=+o(k,v,t)}}function y(v){var S=0,k,C,E=0,M,$,O;if(v.length){for(M=$=O=0;O<4;++O)(k=v[O])&&(C=Math.abs(k.value))&&(S+=k.value,E+=C,M+=C*k.x,$+=C*k.y);v.x=M/E,v.y=$/E}else{k=v,k.x=k.data.x,k.y=k.data.y;do S+=u[k.data.index];while(k=k.next)}v.value=S}function b(v,S,k,C){if(!v.value)return!0;var E=v.x-l.x,M=v.y-l.y,$=C-S,O=E*E+M*M;if($*$/p<O)return O<m&&(E===0&&(E=Ta(a),O+=E*E),M===0&&(M=Ta(a),O+=M*M),O<f&&(O=Math.sqrt(f*O)),l.vx+=E*v.value*i/O,l.vy+=M*v.value*i/O),!0;if(v.length||O>=m)return;(v.data!==l||v.next)&&(E===0&&(E=Ta(a),O+=E*E),M===0&&(M=Ta(a),O+=M*M),O<f&&(O=Math.sqrt(f*O)));do v.data!==l&&($=u[v.data.index]*i/O,l.vx+=E*$,l.vy+=M*$);while(v=v.next)}return h.initialize=function(v,S){t=v,a=S,g()},h.strength=function(v){return arguments.length?(o=typeof v=="function"?v:rr(+v),g(),h):o},h.distanceMin=function(v){return arguments.length?(f=v*v,h):Math.sqrt(f)},h.distanceMax=function(v){return arguments.length?(m=v*v,h):Math.sqrt(m)},h.theta=function(v){return arguments.length?(p=v*v,h):Math.sqrt(p)},h}const ks={tech:{bg:"rgba(59,130,246,0.15)",border:"#3b82f6",text:"#60a5fa"},market:{bg:"rgba(245,158,11,0.15)",border:"#f59e0b",text:"#fbbf24"},strategy:{bg:"rgba(139,92,246,0.15)",border:"#8b5cf6",text:"#a78bfa"},financial:{bg:"rgba(34,197,94,0.15)",border:"#22c55e",text:"#4ade80"},process:{bg:"rgba(236,72,153,0.15)",border:"#ec4899",text:"#f472b6"},competitor:{bg:"rgba(239,68,68,0.15)",border:"#ef4444",text:"#f87171"},domain:{bg:"rgba(14,165,233,0.15)",border:"#0ea5e9",text:"#38bdf8"},general:{bg:"rgba(148,163,184,0.12)",border:"#64748b",text:"#94a3b8"}};function Mj(t){return ks[t]??ks.general}function _j({docs:t,onNodeClick:l,selectedDocId:a}){var I;const i=j.useRef(null),o=j.useRef(null),[u,f]=j.useState({width:600,height:400}),[m,p]=j.useState({nodes:[],links:[]}),[h,g]=j.useState(null),[y,b]=j.useState(null),[v,S]=j.useState({x:0,y:0}),[k,C]=j.useState({x:0,y:0,w:600,h:400}),E=j.useRef(!1),M=j.useRef({x:0,y:0,vx:0,vy:0}),$=j.useRef(null),O=j.useRef(null);j.useEffect(()=>{const L=i.current;if(!L)return;const ee=new ResizeObserver(ae=>{const{width:X,height:U}=ae[0].contentRect;X>0&&U>0&&(f({width:X,height:U}),C(Q=>({...Q,w:X,h:U})))});return ee.observe(L),()=>ee.disconnect()},[]),j.useEffect(()=>{if(t.length===0)return;const L=new Set(t.map(ie=>ie.id)),ee=t.map(ie=>({id:ie.id,title:ie.title,category:ie.category,akb_type:ie.akb_type})),ae=[];for(const ie of t)for(const ve of ie.links){const z=ve.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,"");L.has(z)&&z!==ie.id&&(ae.some(_=>_.source===ie.id&&_.target===z||_.source===z&&_.target===ie.id)||ae.push({source:ie.id,target:z,label:ve.text}))}const{width:X,height:U}=u,Q=Tj(ee).force("link",xj(ae).id(ie=>ie.id).distance(140)).force("charge",zj().strength(-400)).force("center",KS(X/2,U/2)).force("collide",hj(50));O.current=Q,Q.on("tick",()=>{for(const ie of ee)ie.x=Math.max(60,Math.min(X-60,ie.x??X/2)),ie.y=Math.max(60,Math.min(U-60,ie.y??U/2));p({nodes:[...ee],links:[...ae]})}),Q.alpha(1).restart();for(let ie=0;ie<150;ie++)Q.tick();return Q.stop(),p({nodes:[...ee],links:[...ae]}),()=>{Q.stop()}},[t,u]);const B=L=>{if(typeof L=="string"){const ee=m.nodes.find(ae=>ae.id===L);return{x:(ee==null?void 0:ee.x)??0,y:(ee==null?void 0:ee.y)??0}}return{x:L.x??0,y:L.y??0}},T=j.useCallback(L=>{L.preventDefault();const ee=L.deltaY>0?1.1:.9;C(ae=>{const X=Math.max(200,Math.min(u.width*3,ae.w*ee)),U=Math.max(150,Math.min(u.height*3,ae.h*ee)),Q=(X-ae.w)/2,ie=(U-ae.h)/2;return{x:ae.x-Q,y:ae.y-ie,w:X,h:U}})},[u]),Y=j.useCallback(L=>{L.button===0&&(E.current=!0,M.current={x:L.clientX,y:L.clientY,vx:k.x,vy:k.y})},[k]),V=j.useCallback(L=>{var ee;if($.current){const ae=o.current;if(!ae)return;const X=ae.getBoundingClientRect(),U=k.w/X.width,Q=k.h/X.height,ie=k.x+(L.clientX-X.left)*U,ve=k.y+(L.clientY-X.top)*Q;$.current.fx=ie,$.current.fy=ve,(ee=O.current)==null||ee.alpha(.3).restart();return}if(E.current){const ae=(L.clientX-M.current.x)*(k.w/u.width),X=(L.clientY-M.current.y)*(k.h/u.height);C(U=>({...U,x:M.current.vx-ae,y:M.current.vy-X}))}},[k,u]),te=j.useCallback(()=>{E.current=!1,$.current&&($.current.fx=null,$.current.fy=null,$.current=null)},[]),D=j.useCallback((L,ee)=>{var ae;L.stopPropagation(),$.current=ee,(ae=O.current)==null||ae.alpha(.3).restart()},[]);return c.jsxs("div",{ref:i,className:"relative flex-1 overflow-hidden",style:{background:"#1e1e2e"},children:[c.jsxs("svg",{ref:o,width:u.width,height:u.height,viewBox:`${k.x} ${k.y} ${k.w} ${k.h}`,style:{display:"block",cursor:E.current?"grabbing":"grab"},onWheel:T,onMouseDown:Y,onMouseMove:V,onMouseUp:te,onMouseLeave:te,children:[c.jsx("defs",{children:c.jsx("pattern",{id:"grid",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:c.jsx("circle",{cx:"0",cy:"0",r:"0.5",fill:"rgba(255,255,255,0.06)"})})}),c.jsx("rect",{x:k.x-100,y:k.y-100,width:k.w+200,height:k.h+200,fill:"url(#grid)",pointerEvents:"none"}),m.links.map((L,ee)=>{const ae=B(L.source),X=B(L.target),U=y===ee,Q=(ae.x+X.x)/2,ie=(ae.y+X.y)/2;return c.jsxs("g",{children:[c.jsx("line",{x1:ae.x,y1:ae.y,x2:X.x,y2:X.y,stroke:"transparent",strokeWidth:12,style:{cursor:"default"},onMouseEnter:()=>b(ee),onMouseLeave:()=>b(null)}),c.jsx("line",{x1:ae.x,y1:ae.y,x2:X.x,y2:X.y,stroke:U?"rgba(148,163,184,0.7)":"rgba(148,163,184,0.3)",strokeWidth:U?2:1.5,strokeDasharray:"4 3",pointerEvents:"none"}),U&&L.label&&c.jsx("text",{x:Q,y:ie-6,textAnchor:"middle",fill:"#e2e8f0",fontSize:9,fontFamily:"monospace",style:{pointerEvents:"none"},children:c.jsx("tspan",{style:{filter:"drop-shadow(0 0 2px rgba(0,0,0,0.8))"},children:L.label.length>30?L.label.slice(0,28)+"..":L.label})})]},ee)}),m.nodes.map(L=>{const ee=ks[L.category]??ks.general,ae=L.akb_type==="hub",X=ae?24:16,U=(h==null?void 0:h.id)===L.id,Q=a===L.id,ie=U?1.2:Q?1.15:1;return c.jsxs("g",{transform:`translate(${L.x??0}, ${L.y??0}) scale(${ie})`,style:{cursor:"pointer",transition:"transform 0.15s ease"},onClick:ve=>{ve.stopPropagation();const z=t.find(_=>_.id===L.id);z&&l(z)},onMouseDown:ve=>D(ve,L),onMouseEnter:ve=>{var _;g(L);const z=(_=i.current)==null?void 0:_.getBoundingClientRect();z&&S({x:ve.clientX-z.left,y:ve.clientY-z.top})},onMouseLeave:()=>g(null),children:[Q&&c.jsx("rect",{x:-X/2-4,y:-X/2-4,width:X+8,height:X+8,fill:"none",stroke:"#22c55e",strokeWidth:2,rx:ae?5:2,opacity:.6}),c.jsx("rect",{x:-X/2,y:-X/2,width:X,height:X,fill:ee.border,rx:ae?4:2,opacity:U?1:.9}),c.jsx("rect",{x:-X/2+3,y:-X/2+3,width:Math.max(0,X-6),height:Math.max(0,X-6),fill:ee.bg,rx:ae?3:1}),c.jsx("text",{y:X/2+14,textAnchor:"middle",fill:Q?"#e2e8f0":"#94a3b8",fontSize:11,fontFamily:"monospace",fontWeight:Q?"bold":"normal",style:{pointerEvents:"none"},children:L.title.length>24?L.title.slice(0,22)+"..":L.title})]},L.id)})]}),h&&!$.current&&c.jsxs("div",{className:"absolute z-10 pointer-events-none p-2.5 rounded text-xs max-w-[240px]",style:{left:Math.min(v.x+16,u.width-250),top:Math.max(v.y-30,8),background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",boxShadow:"0 4px 12px rgba(0,0,0,0.4)"},children:[c.jsx("div",{className:"font-bold mb-1",children:h.title}),c.jsxs("div",{className:"text-[10px] opacity-60 mb-1",children:[h.akb_type.toUpperCase()," / ",h.category]}),((I=t.find(L=>L.id===h.id))==null?void 0:I.tldr)&&c.jsx("div",{className:"text-[10px] opacity-80 mb-1",children:t.find(L=>L.id===h.id).tldr}),c.jsx("div",{className:"text-[10px] text-green-400",children:"Click to open | Drag to move"})]}),t.length===0&&c.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"No knowledge documents found"})]})}function Fj({doc:t,allDocs:l,onOpen:a,onNavigateDoc:i}){const[o,u]=j.useState(!1),f=Mj(t.category),m=t.akb_type==="hub",p=new Set(l.map(h=>h.id));return c.jsxs("div",{className:"mb-2 rounded-lg overflow-hidden",style:{background:m?"rgba(22,163,106,0.08)":"var(--hud-bg-alt)",border:`2px solid ${m?"rgba(22,163,106,0.4)":"var(--terminal-border)"}`},children:[c.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>u(!o),children:[c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx("span",{className:"shrink-0 text-sm",children:m?"🗂":t.format==="html"?"🌐":"📄"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[c.jsx("span",{className:"font-semibold text-xs truncate",style:{color:"var(--terminal-text)"},children:t.title}),c.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:t.status==="active"?"#16a34a":t.status==="draft"?"#f59e0b":"#94a3b8"},title:t.status})]}),c.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:t.tags.slice(0,4).map(h=>c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium",style:{background:f.bg,color:f.text,border:`1px solid ${f.border}`},children:h},h))})]}),c.jsx("span",{className:"text-xs shrink-0",style:{color:"var(--terminal-text-muted)"},children:o?"▲":"▼"})]}),!o&&t.tldr&&c.jsx("div",{className:"mt-1.5 text-[10px] line-clamp-2 ml-6",style:{color:"var(--terminal-text-secondary)"},children:t.tldr})]}),o&&c.jsxs("div",{className:"px-3 pb-3",style:{borderTop:"1px solid var(--terminal-border)"},children:[t.tldr&&c.jsx("div",{className:"mt-2 text-[11px] leading-relaxed italic",style:{color:"var(--terminal-text-secondary)"},children:t.tldr}),t.links.length>0&&c.jsxs("div",{className:"mt-2",children:[c.jsx("div",{className:"text-[9px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Cross-links"}),c.jsx("div",{className:"flex flex-wrap gap-1",children:t.links.slice(0,5).map((h,g)=>{const y=h.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,""),b=p.has(y);return c.jsxs("span",{className:`px-1.5 py-0.5 text-[9px] rounded ${b?"cursor-pointer hover:opacity-70":""}`,style:{background:b?"rgba(22,163,106,0.15)":"rgba(148,163,184,0.1)",color:b?"#4ade80":"var(--terminal-text-muted)",border:`1px solid ${b?"rgba(22,163,106,0.3)":"var(--terminal-border)"}`},onClick:v=>{b&&(v.stopPropagation(),i(y))},children:["🔗"," ",h.text]},g)})})]}),c.jsxs("button",{className:"mt-2 text-[10px] font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},onClick:h=>{h.stopPropagation(),a(t)},children:["Open full ","→"]})]})]})}function Rj({docId:t,onBack:l,onDocUpdated:a,onDelete:i,onNavigateDoc:o,allDocs:u}){const[f,m]=j.useState(null),[p,h]=j.useState(!0),[g,y]=j.useState(!1),[b,v]=j.useState(""),[S,k]=j.useState(!1),C=new Set(u.map(B=>B.id)),E=j.useCallback(B=>{const T=B.split("#")[0];if(!T.match(/\.(md|html)$/))return null;const Y=t.includes("/")?t.replace(/\/[^/]+$/,""):"";let V;if(T.startsWith("./"))V=Y?`${Y}/${T.slice(2)}`:T.slice(2);else if(T.startsWith("../")){const I=Y.split("/").filter(Boolean);let L=T;for(;L.startsWith("../");)I.length>0&&I.pop(),L=L.slice(3);V=I.length>0?`${I.join("/")}/${L}`:L}else V=T;if(C.has(V))return V;const te=V.split("/").pop()??"",D=u.find(I=>I.id===te||I.id.endsWith("/"+te));return D?D.id:null},[t,C,u]),M=j.useCallback(B=>{const Y=B.target.closest("a");if(!Y)return;const V=Y.getAttribute("href");if(!V||V.startsWith("http://")||V.startsWith("https://")||!V.match(/\.(md|html)(#.*)?$/))return;B.preventDefault(),B.stopPropagation();const te=E(V);te&&o(te)},[E,o]);j.useEffect(()=>{h(!0),Te.getKnowledgeDoc(t).then(B=>{m(B),v(B.content)}).catch(console.error).finally(()=>h(!1))},[t]);const $=async()=>{if(f){k(!0);try{await Te.updateKnowledgeDoc(t,b),m({...f,content:b}),y(!1),a()}catch(B){console.error("Save failed:",B)}finally{k(!1)}}},O=async()=>{if(confirm(`Delete "${f==null?void 0:f.title}"?`))try{await Te.deleteKnowledgeDoc(t),i(t)}catch(B){console.error("Delete failed:",B)}};return p?c.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Loading..."}):f?c.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col",children:[c.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Back"]}),c.jsx("div",{className:"flex-1"}),g?c.jsxs(c.Fragment,{children:[c.jsx("button",{onClick:()=>{y(!1),v(f.content)},className:"px-2.5 py-1 text-[10px] rounded cursor-pointer",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Cancel"}),c.jsx("button",{onClick:$,disabled:S,className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold text-white",style:{background:S?"#86efac":"#16a34a"},children:S?"Saving...":"Save"})]}):c.jsxs(c.Fragment,{children:[c.jsx("button",{onClick:()=>y(!0),className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa",border:"1px solid rgba(59,130,246,0.3)"},children:"Edit"}),c.jsx("button",{onClick:O,className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold",style:{background:"rgba(239,68,68,0.15)",color:"#f87171",border:"1px solid rgba(239,68,68,0.3)"},children:"Delete"})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[c.jsx("h2",{className:"text-sm font-bold mb-1",style:{color:"var(--terminal-text)"},children:f.title}),f.tldr&&!g&&c.jsx("div",{className:"mb-3 text-xs italic",style:{color:"var(--terminal-text-secondary)"},children:f.tldr}),f.format==="html"?g?c.jsx("textarea",{className:"w-full h-full min-h-[400px] p-3 text-xs leading-relaxed rounded border resize-y",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',background:"var(--hud-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},value:b,onChange:B=>v(B.target.value),spellCheck:!1}):c.jsx("iframe",{srcDoc:f.content,sandbox:"allow-same-origin",className:"w-full flex-1 min-h-[400px] rounded",style:{border:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},title:f.title}):g?c.jsx("textarea",{className:"w-full h-full min-h-[400px] p-3 text-xs leading-relaxed rounded border resize-y",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',background:"#1e1e2e",color:"#e2e8f0",border:"1px solid #334155"},value:b,onChange:B=>v(B.target.value),spellCheck:!1}):c.jsx("div",{className:"text-xs leading-relaxed",style:{color:"var(--terminal-text-secondary)"},onClick:M,children:c.jsx(Ns,{content:f.content})})]})]}):c.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Failed to load document"})}function Oj({onCreated:t,onCancel:l}){const[a,i]=j.useState(""),[o,u]=j.useState(""),[f,m]=j.useState(""),[p,h]=j.useState(!1),[g,y]=j.useState("");j.useEffect(()=>{if(!a){u("");return}const v=a.toLowerCase().replace(/[^a-z0-9가-힣\s-]/g,"").replace(/\s+/g,"-").slice(0,60);u(v)},[a]);const b=async()=>{if(!a.trim()||!o.trim()){y("Title and filename are required");return}h(!0),y("");try{const v=await Te.createKnowledgeDoc({filename:o,title:a,category:f||void 0});t(v.id)}catch(v){y(v instanceof Error?v.message:"Failed to create")}finally{h(!1)}};return c.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[c.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Cancel"]}),c.jsx("h2",{className:"text-sm font-bold",style:{color:"var(--terminal-text)"},children:"New Document"})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"TITLE"}),c.jsx("input",{type:"text",value:a,onChange:v=>i(v.target.value),placeholder:"Document title...",className:"w-full px-3 py-2 text-xs rounded focus:outline-none",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"FILENAME"}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("input",{type:"text",value:o,onChange:v=>u(v.target.value),className:"flex-1 px-3 py-2 text-xs rounded focus:outline-none font-mono",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}}),c.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:".md"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"CATEGORY (optional)"}),c.jsx("input",{type:"text",value:f,onChange:v=>m(v.target.value),placeholder:"e.g., tech, market, strategy",className:"w-full px-3 py-2 text-xs rounded focus:outline-none",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}})]}),g&&c.jsx("div",{className:"text-[10px] px-3 py-1.5 rounded",style:{background:"rgba(239,68,68,0.15)",color:"#f87171"},children:g}),c.jsx("button",{onClick:b,disabled:p||!a.trim(),className:"w-full py-2 text-xs font-semibold rounded cursor-pointer text-white",style:{background:p?"#86efac":"#16a34a"},children:p?"Creating...":"Create Document"})]})]})}const Bj=500,oy=360,cy=700;function hh(t){const[l,a]=j.useState(Bj),[i,o]=j.useState(!1),u=j.useRef(0),f=j.useRef(0),m=t>0,p=m?t:0,h=m?Math.max(oy,window.innerWidth-t-100):cy,g=Math.min(l,h),y=j.useCallback(b=>{b.preventDefault(),u.current=b.clientX,f.current=g,o(!0);const v=k=>{const C=u.current-k.clientX,E=Math.min(cy,Math.max(oy,f.current+C));a(E)},S=()=>{o(!1),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",S)};document.addEventListener("mousemove",v),document.addEventListener("mouseup",S)},[g]);return{panelRight:p,panelWidth:g,isResizing:i,handleResizeStart:y}}function $j({docs:t,onClose:l,onRefresh:a,terminalWidth:i=0,initialDocId:o}){const[u,f]=j.useState("list"),[m,p]=j.useState("all"),[h,g]=j.useState(o??null),[y,b]=j.useState(""),[v,S]=j.useState(!1),[k,C]=j.useState(null),{panelRight:E,panelWidth:M,isResizing:$,handleResizeStart:O}=hh(i),B=["all",...Array.from(new Set(t.map(I=>I.category))).sort()],T=t.filter(I=>{if(m!=="all"&&I.category!==m)return!1;if(y){const L=y.toLowerCase();return I.title.toLowerCase().includes(L)||(I.tldr??"").toLowerCase().includes(L)||I.tags.some(ee=>ee.toLowerCase().includes(L))}return!0}),Y=I=>{S(!1),a(),g(I)},V=I=>{g(null),a()},te=I=>{C(I.id)},D=k?t.find(I=>I.id===k):null;return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:E},onClick:l}),c.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${$?"resizing":""}`,style:{right:E,width:M,background:"var(--terminal-bg)",borderLeftColor:"#16a34a"},children:[c.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${$?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:O}),c.jsxs("div",{className:"p-5 text-white relative",style:{background:"#16a34a"},children:[c.jsx("button",{onClick:l,className:"absolute top-3 right-3 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),c.jsxs("div",{className:"text-lg font-bold",children:["📚"," Knowledge Base"]}),c.jsxs("div",{className:"text-xs opacity-80 mt-0.5",children:[t.length," documents"]})]}),c.jsxs("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsx(uy,{label:"List",active:u==="list",onClick:()=>{f("list"),C(null)}}),c.jsx(uy,{label:"Graph",active:u==="graph",onClick:()=>f("graph")})]}),u==="list"&&!h&&!v&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsx("input",{type:"text",value:y,onChange:I=>b(I.target.value),placeholder:"Search docs...",className:"flex-1 px-2.5 py-1.5 text-[11px] rounded focus:outline-none",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}}),c.jsx("button",{onClick:()=>S(!0),className:"px-2.5 py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white shrink-0",style:{background:"#16a34a"},children:"+ New"})]}),c.jsx("div",{className:"flex overflow-x-auto shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",scrollbarWidth:"none"},children:B.map(I=>c.jsx("button",{onClick:()=>p(I),className:"px-3 py-1.5 text-[10px] font-medium cursor-pointer whitespace-nowrap",style:{color:m===I?"#4ade80":"var(--terminal-text-muted)",borderBottom:m===I?"2px solid #4ade80":"2px solid transparent"},children:I==="all"?`All (${t.length})`:`${I} (${t.filter(L=>L.category===I).length})`},I))}),c.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:T.length===0?c.jsx("div",{className:"text-center text-xs py-8",style:{color:"var(--terminal-text-muted)"},children:y?"No matching documents":"No documents in this category"}):T.map(I=>c.jsx(Fj,{doc:I,allDocs:t,onOpen:L=>g(L.id),onNavigateDoc:L=>g(L)},I.id))})]}),u==="list"&&h&&!v&&c.jsx(Rj,{docId:h,onBack:()=>g(null),onDocUpdated:a,onDelete:V,onNavigateDoc:I=>g(I),allDocs:t}),u==="list"&&v&&c.jsx(Oj,{onCreated:Y,onCancel:()=>S(!1)}),u==="graph"&&c.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[c.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[c.jsx(_j,{docs:t,onNodeClick:te,selectedDocId:k}),D&&c.jsxs("div",{className:"shrink-0 overflow-y-auto p-3",style:{width:200,background:"var(--hud-bg-alt)",borderLeft:"1px solid var(--terminal-border)"},children:[c.jsx("div",{className:"text-[10px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Selected"}),c.jsx("div",{className:"text-xs font-bold mb-1",style:{color:"var(--terminal-text)"},children:D.title}),c.jsx("div",{className:"w-2 h-2 rounded-full mb-2",style:{background:D.status==="active"?"#16a34a":D.status==="draft"?"#f59e0b":"#94a3b8"}}),D.tldr&&c.jsx("div",{className:"text-[10px] mb-2 leading-relaxed",style:{color:"var(--terminal-text-secondary)"},children:D.tldr}),D.links.length>0&&c.jsxs("div",{className:"mb-2",children:[c.jsx("div",{className:"text-[9px] font-bold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Links"}),D.links.slice(0,5).map((I,L)=>c.jsxs("div",{className:"text-[9px] mb-0.5 truncate",style:{color:"var(--terminal-text-secondary)"},children:["🔗"," ",I.text]},L))]}),c.jsx("button",{className:"w-full py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white",style:{background:"#16a34a"},onClick:()=>{f("list"),g(D.id),C(null)},children:"Open Document"})]})]}),c.jsx("div",{className:"shrink-0 p-2",style:{borderTop:"1px solid var(--terminal-border)"},children:c.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(ks).map(([I,L])=>c.jsxs("div",{className:"flex items-center gap-1 text-[9px]",children:[c.jsx("div",{className:"w-2 h-2",style:{background:L.border}}),c.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:I})]},I))})})]})]})]})}function uy({label:t,active:l,onClick:a}){return c.jsx("button",{onClick:a,className:"px-4 py-2.5 text-sm font-medium cursor-pointer",style:{color:l?"#4ade80":"var(--terminal-text-muted)",borderBottom:l?"2px solid #4ade80":"2px solid transparent"},children:t})}function Lj({standups:t,waves:l,decisions:a,mode:i,onClose:o,terminalWidth:u=0}){const[f,m]=j.useState(i==="decisions"?"decisions":"standups"),{panelRight:p,panelWidth:h,isResizing:g,handleResizeStart:y}=hh(u);return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:p},onClick:o}),c.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${g?"resizing":""}`,style:{right:p,width:h,background:"var(--terminal-bg)",borderLeftColor:"var(--desk-wood)"},children:[c.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${g?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:y}),c.jsxs("div",{className:"p-5 bg-[var(--desk-wood)] text-white relative",children:[c.jsx("button",{onClick:o,className:"absolute top-3 right-3 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),c.jsx("div",{className:"text-lg font-bold",children:i==="bulletin"?"📌 Bulletin Board":"📜 Decision Log"})]}),c.jsx("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:i==="bulletin"?c.jsxs(c.Fragment,{children:[c.jsx(ud,{label:`Standups (${t.length})`,active:f==="standups",onClick:()=>m("standups")}),c.jsx(ud,{label:`Waves (${l.length})`,active:f==="waves",onClick:()=>m("waves")})]}):c.jsx(ud,{label:`Decisions (${a.length})`,active:f==="decisions",onClick:()=>m("decisions")})}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[f==="standups"&&t.map((b,v)=>c.jsx(fd,{title:`Standup ${b.date}`,content:b.content},v)),f==="waves"&&l.map((b,v)=>c.jsx(fd,{title:`Wave ${b.id}`,subtitle:b.timestamp,content:b.content},v)),f==="decisions"&&a.map((b,v)=>c.jsx(fd,{title:`#${b.id} ${b.title}`,subtitle:b.date,content:b.content},v))]})]})]})}function ud({label:t,active:l,onClick:a}){return c.jsx("button",{onClick:a,className:"px-4 py-2.5 text-sm font-medium cursor-pointer",style:{color:l?"var(--accent)":"var(--terminal-text-muted)",borderBottom:l?"2px solid var(--accent)":"2px solid transparent"},children:t})}function Hj(t){return t.replace(/^#{1,6}\s+/gm,"").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/```[\s\S]*?```/g,"").replace(/^\s*[-*+]\s+/gm,"• ").replace(/^\s*\d+\.\s+/gm,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/^>\s+/gm,"").replace(/^---+$/gm,"").replace(/\|[^|]*\|/g,"").replace(/\n{2,}/g," · ").replace(/\n/g," ").trim()}function fd({title:t,subtitle:l,content:a}){const[i,o]=j.useState(!1),u=a.length>100,f=Hj(a).slice(0,160);return c.jsxs("div",{className:"mb-3 rounded-lg overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[c.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>o(!i),children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("div",{className:"font-medium text-sm",style:{color:"var(--terminal-text)"},children:t}),c.jsx("span",{className:"text-xs shrink-0 ml-2",style:{color:"var(--terminal-text-muted)"},children:i?"▲":"▼"})]}),l&&c.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--terminal-text-muted)"},children:l})]}),i&&c.jsx("div",{className:"px-3 pb-3 text-xs leading-relaxed pt-2",style:{borderTop:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:c.jsx(Ns,{content:a})}),!i&&u&&c.jsx("div",{className:"px-3 pb-2 text-xs line-clamp-2 leading-relaxed",style:{color:"var(--terminal-text-muted)"},children:f})]})}function Uj({projectId:t,onClose:l,terminalWidth:a=0}){const[i,o]=j.useState(null),{panelRight:u,panelWidth:f,isResizing:m,handleResizeStart:p}=hh(a);if(j.useEffect(()=>{Te.getProject(t).then(o).catch(console.error)},[t]),!i)return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),c.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px] border-[var(--meeting-blue)]",style:{right:u,width:f,background:"var(--terminal-bg)"},children:c.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading project..."})})]});const h=i.tasks.filter(b=>b.status==="done").length,g=i.tasks.length,y=g>0?Math.round(h/g*100):0;return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),c.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] border-[var(--meeting-blue)] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${m?"resizing":""}`,style:{right:u,width:f,background:"var(--terminal-bg)"},children:[c.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${m?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:p}),c.jsxs("div",{className:"p-5 bg-[var(--meeting-blue)] text-white relative",children:[c.jsx("div",{className:"text-sm opacity-70",children:"Meeting Room"}),c.jsx("button",{onClick:l,className:"absolute top-3 right-3 z-10 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),c.jsx("div",{className:"text-xl font-bold mt-1",children:i.name}),c.jsxs("div",{className:"flex items-center gap-3 mt-3 text-sm",children:[c.jsxs("span",{children:["Tasks: ",g]}),c.jsxs("span",{children:["Done: ",h]}),c.jsxs("span",{children:["Progress: ",y,"%"]})]}),c.jsx("div",{className:"mt-2 h-1.5 bg-white/20 rounded-full overflow-hidden",children:c.jsx("div",{className:"h-full bg-white rounded-full transition-all",style:{width:`${y}%`}})})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[i.prd&&c.jsxs("div",{className:"mb-5",children:[c.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"PRD"}),c.jsx("div",{className:"rounded-lg p-4 text-xs leading-relaxed max-h-60 overflow-y-auto",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:c.jsx(Ns,{content:i.prd})})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:["Tasks (",g,")"]}),c.jsx("div",{className:"space-y-2",children:i.tasks.map(b=>c.jsxs("div",{className:"rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-sm font-medium",style:{color:"var(--terminal-text)"},children:b.title}),c.jsx(Ij,{status:b.status})]}),c.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-muted)"},children:b.role}),b.description&&c.jsx("div",{className:"text-xs mt-1.5 line-clamp-2",style:{color:"var(--terminal-text-secondary)"},children:b.description})]},b.id))})]})]})]})]})}function Ij({status:t}){const l={done:{bg:"rgba(34,197,94,0.15)",color:"#4ade80"},"in-progress":{bg:"rgba(59,130,246,0.15)",color:"#60a5fa"},todo:{bg:"rgba(148,163,184,0.15)",color:"var(--terminal-text-muted)"}},a=l[t]??l.todo;return c.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:a.bg,color:a.color},children:t})}const Yj={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function qj({roleId:t,roleName:l,mode:a="assign",onClose:i,onExecutionStart:o}){const[u,f]=j.useState(""),m=j.useRef(null);j.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const p=()=>{u.trim()&&(o(t,u.trim()),i())},h=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&p(),y.key==="Escape"&&i()},g=Yj[t]??"#666";return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),c.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[520px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[c.jsxs("div",{className:"p-5 text-white",style:{background:`linear-gradient(135deg, ${g}, ${g}cc)`},children:[c.jsx("div",{className:"text-lg font-bold",children:a==="ask"?"Ask":"Assign Task"}),c.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:a==="ask"?`to ${l}`:`to ${l} (${t})`})]}),c.jsxs("div",{className:"p-5",children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Task Description"}),c.jsx("textarea",{ref:m,value:u,onChange:y=>f(y.target.value),onKeyDown:h,placeholder:a==="ask"?"What would you like to ask?":"Describe the task...",className:"w-full h-32 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),c.jsx("div",{className:"text-[10px] text-white/30 mt-1",children:"Cmd+Enter to submit"})]}),c.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[c.jsx("button",{onClick:i,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),c.jsx("button",{onClick:p,disabled:!u.trim(),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:g},children:a==="ask"?"Ask":"Assign"})]})]})]})}const fy={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function eg({event:t,isThinkingCollapsed:l,onToggleThinking:a,onNavigateToJob:i,onOpenKnowledgeDoc:o,compact:u}){var m;const f=fy[t.roleId]??"#888";switch(t.type){case"text":return c.jsx("div",{className:"text-green-300/90 whitespace-pre-wrap leading-relaxed",children:u?(t.data.text??"").slice(0,300):t.data.text});case"thinking":{const p=t.data.text??"";return c.jsxs("div",{className:"group",children:[c.jsxs("button",{onClick:a,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-[10px] cursor-pointer flex items-center gap-1",children:[c.jsx("span",{children:l?"▶":"▼"}),c.jsx("span",{className:"italic",children:"thinking..."})]}),!l&&c.jsxs("div",{className:`ml-3 text-[var(--terminal-text-muted)] italic whitespace-pre-wrap opacity-60 text-[11px] overflow-y-auto ${u?"max-h-[60px]":"max-h-[120px]"}`,children:[p.slice(0,u?200:500),p.length>(u?200:500)?"...":""]})]})}case"tool:start":{const p=String(t.data.name??""),h=t.data.input,g=typeof(h==null?void 0:h.command)=="string"?h.command.slice(0,80):"",y=typeof(h==null?void 0:h.file_path)=="string"?String(h.file_path):typeof(h==null?void 0:h.path)=="string"?String(h.path):"",b=y?y.split("/").pop()??"":"",v=/^(write_file|Write|edit_file|Edit)$/i.test(p),S=(m=y.match(/(?:^|\/)knowledge\/(.+\.md)$/))==null?void 0:m[1],k=v&&S&&o;return c.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[c.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${k?"text-green-400/80 bg-green-400/10":"text-blue-400/80 bg-blue-400/10"}`,children:k?v&&p.toLowerCase().includes("edit")?"Edit":"Write":p}),k?c.jsx("button",{onClick:()=>o(S),className:"text-[10px] text-green-400 hover:text-green-300 underline underline-offset-2 cursor-pointer truncate",style:{maxWidth:u?200:400},children:b}):c.jsxs(c.Fragment,{children:[g&&c.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:g}),b&&c.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:b})]})]})}case"dispatch:start":{const p=t.data.targetRoleId??t.data.roleId??"",h=t.data.task??"",g=t.data.childJobId,y=fy[p]??"#888";return c.jsx("div",{className:"my-1 p-2 rounded-lg border cursor-pointer hover:opacity-90 transition-opacity",style:{borderColor:`${y}44`,background:`${y}11`},onClick:()=>g&&(i==null?void 0:i(g)),children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("span",{style:{color:y},className:"font-bold text-[11px]",children:["→"," ",p.toUpperCase()]}),c.jsx("span",{className:"text-[var(--terminal-text-secondary)] text-[10px] truncate flex-1",children:h.slice(0,u?60:100)}),g&&i&&c.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/10 text-[var(--terminal-text-muted)]",children:["View ","→"]})]})})}case"dispatch:done":return c.jsx("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pl-3 border-l-2 border-[var(--terminal-border)] my-0.5",children:"Dispatch completed"});case"turn:complete":return c.jsx("div",{className:"border-t border-[var(--terminal-border)] my-2 relative",children:c.jsxs("span",{className:"absolute -top-2 left-2 bg-[var(--terminal-bg)] px-2 text-[9px] text-[var(--terminal-text-muted)]",children:["Turn ",t.data.turn]})});case"stderr":return c.jsxs("div",{className:"text-red-400/80 text-[11px]",children:["⚠"," ",t.data.message]});case"job:start":return c.jsxs("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pb-1",children:[c.jsx("span",{style:{color:f},className:"font-bold",children:t.roleId.toUpperCase()})," ","started: ",(t.data.task??"").slice(0,u?50:80)]});case"job:done":{const p=t.data.turns??0,h=t.data.toolCalls??0;return c.jsx("div",{className:"mt-2 p-2 rounded-lg bg-green-900/20 border border-green-800/30",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-2 h-2 rounded-full bg-green-400"}),c.jsx("span",{className:"text-green-300 font-bold text-[11px]",children:"Complete"}),c.jsxs("span",{className:"text-[var(--terminal-text-muted)] text-[10px]",children:[p," turns · ",h," tools"]})]})})}case"job:error":return c.jsx("div",{className:"mt-2 p-2 rounded-lg bg-red-900/20 border border-red-800/30",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-2 h-2 rounded-full bg-red-400"}),c.jsx("span",{className:"text-red-300 font-bold text-[11px]",children:"Error"}),c.jsx("span",{className:"text-red-200/70 text-[10px]",children:t.data.message})]})});case"import:scan":case"import:process":case"import:created":return c.jsxs("div",{className:"text-cyan-300/70 text-[11px]",children:["[",t.type,"] ",JSON.stringify(t.data)]});default:return null}}function Xj({jobId:t,title:l,color:a,variant:i,style:o,onClose:u,onMinimize:f,onDone:m,onNavigateToJob:p,onOpenKnowledgeDoc:h}){const{events:g,status:y,textOutput:b,childJobIds:v}=Fy(t),[S,k]=j.useState(0),[C,E]=j.useState(new Set),M=j.useRef(null),$=j.useRef(Date.now()),O=j.useRef(!1);j.useEffect(()=>{const I=setInterval(()=>{k(Math.floor((Date.now()-$.current)/1e3))},1e3);return()=>clearInterval(I)},[]),j.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[g]),j.useEffect(()=>{(y==="done"||y==="error")&&!O.current&&(O.current=!0,m==null||m())},[y,m]);const B=I=>{E(L=>{const ee=new Set(L);return ee.has(I)?ee.delete(I):ee.add(I),ee})},T={idle:"Waiting",connecting:"Connecting...",streaming:"Working",done:"Complete",error:"Error"}[y],Y={idle:"#888",connecting:"#888",streaming:a,done:"#2E7D32",error:"#C62828"}[y],V=I=>`${Math.floor(I/60)}:${String(I%60).padStart(2,"0")}`,te=y==="done"||y==="error",D=c.jsxs("div",{className:i==="modal"?"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] h-[85vh] z-[61] bg-[var(--terminal-bg)] rounded-2xl shadow-2xl overflow-hidden flex flex-col":"bg-[var(--terminal-bg)] rounded-xl border border-[var(--terminal-border)] overflow-hidden flex flex-col max-h-[400px]",style:o,children:[c.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{background:Y}}),c.jsx("div",{children:c.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:l})})]}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:V(S)}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:`${Y}22`,color:Y},children:T}),f&&i==="modal"&&c.jsx("button",{onClick:f,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),te&&c.jsx("button",{onClick:u,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),c.jsxs("div",{ref:M,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[g.length===0&&y==="connecting"&&c.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:"Connecting to activity stream..."}),g.map(I=>c.jsx(eg,{event:I,isThinkingCollapsed:C.has(I.seq),onToggleThinking:()=>B(I.seq),onNavigateToJob:p,onOpenKnowledgeDoc:h},I.seq)),y==="streaming"&&c.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),c.jsxs("div",{className:"px-5 py-3 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[c.jsxs("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:[g.length>0&&`${g.length} events`,b.length>0&&` · ${b.length} chars`,v.length>0&&` · ${v.length} dispatches`]}),te&&c.jsx("button",{onClick:u,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer",style:{background:a},children:"Close"})]})]});return i==="modal"?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:te?u:void 0}),D]}):D}const dd={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function Vj({orgNodes:t,rootId:l}){const a=t[l];if(!a)return null;const o=a.children.map(m=>t[m]).filter(Boolean),u=[];for(const m of o)for(const p of m.children){const h=t[p];h&&u.push({node:h,parentId:m.id})}const f=o.length+u.length;return c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Propagation Preview"}),c.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-lg p-4",children:[c.jsx("div",{className:"flex justify-center mb-2",children:c.jsx("span",{className:"px-3 py-1 text-[10px] font-bold rounded border-2 border-white/20 bg-white/5 text-white/30 uppercase",children:"CEO"})}),o.length>0&&c.jsx("div",{className:"flex justify-center mb-1",children:c.jsx("div",{className:"w-px h-3 bg-white/15"})}),o.length>1&&c.jsx("div",{className:"flex justify-center mb-1",children:c.jsx("div",{className:"h-px bg-white/15",style:{width:`${Math.min(o.length*80,320)}px`}})}),c.jsx("div",{className:"flex justify-center gap-3 mb-2 flex-wrap",children:o.map(m=>c.jsxs("div",{className:"flex flex-col items-center",children:[c.jsx("span",{className:"px-2.5 py-1 text-[10px] font-bold rounded border-2 uppercase",style:{borderColor:dd[m.id]??"#888",color:dd[m.id]??"#888",background:`${dd[m.id]??"#888"}22`},children:m.id}),c.jsx("span",{className:"text-[8px] text-white/30 mt-0.5",children:"direct"})]},m.id))}),u.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"flex justify-center mb-1",children:c.jsx("div",{className:"w-px h-2 bg-white/10"})}),c.jsx("div",{className:"flex justify-center gap-2 flex-wrap",children:u.map(({node:m})=>c.jsx("span",{className:"px-2 py-0.5 text-[9px] font-semibold rounded border border-white/15 text-white/40 uppercase",children:m.id},m.id))}),c.jsx("div",{className:"text-center text-[8px] text-white/30 mt-1",children:"via re-dispatch"})]})]}),c.jsxs("div",{className:"text-[10px] text-gray-400 mt-1.5",children:[f," role",f!==1?"s":""," will receive this wave"]})]})}function Gj({cLevelRoles:t,orgNodes:l,rootId:a,onClose:i,onDispatch:o}){const[u,f]=j.useState(""),m=j.useRef(null);j.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const p=()=>{!u.trim()||t.length===0||(o(u.trim()),i())},h=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&p(),y.key==="Escape"&&i()},g=a&&Object.keys(l).length>0;return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),c.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[560px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[c.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[c.jsx("div",{className:"text-lg font-bold",children:"CEO Wave"}),c.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:"Broadcast a directive to all C-Level reports"})]}),c.jsxs("div",{className:"p-5 space-y-4",children:[g&&c.jsx(Vj,{orgNodes:l,rootId:a}),!g&&c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Dispatching to"}),c.jsx("div",{className:"flex gap-2 flex-wrap",children:t.length>0?t.map(y=>c.jsxs("span",{className:"px-3 py-1.5 text-xs font-semibold rounded-lg border-2 border-red-200 bg-red-50 text-red-800",children:[y.id.toUpperCase()," · ",y.name]},y.id)):c.jsx("span",{className:"text-xs text-gray-400 italic",children:"No C-Level roles found"})}),c.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Each C-Level receives the directive and delegates to their reports"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Directive"}),c.jsx("textarea",{ref:m,value:u,onChange:y=>f(y.target.value),onKeyDown:h,placeholder:"e.g. Report current status across all departments",className:"w-full h-28 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),c.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Cmd+Enter to dispatch"})]})]}),c.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[c.jsx("button",{onClick:i,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),c.jsxs("button",{onClick:p,disabled:!u.trim()||t.length===0,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#B71C1C"},children:["Dispatch to ",t.length," Role",t.length!==1?"s":""]})]})]})]})}function Kj(t,l,a){const[i,o]=j.useState(new Map),[u,f]=j.useState(null),m=j.useRef(new Map),p=j.useRef(i);p.current=i,j.useEffect(()=>{if(!a||Object.keys(l).length===0)return;const b=new Map,v=k=>{const C=l[k];C&&(b.set(k,{jobId:null,roleId:k,roleName:C.name,children:C.children,status:"waiting",events:[],streamStatus:"idle"}),C.children.forEach(v))},S=l[a];S&&(b.set(a,{jobId:null,roleId:a,roleName:"CEO",children:S.children,status:"not-dispatched",events:[],streamStatus:"idle"}),S.children.forEach(v));for(const k of t){const C=b.get(k.roleId);C&&(C.jobId=k.jobId,C.status="running",C.streamStatus="connecting")}o(b),t.length>0&&f(t[0].roleId)},[t,l,a]);const h=j.useCallback((b,v)=>{const S=m.current.get(b);S&&S.controller.abort();const k=new AbortController,C={controller:k,lastSeq:-1};m.current.set(b,C);const M=`/api/jobs/${b}/stream?from=0`;fetch(M,{signal:k.signal}).then(async $=>{if(!$.ok||!$.body){o(Y=>{const V=new Map(Y),te=V.get(v);return te&&V.set(v,{...te,streamStatus:"error"}),V});return}o(Y=>{const V=new Map(Y),te=V.get(v);return te&&V.set(v,{...te,streamStatus:"streaming",status:"running"}),V});const O=$.body.getReader(),B=new TextDecoder;let T="";for(;;){const{done:Y,value:V}=await O.read();if(Y)break;T+=B.decode(V,{stream:!0});const te=T.split(`
|
|
80
|
-
`);T=te.pop()??"";let D="";for(const I of te)if(I.startsWith("event: "))D=I.slice(7).trim();else if(I.startsWith("data: ")){try{const L=JSON.parse(I.slice(6));if(D==="activity"){const ee=L;ee.seq>C.lastSeq&&(C.lastSeq=ee.seq),o(ae=>{const X=new Map(ae),U=X.get(v);if(!U||U.events.some(ie=>ie.seq===ee.seq))return ae;const Q={...U,events:[...U.events,ee]};if(ee.type==="dispatch:start"&&ee.data.childJobId){const ie=ee.data.childJobId,ve=ee.data.targetRoleId??ee.data.roleId;if(ve){const z=X.get(ve);z&&(X.set(ve,{...z,jobId:ie,status:"running",streamStatus:"connecting"}),setTimeout(()=>h(ie,ve),0))}}return ee.type==="job:done"?(Q.status="done",Q.streamStatus="done"):ee.type==="job:error"&&(Q.status="error",Q.streamStatus="error"),X.set(v,Q),X})}else if(D==="stream:end"){const ee=L.reason;o(ae=>{const X=new Map(ae),U=X.get(v);if(!U)return ae;const Q=ee==="error"?"error":"done";return X.set(v,{...U,status:U.status==="running"?Q:U.status,streamStatus:Q==="error"?"error":"done"}),X})}}catch{}D=""}}}).catch($=>{$.name!=="AbortError"&&o(O=>{const B=new Map(O),T=B.get(v);return T&&B.set(v,{...T,streamStatus:"error"}),B})})},[]);j.useEffect(()=>{if(t.length!==0){for(const b of t)h(b.jobId,b.roleId);return()=>{for(const[,b]of m.current)b.controller.abort();m.current.clear()}}},[t,h]);const g=(()=>{let b=0,v=0,S=0;for(const[k,C]of i)k!==a&&(S++,C.status==="done"?b++:C.status==="running"&&v++);return{done:b,total:S,running:v}})(),y=g.total>0&&g.running===0&&Array.from(i.values()).every(b=>b.status!=="running"&&b.streamStatus!=="streaming"&&b.streamStatus!=="connecting");return j.useEffect(()=>{y&&o(b=>{const v=new Map(b);let S=!1;for(const[k,C]of v)C.status==="waiting"&&(v.set(k,{...C,status:"not-dispatched"}),S=!0);return S?v:b})},[y]),{nodes:i,selectedRoleId:u,selectNode:f,progress:g,allDone:y}}const dy={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},lr=120,Kl=44,hy=80;function Qj(t,l){if(!t.get(l))return{layout:[],width:300,height:200};const i=[],o=[],u=[{id:l,depth:0,parentId:null}],f=new Set;for(;u.length>0;){const{id:g,depth:y,parentId:b}=u.shift();if(f.has(g))continue;for(f.add(g);o.length<=y;)o.push([]);o[y].push(g),i.push({roleId:g,x:0,y:y*hy+20,parentId:b});const v=t.get(g);if(v)for(const S of v.children)t.has(S)&&!f.has(S)&&u.push({id:S,depth:y+1,parentId:g})}const m=Math.max(...o.map(g=>g.length))*(lr+16),p=Math.max(m,280);for(const g of o){const y=g.length*(lr+16)-16,b=(p-y)/2;g.forEach((v,S)=>{const k=i.find(C=>C.roleId===v);k&&(k.x=b+S*(lr+16))})}const h=o.length*hy+40;return{layout:i,width:p,height:h}}function Zj({nodes:t,rootId:l,selectedRoleId:a,onSelectNode:i}){const{layout:o,width:u,height:f}=Qj(t,l),m=h=>{const g=o.find(y=>y.roleId===h);return g?{cx:g.x+lr/2,cy:g.y+Kl/2}:{cx:0,cy:0}},p=h=>{switch(h.status){case"running":return dy[h.roleId]??"#FBBF24";case"done":return"#2E7D32";case"error":return"#C62828";case"not-dispatched":return"#666";default:return"#888"}};return c.jsxs("svg",{viewBox:`0 0 ${u} ${f}`,width:"100%",height:"100%",className:"block",children:[c.jsx("defs",{children:c.jsxs("filter",{id:"glow",children:[c.jsx("feGaussianBlur",{stdDeviation:"2",result:"blur"}),c.jsxs("feMerge",{children:[c.jsx("feMergeNode",{in:"blur"}),c.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),o.filter(h=>h.parentId).map(h=>{const g=m(h.parentId),y=m(h.roleId),b=t.get(h.roleId),v=t.get(h.parentId);let S="rgba(180,200,240,0.15)",k="4 4",C="";return(b==null?void 0:b.status)==="done"||(v==null?void 0:v.status)==="done"?(S="#2E7D3266",k=""):(b==null?void 0:b.status)==="running"&&(S=dy[h.roleId]??"#FBBF24",k="6 4",C="wave-edge-flow"),c.jsx("line",{x1:g.cx,y1:g.cy+Kl/2-4,x2:y.cx,y2:y.cy-Kl/2+4,stroke:S,strokeWidth:1.5,strokeDasharray:k,className:C},`${h.parentId}-${h.roleId}`)}),o.map(h=>{const g=t.get(h.roleId);if(!g)return null;const y=p(g),b=a===h.roleId,v=h.roleId===l,S=v?.4:g.status==="not-dispatched"?.35:1;return c.jsxs("g",{transform:`translate(${h.x}, ${h.y})`,style:{cursor:v?"default":"pointer",opacity:S},onClick:()=>!v&&i(h.roleId),children:[c.jsx("rect",{x:0,y:0,width:lr,height:Kl,rx:8,ry:8,fill:"var(--terminal-bg-deeper, #181825)",stroke:b?"#fff":y,strokeWidth:b?2:1.5,strokeDasharray:g.status==="not-dispatched"?"4 3":""}),c.jsx("circle",{cx:14,cy:Kl/2,r:4,fill:y,filter:g.status==="running"?"url(#glow)":void 0,children:g.status==="running"&&c.jsx("animate",{attributeName:"opacity",values:"1;0.4;1",dur:"1.5s",repeatCount:"indefinite"})}),c.jsx("text",{x:26,y:Kl/2-4,fill:"var(--terminal-text, #fff)",fontSize:10,fontWeight:700,fontFamily:"var(--pixel-font)",children:g.roleId.toUpperCase()}),c.jsx("text",{x:26,y:Kl/2+10,fill:"var(--terminal-text-muted, #888)",fontSize:8,fontFamily:"var(--pixel-font)",children:g.status==="running"?"Working...":g.status==="done"?"Complete":g.status==="error"?"Error":g.status==="waiting"?"Waiting":""}),g.status==="done"&&c.jsx("text",{x:lr-18,y:Kl/2+4,fontSize:14,fill:"#2E7D32",children:"✓"}),g.status==="error"&&c.jsx("text",{x:lr-18,y:Kl/2+4,fontSize:14,fill:"#C62828",children:"✗"})]},h.roleId)})]})}const Wj={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function Jj({directive:t,rootJobs:l,orgNodes:a,rootRoleId:i,onClose:o,onMinimize:u,onDone:f,onOpenKnowledgeDoc:m}){const{nodes:p,selectedRoleId:h,selectNode:g,progress:y,allDone:b}=Kj(l,a,i),[v,S]=j.useState(0),[k,C]=j.useState(new Set),E=j.useRef(null),M=j.useRef(Date.now()),$=j.useRef(!1);j.useEffect(()=>{const V=setInterval(()=>{S(Math.floor((Date.now()-M.current)/1e3))},1e3);return()=>clearInterval(V)},[]),j.useEffect(()=>{E.current&&(E.current.scrollTop=E.current.scrollHeight)},[h,p]),j.useEffect(()=>{b&&!$.current&&($.current=!0,f==null||f())},[b,f]);const O=V=>`${Math.floor(V/60)}:${String(V%60).padStart(2,"0")}`,B=h?p.get(h):null,T=h?Wj[h]??"#888":"#888",Y=V=>{C(te=>{const D=new Set(te);return D.has(V)?D.delete(V):D.add(V),D})};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:b?o:void 0}),c.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[960px] max-w-[95vw] h-[85vh] z-[61] bg-[var(--terminal-bg)] rounded-2xl shadow-2xl overflow-hidden flex flex-col",children:[c.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:b?"#2E7D32":"#B71C1C",animation:b?void 0:"wave-pulse 2s ease-in-out infinite"}}),c.jsx("div",{children:c.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:b?"WAVE COMPLETE":"WAVE COMMAND CENTER"})})]}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:O(v)}),c.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:b?"#2E7D3222":"#B71C1C22",color:b?"#2E7D32":"#B71C1C"},children:[y.done,"/",y.total," done"]}),c.jsx("button",{onClick:u,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),b&&c.jsx("button",{onClick:o,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),c.jsx("div",{className:"px-5 py-2 border-b border-[var(--terminal-border)] shrink-0",children:c.jsxs("span",{className:"text-[var(--terminal-text-secondary)] text-xs italic",children:["“",t,"”"]})}),c.jsxs("div",{className:"flex flex-1 min-h-0",children:[c.jsxs("div",{className:"w-[280px] shrink-0 border-r border-[var(--terminal-border)] flex flex-col",children:[c.jsx("div",{className:"px-3 py-2 border-b border-[var(--terminal-border)]",children:c.jsx("span",{className:"text-[10px] font-bold text-[var(--terminal-text-secondary)] uppercase tracking-wider",children:"Org Propagation"})}),c.jsx("div",{className:"flex-1 overflow-auto p-3",children:c.jsx(Zj,{nodes:p,rootId:i,selectedRoleId:h,onSelectNode:g})}),c.jsx("div",{className:"px-3 py-2 border-t border-[var(--terminal-border)] flex flex-wrap gap-x-3 gap-y-1",children:[{label:"running",color:"#FBBF24",dot:!0},{label:"done",color:"#2E7D32",dot:!1},{label:"waiting",color:"#888",dot:!1},{label:"error",color:"#C62828",dot:!1}].map(V=>c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:V.color,animation:V.dot?"wave-pulse 1.5s ease-in-out infinite":void 0}}),c.jsx("span",{className:"text-[8px] text-[var(--terminal-text-muted)]",children:V.label})]},V.label))})]}),c.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[B&&c.jsxs("div",{className:"px-4 py-2 border-b border-[var(--terminal-border)] shrink-0 flex items-center gap-2",children:[c.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:T}}),c.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-xs",children:B.roleId.toUpperCase()}),c.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs",children:B.roleName}),c.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full font-semibold",style:{background:`${T}22`,color:T},children:B.status==="running"?"Working":B.status==="done"?"Complete":B.status==="error"?"Error":B.status==="waiting"?"Waiting":"Not dispatched"})]}),c.jsxs("div",{ref:E,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[B&&B.events.length===0&&c.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:B.status==="waiting"?"Waiting for dispatch...":B.status==="running"?"Connecting to activity stream...":B.status==="not-dispatched"?"This role was not dispatched in this wave.":""}),B==null?void 0:B.events.map(V=>c.jsx(eg,{event:V,isThinkingCollapsed:k.has(V.seq),onToggleThinking:()=>Y(V.seq),onNavigateToJob:te=>{for(const[,D]of p)if(D.jobId===te){g(D.roleId);return}},onOpenKnowledgeDoc:m},V.seq)),(B==null?void 0:B.status)==="running"&&c.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),!B&&c.jsx("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-xs",children:"Click a node in the org tree to view activity"}),c.jsxs("div",{className:"px-4 py-2 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[c.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:B&&B.events.length>0&&`${B.events.length} events`}),b&&c.jsx("button",{onClick:o,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer",style:{background:"#2E7D32"},children:"Close"})]})]})]})]})]})}const Pj={cto:{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"short",outfitStyle:"tshirt",accessory:"glasses"},cbo:{skinColor:"#FDEBD0",hairColor:"#1A0A00",shirtColor:"#E65100",pantsColor:"#37474F",shoeColor:"#1A1A1A",hairStyle:"slicked",outfitStyle:"suit",accessory:"lapels"},pm:{skinColor:"#FDEBD0",hairColor:"#6D4C41",shirtColor:"#2E7D32",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"bun",outfitStyle:"tshirt",accessory:"blush"},engineer:{skinColor:"#F5CBA7",hairColor:"#1A1A1A",shirtColor:"#4A148C",pantsColor:"#37474F",shoeColor:"#7B1FA2",hairStyle:"messy",outfitStyle:"hoodie",accessory:"headphones"},designer:{skinColor:"#FDEBD0",hairColor:"#AD1457",shirtColor:"#AD1457",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"bob",outfitStyle:"tshirt",accessory:"beret"},qa:{skinColor:"#F5CBA7",hairColor:"#4E342E",shirtColor:"#00695C",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"short",outfitStyle:"tshirt",accessory:"badge"},"data-analyst":{skinColor:"#F5CBA7",hairColor:"#3E2723",shirtColor:"#0277BD",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"curly",outfitStyle:"vest",accessory:"none"}};function mh(t){return Pj[t]??{skinColor:"#B0BEC5",hairColor:"#78909C",shirtColor:"#607D8B",pantsColor:"#455A64",shoeColor:"#37474F"}}const tg=["#FDEBD0","#F5CBA7","#D4A07A","#C68642","#8D5524","#5C3A1E","#F3D1C7","#E8BEAC","#B07D62","#704214"],ng=["#1A0A00","#2C1810","#4E342E","#6D4C41","#8D6E63","#D4A574","#F5E6CA","#FFD700","#B71C1C","#AD1457","#4A148C","#1A237E","#004D40","#1A1A1A","#78909C","#E0E0E0"],lg=["#1565C0","#E65100","#2E7D32","#4A148C","#AD1457","#00695C","#D32F2F","#F57F17","#1B5E20","#283593","#4E342E","#37474F","#880E4F","#00838F","#6A1B9A","#FF6F00"],ag=["#37474F","#1A237E","#3E2723","#263238","#1B5E20","#455A64","#212121","#4E342E","#0D47A1","#311B92"],rg=["#212121","#1A1A1A","#37474F","#4E342E","#7B1FA2","#D32F2F","#1565C0","#F57F17","#2E7D32","#FFFFFF"],za={default:{name:"MIDNIGHT",icon:"🌃",vars:{"--floor-light":"#0d1117","--floor-dark":"#0a0e14","--hud-bg":"#0d1117","--hud-bg-alt":"#161b22","--pixel-border":"#30363d","--terminal-bg":"#0d1117","--terminal-border":"#21262d","--terminal-border-hover":"#388bfd","--terminal-text":"#e6edf3","--terminal-text-secondary":"#8b949e","--terminal-text-muted":"#484f58","--accent":"#388bfd","--active-green":"#3fb950","--idle-amber":"#d29922"}},light:{name:"DAYLIGHT",icon:"☀️",vars:{"--floor-light":"#f6f8fa","--floor-dark":"#eaeef2","--hud-bg":"#24292f","--hud-bg-alt":"#32383f","--pixel-border":"#d0d7de","--terminal-bg":"#ffffff","--terminal-border":"#d0d7de","--terminal-border-hover":"#0969da","--terminal-text":"#1f2328","--terminal-text-secondary":"#656d76","--terminal-text-muted":"#8c959f","--accent":"#0969da","--active-green":"#1a7f37","--idle-amber":"#9a6700"}},retro:{name:"RETRO",icon:"🎮",vars:{"--floor-light":"#1a1410","--floor-dark":"#140f0a","--hud-bg":"#1a1410","--hud-bg-alt":"#2a2018","--pixel-border":"#5c4a32","--terminal-bg":"#1a1410","--terminal-border":"#3a2e20","--terminal-border-hover":"#d4a44e","--terminal-text":"#e8d5b0","--terminal-text-secondary":"#a08860","--terminal-text-muted":"#6b5840","--accent":"#d4a44e","--active-green":"#8bba4a","--idle-amber":"#e8a030"}},cyberpunk:{name:"NEON",icon:"🌌",vars:{"--floor-light":"#0a0014","--floor-dark":"#06000e","--hud-bg":"#0a0014","--hud-bg-alt":"#14002a","--pixel-border":"#4a1a80","--terminal-bg":"#0a0014","--terminal-border":"#2a0a50","--terminal-border-hover":"#e040fb","--terminal-text":"#e0d0ff","--terminal-text-secondary":"#9070c0","--terminal-text-muted":"#5a3a80","--accent":"#e040fb","--active-green":"#00ff88","--idle-amber":"#ffab00"}},forest:{name:"FOREST",icon:"🌲",vars:{"--floor-light":"#0a1410","--floor-dark":"#060e0a","--hud-bg":"#0a1410","--hud-bg-alt":"#142a1e","--pixel-border":"#2a5a3a","--terminal-bg":"#0a1410","--terminal-border":"#1a3a26","--terminal-border-hover":"#4ade80","--terminal-text":"#d0f0d8","--terminal-text-secondary":"#70a880","--terminal-text-muted":"#3a6848","--accent":"#4ade80","--active-green":"#86efac","--idle-amber":"#fcd34d"}},ocean:{name:"OCEAN",icon:"🌊",vars:{"--floor-light":"#0a1420","--floor-dark":"#060e18","--hud-bg":"#0a1420","--hud-bg-alt":"#142a40","--pixel-border":"#1e4a6a","--terminal-bg":"#0a1420","--terminal-border":"#163050","--terminal-border-hover":"#38bdf8","--terminal-text":"#d0e8f8","--terminal-text-secondary":"#6090b0","--terminal-text-muted":"#305070","--accent":"#38bdf8","--active-green":"#34d399","--idle-amber":"#fbbf24"}}};function eE({color:t,selected:l,onClick:a}){return c.jsx("button",{onClick:a,className:"customize-swatch",style:{background:t,outline:l?"2px solid #fff":"2px solid transparent",boxShadow:l?`0 0 0 1px ${t}, 0 0 6px ${t}88`:"none"}})}function ss({label:t,presets:l,value:a,onChange:i}){return c.jsxs("div",{className:"customize-row",children:[c.jsxs("div",{className:"customize-row-header",children:[c.jsx("span",{className:"customize-row-label",children:t}),c.jsx("div",{className:"customize-row-current",style:{background:a}})]}),c.jsx("div",{className:"customize-swatches",children:l.map(o=>c.jsx(eE,{color:o,selected:o===a,onClick:()=>i(o)},o))})]})}function hd({label:t,items:l,value:a,onChange:i}){return c.jsxs("div",{className:"customize-row",children:[c.jsx("div",{className:"customize-row-header",children:c.jsx("span",{className:"customize-row-label",children:t})}),c.jsx("div",{className:"customize-swatches",style:{gap:4},children:l.map(o=>c.jsx("button",{onClick:()=>i(o.id===a?void 0:o.id),className:"customize-swatch",style:{width:"auto",height:"auto",padding:"2px 6px",fontSize:9,fontFamily:"var(--font-pixel, monospace)",background:o.id===a?"rgba(255,255,255,0.15)":"rgba(255,255,255,0.04)",outline:o.id===a?"2px solid #fff":"2px solid transparent",color:o.id===a?"#fff":"rgba(255,255,255,0.5)",borderRadius:4},children:o.name},o.id))})]})}function md({label:t,active:l,onClick:a}){return c.jsx("button",{onClick:a,style:{flex:1,padding:"6px 0",fontSize:10,fontFamily:"var(--font-pixel, monospace)",fontWeight:"bold",letterSpacing:1,background:l?"rgba(255,255,255,0.08)":"transparent",color:l?"#fff":"rgba(255,255,255,0.35)",border:"none",borderBottom:l?"2px solid #3B82F6":"2px solid transparent",cursor:"pointer",transition:"all 0.15s"},children:t})}function Ca(t){return t[Math.floor(Math.random()*t.length)]}function ds(){var i,o,u;const t=q0(),l=X0(),a=V0();return{skinColor:Ca(tg),hairColor:Ca(ng),shirtColor:Ca(lg),pantsColor:Ca(ag),shoeColor:Ca(rg),hairStyle:(i=Ca(t))==null?void 0:i.id,outfitStyle:(o=Ca(l))==null?void 0:o.id,accessory:(u=Ca(a))==null?void 0:u.id}}function ig({roleId:t,appearance:l,onChange:a,onRandomize:i,onReset:o,label:u}){const[f,m]=j.useState("look"),p=j.useCallback((S,k)=>{a({...l,[S]:k})},[l,a]),h=j.useRef(null),g=j.useCallback(S=>{var E;const k=(E=S.target.files)==null?void 0:E[0];if(!k)return;const C=new Image;C.onload=()=>{const M=jS(C);a({...M,hairStyle:l.hairStyle,outfitStyle:l.outfitStyle,accessory:l.accessory}),URL.revokeObjectURL(C.src)},C.src=URL.createObjectURL(k),S.target.value=""},[l.hairStyle,l.outfitStyle,l.accessory,a]),y=q0(),b=X0(),v=V0();return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"customize-preview",children:[c.jsx("div",{className:"customize-preview-bg",children:c.jsx(Cc,{roleId:t,appearance:l,scale:12})}),u&&c.jsx("div",{className:"customize-preview-name",children:u}),c.jsxs("div",{className:"customize-preview-actions",children:[c.jsx("button",{className:"customize-btn customize-btn--random",onClick:i,children:"RANDOM"}),c.jsx("button",{className:"customize-btn customize-btn--reset",onClick:o,children:"RESET"}),c.jsx("button",{className:"customize-btn",onClick:()=>{var S;return(S=h.current)==null?void 0:S.click()},style:{fontSize:9,opacity:.7},children:"PHOTO"}),c.jsx("input",{ref:h,type:"file",accept:"image/*",onChange:g,style:{display:"none"}})]})]}),c.jsxs("div",{className:"customize-colors",children:[c.jsxs("div",{style:{display:"flex",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:[c.jsx(md,{label:"LOOK",active:f==="look",onClick:()=>m("look")}),c.jsx(md,{label:"OUTFIT",active:f==="outfit",onClick:()=>m("outfit")}),c.jsx(md,{label:"ACCESSORY",active:f==="accessory",onClick:()=>m("accessory")})]}),f==="look"&&c.jsxs(c.Fragment,{children:[c.jsx(ss,{label:"SKIN",presets:tg,value:l.skinColor,onChange:S=>p("skinColor",S)}),c.jsx(ss,{label:"HAIR COLOR",presets:ng,value:l.hairColor,onChange:S=>p("hairColor",S)}),c.jsx(hd,{label:"HAIR STYLE",items:y,value:l.hairStyle,onChange:S=>p("hairStyle",S)})]}),f==="outfit"&&c.jsxs(c.Fragment,{children:[c.jsx(hd,{label:"STYLE",items:b,value:l.outfitStyle,onChange:S=>p("outfitStyle",S)}),c.jsx(ss,{label:"TOP",presets:lg,value:l.shirtColor,onChange:S=>p("shirtColor",S)}),c.jsx(ss,{label:"PANTS",presets:ag,value:l.pantsColor,onChange:S=>p("pantsColor",S)}),c.jsx(ss,{label:"SHOES",presets:rg,value:l.shoeColor,onChange:S=>p("shoeColor",S)})]}),f==="accessory"&&c.jsxs(c.Fragment,{children:[c.jsx(hd,{label:"ACCESSORY",items:v,value:l.accessory,onChange:S=>p("accessory",S)}),c.jsx("div",{style:{marginTop:12,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:6,border:"1px dashed rgba(255,255,255,0.08)",color:"rgba(255,255,255,0.25)",fontSize:9,fontFamily:"var(--font-pixel, monospace)",textAlign:"center"},children:"More accessories coming soon"})]})]})]})}const tE=[{value:"c-level",label:"C-Level"},{value:"team-lead",label:"Team Lead"},{value:"member",label:"Member"}];function sg(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,24)}function my(t){switch(t){case"c-level":return{authority:{autonomous:["Strategic decisions within domain","Task delegation to reports"],needsApproval:["Budget over $5K","External commitments"]},knowledge:{reads:["company/","operations/","projects/"],writes:["operations/","knowledge/"]},reports:{daily:"standup",weekly:"summary"}};case"team-lead":return{authority:{autonomous:["Task planning","Sprint management"],needsApproval:["Architecture changes","New tool adoption"]},knowledge:{reads:["projects/","architecture/"],writes:["projects/"]},reports:{daily:"standup",weekly:"summary"}};default:return{authority:{autonomous:["Implementation within assigned tasks"],needsApproval:["Design changes","New dependencies"]},knowledge:{reads:["projects/"],writes:[]},reports:{daily:"standup",weekly:""}}}}const os=4;function nE(t,l,a){const i=t.trim();if(!i||i.startsWith("#"))return null;const o=i.split(",").map(y=>y.trim()),u=o[0];if(!u)return null;const f=sg(u),m=(o[1]||"member").toLowerCase(),p=m==="c-level"?"c-level":m==="team-lead"?"team-lead":"member",h=o[2]||"ceo";let g;return l.has(f)?g="ID already exists":a.has(f)&&(g="Duplicate ID in batch"),a.add(f),{name:u,id:f,level:p,reportsTo:h,error:g}}function lE({existingRoles:t,onClose:l,onHire:a}){const[i,o]=j.useState("single"),[u,f]=j.useState(1),[m,p]=j.useState(""),[h,g]=j.useState(""),[y,b]=j.useState(!1),[v,S]=j.useState("member"),[k,C]=j.useState("ceo"),[E,M]=j.useState(""),[$,O]=j.useState(ds),[B,T]=j.useState(!1),[Y,V]=j.useState(""),[te,D]=j.useState([]),[I,L]=j.useState(new Set),[ee,ae]=j.useState(""),[X,U]=j.useState("input"),[Q,ie]=j.useState({done:0,total:0}),ve=j.useRef(null),z=j.useRef(null),_=j.useRef(null);j.useEffect(()=>{Te.getSkills().then(ne=>D(ne.filter(xe=>xe.installed))).catch(()=>{})},[]),j.useEffect(()=>{var ne,xe,je;i==="single"?(u===1&&((ne=ve.current)==null||ne.focus()),u===2&&((xe=z.current)==null||xe.focus())):X==="input"&&((je=_.current)==null||je.focus())},[u,i,X]);const P=j.useMemo(()=>new Set(t.map(ne=>ne.id)),[t]),A=j.useMemo(()=>{const ne=ee.split(`
|
|
81
|
-
`),xe=new Set;return ne.map(je=>nE(je,P,xe)).filter(je=>je!==null)},[ee,P]),pe=A.length>0&&A.every(ne=>!ne.error),Se=ne=>{p(ne),y||g(sg(ne))},Ce=m.trim().length>0&&h.trim().length>0&&!t.some(ne=>ne.id===h),Fe=E.trim().length>0,Ye=async()=>{T(!0),V("");const ne=my(v);try{await a({id:h,name:m.trim(),level:v,reportsTo:k,persona:E.trim(),...ne,skills:I.size>0?[...I]:void 0},$),l()}catch(xe){V(xe instanceof Error?xe.message:"Failed to create role"),T(!1)}},se=ne=>ne===1?Ce:ne===2?Fe:!0,K=async()=>{T(!0),V(""),ie({done:0,total:A.length});try{for(let ne=0;ne<A.length;ne++){const xe=A[ne],je=my(xe.level),Ae=ds(),Re=`${xe.name}. A ${xe.level} role reporting to ${xe.reportsTo}.`;await a({id:xe.id,name:xe.name,level:xe.level,reportsTo:xe.reportsTo,persona:Re,...je},Ae),ie({done:ne+1,total:A.length})}l()}catch(ne){V(ne instanceof Error?ne.message:"Failed to create roles"),T(!1)}},ue=ne=>{ne.key==="Escape"&&l(),ne.key==="Enter"&&(ne.metaKey||ne.ctrlKey)&&(i==="single"?u<os&&se(u)?f(u+1):u===os&&Ye():X==="input"&&pe?U("review"):X==="review"&&K())},we=t.some(ne=>ne.id===h)&&h.length>0;return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:l}),c.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[560px] max-h-[90vh] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden flex flex-col",onKeyDown:ue,children:[c.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #2E7D32, #43A047)"},children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("div",{className:"text-lg font-bold",children:"Hire New Role"}),c.jsxs("div",{className:"flex bg-black/20 rounded-lg p-0.5",children:[c.jsx("button",{onClick:()=>{o("single"),V("")},className:`px-3 py-1 text-xs font-semibold rounded-md cursor-pointer transition-colors ${i==="single"?"bg-white/20 text-white":"text-white/50 hover:text-white/70"}`,children:"Single"}),c.jsx("button",{onClick:()=>{o("bulk"),V("")},className:`px-3 py-1 text-xs font-semibold rounded-md cursor-pointer transition-colors ${i==="bulk"?"bg-white/20 text-white":"text-white/50 hover:text-white/70"}`,children:"Bulk"})]})]}),c.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:i==="single"?`Step ${u} of ${os}`:X==="input"?"Enter roles, one per line":`Review ${A.length} roles`})]}),i==="single"&&c.jsx("div",{className:"flex gap-1 px-5 pt-4",children:Array.from({length:os},(ne,xe)=>xe+1).map(ne=>c.jsx("div",{className:"flex-1 h-1 rounded-full transition-colors",style:{background:ne<=u?"#2E7D32":"rgba(255,255,255,0.1)"}},ne))}),c.jsx("div",{className:"p-5 min-h-[240px] overflow-y-auto flex-1",children:i==="single"?c.jsxs(c.Fragment,{children:[u===1&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role Name"}),c.jsx("input",{ref:ve,value:m,onChange:ne=>Se(ne.target.value),placeholder:"e.g. Data Analyst",className:"w-full p-2.5 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 focus:outline-none focus:border-white/25 transition-colors"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role ID (slug)"}),c.jsx("input",{value:h,onChange:ne=>{g(ne.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),b(!0)},className:`w-full p-2.5 rounded-lg border bg-white/5 text-sm text-white/90 font-mono focus:outline-none transition-colors ${we?"border-red-400":"border-white/10 focus:border-white/25"}`}),we&&c.jsx("div",{className:"text-xs text-red-500 mt-1",children:"ID already exists"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Level"}),c.jsx("div",{className:"flex gap-2",children:tE.map(ne=>c.jsx("button",{onClick:()=>S(ne.value),className:`flex-1 p-2 text-xs font-semibold rounded-lg border cursor-pointer transition-colors ${v===ne.value?"border-green-600 bg-green-900/30 text-green-400":"border-white/10 text-white/50 hover:border-white/20"}`,children:ne.label},ne.value))})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Reports To"}),c.jsxs("select",{value:k,onChange:ne=>C(ne.target.value),className:"w-full p-2.5 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 focus:outline-none focus:border-white/25 transition-colors",children:[c.jsx("option",{value:"ceo",className:"bg-[var(--wall)] text-white",children:"CEO"}),t.map(ne=>c.jsxs("option",{value:ne.id,className:"bg-[var(--wall)] text-white",children:[ne.name," (",ne.id,")"]},ne.id))]})]})]}),u===2&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Persona"}),c.jsx("textarea",{ref:z,value:E,onChange:ne=>M(ne.target.value),placeholder:"Describe this role's personality, expertise, and working style...",className:"w-full h-32 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),c.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"This defines how the AI agent will behave in this role"})]}),te.length>0&&c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Skills"}),c.jsx("div",{className:"space-y-1.5 max-h-[120px] overflow-y-auto",children:te.map(ne=>c.jsxs("label",{className:"flex items-center gap-2 p-2 rounded-lg border border-white/10 bg-white/5 cursor-pointer hover:border-white/20 transition-colors",children:[c.jsx("input",{type:"checkbox",checked:I.has(ne.id),onChange:()=>L(xe=>{const je=new Set(xe);return je.has(ne.id)?je.delete(ne.id):je.add(ne.id),je}),className:"accent-green-600"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"text-xs font-semibold text-white/80",children:ne.name}),c.jsx("div",{className:"text-[10px] text-white/40 truncate",children:ne.description})]})]},ne.id))})]})]}),u===3&&c.jsx("div",{className:"customize-body",style:{padding:0},children:c.jsx(ig,{roleId:"default",appearance:$,onChange:O,onRandomize:()=>O(ds()),onReset:()=>O(ds()),label:c.jsxs("span",{children:[h||"new-role"," — ",m||"New Role"]})})}),u===4&&c.jsxs("div",{className:"space-y-3",children:[c.jsx("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Review"}),c.jsxs("div",{className:"bg-white/5 rounded-xl p-4 border border-white/10",children:[c.jsxs("div",{className:"flex gap-4",children:[c.jsx("div",{className:"flex-shrink-0 rounded-lg overflow-hidden",style:{background:"#0d1117",padding:8},children:c.jsx(Cc,{roleId:"default",appearance:$,scale:4})}),c.jsxs("div",{className:"flex-1 space-y-2.5",children:[c.jsx(cs,{label:"Name",value:m}),c.jsx(cs,{label:"ID",value:h,mono:!0}),c.jsx(cs,{label:"Level",value:v}),c.jsx(cs,{label:"Reports To",value:k}),I.size>0&&c.jsx(cs,{label:"Skills",value:[...I].join(", ")})]})]}),c.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[c.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Persona"}),c.jsx("div",{className:"text-xs text-white/60 leading-relaxed",children:E})]})]}),Y&&c.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:Y})]})]}):c.jsxs(c.Fragment,{children:[X==="input"&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Roles (one per line)"}),c.jsx("textarea",{ref:_,value:ee,onChange:ne=>ae(ne.target.value),placeholder:`Name, Level, ReportsTo
|
|
82
|
-
e.g.
|
|
83
|
-
Data Analyst
|
|
84
|
-
DevOps Engineer, member, cto
|
|
85
|
-
VP Marketing, c-level, ceo`,className:"w-full h-40 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors font-mono"}),c.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Format: Name, Level (member/team-lead/c-level), ReportsTo. Level and ReportsTo are optional."})]}),A.length>0&&c.jsxs("div",{children:[c.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Preview (",A.length," role",A.length!==1?"s":"",")"]}),c.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden",children:c.jsxs("table",{className:"w-full text-xs",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-white/10",children:[c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),c.jsx("tbody",{children:A.map((ne,xe)=>c.jsxs("tr",{className:`border-b border-white/5 ${ne.error?"bg-red-900/10":""}`,children:[c.jsx("td",{className:"p-2 text-white/80",children:ne.name}),c.jsx("td",{className:"p-2 text-white/60 font-mono",children:ne.id}),c.jsx("td",{className:"p-2 text-white/60",children:ne.level}),c.jsx("td",{className:"p-2 text-white/60",children:ne.reportsTo}),ne.error&&c.jsx("td",{className:"p-2 text-red-400 text-[10px]",children:ne.error})]},xe))})]})})]})]}),X==="review"&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Confirm Bulk Hire — ",A.length," roles"]}),c.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden max-h-[300px] overflow-y-auto",children:c.jsxs("table",{className:"w-full text-xs",children:[c.jsx("thead",{className:"sticky top-0 bg-[var(--wall)]",children:c.jsxs("tr",{className:"border-b border-white/10",children:[c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"#"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),c.jsx("tbody",{children:A.map((ne,xe)=>c.jsxs("tr",{className:"border-b border-white/5",children:[c.jsx("td",{className:"p-2 text-white/30",children:xe+1}),c.jsx("td",{className:"p-2 text-white/80",children:ne.name}),c.jsx("td",{className:"p-2 text-white/60 font-mono",children:ne.id}),c.jsx("td",{className:"p-2 text-white/60",children:ne.level}),c.jsx("td",{className:"p-2 text-white/60",children:ne.reportsTo})]},xe))})]})}),B&&Q.total>0&&c.jsxs("div",{children:[c.jsxs("div",{className:"flex justify-between text-[10px] text-white/40 mb-1",children:[c.jsx("span",{children:"Hiring..."}),c.jsxs("span",{children:[Q.done,"/",Q.total]})]}),c.jsx("div",{className:"h-1.5 bg-white/10 rounded-full overflow-hidden",children:c.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Q.done/Q.total*100}%`,background:"#2E7D32"}})})]}),c.jsx("div",{className:"text-[10px] text-white/30",children:"Each role will get a random appearance and auto-generated persona. You can customize them later."}),Y&&c.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:Y})]})]})}),c.jsxs("div",{className:"flex justify-between px-5 pb-5",children:[c.jsxs("div",{children:[i==="single"&&u>1&&c.jsx("button",{onClick:()=>f(u-1),className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Back"}),i==="bulk"&&X==="review"&&c.jsx("button",{onClick:()=>U("input"),disabled:B,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer disabled:opacity-40",children:"Back"})]}),c.jsxs("div",{className:"flex gap-3",children:[c.jsx("button",{onClick:l,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),i==="single"?u<os?c.jsx("button",{onClick:()=>f(u+1),disabled:!se(u),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:"Next"}):c.jsx("button",{onClick:Ye,disabled:B,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:B?"Hiring...":"HIRE"}):X==="input"?c.jsxs("button",{onClick:()=>U("review"),disabled:!pe,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:["Review (",A.length,")"]}):c.jsx("button",{onClick:K,disabled:B,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:B?`Hiring ${Q.done}/${Q.total}...`:`HIRE ALL (${A.length})`})]})]})]})]})}function cs({label:t,value:l,mono:a}){return c.jsxs("div",{className:"flex justify-between text-sm",children:[c.jsx("span",{className:"text-white/40",children:t}),c.jsx("span",{className:`font-semibold text-white/80 ${a?"font-mono":""}`,children:l})]})}function aE({roleId:t,roleName:l,onClose:a,onConfirm:i}){const[o,u]=j.useState(!1),f=async()=>{u(!0);try{await i(t)}finally{u(!1)}};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:a}),c.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[480px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[c.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[c.jsx("div",{className:"text-lg font-bold",children:"Fire Role"}),c.jsxs("div",{className:"text-sm opacity-80 mt-0.5",children:["Remove ",l," (",t,")"]})]}),c.jsxs("div",{className:"p-5",children:[c.jsxs("div",{className:"p-4 rounded-lg border-2 border-red-300 bg-red-50 mb-4",children:[c.jsx("div",{className:"text-sm font-bold text-red-800 mb-1",children:"Warning"}),c.jsxs("div",{className:"text-xs text-red-700 leading-relaxed",children:["This will permanently delete the role directory including",c.jsx("strong",{children:" role.yaml"}),", ",c.jsx("strong",{children:"profile.md"}),", ",c.jsx("strong",{children:"SKILL.md"}),", and all journal entries. This action cannot be undone."]})]}),c.jsxs("div",{className:"text-sm text-gray-600",children:["Are you sure you want to fire ",c.jsx("strong",{children:l}),"?"]})]}),c.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[c.jsx("button",{onClick:a,className:"px-4 py-2 text-sm rounded-lg border border-gray-300 hover:bg-gray-50 cursor-pointer",children:"Cancel"}),c.jsx("button",{onClick:f,disabled:o,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#B71C1C"},children:o?"Removing...":"Confirm Fire"})]})]})]})}const rE={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function iE({roleId:t,title:l,roleColor:a,active:i,onClick:o,onClose:u,"data-session-id":f}){return c.jsxs("button",{onClick:o,"data-session-id":f,className:`flex items-center gap-1.5 px-3 py-1.5 text-[11px] rounded-t-lg shrink-0 cursor-pointer transition-colors max-w-[180px] group ${i?"bg-[var(--terminal-bg)] text-[var(--terminal-text)]":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] hover:bg-[var(--terminal-surface)]"}`,style:i?{borderTop:`2px solid ${a}`}:void 0,children:[c.jsx("span",{className:"text-xs",children:rE[t]??"👤"}),c.jsx("span",{className:"truncate",children:l}),c.jsx("span",{onClick:u,className:"ml-auto text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none",children:"×"})]})}function sE({content:t,streaming:l}){let a=t;return l&&(t.match(/```/g)??[]).length%2!==0&&(a+="\n```"),c.jsx("div",{className:"terminal-markdown",children:c.jsx(p0,{remarkPlugins:[H0],components:{code:oE,table:({children:i})=>c.jsx("div",{className:"overflow-x-auto my-2",children:c.jsx("table",{className:"terminal-table",children:i})})},children:a})})}function oE({className:t,children:l,...a}){const i=/language-(\w+)/.exec(t??"");return i||typeof l=="string"&&l.includes(`
|
|
86
|
-
`)?c.jsx(cE,{language:i==null?void 0:i[1],children:l}):c.jsx("code",{className:"terminal-inline-code",...a,children:l})}function cE({children:t,language:l}){const[a,i]=j.useState(!1),o=String(t).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(o),i(!0),setTimeout(()=>i(!1),1500)};return c.jsxs("div",{className:"terminal-code-block group relative my-2",children:[l&&c.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] px-3 pt-1.5",children:l}),c.jsx("button",{onClick:u,className:"absolute top-1.5 right-2 text-[10px] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:a?"Copied!":"Copy"}),c.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:c.jsx("code",{children:o})})]})}const uE={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function xd(t,l){return l?l.file_path?String(l.file_path).replace(/^.*\/(?=[^/]+\/)/,""):l.path?String(l.path).replace(/^.*\/(?=[^/]+\/)/,""):l.pattern?String(l.pattern):l.command?String(l.command).slice(0,60):l.query?String(l.query).slice(0,60):l.url?String(l.url).slice(0,60):"":""}function fE(t){const l=[];let a="";for(const i of t)if(i.type==="thinking")i.text&&(a=i.text),l.length===0||l[l.length-1].type!=="thinking"?l.push({type:"thinking",text:i.text}):l[l.length-1].text=i.text;else if(i.type==="tool")l.push({type:"tool",toolName:i.toolName,toolSummary:xd(i.toolName??"",i.toolInput),toolInput:i.toolInput});else if(i.type==="dispatch")l.push({type:"dispatch",roleId:i.roleId,task:i.task});else if(i.type==="dispatch:progress"){const o=l.length>0?l[l.length-1]:null;(o==null?void 0:o.type)==="dispatch:progress"&&o.roleId===i.roleId?i.progressType==="tool"?(o.toolName=i.toolName,o.toolSummary=xd(i.toolName??"",i.toolInput),o.progressType="tool"):i.progressType==="thinking"?(o.text=i.text,o.progressType="thinking"):i.progressType==="text"?(o.text=i.text,o.progressType="text"):(i.progressType==="done"||i.progressType==="error")&&(o.progressType=i.progressType):l.push({type:"dispatch:progress",roleId:i.roleId,progressType:i.progressType,text:i.text,toolName:i.toolName,toolSummary:i.toolName?xd(i.toolName,i.toolInput):void 0})}if(a){const i=l.filter(o=>o.type==="thinking");i.length>0&&(i[i.length-1].text=a)}return l}function dE({event:t,isStreaming:l}){var o,u,f;const[a,i]=j.useState(!1);switch(t.type){case"thinking":return c.jsxs("div",{className:"stream-event-thinking",children:[c.jsxs("div",{className:"stream-event-thinking-header",onClick:()=>i(!a),children:[c.jsx("span",{className:"stream-event-thinking-icon"}),c.jsxs("span",{className:"stream-event-thinking-label",children:["thinking",l?"...":""]}),t.text&&!l&&c.jsx("span",{className:"stream-event-thinking-toggle",children:a?"▾":"▸"})]}),(l||a)&&t.text&&c.jsx("div",{className:"stream-event-thinking-content",children:t.text.slice(-500)})]});case"tool":return c.jsxs("div",{className:"stream-event-tool",children:[c.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&c.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary}),t.toolInput&&c.jsx("span",{className:"stream-event-tool-toggle",onClick:()=>i(!a),children:a?"▾":"▸"}),a&&t.toolInput&&c.jsx("div",{className:"stream-event-tool-detail",children:JSON.stringify(t.toolInput,null,1).slice(0,300)})]});case"dispatch":return c.jsxs("div",{className:"stream-event-dispatch",children:[c.jsxs("span",{className:"stream-event-dispatch-badge",children:["→"," ",(o=t.roleId)==null?void 0:o.toUpperCase()]}),c.jsx("span",{className:"stream-event-dispatch-task",children:(u=t.task)==null?void 0:u.slice(0,80)})]});case"dispatch:progress":return c.jsxs("div",{className:"stream-event-dispatch-progress",children:[c.jsx("span",{className:"stream-event-dispatch-progress-role",children:(f=t.roleId)==null?void 0:f.toUpperCase()}),t.progressType==="thinking"&&c.jsxs("span",{className:"stream-event-dispatch-progress-status",children:["thinking",l?"...":""]}),t.progressType==="tool"&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&c.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary})]}),t.progressType==="text"&&t.text&&c.jsx("span",{className:"stream-event-dispatch-progress-status",children:"responding..."}),t.progressType==="done"&&c.jsx("span",{className:"stream-event-dispatch-progress-done",children:"done"}),t.progressType==="error"&&c.jsx("span",{className:"stream-event-dispatch-progress-error",children:"error"})]});default:return null}}function hE({events:t,isStreaming:l}){const[a,i]=j.useState(!1);if(t.length===0)return null;const o=fE(t);if(o.length===0)return null;const u=t.filter(b=>b.type==="thinking").length,f=t.filter(b=>b.type==="tool"),m=t.filter(b=>b.type==="dispatch"||b.type==="dispatch:progress"),p=t.filter(b=>b.type==="turn").reduce((b,v)=>Math.max(b,v.turn??0),0),h=[];if(u>0&&h.push("thinking"),f.length>0){const b=[...new Set(f.map(v=>v.toolName))];b.length<=3?h.push(b.join(", ")):h.push(`${f.length} tool calls`)}m.length>0&&h.push(`${m.length} dispatch`),p>1&&h.push(`${p} turns`);const g=h.join(" · "),y=!a;return c.jsxs("div",{className:"stream-activity-log",children:[c.jsxs("div",{className:"stream-activity-header",onClick:()=>i(!a),children:[l&&c.jsx("span",{className:"stream-activity-pulse"}),c.jsxs("span",{className:"stream-activity-summary",children:[a?"▸":"▾"," ",g,l?"...":""]})]}),y&&c.jsx("div",{className:"stream-activity-events",children:o.map((b,v)=>c.jsx(dE,{event:b,isStreaming:l&&v===o.length-1},v))})]})}function mE({message:t,roleId:l,roleColor:a}){var h;const i=t.from==="ceo",o=t.type==="system",u=t.status==="streaming";if(o)return c.jsx("div",{className:"flex justify-center my-2",children:c.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] bg-[var(--terminal-inline-bg)] px-3 py-1 rounded-full",children:t.content})});if(i)return c.jsx("div",{className:"flex justify-end mb-3",children:c.jsxs("div",{className:"max-w-[85%]",children:[c.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] text-right mb-1",children:"CEO"}),c.jsxs("div",{className:"bg-[var(--terminal-surface-light)] rounded-xl rounded-tr-sm px-4 py-2.5 text-sm text-[var(--terminal-text)] leading-relaxed",children:[t.type==="directive"&&c.jsx("span",{className:"text-amber-400 text-[10px] font-bold mr-1.5",children:"DO"}),t.content]})]})});const f=(((h=t.streamEvents)==null?void 0:h.length)??0)>0,m=!!t.thinking,p=m&&!t.content&&u&&!f;return c.jsxs("div",{className:"flex gap-2.5 mb-3",children:[c.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center text-sm shrink-0 mt-5",style:{background:`${a}33`},children:uE[l]??"👤"}),c.jsxs("div",{className:"max-w-[85%] min-w-0",children:[c.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] mb-1",children:l.toUpperCase()}),f&&c.jsx(hE,{events:t.streamEvents,isStreaming:u}),m&&!f&&c.jsxs("details",{open:p,className:"mb-1",children:[c.jsxs("summary",{className:"text-[10px] text-purple-400/70 cursor-pointer select-none flex items-center gap-1",children:[p&&c.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-purple-400 animate-pulse"}),"thinking",p?"...":` (${t.thinking.length} chars)`]}),c.jsx("div",{className:"text-[11px] text-[var(--terminal-text-muted)] leading-relaxed mt-1 pl-2 border-l border-purple-400/20 max-h-32 overflow-y-auto",children:t.thinking.slice(-500)})]}),c.jsxs("div",{className:"rounded-xl rounded-tl-sm px-4 py-2.5 text-sm text-[var(--terminal-text)] leading-relaxed",style:{borderLeft:`3px solid ${a}`,background:"var(--terminal-surface)"},children:[t.content?c.jsx(sE,{content:t.content,streaming:u}):u&&!m?c.jsx("span",{className:"inline-block w-2 h-4 bg-[var(--terminal-text-secondary)] animate-pulse"}):u&&m?c.jsx("span",{className:"text-[11px] text-purple-400/50 italic",children:"analyzing..."}):null,u&&t.content&&c.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-[var(--terminal-text-secondary)] animate-pulse ml-0.5 align-middle"})]}),t.status==="error"&&c.jsx("div",{className:"text-[10px] text-red-400 mt-1",children:"Error occurred"})]})]})}function xE({messages:t,roleId:l,roleColor:a}){var o;const i=j.useRef(null);return j.useEffect(()=>{var u;(u=i.current)==null||u.scrollIntoView({behavior:"smooth"})},[t,(o=t[t.length-1])==null?void 0:o.content]),t.length===0?c.jsxs("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:["Start a conversation with ",l.toUpperCase()]}):c.jsxs("div",{className:"flex-1 overflow-y-auto p-4 terminal-scrollbar",children:[t.map(u=>c.jsx(mE,{message:u,roleId:l,roleColor:a},u.id)),c.jsx("div",{ref:i})]})}function pE({mode:t,onModeChange:l,onSend:a,disabled:i,disabledReason:o}){const[u,f]=j.useState(""),m=j.useRef(null);j.useEffect(()=>{const g=m.current;g&&(g.style.height="0",g.style.height=Math.min(g.scrollHeight,120)+"px")},[u]);const p=()=>{const g=u.trim();!g||i||(a(g),f(""))},h=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),p())};return c.jsxs("div",{className:"border-t border-[var(--terminal-border)] p-3 shrink-0",children:[o&&c.jsx("div",{className:"text-[10px] text-amber-400/70 mb-2 text-center",children:o}),c.jsxs("div",{className:"flex items-end gap-2",children:[c.jsxs("div",{className:"flex rounded-lg overflow-hidden border border-[var(--terminal-border)] shrink-0",children:[c.jsx("button",{onClick:()=>l("talk"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${t==="talk"?"bg-[var(--desk-wood)] text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Talk"}),c.jsx("button",{onClick:()=>l("do"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${t==="do"?"bg-amber-700 text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Do"})]}),c.jsx("textarea",{ref:m,value:u,onChange:g=>f(g.target.value),onKeyDown:h,placeholder:i?"Waiting...":t==="talk"?"Ask something...":"Give a directive...",disabled:i,rows:1,className:"flex-1 bg-[var(--terminal-inline-bg)] border border-[var(--terminal-border)] rounded-lg px-3 py-2 text-sm text-[var(--terminal-text)] placeholder:text-[var(--terminal-text-muted)] resize-none focus:outline-none focus:border-[var(--terminal-border-hover)] disabled:opacity-40 terminal-scrollbar"}),c.jsx("button",{onClick:p,disabled:i||!u.trim(),className:"w-8 h-8 rounded-lg bg-[var(--terminal-surface-light)] text-[var(--terminal-text-secondary)] flex items-center justify-center shrink-0 cursor-pointer hover:bg-[var(--desk-wood)] hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("path",{d:"M22 2L11 13"}),c.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})]})}const yE={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},og={cto:"CTO",cbo:"CBO",pm:"PM",engineer:"Engineer",designer:"Designer",qa:"QA","data-analyst":"Data Analyst"};function xy(t){return new Date(t).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit"})}function gE({msg:t}){const l=yE[t.roleId]??"#888",a=og[t.roleId]??t.roleId;if(t.type==="dispatch"){const i=t.text.includes("WAVE"),o=t.text.includes("completed")||t.text.includes("완료"),u=i?"📡":o?"✓":"→",f=o?"text-green-400/70":"text-[var(--terminal-text-muted)]";return c.jsxs("div",{className:"flex items-start gap-2 px-3 py-1 hover:bg-white/[0.02]",children:[c.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:xy(t.ts)}),c.jsx("span",{className:"text-[10px] shrink-0 mt-0.5",children:u}),c.jsx("span",{className:`text-[11px] ${f}`,children:t.text})]})}return c.jsxs("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-white/[0.02]",children:[c.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:xy(t.ts)}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:"text-[11px] font-semibold mr-1.5",style:{color:l},children:a}),c.jsx("span",{className:"text-xs text-[var(--terminal-text-secondary)]",children:t.text})]})]})}function bE({channel:t,allRoles:l,onUpdateMembers:a,onUpdateTopic:i}){const o=j.useRef(null),u=j.useRef(null);j.useEffect(()=>{var S;const b=u.current;if(!b)return;b.scrollHeight-b.scrollTop-b.clientHeight<80&&((S=o.current)==null||S.scrollIntoView({behavior:"smooth"}))},[t.messages.length]);const[f,m]=j.useState(!1),[p,h]=j.useState(!1),[g,y]=j.useState("");return c.jsxs("div",{ref:u,className:"flex-1 overflow-y-auto terminal-scrollbar py-2",children:[c.jsxs("div",{className:"px-3 py-2 mb-2 border-b border-[var(--terminal-border)] flex items-center gap-2",children:[c.jsx("span",{className:"text-sm font-semibold text-[var(--terminal-text)]",children:t.name}),t.members.length>0&&c.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.members.map(b=>og[b]??b).join(", ")}),t.members.length===0&&c.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.isDefault?"system logs":"no members"}),!t.isDefault&&l&&a&&c.jsx("button",{className:"ml-auto text-[10px] px-2 py-0.5 rounded bg-white/5 hover:bg-white/10 text-[var(--terminal-text-muted)]",onClick:()=>m(!f),children:f?"Done":"Invite"})]}),!t.isDefault&&i&&c.jsx("div",{className:"px-3 pb-2 mb-1",children:p?c.jsx("input",{autoFocus:!0,value:g,onChange:b=>y(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(i(t.id,g.trim()),h(!1)),b.key==="Escape"&&h(!1)},onBlur:()=>{i(t.id,g.trim()),h(!1)},placeholder:"Set a topic for this channel...",className:"w-full bg-transparent text-[10px] text-[var(--terminal-text-muted)] outline-none border-b border-[var(--terminal-border)] pb-0.5"}):c.jsx("button",{onClick:()=>{y(t.topic??""),h(!0)},className:"text-[10px] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] cursor-pointer italic",children:t.topic||"Click to set channel topic..."})}),f&&!t.isDefault&&l&&a&&c.jsx("div",{className:"px-3 pb-2 mb-2 border-b border-[var(--terminal-border)]",children:c.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(b=>{const v=t.members.includes(b.id);return c.jsxs("button",{className:`text-[10px] px-2 py-1 rounded ${v?"bg-white/15 text-[var(--terminal-text)]":"bg-white/5 text-[var(--terminal-text-muted)]"}`,onClick:()=>{const S=v?t.members.filter(k=>k!==b.id):[...t.members,b.id];a(t.id,S)},children:[v?"✓ ":"",b.name]},b.id)})})}),t.messages.length===0&&c.jsx("div",{className:"flex-1 flex flex-col items-center justify-center text-[var(--terminal-text-muted)] text-xs gap-1 py-8",children:c.jsx("span",{children:t.isDefault?"No dispatch events yet":"No messages yet — invite roles to start chatting"})}),t.messages.map(b=>c.jsx(gE,{msg:b},b.id)),c.jsx("div",{ref:o})]})}const pd={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},vE=400,wE=800;function kE({sessions:t,activeSessionId:l,roles:a,streamingSessionId:i,width:o,onWidthChange:u,onSwitchSession:f,onCloseSession:m,onCreateSession:p,onClearEmpty:h,onCloseAll:g,onSendMessage:y,onModeChange:b,onCloseTerminal:v,chatChannels:S,activeChatChannelId:k,onSwitchChatChannel:C,onCreateChatChannel:E,onDeleteChatChannel:M,onUpdateChatMembers:$,onUpdateChatTopic:O,unreadChannels:B}){const[T,Y]=j.useState(!1),[V,te]=j.useState(!1),[D,I]=j.useState(!1),[L,ee]=j.useState(""),ae=k!=null,X=S==null?void 0:S.find(K=>K.id===k),[U,Q]=j.useState(!1),[ie,ve]=j.useState(!1),[z,_]=j.useState(!1),P=j.useRef(0),A=j.useRef(0),pe=j.useRef(null),Se=t.find(K=>K.id===l),Ce=i===l,Fe=t.filter(K=>K.messages.length===0).length,Ye=j.useCallback(()=>{const K=pe.current;K&&(ve(K.scrollLeft>0),_(K.scrollLeft+K.clientWidth<K.scrollWidth-1))},[]);j.useEffect(()=>{if(!l||!pe.current)return;const K=pe.current.querySelector(`[data-session-id="${l}"]`);K&&K.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),Ye()},[l,t.length,Ye]),j.useEffect(()=>{const K=pe.current;if(!K)return;Ye(),K.addEventListener("scroll",Ye);const ue=new ResizeObserver(Ye);return ue.observe(K),()=>{K.removeEventListener("scroll",Ye),ue.disconnect()}},[Ye]);const se=j.useCallback(K=>{K.preventDefault(),P.current=K.clientX,A.current=o,Q(!0);const ue=ne=>{const xe=P.current-ne.clientX,je=Math.min(wE,Math.max(vE,A.current+xe));u==null||u(je)},we=()=>{Q(!1),document.removeEventListener("mousemove",ue),document.removeEventListener("mouseup",we)};document.addEventListener("mousemove",ue),document.addEventListener("mouseup",we)},[o,u]);return c.jsxs("div",{className:"shrink-0 bg-[var(--terminal-bg)] border-l border-[var(--terminal-border)] flex flex-col h-full relative",style:{width:o},children:[u&&c.jsx("div",{className:`terminal-resize-handle absolute top-0 left-0 w-1 h-full cursor-col-resize z-10 transition-colors ${U?"bg-[var(--terminal-border-hover)]":"bg-transparent"}`,onMouseDown:se}),c.jsxs("div",{className:"flex items-center bg-[var(--terminal-bg-deeper)] border-b border-[var(--terminal-border)] shrink-0",children:[c.jsxs("div",{className:"relative flex-1 min-w-0",children:[ie&&c.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-6 bg-gradient-to-r from-[var(--terminal-bg-deeper)] to-transparent z-10 pointer-events-none"}),c.jsxs("div",{ref:pe,className:"flex items-center overflow-x-auto terminal-tab-scroll gap-px px-1 py-1",children:[S==null?void 0:S.map(K=>c.jsxs("button",{onClick:()=>{C==null||C(K.id)},className:`flex items-center gap-1 px-2.5 py-1.5 text-[11px] rounded-t-lg shrink-0 cursor-pointer transition-colors group ${k===K.id?"bg-[var(--terminal-bg)] text-[var(--terminal-text)]":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface)]"}`,style:k===K.id?{borderTop:"2px solid #4CAF50"}:void 0,children:[c.jsx("span",{className:"text-[10px]",children:"💬"}),c.jsx("span",{className:"truncate",children:K.name}),(B==null?void 0:B.has(K.id))&&k!==K.id&&c.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 shrink-0"}),!K.isDefault&&c.jsx("span",{onClick:ue=>{ue.stopPropagation(),M==null||M(K.id)},className:"ml-1 text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none opacity-0 group-hover:opacity-100",children:"×"})]},K.id)),S&&S.length>0&&t.length>0&&c.jsx("div",{className:"w-px h-4 bg-[var(--terminal-border)] shrink-0 mx-1"}),t.map(K=>c.jsx(iE,{roleId:K.roleId,title:K.title,roleColor:pd[K.roleId]??"#666",active:!ae&&K.id===l,onClick:()=>{C==null||C(null),f(K.id)},onClose:ue=>{ue.stopPropagation(),m(K.id)},"data-session-id":K.id},K.id))]}),z&&c.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-6 bg-gradient-to-l from-[var(--terminal-bg-deeper)] to-transparent z-10 pointer-events-none"})]}),c.jsxs("div",{className:"relative shrink-0",children:[c.jsx("button",{onClick:()=>{Y(!T),te(!1)},className:"w-7 h-7 flex items-center justify-center text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-lg cursor-pointer",children:"+"}),T&&c.jsxs("div",{className:"absolute top-full right-0 mt-1 bg-[var(--terminal-surface)] border border-[var(--terminal-border)] rounded-lg shadow-xl z-50 py-1 min-w-[200px]",children:[E&&c.jsxs(c.Fragment,{children:[D?c.jsxs("div",{className:"px-3 py-2 flex items-center gap-1",children:[c.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:"#"}),c.jsx("input",{autoFocus:!0,value:L,onChange:K=>ee(K.target.value),onKeyDown:K=>{K.key==="Enter"&&L.trim()&&(E(L.trim(),[]),ee(""),I(!1),Y(!1)),K.key==="Escape"&&(I(!1),ee(""))},placeholder:"channel name",className:"flex-1 bg-transparent text-xs text-[var(--terminal-text)] outline-none border-b border-[var(--terminal-border)]"})]}):c.jsxs("button",{onClick:()=>I(!0),className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer flex items-center gap-2",children:[c.jsx("span",{className:"text-[10px]",children:"💬"}),"New Channel"]}),c.jsx("div",{className:"border-b border-[var(--terminal-border)] my-1"})]}),a.map(K=>c.jsxs("button",{onClick:()=>{p(K.id),C==null||C(null),Y(!1)},className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer flex items-center gap-2",children:[c.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:pd[K.id]??"#666"}}),K.id.toUpperCase()," — ",K.name]},K.id))]})]}),c.jsxs("div",{className:"relative shrink-0",children:[c.jsx("button",{onClick:()=>{te(!V),Y(!1)},className:"w-7 h-7 flex items-center justify-center text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-xs cursor-pointer tracking-tight",title:"Manage sessions",children:"···"}),V&&c.jsxs("div",{className:"absolute top-full right-0 mt-1 bg-[var(--terminal-surface)] border border-[var(--terminal-border)] rounded-lg shadow-xl z-50 py-1 min-w-[200px]",children:[c.jsxs("div",{className:"px-3 py-1.5 text-[10px] text-[var(--terminal-text-muted)] border-b border-[var(--terminal-border)]",children:[t.length," session",t.length!==1?"s":""]}),Fe>0&&h&&c.jsxs("button",{onClick:()=>{h(),te(!1)},className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer",children:["Clear empty sessions (",Fe,")"]}),t.length>0&&g&&c.jsx("button",{onClick:()=>{g(),te(!1)},className:"w-full text-left px-3 py-2 text-xs text-[#E57373] hover:bg-[var(--terminal-surface-light)] cursor-pointer",children:"Close all sessions"}),t.length===0&&c.jsx("div",{className:"px-3 py-2 text-xs text-[var(--terminal-text-muted)]",children:"No sessions"})]})]}),c.jsx("button",{onClick:v,className:"px-2 py-1 text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm cursor-pointer shrink-0",children:"×"})]}),ae&&X?c.jsx(bE,{channel:X,allRoles:a,onUpdateMembers:$,onUpdateTopic:O}):Se?c.jsxs(c.Fragment,{children:[c.jsx(xE,{messages:Se.messages,roleId:Se.roleId,roleColor:pd[Se.roleId]??"#666"}),c.jsx(pE,{mode:Se.mode,onModeChange:K=>b(Se.id,K),onSend:K=>y(Se.id,K,Se.mode),disabled:Ce,disabledReason:Ce?`${Se.roleId.toUpperCase()} is responding...`:void 0})]}):c.jsx("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:"No active session. Click [+] to start."})]})}function SE(){const t=j.useRef(null),l=j.useCallback(()=>{var i;(i=t.current)==null||i.abort(),t.current=null},[]);return{sendMessage:j.useCallback((i,o,u,f)=>{l();const m=new AbortController;return t.current=m,fetch(`/api/exec/session/${i}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:o,mode:u}),signal:m.signal}).then(async p=>{var b,v,S,k,C;if(!p.ok||!p.body){f.onError("Failed to connect");return}const h=p.body.getReader(),g=new TextDecoder;let y="";for(;;){const{done:E,value:M}=await h.read();if(E)break;y+=g.decode(M,{stream:!0});const $=y.split(`
|
|
87
|
-
`);y=$.pop()??"";let O="";for(let B=0;B<$.length;B++){const T=$[B];if(T.startsWith("event: ")){O=T.slice(7).trim();continue}if(T.startsWith("data: ")){let Y;try{Y=JSON.parse(T.slice(6))}catch{O="";continue}switch(O){case"thinking":Y.text&&((b=f.onThinking)==null||b.call(f,Y.text));break;case"output":Y.text&&f.onText(Y.text);break;case"tool":(v=f.onToolUse)==null||v.call(f,Y.name,Y.input);break;case"dispatch":(S=f.onDispatch)==null||S.call(f,Y.roleId,Y.task);break;case"dispatch:progress":(k=f.onDispatchProgress)==null||k.call(f,Y.roleId,Y.type,Y);break;case"turn":(C=f.onTurn)==null||C.call(f,Y.turn);break;case"done":f.onDone(Y);break;case"error":f.onError(Y.message??"Unknown error");break;default:Y.text&&f.onText(Y.text);break}O=""}}}}).catch(p=>{p.name!=="AbortError"&&f.onError(p.message)}),{abort:l}},[l]),abort:l}}const xh="tycono-appearances",gc="tycono-theme";(()=>{try{for(const[t,l]of[["the-company-appearances",xh],["the-company-theme",gc]]){const a=localStorage.getItem(t);a&&!localStorage.getItem(l)&&(localStorage.setItem(l,a),localStorage.removeItem(t))}}catch{}})();function py(){try{const t=localStorage.getItem(xh);return t?JSON.parse(t):{}}catch{return{}}}function yd(t){localStorage.setItem(xh,JSON.stringify(t))}function yy(){try{const t=localStorage.getItem(gc);if(t&&t in za)return t}catch{}return"default"}function jE(t){var i;const l=(i=za[t])==null?void 0:i.vars;if(!l)return;const a=document.documentElement;for(const[o,u]of Object.entries(l))a.style.setProperty(o,u)}const gd={mode:"auto",intervalSec:18,dailyBudgetUsd:1},Id="tycono-speech-settings",bd="tycono-language";function EE(){try{const t=localStorage.getItem(Id);return t?{...gd,...JSON.parse(t)}:gd}catch{return gd}}function CE(){const[t,l]=j.useState(py),[a,i]=j.useState(yy),[o,u]=j.useState(EE),[f,m]=j.useState(()=>{try{return localStorage.getItem(bd)??"auto"}catch{return"auto"}}),p=j.useRef(!1);j.useEffect(()=>{p.current||(p.current=!0,Te.getPreferences().then(k=>{const C=Object.keys(k.appearances??{}).length>0||k.theme!=="default";if(k.speech&&(u(E=>({...E,...k.speech})),localStorage.setItem(Id,JSON.stringify(k.speech))),k.language&&(m(k.language),localStorage.setItem(bd,k.language)),C){const E=k.appearances;l(E),yd(E),k.theme&&k.theme in za&&(i(k.theme),localStorage.setItem(gc,k.theme))}else{const E=py(),M=yy();(Object.keys(E).length>0||M!=="default")&&Te.updatePreferences({appearances:E,theme:M}).catch(()=>{})}}).catch(()=>{}))},[]),j.useEffect(()=>{jE(a)},[a]);const h=j.useCallback(k=>t[k]??mh(k),[t]),g=j.useCallback((k,C)=>{l(E=>{const M={...E,[k]:C};return yd(M),Te.updatePreferences({appearances:M}).catch(()=>{}),M})},[]),y=j.useCallback(k=>{l(C=>{const E={...C};return delete E[k],yd(E),Te.updatePreferences({appearances:E}).catch(()=>{}),E})},[]),b=j.useCallback(k=>{i(k),localStorage.setItem(gc,k),Te.updatePreferences({theme:k}).catch(()=>{})},[]),v=j.useCallback(k=>{u(C=>{const E={...C,...k};return localStorage.setItem(Id,JSON.stringify(E)),Te.updatePreferences({speech:E}).catch(()=>{}),E})},[]),S=j.useCallback(k=>{m(k),localStorage.setItem(bd,k),Te.updatePreferences({language:k}).catch(()=>{})},[]);return{appearances:t,getAppearance:h,setAppearance:g,resetAppearance:y,theme:a,setTheme:b,speechSettings:o,setSpeechSettings:v,language:f,setLanguage:S}}const NE=3e4;function AE(){var S;const[t,l]=j.useState(null),[a,i]=j.useState("synced"),[o,u]=j.useState([]),f=j.useRef(null),m=j.useCallback(async()=>{try{const k=await Te.getSaveStatus();l(k),k.noGit?i("no-git"):i(C=>C==="saving"?C:k.dirty?"dirty":"synced")}catch{i("error")}},[]);j.useEffect(()=>(m(),f.current=setInterval(m,NE),()=>{f.current&&clearInterval(f.current)}),[m]);const p=j.useCallback(async k=>{i("saving");try{const C=await Te.save(k);return await m(),C}catch(C){throw i("error"),C}},[m]),h=j.useCallback(async()=>{try{const k=await Te.getSaveHistory(20);u(k)}catch{}},[]),g=j.useCallback(async k=>{i("saving");try{await Te.restoreSave(k),await m()}catch(C){throw i("error"),C}},[m]),y=j.useCallback(async()=>{try{await Te.initGit(),await m()}catch{i("error")}},[m]),b=t?t.modified.length+t.untracked.length:0,v=((S=t==null?void 0:t.lastCommit)==null?void 0:S.date)??null;return{state:a,dirtyCount:b,lastSaved:v,status:t,save:p,history:o,loadHistory:h,restore:g,refresh:m,initGit:y}}const gy={cto:["Need to reduce this architecture tech debt...","Don't over-engineer. Keep it minimal.","Performance profiling results are a bit concerning.","Should do a system design review.","If I just strip one abstraction layer, it should work.","Let me check the monitoring dashboard.","Need to go through the code review queue.","It's about time to clean up these module dependencies."],cbo:["Heard the competitor launched a new feature... need to analyze.","Should compile this month's revenue metrics.","It's time to update the market trend report.","Maybe I should benchmark the pricing strategy.","Need to recalculate the ROI.","Let me check the competitor's GitHub star trends.","Thinking about launch timing...","Should re-examine the positioning strategy."],pm:["Is this feature really what users want?","Need to clean up the backlog...","MVP scope keeps expanding.","Analyzing user feedback...","Might need to re-prioritize.","Watch out for scope creep.","Will the roadmap timeline hold...","Should double-check the task dependencies."],engineer:["I want to refactor this code...","Test coverage seems a bit low.","Working code first, perfect code later.","Waiting for PR review...","What could be causing this bug...","Is the build broken?","Need to fix that one type error.","Maybe I should run npm audit."],designer:["This UI flow feels a bit awkward...","Usability first, pretty later.","Need to organize the design system components.","Let me make two quick options and compare.","Should run through the accessibility checklist.","Maybe I should prototype this interaction.","Let me revisit the color palette...","The spacing feels a bit cramped."],qa:['"Works" and "correct" are two different things.',"Organizing edge case scenarios...","Should run the regression test suite.","This part could be converted to automated tests.","Need to go through the pre-release checklist.","Reproducible bug reports are key.","Should run cross-browser tests.","Need to check for performance regressions."],"data-analyst":["Checking the data pipeline status...","Interesting outlier detection pattern.","Need to update the dashboard metrics.","Correlation isn't causation though...","Seems like there is room for SQL query optimization.","It's time for a data quality check."]},by={cto:["Should I assign more work to the team...","It's time to clean up the architecture debt.","Need to re-examine the tech roadmap.","It's quiet... am I missing something?"],cbo:["It's time to update the market analysis...","Should be preparing the revenue report, but no directives.","Let me check on competitor movements.","It's quiet on the business side..."],pm:["Backlog is pretty quiet... nothing to plan?","It's been a while since we scheduled a sprint.","User feedback must be piling up...","No PRD to write... that's unusual."],engineer:["Nothing to do today... maybe some code reviews.","Task queue is empty. Guess I'll refactor.","Am I missing something?","Should clean up the commit log."],designer:["No design requests coming in. Should I improve something on my own?","Maybe run a UI audit...","Should organize my portfolio.","Let me tidy up the component library."],qa:["No builds to test. Let me improve the automation scripts.","It's quiet... no bugs, or just haven't found them?","Let me review the existing test scenarios.","Should update the test coverage report."],"data-analyst":["No analysis requests coming in...","Maybe I should clean up the data warehouse.","Should verify the past reports."]},DE=[{id:"sup-check-1",relation:"superior-subordinate",minFamiliarity:0,topic:"progress",turns:[{speaker:"A",text:"How's the progress?"},{speaker:"B",text:"Going well. Should be done soon."},{speaker:"A",text:"Good, let me know when it's done."}]},{id:"sup-check-2",relation:"superior-subordinate",minFamiliarity:20,topic:"progress",turns:[{speaker:"A",text:"What are you working on today?"},{speaker:"B",text:"Finishing up what I was doing yesterday."}]},{id:"sub-report-1",relation:"superior-subordinate",minFamiliarity:10,topic:"report",turns:[{speaker:"B",text:"Done with that task from earlier."},{speaker:"A",text:"Nice work. Can you share the results?"},{speaker:"B",text:"Sure, I've updated the docs."}]},{id:"peer-tech-1",relation:"peer",minFamiliarity:20,topic:"tech",turns:[{speaker:"A",text:"What do you think about this design?"},{speaker:"B",text:"I think we could go simpler."},{speaker:"A",text:"Really? Want to look at it together?"}]},{id:"peer-tech-2",relation:"peer",minFamiliarity:30,topic:"tech",turns:[{speaker:"A",text:"Have you used this library before?"},{speaker:"B",text:"Yeah, used it in the last project. It was decent."}]},{id:"close-feedback-1",relation:"peer",minFamiliarity:60,topic:"feedback",turns:[{speaker:"A",text:"Can I be honest with you?"},{speaker:"B",text:"Of course, go ahead."},{speaker:"A",text:"This one feels a bit off. Let's revisit."},{speaker:"B",text:"...Alright. Thanks for the feedback."}]},{id:"clevel-sync-1",relation:"c-level",minFamiliarity:10,topic:"strategy",turns:[{speaker:"A",text:"We need to sync the roadmap with the business timeline."},{speaker:"B",text:"Agreed. I'll have it organized and shared by tomorrow."}]},{id:"clevel-sync-2",relation:"c-level",minFamiliarity:30,topic:"strategy",turns:[{speaker:"A",text:"I have some competitor intel to share."},{speaker:"B",text:"Great, I have a tech update too."},{speaker:"A",text:"Let's sync up when you're free."}]},{id:"casual-coffee",relation:"any",minFamiliarity:30,topic:"casual",turns:[{speaker:"A",text:"Want to grab a coffee?"},{speaker:"B",text:"Sure. Feels like it's going to be a long day."}]},{id:"casual-overtime",relation:"any",minFamiliarity:25,topic:"casual",turns:[{speaker:"A",text:"Working late again..."},{speaker:"B",text:"We're in this together. Hang in there."}]},{id:"casual-lunch",relation:"any",minFamiliarity:35,topic:"casual",turns:[{speaker:"A",text:"What should we get for lunch?"},{speaker:"B",text:"Anything. Feel like we eat the same thing every day."}]},{id:"casual-weekend",relation:"any",minFamiliarity:40,topic:"casual",turns:[{speaker:"A",text:"What did you do this weekend?"},{speaker:"B",text:"Just rested. Was too tired."}]},{id:"bestie-1",relation:"any",minFamiliarity:80,topic:"trust",turns:[{speaker:"A",text:"I'm a bit unsure about this direction..."},{speaker:"B",text:"What's bothering you? Be honest."},{speaker:"A",text:"Thanks. It's nice having someone I can talk to."}]}],TE=18e3,vy=6e3,zE=2500,ME=30*6e4,cg="tycono:relationships";function _E(){try{const t=localStorage.getItem(cg);return t?JSON.parse(t):[]}catch{return[]}}function FE(t){localStorage.setItem(cg,JSON.stringify(t))}function Wo(t,l,a){const[i,o]=l<a?[l,a]:[a,l];let u=t.find(f=>f.roleA===i&&f.roleB===o);return u||(u={roleA:i,roleB:o,dispatches:0,wavesTogether:0,conversations:0,familiarity:0,lastInteraction:new Date().toISOString()},t.push(u)),u}function Jo(t){return Math.min(100,t.dispatches*5+t.wavesTogether*10+t.conversations*2)}function Po(t){return t[Math.floor(Math.random()*t.length)]}function RE(t,l,a){const i=a.find(m=>m.id===t),o=a.find(m=>m.id===l);if(!i||!o)return null;const u=i.level==="c-level",f=o.level==="c-level";return u&&f?"c-level":i.reportsTo===l||o.reportsTo===t?"superior-subordinate":(i.reportsTo===o.reportsTo,"peer")}function OE(t,l){return t.relation==="any"?!0:t.relation===l}function BE({roles:t,roleStatuses:l,activeExecs:a,getStandupSpeech:i}){const[o,u]=j.useState(new Map),[f,m]=j.useState(_E),p=j.useRef({}),h=j.useRef(null),g=j.useRef(t),y=j.useRef(l),b=j.useRef(a),v=j.useRef(i),S=j.useRef(f);g.current=t,y.current=l,b.current=a,v.current=i,S.current=f,j.useEffect(()=>{const O=Date.now();for(const[B,T]of Object.entries(l))T==="working"&&(p.current[B]=O)},[l]),j.useEffect(()=>{FE(f)},[f]);const k=j.useCallback(O=>{const B=y.current[O],T=b.current.find(I=>I.roleId===O);if(B==="working"&&(T!=null&&T.task))return null;const Y=v.current(O);if(Y&&Math.random()<.3)return{text:Y,type:"work",ts:Date.now()};const V=Date.now(),te=p.current[O]??0;if(V-te>ME&&Math.random()<.5){const I=by[O]??by.engineer;return{text:Po(I),type:"guilt",ts:V}}const D=gy[O]??gy.engineer;return{text:Po(D),type:"personality",ts:V}},[]),C=j.useCallback(O=>{if(h.current)return!1;const B=O.filter(Q=>y.current[Q.id]!=="working");if(B.length<2)return!1;const T=[...B].sort(()=>Math.random()-.5),Y=T[0],V=T[1],te=RE(Y.id,V.id,O);if(!te)return!1;const D=Wo(S.current,Y.id,V.id),I=Jo(D),L=DE.filter(Q=>OE(Q,te)&&I>=Q.minFamiliarity);if(L.length===0)return!1;const ee=Po(L);let ae=Y.id,X=V.id;ee.relation==="superior-subordinate"&&(V.reportsTo===Y.id||Y.level==="c-level"?(ae=Y.id,X=V.id):(ae=V.id,X=Y.id)),h.current={templateId:ee.id,roleA:ae,roleB:X,turnIdx:0,timer:null};const U=Q=>{if(!h.current||Q>=ee.turns.length){h.current=null,m(_=>{const P=[..._],A=Wo(P,ae,X);return A.conversations++,A.familiarity=Jo(A),A.lastInteraction=new Date().toISOString(),P}),setTimeout(()=>{u(_=>{const P=new Map(_);return P.delete(ae),P.delete(X),P})},vy);return}const ie=ee.turns[Q],ve=ie.speaker==="A"?ae:X,z=ie.speaker==="A"?X:ae;u(_=>{const P=new Map(_);if(P.set(ve,{text:ie.text,type:"social",partnerId:z,ts:Date.now()}),Q>0){const A=ee.turns[Q-1].speaker==="A"?ae:X;A!==ve&&P.delete(A)}return P}),h.current.turnIdx=Q,h.current.timer=setTimeout(()=>U(Q+1),zE)};return U(0),!0},[]);j.useEffect(()=>{const O=setInterval(()=>{const B=g.current;if(B.length===0||h.current||Math.random()<.35&&C(B))return;const T=B.filter(te=>y.current[te.id]!=="working");if(T.length===0)return;const Y=Po(T),V=k(Y.id);V&&(u(te=>{const D=new Map(te);return D.set(Y.id,V),D}),setTimeout(()=>{u(te=>{const D=new Map(te),I=D.get(Y.id);return I&&I.ts===V.ts&&D.delete(Y.id),D})},vy))},TE);return()=>{var B;clearInterval(O),(B=h.current)!=null&&B.timer&&clearTimeout(h.current.timer)}},[k,C]);const E=j.useCallback(O=>{const B=o.get(O);return(B==null?void 0:B.text)??""},[o]),M=j.useCallback((O,B)=>{m(T=>{const Y=[...T],V=Wo(Y,O,B);return V.dispatches++,V.familiarity=Jo(V),V.lastInteraction=new Date().toISOString(),Y})},[]),$=j.useCallback(O=>{O.length<2||m(B=>{const T=[...B];for(let Y=0;Y<O.length;Y++)for(let V=Y+1;V<O.length;V++){const te=Wo(T,O[Y],O[V]);te.wavesTogether++,te.familiarity=Jo(te),te.lastInteraction=new Date().toISOString()}return T})},[]);return{speeches:o,getSpeech:E,relationships:f,notifyDispatch:M,notifyWave:$}}const ug="tycono:office-chat";let $E=0;function LE(){return`chat-${Date.now()}-${++$E}`}function vd(){return[{id:"general",name:"#general",members:[],isDefault:!0,messages:[],topic:"Company-wide announcements and general discussion"},{id:"watercooler",name:"#watercooler",members:[],isDefault:!0,messages:[],topic:"No managers allowed. Vent, gossip, joke around. Talk freely about work frustrations, complain about directives you disagree with, share hot takes."}]}function HE(){try{const t=localStorage.getItem(ug);if(t){const l=JSON.parse(t);if(l.find(i=>i.id==="office")&&!l.find(i=>i.id==="general")){const i=l.filter(o=>o.id!=="office");return[...vd(),...i]}const a=vd();for(const i of a)l.find(o=>o.id===i.id)||l.unshift(i);return l}}catch{}return vd()}function UE(t){const l=t.map(a=>({...a,messages:a.messages.slice(-200)}));localStorage.setItem(ug,JSON.stringify(l))}function IE(){const[t,l]=j.useState(HE),[a,i]=j.useState(null),[o,u]=j.useState(new Set);j.useEffect(()=>{UE(t)},[t]);const f=j.useCallback(v=>{i(v),v&&u(S=>{const k=new Set(S);return k.delete(v),k})},[]),m=j.useCallback(v=>{const S={...v,id:LE()};l(k=>{const C=k.map(E=>E.id==="general"?v.type==="dispatch"?{...E,messages:[...E.messages,S].slice(-200)}:E:v.channelId?E.id===v.channelId?{...E,messages:[...E.messages,S].slice(-200)}:E:E.members.length>0&&E.members.includes(v.roleId)?{...E,messages:[...E.messages,S].slice(-200)}:E);return u(E=>{const M=new Set(E);for(const $ of C){const O=k.find(B=>B.id===$.id);O&&$.messages.length>O.messages.length&&M.add($.id)}return M}),C})},[]),p=j.useCallback((v,S,k)=>{const C=`ch-${Date.now()}`,E={id:C,name:v.startsWith("#")?v:`#${v}`,members:S,isDefault:!1,messages:[],topic:k};l(M=>[...M,E]),i(C)},[]),h=j.useCallback(v=>{l(S=>S.filter(k=>k.id!==v||k.isDefault)),i(S=>S===v?"general":S)},[]),g=j.useCallback((v,S)=>{l(k=>k.map(C=>C.id===v&&!C.isDefault?{...C,members:S}:C))},[]),y=j.useCallback((v,S)=>{l(k=>k.map(C=>C.id===v&&!C.isDefault?{...C,topic:S||void 0}:C))},[]),b=j.useCallback(v=>{l(S=>S.map(k=>{if(k.id==="watercooler"){const C=v.filter(E=>E.level!=="c-level").map(E=>E.id);if(k.members.length!==C.length||!C.every(E=>k.members.includes(E)))return{...k,members:C}}return k}))},[]);return{channels:t,activeChannelId:a,setActiveChannelId:f,pushMessage:m,createChannel:p,deleteChannel:h,updateMembers:g,updateTopic:y,unreadChannels:o,syncDefaultMembers:b}}const YE=45e3,qE=3e3,XE=3,VE=20;function GE({roles:t,roleStatuses:l,activeExecs:a,channels:i,relationships:o,pushMessage:u,speechSettings:f,engineType:m,hasApiKey:p}){const g=((f==null?void 0:f.mode)==="auto"?m==="claude-cli"||m==="local"?"llm":"template":(f==null?void 0:f.mode)??"template")==="llm"&&(p!==!1||m==="claude-cli"),y=((f==null?void 0:f.intervalSec)??YE/1e3)*1e3,b=j.useRef(t),v=j.useRef(l),S=j.useRef(a),k=j.useRef(i),C=j.useRef(o),E=j.useRef(u),M=j.useRef(0),$=j.useRef(!1);b.current=t,v.current=l,S.current=a,k.current=i,C.current=o,E.current=u;const O=j.useCallback(async(T,Y)=>{if($.current)return!1;$.current=!0;try{if(!b.current.find(X=>X.id===T))return!1;const te=Y.messages.slice(-VE).map(X=>({roleId:X.roleId,text:X.text,ts:X.ts})),D=b.current.filter(X=>Y.members.includes(X.id)),I=C.current.filter(X=>X.roleA===T||X.roleB===T).map(X=>({partnerId:X.roleA===T?X.roleB:X.roleA,familiarity:X.familiarity})),L=S.current.find(X=>X.roleId===T),ee=L?{currentTask:L.task,taskProgress:null}:{currentTask:null,taskProgress:null},ae=await Te.chatInChannel({channelId:Y.name.replace("#",""),channelTopic:Y.topic,roleId:T,history:te,members:D.map(X=>({id:X.id,name:X.name,level:X.level})),relationships:I,workContext:ee});return ae.message?(E.current({ts:Date.now(),roleId:T,text:ae.message,type:"chat",channelId:Y.id}),!0):!1}catch{return!1}finally{$.current=!1}},[]),B=j.useCallback(async(T,Y)=>{if(M.current>=XE){M.current=0;return}const V=T.members.filter(D=>D!==Y&&v.current[D]!=="working");if(V.length===0){M.current=0;return}const te=V[Math.floor(Math.random()*V.length)];if(Math.random()>.6){M.current=0;return}setTimeout(async()=>{M.current++;const D=k.current.find(L=>L.id===T.id);if(!D)return;await O(te,D)?B(D,te):M.current=0},qE+Math.random()*2e3)},[O]);j.useEffect(()=>{if(!g)return;const T=setInterval(async()=>{const Y=b.current;if(Y.length===0||$.current)return;const V=Y.filter(ee=>v.current[ee.id]!=="working");if(V.length===0)return;const te=V[Math.floor(Math.random()*V.length)],D=k.current.filter(ee=>ee.members.length===0?!0:ee.members.includes(te.id));if(D.length===0)return;const I=D[Math.floor(Math.random()*D.length)];M.current=0,await O(te.id,I)&&B(I,te.id)},y);return()=>clearInterval(T)},[g,y,O,B])}function ec({type:t,className:l}){const a=j.useRef(null),i=mS(t);return j.useEffect(()=>{const o=a.current;if(!o||!i)return;const u=o.getContext("2d");u&&pS(u,i)},[t,i]),i?c.jsx("canvas",{ref:a,width:i.canvasWidth,height:i.canvasHeight,className:l,style:{imageRendering:"pixelated",display:"block"}}):null}const fg=[[1,8],[3,5],[8,1],[5,3]],KE=[[1,4],[2,3],[4,1],[3,2]];function tc(t){const l=t===1||t===3?-1:0,a=fg[t],i=t<2?[0,1]:[1,0],o=l;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:a[0],y:13,w:3,h:4,c:"$pants"},{x:a[1],y:13,w:3,h:4,c:"$pants"},{x:a[0]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:a[1]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:a[0],y:16,w:3,h:2,c:"$shoes"},{x:a[1],y:16,w:3,h:2,c:"$shoes"},{x:a[0],y:16,w:3,h:1,c:"lighten($shoes, 25)",a:.4},{x:a[1],y:16,w:3,h:1,c:"lighten($shoes, 25)",a:.4},{x:1,y:o+8,w:10,h:6,c:"$shirt"},{x:2,y:o+8,w:8,h:1,c:"lighten($shirt, 20)",a:.35},{x:1,y:o+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:10,y:o+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:-1,y:o+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:o+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:-1,y:o+12,w:2,h:1,c:"$skin"},{x:11,y:o+12,w:2,h:1,c:"$skin"},{x:4,y:o+6,w:4,h:3,c:"$skin"},{x:1,y:o+0,w:10,h:7,c:"$skin"},{x:3,y:o+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:o+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:o+3,w:1,h:1,c:"#FFF",a:.4},{x:7,y:o+3,w:1,h:1,c:"#FFF",a:.4},{x:5,y:o+6,w:2,h:1,c:"darken($skin, 25)",a:.35},{x:0,y:o+3,w:1,h:1,c:"$skin"},{x:11,y:o+3,w:1,h:1,c:"$skin"},{x:1,y:o+0,w:10,h:3,c:"$hair"},{x:0,y:o+1,w:2,h:3,c:"$hair"},{x:10,y:o+1,w:2,h:3,c:"$hair"},{x:2,y:o+0,w:8,h:1,c:"lighten($hair, 25)",a:.3}]}function nc(t){const l=t===1||t===3?-1:0,a=fg[t],i=t<2?[0,1]:[1,0],o=l;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:a[0],y:13,w:3,h:4,c:"$pants"},{x:a[1],y:13,w:3,h:4,c:"$pants"},{x:a[0],y:16,w:3,h:2,c:"$shoes"},{x:a[1],y:16,w:3,h:2,c:"$shoes"},{x:1,y:o+8,w:10,h:6,c:"$shirt"},{x:2,y:o+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:5,y:o+10,w:2,h:3,c:"darken($shirt, 30)",a:.12},{x:-1,y:o+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:o+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:4,y:o+6,w:4,h:3,c:"$skin"},{x:1,y:o+0,w:10,h:7,c:"$skin"},{x:1,y:o+0,w:10,h:6,c:"$hair"},{x:0,y:o+1,w:2,h:5,c:"$hair"},{x:10,y:o+1,w:2,h:5,c:"$hair"},{x:2,y:o+0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:0,y:o+4,w:1,h:1,c:"$skin",a:.6},{x:11,y:o+4,w:1,h:1,c:"$skin",a:.6}]}function Na(t,l){const a=t===1||t===3?-1:0,i=KE[t],o=a,u=t%2===0?1:0;return l?[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:i[0],y:13,w:3,h:4,c:"$pants"},{x:i[1],y:13,w:3,h:4,c:"$pants"},{x:i[0],y:16,w:3,h:2,c:"$shoes"},{x:i[1],y:16,w:3,h:2,c:"$shoes"},{x:2,y:o+8,w:8,h:6,c:"$shirt"},{x:2,y:o+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:8,y:o+9+u,w:3,h:4-u,c:"$shirt"},{x:9,y:o+12,w:2,h:1,c:"$skin"},{x:4,y:o+6,w:4,h:3,c:"$skin"},{x:2,y:o+0,w:8,h:7,c:"$skin"},{x:7,y:o+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:o+3,w:1,h:1,c:"#FFF",a:.3},{x:9,y:o+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:o+0,w:8,h:3,c:"$hair"},{x:1,y:o+1,w:2,h:4,c:"$hair"},{x:9,y:o+1,w:2,h:3,c:"$hair"},{x:3,y:o+0,w:6,h:1,c:"lighten($hair, 25)",a:.25}]:[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:i[0],y:13,w:3,h:4,c:"$pants"},{x:i[1],y:13,w:3,h:4,c:"$pants"},{x:i[0],y:16,w:3,h:2,c:"$shoes"},{x:i[1],y:16,w:3,h:2,c:"$shoes"},{x:2,y:o+8,w:8,h:6,c:"$shirt"},{x:2,y:o+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:0,y:o+9+u,w:3,h:4-u,c:"$shirt"},{x:-1,y:o+12,w:2,h:1,c:"$skin"},{x:4,y:o+6,w:4,h:3,c:"$skin"},{x:2,y:o+0,w:8,h:7,c:"$skin"},{x:3,y:o+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:o+3,w:1,h:1,c:"#FFF",a:.3},{x:1,y:o+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:o+0,w:8,h:3,c:"$hair"},{x:1,y:o+1,w:2,h:3,c:"$hair"},{x:9,y:o+1,w:2,h:4,c:"$hair"},{x:3,y:o+0,w:6,h:1,c:"lighten($hair, 25)",a:.25}]}const wy={down:[tc(0),tc(1),tc(2),tc(3)],up:[nc(0),nc(1),nc(2),nc(3)],right:[Na(0,!0),Na(1,!0),Na(2,!0),Na(3,!0)],left:[Na(0,!1),Na(1,!1),Na(2,!1),Na(3,!1)]},Ue=4,At=28,ln=2,rt=4,We=4,Zl=[{wallColor:"#C8B898",baseboardColor:"#6A5840",floorType:"wood"},{wallColor:"#A8B8C8",baseboardColor:"#586878",floorType:"dark"},{wallColor:"#A8C8B0",baseboardColor:"#4A6A50",floorType:"carpet"},{wallColor:"#C8C0A8",baseboardColor:"#7A6A50",floorType:"tile"}];function ph(t,l,a){const u=t.fy+Math.max(10,Math.floor(t.fh*.18)),f=Math.min(l,a),m=Math.ceil(l/f),p=[],h=f*28,g=t.fx+Math.max(8,Math.floor((t.fw-h)/2));for(let y=0;y<m&&p.length<l;y++){const b=Math.min(f,l-y*f);for(let v=0;v<b;v++)p.push({dx:g+v*28,dy:u+y*28,room:t.id})}return p}function QE(t){const i=Zl[0],o={id:"main",wx:Ue+We,wy:Ue,ww:160-2*(Ue+We),wh:At,fx:Ue+We,fy:Ue+At+ln,fw:160-2*(Ue+We),fh:120-Ue-At-ln-Ue,...i},u=ph(o,Math.min(t,6),3),f=[{id:"s-window-l",type:"window",room:"main",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"s-window-r",type:"window",room:"main",zone:"wall",anchorX:"right",offsetX:-26,offsetY:6,windowW:16,windowH:14},{id:"s-clock",type:"clock",room:"main",zone:"wall",offsetX:Math.floor((160-2*(Ue+We))/2),offsetY:10}],m=[{id:"s-plant-l",type:"plant",room:"main",zone:"floor",offsetX:4,offsetY:4},{id:"s-plant-r",type:"plant",room:"main",zone:"floor",anchorX:"right",offsetX:-8,offsetY:4}];return{preset:"S",canvasW:160,canvasH:120,rooms:{main:o},desks:u,doors:{},adjacency:{main:[]},corridorY:{main:o.fy+o.fh-12},waypoints:{main:[{x:o.fx+10,y:o.fy+o.fh-14},{x:o.fx+o.fw/2,y:o.fy+o.fh-14},{x:o.fx+o.fw-10,y:o.fy+o.fh-14}]},wallDecorations:f,furniture:m}}function ZE(t){const o={id:"exec",wx:Ue+We,wy:Ue,ww:144-Ue-We-rt/2,wh:At,fx:Ue+We,fy:Ue+At+ln,fw:144-Ue-We-rt/2,fh:66,...Zl[0]},u={id:"work",wx:144+rt/2+We,wy:Ue,ww:144-rt/2-We-Ue,wh:At,fx:144+rt/2+We,fy:Ue+At+ln,fw:144-rt/2-We-Ue,fh:66,...Zl[1]},f={id:"meet",wx:Ue+We,wy:Ue+At+ln+66+rt,ww:144-Ue-We-rt/2,wh:At,fx:Ue+We,fy:Ue+At+ln+66+rt+At+ln,fw:144-Ue-We-rt/2,fh:70,...Zl[2]},m={id:"comm",wx:144+rt/2+We,wy:Ue+At+ln+66+rt,ww:144-rt/2-We-Ue,wh:At,fx:144+rt/2+We,fy:Ue+At+ln+66+rt+At+ln,fw:144-rt/2-We-Ue,fh:70,...Zl[3]},p={exec:o,work:u,meet:f,comm:m},h=[];let g=t;const y=[[o,Math.min(3,g)],[u,0]];y[1][1]=Math.min(3,g-y[0][1]);const b=[[f,0],[m,0]];let v=g-y[0][1]-y[1][1];v>0&&(b[0][1]=Math.min(2,v),v-=b[0][1]),v>0&&(b[1][1]=Math.min(2,v));for(const[T,Y]of[...y,...b])Y>0&&h.push(...ph(T,Y,3));const S=Ue+At+ln+66,k=144-rt/2,C={exec_work:{id:"exec_work",type:"v",doorY:Ue+At+ln+20+12,xA:k-2,xB:u.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:Ue+At+ln+66+rt+At+ln+20+12,xA:k-2,xB:m.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:Ue+We+40+14,yA:S-2,yB:f.fy+2},work_comm:{id:"work_comm",type:"h",doorX:144+rt/2+We+40+14,yA:S-2,yB:m.fy+2}},E={exec:[{room:"work",door:"exec_work",side:"A"},{room:"meet",door:"exec_meet",side:"A"}],work:[{room:"exec",door:"exec_work",side:"B"},{room:"comm",door:"work_comm",side:"A"}],meet:[{room:"exec",door:"exec_meet",side:"B"},{room:"comm",door:"meet_comm",side:"A"}],comm:[{room:"work",door:"work_comm",side:"B"},{room:"meet",door:"meet_comm",side:"B"}]},M={exec:o.fy+52,work:u.fy+48,meet:f.fy+56,comm:m.fy+42},$={exec:[{x:o.fx+6,y:o.fy+52},{x:o.fx+60,y:o.fy+54},{x:o.fx+112,y:o.fy+50},{x:o.fx+50,y:o.fy+52}],work:[{x:u.fx+14,y:u.fy+48},{x:u.fx+44,y:u.fy+48},{x:u.fx+70,y:u.fy+48},{x:u.fx+100,y:u.fy+48}],meet:[{x:f.fx+60,y:f.fy+56},{x:f.fx+30,y:f.fy+54},{x:f.fx+110,y:f.fy+50},{x:f.fx+80,y:f.fy+56}],comm:[{x:m.fx+96,y:m.fy+8},{x:m.fx+60,y:m.fy+42},{x:m.fx+40,y:m.fy+42},{x:m.fx+20,y:m.fy+42}]},O=[{id:"exec-window-1",type:"window",room:"exec",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"exec-picture-1",type:"picture",room:"exec",zone:"wall",offsetX:34,offsetY:8,pictureColor:"#1565C0"},{id:"exec-picture-2",type:"picture",room:"exec",zone:"wall",offsetX:48,offsetY:8,pictureColor:"#E65100"},{id:"exec-clock",type:"clock",room:"exec",zone:"wall",offsetX:64,offsetY:10},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:18},{id:"exec-window-2",type:"window",room:"exec",zone:"wall",offsetX:104,offsetY:6,windowW:16,windowH:14},{id:"work-whiteboard",type:"whiteboard",room:"work",zone:"wall",offsetX:6,offsetY:4},{id:"work-window-1",type:"window",room:"work",zone:"wall",offsetX:50,offsetY:6,windowW:16,windowH:14},{id:"work-window-2",type:"window",room:"work",zone:"wall",offsetX:92,offsetY:6,windowW:16,windowH:14},{id:"meet-bulletin",type:"bulletin-board",room:"meet",zone:"wall",offsetX:6,offsetY:4,facility:{id:"bulletin",label:"BULLETIN",icon:"📋",color:"#F59E0B",hitW:22,hitH:16}},{id:"meet-picture",type:"picture",room:"meet",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#10B981"},{id:"meet-window",type:"window",room:"meet",zone:"wall",offsetX:80,offsetY:6,windowW:16,windowH:14},{id:"meet-shelf",type:"shelf",room:"meet",zone:"wall",offsetX:102,offsetY:18},{id:"comm-screen",type:"screen",room:"comm",zone:"wall",offsetX:6,offsetY:6,facility:{id:"decisions",label:"DECISIONS",icon:"📜",color:"#EF4444",hitW:16,hitH:12}},{id:"comm-picture",type:"picture",room:"comm",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#d4956a"},{id:"comm-window",type:"window",room:"comm",zone:"wall",offsetX:76,offsetY:6,windowW:16,windowH:14},{id:"comm-clock",type:"clock",room:"comm",zone:"wall",offsetX:98,offsetY:10},{id:"comm-shelf",type:"shelf",room:"comm",zone:"wall",offsetX:108,offsetY:18}],B=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(o.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"M",canvasW:288,canvasH:208,rooms:p,desks:h,doors:C,adjacency:E,corridorY:M,waypoints:$,wallDecorations:O,furniture:B}}function WE(t){const f={id:"exec",wx:Ue+We,wy:Ue,ww:180-Ue-We-rt/2,wh:At,fx:Ue+We,fy:Ue+At+ln,fw:180-Ue-We-rt/2,fh:82,...Zl[0]},m={id:"work",wx:180+rt/2+We,wy:Ue,ww:180-rt/2-We-Ue,wh:At,fx:180+rt/2+We,fy:Ue+At+ln,fw:180-rt/2-We-Ue,fh:82,...Zl[1]},p=Ue+At+ln+82,h={id:"meet",wx:Ue+We,wy:p+rt,ww:180-Ue-We-rt/2,wh:At,fx:Ue+We,fy:p+rt+At+ln,fw:180-Ue-We-rt/2,fh:86,...Zl[2]},g={id:"comm",wx:180+rt/2+We,wy:p+rt,ww:180-rt/2-We-Ue,wh:At,fx:180+rt/2+We,fy:p+rt+At+ln,fw:180-rt/2-We-Ue,fh:86,...Zl[3]},y={exec:f,work:m,meet:h,comm:g},b=[];let v=t;const S=[[f,Math.min(5,v)],[m,0]];S[1][1]=Math.min(5,v-S[0][1]);const k=[[h,0],[g,0]];let C=v-S[0][1]-S[1][1];C>0&&(k[0][1]=Math.min(3,C),C-=k[0][1]),C>0&&(k[1][1]=Math.min(3,C));for(const[V,te]of[...S,...k])te>0&&b.push(...ph(V,te,4));const E=180-rt/2,M={exec_work:{id:"exec_work",type:"v",doorY:f.fy+82/2,xA:E-2,xB:m.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:h.fy+86/2,xA:E-2,xB:g.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:f.fx+54,yA:p-2,yB:h.fy+2},work_comm:{id:"work_comm",type:"h",doorX:m.fx+54,yA:p-2,yB:g.fy+2}},$={exec:[{room:"work",door:"exec_work",side:"A"},{room:"meet",door:"exec_meet",side:"A"}],work:[{room:"exec",door:"exec_work",side:"B"},{room:"comm",door:"work_comm",side:"A"}],meet:[{room:"exec",door:"exec_meet",side:"B"},{room:"comm",door:"meet_comm",side:"A"}],comm:[{room:"work",door:"work_comm",side:"B"},{room:"meet",door:"meet_comm",side:"B"}]},O={exec:f.fy+82-12,work:m.fy+82-12,meet:h.fy+86-12,comm:g.fy+86-12},B={exec:[{x:f.fx+10,y:O.exec},{x:f.fx+f.fw/2,y:O.exec},{x:f.fx+f.fw-10,y:O.exec}],work:[{x:m.fx+10,y:O.work},{x:m.fx+m.fw/2,y:O.work},{x:m.fx+m.fw-10,y:O.work}],meet:[{x:h.fx+10,y:O.meet},{x:h.fx+h.fw/2,y:O.meet},{x:h.fx+h.fw-10,y:O.meet}],comm:[{x:g.fx+10,y:O.comm},{x:g.fx+g.fw/2,y:O.comm},{x:g.fx+g.fw-10,y:O.comm}]},T=[{id:"exec-window-1",type:"window",room:"exec",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"exec-picture-1",type:"picture",room:"exec",zone:"wall",offsetX:34,offsetY:8,pictureColor:"#1565C0"},{id:"exec-picture-2",type:"picture",room:"exec",zone:"wall",offsetX:48,offsetY:8,pictureColor:"#E65100"},{id:"exec-clock",type:"clock",room:"exec",zone:"wall",offsetX:64,offsetY:10},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:18},{id:"exec-window-2",type:"window",room:"exec",zone:"wall",offsetX:104,offsetY:6,windowW:16,windowH:14},{id:"work-whiteboard",type:"whiteboard",room:"work",zone:"wall",offsetX:6,offsetY:4},{id:"work-window-1",type:"window",room:"work",zone:"wall",offsetX:50,offsetY:6,windowW:16,windowH:14},{id:"work-window-2",type:"window",room:"work",zone:"wall",offsetX:92,offsetY:6,windowW:16,windowH:14},{id:"meet-bulletin",type:"bulletin-board",room:"meet",zone:"wall",offsetX:6,offsetY:4,facility:{id:"bulletin",label:"BULLETIN",icon:"📋",color:"#F59E0B",hitW:22,hitH:16}},{id:"meet-picture",type:"picture",room:"meet",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#10B981"},{id:"meet-window",type:"window",room:"meet",zone:"wall",offsetX:80,offsetY:6,windowW:16,windowH:14},{id:"meet-shelf",type:"shelf",room:"meet",zone:"wall",offsetX:102,offsetY:18},{id:"comm-screen",type:"screen",room:"comm",zone:"wall",offsetX:6,offsetY:6,facility:{id:"decisions",label:"DECISIONS",icon:"📜",color:"#EF4444",hitW:16,hitH:12}},{id:"comm-picture",type:"picture",room:"comm",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#d4956a"},{id:"comm-window",type:"window",room:"comm",zone:"wall",offsetX:76,offsetY:6,windowW:16,windowH:14},{id:"comm-clock",type:"clock",room:"comm",zone:"wall",offsetX:98,offsetY:10},{id:"comm-shelf",type:"shelf",room:"comm",zone:"wall",offsetX:108,offsetY:18}],Y=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(f.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"L",canvasW:360,canvasH:260,rooms:y,desks:b,doors:M,adjacency:$,corridorY:O,waypoints:B,wallDecorations:T,furniture:Y}}const JE=2;function dg(t,l){return l?l==="L"&&t<=12-JE?"M":l==="M"&&t>12?"L":l:t<=12?"M":"L"}function hg(t,l){switch(l??dg(t)){case"S":return QE(t);case"M":return ZE(t);case"L":return WE(t)}}function ky(t,l){if(!l||Object.keys(l).length===0)return t;const a=i=>i.map(o=>{const u=l[o.id];return u?{...o,offsetX:u.offsetX,offsetY:u.offsetY}:o});return{...t,wallDecorations:a(t.wallDecorations),furniture:a(t.furniture)}}function Sy(t,l){if(l)for(const[a,i]of Object.entries(l))t[a]&&(t[a]={...t[a],dx:i.dx,dy:i.dy})}function wd(t,l){if(!l||l.length===0)return t;const a=new Set(l);return{...t,wallDecorations:t.wallDecorations.filter(i=>!a.has(i.id)),furniture:t.furniture.filter(i=>!a.has(i.id))}}function jy(t,l){if(!l||l.length===0)return t;const a=[],i=[];for(const o of l)o.zone==="wall"?a.push(o):i.push(o);return{...t,wallDecorations:[...t.wallDecorations,...a],furniture:[...t.furniture,...i]}}let hs;function PE(t){hs=t}function F(t,l,a,i,o,u){t=Math.round(t),l=Math.round(l),!(u!==void 0&&u<.01)&&(u!==void 0&&u!==1&&(hs.globalAlpha=u),hs.fillStyle=o,hs.fillRect(t,l,a,i),u!==void 0&&u!==1&&(hs.globalAlpha=1))}function Je(t,l,a,i){F(t,l,1,1,a,i)}let sc=1;function li(t){sc=t}function jl(){return sc=sc*16807%2147483647,(sc&65535)/65535}function mg(t){const l=parseInt(t.slice(1,3),16)/255,a=parseInt(t.slice(3,5),16)/255,i=parseInt(t.slice(5,7),16)/255,o=Math.max(l,a,i),u=Math.min(l,a,i);let f=0,m=0;const p=(o+u)/2;if(o!==u){const h=o-u;m=p>.5?h/(2-o-u):h/(o+u),o===l?f=((a-i)/h+(a<i?6:0))/6:o===a?f=((i-l)/h+2)/6:f=((l-a)/h+4)/6}return[f*360,m*100,p*100]}function xg(t,l,a){t=(t%360+360)%360,l=Math.max(0,Math.min(100,l))/100,a=Math.max(0,Math.min(100,a))/100;const i=l*Math.min(a,1-a),o=f=>{const m=(f+t/30)%12;return a-i*Math.max(-1,Math.min(m-3,9-m,1))},u=f=>Math.round(f*255).toString(16).padStart(2,"0");return"#"+u(o(0))+u(o(8))+u(o(4))}function El(t,l=1){const[a,i,o]=mg(t);return xg(a+15*l,Math.min(100,i+8),o-12*l)}function Lt(t,l=1){const[a,i,o]=mg(t);return xg(a-10*l,i-3,o+10*l)}const nn={hi:"#D4AA5C",base:"#B08040",sh:"#7A5038",deep:"#4E3028"},Sl={hi:"#8A6848",base:"#604832",sh:"#3A2E24",deep:"#2A1E18"},vl={hi:"#5A6A80",base:"#485868",sh:"#364858",deep:"#283848"},Fa="#100A06";function eC(t,l,a=14,i=12){F(t,l,a,i,"#4A3828"),F(t+1,l+1,a-2,i-2,"#5A4838"),F(t+2,l+2,a-4,i-4,"#4A7098"),F(t+2,l+2,a-4,Math.floor((i-4)/2),"#6A90B8",.35);const o=Math.floor(a/2);F(t+o,l+1,1,i-2,"#4A3828"),F(t+1,l+Math.floor(i/2),a-2,1,"#4A3828",.5),Je(t+3,l+3,"#8AB8E8",.35),Je(t+o+2,l+3,"#8AB8E8",.25),F(t-1,l+i,a+2,2,"#5A4838"),F(t-1,l+i,a+2,1,Lt("#5A4838",.5),.35)}function tC(t,l,a){F(t,l,10,8,"#3A2818"),F(t+1,l+1,8,6,a),F(t+2,l+2,4,3,Lt(a,1.2),.3),Je(t+3,l+2,Lt(a,2),.25)}function nC(t,l){F(t,l,7,7,"#3A2818"),F(t+1,l+1,5,5,"#F0EDE5"),Je(t+3,l+1,"#AAA"),Je(t+3,l+5,"#AAA"),Je(t+1,l+3,"#AAA"),Je(t+5,l+3,"#AAA"),Je(t+3,l+3,"#222"),F(t+3,l+1,1,2,"#333"),Je(t+4,l+3,"#D32F2F")}function lC(t,l){F(t,l,26,16,"#586878"),F(t+1,l+1,24,13,"#ECEFF1"),F(t+1,l+1,24,1,"#F5F5F5",.4),F(t+3,l+3,14,1,"#1565C0",.6),F(t+3,l+5,18,1,"#333",.2),F(t+3,l+7,12,1,"#D32F2F",.35),F(t+3,l+9,16,1,"#333",.15),F(t+1,l+14,24,2,"#708898"),F(t+3,l+14,3,1,"#D32F2F"),F(t+7,l+14,3,1,"#1565C0"),F(t+11,l+14,3,1,"#2E7D32")}function aC(t,l){F(t,l,22,16,"#6A5030"),F(t+1,l+1,20,14,"#C4A66A"),li(88);for(let a=0;a<14;a++)for(let i=0;i<20;i++)jl()>.5&&Je(t+1+i,l+1+a,jl()>.5?"#B89858":"#D4B87A",.18);F(t+2,l+2,5,4,"#FFF176"),F(t+8,l+2,5,4,"#90CAF9"),F(t+14,l+3,5,4,"#CE93D8"),F(t+3,l+8,7,4,"#C8E6C9"),F(t+11,l+8,8,4,"#F8BBD0"),Je(t+4,l+2,"#E53935"),Je(t+10,l+2,"#1E88E5"),Je(t+16,l+3,"#FF9800")}function rC(t,l){F(t,l,20,3,"#5A4030"),F(t,l,20,1,Lt("#5A4030",.5),.35),F(t,l+2,20,1,El("#5A4030",.5),.3),F(t+2,l-4,3,4,"#E53935"),F(t+2,l-4,3,1,Lt("#E53935",1),.3),F(t+6,l-3,2,3,"#1E88E5"),F(t+9,l-5,4,5,"#43A047"),F(t+14,l-3,3,3,"#FFD54F"),Je(t+15,l-3,"#FFF176",.4)}function iC(t,l){F(t,l,16,12,"#1E1E28"),F(t+1,l+1,14,9,"#0C1420"),F(t+2,l+2,12,1,"#EF4444",.6),Je(t+2,l+4,"#4CAF50"),F(t+4,l+4,7,1,"#8b949e",.4),Je(t+2,l+6,"#FF9800"),F(t+4,l+6,5,1,"#8b949e",.3),Je(t+2,l+8,"#42A5F5"),F(t+4,l+8,8,1,"#8b949e",.25),F(t+7,l+10,2,2,"#1E1E28"),F(t+5,l+11,6,1,"#586878")}function sC(t,l,a){F(t+2,l+20,22,2,Fa,.15),F(t,l,22,20,Sl.deep),F(t+1,l+1,20,18,Sl.base),F(t,l,22,1,Sl.hi,.35),F(t,l,1,20,Sl.hi,.2);for(const u of[6,12])F(t+1,l+u,20,2,Sl.sh),F(t+1,l+u,20,1,Sl.hi,.2);const i=["#E53935","#1E88E5","#43A047","#8E24AA","#FB8C00","#00897B","#5C6BC0"];let o=t+2;for(let u=0;u<5;u++){const f=2+u%2;F(o,l+1,f,5,i[u]),F(o,l+1,f,1,Lt(i[u],1),.35),o+=f+1}o=t+2;for(let u=0;u<4;u++)F(o,l+7,4,5,i[u+3]),F(o,l+7,4,1,Lt(i[u+3],1),.25),o+=5;F(t+2,l+14,4,4,"#FFD54F"),F(t+8,l+14,7,4,"#90CAF9"),a&&F(t,l-1,22,1,a,.7)}function oC(t,l){F(t+2,l+11,6,2,Fa,.1),F(t+2,l+8,6,4,"#8B5E3C"),F(t+1,l+7,8,2,El("#A06E48",.3)),F(t+2,l+7,6,1,Lt("#A06E48",.5),.4),F(t+1,l+3,3,4,"#2E7D32"),F(t+5,l+2,3,4,"#2E7D32"),F(t+2,l+1,4,4,"#43A047"),F(t+3,l+0,3,3,"#66BB6A"),Je(t+4,l,"#81C784"),Je(t+3,l+1,"#A5D6A7",.4)}function cC(t,l){tr(t+4,l-4,"down"),tr(t+16,l-4,"down"),tr(t+28,l-4,"down"),F(t+3,l+24,34,3,Fa,.15),F(t,l+2,36,18,nn.deep),F(t+1,l+3,34,16,nn.base),F(t+1,l+3,34,1,nn.hi,.35);for(let a=0;a<14;a+=3)F(t+1,l+4+a,34,1,El(nn.base,.2),.08);F(t,l+20,36,4,nn.deep),F(t+1,l+21,34,2,nn.sh),F(t+6,l+7,10,6,"#1A1A24"),F(t+7,l+8,8,4,"#0C1420"),F(t+8,l+9,4,1,"#2A6898",.4),F(t+20,l+8,6,4,"#F0F0F0"),F(t+15,l+7,3,3,"#ECEFF1"),Je(t+16,l+8,"#795548"),tr(t+4,l+24,"up"),tr(t+16,l+24,"up"),tr(t+28,l+24,"up")}function uC(t,l){F(t+2,l+16,36,3,Fa,.15),F(t,l,36,5,"#5D4037"),F(t+1,l+1,34,3,"#6D4C41"),F(t+1,l+1,34,1,Lt("#6D4C41",.5),.3),F(t,l+5,36,8,"#5D4037"),F(t+2,l+6,15,6,"#6D4C41"),F(t+3,l+6,13,1,Lt("#6D4C41",.5),.35),F(t+19,l+6,15,6,"#6D4C41"),F(t+20,l+6,13,1,Lt("#6D4C41",.5),.35),F(t+17,l+6,2,6,"#5D4037"),F(t,l+13,36,3,El("#5D4037",1)),F(t-2,l+2,3,12,"#5D4037"),F(t+35,l+2,3,12,"#5D4037"),F(t+4,l+7,6,4,"#FF8A65"),F(t+5,l+7,4,1,Lt("#FF8A65",1),.35)}function fC(t,l){F(t+2,l+10,22,2,Fa,.12),F(t,l,22,8,Sl.deep),F(t+1,l+1,20,6,Sl.base),F(t+1,l+1,20,1,Sl.hi,.3),F(t,l+8,22,2,Sl.sh),F(t+3,l+2,6,4,"#F0F0F0"),F(t+13,l+3,3,3,"#ECEFF1"),Je(t+14,l+4,"#795548")}function dC(t,l){F(t+1,l+14,10,2,Fa,.12),F(t,l,10,14,"#546E7A"),F(t,l,10,1,Lt("#546E7A",1),.35),F(t+1,l+1,8,3,"#78909C"),F(t+1,l+5,8,4,"#37474F"),Je(t+2,l+6,"#EF5350"),Je(t+4,l+6,"#66BB6A"),F(t+2,l+11,4,2,"#ECEFF1")}function hC(t,l){F(t+2,l+16,26,3,Fa,.18),F(t,l,26,10,nn.deep),F(t+1,l+1,24,8,nn.base),F(t+1,l+2,24,1,nn.hi,.2),F(t+1,l+4,24,1,El(nn.base,.2),.1),F(t+1,l+6,24,1,nn.hi,.15),F(t+1,l+1,24,1,nn.hi,.4),F(t+1,l+1,1,8,nn.hi,.2),F(t,l+10,26,5,nn.deep),F(t+1,l+11,24,3,nn.sh),F(t+1,l+10,24,1,El(nn.base,1.5),.4),F(t+1,l+14,24,1,nn.base,.15),F(t+2,l+12,10,1,nn.deep,.4),F(t+14,l+12,10,1,nn.deep,.4),Je(t+7,l+11,"#C8D0D8",.6),Je(t+19,l+11,"#C8D0D8",.6),F(t+6,l-5,14,7,"#1E1E28"),F(t+7,l-4,12,5,"#0C1420"),F(t+8,l-3,5,1,"#2A6898",.6),F(t+8,l-2,8,1,"#1A3858",.4),F(t+8,l-1,3,1,"#2A6898",.35),Je(t+7,l-4,"#4A98D8",.25),Je(t+12,l+1,"#4CAF50",.4),F(t+12,l+2,2,3,"#586878"),F(t+10,l+4,6,1,"#8898A8"),F(t+6,l+4,12,4,"#222228"),F(t+6,l+4,12,1,"#333338",.4);for(let a=0;a<5;a++)Je(t+7+a*2,l+5,"#444",.6),Je(t+7+a*2,l+6,"#3A3A3E",.4);F(t+20,l+5,3,4,"#333338"),F(t+20,l+5,3,1,"#444448"),F(t+1,l+3,4,4,"#F0EDE8"),F(t+1,l+3,4,1,"#F8F6F2"),Je(t+2,l+5,"#6D4C41")}function tr(t,l,a){F(t+1,l+9,10,2,Fa,.1),Je(t+5,l+9,"#1E1E22"),Je(t+1,l+10,"#1A1A1E"),Je(t+9,l+10,"#1A1A1E"),Je(t+3,l+11,"#1A1A1E"),Je(t+7,l+11,"#1A1A1E"),F(t+1,l+2,8,6,vl.base),F(t+2,l+3,6,4,vl.hi,.35),F(t+2,l+3,6,1,Lt(vl.hi,.5),.25),F(t+1,l+7,8,1,vl.deep),a==="up"?(F(t,l+7,10,3,vl.deep),F(t+1,l+8,8,1,vl.sh)):(F(t,l-1,10,3,vl.deep),F(t+1,l,8,1,vl.sh)),F(t,l+3,1,4,vl.sh),F(t+9,l+3,1,4,vl.sh)}const pg={bookshelf:(t,l,a)=>sC(t,l,a.accent),plant:(t,l)=>oC(t,l),"meeting-table":(t,l)=>cC(t,l),sofa:(t,l)=>uC(t,l),"coffee-table":(t,l)=>fC(t,l),"coffee-machine":(t,l)=>dC(t,l),window:(t,l,a)=>eC(t,l,a.windowW??16,a.windowH??14),picture:(t,l,a)=>tC(t,l,a.pictureColor??"#1565C0"),clock:(t,l)=>nC(t,l),whiteboard:(t,l)=>lC(t,l),"bulletin-board":(t,l)=>aC(t,l),shelf:(t,l)=>rC(t,l),screen:(t,l)=>iC(t,l)};function ei(t,l){const a=t.zone==="wall"?l.wx:l.fx,i=t.zone==="wall"?l.wy:l.fy;return{x:t.anchorX==="right"?(t.zone==="wall"?l.wx+l.ww:l.fx+l.fw)+t.offsetX:a+t.offsetX,y:i+t.offsetY}}function mC(t){for(const l of t.wallDecorations){const a=t.rooms[l.room];if(!a)continue;const{x:i,y:o}=ei(l,a),u=pg[l.type];u&&u(i,o,l)}}function xC(t,l,a){for(const i of t.furniture){const o=t.rooms[i.room];if(!o||i.condition==="no-desks"&&a.has(i.room))continue;const{x:u,y:f}=ei(i,o),m=pg[i.type];m&&l.push({y:f,draw:()=>m(u,f,i)})}}function Aa(t){const l=[],a=[...t.wallDecorations,...t.furniture];for(const i of a){if(!i.facility)continue;const o=t.rooms[i.room];if(!o)continue;const{x:u,y:f}=ei(i,o);l.push({id:i.facility.id,label:i.facility.label,icon:i.facility.icon,color:i.facility.color,dx:u,dy:f,pw:i.facility.hitW,ph:i.facility.hitH})}return l}const pC={bookshelf:{w:22,h:20},plant:{w:10,h:12},"meeting-table":{w:36,h:28},sofa:{w:38,h:16},"coffee-table":{w:22,h:10},"coffee-machine":{w:10,h:14},window:{w:16,h:14},picture:{w:10,h:8},clock:{w:7,h:7},whiteboard:{w:26,h:16},"bulletin-board":{w:22,h:16},shelf:{w:20,h:8},screen:{w:16,h:12}};function Yd(t){return pC[t]??{w:16,h:16}}function kd(t,l,a,i){for(let o=t.furniture.length-1;o>=0;o--){const u=t.furniture[o],f=t.rooms[u.room];if(!f||u.condition==="no-desks"&&i.has(u.room))continue;const{x:m,y:p}=ei(u,f),h=Yd(u.type);if(l>=m&&l<=m+h.w&&a>=p&&a<=p+h.h)return u.id}for(let o=t.wallDecorations.length-1;o>=0;o--){const u=t.wallDecorations[o],f=t.rooms[u.room];if(!f)continue;const{x:m,y:p}=ei(u,f),h=Yd(u.type);if(l>=m&&l<=m+h.w&&a>=p&&a<=p+h.h)return u.id}return null}function Ey(t,l,a,i,o){const f=[...l.wallDecorations,...l.furniture].find(y=>y.id===a);if(!f||f.condition==="no-desks"&&o.has(f.room))return;const m=l.rooms[f.room];if(!m)return;const{x:p,y:h}=ei(f,m),g=Yd(f.type);t.save(),t.fillStyle=i,t.globalAlpha=.2,t.fillRect(p-1,h-1,g.w+2,g.h+2),t.globalAlpha=.9,t.strokeStyle=i,t.lineWidth=1,t.strokeRect(p-.5,h-.5,g.w+1,g.h+1),t.restore()}function Cy(t,l,a,i){t.save(),t.fillStyle=i,t.globalAlpha=.2,t.fillRect(l-1,a-1,28,42),t.globalAlpha=.9,t.strokeStyle=i,t.lineWidth=1,t.strokeRect(l-.5,a-.5,27,41),t.restore()}function Ny(t,l,a){for(const[i,o]of Object.entries(t))if(l>=o.dx&&l<=o.dx+26&&a>=o.dy&&a<=o.dy+40)return i;return null}const yC=[{type:"plant",zone:"floor",label:"Plant",icon:"🪴"},{type:"bookshelf",zone:"floor",label:"Bookshelf",icon:"📚"},{type:"sofa",zone:"floor",label:"Sofa",icon:"🛋️"},{type:"coffee-table",zone:"floor",label:"Coffee Table",icon:"☕"},{type:"coffee-machine",zone:"floor",label:"Coffee Machine",icon:"☕"},{type:"meeting-table",zone:"floor",label:"Meeting Table",icon:"🪑"},{type:"window",zone:"wall",label:"Window",icon:"🪟"},{type:"picture",zone:"wall",label:"Picture",icon:"🖼️"},{type:"clock",zone:"wall",label:"Clock",icon:"🕐"},{type:"whiteboard",zone:"wall",label:"Whiteboard",icon:"📋"},{type:"shelf",zone:"wall",label:"Shelf",icon:"📦"},{type:"screen",zone:"wall",label:"Screen",icon:"🖥️"}],lc=16,gC=4,er=4,oc=2,mt=4,Da=4;let Me=hg(7);const bc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};let ul=Aa(Me);function yg(t){return{x:t.dx,y:t.dy,w:t.pw,h:t.ph}}function gg(t){return{cx:t.dx+t.pw/2,botY:t.dy+t.ph}}let qt={};function bC(t){const l={};for(let a=0;a<t.length&&a<Me.desks.length;a++)l[t[a]]=Me.desks[a];return l}let Rt,ar=null,nr=null,Ql=!1,fl=null,Yn=null,mn=null,tn=null,Qr=null,wl=null;function vC(t,l){const{wx:a,wy:i,ww:o,wh:u,wallColor:f,baseboardColor:m}=t,p=El(f,.5),h=Lt(f,.5),g=[];if(l){const y=l.x-a,b=l.w;y>0&&g.push({sx:a,sw:y}),y+b<o&&g.push({sx:l.x+b,sw:o-y-b})}else g.push({sx:a,sw:o});for(const y of g){F(y.sx,i,y.sw,u,f);for(let b=0;b<u;b+=4)F(y.sx,i+b,y.sw,1,h,.08),F(y.sx,i+b+2,y.sw,1,p,.05);li(Math.round(y.sx*7+i*13));for(let b=0;b<y.sw;b+=3)jl()>.4&&F(y.sx+b,i,1,u,h,.04);F(y.sx,i,y.sw,2,h,.3),F(y.sx,i,y.sw,1,Lt(f,1),.2),F(y.sx,i+u-2,y.sw,2,p,.3),F(y.sx,i+u,y.sw,oc,m),F(y.sx,i+u,y.sw,1,Lt(m,.5),.4)}l&&(F(l.x-1,i,1,u+oc,"#4A3828"),F(l.x+l.w,i,1,u+oc,"#4A3828"),F(l.x,i,l.w,1,"#0A0808",.12)),F(t.fx,t.fy,t.fw,3,"#0A0808",.12),F(t.fx,t.fy+3,t.fw,2,"#0A0808",.06)}function wC(t){const l="#504038",a=El(l,.5),i=Lt(l,.5),o=t.wx-Da,u=t.wy,f=t.wh+oc+t.fh;F(o,u,Da,f,l),F(o,u,1,f,i,.3),F(o+Da-1,u,1,f,a,.4);for(let p=0;p<f;p+=6)F(o+1,u+p,Da-2,1,i,.06);const m=t.wx+t.ww;F(m,u,Da,f,l),F(m,u,1,f,i,.2),F(m+Da-1,u,1,f,a,.3)}function Sd(t){const{fx:l,fy:a,fw:i,fh:o}=t,u="#B08040",f="#C89848",m="#8A6030",p="#6A4820";F(l,a,i,o,u),li(42);for(let h=0;h<o;h+=5){const g=Math.floor(h/5)%2*10;for(let y=-10;y<i+10;y+=20){const b=l+y+g,v=Math.max(l,b),S=Math.min(b+19,l+i)-v;if(S<=0)continue;const k=jl()>.5?f:u;F(v,a+h,S,4,k,.25),F(v,a+h,S,1,f,.3),F(v,a+h+4,S,1,p,.35),b>=l&&b<l+i&&F(b,a+h,1,4,p,.2),F(v,a+h+2,S,1,m,.1)}}F(l,a,i,2,"#0A0808",.08),F(l,a,2,o,"#0A0808",.06)}function Ay(t){const{fx:l,fy:a,fw:i,fh:o}=t,u="#1C2A38",f="#101820";li(99),F(l,a,i,o,u);for(let m=0;m<o;m+=lc)for(let p=0;p<i;p+=lc){const h=Math.min(lc,i-p),g=Math.min(lc,o-m);jl()>.5&&F(l+p,a+m,h,g,Lt(u,.2),.15),F(l+p+2,a+m+2,h-4,g-4,Lt(u,.3),.08),F(l+p,a+m,h,1,f,.5),F(l+p,a+m,1,g,f,.5),F(l+p+1,a+m+1,1,g-1,Lt(u,.4),.1),jl()>.85&&Je(l+p+4+Math.floor(jl()*8),a+m+4+Math.floor(jl()*8),"#3A6A9A",.08)}}function kC(t){const{fx:l,fy:a,fw:i,fh:o}=t,u="#387848",f="#4A9058",m="#285E38";F(l,a,i,o,u),li(77);for(let h=0;h<o;h+=2)for(let g=0;g<i;g+=2)jl()>.5&&Je(l+g,a+h,f,.1),jl()>.8&&Je(l+g+1,a+h+1,m,.12);const p=5;F(l+p,a+p,i-p*2,1,f,.45),F(l+p,a+o-p-1,i-p*2,1,m,.45),F(l+p,a+p,1,o-p*2,f,.35),F(l+i-p-1,a+p,1,o-p*2,m,.35)}function SC(t){const{fx:l,fy:a,fw:i,fh:o}=t,u="#D8C490",f="#B09060",m="#907848";li(55);for(let p=0;p<o;p+=8)for(let h=0;h<i;h+=8){const g=Math.min(8,i-h),y=Math.min(8,o-p),b=(h/8+p/8)%2===0?f:u;F(l+h,a+p,g,y,b),F(l+h+1,a+p+1,g-2,1,Lt(b,.4),.2),F(l+h+1,a+p+1,1,y-2,Lt(b,.4),.15),F(l+h+g-2,a+p+2,1,y-3,El(b,.4),.15),F(l+h+2,a+p+y-2,g-3,1,El(b,.4),.15),F(l+h,a+p,g,1,m,.3),F(l+h,a+p,1,y,m,.3)}}function jC(){const{canvasW:t,canvasH:l,rooms:a,doors:i}=Me,o="#2A1E14",u="#3A2E24";if(F(0,0,t,er,o),F(0,l-er,t,er,o),F(0,0,er,l,o),F(t-er,0,er,l,o),F(0,0,t,1,u,.3),F(0,0,1,l,u,.2),!a.exec||!a.work||!a.meet||!a.comm)return;const f=a.exec,m=a.meet,p=t/2,h=p-mt/2,g=f.fy+f.fh,y=i.exec_work,b=i.meet_comm,v=i.exec_meet,S=i.work_comm,k=24,C=28,E=((y==null?void 0:y.doorY)??f.fy+20)-k/2,M=((v==null?void 0:v.doorX)??er+Da+54)-C/2,$=((S==null?void 0:S.doorX)??p+mt/2+Da+54)-C/2,O=((b==null?void 0:b.doorY)??m.fy+20)-k/2;F(0,g,M,mt,o),F(M+C,g,h-M-C,mt,o),F(h+mt,g,$-h-mt,mt,o),F($+C,g,t-$-C,mt,o),F(0,g,M,1,u,.3),F(M+C,g,h-M-C,1,u,.3),F(h+mt,g,$-h-mt,1,u,.3),F($+C,g,t-$-C,1,u,.3),F(h,0,mt,E,o),F(h,E+k,mt,g-E-k,o),F(h,g+mt,mt,O-g-mt,o),F(h,O+k,mt,l-O-k,o),F(h,0,1,E,u,.2),F(h,E+k,1,g-E-k,u,.2),F(h,g+mt,1,O-g-mt,u,.2),F(h,O+k,1,l-O-k,u,.2),F(h,E,mt,k,"#C4A070"),F(h+mt/2,E,mt/2,k,"#3A4858"),F(h,O,mt,k,"#7AA880"),F(h+mt/2,O,mt/2,k,"#C8B890");const B="#4A3828";F(h,E-1,mt,1,B),F(h,E+k,mt,1,B),F(M-1,g,1,mt,B),F(M+C,g,1,mt,B),F($-1,g,1,mt,B),F($+C,g,1,mt,B),F(h,O-1,mt,1,B),F(h,O+k,mt,1,B)}const Dy=new Map;function EC(t){const l=`${t.hairStyle??""}|${t.outfitStyle??""}|${t.accessory??""}`;let a=Dy.get(l);if(!a){const i=$d("mini-seated:default"),o=G0(i,t);a=o?o.layers.flatMap(u=>u.pixels):[],Dy.set(l,a)}return a}function CC(t,l,a){Ld(Rt,EC(a),t,l,a)}function NC(t,l,a,i,o){tr(t+8,l+20,"up"),o||CC(t+8,l+0+i,a),hC(t,l+14)}function AC(t,l,a,i,o){const u=i in wy?i:"down",f=o%4,m=wy[u][f];Ld(Rt,m,t,l,a);const p=f===1||f===3?-1:0;if(a.accessory&&a.accessory!=="none"){const h=vS(a.accessory,u);h&&h.pixels.length>0&&Ld(Rt,h.pixels,t,l+p,a)}Rt.globalAlpha=1}function DC(t){const l={};let a=0;for(const i of t){const o=qt[i];o&&(l[i]={state:"sitting",homeX:o.dx+8,homeY:o.dy+34,homeRoom:o.room,x:o.dx+8,y:o.dy+34,path:[],room:o.room,dir:"down",walkFrame:0,walkTimer:0,bobY:0,bobOff:a*17,stateTimer:600+Math.floor(Math.random()*900)},a++)}return l}function ys(t,l,a,i,o){const u=Me.corridorY[o]??l,f=[];return l<u-4&&f.push({x:t,y:u}),Math.abs(t-a)>4&&f.push({x:a,y:u}),f.push({x:a,y:i}),f}function jd(t,l,a,i){const o=Me.adjacency[a];if(!o)return[];const u=o.find(g=>g.room===i);if(!u)return[];const f=Me.doors[u.door];if(!f)return[];const m=[],p=Me.corridorY[a]??l,h=Me.corridorY[i]??l;if(Math.abs(l-p)>4&&m.push({x:t,y:p}),f.type==="v"){const g=u.side==="A"?f.xA:f.xB,y=u.side==="A"?f.xB:f.xA;m.push({x:g,y:p}),m.push({x:g,y:f.doorY}),m.push({x:y,y:f.doorY}),m.push({x:y,y:h})}else{const g=u.side==="A"?f.yA:f.yB,y=u.side==="A"?f.yB:f.yA;m.push({x:f.doorX,y:p}),m.push({x:f.doorX,y:g}),m.push({x:f.doorX,y}),m.push({x:f.doorX,y:h})}return m}function bg(t,l){const a=Me.adjacency[t.room];if(!a)return[];if(!a.find(o=>o.room===l)){for(const o of a){const u=Me.adjacency[o.room];if(u!=null&&u.find(f=>f.room===l)){const f=jd(t.x,t.y,t.room,o.room),m=f[f.length-1],p=jd((m==null?void 0:m.x)??t.x,(m==null?void 0:m.y)??t.y,o.room,l);return[...f,...p]}}return[]}return jd(t.x,t.y,t.room,l)}function TC(t){if(t.room!==t.homeRoom){const l=bg({...t},t.homeRoom),a=l[l.length-1],i=ys((a==null?void 0:a.x)??t.x,(a==null?void 0:a.y)??t.y,t.homeX,t.homeY,t.homeRoom);return[...l,...i]}return ys(t.x,t.y,t.homeX,t.homeY,t.room)}function zC(t,l){for(const[,a]of Object.entries(t))if(a.stateTimer--,a.state==="sitting"){if(a.bobY=(l+a.bobOff)%60<30?1:0,a.stateTimer<=0){a.state="walking",a.x=a.homeX,a.y=a.homeY,a.room=a.homeRoom;const i=Object.keys(Me.rooms);if(Math.random()<.25&&i.length>1){const o=i.filter(p=>p!==a.room),u=o[Math.floor(Math.random()*o.length)],f=bg(a,u),m=Me.waypoints[u];if(m&&m.length>0){const p=m[Math.floor(Math.random()*m.length)],h=f[f.length-1]??{x:a.x,y:a.y},g=ys(h.x,h.y,p.x,p.y,u);a.path=[...f,...g]}else a.path=f;a.walkTimer=0}else{const o=Me.waypoints[a.room];if(o&&o.length>0){const u=o[Math.floor(Math.random()*o.length)];a.path=ys(a.x,a.y,u.x,u.y,a.room)}a.walkTimer=0}}}else if(a.state==="walking"||a.state==="returning"){if(a.path.length===0){a.state==="returning"?(a.state="sitting",a.room=a.homeRoom,a.stateTimer=800+Math.floor(Math.random()*1200)):(a.state="idle",a.dir="down",a.stateTimer=180+Math.floor(Math.random()*360));continue}const i=a.path[0],o=i.x-a.x,u=i.y-a.y,f=Math.sqrt(o*o+u*u);if(f<1.5){a.x=i.x,a.y=i.y,a.path.shift();for(const[m,p]of Object.entries(Me.rooms))if(a.x>=p.fx&&a.x<=p.fx+p.fw&&a.y>=p.fy&&a.y<=p.fy+p.fh){a.room=m;break}}else a.x+=o/f*.2,a.y+=u/f*.2,Math.abs(o)>Math.abs(u)?a.dir=o>0?"right":"left":a.dir=u>0?"down":"up",a.walkTimer++,a.walkFrame=Math.floor(a.walkTimer/12)%4}else if(a.state==="idle"&&a.stateTimer<=0)if(Math.random()<.3){a.state="walking";const i=Me.waypoints[a.room];if(i&&i.length>0){const o=i[Math.floor(Math.random()*i.length)];a.path=ys(a.x,a.y,o.x,o.y,a.room)}a.walkTimer=0}else a.state="returning",a.path=TC(a),a.walkTimer=0}function MC(t,l,a){const{canvasW:i,canvasH:o,rooms:u}=Me;Rt.clearRect(0,0,i,o),F(0,0,i,o,"#2A1E14");const f={wood:Sd,dark:Ay,carpet:kC,tile:SC};for(const y of Object.values(u))(f[y.floorType]??Sd)(y);const m=Object.keys(u);if(m.length>=4){const y=u.exec,b=u.meet,{doors:v}=Me;if(y&&b&&v.exec_meet&&v.work_comm){const k=(v.exec_meet.doorX??0)-14,C=(v.work_comm.doorX??0)-28/2,E=y.fy+y.fh,M=b.fy;Sd({fx:k,fy:E,fw:28,fh:M-E}),Ay({fx:C,fy:E,fw:28,fh:M-E})}}const p={};if(m.length>=4){const{doors:y}=Me,b=28,v=y.exec_meet,S=y.work_comm;v!=null&&v.doorX&&(p.meet={x:v.doorX-b/2,w:b}),S!=null&&S.doorX&&(p.comm={x:S.doorX-b/2,w:b})}for(const y of Object.values(u))vC(y,p[y.id]),wC(y);jC(),mC(Me);const h=[],g=new Set(Object.values(qt).map(y=>y.room));xC(Me,h,g);for(const[y,b]of Object.entries(qt)){const v=t[y];if(!v)continue;const S=v.state==="sitting",k=l(y),C=a[y]==="working";h.push({y:b.dy+14,draw:()=>{if(NC(b.dx,b.dy,k,S?v.bobY:0,!S),S&&C){const E=bc[y]??"#388bfd";F(b.dx+7,b.dy+14-4,12,5,E,.15),Je(b.dx+12,b.dy+14+1,"#4CAF50",.8)}}})}for(const[y,b]of Object.entries(t))if(b.state!=="sitting"){const v=l(y);h.push({y:b.y+14,draw:()=>AC(Math.round(b.x),Math.round(b.y),v,b.dir,b.walkFrame)})}h.sort((y,b)=>y.y-b.y);for(const y of h)y.draw();for(const y of ul){const b=nr===y.id,v=gg(y);if(Rt.save(),Rt.globalAlpha=b?.9:.5,Rt.fillStyle=y.color,Rt.fillRect(v.cx-1,v.botY-2,3,3),b){const S=yg(y);Rt.globalAlpha=.3,Rt.strokeStyle=y.color,Rt.lineWidth=1,Rt.strokeRect(S.x-1,S.y-1,S.w+2,S.h+2)}Rt.restore()}if(Ql){const y=new Set(Object.values(qt).map(b=>b.room));if(fl&&fl!==Yn)if(fl.startsWith("desk:")){const b=fl.slice(5),v=qt[b];v&&Cy(Rt,v.dx,v.dy,"#FBBF24")}else Ey(Rt,Me,fl,"#FBBF24",y);if(Yn)if(Yn.startsWith("desk:")){const b=Yn.slice(5),v=qt[b];v&&Cy(Rt,v.dx,v.dy,"#3B82F6")}else Ey(Rt,Me,Yn,"#3B82F6",y)}if(ar){const y=qt[ar],b=t[ar];y&&b&&(Rt.save(),Rt.globalAlpha=.25,Rt.fillStyle=bc[ar]??"#fff",b.state==="sitting"?Rt.fillRect(y.dx-1,y.dy+6,28,30):Rt.fillRect(Math.round(b.x)-1,Math.round(b.y)-1,14,24),Rt.restore())}}function _C({roles:t,projects:l,roleStatuses:a,activeExecs:i,onRoleClick:o,onProjectClick:u,onBulletinClick:f,onDecisionsClick:m,onKnowledgeClick:p,getRoleSpeech:h,getAppearance:g,onHireClick:y}){const b=j.useRef(null),v=j.useRef(null),S=j.useRef(null),k=j.useRef({}),C=j.useRef(0),E=j.useRef(gC),[M,$]=j.useState(!1),[O,B]=j.useState(null),[T,Y]=j.useState(null),V=j.useRef({}),te=j.useRef({}),D=j.useRef([]),I=j.useRef([]);j.useEffect(()=>{Ql=M},[M]),j.useEffect(()=>{Qr=O,wl=T},[O,T]),j.useEffect(()=>{Te.getPreferences().then(se=>{const K=se.furnitureOverrides;K&&Object.keys(K).length>0&&(V.current=K,Me=ky(Me,K));const ue=se.deskOverrides;if(ue&&Object.keys(ue).length>0){te.current=ue,Sy(qt,ue);for(const[xe,je]of Object.entries(qt)){const Ae=k.current[xe];Ae&&(Ae.homeX=je.dx+8,Ae.homeY=je.dy+34)}}const we=se.removedFurniture;we&&we.length>0&&(D.current=we,Me=wd(Me,we));const ne=se.addedFurniture;ne&&ne.length>0&&(I.current=ne,Me=jy(Me,ne)),ul=Aa(Me)}).catch(()=>{})},[]);const L=j.useRef({roleStatuses:a,activeExecs:i,getRoleSpeech:h,getAppearance:g});L.current={roleStatuses:a,activeExecs:i,getRoleSpeech:h,getAppearance:g};const ee=j.useMemo(()=>t.map(se=>se.id),[t]),ae=j.useRef(Me);j.useEffect(()=>{const se=ee.length,K=dg(se,ae.current.preset);let ue=hg(se,K);D.current.length>0&&(ue=wd(ue,D.current)),I.current.length>0&&(ue=jy(ue,I.current)),Object.keys(V.current).length>0&&(ue=ky(ue,V.current)),Me=ue,ae.current=ue,qt=bC(ee),Object.keys(te.current).length>0&&Sy(qt,te.current),ul=Aa(ue),k.current=DC(ee);const we=b.current;we&&(we.width=ue.canvasW,we.height=ue.canvasH),U()},[ee]);const X=j.useCallback(se=>{var K,ue;return((ue=(K=L.current).getAppearance)==null?void 0:ue.call(K,se))??mh(se)},[]),U=j.useCallback(()=>{const se=v.current,K=b.current;if(!se||!K)return;const ue=se.parentElement;if(!ue)return;const we=ue.clientWidth,ne=ue.clientHeight;if(we===0||ne===0)return;const{canvasW:xe,canvasH:je}=Me;let Ae=Math.floor(Math.min(we/xe,ne/je));Ae=Math.max(2,Math.min(Ae,5)),E.current=Ae,K.style.width=xe*Ae+"px",K.style.height=je*Ae+"px",se.style.width=xe*Ae+"px",se.style.height=je*Ae+"px"},[]);j.useEffect(()=>{var je;const se=b.current;if(!se)return;const K=se.getContext("2d");if(!K)return;Rt=K,PE(K),U();const ue=new ResizeObserver(()=>U()),we=(je=v.current)==null?void 0:je.parentElement;we&&ue.observe(we);let ne;const xe=()=>{C.current++,zC(k.current,C.current),MC(k.current,X,L.current.roleStatuses),Q(),ne=requestAnimationFrame(xe)};return ne=requestAnimationFrame(xe),()=>{cancelAnimationFrame(ne),ue.disconnect()}},[X,U]),j.useEffect(()=>{const se=S.current;if(!se)return;se.innerHTML="";for(const ue of ee){const we=bc[ue]??"#8b949e",ne=document.createElement("div");ne.className="td-nametag",ne.dataset.role=ue;const xe=document.createElement("span");xe.className="td-dot",xe.style.background=we,ne.appendChild(xe),ne.appendChild(document.createTextNode(ue.toUpperCase())),se.appendChild(ne);const je=document.createElement("div");je.className="td-bubble",je.dataset.role=ue,je.dataset.type="bubble",se.appendChild(je)}const K={meeting:()=>{const ue=l[0];ue?u(ue.id):f()},bulletin:f,decisions:m,knowledge:p};for(const ue of ul){const we=document.createElement("div");we.className="td-facility-label",we.dataset.facility=ue.id,we.textContent=`${ue.icon} ${ue.label}`,we.style.borderColor=`${ue.color}44`;const ne=K[ue.id];ne&&we.addEventListener("click",ne),we.addEventListener("mouseenter",()=>{nr=ue.id}),we.addEventListener("mouseleave",()=>{nr=null}),se.appendChild(we)}},[ee,l,u,f,m,p]);const Q=j.useCallback(()=>{var je;const se=S.current;if(!se)return;const K=E.current,ue=k.current,{getRoleSpeech:we,roleStatuses:ne,activeExecs:xe}=L.current;for(const Ae of Object.keys(ue)){const Re=ue[Ae],Ve=qt[Ae];if(!Ve)continue;let jt,$t,ct;Re.state==="sitting"?(jt=Ve.dx+13,ct=Ve.dy+2,$t=Ve.dy+37):(jt=Math.round(Re.x)+6,ct=Math.round(Re.y)-2,$t=Math.round(Re.y)+18);const Dt=jt/Me.canvasW*100,on=se.querySelector(`.td-nametag[data-role="${Ae}"]`);if(on){on.style.left=Dt+"%",on.style.top=$t*K+2+"px";const Pt=on.querySelector(".td-dot");if(Pt){const re=ne[Ae]==="working";Pt.style.background=re?"#FBBF24":bc[Ae]??"#8b949e",re?Pt.style.animation="td-pulse 1s ease-in-out infinite":Pt.style.animation=""}}const gt=se.querySelector(`.td-bubble[data-role="${Ae}"]`);if(gt){const Pt=ne[Ae]==="working",re=(je=xe.find(me=>me.roleId===Ae))==null?void 0:je.task,ye=we(Ae),_e=Pt&&re?re.slice(0,30):ye?ye.slice(0,30):"";_e&&Re.state==="sitting"?(gt.style.display="",gt.style.left=Dt+"%",gt.style.top=(ct-5)*K+"px",gt.textContent=_e):gt.style.display="none"}}for(const Ae of ul){const Re=se.querySelector(`.td-facility-label[data-facility="${Ae.id}"]`);if(Re){const Ve=gg(Ae);Re.style.left=Ve.cx/Me.canvasW*100+"%",Re.style.top=Ve.botY*K+2+"px",Re.classList.toggle("td-facility-label--hover",nr===Ae.id)}}},[]),ie=j.useCallback(se=>{const K=b.current;if(!K)return null;const ue=K.getBoundingClientRect(),we=E.current,ne=(se.clientX-ue.left)/we,xe=(se.clientY-ue.top)/we,je=k.current;for(const[Ae,Re]of Object.entries(qt)){if(!je[Ae])continue;const Ve=je[Ae];if(Ve.state==="sitting"){if(ne>=Re.dx&&ne<=Re.dx+26&&xe>=Re.dy&&xe<=Re.dy+40)return{type:"role",id:Ae}}else if(ne>=Ve.x-2&&ne<=Ve.x+14&&xe>=Ve.y-2&&xe<=Ve.y+20)return{type:"role",id:Ae}}for(const Ae of ul){const Re=yg(Ae);if(ne>=Re.x&&ne<=Re.x+Re.w&&xe>=Re.y&&xe<=Re.y+Re.h)return{type:"facility",id:Ae.id}}return null},[]),ve=j.useCallback(se=>{const K=b.current;if(!K)return{mx:0,my:0};const ue=K.getBoundingClientRect(),we=E.current;return{mx:(se.clientX-ue.left)/we,my:(se.clientY-ue.top)/we}},[]),z=j.useCallback(se=>{Te.updatePreferences(se).catch(()=>{})},[]),_=j.useCallback(se=>{const K=[...D.current,se];D.current=K,Me=wd(Me,[se]),ul=Aa(Me),Yn=null,fl=null,z({removedFurniture:K})},[z]),P=j.useCallback((se,K)=>{if(!Qr||!wl)return;let ue=null;for(const[Re,Ve]of Object.entries(Me.rooms)){const jt=wl==="wall"?Ve.wx:Ve.fx,$t=wl==="wall"?Ve.wy:Ve.fy,ct=wl==="wall"?Ve.ww:Ve.fw,Dt=wl==="wall"?Ve.wh:Ve.fh;if(se>=jt&&se<=jt+ct&&K>=$t&&K<=$t+Dt){ue=Re;break}}if(!ue)return;const we=Me.rooms[ue],ne=wl==="wall"?we.wx:we.fx,xe=wl==="wall"?we.wy:we.fy,je={id:`user-${Qr}-${Date.now()}`,type:Qr,room:ue,zone:wl,offsetX:Math.round(se-ne),offsetY:Math.round(K-xe)},Ae=[...I.current,je];I.current=Ae,wl==="wall"?Me.wallDecorations.push(je):Me.furniture.push(je),ul=Aa(Me),z({addedFurniture:Ae}),B(null),Y(null)},[z]),A=j.useCallback(se=>{const K=b.current;if(Ql&&mn){const{mx:we,my:ne}=ve(se),je=[...Me.furniture,...Me.wallDecorations].find(Ve=>Ve.id===mn.defId);if(!je)return;const Ae=we-mn.startMx,Re=ne-mn.startMy;je.offsetX=Math.round(mn.origOffX+Ae),je.offsetY=Math.round(mn.origOffY+Re),ul=Aa(Me),K&&(K.style.cursor="grabbing");return}if(Ql&&tn){const{mx:we,my:ne}=ve(se),xe=qt[tn.roleId];if(!xe)return;xe.dx=Math.round(tn.origDx+(we-tn.startMx)),xe.dy=Math.round(tn.origDy+(ne-tn.startMy));const je=k.current[tn.roleId];je&&(je.homeX=xe.dx+8,je.homeY=xe.dy+34),K&&(K.style.cursor="grabbing");return}if(Ql){const{mx:we,my:ne}=ve(se);if(Qr){K&&(K.style.cursor="crosshair");return}const xe=new Set(Object.values(qt).map(Ae=>Ae.room)),je=kd(Me,we,ne,xe);if(je)fl=je;else{const Ae=Ny(qt,we,ne);fl=Ae?`desk:${Ae}`:null}ar=null,nr=null,K&&(K.style.cursor=fl?"grab":"default");return}const ue=ie(se);ar=(ue==null?void 0:ue.type)==="role"?ue.id:null,nr=(ue==null?void 0:ue.type)==="facility"?ue.id:null,fl=null,K&&(K.style.cursor=ue?"pointer":"default")},[ie,ve]),pe=j.useCallback(se=>{if(!Ql)return;const{mx:K,my:ue}=ve(se);if(Qr){P(K,ue),se.preventDefault();return}const we=new Set(Object.values(qt).map(je=>je.room)),ne=kd(Me,K,ue,we);if(ne){const Ae=[...Me.furniture,...Me.wallDecorations].find(Re=>Re.id===ne);Ae&&(Yn=ne,mn={defId:ne,startMx:K,startMy:ue,origOffX:Ae.offsetX,origOffY:Ae.offsetY},se.preventDefault());return}const xe=Ny(qt,K,ue);if(xe){const je=qt[xe];Yn=`desk:${xe}`,tn={roleId:xe,startMx:K,startMy:ue,origDx:je.dx,origDy:je.dy},se.preventDefault();return}Yn=null},[ve,P]),Se=j.useCallback(se=>{if(mn){const ue=[...Me.furniture,...Me.wallDecorations].find(we=>we.id===mn.defId);if(ue){const we={...V.current,[ue.id]:{offsetX:ue.offsetX,offsetY:ue.offsetY}};V.current=we,z({furnitureOverrides:we}),ul=Aa(Me)}mn=null,b.current&&(b.current.style.cursor="grab");return}if(tn){const K=qt[tn.roleId];if(K){const ue={...te.current,[tn.roleId]:{dx:K.dx,dy:K.dy}};te.current=ue,z({deskOverrides:ue})}tn=null,b.current&&(b.current.style.cursor="grab")}},[z]),Ce=j.useCallback(se=>{if(!Ql)return;se.preventDefault();const{mx:K,my:ue}=ve(se),we=new Set(Object.values(qt).map(xe=>xe.room)),ne=kd(Me,K,ue,we);ne&&_(ne)},[ve,_]);j.useEffect(()=>{const se=K=>{!Ql||!Yn||(K.key==="Delete"||K.key==="Backspace")&&(Yn.startsWith("desk:")||_(Yn))};return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[_]);const Fe=j.useCallback(()=>{if(mn){const K=[...Me.furniture,...Me.wallDecorations].find(ue=>ue.id===mn.defId);K&&(K.offsetX=mn.origOffX,K.offsetY=mn.origOffY,ul=Aa(Me)),mn=null}if(tn){const se=qt[tn.roleId];se&&(se.dx=tn.origDx,se.dy=tn.origDy);const K=k.current[tn.roleId];K&&(K.homeX=se.dx+8,K.homeY=se.dy+34),tn=null}ar=null,nr=null,fl=null,b.current&&(b.current.style.cursor="default")},[]),Ye=j.useCallback(se=>{if(Ql)return;const K=ie(se);if(K){if(K.type==="role"){o(K.id);return}switch(K.id){case"meeting":{const ue=l[0];ue?u(ue.id):f();break}case"bulletin":f();break;case"decisions":m();break;case"knowledge":p();break}}},[ie,o,u,f,m,p]);return c.jsxs("div",{className:"td-scene",children:[c.jsxs("div",{ref:v,className:"td-wrap",children:[c.jsx("canvas",{ref:b,width:Me.canvasW,height:Me.canvasH,className:"td-canvas",onClick:Ye,onMouseDown:pe,onMouseUp:Se,onMouseMove:A,onMouseLeave:Fe,onContextMenu:Ce}),c.jsx("div",{ref:S,className:"td-overlay"})]}),c.jsxs("button",{className:`td-edit-btn${M?" td-edit-btn--active":""}`,onClick:()=>{$(se=>{const K=!se;return K||(B(null),Y(null)),K}),Yn=null,mn=null,tn=null},title:M?"Exit Edit Mode":"Edit Furniture Layout",children:[c.jsx("span",{className:"td-edit-btn__icon",children:M?"✓":"✎"}),c.jsx("span",{className:"td-edit-btn__label",children:M?"DONE":"EDIT"})]}),M&&c.jsx("div",{className:"td-palette",children:yC.map(se=>c.jsx("button",{className:`td-palette__item${O===se.type?" td-palette__item--active":""}`,onClick:()=>{O===se.type?(B(null),Y(null)):(B(se.type),Y(se.zone))},title:se.label,children:c.jsx("span",{children:se.icon})},se.type))}),y&&c.jsxs("button",{className:"td-hire-btn",onClick:y,title:"Hire New Role",children:[c.jsx("span",{className:"td-hire-btn__icon",children:"+"}),c.jsx("span",{className:"td-hire-btn__label",children:"HIRE"})]})]})}function FC({role:t,appearance:l,onSave:a,onReset:i,onClose:o,theme:u,onThemeChange:f,onUpdateName:m,initialTab:p,speechSettings:h,onSpeechSettingsChange:g,language:y,onLanguageChange:b}){var te;const[v,S]=j.useState(p??"character"),[k,C]=j.useState({...l}),[E,M]=j.useState(t.name),[$,O]=j.useState(!1),B=j.useCallback(()=>C(ds()),[]),T=j.useCallback(()=>{const D=mh(t.id);C({...D}),i()},[t.id,i]),Y=j.useCallback(async()=>{a(k);const D=E.trim();if(m&&D&&D!==t.name){O(!0);try{await m(t.id,D)}catch{}O(!1)}o()},[k,a,o,E,t.name,t.id,m]),V=c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[c.jsxs("span",{children:[t.id.toUpperCase()," –"]}),m?c.jsx("input",{value:E,onChange:D=>M(D.target.value),disabled:$,className:"customize-name-input",style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:4,color:"inherit",font:"inherit",padding:"2px 6px",flex:1,minWidth:0}}):c.jsx("span",{children:t.name})]});return c.jsx("div",{className:"customize-overlay",onClick:o,children:c.jsxs("div",{className:"customize-modal",onClick:D=>D.stopPropagation(),children:[c.jsxs("div",{className:"customize-header",children:[c.jsxs("div",{className:"customize-tabs",children:[c.jsx("button",{className:`customize-tab ${v==="character"?"active":""}`,onClick:()=>S("character"),children:"CHARACTER"}),c.jsx("button",{className:`customize-tab ${v==="office"?"active":""}`,onClick:()=>S("office"),children:"OFFICE THEME"}),c.jsx("button",{className:`customize-tab ${v==="settings"?"active":""}`,onClick:()=>S("settings"),children:"SETTINGS"})]}),c.jsx("button",{className:"customize-close",onClick:o,children:"X"})]}),v==="character"?c.jsx("div",{className:"customize-body",children:c.jsx(ig,{roleId:t.id,appearance:k,onChange:C,onRandomize:B,onReset:T,label:V})}):v==="office"?c.jsx("div",{className:"customize-body",children:c.jsx("div",{className:"customize-themes",children:Object.entries(za).map(([D,I])=>c.jsxs("button",{className:`customize-theme-card ${u===D?"active":""}`,onClick:()=>f(D),children:[c.jsxs("div",{className:"customize-theme-preview",style:{background:I.vars["--floor-light"],borderColor:I.vars["--pixel-border"]},children:[c.jsx("div",{style:{background:I.vars["--hud-bg"],height:8,borderBottom:`2px solid ${I.vars["--pixel-border"]}`}}),c.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1 p-1",children:[c.jsx("div",{style:{width:10,height:14,background:I.vars["--accent"],borderRadius:1}}),c.jsx("div",{style:{width:10,height:14,background:I.vars["--active-green"],borderRadius:1}}),c.jsx("div",{style:{width:10,height:14,background:I.vars["--idle-amber"],borderRadius:1}})]}),c.jsx("div",{style:{background:I.vars["--hud-bg"],height:6,borderTop:`2px solid ${I.vars["--pixel-border"]}`}})]}),c.jsxs("div",{className:"customize-theme-name",children:[I.icon," ",I.name]})]},D))})}):c.jsx("div",{className:"customize-body",children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,padding:"8px 0"},children:[c.jsxs("div",{children:[c.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),c.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(D=>c.jsxs("button",{onClick:()=>g==null?void 0:g({mode:D}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(h==null?void 0:h.mode)===D?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(h==null?void 0:h.mode)===D?"rgba(255,255,255,0.08)":"transparent",color:(h==null?void 0:h.mode)===D?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[c.jsx("div",{style:{fontWeight:600,marginBottom:2},children:D==="template"?"TEMPLATE":D==="llm"?"AI":"AUTO"}),c.jsx("div",{style:{fontSize:9,opacity:.7},children:D==="template"?"Static pool ($0)":D==="llm"?"LLM generated":"Detect engine"})]},D))}),c.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),c.jsxs("div",{children:[c.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(h==null?void 0:h.intervalSec)??18,"s"]}),c.jsx("input",{type:"range",min:5,max:120,step:5,value:(h==null?void 0:h.intervalSec)??18,onChange:D=>g==null?void 0:g({intervalSec:Number(D.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),c.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[c.jsx("span",{children:"5s (frequent)"}),c.jsx("span",{children:"120s (rare)"})]})]}),(h==null?void 0:h.mode)!=="template"&&c.jsxs("div",{children:[c.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((te=h==null?void 0:h.dailyBudgetUsd)==null?void 0:te.toFixed(2))??"1.00"]}),c.jsx("input",{type:"range",min:0,max:5,step:.25,value:(h==null?void 0:h.dailyBudgetUsd)??1,onChange:D=>g==null?void 0:g({dailyBudgetUsd:Number(D.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),c.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[c.jsx("span",{children:"$0 (unlimited)"}),c.jsx("span",{children:"$5.00/day"})]})]}),c.jsxs("div",{children:[c.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),c.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:D,label:I})=>c.jsx("button",{onClick:()=>b==null?void 0:b(D),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(y??"auto")===D?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(y??"auto")===D?"rgba(255,255,255,0.08)":"transparent",color:(y??"auto")===D?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:I},D))}),c.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]})]})}),v==="character"&&c.jsxs("div",{className:"customize-footer",children:[c.jsx("button",{className:"customize-btn customize-btn--cancel",onClick:o,children:"CANCEL"}),c.jsx("button",{className:"customize-btn customize-btn--save",onClick:Y,children:"SAVE"})]})]})})}function Ty(t){const l=Date.now()-new Date(t).getTime(),a=Math.floor(l/6e4);if(a<1)return"just now";if(a<60)return`${a}m ago`;const i=Math.floor(a/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function RC({status:t,history:l,onClose:a,onSave:i,onLoadHistory:o,onRestore:u,saving:f}){const[m,p]=j.useState("save"),[h,g]=j.useState(""),[y,b]=j.useState(null),[v,S]=j.useState(!1),[k,C]=j.useState(null),E=j.useRef(null);j.useEffect(()=>{m==="history"&&o()},[m,o]),j.useEffect(()=>{var T;(T=E.current)==null||T.focus()},[]);const M=[...((t==null?void 0:t.modified)??[]).map(T=>({status:"M",file:T})),...((t==null?void 0:t.untracked)??[]).map(T=>({status:"A",file:T}))],$=async()=>{b(null),C(null);try{const T=await i(h||void 0);C(T),g("")}catch(T){b(T instanceof Error?T.message:"Save failed")}},O=async T=>{if(confirm(`Restore from commit ${T.slice(0,7)}? This creates a new commit with those files.`)){S(!0);try{await u(T),S(!1)}catch(Y){b(Y instanceof Error?Y.message:"Restore failed"),S(!1)}}};j.useEffect(()=>{const T=Y=>{Y.key==="Escape"&&a()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[a]);const B=T=>{T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&$()};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:a}),c.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[520px] max-h-[80vh] z-[61] overflow-hidden flex flex-col",style:{background:"var(--hud-bg)",border:"3px solid var(--pixel-border)",fontFamily:"var(--pixel-font)",color:"var(--terminal-text)"},onKeyDown:B,children:[c.jsxs("div",{className:"px-5 py-3 flex items-center justify-between shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("span",{className:"text-lg font-black tracking-tight",children:"SAVE GAME"}),c.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:(t==null?void 0:t.branch)??""})]}),c.jsx("button",{onClick:a,className:"text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] cursor-pointer text-lg",children:"×"})]}),c.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["save","history"].map(T=>c.jsx("button",{onClick:()=>p(T),className:"flex-1 py-2 text-[11px] font-bold uppercase tracking-wider cursor-pointer",style:{background:m===T?"var(--hud-bg-alt)":"transparent",color:m===T?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:m===T?"2px solid var(--accent)":"2px solid transparent"},children:T==="save"?"SAVE":"HISTORY"},T))}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[m==="save"&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"text-[11px]",style:{color:"var(--terminal-text-secondary)"},children:M.length>0?c.jsxs("span",{style:{color:"var(--idle-amber)"},children:["* ",M.length," unsaved change",M.length>1?"s":""]}):c.jsx("span",{style:{color:"var(--active-green)"},children:"All changes saved"})}),M.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Changed Files"}),c.jsx("div",{className:"text-[11px] max-h-[160px] overflow-y-auto p-2 space-y-0.5",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)"},children:M.map(({status:T,file:Y})=>c.jsxs("div",{className:"flex gap-2",children:[c.jsx("span",{style:{color:T==="A"?"var(--active-green)":"var(--idle-amber)",width:"14px"},children:T}),c.jsx("span",{style:{color:"var(--terminal-text-secondary)"},children:Y})]},Y))})]}),M.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Save Message"}),c.jsx("input",{ref:E,type:"text",value:h,onChange:T=>g(T.target.value),placeholder:"Optional: describe your progress...",className:"w-full px-3 py-2 text-[12px] outline-none",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"}})]}),M.length>0&&c.jsx("div",{className:"flex gap-3",children:c.jsx("button",{onClick:$,disabled:f,className:"flex-1 py-2.5 text-[12px] font-black uppercase tracking-wider cursor-pointer disabled:opacity-50",style:{background:"var(--accent)",color:"#fff",border:"2px solid var(--accent)"},children:f?"SAVING...":t!=null&&t.hasRemote?"SAVE & PUSH":"SAVE"})}),M.length>0&&t&&!t.hasRemote&&c.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"Local save only — add a git remote to enable push"}),k&&c.jsxs("div",{className:"text-[11px] p-2",style:{background:"rgba(59,185,80,0.1)",border:"1px solid var(--active-green)",color:"var(--active-green)"},children:["Saved! ",k.filesChanged," file",k.filesChanged>1?"s":""," committed",k.pushed?" & pushed":"",k.pushError?` (push error: ${k.pushError})`:""]}),y&&c.jsx("div",{className:"text-[11px] p-2",style:{background:"rgba(211,47,47,0.1)",border:"1px solid #D32F2F",color:"#EF5350"},children:y}),(t==null?void 0:t.lastCommit)&&c.jsxs("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:["Last save: ",t.lastCommit.message," (",Ty(t.lastCommit.date),")"]})]}),m==="history"&&c.jsxs(c.Fragment,{children:[l.length===0&&c.jsx("div",{className:"text-[11px] text-center py-8",style:{color:"var(--terminal-text-muted)"},children:"No save history"}),c.jsx("div",{className:"space-y-1",children:l.map(T=>c.jsxs("div",{className:"flex items-center justify-between py-2 px-3 group",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--accent)"},children:T.shortSha}),c.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--terminal-text)"},children:T.message})]}),c.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:Ty(T.date)})]}),c.jsx("button",{onClick:()=>O(T.sha),disabled:v,className:"text-[10px] font-bold px-2 py-1 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--idle-amber)"},children:"LOAD"})]},T.sha))})]})]})]})]})}const OC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍","data-analyst":"📊"},cc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},BC={cto:8,cbo:7,pm:6,engineer:5,designer:5,qa:4,"data-analyst":4},$C={cto:"아키텍처",cbo:"시장 분석",pm:"PRD 작성",engineer:"코딩",designer:"시안 제작",qa:"품질 검증"};function LC(t){let l=0;for(let i=0;i<t.length;i++)l=t.charCodeAt(i)+((l<<5)-l);return`hsl(${(l%360+360)%360}, 50%, 40%)`}function HC({importJob:t,onImportDone:l}){var fi,mr,zl;const[a,i]=j.useState([]),[o,u]=j.useState([]),[f,m]=j.useState([]),[p,h]=j.useState([]),[g,y]=j.useState([]),[b,v]=j.useState([]),[S,k]=j.useState("TYCONO"),[C,E]=j.useState(!0),[M,$]=j.useState(null),[O,B]=j.useState({type:"none"}),[T,Y]=j.useState(null),[V,te]=j.useState(null),[D,I]=j.useState([]),[L,ee]=j.useState(!1),[ae,X]=j.useState([]),[U,Q]=j.useState(0),[ie,ve]=j.useState(!1),[z,_]=j.useState({}),[P,A]=j.useState("ceo"),[pe,Se]=j.useState(null),[Ce,Fe]=j.useState(!1),[Ye,se]=j.useState(!1),[K,ue]=j.useState(null),[we,ne]=j.useState({}),[xe,je]=j.useState([]),[Ae,Re]=j.useState([]),[Ve,jt]=j.useState(void 0),[$t,ct]=j.useState(!1);j.useEffect(()=>{Te.getStatus().then(H=>{jt(H.engine),ct(!!H.hasApiKey)}).catch(()=>{})},[]);const{getAppearance:Dt,setAppearance:on,resetAppearance:gt,theme:Pt,setTheme:re,speechSettings:ye,setSpeechSettings:_e,language:me,setLanguage:be}=CE(),[ot,bt]=j.useState(null),[Ze,de]=j.useState("character"),Oe=AE(),[ut,kn]=j.useState(!1);j.useEffect(()=>{const H=he=>{(he.metaKey||he.ctrlKey)&&he.key==="s"&&(he.preventDefault(),Oe.dirtyCount>0&&kn(!0))};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[Oe.dirtyCount]);const[an,ai]=j.useState(null),[tl,nl]=j.useState(null),[ll,hl]=j.useState([]),[al,Jl]=j.useState(!1),As=j.useRef(!1),cr=j.useRef(null);let ur=j.useRef(0);const Mn=(H,he,ke)=>{const Ne={id:ur.current++,type:H,text:he,detail:ke};hl(Ee=>[...Ee,Ne])};j.useEffect(()=>{var H;al&&((H=cr.current)==null||H.scrollIntoView({behavior:"smooth"}))},[ll,al]),j.useEffect(()=>{t&&(As.current||(As.current=!0,nl("Scanning knowledge sources..."),hl([{id:0,type:"scan",text:"Starting knowledge import..."}]),ur.current=1,fetch("/api/setup/import-knowledge",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:t.paths,companyRoot:t.companyRoot})}).then(async H=>{var Ee;const he=(Ee=H.body)==null?void 0:Ee.getReader();if(!he)return;const ke=new TextDecoder;let Ne="";for(;;){const{done:$e,value:Ie}=await he.read();if($e)break;Ne+=ke.decode(Ie,{stream:!0});const nt=Ne.split(`
|
|
88
|
-
`);Ne=nt.pop()||"";let ft="";for(const qe of nt)if(qe.startsWith("event: "))ft=qe.slice(7).trim();else if(qe.startsWith("data: ")&&ft){try{const yt=JSON.parse(qe.slice(6));switch(ft){case"scanning":nl(`Scanning: ${yt.path} (${yt.fileCount} files)`),Mn("scan",`Found ${yt.fileCount} files`,yt.path);break;case"processing":ai({index:yt.index,total:yt.total}),nl(`Importing knowledge... (${yt.index}/${yt.total})`),Mn("process",`Processing: ${yt.file}`,`${yt.index} / ${yt.total}`);break;case"created":Mn("created",yt.title,yt.summary);break;case"skipped":Mn("process",`Skipped: ${yt.file}`,yt.reason);break;case"done":nl(null),ai(null),Mn("done",`Import complete! ${yt.created} created, ${yt.skipped} skipped.`),Ot(`Knowledge import complete! ${yt.created} documents imported.`,"#2E7D32"),l==null||l();break;case"error":nl(null),ai(null),Mn("error",yt.message),Ot(`Import failed: ${yt.message}`,"#B71C1C"),l==null||l();break}}catch{}ft=""}}}).catch(H=>{nl(null),Mn("error",H.message),Ot(`Import error: ${H.message}`,"#B71C1C"),l==null||l()})))},[t]);const[ri,ii]=j.useState("card"),[si,Ds]=j.useState(typeof window<"u"?window.innerWidth:1200);j.useEffect(()=>{const H=()=>Ds(window.innerWidth);return window.addEventListener("resize",H),()=>window.removeEventListener("resize",H)},[]);const Ra=si<1024,[Sn,Al]=j.useState(!1),[Pl,ml]=j.useState(560),[Ht,vt]=j.useState([]),[rl,_n]=j.useState(null),[Ts,oi]=j.useState(null),{sendMessage:zs}=SE();j.useEffect(()=>{Promise.all([Te.getCompany().then(H=>{k(H.name),i(H.roles)}),Te.getProjects().then(u),Te.getStandups().then(m),Te.getWaves().then(h),Te.getDecisions().then(y),Te.getKnowledge().then(v).catch(()=>{}),Te.getOrgTree().then(H=>{_(H.nodes),A(H.root)}).catch(()=>{})]).catch(H=>$(`Failed to load: ${H.message}`)).finally(()=>E(!1))},[]),j.useEffect(()=>{Te.deleteEmptySessions().catch(()=>{}),Te.getSessions().then(H=>{if(H.length>0){const he=H.map(Ne=>({...Ne,messages:[]}));vt(he);const ke=he.find(Ne=>Ne.status==="active")??he[0];_n(ke.id),Al(!0)}}).catch(H=>{console.error("Failed to load sessions",H)})},[]),j.useEffect(()=>{const H=()=>{fetch("/api/exec/status").then(ke=>ke.json()).then(ke=>{ne(ke.statuses??{}),je(ke.activeExecutions??[])}).catch(()=>{})};H();const he=setInterval(H,3e3);return()=>clearInterval(he)},[]),j.useEffect(()=>{O.type==="role"?Te.getRole(O.roleId).then(Y).catch(console.error):Y(null)},[O]);const il=()=>B({type:"none"}),ci=async(H,he)=>{const ke=a.find(Ee=>Ee.id===H),Ne=(V==null?void 0:V.mode)==="ask";te(null);try{const{jobId:Ee}=await Te.startJob({type:"assign",roleId:H,task:he,readOnly:Ne}),$e=cc[H]??"#666",Ie=`${H.toUpperCase()} · ${(ke==null?void 0:ke.name)??H}`;ve(!1),I([{jobId:Ee,title:Ie,color:$e}]),wt.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO → ${(ke==null?void 0:ke.name)??H}] ${Ne?"Ask":"Assign"}: ${he}`,type:"dispatch",targetRoleId:H})}catch(Ee){Ot(`Failed to start job: ${Ee instanceof Error?Ee.message:"unknown"}`,"#C62828")}},Ot=(H,he)=>{const ke=Date.now();Re(Ne=>[...Ne,{id:ke,message:H,color:he}]),setTimeout(()=>Re(Ne=>Ne.filter(Ee=>Ee.id!==ke)),4e3)},ea=()=>{var he;const H=D[D.length-1];H&&(Ot(`${H.title} completed`,H.color),wt.pushMessage({ts:Date.now(),roleId:((he=H.title.split(" · ")[0])==null?void 0:he.toLowerCase())??"unknown",text:`[${H.title}] Job completed`,type:"dispatch"})),Te.getStandups().then(m).catch(console.error),Te.getCompany().then(ke=>i(ke.roles)).catch(console.error)},Oa=async H=>{ee(!1);try{const he=await Te.startJob({type:"wave",directive:H}),ke=he.jobIds??(he.jobId?[he.jobId]:[]),Ne=a.filter($e=>$e.level==="c-level"),Ee=ke.map(($e,Ie)=>{var nt,ft;return{jobId:$e,roleId:((nt=Ne[Ie])==null?void 0:nt.id)??`role-${Ie}`,roleName:((ft=Ne[Ie])==null?void 0:ft.name)??`C-Level ${Ie+1}`}});wt.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO WAVE] "${H}" → ${Ee.map($e=>$e.roleName).join(", ")}`,type:"dispatch"}),Object.keys(z).length>0?(Se({directive:H,rootJobs:Ee}),Fe(!1)):(X(Ee),Q(0),ve(!1),Ee.length>0&&I([{jobId:Ee[0].jobId,title:`CEO WAVE · ${Ee[0].roleId.toUpperCase()}`,color:"#B71C1C"}]))}catch(he){Ot(`Failed to start wave: ${he instanceof Error?he.message:"unknown"}`,"#C62828")}},Dl=()=>{Te.getWaves().then(h).catch(console.error),Te.getStandups().then(m).catch(console.error)},Ut=()=>{Te.getCompany().then(H=>i(H.roles)).catch(console.error)},Ms=async(H,he)=>{await Te.createRole(H),on(H.id,he),Ut(),Ot(`${H.name} hired!`,"#2E7D32")},_s=async H=>{await Te.deleteRole(H),Ut(),ue(null),Ot(`${H.toUpperCase()} removed`,"#B71C1C")},xl=async(H,he)=>{await Te.updateRole(H,he),Ut(),he.name&&Ot(`${H.toUpperCase()} renamed to "${he.name}"`,"#1565C0")},ta=H=>{Al(!0)},Ac=async H=>{try{const he=await Te.createSession(H,"talk");vt(ke=>[he,...ke]),_n(he.id),Al(!0)}catch(he){console.error("Failed to create session",he),Ot(`Failed to create session: ${he instanceof Error?he.message:"API unreachable"}`,"#B71C1C")}},Fs=async H=>{try{const he=await Te.createSession(H,"talk");vt(ke=>[he,...ke]),_n(he.id)}catch(he){console.error("Failed to create session",he),Ot(`Failed to create session: ${he instanceof Error?he.message:"API unreachable"}`,"#B71C1C")}},Rs=async H=>{const he=xe.find(Ee=>Ee.roleId===H),ke=(he==null?void 0:he.jobId)??(he==null?void 0:he.id);if(ke&&we[H]==="working"){const Ee=a.find(nt=>nt.id===H),$e=cc[H]??"#666",Ie=`${H.toUpperCase()} · ${(Ee==null?void 0:Ee.name)??H}`;I([{jobId:ke,title:Ie,color:$e}]),ve(!1);return}const Ne=Ht.find(Ee=>Ee.roleId===H);if(Ne)_n(Ne.id),wt.setActiveChannelId(null);else try{const Ee=await Te.createSession(H,"talk");vt($e=>[Ee,...$e]),_n(Ee.id),wt.setActiveChannelId(null)}catch(Ee){console.error("Failed to create session",Ee)}Al(!0)},Dc=async H=>{try{await Te.deleteSession(H),vt(he=>{var Ne;const ke=he.filter(Ee=>Ee.id!==H);return rl===H&&_n(((Ne=ke[0])==null?void 0:Ne.id)??null),ke})}catch(he){console.error("Failed to delete session",he),Ot(`Failed to close session: ${he instanceof Error?he.message:"API error"}`,"#B71C1C")}},fr=async()=>{try{const{ids:H}=await Te.deleteEmptySessions();if(H.length===0)return;vt(he=>{var Ne;const ke=he.filter(Ee=>!H.includes(Ee.id));return rl&&H.includes(rl)&&_n(((Ne=ke[0])==null?void 0:Ne.id)??null),ke}),Ot(`Cleared ${H.length} empty session${H.length!==1?"s":""}`,"#2E7D32")}catch(H){Ot(`Failed to clear empty sessions: ${H instanceof Error?H.message:"API error"}`,"#B71C1C")}},dr=async()=>{if(!confirm("Close all sessions? This cannot be undone."))return;const H=Ht.map(he=>he.id);try{await Te.deleteSessions(H),vt([]),_n(null),Ot("All sessions closed","#2E7D32")}catch(he){Ot(`Failed to close sessions: ${he instanceof Error?he.message:"API error"}`,"#B71C1C")}},rn=(H,he)=>{vt(ke=>ke.map(Ne=>{if(Ne.id!==H)return Ne;const Ee=[...Ne.messages],$e=Ee[Ee.length-1];if($e&&$e.from==="role"&&$e.status==="streaming"){const Ie=[...$e.streamEvents??[],he];Ee[Ee.length-1]={...$e,streamEvents:Ie}}return{...Ne,messages:Ee}}))},yn=(H,he,ke)=>{const Ne={id:`msg-${Date.now()}-ceo`,from:"ceo",content:he,type:ke==="do"?"directive":"conversation",status:"done",timestamp:new Date().toISOString()},Ee={id:`msg-${Date.now()+1}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:new Date().toISOString(),streamEvents:[]};vt($e=>$e.map(Ie=>Ie.id===H?{...Ie,messages:[...Ie.messages,Ne,Ee],updatedAt:new Date().toISOString()}:Ie)),oi(H),zs(H,he,ke,{onThinking:$e=>{vt(Ie=>Ie.map(nt=>{if(nt.id!==H)return nt;const ft=[...nt.messages],qe=ft[ft.length-1];return qe&&qe.from==="role"&&qe.status==="streaming"&&(ft[ft.length-1]={...qe,thinking:(qe.thinking??"")+$e}),{...nt,messages:ft}})),rn(H,{type:"thinking",timestamp:Date.now(),text:$e})},onText:$e=>{vt(Ie=>Ie.map(nt=>{if(nt.id!==H)return nt;const ft=[...nt.messages],qe=ft[ft.length-1];return qe&&qe.from==="role"&&qe.status==="streaming"&&(ft[ft.length-1]={...qe,content:qe.content+$e}),{...nt,messages:ft}}))},onToolUse:($e,Ie)=>{rn(H,{type:"tool",timestamp:Date.now(),toolName:$e,toolInput:Ie})},onDispatch:($e,Ie)=>{rn(H,{type:"dispatch",timestamp:Date.now(),roleId:$e,task:Ie})},onDispatchProgress:($e,Ie,nt)=>{var ft;Ie==="tool"?rn(H,{type:"dispatch:progress",timestamp:Date.now(),roleId:$e,progressType:"tool",toolName:nt.name,toolInput:nt.input}):Ie==="thinking"?rn(H,{type:"dispatch:progress",timestamp:Date.now(),roleId:$e,progressType:"thinking",text:nt.text}):Ie==="text"?rn(H,{type:"dispatch:progress",timestamp:Date.now(),roleId:$e,progressType:"text",text:(ft=nt.text)==null?void 0:ft.slice(-200)}):(Ie==="done"||Ie==="error")&&rn(H,{type:"dispatch:progress",timestamp:Date.now(),roleId:$e,progressType:Ie})},onTurn:$e=>{rn(H,{type:"turn",timestamp:Date.now(),turn:$e})},onDone:()=>{vt($e=>$e.map(Ie=>{if(Ie.id!==H)return Ie;const nt=Ie.messages.map(qe=>qe.status==="streaming"?{...qe,status:"done"}:qe),ft=Ie.messages.length<=2?he.slice(0,40).replace(/\n/g," "):Ie.title;return{...Ie,messages:nt,title:ft}})),oi(null)},onError:$e=>{vt(Ie=>Ie.map(nt=>{if(nt.id!==H)return nt;const ft=nt.messages.map(qe=>qe.status==="streaming"?{...qe,status:"error",content:qe.content||$e}:qe);return{...nt,messages:ft}})),oi(null)}})},Os=(H,he)=>{vt(ke=>ke.map(Ne=>Ne.id===H?{...Ne,mode:he}:Ne)),Te.updateSession(H,{mode:he}).catch(console.error)},Tc=new Date().toISOString().slice(0,10),Xn=o[0],ui={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},hr=H=>{const he=ui[H];if(!he)return"";for(const ke of f){const Ne=ke.content,Ee=Ne.indexOf(`## ${he}`);if(Ee===-1)continue;const $e=Ne.indexOf(`
|
|
89
|
-
## `,Ee+10),nt=($e===-1?Ne.slice(Ee):Ne.slice(Ee,$e)).split(`
|
|
90
|
-
`).filter(ft=>ft.trim().length>0);for(const ft of nt){const qe=ft.replace(/^#+\s*/,"").replace(/\*\*/g,"").replace(/^[-*]\s+/,"").trim();if(!(qe.startsWith("|")||qe.startsWith("{")||qe.startsWith("[")||qe.startsWith("```")||qe.startsWith("---")||qe.includes("Journal")||qe.includes("(c-level)")||qe.includes("(team-lead)")||qe.includes("(member)")||/^(CEO |작업 결과|생성\/수정|APPROVAL|비고|상황 보고|태스크$)/.test(qe))&&qe.length>15&&qe.length<120)return qe}}return""},zc=H=>{const he=ui[H];if(!he)return"";for(const ke of f){const Ne=ke.content,Ee=Ne.indexOf(`## ${he}`);if(Ee===-1)continue;const $e=Ne.indexOf(`
|
|
91
|
-
## `,Ee+10),nt=($e===-1?Ne.slice(Ee):Ne.slice(Ee,$e)).replace(/^## .+\n/,"").trim();if(nt)return nt.slice(0,1500)}return""},wt=IE();j.useEffect(()=>{a.length>0&&wt.syncDefaultMembers(a)},[a]);const Tl=BE({roles:a,roleStatuses:we,activeExecs:xe,getStandupSpeech:hr});return GE({roles:a,roleStatuses:we,activeExecs:xe,channels:wt.channels,relationships:Tl.relationships,pushMessage:wt.pushMessage,speechSettings:ye,engineType:Ve,hasApiKey:$t}),C?c.jsxs("div",{className:"h-screen flex flex-col bg-[var(--floor-light)]",style:{fontFamily:"var(--pixel-font)"},children:[(tl||ll.length>0)&&c.jsxs("div",{className:"shrink-0 z-[44]",children:[c.jsxs("div",{className:"flex items-center gap-3 px-5 py-2 text-xs cursor-pointer select-none",style:{background:"var(--accent)",color:"#fff",fontFamily:"var(--pixel-font)"},onClick:()=>Jl(H=>!H),children:[tl?c.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):c.jsx("span",{className:"shrink-0",children:"✅"}),c.jsx("span",{className:"flex-1",children:tl||"Knowledge import finished"}),an&&c.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:c.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${an.index/an.total*100}%`,background:"#fff"}})}),c.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:al?"▲":"▼"})]}),al&&c.jsxs("div",{className:"overflow-y-auto text-xs",style:{background:"var(--terminal-bg)",borderBottom:"2px solid var(--accent)",maxHeight:240,fontFamily:"var(--pixel-font)"},children:[ll.map(H=>c.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[H.type==="scan"&&"🔍",H.type==="process"&&"⚙️",H.type==="created"&&"✅",H.type==="done"&&"🎉",H.type==="error"&&"❌"]}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{style:{color:H.type==="error"?"#EF4444":H.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:H.text}),H.detail&&c.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:H.detail})]})]},H.id)),c.jsx("div",{ref:cr})]})]}),c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsxs("div",{className:"text-center",children:[c.jsx("div",{className:"text-4xl mb-3",children:"🏢"}),c.jsx("div",{className:"text-gray-600 font-semibold text-xs",children:"LOADING OFFICE..."})]})})]}):M?c.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:c.jsxs("div",{className:"text-center max-w-md",style:{fontFamily:"var(--pixel-font)"},children:[c.jsx("div",{className:"text-4xl mb-3",children:"⚠️"}),c.jsx("div",{className:"text-gray-800 font-semibold mb-2 text-xs",children:"CONNECTION ERROR"}),c.jsx("div",{className:"text-gray-500 text-xs mb-4",children:M}),c.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-gray-800 text-white text-xs font-bold cursor-pointer border-2 border-gray-600",style:{fontFamily:"var(--pixel-font)"},children:"RETRY"})]})}):c.jsxs("div",{className:"flex flex-col",style:{height:"100dvh",fontFamily:"var(--pixel-font)"},children:[c.jsxs("div",{className:"flex items-center justify-between px-5 py-2 bg-[var(--hud-bg)] text-white text-sm shrink-0 z-[45]",style:{borderBottom:"3px solid var(--pixel-border)"},children:[c.jsxs("div",{className:"font-black text-[13px] tracking-tight",style:{color:"var(--idle-amber)",textShadow:"2px 2px 0 rgba(0,0,0,0.5)"},children:["🏢"," ",c.jsx("span",{style:{color:"var(--terminal-text)"},children:S})]}),c.jsxs("div",{className:"flex gap-4 text-[var(--terminal-text-secondary)] text-[11px] items-center",children:[c.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["💰",c.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:c.jsx("div",{className:"h-full",style:{width:"72%",background:"linear-gradient(90deg,#22c55e,#34D399)"}})}),c.jsx("strong",{className:"text-[var(--active-green)]",children:"$72K"})]}),c.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["⚡",c.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:c.jsx("div",{className:"h-full",style:{width:"85%",background:"linear-gradient(90deg,#3b82f6,#60A5FA)"}})}),c.jsx("strong",{className:"text-[var(--terminal-text)]",children:"85"})]}),c.jsxs("span",{className:"hidden sm:inline",children:["Roles: ",c.jsx("strong",{className:"text-[var(--terminal-text)]",children:a.length})]}),c.jsxs("span",{className:"hidden sm:inline",children:["Projects: ",c.jsx("strong",{className:"text-[var(--terminal-text)]",children:o.length})]}),xe.length>0&&c.jsxs("span",{className:"text-amber-400",children:["Working: ",c.jsx("strong",{children:xe.length})]}),c.jsxs("button",{onClick:()=>{Oe.state==="no-git"?Oe.initGit():kn(!0)},className:"flex items-center gap-1 cursor-pointer px-1.5 py-0.5",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--pixel-border)"},title:Oe.state==="no-git"?"Click to initialize git repository":Oe.state==="dirty"?`${Oe.dirtyCount} unsaved changes`:"All saved",children:[c.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:Oe.state==="no-git"?"var(--terminal-text-muted)":Oe.state==="saving"||Oe.state==="dirty"?"var(--idle-amber)":Oe.state==="error"?"#EF5350":"var(--active-green)",animation:Oe.state==="saving"?"pulse 1s infinite":void 0}}),c.jsx("span",{children:Tc})]})]})]}),(tl||ll.length>0)&&c.jsxs("div",{className:"shrink-0 z-[44]",children:[c.jsxs("div",{className:"flex items-center gap-3 px-5 py-2 text-xs cursor-pointer select-none",style:{background:"var(--accent)",color:"#fff",fontFamily:"var(--pixel-font)"},onClick:()=>Jl(H=>!H),children:[tl?c.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):c.jsx("span",{className:"shrink-0",children:"✅"}),c.jsx("span",{className:"flex-1",children:tl||"Knowledge import finished"}),an&&c.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:c.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${an.index/an.total*100}%`,background:"#fff"}})}),c.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:al?"▲":"▼"})]}),al&&c.jsxs("div",{className:"overflow-y-auto text-xs",style:{background:"var(--terminal-bg)",borderBottom:"2px solid var(--accent)",maxHeight:240,fontFamily:"var(--pixel-font)"},children:[ll.map(H=>c.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[H.type==="scan"&&"🔍",H.type==="process"&&"⚙️",H.type==="created"&&"✅",H.type==="done"&&"🎉",H.type==="error"&&"❌"]}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{style:{color:H.type==="error"?"#EF4444":H.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:H.text}),H.detail&&c.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:H.detail})]})]},H.id)),c.jsx("div",{ref:cr}),ll.length===0&&c.jsx("div",{className:"px-5 py-4 text-center",style:{color:"var(--terminal-text-muted)"},children:"Waiting for events..."})]})]}),c.jsxs("div",{className:"flex-1 overflow-hidden flex relative",children:[c.jsx("div",{className:"flex-1 overflow-y-auto relative floor-grid",style:{background:"var(--floor-light)"},children:ri==="iso"?c.jsx(_C,{roles:a,projects:o,waves:p,standups:f,decisions:g,roleStatuses:we,activeExecs:xe,onRoleClick:H=>B({type:"role",roleId:H}),onProjectClick:H=>B({type:"project",projectId:H}),onBulletinClick:()=>B({type:"bulletin"}),onDecisionsClick:()=>B({type:"decisions"}),onKnowledgeClick:()=>B({type:"knowledge"}),knowledgeDocsCount:b.length,getRoleSpeech:Tl.getSpeech,getAppearance:Dt,onHireClick:()=>se(!0)}):c.jsxs("div",{className:`${Sn?"max-w-full":"max-w-[1100px]"} mx-auto h-full p-4 flex flex-col gap-3 relative z-[1]`,children:[(()=>{const H=a.filter(ke=>ke.level==="c-level"),he=a.filter(ke=>ke.level!=="c-level");return c.jsxs(c.Fragment,{children:[H.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"pixel-section-label",children:"LEADERSHIP"}),c.jsx("div",{className:`grid gap-2 ${H.length===1?"grid-cols-1":"grid-cols-2"}`,children:H.map(ke=>{var Ne;return c.jsx(zy,{role:ke,speech:Tl.getSpeech(ke.id),onClick:()=>B({type:"role",roleId:ke.id}),liveStatus:we[ke.id],activeTask:(Ne=xe.find(Ee=>Ee.roleId===ke.id))==null?void 0:Ne.task,featured:!0,appearance:Dt(ke.id)},ke.id)})})]}),c.jsx("div",{className:"pixel-section-label",children:"TEAM"}),c.jsxs("div",{className:`grid gap-2 ${Sn?"grid-cols-3":"grid-cols-4"}`,children:[he.map(ke=>{var Ne;return c.jsx(zy,{role:ke,speech:Tl.getSpeech(ke.id),onClick:()=>B({type:"role",roleId:ke.id}),liveStatus:we[ke.id],activeTask:(Ne=xe.find(Ee=>Ee.roleId===ke.id))==null?void 0:Ne.task,appearance:Dt(ke.id)},ke.id)}),c.jsx("div",{className:"pixel-card pixel-card--hire",onClick:()=>se(!0),children:c.jsxs("div",{className:"pixel-card--hire-inner",children:[c.jsx("span",{className:"pixel-card--hire-icon",children:"+"}),c.jsx("span",{className:"pixel-card--hire-label",children:"HIRE NEW ROLE"})]})})]})]})})(),c.jsx("div",{className:"pixel-section-label mt-1",children:"OFFICE"}),c.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[c.jsxs("div",{className:"facility-card-compact",onClick:Xn?()=>B({type:"project",projectId:Xn.id}):void 0,style:Xn?void 0:{borderStyle:"dashed",opacity:.5},children:[c.jsxs("div",{className:"fcc-hdr",style:{background:"#3B82F6"},children:["🏢"," MEETING ROOM"]}),c.jsx("div",{className:"fcc-canvas",children:c.jsx(ec,{type:"meeting"})}),c.jsxs("div",{className:"fcc-body",children:[c.jsx("div",{className:"fcc-desc",children:"Projects, PRDs, and task boards"}),Xn?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"fcc-title",children:['"',Xn.name,'"']}),c.jsxs("div",{className:"fcc-meta",children:["Status: ",c.jsx("strong",{style:{color:"var(--active-green)"},children:Xn.status})]})]}):c.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No active projects"})]})]}),c.jsxs("div",{className:"facility-card-compact",onClick:()=>B({type:"bulletin"}),children:[c.jsxs("div",{className:"fcc-hdr",style:{background:"#64748b"},children:["📋"," BULLETIN"]}),c.jsx("div",{className:"fcc-canvas",children:c.jsx(ec,{type:"bulletin"})}),c.jsxs("div",{className:"fcc-body",children:[c.jsx("div",{className:"fcc-desc",children:"Waves and daily standups"}),p.slice(0,1).map(H=>c.jsxs("div",{className:"fcc-item",children:["Wave ",H.id]},H.id)),f.slice(0,1).map(H=>c.jsxs("div",{className:"fcc-item",children:["Standup ",H.date]},H.date)),p.length===0&&f.length===0&&c.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No entries yet"})]})]}),c.jsxs("div",{className:"facility-card-compact",onClick:()=>B({type:"decisions"}),children:[c.jsxs("div",{className:"fcc-hdr",style:{background:"#EF4444"},children:["📜"," DECISIONS"]}),c.jsx("div",{className:"fcc-canvas",children:c.jsx(ec,{type:"decision"})}),c.jsxs("div",{className:"fcc-body",children:[c.jsx("div",{className:"fcc-desc",children:"CEO strategic decision log"}),c.jsxs("div",{className:"fcc-title",children:[g.length," decisions"]}),g.slice(0,2).map(H=>c.jsxs("div",{className:"fcc-item",children:["#",H.id," ",H.title]},H.id))]})]}),c.jsxs("div",{className:"facility-card-compact",onClick:()=>B({type:"knowledge"}),children:[c.jsxs("div",{className:"fcc-hdr",style:{background:"#0D9488"},children:["📚"," KNOWLEDGE"]}),c.jsx("div",{className:"fcc-canvas",children:c.jsx(ec,{type:"knowledge"})}),c.jsxs("div",{className:"fcc-body",children:[c.jsx("div",{className:"fcc-desc",children:"Research, analysis, and references"}),c.jsxs("div",{className:"fcc-title",children:[b.length," docs"]}),b.slice(0,2).map(H=>c.jsx("div",{className:"fcc-item",children:H.title},H.id))]})]})]})]})}),Sn&&c.jsx("div",{className:Ra?"absolute inset-0 z-50":"contents",children:c.jsx(kE,{sessions:Ht,activeSessionId:rl,roles:a,streamingSessionId:Ts,width:Ra?si:Pl,onWidthChange:Ra?void 0:ml,onSwitchSession:_n,onCloseSession:Dc,onCreateSession:Ac,onClearEmpty:fr,onCloseAll:dr,onSendMessage:yn,onModeChange:Os,onCloseTerminal:()=>Al(!1),chatChannels:wt.channels,activeChatChannelId:wt.activeChannelId,onSwitchChatChannel:wt.setActiveChannelId,onCreateChatChannel:wt.createChannel,onDeleteChatChannel:wt.deleteChannel,onUpdateChatMembers:wt.updateMembers,onUpdateChatTopic:wt.updateTopic,unreadChannels:wt.unreadChannels})})]}),c.jsxs("div",{className:"flex items-center justify-between px-5 py-2 bg-[var(--hud-bg)] text-[var(--terminal-text-secondary)] text-[10px] shrink-0 z-[45]",style:{borderTop:"3px solid var(--pixel-border)"},children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{onClick:()=>ii("card"),className:`view-toggle-btn ${ri==="card"?"active":""}`,children:"CARD"}),c.jsx("button",{onClick:()=>ii("iso"),className:`view-toggle-btn ${ri==="iso"?"active":""}`,children:"ISO"}),c.jsx("span",{className:"mx-1",children:"|"}),c.jsxs("button",{className:"theme-btn",onClick:()=>{de("office"),bt(a[0]??null)},title:"Customize",children:[((fi=za[Pt])==null?void 0:fi.icon)??""," ",((mr=za[Pt])==null?void 0:mr.name)??"THEME"]}),c.jsx("span",{className:"mx-1",children:"|"}),c.jsx("span",{style:{color:Oe.state==="dirty"?"var(--idle-amber)":"var(--terminal-text-muted)"},children:Oe.state==="no-git"?"No git":Oe.state==="saving"?"Saving...":Oe.state==="dirty"?`${Oe.dirtyCount} unsaved`:Oe.lastSaved?`Saved ${(()=>{const H=Math.floor((Date.now()-new Date(Oe.lastSaved).getTime())/6e4);return H<1?"just now":H<60?`${H}m ago`:`${Math.floor(H/60)}h ago`})()}`:"Saved"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[pe&&Ce&&c.jsx("button",{onClick:()=>Fe(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:"#B71C1C",border:"2px solid #7f121288",fontFamily:"var(--pixel-font)",borderRadius:4},children:"WAVE"}),D.length>0&&ie&&c.jsxs("button",{onClick:()=>ve(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:D[D.length-1].color,border:`2px solid ${D[D.length-1].color}88`,fontFamily:"var(--pixel-font)",borderRadius:4},children:[D[D.length-1].title.slice(0,20),D[D.length-1].title.length>20?"..":""]}),c.jsxs("button",{onClick:()=>ee(!0),className:"wave-btn px-3 py-1 font-black text-white cursor-pointer",style:{background:"#B71C1C",border:"2px solid #7f1212",fontFamily:"var(--pixel-font)"},children:["🔴"," CEO WAVE"]}),c.jsx("button",{onClick:()=>Sn?Al(!1):ta(),className:"px-3 py-1 font-black cursor-pointer",style:{background:Sn?"var(--terminal-bg)":"var(--hud-bg-alt)",color:"var(--terminal-text)",border:`2px solid ${Sn?"var(--terminal-border-hover)":"var(--pixel-border)"}`,fontFamily:"var(--pixel-font)"},children:"TERMINAL"})]}),c.jsxs("span",{children:["Expand: +",Math.max(0,10-a.length)," desks available"]})]}),O.type==="role"&&T&&(()=>{const H=xe.find(he=>he.roleId===T.id);return c.jsx(VS,{role:T,allRoles:a,recentActivity:zc(T.id),onClose:il,onFireRole:(he,ke)=>{ue({roleId:he,roleName:ke}),il()},terminalWidth:Sn?Pl:0,activeJobId:H==null?void 0:H.id,activeTask:H==null?void 0:H.task,isWorking:we[T.id]==="working",jobStartedAt:H==null?void 0:H.startedAt,onStopJob:he=>Te.abortJob(he),sessions:Ht,streamingSessionId:Ts,onCreateSessionSilent:Fs,onSendMessage:yn,onFocusTerminal:Rs,onCustomize:he=>{const ke=a.find(Ne=>Ne.id===he);ke&&(de("character"),bt(ke))},onUpdateRole:xl,appearance:Dt(T.id),relationships:Tl.relationships})})(),O.type==="project"&&Xn&&c.jsx(Uj,{projectId:Xn.id,onClose:il,terminalWidth:Sn?Pl:0}),(O.type==="bulletin"||O.type==="decisions")&&c.jsx(Lj,{standups:f,waves:p,decisions:g,mode:O.type==="bulletin"?"bulletin":"decisions",onClose:il,terminalWidth:Sn?Pl:0}),O.type==="knowledge"&&c.jsx($j,{docs:b,onClose:il,onRefresh:()=>Te.getKnowledge().then(v).catch(()=>{}),terminalWidth:Sn?Pl:0,initialDocId:O.docId}),V&&c.jsx(qj,{roleId:V.roleId,roleName:V.roleName,mode:V.mode,onClose:()=>te(null),onExecutionStart:ci}),pe&&!Ce&&c.jsx(Jj,{directive:pe.directive,rootJobs:pe.rootJobs,orgNodes:z,rootRoleId:P,onClose:()=>{Se(null),Fe(!1)},onMinimize:()=>Fe(!0),onDone:()=>{Dl(),Ot("Wave complete","#2E7D32")},onOpenKnowledgeDoc:H=>{Se(null),Fe(!1),B({type:"knowledge",docId:H}),Te.getKnowledge().then(v).catch(()=>{})}}),D.length>0&&!ie&&(()=>{var ke;const H=D[D.length-1],he=ae.length>1;return c.jsxs(c.Fragment,{children:[he&&D.length===1&&c.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[63] flex gap-1 px-2 pt-2",children:ae.map((Ne,Ee)=>c.jsx("button",{onClick:()=>{Q(Ee),I([{jobId:Ne.jobId,title:`CEO WAVE · ${Ne.roleId.toUpperCase()}`,color:"#B71C1C"}])},className:"px-3 py-1.5 text-xs font-bold rounded-t-lg cursor-pointer transition-colors",style:{background:U===Ee?"#B71C1C":"var(--terminal-bg)",color:U===Ee?"#fff":"var(--terminal-text-secondary)",border:`1px solid ${U===Ee?"#B71C1C":"var(--terminal-border)"}`,borderBottom:"none"},children:Ne.roleId.toUpperCase()},Ne.jobId))}),c.jsx(Xj,{jobId:H.jobId,title:D.length>1?H.title:he?`CEO WAVE · ${((ke=ae[U])==null?void 0:ke.roleName)??""}`:H.title,color:H.color,variant:"modal",style:he&&D.length===1?{marginTop:28}:void 0,onClose:()=>{I([]),X([]),Q(0),ve(!1)},onMinimize:()=>ve(!0),onDone:()=>{ea(),Dl()},onNavigateToJob:Ne=>{Te.getJob(Ne).then(Ee=>{const $e=cc[Ee.roleId]??"#888";I(Ie=>[...Ie,{jobId:Ne,title:`${Ee.roleId.toUpperCase()} · ${Ee.task.slice(0,40)}`,color:$e}])}).catch(console.error)},onOpenKnowledgeDoc:Ne=>{I([]),X([]),Q(0),ve(!1),B({type:"knowledge",docId:Ne}),Te.getKnowledge().then(v).catch(()=>{})}},H.jobId)]})})(),D.length>1&&c.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[62] pointer-events-none",children:c.jsx("div",{className:"pointer-events-auto",children:c.jsxs("button",{onClick:()=>I(H=>H.slice(0,-1)),className:"mt-2 ml-2 px-3 py-1 text-xs font-bold text-[var(--terminal-text)] bg-[var(--terminal-bg)] border border-[var(--terminal-border)] rounded-lg cursor-pointer hover:bg-[var(--terminal-inline-bg)]",children:["←"," Back to ",(zl=D[D.length-2])==null?void 0:zl.title]})})}),L&&c.jsx(Gj,{cLevelRoles:a.filter(H=>H.level==="c-level"),orgNodes:z,rootId:P,onClose:()=>ee(!1),onDispatch:Oa}),Ye&&c.jsx(lE,{existingRoles:a,onClose:()=>se(!1),onHire:Ms}),K&&c.jsx(aE,{roleId:K.roleId,roleName:K.roleName,onClose:()=>ue(null),onConfirm:_s}),ot&&c.jsx(FC,{role:ot,appearance:Dt(ot.id),onSave:H=>on(ot.id,H),onReset:()=>gt(ot.id),onClose:()=>{bt(null),de("character")},theme:Pt,onThemeChange:re,onUpdateName:async(H,he)=>{await xl(H,{name:he})},initialTab:Ze,speechSettings:ye,onSpeechSettingsChange:_e,language:me,onLanguageChange:be}),ut&&c.jsx(RC,{status:Oe.status,history:Oe.history,onClose:()=>kn(!1),onSave:async H=>await Oe.save(H),onLoadHistory:Oe.loadHistory,onRestore:Oe.restore,saving:Oe.state==="saving"}),c.jsx("div",{className:"fixed top-16 right-4 z-[70] flex flex-col gap-2",children:Ae.map(H=>c.jsxs("div",{className:"toast-enter flex items-center gap-2 px-4 py-2.5 shadow-lg text-white text-xs font-black",style:{background:H.color,border:"2px solid rgba(0,0,0,0.3)",fontFamily:"var(--pixel-font)"},children:[c.jsx("div",{className:"w-2 h-2 bg-white/60"}),H.message]},H.id))})]})}function zy({role:t,speech:l,onClick:a,liveStatus:i,activeTask:o,featured:u,appearance:f}){const m=cc[t.id]??LC(t.id),p=BC[t.id]??1,h=$C[t.id]??t.name,g=i==="working",y=g&&o?o:l||h;return c.jsxs("div",{className:`pixel-card ${g?"working":""} ${u?"pixel-card--featured":""}`,onClick:a,children:[c.jsxs("div",{className:"pixel-card-hdr",style:{background:m},children:[c.jsxs("span",{children:[t.id.toUpperCase()," ","·"," ",t.name.toUpperCase()]}),c.jsxs("span",{className:"lvl",children:["Lv.",p]})]}),c.jsxs("div",{className:"pixel-card-body",children:[c.jsx("div",{className:"pixel-desk"}),c.jsx(Cc,{roleId:t.id,appearance:f}),c.jsx("div",{className:"pixel-status-dot",style:{background:g?"var(--idle-amber)":"var(--active-green)"}})]}),c.jsxs("div",{className:"pixel-card-task",children:[c.jsx("span",{className:"pixel-card-task-icon",children:g?"🛠️":OC[t.id]??"👤"}),c.jsx("span",{className:"pixel-card-task-text",children:y||h})]})]})}function Ed({onSelect:t,onClose:l}){const[a,i]=j.useState(null),[o,u]=j.useState(!0),f=j.useCallback(async m=>{u(!0);try{const p=await Te.browse(m);i(p)}catch{}finally{u(!1)}},[]);return j.useEffect(()=>{f()},[f]),o&&!a?c.jsx("div",{className:"mt-3 rounded-lg p-4 text-xs text-center",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-muted)"},children:"Loading..."}):a?c.jsxs("div",{className:"mt-3 rounded-lg overflow-hidden text-xs",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",maxHeight:220,overflowY:"auto"},children:[c.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 sticky top-0",style:{background:"var(--terminal-surface)",borderBottom:"1px solid var(--terminal-border)"},children:[c.jsx("span",{style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},className:"truncate flex-1",children:a.current}),c.jsx("button",{onClick:()=>t(a.current),className:"px-2 py-1 rounded text-[10px] font-medium shrink-0",style:{background:"var(--active-green)",color:"#fff"},children:"Select"}),c.jsx("button",{onClick:l,className:"opacity-50 hover:opacity-100 shrink-0",style:{color:"var(--terminal-text)"},children:"✕"})]}),a.parent&&c.jsxs("div",{className:"px-3 py-1.5 cursor-pointer flex items-center gap-2 hover:bg-[var(--terminal-surface-light)]",style:{color:"var(--terminal-text-secondary)"},onClick:()=>f(a.parent),children:[c.jsx("span",{children:"⬆️"}),c.jsx("span",{children:".."})]}),a.dirs.map(m=>c.jsxs("div",{className:"px-3 py-1.5 cursor-pointer flex items-center gap-2 hover:bg-[var(--terminal-surface-light)]",style:{color:"var(--terminal-text)"},onClick:()=>f(m.path),children:[c.jsx("span",{children:"📁"}),c.jsx("span",{children:m.name})]},m.path)),a.dirs.length===0&&c.jsx("div",{className:"px-3 py-3 text-center",style:{color:"var(--terminal-text-muted)"},children:"No subdirectories"})]}):null}const UC={engine:"AI Engine",company:"Company Info",project:"Project",knowledge:"Knowledge",team:"Team Template",create:"Create"};function My(t){switch(t){case"skip":return["engine","company","project","knowledge","team","create"];case"import":return["engine","company","project","knowledge","team","create"];case"existing-akb":return["engine","knowledge","create"]}}function IC({onComplete:t}){const[l,a]=j.useState(0),[i,o]=j.useState(null),[u,f]=j.useState("none"),[m,p]=j.useState(""),[h,g]=j.useState(!0),[y,b]=j.useState(""),[v,S]=j.useState(""),k=j.useRef(null),[C,E]=j.useState("fresh"),[M,$]=j.useState(""),[O,B]=j.useState(null),[T,Y]=j.useState(!1),[V,te]=j.useState(!1),[D,I]=j.useState("skip"),[L,ee]=j.useState([]),[ae,X]=j.useState(""),[U,Q]=j.useState(!1),[ie,ve]=j.useState(""),[z,_]=j.useState(null),[P,A]=j.useState(!1),[pe,Se]=j.useState(!1),[Ce,Fe]=j.useState([]),[Ye,se]=j.useState("startup"),[K,ue]=j.useState(!1),[we,ne]=j.useState(!1),[xe,je]=j.useState(null),[Ae,Re]=j.useState([]),[Ve,jt]=j.useState(!1),$t=j.useMemo(()=>My(D),[D]),ct=$t[l]??"engine";j.useEffect(()=>{Te.detectEngine().then(de=>{o(de),f(de.recommended),g(!1)}).catch(()=>g(!1)),Te.getTeams().then(Fe).catch(()=>{})},[]),j.useEffect(()=>{var de;ct==="company"&&((de=k.current)==null||de.focus())},[ct]);const Dt=()=>{switch(ct){case"engine":return u!=="none"||m.length>10;case"company":return y.trim().length>0;case"project":return C==="fresh"||C==="existing"&&O===!0;case"knowledge":return D==="existing-akb"?z===!0:D==="import"?L.length>0:!0;case"team":return!0;case"create":return!we;default:return!1}},on=()=>{l<$t.length-1&&Dt()&&a(l+1),ct==="create"&&!K&&!Ve&&(D==="existing-akb"?me():_e())},gt=()=>{l>0&&a(l-1)};j.useEffect(()=>{const de=My(D);l>=de.length&&a(de.length-1)},[D,l]);const Pt=async()=>{if(M.trim()){Y(!0);try{const de=await Te.validatePath(M.trim());B(de.valid)}catch{B(!1)}finally{Y(!1)}}},re=async()=>{if(ie.trim()){A(!0);try{const de=await Te.validatePath(ie.trim());_(de.valid&&de.hasClaudeMd===!0)}catch{_(!1)}finally{A(!1)}}},ye=()=>{const de=ae.trim();de&&!L.includes(de)&&(ee([...L,de]),X(""))},_e=async()=>{ue(!0),je(null);try{const de={companyName:y.trim(),description:v.trim()||"An AI-powered organization",team:Ye,existingProjectPath:C==="existing"?M.trim():void 0,knowledgePaths:D==="import"&&L.length>0?L:void 0};(u==="direct-api"||m)&&(de.apiKey=m||void 0);const Oe=await Te.scaffold(de);Re(Oe.created),ne(!0)}catch(de){je(de instanceof Error?de.message:"Scaffold failed")}finally{ue(!1)}},me=async()=>{jt(!0),je(null);try{const de=await Te.connectAkb(ie.trim());de.ok?(ne(!0),Re([`Connected to: ${de.companyRoot}`])):je(de.error||"Failed to connect")}catch(de){je(de instanceof Error?de.message:"Connect failed")}finally{jt(!1)}},be=()=>{D==="import"&&L.length>0?t({paths:L,companyRoot:""}):t()},ot=de=>{de.key==="Enter"&&Dt()&&(de.preventDefault(),on())},bt=`w-full px-3 py-2 rounded text-sm outline-none transition-colors
|
|
92
|
-
bg-[var(--terminal-bg)] text-[var(--terminal-text)]
|
|
93
|
-
border border-[var(--terminal-border)]
|
|
94
|
-
focus:border-[var(--terminal-border-hover)]
|
|
95
|
-
placeholder:text-[var(--terminal-text-muted)]`,Ze=de=>`p-4 rounded-lg border-2 cursor-pointer transition-all text-[var(--terminal-text)] ${de?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--terminal-border)] bg-[var(--hud-bg-alt)] hover:border-[var(--accent)]/50"}`;return c.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},onKeyDown:ot,children:c.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl overflow-hidden",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)"},children:[c.jsxs("div",{className:"px-6 py-5",style:{background:"var(--terminal-bg)",borderBottom:"1px solid var(--terminal-border)"},children:[c.jsx("div",{className:"text-lg font-bold",style:{color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"},children:"tycono"}),c.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-secondary)"},children:"Build an AI company. Watch them work."}),c.jsx("div",{className:"flex gap-1.5 mt-4",children:$t.map((de,Oe)=>c.jsxs("div",{className:"flex-1",children:[c.jsx("div",{className:"h-1 rounded-full transition-colors",style:{background:Oe<=l?"var(--accent)":"var(--terminal-surface-light)"}}),c.jsx("div",{className:"text-[9px] mt-1 truncate",style:{color:Oe===l?"var(--terminal-text)":"var(--terminal-text-muted)"},children:UC[de]})]},de))})]}),c.jsxs("div",{className:"px-6 py-5 min-h-[280px]",children:[ct==="engine"&&c.jsxs("div",{className:"space-y-4",children:[c.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"AI Engine Setup"}),h?c.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:"Detecting AI engine..."}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:Ze(u==="claude-cli"),onClick:()=>(i==null?void 0:i.claudeCli)&&f("claude-cli"),style:{opacity:i!=null&&i.claudeCli?1:.4},children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-lg",children:i!=null&&i.claudeCli?"✅":"❌"}),c.jsxs("div",{children:[c.jsx("div",{className:"font-medium text-sm",children:"Claude Code CLI"}),c.jsx("div",{className:"text-xs opacity-70",children:i!=null&&i.claudeCli?"Detected! Recommended — zero config needed.":"Not installed. Get it at claude.ai/download"})]})]})}),c.jsxs("div",{className:Ze(u==="direct-api"),onClick:()=>f("direct-api"),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-lg",children:i!=null&&i.apiKey?"✅":"🔑"}),c.jsxs("div",{className:"flex-1",children:[c.jsx("div",{className:"font-medium text-sm",children:"Anthropic API Key (BYOK)"}),c.jsx("div",{className:"text-xs opacity-70",children:i!=null&&i.apiKey?"API key found in environment.":"Enter your ANTHROPIC_API_KEY"})]})]}),u==="direct-api"&&!(i!=null&&i.apiKey)&&c.jsx("input",{type:"password",className:`${bt} mt-3`,placeholder:"sk-ant-...",value:m,onChange:de=>p(de.target.value),autoFocus:!0})]})]})]}),ct==="company"&&c.jsxs("div",{className:"space-y-4",children:[c.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Company Info"}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Company Name *"}),c.jsx("input",{ref:k,className:bt,placeholder:"e.g. Acme Corp",value:y,onChange:de=>b(de.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Description"}),c.jsx("textarea",{className:`${bt} resize-none`,rows:3,placeholder:"What does your AI company do?",value:v,onChange:de=>S(de.target.value)})]})]}),ct==="project"&&c.jsxs("div",{className:"space-y-4",children:[c.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Project Setup"}),c.jsxs("div",{className:Ze(C==="fresh"),onClick:()=>{E("fresh"),B(null)},children:[c.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),c.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Create a new AI company from scratch with clean directory structure."})]}),c.jsxs("div",{className:Ze(C==="existing"),onClick:()=>E("existing"),children:[c.jsxs("div",{className:"font-medium text-sm",children:["📂"," Connect Existing Project"]}),c.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Add AI company structure to an existing codebase or knowledge base."}),C==="existing"&&c.jsxs("div",{className:"mt-3",onClick:de=>de.stopPropagation(),children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{className:`${bt} flex-1`,placeholder:"/path/to/your/project",value:M,onChange:de=>{$(de.target.value),B(null)},autoFocus:!0}),c.jsx("button",{onClick:()=>te(!V),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),c.jsx("button",{onClick:Pt,disabled:T||!M.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:T||!M.trim()?.5:1},children:T?"...":"Verify"})]}),O===!0&&c.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Path verified: ",M]}),O===!1&&c.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," Invalid path"]}),V&&c.jsx(Ed,{onSelect:de=>{$(de),B(!0),te(!1)},onClose:()=>te(!1)})]})]})]}),ct==="knowledge"&&c.jsxs("div",{className:"space-y-3",children:[c.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Knowledge Strategy"}),c.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"How should AI handle your knowledge base?"}),c.jsxs("div",{className:Ze(D==="skip"),onClick:()=>I("skip"),children:[c.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),c.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Empty knowledge base. Add documents later from the office."})]}),c.jsxs("div",{className:Ze(D==="import"),onClick:()=>I("import"),children:[c.jsxs("div",{className:"font-medium text-sm",children:["📚"," Import & Build"]}),c.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Select folders with documents — AI reads, summarizes, and organizes them."}),D==="import"&&c.jsxs("div",{className:"mt-3 space-y-2",onClick:de=>de.stopPropagation(),children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{className:`${bt} flex-1`,placeholder:"/path/to/docs",value:ae,onChange:de=>X(de.target.value),onKeyDown:de=>{de.key==="Enter"&&(de.preventDefault(),ye())},autoFocus:!0}),c.jsx("button",{onClick:()=>Q(!U),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),c.jsx("button",{onClick:ye,disabled:!ae.trim(),className:"px-3 py-2 rounded text-xs font-medium",style:{background:"var(--accent)",color:"#fff",opacity:ae.trim()?1:.5},children:"Add"})]}),U&&c.jsx(Ed,{onSelect:de=>{L.includes(de)||ee([...L,de]),Q(!1)},onClose:()=>Q(!1)}),L.length>0&&c.jsx("div",{className:"space-y-1",children:L.map((de,Oe)=>c.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:[c.jsx("span",{className:"flex-1 truncate",style:{fontFamily:"var(--pixel-font)"},children:de}),c.jsx("button",{onClick:()=>ee(L.filter((ut,kn)=>kn!==Oe)),className:"opacity-50 hover:opacity-100",children:"✕"})]},Oe))}),L.length===0&&c.jsx("div",{className:"text-[10px] text-center py-2",style:{color:"var(--terminal-text-muted)"},children:"Add at least one folder to import."})]})]}),c.jsxs("div",{className:Ze(D==="existing-akb"),onClick:()=>I("existing-akb"),children:[c.jsxs("div",{className:"font-medium text-sm",children:["🔗"," Connect Existing AKB"]}),c.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Connect a directory that already has CLAUDE.md and AKB structure."}),D==="existing-akb"&&c.jsxs("div",{className:"mt-3",onClick:de=>de.stopPropagation(),children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{className:`${bt} flex-1`,placeholder:"/path/to/your/akb",value:ie,onChange:de=>{ve(de.target.value),_(null)},autoFocus:!0}),c.jsx("button",{onClick:()=>Se(!pe),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),c.jsx("button",{onClick:re,disabled:P||!ie.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:P||!ie.trim()?.5:1},children:P?"...":"Verify"})]}),z===!0&&c.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Valid AKB found: ",ie]}),z===!1&&c.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," No valid AKB (CLAUDE.md required)"]}),pe&&c.jsx(Ed,{onSelect:de=>{ve(de),_(null),Se(!1)},onClose:()=>Se(!1)})]})]})]}),ct==="team"&&c.jsxs("div",{className:"space-y-4",children:[c.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Team Template"}),c.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"Choose a starting team. You can add or remove roles later."}),Ce.map(de=>c.jsxs("div",{className:Ze(Ye===de.id),onClick:()=>se(de.id),children:[c.jsx("div",{className:"font-medium text-sm capitalize",children:de.id}),c.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:de.roles.map(Oe=>c.jsx("span",{className:"px-2 py-0.5 rounded text-[10px]",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:Oe.name},Oe.id))})]},de.id)),c.jsxs("div",{className:Ze(Ye==="custom"),onClick:()=>se("custom"),children:[c.jsx("div",{className:"font-medium text-sm",children:"Custom"}),c.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Start with no pre-built roles. Hire them from the office."})]})]}),ct==="create"&&c.jsxs("div",{className:"space-y-4",children:[c.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:we?D==="existing-akb"?"AKB Connected!":"Company Created!":"Review & Create"}),!we&&!K&&!Ve&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"rounded-lg p-4 space-y-2 text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:D==="existing-akb"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Mode:"})," Connect Existing AKB"]}),c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Path:"})," ",ie]}),c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Company:"})," ",y]}),c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]}),c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Project:"})," ",C==="fresh"?"Start Fresh":`Existing (${M})`]}),c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Knowledge:"})," ",D==="skip"?"Fresh (empty)":`Import ${L.length} source(s)`]}),c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Team:"})," ",Ye]}),D==="import"&&L.length>0&&c.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--idle-amber)"},children:"Knowledge import will run in the background after entering the office."})]})}),xe&&c.jsx("div",{className:"text-xs p-3 rounded",style:{background:"rgba(220,38,38,0.15)",color:"#f87171"},children:xe})]}),(K||Ve)&&c.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[c.jsx("div",{className:"w-8 h-8 border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),c.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:Ve?"Connecting to AKB...":"Scaffolding your company..."})]}),we&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"text-center py-4 text-4xl",children:"🏢"}),c.jsx("div",{className:"rounded-lg p-4 text-xs max-h-40 overflow-y-auto",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:Ae.map((de,Oe)=>c.jsxs("div",{className:"py-0.5",children:[c.jsx("span",{style:{color:"var(--active-green)"},children:"✓"})," ",de]},Oe))}),D==="import"&&L.length>0&&c.jsx("div",{className:"text-xs p-3 rounded",style:{background:"var(--accent)",color:"#fff",opacity:.9},children:"Knowledge import will start in the background after entering the office."})]})]})]}),c.jsxs("div",{className:"px-6 py-4 flex justify-between items-center",style:{borderTop:"1px solid var(--terminal-border)"},children:[c.jsx("div",{children:l>0&&!we&&c.jsx("button",{onClick:gt,className:"px-4 py-2 rounded text-sm transition-colors",style:{color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Back"})}),c.jsxs("div",{className:"text-xs",style:{color:"var(--terminal-text-muted)"},children:[l+1," / ",$t.length]}),c.jsx("div",{children:we?c.jsx("button",{onClick:be,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:"var(--active-green)",color:"#fff"},children:"Enter Office"}):c.jsx("button",{onClick:on,disabled:!Dt()||K||Ve,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:Dt()?"var(--accent)":"var(--terminal-border)",color:"#fff",opacity:Dt()&&!K&&!Ve?1:.5},children:ct==="create"?K||Ve?Ve?"Connecting...":"Creating...":D==="existing-akb"?"Connect AKB":"Create Company":"Next"})})]})]})})}function YC(){const[t,l]=j.useState(null),[a,i]=j.useState(!0),[o,u]=j.useState(null),f=j.useCallback(async()=>{i(!0),u(null);try{const m=await Te.getStatus();l(m)}catch(m){u(m instanceof Error?m.message:"Failed to fetch status")}finally{i(!1)}},[]);return j.useEffect(()=>{f()},[f]),{initialized:(t==null?void 0:t.initialized)??!1,companyName:(t==null?void 0:t.companyName)??null,engine:(t==null?void 0:t.engine)??"none",companyRoot:(t==null?void 0:t.companyRoot)??"",loading:a,error:o,refetch:f}}const qC=j.lazy(()=>Bb(()=>import("./preview-app-pniQIcGk.js"),[]));function vg(){return c.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},children:c.jsxs("div",{className:"text-center",children:[c.jsx("div",{className:"w-10 h-10 mx-auto border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),c.jsx("div",{className:"mt-4 text-sm",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Loading..."})]})})}function XC(){var t;try{const l=localStorage.getItem("tycono-theme")||localStorage.getItem("the-company-theme"),a=l&&l in za?l:"default",i=(t=za[a])==null?void 0:t.vars;if(!i)return;const o=document.documentElement;for(const[u,f]of Object.entries(i))o.style.setProperty(u,f)}catch{}}function VC(){const{initialized:t,loading:l,refetch:a}=YC(),[i,o]=j.useState(null);j.useEffect(()=>{XC()},[]);const u=f=>{f&&o(f),a()};return l?c.jsx(vg,{}):t?c.jsx(HC,{importJob:i,onImportDone:()=>o(null)}):c.jsx(IC,{onComplete:u})}function GC(){const t=new URLSearchParams(window.location.search).has("sprite-preview");return c.jsx($b,{children:t?c.jsx(j.Suspense,{fallback:c.jsx(vg,{}),children:c.jsx(qC,{})}):c.jsx(VC,{})})}Fb.createRoot(document.getElementById("root")).render(c.jsx(j.StrictMode,{children:c.jsx(GC,{})}));export{ng as H,ag as P,rg as S,ZC as a,lg as b,tg as c,$d as d,xS as e,mS as f,QC as g,pS as h,c as j,j as r};
|