tycono 0.1.74 → 0.1.75-beta.0
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/package.json +1 -1
- package/src/api/src/routes/execute.ts +38 -0
- package/src/api/src/services/wave-multiplexer.ts +268 -0
- package/src/web/dist/assets/index-BcaNcOCL.js +110 -0
- package/src/web/dist/assets/{preview-app-WN7GvXXY.js → preview-app-cOnPQipW.js} +1 -1
- package/src/web/dist/index.html +1 -1
- package/templates/CLAUDE.md.tmpl +10 -2
- package/templates/teams/startup.json +13 -5
- package/src/web/dist/assets/index-HUPb1tEm.js +0 -109
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
var ow=Object.defineProperty;var cw=(e,n,a)=>n in e?ow(e,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[n]=a;var k0=(e,n,a)=>cw(e,typeof n!="symbol"?n+"":n,a);(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.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 d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).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 Cy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zf={exports:{}},vo={};/**
|
|
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 j0;function uw(){if(j0)return vo;j0=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function a(i,o,u){var d=null;if(u!==void 0&&(d=""+u),o.key!==void 0&&(d=""+o.key),"key"in o){u={};for(var h in o)h!=="key"&&(u[h]=o[h])}else u=o;return o=u.ref,{$$typeof:e,type:i,key:d,ref:o!==void 0?o:null,props:u}}return vo.Fragment=n,vo.jsx=a,vo.jsxs=a,vo}var S0;function dw(){return S0||(S0=1,Zf.exports=uw()),Zf.exports}var l=dw(),Jf={exports:{}},mt={};/**
|
|
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 C0;function fw(){if(C0)return mt;C0=1;var e=Symbol.for("react.transitional.element"),n=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"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),w=Symbol.iterator;function b(F){return F===null||typeof F!="object"?null:(F=w&&F[w]||F["@@iterator"],typeof F=="function"?F:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,N={};function C(F,W,T){this.props=F,this.context=W,this.refs=N,this.updater=T||j}C.prototype.isReactComponent={},C.prototype.setState=function(F,W){if(typeof F!="object"&&typeof F!="function"&&F!=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,F,W,"setState")},C.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function E(){}E.prototype=C.prototype;function B(F,W,T){this.props=F,this.context=W,this.refs=N,this.updater=T||j}var R=B.prototype=new E;R.constructor=B,k(R,C.prototype),R.isPureReactComponent=!0;var $=Array.isArray;function _(){}var L={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function Q(F,W,T){var de=T.ref;return{$$typeof:e,type:F,key:W,ref:de!==void 0?de:null,props:T}}function D(F,W){return Q(F.type,W,F.props)}function I(F){return typeof F=="object"&&F!==null&&F.$$typeof===e}function H(F){var W={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(T){return W[T]})}var q=/\/+/g;function ue(F,W){return typeof F=="object"&&F!==null&&F.key!=null?H(""+F.key):W.toString(36)}function te(F){switch(F.status){case"fulfilled":return F.value;case"rejected":throw F.reason;default:switch(typeof F.status=="string"?F.then(_,_):(F.status="pending",F.then(function(W){F.status==="pending"&&(F.status="fulfilled",F.value=W)},function(W){F.status==="pending"&&(F.status="rejected",F.reason=W)})),F.status){case"fulfilled":return F.value;case"rejected":throw F.reason}}throw F}function Y(F,W,T,de,xe){var ye=typeof F;(ye==="undefined"||ye==="boolean")&&(F=null);var Le=!1;if(F===null)Le=!0;else switch(ye){case"bigint":case"string":case"number":Le=!0;break;case"object":switch(F.$$typeof){case e:case n:Le=!0;break;case x:return Le=F._init,Y(Le(F._payload),W,T,de,xe)}}if(Le)return xe=xe(F),Le=de===""?"."+ue(F,0):de,$(xe)?(T="",Le!=null&&(T=Le.replace(q,"$&/")+"/"),Y(xe,W,T,"",function(ht){return ht})):xe!=null&&(I(xe)&&(xe=D(xe,T+(xe.key==null||F&&F.key===xe.key?"":(""+xe.key).replace(q,"$&/")+"/")+Le)),W.push(xe)),1;Le=0;var Xe=de===""?".":de+":";if($(F))for(var Ye=0;Ye<F.length;Ye++)de=F[Ye],ye=Xe+ue(de,Ye),Le+=Y(de,W,T,ye,xe);else if(Ye=b(F),typeof Ye=="function")for(F=Ye.call(F),Ye=0;!(de=F.next()).done;)de=de.value,ye=Xe+ue(de,Ye++),Le+=Y(de,W,T,ye,xe);else if(ye==="object"){if(typeof F.then=="function")return Y(te(F),W,T,de,xe);throw W=String(F),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return Le}function se(F,W,T){if(F==null)return F;var de=[],xe=0;return Y(F,de,"","",function(ye){return W.call(T,ye,xe++)}),de}function J(F){if(F._status===-1){var W=F._result;W=W(),W.then(function(T){(F._status===0||F._status===-1)&&(F._status=1,F._result=T)},function(T){(F._status===0||F._status===-1)&&(F._status=2,F._result=T)}),F._status===-1&&(F._status=0,F._result=W)}if(F._status===1)return F._result.default;throw F._result}var Z=typeof reportError=="function"?reportError:function(F){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof F=="object"&&F!==null&&typeof F.message=="string"?String(F.message):String(F),error:F});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",F);return}console.error(F)},A={map:se,forEach:function(F,W,T){se(F,function(){W.apply(this,arguments)},T)},count:function(F){var W=0;return se(F,function(){W++}),W},toArray:function(F){return se(F,function(W){return W})||[]},only:function(F){if(!I(F))throw Error("React.Children.only expected to receive a single React element child.");return F}};return mt.Activity=g,mt.Children=A,mt.Component=C,mt.Fragment=a,mt.Profiler=o,mt.PureComponent=B,mt.StrictMode=i,mt.Suspense=m,mt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,mt.__COMPILER_RUNTIME={__proto__:null,c:function(F){return L.H.useMemoCache(F)}},mt.cache=function(F){return function(){return F.apply(null,arguments)}},mt.cacheSignal=function(){return null},mt.cloneElement=function(F,W,T){if(F==null)throw Error("The argument must be a React element, but you passed "+F+".");var de=k({},F.props),xe=F.key;if(W!=null)for(ye in W.key!==void 0&&(xe=""+W.key),W)!U.call(W,ye)||ye==="key"||ye==="__self"||ye==="__source"||ye==="ref"&&W.ref===void 0||(de[ye]=W[ye]);var ye=arguments.length-2;if(ye===1)de.children=T;else if(1<ye){for(var Le=Array(ye),Xe=0;Xe<ye;Xe++)Le[Xe]=arguments[Xe+2];de.children=Le}return Q(F.type,xe,de)},mt.createContext=function(F){return F={$$typeof:d,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null},F.Provider=F,F.Consumer={$$typeof:u,_context:F},F},mt.createElement=function(F,W,T){var de,xe={},ye=null;if(W!=null)for(de in W.key!==void 0&&(ye=""+W.key),W)U.call(W,de)&&de!=="key"&&de!=="__self"&&de!=="__source"&&(xe[de]=W[de]);var Le=arguments.length-2;if(Le===1)xe.children=T;else if(1<Le){for(var Xe=Array(Le),Ye=0;Ye<Le;Ye++)Xe[Ye]=arguments[Ye+2];xe.children=Xe}if(F&&F.defaultProps)for(de in Le=F.defaultProps,Le)xe[de]===void 0&&(xe[de]=Le[de]);return Q(F,ye,xe)},mt.createRef=function(){return{current:null}},mt.forwardRef=function(F){return{$$typeof:h,render:F}},mt.isValidElement=I,mt.lazy=function(F){return{$$typeof:x,_payload:{_status:-1,_result:F},_init:J}},mt.memo=function(F,W){return{$$typeof:f,type:F,compare:W===void 0?null:W}},mt.startTransition=function(F){var W=L.T,T={};L.T=T;try{var de=F(),xe=L.S;xe!==null&&xe(T,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then(_,Z)}catch(ye){Z(ye)}finally{W!==null&&T.types!==null&&(W.types=T.types),L.T=W}},mt.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},mt.use=function(F){return L.H.use(F)},mt.useActionState=function(F,W,T){return L.H.useActionState(F,W,T)},mt.useCallback=function(F,W){return L.H.useCallback(F,W)},mt.useContext=function(F){return L.H.useContext(F)},mt.useDebugValue=function(){},mt.useDeferredValue=function(F,W){return L.H.useDeferredValue(F,W)},mt.useEffect=function(F,W){return L.H.useEffect(F,W)},mt.useEffectEvent=function(F){return L.H.useEffectEvent(F)},mt.useId=function(){return L.H.useId()},mt.useImperativeHandle=function(F,W,T){return L.H.useImperativeHandle(F,W,T)},mt.useInsertionEffect=function(F,W){return L.H.useInsertionEffect(F,W)},mt.useLayoutEffect=function(F,W){return L.H.useLayoutEffect(F,W)},mt.useMemo=function(F,W){return L.H.useMemo(F,W)},mt.useOptimistic=function(F,W){return L.H.useOptimistic(F,W)},mt.useReducer=function(F,W,T){return L.H.useReducer(F,W,T)},mt.useRef=function(F){return L.H.useRef(F)},mt.useState=function(F){return L.H.useState(F)},mt.useSyncExternalStore=function(F,W,T){return L.H.useSyncExternalStore(F,W,T)},mt.useTransition=function(){return L.H.useTransition()},mt.version="19.2.4",mt}var N0;function wm(){return N0||(N0=1,Jf.exports=fw()),Jf.exports}var v=wm(),eh={exports:{}},wo={},th={exports:{}},nh={};/**
|
|
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 E0;function hw(){return E0||(E0=1,(function(e){function n(Y,se){var J=Y.length;Y.push(se);e:for(;0<J;){var Z=J-1>>>1,A=Y[Z];if(0<o(A,se))Y[Z]=se,Y[J]=A,J=Z;else break e}}function a(Y){return Y.length===0?null:Y[0]}function i(Y){if(Y.length===0)return null;var se=Y[0],J=Y.pop();if(J!==se){Y[0]=J;e:for(var Z=0,A=Y.length,F=A>>>1;Z<F;){var W=2*(Z+1)-1,T=Y[W],de=W+1,xe=Y[de];if(0>o(T,J))de<A&&0>o(xe,T)?(Y[Z]=xe,Y[de]=J,Z=de):(Y[Z]=T,Y[W]=J,Z=W);else if(de<A&&0>o(xe,J))Y[Z]=xe,Y[de]=J,Z=de;else break e}}return se}function o(Y,se){var J=Y.sortIndex-se.sortIndex;return J!==0?J:Y.id-se.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var d=Date,h=d.now();e.unstable_now=function(){return d.now()-h}}var m=[],f=[],x=1,g=null,w=3,b=!1,j=!1,k=!1,N=!1,C=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function R(Y){for(var se=a(f);se!==null;){if(se.callback===null)i(f);else if(se.startTime<=Y)i(f),se.sortIndex=se.expirationTime,n(m,se);else break;se=a(f)}}function $(Y){if(k=!1,R(Y),!j)if(a(m)!==null)j=!0,_||(_=!0,H());else{var se=a(f);se!==null&&te($,se.startTime-Y)}}var _=!1,L=-1,U=5,Q=-1;function D(){return N?!0:!(e.unstable_now()-Q<U)}function I(){if(N=!1,_){var Y=e.unstable_now();Q=Y;var se=!0;try{e:{j=!1,k&&(k=!1,E(L),L=-1),b=!0;var J=w;try{t:{for(R(Y),g=a(m);g!==null&&!(g.expirationTime>Y&&D());){var Z=g.callback;if(typeof Z=="function"){g.callback=null,w=g.priorityLevel;var A=Z(g.expirationTime<=Y);if(Y=e.unstable_now(),typeof A=="function"){g.callback=A,R(Y),se=!0;break t}g===a(m)&&i(m),R(Y)}else i(m);g=a(m)}if(g!==null)se=!0;else{var F=a(f);F!==null&&te($,F.startTime-Y),se=!1}}break e}finally{g=null,w=J,b=!1}se=void 0}}finally{se?H():_=!1}}}var H;if(typeof B=="function")H=function(){B(I)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,ue=q.port2;q.port1.onmessage=I,H=function(){ue.postMessage(null)}}else H=function(){C(I,0)};function te(Y,se){L=C(function(){Y(e.unstable_now())},se)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(Y){Y.callback=null},e.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<Y?Math.floor(1e3/Y):5},e.unstable_getCurrentPriorityLevel=function(){return w},e.unstable_next=function(Y){switch(w){case 1:case 2:case 3:var se=3;break;default:se=w}var J=w;w=se;try{return Y()}finally{w=J}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(Y,se){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var J=w;w=Y;try{return se()}finally{w=J}},e.unstable_scheduleCallback=function(Y,se,J){var Z=e.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?Z+J:Z):J=Z,Y){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=J+A,Y={id:x++,callback:se,priorityLevel:Y,startTime:J,expirationTime:A,sortIndex:-1},J>Z?(Y.sortIndex=J,n(f,Y),a(m)===null&&Y===a(f)&&(k?(E(L),L=-1):k=!0,te($,J-Z))):(Y.sortIndex=A,n(m,Y),j||b||(j=!0,_||(_=!0,H()))),Y},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(Y){var se=w;return function(){var J=w;w=se;try{return Y.apply(this,arguments)}finally{w=J}}}})(nh)),nh}var A0;function mw(){return A0||(A0=1,th.exports=hw()),th.exports}var rh={exports:{}},nr={};/**
|
|
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 D0;function pw(){if(D0)return nr;D0=1;var e=wm();function n(m){var f="https://react.dev/errors/"+m;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)f+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+m+"; visit "+f+" 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(n(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(m,f,x){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:m,containerInfo:f,implementation:x}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(m,f){if(m==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return nr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,nr.createPortal=function(m,f){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(n(299));return u(m,f,null,x)},nr.flushSync=function(m){var f=d.T,x=i.p;try{if(d.T=null,i.p=2,m)return m()}finally{d.T=f,i.p=x,i.d.f()}},nr.preconnect=function(m,f){typeof m=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,i.d.C(m,f))},nr.prefetchDNS=function(m){typeof m=="string"&&i.d.D(m)},nr.preinit=function(m,f){if(typeof m=="string"&&f&&typeof f.as=="string"){var x=f.as,g=h(x,f.crossOrigin),w=typeof f.integrity=="string"?f.integrity:void 0,b=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;x==="style"?i.d.S(m,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:g,integrity:w,fetchPriority:b}):x==="script"&&i.d.X(m,{crossOrigin:g,integrity:w,fetchPriority:b,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},nr.preinitModule=function(m,f){if(typeof m=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var x=h(f.as,f.crossOrigin);i.d.M(m,{crossOrigin:x,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&i.d.M(m)},nr.preload=function(m,f){if(typeof m=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var x=f.as,g=h(x,f.crossOrigin);i.d.L(m,x,{crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},nr.preloadModule=function(m,f){if(typeof m=="string")if(f){var x=h(f.as,f.crossOrigin);i.d.m(m,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:x,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else i.d.m(m)},nr.requestFormReset=function(m){i.d.r(m)},nr.unstable_batchedUpdates=function(m,f){return m(f)},nr.useFormState=function(m,f,x){return d.H.useFormState(m,f,x)},nr.useFormStatus=function(){return d.H.useHostTransitionStatus()},nr.version="19.2.4",nr}var T0;function xw(){if(T0)return rh.exports;T0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),rh.exports=pw(),rh.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 F0;function gw(){if(F0)return wo;F0=1;var e=mw(),n=wm(),a=xw();function i(t){var r="https://react.dev/errors/"+t;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)r+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+t+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var r=t,s=t;if(t.alternate)for(;r.return;)r=r.return;else{t=r;do r=t,(r.flags&4098)!==0&&(s=r.return),t=r.return;while(t)}return r.tag===3?s:null}function d(t){if(t.tag===13){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function h(t){if(t.tag===31){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function m(t){if(u(t)!==t)throw Error(i(188))}function f(t){var r=t.alternate;if(!r){if(r=u(t),r===null)throw Error(i(188));return r!==t?null:t}for(var s=t,c=r;;){var p=s.return;if(p===null)break;var y=p.alternate;if(y===null){if(c=p.return,c!==null){s=c;continue}break}if(p.child===y.child){for(y=p.child;y;){if(y===s)return m(p),t;if(y===c)return m(p),r;y=y.sibling}throw Error(i(188))}if(s.return!==c.return)s=p,c=y;else{for(var S=!1,z=p.child;z;){if(z===s){S=!0,s=p,c=y;break}if(z===c){S=!0,c=p,s=y;break}z=z.sibling}if(!S){for(z=y.child;z;){if(z===s){S=!0,s=y,c=p;break}if(z===c){S=!0,c=y,s=p;break}z=z.sibling}if(!S)throw Error(i(189))}}if(s.alternate!==c)throw Error(i(190))}if(s.tag!==3)throw Error(i(188));return s.stateNode.current===s?t:r}function x(t){var r=t.tag;if(r===5||r===26||r===27||r===6)return t;for(t=t.child;t!==null;){if(r=x(t),r!==null)return r;t=t.sibling}return null}var g=Object.assign,w=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),B=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function H(t){return t===null||typeof t!="object"?null:(t=I&&t[I]||t["@@iterator"],typeof t=="function"?t:null)}var q=Symbol.for("react.client.reference");function ue(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===q?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case k:return"Fragment";case C:return"Profiler";case N:return"StrictMode";case $:return"Suspense";case _:return"SuspenseList";case Q:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case j:return"Portal";case B:return t.displayName||"Context";case E:return(t._context.displayName||"Context")+".Consumer";case R:var r=t.render;return t=t.displayName,t||(t=r.displayName||r.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case L:return r=t.displayName||null,r!==null?r:ue(t.type)||"Memo";case U:r=t._payload,t=t._init;try{return ue(t(r))}catch{}}return null}var te=Array.isArray,Y=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},Z=[],A=-1;function F(t){return{current:t}}function W(t){0>A||(t.current=Z[A],Z[A]=null,A--)}function T(t,r){A++,Z[A]=t.current,t.current=r}var de=F(null),xe=F(null),ye=F(null),Le=F(null);function Xe(t,r){switch(T(ye,r),T(xe,t),T(de,null),r.nodeType){case 9:case 11:t=(t=r.documentElement)&&(t=t.namespaceURI)?X1(t):0;break;default:if(t=r.tagName,r=r.namespaceURI)r=X1(r),t=W1(r,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}W(de),T(de,t)}function Ye(){W(de),W(xe),W(ye)}function ht(t){t.memoizedState!==null&&T(Le,t);var r=de.current,s=W1(r,t.type);r!==s&&(T(xe,t),T(de,s))}function tt(t){xe.current===t&&(W(de),W(xe)),Le.current===t&&(W(Le),xo._currentValue=J)}var Je,Ne;function De(t){if(Je===void 0)try{throw Error()}catch(s){var r=s.stack.trim().match(/\n( *(at )?)/);Je=r&&r[1]||"",Ne=-1<s.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+Je+t+Ne}var yt=!1;function ct(t,r){if(!t||yt)return"";yt=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(r){var Ce=function(){throw Error()};if(Object.defineProperty(Ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ce,[])}catch(fe){var oe=fe}Reflect.construct(t,[],Ce)}else{try{Ce.call()}catch(fe){oe=fe}t.call(Ce.prototype)}}else{try{throw Error()}catch(fe){oe=fe}(Ce=t())&&typeof Ce.catch=="function"&&Ce.catch(function(){})}}catch(fe){if(fe&&oe&&typeof fe.stack=="string")return[fe.stack,oe.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=c.DetermineComponentFrameRoot(),S=y[0],z=y[1];if(S&&z){var X=S.split(`
|
|
44
|
-
`),ie=z.split(`
|
|
45
|
-
`);for(p=c=0;c<X.length&&!X[c].includes("DetermineComponentFrameRoot");)c++;for(;p<ie.length&&!ie[p].includes("DetermineComponentFrameRoot");)p++;if(c===X.length||p===ie.length)for(c=X.length-1,p=ie.length-1;1<=c&&0<=p&&X[c]!==ie[p];)p--;for(;1<=c&&0<=p;c--,p--)if(X[c]!==ie[p]){if(c!==1||p!==1)do if(c--,p--,0>p||X[c]!==ie[p]){var pe=`
|
|
46
|
-
`+X[c].replace(" at new "," at ");return t.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",t.displayName)),pe}while(1<=c&&0<=p);break}}}finally{yt=!1,Error.prepareStackTrace=s}return(s=t?t.displayName||t.name:"")?De(s):""}function pt(t,r){switch(t.tag){case 26:case 27:case 5:return De(t.type);case 16:return De("Lazy");case 13:return t.child!==r&&r!==null?De("Suspense Fallback"):De("Suspense");case 19:return De("SuspenseList");case 0:case 15:return ct(t.type,!1);case 11:return ct(t.type.render,!1);case 1:return ct(t.type,!0);case 31:return De("Activity");default:return""}}function jt(t){try{var r="",s=null;do r+=pt(t,s),s=t,t=t.return;while(t);return r}catch(c){return`
|
|
47
|
-
Error generating stack: `+c.message+`
|
|
48
|
-
`+c.stack}}var Wt=Object.prototype.hasOwnProperty,Ft=e.unstable_scheduleCallback,Nt=e.unstable_cancelCallback,$n=e.unstable_shouldYield,me=e.unstable_requestPaint,Se=e.unstable_now,Ee=e.unstable_getCurrentPriorityLevel,G=e.unstable_ImmediatePriority,ce=e.unstable_UserBlockingPriority,ne=e.unstable_NormalPriority,ke=e.unstable_LowPriority,ve=e.unstable_IdlePriority,ze=e.log,_e=e.unstable_setDisableYieldValue,Be=null,He=null;function rt(t){if(typeof ze=="function"&&_e(t),He&&typeof He.setStrictMode=="function")try{He.setStrictMode(Be,t)}catch{}}var Ve=Math.clz32?Math.clz32:Ie,bt=Math.log,Re=Math.LN2;function Ie(t){return t>>>=0,t===0?32:31-(bt(t)/Re|0)|0}var _t=256,Bt=262144,Ot=4194304;function fn(t){var r=t&42;if(r!==0)return r;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function wn(t,r,s){var c=t.pendingLanes;if(c===0)return 0;var p=0,y=t.suspendedLanes,S=t.pingedLanes;t=t.warmLanes;var z=c&134217727;return z!==0?(c=z&~y,c!==0?p=fn(c):(S&=z,S!==0?p=fn(S):s||(s=z&~t,s!==0&&(p=fn(s))))):(z=c&~y,z!==0?p=fn(z):S!==0?p=fn(S):s||(s=c&~t,s!==0&&(p=fn(s)))),p===0?0:r!==0&&r!==p&&(r&y)===0&&(y=p&-p,s=r&-r,y>=s||y===32&&(s&4194048)!==0)?r:p}function P(t,r){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&r)===0}function Oe(t,r){switch(t){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 nt(){var t=Ot;return Ot<<=1,(Ot&62914560)===0&&(Ot=4194304),t}function Qt(t){for(var r=[],s=0;31>s;s++)r.push(t);return r}function we(t,r){t.pendingLanes|=r,r!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function kt(t,r,s,c,p,y){var S=t.pendingLanes;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=s,t.entangledLanes&=s,t.errorRecoveryDisabledLanes&=s,t.shellSuspendCounter=0;var z=t.entanglements,X=t.expirationTimes,ie=t.hiddenUpdates;for(s=S&~s;0<s;){var pe=31-Ve(s),Ce=1<<pe;z[pe]=0,X[pe]=-1;var oe=ie[pe];if(oe!==null)for(ie[pe]=null,pe=0;pe<oe.length;pe++){var fe=oe[pe];fe!==null&&(fe.lane&=-536870913)}s&=~Ce}c!==0&&ln(t,c,0),y!==0&&p===0&&t.tag!==0&&(t.suspendedLanes|=y&~(S&~r))}function ln(t,r,s){t.pendingLanes|=r,t.suspendedLanes&=~r;var c=31-Ve(r);t.entangledLanes|=r,t.entanglements[c]=t.entanglements[c]|1073741824|s&261930}function sn(t,r){var s=t.entangledLanes|=r;for(t=t.entanglements;s;){var c=31-Ve(s),p=1<<c;p&r|t[c]&r&&(t[c]|=r),s&=~p}}function re(t,r){var s=r&-r;return s=(s&42)!==0?1:Ae(s),(s&(t.suspendedLanes|r))!==0?0:s}function Ae(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function We(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Et(){var t=se.p;return t!==0?t:(t=window.event,t===void 0?32:p0(t.type))}function kn(t,r){var s=se.p;try{return se.p=t,r()}finally{se.p=s}}var ur=Math.random().toString(36).slice(2),xn="__reactFiber$"+ur,gn="__reactProps$"+ur,dr="__reactContainer$"+ur,sl="__reactEvents$"+ur,Ju="__reactListeners$"+ur,Fs="__reactHandles$"+ur,Vo="__reactResources$"+ur,Ta="__reactMarker$"+ur;function Ti(t){delete t[xn],delete t[gn],delete t[sl],delete t[Ju],delete t[Fs]}function ca(t){var r=t[xn];if(r)return r;for(var s=t.parentNode;s;){if(r=s[dr]||s[xn]){if(s=r.alternate,r.child!==null||s!==null&&s.child!==null)for(t=J1(t);t!==null;){if(s=t[xn])return s;t=J1(t)}return r}t=s,s=t.parentNode}return null}function Vn(t){if(t=t[xn]||t[dr]){var r=t.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return t}return null}function Wl(t){var r=t.tag;if(r===5||r===26||r===27||r===6)return t.stateNode;throw Error(i(33))}function jr(t){var r=t[Vo];return r||(r=t[Vo]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function jn(t){t[Ta]=!0}var Fa=new Set,Ma={};function fr(t,r){Ra(t,r),Ra(t+"Capture",r)}function Ra(t,r){for(Ma[t]=r,t=0;t<r.length;t++)Fa.add(r[t])}var ol=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]*$"),Ms={},Rs={};function zs(t){return Wt.call(Rs,t)?!0:Wt.call(Ms,t)?!1:ol.test(t)?Rs[t]=!0:(Ms[t]=!0,!1)}function Gl(t,r,s){if(zs(r))if(s===null)t.removeAttribute(r);else{switch(typeof s){case"undefined":case"function":case"symbol":t.removeAttribute(r);return;case"boolean":var c=r.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){t.removeAttribute(r);return}}t.setAttribute(r,""+s)}}function Vl(t,r,s){if(s===null)t.removeAttribute(r);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(r);return}t.setAttribute(r,""+s)}}function Pr(t,r,s,c){if(c===null)t.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttributeNS(r,s,""+c)}}function Dn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Zr(t){var r=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function ua(t,r,s){var c=Object.getOwnPropertyDescriptor(t.constructor.prototype,r);if(!t.hasOwnProperty(r)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var p=c.get,y=c.set;return Object.defineProperty(t,r,{configurable:!0,get:function(){return p.call(this)},set:function(S){s=""+S,y.call(this,S)}}),Object.defineProperty(t,r,{enumerable:c.enumerable}),{getValue:function(){return s},setValue:function(S){s=""+S},stopTracking:function(){t._valueTracker=null,delete t[r]}}}}function Jr(t){if(!t._valueTracker){var r=Zr(t)?"checked":"value";t._valueTracker=ua(t,r,""+t[r])}}function Or(t){if(!t)return!1;var r=t._valueTracker;if(!r)return!0;var s=r.getValue(),c="";return t&&(c=Zr(t)?t.checked?"true":"false":t.value),t=c,t!==s?(r.setValue(t),!0):!1}function Tn(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Ko=/[\n"\\]/g;function hr(t){return t.replace(Ko,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Kl(t,r,s,c,p,y,S,z){t.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?t.type=S:t.removeAttribute("type"),r!=null?S==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+Dn(r)):t.value!==""+Dn(r)&&(t.value=""+Dn(r)):S!=="submit"&&S!=="reset"||t.removeAttribute("value"),r!=null?da(t,S,Dn(r)):s!=null?da(t,S,Dn(s)):c!=null&&t.removeAttribute("value"),p==null&&y!=null&&(t.defaultChecked=!!y),p!=null&&(t.checked=p&&typeof p!="function"&&typeof p!="symbol"),z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"?t.name=""+Dn(z):t.removeAttribute("name")}function Sr(t,r,s,c,p,y,S,z){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(t.type=y),r!=null||s!=null){if(!(y!=="submit"&&y!=="reset"||r!=null)){Jr(t);return}s=s!=null?""+Dn(s):"",r=r!=null?""+Dn(r):s,z||r===t.value||(t.value=r),t.defaultValue=r}c=c??p,c=typeof c!="function"&&typeof c!="symbol"&&!!c,t.checked=z?t.checked:!!c,t.defaultChecked=!!c,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(t.name=S),Jr(t)}function da(t,r,s){r==="number"&&Tn(t.ownerDocument)===t||t.defaultValue===""+s||(t.defaultValue=""+s)}function mr(t,r,s,c){if(t=t.options,r){r={};for(var p=0;p<s.length;p++)r["$"+s[p]]=!0;for(s=0;s<t.length;s++)p=r.hasOwnProperty("$"+t[s].value),t[s].selected!==p&&(t[s].selected=p),p&&c&&(t[s].defaultSelected=!0)}else{for(s=""+Dn(s),r=null,p=0;p<t.length;p++){if(t[p].value===s){t[p].selected=!0,c&&(t[p].defaultSelected=!0);return}r!==null||t[p].disabled||(r=t[p])}r!==null&&(r.selected=!0)}}function Qo(t,r,s){if(r!=null&&(r=""+Dn(r),r!==t.value&&(t.value=r),s==null)){t.defaultValue!==r&&(t.defaultValue=r);return}t.defaultValue=s!=null?""+Dn(s):""}function Ln(t,r,s,c){if(r==null){if(c!=null){if(s!=null)throw Error(i(92));if(te(c)){if(1<c.length)throw Error(i(93));c=c[0]}s=c}s==null&&(s=""),r=s}s=Dn(r),t.defaultValue=s,c=t.textContent,c===s&&c!==""&&c!==null&&(t.value=c),Jr(t)}function Gt(t,r){if(r){var s=t.firstChild;if(s&&s===t.lastChild&&s.nodeType===3){s.nodeValue=r;return}}t.textContent=r}var fa=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 Xn(t,r,s){var c=r.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?c?t.setProperty(r,""):r==="float"?t.cssFloat="":t[r]="":c?t.setProperty(r,s):typeof s!="number"||s===0||fa.has(r)?r==="float"?t.cssFloat=s:t[r]=(""+s).trim():t[r]=s+"px"}function ea(t,r,s){if(r!=null&&typeof r!="object")throw Error(i(62));if(t=t.style,s!=null){for(var c in s)!s.hasOwnProperty(c)||r!=null&&r.hasOwnProperty(c)||(c.indexOf("--")===0?t.setProperty(c,""):c==="float"?t.cssFloat="":t[c]="");for(var p in r)c=r[p],r.hasOwnProperty(p)&&s[p]!==c&&Xn(t,p,c)}else for(var y in r)r.hasOwnProperty(y)&&Xn(t,y,r[y])}function ta(t){if(t.indexOf("-")===-1)return!1;switch(t){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 ed=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"]]),Fi=/^[\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 Ql(t){return Fi.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function tr(){}var na=null;function Mi(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var za=null,Fn=null;function _a(t){var r=Vn(t);if(r&&(t=r.stateNode)){var s=t[gn]||null;e:switch(t=r.stateNode,r.type){case"input":if(Kl(t,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),r=s.name,s.type==="radio"&&r!=null){for(s=t;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+hr(""+r)+'"][type="radio"]'),r=0;r<s.length;r++){var c=s[r];if(c!==t&&c.form===t.form){var p=c[gn]||null;if(!p)throw Error(i(90));Kl(c,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(r=0;r<s.length;r++)c=s[r],c.form===t.form&&Or(c)}break e;case"textarea":Qo(t,s.value,s.defaultValue);break e;case"select":r=s.value,r!=null&&mr(t,!!s.multiple,r,!1)}}}var cl=!1;function Po(t,r,s){if(cl)return t(r,s);cl=!0;try{var c=t(r);return c}finally{if(cl=!1,(za!==null||Fn!==null)&&(qc(),za&&(r=za,t=Fn,Fn=za=null,_a(r),t)))for(r=0;r<t.length;r++)_a(t[r])}}function Pl(t,r){var s=t.stateNode;if(s===null)return null;var c=s[gn]||null;if(c===null)return null;s=c[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(t=t.type,c=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!c;break e;default:t=!1}if(t)return null;if(s&&typeof s!="function")throw Error(i(231,r,typeof s));return s}var xt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),_s=!1;if(xt)try{var Pt={};Object.defineProperty(Pt,"passive",{get:function(){_s=!0}}),window.addEventListener("test",Pt,Pt),window.removeEventListener("test",Pt,Pt)}catch{_s=!1}var $r=null,Ba=null,Ri=null;function ul(){if(Ri)return Ri;var t,r=Ba,s=r.length,c,p="value"in $r?$r.value:$r.textContent,y=p.length;for(t=0;t<s&&r[t]===p[t];t++);var S=s-t;for(c=1;c<=S&&r[s-c]===p[y-c];c++);return Ri=p.slice(t,1<c?1-c:void 0)}function zi(t){var r=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&r===13&&(t=13)):t=r,t===10&&(t=13),32<=t||t===13?t:0}function dl(){return!0}function ha(){return!1}function Wn(t){function r(s,c,p,y,S){this._reactName=s,this._targetInst=p,this.type=c,this.nativeEvent=y,this.target=S,this.currentTarget=null;for(var z in t)t.hasOwnProperty(z)&&(s=t[z],this[z]=s?s(y):y[z]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?dl:ha,this.isPropagationStopped=ha,this}return g(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=dl)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=dl)},persist:function(){},isPersistent:dl}),r}var Oa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_i=Wn(Oa),$a=g({},Oa,{view:0,detail:0}),td=Wn($a),Bi,Oi,Zl,Jl=g({},$a,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Li,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Zl&&(Zl&&t.type==="mousemove"?(Bi=t.screenX-Zl.screenX,Oi=t.screenY-Zl.screenY):Oi=Bi=0,Zl=t),Bi)},movementY:function(t){return"movementY"in t?t.movementY:Oi}}),Bs=Wn(Jl),Zo=g({},Jl,{dataTransfer:0}),ma=Wn(Zo),La=g({},$a,{relatedTarget:0}),ei=Wn(La),nd=g({},Oa,{animationName:0,elapsedTime:0,pseudoElement:0}),Jo=Wn(nd),ec=g({},Oa,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),rd=Wn(ec),tc=g({},Oa,{data:0}),Zt=Wn(tc),$i={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},nc={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"},rc={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ac(t){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(t):(t=rc[t])?!!r[t]:!1}function Li(){return ac}var lc=g({},$a,{key:function(t){if(t.key){var r=$i[t.key]||t.key;if(r!=="Unidentified")return r}return t.type==="keypress"?(t=zi(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?nc[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Li,charCode:function(t){return t.type==="keypress"?zi(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?zi(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),ic=Wn(lc),sc=g({},Jl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),M=Wn(sc),V=g({},$a,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Li}),ae=Wn(V),he=g({},Oa,{propertyName:0,elapsedTime:0,pseudoElement:0}),je=Wn(he),$e=g({},Jl,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),It=Wn($e),ut=g({},Oa,{newState:0,oldState:0}),Pe=Wn(ut),Ze=[9,13,27,32],dt=xt&&"CompositionEvent"in window,St=null;xt&&"documentMode"in document&&(St=document.documentMode);var ti=xt&&"TextEvent"in window&&!St,Kn=xt&&(!dt||St&&8<St&&11>=St),st=" ",$t=!1;function Nn(t,r){switch(t){case"keyup":return Ze.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function on(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ii=!1;function Mv(t,r){switch(t){case"compositionend":return on(r);case"keypress":return r.which!==32?null:($t=!0,st);case"textInput":return t=r.data,t===st&&$t?null:t;default:return null}}function Rv(t,r){if(Ii)return t==="compositionend"||!dt&&Nn(t,r)?(t=ul(),Ri=Ba=$r=null,Ii=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return Kn&&r.locale!=="ko"?null:r.data;default:return null}}var zv={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 np(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r==="input"?!!zv[t.type]:r==="textarea"}function rp(t,r,s,c){za?Fn?Fn.push(c):Fn=[c]:za=c,r=Qc(r,"onChange"),0<r.length&&(s=new _i("onChange","change",null,s,c),t.push({event:s,listeners:r}))}var Os=null,$s=null;function _v(t){L1(t,0)}function oc(t){var r=Wl(t);if(Or(r))return t}function ap(t,r){if(t==="change")return r}var lp=!1;if(xt){var ad;if(xt){var ld="oninput"in document;if(!ld){var ip=document.createElement("div");ip.setAttribute("oninput","return;"),ld=typeof ip.oninput=="function"}ad=ld}else ad=!1;lp=ad&&(!document.documentMode||9<document.documentMode)}function sp(){Os&&(Os.detachEvent("onpropertychange",op),$s=Os=null)}function op(t){if(t.propertyName==="value"&&oc($s)){var r=[];rp(r,$s,t,Mi(t)),Po(_v,r)}}function Bv(t,r,s){t==="focusin"?(sp(),Os=r,$s=s,Os.attachEvent("onpropertychange",op)):t==="focusout"&&sp()}function Ov(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return oc($s)}function $v(t,r){if(t==="click")return oc(r)}function Lv(t,r){if(t==="input"||t==="change")return oc(r)}function Iv(t,r){return t===r&&(t!==0||1/t===1/r)||t!==t&&r!==r}var Cr=typeof Object.is=="function"?Object.is:Iv;function Ls(t,r){if(Cr(t,r))return!0;if(typeof t!="object"||t===null||typeof r!="object"||r===null)return!1;var s=Object.keys(t),c=Object.keys(r);if(s.length!==c.length)return!1;for(c=0;c<s.length;c++){var p=s[c];if(!Wt.call(r,p)||!Cr(t[p],r[p]))return!1}return!0}function cp(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function up(t,r){var s=cp(t);t=0;for(var c;s;){if(s.nodeType===3){if(c=t+s.textContent.length,t<=r&&c>=r)return{node:s,offset:r-t};t=c}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=cp(s)}}function dp(t,r){return t&&r?t===r?!0:t&&t.nodeType===3?!1:r&&r.nodeType===3?dp(t,r.parentNode):"contains"in t?t.contains(r):t.compareDocumentPosition?!!(t.compareDocumentPosition(r)&16):!1:!1}function fp(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var r=Tn(t.document);r instanceof t.HTMLIFrameElement;){try{var s=typeof r.contentWindow.location.href=="string"}catch{s=!1}if(s)t=r.contentWindow;else break;r=Tn(t.document)}return r}function id(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r&&(r==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||r==="textarea"||t.contentEditable==="true")}var Hv=xt&&"documentMode"in document&&11>=document.documentMode,Hi=null,sd=null,Is=null,od=!1;function hp(t,r,s){var c=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;od||Hi==null||Hi!==Tn(c)||(c=Hi,"selectionStart"in c&&id(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Is&&Ls(Is,c)||(Is=c,c=Qc(sd,"onSelect"),0<c.length&&(r=new _i("onSelect","select",null,r,s),t.push({event:r,listeners:c}),r.target=Hi)))}function ni(t,r){var s={};return s[t.toLowerCase()]=r.toLowerCase(),s["Webkit"+t]="webkit"+r,s["Moz"+t]="moz"+r,s}var Ui={animationend:ni("Animation","AnimationEnd"),animationiteration:ni("Animation","AnimationIteration"),animationstart:ni("Animation","AnimationStart"),transitionrun:ni("Transition","TransitionRun"),transitionstart:ni("Transition","TransitionStart"),transitioncancel:ni("Transition","TransitionCancel"),transitionend:ni("Transition","TransitionEnd")},cd={},mp={};xt&&(mp=document.createElement("div").style,"AnimationEvent"in window||(delete Ui.animationend.animation,delete Ui.animationiteration.animation,delete Ui.animationstart.animation),"TransitionEvent"in window||delete Ui.transitionend.transition);function ri(t){if(cd[t])return cd[t];if(!Ui[t])return t;var r=Ui[t],s;for(s in r)if(r.hasOwnProperty(s)&&s in mp)return cd[t]=r[s];return t}var pp=ri("animationend"),xp=ri("animationiteration"),gp=ri("animationstart"),Uv=ri("transitionrun"),qv=ri("transitionstart"),Yv=ri("transitioncancel"),yp=ri("transitionend"),bp=new Map,ud="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(" ");ud.push("scrollEnd");function ra(t,r){bp.set(t,r),fr(r,[t])}var cc=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Lr=[],qi=0,dd=0;function uc(){for(var t=qi,r=dd=qi=0;r<t;){var s=Lr[r];Lr[r++]=null;var c=Lr[r];Lr[r++]=null;var p=Lr[r];Lr[r++]=null;var y=Lr[r];if(Lr[r++]=null,c!==null&&p!==null){var S=c.pending;S===null?p.next=p:(p.next=S.next,S.next=p),c.pending=p}y!==0&&vp(s,p,y)}}function dc(t,r,s,c){Lr[qi++]=t,Lr[qi++]=r,Lr[qi++]=s,Lr[qi++]=c,dd|=c,t.lanes|=c,t=t.alternate,t!==null&&(t.lanes|=c)}function fd(t,r,s,c){return dc(t,r,s,c),fc(t)}function ai(t,r){return dc(t,null,null,r),fc(t)}function vp(t,r,s){t.lanes|=s;var c=t.alternate;c!==null&&(c.lanes|=s);for(var p=!1,y=t.return;y!==null;)y.childLanes|=s,c=y.alternate,c!==null&&(c.childLanes|=s),y.tag===22&&(t=y.stateNode,t===null||t._visibility&1||(p=!0)),t=y,y=y.return;return t.tag===3?(y=t.stateNode,p&&r!==null&&(p=31-Ve(s),t=y.hiddenUpdates,c=t[p],c===null?t[p]=[r]:c.push(r),r.lane=s|536870912),y):null}function fc(t){if(50<oo)throw oo=0,kf=null,Error(i(185));for(var r=t.return;r!==null;)t=r,r=t.return;return t.tag===3?t.stateNode:null}var Yi={};function Xv(t,r,s,c){this.tag=t,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Nr(t,r,s,c){return new Xv(t,r,s,c)}function hd(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Ia(t,r){var s=t.alternate;return s===null?(s=Nr(t.tag,r,t.key,t.mode),s.elementType=t.elementType,s.type=t.type,s.stateNode=t.stateNode,s.alternate=t,t.alternate=s):(s.pendingProps=r,s.type=t.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=t.flags&65011712,s.childLanes=t.childLanes,s.lanes=t.lanes,s.child=t.child,s.memoizedProps=t.memoizedProps,s.memoizedState=t.memoizedState,s.updateQueue=t.updateQueue,r=t.dependencies,s.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},s.sibling=t.sibling,s.index=t.index,s.ref=t.ref,s.refCleanup=t.refCleanup,s}function wp(t,r){t.flags&=65011714;var s=t.alternate;return s===null?(t.childLanes=0,t.lanes=r,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=s.childLanes,t.lanes=s.lanes,t.child=s.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=s.memoizedProps,t.memoizedState=s.memoizedState,t.updateQueue=s.updateQueue,t.type=s.type,r=s.dependencies,t.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),t}function hc(t,r,s,c,p,y){var S=0;if(c=t,typeof t=="function")hd(t)&&(S=1);else if(typeof t=="string")S=Q2(t,s,de.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case Q:return t=Nr(31,s,r,p),t.elementType=Q,t.lanes=y,t;case k:return li(s.children,p,y,r);case N:S=8,p|=24;break;case C:return t=Nr(12,s,r,p|2),t.elementType=C,t.lanes=y,t;case $:return t=Nr(13,s,r,p),t.elementType=$,t.lanes=y,t;case _:return t=Nr(19,s,r,p),t.elementType=_,t.lanes=y,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case B:S=10;break e;case E:S=9;break e;case R:S=11;break e;case L:S=14;break e;case U:S=16,c=null;break e}S=29,s=Error(i(130,t===null?"null":typeof t,"")),c=null}return r=Nr(S,s,r,p),r.elementType=t,r.type=c,r.lanes=y,r}function li(t,r,s,c){return t=Nr(7,t,c,r),t.lanes=s,t}function md(t,r,s){return t=Nr(6,t,null,r),t.lanes=s,t}function kp(t){var r=Nr(18,null,null,0);return r.stateNode=t,r}function pd(t,r,s){return r=Nr(4,t.children!==null?t.children:[],t.key,r),r.lanes=s,r.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},r}var jp=new WeakMap;function Ir(t,r){if(typeof t=="object"&&t!==null){var s=jp.get(t);return s!==void 0?s:(r={value:t,source:r,stack:jt(r)},jp.set(t,r),r)}return{value:t,source:r,stack:jt(r)}}var Xi=[],Wi=0,mc=null,Hs=0,Hr=[],Ur=0,fl=null,pa=1,xa="";function Ha(t,r){Xi[Wi++]=Hs,Xi[Wi++]=mc,mc=t,Hs=r}function Sp(t,r,s){Hr[Ur++]=pa,Hr[Ur++]=xa,Hr[Ur++]=fl,fl=t;var c=pa;t=xa;var p=32-Ve(c)-1;c&=~(1<<p),s+=1;var y=32-Ve(r)+p;if(30<y){var S=p-p%5;y=(c&(1<<S)-1).toString(32),c>>=S,p-=S,pa=1<<32-Ve(r)+p|s<<p|c,xa=y+t}else pa=1<<y|s<<p|c,xa=t}function xd(t){t.return!==null&&(Ha(t,1),Sp(t,1,0))}function gd(t){for(;t===mc;)mc=Xi[--Wi],Xi[Wi]=null,Hs=Xi[--Wi],Xi[Wi]=null;for(;t===fl;)fl=Hr[--Ur],Hr[Ur]=null,xa=Hr[--Ur],Hr[Ur]=null,pa=Hr[--Ur],Hr[Ur]=null}function Cp(t,r){Hr[Ur++]=pa,Hr[Ur++]=xa,Hr[Ur++]=fl,pa=r.id,xa=r.overflow,fl=t}var Qn=null,mn=null,Lt=!1,hl=null,qr=!1,yd=Error(i(519));function ml(t){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Us(Ir(r,t)),yd}function Np(t){var r=t.stateNode,s=t.type,c=t.memoizedProps;switch(r[xn]=t,r[gn]=c,s){case"dialog":Dt("cancel",r),Dt("close",r);break;case"iframe":case"object":case"embed":Dt("load",r);break;case"video":case"audio":for(s=0;s<uo.length;s++)Dt(uo[s],r);break;case"source":Dt("error",r);break;case"img":case"image":case"link":Dt("error",r),Dt("load",r);break;case"details":Dt("toggle",r);break;case"input":Dt("invalid",r),Sr(r,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":Dt("invalid",r);break;case"textarea":Dt("invalid",r),Ln(r,c.value,c.defaultValue,c.children)}s=c.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||r.textContent===""+s||c.suppressHydrationWarning===!0||q1(r.textContent,s)?(c.popover!=null&&(Dt("beforetoggle",r),Dt("toggle",r)),c.onScroll!=null&&Dt("scroll",r),c.onScrollEnd!=null&&Dt("scrollend",r),c.onClick!=null&&(r.onclick=tr),r=!0):r=!1,r||ml(t,!0)}function Ep(t){for(Qn=t.return;Qn;)switch(Qn.tag){case 5:case 31:case 13:qr=!1;return;case 27:case 3:qr=!0;return;default:Qn=Qn.return}}function Gi(t){if(t!==Qn)return!1;if(!Lt)return Ep(t),Lt=!0,!1;var r=t.tag,s;if((s=r!==3&&r!==27)&&((s=r===5)&&(s=t.type,s=!(s!=="form"&&s!=="button")||Of(t.type,t.memoizedProps)),s=!s),s&&mn&&ml(t),Ep(t),r===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));mn=Z1(t)}else if(r===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));mn=Z1(t)}else r===27?(r=mn,Al(t.type)?(t=Uf,Uf=null,mn=t):mn=r):mn=Qn?Xr(t.stateNode.nextSibling):null;return!0}function ii(){mn=Qn=null,Lt=!1}function bd(){var t=hl;return t!==null&&(yr===null?yr=t:yr.push.apply(yr,t),hl=null),t}function Us(t){hl===null?hl=[t]:hl.push(t)}var vd=F(null),si=null,Ua=null;function pl(t,r,s){T(vd,r._currentValue),r._currentValue=s}function qa(t){t._currentValue=vd.current,W(vd)}function wd(t,r,s){for(;t!==null;){var c=t.alternate;if((t.childLanes&r)!==r?(t.childLanes|=r,c!==null&&(c.childLanes|=r)):c!==null&&(c.childLanes&r)!==r&&(c.childLanes|=r),t===s)break;t=t.return}}function kd(t,r,s,c){var p=t.child;for(p!==null&&(p.return=t);p!==null;){var y=p.dependencies;if(y!==null){var S=p.child;y=y.firstContext;e:for(;y!==null;){var z=y;y=p;for(var X=0;X<r.length;X++)if(z.context===r[X]){y.lanes|=s,z=y.alternate,z!==null&&(z.lanes|=s),wd(y.return,s,t),c||(S=null);break e}y=z.next}}else if(p.tag===18){if(S=p.return,S===null)throw Error(i(341));S.lanes|=s,y=S.alternate,y!==null&&(y.lanes|=s),wd(S,s,t),S=null}else S=p.child;if(S!==null)S.return=p;else for(S=p;S!==null;){if(S===t){S=null;break}if(p=S.sibling,p!==null){p.return=S.return,S=p;break}S=S.return}p=S}}function Vi(t,r,s,c){t=null;for(var p=r,y=!1;p!==null;){if(!y){if((p.flags&524288)!==0)y=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var S=p.alternate;if(S===null)throw Error(i(387));if(S=S.memoizedProps,S!==null){var z=p.type;Cr(p.pendingProps.value,S.value)||(t!==null?t.push(z):t=[z])}}else if(p===Le.current){if(S=p.alternate,S===null)throw Error(i(387));S.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(t!==null?t.push(xo):t=[xo])}p=p.return}t!==null&&kd(r,t,s,c),r.flags|=262144}function pc(t){for(t=t.firstContext;t!==null;){if(!Cr(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function oi(t){si=t,Ua=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Pn(t){return Ap(si,t)}function xc(t,r){return si===null&&oi(t),Ap(t,r)}function Ap(t,r){var s=r._currentValue;if(r={context:r,memoizedValue:s,next:null},Ua===null){if(t===null)throw Error(i(308));Ua=r,t.dependencies={lanes:0,firstContext:r},t.flags|=524288}else Ua=Ua.next=r;return s}var Wv=typeof AbortController<"u"?AbortController:function(){var t=[],r=this.signal={aborted:!1,addEventListener:function(s,c){t.push(c)}};this.abort=function(){r.aborted=!0,t.forEach(function(s){return s()})}},Gv=e.unstable_scheduleCallback,Vv=e.unstable_NormalPriority,Mn={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function jd(){return{controller:new Wv,data:new Map,refCount:0}}function qs(t){t.refCount--,t.refCount===0&&Gv(Vv,function(){t.controller.abort()})}var Ys=null,Sd=0,Ki=0,Qi=null;function Kv(t,r){if(Ys===null){var s=Ys=[];Sd=0,Ki=Af(),Qi={status:"pending",value:void 0,then:function(c){s.push(c)}}}return Sd++,r.then(Dp,Dp),r}function Dp(){if(--Sd===0&&Ys!==null){Qi!==null&&(Qi.status="fulfilled");var t=Ys;Ys=null,Ki=0,Qi=null;for(var r=0;r<t.length;r++)(0,t[r])()}}function Qv(t,r){var s=[],c={status:"pending",value:null,reason:null,then:function(p){s.push(p)}};return t.then(function(){c.status="fulfilled",c.value=r;for(var p=0;p<s.length;p++)(0,s[p])(r)},function(p){for(c.status="rejected",c.reason=p,p=0;p<s.length;p++)(0,s[p])(void 0)}),c}var Tp=Y.S;Y.S=function(t,r){h1=Se(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&Kv(t,r),Tp!==null&&Tp(t,r)};var ci=F(null);function Cd(){var t=ci.current;return t!==null?t:cn.pooledCache}function gc(t,r){r===null?T(ci,ci.current):T(ci,r.pool)}function Fp(){var t=Cd();return t===null?null:{parent:Mn._currentValue,pool:t}}var Pi=Error(i(460)),Nd=Error(i(474)),yc=Error(i(542)),bc={then:function(){}};function Mp(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Rp(t,r,s){switch(s=t[s],s===void 0?t.push(r):s!==r&&(r.then(tr,tr),r=s),r.status){case"fulfilled":return r.value;case"rejected":throw t=r.reason,_p(t),t;default:if(typeof r.status=="string")r.then(tr,tr);else{if(t=cn,t!==null&&100<t.shellSuspendCounter)throw Error(i(482));t=r,t.status="pending",t.then(function(c){if(r.status==="pending"){var p=r;p.status="fulfilled",p.value=c}},function(c){if(r.status==="pending"){var p=r;p.status="rejected",p.reason=c}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw t=r.reason,_p(t),t}throw di=r,Pi}}function ui(t){try{var r=t._init;return r(t._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(di=s,Pi):s}}var di=null;function zp(){if(di===null)throw Error(i(459));var t=di;return di=null,t}function _p(t){if(t===Pi||t===yc)throw Error(i(483))}var Zi=null,Xs=0;function vc(t){var r=Xs;return Xs+=1,Zi===null&&(Zi=[]),Rp(Zi,t,r)}function Ws(t,r){r=r.props.ref,t.ref=r!==void 0?r:null}function wc(t,r){throw r.$$typeof===w?Error(i(525)):(t=Object.prototype.toString.call(r),Error(i(31,t==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":t)))}function Bp(t){function r(ee,K){if(t){var le=ee.deletions;le===null?(ee.deletions=[K],ee.flags|=16):le.push(K)}}function s(ee,K){if(!t)return null;for(;K!==null;)r(ee,K),K=K.sibling;return null}function c(ee){for(var K=new Map;ee!==null;)ee.key!==null?K.set(ee.key,ee):K.set(ee.index,ee),ee=ee.sibling;return K}function p(ee,K){return ee=Ia(ee,K),ee.index=0,ee.sibling=null,ee}function y(ee,K,le){return ee.index=le,t?(le=ee.alternate,le!==null?(le=le.index,le<K?(ee.flags|=67108866,K):le):(ee.flags|=67108866,K)):(ee.flags|=1048576,K)}function S(ee){return t&&ee.alternate===null&&(ee.flags|=67108866),ee}function z(ee,K,le,be){return K===null||K.tag!==6?(K=md(le,ee.mode,be),K.return=ee,K):(K=p(K,le),K.return=ee,K)}function X(ee,K,le,be){var et=le.type;return et===k?pe(ee,K,le.props.children,be,le.key):K!==null&&(K.elementType===et||typeof et=="object"&&et!==null&&et.$$typeof===U&&ui(et)===K.type)?(K=p(K,le.props),Ws(K,le),K.return=ee,K):(K=hc(le.type,le.key,le.props,null,ee.mode,be),Ws(K,le),K.return=ee,K)}function ie(ee,K,le,be){return K===null||K.tag!==4||K.stateNode.containerInfo!==le.containerInfo||K.stateNode.implementation!==le.implementation?(K=pd(le,ee.mode,be),K.return=ee,K):(K=p(K,le.children||[]),K.return=ee,K)}function pe(ee,K,le,be,et){return K===null||K.tag!==7?(K=li(le,ee.mode,be,et),K.return=ee,K):(K=p(K,le),K.return=ee,K)}function Ce(ee,K,le){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return K=md(""+K,ee.mode,le),K.return=ee,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case b:return le=hc(K.type,K.key,K.props,null,ee.mode,le),Ws(le,K),le.return=ee,le;case j:return K=pd(K,ee.mode,le),K.return=ee,K;case U:return K=ui(K),Ce(ee,K,le)}if(te(K)||H(K))return K=li(K,ee.mode,le,null),K.return=ee,K;if(typeof K.then=="function")return Ce(ee,vc(K),le);if(K.$$typeof===B)return Ce(ee,xc(ee,K),le);wc(ee,K)}return null}function oe(ee,K,le,be){var et=K!==null?K.key:null;if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return et!==null?null:z(ee,K,""+le,be);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case b:return le.key===et?X(ee,K,le,be):null;case j:return le.key===et?ie(ee,K,le,be):null;case U:return le=ui(le),oe(ee,K,le,be)}if(te(le)||H(le))return et!==null?null:pe(ee,K,le,be,null);if(typeof le.then=="function")return oe(ee,K,vc(le),be);if(le.$$typeof===B)return oe(ee,K,xc(ee,le),be);wc(ee,le)}return null}function fe(ee,K,le,be,et){if(typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint")return ee=ee.get(le)||null,z(K,ee,""+be,et);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case b:return ee=ee.get(be.key===null?le:be.key)||null,X(K,ee,be,et);case j:return ee=ee.get(be.key===null?le:be.key)||null,ie(K,ee,be,et);case U:return be=ui(be),fe(ee,K,le,be,et)}if(te(be)||H(be))return ee=ee.get(le)||null,pe(K,ee,be,et,null);if(typeof be.then=="function")return fe(ee,K,le,vc(be),et);if(be.$$typeof===B)return fe(ee,K,le,xc(K,be),et);wc(K,be)}return null}function Ue(ee,K,le,be){for(var et=null,qt=null,Ge=K,vt=K=0,Rt=null;Ge!==null&&vt<le.length;vt++){Ge.index>vt?(Rt=Ge,Ge=null):Rt=Ge.sibling;var Yt=oe(ee,Ge,le[vt],be);if(Yt===null){Ge===null&&(Ge=Rt);break}t&&Ge&&Yt.alternate===null&&r(ee,Ge),K=y(Yt,K,vt),qt===null?et=Yt:qt.sibling=Yt,qt=Yt,Ge=Rt}if(vt===le.length)return s(ee,Ge),Lt&&Ha(ee,vt),et;if(Ge===null){for(;vt<le.length;vt++)Ge=Ce(ee,le[vt],be),Ge!==null&&(K=y(Ge,K,vt),qt===null?et=Ge:qt.sibling=Ge,qt=Ge);return Lt&&Ha(ee,vt),et}for(Ge=c(Ge);vt<le.length;vt++)Rt=fe(Ge,ee,vt,le[vt],be),Rt!==null&&(t&&Rt.alternate!==null&&Ge.delete(Rt.key===null?vt:Rt.key),K=y(Rt,K,vt),qt===null?et=Rt:qt.sibling=Rt,qt=Rt);return t&&Ge.forEach(function(Rl){return r(ee,Rl)}),Lt&&Ha(ee,vt),et}function lt(ee,K,le,be){if(le==null)throw Error(i(151));for(var et=null,qt=null,Ge=K,vt=K=0,Rt=null,Yt=le.next();Ge!==null&&!Yt.done;vt++,Yt=le.next()){Ge.index>vt?(Rt=Ge,Ge=null):Rt=Ge.sibling;var Rl=oe(ee,Ge,Yt.value,be);if(Rl===null){Ge===null&&(Ge=Rt);break}t&&Ge&&Rl.alternate===null&&r(ee,Ge),K=y(Rl,K,vt),qt===null?et=Rl:qt.sibling=Rl,qt=Rl,Ge=Rt}if(Yt.done)return s(ee,Ge),Lt&&Ha(ee,vt),et;if(Ge===null){for(;!Yt.done;vt++,Yt=le.next())Yt=Ce(ee,Yt.value,be),Yt!==null&&(K=y(Yt,K,vt),qt===null?et=Yt:qt.sibling=Yt,qt=Yt);return Lt&&Ha(ee,vt),et}for(Ge=c(Ge);!Yt.done;vt++,Yt=le.next())Yt=fe(Ge,ee,vt,Yt.value,be),Yt!==null&&(t&&Yt.alternate!==null&&Ge.delete(Yt.key===null?vt:Yt.key),K=y(Yt,K,vt),qt===null?et=Yt:qt.sibling=Yt,qt=Yt);return t&&Ge.forEach(function(sw){return r(ee,sw)}),Lt&&Ha(ee,vt),et}function rn(ee,K,le,be){if(typeof le=="object"&&le!==null&&le.type===k&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case b:e:{for(var et=le.key;K!==null;){if(K.key===et){if(et=le.type,et===k){if(K.tag===7){s(ee,K.sibling),be=p(K,le.props.children),be.return=ee,ee=be;break e}}else if(K.elementType===et||typeof et=="object"&&et!==null&&et.$$typeof===U&&ui(et)===K.type){s(ee,K.sibling),be=p(K,le.props),Ws(be,le),be.return=ee,ee=be;break e}s(ee,K);break}else r(ee,K);K=K.sibling}le.type===k?(be=li(le.props.children,ee.mode,be,le.key),be.return=ee,ee=be):(be=hc(le.type,le.key,le.props,null,ee.mode,be),Ws(be,le),be.return=ee,ee=be)}return S(ee);case j:e:{for(et=le.key;K!==null;){if(K.key===et)if(K.tag===4&&K.stateNode.containerInfo===le.containerInfo&&K.stateNode.implementation===le.implementation){s(ee,K.sibling),be=p(K,le.children||[]),be.return=ee,ee=be;break e}else{s(ee,K);break}else r(ee,K);K=K.sibling}be=pd(le,ee.mode,be),be.return=ee,ee=be}return S(ee);case U:return le=ui(le),rn(ee,K,le,be)}if(te(le))return Ue(ee,K,le,be);if(H(le)){if(et=H(le),typeof et!="function")throw Error(i(150));return le=et.call(le),lt(ee,K,le,be)}if(typeof le.then=="function")return rn(ee,K,vc(le),be);if(le.$$typeof===B)return rn(ee,K,xc(ee,le),be);wc(ee,le)}return typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint"?(le=""+le,K!==null&&K.tag===6?(s(ee,K.sibling),be=p(K,le),be.return=ee,ee=be):(s(ee,K),be=md(le,ee.mode,be),be.return=ee,ee=be),S(ee)):s(ee,K)}return function(ee,K,le,be){try{Xs=0;var et=rn(ee,K,le,be);return Zi=null,et}catch(Ge){if(Ge===Pi||Ge===yc)throw Ge;var qt=Nr(29,Ge,null,ee.mode);return qt.lanes=be,qt.return=ee,qt}finally{}}}var fi=Bp(!0),Op=Bp(!1),xl=!1;function Ed(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ad(t,r){t=t.updateQueue,r.updateQueue===t&&(r.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function gl(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function yl(t,r,s){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(Vt&2)!==0){var p=c.pending;return p===null?r.next=r:(r.next=p.next,p.next=r),c.pending=r,r=fc(t),vp(t,null,s),r}return dc(t,c,r,s),fc(t)}function Gs(t,r,s){if(r=r.updateQueue,r!==null&&(r=r.shared,(s&4194048)!==0)){var c=r.lanes;c&=t.pendingLanes,s|=c,r.lanes=s,sn(t,s)}}function Dd(t,r){var s=t.updateQueue,c=t.alternate;if(c!==null&&(c=c.updateQueue,s===c)){var p=null,y=null;if(s=s.firstBaseUpdate,s!==null){do{var S={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};y===null?p=y=S:y=y.next=S,s=s.next}while(s!==null);y===null?p=y=r:y=y.next=r}else p=y=r;s={baseState:c.baseState,firstBaseUpdate:p,lastBaseUpdate:y,shared:c.shared,callbacks:c.callbacks},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=r:t.next=r,s.lastBaseUpdate=r}var Td=!1;function Vs(){if(Td){var t=Qi;if(t!==null)throw t}}function Ks(t,r,s,c){Td=!1;var p=t.updateQueue;xl=!1;var y=p.firstBaseUpdate,S=p.lastBaseUpdate,z=p.shared.pending;if(z!==null){p.shared.pending=null;var X=z,ie=X.next;X.next=null,S===null?y=ie:S.next=ie,S=X;var pe=t.alternate;pe!==null&&(pe=pe.updateQueue,z=pe.lastBaseUpdate,z!==S&&(z===null?pe.firstBaseUpdate=ie:z.next=ie,pe.lastBaseUpdate=X))}if(y!==null){var Ce=p.baseState;S=0,pe=ie=X=null,z=y;do{var oe=z.lane&-536870913,fe=oe!==z.lane;if(fe?(Mt&oe)===oe:(c&oe)===oe){oe!==0&&oe===Ki&&(Td=!0),pe!==null&&(pe=pe.next={lane:0,tag:z.tag,payload:z.payload,callback:null,next:null});e:{var Ue=t,lt=z;oe=r;var rn=s;switch(lt.tag){case 1:if(Ue=lt.payload,typeof Ue=="function"){Ce=Ue.call(rn,Ce,oe);break e}Ce=Ue;break e;case 3:Ue.flags=Ue.flags&-65537|128;case 0:if(Ue=lt.payload,oe=typeof Ue=="function"?Ue.call(rn,Ce,oe):Ue,oe==null)break e;Ce=g({},Ce,oe);break e;case 2:xl=!0}}oe=z.callback,oe!==null&&(t.flags|=64,fe&&(t.flags|=8192),fe=p.callbacks,fe===null?p.callbacks=[oe]:fe.push(oe))}else fe={lane:oe,tag:z.tag,payload:z.payload,callback:z.callback,next:null},pe===null?(ie=pe=fe,X=Ce):pe=pe.next=fe,S|=oe;if(z=z.next,z===null){if(z=p.shared.pending,z===null)break;fe=z,z=fe.next,fe.next=null,p.lastBaseUpdate=fe,p.shared.pending=null}}while(!0);pe===null&&(X=Ce),p.baseState=X,p.firstBaseUpdate=ie,p.lastBaseUpdate=pe,y===null&&(p.shared.lanes=0),jl|=S,t.lanes=S,t.memoizedState=Ce}}function $p(t,r){if(typeof t!="function")throw Error(i(191,t));t.call(r)}function Lp(t,r){var s=t.callbacks;if(s!==null)for(t.callbacks=null,t=0;t<s.length;t++)$p(s[t],r)}var Ji=F(null),kc=F(0);function Ip(t,r){t=Za,T(kc,t),T(Ji,r),Za=t|r.baseLanes}function Fd(){T(kc,Za),T(Ji,Ji.current)}function Md(){Za=kc.current,W(Ji),W(kc)}var Er=F(null),Yr=null;function bl(t){var r=t.alternate;T(En,En.current&1),T(Er,t),Yr===null&&(r===null||Ji.current!==null||r.memoizedState!==null)&&(Yr=t)}function Rd(t){T(En,En.current),T(Er,t),Yr===null&&(Yr=t)}function Hp(t){t.tag===22?(T(En,En.current),T(Er,t),Yr===null&&(Yr=t)):vl()}function vl(){T(En,En.current),T(Er,Er.current)}function Ar(t){W(Er),Yr===t&&(Yr=null),W(En)}var En=F(0);function jc(t){for(var r=t;r!==null;){if(r.tag===13){var s=r.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||If(s)||Hf(s)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Ya=0,gt=null,tn=null,Rn=null,Sc=!1,es=!1,hi=!1,Cc=0,Qs=0,ts=null,Pv=0;function Sn(){throw Error(i(321))}function zd(t,r){if(r===null)return!1;for(var s=0;s<r.length&&s<t.length;s++)if(!Cr(t[s],r[s]))return!1;return!0}function _d(t,r,s,c,p,y){return Ya=y,gt=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,Y.H=t===null||t.memoizedState===null?Sx:Qd,hi=!1,y=s(c,p),hi=!1,es&&(y=qp(r,s,c,p)),Up(t),y}function Up(t){Y.H=Js;var r=tn!==null&&tn.next!==null;if(Ya=0,Rn=tn=gt=null,Sc=!1,Qs=0,ts=null,r)throw Error(i(300));t===null||zn||(t=t.dependencies,t!==null&&pc(t)&&(zn=!0))}function qp(t,r,s,c){gt=t;var p=0;do{if(es&&(ts=null),Qs=0,es=!1,25<=p)throw Error(i(301));if(p+=1,Rn=tn=null,t.updateQueue!=null){var y=t.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}Y.H=Cx,y=r(s,c)}while(es);return y}function Zv(){var t=Y.H,r=t.useState()[0];return r=typeof r.then=="function"?Ps(r):r,t=t.useState()[0],(tn!==null?tn.memoizedState:null)!==t&&(gt.flags|=1024),r}function Bd(){var t=Cc!==0;return Cc=0,t}function Od(t,r,s){r.updateQueue=t.updateQueue,r.flags&=-2053,t.lanes&=~s}function $d(t){if(Sc){for(t=t.memoizedState;t!==null;){var r=t.queue;r!==null&&(r.pending=null),t=t.next}Sc=!1}Ya=0,Rn=tn=gt=null,es=!1,Qs=Cc=0,ts=null}function ir(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rn===null?gt.memoizedState=Rn=t:Rn=Rn.next=t,Rn}function An(){if(tn===null){var t=gt.alternate;t=t!==null?t.memoizedState:null}else t=tn.next;var r=Rn===null?gt.memoizedState:Rn.next;if(r!==null)Rn=r,tn=t;else{if(t===null)throw gt.alternate===null?Error(i(467)):Error(i(310));tn=t,t={memoizedState:tn.memoizedState,baseState:tn.baseState,baseQueue:tn.baseQueue,queue:tn.queue,next:null},Rn===null?gt.memoizedState=Rn=t:Rn=Rn.next=t}return Rn}function Nc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ps(t){var r=Qs;return Qs+=1,ts===null&&(ts=[]),t=Rp(ts,t,r),r=gt,(Rn===null?r.memoizedState:Rn.next)===null&&(r=r.alternate,Y.H=r===null||r.memoizedState===null?Sx:Qd),t}function Ec(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Ps(t);if(t.$$typeof===B)return Pn(t)}throw Error(i(438,String(t)))}function Ld(t){var r=null,s=gt.updateQueue;if(s!==null&&(r=s.memoCache),r==null){var c=gt.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(r={data:c.data.map(function(p){return p.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),s===null&&(s=Nc(),gt.updateQueue=s),s.memoCache=r,s=r.data[r.index],s===void 0)for(s=r.data[r.index]=Array(t),c=0;c<t;c++)s[c]=D;return r.index++,s}function Xa(t,r){return typeof r=="function"?r(t):r}function Ac(t){var r=An();return Id(r,tn,t)}function Id(t,r,s){var c=t.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=s;var p=t.baseQueue,y=c.pending;if(y!==null){if(p!==null){var S=p.next;p.next=y.next,y.next=S}r.baseQueue=p=y,c.pending=null}if(y=t.baseState,p===null)t.memoizedState=y;else{r=p.next;var z=S=null,X=null,ie=r,pe=!1;do{var Ce=ie.lane&-536870913;if(Ce!==ie.lane?(Mt&Ce)===Ce:(Ya&Ce)===Ce){var oe=ie.revertLane;if(oe===0)X!==null&&(X=X.next={lane:0,revertLane:0,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),Ce===Ki&&(pe=!0);else if((Ya&oe)===oe){ie=ie.next,oe===Ki&&(pe=!0);continue}else Ce={lane:0,revertLane:ie.revertLane,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},X===null?(z=X=Ce,S=y):X=X.next=Ce,gt.lanes|=oe,jl|=oe;Ce=ie.action,hi&&s(y,Ce),y=ie.hasEagerState?ie.eagerState:s(y,Ce)}else oe={lane:Ce,revertLane:ie.revertLane,gesture:ie.gesture,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},X===null?(z=X=oe,S=y):X=X.next=oe,gt.lanes|=Ce,jl|=Ce;ie=ie.next}while(ie!==null&&ie!==r);if(X===null?S=y:X.next=z,!Cr(y,t.memoizedState)&&(zn=!0,pe&&(s=Qi,s!==null)))throw s;t.memoizedState=y,t.baseState=S,t.baseQueue=X,c.lastRenderedState=y}return p===null&&(c.lanes=0),[t.memoizedState,c.dispatch]}function Hd(t){var r=An(),s=r.queue;if(s===null)throw Error(i(311));s.lastRenderedReducer=t;var c=s.dispatch,p=s.pending,y=r.memoizedState;if(p!==null){s.pending=null;var S=p=p.next;do y=t(y,S.action),S=S.next;while(S!==p);Cr(y,r.memoizedState)||(zn=!0),r.memoizedState=y,r.baseQueue===null&&(r.baseState=y),s.lastRenderedState=y}return[y,c]}function Yp(t,r,s){var c=gt,p=An(),y=Lt;if(y){if(s===void 0)throw Error(i(407));s=s()}else s=r();var S=!Cr((tn||p).memoizedState,s);if(S&&(p.memoizedState=s,zn=!0),p=p.queue,Yd(Gp.bind(null,c,p,t),[t]),p.getSnapshot!==r||S||Rn!==null&&Rn.memoizedState.tag&1){if(c.flags|=2048,ns(9,{destroy:void 0},Wp.bind(null,c,p,s,r),null),cn===null)throw Error(i(349));y||(Ya&127)!==0||Xp(c,r,s)}return s}function Xp(t,r,s){t.flags|=16384,t={getSnapshot:r,value:s},r=gt.updateQueue,r===null?(r=Nc(),gt.updateQueue=r,r.stores=[t]):(s=r.stores,s===null?r.stores=[t]:s.push(t))}function Wp(t,r,s,c){r.value=s,r.getSnapshot=c,Vp(r)&&Kp(t)}function Gp(t,r,s){return s(function(){Vp(r)&&Kp(t)})}function Vp(t){var r=t.getSnapshot;t=t.value;try{var s=r();return!Cr(t,s)}catch{return!0}}function Kp(t){var r=ai(t,2);r!==null&&br(r,t,2)}function Ud(t){var r=ir();if(typeof t=="function"){var s=t;if(t=s(),hi){rt(!0);try{s()}finally{rt(!1)}}}return r.memoizedState=r.baseState=t,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xa,lastRenderedState:t},r}function Qp(t,r,s,c){return t.baseState=s,Id(t,tn,typeof c=="function"?c:Xa)}function Jv(t,r,s,c,p){if(Fc(t))throw Error(i(485));if(t=r.action,t!==null){var y={payload:p,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){y.listeners.push(S)}};Y.T!==null?s(!0):y.isTransition=!1,c(y),s=r.pending,s===null?(y.next=r.pending=y,Pp(r,y)):(y.next=s.next,r.pending=s.next=y)}}function Pp(t,r){var s=r.action,c=r.payload,p=t.state;if(r.isTransition){var y=Y.T,S={};Y.T=S;try{var z=s(p,c),X=Y.S;X!==null&&X(S,z),Zp(t,r,z)}catch(ie){qd(t,r,ie)}finally{y!==null&&S.types!==null&&(y.types=S.types),Y.T=y}}else try{y=s(p,c),Zp(t,r,y)}catch(ie){qd(t,r,ie)}}function Zp(t,r,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(c){Jp(t,r,c)},function(c){return qd(t,r,c)}):Jp(t,r,s)}function Jp(t,r,s){r.status="fulfilled",r.value=s,ex(r),t.state=s,r=t.pending,r!==null&&(s=r.next,s===r?t.pending=null:(s=s.next,r.next=s,Pp(t,s)))}function qd(t,r,s){var c=t.pending;if(t.pending=null,c!==null){c=c.next;do r.status="rejected",r.reason=s,ex(r),r=r.next;while(r!==c)}t.action=null}function ex(t){t=t.listeners;for(var r=0;r<t.length;r++)(0,t[r])()}function tx(t,r){return r}function nx(t,r){if(Lt){var s=cn.formState;if(s!==null){e:{var c=gt;if(Lt){if(mn){t:{for(var p=mn,y=qr;p.nodeType!==8;){if(!y){p=null;break t}if(p=Xr(p.nextSibling),p===null){p=null;break t}}y=p.data,p=y==="F!"||y==="F"?p:null}if(p){mn=Xr(p.nextSibling),c=p.data==="F!";break e}}ml(c)}c=!1}c&&(r=s[0])}}return s=ir(),s.memoizedState=s.baseState=r,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tx,lastRenderedState:r},s.queue=c,s=wx.bind(null,gt,c),c.dispatch=s,c=Ud(!1),y=Kd.bind(null,gt,!1,c.queue),c=ir(),p={state:r,dispatch:null,action:t,pending:null},c.queue=p,s=Jv.bind(null,gt,p,y,s),p.dispatch=s,c.memoizedState=t,[r,s,!1]}function rx(t){var r=An();return ax(r,tn,t)}function ax(t,r,s){if(r=Id(t,r,tx)[0],t=Ac(Xa)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var c=Ps(r)}catch(S){throw S===Pi?yc:S}else c=r;r=An();var p=r.queue,y=p.dispatch;return s!==r.memoizedState&&(gt.flags|=2048,ns(9,{destroy:void 0},e2.bind(null,p,s),null)),[c,y,t]}function e2(t,r){t.action=r}function lx(t){var r=An(),s=tn;if(s!==null)return ax(r,s,t);An(),r=r.memoizedState,s=An();var c=s.queue.dispatch;return s.memoizedState=t,[r,c,!1]}function ns(t,r,s,c){return t={tag:t,create:s,deps:c,inst:r,next:null},r=gt.updateQueue,r===null&&(r=Nc(),gt.updateQueue=r),s=r.lastEffect,s===null?r.lastEffect=t.next=t:(c=s.next,s.next=t,t.next=c,r.lastEffect=t),t}function ix(){return An().memoizedState}function Dc(t,r,s,c){var p=ir();gt.flags|=t,p.memoizedState=ns(1|r,{destroy:void 0},s,c===void 0?null:c)}function Tc(t,r,s,c){var p=An();c=c===void 0?null:c;var y=p.memoizedState.inst;tn!==null&&c!==null&&zd(c,tn.memoizedState.deps)?p.memoizedState=ns(r,y,s,c):(gt.flags|=t,p.memoizedState=ns(1|r,y,s,c))}function sx(t,r){Dc(8390656,8,t,r)}function Yd(t,r){Tc(2048,8,t,r)}function t2(t){gt.flags|=4;var r=gt.updateQueue;if(r===null)r=Nc(),gt.updateQueue=r,r.events=[t];else{var s=r.events;s===null?r.events=[t]:s.push(t)}}function ox(t){var r=An().memoizedState;return t2({ref:r,nextImpl:t}),function(){if((Vt&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function cx(t,r){return Tc(4,2,t,r)}function ux(t,r){return Tc(4,4,t,r)}function dx(t,r){if(typeof r=="function"){t=t();var s=r(t);return function(){typeof s=="function"?s():r(null)}}if(r!=null)return t=t(),r.current=t,function(){r.current=null}}function fx(t,r,s){s=s!=null?s.concat([t]):null,Tc(4,4,dx.bind(null,r,t),s)}function Xd(){}function hx(t,r){var s=An();r=r===void 0?null:r;var c=s.memoizedState;return r!==null&&zd(r,c[1])?c[0]:(s.memoizedState=[t,r],t)}function mx(t,r){var s=An();r=r===void 0?null:r;var c=s.memoizedState;if(r!==null&&zd(r,c[1]))return c[0];if(c=t(),hi){rt(!0);try{t()}finally{rt(!1)}}return s.memoizedState=[c,r],c}function Wd(t,r,s){return s===void 0||(Ya&1073741824)!==0&&(Mt&261930)===0?t.memoizedState=r:(t.memoizedState=s,t=p1(),gt.lanes|=t,jl|=t,s)}function px(t,r,s,c){return Cr(s,r)?s:Ji.current!==null?(t=Wd(t,s,c),Cr(t,r)||(zn=!0),t):(Ya&42)===0||(Ya&1073741824)!==0&&(Mt&261930)===0?(zn=!0,t.memoizedState=s):(t=p1(),gt.lanes|=t,jl|=t,r)}function xx(t,r,s,c,p){var y=se.p;se.p=y!==0&&8>y?y:8;var S=Y.T,z={};Y.T=z,Kd(t,!1,r,s);try{var X=p(),ie=Y.S;if(ie!==null&&ie(z,X),X!==null&&typeof X=="object"&&typeof X.then=="function"){var pe=Qv(X,c);Zs(t,r,pe,Fr(t))}else Zs(t,r,c,Fr(t))}catch(Ce){Zs(t,r,{then:function(){},status:"rejected",reason:Ce},Fr())}finally{se.p=y,S!==null&&z.types!==null&&(S.types=z.types),Y.T=S}}function n2(){}function Gd(t,r,s,c){if(t.tag!==5)throw Error(i(476));var p=gx(t).queue;xx(t,p,r,J,s===null?n2:function(){return yx(t),s(c)})}function gx(t){var r=t.memoizedState;if(r!==null)return r;r={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xa,lastRenderedState:J},next:null};var s={};return r.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xa,lastRenderedState:s},next:null},t.memoizedState=r,t=t.alternate,t!==null&&(t.memoizedState=r),r}function yx(t){var r=gx(t);r.next===null&&(r=t.alternate.memoizedState),Zs(t,r.next.queue,{},Fr())}function Vd(){return Pn(xo)}function bx(){return An().memoizedState}function vx(){return An().memoizedState}function r2(t){for(var r=t.return;r!==null;){switch(r.tag){case 24:case 3:var s=Fr();t=gl(s);var c=yl(r,t,s);c!==null&&(br(c,r,s),Gs(c,r,s)),r={cache:jd()},t.payload=r;return}r=r.return}}function a2(t,r,s){var c=Fr();s={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Fc(t)?kx(r,s):(s=fd(t,r,s,c),s!==null&&(br(s,t,c),jx(s,r,c)))}function wx(t,r,s){var c=Fr();Zs(t,r,s,c)}function Zs(t,r,s,c){var p={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Fc(t))kx(r,p);else{var y=t.alternate;if(t.lanes===0&&(y===null||y.lanes===0)&&(y=r.lastRenderedReducer,y!==null))try{var S=r.lastRenderedState,z=y(S,s);if(p.hasEagerState=!0,p.eagerState=z,Cr(z,S))return dc(t,r,p,0),cn===null&&uc(),!1}catch{}finally{}if(s=fd(t,r,p,c),s!==null)return br(s,t,c),jx(s,r,c),!0}return!1}function Kd(t,r,s,c){if(c={lane:2,revertLane:Af(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Fc(t)){if(r)throw Error(i(479))}else r=fd(t,s,c,2),r!==null&&br(r,t,2)}function Fc(t){var r=t.alternate;return t===gt||r!==null&&r===gt}function kx(t,r){es=Sc=!0;var s=t.pending;s===null?r.next=r:(r.next=s.next,s.next=r),t.pending=r}function jx(t,r,s){if((s&4194048)!==0){var c=r.lanes;c&=t.pendingLanes,s|=c,r.lanes=s,sn(t,s)}}var Js={readContext:Pn,use:Ec,useCallback:Sn,useContext:Sn,useEffect:Sn,useImperativeHandle:Sn,useLayoutEffect:Sn,useInsertionEffect:Sn,useMemo:Sn,useReducer:Sn,useRef:Sn,useState:Sn,useDebugValue:Sn,useDeferredValue:Sn,useTransition:Sn,useSyncExternalStore:Sn,useId:Sn,useHostTransitionStatus:Sn,useFormState:Sn,useActionState:Sn,useOptimistic:Sn,useMemoCache:Sn,useCacheRefresh:Sn};Js.useEffectEvent=Sn;var Sx={readContext:Pn,use:Ec,useCallback:function(t,r){return ir().memoizedState=[t,r===void 0?null:r],t},useContext:Pn,useEffect:sx,useImperativeHandle:function(t,r,s){s=s!=null?s.concat([t]):null,Dc(4194308,4,dx.bind(null,r,t),s)},useLayoutEffect:function(t,r){return Dc(4194308,4,t,r)},useInsertionEffect:function(t,r){Dc(4,2,t,r)},useMemo:function(t,r){var s=ir();r=r===void 0?null:r;var c=t();if(hi){rt(!0);try{t()}finally{rt(!1)}}return s.memoizedState=[c,r],c},useReducer:function(t,r,s){var c=ir();if(s!==void 0){var p=s(r);if(hi){rt(!0);try{s(r)}finally{rt(!1)}}}else p=r;return c.memoizedState=c.baseState=p,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:p},c.queue=t,t=t.dispatch=a2.bind(null,gt,t),[c.memoizedState,t]},useRef:function(t){var r=ir();return t={current:t},r.memoizedState=t},useState:function(t){t=Ud(t);var r=t.queue,s=wx.bind(null,gt,r);return r.dispatch=s,[t.memoizedState,s]},useDebugValue:Xd,useDeferredValue:function(t,r){var s=ir();return Wd(s,t,r)},useTransition:function(){var t=Ud(!1);return t=xx.bind(null,gt,t.queue,!0,!1),ir().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,r,s){var c=gt,p=ir();if(Lt){if(s===void 0)throw Error(i(407));s=s()}else{if(s=r(),cn===null)throw Error(i(349));(Mt&127)!==0||Xp(c,r,s)}p.memoizedState=s;var y={value:s,getSnapshot:r};return p.queue=y,sx(Gp.bind(null,c,y,t),[t]),c.flags|=2048,ns(9,{destroy:void 0},Wp.bind(null,c,y,s,r),null),s},useId:function(){var t=ir(),r=cn.identifierPrefix;if(Lt){var s=xa,c=pa;s=(c&~(1<<32-Ve(c)-1)).toString(32)+s,r="_"+r+"R_"+s,s=Cc++,0<s&&(r+="H"+s.toString(32)),r+="_"}else s=Pv++,r="_"+r+"r_"+s.toString(32)+"_";return t.memoizedState=r},useHostTransitionStatus:Vd,useFormState:nx,useActionState:nx,useOptimistic:function(t){var r=ir();r.memoizedState=r.baseState=t;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=s,r=Kd.bind(null,gt,!0,s),s.dispatch=r,[t,r]},useMemoCache:Ld,useCacheRefresh:function(){return ir().memoizedState=r2.bind(null,gt)},useEffectEvent:function(t){var r=ir(),s={impl:t};return r.memoizedState=s,function(){if((Vt&2)!==0)throw Error(i(440));return s.impl.apply(void 0,arguments)}}},Qd={readContext:Pn,use:Ec,useCallback:hx,useContext:Pn,useEffect:Yd,useImperativeHandle:fx,useInsertionEffect:cx,useLayoutEffect:ux,useMemo:mx,useReducer:Ac,useRef:ix,useState:function(){return Ac(Xa)},useDebugValue:Xd,useDeferredValue:function(t,r){var s=An();return px(s,tn.memoizedState,t,r)},useTransition:function(){var t=Ac(Xa)[0],r=An().memoizedState;return[typeof t=="boolean"?t:Ps(t),r]},useSyncExternalStore:Yp,useId:bx,useHostTransitionStatus:Vd,useFormState:rx,useActionState:rx,useOptimistic:function(t,r){var s=An();return Qp(s,tn,t,r)},useMemoCache:Ld,useCacheRefresh:vx};Qd.useEffectEvent=ox;var Cx={readContext:Pn,use:Ec,useCallback:hx,useContext:Pn,useEffect:Yd,useImperativeHandle:fx,useInsertionEffect:cx,useLayoutEffect:ux,useMemo:mx,useReducer:Hd,useRef:ix,useState:function(){return Hd(Xa)},useDebugValue:Xd,useDeferredValue:function(t,r){var s=An();return tn===null?Wd(s,t,r):px(s,tn.memoizedState,t,r)},useTransition:function(){var t=Hd(Xa)[0],r=An().memoizedState;return[typeof t=="boolean"?t:Ps(t),r]},useSyncExternalStore:Yp,useId:bx,useHostTransitionStatus:Vd,useFormState:lx,useActionState:lx,useOptimistic:function(t,r){var s=An();return tn!==null?Qp(s,tn,t,r):(s.baseState=t,[t,s.queue.dispatch])},useMemoCache:Ld,useCacheRefresh:vx};Cx.useEffectEvent=ox;function Pd(t,r,s,c){r=t.memoizedState,s=s(c,r),s=s==null?r:g({},r,s),t.memoizedState=s,t.lanes===0&&(t.updateQueue.baseState=s)}var Zd={enqueueSetState:function(t,r,s){t=t._reactInternals;var c=Fr(),p=gl(c);p.payload=r,s!=null&&(p.callback=s),r=yl(t,p,c),r!==null&&(br(r,t,c),Gs(r,t,c))},enqueueReplaceState:function(t,r,s){t=t._reactInternals;var c=Fr(),p=gl(c);p.tag=1,p.payload=r,s!=null&&(p.callback=s),r=yl(t,p,c),r!==null&&(br(r,t,c),Gs(r,t,c))},enqueueForceUpdate:function(t,r){t=t._reactInternals;var s=Fr(),c=gl(s);c.tag=2,r!=null&&(c.callback=r),r=yl(t,c,s),r!==null&&(br(r,t,s),Gs(r,t,s))}};function Nx(t,r,s,c,p,y,S){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(c,y,S):r.prototype&&r.prototype.isPureReactComponent?!Ls(s,c)||!Ls(p,y):!0}function Ex(t,r,s,c){t=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(s,c),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(s,c),r.state!==t&&Zd.enqueueReplaceState(r,r.state,null)}function mi(t,r){var s=r;if("ref"in r){s={};for(var c in r)c!=="ref"&&(s[c]=r[c])}if(t=t.defaultProps){s===r&&(s=g({},s));for(var p in t)s[p]===void 0&&(s[p]=t[p])}return s}function Ax(t){cc(t)}function Dx(t){console.error(t)}function Tx(t){cc(t)}function Mc(t,r){try{var s=t.onUncaughtError;s(r.value,{componentStack:r.stack})}catch(c){setTimeout(function(){throw c})}}function Fx(t,r,s){try{var c=t.onCaughtError;c(s.value,{componentStack:s.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function Jd(t,r,s){return s=gl(s),s.tag=3,s.payload={element:null},s.callback=function(){Mc(t,r)},s}function Mx(t){return t=gl(t),t.tag=3,t}function Rx(t,r,s,c){var p=s.type.getDerivedStateFromError;if(typeof p=="function"){var y=c.value;t.payload=function(){return p(y)},t.callback=function(){Fx(r,s,c)}}var S=s.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(t.callback=function(){Fx(r,s,c),typeof p!="function"&&(Sl===null?Sl=new Set([this]):Sl.add(this));var z=c.stack;this.componentDidCatch(c.value,{componentStack:z!==null?z:""})})}function l2(t,r,s,c,p){if(s.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(r=s.alternate,r!==null&&Vi(r,s,p,!0),s=Er.current,s!==null){switch(s.tag){case 31:case 13:return Yr===null?Yc():s.alternate===null&&Cn===0&&(Cn=3),s.flags&=-257,s.flags|=65536,s.lanes=p,c===bc?s.flags|=16384:(r=s.updateQueue,r===null?s.updateQueue=new Set([c]):r.add(c),Cf(t,c,p)),!1;case 22:return s.flags|=65536,c===bc?s.flags|=16384:(r=s.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([c])},s.updateQueue=r):(s=r.retryQueue,s===null?r.retryQueue=new Set([c]):s.add(c)),Cf(t,c,p)),!1}throw Error(i(435,s.tag))}return Cf(t,c,p),Yc(),!1}if(Lt)return r=Er.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=p,c!==yd&&(t=Error(i(422),{cause:c}),Us(Ir(t,s)))):(c!==yd&&(r=Error(i(423),{cause:c}),Us(Ir(r,s))),t=t.current.alternate,t.flags|=65536,p&=-p,t.lanes|=p,c=Ir(c,s),p=Jd(t.stateNode,c,p),Dd(t,p),Cn!==4&&(Cn=2)),!1;var y=Error(i(520),{cause:c});if(y=Ir(y,s),so===null?so=[y]:so.push(y),Cn!==4&&(Cn=2),r===null)return!0;c=Ir(c,s),s=r;do{switch(s.tag){case 3:return s.flags|=65536,t=p&-p,s.lanes|=t,t=Jd(s.stateNode,c,t),Dd(s,t),!1;case 1:if(r=s.type,y=s.stateNode,(s.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Sl===null||!Sl.has(y))))return s.flags|=65536,p&=-p,s.lanes|=p,p=Mx(p),Rx(p,t,s,c),Dd(s,p),!1}s=s.return}while(s!==null);return!1}var ef=Error(i(461)),zn=!1;function Zn(t,r,s,c){r.child=t===null?Op(r,null,s,c):fi(r,t.child,s,c)}function zx(t,r,s,c,p){s=s.render;var y=r.ref;if("ref"in c){var S={};for(var z in c)z!=="ref"&&(S[z]=c[z])}else S=c;return oi(r),c=_d(t,r,s,S,y,p),z=Bd(),t!==null&&!zn?(Od(t,r,p),Wa(t,r,p)):(Lt&&z&&xd(r),r.flags|=1,Zn(t,r,c,p),r.child)}function _x(t,r,s,c,p){if(t===null){var y=s.type;return typeof y=="function"&&!hd(y)&&y.defaultProps===void 0&&s.compare===null?(r.tag=15,r.type=y,Bx(t,r,y,c,p)):(t=hc(s.type,null,c,r,r.mode,p),t.ref=r.ref,t.return=r,r.child=t)}if(y=t.child,!cf(t,p)){var S=y.memoizedProps;if(s=s.compare,s=s!==null?s:Ls,s(S,c)&&t.ref===r.ref)return Wa(t,r,p)}return r.flags|=1,t=Ia(y,c),t.ref=r.ref,t.return=r,r.child=t}function Bx(t,r,s,c,p){if(t!==null){var y=t.memoizedProps;if(Ls(y,c)&&t.ref===r.ref)if(zn=!1,r.pendingProps=c=y,cf(t,p))(t.flags&131072)!==0&&(zn=!0);else return r.lanes=t.lanes,Wa(t,r,p)}return tf(t,r,s,c,p)}function Ox(t,r,s,c){var p=c.children,y=t!==null?t.memoizedState:null;if(t===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((r.flags&128)!==0){if(y=y!==null?y.baseLanes|s:s,t!==null){for(c=r.child=t.child,p=0;c!==null;)p=p|c.lanes|c.childLanes,c=c.sibling;c=p&~y}else c=0,r.child=null;return $x(t,r,y,s,c)}if((s&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},t!==null&&gc(r,y!==null?y.cachePool:null),y!==null?Ip(r,y):Fd(),Hp(r);else return c=r.lanes=536870912,$x(t,r,y!==null?y.baseLanes|s:s,s,c)}else y!==null?(gc(r,y.cachePool),Ip(r,y),vl(),r.memoizedState=null):(t!==null&&gc(r,null),Fd(),vl());return Zn(t,r,p,s),r.child}function eo(t,r){return t!==null&&t.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function $x(t,r,s,c,p){var y=Cd();return y=y===null?null:{parent:Mn._currentValue,pool:y},r.memoizedState={baseLanes:s,cachePool:y},t!==null&&gc(r,null),Fd(),Hp(r),t!==null&&Vi(t,r,c,!0),r.childLanes=p,null}function Rc(t,r){return r=_c({mode:r.mode,children:r.children},t.mode),r.ref=t.ref,t.child=r,r.return=t,r}function Lx(t,r,s){return fi(r,t.child,null,s),t=Rc(r,r.pendingProps),t.flags|=2,Ar(r),r.memoizedState=null,t}function i2(t,r,s){var c=r.pendingProps,p=(r.flags&128)!==0;if(r.flags&=-129,t===null){if(Lt){if(c.mode==="hidden")return t=Rc(r,c),r.lanes=536870912,eo(null,t);if(Rd(r),(t=mn)?(t=P1(t,qr),t=t!==null&&t.data==="&"?t:null,t!==null&&(r.memoizedState={dehydrated:t,treeContext:fl!==null?{id:pa,overflow:xa}:null,retryLane:536870912,hydrationErrors:null},s=kp(t),s.return=r,r.child=s,Qn=r,mn=null)):t=null,t===null)throw ml(r);return r.lanes=536870912,null}return Rc(r,c)}var y=t.memoizedState;if(y!==null){var S=y.dehydrated;if(Rd(r),p)if(r.flags&256)r.flags&=-257,r=Lx(t,r,s);else if(r.memoizedState!==null)r.child=t.child,r.flags|=128,r=null;else throw Error(i(558));else if(zn||Vi(t,r,s,!1),p=(s&t.childLanes)!==0,zn||p){if(c=cn,c!==null&&(S=re(c,s),S!==0&&S!==y.retryLane))throw y.retryLane=S,ai(t,S),br(c,t,S),ef;Yc(),r=Lx(t,r,s)}else t=y.treeContext,mn=Xr(S.nextSibling),Qn=r,Lt=!0,hl=null,qr=!1,t!==null&&Cp(r,t),r=Rc(r,c),r.flags|=4096;return r}return t=Ia(t.child,{mode:c.mode,children:c.children}),t.ref=r.ref,r.child=t,t.return=r,t}function zc(t,r){var s=r.ref;if(s===null)t!==null&&t.ref!==null&&(r.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(i(284));(t===null||t.ref!==s)&&(r.flags|=4194816)}}function tf(t,r,s,c,p){return oi(r),s=_d(t,r,s,c,void 0,p),c=Bd(),t!==null&&!zn?(Od(t,r,p),Wa(t,r,p)):(Lt&&c&&xd(r),r.flags|=1,Zn(t,r,s,p),r.child)}function Ix(t,r,s,c,p,y){return oi(r),r.updateQueue=null,s=qp(r,c,s,p),Up(t),c=Bd(),t!==null&&!zn?(Od(t,r,y),Wa(t,r,y)):(Lt&&c&&xd(r),r.flags|=1,Zn(t,r,s,y),r.child)}function Hx(t,r,s,c,p){if(oi(r),r.stateNode===null){var y=Yi,S=s.contextType;typeof S=="object"&&S!==null&&(y=Pn(S)),y=new s(c,y),r.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Zd,r.stateNode=y,y._reactInternals=r,y=r.stateNode,y.props=c,y.state=r.memoizedState,y.refs={},Ed(r),S=s.contextType,y.context=typeof S=="object"&&S!==null?Pn(S):Yi,y.state=r.memoizedState,S=s.getDerivedStateFromProps,typeof S=="function"&&(Pd(r,s,S,c),y.state=r.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(S=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),S!==y.state&&Zd.enqueueReplaceState(y,y.state,null),Ks(r,c,y,p),Vs(),y.state=r.memoizedState),typeof y.componentDidMount=="function"&&(r.flags|=4194308),c=!0}else if(t===null){y=r.stateNode;var z=r.memoizedProps,X=mi(s,z);y.props=X;var ie=y.context,pe=s.contextType;S=Yi,typeof pe=="object"&&pe!==null&&(S=Pn(pe));var Ce=s.getDerivedStateFromProps;pe=typeof Ce=="function"||typeof y.getSnapshotBeforeUpdate=="function",z=r.pendingProps!==z,pe||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(z||ie!==S)&&Ex(r,y,c,S),xl=!1;var oe=r.memoizedState;y.state=oe,Ks(r,c,y,p),Vs(),ie=r.memoizedState,z||oe!==ie||xl?(typeof Ce=="function"&&(Pd(r,s,Ce,c),ie=r.memoizedState),(X=xl||Nx(r,s,X,c,oe,ie,S))?(pe||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(r.flags|=4194308)):(typeof y.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=c,r.memoizedState=ie),y.props=c,y.state=ie,y.context=S,c=X):(typeof y.componentDidMount=="function"&&(r.flags|=4194308),c=!1)}else{y=r.stateNode,Ad(t,r),S=r.memoizedProps,pe=mi(s,S),y.props=pe,Ce=r.pendingProps,oe=y.context,ie=s.contextType,X=Yi,typeof ie=="object"&&ie!==null&&(X=Pn(ie)),z=s.getDerivedStateFromProps,(ie=typeof z=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(S!==Ce||oe!==X)&&Ex(r,y,c,X),xl=!1,oe=r.memoizedState,y.state=oe,Ks(r,c,y,p),Vs();var fe=r.memoizedState;S!==Ce||oe!==fe||xl||t!==null&&t.dependencies!==null&&pc(t.dependencies)?(typeof z=="function"&&(Pd(r,s,z,c),fe=r.memoizedState),(pe=xl||Nx(r,s,pe,c,oe,fe,X)||t!==null&&t.dependencies!==null&&pc(t.dependencies))?(ie||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(c,fe,X),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(c,fe,X)),typeof y.componentDidUpdate=="function"&&(r.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof y.componentDidUpdate!="function"||S===t.memoizedProps&&oe===t.memoizedState||(r.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||S===t.memoizedProps&&oe===t.memoizedState||(r.flags|=1024),r.memoizedProps=c,r.memoizedState=fe),y.props=c,y.state=fe,y.context=X,c=pe):(typeof y.componentDidUpdate!="function"||S===t.memoizedProps&&oe===t.memoizedState||(r.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||S===t.memoizedProps&&oe===t.memoizedState||(r.flags|=1024),c=!1)}return y=c,zc(t,r),c=(r.flags&128)!==0,y||c?(y=r.stateNode,s=c&&typeof s.getDerivedStateFromError!="function"?null:y.render(),r.flags|=1,t!==null&&c?(r.child=fi(r,t.child,null,p),r.child=fi(r,null,s,p)):Zn(t,r,s,p),r.memoizedState=y.state,t=r.child):t=Wa(t,r,p),t}function Ux(t,r,s,c){return ii(),r.flags|=256,Zn(t,r,s,c),r.child}var nf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function rf(t){return{baseLanes:t,cachePool:Fp()}}function af(t,r,s){return t=t!==null?t.childLanes&~s:0,r&&(t|=Tr),t}function qx(t,r,s){var c=r.pendingProps,p=!1,y=(r.flags&128)!==0,S;if((S=y)||(S=t!==null&&t.memoizedState===null?!1:(En.current&2)!==0),S&&(p=!0,r.flags&=-129),S=(r.flags&32)!==0,r.flags&=-33,t===null){if(Lt){if(p?bl(r):vl(),(t=mn)?(t=P1(t,qr),t=t!==null&&t.data!=="&"?t:null,t!==null&&(r.memoizedState={dehydrated:t,treeContext:fl!==null?{id:pa,overflow:xa}:null,retryLane:536870912,hydrationErrors:null},s=kp(t),s.return=r,r.child=s,Qn=r,mn=null)):t=null,t===null)throw ml(r);return Hf(t)?r.lanes=32:r.lanes=536870912,null}var z=c.children;return c=c.fallback,p?(vl(),p=r.mode,z=_c({mode:"hidden",children:z},p),c=li(c,p,s,null),z.return=r,c.return=r,z.sibling=c,r.child=z,c=r.child,c.memoizedState=rf(s),c.childLanes=af(t,S,s),r.memoizedState=nf,eo(null,c)):(bl(r),lf(r,z))}var X=t.memoizedState;if(X!==null&&(z=X.dehydrated,z!==null)){if(y)r.flags&256?(bl(r),r.flags&=-257,r=sf(t,r,s)):r.memoizedState!==null?(vl(),r.child=t.child,r.flags|=128,r=null):(vl(),z=c.fallback,p=r.mode,c=_c({mode:"visible",children:c.children},p),z=li(z,p,s,null),z.flags|=2,c.return=r,z.return=r,c.sibling=z,r.child=c,fi(r,t.child,null,s),c=r.child,c.memoizedState=rf(s),c.childLanes=af(t,S,s),r.memoizedState=nf,r=eo(null,c));else if(bl(r),Hf(z)){if(S=z.nextSibling&&z.nextSibling.dataset,S)var ie=S.dgst;S=ie,c=Error(i(419)),c.stack="",c.digest=S,Us({value:c,source:null,stack:null}),r=sf(t,r,s)}else if(zn||Vi(t,r,s,!1),S=(s&t.childLanes)!==0,zn||S){if(S=cn,S!==null&&(c=re(S,s),c!==0&&c!==X.retryLane))throw X.retryLane=c,ai(t,c),br(S,t,c),ef;If(z)||Yc(),r=sf(t,r,s)}else If(z)?(r.flags|=192,r.child=t.child,r=null):(t=X.treeContext,mn=Xr(z.nextSibling),Qn=r,Lt=!0,hl=null,qr=!1,t!==null&&Cp(r,t),r=lf(r,c.children),r.flags|=4096);return r}return p?(vl(),z=c.fallback,p=r.mode,X=t.child,ie=X.sibling,c=Ia(X,{mode:"hidden",children:c.children}),c.subtreeFlags=X.subtreeFlags&65011712,ie!==null?z=Ia(ie,z):(z=li(z,p,s,null),z.flags|=2),z.return=r,c.return=r,c.sibling=z,r.child=c,eo(null,c),c=r.child,z=t.child.memoizedState,z===null?z=rf(s):(p=z.cachePool,p!==null?(X=Mn._currentValue,p=p.parent!==X?{parent:X,pool:X}:p):p=Fp(),z={baseLanes:z.baseLanes|s,cachePool:p}),c.memoizedState=z,c.childLanes=af(t,S,s),r.memoizedState=nf,eo(t.child,c)):(bl(r),s=t.child,t=s.sibling,s=Ia(s,{mode:"visible",children:c.children}),s.return=r,s.sibling=null,t!==null&&(S=r.deletions,S===null?(r.deletions=[t],r.flags|=16):S.push(t)),r.child=s,r.memoizedState=null,s)}function lf(t,r){return r=_c({mode:"visible",children:r},t.mode),r.return=t,t.child=r}function _c(t,r){return t=Nr(22,t,null,r),t.lanes=0,t}function sf(t,r,s){return fi(r,t.child,null,s),t=lf(r,r.pendingProps.children),t.flags|=2,r.memoizedState=null,t}function Yx(t,r,s){t.lanes|=r;var c=t.alternate;c!==null&&(c.lanes|=r),wd(t.return,r,s)}function of(t,r,s,c,p,y){var S=t.memoizedState;S===null?t.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:c,tail:s,tailMode:p,treeForkCount:y}:(S.isBackwards=r,S.rendering=null,S.renderingStartTime=0,S.last=c,S.tail=s,S.tailMode=p,S.treeForkCount=y)}function Xx(t,r,s){var c=r.pendingProps,p=c.revealOrder,y=c.tail;c=c.children;var S=En.current,z=(S&2)!==0;if(z?(S=S&1|2,r.flags|=128):S&=1,T(En,S),Zn(t,r,c,s),c=Lt?Hs:0,!z&&t!==null&&(t.flags&128)!==0)e:for(t=r.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Yx(t,s,r);else if(t.tag===19)Yx(t,s,r);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===r)break e;for(;t.sibling===null;){if(t.return===null||t.return===r)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(p){case"forwards":for(s=r.child,p=null;s!==null;)t=s.alternate,t!==null&&jc(t)===null&&(p=s),s=s.sibling;s=p,s===null?(p=r.child,r.child=null):(p=s.sibling,s.sibling=null),of(r,!1,p,s,y,c);break;case"backwards":case"unstable_legacy-backwards":for(s=null,p=r.child,r.child=null;p!==null;){if(t=p.alternate,t!==null&&jc(t)===null){r.child=p;break}t=p.sibling,p.sibling=s,s=p,p=t}of(r,!0,s,null,y,c);break;case"together":of(r,!1,null,null,void 0,c);break;default:r.memoizedState=null}return r.child}function Wa(t,r,s){if(t!==null&&(r.dependencies=t.dependencies),jl|=r.lanes,(s&r.childLanes)===0)if(t!==null){if(Vi(t,r,s,!1),(s&r.childLanes)===0)return null}else return null;if(t!==null&&r.child!==t.child)throw Error(i(153));if(r.child!==null){for(t=r.child,s=Ia(t,t.pendingProps),r.child=s,s.return=r;t.sibling!==null;)t=t.sibling,s=s.sibling=Ia(t,t.pendingProps),s.return=r;s.sibling=null}return r.child}function cf(t,r){return(t.lanes&r)!==0?!0:(t=t.dependencies,!!(t!==null&&pc(t)))}function s2(t,r,s){switch(r.tag){case 3:Xe(r,r.stateNode.containerInfo),pl(r,Mn,t.memoizedState.cache),ii();break;case 27:case 5:ht(r);break;case 4:Xe(r,r.stateNode.containerInfo);break;case 10:pl(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Rd(r),null;break;case 13:var c=r.memoizedState;if(c!==null)return c.dehydrated!==null?(bl(r),r.flags|=128,null):(s&r.child.childLanes)!==0?qx(t,r,s):(bl(r),t=Wa(t,r,s),t!==null?t.sibling:null);bl(r);break;case 19:var p=(t.flags&128)!==0;if(c=(s&r.childLanes)!==0,c||(Vi(t,r,s,!1),c=(s&r.childLanes)!==0),p){if(c)return Xx(t,r,s);r.flags|=128}if(p=r.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),T(En,En.current),c)break;return null;case 22:return r.lanes=0,Ox(t,r,s,r.pendingProps);case 24:pl(r,Mn,t.memoizedState.cache)}return Wa(t,r,s)}function Wx(t,r,s){if(t!==null)if(t.memoizedProps!==r.pendingProps)zn=!0;else{if(!cf(t,s)&&(r.flags&128)===0)return zn=!1,s2(t,r,s);zn=(t.flags&131072)!==0}else zn=!1,Lt&&(r.flags&1048576)!==0&&Sp(r,Hs,r.index);switch(r.lanes=0,r.tag){case 16:e:{var c=r.pendingProps;if(t=ui(r.elementType),r.type=t,typeof t=="function")hd(t)?(c=mi(t,c),r.tag=1,r=Hx(null,r,t,c,s)):(r.tag=0,r=tf(null,r,t,c,s));else{if(t!=null){var p=t.$$typeof;if(p===R){r.tag=11,r=zx(null,r,t,c,s);break e}else if(p===L){r.tag=14,r=_x(null,r,t,c,s);break e}}throw r=ue(t)||t,Error(i(306,r,""))}}return r;case 0:return tf(t,r,r.type,r.pendingProps,s);case 1:return c=r.type,p=mi(c,r.pendingProps),Hx(t,r,c,p,s);case 3:e:{if(Xe(r,r.stateNode.containerInfo),t===null)throw Error(i(387));c=r.pendingProps;var y=r.memoizedState;p=y.element,Ad(t,r),Ks(r,c,null,s);var S=r.memoizedState;if(c=S.cache,pl(r,Mn,c),c!==y.cache&&kd(r,[Mn],s,!0),Vs(),c=S.element,y.isDehydrated)if(y={element:c,isDehydrated:!1,cache:S.cache},r.updateQueue.baseState=y,r.memoizedState=y,r.flags&256){r=Ux(t,r,c,s);break e}else if(c!==p){p=Ir(Error(i(424)),r),Us(p),r=Ux(t,r,c,s);break e}else{switch(t=r.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(mn=Xr(t.firstChild),Qn=r,Lt=!0,hl=null,qr=!0,s=Op(r,null,c,s),r.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling}else{if(ii(),c===p){r=Wa(t,r,s);break e}Zn(t,r,c,s)}r=r.child}return r;case 26:return zc(t,r),t===null?(s=r0(r.type,null,r.pendingProps,null))?r.memoizedState=s:Lt||(s=r.type,t=r.pendingProps,c=Pc(ye.current).createElement(s),c[xn]=r,c[gn]=t,Jn(c,s,t),jn(c),r.stateNode=c):r.memoizedState=r0(r.type,t.memoizedProps,r.pendingProps,t.memoizedState),null;case 27:return ht(r),t===null&&Lt&&(c=r.stateNode=e0(r.type,r.pendingProps,ye.current),Qn=r,qr=!0,p=mn,Al(r.type)?(Uf=p,mn=Xr(c.firstChild)):mn=p),Zn(t,r,r.pendingProps.children,s),zc(t,r),t===null&&(r.flags|=4194304),r.child;case 5:return t===null&&Lt&&((p=c=mn)&&(c=O2(c,r.type,r.pendingProps,qr),c!==null?(r.stateNode=c,Qn=r,mn=Xr(c.firstChild),qr=!1,p=!0):p=!1),p||ml(r)),ht(r),p=r.type,y=r.pendingProps,S=t!==null?t.memoizedProps:null,c=y.children,Of(p,y)?c=null:S!==null&&Of(p,S)&&(r.flags|=32),r.memoizedState!==null&&(p=_d(t,r,Zv,null,null,s),xo._currentValue=p),zc(t,r),Zn(t,r,c,s),r.child;case 6:return t===null&&Lt&&((t=s=mn)&&(s=$2(s,r.pendingProps,qr),s!==null?(r.stateNode=s,Qn=r,mn=null,t=!0):t=!1),t||ml(r)),null;case 13:return qx(t,r,s);case 4:return Xe(r,r.stateNode.containerInfo),c=r.pendingProps,t===null?r.child=fi(r,null,c,s):Zn(t,r,c,s),r.child;case 11:return zx(t,r,r.type,r.pendingProps,s);case 7:return Zn(t,r,r.pendingProps,s),r.child;case 8:return Zn(t,r,r.pendingProps.children,s),r.child;case 12:return Zn(t,r,r.pendingProps.children,s),r.child;case 10:return c=r.pendingProps,pl(r,r.type,c.value),Zn(t,r,c.children,s),r.child;case 9:return p=r.type._context,c=r.pendingProps.children,oi(r),p=Pn(p),c=c(p),r.flags|=1,Zn(t,r,c,s),r.child;case 14:return _x(t,r,r.type,r.pendingProps,s);case 15:return Bx(t,r,r.type,r.pendingProps,s);case 19:return Xx(t,r,s);case 31:return i2(t,r,s);case 22:return Ox(t,r,s,r.pendingProps);case 24:return oi(r),c=Pn(Mn),t===null?(p=Cd(),p===null&&(p=cn,y=jd(),p.pooledCache=y,y.refCount++,y!==null&&(p.pooledCacheLanes|=s),p=y),r.memoizedState={parent:c,cache:p},Ed(r),pl(r,Mn,p)):((t.lanes&s)!==0&&(Ad(t,r),Ks(r,null,null,s),Vs()),p=t.memoizedState,y=r.memoizedState,p.parent!==c?(p={parent:c,cache:c},r.memoizedState=p,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=p),pl(r,Mn,c)):(c=y.cache,pl(r,Mn,c),c!==p.cache&&kd(r,[Mn],s,!0))),Zn(t,r,r.pendingProps.children,s),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function Ga(t){t.flags|=4}function uf(t,r,s,c,p){if((r=(t.mode&32)!==0)&&(r=!1),r){if(t.flags|=16777216,(p&335544128)===p)if(t.stateNode.complete)t.flags|=8192;else if(b1())t.flags|=8192;else throw di=bc,Nd}else t.flags&=-16777217}function Gx(t,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!o0(r))if(b1())t.flags|=8192;else throw di=bc,Nd}function Bc(t,r){r!==null&&(t.flags|=4),t.flags&16384&&(r=t.tag!==22?nt():536870912,t.lanes|=r,is|=r)}function to(t,r){if(!Lt)switch(t.tailMode){case"hidden":r=t.tail;for(var s=null;r!==null;)r.alternate!==null&&(s=r),r=r.sibling;s===null?t.tail=null:s.sibling=null;break;case"collapsed":s=t.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?r||t.tail===null?t.tail=null:t.tail.sibling=null:c.sibling=null}}function pn(t){var r=t.alternate!==null&&t.alternate.child===t.child,s=0,c=0;if(r)for(var p=t.child;p!==null;)s|=p.lanes|p.childLanes,c|=p.subtreeFlags&65011712,c|=p.flags&65011712,p.return=t,p=p.sibling;else for(p=t.child;p!==null;)s|=p.lanes|p.childLanes,c|=p.subtreeFlags,c|=p.flags,p.return=t,p=p.sibling;return t.subtreeFlags|=c,t.childLanes=s,r}function o2(t,r,s){var c=r.pendingProps;switch(gd(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pn(r),null;case 1:return pn(r),null;case 3:return s=r.stateNode,c=null,t!==null&&(c=t.memoizedState.cache),r.memoizedState.cache!==c&&(r.flags|=2048),qa(Mn),Ye(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(t===null||t.child===null)&&(Gi(r)?Ga(r):t===null||t.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,bd())),pn(r),null;case 26:var p=r.type,y=r.memoizedState;return t===null?(Ga(r),y!==null?(pn(r),Gx(r,y)):(pn(r),uf(r,p,null,c,s))):y?y!==t.memoizedState?(Ga(r),pn(r),Gx(r,y)):(pn(r),r.flags&=-16777217):(t=t.memoizedProps,t!==c&&Ga(r),pn(r),uf(r,p,t,c,s)),null;case 27:if(tt(r),s=ye.current,p=r.type,t!==null&&r.stateNode!=null)t.memoizedProps!==c&&Ga(r);else{if(!c){if(r.stateNode===null)throw Error(i(166));return pn(r),null}t=de.current,Gi(r)?Np(r):(t=e0(p,c,s),r.stateNode=t,Ga(r))}return pn(r),null;case 5:if(tt(r),p=r.type,t!==null&&r.stateNode!=null)t.memoizedProps!==c&&Ga(r);else{if(!c){if(r.stateNode===null)throw Error(i(166));return pn(r),null}if(y=de.current,Gi(r))Np(r);else{var S=Pc(ye.current);switch(y){case 1:y=S.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:y=S.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":y=S.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":y=S.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":y=S.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof c.is=="string"?S.createElement("select",{is:c.is}):S.createElement("select"),c.multiple?y.multiple=!0:c.size&&(y.size=c.size);break;default:y=typeof c.is=="string"?S.createElement(p,{is:c.is}):S.createElement(p)}}y[xn]=r,y[gn]=c;e:for(S=r.child;S!==null;){if(S.tag===5||S.tag===6)y.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===r)break e;for(;S.sibling===null;){if(S.return===null||S.return===r)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}r.stateNode=y;e:switch(Jn(y,p,c),p){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Ga(r)}}return pn(r),uf(r,r.type,t===null?null:t.memoizedProps,r.pendingProps,s),null;case 6:if(t&&r.stateNode!=null)t.memoizedProps!==c&&Ga(r);else{if(typeof c!="string"&&r.stateNode===null)throw Error(i(166));if(t=ye.current,Gi(r)){if(t=r.stateNode,s=r.memoizedProps,c=null,p=Qn,p!==null)switch(p.tag){case 27:case 5:c=p.memoizedProps}t[xn]=r,t=!!(t.nodeValue===s||c!==null&&c.suppressHydrationWarning===!0||q1(t.nodeValue,s)),t||ml(r,!0)}else t=Pc(t).createTextNode(c),t[xn]=r,r.stateNode=t}return pn(r),null;case 31:if(s=r.memoizedState,t===null||t.memoizedState!==null){if(c=Gi(r),s!==null){if(t===null){if(!c)throw Error(i(318));if(t=r.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(557));t[xn]=r}else ii(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;pn(r),t=!1}else s=bd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=s),t=!0;if(!t)return r.flags&256?(Ar(r),r):(Ar(r),null);if((r.flags&128)!==0)throw Error(i(558))}return pn(r),null;case 13:if(c=r.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(p=Gi(r),c!==null&&c.dehydrated!==null){if(t===null){if(!p)throw Error(i(318));if(p=r.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(i(317));p[xn]=r}else ii(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;pn(r),p=!1}else p=bd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=p),p=!0;if(!p)return r.flags&256?(Ar(r),r):(Ar(r),null)}return Ar(r),(r.flags&128)!==0?(r.lanes=s,r):(s=c!==null,t=t!==null&&t.memoizedState!==null,s&&(c=r.child,p=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(p=c.alternate.memoizedState.cachePool.pool),y=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(y=c.memoizedState.cachePool.pool),y!==p&&(c.flags|=2048)),s!==t&&s&&(r.child.flags|=8192),Bc(r,r.updateQueue),pn(r),null);case 4:return Ye(),t===null&&Mf(r.stateNode.containerInfo),pn(r),null;case 10:return qa(r.type),pn(r),null;case 19:if(W(En),c=r.memoizedState,c===null)return pn(r),null;if(p=(r.flags&128)!==0,y=c.rendering,y===null)if(p)to(c,!1);else{if(Cn!==0||t!==null&&(t.flags&128)!==0)for(t=r.child;t!==null;){if(y=jc(t),y!==null){for(r.flags|=128,to(c,!1),t=y.updateQueue,r.updateQueue=t,Bc(r,t),r.subtreeFlags=0,t=s,s=r.child;s!==null;)wp(s,t),s=s.sibling;return T(En,En.current&1|2),Lt&&Ha(r,c.treeForkCount),r.child}t=t.sibling}c.tail!==null&&Se()>Hc&&(r.flags|=128,p=!0,to(c,!1),r.lanes=4194304)}else{if(!p)if(t=jc(y),t!==null){if(r.flags|=128,p=!0,t=t.updateQueue,r.updateQueue=t,Bc(r,t),to(c,!0),c.tail===null&&c.tailMode==="hidden"&&!y.alternate&&!Lt)return pn(r),null}else 2*Se()-c.renderingStartTime>Hc&&s!==536870912&&(r.flags|=128,p=!0,to(c,!1),r.lanes=4194304);c.isBackwards?(y.sibling=r.child,r.child=y):(t=c.last,t!==null?t.sibling=y:r.child=y,c.last=y)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=Se(),t.sibling=null,s=En.current,T(En,p?s&1|2:s&1),Lt&&Ha(r,c.treeForkCount),t):(pn(r),null);case 22:case 23:return Ar(r),Md(),c=r.memoizedState!==null,t!==null?t.memoizedState!==null!==c&&(r.flags|=8192):c&&(r.flags|=8192),c?(s&536870912)!==0&&(r.flags&128)===0&&(pn(r),r.subtreeFlags&6&&(r.flags|=8192)):pn(r),s=r.updateQueue,s!==null&&Bc(r,s.retryQueue),s=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),c=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),c!==s&&(r.flags|=2048),t!==null&&W(ci),null;case 24:return s=null,t!==null&&(s=t.memoizedState.cache),r.memoizedState.cache!==s&&(r.flags|=2048),qa(Mn),pn(r),null;case 25:return null;case 30:return null}throw Error(i(156,r.tag))}function c2(t,r){switch(gd(r),r.tag){case 1:return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 3:return qa(Mn),Ye(),t=r.flags,(t&65536)!==0&&(t&128)===0?(r.flags=t&-65537|128,r):null;case 26:case 27:case 5:return tt(r),null;case 31:if(r.memoizedState!==null){if(Ar(r),r.alternate===null)throw Error(i(340));ii()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 13:if(Ar(r),t=r.memoizedState,t!==null&&t.dehydrated!==null){if(r.alternate===null)throw Error(i(340));ii()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 19:return W(En),null;case 4:return Ye(),null;case 10:return qa(r.type),null;case 22:case 23:return Ar(r),Md(),t!==null&&W(ci),t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 24:return qa(Mn),null;case 25:return null;default:return null}}function Vx(t,r){switch(gd(r),r.tag){case 3:qa(Mn),Ye();break;case 26:case 27:case 5:tt(r);break;case 4:Ye();break;case 31:r.memoizedState!==null&&Ar(r);break;case 13:Ar(r);break;case 19:W(En);break;case 10:qa(r.type);break;case 22:case 23:Ar(r),Md(),t!==null&&W(ci);break;case 24:qa(Mn)}}function no(t,r){try{var s=r.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var p=c.next;s=p;do{if((s.tag&t)===t){c=void 0;var y=s.create,S=s.inst;c=y(),S.destroy=c}s=s.next}while(s!==p)}}catch(z){en(r,r.return,z)}}function wl(t,r,s){try{var c=r.updateQueue,p=c!==null?c.lastEffect:null;if(p!==null){var y=p.next;c=y;do{if((c.tag&t)===t){var S=c.inst,z=S.destroy;if(z!==void 0){S.destroy=void 0,p=r;var X=s,ie=z;try{ie()}catch(pe){en(p,X,pe)}}}c=c.next}while(c!==y)}}catch(pe){en(r,r.return,pe)}}function Kx(t){var r=t.updateQueue;if(r!==null){var s=t.stateNode;try{Lp(r,s)}catch(c){en(t,t.return,c)}}}function Qx(t,r,s){s.props=mi(t.type,t.memoizedProps),s.state=t.memoizedState;try{s.componentWillUnmount()}catch(c){en(t,r,c)}}function ro(t,r){try{var s=t.ref;if(s!==null){switch(t.tag){case 26:case 27:case 5:var c=t.stateNode;break;case 30:c=t.stateNode;break;default:c=t.stateNode}typeof s=="function"?t.refCleanup=s(c):s.current=c}}catch(p){en(t,r,p)}}function ga(t,r){var s=t.ref,c=t.refCleanup;if(s!==null)if(typeof c=="function")try{c()}catch(p){en(t,r,p)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(p){en(t,r,p)}else s.current=null}function Px(t){var r=t.type,s=t.memoizedProps,c=t.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":s.autoFocus&&c.focus();break e;case"img":s.src?c.src=s.src:s.srcSet&&(c.srcset=s.srcSet)}}catch(p){en(t,t.return,p)}}function df(t,r,s){try{var c=t.stateNode;F2(c,t.type,s,r),c[gn]=r}catch(p){en(t,t.return,p)}}function Zx(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Al(t.type)||t.tag===4}function ff(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Zx(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Al(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function hf(t,r,s){var c=t.tag;if(c===5||c===6)t=t.stateNode,r?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(t,r):(r=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,r.appendChild(t),s=s._reactRootContainer,s!=null||r.onclick!==null||(r.onclick=tr));else if(c!==4&&(c===27&&Al(t.type)&&(s=t.stateNode,r=null),t=t.child,t!==null))for(hf(t,r,s),t=t.sibling;t!==null;)hf(t,r,s),t=t.sibling}function Oc(t,r,s){var c=t.tag;if(c===5||c===6)t=t.stateNode,r?s.insertBefore(t,r):s.appendChild(t);else if(c!==4&&(c===27&&Al(t.type)&&(s=t.stateNode),t=t.child,t!==null))for(Oc(t,r,s),t=t.sibling;t!==null;)Oc(t,r,s),t=t.sibling}function Jx(t){var r=t.stateNode,s=t.memoizedProps;try{for(var c=t.type,p=r.attributes;p.length;)r.removeAttributeNode(p[0]);Jn(r,c,s),r[xn]=t,r[gn]=s}catch(y){en(t,t.return,y)}}var Va=!1,_n=!1,mf=!1,e1=typeof WeakSet=="function"?WeakSet:Set,Gn=null;function u2(t,r){if(t=t.containerInfo,_f=au,t=fp(t),id(t)){if("selectionStart"in t)var s={start:t.selectionStart,end:t.selectionEnd};else e:{s=(s=t.ownerDocument)&&s.defaultView||window;var c=s.getSelection&&s.getSelection();if(c&&c.rangeCount!==0){s=c.anchorNode;var p=c.anchorOffset,y=c.focusNode;c=c.focusOffset;try{s.nodeType,y.nodeType}catch{s=null;break e}var S=0,z=-1,X=-1,ie=0,pe=0,Ce=t,oe=null;t:for(;;){for(var fe;Ce!==s||p!==0&&Ce.nodeType!==3||(z=S+p),Ce!==y||c!==0&&Ce.nodeType!==3||(X=S+c),Ce.nodeType===3&&(S+=Ce.nodeValue.length),(fe=Ce.firstChild)!==null;)oe=Ce,Ce=fe;for(;;){if(Ce===t)break t;if(oe===s&&++ie===p&&(z=S),oe===y&&++pe===c&&(X=S),(fe=Ce.nextSibling)!==null)break;Ce=oe,oe=Ce.parentNode}Ce=fe}s=z===-1||X===-1?null:{start:z,end:X}}else s=null}s=s||{start:0,end:0}}else s=null;for(Bf={focusedElem:t,selectionRange:s},au=!1,Gn=r;Gn!==null;)if(r=Gn,t=r.child,(r.subtreeFlags&1028)!==0&&t!==null)t.return=r,Gn=t;else for(;Gn!==null;){switch(r=Gn,y=r.alternate,t=r.flags,r.tag){case 0:if((t&4)!==0&&(t=r.updateQueue,t=t!==null?t.events:null,t!==null))for(s=0;s<t.length;s++)p=t[s],p.ref.impl=p.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&y!==null){t=void 0,s=r,p=y.memoizedProps,y=y.memoizedState,c=s.stateNode;try{var Ue=mi(s.type,p);t=c.getSnapshotBeforeUpdate(Ue,y),c.__reactInternalSnapshotBeforeUpdate=t}catch(lt){en(s,s.return,lt)}}break;case 3:if((t&1024)!==0){if(t=r.stateNode.containerInfo,s=t.nodeType,s===9)Lf(t);else if(s===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Lf(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(i(163))}if(t=r.sibling,t!==null){t.return=r.return,Gn=t;break}Gn=r.return}}function t1(t,r,s){var c=s.flags;switch(s.tag){case 0:case 11:case 15:Qa(t,s),c&4&&no(5,s);break;case 1:if(Qa(t,s),c&4)if(t=s.stateNode,r===null)try{t.componentDidMount()}catch(S){en(s,s.return,S)}else{var p=mi(s.type,r.memoizedProps);r=r.memoizedState;try{t.componentDidUpdate(p,r,t.__reactInternalSnapshotBeforeUpdate)}catch(S){en(s,s.return,S)}}c&64&&Kx(s),c&512&&ro(s,s.return);break;case 3:if(Qa(t,s),c&64&&(t=s.updateQueue,t!==null)){if(r=null,s.child!==null)switch(s.child.tag){case 27:case 5:r=s.child.stateNode;break;case 1:r=s.child.stateNode}try{Lp(t,r)}catch(S){en(s,s.return,S)}}break;case 27:r===null&&c&4&&Jx(s);case 26:case 5:Qa(t,s),r===null&&c&4&&Px(s),c&512&&ro(s,s.return);break;case 12:Qa(t,s);break;case 31:Qa(t,s),c&4&&a1(t,s);break;case 13:Qa(t,s),c&4&&l1(t,s),c&64&&(t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(s=b2.bind(null,s),L2(t,s))));break;case 22:if(c=s.memoizedState!==null||Va,!c){r=r!==null&&r.memoizedState!==null||_n,p=Va;var y=_n;Va=c,(_n=r)&&!y?Pa(t,s,(s.subtreeFlags&8772)!==0):Qa(t,s),Va=p,_n=y}break;case 30:break;default:Qa(t,s)}}function n1(t){var r=t.alternate;r!==null&&(t.alternate=null,n1(r)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(r=t.stateNode,r!==null&&Ti(r)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var yn=null,pr=!1;function Ka(t,r,s){for(s=s.child;s!==null;)r1(t,r,s),s=s.sibling}function r1(t,r,s){if(He&&typeof He.onCommitFiberUnmount=="function")try{He.onCommitFiberUnmount(Be,s)}catch{}switch(s.tag){case 26:_n||ga(s,r),Ka(t,r,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:_n||ga(s,r);var c=yn,p=pr;Al(s.type)&&(yn=s.stateNode,pr=!1),Ka(t,r,s),ho(s.stateNode),yn=c,pr=p;break;case 5:_n||ga(s,r);case 6:if(c=yn,p=pr,yn=null,Ka(t,r,s),yn=c,pr=p,yn!==null)if(pr)try{(yn.nodeType===9?yn.body:yn.nodeName==="HTML"?yn.ownerDocument.body:yn).removeChild(s.stateNode)}catch(y){en(s,r,y)}else try{yn.removeChild(s.stateNode)}catch(y){en(s,r,y)}break;case 18:yn!==null&&(pr?(t=yn,K1(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,s.stateNode),ms(t)):K1(yn,s.stateNode));break;case 4:c=yn,p=pr,yn=s.stateNode.containerInfo,pr=!0,Ka(t,r,s),yn=c,pr=p;break;case 0:case 11:case 14:case 15:wl(2,s,r),_n||wl(4,s,r),Ka(t,r,s);break;case 1:_n||(ga(s,r),c=s.stateNode,typeof c.componentWillUnmount=="function"&&Qx(s,r,c)),Ka(t,r,s);break;case 21:Ka(t,r,s);break;case 22:_n=(c=_n)||s.memoizedState!==null,Ka(t,r,s),_n=c;break;default:Ka(t,r,s)}}function a1(t,r){if(r.memoizedState===null&&(t=r.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{ms(t)}catch(s){en(r,r.return,s)}}}function l1(t,r){if(r.memoizedState===null&&(t=r.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{ms(t)}catch(s){en(r,r.return,s)}}function d2(t){switch(t.tag){case 31:case 13:case 19:var r=t.stateNode;return r===null&&(r=t.stateNode=new e1),r;case 22:return t=t.stateNode,r=t._retryCache,r===null&&(r=t._retryCache=new e1),r;default:throw Error(i(435,t.tag))}}function $c(t,r){var s=d2(t);r.forEach(function(c){if(!s.has(c)){s.add(c);var p=v2.bind(null,t,c);c.then(p,p)}})}function xr(t,r){var s=r.deletions;if(s!==null)for(var c=0;c<s.length;c++){var p=s[c],y=t,S=r,z=S;e:for(;z!==null;){switch(z.tag){case 27:if(Al(z.type)){yn=z.stateNode,pr=!1;break e}break;case 5:yn=z.stateNode,pr=!1;break e;case 3:case 4:yn=z.stateNode.containerInfo,pr=!0;break e}z=z.return}if(yn===null)throw Error(i(160));r1(y,S,p),yn=null,pr=!1,y=p.alternate,y!==null&&(y.return=null),p.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)i1(r,t),r=r.sibling}var aa=null;function i1(t,r){var s=t.alternate,c=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:xr(r,t),gr(t),c&4&&(wl(3,t,t.return),no(3,t),wl(5,t,t.return));break;case 1:xr(r,t),gr(t),c&512&&(_n||s===null||ga(s,s.return)),c&64&&Va&&(t=t.updateQueue,t!==null&&(c=t.callbacks,c!==null&&(s=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=s===null?c:s.concat(c))));break;case 26:var p=aa;if(xr(r,t),gr(t),c&512&&(_n||s===null||ga(s,s.return)),c&4){var y=s!==null?s.memoizedState:null;if(c=t.memoizedState,s===null)if(c===null)if(t.stateNode===null){e:{c=t.type,s=t.memoizedProps,p=p.ownerDocument||p;t:switch(c){case"title":y=p.getElementsByTagName("title")[0],(!y||y[Ta]||y[xn]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=p.createElement(c),p.head.insertBefore(y,p.querySelector("head > title"))),Jn(y,c,s),y[xn]=t,jn(y),c=y;break e;case"link":var S=i0("link","href",p).get(c+(s.href||""));if(S){for(var z=0;z<S.length;z++)if(y=S[z],y.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&y.getAttribute("rel")===(s.rel==null?null:s.rel)&&y.getAttribute("title")===(s.title==null?null:s.title)&&y.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){S.splice(z,1);break t}}y=p.createElement(c),Jn(y,c,s),p.head.appendChild(y);break;case"meta":if(S=i0("meta","content",p).get(c+(s.content||""))){for(z=0;z<S.length;z++)if(y=S[z],y.getAttribute("content")===(s.content==null?null:""+s.content)&&y.getAttribute("name")===(s.name==null?null:s.name)&&y.getAttribute("property")===(s.property==null?null:s.property)&&y.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&y.getAttribute("charset")===(s.charSet==null?null:s.charSet)){S.splice(z,1);break t}}y=p.createElement(c),Jn(y,c,s),p.head.appendChild(y);break;default:throw Error(i(468,c))}y[xn]=t,jn(y),c=y}t.stateNode=c}else s0(p,t.type,t.stateNode);else t.stateNode=l0(p,c,t.memoizedProps);else y!==c?(y===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):y.count--,c===null?s0(p,t.type,t.stateNode):l0(p,c,t.memoizedProps)):c===null&&t.stateNode!==null&&df(t,t.memoizedProps,s.memoizedProps)}break;case 27:xr(r,t),gr(t),c&512&&(_n||s===null||ga(s,s.return)),s!==null&&c&4&&df(t,t.memoizedProps,s.memoizedProps);break;case 5:if(xr(r,t),gr(t),c&512&&(_n||s===null||ga(s,s.return)),t.flags&32){p=t.stateNode;try{Gt(p,"")}catch(Ue){en(t,t.return,Ue)}}c&4&&t.stateNode!=null&&(p=t.memoizedProps,df(t,p,s!==null?s.memoizedProps:p)),c&1024&&(mf=!0);break;case 6:if(xr(r,t),gr(t),c&4){if(t.stateNode===null)throw Error(i(162));c=t.memoizedProps,s=t.stateNode;try{s.nodeValue=c}catch(Ue){en(t,t.return,Ue)}}break;case 3:if(eu=null,p=aa,aa=Zc(r.containerInfo),xr(r,t),aa=p,gr(t),c&4&&s!==null&&s.memoizedState.isDehydrated)try{ms(r.containerInfo)}catch(Ue){en(t,t.return,Ue)}mf&&(mf=!1,s1(t));break;case 4:c=aa,aa=Zc(t.stateNode.containerInfo),xr(r,t),gr(t),aa=c;break;case 12:xr(r,t),gr(t);break;case 31:xr(r,t),gr(t),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,$c(t,c)));break;case 13:xr(r,t),gr(t),t.child.flags&8192&&t.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(Ic=Se()),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,$c(t,c)));break;case 22:p=t.memoizedState!==null;var X=s!==null&&s.memoizedState!==null,ie=Va,pe=_n;if(Va=ie||p,_n=pe||X,xr(r,t),_n=pe,Va=ie,gr(t),c&8192)e:for(r=t.stateNode,r._visibility=p?r._visibility&-2:r._visibility|1,p&&(s===null||X||Va||_n||pi(t)),s=null,r=t;;){if(r.tag===5||r.tag===26){if(s===null){X=s=r;try{if(y=X.stateNode,p)S=y.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{z=X.stateNode;var Ce=X.memoizedProps.style,oe=Ce!=null&&Ce.hasOwnProperty("display")?Ce.display:null;z.style.display=oe==null||typeof oe=="boolean"?"":(""+oe).trim()}}catch(Ue){en(X,X.return,Ue)}}}else if(r.tag===6){if(s===null){X=r;try{X.stateNode.nodeValue=p?"":X.memoizedProps}catch(Ue){en(X,X.return,Ue)}}}else if(r.tag===18){if(s===null){X=r;try{var fe=X.stateNode;p?Q1(fe,!0):Q1(X.stateNode,!1)}catch(Ue){en(X,X.return,Ue)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===t)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break e;for(;r.sibling===null;){if(r.return===null||r.return===t)break e;s===r&&(s=null),r=r.return}s===r&&(s=null),r.sibling.return=r.return,r=r.sibling}c&4&&(c=t.updateQueue,c!==null&&(s=c.retryQueue,s!==null&&(c.retryQueue=null,$c(t,s))));break;case 19:xr(r,t),gr(t),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,$c(t,c)));break;case 30:break;case 21:break;default:xr(r,t),gr(t)}}function gr(t){var r=t.flags;if(r&2){try{for(var s,c=t.return;c!==null;){if(Zx(c)){s=c;break}c=c.return}if(s==null)throw Error(i(160));switch(s.tag){case 27:var p=s.stateNode,y=ff(t);Oc(t,y,p);break;case 5:var S=s.stateNode;s.flags&32&&(Gt(S,""),s.flags&=-33);var z=ff(t);Oc(t,z,S);break;case 3:case 4:var X=s.stateNode.containerInfo,ie=ff(t);hf(t,ie,X);break;default:throw Error(i(161))}}catch(pe){en(t,t.return,pe)}t.flags&=-3}r&4096&&(t.flags&=-4097)}function s1(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var r=t;s1(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),t=t.sibling}}function Qa(t,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)t1(t,r.alternate,r),r=r.sibling}function pi(t){for(t=t.child;t!==null;){var r=t;switch(r.tag){case 0:case 11:case 14:case 15:wl(4,r,r.return),pi(r);break;case 1:ga(r,r.return);var s=r.stateNode;typeof s.componentWillUnmount=="function"&&Qx(r,r.return,s),pi(r);break;case 27:ho(r.stateNode);case 26:case 5:ga(r,r.return),pi(r);break;case 22:r.memoizedState===null&&pi(r);break;case 30:pi(r);break;default:pi(r)}t=t.sibling}}function Pa(t,r,s){for(s=s&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var c=r.alternate,p=t,y=r,S=y.flags;switch(y.tag){case 0:case 11:case 15:Pa(p,y,s),no(4,y);break;case 1:if(Pa(p,y,s),c=y,p=c.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(ie){en(c,c.return,ie)}if(c=y,p=c.updateQueue,p!==null){var z=c.stateNode;try{var X=p.shared.hiddenCallbacks;if(X!==null)for(p.shared.hiddenCallbacks=null,p=0;p<X.length;p++)$p(X[p],z)}catch(ie){en(c,c.return,ie)}}s&&S&64&&Kx(y),ro(y,y.return);break;case 27:Jx(y);case 26:case 5:Pa(p,y,s),s&&c===null&&S&4&&Px(y),ro(y,y.return);break;case 12:Pa(p,y,s);break;case 31:Pa(p,y,s),s&&S&4&&a1(p,y);break;case 13:Pa(p,y,s),s&&S&4&&l1(p,y);break;case 22:y.memoizedState===null&&Pa(p,y,s),ro(y,y.return);break;case 30:break;default:Pa(p,y,s)}r=r.sibling}}function pf(t,r){var s=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),t=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(t=r.memoizedState.cachePool.pool),t!==s&&(t!=null&&t.refCount++,s!=null&&qs(s))}function xf(t,r){t=null,r.alternate!==null&&(t=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==t&&(r.refCount++,t!=null&&qs(t))}function la(t,r,s,c){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)o1(t,r,s,c),r=r.sibling}function o1(t,r,s,c){var p=r.flags;switch(r.tag){case 0:case 11:case 15:la(t,r,s,c),p&2048&&no(9,r);break;case 1:la(t,r,s,c);break;case 3:la(t,r,s,c),p&2048&&(t=null,r.alternate!==null&&(t=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==t&&(r.refCount++,t!=null&&qs(t)));break;case 12:if(p&2048){la(t,r,s,c),t=r.stateNode;try{var y=r.memoizedProps,S=y.id,z=y.onPostCommit;typeof z=="function"&&z(S,r.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(X){en(r,r.return,X)}}else la(t,r,s,c);break;case 31:la(t,r,s,c);break;case 13:la(t,r,s,c);break;case 23:break;case 22:y=r.stateNode,S=r.alternate,r.memoizedState!==null?y._visibility&2?la(t,r,s,c):ao(t,r):y._visibility&2?la(t,r,s,c):(y._visibility|=2,rs(t,r,s,c,(r.subtreeFlags&10256)!==0||!1)),p&2048&&pf(S,r);break;case 24:la(t,r,s,c),p&2048&&xf(r.alternate,r);break;default:la(t,r,s,c)}}function rs(t,r,s,c,p){for(p=p&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var y=t,S=r,z=s,X=c,ie=S.flags;switch(S.tag){case 0:case 11:case 15:rs(y,S,z,X,p),no(8,S);break;case 23:break;case 22:var pe=S.stateNode;S.memoizedState!==null?pe._visibility&2?rs(y,S,z,X,p):ao(y,S):(pe._visibility|=2,rs(y,S,z,X,p)),p&&ie&2048&&pf(S.alternate,S);break;case 24:rs(y,S,z,X,p),p&&ie&2048&&xf(S.alternate,S);break;default:rs(y,S,z,X,p)}r=r.sibling}}function ao(t,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var s=t,c=r,p=c.flags;switch(c.tag){case 22:ao(s,c),p&2048&&pf(c.alternate,c);break;case 24:ao(s,c),p&2048&&xf(c.alternate,c);break;default:ao(s,c)}r=r.sibling}}var lo=8192;function as(t,r,s){if(t.subtreeFlags&lo)for(t=t.child;t!==null;)c1(t,r,s),t=t.sibling}function c1(t,r,s){switch(t.tag){case 26:as(t,r,s),t.flags&lo&&t.memoizedState!==null&&P2(s,aa,t.memoizedState,t.memoizedProps);break;case 5:as(t,r,s);break;case 3:case 4:var c=aa;aa=Zc(t.stateNode.containerInfo),as(t,r,s),aa=c;break;case 22:t.memoizedState===null&&(c=t.alternate,c!==null&&c.memoizedState!==null?(c=lo,lo=16777216,as(t,r,s),lo=c):as(t,r,s));break;default:as(t,r,s)}}function u1(t){var r=t.alternate;if(r!==null&&(t=r.child,t!==null)){r.child=null;do r=t.sibling,t.sibling=null,t=r;while(t!==null)}}function io(t){var r=t.deletions;if((t.flags&16)!==0){if(r!==null)for(var s=0;s<r.length;s++){var c=r[s];Gn=c,f1(c,t)}u1(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)d1(t),t=t.sibling}function d1(t){switch(t.tag){case 0:case 11:case 15:io(t),t.flags&2048&&wl(9,t,t.return);break;case 3:io(t);break;case 12:io(t);break;case 22:var r=t.stateNode;t.memoizedState!==null&&r._visibility&2&&(t.return===null||t.return.tag!==13)?(r._visibility&=-3,Lc(t)):io(t);break;default:io(t)}}function Lc(t){var r=t.deletions;if((t.flags&16)!==0){if(r!==null)for(var s=0;s<r.length;s++){var c=r[s];Gn=c,f1(c,t)}u1(t)}for(t=t.child;t!==null;){switch(r=t,r.tag){case 0:case 11:case 15:wl(8,r,r.return),Lc(r);break;case 22:s=r.stateNode,s._visibility&2&&(s._visibility&=-3,Lc(r));break;default:Lc(r)}t=t.sibling}}function f1(t,r){for(;Gn!==null;){var s=Gn;switch(s.tag){case 0:case 11:case 15:wl(8,s,r);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var c=s.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:qs(s.memoizedState.cache)}if(c=s.child,c!==null)c.return=s,Gn=c;else e:for(s=t;Gn!==null;){c=Gn;var p=c.sibling,y=c.return;if(n1(c),c===s){Gn=null;break e}if(p!==null){p.return=y,Gn=p;break e}Gn=y}}}var f2={getCacheForType:function(t){var r=Pn(Mn),s=r.data.get(t);return s===void 0&&(s=t(),r.data.set(t,s)),s},cacheSignal:function(){return Pn(Mn).controller.signal}},h2=typeof WeakMap=="function"?WeakMap:Map,Vt=0,cn=null,At=null,Mt=0,Jt=0,Dr=null,kl=!1,ls=!1,gf=!1,Za=0,Cn=0,jl=0,xi=0,yf=0,Tr=0,is=0,so=null,yr=null,bf=!1,Ic=0,h1=0,Hc=1/0,Uc=null,Sl=null,In=0,Cl=null,ss=null,Ja=0,vf=0,wf=null,m1=null,oo=0,kf=null;function Fr(){return(Vt&2)!==0&&Mt!==0?Mt&-Mt:Y.T!==null?Af():Et()}function p1(){if(Tr===0)if((Mt&536870912)===0||Lt){var t=Bt;Bt<<=1,(Bt&3932160)===0&&(Bt=262144),Tr=t}else Tr=536870912;return t=Er.current,t!==null&&(t.flags|=32),Tr}function br(t,r,s){(t===cn&&(Jt===2||Jt===9)||t.cancelPendingCommit!==null)&&(os(t,0),Nl(t,Mt,Tr,!1)),we(t,s),((Vt&2)===0||t!==cn)&&(t===cn&&((Vt&2)===0&&(xi|=s),Cn===4&&Nl(t,Mt,Tr,!1)),ya(t))}function x1(t,r,s){if((Vt&6)!==0)throw Error(i(327));var c=!s&&(r&127)===0&&(r&t.expiredLanes)===0||P(t,r),p=c?x2(t,r):Sf(t,r,!0),y=c;do{if(p===0){ls&&!c&&Nl(t,r,0,!1);break}else{if(s=t.current.alternate,y&&!m2(s)){p=Sf(t,r,!1),y=!1;continue}if(p===2){if(y=r,t.errorRecoveryDisabledLanes&y)var S=0;else S=t.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){r=S;e:{var z=t;p=so;var X=z.current.memoizedState.isDehydrated;if(X&&(os(z,S).flags|=256),S=Sf(z,S,!1),S!==2){if(gf&&!X){z.errorRecoveryDisabledLanes|=y,xi|=y,p=4;break e}y=yr,yr=p,y!==null&&(yr===null?yr=y:yr.push.apply(yr,y))}p=S}if(y=!1,p!==2)continue}}if(p===1){os(t,0),Nl(t,r,0,!0);break}e:{switch(c=t,y=p,y){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r)break;case 6:Nl(c,r,Tr,!kl);break e;case 2:yr=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(p=Ic+300-Se(),10<p)){if(Nl(c,r,Tr,!kl),wn(c,0,!0)!==0)break e;Ja=r,c.timeoutHandle=G1(g1.bind(null,c,s,yr,Uc,bf,r,Tr,xi,is,kl,y,"Throttled",-0,0),p);break e}g1(c,s,yr,Uc,bf,r,Tr,xi,is,kl,y,null,-0,0)}}break}while(!0);ya(t)}function g1(t,r,s,c,p,y,S,z,X,ie,pe,Ce,oe,fe){if(t.timeoutHandle=-1,Ce=r.subtreeFlags,Ce&8192||(Ce&16785408)===16785408){Ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:tr},c1(r,y,Ce);var Ue=(y&62914560)===y?Ic-Se():(y&4194048)===y?h1-Se():0;if(Ue=Z2(Ce,Ue),Ue!==null){Ja=y,t.cancelPendingCommit=Ue(C1.bind(null,t,r,y,s,c,p,S,z,X,pe,Ce,null,oe,fe)),Nl(t,y,S,!ie);return}}C1(t,r,y,s,c,p,S,z,X)}function m2(t){for(var r=t;;){var s=r.tag;if((s===0||s===11||s===15)&&r.flags&16384&&(s=r.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var c=0;c<s.length;c++){var p=s[c],y=p.getSnapshot;p=p.value;try{if(!Cr(y(),p))return!1}catch{return!1}}if(s=r.child,r.subtreeFlags&16384&&s!==null)s.return=r,r=s;else{if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function Nl(t,r,s,c){r&=~yf,r&=~xi,t.suspendedLanes|=r,t.pingedLanes&=~r,c&&(t.warmLanes|=r),c=t.expirationTimes;for(var p=r;0<p;){var y=31-Ve(p),S=1<<y;c[y]=-1,p&=~S}s!==0&&ln(t,s,r)}function qc(){return(Vt&6)===0?(co(0),!1):!0}function jf(){if(At!==null){if(Jt===0)var t=At.return;else t=At,Ua=si=null,$d(t),Zi=null,Xs=0,t=At;for(;t!==null;)Vx(t.alternate,t),t=t.return;At=null}}function os(t,r){var s=t.timeoutHandle;s!==-1&&(t.timeoutHandle=-1,z2(s)),s=t.cancelPendingCommit,s!==null&&(t.cancelPendingCommit=null,s()),Ja=0,jf(),cn=t,At=s=Ia(t.current,null),Mt=r,Jt=0,Dr=null,kl=!1,ls=P(t,r),gf=!1,is=Tr=yf=xi=jl=Cn=0,yr=so=null,bf=!1,(r&8)!==0&&(r|=r&32);var c=t.entangledLanes;if(c!==0)for(t=t.entanglements,c&=r;0<c;){var p=31-Ve(c),y=1<<p;r|=t[p],c&=~y}return Za=r,uc(),s}function y1(t,r){gt=null,Y.H=Js,r===Pi||r===yc?(r=zp(),Jt=3):r===Nd?(r=zp(),Jt=4):Jt=r===ef?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Dr=r,At===null&&(Cn=1,Mc(t,Ir(r,t.current)))}function b1(){var t=Er.current;return t===null?!0:(Mt&4194048)===Mt?Yr===null:(Mt&62914560)===Mt||(Mt&536870912)!==0?t===Yr:!1}function v1(){var t=Y.H;return Y.H=Js,t===null?Js:t}function w1(){var t=Y.A;return Y.A=f2,t}function Yc(){Cn=4,kl||(Mt&4194048)!==Mt&&Er.current!==null||(ls=!0),(jl&134217727)===0&&(xi&134217727)===0||cn===null||Nl(cn,Mt,Tr,!1)}function Sf(t,r,s){var c=Vt;Vt|=2;var p=v1(),y=w1();(cn!==t||Mt!==r)&&(Uc=null,os(t,r)),r=!1;var S=Cn;e:do try{if(Jt!==0&&At!==null){var z=At,X=Dr;switch(Jt){case 8:jf(),S=6;break e;case 3:case 2:case 9:case 6:Er.current===null&&(r=!0);var ie=Jt;if(Jt=0,Dr=null,cs(t,z,X,ie),s&&ls){S=0;break e}break;default:ie=Jt,Jt=0,Dr=null,cs(t,z,X,ie)}}p2(),S=Cn;break}catch(pe){y1(t,pe)}while(!0);return r&&t.shellSuspendCounter++,Ua=si=null,Vt=c,Y.H=p,Y.A=y,At===null&&(cn=null,Mt=0,uc()),S}function p2(){for(;At!==null;)k1(At)}function x2(t,r){var s=Vt;Vt|=2;var c=v1(),p=w1();cn!==t||Mt!==r?(Uc=null,Hc=Se()+500,os(t,r)):ls=P(t,r);e:do try{if(Jt!==0&&At!==null){r=At;var y=Dr;t:switch(Jt){case 1:Jt=0,Dr=null,cs(t,r,y,1);break;case 2:case 9:if(Mp(y)){Jt=0,Dr=null,j1(r);break}r=function(){Jt!==2&&Jt!==9||cn!==t||(Jt=7),ya(t)},y.then(r,r);break e;case 3:Jt=7;break e;case 4:Jt=5;break e;case 7:Mp(y)?(Jt=0,Dr=null,j1(r)):(Jt=0,Dr=null,cs(t,r,y,7));break;case 5:var S=null;switch(At.tag){case 26:S=At.memoizedState;case 5:case 27:var z=At;if(S?o0(S):z.stateNode.complete){Jt=0,Dr=null;var X=z.sibling;if(X!==null)At=X;else{var ie=z.return;ie!==null?(At=ie,Xc(ie)):At=null}break t}}Jt=0,Dr=null,cs(t,r,y,5);break;case 6:Jt=0,Dr=null,cs(t,r,y,6);break;case 8:jf(),Cn=6;break e;default:throw Error(i(462))}}g2();break}catch(pe){y1(t,pe)}while(!0);return Ua=si=null,Y.H=c,Y.A=p,Vt=s,At!==null?0:(cn=null,Mt=0,uc(),Cn)}function g2(){for(;At!==null&&!$n();)k1(At)}function k1(t){var r=Wx(t.alternate,t,Za);t.memoizedProps=t.pendingProps,r===null?Xc(t):At=r}function j1(t){var r=t,s=r.alternate;switch(r.tag){case 15:case 0:r=Ix(s,r,r.pendingProps,r.type,void 0,Mt);break;case 11:r=Ix(s,r,r.pendingProps,r.type.render,r.ref,Mt);break;case 5:$d(r);default:Vx(s,r),r=At=wp(r,Za),r=Wx(s,r,Za)}t.memoizedProps=t.pendingProps,r===null?Xc(t):At=r}function cs(t,r,s,c){Ua=si=null,$d(r),Zi=null,Xs=0;var p=r.return;try{if(l2(t,p,r,s,Mt)){Cn=1,Mc(t,Ir(s,t.current)),At=null;return}}catch(y){if(p!==null)throw At=p,y;Cn=1,Mc(t,Ir(s,t.current)),At=null;return}r.flags&32768?(Lt||c===1?t=!0:ls||(Mt&536870912)!==0?t=!1:(kl=t=!0,(c===2||c===9||c===3||c===6)&&(c=Er.current,c!==null&&c.tag===13&&(c.flags|=16384))),S1(r,t)):Xc(r)}function Xc(t){var r=t;do{if((r.flags&32768)!==0){S1(r,kl);return}t=r.return;var s=o2(r.alternate,r,Za);if(s!==null){At=s;return}if(r=r.sibling,r!==null){At=r;return}At=r=t}while(r!==null);Cn===0&&(Cn=5)}function S1(t,r){do{var s=c2(t.alternate,t);if(s!==null){s.flags&=32767,At=s;return}if(s=t.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!r&&(t=t.sibling,t!==null)){At=t;return}At=t=s}while(t!==null);Cn=6,At=null}function C1(t,r,s,c,p,y,S,z,X){t.cancelPendingCommit=null;do Wc();while(In!==0);if((Vt&6)!==0)throw Error(i(327));if(r!==null){if(r===t.current)throw Error(i(177));if(y=r.lanes|r.childLanes,y|=dd,kt(t,s,y,S,z,X),t===cn&&(At=cn=null,Mt=0),ss=r,Cl=t,Ja=s,vf=y,wf=p,m1=c,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,w2(ne,function(){return T1(),null})):(t.callbackNode=null,t.callbackPriority=0),c=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||c){c=Y.T,Y.T=null,p=se.p,se.p=2,S=Vt,Vt|=4;try{u2(t,r,s)}finally{Vt=S,se.p=p,Y.T=c}}In=1,N1(),E1(),A1()}}function N1(){if(In===1){In=0;var t=Cl,r=ss,s=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||s){s=Y.T,Y.T=null;var c=se.p;se.p=2;var p=Vt;Vt|=4;try{i1(r,t);var y=Bf,S=fp(t.containerInfo),z=y.focusedElem,X=y.selectionRange;if(S!==z&&z&&z.ownerDocument&&dp(z.ownerDocument.documentElement,z)){if(X!==null&&id(z)){var ie=X.start,pe=X.end;if(pe===void 0&&(pe=ie),"selectionStart"in z)z.selectionStart=ie,z.selectionEnd=Math.min(pe,z.value.length);else{var Ce=z.ownerDocument||document,oe=Ce&&Ce.defaultView||window;if(oe.getSelection){var fe=oe.getSelection(),Ue=z.textContent.length,lt=Math.min(X.start,Ue),rn=X.end===void 0?lt:Math.min(X.end,Ue);!fe.extend&<>rn&&(S=rn,rn=lt,lt=S);var ee=up(z,lt),K=up(z,rn);if(ee&&K&&(fe.rangeCount!==1||fe.anchorNode!==ee.node||fe.anchorOffset!==ee.offset||fe.focusNode!==K.node||fe.focusOffset!==K.offset)){var le=Ce.createRange();le.setStart(ee.node,ee.offset),fe.removeAllRanges(),lt>rn?(fe.addRange(le),fe.extend(K.node,K.offset)):(le.setEnd(K.node,K.offset),fe.addRange(le))}}}}for(Ce=[],fe=z;fe=fe.parentNode;)fe.nodeType===1&&Ce.push({element:fe,left:fe.scrollLeft,top:fe.scrollTop});for(typeof z.focus=="function"&&z.focus(),z=0;z<Ce.length;z++){var be=Ce[z];be.element.scrollLeft=be.left,be.element.scrollTop=be.top}}au=!!_f,Bf=_f=null}finally{Vt=p,se.p=c,Y.T=s}}t.current=r,In=2}}function E1(){if(In===2){In=0;var t=Cl,r=ss,s=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||s){s=Y.T,Y.T=null;var c=se.p;se.p=2;var p=Vt;Vt|=4;try{t1(t,r.alternate,r)}finally{Vt=p,se.p=c,Y.T=s}}In=3}}function A1(){if(In===4||In===3){In=0,me();var t=Cl,r=ss,s=Ja,c=m1;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?In=5:(In=0,ss=Cl=null,D1(t,t.pendingLanes));var p=t.pendingLanes;if(p===0&&(Sl=null),We(s),r=r.stateNode,He&&typeof He.onCommitFiberRoot=="function")try{He.onCommitFiberRoot(Be,r,void 0,(r.current.flags&128)===128)}catch{}if(c!==null){r=Y.T,p=se.p,se.p=2,Y.T=null;try{for(var y=t.onRecoverableError,S=0;S<c.length;S++){var z=c[S];y(z.value,{componentStack:z.stack})}}finally{Y.T=r,se.p=p}}(Ja&3)!==0&&Wc(),ya(t),p=t.pendingLanes,(s&261930)!==0&&(p&42)!==0?t===kf?oo++:(oo=0,kf=t):oo=0,co(0)}}function D1(t,r){(t.pooledCacheLanes&=r)===0&&(r=t.pooledCache,r!=null&&(t.pooledCache=null,qs(r)))}function Wc(){return N1(),E1(),A1(),T1()}function T1(){if(In!==5)return!1;var t=Cl,r=vf;vf=0;var s=We(Ja),c=Y.T,p=se.p;try{se.p=32>s?32:s,Y.T=null,s=wf,wf=null;var y=Cl,S=Ja;if(In=0,ss=Cl=null,Ja=0,(Vt&6)!==0)throw Error(i(331));var z=Vt;if(Vt|=4,d1(y.current),o1(y,y.current,S,s),Vt=z,co(0,!1),He&&typeof He.onPostCommitFiberRoot=="function")try{He.onPostCommitFiberRoot(Be,y)}catch{}return!0}finally{se.p=p,Y.T=c,D1(t,r)}}function F1(t,r,s){r=Ir(s,r),r=Jd(t.stateNode,r,2),t=yl(t,r,2),t!==null&&(we(t,2),ya(t))}function en(t,r,s){if(t.tag===3)F1(t,t,s);else for(;r!==null;){if(r.tag===3){F1(r,t,s);break}else if(r.tag===1){var c=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Sl===null||!Sl.has(c))){t=Ir(s,t),s=Mx(2),c=yl(r,s,2),c!==null&&(Rx(s,c,r,t),we(c,2),ya(c));break}}r=r.return}}function Cf(t,r,s){var c=t.pingCache;if(c===null){c=t.pingCache=new h2;var p=new Set;c.set(r,p)}else p=c.get(r),p===void 0&&(p=new Set,c.set(r,p));p.has(s)||(gf=!0,p.add(s),t=y2.bind(null,t,r,s),r.then(t,t))}function y2(t,r,s){var c=t.pingCache;c!==null&&c.delete(r),t.pingedLanes|=t.suspendedLanes&s,t.warmLanes&=~s,cn===t&&(Mt&s)===s&&(Cn===4||Cn===3&&(Mt&62914560)===Mt&&300>Se()-Ic?(Vt&2)===0&&os(t,0):yf|=s,is===Mt&&(is=0)),ya(t)}function M1(t,r){r===0&&(r=nt()),t=ai(t,r),t!==null&&(we(t,r),ya(t))}function b2(t){var r=t.memoizedState,s=0;r!==null&&(s=r.retryLane),M1(t,s)}function v2(t,r){var s=0;switch(t.tag){case 31:case 13:var c=t.stateNode,p=t.memoizedState;p!==null&&(s=p.retryLane);break;case 19:c=t.stateNode;break;case 22:c=t.stateNode._retryCache;break;default:throw Error(i(314))}c!==null&&c.delete(r),M1(t,s)}function w2(t,r){return Ft(t,r)}var Gc=null,us=null,Nf=!1,Vc=!1,Ef=!1,El=0;function ya(t){t!==us&&t.next===null&&(us===null?Gc=us=t:us=us.next=t),Vc=!0,Nf||(Nf=!0,j2())}function co(t,r){if(!Ef&&Vc){Ef=!0;do for(var s=!1,c=Gc;c!==null;){if(t!==0){var p=c.pendingLanes;if(p===0)var y=0;else{var S=c.suspendedLanes,z=c.pingedLanes;y=(1<<31-Ve(42|t)+1)-1,y&=p&~(S&~z),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(s=!0,B1(c,y))}else y=Mt,y=wn(c,c===cn?y:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(y&3)===0||P(c,y)||(s=!0,B1(c,y));c=c.next}while(s);Ef=!1}}function k2(){R1()}function R1(){Vc=Nf=!1;var t=0;El!==0&&R2()&&(t=El);for(var r=Se(),s=null,c=Gc;c!==null;){var p=c.next,y=z1(c,r);y===0?(c.next=null,s===null?Gc=p:s.next=p,p===null&&(us=s)):(s=c,(t!==0||(y&3)!==0)&&(Vc=!0)),c=p}In!==0&&In!==5||co(t),El!==0&&(El=0)}function z1(t,r){for(var s=t.suspendedLanes,c=t.pingedLanes,p=t.expirationTimes,y=t.pendingLanes&-62914561;0<y;){var S=31-Ve(y),z=1<<S,X=p[S];X===-1?((z&s)===0||(z&c)!==0)&&(p[S]=Oe(z,r)):X<=r&&(t.expiredLanes|=z),y&=~z}if(r=cn,s=Mt,s=wn(t,t===r?s:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c=t.callbackNode,s===0||t===r&&(Jt===2||Jt===9)||t.cancelPendingCommit!==null)return c!==null&&c!==null&&Nt(c),t.callbackNode=null,t.callbackPriority=0;if((s&3)===0||P(t,s)){if(r=s&-s,r===t.callbackPriority)return r;switch(c!==null&&Nt(c),We(s)){case 2:case 8:s=ce;break;case 32:s=ne;break;case 268435456:s=ve;break;default:s=ne}return c=_1.bind(null,t),s=Ft(s,c),t.callbackPriority=r,t.callbackNode=s,r}return c!==null&&c!==null&&Nt(c),t.callbackPriority=2,t.callbackNode=null,2}function _1(t,r){if(In!==0&&In!==5)return t.callbackNode=null,t.callbackPriority=0,null;var s=t.callbackNode;if(Wc()&&t.callbackNode!==s)return null;var c=Mt;return c=wn(t,t===cn?c:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c===0?null:(x1(t,c,r),z1(t,Se()),t.callbackNode!=null&&t.callbackNode===s?_1.bind(null,t):null)}function B1(t,r){if(Wc())return null;x1(t,r,!0)}function j2(){_2(function(){(Vt&6)!==0?Ft(G,k2):R1()})}function Af(){if(El===0){var t=Ki;t===0&&(t=_t,_t<<=1,(_t&261888)===0&&(_t=256)),El=t}return El}function O1(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Ql(""+t)}function $1(t,r){var s=r.ownerDocument.createElement("input");return s.name=r.name,s.value=r.value,t.id&&s.setAttribute("form",t.id),r.parentNode.insertBefore(s,r),t=new FormData(t),s.parentNode.removeChild(s),t}function S2(t,r,s,c,p){if(r==="submit"&&s&&s.stateNode===p){var y=O1((p[gn]||null).action),S=c.submitter;S&&(r=(r=S[gn]||null)?O1(r.formAction):S.getAttribute("formAction"),r!==null&&(y=r,S=null));var z=new _i("action","action",null,c,p);t.push({event:z,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(El!==0){var X=S?$1(p,S):new FormData(p);Gd(s,{pending:!0,data:X,method:p.method,action:y},null,X)}}else typeof y=="function"&&(z.preventDefault(),X=S?$1(p,S):new FormData(p),Gd(s,{pending:!0,data:X,method:p.method,action:y},y,X))},currentTarget:p}]})}}for(var Df=0;Df<ud.length;Df++){var Tf=ud[Df],C2=Tf.toLowerCase(),N2=Tf[0].toUpperCase()+Tf.slice(1);ra(C2,"on"+N2)}ra(pp,"onAnimationEnd"),ra(xp,"onAnimationIteration"),ra(gp,"onAnimationStart"),ra("dblclick","onDoubleClick"),ra("focusin","onFocus"),ra("focusout","onBlur"),ra(Uv,"onTransitionRun"),ra(qv,"onTransitionStart"),ra(Yv,"onTransitionCancel"),ra(yp,"onTransitionEnd"),Ra("onMouseEnter",["mouseout","mouseover"]),Ra("onMouseLeave",["mouseout","mouseover"]),Ra("onPointerEnter",["pointerout","pointerover"]),Ra("onPointerLeave",["pointerout","pointerover"]),fr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),fr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),fr("onBeforeInput",["compositionend","keypress","textInput","paste"]),fr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),fr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),fr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var uo="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(" "),E2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(uo));function L1(t,r){r=(r&4)!==0;for(var s=0;s<t.length;s++){var c=t[s],p=c.event;c=c.listeners;e:{var y=void 0;if(r)for(var S=c.length-1;0<=S;S--){var z=c[S],X=z.instance,ie=z.currentTarget;if(z=z.listener,X!==y&&p.isPropagationStopped())break e;y=z,p.currentTarget=ie;try{y(p)}catch(pe){cc(pe)}p.currentTarget=null,y=X}else for(S=0;S<c.length;S++){if(z=c[S],X=z.instance,ie=z.currentTarget,z=z.listener,X!==y&&p.isPropagationStopped())break e;y=z,p.currentTarget=ie;try{y(p)}catch(pe){cc(pe)}p.currentTarget=null,y=X}}}}function Dt(t,r){var s=r[sl];s===void 0&&(s=r[sl]=new Set);var c=t+"__bubble";s.has(c)||(I1(r,t,2,!1),s.add(c))}function Ff(t,r,s){var c=0;r&&(c|=4),I1(s,t,c,r)}var Kc="_reactListening"+Math.random().toString(36).slice(2);function Mf(t){if(!t[Kc]){t[Kc]=!0,Fa.forEach(function(s){s!=="selectionchange"&&(E2.has(s)||Ff(s,!1,t),Ff(s,!0,t))});var r=t.nodeType===9?t:t.ownerDocument;r===null||r[Kc]||(r[Kc]=!0,Ff("selectionchange",!1,r))}}function I1(t,r,s,c){switch(p0(r)){case 2:var p=tw;break;case 8:p=nw;break;default:p=Gf}s=p.bind(null,r,s,t),p=void 0,!_s||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(p=!0),c?p!==void 0?t.addEventListener(r,s,{capture:!0,passive:p}):t.addEventListener(r,s,!0):p!==void 0?t.addEventListener(r,s,{passive:p}):t.addEventListener(r,s,!1)}function Rf(t,r,s,c,p){var y=c;if((r&1)===0&&(r&2)===0&&c!==null)e:for(;;){if(c===null)return;var S=c.tag;if(S===3||S===4){var z=c.stateNode.containerInfo;if(z===p)break;if(S===4)for(S=c.return;S!==null;){var X=S.tag;if((X===3||X===4)&&S.stateNode.containerInfo===p)return;S=S.return}for(;z!==null;){if(S=ca(z),S===null)return;if(X=S.tag,X===5||X===6||X===26||X===27){c=y=S;continue e}z=z.parentNode}}c=c.return}Po(function(){var ie=y,pe=Mi(s),Ce=[];e:{var oe=bp.get(t);if(oe!==void 0){var fe=_i,Ue=t;switch(t){case"keypress":if(zi(s)===0)break e;case"keydown":case"keyup":fe=ic;break;case"focusin":Ue="focus",fe=ei;break;case"focusout":Ue="blur",fe=ei;break;case"beforeblur":case"afterblur":fe=ei;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":fe=Bs;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":fe=ma;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":fe=ae;break;case pp:case xp:case gp:fe=Jo;break;case yp:fe=je;break;case"scroll":case"scrollend":fe=td;break;case"wheel":fe=It;break;case"copy":case"cut":case"paste":fe=rd;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":fe=M;break;case"toggle":case"beforetoggle":fe=Pe}var lt=(r&4)!==0,rn=!lt&&(t==="scroll"||t==="scrollend"),ee=lt?oe!==null?oe+"Capture":null:oe;lt=[];for(var K=ie,le;K!==null;){var be=K;if(le=be.stateNode,be=be.tag,be!==5&&be!==26&&be!==27||le===null||ee===null||(be=Pl(K,ee),be!=null&<.push(fo(K,be,le))),rn)break;K=K.return}0<lt.length&&(oe=new fe(oe,Ue,null,s,pe),Ce.push({event:oe,listeners:lt}))}}if((r&7)===0){e:{if(oe=t==="mouseover"||t==="pointerover",fe=t==="mouseout"||t==="pointerout",oe&&s!==na&&(Ue=s.relatedTarget||s.fromElement)&&(ca(Ue)||Ue[dr]))break e;if((fe||oe)&&(oe=pe.window===pe?pe:(oe=pe.ownerDocument)?oe.defaultView||oe.parentWindow:window,fe?(Ue=s.relatedTarget||s.toElement,fe=ie,Ue=Ue?ca(Ue):null,Ue!==null&&(rn=u(Ue),lt=Ue.tag,Ue!==rn||lt!==5&<!==27&<!==6)&&(Ue=null)):(fe=null,Ue=ie),fe!==Ue)){if(lt=Bs,be="onMouseLeave",ee="onMouseEnter",K="mouse",(t==="pointerout"||t==="pointerover")&&(lt=M,be="onPointerLeave",ee="onPointerEnter",K="pointer"),rn=fe==null?oe:Wl(fe),le=Ue==null?oe:Wl(Ue),oe=new lt(be,K+"leave",fe,s,pe),oe.target=rn,oe.relatedTarget=le,be=null,ca(pe)===ie&&(lt=new lt(ee,K+"enter",Ue,s,pe),lt.target=le,lt.relatedTarget=rn,be=lt),rn=be,fe&&Ue)t:{for(lt=A2,ee=fe,K=Ue,le=0,be=ee;be;be=lt(be))le++;be=0;for(var et=K;et;et=lt(et))be++;for(;0<le-be;)ee=lt(ee),le--;for(;0<be-le;)K=lt(K),be--;for(;le--;){if(ee===K||K!==null&&ee===K.alternate){lt=ee;break t}ee=lt(ee),K=lt(K)}lt=null}else lt=null;fe!==null&&H1(Ce,oe,fe,lt,!1),Ue!==null&&rn!==null&&H1(Ce,rn,Ue,lt,!0)}}e:{if(oe=ie?Wl(ie):window,fe=oe.nodeName&&oe.nodeName.toLowerCase(),fe==="select"||fe==="input"&&oe.type==="file")var qt=ap;else if(np(oe))if(lp)qt=Lv;else{qt=Ov;var Ge=Bv}else fe=oe.nodeName,!fe||fe.toLowerCase()!=="input"||oe.type!=="checkbox"&&oe.type!=="radio"?ie&&ta(ie.elementType)&&(qt=ap):qt=$v;if(qt&&(qt=qt(t,ie))){rp(Ce,qt,s,pe);break e}Ge&&Ge(t,oe,ie),t==="focusout"&&ie&&oe.type==="number"&&ie.memoizedProps.value!=null&&da(oe,"number",oe.value)}switch(Ge=ie?Wl(ie):window,t){case"focusin":(np(Ge)||Ge.contentEditable==="true")&&(Hi=Ge,sd=ie,Is=null);break;case"focusout":Is=sd=Hi=null;break;case"mousedown":od=!0;break;case"contextmenu":case"mouseup":case"dragend":od=!1,hp(Ce,s,pe);break;case"selectionchange":if(Hv)break;case"keydown":case"keyup":hp(Ce,s,pe)}var vt;if(dt)e:{switch(t){case"compositionstart":var Rt="onCompositionStart";break e;case"compositionend":Rt="onCompositionEnd";break e;case"compositionupdate":Rt="onCompositionUpdate";break e}Rt=void 0}else Ii?Nn(t,s)&&(Rt="onCompositionEnd"):t==="keydown"&&s.keyCode===229&&(Rt="onCompositionStart");Rt&&(Kn&&s.locale!=="ko"&&(Ii||Rt!=="onCompositionStart"?Rt==="onCompositionEnd"&&Ii&&(vt=ul()):($r=pe,Ba="value"in $r?$r.value:$r.textContent,Ii=!0)),Ge=Qc(ie,Rt),0<Ge.length&&(Rt=new Zt(Rt,t,null,s,pe),Ce.push({event:Rt,listeners:Ge}),vt?Rt.data=vt:(vt=on(s),vt!==null&&(Rt.data=vt)))),(vt=ti?Mv(t,s):Rv(t,s))&&(Rt=Qc(ie,"onBeforeInput"),0<Rt.length&&(Ge=new Zt("onBeforeInput","beforeinput",null,s,pe),Ce.push({event:Ge,listeners:Rt}),Ge.data=vt)),S2(Ce,t,ie,s,pe)}L1(Ce,r)})}function fo(t,r,s){return{instance:t,listener:r,currentTarget:s}}function Qc(t,r){for(var s=r+"Capture",c=[];t!==null;){var p=t,y=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||y===null||(p=Pl(t,s),p!=null&&c.unshift(fo(t,p,y)),p=Pl(t,r),p!=null&&c.push(fo(t,p,y))),t.tag===3)return c;t=t.return}return[]}function A2(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function H1(t,r,s,c,p){for(var y=r._reactName,S=[];s!==null&&s!==c;){var z=s,X=z.alternate,ie=z.stateNode;if(z=z.tag,X!==null&&X===c)break;z!==5&&z!==26&&z!==27||ie===null||(X=ie,p?(ie=Pl(s,y),ie!=null&&S.unshift(fo(s,ie,X))):p||(ie=Pl(s,y),ie!=null&&S.push(fo(s,ie,X)))),s=s.return}S.length!==0&&t.push({event:r,listeners:S})}var D2=/\r\n?/g,T2=/\u0000|\uFFFD/g;function U1(t){return(typeof t=="string"?t:""+t).replace(D2,`
|
|
49
|
-
`).replace(T2,"")}function q1(t,r){return r=U1(r),U1(t)===r}function nn(t,r,s,c,p,y){switch(s){case"children":typeof c=="string"?r==="body"||r==="textarea"&&c===""||Gt(t,c):(typeof c=="number"||typeof c=="bigint")&&r!=="body"&&Gt(t,""+c);break;case"className":Vl(t,"class",c);break;case"tabIndex":Vl(t,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":Vl(t,s,c);break;case"style":ea(t,c,y);break;case"data":if(r!=="object"){Vl(t,"data",c);break}case"src":case"href":if(c===""&&(r!=="a"||s!=="href")){t.removeAttribute(s);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(s);break}c=Ql(""+c),t.setAttribute(s,c);break;case"action":case"formAction":if(typeof c=="function"){t.setAttribute(s,"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 y=="function"&&(s==="formAction"?(r!=="input"&&nn(t,r,"name",p.name,p,null),nn(t,r,"formEncType",p.formEncType,p,null),nn(t,r,"formMethod",p.formMethod,p,null),nn(t,r,"formTarget",p.formTarget,p,null)):(nn(t,r,"encType",p.encType,p,null),nn(t,r,"method",p.method,p,null),nn(t,r,"target",p.target,p,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(s);break}c=Ql(""+c),t.setAttribute(s,c);break;case"onClick":c!=null&&(t.onclick=tr);break;case"onScroll":c!=null&&Dt("scroll",t);break;case"onScrollEnd":c!=null&&Dt("scrollend",t);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(i(61));if(s=c.__html,s!=null){if(p.children!=null)throw Error(i(60));t.innerHTML=s}}break;case"multiple":t.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":t.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){t.removeAttribute("xlink:href");break}s=Ql(""+c),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,""+c):t.removeAttribute(s);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":c&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,""):t.removeAttribute(s);break;case"capture":case"download":c===!0?t.setAttribute(s,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,c):t.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?t.setAttribute(s,c):t.removeAttribute(s);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?t.removeAttribute(s):t.setAttribute(s,c);break;case"popover":Dt("beforetoggle",t),Dt("toggle",t),Gl(t,"popover",c);break;case"xlinkActuate":Pr(t,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Pr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Pr(t,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Pr(t,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Pr(t,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Pr(t,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Pr(t,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Pr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Pr(t,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":Gl(t,"is",c);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=ed.get(s)||s,Gl(t,s,c))}}function zf(t,r,s,c,p,y){switch(s){case"style":ea(t,c,y);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(i(61));if(s=c.__html,s!=null){if(p.children!=null)throw Error(i(60));t.innerHTML=s}}break;case"children":typeof c=="string"?Gt(t,c):(typeof c=="number"||typeof c=="bigint")&&Gt(t,""+c);break;case"onScroll":c!=null&&Dt("scroll",t);break;case"onScrollEnd":c!=null&&Dt("scrollend",t);break;case"onClick":c!=null&&(t.onclick=tr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ma.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(p=s.endsWith("Capture"),r=s.slice(2,p?s.length-7:void 0),y=t[gn]||null,y=y!=null?y[s]:null,typeof y=="function"&&t.removeEventListener(r,y,p),typeof c=="function")){typeof y!="function"&&y!==null&&(s in t?t[s]=null:t.hasAttribute(s)&&t.removeAttribute(s)),t.addEventListener(r,c,p);break e}s in t?t[s]=c:c===!0?t.setAttribute(s,""):Gl(t,s,c)}}}function Jn(t,r,s){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Dt("error",t),Dt("load",t);var c=!1,p=!1,y;for(y in s)if(s.hasOwnProperty(y)){var S=s[y];if(S!=null)switch(y){case"src":c=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:nn(t,r,y,S,s,null)}}p&&nn(t,r,"srcSet",s.srcSet,s,null),c&&nn(t,r,"src",s.src,s,null);return;case"input":Dt("invalid",t);var z=y=S=p=null,X=null,ie=null;for(c in s)if(s.hasOwnProperty(c)){var pe=s[c];if(pe!=null)switch(c){case"name":p=pe;break;case"type":S=pe;break;case"checked":X=pe;break;case"defaultChecked":ie=pe;break;case"value":y=pe;break;case"defaultValue":z=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(i(137,r));break;default:nn(t,r,c,pe,s,null)}}Sr(t,y,z,X,ie,S,p,!1);return;case"select":Dt("invalid",t),c=S=y=null;for(p in s)if(s.hasOwnProperty(p)&&(z=s[p],z!=null))switch(p){case"value":y=z;break;case"defaultValue":S=z;break;case"multiple":c=z;default:nn(t,r,p,z,s,null)}r=y,s=S,t.multiple=!!c,r!=null?mr(t,!!c,r,!1):s!=null&&mr(t,!!c,s,!0);return;case"textarea":Dt("invalid",t),y=p=c=null;for(S in s)if(s.hasOwnProperty(S)&&(z=s[S],z!=null))switch(S){case"value":c=z;break;case"defaultValue":p=z;break;case"children":y=z;break;case"dangerouslySetInnerHTML":if(z!=null)throw Error(i(91));break;default:nn(t,r,S,z,s,null)}Ln(t,c,p,y);return;case"option":for(X in s)if(s.hasOwnProperty(X)&&(c=s[X],c!=null))switch(X){case"selected":t.selected=c&&typeof c!="function"&&typeof c!="symbol";break;default:nn(t,r,X,c,s,null)}return;case"dialog":Dt("beforetoggle",t),Dt("toggle",t),Dt("cancel",t),Dt("close",t);break;case"iframe":case"object":Dt("load",t);break;case"video":case"audio":for(c=0;c<uo.length;c++)Dt(uo[c],t);break;case"image":Dt("error",t),Dt("load",t);break;case"details":Dt("toggle",t);break;case"embed":case"source":case"link":Dt("error",t),Dt("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ie in s)if(s.hasOwnProperty(ie)&&(c=s[ie],c!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:nn(t,r,ie,c,s,null)}return;default:if(ta(r)){for(pe in s)s.hasOwnProperty(pe)&&(c=s[pe],c!==void 0&&zf(t,r,pe,c,s,void 0));return}}for(z in s)s.hasOwnProperty(z)&&(c=s[z],c!=null&&nn(t,r,z,c,s,null))}function F2(t,r,s,c){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,y=null,S=null,z=null,X=null,ie=null,pe=null;for(fe in s){var Ce=s[fe];if(s.hasOwnProperty(fe)&&Ce!=null)switch(fe){case"checked":break;case"value":break;case"defaultValue":X=Ce;default:c.hasOwnProperty(fe)||nn(t,r,fe,null,c,Ce)}}for(var oe in c){var fe=c[oe];if(Ce=s[oe],c.hasOwnProperty(oe)&&(fe!=null||Ce!=null))switch(oe){case"type":y=fe;break;case"name":p=fe;break;case"checked":ie=fe;break;case"defaultChecked":pe=fe;break;case"value":S=fe;break;case"defaultValue":z=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(i(137,r));break;default:fe!==Ce&&nn(t,r,oe,fe,c,Ce)}}Kl(t,S,z,X,ie,pe,y,p);return;case"select":fe=S=z=oe=null;for(y in s)if(X=s[y],s.hasOwnProperty(y)&&X!=null)switch(y){case"value":break;case"multiple":fe=X;default:c.hasOwnProperty(y)||nn(t,r,y,null,c,X)}for(p in c)if(y=c[p],X=s[p],c.hasOwnProperty(p)&&(y!=null||X!=null))switch(p){case"value":oe=y;break;case"defaultValue":z=y;break;case"multiple":S=y;default:y!==X&&nn(t,r,p,y,c,X)}r=z,s=S,c=fe,oe!=null?mr(t,!!s,oe,!1):!!c!=!!s&&(r!=null?mr(t,!!s,r,!0):mr(t,!!s,s?[]:"",!1));return;case"textarea":fe=oe=null;for(z in s)if(p=s[z],s.hasOwnProperty(z)&&p!=null&&!c.hasOwnProperty(z))switch(z){case"value":break;case"children":break;default:nn(t,r,z,null,c,p)}for(S in c)if(p=c[S],y=s[S],c.hasOwnProperty(S)&&(p!=null||y!=null))switch(S){case"value":oe=p;break;case"defaultValue":fe=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(i(91));break;default:p!==y&&nn(t,r,S,p,c,y)}Qo(t,oe,fe);return;case"option":for(var Ue in s)if(oe=s[Ue],s.hasOwnProperty(Ue)&&oe!=null&&!c.hasOwnProperty(Ue))switch(Ue){case"selected":t.selected=!1;break;default:nn(t,r,Ue,null,c,oe)}for(X in c)if(oe=c[X],fe=s[X],c.hasOwnProperty(X)&&oe!==fe&&(oe!=null||fe!=null))switch(X){case"selected":t.selected=oe&&typeof oe!="function"&&typeof oe!="symbol";break;default:nn(t,r,X,oe,c,fe)}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 lt in s)oe=s[lt],s.hasOwnProperty(lt)&&oe!=null&&!c.hasOwnProperty(lt)&&nn(t,r,lt,null,c,oe);for(ie in c)if(oe=c[ie],fe=s[ie],c.hasOwnProperty(ie)&&oe!==fe&&(oe!=null||fe!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(i(137,r));break;default:nn(t,r,ie,oe,c,fe)}return;default:if(ta(r)){for(var rn in s)oe=s[rn],s.hasOwnProperty(rn)&&oe!==void 0&&!c.hasOwnProperty(rn)&&zf(t,r,rn,void 0,c,oe);for(pe in c)oe=c[pe],fe=s[pe],!c.hasOwnProperty(pe)||oe===fe||oe===void 0&&fe===void 0||zf(t,r,pe,oe,c,fe);return}}for(var ee in s)oe=s[ee],s.hasOwnProperty(ee)&&oe!=null&&!c.hasOwnProperty(ee)&&nn(t,r,ee,null,c,oe);for(Ce in c)oe=c[Ce],fe=s[Ce],!c.hasOwnProperty(Ce)||oe===fe||oe==null&&fe==null||nn(t,r,Ce,oe,c,fe)}function Y1(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function M2(){if(typeof performance.getEntriesByType=="function"){for(var t=0,r=0,s=performance.getEntriesByType("resource"),c=0;c<s.length;c++){var p=s[c],y=p.transferSize,S=p.initiatorType,z=p.duration;if(y&&z&&Y1(S)){for(S=0,z=p.responseEnd,c+=1;c<s.length;c++){var X=s[c],ie=X.startTime;if(ie>z)break;var pe=X.transferSize,Ce=X.initiatorType;pe&&Y1(Ce)&&(X=X.responseEnd,S+=pe*(X<z?1:(z-ie)/(X-ie)))}if(--c,r+=8*(y+S)/(p.duration/1e3),t++,10<t)break}}if(0<t)return r/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var _f=null,Bf=null;function Pc(t){return t.nodeType===9?t:t.ownerDocument}function X1(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function W1(t,r){if(t===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&r==="foreignObject"?0:t}function Of(t,r){return t==="textarea"||t==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var $f=null;function R2(){var t=window.event;return t&&t.type==="popstate"?t===$f?!1:($f=t,!0):($f=null,!1)}var G1=typeof setTimeout=="function"?setTimeout:void 0,z2=typeof clearTimeout=="function"?clearTimeout:void 0,V1=typeof Promise=="function"?Promise:void 0,_2=typeof queueMicrotask=="function"?queueMicrotask:typeof V1<"u"?function(t){return V1.resolve(null).then(t).catch(B2)}:G1;function B2(t){setTimeout(function(){throw t})}function Al(t){return t==="head"}function K1(t,r){var s=r,c=0;do{var p=s.nextSibling;if(t.removeChild(s),p&&p.nodeType===8)if(s=p.data,s==="/$"||s==="/&"){if(c===0){t.removeChild(p),ms(r);return}c--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")c++;else if(s==="html")ho(t.ownerDocument.documentElement);else if(s==="head"){s=t.ownerDocument.head,ho(s);for(var y=s.firstChild;y;){var S=y.nextSibling,z=y.nodeName;y[Ta]||z==="SCRIPT"||z==="STYLE"||z==="LINK"&&y.rel.toLowerCase()==="stylesheet"||s.removeChild(y),y=S}}else s==="body"&&ho(t.ownerDocument.body);s=p}while(s);ms(r)}function Q1(t,r){var s=t;t=0;do{var c=s.nextSibling;if(s.nodeType===1?r?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(r?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),c&&c.nodeType===8)if(s=c.data,s==="/$"){if(t===0)break;t--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||t++;s=c}while(s)}function Lf(t){var r=t.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var s=r;switch(r=r.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Lf(s),Ti(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}t.removeChild(s)}}function O2(t,r,s,c){for(;t.nodeType===1;){var p=s;if(t.nodeName.toLowerCase()!==r.toLowerCase()){if(!c&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(c){if(!t[Ta])switch(r){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(y=t.getAttribute("rel"),y==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(y!==p.rel||t.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||t.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||t.getAttribute("title")!==(p.title==null?null:p.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(y=t.getAttribute("src"),(y!==(p.src==null?null:p.src)||t.getAttribute("type")!==(p.type==null?null:p.type)||t.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&y&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(r==="input"&&t.type==="hidden"){var y=p.name==null?null:""+p.name;if(p.type==="hidden"&&t.getAttribute("name")===y)return t}else return t;if(t=Xr(t.nextSibling),t===null)break}return null}function $2(t,r,s){if(r==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=Xr(t.nextSibling),t===null))return null;return t}function P1(t,r){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!r||(t=Xr(t.nextSibling),t===null))return null;return t}function If(t){return t.data==="$?"||t.data==="$~"}function Hf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function L2(t,r){var s=t.ownerDocument;if(t.data==="$~")t._reactRetry=r;else if(t.data!=="$?"||s.readyState!=="loading")r();else{var c=function(){r(),s.removeEventListener("DOMContentLoaded",c)};s.addEventListener("DOMContentLoaded",c),t._reactRetry=c}}function Xr(t){for(;t!=null;t=t.nextSibling){var r=t.nodeType;if(r===1||r===3)break;if(r===8){if(r=t.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return t}var Uf=null;function Z1(t){t=t.nextSibling;for(var r=0;t;){if(t.nodeType===8){var s=t.data;if(s==="/$"||s==="/&"){if(r===0)return Xr(t.nextSibling);r--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||r++}t=t.nextSibling}return null}function J1(t){t=t.previousSibling;for(var r=0;t;){if(t.nodeType===8){var s=t.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(r===0)return t;r--}else s!=="/$"&&s!=="/&"||r++}t=t.previousSibling}return null}function e0(t,r,s){switch(r=Pc(s),t){case"html":if(t=r.documentElement,!t)throw Error(i(452));return t;case"head":if(t=r.head,!t)throw Error(i(453));return t;case"body":if(t=r.body,!t)throw Error(i(454));return t;default:throw Error(i(451))}}function ho(t){for(var r=t.attributes;r.length;)t.removeAttributeNode(r[0]);Ti(t)}var Wr=new Map,t0=new Set;function Zc(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var el=se.d;se.d={f:I2,r:H2,D:U2,C:q2,L:Y2,m:X2,X:G2,S:W2,M:V2};function I2(){var t=el.f(),r=qc();return t||r}function H2(t){var r=Vn(t);r!==null&&r.tag===5&&r.type==="form"?yx(r):el.r(t)}var ds=typeof document>"u"?null:document;function n0(t,r,s){var c=ds;if(c&&typeof r=="string"&&r){var p=hr(r);p='link[rel="'+t+'"][href="'+p+'"]',typeof s=="string"&&(p+='[crossorigin="'+s+'"]'),t0.has(p)||(t0.add(p),t={rel:t,crossOrigin:s,href:r},c.querySelector(p)===null&&(r=c.createElement("link"),Jn(r,"link",t),jn(r),c.head.appendChild(r)))}}function U2(t){el.D(t),n0("dns-prefetch",t,null)}function q2(t,r){el.C(t,r),n0("preconnect",t,r)}function Y2(t,r,s){el.L(t,r,s);var c=ds;if(c&&t&&r){var p='link[rel="preload"][as="'+hr(r)+'"]';r==="image"&&s&&s.imageSrcSet?(p+='[imagesrcset="'+hr(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(p+='[imagesizes="'+hr(s.imageSizes)+'"]')):p+='[href="'+hr(t)+'"]';var y=p;switch(r){case"style":y=fs(t);break;case"script":y=hs(t)}Wr.has(y)||(t=g({rel:"preload",href:r==="image"&&s&&s.imageSrcSet?void 0:t,as:r},s),Wr.set(y,t),c.querySelector(p)!==null||r==="style"&&c.querySelector(mo(y))||r==="script"&&c.querySelector(po(y))||(r=c.createElement("link"),Jn(r,"link",t),jn(r),c.head.appendChild(r)))}}function X2(t,r){el.m(t,r);var s=ds;if(s&&t){var c=r&&typeof r.as=="string"?r.as:"script",p='link[rel="modulepreload"][as="'+hr(c)+'"][href="'+hr(t)+'"]',y=p;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=hs(t)}if(!Wr.has(y)&&(t=g({rel:"modulepreload",href:t},r),Wr.set(y,t),s.querySelector(p)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(po(y)))return}c=s.createElement("link"),Jn(c,"link",t),jn(c),s.head.appendChild(c)}}}function W2(t,r,s){el.S(t,r,s);var c=ds;if(c&&t){var p=jr(c).hoistableStyles,y=fs(t);r=r||"default";var S=p.get(y);if(!S){var z={loading:0,preload:null};if(S=c.querySelector(mo(y)))z.loading=5;else{t=g({rel:"stylesheet",href:t,"data-precedence":r},s),(s=Wr.get(y))&&qf(t,s);var X=S=c.createElement("link");jn(X),Jn(X,"link",t),X._p=new Promise(function(ie,pe){X.onload=ie,X.onerror=pe}),X.addEventListener("load",function(){z.loading|=1}),X.addEventListener("error",function(){z.loading|=2}),z.loading|=4,Jc(S,r,c)}S={type:"stylesheet",instance:S,count:1,state:z},p.set(y,S)}}}function G2(t,r){el.X(t,r);var s=ds;if(s&&t){var c=jr(s).hoistableScripts,p=hs(t),y=c.get(p);y||(y=s.querySelector(po(p)),y||(t=g({src:t,async:!0},r),(r=Wr.get(p))&&Yf(t,r),y=s.createElement("script"),jn(y),Jn(y,"link",t),s.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},c.set(p,y))}}function V2(t,r){el.M(t,r);var s=ds;if(s&&t){var c=jr(s).hoistableScripts,p=hs(t),y=c.get(p);y||(y=s.querySelector(po(p)),y||(t=g({src:t,async:!0,type:"module"},r),(r=Wr.get(p))&&Yf(t,r),y=s.createElement("script"),jn(y),Jn(y,"link",t),s.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},c.set(p,y))}}function r0(t,r,s,c){var p=(p=ye.current)?Zc(p):null;if(!p)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(r=fs(s.href),s=jr(p).hoistableStyles,c=s.get(r),c||(c={type:"style",instance:null,count:0,state:null},s.set(r,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){t=fs(s.href);var y=jr(p).hoistableStyles,S=y.get(t);if(S||(p=p.ownerDocument||p,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(t,S),(y=p.querySelector(mo(t)))&&!y._p&&(S.instance=y,S.state.loading=5),Wr.has(t)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Wr.set(t,s),y||K2(p,t,s,S.state))),r&&c===null)throw Error(i(528,""));return S}if(r&&c!==null)throw Error(i(529,""));return null;case"script":return r=s.async,s=s.src,typeof s=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=hs(s),s=jr(p).hoistableScripts,c=s.get(r),c||(c={type:"script",instance:null,count:0,state:null},s.set(r,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,t))}}function fs(t){return'href="'+hr(t)+'"'}function mo(t){return'link[rel="stylesheet"]['+t+"]"}function a0(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function K2(t,r,s,c){t.querySelector('link[rel="preload"][as="style"]['+r+"]")?c.loading=1:(r=t.createElement("link"),c.preload=r,r.addEventListener("load",function(){return c.loading|=1}),r.addEventListener("error",function(){return c.loading|=2}),Jn(r,"link",s),jn(r),t.head.appendChild(r))}function hs(t){return'[src="'+hr(t)+'"]'}function po(t){return"script[async]"+t}function l0(t,r,s){if(r.count++,r.instance===null)switch(r.type){case"style":var c=t.querySelector('style[data-href~="'+hr(s.href)+'"]');if(c)return r.instance=c,jn(c),c;var p=g({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return c=(t.ownerDocument||t).createElement("style"),jn(c),Jn(c,"style",p),Jc(c,s.precedence,t),r.instance=c;case"stylesheet":p=fs(s.href);var y=t.querySelector(mo(p));if(y)return r.state.loading|=4,r.instance=y,jn(y),y;c=a0(s),(p=Wr.get(p))&&qf(c,p),y=(t.ownerDocument||t).createElement("link"),jn(y);var S=y;return S._p=new Promise(function(z,X){S.onload=z,S.onerror=X}),Jn(y,"link",c),r.state.loading|=4,Jc(y,s.precedence,t),r.instance=y;case"script":return y=hs(s.src),(p=t.querySelector(po(y)))?(r.instance=p,jn(p),p):(c=s,(p=Wr.get(y))&&(c=g({},s),Yf(c,p)),t=t.ownerDocument||t,p=t.createElement("script"),jn(p),Jn(p,"link",c),t.head.appendChild(p),r.instance=p);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(c=r.instance,r.state.loading|=4,Jc(c,s.precedence,t));return r.instance}function Jc(t,r,s){for(var c=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=c.length?c[c.length-1]:null,y=p,S=0;S<c.length;S++){var z=c[S];if(z.dataset.precedence===r)y=z;else if(y!==p)break}y?y.parentNode.insertBefore(t,y.nextSibling):(r=s.nodeType===9?s.head:s,r.insertBefore(t,r.firstChild))}function qf(t,r){t.crossOrigin==null&&(t.crossOrigin=r.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=r.referrerPolicy),t.title==null&&(t.title=r.title)}function Yf(t,r){t.crossOrigin==null&&(t.crossOrigin=r.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=r.referrerPolicy),t.integrity==null&&(t.integrity=r.integrity)}var eu=null;function i0(t,r,s){if(eu===null){var c=new Map,p=eu=new Map;p.set(s,c)}else p=eu,c=p.get(s),c||(c=new Map,p.set(s,c));if(c.has(t))return c;for(c.set(t,null),s=s.getElementsByTagName(t),p=0;p<s.length;p++){var y=s[p];if(!(y[Ta]||y[xn]||t==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var S=y.getAttribute(r)||"";S=t+S;var z=c.get(S);z?z.push(y):c.set(S,[y])}}return c}function s0(t,r,s){t=t.ownerDocument||t,t.head.insertBefore(s,r==="title"?t.querySelector("head > title"):null)}function Q2(t,r,s){if(s===1||r.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return t=r.disabled,typeof r.precedence=="string"&&t==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function o0(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function P2(t,r,s,c){if(s.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var p=fs(c.href),y=r.querySelector(mo(p));if(y){r=y._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(t.count++,t=tu.bind(t),r.then(t,t)),s.state.loading|=4,s.instance=y,jn(y);return}y=r.ownerDocument||r,c=a0(c),(p=Wr.get(p))&&qf(c,p),y=y.createElement("link"),jn(y);var S=y;S._p=new Promise(function(z,X){S.onload=z,S.onerror=X}),Jn(y,"link",c),s.instance=y}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(s,r),(r=s.state.preload)&&(s.state.loading&3)===0&&(t.count++,s=tu.bind(t),r.addEventListener("load",s),r.addEventListener("error",s))}}var Xf=0;function Z2(t,r){return t.stylesheets&&t.count===0&&ru(t,t.stylesheets),0<t.count||0<t.imgCount?function(s){var c=setTimeout(function(){if(t.stylesheets&&ru(t,t.stylesheets),t.unsuspend){var y=t.unsuspend;t.unsuspend=null,y()}},6e4+r);0<t.imgBytes&&Xf===0&&(Xf=62500*M2());var p=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&ru(t,t.stylesheets),t.unsuspend)){var y=t.unsuspend;t.unsuspend=null,y()}},(t.imgBytes>Xf?50:800)+r);return t.unsuspend=s,function(){t.unsuspend=null,clearTimeout(c),clearTimeout(p)}}:null}function tu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ru(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var nu=null;function ru(t,r){t.stylesheets=null,t.unsuspend!==null&&(t.count++,nu=new Map,r.forEach(J2,t),nu=null,tu.call(t))}function J2(t,r){if(!(r.state.loading&4)){var s=nu.get(t);if(s)var c=s.get(null);else{s=new Map,nu.set(t,s);for(var p=t.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<p.length;y++){var S=p[y];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(s.set(S.dataset.precedence,S),c=S)}c&&s.set(null,c)}p=r.instance,S=p.getAttribute("data-precedence"),y=s.get(S)||c,y===c&&s.set(null,p),s.set(S,p),this.count++,c=tu.bind(this),p.addEventListener("load",c),p.addEventListener("error",c),y?y.parentNode.insertBefore(p,y.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(p,t.firstChild)),r.state.loading|=4}}var xo={$$typeof:B,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function ew(t,r,s,c,p,y,S,z,X){this.tag=1,this.containerInfo=t,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=Qt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qt(0),this.hiddenUpdates=Qt(null),this.identifierPrefix=c,this.onUncaughtError=p,this.onCaughtError=y,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=X,this.incompleteTransitions=new Map}function c0(t,r,s,c,p,y,S,z,X,ie,pe,Ce){return t=new ew(t,r,s,S,X,ie,pe,Ce,z),r=1,y===!0&&(r|=24),y=Nr(3,null,null,r),t.current=y,y.stateNode=t,r=jd(),r.refCount++,t.pooledCache=r,r.refCount++,y.memoizedState={element:c,isDehydrated:s,cache:r},Ed(y),t}function u0(t){return t?(t=Yi,t):Yi}function d0(t,r,s,c,p,y){p=u0(p),c.context===null?c.context=p:c.pendingContext=p,c=gl(r),c.payload={element:s},y=y===void 0?null:y,y!==null&&(c.callback=y),s=yl(t,c,r),s!==null&&(br(s,t,r),Gs(s,t,r))}function f0(t,r){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var s=t.retryLane;t.retryLane=s!==0&&s<r?s:r}}function Wf(t,r){f0(t,r),(t=t.alternate)&&f0(t,r)}function h0(t){if(t.tag===13||t.tag===31){var r=ai(t,67108864);r!==null&&br(r,t,67108864),Wf(t,67108864)}}function m0(t){if(t.tag===13||t.tag===31){var r=Fr();r=Ae(r);var s=ai(t,r);s!==null&&br(s,t,r),Wf(t,r)}}var au=!0;function tw(t,r,s,c){var p=Y.T;Y.T=null;var y=se.p;try{se.p=2,Gf(t,r,s,c)}finally{se.p=y,Y.T=p}}function nw(t,r,s,c){var p=Y.T;Y.T=null;var y=se.p;try{se.p=8,Gf(t,r,s,c)}finally{se.p=y,Y.T=p}}function Gf(t,r,s,c){if(au){var p=Vf(c);if(p===null)Rf(t,r,c,lu,s),x0(t,c);else if(aw(p,t,r,s,c))c.stopPropagation();else if(x0(t,c),r&4&&-1<rw.indexOf(t)){for(;p!==null;){var y=Vn(p);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var S=fn(y.pendingLanes);if(S!==0){var z=y;for(z.pendingLanes|=2,z.entangledLanes|=2;S;){var X=1<<31-Ve(S);z.entanglements[1]|=X,S&=~X}ya(y),(Vt&6)===0&&(Hc=Se()+500,co(0))}}break;case 31:case 13:z=ai(y,2),z!==null&&br(z,y,2),qc(),Wf(y,2)}if(y=Vf(c),y===null&&Rf(t,r,c,lu,s),y===p)break;p=y}p!==null&&c.stopPropagation()}else Rf(t,r,c,null,s)}}function Vf(t){return t=Mi(t),Kf(t)}var lu=null;function Kf(t){if(lu=null,t=ca(t),t!==null){var r=u(t);if(r===null)t=null;else{var s=r.tag;if(s===13){if(t=d(r),t!==null)return t;t=null}else if(s===31){if(t=h(r),t!==null)return t;t=null}else if(s===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;t=null}else r!==t&&(t=null)}}return lu=t,null}function p0(t){switch(t){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(Ee()){case G:return 2;case ce:return 8;case ne:case ke:return 32;case ve:return 268435456;default:return 32}default:return 32}}var Qf=!1,Dl=null,Tl=null,Fl=null,go=new Map,yo=new Map,Ml=[],rw="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 x0(t,r){switch(t){case"focusin":case"focusout":Dl=null;break;case"dragenter":case"dragleave":Tl=null;break;case"mouseover":case"mouseout":Fl=null;break;case"pointerover":case"pointerout":go.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":yo.delete(r.pointerId)}}function bo(t,r,s,c,p,y){return t===null||t.nativeEvent!==y?(t={blockedOn:r,domEventName:s,eventSystemFlags:c,nativeEvent:y,targetContainers:[p]},r!==null&&(r=Vn(r),r!==null&&h0(r)),t):(t.eventSystemFlags|=c,r=t.targetContainers,p!==null&&r.indexOf(p)===-1&&r.push(p),t)}function aw(t,r,s,c,p){switch(r){case"focusin":return Dl=bo(Dl,t,r,s,c,p),!0;case"dragenter":return Tl=bo(Tl,t,r,s,c,p),!0;case"mouseover":return Fl=bo(Fl,t,r,s,c,p),!0;case"pointerover":var y=p.pointerId;return go.set(y,bo(go.get(y)||null,t,r,s,c,p)),!0;case"gotpointercapture":return y=p.pointerId,yo.set(y,bo(yo.get(y)||null,t,r,s,c,p)),!0}return!1}function g0(t){var r=ca(t.target);if(r!==null){var s=u(r);if(s!==null){if(r=s.tag,r===13){if(r=d(s),r!==null){t.blockedOn=r,kn(t.priority,function(){m0(s)});return}}else if(r===31){if(r=h(s),r!==null){t.blockedOn=r,kn(t.priority,function(){m0(s)});return}}else if(r===3&&s.stateNode.current.memoizedState.isDehydrated){t.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}t.blockedOn=null}function iu(t){if(t.blockedOn!==null)return!1;for(var r=t.targetContainers;0<r.length;){var s=Vf(t.nativeEvent);if(s===null){s=t.nativeEvent;var c=new s.constructor(s.type,s);na=c,s.target.dispatchEvent(c),na=null}else return r=Vn(s),r!==null&&h0(r),t.blockedOn=s,!1;r.shift()}return!0}function y0(t,r,s){iu(t)&&s.delete(r)}function lw(){Qf=!1,Dl!==null&&iu(Dl)&&(Dl=null),Tl!==null&&iu(Tl)&&(Tl=null),Fl!==null&&iu(Fl)&&(Fl=null),go.forEach(y0),yo.forEach(y0)}function su(t,r){t.blockedOn===r&&(t.blockedOn=null,Qf||(Qf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,lw)))}var ou=null;function b0(t){ou!==t&&(ou=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ou===t&&(ou=null);for(var r=0;r<t.length;r+=3){var s=t[r],c=t[r+1],p=t[r+2];if(typeof c!="function"){if(Kf(c||s)===null)continue;break}var y=Vn(s);y!==null&&(t.splice(r,3),r-=3,Gd(y,{pending:!0,data:p,method:s.method,action:c},c,p))}}))}function ms(t){function r(X){return su(X,t)}Dl!==null&&su(Dl,t),Tl!==null&&su(Tl,t),Fl!==null&&su(Fl,t),go.forEach(r),yo.forEach(r);for(var s=0;s<Ml.length;s++){var c=Ml[s];c.blockedOn===t&&(c.blockedOn=null)}for(;0<Ml.length&&(s=Ml[0],s.blockedOn===null);)g0(s),s.blockedOn===null&&Ml.shift();if(s=(t.ownerDocument||t).$$reactFormReplay,s!=null)for(c=0;c<s.length;c+=3){var p=s[c],y=s[c+1],S=p[gn]||null;if(typeof y=="function")S||b0(s);else if(S){var z=null;if(y&&y.hasAttribute("formAction")){if(p=y,S=y[gn]||null)z=S.formAction;else if(Kf(p)!==null)continue}else z=S.action;typeof z=="function"?s[c+1]=z:(s.splice(c,3),c-=3),b0(s)}}}function v0(){function t(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(S){return p=S})},focusReset:"manual",scroll:"manual"})}function r(){p!==null&&(p(),p=null),c||setTimeout(s,20)}function s(){if(!c&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,p=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(s,100),function(){c=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),p!==null&&(p(),p=null)}}}function Pf(t){this._internalRoot=t}cu.prototype.render=Pf.prototype.render=function(t){var r=this._internalRoot;if(r===null)throw Error(i(409));var s=r.current,c=Fr();d0(s,c,t,r,null,null)},cu.prototype.unmount=Pf.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var r=t.containerInfo;d0(t.current,2,null,t,null,null),qc(),r[dr]=null}};function cu(t){this._internalRoot=t}cu.prototype.unstable_scheduleHydration=function(t){if(t){var r=Et();t={blockedOn:null,target:t,priority:r};for(var s=0;s<Ml.length&&r!==0&&r<Ml[s].priority;s++);Ml.splice(s,0,t),s===0&&g0(t)}};var w0=n.version;if(w0!=="19.2.4")throw Error(i(527,w0,"19.2.4"));se.findDOMNode=function(t){var r=t._reactInternals;if(r===void 0)throw typeof t.render=="function"?Error(i(188)):(t=Object.keys(t).join(","),Error(i(268,t)));return t=f(r),t=t!==null?x(t):null,t=t===null?null:t.stateNode,t};var iw={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Y,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uu.isDisabled&&uu.supportsFiber)try{Be=uu.inject(iw),He=uu}catch{}}return wo.createRoot=function(t,r){if(!o(t))throw Error(i(299));var s=!1,c="",p=Ax,y=Dx,S=Tx;return r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(c=r.identifierPrefix),r.onUncaughtError!==void 0&&(p=r.onUncaughtError),r.onCaughtError!==void 0&&(y=r.onCaughtError),r.onRecoverableError!==void 0&&(S=r.onRecoverableError)),r=c0(t,1,!1,null,null,s,c,null,p,y,S,v0),t[dr]=r.current,Mf(t),new Pf(r)},wo.hydrateRoot=function(t,r,s){if(!o(t))throw Error(i(299));var c=!1,p="",y=Ax,S=Dx,z=Tx,X=null;return s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(p=s.identifierPrefix),s.onUncaughtError!==void 0&&(y=s.onUncaughtError),s.onCaughtError!==void 0&&(S=s.onCaughtError),s.onRecoverableError!==void 0&&(z=s.onRecoverableError),s.formState!==void 0&&(X=s.formState)),r=c0(t,1,!0,r,s??null,c,p,X,y,S,z,v0),r.context=u0(null),s=r.current,c=Fr(),c=Ae(c),p=gl(c),p.callback=null,yl(s,p,c),s=c,r.current.lanes=s,we(r,s),ya(r),t[dr]=r.current,Mf(t),new cu(r)},wo.version="19.2.4",wo}var M0;function yw(){if(M0)return eh.exports;M0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),eh.exports=gw(),eh.exports}var bw=yw();const vw="modulepreload",ww=function(e){return"/"+e},R0={},Ny=function(n,a,i){let o=Promise.resolve();if(a&&a.length>0){let d=function(f){return Promise.all(f.map(x=>Promise.resolve(x).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),m=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));o=d(a.map(f=>{if(f=ww(f),f in R0)return;R0[f]=!0;const x=f.endsWith(".css"),g=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${g}`))return;const w=document.createElement("link");if(w.rel=x?"stylesheet":vw,x||(w.as="script"),w.crossOrigin="",w.href=f,m&&w.setAttribute("nonce",m),document.head.appendChild(w),x)return new Promise((b,j)=>{w.addEventListener("load",b),w.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${f}`)))})}))}function u(d){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=d,window.dispatchEvent(h),!h.defaultPrevented)throw d}return o.then(d=>{for(const h of d||[])h.status==="rejected"&&u(h.reason);return n().catch(u)})};class kw extends v.Component{constructor(){super(...arguments);k0(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(a){return{hasError:!0,error:a}}render(){var a;return this.state.hasError?l.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:l.jsxs("div",{className:"text-center max-w-md",children:[l.jsx("div",{className:"text-4xl mb-3",children:"🚨"}),l.jsx("div",{className:"text-gray-800 font-semibold mb-2",children:"Something went wrong"}),l.jsx("div",{className:"text-gray-500 text-sm mb-4",children:((a=this.state.error)==null?void 0:a.message)??"An unexpected error occurred."}),l.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 Sa="/api";async function Ut(e){const n=await fetch(`${Sa}${e}`);if(!n.ok)throw new Error(`API error: ${n.status}`);return n.json()}async function un(e,n){const a=await fetch(`${Sa}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}async function du(e,n){const a=await fetch(`${Sa}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}async function jw(e,n){const a=await fetch(`${Sa}${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}async function tl(e,n){const a={method:"DELETE"};n!==void 0&&(a.headers={"Content-Type":"application/json"},a.body=JSON.stringify(n));const i=await fetch(`${Sa}${e}`,a);if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()}const ge={getCompany:()=>Ut("/company"),getRoles:()=>Ut("/roles"),getRole:e=>Ut(`/roles/${e}`),getProjects:()=>Ut("/projects"),getProject:e=>Ut(`/projects/${e}`),getStandups:()=>Ut("/operations/standups"),getWaves:()=>Ut("/operations/waves"),getWaveDetail:e=>Ut(`/operations/waves/${e}`),patchWave:(e,n)=>du(`/operations/waves/${e}`,n),getDecisions:()=>Ut("/operations/decisions"),updateDecision:(e,n)=>jw(`/operations/decisions/${e}`,{content:n}),deleteDecision:e=>tl(`/operations/decisions/${e}`),getOrgTree:()=>Ut("/engine/org"),getSkills:()=>Ut("/skills"),exportSkills:e=>Ut(`/skills/export/${e}`),getSkillRegistry:()=>Ut("/skills/registry"),installRegistrySkill:(e,n)=>un("/skills/registry/install",{skillId:e,url:n}),createRole:e=>un("/engine/roles",e),updateRole:(e,n)=>du(`/engine/roles/${e}`,n),deleteRole:e=>tl(`/engine/roles/${e}`),getSessions:()=>Ut("/sessions"),getSession:e=>Ut(`/sessions/${e}`),createSession:(e,n="talk")=>un("/sessions",{roleId:e,mode:n}),deleteSession:e=>tl(`/sessions/${e}`),deleteSessions:e=>tl("/sessions",{ids:e}),deleteEmptySessions:()=>tl("/sessions?empty=true"),updateSession:(e,n)=>du(`/sessions/${e}`,n),abortSession:e=>un(`/sessions/${e}/abort`,{}),replyToSession:(e,n,a)=>un(`/sessions/${e}/reply`,{message:n,...a&&{attachments:a}}),startJob:e=>un("/jobs",e),saveWave:e=>un("/waves/save",e),getStatus:()=>Ut("/status"),detectEngine:()=>un("/setup/detect-engine",{}),validatePath:e=>un("/setup/validate-path",{path:e}),scaffold:e=>un("/setup/scaffold",e),getTeams:()=>Ut("/setup/teams"),browse:e=>un("/setup/browse",{path:e}),mkdir:(e,n)=>un("/setup/mkdir",{path:e,name:n}),connectAkb:e=>un("/setup/connect-akb",{path:e}),getRequiredTools:e=>un("/setup/required-tools",{team:e}),installTools:(e,n)=>fetch(`${Sa}/setup/install-tools`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({team:e})}).then(a=>{var h;const i=(h=a.body)==null?void 0:h.getReader();if(!i)return;const o=new TextDecoder;let u="";const d=()=>i.read().then(({done:m,value:f})=>{if(m)return;u+=o.decode(f,{stream:!0});const x=u.split(`
|
|
50
|
-
`);u=x.pop()||"";let g="";for(const w of x)if(w.startsWith("event: "))g=w.slice(7);else if(w.startsWith("data: ")&&g){try{n(g,JSON.parse(w.slice(6)))}catch{}g=""}return d()});return d()}),getKnowledge:()=>Ut("/knowledge"),getKnowledgeDoc:e=>{const n=e.split("/").map(encodeURIComponent).join("/");return Ut(`/knowledge/${n}`)},createKnowledgeDoc:e=>un("/knowledge",e),updateKnowledgeDoc:(e,n)=>{const a=e.split("/").map(encodeURIComponent).join("/");return fetch(`${Sa}/knowledge/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n})}).then(i=>{if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()})},deleteKnowledgeDoc:e=>{const n=e.split("/").map(encodeURIComponent).join("/");return tl(`/knowledge/${n}`)},getPreferences:()=>Ut("/preferences"),updatePreferences:e=>du("/preferences",e),chatInChannel:e=>un("/speech/chat",e),getSaveStatus:(e="akb")=>Ut(`/save/status?repo=${e}`),save:(e,n="akb")=>un(`/save?repo=${n}`,{message:e}),getSaveHistory:(e=20,n="akb")=>Ut(`/save/history?limit=${e}&repo=${n}`),restoreSave:(e,n,a="akb")=>un(`/save/restore?repo=${a}`,{sha:e,paths:n}),initGit:()=>un("/save/init",{}),getSyncStatus:(e="akb")=>Ut(`/save/sync-status?repo=${e}`),pull:async(e="akb")=>await(await fetch(`${Sa}/save/pull?repo=${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"})).json(),getGithubStatus:(e="akb")=>Ut(`/save/github-status?repo=${e}`),githubCreateRepo:(e,n="private",a="akb")=>un(`/save/github-create-repo?repo=${a}`,{name:e,visibility:n}),addRemote:(e,n="akb")=>un(`/save/remote?repo=${n}`,{url:e}),setCodeRoot:async e=>{const n=await fetch(`${Sa}/setup/code-root`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({codeRoot:e})}),a=await n.json();if(!n.ok)throw new Error(a.error||`API error: ${n.status}`);return a},getCodeRoot:()=>Ut("/setup/code-root"),getCostSummary:()=>Ut("/cost/summary"),getSyncRoles:()=>Ut("/sync/roles"),applySyncUpdate:e=>un("/sync/apply",e),getCompanyStats:()=>Ut("/sync/stats"),getCoins:()=>Ut("/coins"),earnCoins:(e,n,a)=>un("/coins/earn",{amount:e,reason:n,ref:a}),spendCoins:(e,n,a)=>un("/coins/spend",{amount:e,reason:n,ref:a}),migrateCoins:e=>un("/coins/migrate",{completedQuests:e}),getQuestProgress:()=>Ut("/quests/progress"),saveQuestProgress:e=>fetch(`${Sa}/quests/progress`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(n=>n.json()),getActiveSessions:()=>Ut("/active-sessions"),getActiveSession:e=>Ut(`/active-sessions/${e}`),registerActiveSession:e=>un("/active-sessions/register",e),deleteActiveSession:e=>tl(`/active-sessions/${e}`),cleanupActiveSessions:()=>un("/active-sessions/cleanup",{}),getGitStatus:()=>Ut("/git/status"),deleteWorktree:e=>tl(`/git/worktrees/${encodeURIComponent(e)}`),deleteBranch:e=>tl(`/git/branches/${encodeURIComponent(e)}`)},Sw=Object.freeze(Object.defineProperty({__proto__:null,api:ge},Symbol.toStringTag,{value:"Module"}));function Ey(e){const[n,a]=v.useState([]),[i,o]=v.useState("idle"),[u,d]=v.useState(""),[h,m]=v.useState([]),f=v.useRef(-1),x=v.useRef(null),g=v.useRef(0),w=v.useCallback(()=>{var C;if(!e)return;(C=x.current)==null||C.abort();const j=new AbortController;x.current=j,o("connecting");const k=f.current+1,N=`/api/sessions/${e}/stream?from=${k}`;fetch(N,{signal:j.signal}).then(async E=>{if(!E.ok||!E.body){o("error");return}o("streaming");const B=E.body.getReader(),R=new TextDecoder;let $="";for(;;){const{done:_,value:L}=await B.read();if(_)break;$+=R.decode(L,{stream:!0});const U=$.split(`
|
|
51
|
-
`);$=U.pop()??"";let Q="";for(const D of U)if(D.startsWith("event: "))Q=D.slice(7).trim();else if(D.startsWith("data: ")){try{const I=JSON.parse(D.slice(6));if(Q==="activity"){const H=I;H.seq>f.current&&(f.current=H.seq),a(q=>q.some(ue=>ue.seq===H.seq)?q:[...q,H]),H.type==="text"&&d(q=>q+(H.data.text??"")),H.type==="dispatch:start"&&H.data.childJobId&&m(q=>[...q,H.data.childJobId]),H.type==="job:done"?o("done"):H.type==="job:error"&&o("error")}else if(Q==="stream:end"){const H=I.reason;o(H==="done"?"done":H==="error"?"error":"done")}}catch{}Q=""}}i==="streaming"&&o("done")}).catch(E=>{E.name!=="AbortError"&&(o("error"),g.current<3&&(g.current++,setTimeout(w,1e3*g.current)))})},[e]),b=v.useCallback(()=>{g.current=0,w()},[w]);return v.useEffect(()=>{if(!e){a([]),o("idle"),d(""),m([]),f.current=-1;return}return a([]),d(""),m([]),f.current=-1,g.current=0,w(),()=>{var j;(j=x.current)==null||j.abort()}},[e,w]),{events:n,status:i,textOutput:u,childJobIds:h,reconnect:b}}function Cw(e,n){const a={};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const Nw=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ew=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Aw={};function z0(e,n){return(Aw.jsx?Ew:Nw).test(e)}const Dw=/[ \t\n\f\r]/g;function Tw(e){return typeof e=="object"?e.type==="text"?_0(e.value):!1:_0(e)}function _0(e){return e.replace(Dw,"")===""}class Yo{constructor(n,a,i){this.normal=a,this.property=n,i&&(this.space=i)}}Yo.prototype.normal={};Yo.prototype.property={};Yo.prototype.space=void 0;function Ay(e,n){const a={},i={};for(const o of e)Object.assign(a,o.property),Object.assign(i,o.normal);return new Yo(a,i,n)}function Xh(e){return e.toLowerCase()}class kr{constructor(n,a){this.attribute=a,this.property=n}}kr.prototype.attribute="";kr.prototype.booleanish=!1;kr.prototype.boolean=!1;kr.prototype.commaOrSpaceSeparated=!1;kr.prototype.commaSeparated=!1;kr.prototype.defined=!1;kr.prototype.mustUseProperty=!1;kr.prototype.number=!1;kr.prototype.overloadedBoolean=!1;kr.prototype.property="";kr.prototype.spaceSeparated=!1;kr.prototype.space=void 0;let Fw=0;const wt=Di(),Bn=Di(),Wh=Di(),Me=Di(),hn=Di(),bs=Di(),Mr=Di();function Di(){return 2**++Fw}const Gh=Object.freeze(Object.defineProperty({__proto__:null,boolean:wt,booleanish:Bn,commaOrSpaceSeparated:Mr,commaSeparated:bs,number:Me,overloadedBoolean:Wh,spaceSeparated:hn},Symbol.toStringTag,{value:"Module"})),ah=Object.keys(Gh);class km extends kr{constructor(n,a,i,o){let u=-1;if(super(n,a),B0(this,"space",o),typeof i=="number")for(;++u<ah.length;){const d=ah[u];B0(this,ah[u],(i&Gh[d])===Gh[d])}}}km.prototype.defined=!0;function B0(e,n,a){a&&(e[n]=a)}function Ns(e){const n={},a={};for(const[i,o]of Object.entries(e.properties)){const u=new km(i,e.transform(e.attributes||{},i),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),n[i]=u,a[Xh(i)]=i,a[Xh(u.attribute)]=i}return new Yo(n,a,e.space)}const Dy=Ns({properties:{ariaActiveDescendant:null,ariaAtomic:Bn,ariaAutoComplete:null,ariaBusy:Bn,ariaChecked:Bn,ariaColCount:Me,ariaColIndex:Me,ariaColSpan:Me,ariaControls:hn,ariaCurrent:null,ariaDescribedBy:hn,ariaDetails:null,ariaDisabled:Bn,ariaDropEffect:hn,ariaErrorMessage:null,ariaExpanded:Bn,ariaFlowTo:hn,ariaGrabbed:Bn,ariaHasPopup:null,ariaHidden:Bn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:hn,ariaLevel:Me,ariaLive:null,ariaModal:Bn,ariaMultiLine:Bn,ariaMultiSelectable:Bn,ariaOrientation:null,ariaOwns:hn,ariaPlaceholder:null,ariaPosInSet:Me,ariaPressed:Bn,ariaReadOnly:Bn,ariaRelevant:null,ariaRequired:Bn,ariaRoleDescription:hn,ariaRowCount:Me,ariaRowIndex:Me,ariaRowSpan:Me,ariaSelected:Bn,ariaSetSize:Me,ariaSort:null,ariaValueMax:Me,ariaValueMin:Me,ariaValueNow:Me,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function Ty(e,n){return n in e?e[n]:n}function Fy(e,n){return Ty(e,n.toLowerCase())}const Mw=Ns({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:bs,acceptCharset:hn,accessKey:hn,action:null,allow:null,allowFullScreen:wt,allowPaymentRequest:wt,allowUserMedia:wt,alt:null,as:null,async:wt,autoCapitalize:null,autoComplete:hn,autoFocus:wt,autoPlay:wt,blocking:hn,capture:null,charSet:null,checked:wt,cite:null,className:hn,cols:Me,colSpan:null,content:null,contentEditable:Bn,controls:wt,controlsList:hn,coords:Me|bs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:wt,defer:wt,dir:null,dirName:null,disabled:wt,download:Wh,draggable:Bn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:wt,formTarget:null,headers:hn,height:Me,hidden:Wh,high:Me,href:null,hrefLang:null,htmlFor:hn,httpEquiv:hn,id:null,imageSizes:null,imageSrcSet:null,inert:wt,inputMode:null,integrity:null,is:null,isMap:wt,itemId:null,itemProp:hn,itemRef:hn,itemScope:wt,itemType:hn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:wt,low:Me,manifest:null,max:null,maxLength:Me,media:null,method:null,min:null,minLength:Me,multiple:wt,muted:wt,name:null,nonce:null,noModule:wt,noValidate:wt,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:wt,optimum:Me,pattern:null,ping:hn,placeholder:null,playsInline:wt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:wt,referrerPolicy:null,rel:hn,required:wt,reversed:wt,rows:Me,rowSpan:Me,sandbox:hn,scope:null,scoped:wt,seamless:wt,selected:wt,shadowRootClonable:wt,shadowRootDelegatesFocus:wt,shadowRootMode:null,shape:null,size:Me,sizes:null,slot:null,span:Me,spellCheck:Bn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Me,step:null,style:null,tabIndex:Me,target:null,title:null,translate:null,type:null,typeMustMatch:wt,useMap:null,value:Bn,width:Me,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:hn,axis:null,background:null,bgColor:null,border:Me,borderColor:null,bottomMargin:Me,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:wt,declare:wt,event:null,face:null,frame:null,frameBorder:null,hSpace:Me,leftMargin:Me,link:null,longDesc:null,lowSrc:null,marginHeight:Me,marginWidth:Me,noResize:wt,noHref:wt,noShade:wt,noWrap:wt,object:null,profile:null,prompt:null,rev:null,rightMargin:Me,rules:null,scheme:null,scrolling:Bn,standby:null,summary:null,text:null,topMargin:Me,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Me,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:wt,disableRemotePlayback:wt,prefix:null,property:null,results:Me,security:null,unselectable:null},space:"html",transform:Fy}),Rw=Ns({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:Mr,accentHeight:Me,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Me,amplitude:Me,arabicForm:null,ascent:Me,attributeName:null,attributeType:null,azimuth:Me,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Me,by:null,calcMode:null,capHeight:Me,className:hn,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:Me,diffuseConstant:Me,direction:null,display:null,dur:null,divisor:Me,dominantBaseline:null,download:wt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Me,enableBackground:null,end:null,event:null,exponent:Me,externalResourcesRequired:null,fill:null,fillOpacity:Me,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:bs,g2:bs,glyphName:bs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Me,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Me,horizOriginX:Me,horizOriginY:Me,id:null,ideographic:Me,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Me,k:Me,k1:Me,k2:Me,k3:Me,k4:Me,kernelMatrix:Mr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Me,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:Me,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:Me,overlineThickness:Me,paintOrder:null,panose1:null,path:null,pathLength:Me,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:hn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Me,pointsAtY:Me,pointsAtZ:Me,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Mr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Mr,rev:Mr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Mr,requiredFeatures:Mr,requiredFonts:Mr,requiredFormats:Mr,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:Me,specularExponent:Me,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Me,strikethroughThickness:Me,string:null,stroke:null,strokeDashArray:Mr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Me,strokeOpacity:Me,strokeWidth:null,style:null,surfaceScale:Me,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Mr,tabIndex:Me,tableValues:null,target:null,targetX:Me,targetY:Me,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Mr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Me,underlineThickness:Me,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Me,values:null,vAlphabetic:Me,vMathematical:Me,vectorEffect:null,vHanging:Me,vIdeographic:Me,version:null,vertAdvY:Me,vertOriginX:Me,vertOriginY:Me,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Me,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ty}),My=Ns({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),Ry=Ns({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Fy}),zy=Ns({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),zw={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"},_w=/[A-Z]/g,O0=/-[a-z]/g,Bw=/^data[-\w.:]+$/i;function Ow(e,n){const a=Xh(n);let i=n,o=kr;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&Bw.test(n)){if(n.charAt(4)==="-"){const u=n.slice(5).replace(O0,Lw);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=n.slice(4);if(!O0.test(u)){let d=u.replace(_w,$w);d.charAt(0)!=="-"&&(d="-"+d),n="data"+d}}o=km}return new o(i,n)}function $w(e){return"-"+e.toLowerCase()}function Lw(e){return e.charAt(1).toUpperCase()}const Iw=Ay([Dy,Mw,My,Ry,zy],"html"),jm=Ay([Dy,Rw,My,Ry,zy],"svg");function Hw(e){return e.join(" ").trim()}var ps={},lh,$0;function Uw(){if($0)return lh;$0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,a=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,h=/^\s+|\s+$/g,m=`
|
|
52
|
-
`,f="/",x="*",g="",w="comment",b="declaration";function j(N,C){if(typeof N!="string")throw new TypeError("First argument must be a string");if(!N)return[];C=C||{};var E=1,B=1;function R(ue){var te=ue.match(n);te&&(E+=te.length);var Y=ue.lastIndexOf(m);B=~Y?ue.length-Y:B+ue.length}function $(){var ue={line:E,column:B};return function(te){return te.position=new _(ue),Q(),te}}function _(ue){this.start=ue,this.end={line:E,column:B},this.source=C.source}_.prototype.content=N;function L(ue){var te=new Error(C.source+":"+E+":"+B+": "+ue);if(te.reason=ue,te.filename=C.source,te.line=E,te.column=B,te.source=N,!C.silent)throw te}function U(ue){var te=ue.exec(N);if(te){var Y=te[0];return R(Y),N=N.slice(Y.length),te}}function Q(){U(a)}function D(ue){var te;for(ue=ue||[];te=I();)te!==!1&&ue.push(te);return ue}function I(){var ue=$();if(!(f!=N.charAt(0)||x!=N.charAt(1))){for(var te=2;g!=N.charAt(te)&&(x!=N.charAt(te)||f!=N.charAt(te+1));)++te;if(te+=2,g===N.charAt(te-1))return L("End of comment missing");var Y=N.slice(2,te-2);return B+=2,R(Y),N=N.slice(te),B+=2,ue({type:w,comment:Y})}}function H(){var ue=$(),te=U(i);if(te){if(I(),!U(o))return L("property missing ':'");var Y=U(u),se=ue({type:b,property:k(te[0].replace(e,g)),value:Y?k(Y[0].replace(e,g)):g});return U(d),se}}function q(){var ue=[];D(ue);for(var te;te=H();)te!==!1&&(ue.push(te),D(ue));return ue}return Q(),q()}function k(N){return N?N.replace(h,g):g}return lh=j,lh}var L0;function qw(){if(L0)return ps;L0=1;var e=ps&&ps.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(ps,"__esModule",{value:!0}),ps.default=a;const n=e(Uw());function a(i,o){let u=null;if(!i||typeof i!="string")return u;const d=(0,n.default)(i),h=typeof o=="function";return d.forEach(m=>{if(m.type!=="declaration")return;const{property:f,value:x}=m;h?o(f,x,m):x&&(u=u||{},u[f]=x)}),u}return ps}var ko={},I0;function Yw(){if(I0)return ko;I0=1,Object.defineProperty(ko,"__esModule",{value:!0}),ko.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,a=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,u=function(f){return!f||a.test(f)||e.test(f)},d=function(f,x){return x.toUpperCase()},h=function(f,x){return"".concat(x,"-")},m=function(f,x){return x===void 0&&(x={}),u(f)?f:(f=f.toLowerCase(),x.reactCompat?f=f.replace(o,h):f=f.replace(i,h),f.replace(n,d))};return ko.camelCase=m,ko}var jo,H0;function Xw(){if(H0)return jo;H0=1;var e=jo&&jo.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},n=e(qw()),a=Yw();function i(o,u){var d={};return!o||typeof o!="string"||(0,n.default)(o,function(h,m){h&&m&&(d[(0,a.camelCase)(h,u)]=m)}),d}return i.default=i,jo=i,jo}var Ww=Xw();const Gw=Cy(Ww),_y=By("end"),Sm=By("start");function By(e){return n;function n(a){const i=a&&a.position&&a.position[e]||{};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 Vw(e){const n=Sm(e),a=_y(e);if(n&&a)return{start:n,end:a}}function _o(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?U0(e.position):"start"in e||"end"in e?U0(e):"line"in e||"column"in e?Vh(e):""}function Vh(e){return q0(e&&e.line)+":"+q0(e&&e.column)}function U0(e){return Vh(e&&e.start)+"-"+Vh(e&&e.end)}function q0(e){return e&&typeof e=="number"?e:1}class lr extends Error{constructor(n,a,i){super(),typeof a=="string"&&(i=a,a=void 0);let o="",u={},d=!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 n=="string"?o=n:!u.cause&&n&&(d=!0,o=n.message,u.cause=n),!u.ruleId&&!u.source&&typeof i=="string"){const m=i.indexOf(":");m===-1?u.ruleId=i:(u.source=i.slice(0,m),u.ruleId=i.slice(m+1))}if(!u.place&&u.ancestors&&u.ancestors){const m=u.ancestors[u.ancestors.length-1];m&&(u.place=m.position)}const h=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=h?h.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=h?h.line:void 0,this.name=_o(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=d&&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}}lr.prototype.file="";lr.prototype.name="";lr.prototype.reason="";lr.prototype.message="";lr.prototype.stack="";lr.prototype.column=void 0;lr.prototype.line=void 0;lr.prototype.ancestors=void 0;lr.prototype.cause=void 0;lr.prototype.fatal=void 0;lr.prototype.place=void 0;lr.prototype.ruleId=void 0;lr.prototype.source=void 0;const Cm={}.hasOwnProperty,Kw=new Map,Qw=/[A-Z]/g,Pw=new Set(["table","tbody","thead","tfoot","tr"]),Zw=new Set(["td","th"]),Oy="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Jw(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=n.filePath||void 0;let i;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=s5(a,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=i5(a,n.jsx,n.jsxs)}const o={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:i,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?jm:Iw,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},u=$y(o,e,void 0);return u&&typeof u!="string"?u:o.create(e,o.Fragment,{children:u||void 0},void 0)}function $y(e,n,a){if(n.type==="element")return e5(e,n,a);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return t5(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return r5(e,n,a);if(n.type==="mdxjsEsm")return n5(e,n);if(n.type==="root")return a5(e,n,a);if(n.type==="text")return l5(e,n)}function e5(e,n,a){const i=e.schema;let o=i;n.tagName.toLowerCase()==="svg"&&i.space==="html"&&(o=jm,e.schema=o),e.ancestors.push(n);const u=Iy(e,n.tagName,!1),d=o5(e,n);let h=Em(e,n);return Pw.has(n.tagName)&&(h=h.filter(function(m){return typeof m=="string"?!Tw(m):!0})),Ly(e,d,u,n),Nm(d,h),e.ancestors.pop(),e.schema=i,e.create(n,u,d,a)}function t5(e,n){if(n.data&&n.data.estree&&e.evaluater){const i=n.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}Lo(e,n.position)}function n5(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Lo(e,n.position)}function r5(e,n,a){const i=e.schema;let o=i;n.name==="svg"&&i.space==="html"&&(o=jm,e.schema=o),e.ancestors.push(n);const u=n.name===null?e.Fragment:Iy(e,n.name,!0),d=c5(e,n),h=Em(e,n);return Ly(e,d,u,n),Nm(d,h),e.ancestors.pop(),e.schema=i,e.create(n,u,d,a)}function a5(e,n,a){const i={};return Nm(i,Em(e,n)),e.create(n,e.Fragment,i,a)}function l5(e,n){return n.value}function Ly(e,n,a,i){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(n.node=i)}function Nm(e,n){if(n.length>0){const a=n.length>1?n:n[0];a&&(e.children=a)}}function i5(e,n,a){return i;function i(o,u,d,h){const f=Array.isArray(d.children)?a:n;return h?f(u,d,h):f(u,d)}}function s5(e,n){return a;function a(i,o,u,d){const h=Array.isArray(u.children),m=Sm(i);return n(o,u,d,h,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function o5(e,n){const a={};let i,o;for(o in n.properties)if(o!=="children"&&Cm.call(n.properties,o)){const u=u5(e,o,n.properties[o]);if(u){const[d,h]=u;e.tableCellAlignToStyle&&d==="align"&&typeof h=="string"&&Zw.has(n.tagName)?i=h:a[d]=h}}if(i){const u=a.style||(a.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return a}function c5(e,n){const a={};for(const i of n.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const u=i.data.estree.body[0];u.type;const d=u.expression;d.type;const h=d.properties[0];h.type,Object.assign(a,e.evaluater.evaluateExpression(h.argument))}else Lo(e,n.position);else{const o=i.name;let u;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const h=i.value.data.estree.body[0];h.type,u=e.evaluater.evaluateExpression(h.expression)}else Lo(e,n.position);else u=i.value===null?!0:i.value;a[o]=u}return a}function Em(e,n){const a=[];let i=-1;const o=e.passKeys?new Map:Kw;for(;++i<n.children.length;){const u=n.children[i];let d;if(e.passKeys){const m=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(m){const f=o.get(m)||0;d=m+"-"+f,o.set(m,f+1)}}const h=$y(e,u,d);h!==void 0&&a.push(h)}return a}function u5(e,n,a){const i=Ow(e.schema,n);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=i.commaSeparated?Cw(a):Hw(a)),i.property==="style"){let o=typeof a=="object"?a:d5(e,String(a));return e.stylePropertyNameCase==="css"&&(o=f5(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&i.space?zw[i.property]||i.property:i.attribute,a]}}function d5(e,n){try{return Gw(n,{reactCompat:!0})}catch(a){if(e.ignoreInvalidStyle)return{};const i=a,o=new lr("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=Oy+"#cannot-parse-style-attribute",o}}function Iy(e,n,a){let i;if(!a)i={type:"Literal",value:n};else if(n.includes(".")){const o=n.split(".");let u=-1,d;for(;++u<o.length;){const h=z0(o[u])?{type:"Identifier",name:o[u]}:{type:"Literal",value:o[u]};d=d?{type:"MemberExpression",object:d,property:h,computed:!!(u&&h.type==="Literal"),optional:!1}:h}i=d}else i=z0(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(i.type==="Literal"){const o=i.value;return Cm.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(i);Lo(e)}function Lo(e,n){const a=new lr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=Oy+"#cannot-handle-mdx-estrees-without-createevaluater",a}function f5(e){const n={};let a;for(a in e)Cm.call(e,a)&&(n[h5(a)]=e[a]);return n}function h5(e){let n=e.replace(Qw,m5);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function m5(e){return"-"+e.toLowerCase()}const ih={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"]},p5={};function Am(e,n){const a=p5,i=typeof a.includeImageAlt=="boolean"?a.includeImageAlt:!0,o=typeof a.includeHtml=="boolean"?a.includeHtml:!0;return Hy(e,i,o)}function Hy(e,n,a){if(x5(e)){if("value"in e)return e.type==="html"&&!a?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Y0(e.children,n,a)}return Array.isArray(e)?Y0(e,n,a):""}function Y0(e,n,a){const i=[];let o=-1;for(;++o<e.length;)i[o]=Hy(e[o],n,a);return i.join("")}function x5(e){return!!(e&&typeof e=="object")}const X0=document.createElement("i");function Dm(e){const n="&"+e+";";X0.innerHTML=n;const a=X0.textContent;return a.charCodeAt(a.length-1)===59&&e!=="semi"||a===n?!1:a}function Br(e,n,a,i){const o=e.length;let u=0,d;if(n<0?n=-n>o?0:o+n:n=n>o?o:n,a=a>0?a:0,i.length<1e4)d=Array.from(i),d.unshift(n,a),e.splice(...d);else for(a&&e.splice(n,a);u<i.length;)d=i.slice(u,u+1e4),d.unshift(n,0),e.splice(...d),u+=1e4,n+=1e4}function Vr(e,n){return e.length>0?(Br(e,e.length,0,n),e):n}const W0={}.hasOwnProperty;function Uy(e){const n={};let a=-1;for(;++a<e.length;)g5(n,e[a]);return n}function g5(e,n){let a;for(a in n){const o=(W0.call(e,a)?e[a]:void 0)||(e[a]={}),u=n[a];let d;if(u)for(d in u){W0.call(o,d)||(o[d]=[]);const h=u[d];y5(o[d],Array.isArray(h)?h:h?[h]:[])}}}function y5(e,n){let a=-1;const i=[];for(;++a<n.length;)(n[a].add==="after"?e:i).push(n[a]);Br(e,0,0,i)}function qy(e,n){const a=Number.parseInt(e,n);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 oa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const sr=ql(/[A-Za-z]/),ar=ql(/[\dA-Za-z]/),b5=ql(/[#-'*+\--9=?A-Z^-~]/);function zu(e){return e!==null&&(e<32||e===127)}const Kh=ql(/\d/),v5=ql(/[\dA-Fa-f]/),w5=ql(/[!-/:-@[-`{-~]/);function at(e){return e!==null&&e<-2}function dn(e){return e!==null&&(e<0||e===32)}function Tt(e){return e===-2||e===-1||e===32}const Xu=ql(new RegExp("\\p{P}|\\p{S}","u")),Ei=ql(/\s/);function ql(e){return n;function n(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}function Es(e){const n=[];let a=-1,i=0,o=0;for(;++a<e.length;){const u=e.charCodeAt(a);let d="";if(u===37&&ar(e.charCodeAt(a+1))&&ar(e.charCodeAt(a+2)))o=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(d=String.fromCharCode(u));else if(u>55295&&u<57344){const h=e.charCodeAt(a+1);u<56320&&h>56319&&h<57344?(d=String.fromCharCode(u,h),o=1):d="�"}else d=String.fromCharCode(u);d&&(n.push(e.slice(i,a),encodeURIComponent(d)),i=a+o+1,d=""),o&&(a+=o,o=0)}return n.join("")+e.slice(i)}function Ht(e,n,a,i){const o=i?i-1:Number.POSITIVE_INFINITY;let u=0;return d;function d(m){return Tt(m)?(e.enter(a),h(m)):n(m)}function h(m){return Tt(m)&&u++<o?(e.consume(m),h):(e.exit(a),n(m))}}const k5={tokenize:j5};function j5(e){const n=e.attempt(this.parser.constructs.contentInitial,i,o);let a;return n;function i(h){if(h===null){e.consume(h);return}return e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Ht(e,n,"linePrefix")}function o(h){return e.enter("paragraph"),u(h)}function u(h){const m=e.enter("chunkText",{contentType:"text",previous:a});return a&&(a.next=m),a=m,d(h)}function d(h){if(h===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(h);return}return at(h)?(e.consume(h),e.exit("chunkText"),u):(e.consume(h),d)}}const S5={tokenize:C5},G0={tokenize:N5};function C5(e){const n=this,a=[];let i=0,o,u,d;return h;function h(B){if(i<a.length){const R=a[i];return n.containerState=R[1],e.attempt(R[0].continuation,m,f)(B)}return f(B)}function m(B){if(i++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,o&&E();const R=n.events.length;let $=R,_;for(;$--;)if(n.events[$][0]==="exit"&&n.events[$][1].type==="chunkFlow"){_=n.events[$][1].end;break}C(i);let L=R;for(;L<n.events.length;)n.events[L][1].end={..._},L++;return Br(n.events,$+1,0,n.events.slice(R)),n.events.length=L,f(B)}return h(B)}function f(B){if(i===a.length){if(!o)return w(B);if(o.currentConstruct&&o.currentConstruct.concrete)return j(B);n.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(G0,x,g)(B)}function x(B){return o&&E(),C(i),w(B)}function g(B){return n.parser.lazy[n.now().line]=i!==a.length,d=n.now().offset,j(B)}function w(B){return n.containerState={},e.attempt(G0,b,j)(B)}function b(B){return i++,a.push([n.currentConstruct,n.containerState]),w(B)}function j(B){if(B===null){o&&E(),C(0),e.consume(B);return}return o=o||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:u}),k(B)}function k(B){if(B===null){N(e.exit("chunkFlow"),!0),C(0),e.consume(B);return}return at(B)?(e.consume(B),N(e.exit("chunkFlow")),i=0,n.interrupt=void 0,h):(e.consume(B),k)}function N(B,R){const $=n.sliceStream(B);if(R&&$.push(null),B.previous=u,u&&(u.next=B),u=B,o.defineSkip(B.start),o.write($),n.parser.lazy[B.start.line]){let _=o.events.length;for(;_--;)if(o.events[_][1].start.offset<d&&(!o.events[_][1].end||o.events[_][1].end.offset>d))return;const L=n.events.length;let U=L,Q,D;for(;U--;)if(n.events[U][0]==="exit"&&n.events[U][1].type==="chunkFlow"){if(Q){D=n.events[U][1].end;break}Q=!0}for(C(i),_=L;_<n.events.length;)n.events[_][1].end={...D},_++;Br(n.events,U+1,0,n.events.slice(L)),n.events.length=_}}function C(B){let R=a.length;for(;R-- >B;){const $=a[R];n.containerState=$[1],$[0].exit.call(n,e)}a.length=B}function E(){o.write([null]),u=void 0,o=void 0,n.containerState._closeFlow=void 0}}function N5(e,n,a){return Ht(e,e.attempt(this.parser.constructs.document,n,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ws(e){if(e===null||dn(e)||Ei(e))return 1;if(Xu(e))return 2}function Wu(e,n,a){const i=[];let o=-1;for(;++o<e.length;){const u=e[o].resolveAll;u&&!i.includes(u)&&(n=u(n,a),i.push(u))}return n}const Qh={name:"attention",resolveAll:E5,tokenize:A5};function E5(e,n){let a=-1,i,o,u,d,h,m,f,x;for(;++a<e.length;)if(e[a][0]==="enter"&&e[a][1].type==="attentionSequence"&&e[a][1]._close){for(i=a;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&n.sliceSerialize(e[i][1]).charCodeAt(0)===n.sliceSerialize(e[a][1]).charCodeAt(0)){if((e[i][1]._close||e[a][1]._open)&&(e[a][1].end.offset-e[a][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[a][1].end.offset-e[a][1].start.offset)%3))continue;m=e[i][1].end.offset-e[i][1].start.offset>1&&e[a][1].end.offset-e[a][1].start.offset>1?2:1;const g={...e[i][1].end},w={...e[a][1].start};V0(g,-m),V0(w,m),d={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[i][1].end}},h={type:m>1?"strongSequence":"emphasisSequence",start:{...e[a][1].start},end:w},u={type:m>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[a][1].start}},o={type:m>1?"strong":"emphasis",start:{...d.start},end:{...h.end}},e[i][1].end={...d.start},e[a][1].start={...h.end},f=[],e[i][1].end.offset-e[i][1].start.offset&&(f=Vr(f,[["enter",e[i][1],n],["exit",e[i][1],n]])),f=Vr(f,[["enter",o,n],["enter",d,n],["exit",d,n],["enter",u,n]]),f=Vr(f,Wu(n.parser.constructs.insideSpan.null,e.slice(i+1,a),n)),f=Vr(f,[["exit",u,n],["enter",h,n],["exit",h,n],["exit",o,n]]),e[a][1].end.offset-e[a][1].start.offset?(x=2,f=Vr(f,[["enter",e[a][1],n],["exit",e[a][1],n]])):x=0,Br(e,i-1,a-i+3,f),a=i+f.length-x-2;break}}for(a=-1;++a<e.length;)e[a][1].type==="attentionSequence"&&(e[a][1].type="data");return e}function A5(e,n){const a=this.parser.constructs.attentionMarkers.null,i=this.previous,o=ws(i);let u;return d;function d(m){return u=m,e.enter("attentionSequence"),h(m)}function h(m){if(m===u)return e.consume(m),h;const f=e.exit("attentionSequence"),x=ws(m),g=!x||x===2&&o||a.includes(m),w=!o||o===2&&x||a.includes(i);return f._open=!!(u===42?g:g&&(o||!w)),f._close=!!(u===42?w:w&&(x||!g)),n(m)}}function V0(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const D5={name:"autolink",tokenize:T5};function T5(e,n,a){let i=0;return o;function o(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(b){return sr(b)?(e.consume(b),d):b===64?a(b):f(b)}function d(b){return b===43||b===45||b===46||ar(b)?(i=1,h(b)):f(b)}function h(b){return b===58?(e.consume(b),i=0,m):(b===43||b===45||b===46||ar(b))&&i++<32?(e.consume(b),h):(i=0,f(b))}function m(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),n):b===null||b===32||b===60||zu(b)?a(b):(e.consume(b),m)}function f(b){return b===64?(e.consume(b),x):b5(b)?(e.consume(b),f):a(b)}function x(b){return ar(b)?g(b):a(b)}function g(b){return b===46?(e.consume(b),i=0,x):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),n):w(b)}function w(b){if((b===45||ar(b))&&i++<63){const j=b===45?w:g;return e.consume(b),j}return a(b)}}const Xo={partial:!0,tokenize:F5};function F5(e,n,a){return i;function i(u){return Tt(u)?Ht(e,o,"linePrefix")(u):o(u)}function o(u){return u===null||at(u)?n(u):a(u)}}const Yy={continuation:{tokenize:R5},exit:z5,name:"blockQuote",tokenize:M5};function M5(e,n,a){const i=this;return o;function o(d){if(d===62){const h=i.containerState;return h.open||(e.enter("blockQuote",{_container:!0}),h.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),u}return a(d)}function u(d){return Tt(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(d))}}function R5(e,n,a){const i=this;return o;function o(d){return Tt(d)?Ht(e,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):u(d)}function u(d){return e.attempt(Yy,n,a)(d)}}function z5(e){e.exit("blockQuote")}const Xy={name:"characterEscape",tokenize:_5};function _5(e,n,a){return i;function i(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),o}function o(u){return w5(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):a(u)}}const Wy={name:"characterReference",tokenize:B5};function B5(e,n,a){const i=this;let o=0,u,d;return h;function h(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),u=31,d=ar,x(g))}function f(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,d=v5,x):(e.enter("characterReferenceValue"),u=7,d=Kh,x(g))}function x(g){if(g===59&&o){const w=e.exit("characterReferenceValue");return d===ar&&!Dm(i.sliceSerialize(w))?a(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return d(g)&&o++<u?(e.consume(g),x):a(g)}}const K0={partial:!0,tokenize:$5},Q0={concrete:!0,name:"codeFenced",tokenize:O5};function O5(e,n,a){const i=this,o={partial:!0,tokenize:$};let u=0,d=0,h;return m;function m(_){return f(_)}function f(_){const L=i.events[i.events.length-1];return u=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[1],!0).length:0,h=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),x(_)}function x(_){return _===h?(d++,e.consume(_),x):d<3?a(_):(e.exit("codeFencedFenceSequence"),Tt(_)?Ht(e,g,"whitespace")(_):g(_))}function g(_){return _===null||at(_)?(e.exit("codeFencedFence"),i.interrupt?n(_):e.check(K0,k,R)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),w(_))}function w(_){return _===null||at(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(_)):Tt(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ht(e,b,"whitespace")(_)):_===96&&_===h?a(_):(e.consume(_),w)}function b(_){return _===null||at(_)?g(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),j(_))}function j(_){return _===null||at(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(_)):_===96&&_===h?a(_):(e.consume(_),j)}function k(_){return e.attempt(o,R,N)(_)}function N(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),C}function C(_){return u>0&&Tt(_)?Ht(e,E,"linePrefix",u+1)(_):E(_)}function E(_){return _===null||at(_)?e.check(K0,k,R)(_):(e.enter("codeFlowValue"),B(_))}function B(_){return _===null||at(_)?(e.exit("codeFlowValue"),E(_)):(e.consume(_),B)}function R(_){return e.exit("codeFenced"),n(_)}function $(_,L,U){let Q=0;return D;function D(te){return _.enter("lineEnding"),_.consume(te),_.exit("lineEnding"),I}function I(te){return _.enter("codeFencedFence"),Tt(te)?Ht(_,H,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(te):H(te)}function H(te){return te===h?(_.enter("codeFencedFenceSequence"),q(te)):U(te)}function q(te){return te===h?(Q++,_.consume(te),q):Q>=d?(_.exit("codeFencedFenceSequence"),Tt(te)?Ht(_,ue,"whitespace")(te):ue(te)):U(te)}function ue(te){return te===null||at(te)?(_.exit("codeFencedFence"),L(te)):U(te)}}}function $5(e,n,a){const i=this;return o;function o(d){return d===null?a(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u)}function u(d){return i.parser.lazy[i.now().line]?a(d):n(d)}}const sh={name:"codeIndented",tokenize:I5},L5={partial:!0,tokenize:H5};function I5(e,n,a){const i=this;return o;function o(f){return e.enter("codeIndented"),Ht(e,u,"linePrefix",5)(f)}function u(f){const x=i.events[i.events.length-1];return x&&x[1].type==="linePrefix"&&x[2].sliceSerialize(x[1],!0).length>=4?d(f):a(f)}function d(f){return f===null?m(f):at(f)?e.attempt(L5,d,m)(f):(e.enter("codeFlowValue"),h(f))}function h(f){return f===null||at(f)?(e.exit("codeFlowValue"),d(f)):(e.consume(f),h)}function m(f){return e.exit("codeIndented"),n(f)}}function H5(e,n,a){const i=this;return o;function o(d){return i.parser.lazy[i.now().line]?a(d):at(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),o):Ht(e,u,"linePrefix",5)(d)}function u(d){const h=i.events[i.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?n(d):at(d)?o(d):a(d)}}const U5={name:"codeText",previous:Y5,resolve:q5,tokenize:X5};function q5(e){let n=e.length-4,a=3,i,o;if((e[a][1].type==="lineEnding"||e[a][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(i=a;++i<n;)if(e[i][1].type==="codeTextData"){e[a][1].type="codeTextPadding",e[n][1].type="codeTextPadding",a+=2,n-=2;break}}for(i=a-1,n++;++i<=n;)o===void 0?i!==n&&e[i][1].type!=="lineEnding"&&(o=i):(i===n||e[i][1].type==="lineEnding")&&(e[o][1].type="codeTextData",i!==o+2&&(e[o][1].end=e[i-1][1].end,e.splice(o+2,i-o-2),n-=i-o-2,i=o+2),o=void 0);return e}function Y5(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function X5(e,n,a){let i=0,o,u;return d;function d(g){return e.enter("codeText"),e.enter("codeTextSequence"),h(g)}function h(g){return g===96?(e.consume(g),i++,h):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?a(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(u=e.enter("codeTextSequence"),o=0,x(g)):at(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),f(g))}function f(g){return g===null||g===32||g===96||at(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),f)}function x(g){return g===96?(e.consume(g),o++,x):o===i?(e.exit("codeTextSequence"),e.exit("codeText"),n(g)):(u.type="codeTextData",f(g))}}class W5{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,a){const i=a??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(n,i):n>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(n,a,i){const o=a||0;this.setCursor(Math.trunc(n));const u=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return i&&So(this.left,i),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),So(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),So(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){const a=this.left.splice(n,Number.POSITIVE_INFINITY);So(this.right,a.reverse())}else{const a=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);So(this.left,a.reverse())}}}function So(e,n){let a=0;if(n.length<1e4)e.push(...n);else for(;a<n.length;)e.push(...n.slice(a,a+1e4)),a+=1e4}function Gy(e){const n={};let a=-1,i,o,u,d,h,m,f;const x=new W5(e);for(;++a<x.length;){for(;a in n;)a=n[a];if(i=x.get(a),a&&i[1].type==="chunkFlow"&&x.get(a-1)[1].type==="listItemPrefix"&&(m=i[1]._tokenizer.events,u=0,u<m.length&&m[u][1].type==="lineEndingBlank"&&(u+=2),u<m.length&&m[u][1].type==="content"))for(;++u<m.length&&m[u][1].type!=="content";)m[u][1].type==="chunkText"&&(m[u][1]._isInFirstContentOfListItem=!0,u++);if(i[0]==="enter")i[1].contentType&&(Object.assign(n,G5(x,a)),a=n[a],f=!0);else if(i[1]._container){for(u=a,o=void 0;u--;)if(d=x.get(u),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(o&&(x.get(o)[1].type="lineEndingBlank"),d[1].type="lineEnding",o=u);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;o&&(i[1].end={...x.get(o)[1].start},h=x.slice(o,a),h.unshift(i),x.splice(o,a-o+1,h))}}return Br(e,0,Number.POSITIVE_INFINITY,x.slice(0)),!f}function G5(e,n){const a=e.get(n)[1],i=e.get(n)[2];let o=n-1;const u=[];let d=a._tokenizer;d||(d=i.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const h=d.events,m=[],f={};let x,g,w=-1,b=a,j=0,k=0;const N=[k];for(;b;){for(;e.get(++o)[1]!==b;);u.push(o),b._tokenizer||(x=i.sliceStream(b),b.next||x.push(null),g&&d.defineSkip(b.start),b._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(x),b._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),g=b,b=b.next}for(b=a;++w<h.length;)h[w][0]==="exit"&&h[w-1][0]==="enter"&&h[w][1].type===h[w-1][1].type&&h[w][1].start.line!==h[w][1].end.line&&(k=w+1,N.push(k),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(d.events=[],b?(b._tokenizer=void 0,b.previous=void 0):N.pop(),w=N.length;w--;){const C=h.slice(N[w],N[w+1]),E=u.pop();m.push([E,E+C.length-1]),e.splice(E,2,C)}for(m.reverse(),w=-1;++w<m.length;)f[j+m[w][0]]=j+m[w][1],j+=m[w][1]-m[w][0]-1;return f}const V5={resolve:Q5,tokenize:P5},K5={partial:!0,tokenize:Z5};function Q5(e){return Gy(e),e}function P5(e,n){let a;return i;function i(h){return e.enter("content"),a=e.enter("chunkContent",{contentType:"content"}),o(h)}function o(h){return h===null?u(h):at(h)?e.check(K5,d,u)(h):(e.consume(h),o)}function u(h){return e.exit("chunkContent"),e.exit("content"),n(h)}function d(h){return e.consume(h),e.exit("chunkContent"),a.next=e.enter("chunkContent",{contentType:"content",previous:a}),a=a.next,o}}function Z5(e,n,a){const i=this;return o;function o(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Ht(e,u,"linePrefix")}function u(d){if(d===null||at(d))return a(d);const h=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?n(d):e.interrupt(i.parser.constructs.flow,a,n)(d)}}function Vy(e,n,a,i,o,u,d,h,m){const f=m||Number.POSITIVE_INFINITY;let x=0;return g;function g(C){return C===60?(e.enter(i),e.enter(o),e.enter(u),e.consume(C),e.exit(u),w):C===null||C===32||C===41||zu(C)?a(C):(e.enter(i),e.enter(d),e.enter(h),e.enter("chunkString",{contentType:"string"}),k(C))}function w(C){return C===62?(e.enter(u),e.consume(C),e.exit(u),e.exit(o),e.exit(i),n):(e.enter(h),e.enter("chunkString",{contentType:"string"}),b(C))}function b(C){return C===62?(e.exit("chunkString"),e.exit(h),w(C)):C===null||C===60||at(C)?a(C):(e.consume(C),C===92?j:b)}function j(C){return C===60||C===62||C===92?(e.consume(C),b):b(C)}function k(C){return!x&&(C===null||C===41||dn(C))?(e.exit("chunkString"),e.exit(h),e.exit(d),e.exit(i),n(C)):x<f&&C===40?(e.consume(C),x++,k):C===41?(e.consume(C),x--,k):C===null||C===32||C===40||zu(C)?a(C):(e.consume(C),C===92?N:k)}function N(C){return C===40||C===41||C===92?(e.consume(C),k):k(C)}}function Ky(e,n,a,i,o,u){const d=this;let h=0,m;return f;function f(b){return e.enter(i),e.enter(o),e.consume(b),e.exit(o),e.enter(u),x}function x(b){return h>999||b===null||b===91||b===93&&!m||b===94&&!h&&"_hiddenFootnoteSupport"in d.parser.constructs?a(b):b===93?(e.exit(u),e.enter(o),e.consume(b),e.exit(o),e.exit(i),n):at(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),x):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===null||b===91||b===93||at(b)||h++>999?(e.exit("chunkString"),x(b)):(e.consume(b),m||(m=!Tt(b)),b===92?w:g)}function w(b){return b===91||b===92||b===93?(e.consume(b),h++,g):g(b)}}function Qy(e,n,a,i,o,u){let d;return h;function h(w){return w===34||w===39||w===40?(e.enter(i),e.enter(o),e.consume(w),e.exit(o),d=w===40?41:w,m):a(w)}function m(w){return w===d?(e.enter(o),e.consume(w),e.exit(o),e.exit(i),n):(e.enter(u),f(w))}function f(w){return w===d?(e.exit(u),m(d)):w===null?a(w):at(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),Ht(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),x(w))}function x(w){return w===d||w===null||at(w)?(e.exit("chunkString"),f(w)):(e.consume(w),w===92?g:x)}function g(w){return w===d||w===92?(e.consume(w),x):x(w)}}function Bo(e,n){let a;return i;function i(o){return at(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a=!0,i):Tt(o)?Ht(e,i,a?"linePrefix":"lineSuffix")(o):n(o)}}const J5={name:"definition",tokenize:tk},ek={partial:!0,tokenize:nk};function tk(e,n,a){const i=this;let o;return u;function u(b){return e.enter("definition"),d(b)}function d(b){return Ky.call(i,e,h,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function h(b){return o=oa(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),m):a(b)}function m(b){return dn(b)?Bo(e,f)(b):f(b)}function f(b){return Vy(e,x,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function x(b){return e.attempt(ek,g,g)(b)}function g(b){return Tt(b)?Ht(e,w,"whitespace")(b):w(b)}function w(b){return b===null||at(b)?(e.exit("definition"),i.parser.defined.push(o),n(b)):a(b)}}function nk(e,n,a){return i;function i(h){return dn(h)?Bo(e,o)(h):a(h)}function o(h){return Qy(e,u,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function u(h){return Tt(h)?Ht(e,d,"whitespace")(h):d(h)}function d(h){return h===null||at(h)?n(h):a(h)}}const rk={name:"hardBreakEscape",tokenize:ak};function ak(e,n,a){return i;function i(u){return e.enter("hardBreakEscape"),e.consume(u),o}function o(u){return at(u)?(e.exit("hardBreakEscape"),n(u)):a(u)}}const lk={name:"headingAtx",resolve:ik,tokenize:sk};function ik(e,n){let a=e.length-2,i=3,o,u;return e[i][1].type==="whitespace"&&(i+=2),a-2>i&&e[a][1].type==="whitespace"&&(a-=2),e[a][1].type==="atxHeadingSequence"&&(i===a-1||a-4>i&&e[a-2][1].type==="whitespace")&&(a-=i+1===a?2:4),a>i&&(o={type:"atxHeadingText",start:e[i][1].start,end:e[a][1].end},u={type:"chunkText",start:e[i][1].start,end:e[a][1].end,contentType:"text"},Br(e,i,a-i+1,[["enter",o,n],["enter",u,n],["exit",u,n],["exit",o,n]])),e}function sk(e,n,a){let i=0;return o;function o(x){return e.enter("atxHeading"),u(x)}function u(x){return e.enter("atxHeadingSequence"),d(x)}function d(x){return x===35&&i++<6?(e.consume(x),d):x===null||dn(x)?(e.exit("atxHeadingSequence"),h(x)):a(x)}function h(x){return x===35?(e.enter("atxHeadingSequence"),m(x)):x===null||at(x)?(e.exit("atxHeading"),n(x)):Tt(x)?Ht(e,h,"whitespace")(x):(e.enter("atxHeadingText"),f(x))}function m(x){return x===35?(e.consume(x),m):(e.exit("atxHeadingSequence"),h(x))}function f(x){return x===null||x===35||dn(x)?(e.exit("atxHeadingText"),h(x)):(e.consume(x),f)}}const ok=["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"],P0=["pre","script","style","textarea"],ck={concrete:!0,name:"htmlFlow",resolveTo:fk,tokenize:hk},uk={partial:!0,tokenize:pk},dk={partial:!0,tokenize:mk};function fk(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function hk(e,n,a){const i=this;let o,u,d,h,m;return f;function f(T){return x(T)}function x(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),g}function g(T){return T===33?(e.consume(T),w):T===47?(e.consume(T),u=!0,k):T===63?(e.consume(T),o=3,i.interrupt?n:A):sr(T)?(e.consume(T),d=String.fromCharCode(T),N):a(T)}function w(T){return T===45?(e.consume(T),o=2,b):T===91?(e.consume(T),o=5,h=0,j):sr(T)?(e.consume(T),o=4,i.interrupt?n:A):a(T)}function b(T){return T===45?(e.consume(T),i.interrupt?n:A):a(T)}function j(T){const de="CDATA[";return T===de.charCodeAt(h++)?(e.consume(T),h===de.length?i.interrupt?n:H:j):a(T)}function k(T){return sr(T)?(e.consume(T),d=String.fromCharCode(T),N):a(T)}function N(T){if(T===null||T===47||T===62||dn(T)){const de=T===47,xe=d.toLowerCase();return!de&&!u&&P0.includes(xe)?(o=1,i.interrupt?n(T):H(T)):ok.includes(d.toLowerCase())?(o=6,de?(e.consume(T),C):i.interrupt?n(T):H(T)):(o=7,i.interrupt&&!i.parser.lazy[i.now().line]?a(T):u?E(T):B(T))}return T===45||ar(T)?(e.consume(T),d+=String.fromCharCode(T),N):a(T)}function C(T){return T===62?(e.consume(T),i.interrupt?n:H):a(T)}function E(T){return Tt(T)?(e.consume(T),E):D(T)}function B(T){return T===47?(e.consume(T),D):T===58||T===95||sr(T)?(e.consume(T),R):Tt(T)?(e.consume(T),B):D(T)}function R(T){return T===45||T===46||T===58||T===95||ar(T)?(e.consume(T),R):$(T)}function $(T){return T===61?(e.consume(T),_):Tt(T)?(e.consume(T),$):B(T)}function _(T){return T===null||T===60||T===61||T===62||T===96?a(T):T===34||T===39?(e.consume(T),m=T,L):Tt(T)?(e.consume(T),_):U(T)}function L(T){return T===m?(e.consume(T),m=null,Q):T===null||at(T)?a(T):(e.consume(T),L)}function U(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||dn(T)?$(T):(e.consume(T),U)}function Q(T){return T===47||T===62||Tt(T)?B(T):a(T)}function D(T){return T===62?(e.consume(T),I):a(T)}function I(T){return T===null||at(T)?H(T):Tt(T)?(e.consume(T),I):a(T)}function H(T){return T===45&&o===2?(e.consume(T),Y):T===60&&o===1?(e.consume(T),se):T===62&&o===4?(e.consume(T),F):T===63&&o===3?(e.consume(T),A):T===93&&o===5?(e.consume(T),Z):at(T)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(uk,W,q)(T)):T===null||at(T)?(e.exit("htmlFlowData"),q(T)):(e.consume(T),H)}function q(T){return e.check(dk,ue,W)(T)}function ue(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),te}function te(T){return T===null||at(T)?q(T):(e.enter("htmlFlowData"),H(T))}function Y(T){return T===45?(e.consume(T),A):H(T)}function se(T){return T===47?(e.consume(T),d="",J):H(T)}function J(T){if(T===62){const de=d.toLowerCase();return P0.includes(de)?(e.consume(T),F):H(T)}return sr(T)&&d.length<8?(e.consume(T),d+=String.fromCharCode(T),J):H(T)}function Z(T){return T===93?(e.consume(T),A):H(T)}function A(T){return T===62?(e.consume(T),F):T===45&&o===2?(e.consume(T),A):H(T)}function F(T){return T===null||at(T)?(e.exit("htmlFlowData"),W(T)):(e.consume(T),F)}function W(T){return e.exit("htmlFlow"),n(T)}}function mk(e,n,a){const i=this;return o;function o(d){return at(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):a(d)}function u(d){return i.parser.lazy[i.now().line]?a(d):n(d)}}function pk(e,n,a){return i;function i(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Xo,n,a)}}const xk={name:"htmlText",tokenize:gk};function gk(e,n,a){const i=this;let o,u,d;return h;function h(A){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(A),m}function m(A){return A===33?(e.consume(A),f):A===47?(e.consume(A),$):A===63?(e.consume(A),B):sr(A)?(e.consume(A),U):a(A)}function f(A){return A===45?(e.consume(A),x):A===91?(e.consume(A),u=0,j):sr(A)?(e.consume(A),E):a(A)}function x(A){return A===45?(e.consume(A),b):a(A)}function g(A){return A===null?a(A):A===45?(e.consume(A),w):at(A)?(d=g,se(A)):(e.consume(A),g)}function w(A){return A===45?(e.consume(A),b):g(A)}function b(A){return A===62?Y(A):A===45?w(A):g(A)}function j(A){const F="CDATA[";return A===F.charCodeAt(u++)?(e.consume(A),u===F.length?k:j):a(A)}function k(A){return A===null?a(A):A===93?(e.consume(A),N):at(A)?(d=k,se(A)):(e.consume(A),k)}function N(A){return A===93?(e.consume(A),C):k(A)}function C(A){return A===62?Y(A):A===93?(e.consume(A),C):k(A)}function E(A){return A===null||A===62?Y(A):at(A)?(d=E,se(A)):(e.consume(A),E)}function B(A){return A===null?a(A):A===63?(e.consume(A),R):at(A)?(d=B,se(A)):(e.consume(A),B)}function R(A){return A===62?Y(A):B(A)}function $(A){return sr(A)?(e.consume(A),_):a(A)}function _(A){return A===45||ar(A)?(e.consume(A),_):L(A)}function L(A){return at(A)?(d=L,se(A)):Tt(A)?(e.consume(A),L):Y(A)}function U(A){return A===45||ar(A)?(e.consume(A),U):A===47||A===62||dn(A)?Q(A):a(A)}function Q(A){return A===47?(e.consume(A),Y):A===58||A===95||sr(A)?(e.consume(A),D):at(A)?(d=Q,se(A)):Tt(A)?(e.consume(A),Q):Y(A)}function D(A){return A===45||A===46||A===58||A===95||ar(A)?(e.consume(A),D):I(A)}function I(A){return A===61?(e.consume(A),H):at(A)?(d=I,se(A)):Tt(A)?(e.consume(A),I):Q(A)}function H(A){return A===null||A===60||A===61||A===62||A===96?a(A):A===34||A===39?(e.consume(A),o=A,q):at(A)?(d=H,se(A)):Tt(A)?(e.consume(A),H):(e.consume(A),ue)}function q(A){return A===o?(e.consume(A),o=void 0,te):A===null?a(A):at(A)?(d=q,se(A)):(e.consume(A),q)}function ue(A){return A===null||A===34||A===39||A===60||A===61||A===96?a(A):A===47||A===62||dn(A)?Q(A):(e.consume(A),ue)}function te(A){return A===47||A===62||dn(A)?Q(A):a(A)}function Y(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),n):a(A)}function se(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),J}function J(A){return Tt(A)?Ht(e,Z,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):Z(A)}function Z(A){return e.enter("htmlTextData"),d(A)}}const Tm={name:"labelEnd",resolveAll:wk,resolveTo:kk,tokenize:jk},yk={tokenize:Sk},bk={tokenize:Ck},vk={tokenize:Nk};function wk(e){let n=-1;const a=[];for(;++n<e.length;){const i=e[n][1];if(a.push(e[n]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const o=i.type==="labelImage"?4:2;i.type="data",n+=o}}return e.length!==a.length&&Br(e,0,e.length,a),e}function kk(e,n){let a=e.length,i=0,o,u,d,h;for(;a--;)if(o=e[a][1],u){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[a][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(d){if(e[a][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(u=a,o.type!=="labelLink")){i=2;break}}else o.type==="labelEnd"&&(d=a);const m={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[u][1].start},end:{...e[d][1].end}},x={type:"labelText",start:{...e[u+i+2][1].end},end:{...e[d-2][1].start}};return h=[["enter",m,n],["enter",f,n]],h=Vr(h,e.slice(u+1,u+i+3)),h=Vr(h,[["enter",x,n]]),h=Vr(h,Wu(n.parser.constructs.insideSpan.null,e.slice(u+i+4,d-3),n)),h=Vr(h,[["exit",x,n],e[d-2],e[d-1],["exit",f,n]]),h=Vr(h,e.slice(d+1)),h=Vr(h,[["exit",m,n]]),Br(e,u,e.length,h),e}function jk(e,n,a){const i=this;let o=i.events.length,u,d;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 h;function h(w){return u?u._inactive?g(w):(d=i.parser.defined.includes(oa(i.sliceSerialize({start:u.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(w),e.exit("labelMarker"),e.exit("labelEnd"),m):a(w)}function m(w){return w===40?e.attempt(yk,x,d?x:g)(w):w===91?e.attempt(bk,x,d?f:g)(w):d?x(w):g(w)}function f(w){return e.attempt(vk,x,g)(w)}function x(w){return n(w)}function g(w){return u._balanced=!0,a(w)}}function Sk(e,n,a){return i;function i(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),o}function o(g){return dn(g)?Bo(e,u)(g):u(g)}function u(g){return g===41?x(g):Vy(e,d,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function d(g){return dn(g)?Bo(e,m)(g):x(g)}function h(g){return a(g)}function m(g){return g===34||g===39||g===40?Qy(e,f,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):x(g)}function f(g){return dn(g)?Bo(e,x)(g):x(g)}function x(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),n):a(g)}}function Ck(e,n,a){const i=this;return o;function o(h){return Ky.call(i,e,u,d,"reference","referenceMarker","referenceString")(h)}function u(h){return i.parser.defined.includes(oa(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?n(h):a(h)}function d(h){return a(h)}}function Nk(e,n,a){return i;function i(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),o}function o(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),n):a(u)}}const Ek={name:"labelStartImage",resolveAll:Tm.resolveAll,tokenize:Ak};function Ak(e,n,a){const i=this;return o;function o(h){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(h),e.exit("labelImageMarker"),u}function u(h){return h===91?(e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelImage"),d):a(h)}function d(h){return h===94&&"_hiddenFootnoteSupport"in i.parser.constructs?a(h):n(h)}}const Dk={name:"labelStartLink",resolveAll:Tm.resolveAll,tokenize:Tk};function Tk(e,n,a){const i=this;return o;function o(d){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelLink"),u}function u(d){return d===94&&"_hiddenFootnoteSupport"in i.parser.constructs?a(d):n(d)}}const oh={name:"lineEnding",tokenize:Fk};function Fk(e,n){return a;function a(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),Ht(e,n,"linePrefix")}}const Du={name:"thematicBreak",tokenize:Mk};function Mk(e,n,a){let i=0,o;return u;function u(f){return e.enter("thematicBreak"),d(f)}function d(f){return o=f,h(f)}function h(f){return f===o?(e.enter("thematicBreakSequence"),m(f)):i>=3&&(f===null||at(f))?(e.exit("thematicBreak"),n(f)):a(f)}function m(f){return f===o?(e.consume(f),i++,m):(e.exit("thematicBreakSequence"),Tt(f)?Ht(e,h,"whitespace")(f):h(f))}}const vr={continuation:{tokenize:Bk},exit:$k,name:"list",tokenize:_k},Rk={partial:!0,tokenize:Lk},zk={partial:!0,tokenize:Ok};function _k(e,n,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,d=0;return h;function h(b){const j=i.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(j==="listUnordered"?!i.containerState.marker||b===i.containerState.marker:Kh(b)){if(i.containerState.type||(i.containerState.type=j,e.enter(j,{_container:!0})),j==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(Du,a,f)(b):f(b);if(!i.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(b)}return a(b)}function m(b){return Kh(b)&&++d<10?(e.consume(b),m):(!i.interrupt||d<2)&&(i.containerState.marker?b===i.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),f(b)):a(b)}function f(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||b,e.check(Xo,i.interrupt?a:x,e.attempt(Rk,w,g))}function x(b){return i.containerState.initialBlankLine=!0,u++,w(b)}function g(b){return Tt(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),w):a(b)}function w(b){return i.containerState.size=u+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(b)}}function Bk(e,n,a){const i=this;return i.containerState._closeFlow=void 0,e.check(Xo,o,u);function o(h){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,Ht(e,n,"listItemIndent",i.containerState.size+1)(h)}function u(h){return i.containerState.furtherBlankLines||!Tt(h)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,d(h)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(zk,n,d)(h))}function d(h){return i.containerState._closeFlow=!0,i.interrupt=void 0,Ht(e,e.attempt(vr,n,a),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function Ok(e,n,a){const i=this;return Ht(e,o,"listItemIndent",i.containerState.size+1);function o(u){const d=i.events[i.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===i.containerState.size?n(u):a(u)}}function $k(e){e.exit(this.containerState.type)}function Lk(e,n,a){const i=this;return Ht(e,o,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(u){const d=i.events[i.events.length-1];return!Tt(u)&&d&&d[1].type==="listItemPrefixWhitespace"?n(u):a(u)}}const Z0={name:"setextUnderline",resolveTo:Ik,tokenize:Hk};function Ik(e,n){let a=e.length,i,o,u;for(;a--;)if(e[a][0]==="enter"){if(e[a][1].type==="content"){i=a;break}e[a][1].type==="paragraph"&&(o=a)}else e[a][1].type==="content"&&e.splice(a,1),!u&&e[a][1].type==="definition"&&(u=a);const d={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",u?(e.splice(o,0,["enter",d,n]),e.splice(u+1,0,["exit",e[i][1],n]),e[i][1].end={...e[u][1].end}):e[i][1]=d,e.push(["exit",d,n]),e}function Hk(e,n,a){const i=this;let o;return u;function u(f){let x=i.events.length,g;for(;x--;)if(i.events[x][1].type!=="lineEnding"&&i.events[x][1].type!=="linePrefix"&&i.events[x][1].type!=="content"){g=i.events[x][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||g)?(e.enter("setextHeadingLine"),o=f,d(f)):a(f)}function d(f){return e.enter("setextHeadingLineSequence"),h(f)}function h(f){return f===o?(e.consume(f),h):(e.exit("setextHeadingLineSequence"),Tt(f)?Ht(e,m,"lineSuffix")(f):m(f))}function m(f){return f===null||at(f)?(e.exit("setextHeadingLine"),n(f)):a(f)}}const Uk={tokenize:qk};function qk(e){const n=this,a=e.attempt(Xo,i,e.attempt(this.parser.constructs.flowInitial,o,Ht(e,e.attempt(this.parser.constructs.flow,o,e.attempt(V5,o)),"linePrefix")));return a;function i(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),n.currentConstruct=void 0,a}function o(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),n.currentConstruct=void 0,a}}const Yk={resolveAll:Zy()},Xk=Py("string"),Wk=Py("text");function Py(e){return{resolveAll:Zy(e==="text"?Gk:void 0),tokenize:n};function n(a){const i=this,o=this.parser.constructs[e],u=a.attempt(o,d,h);return d;function d(x){return f(x)?u(x):h(x)}function h(x){if(x===null){a.consume(x);return}return a.enter("data"),a.consume(x),m}function m(x){return f(x)?(a.exit("data"),u(x)):(a.consume(x),m)}function f(x){if(x===null)return!0;const g=o[x];let w=-1;if(g)for(;++w<g.length;){const b=g[w];if(!b.previous||b.previous.call(i,i.previous))return!0}return!1}}}function Zy(e){return n;function n(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 e?e(a,i):a}}function Gk(e,n){let a=0;for(;++a<=e.length;)if((a===e.length||e[a][1].type==="lineEnding")&&e[a-1][1].type==="data"){const i=e[a-1][1],o=n.sliceStream(i);let u=o.length,d=-1,h=0,m;for(;u--;){const f=o[u];if(typeof f=="string"){for(d=f.length;f.charCodeAt(d-1)===32;)h++,d--;if(d)break;d=-1}else if(f===-2)m=!0,h++;else if(f!==-1){u++;break}}if(n._contentTypeTextTrailing&&a===e.length&&(h=0),h){const f={type:a===e.length||m||h<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?d:i.start._bufferIndex+d,_index:i.start._index+u,line:i.end.line,column:i.end.column-h,offset:i.end.offset-h},end:{...i.end}};i.end={...f.start},i.start.offset===i.end.offset?Object.assign(i,f):(e.splice(a,0,["enter",f,n],["exit",f,n]),a+=2)}a++}return e}const Vk={42:vr,43:vr,45:vr,48:vr,49:vr,50:vr,51:vr,52:vr,53:vr,54:vr,55:vr,56:vr,57:vr,62:Yy},Kk={91:J5},Qk={[-2]:sh,[-1]:sh,32:sh},Pk={35:lk,42:Du,45:[Z0,Du],60:ck,61:Z0,95:Du,96:Q0,126:Q0},Zk={38:Wy,92:Xy},Jk={[-5]:oh,[-4]:oh,[-3]:oh,33:Ek,38:Wy,42:Qh,60:[D5,xk],91:Dk,92:[rk,Xy],93:Tm,95:Qh,96:U5},e3={null:[Qh,Yk]},t3={null:[42,95]},n3={null:[]},r3=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:t3,contentInitial:Kk,disable:n3,document:Vk,flow:Pk,flowInitial:Qk,insideSpan:e3,string:Zk,text:Jk},Symbol.toStringTag,{value:"Module"}));function a3(e,n,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 d=[],h=[];const m={attempt:L($),check:L(_),consume:E,enter:B,exit:R,interrupt:L(_,{interrupt:!0})},f={code:null,containerState:{},defineSkip:k,events:[],now:j,parser:e,previous:null,sliceSerialize:w,sliceStream:b,write:g};let x=n.tokenize.call(f,m);return n.resolveAll&&u.push(n),f;function g(I){return d=Vr(d,I),N(),d[d.length-1]!==null?[]:(U(n,0),f.events=Wu(u,f.events,f),f.events)}function w(I,H){return i3(b(I),H)}function b(I){return l3(d,I)}function j(){const{_bufferIndex:I,_index:H,line:q,column:ue,offset:te}=i;return{_bufferIndex:I,_index:H,line:q,column:ue,offset:te}}function k(I){o[I.line]=I.column,D()}function N(){let I;for(;i._index<d.length;){const H=d[i._index];if(typeof H=="string")for(I=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===I&&i._bufferIndex<H.length;)C(H.charCodeAt(i._bufferIndex));else C(H)}}function C(I){x=x(I)}function E(I){at(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===d[i._index].length&&(i._bufferIndex=-1,i._index++)),f.previous=I}function B(I,H){const q=H||{};return q.type=I,q.start=j(),f.events.push(["enter",q,f]),h.push(q),q}function R(I){const H=h.pop();return H.end=j(),f.events.push(["exit",H,f]),H}function $(I,H){U(I,H.from)}function _(I,H){H.restore()}function L(I,H){return q;function q(ue,te,Y){let se,J,Z,A;return Array.isArray(ue)?W(ue):"tokenize"in ue?W([ue]):F(ue);function F(ye){return Le;function Le(Xe){const Ye=Xe!==null&&ye[Xe],ht=Xe!==null&&ye.null,tt=[...Array.isArray(Ye)?Ye:Ye?[Ye]:[],...Array.isArray(ht)?ht:ht?[ht]:[]];return W(tt)(Xe)}}function W(ye){return se=ye,J=0,ye.length===0?Y:T(ye[J])}function T(ye){return Le;function Le(Xe){return A=Q(),Z=ye,ye.partial||(f.currentConstruct=ye),ye.name&&f.parser.constructs.disable.null.includes(ye.name)?xe():ye.tokenize.call(H?Object.assign(Object.create(f),H):f,m,de,xe)(Xe)}}function de(ye){return I(Z,A),te}function xe(ye){return A.restore(),++J<se.length?T(se[J]):Y}}}function U(I,H){I.resolveAll&&!u.includes(I)&&u.push(I),I.resolve&&Br(f.events,H,f.events.length-H,I.resolve(f.events.slice(H),f)),I.resolveTo&&(f.events=I.resolveTo(f.events,f))}function Q(){const I=j(),H=f.previous,q=f.currentConstruct,ue=f.events.length,te=Array.from(h);return{from:ue,restore:Y};function Y(){i=I,f.previous=H,f.currentConstruct=q,f.events.length=ue,h=te,D()}}function D(){i.line in o&&i.column<2&&(i.column=o[i.line],i.offset+=o[i.line]-1)}}function l3(e,n){const a=n.start._index,i=n.start._bufferIndex,o=n.end._index,u=n.end._bufferIndex;let d;if(a===o)d=[e[a].slice(i,u)];else{if(d=e.slice(a,o),i>-1){const h=d[0];typeof h=="string"?d[0]=h.slice(i):d.shift()}u>0&&d.push(e[o].slice(0,u))}return d}function i3(e,n){let a=-1;const i=[];let o;for(;++a<e.length;){const u=e[a];let d;if(typeof u=="string")d=u;else switch(u){case-5:{d="\r";break}case-4:{d=`
|
|
53
|
-
`;break}case-3:{d=`\r
|
|
54
|
-
`;break}case-2:{d=n?" ":" ";break}case-1:{if(!n&&o)continue;d=" ";break}default:d=String.fromCharCode(u)}o=u===-2,i.push(d)}return i.join("")}function s3(e){const i={constructs:Uy([r3,...(e||{}).extensions||[]]),content:o(k5),defined:[],document:o(S5),flow:o(Uk),lazy:{},string:o(Xk),text:o(Wk)};return i;function o(u){return d;function d(h){return a3(i,u,h)}}}function o3(e){for(;!Gy(e););return e}const J0=/[\0\t\n\r]/g;function c3(){let e=1,n="",a=!0,i;return o;function o(u,d,h){const m=[];let f,x,g,w,b;for(u=n+(typeof u=="string"?u.toString():new TextDecoder(d||void 0).decode(u)),g=0,n="",a&&(u.charCodeAt(0)===65279&&g++,a=void 0);g<u.length;){if(J0.lastIndex=g,f=J0.exec(u),w=f&&f.index!==void 0?f.index:u.length,b=u.charCodeAt(w),!f){n=u.slice(g);break}if(b===10&&g===w&&i)m.push(-3),i=void 0;else switch(i&&(m.push(-5),i=void 0),g<w&&(m.push(u.slice(g,w)),e+=w-g),b){case 0:{m.push(65533),e++;break}case 9:{for(x=Math.ceil(e/4)*4,m.push(-2);e++<x;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:i=!0,e=1}g=w+1}return h&&(i&&m.push(-5),n&&m.push(n),m.push(null)),m}}const u3=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function d3(e){return e.replace(u3,f3)}function f3(e,n,a){if(n)return n;if(a.charCodeAt(0)===35){const o=a.charCodeAt(1),u=o===120||o===88;return qy(a.slice(u?2:1),u?16:10)}return Dm(a)||e}const Jy={}.hasOwnProperty;function h3(e,n,a){return n&&typeof n=="object"&&(a=n,n=void 0),m3(a)(o3(s3(a).document().write(c3()(e,n,!0))))}function m3(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Wt),autolinkProtocol:Q,autolinkEmail:Q,atxHeading:u(yt),blockQuote:u(ht),characterEscape:Q,characterReference:Q,codeFenced:u(tt),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:u(tt,d),codeText:u(Je,d),codeTextData:Q,data:Q,codeFlowValue:Q,definition:u(Ne),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:u(De),hardBreakEscape:u(ct),hardBreakTrailing:u(ct),htmlFlow:u(pt,d),htmlFlowData:Q,htmlText:u(pt,d),htmlTextData:Q,image:u(jt),label:d,link:u(Wt),listItem:u(Nt),listItemValue:w,listOrdered:u(Ft,g),listUnordered:u(Ft),paragraph:u($n),reference:T,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:u(yt),strong:u(me),thematicBreak:u(Ee)},exit:{atxHeading:m(),atxHeadingSequence:$,autolink:m(),autolinkEmail:Ye,autolinkProtocol:Xe,blockQuote:m(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:xe,characterReferenceMarkerNumeric:xe,characterReferenceValue:ye,characterReference:Le,codeFenced:m(N),codeFencedFence:k,codeFencedFenceInfo:b,codeFencedFenceMeta:j,codeFlowValue:D,codeIndented:m(C),codeText:m(te),codeTextData:D,data:D,definition:m(),definitionDestinationString:R,definitionLabelString:E,definitionTitleString:B,emphasis:m(),hardBreakEscape:m(H),hardBreakTrailing:m(H),htmlFlow:m(q),htmlFlowData:D,htmlText:m(ue),htmlTextData:D,image:m(se),label:Z,labelText:J,lineEnding:I,link:m(Y),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:de,resourceDestinationString:A,resourceTitleString:F,resource:W,setextHeading:m(U),setextHeadingLineSequence:L,setextHeadingText:_,strong:m(),thematicBreak:m()}};eb(n,(e||{}).mdastExtensions||[]);const a={};return i;function i(G){let ce={type:"root",children:[]};const ne={stack:[ce],tokenStack:[],config:n,enter:h,exit:f,buffer:d,resume:x,data:a},ke=[];let ve=-1;for(;++ve<G.length;)if(G[ve][1].type==="listOrdered"||G[ve][1].type==="listUnordered")if(G[ve][0]==="enter")ke.push(ve);else{const ze=ke.pop();ve=o(G,ze,ve)}for(ve=-1;++ve<G.length;){const ze=n[G[ve][0]];Jy.call(ze,G[ve][1].type)&&ze[G[ve][1].type].call(Object.assign({sliceSerialize:G[ve][2].sliceSerialize},ne),G[ve][1])}if(ne.tokenStack.length>0){const ze=ne.tokenStack[ne.tokenStack.length-1];(ze[1]||eg).call(ne,void 0,ze[0])}for(ce.position={start:zl(G.length>0?G[0][1].start:{line:1,column:1,offset:0}),end:zl(G.length>0?G[G.length-2][1].end:{line:1,column:1,offset:0})},ve=-1;++ve<n.transforms.length;)ce=n.transforms[ve](ce)||ce;return ce}function o(G,ce,ne){let ke=ce-1,ve=-1,ze=!1,_e,Be,He,rt;for(;++ke<=ne;){const Ve=G[ke];switch(Ve[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ve[0]==="enter"?ve++:ve--,rt=void 0;break}case"lineEndingBlank":{Ve[0]==="enter"&&(_e&&!rt&&!ve&&!He&&(He=ke),rt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:rt=void 0}if(!ve&&Ve[0]==="enter"&&Ve[1].type==="listItemPrefix"||ve===-1&&Ve[0]==="exit"&&(Ve[1].type==="listUnordered"||Ve[1].type==="listOrdered")){if(_e){let bt=ke;for(Be=void 0;bt--;){const Re=G[bt];if(Re[1].type==="lineEnding"||Re[1].type==="lineEndingBlank"){if(Re[0]==="exit")continue;Be&&(G[Be][1].type="lineEndingBlank",ze=!0),Re[1].type="lineEnding",Be=bt}else if(!(Re[1].type==="linePrefix"||Re[1].type==="blockQuotePrefix"||Re[1].type==="blockQuotePrefixWhitespace"||Re[1].type==="blockQuoteMarker"||Re[1].type==="listItemIndent"))break}He&&(!Be||He<Be)&&(_e._spread=!0),_e.end=Object.assign({},Be?G[Be][1].start:Ve[1].end),G.splice(Be||ke,0,["exit",_e,Ve[2]]),ke++,ne++}if(Ve[1].type==="listItemPrefix"){const bt={type:"listItem",_spread:!1,start:Object.assign({},Ve[1].start),end:void 0};_e=bt,G.splice(ke,0,["enter",bt,Ve[2]]),ke++,ne++,He=void 0,rt=!0}}}return G[ce][1]._spread=ze,ne}function u(G,ce){return ne;function ne(ke){h.call(this,G(ke),ke),ce&&ce.call(this,ke)}}function d(){this.stack.push({type:"fragment",children:[]})}function h(G,ce,ne){this.stack[this.stack.length-1].children.push(G),this.stack.push(G),this.tokenStack.push([ce,ne||void 0]),G.position={start:zl(ce.start),end:void 0}}function m(G){return ce;function ce(ne){G&&G.call(this,ne),f.call(this,ne)}}function f(G,ce){const ne=this.stack.pop(),ke=this.tokenStack.pop();if(ke)ke[0].type!==G.type&&(ce?ce.call(this,G,ke[0]):(ke[1]||eg).call(this,G,ke[0]));else throw new Error("Cannot close `"+G.type+"` ("+_o({start:G.start,end:G.end})+"): it’s not open");ne.position.end=zl(G.end)}function x(){return Am(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function w(G){if(this.data.expectingFirstListItemValue){const ce=this.stack[this.stack.length-2];ce.start=Number.parseInt(this.sliceSerialize(G),10),this.data.expectingFirstListItemValue=void 0}}function b(){const G=this.resume(),ce=this.stack[this.stack.length-1];ce.lang=G}function j(){const G=this.resume(),ce=this.stack[this.stack.length-1];ce.meta=G}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const G=this.resume(),ce=this.stack[this.stack.length-1];ce.value=G.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const G=this.resume(),ce=this.stack[this.stack.length-1];ce.value=G.replace(/(\r?\n|\r)$/g,"")}function E(G){const ce=this.resume(),ne=this.stack[this.stack.length-1];ne.label=ce,ne.identifier=oa(this.sliceSerialize(G)).toLowerCase()}function B(){const G=this.resume(),ce=this.stack[this.stack.length-1];ce.title=G}function R(){const G=this.resume(),ce=this.stack[this.stack.length-1];ce.url=G}function $(G){const ce=this.stack[this.stack.length-1];if(!ce.depth){const ne=this.sliceSerialize(G).length;ce.depth=ne}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function L(G){const ce=this.stack[this.stack.length-1];ce.depth=this.sliceSerialize(G).codePointAt(0)===61?1:2}function U(){this.data.setextHeadingSlurpLineEnding=void 0}function Q(G){const ne=this.stack[this.stack.length-1].children;let ke=ne[ne.length-1];(!ke||ke.type!=="text")&&(ke=Se(),ke.position={start:zl(G.start),end:void 0},ne.push(ke)),this.stack.push(ke)}function D(G){const ce=this.stack.pop();ce.value+=this.sliceSerialize(G),ce.position.end=zl(G.end)}function I(G){const ce=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ne=ce.children[ce.children.length-1];ne.position.end=zl(G.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(ce.type)&&(Q.call(this,G),D.call(this,G))}function H(){this.data.atHardBreak=!0}function q(){const G=this.resume(),ce=this.stack[this.stack.length-1];ce.value=G}function ue(){const G=this.resume(),ce=this.stack[this.stack.length-1];ce.value=G}function te(){const G=this.resume(),ce=this.stack[this.stack.length-1];ce.value=G}function Y(){const G=this.stack[this.stack.length-1];if(this.data.inReference){const ce=this.data.referenceType||"shortcut";G.type+="Reference",G.referenceType=ce,delete G.url,delete G.title}else delete G.identifier,delete G.label;this.data.referenceType=void 0}function se(){const G=this.stack[this.stack.length-1];if(this.data.inReference){const ce=this.data.referenceType||"shortcut";G.type+="Reference",G.referenceType=ce,delete G.url,delete G.title}else delete G.identifier,delete G.label;this.data.referenceType=void 0}function J(G){const ce=this.sliceSerialize(G),ne=this.stack[this.stack.length-2];ne.label=d3(ce),ne.identifier=oa(ce).toLowerCase()}function Z(){const G=this.stack[this.stack.length-1],ce=this.resume(),ne=this.stack[this.stack.length-1];if(this.data.inReference=!0,ne.type==="link"){const ke=G.children;ne.children=ke}else ne.alt=ce}function A(){const G=this.resume(),ce=this.stack[this.stack.length-1];ce.url=G}function F(){const G=this.resume(),ce=this.stack[this.stack.length-1];ce.title=G}function W(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function de(G){const ce=this.resume(),ne=this.stack[this.stack.length-1];ne.label=ce,ne.identifier=oa(this.sliceSerialize(G)).toLowerCase(),this.data.referenceType="full"}function xe(G){this.data.characterReferenceType=G.type}function ye(G){const ce=this.sliceSerialize(G),ne=this.data.characterReferenceType;let ke;ne?(ke=qy(ce,ne==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ke=Dm(ce);const ve=this.stack[this.stack.length-1];ve.value+=ke}function Le(G){const ce=this.stack.pop();ce.position.end=zl(G.end)}function Xe(G){D.call(this,G);const ce=this.stack[this.stack.length-1];ce.url=this.sliceSerialize(G)}function Ye(G){D.call(this,G);const ce=this.stack[this.stack.length-1];ce.url="mailto:"+this.sliceSerialize(G)}function ht(){return{type:"blockquote",children:[]}}function tt(){return{type:"code",lang:null,meta:null,value:""}}function Je(){return{type:"inlineCode",value:""}}function Ne(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function De(){return{type:"emphasis",children:[]}}function yt(){return{type:"heading",depth:0,children:[]}}function ct(){return{type:"break"}}function pt(){return{type:"html",value:""}}function jt(){return{type:"image",title:null,url:"",alt:null}}function Wt(){return{type:"link",title:null,url:"",children:[]}}function Ft(G){return{type:"list",ordered:G.type==="listOrdered",start:null,spread:G._spread,children:[]}}function Nt(G){return{type:"listItem",spread:G._spread,checked:null,children:[]}}function $n(){return{type:"paragraph",children:[]}}function me(){return{type:"strong",children:[]}}function Se(){return{type:"text",value:""}}function Ee(){return{type:"thematicBreak"}}}function zl(e){return{line:e.line,column:e.column,offset:e.offset}}function eb(e,n){let a=-1;for(;++a<n.length;){const i=n[a];Array.isArray(i)?eb(e,i):p3(e,i)}}function p3(e,n){let a;for(a in n)if(Jy.call(n,a))switch(a){case"canContainEols":{const i=n[a];i&&e[a].push(...i);break}case"transforms":{const i=n[a];i&&e[a].push(...i);break}case"enter":case"exit":{const i=n[a];i&&Object.assign(e[a],i);break}}}function eg(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+_o({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+_o({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+_o({start:n.start,end:n.end})+") is still open")}function x3(e){const n=this;n.parser=a;function a(i){return h3(i,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function g3(e,n){const a={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,a),e.applyData(n,a)}function y3(e,n){const a={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,a),[e.applyData(n,a),{type:"text",value:`
|
|
55
|
-
`}]}function b3(e,n){const a=n.value?n.value+`
|
|
56
|
-
`:"",i={},o=n.lang?n.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 n.meta&&(u.data={meta:n.meta}),e.patch(n,u),u=e.applyData(n,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(n,u),u}function v3(e,n){const a={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function w3(e,n){const a={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function k3(e,n){const a=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(n.identifier).toUpperCase(),o=Es(i.toLowerCase()),u=e.footnoteOrder.indexOf(i);let d,h=e.footnoteCounts.get(i);h===void 0?(h=0,e.footnoteOrder.push(i),d=e.footnoteOrder.length):d=u+1,h+=1,e.footnoteCounts.set(i,h);const m={type:"element",tagName:"a",properties:{href:"#"+a+"fn-"+o,id:a+"fnref-"+o+(h>1?"-"+h:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};e.patch(n,m);const f={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(n,f),e.applyData(n,f)}function j3(e,n){const a={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function S3(e,n){if(e.options.allowDangerousHtml){const a={type:"raw",value:n.value};return e.patch(n,a),e.applyData(n,a)}}function tb(e,n){const a=n.referenceType;let i="]";if(a==="collapsed"?i+="[]":a==="full"&&(i+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+i}];const o=e.all(n),u=o[0];u&&u.type==="text"?u.value="["+u.value:o.unshift({type:"text",value:"["});const d=o[o.length-1];return d&&d.type==="text"?d.value+=i:o.push({type:"text",value:i}),o}function C3(e,n){const a=String(n.identifier).toUpperCase(),i=e.definitionById.get(a);if(!i)return tb(e,n);const o={src:Es(i.url||""),alt:n.alt};i.title!==null&&i.title!==void 0&&(o.title=i.title);const u={type:"element",tagName:"img",properties:o,children:[]};return e.patch(n,u),e.applyData(n,u)}function N3(e,n){const a={src:Es(n.url)};n.alt!==null&&n.alt!==void 0&&(a.alt=n.alt),n.title!==null&&n.title!==void 0&&(a.title=n.title);const i={type:"element",tagName:"img",properties:a,children:[]};return e.patch(n,i),e.applyData(n,i)}function E3(e,n){const a={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,a);const i={type:"element",tagName:"code",properties:{},children:[a]};return e.patch(n,i),e.applyData(n,i)}function A3(e,n){const a=String(n.identifier).toUpperCase(),i=e.definitionById.get(a);if(!i)return tb(e,n);const o={href:Es(i.url||"")};i.title!==null&&i.title!==void 0&&(o.title=i.title);const u={type:"element",tagName:"a",properties:o,children:e.all(n)};return e.patch(n,u),e.applyData(n,u)}function D3(e,n){const a={href:Es(n.url)};n.title!==null&&n.title!==void 0&&(a.title=n.title);const i={type:"element",tagName:"a",properties:a,children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function T3(e,n,a){const i=e.all(n),o=a?F3(a):nb(n),u={},d=[];if(typeof n.checked=="boolean"){const x=i[0];let g;x&&x.type==="element"&&x.tagName==="p"?g=x:(g={type:"element",tagName:"p",properties:{},children:[]},i.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let h=-1;for(;++h<i.length;){const x=i[h];(o||h!==0||x.type!=="element"||x.tagName!=="p")&&d.push({type:"text",value:`
|
|
57
|
-
`}),x.type==="element"&&x.tagName==="p"&&!o?d.push(...x.children):d.push(x)}const m=i[i.length-1];m&&(o||m.type!=="element"||m.tagName!=="p")&&d.push({type:"text",value:`
|
|
58
|
-
`});const f={type:"element",tagName:"li",properties:u,children:d};return e.patch(n,f),e.applyData(n,f)}function F3(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const a=e.children;let i=-1;for(;!n&&++i<a.length;)n=nb(a[i])}return n}function nb(e){const n=e.spread;return n??e.children.length>1}function M3(e,n){const a={},i=e.all(n);let o=-1;for(typeof n.start=="number"&&n.start!==1&&(a.start=n.start);++o<i.length;){const d=i[o];if(d.type==="element"&&d.tagName==="li"&&d.properties&&Array.isArray(d.properties.className)&&d.properties.className.includes("task-list-item")){a.className=["contains-task-list"];break}}const u={type:"element",tagName:n.ordered?"ol":"ul",properties:a,children:e.wrap(i,!0)};return e.patch(n,u),e.applyData(n,u)}function R3(e,n){const a={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function z3(e,n){const a={type:"root",children:e.wrap(e.all(n))};return e.patch(n,a),e.applyData(n,a)}function _3(e,n){const a={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function B3(e,n){const a=e.all(n),i=a.shift(),o=[];if(i){const d={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(n.children[0],d),o.push(d)}if(a.length>0){const d={type:"element",tagName:"tbody",properties:{},children:e.wrap(a,!0)},h=Sm(n.children[1]),m=_y(n.children[n.children.length-1]);h&&m&&(d.position={start:h,end:m}),o.push(d)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(n,u),e.applyData(n,u)}function O3(e,n,a){const i=a?a.children:void 0,u=(i?i.indexOf(n):1)===0?"th":"td",d=a&&a.type==="table"?a.align:void 0,h=d?d.length:n.children.length;let m=-1;const f=[];for(;++m<h;){const g=n.children[m],w={},b=d?d[m]:void 0;b&&(w.align=b);let j={type:"element",tagName:u,properties:w,children:[]};g&&(j.children=e.all(g),e.patch(g,j),j=e.applyData(g,j)),f.push(j)}const x={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(n,x),e.applyData(n,x)}function $3(e,n){const a={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}const tg=9,ng=32;function L3(e){const n=String(e),a=/\r?\n|\r/g;let i=a.exec(n),o=0;const u=[];for(;i;)u.push(rg(n.slice(o,i.index),o>0,!0),i[0]),o=i.index+i[0].length,i=a.exec(n);return u.push(rg(n.slice(o),o>0,!1)),u.join("")}function rg(e,n,a){let i=0,o=e.length;if(n){let u=e.codePointAt(i);for(;u===tg||u===ng;)i++,u=e.codePointAt(i)}if(a){let u=e.codePointAt(o-1);for(;u===tg||u===ng;)o--,u=e.codePointAt(o-1)}return o>i?e.slice(i,o):""}function I3(e,n){const a={type:"text",value:L3(String(n.value))};return e.patch(n,a),e.applyData(n,a)}function H3(e,n){const a={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,a),e.applyData(n,a)}const U3={blockquote:g3,break:y3,code:b3,delete:v3,emphasis:w3,footnoteReference:k3,heading:j3,html:S3,imageReference:C3,image:N3,inlineCode:E3,linkReference:A3,link:D3,listItem:T3,list:M3,paragraph:R3,root:z3,strong:_3,table:B3,tableCell:$3,tableRow:O3,text:I3,thematicBreak:H3,toml:fu,yaml:fu,definition:fu,footnoteDefinition:fu};function fu(){}const rb=-1,Gu=0,Oo=1,_u=2,Fm=3,Mm=4,Rm=5,zm=6,ab=7,lb=8,ag=typeof self=="object"?self:globalThis,q3=(e,n)=>{const a=(o,u)=>(e.set(u,o),o),i=o=>{if(e.has(o))return e.get(o);const[u,d]=n[o];switch(u){case Gu:case rb:return a(d,o);case Oo:{const h=a([],o);for(const m of d)h.push(i(m));return h}case _u:{const h=a({},o);for(const[m,f]of d)h[i(m)]=i(f);return h}case Fm:return a(new Date(d),o);case Mm:{const{source:h,flags:m}=d;return a(new RegExp(h,m),o)}case Rm:{const h=a(new Map,o);for(const[m,f]of d)h.set(i(m),i(f));return h}case zm:{const h=a(new Set,o);for(const m of d)h.add(i(m));return h}case ab:{const{name:h,message:m}=d;return a(new ag[h](m),o)}case lb:return a(BigInt(d),o);case"BigInt":return a(Object(BigInt(d)),o);case"ArrayBuffer":return a(new Uint8Array(d).buffer,d);case"DataView":{const{buffer:h}=new Uint8Array(d);return a(new DataView(h),d)}}return a(new ag[u](d),o)};return i},lg=e=>q3(new Map,e)(0),xs="",{toString:Y3}={},{keys:X3}=Object,Co=e=>{const n=typeof e;if(n!=="object"||!e)return[Gu,n];const a=Y3.call(e).slice(8,-1);switch(a){case"Array":return[Oo,xs];case"Object":return[_u,xs];case"Date":return[Fm,xs];case"RegExp":return[Mm,xs];case"Map":return[Rm,xs];case"Set":return[zm,xs];case"DataView":return[Oo,a]}return a.includes("Array")?[Oo,a]:a.includes("Error")?[ab,a]:[_u,a]},hu=([e,n])=>e===Gu&&(n==="function"||n==="symbol"),W3=(e,n,a,i)=>{const o=(d,h)=>{const m=i.push(d)-1;return a.set(h,m),m},u=d=>{if(a.has(d))return a.get(d);let[h,m]=Co(d);switch(h){case Gu:{let x=d;switch(m){case"bigint":h=lb,x=d.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);x=null;break;case"undefined":return o([rb],d)}return o([h,x],d)}case Oo:{if(m){let w=d;return m==="DataView"?w=new Uint8Array(d.buffer):m==="ArrayBuffer"&&(w=new Uint8Array(d)),o([m,[...w]],d)}const x=[],g=o([h,x],d);for(const w of d)x.push(u(w));return g}case _u:{if(m)switch(m){case"BigInt":return o([m,d.toString()],d);case"Boolean":case"Number":case"String":return o([m,d.valueOf()],d)}if(n&&"toJSON"in d)return u(d.toJSON());const x=[],g=o([h,x],d);for(const w of X3(d))(e||!hu(Co(d[w])))&&x.push([u(w),u(d[w])]);return g}case Fm:return o([h,d.toISOString()],d);case Mm:{const{source:x,flags:g}=d;return o([h,{source:x,flags:g}],d)}case Rm:{const x=[],g=o([h,x],d);for(const[w,b]of d)(e||!(hu(Co(w))||hu(Co(b))))&&x.push([u(w),u(b)]);return g}case zm:{const x=[],g=o([h,x],d);for(const w of d)(e||!hu(Co(w)))&&x.push(u(w));return g}}const{message:f}=d;return o([h,{name:m,message:f}],d)};return u},ig=(e,{json:n,lossy:a}={})=>{const i=[];return W3(!(n||a),!!n,new Map,i)(e),i},Bu=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?lg(ig(e,n)):structuredClone(e):(e,n)=>lg(ig(e,n));function G3(e,n){const a=[{type:"text",value:"↩"}];return n>1&&a.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),a}function V3(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function K3(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=e.options.footnoteBackContent||G3,i=e.options.footnoteBackLabel||V3,o=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",d=e.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let m=-1;for(;++m<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[m]);if(!f)continue;const x=e.all(f),g=String(f.identifier).toUpperCase(),w=Es(g.toLowerCase());let b=0;const j=[],k=e.footnoteCounts.get(g);for(;k!==void 0&&++b<=k;){j.length>0&&j.push({type:"text",value:" "});let E=typeof a=="string"?a:a(m,b);typeof E=="string"&&(E={type:"text",value:E}),j.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+w+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(m,b),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const N=x[x.length-1];if(N&&N.type==="element"&&N.tagName==="p"){const E=N.children[N.children.length-1];E&&E.type==="text"?E.value+=" ":N.children.push({type:"text",value:" "}),N.children.push(...j)}else x.push(...j);const C={type:"element",tagName:"li",properties:{id:n+"fn-"+w},children:e.wrap(x,!0)};e.patch(f,C),h.push(C)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Bu(d),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
59
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(h,!0)},{type:"text",value:`
|
|
60
|
-
`}]}}const Vu=(function(e){if(e==null)return J3;if(typeof e=="function")return Ku(e);if(typeof e=="object")return Array.isArray(e)?Q3(e):P3(e);if(typeof e=="string")return Z3(e);throw new Error("Expected function, string, or object as test")});function Q3(e){const n=[];let a=-1;for(;++a<e.length;)n[a]=Vu(e[a]);return Ku(i);function i(...o){let u=-1;for(;++u<n.length;)if(n[u].apply(this,o))return!0;return!1}}function P3(e){const n=e;return Ku(a);function a(i){const o=i;let u;for(u in e)if(o[u]!==n[u])return!1;return!0}}function Z3(e){return Ku(n);function n(a){return a&&a.type===e}}function Ku(e){return n;function n(a,i,o){return!!(e4(a)&&e.call(this,a,typeof i=="number"?i:void 0,o||void 0))}}function J3(){return!0}function e4(e){return e!==null&&typeof e=="object"&&"type"in e}const ib=[],t4=!0,Ph=!1,n4="skip";function sb(e,n,a,i){let o;typeof n=="function"&&typeof a!="function"?(i=a,a=n):o=n;const u=Vu(o),d=i?-1:1;h(e,void 0,[])();function h(m,f,x){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const b=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(w,"name",{value:"node ("+(m.type+(b?"<"+b+">":""))+")"})}return w;function w(){let b=ib,j,k,N;if((!n||u(m,f,x[x.length-1]||void 0))&&(b=r4(a(m,x)),b[0]===Ph))return b;if("children"in m&&m.children){const C=m;if(C.children&&b[0]!==n4)for(k=(i?C.children.length:-1)+d,N=x.concat(C);k>-1&&k<C.children.length;){const E=C.children[k];if(j=h(E,k,N)(),j[0]===Ph)return j;k=typeof j[1]=="number"?j[1]:k+d}}return b}}}function r4(e){return Array.isArray(e)?e:typeof e=="number"?[t4,e]:e==null?ib:[e]}function _m(e,n,a,i){let o,u,d;typeof n=="function"&&typeof a!="function"?(u=void 0,d=n,o=a):(u=n,d=a,o=i),sb(e,u,h,o);function h(m,f){const x=f[f.length-1],g=x?x.children.indexOf(m):void 0;return d(m,g,x)}}const Zh={}.hasOwnProperty,a4={};function l4(e,n){const a=n||a4,i=new Map,o=new Map,u=new Map,d={...U3,...a.handlers},h={all:f,applyData:s4,definitionById:i,footnoteById:o,footnoteCounts:u,footnoteOrder:[],handlers:d,one:m,options:a,patch:i4,wrap:c4};return _m(e,function(x){if(x.type==="definition"||x.type==="footnoteDefinition"){const g=x.type==="definition"?i:o,w=String(x.identifier).toUpperCase();g.has(w)||g.set(w,x)}}),h;function m(x,g){const w=x.type,b=h.handlers[w];if(Zh.call(h.handlers,w)&&b)return b(h,x,g);if(h.options.passThrough&&h.options.passThrough.includes(w)){if("children"in x){const{children:k,...N}=x,C=Bu(N);return C.children=h.all(x),C}return Bu(x)}return(h.options.unknownHandler||o4)(h,x,g)}function f(x){const g=[];if("children"in x){const w=x.children;let b=-1;for(;++b<w.length;){const j=h.one(w[b],x);if(j){if(b&&w[b-1].type==="break"&&(!Array.isArray(j)&&j.type==="text"&&(j.value=sg(j.value)),!Array.isArray(j)&&j.type==="element")){const k=j.children[0];k&&k.type==="text"&&(k.value=sg(k.value))}Array.isArray(j)?g.push(...j):g.push(j)}}}return g}}function i4(e,n){e.position&&(n.position=Vw(e))}function s4(e,n){let a=n;if(e&&e.data){const i=e.data.hName,o=e.data.hChildren,u=e.data.hProperties;if(typeof i=="string")if(a.type==="element")a.tagName=i;else{const d="children"in a?a.children:[a];a={type:"element",tagName:i,properties:{},children:d}}a.type==="element"&&u&&Object.assign(a.properties,Bu(u)),"children"in a&&a.children&&o!==null&&o!==void 0&&(a.children=o)}return a}function o4(e,n){const a=n.data||{},i="value"in n&&!(Zh.call(a,"hProperties")||Zh.call(a,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function c4(e,n){const a=[];let i=-1;for(n&&a.push({type:"text",value:`
|
|
61
|
-
`});++i<e.length;)i&&a.push({type:"text",value:`
|
|
62
|
-
`}),a.push(e[i]);return n&&e.length>0&&a.push({type:"text",value:`
|
|
63
|
-
`}),a}function sg(e){let n=0,a=e.charCodeAt(n);for(;a===9||a===32;)n++,a=e.charCodeAt(n);return e.slice(n)}function og(e,n){const a=l4(e,n),i=a.one(e,void 0),o=K3(a),u=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return o&&u.children.push({type:"text",value:`
|
|
64
|
-
`},o),u}function u4(e,n){return e&&"run"in e?async function(a,i){const o=og(a,{file:i,...n});await e.run(o,i)}:function(a,i){return og(a,{file:i,...e||n})}}function cg(e){if(e)throw e}var ch,ug;function d4(){if(ug)return ch;ug=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,a=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=function(f){return typeof Array.isArray=="function"?Array.isArray(f):n.call(f)==="[object Array]"},u=function(f){if(!f||n.call(f)!=="[object Object]")return!1;var x=e.call(f,"constructor"),g=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!x&&!g)return!1;var w;for(w in f);return typeof w>"u"||e.call(f,w)},d=function(f,x){a&&x.name==="__proto__"?a(f,x.name,{enumerable:!0,configurable:!0,value:x.newValue,writable:!0}):f[x.name]=x.newValue},h=function(f,x){if(x==="__proto__")if(e.call(f,x)){if(i)return i(f,x).value}else return;return f[x]};return ch=function m(){var f,x,g,w,b,j,k=arguments[0],N=1,C=arguments.length,E=!1;for(typeof k=="boolean"&&(E=k,k=arguments[1]||{},N=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});N<C;++N)if(f=arguments[N],f!=null)for(x in f)g=h(k,x),w=h(f,x),k!==w&&(E&&w&&(u(w)||(b=o(w)))?(b?(b=!1,j=g&&o(g)?g:[]):j=g&&u(g)?g:{},d(k,{name:x,newValue:m(E,j,w)})):typeof w<"u"&&d(k,{name:x,newValue:w}));return k},ch}var f4=d4();const uh=Cy(f4);function Jh(e){if(typeof e!="object"||e===null)return!1;const n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function h4(){const e=[],n={run:a,use:i};return n;function a(...o){let u=-1;const d=o.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);h(null,...o);function h(m,...f){const x=e[++u];let g=-1;if(m){d(m);return}for(;++g<o.length;)(f[g]===null||f[g]===void 0)&&(f[g]=o[g]);o=f,x?m4(x,h)(...f):d(null,...f)}}function i(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),n}}function m4(e,n){let a;return i;function i(...d){const h=e.length>d.length;let m;h&&d.push(o);try{m=e.apply(this,d)}catch(f){const x=f;if(h&&a)throw x;return o(x)}h||(m&&m.then&&typeof m.then=="function"?m.then(u,o):m instanceof Error?o(m):u(m))}function o(d,...h){a||(a=!0,n(d,...h))}function u(d){o(null,d)}}const ka={basename:p4,dirname:x4,extname:g4,join:y4,sep:"/"};function p4(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Wo(e);let a=0,i=-1,o=e.length,u;if(n===void 0||n.length===0||n.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(u){a=o+1;break}}else i<0&&(u=!0,i=o+1);return i<0?"":e.slice(a,i)}if(n===e)return"";let d=-1,h=n.length-1;for(;o--;)if(e.codePointAt(o)===47){if(u){a=o+1;break}}else d<0&&(u=!0,d=o+1),h>-1&&(e.codePointAt(o)===n.codePointAt(h--)?h<0&&(i=o):(h=-1,i=d));return a===i?i=d:i<0&&(i=e.length),e.slice(a,i)}function x4(e){if(Wo(e),e.length===0)return".";let n=-1,a=e.length,i;for(;--a;)if(e.codePointAt(a)===47){if(i){n=a;break}}else i||(i=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function g4(e){Wo(e);let n=e.length,a=-1,i=0,o=-1,u=0,d;for(;n--;){const h=e.codePointAt(n);if(h===47){if(d){i=n+1;break}continue}a<0&&(d=!0,a=n+1),h===46?o<0?o=n:u!==1&&(u=1):o>-1&&(u=-1)}return o<0||a<0||u===0||u===1&&o===a-1&&o===i+1?"":e.slice(o,a)}function y4(...e){let n=-1,a;for(;++n<e.length;)Wo(e[n]),e[n]&&(a=a===void 0?e[n]:a+"/"+e[n]);return a===void 0?".":b4(a)}function b4(e){Wo(e);const n=e.codePointAt(0)===47;let a=v4(e,!n);return a.length===0&&!n&&(a="."),a.length>0&&e.codePointAt(e.length-1)===47&&(a+="/"),n?"/"+a:a}function v4(e,n){let a="",i=0,o=-1,u=0,d=-1,h,m;for(;++d<=e.length;){if(d<e.length)h=e.codePointAt(d);else{if(h===47)break;h=47}if(h===47){if(!(o===d-1||u===1))if(o!==d-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(m=a.lastIndexOf("/"),m!==a.length-1){m<0?(a="",i=0):(a=a.slice(0,m),i=a.length-1-a.lastIndexOf("/")),o=d,u=0;continue}}else if(a.length>0){a="",i=0,o=d,u=0;continue}}n&&(a=a.length>0?a+"/..":"..",i=2)}else a.length>0?a+="/"+e.slice(o+1,d):a=e.slice(o+1,d),i=d-o-1;o=d,u=0}else h===46&&u>-1?u++:u=-1}return a}function Wo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const w4={cwd:k4};function k4(){return"/"}function em(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function j4(e){if(typeof e=="string")e=new URL(e);else if(!em(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return S4(e)}function S4(e){if(e.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 n=e.pathname;let a=-1;for(;++a<n.length;)if(n.codePointAt(a)===37&&n.codePointAt(a+1)===50){const i=n.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(n)}const dh=["history","path","basename","stem","extname","dirname"];class ob{constructor(n){let a;n?em(n)?a={path:n}:typeof n=="string"||C4(n)?a={value:n}:a=n:a={},this.cwd="cwd"in a?"":w4.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<dh.length;){const u=dh[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)dh.includes(o)||(this[o]=a[o])}get basename(){return typeof this.path=="string"?ka.basename(this.path):void 0}set basename(n){hh(n,"basename"),fh(n,"basename"),this.path=ka.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?ka.dirname(this.path):void 0}set dirname(n){dg(this.basename,"dirname"),this.path=ka.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?ka.extname(this.path):void 0}set extname(n){if(fh(n,"extname"),dg(this.dirname,"extname"),n){if(n.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(n.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ka.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){em(n)&&(n=j4(n)),hh(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?ka.basename(this.path,this.extname):void 0}set stem(n){hh(n,"stem"),fh(n,"stem"),this.path=ka.join(this.dirname||"",n+(this.extname||""))}fail(n,a,i){const o=this.message(n,a,i);throw o.fatal=!0,o}info(n,a,i){const o=this.message(n,a,i);return o.fatal=void 0,o}message(n,a,i){const o=new lr(n,a,i);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function fh(e,n){if(e&&e.includes(ka.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+ka.sep+"`")}function hh(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function dg(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function C4(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const N4=(function(e){const i=this.constructor.prototype,o=i[e],u=function(){return o.apply(u,arguments)};return Object.setPrototypeOf(u,i),u}),E4={}.hasOwnProperty;class Bm extends N4{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=h4()}copy(){const n=new Bm;let a=-1;for(;++a<this.attachers.length;){const i=this.attachers[a];n.use(...i)}return n.data(uh(!0,{},this.namespace)),n}data(n,a){return typeof n=="string"?arguments.length===2?(xh("data",this.frozen),this.namespace[n]=a,this):E4.call(this.namespace,n)&&this.namespace[n]||void 0:n?(xh("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=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(n,...i);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const a=mu(n),i=this.parser||this.Parser;return mh("parse",i),i(String(a),a)}process(n,a){const i=this;return this.freeze(),mh("process",this.parser||this.Parser),ph("process",this.compiler||this.Compiler),a?o(void 0,a):new Promise(o);function o(u,d){const h=mu(n),m=i.parse(h);i.run(m,h,function(x,g,w){if(x||!g||!w)return f(x);const b=g,j=i.stringify(b,w);T4(j)?w.value=j:w.result=j,f(x,w)});function f(x,g){x||!g?d(x):u?u(g):a(void 0,g)}}}processSync(n){let a=!1,i;return this.freeze(),mh("processSync",this.parser||this.Parser),ph("processSync",this.compiler||this.Compiler),this.process(n,o),hg("processSync","process",a),i;function o(u,d){a=!0,cg(u),i=d}}run(n,a,i){fg(n),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(d,h){const m=mu(a);o.run(n,m,f);function f(x,g,w){const b=g||n;x?h(x):d?d(b):i(void 0,b,w)}}}runSync(n,a){let i=!1,o;return this.run(n,a,u),hg("runSync","run",i),o;function u(d,h){cg(d),o=h,i=!0}}stringify(n,a){this.freeze();const i=mu(a),o=this.compiler||this.Compiler;return ph("stringify",o),fg(n),o(n,i)}use(n,...a){const i=this.attachers,o=this.namespace;if(xh("use",this.frozen),n!=null)if(typeof n=="function")m(n,a);else if(typeof n=="object")Array.isArray(n)?h(n):d(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function u(f){if(typeof f=="function")m(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[x,...g]=f;m(x,g)}else d(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function d(f){if(!("plugins"in f)&&!("settings"in f))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");h(f.plugins),f.settings&&(o.settings=uh(!0,o.settings,f.settings))}function h(f){let x=-1;if(f!=null)if(Array.isArray(f))for(;++x<f.length;){const g=f[x];u(g)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function m(f,x){let g=-1,w=-1;for(;++g<i.length;)if(i[g][0]===f){w=g;break}if(w===-1)i.push([f,...x]);else if(x.length>0){let[b,...j]=x;const k=i[w][1];Jh(k)&&Jh(b)&&(b=uh(!0,k,b)),i[w]=[f,b,...j]}}}}const A4=new Bm().freeze();function mh(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ph(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function xh(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function fg(e){if(!Jh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function hg(e,n,a){if(!a)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function mu(e){return D4(e)?e:new ob(e)}function D4(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function T4(e){return typeof e=="string"||F4(e)}function F4(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const M4="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",mg=[],pg={allowDangerousHtml:!0},R4=/^(https?|ircs?|mailto|xmpp)$/i,z4=[{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 Om(e){const n=_4(e),a=B4(e);return O4(n.runSync(n.parse(a),a),e)}function _4(e){const n=e.rehypePlugins||mg,a=e.remarkPlugins||mg,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...pg}:pg;return A4().use(x3).use(a).use(u4,i).use(n)}function B4(e){const n=e.children||"",a=new ob;return typeof n=="string"&&(a.value=n),a}function O4(e,n){const a=n.allowedElements,i=n.allowElement,o=n.components,u=n.disallowedElements,d=n.skipHtml,h=n.unwrapDisallowed,m=n.urlTransform||$4;for(const x of z4)Object.hasOwn(n,x.from)&&(""+x.from+(x.to?"use `"+x.to+"` instead":"remove it")+M4+x.id,void 0);return _m(e,f),Jw(e,{Fragment:l.Fragment,components:o,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function f(x,g,w){if(x.type==="raw"&&w&&typeof g=="number")return d?w.children.splice(g,1):w.children[g]={type:"text",value:x.value},g;if(x.type==="element"){let b;for(b in ih)if(Object.hasOwn(ih,b)&&Object.hasOwn(x.properties,b)){const j=x.properties[b],k=ih[b];(k===null||k.includes(x.tagName))&&(x.properties[b]=m(String(j||""),b,x))}}if(x.type==="element"){let b=a?!a.includes(x.tagName):u?u.includes(x.tagName):!1;if(!b&&i&&typeof g=="number"&&(b=!i(x,g,w)),b&&w&&typeof g=="number")return h&&x.children?w.children.splice(g,1,...x.children):w.children.splice(g,1),g}}}function $4(e){const n=e.indexOf(":"),a=e.indexOf("?"),i=e.indexOf("#"),o=e.indexOf("/");return n===-1||o!==-1&&n>o||a!==-1&&n>a||i!==-1&&n>i||R4.test(e.slice(0,n))?e:""}function xg(e,n){const a=String(e);if(typeof n!="string")throw new TypeError("Expected character");let i=0,o=a.indexOf(n);for(;o!==-1;)i++,o=a.indexOf(n,o+n.length);return i}function L4(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function I4(e,n,a){const o=Vu((a||{}).ignore||[]),u=H4(n);let d=-1;for(;++d<u.length;)sb(e,"text",h);function h(f,x){let g=-1,w;for(;++g<x.length;){const b=x[g],j=w?w.children:void 0;if(o(b,j?j.indexOf(b):void 0,w))return;w=b}if(w)return m(f,x)}function m(f,x){const g=x[x.length-1],w=u[d][0],b=u[d][1];let j=0;const N=g.children.indexOf(f);let C=!1,E=[];w.lastIndex=0;let B=w.exec(f.value);for(;B;){const R=B.index,$={index:B.index,input:B.input,stack:[...x,f]};let _=b(...B,$);if(typeof _=="string"&&(_=_.length>0?{type:"text",value:_}:void 0),_===!1?w.lastIndex=R+1:(j!==R&&E.push({type:"text",value:f.value.slice(j,R)}),Array.isArray(_)?E.push(..._):_&&E.push(_),j=R+B[0].length,C=!0),!w.global)break;B=w.exec(f.value)}return C?(j<f.value.length&&E.push({type:"text",value:f.value.slice(j)}),g.children.splice(N,1,...E)):E=[f],N+E.length}}function H4(e){const n=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const a=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<a.length;){const o=a[i];n.push([U4(o[0]),q4(o[1])])}return n}function U4(e){return typeof e=="string"?new RegExp(L4(e),"g"):e}function q4(e){return typeof e=="function"?e:function(){return e}}const gh="phrasing",yh=["autolink","link","image","label"];function Y4(){return{transforms:[P4],enter:{literalAutolink:W4,literalAutolinkEmail:bh,literalAutolinkHttp:bh,literalAutolinkWww:bh},exit:{literalAutolink:Q4,literalAutolinkEmail:K4,literalAutolinkHttp:G4,literalAutolinkWww:V4}}}function X4(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:gh,notInConstruct:yh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:gh,notInConstruct:yh},{character:":",before:"[ps]",after:"\\/",inConstruct:gh,notInConstruct:yh}]}}function W4(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function bh(e){this.config.enter.autolinkProtocol.call(this,e)}function G4(e){this.config.exit.autolinkProtocol.call(this,e)}function V4(e){this.config.exit.data.call(this,e);const n=this.stack[this.stack.length-1];n.type,n.url="http://"+this.sliceSerialize(e)}function K4(e){this.config.exit.autolinkEmail.call(this,e)}function Q4(e){this.exit(e)}function P4(e){I4(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Z4],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),J4]],{ignore:["link","linkReference"]})}function Z4(e,n,a,i,o){let u="";if(!cb(o)||(/^w/i.test(n)&&(a=n+a,n="",u="http://"),!ej(a)))return!1;const d=tj(a+i);if(!d[0])return!1;const h={type:"link",title:null,url:u+n+d[0],children:[{type:"text",value:n+d[0]}]};return d[1]?[h,{type:"text",value:d[1]}]:h}function J4(e,n,a,i){return!cb(i,!0)||/[-\d_]$/.test(a)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+a,children:[{type:"text",value:n+"@"+a}]}}function ej(e){const n=e.split(".");return!(n.length<2||n[n.length-1]&&(/_/.test(n[n.length-1])||!/[a-zA-Z\d]/.test(n[n.length-1]))||n[n.length-2]&&(/_/.test(n[n.length-2])||!/[a-zA-Z\d]/.test(n[n.length-2])))}function tj(e){const n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let a=n[0],i=a.indexOf(")");const o=xg(e,"(");let u=xg(e,")");for(;i!==-1&&o>u;)e+=a.slice(0,i+1),a=a.slice(i+1),i=a.indexOf(")"),u++;return[e,a]}function cb(e,n){const a=e.input.charCodeAt(e.index-1);return(e.index===0||Ei(a)||Xu(a))&&(!n||a!==47)}ub.peek=uj;function nj(){this.buffer()}function rj(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function aj(){this.buffer()}function lj(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function ij(e){const n=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=oa(this.sliceSerialize(e)).toLowerCase(),a.label=n}function sj(e){this.exit(e)}function oj(e){const n=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=oa(this.sliceSerialize(e)).toLowerCase(),a.label=n}function cj(e){this.exit(e)}function uj(){return"["}function ub(e,n,a,i){const o=a.createTracker(i);let u=o.move("[^");const d=a.enter("footnoteReference"),h=a.enter("reference");return u+=o.move(a.safe(a.associationId(e),{after:"]",before:u})),h(),d(),u+=o.move("]"),u}function dj(){return{enter:{gfmFootnoteCallString:nj,gfmFootnoteCall:rj,gfmFootnoteDefinitionLabelString:aj,gfmFootnoteDefinition:lj},exit:{gfmFootnoteCallString:ij,gfmFootnoteCall:sj,gfmFootnoteDefinitionLabelString:oj,gfmFootnoteDefinition:cj}}}function fj(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:a,footnoteReference:ub},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function a(i,o,u,d){const h=u.createTracker(d);let m=h.move("[^");const f=u.enter("footnoteDefinition"),x=u.enter("label");return m+=h.move(u.safe(u.associationId(i),{before:m,after:"]"})),x(),m+=h.move("]:"),i.children&&i.children.length>0&&(h.shift(4),m+=h.move((n?`
|
|
65
|
-
`:" ")+u.indentLines(u.containerFlow(i,h.current()),n?db:hj))),f(),m}}function hj(e,n,a){return n===0?e:db(e,n,a)}function db(e,n,a){return(a?"":" ")+e}const mj=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];fb.peek=bj;function pj(){return{canContainEols:["delete"],enter:{strikethrough:gj},exit:{strikethrough:yj}}}function xj(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:mj}],handlers:{delete:fb}}}function gj(e){this.enter({type:"delete",children:[]},e)}function yj(e){this.exit(e)}function fb(e,n,a,i){const o=a.createTracker(i),u=a.enter("strikethrough");let d=o.move("~~");return d+=a.containerPhrasing(e,{...o.current(),before:d,after:"~"}),d+=o.move("~~"),u(),d}function bj(){return"~"}function vj(e){return e.length}function wj(e,n){const a=n||{},i=(a.align||[]).concat(),o=a.stringLength||vj,u=[],d=[],h=[],m=[];let f=0,x=-1;for(;++x<e.length;){const k=[],N=[];let C=-1;for(e[x].length>f&&(f=e[x].length);++C<e[x].length;){const E=kj(e[x][C]);if(a.alignDelimiters!==!1){const B=o(E);N[C]=B,(m[C]===void 0||B>m[C])&&(m[C]=B)}k.push(E)}d[x]=k,h[x]=N}let g=-1;if(typeof i=="object"&&"length"in i)for(;++g<f;)u[g]=gg(i[g]);else{const k=gg(i);for(;++g<f;)u[g]=k}g=-1;const w=[],b=[];for(;++g<f;){const k=u[g];let N="",C="";k===99?(N=":",C=":"):k===108?N=":":k===114&&(C=":");let E=a.alignDelimiters===!1?1:Math.max(1,m[g]-N.length-C.length);const B=N+"-".repeat(E)+C;a.alignDelimiters!==!1&&(E=N.length+E+C.length,E>m[g]&&(m[g]=E),b[g]=E),w[g]=B}d.splice(1,0,w),h.splice(1,0,b),x=-1;const j=[];for(;++x<d.length;){const k=d[x],N=h[x];g=-1;const C=[];for(;++g<f;){const E=k[g]||"";let B="",R="";if(a.alignDelimiters!==!1){const $=m[g]-(N[g]||0),_=u[g];_===114?B=" ".repeat($):_===99?$%2?(B=" ".repeat($/2+.5),R=" ".repeat($/2-.5)):(B=" ".repeat($/2),R=B):R=" ".repeat($)}a.delimiterStart!==!1&&!g&&C.push("|"),a.padding!==!1&&!(a.alignDelimiters===!1&&E==="")&&(a.delimiterStart!==!1||g)&&C.push(" "),a.alignDelimiters!==!1&&C.push(B),C.push(E),a.alignDelimiters!==!1&&C.push(R),a.padding!==!1&&C.push(" "),(a.delimiterEnd!==!1||g!==f-1)&&C.push("|")}j.push(a.delimiterEnd===!1?C.join("").replace(/ +$/,""):C.join(""))}return j.join(`
|
|
66
|
-
`)}function kj(e){return e==null?"":String(e)}function gg(e){const n=typeof e=="string"?e.codePointAt(0):0;return n===67||n===99?99:n===76||n===108?108:n===82||n===114?114:0}function jj(e,n,a,i){const o=a.enter("blockquote"),u=a.createTracker(i);u.move("> "),u.shift(2);const d=a.indentLines(a.containerFlow(e,u.current()),Sj);return o(),d}function Sj(e,n,a){return">"+(a?"":" ")+e}function Cj(e,n){return yg(e,n.inConstruct,!0)&&!yg(e,n.notInConstruct,!1)}function yg(e,n,a){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return a;let i=-1;for(;++i<n.length;)if(e.includes(n[i]))return!0;return!1}function bg(e,n,a,i){let o=-1;for(;++o<a.unsafe.length;)if(a.unsafe[o].character===`
|
|
67
|
-
`&&Cj(a.stack,a.unsafe[o]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
68
|
-
`}function Nj(e,n){const a=String(e);let i=a.indexOf(n),o=i,u=0,d=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===o?++u>d&&(d=u):u=1,o=i+n.length,i=a.indexOf(n,o);return d}function Ej(e,n){return!!(n.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Aj(e){const n=e.options.fence||"`";if(n!=="`"&&n!=="~")throw new Error("Cannot serialize code with `"+n+"` for `options.fence`, expected `` ` `` or `~`");return n}function Dj(e,n,a,i){const o=Aj(a),u=e.value||"",d=o==="`"?"GraveAccent":"Tilde";if(Ej(e,a)){const g=a.enter("codeIndented"),w=a.indentLines(u,Tj);return g(),w}const h=a.createTracker(i),m=o.repeat(Math.max(Nj(u,o)+1,3)),f=a.enter("codeFenced");let x=h.move(m);if(e.lang){const g=a.enter(`codeFencedLang${d}`);x+=h.move(a.safe(e.lang,{before:x,after:" ",encode:["`"],...h.current()})),g()}if(e.lang&&e.meta){const g=a.enter(`codeFencedMeta${d}`);x+=h.move(" "),x+=h.move(a.safe(e.meta,{before:x,after:`
|
|
69
|
-
`,encode:["`"],...h.current()})),g()}return x+=h.move(`
|
|
70
|
-
`),u&&(x+=h.move(u+`
|
|
71
|
-
`)),x+=h.move(m),f(),x}function Tj(e,n,a){return(a?"":" ")+e}function $m(e){const n=e.options.quote||'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize title with `"+n+"` for `options.quote`, expected `\"`, or `'`");return n}function Fj(e,n,a,i){const o=$m(a),u=o==='"'?"Quote":"Apostrophe",d=a.enter("definition");let h=a.enter("label");const m=a.createTracker(i);let f=m.move("[");return f+=m.move(a.safe(a.associationId(e),{before:f,after:"]",...m.current()})),f+=m.move("]: "),h(),!e.url||/[\0- \u007F]/.test(e.url)?(h=a.enter("destinationLiteral"),f+=m.move("<"),f+=m.move(a.safe(e.url,{before:f,after:">",...m.current()})),f+=m.move(">")):(h=a.enter("destinationRaw"),f+=m.move(a.safe(e.url,{before:f,after:e.title?" ":`
|
|
72
|
-
`,...m.current()}))),h(),e.title&&(h=a.enter(`title${u}`),f+=m.move(" "+o),f+=m.move(a.safe(e.title,{before:f,after:o,...m.current()})),f+=m.move(o),h()),d(),f}function Mj(e){const n=e.options.emphasis||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize emphasis with `"+n+"` for `options.emphasis`, expected `*`, or `_`");return n}function Io(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Ou(e,n,a){const i=ws(e),o=ws(n);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}}hb.peek=Rj;function hb(e,n,a,i){const o=Mj(a),u=a.enter("emphasis"),d=a.createTracker(i),h=d.move(o);let m=d.move(a.containerPhrasing(e,{after:o,before:h,...d.current()}));const f=m.charCodeAt(0),x=Ou(i.before.charCodeAt(i.before.length-1),f,o);x.inside&&(m=Io(f)+m.slice(1));const g=m.charCodeAt(m.length-1),w=Ou(i.after.charCodeAt(0),g,o);w.inside&&(m=m.slice(0,-1)+Io(g));const b=d.move(o);return u(),a.attentionEncodeSurroundingInfo={after:w.outside,before:x.outside},h+m+b}function Rj(e,n,a){return a.options.emphasis||"*"}function zj(e,n){let a=!1;return _m(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return a=!0,Ph}),!!((!e.depth||e.depth<3)&&Am(e)&&(n.options.setext||a))}function _j(e,n,a,i){const o=Math.max(Math.min(6,e.depth||1),1),u=a.createTracker(i);if(zj(e,a)){const x=a.enter("headingSetext"),g=a.enter("phrasing"),w=a.containerPhrasing(e,{...u.current(),before:`
|
|
73
|
-
`,after:`
|
|
74
|
-
`});return g(),x(),w+`
|
|
75
|
-
`+(o===1?"=":"-").repeat(w.length-(Math.max(w.lastIndexOf("\r"),w.lastIndexOf(`
|
|
76
|
-
`))+1))}const d="#".repeat(o),h=a.enter("headingAtx"),m=a.enter("phrasing");u.move(d+" ");let f=a.containerPhrasing(e,{before:"# ",after:`
|
|
77
|
-
`,...u.current()});return/^[\t ]/.test(f)&&(f=Io(f.charCodeAt(0))+f.slice(1)),f=f?d+" "+f:d,a.options.closeAtx&&(f+=" "+d),m(),h(),f}mb.peek=Bj;function mb(e){return e.value||""}function Bj(){return"<"}pb.peek=Oj;function pb(e,n,a,i){const o=$m(a),u=o==='"'?"Quote":"Apostrophe",d=a.enter("image");let h=a.enter("label");const m=a.createTracker(i);let f=m.move("![");return f+=m.move(a.safe(e.alt,{before:f,after:"]",...m.current()})),f+=m.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=a.enter("destinationLiteral"),f+=m.move("<"),f+=m.move(a.safe(e.url,{before:f,after:">",...m.current()})),f+=m.move(">")):(h=a.enter("destinationRaw"),f+=m.move(a.safe(e.url,{before:f,after:e.title?" ":")",...m.current()}))),h(),e.title&&(h=a.enter(`title${u}`),f+=m.move(" "+o),f+=m.move(a.safe(e.title,{before:f,after:o,...m.current()})),f+=m.move(o),h()),f+=m.move(")"),d(),f}function Oj(){return"!"}xb.peek=$j;function xb(e,n,a,i){const o=e.referenceType,u=a.enter("imageReference");let d=a.enter("label");const h=a.createTracker(i);let m=h.move("![");const f=a.safe(e.alt,{before:m,after:"]",...h.current()});m+=h.move(f+"]["),d();const x=a.stack;a.stack=[],d=a.enter("reference");const g=a.safe(a.associationId(e),{before:m,after:"]",...h.current()});return d(),a.stack=x,u(),o==="full"||!f||f!==g?m+=h.move(g+"]"):o==="shortcut"?m=m.slice(0,-1):m+=h.move("]"),m}function $j(){return"!"}gb.peek=Lj;function gb(e,n,a){let i=e.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 d=a.unsafe[u],h=a.compilePattern(d);let m;if(d.atBreak)for(;m=h.exec(i);){let f=m.index;i.charCodeAt(f)===10&&i.charCodeAt(f-1)===13&&f--,i=i.slice(0,f)+" "+i.slice(m.index+1)}}return o+i+o}function Lj(){return"`"}function yb(e,n){const a=Am(e);return!!(!n.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(a===e.url||"mailto:"+a===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}bb.peek=Ij;function bb(e,n,a,i){const o=$m(a),u=o==='"'?"Quote":"Apostrophe",d=a.createTracker(i);let h,m;if(yb(e,a)){const x=a.stack;a.stack=[],h=a.enter("autolink");let g=d.move("<");return g+=d.move(a.containerPhrasing(e,{before:g,after:">",...d.current()})),g+=d.move(">"),h(),a.stack=x,g}h=a.enter("link"),m=a.enter("label");let f=d.move("[");return f+=d.move(a.containerPhrasing(e,{before:f,after:"](",...d.current()})),f+=d.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=a.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(a.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(m=a.enter("destinationRaw"),f+=d.move(a.safe(e.url,{before:f,after:e.title?" ":")",...d.current()}))),m(),e.title&&(m=a.enter(`title${u}`),f+=d.move(" "+o),f+=d.move(a.safe(e.title,{before:f,after:o,...d.current()})),f+=d.move(o),m()),f+=d.move(")"),h(),f}function Ij(e,n,a){return yb(e,a)?"<":"["}vb.peek=Hj;function vb(e,n,a,i){const o=e.referenceType,u=a.enter("linkReference");let d=a.enter("label");const h=a.createTracker(i);let m=h.move("[");const f=a.containerPhrasing(e,{before:m,after:"]",...h.current()});m+=h.move(f+"]["),d();const x=a.stack;a.stack=[],d=a.enter("reference");const g=a.safe(a.associationId(e),{before:m,after:"]",...h.current()});return d(),a.stack=x,u(),o==="full"||!f||f!==g?m+=h.move(g+"]"):o==="shortcut"?m=m.slice(0,-1):m+=h.move("]"),m}function Hj(){return"["}function Lm(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function Uj(e){const n=Lm(e),a=e.options.bulletOther;if(!a)return n==="*"?"-":"*";if(a!=="*"&&a!=="+"&&a!=="-")throw new Error("Cannot serialize items with `"+a+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(a===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+a+"`) to be different");return a}function qj(e){const n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function wb(e){const n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function Yj(e,n,a,i){const o=a.enter("list"),u=a.bulletCurrent;let d=e.ordered?qj(a):Lm(a);const h=e.ordered?d==="."?")":".":Uj(a);let m=n&&a.bulletLastUsed?d===a.bulletLastUsed:!1;if(!e.ordered){const x=e.children?e.children[0]:void 0;if((d==="*"||d==="-")&&x&&(!x.children||!x.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&&(m=!0),wb(a)===d&&x){let g=-1;for(;++g<e.children.length;){const w=e.children[g];if(w&&w.type==="listItem"&&w.children&&w.children[0]&&w.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(d=h),a.bulletCurrent=d;const f=a.containerFlow(e,i);return a.bulletLastUsed=d,a.bulletCurrent=u,o(),f}function Xj(e){const n=e.options.listItemIndent||"one";if(n!=="tab"&&n!=="one"&&n!=="mixed")throw new Error("Cannot serialize items with `"+n+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return n}function Wj(e,n,a,i){const o=Xj(a);let u=a.bulletCurrent||Lm(a);n&&n.type==="list"&&n.ordered&&(u=(typeof n.start=="number"&&n.start>-1?n.start:1)+(a.options.incrementListMarker===!1?0:n.children.indexOf(e))+u);let d=u.length+1;(o==="tab"||o==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(d=Math.ceil(d/4)*4);const h=a.createTracker(i);h.move(u+" ".repeat(d-u.length)),h.shift(d);const m=a.enter("listItem"),f=a.indentLines(a.containerFlow(e,h.current()),x);return m(),f;function x(g,w,b){return w?(b?"":" ".repeat(d))+g:(b?u:u+" ".repeat(d-u.length))+g}}function Gj(e,n,a,i){const o=a.enter("paragraph"),u=a.enter("phrasing"),d=a.containerPhrasing(e,i);return u(),o(),d}const Vj=Vu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Kj(e,n,a,i){return(e.children.some(function(d){return Vj(d)})?a.containerPhrasing:a.containerFlow).call(a,e,i)}function Qj(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}kb.peek=Pj;function kb(e,n,a,i){const o=Qj(a),u=a.enter("strong"),d=a.createTracker(i),h=d.move(o+o);let m=d.move(a.containerPhrasing(e,{after:o,before:h,...d.current()}));const f=m.charCodeAt(0),x=Ou(i.before.charCodeAt(i.before.length-1),f,o);x.inside&&(m=Io(f)+m.slice(1));const g=m.charCodeAt(m.length-1),w=Ou(i.after.charCodeAt(0),g,o);w.inside&&(m=m.slice(0,-1)+Io(g));const b=d.move(o+o);return u(),a.attentionEncodeSurroundingInfo={after:w.outside,before:x.outside},h+m+b}function Pj(e,n,a){return a.options.strong||"*"}function Zj(e,n,a,i){return a.safe(e.value,i)}function Jj(e){const n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function eS(e,n,a){const i=(wb(a)+(a.options.ruleSpaces?" ":"")).repeat(Jj(a));return a.options.ruleSpaces?i.slice(0,-1):i}const jb={blockquote:jj,break:bg,code:Dj,definition:Fj,emphasis:hb,hardBreak:bg,heading:_j,html:mb,image:pb,imageReference:xb,inlineCode:gb,link:bb,linkReference:vb,list:Yj,listItem:Wj,paragraph:Gj,root:Kj,strong:kb,text:Zj,thematicBreak:eS};function tS(){return{enter:{table:nS,tableData:vg,tableHeader:vg,tableRow:aS},exit:{codeText:lS,table:rS,tableData:vh,tableHeader:vh,tableRow:vh}}}function nS(e){const n=e._align;this.enter({type:"table",align:n.map(function(a){return a==="none"?null:a}),children:[]},e),this.data.inTable=!0}function rS(e){this.exit(e),this.data.inTable=void 0}function aS(e){this.enter({type:"tableRow",children:[]},e)}function vh(e){this.exit(e)}function vg(e){this.enter({type:"tableCell",children:[]},e)}function lS(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,iS));const a=this.stack[this.stack.length-1];a.type,a.value=n,this.exit(e)}function iS(e,n){return n==="|"?n:e}function sS(e){const n=e||{},a=n.tableCellPadding,i=n.tablePipeAlign,o=n.stringLength,u=a?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
78
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:w,table:d,tableCell:m,tableRow:h}};function d(b,j,k,N){return f(x(b,k,N),b.align)}function h(b,j,k,N){const C=g(b,k,N),E=f([C]);return E.slice(0,E.indexOf(`
|
|
79
|
-
`))}function m(b,j,k,N){const C=k.enter("tableCell"),E=k.enter("phrasing"),B=k.containerPhrasing(b,{...N,before:u,after:u});return E(),C(),B}function f(b,j){return wj(b,{align:j,alignDelimiters:i,padding:a,stringLength:o})}function x(b,j,k){const N=b.children;let C=-1;const E=[],B=j.enter("table");for(;++C<N.length;)E[C]=g(N[C],j,k);return B(),E}function g(b,j,k){const N=b.children;let C=-1;const E=[],B=j.enter("tableRow");for(;++C<N.length;)E[C]=m(N[C],b,j,k);return B(),E}function w(b,j,k){let N=jb.inlineCode(b,j,k);return k.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function oS(){return{exit:{taskListCheckValueChecked:wg,taskListCheckValueUnchecked:wg,paragraph:uS}}}function cS(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:dS}}}function wg(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function uS(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const a=this.stack[this.stack.length-1];a.type;const i=a.children[0];if(i&&i.type==="text"){const o=n.children;let u=-1,d;for(;++u<o.length;){const h=o[u];if(h.type==="paragraph"){d=h;break}}d===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(e)}function dS(e,n,a,i){const o=e.children[0],u=typeof e.checked=="boolean"&&o&&o.type==="paragraph",d="["+(e.checked?"x":" ")+"] ",h=a.createTracker(i);u&&h.move(d);let m=jb.listItem(e,n,a,{...i,...h.current()});return u&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),m;function f(x){return x+d}}function fS(){return[Y4(),dj(),pj(),tS(),oS()]}function hS(e){return{extensions:[X4(),fj(e),xj(),sS(e),cS()]}}const mS={tokenize:vS,partial:!0},Sb={tokenize:wS,partial:!0},Cb={tokenize:kS,partial:!0},Nb={tokenize:jS,partial:!0},pS={tokenize:SS,partial:!0},Eb={name:"wwwAutolink",tokenize:yS,previous:Db},Ab={name:"protocolAutolink",tokenize:bS,previous:Tb},il={name:"emailAutolink",tokenize:gS,previous:Fb},Aa={};function xS(){return{text:Aa}}let gi=48;for(;gi<123;)Aa[gi]=il,gi++,gi===58?gi=65:gi===91&&(gi=97);Aa[43]=il;Aa[45]=il;Aa[46]=il;Aa[95]=il;Aa[72]=[il,Ab];Aa[104]=[il,Ab];Aa[87]=[il,Eb];Aa[119]=[il,Eb];function gS(e,n,a){const i=this;let o,u;return d;function d(g){return!tm(g)||!Fb.call(i,i.previous)||Im(i.events)?a(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),h(g))}function h(g){return tm(g)?(e.consume(g),h):g===64?(e.consume(g),m):a(g)}function m(g){return g===46?e.check(pS,x,f)(g):g===45||g===95||ar(g)?(u=!0,e.consume(g),m):x(g)}function f(g){return e.consume(g),o=!0,m}function x(g){return u&&o&&sr(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(g)):a(g)}}function yS(e,n,a){const i=this;return o;function o(d){return d!==87&&d!==119||!Db.call(i,i.previous)||Im(i.events)?a(d):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(mS,e.attempt(Sb,e.attempt(Cb,u),a),a)(d))}function u(d){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(d)}}function bS(e,n,a){const i=this;let o="",u=!1;return d;function d(g){return(g===72||g===104)&&Tb.call(i,i.previous)&&!Im(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(g),e.consume(g),h):a(g)}function h(g){if(sr(g)&&o.length<5)return o+=String.fromCodePoint(g),e.consume(g),h;if(g===58){const w=o.toLowerCase();if(w==="http"||w==="https")return e.consume(g),m}return a(g)}function m(g){return g===47?(e.consume(g),u?f:(u=!0,m)):a(g)}function f(g){return g===null||zu(g)||dn(g)||Ei(g)||Xu(g)?a(g):e.attempt(Sb,e.attempt(Cb,x),a)(g)}function x(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(g)}}function vS(e,n,a){let i=0;return o;function o(d){return(d===87||d===119)&&i<3?(i++,e.consume(d),o):d===46&&i===3?(e.consume(d),u):a(d)}function u(d){return d===null?a(d):n(d)}}function wS(e,n,a){let i,o,u;return d;function d(f){return f===46||f===95?e.check(Nb,m,h)(f):f===null||dn(f)||Ei(f)||f!==45&&Xu(f)?m(f):(u=!0,e.consume(f),d)}function h(f){return f===95?i=!0:(o=i,i=void 0),e.consume(f),d}function m(f){return o||i||!u?a(f):n(f)}}function kS(e,n){let a=0,i=0;return o;function o(d){return d===40?(a++,e.consume(d),o):d===41&&i<a?u(d):d===33||d===34||d===38||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===60||d===63||d===93||d===95||d===126?e.check(Nb,n,u)(d):d===null||dn(d)||Ei(d)?n(d):(e.consume(d),o)}function u(d){return d===41&&i++,e.consume(d),o}}function jS(e,n,a){return i;function i(h){return h===33||h===34||h===39||h===41||h===42||h===44||h===46||h===58||h===59||h===63||h===95||h===126?(e.consume(h),i):h===38?(e.consume(h),u):h===93?(e.consume(h),o):h===60||h===null||dn(h)||Ei(h)?n(h):a(h)}function o(h){return h===null||h===40||h===91||dn(h)||Ei(h)?n(h):i(h)}function u(h){return sr(h)?d(h):a(h)}function d(h){return h===59?(e.consume(h),i):sr(h)?(e.consume(h),d):a(h)}}function SS(e,n,a){return i;function i(u){return e.consume(u),o}function o(u){return ar(u)?a(u):n(u)}}function Db(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||dn(e)}function Tb(e){return!sr(e)}function Fb(e){return!(e===47||tm(e))}function tm(e){return e===43||e===45||e===46||e===95||ar(e)}function Im(e){let n=e.length,a=!1;for(;n--;){const i=e[n][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){a=!0;break}if(i._gfmAutolinkLiteralWalkedInto){a=!1;break}}return e.length>0&&!a&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const CS={tokenize:RS,partial:!0};function NS(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:TS,continuation:{tokenize:FS},exit:MS}},text:{91:{name:"gfmFootnoteCall",tokenize:DS},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ES,resolveTo:AS}}}}function ES(e,n,a){const i=this;let o=i.events.length;const u=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let d;for(;o--;){const m=i.events[o][1];if(m.type==="labelImage"){d=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return h;function h(m){if(!d||!d._balanced)return a(m);const f=oa(i.sliceSerialize({start:d.end,end:i.now()}));return f.codePointAt(0)!==94||!u.includes(f.slice(1))?a(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),n(m))}}function AS(e,n){let a=e.length;for(;a--;)if(e[a][1].type==="labelImage"&&e[a][0]==="enter"){e[a][1];break}e[a+1][1].type="data",e[a+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[a+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[a+3][1].end),end:Object.assign({},e[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({},e[e.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},h=[e[a+1],e[a+2],["enter",i,n],e[a+3],e[a+4],["enter",o,n],["exit",o,n],["enter",u,n],["enter",d,n],["exit",d,n],["exit",u,n],e[e.length-2],e[e.length-1],["exit",i,n]];return e.splice(a,e.length-a+1,...h),e}function DS(e,n,a){const i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u=0,d;return h;function h(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?a(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(g){if(u>999||g===93&&!d||g===null||g===91||dn(g))return a(g);if(g===93){e.exit("chunkString");const w=e.exit("gfmFootnoteCallString");return o.includes(oa(i.sliceSerialize(w)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):a(g)}return dn(g)||(d=!0),u++,e.consume(g),g===92?x:f}function x(g){return g===91||g===92||g===93?(e.consume(g),u++,f):f(g)}}function TS(e,n,a){const i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u,d=0,h;return m;function m(j){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(j),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(j){return j===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(j),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",x):a(j)}function x(j){if(d>999||j===93&&!h||j===null||j===91||dn(j))return a(j);if(j===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return u=oa(i.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(j),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),w}return dn(j)||(h=!0),d++,e.consume(j),j===92?g:x}function g(j){return j===91||j===92||j===93?(e.consume(j),d++,x):x(j)}function w(j){return j===58?(e.enter("definitionMarker"),e.consume(j),e.exit("definitionMarker"),o.includes(u)||o.push(u),Ht(e,b,"gfmFootnoteDefinitionWhitespace")):a(j)}function b(j){return n(j)}}function FS(e,n,a){return e.check(Xo,n,e.attempt(CS,n,a))}function MS(e){e.exit("gfmFootnoteDefinition")}function RS(e,n,a){const i=this;return Ht(e,o,"gfmFootnoteDefinitionIndent",5);function o(u){const d=i.events[i.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?n(u):a(u)}}function zS(e){let a=(e||{}).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(d,h){let m=-1;for(;++m<d.length;)if(d[m][0]==="enter"&&d[m][1].type==="strikethroughSequenceTemporary"&&d[m][1]._close){let f=m;for(;f--;)if(d[f][0]==="exit"&&d[f][1].type==="strikethroughSequenceTemporary"&&d[f][1]._open&&d[m][1].end.offset-d[m][1].start.offset===d[f][1].end.offset-d[f][1].start.offset){d[m][1].type="strikethroughSequence",d[f][1].type="strikethroughSequence";const x={type:"strikethrough",start:Object.assign({},d[f][1].start),end:Object.assign({},d[m][1].end)},g={type:"strikethroughText",start:Object.assign({},d[f][1].end),end:Object.assign({},d[m][1].start)},w=[["enter",x,h],["enter",d[f][1],h],["exit",d[f][1],h],["enter",g,h]],b=h.parser.constructs.insideSpan.null;b&&Br(w,w.length,0,Wu(b,d.slice(f+1,m),h)),Br(w,w.length,0,[["exit",g,h],["enter",d[m][1],h],["exit",d[m][1],h],["exit",x,h]]),Br(d,f-1,m-f+3,w),m=f+w.length-2;break}}for(m=-1;++m<d.length;)d[m][1].type==="strikethroughSequenceTemporary"&&(d[m][1].type="data");return d}function u(d,h,m){const f=this.previous,x=this.events;let g=0;return w;function w(j){return f===126&&x[x.length-1][1].type!=="characterEscape"?m(j):(d.enter("strikethroughSequenceTemporary"),b(j))}function b(j){const k=ws(f);if(j===126)return g>1?m(j):(d.consume(j),g++,b);if(g<2&&!a)return m(j);const N=d.exit("strikethroughSequenceTemporary"),C=ws(j);return N._open=!C||C===2&&!!k,N._close=!k||k===2&&!!C,h(j)}}}class _S{constructor(){this.map=[]}add(n,a,i){BS(this,n,a,i)}consume(n){if(this.map.sort(function(u,d){return u[0]-d[0]}),this.map.length===0)return;let a=this.map.length;const i=[];for(;a>0;)a-=1,i.push(n.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),n.length=this.map[a][0];i.push(n.slice()),n.length=0;let o=i.pop();for(;o;){for(const u of o)n.push(u);o=i.pop()}this.map.length=0}}function BS(e,n,a,i){let o=0;if(!(a===0&&i.length===0)){for(;o<e.map.length;){if(e.map[o][0]===n){e.map[o][1]+=a,e.map[o][2].push(...i);return}o+=1}e.map.push([n,a,i])}}function OS(e,n){let a=!1;const i=[];for(;n<e.length;){const o=e[n];if(a){if(o[0]==="enter")o[1].type==="tableContent"&&i.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[n-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);n+=1}return i}function $S(){return{flow:{null:{name:"table",tokenize:LS,resolveAll:IS}}}}function LS(e,n,a){const i=this;let o=0,u=0,d;return h;function h(D){let I=i.events.length-1;for(;I>-1;){const ue=i.events[I][1].type;if(ue==="lineEnding"||ue==="linePrefix")I--;else break}const H=I>-1?i.events[I][1].type:null,q=H==="tableHead"||H==="tableRow"?_:m;return q===_&&i.parser.lazy[i.now().line]?a(D):q(D)}function m(D){return e.enter("tableHead"),e.enter("tableRow"),f(D)}function f(D){return D===124||(d=!0,u+=1),x(D)}function x(D){return D===null?a(D):at(D)?u>1?(u=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),b):a(D):Tt(D)?Ht(e,x,"whitespace")(D):(u+=1,d&&(d=!1,o+=1),D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),d=!0,x):(e.enter("data"),g(D)))}function g(D){return D===null||D===124||dn(D)?(e.exit("data"),x(D)):(e.consume(D),D===92?w:g)}function w(D){return D===92||D===124?(e.consume(D),g):g(D)}function b(D){return i.interrupt=!1,i.parser.lazy[i.now().line]?a(D):(e.enter("tableDelimiterRow"),d=!1,Tt(D)?Ht(e,j,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):j(D))}function j(D){return D===45||D===58?N(D):D===124?(d=!0,e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),k):$(D)}function k(D){return Tt(D)?Ht(e,N,"whitespace")(D):N(D)}function N(D){return D===58?(u+=1,d=!0,e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),C):D===45?(u+=1,C(D)):D===null||at(D)?R(D):$(D)}function C(D){return D===45?(e.enter("tableDelimiterFiller"),E(D)):$(D)}function E(D){return D===45?(e.consume(D),E):D===58?(d=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),B):(e.exit("tableDelimiterFiller"),B(D))}function B(D){return Tt(D)?Ht(e,R,"whitespace")(D):R(D)}function R(D){return D===124?j(D):D===null||at(D)?!d||o!==u?$(D):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(D)):$(D)}function $(D){return a(D)}function _(D){return e.enter("tableRow"),L(D)}function L(D){return D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),L):D===null||at(D)?(e.exit("tableRow"),n(D)):Tt(D)?Ht(e,L,"whitespace")(D):(e.enter("data"),U(D))}function U(D){return D===null||D===124||dn(D)?(e.exit("data"),L(D)):(e.consume(D),D===92?Q:U)}function Q(D){return D===92||D===124?(e.consume(D),U):U(D)}}function IS(e,n){let a=-1,i=!0,o=0,u=[0,0,0,0],d=[0,0,0,0],h=!1,m=0,f,x,g;const w=new _S;for(;++a<e.length;){const b=e[a],j=b[1];b[0]==="enter"?j.type==="tableHead"?(h=!1,m!==0&&(kg(w,n,m,f,x),x=void 0,m=0),f={type:"table",start:Object.assign({},j.start),end:Object.assign({},j.end)},w.add(a,0,[["enter",f,n]])):j.type==="tableRow"||j.type==="tableDelimiterRow"?(i=!0,g=void 0,u=[0,0,0,0],d=[0,a+1,0,0],h&&(h=!1,x={type:"tableBody",start:Object.assign({},j.start),end:Object.assign({},j.end)},w.add(a,0,[["enter",x,n]])),o=j.type==="tableDelimiterRow"?2:x?3:1):o&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")?(i=!1,d[2]===0&&(u[1]!==0&&(d[0]=d[1],g=pu(w,n,u,o,void 0,g),u=[0,0,0,0]),d[2]=a)):j.type==="tableCellDivider"&&(i?i=!1:(u[1]!==0&&(d[0]=d[1],g=pu(w,n,u,o,void 0,g)),u=d,d=[u[1],a,0,0])):j.type==="tableHead"?(h=!0,m=a):j.type==="tableRow"||j.type==="tableDelimiterRow"?(m=a,u[1]!==0?(d[0]=d[1],g=pu(w,n,u,o,a,g)):d[1]!==0&&(g=pu(w,n,d,o,a,g)),o=0):o&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")&&(d[3]=a)}for(m!==0&&kg(w,n,m,f,x),w.consume(n.events),a=-1;++a<n.events.length;){const b=n.events[a];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=OS(n.events,a))}return e}function pu(e,n,a,i,o,u){const d=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",h="tableContent";a[0]!==0&&(u.end=Object.assign({},gs(n.events,a[0])),e.add(a[0],0,[["exit",u,n]]));const m=gs(n.events,a[1]);if(u={type:d,start:Object.assign({},m),end:Object.assign({},m)},e.add(a[1],0,[["enter",u,n]]),a[2]!==0){const f=gs(n.events,a[2]),x=gs(n.events,a[3]),g={type:h,start:Object.assign({},f),end:Object.assign({},x)};if(e.add(a[2],0,[["enter",g,n]]),i!==2){const w=n.events[a[2]],b=n.events[a[3]];if(w[1].end=Object.assign({},b[1].end),w[1].type="chunkText",w[1].contentType="text",a[3]>a[2]+1){const j=a[2]+1,k=a[3]-a[2]-1;e.add(j,k,[])}}e.add(a[3]+1,0,[["exit",g,n]])}return o!==void 0&&(u.end=Object.assign({},gs(n.events,o)),e.add(o,0,[["exit",u,n]]),u=void 0),u}function kg(e,n,a,i,o){const u=[],d=gs(n.events,a);o&&(o.end=Object.assign({},d),u.push(["exit",o,n])),i.end=Object.assign({},d),u.push(["exit",i,n]),e.add(a+1,0,u)}function gs(e,n){const a=e[n],i=a[0]==="enter"?"start":"end";return a[1][i]}const HS={name:"tasklistCheck",tokenize:qS};function US(){return{text:{91:HS}}}function qS(e,n,a){const i=this;return o;function o(m){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?a(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),u)}function u(m){return dn(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),d):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),d):a(m)}function d(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),h):a(m)}function h(m){return at(m)?n(m):Tt(m)?e.check({tokenize:YS},n,a)(m):a(m)}}function YS(e,n,a){return Ht(e,i,"whitespace");function i(o){return o===null?a(o):n(o)}}function XS(e){return Uy([xS(),NS(),zS(e),$S(),US()])}const WS={};function Hm(e){const n=this,a=e||WS,i=n.data(),o=i.micromarkExtensions||(i.micromarkExtensions=[]),u=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),d=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);o.push(XS(a)),u.push(fS()),d.push(hS(a))}function As({content:e,className:n=""}){return l.jsx("div",{className:`office-markdown ${n}`,children:l.jsx(Om,{remarkPlugins:[Hm],components:{code:GS,table:({children:a})=>l.jsx("div",{className:"overflow-x-auto my-2",children:l.jsx("table",{className:"office-table",children:a})})},children:e})})}function GS({className:e,children:n,...a}){const i=/language-(\w+)/.exec(e??"");return i||typeof n=="string"&&n.includes(`
|
|
80
|
-
`)?l.jsx(VS,{language:i==null?void 0:i[1],children:n}):l.jsx("code",{className:"bg-gray-100 text-gray-700 px-1 py-0.5 rounded text-[0.9em] font-mono",...a,children:n})}function VS({children:e,language:n}){const[a,i]=v.useState(!1),o=String(e).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(o),i(!0),setTimeout(()=>i(!1),1500)};return l.jsxs("div",{className:"office-code-block group relative my-2",children:[n&&l.jsx("div",{className:"text-[10px] text-gray-400 px-3 pt-1.5",children:n}),l.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"}),l.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:l.jsx("code",{children:o})})]})}const jg={$skin:"skinColor",$hair:"hairColor",$shirt:"shirtColor",$pants:"pantsColor",$shoes:"shoeColor"},KS=/^(darken|lighten)\((\$\w+),\s*(\d+)\)$/;function QS(e,n){const a=parseInt(e.replace("#",""),16),i=Math.max(0,(a>>16&255)-n),o=Math.max(0,(a>>8&255)-n),u=Math.max(0,(a&255)-n);return`#${(i<<16|o<<8|u).toString(16).padStart(6,"0")}`}function PS(e,n){const a=parseInt(e.replace("#",""),16),i=Math.min(255,(a>>16&255)+n),o=Math.min(255,(a>>8&255)+n),u=Math.min(255,(a&255)+n);return`#${(i<<16|o<<8|u).toString(16).padStart(6,"0")}`}function Mb(e,n){const a=jg[e];if(a&&n)return n[a];const i=KS.exec(e);if(i){const[,o,u,d]=i,h=jg[u],m=h&&n?n[h]:u,f=parseInt(d,10);return o==="darken"?QS(m,f):PS(m,f)}return e}function nm(e,n=12){return e.map(a=>({...a,x:n-a.x-a.w}))}function ZS(e,n){return n==="down"?e.down:n==="up"&&e.up?e.up:n==="left"&&e.left?e.left:n==="right"&&e.right?e.right:n==="right"&&e.left?{name:e.left.name,pixels:nm(e.left.pixels)}:n==="left"&&e.right?{name:e.right.name,pixels:nm(e.right.pixels)}:e.down}function JS(e,n){return rm(e,"hair",n,1)}function rm(e,n,a,i){const o=e.layers.findIndex(d=>d.name===n),u=[...e.layers];if(o>=0)u[o]={...a,name:n};else{const d=i??u.length;u.splice(d,0,{...a,name:n})}return{...e,layers:u}}const Um=new Map,qm=new Map;function Rb(e,n){Um.set(e,n)}function Qu(e,n){qm.set(e,n)}function am(e){return Um.get(e)}function A8(e){return qm.get(e)}function D8(){return Array.from(Um.keys())}function T8(){return Array.from(qm.keys())}function eC(e,n,a,i,o=2){e.clearRect(0,0,n.width*o,n.height*o);for(const u of n.layers)zb(e,u.pixels,o,a,i)}function Il(e,n,a,i,o){for(const u of n){const d=Mb(u.c,o);u.a!==void 0&&u.a!==1&&(e.globalAlpha=u.a),e.fillStyle=d,e.fillRect(a+u.x,i+u.y,u.w,u.h),u.a!==void 0&&u.a!==1&&(e.globalAlpha=1)}}function F8(e,n){const a=n.scale;e.clearRect(0,0,n.canvasWidth,n.canvasHeight),zb(e,n.pixels,a,0)}function zb(e,n,a,i,o){for(const u of n){const d=Mb(u.c,o);u.a!==void 0&&u.a!==1&&(e.globalAlpha=u.a),e.fillStyle=d,e.fillRect(u.x*a,(u.y+i)*a,u.w*a,u.h*a),u.a!==void 0&&u.a!==1&&(e.globalAlpha=1)}}const $u=new Map;function Yl(e,n,a){if("down"in a&&!("pixels"in a)){const o=a;$u.set(e,{id:e,name:n,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;$u.set(e,{id:e,name:n,layer:{...o,name:"hair"}})}}function tC(e){return $u.get(e)}function _b(){return Array.from($u.values())}Yl("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}]}});Yl("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}]}});Yl("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}]}});Yl("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}]}});Yl("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"}]}});Yl("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}]}});Yl("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}]}});Yl("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 Lu=new Map;function Da(e,n,a){if("down"in a&&!("pixels"in a)){const o=a;Lu.set(e,{id:e,name:n,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;Lu.set(e,{id:e,name:n,layer:{...o,name:"torso"}})}}function nC(e){return Lu.get(e)}function Bb(){return Array.from(Lu.values())}Da("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"}]}});Da("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"}]}});Da("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"}]}});Da("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)"}]}});Da("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)"}]}});Da("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"}]}});Da("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"}]}});Da("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"}]}});Da("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"}]}});Da("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 Ho=new Map;function Kt(e,n,a){if("down"in a&&!("pixels"in a)){const o=a;Ho.set(e,{id:e,name:n,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;Ho.set(e,{id:e,name:n,layer:{...o,name:"accessory"}})}}function rC(e){return Ho.get(e)}function aC(e,n){const a=Ho.get(e);if(!a)return;if(a.directions)return ZS(a.directions,n);if(n==="down")return a.layer;const i=a.layer.pixels.filter(u=>u.y<2);if(i.length===0)return;const o=n==="right"?1:n==="left"?-1:0;return{name:a.layer.name,pixels:o?i.map(u=>({...u,x:u.x+o})):i}}function Ob(){return Array.from(Ho.values())}Kt("none","None",{name:"accessory",pixels:[]});Kt("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}]}});Kt("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}]}});Kt("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}]}});Kt("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}]}});Kt("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}]}});Kt("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}]}});Kt("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}]}});Kt("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}]}});Kt("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}]}});Kt("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}]}});Kt("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}]}});Kt("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"}]}});Kt("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}]}});Kt("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}]}});Kt("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"}]}});Kt("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}]}});Kt("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}]}});Kt("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}]}});Kt("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}]}});Kt("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"}]}});Kt("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}]}});Kt("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}]}});Kt("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}]}});Kt("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}]}});Kt("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"}]}});Kt("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"}]}});Kt("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}]}});Kt("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}]}});Kt("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}]}});const lC={none:1,glasses:1,beret:1,cap:1,badge:1,blush:1,lapels:1,"round-glasses":2,headphones:2,scarf:3,tie:3,bowtie:3,sunglasses:4,bandana:4,eyepatch:4,crown:5,halo:5,horns:5,mask:5,"cat-ears":6,"bear-ears":6,"bunny-ears":6,"dog-nose":6,"fox-mask":6,"cat-face":7,"bear-face":7,"panda-face":7,"frog-face":8,"rabbit-face":8,"dog-face":8,"star-glasses":9};function $b(e){return lC[e]??1}function Lb(e,n){return n>=$b(e)}Kt("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 No({r:e,g:n,b:a}){return`#${(e<<16|n<<8|a).toString(16).padStart(6,"0")}`}function Tu(e,n){const a=e.r-n.r,i=e.g-n.g,o=e.b-n.b;return a*a+i*i+o*o}function iC(e,n){const a=[];a.push(e[Math.floor(Math.random()*e.length)]);for(let i=1;i<n;i++){const o=e.map(h=>{let m=1/0;for(const f of a)m=Math.min(m,Tu(h,f));return m}),u=o.reduce((h,m)=>h+m,0);let d=Math.random()*u;for(let h=0;h<e.length;h++)if(d-=o[h],d<=0){a.push(e[h]);break}a.length<=i&&a.push(e[Math.floor(Math.random()*e.length)])}return a}function sC(e,n,a=20){if(e.length===0)return[];const i=iC(e,n);for(let u=0;u<a;u++){const d=Array.from({length:n},()=>[]);for(const m of e){let f=1/0,x=0;for(let g=0;g<n;g++){const w=Tu(m,i[g]);w<f&&(f=w,x=g)}d[x].push(m)}let h=!0;for(let m=0;m<n;m++){if(d[m].length===0)continue;const f={r:0,g:0,b:0};for(const w of d[m])f.r+=w.r,f.g+=w.g,f.b+=w.b;const x=d[m].length,g={r:Math.round(f.r/x),g:Math.round(f.g/x),b:Math.round(f.b/x)};Tu(g,i[m])>1&&(h=!1),i[m]=g}if(h)break}const o=new Array(n).fill(0);for(const u of e){let d=1/0,h=0;for(let m=0;m<n;m++){const f=Tu(u,i[m]);f<d&&(d=f,h=m)}o[h]++}return i.map((u,d)=>({c:u,count:o[d]})).sort((u,d)=>d.count-u.count).map(u=>u.c)}function oC(e,n=1e4){const a=document.createElement("canvas"),i=e instanceof HTMLImageElement?e.naturalWidth:e.width,o=e instanceof HTMLImageElement?e.naturalHeight:e.height;a.width=i,a.height=o;const u=a.getContext("2d");u.drawImage(e,0,0);const d=u.getImageData(0,0,i,o).data,h=i*o,m=Math.max(1,Math.floor(h/n)),f=[];for(let x=0;x<h;x+=m){const g=x*4;d[g+3]<128||f.push({r:d[g],g:d[g+1],b:d[g+2]})}return f}function Sg(e){return .299*e.r+.587*e.g+.114*e.b}function Cg(e){const n=Math.max(e.r,e.g,e.b),a=Math.min(e.r,e.g,e.b);return n===0?0:(n-a)/n*255}function cC(e,n=8){const a=oC(e),i=sC(a,n);if(i.length<5)return{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121"};const o=[...i].sort((g,w)=>Sg(w)-Sg(g)),u=[...i].sort((g,w)=>Cg(w)-Cg(g)),d=o[0],h=o[o.length-1],m=u[0],f=o[o.length-2],x=o[o.length-1];return{skinColor:No(d),hairColor:No(h),shirtColor:No(m),pantsColor:No(f),shoeColor:No(x)}}const uC=[{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}],dC=[{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"}],fC=[{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"}],hC=[{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 mC(){return{width:12,height:22,layers:[{name:"lower",pixels:uC},{name:"torso",pixels:dC},{name:"head",pixels:fC},{name:"hair",pixels:hC},{name:"accessory",pixels:[]}]}}const pC=["cto","cbo","pm","engineer","designer","qa","data-analyst","default"];for(const e of pC)Rb(`mini:${e}`,mC());const xC=[{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"}],gC=[{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"}],yC=[{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 bC(){return{width:12,height:22,layers:[{name:"torso",pixels:xC},{name:"head",pixels:gC},{name:"hair",pixels:yC},{name:"accessory",pixels:[]}]}}Rb("mini-seated:default",bC());const vC={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"}]},wC={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"}]},kC={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"}]},jC={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"}]};Qu("meeting",vC);Qu("bulletin",wC);Qu("decision",jC);Qu("knowledge",kC);const wh=16,kh=24,SC=60,CC={cbo:0,cto:8,pm:15,engineer:22,designer:5,qa:12};function Ib(e,n){if(!e)return e;let a=e;if(n!=null&&n.hairStyle){const i=tC(n.hairStyle);i&&(a=JS(a,i.layer))}if(n!=null&&n.outfitStyle){const i=nC(n.outfitStyle);i&&(a=rm(a,"torso",i.layer,1))}if(n!=null&&n.accessory&&n.accessory!=="none"){const i=rC(n.accessory);i&&(a=rm(a,"accessory",i.layer))}return a}function Ul({roleId:e,className:n,appearance:a,scale:i}){const o=v.useRef(null),u=v.useRef(0),d=v.useRef(0),h=v.useRef(a);h.current=a;const m=i??4,f=wh*m,x=kh*m,g=v.useMemo(()=>{const w=am(`mini:${e}`)??am("mini:default");return Ib(w,a)},[e,a==null?void 0:a.hairStyle,a==null?void 0:a.outfitStyle,a==null?void 0:a.accessory]);return v.useEffect(()=>{const w=o.current;if(!w)return;const b=w.getContext("2d");if(!b)return;const j=CC[e]??0,k=()=>{d.current++;const N=h.current;if(!N||!g){u.current=requestAnimationFrame(k);return}const E=(d.current+j)%SC<30?1:0;b.clearRect(0,0,wh,kh),b.save(),b.translate(2,1),eC(b,g,E,N,1),b.restore(),u.current=requestAnimationFrame(k)};return u.current=requestAnimationFrame(k),()=>cancelAnimationFrame(u.current)},[e,g]),l.jsx("canvas",{ref:o,width:wh,height:kh,className:n,style:{imageRendering:"pixelated",display:"block",width:f,height:x}})}const NC="https://api.tycono.ai",Ym=NC;async function Eo(e){const n=await fetch(`${Ym}${e}`);if(!n.ok)throw new Error(`Cloud API error: ${n.status}`);return n.json()}async function yi(e,n){const a=await fetch(`${Ym}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok)throw new Error(`Cloud API error: ${a.status}`);return a.json()}const wr={health:()=>Eo("/api/health"),getMyName:e=>Eo(`/api/auth/my-name?instance_id=${encodeURIComponent(e)}`),getCharacters:e=>{const n=new URLSearchParams;e!=null&&e.sort&&n.set("sort",e.sort),e!=null&&e.instanceId&&n.set("instance_id",e.instanceId);const a=n.toString();return Eo(`/api/store/characters${a?`?${a}`:""}`)},getCharacter:e=>Eo(`/api/store/characters/${e}`),getCharacterVersion:e=>Eo(`/api/store/characters/${e}/version`),voteCharacter:(e,n,a)=>yi(`/api/store/characters/${e}/vote`,{instanceId:n,vote:a}),trackInstall:e=>yi(`/api/store/characters/${e}/install`,{}),syncCheck:e=>yi("/api/sync/check",{roles:e}),syncPull:e=>yi("/api/sync/pull",{sourceId:e}),publishCharacter:e=>yi("/api/store/publish",e),deleteCharacter:(e,n)=>{const a=n?`?publisher_id=${encodeURIComponent(n)}`:"";return fetch(`${Ym}/api/store/characters/${e}${a}`,{method:"DELETE"}).then(i=>i.json())},uploadTelemetry:e=>yi("/api/telemetry",e),syncStats:e=>yi("/api/stats/sync",e)},EC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"},jh={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},AC={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},DC=500,Ng=360,Eg=700,TC=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`;function Ag({role:e,allRoles:n,recentActivity:a,onClose:i,onFireRole:o,terminalWidth:u=0,activeJobId:d,activeSessionId:h,activeTask:m,isWorking:f,jobStartedAt:x,onStopJob:g,sessions:w,streamingSessionId:b,onCreateSessionSilent:j,onSendMessage:k,onFocusTerminal:N,onCustomize:C,onUpdateRole:E,appearance:B,relationships:R,roleLevel:$,onMaximize:_}){var Ve,bt;const[L,U]=v.useState(DC),[Q,D]=v.useState(!1),I=v.useRef(0),H=v.useRef(0),[q,ue]=v.useState(!1),[te,Y]=v.useState(!1),[se,J]=v.useState(!1),[Z,A]=v.useState(!1),[F,W]=v.useState("talk"),[T,de]=v.useState(!1),[xe,ye]=v.useState(""),[Le,Xe]=v.useState(!1),Ye=v.useRef(null),[ht,tt]=v.useState(!1),[Je,Ne]=v.useState(""),[De,yt]=v.useState(!1),{events:ct,status:pt}=Ey(h??null),[jt,Wt]=v.useState(0);v.useEffect(()=>{if(!f||!x){Wt(0);return}const Re=new Date(x).getTime(),Ie=()=>Wt(Math.floor((Date.now()-Re)/1e3));Ie();const _t=setInterval(Ie,1e3);return()=>clearInterval(_t)},[f,x]);const Ft=u>0,Nt=Ft?u:0,$n=Ft?Math.max(Ng,window.innerWidth-u-100):Eg,me=Math.min(L,$n),Se=v.useCallback(Re=>{Re.preventDefault(),I.current=Re.clientX,H.current=me,D(!0);const Ie=_,_t=()=>{D(!1),document.removeEventListener("mousemove",Bt),document.removeEventListener("mouseup",_t)},Bt=Ot=>{const fn=I.current-Ot.clientX,wn=H.current+fn;if(wn>=window.innerWidth*.6&&Ie){_t(),Ie();return}const P=Math.min(Eg,Math.max(Ng,wn));U(P)};document.addEventListener("mousemove",Bt),document.addEventListener("mouseup",_t)},[me,_]),Ee=v.useRef(null),G=e?w.find(Re=>Re.roleId===e.id):null,ce=Re=>{if(!e)return;const Ie=f?"talk":F;G?(k(G.id,Re,Ie),N(e.id)):(Ee.current={content:Re,mode:Ie},j(e.id))};v.useEffect(()=>{if(G&&Ee.current){const{content:Re,mode:Ie}=Ee.current;Ee.current=null,k(G.id,Re,Ie),e&&N(e.id)}},[G==null?void 0:G.id]);const ne=(()=>{if(!ct.length)return null;const Re=[];let Ie=0,_t=0,Bt=0;for(const Ot of ct)if(Ot.type==="thinking")Ie++;else if(Ot.type==="text")_t++;else if(Ot.type==="tool:start"){const fn=String(Ot.data.name??"");Re.includes(fn)||Re.push(fn)}else Ot.type==="dispatch:start"&&Bt++;return{tools:Re,thinkCount:Ie,textCount:_t,dispatchCount:Bt,total:ct.length}})(),ke=m||(()=>{if(!G)return null;const Re=G.messages;for(let Ie=Re.length-1;Ie>=0;Ie--)if(Re[Ie].from==="ceo")return Re[Ie].content;return null})(),ve=(()=>{if(!G)return null;const Re=G.messages;for(let Ie=Re.length-1;Ie>=0;Ie--)if(Re[Ie].from==="role"&&Re[Ie].content)return Re[Ie].content;return null})();if(!e)return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:Nt},onClick:i}),l.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px]",style:{right:Nt,width:me,background:"var(--terminal-bg)",borderLeftColor:"var(--pixel-border)"},children:l.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading role..."})})]});const ze=jh[e.id]??"#666",_e=EC[e.id]??"👤",Be=n.filter(Re=>Re.reportsTo===e.id),He=G&&b===G.id,rt=e.name||AC[e.id]||e.id;return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:Nt},onClick:i}),l.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)] ${Q?"resizing":""}`,style:{borderLeftColor:ze,right:Nt,width:me,background:"var(--terminal-bg)"},children:[l.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${Q?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:Se}),l.jsxs("div",{className:"relative shrink-0 overflow-hidden",style:{background:`linear-gradient(135deg, ${ze}ee, ${ze}99)`},children:[l.jsx("div",{className:"absolute inset-0 opacity-[0.06]",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 8px, white 8px, white 9px)"}}),l.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-1.5 z-10",children:[C&&l.jsx("button",{onClick:()=>C(e.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:"🎨"}),_&&l.jsx("button",{onClick:_,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:"Maximize (Pro View)",children:"⤢"}),l.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:"×"})]}),l.jsxs("div",{className:"relative flex items-end gap-4 px-4 pt-4 pb-3",children:[l.jsx("div",{className:"shrink-0 relative",style:{marginBottom:-2},children:l.jsx("div",{className:"rounded-lg p-1",style:{background:"rgba(0,0,0,0.2)"},children:l.jsx(Ul,{roleId:e.id,appearance:B,scale:8})})}),l.jsxs("div",{className:"flex-1 min-w-0 text-white pb-1",children:[l.jsxs("div",{className:"text-lg font-bold flex items-center gap-2",style:{fontFamily:"var(--pixel-font)"},children:[_e," ",e.id.toUpperCase(),f&&l.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"})]}),T?l.jsxs("form",{className:"flex items-center gap-1.5 mt-0.5",onSubmit:async Re=>{Re.preventDefault();const Ie=xe.trim();if(!Ie||Ie===rt||!E){de(!1);return}Xe(!0);try{await E(e.id,{name:Ie})}catch{}Xe(!1),de(!1)},children:[l.jsx("input",{ref:Ye,value:xe,onChange:Re=>ye(Re.target.value),onKeyDown:Re=>{Re.key==="Escape"&&de(!1)},disabled:Le,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"}}),l.jsx("button",{type:"submit",disabled:Le,className:"text-white/80 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✓"}),l.jsx("button",{type:"button",onClick:()=>de(!1),className:"text-white/60 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✕"})]}):l.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&&(ye(rt),de(!0))},title:E?"Click to edit name":void 0,children:[rt,E&&l.jsx("span",{className:"opacity-0 group-hover/name:opacity-60 text-[10px]",children:"✎"})]})]})]}),l.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:[l.jsxs("span",{children:["Lv.",$??1]}),l.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:f?"var(--idle-amber)":"var(--active-green)"}}),f?"Working":"Idle"]}),l.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),l.jsx("span",{children:e.level}),e.reportsTo&&l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),l.jsxs("span",{className:"opacity-60",children:["→"," ",e.reportsTo]})]})]})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:[f&&l.jsxs("div",{className:"px-4 py-3 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"var(--idle-amber)"}}),l.jsxs("span",{className:"text-xs font-semibold",style:{color:"var(--idle-amber)"},children:["Working",jt>0?` · ${TC(jt)}`:""]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:()=>N(e.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"}),d&&g&&l.jsx("button",{onClick:()=>g(d),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"})]})]}),ke&&l.jsx("div",{className:"text-xs truncate",style:{color:"var(--terminal-text-secondary)"},children:ke})]}),f&&d&&ne&&l.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[l.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[l.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Activity"}),l.jsx("button",{onClick:()=>N(e.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"View details ↗"})]}),l.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[ne.thinkCount>0&&l.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:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:"#a855f7"}}),"thinking ×",ne.thinkCount]}),ne.tools.map(Re=>l.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa"},children:Re},Re)),ne.dispatchCount>0&&l.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(249,115,22,0.15)",color:"#fb923c"},children:["dispatch ×",ne.dispatchCount]}),ne.textCount>0&&l.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(34,197,94,0.15)",color:"#4ade80"},children:["output ×",ne.textCount]}),(pt==="streaming"||pt==="connecting")&&l.jsx("span",{className:"inline-block w-1.5 h-3 animate-pulse rounded-sm",style:{background:"var(--active-green)"}})]}),l.jsxs("div",{className:"text-[10px] mt-1",style:{color:"var(--terminal-text-muted)"},children:[ne.total," events"]})]}),f&&ve&&l.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[l.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[l.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Last Message"}),l.jsx("button",{onClick:()=>N(e.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"})]}),l.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:[ve.slice(0,200),ve.length>200&&"..."]})]}),f&&l.jsx("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:l.jsx(Dg,{onSend:ce,disabled:!!He,placeholder:"Ask something...",color:ze})}),!f&&l.jsxs("div",{className:"px-4 pt-4 pb-2",children:[l.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-secondary)"},children:"Latest"}),l.jsx(MC,{icon:_e,roleId:e.id,roleName:rt,color:ze,text:a})]}),!f&&l.jsx("div",{className:"px-4 py-3",style:{borderBottom:"1px solid var(--terminal-border)"},children:l.jsxs("div",{className:"rounded-xl overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[ve&&l.jsxs("div",{className:"px-3 pt-2.5 pb-2 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--terminal-border)"},onClick:()=>N(e.id),children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Last response"}),l.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"View ↗"})]}),l.jsxs("div",{className:"text-xs leading-relaxed line-clamp-2 overflow-hidden",style:{color:"var(--terminal-text-secondary)"},children:[ve.slice(0,150),ve.length>150&&"..."]})]}),l.jsx("div",{className:"p-2",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("div",{className:"flex rounded-lg overflow-hidden shrink-0",style:{border:"1px solid var(--pixel-border)"},children:[l.jsx("button",{onClick:()=>W("talk"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:F==="talk"?"var(--accent)":"transparent",color:F==="talk"?"#fff":"var(--terminal-text-secondary)"},children:"Talk"}),l.jsx("button",{onClick:()=>W("do"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:F==="do"?"var(--idle-amber)":"transparent",color:F==="do"?"#fff":"var(--terminal-text-secondary)"},children:"Do"})]}),l.jsx(Dg,{onSend:ce,disabled:!!He,placeholder:F==="talk"?"Ask something...":"Give a directive...",color:ze})]})})]})}),l.jsxs("div",{className:"px-4 py-2 space-y-1",children:[l.jsxs(xu,{title:`Profile${e.persona?"":" (empty)"}`,open:q,onToggle:()=>ue(Re=>!Re),children:[ht?l.jsxs("div",{className:"space-y-2",children:[l.jsx("textarea",{value:Je,onChange:Re=>Ne(Re.target.value),onKeyDown:Re=>{Re.key==="Escape"&&tt(!1)},disabled:De,autoFocus:!0,rows:5,placeholder:"Describe this role's personality and communication style. How do they talk? Are they sarcastic? Cheerful? Blunt?",className:"w-full text-xs leading-relaxed rounded-lg p-3 outline-none resize-y",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--active-green)",color:"var(--terminal-text)",fontFamily:"inherit",minHeight:"80px"}}),l.jsxs("div",{className:"flex gap-1.5 justify-end",children:[l.jsx("button",{onClick:()=>tt(!1),disabled:De,className:"text-[10px] px-2 py-0.5 rounded cursor-pointer",style:{color:"var(--terminal-text-muted)",border:"1px solid var(--terminal-border)"},children:"Cancel"}),l.jsx("button",{onClick:async()=>{if(E){yt(!0);try{await E(e.id,{persona:Je.trim()})}catch{}yt(!1),tt(!1)}},disabled:De,className:"text-[10px] px-2 py-0.5 rounded cursor-pointer font-semibold",style:{background:"var(--active-green)",color:"#000"},children:De?"Saving...":"Save"})]})]}):l.jsxs("div",{className:"text-xs leading-relaxed rounded-lg p-3 group/persona cursor-pointer hover:opacity-90 transition-opacity",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},onClick:()=>{E&&(Ne(e.persona||""),tt(!0))},title:E?"Click to edit persona":void 0,children:[e.persona||l.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:"No persona set. Click to add one."}),E&&l.jsx("span",{className:"opacity-0 group-hover/persona:opacity-60 text-[10px] ml-1",children:"✎"})]}),l.jsxs("div",{className:"space-y-0 mt-2",children:[l.jsx(Sh,{label:"Level",value:e.level}),l.jsx(Sh,{label:"Reports to",value:e.reportsTo}),l.jsx(Sh,{label:"Status",value:e.status})]}),Be.length>0&&l.jsxs("div",{className:"mt-3",children:[l.jsx("div",{className:"text-[11px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Direct Reports"}),l.jsx("div",{className:"space-y-1",children:Be.map(Re=>l.jsxs("div",{className:"flex items-center gap-2 p-1.5 rounded-lg",style:{background:"var(--hud-bg-alt)"},children:[l.jsx("div",{className:"w-6 h-6 rounded flex items-center justify-center text-white text-[10px] font-bold",style:{background:jh[Re.id]??"#666"},children:Re.id.slice(0,2).toUpperCase()}),l.jsx("div",{className:"text-xs",style:{color:"var(--terminal-text)"},children:Re.name})]},Re.id))})]})]}),e.authority&&l.jsxs(xu,{title:"Authority",open:te,onToggle:()=>Y(Re=>!Re),children:[((Ve=e.authority.autonomous)==null?void 0:Ve.length)>0&&l.jsxs("div",{className:"mb-2",children:[l.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--active-green)"},children:"Autonomous"}),e.authority.autonomous.map((Re,Ie)=>l.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",Re]},Ie))]}),((bt=e.authority.needsApproval)==null?void 0:bt.length)>0&&l.jsxs("div",{children:[l.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--idle-amber)"},children:"Needs Approval"}),e.authority.needsApproval.map((Re,Ie)=>l.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",Re]},Ie))]})]}),e&&R&&(()=>{const Re=R.filter(Ie=>Ie.roleA===e.id||Ie.roleB===e.id).filter(Ie=>Ie.familiarity>0).sort((Ie,_t)=>_t.familiarity-Ie.familiarity);return Re.length===0?null:l.jsx(xu,{title:`Relationships (${Re.length})`,open:se,onToggle:()=>J(Ie=>!Ie),children:l.jsx("div",{className:"space-y-1.5",children:Re.map((Ie,_t)=>{const Bt=Ie.roleA===e.id?Ie.roleB:Ie.roleA,Ot=n.find(P=>P.id===Bt),fn=Ie.familiarity>=80?"Best Partner":Ie.familiarity>=50?"Friend":Ie.familiarity>=20?"Colleague":"Acquaintance",wn=Ie.familiarity>=80?"#4CAF50":Ie.familiarity>=50?"#2196F3":Ie.familiarity>=20?"#FF9800":"#9E9E9E";return l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs w-20 truncate",style:{color:jh[Bt]??"var(--terminal-text-secondary)"},children:(Ot==null?void 0:Ot.name)??Bt}),l.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-white/10",children:l.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Ie.familiarity}%`,background:wn}})}),l.jsx("span",{className:"text-[10px] w-16 text-right",style:{color:"var(--terminal-text-muted)"},children:fn})]},_t)})})})})(),e.journal&&l.jsx(xu,{title:`Journal (${(e.journal.match(/### /g)??[]).length})`,open:Z,onToggle:()=>A(Re=>!Re),children:l.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:[l.jsx(As,{content:e.journal.slice(0,3e3)}),e.journal.length>3e3&&l.jsx("div",{className:"italic mt-2",style:{color:"var(--terminal-text-muted)"},children:"... (truncated)"})]})})]}),l.jsx(FC,{role:e,appearance:B}),o&&l.jsx("div",{className:"px-4 pb-4 mt-auto shrink-0",children:l.jsx("button",{onClick:()=>{o(e.id,e.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 FC({role:e,appearance:n}){const[a,i]=v.useState("idle"),[o,u]=v.useState(""),[d,h]=v.useState(!1),[m,f]=v.useState(null),[x,g]=v.useState(!1),[w,b]=v.useState(!1),[j,k]=v.useState(null);v.useEffect(()=>{wr.getCharacterVersion(e.id).then(E=>f((E==null?void 0:E.version)??null)).catch(()=>f(null)),ge.getPreferences().then(E=>k(E.instanceId??null)).catch(()=>{})},[e.id]);const N=async()=>{var E,B;if(!d){h(!0);return}i("publishing");try{let R=null;try{R=await ge.exportSkills(e.id)}catch{}const $={roleId:e.id,persona:e.persona??"",authority:e.authority??{autonomous:[],needsApproval:[]},level:e.level,tagline:((E=(e.persona??"").split(/[.\n]/)[0])==null?void 0:E.trim().slice(0,80))||e.name,chatStyle:"Professional and focused",skills:R??[],resume:{summary:((B=e.persona)==null?void 0:B.split(`
|
|
81
|
-
`)[0])??"",strengths:[],specialties:[],experience:""},author:{id:"tycono",name:"Tycono"},tags:[e.level,e.id],price:"free",installs:0,rating:0,featured:!1,randomActive:!0,randomPersonality:""};n&&($.appearance=n);let _="1.0.0";try{const L=await wr.getCharacterVersion(e.id);if(L!=null&&L.version){const U=L.version.split(".").map(Number);U[2]=(U[2]??0)+1,_=U.join(".")}}catch{}await wr.publishCharacter({id:e.id,name:e.name||e.id,version:_,data:$,publisherId:j??void 0}),i("done"),u(`Published v${_}`),f(_),h(!1)}catch(R){i("error"),u(R instanceof Error?R.message:"Failed"),h(!1)}},C=async()=>{b(!0);try{await wr.deleteCharacter(e.id,j??void 0),f(null),i("idle"),u(""),g(!1)}catch{u("Delete failed")}b(!1)};return l.jsx("div",{className:"px-4 pb-2 shrink-0",children:l.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:l.jsxs("div",{className:"px-3 py-2.5 flex items-center justify-between gap-2",style:{background:"var(--hud-bg-alt)"},children:[l.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[l.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider shrink-0",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Cloud Store"}),m&&l.jsxs("span",{className:"text-[9px] px-1.5 py-0.5 rounded shrink-0",style:{background:"rgba(34,197,94,0.1)",color:"rgba(34,197,94,0.6)",border:"1px solid rgba(34,197,94,0.2)"},children:["v",m]})]}),l.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[a==="done"?l.jsxs(l.Fragment,{children:[l.jsx("a",{href:"https://tycono.ai/store.html",target:"_blank",rel:"noopener noreferrer",className:"text-[10px] hover:underline",style:{color:"var(--terminal-text-muted)"},onClick:E=>E.stopPropagation(),children:"View on Store ↗"}),l.jsx("span",{className:"text-[10px] font-semibold",style:{color:"var(--active-green)"},children:o})]}):a==="error"?l.jsx("span",{className:"text-[10px] font-semibold",style:{color:"#ef4444"},children:o}):l.jsx("button",{onClick:N,disabled:a==="publishing",className:"text-[10px] px-2.5 py-1 rounded font-semibold cursor-pointer transition-colors disabled:opacity-50",style:{background:d?"rgba(59,130,246,0.3)":"rgba(59,130,246,0.15)",color:"#60a5fa",border:d?"1px solid rgba(59,130,246,0.5)":"1px solid transparent"},children:a==="publishing"?"Publishing...":d?"Confirm?":m?"Update":"Publish"}),m&&!x&&l.jsx("button",{onClick:()=>g(!0),className:"text-[10px] px-1.5 py-1 rounded cursor-pointer transition-colors",style:{color:"rgba(239,68,68,0.4)"},title:"Remove from store",children:"✕"}),x&&l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:C,disabled:w,className:"text-[10px] px-2 py-1 rounded font-semibold cursor-pointer disabled:opacity-50",style:{background:"rgba(239,68,68,0.2)",color:"#ef4444",border:"1px solid rgba(239,68,68,0.3)"},children:w?"...":"Delete"}),l.jsx("button",{onClick:()=>g(!1),className:"text-[10px] px-1.5 py-1 rounded cursor-pointer",style:{color:"var(--terminal-text-muted)"},children:"No"})]})]})]})})})}function MC({icon:e,roleId:n,roleName:a,color:i,text:o}){const u=!!o;return l.jsx("div",{className:"relative",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsxs("div",{className:"shrink-0",children:[l.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:e}),l.jsx("div",{className:"text-[9px] font-bold text-center mt-0.5 uppercase tracking-wide",style:{color:i},children:n})]}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsxs("div",{className:"relative",children:[l.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`}}),l.jsxs("div",{className:"rounded-xl rounded-tl-sm p-4 border",style:{background:`${i}08`,borderColor:`${i}22`},children:[l.jsx("div",{className:"text-[10px] font-semibold mb-1.5 uppercase tracking-wider",style:{color:i},children:a}),u?l.jsx("div",{className:"text-sm leading-relaxed",style:{color:"var(--terminal-text)"},children:l.jsx(As,{content:o})}):l.jsx("div",{className:"text-sm italic",style:{color:"var(--terminal-text-muted)"},children:"No recent activity."})]})]})})]})})}function xu({title:e,open:n,onToggle:a,children:i}){return l.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:[l.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:[l.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:e}),l.jsx("span",{className:"text-[10px] transition-transform",style:{color:"var(--terminal-text-muted)",transform:n?"rotate(0deg)":"rotate(-90deg)"},children:"▼"})]}),n&&l.jsx("div",{className:"px-3 pb-3 pt-2",style:{borderTop:"1px solid var(--terminal-border)"},children:i})]})}function Dg({onSend:e,disabled:n,placeholder:a,color:i}){const[o,u]=v.useState(""),d=v.useRef(!1),h=()=>{const m=o.trim();!m||n||(e(m),u(""))};return l.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[l.jsx("input",{type:"text",value:o,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&!d.current&&(m.preventDefault(),h())},onCompositionStart:()=>{d.current=!0},onCompositionEnd:()=>{d.current=!1},placeholder:n?"Waiting...":a,disabled:n,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)"}}),l.jsx("button",{onClick:h,disabled:n||!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:n||!o.trim()?"#666":i},children:l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M22 2L11 13"}),l.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})}function Sh({label:e,value:n}){return l.jsxs("div",{className:"flex justify-between py-1.5 text-xs",style:{borderBottom:"1px solid var(--terminal-border)"},children:[l.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:e}),l.jsx("span",{className:"font-semibold",style:{color:"var(--terminal-text)"},children:n})]})}function RC(e,n){var a,i=1;e==null&&(e=0),n==null&&(n=0);function o(){var u,d=a.length,h,m=0,f=0;for(u=0;u<d;++u)h=a[u],m+=h.x,f+=h.y;for(m=(m/d-e)*i,f=(f/d-n)*i,u=0;u<d;++u)h=a[u],h.x-=m,h.y-=f}return o.initialize=function(u){a=u},o.x=function(u){return arguments.length?(e=+u,o):e},o.y=function(u){return arguments.length?(n=+u,o):n},o.strength=function(u){return arguments.length?(i=+u,o):i},o}function zC(e){const n=+this._x.call(null,e),a=+this._y.call(null,e);return Hb(this.cover(n,a),n,a,e)}function Hb(e,n,a,i){if(isNaN(n)||isNaN(a))return e;var o,u=e._root,d={data:i},h=e._x0,m=e._y0,f=e._x1,x=e._y1,g,w,b,j,k,N,C,E;if(!u)return e._root=d,e;for(;u.length;)if((k=n>=(g=(h+f)/2))?h=g:f=g,(N=a>=(w=(m+x)/2))?m=w:x=w,o=u,!(u=u[C=N<<1|k]))return o[C]=d,e;if(b=+e._x.call(null,u.data),j=+e._y.call(null,u.data),n===b&&a===j)return d.next=u,o?o[C]=d:e._root=d,e;do o=o?o[C]=new Array(4):e._root=new Array(4),(k=n>=(g=(h+f)/2))?h=g:f=g,(N=a>=(w=(m+x)/2))?m=w:x=w;while((C=N<<1|k)===(E=(j>=w)<<1|b>=g));return o[E]=u,o[C]=d,e}function _C(e){var n,a,i=e.length,o,u,d=new Array(i),h=new Array(i),m=1/0,f=1/0,x=-1/0,g=-1/0;for(a=0;a<i;++a)isNaN(o=+this._x.call(null,n=e[a]))||isNaN(u=+this._y.call(null,n))||(d[a]=o,h[a]=u,o<m&&(m=o),o>x&&(x=o),u<f&&(f=u),u>g&&(g=u));if(m>x||f>g)return this;for(this.cover(m,f).cover(x,g),a=0;a<i;++a)Hb(this,d[a],h[a],e[a]);return this}function BC(e,n){if(isNaN(e=+e)||isNaN(n=+n))return this;var a=this._x0,i=this._y0,o=this._x1,u=this._y1;if(isNaN(a))o=(a=Math.floor(e))+1,u=(i=Math.floor(n))+1;else{for(var d=o-a||1,h=this._root,m,f;a>e||e>=o||i>n||n>=u;)switch(f=(n<i)<<1|e<a,m=new Array(4),m[f]=h,h=m,d*=2,f){case 0:o=a+d,u=i+d;break;case 1:a=o-d,u=i+d;break;case 2:o=a+d,i=u-d;break;case 3:a=o-d,i=u-d;break}this._root&&this._root.length&&(this._root=h)}return this._x0=a,this._y0=i,this._x1=o,this._y1=u,this}function OC(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function $C(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function or(e,n,a,i,o){this.node=e,this.x0=n,this.y0=a,this.x1=i,this.y1=o}function LC(e,n,a){var i,o=this._x0,u=this._y0,d,h,m,f,x=this._x1,g=this._y1,w=[],b=this._root,j,k;for(b&&w.push(new or(b,o,u,x,g)),a==null?a=1/0:(o=e-a,u=n-a,x=e+a,g=n+a,a*=a);j=w.pop();)if(!(!(b=j.node)||(d=j.x0)>x||(h=j.y0)>g||(m=j.x1)<o||(f=j.y1)<u))if(b.length){var N=(d+m)/2,C=(h+f)/2;w.push(new or(b[3],N,C,m,f),new or(b[2],d,C,N,f),new or(b[1],N,h,m,C),new or(b[0],d,h,N,C)),(k=(n>=C)<<1|e>=N)&&(j=w[w.length-1],w[w.length-1]=w[w.length-1-k],w[w.length-1-k]=j)}else{var E=e-+this._x.call(null,b.data),B=n-+this._y.call(null,b.data),R=E*E+B*B;if(R<a){var $=Math.sqrt(a=R);o=e-$,u=n-$,x=e+$,g=n+$,i=b.data}}return i}function IC(e){if(isNaN(x=+this._x.call(null,e))||isNaN(g=+this._y.call(null,e)))return this;var n,a=this._root,i,o,u,d=this._x0,h=this._y0,m=this._x1,f=this._y1,x,g,w,b,j,k,N,C;if(!a)return this;if(a.length)for(;;){if((j=x>=(w=(d+m)/2))?d=w:m=w,(k=g>=(b=(h+f)/2))?h=b:f=b,n=a,!(a=a[N=k<<1|j]))return this;if(!a.length)break;(n[N+1&3]||n[N+2&3]||n[N+3&3])&&(i=n,C=N)}for(;a.data!==e;)if(o=a,!(a=a.next))return this;return(u=a.next)&&delete a.next,o?(u?o.next=u:delete o.next,this):n?(u?n[N]=u:delete n[N],(a=n[0]||n[1]||n[2]||n[3])&&a===(n[3]||n[2]||n[1]||n[0])&&!a.length&&(i?i[C]=a:this._root=a),this):(this._root=u,this)}function HC(e){for(var n=0,a=e.length;n<a;++n)this.remove(e[n]);return this}function UC(){return this._root}function qC(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function YC(e){var n=[],a,i=this._root,o,u,d,h,m;for(i&&n.push(new or(i,this._x0,this._y0,this._x1,this._y1));a=n.pop();)if(!e(i=a.node,u=a.x0,d=a.y0,h=a.x1,m=a.y1)&&i.length){var f=(u+h)/2,x=(d+m)/2;(o=i[3])&&n.push(new or(o,f,x,h,m)),(o=i[2])&&n.push(new or(o,u,x,f,m)),(o=i[1])&&n.push(new or(o,f,d,h,x)),(o=i[0])&&n.push(new or(o,u,d,f,x))}return this}function XC(e){var n=[],a=[],i;for(this._root&&n.push(new or(this._root,this._x0,this._y0,this._x1,this._y1));i=n.pop();){var o=i.node;if(o.length){var u,d=i.x0,h=i.y0,m=i.x1,f=i.y1,x=(d+m)/2,g=(h+f)/2;(u=o[0])&&n.push(new or(u,d,h,x,g)),(u=o[1])&&n.push(new or(u,x,h,m,g)),(u=o[2])&&n.push(new or(u,d,g,x,f)),(u=o[3])&&n.push(new or(u,x,g,m,f))}a.push(i)}for(;i=a.pop();)e(i.node,i.x0,i.y0,i.x1,i.y1);return this}function WC(e){return e[0]}function GC(e){return arguments.length?(this._x=e,this):this._x}function VC(e){return e[1]}function KC(e){return arguments.length?(this._y=e,this):this._y}function Xm(e,n,a){var i=new Wm(n??WC,a??VC,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function Wm(e,n,a,i,o,u){this._x=e,this._y=n,this._x0=a,this._y0=i,this._x1=o,this._y1=u,this._root=void 0}function Tg(e){for(var n={data:e.data},a=n;e=e.next;)a=a.next={data:e.data};return n}var cr=Xm.prototype=Wm.prototype;cr.copy=function(){var e=new Wm(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root,a,i;if(!n)return e;if(!n.length)return e._root=Tg(n),e;for(a=[{source:n,target:e._root=new Array(4)}];n=a.pop();)for(var o=0;o<4;++o)(i=n.source[o])&&(i.length?a.push({source:i,target:n.target[o]=new Array(4)}):n.target[o]=Tg(i));return e};cr.add=zC;cr.addAll=_C;cr.cover=BC;cr.data=OC;cr.extent=$C;cr.find=LC;cr.remove=IC;cr.removeAll=HC;cr.root=UC;cr.size=qC;cr.visit=YC;cr.visitAfter=XC;cr.x=GC;cr.y=KC;function Si(e){return function(){return e}}function Hl(e){return(e()-.5)*1e-6}function QC(e){return e.x+e.vx}function PC(e){return e.y+e.vy}function ZC(e){var n,a,i,o=1,u=1;typeof e!="function"&&(e=Si(e==null?1:+e));function d(){for(var f,x=n.length,g,w,b,j,k,N,C=0;C<u;++C)for(g=Xm(n,QC,PC).visitAfter(h),f=0;f<x;++f)w=n[f],k=a[w.index],N=k*k,b=w.x+w.vx,j=w.y+w.vy,g.visit(E);function E(B,R,$,_,L){var U=B.data,Q=B.r,D=k+Q;if(U){if(U.index>w.index){var I=b-U.x-U.vx,H=j-U.y-U.vy,q=I*I+H*H;q<D*D&&(I===0&&(I=Hl(i),q+=I*I),H===0&&(H=Hl(i),q+=H*H),q=(D-(q=Math.sqrt(q)))/q*o,w.vx+=(I*=q)*(D=(Q*=Q)/(N+Q)),w.vy+=(H*=q)*D,U.vx-=I*(D=1-D),U.vy-=H*D)}return}return R>b+D||_<b-D||$>j+D||L<j-D}}function h(f){if(f.data)return f.r=a[f.data.index];for(var x=f.r=0;x<4;++x)f[x]&&f[x].r>f.r&&(f.r=f[x].r)}function m(){if(n){var f,x=n.length,g;for(a=new Array(x),f=0;f<x;++f)g=n[f],a[g.index]=+e(g,f,n)}}return d.initialize=function(f,x){n=f,i=x,m()},d.iterations=function(f){return arguments.length?(u=+f,d):u},d.strength=function(f){return arguments.length?(o=+f,d):o},d.radius=function(f){return arguments.length?(e=typeof f=="function"?f:Si(+f),m(),d):e},d}function JC(e){return e.index}function Fg(e,n){var a=e.get(n);if(!a)throw new Error("node not found: "+n);return a}function eN(e){var n=JC,a=g,i,o=Si(30),u,d,h,m,f,x=1;e==null&&(e=[]);function g(N){return 1/Math.min(h[N.source.index],h[N.target.index])}function w(N){for(var C=0,E=e.length;C<x;++C)for(var B=0,R,$,_,L,U,Q,D;B<E;++B)R=e[B],$=R.source,_=R.target,L=_.x+_.vx-$.x-$.vx||Hl(f),U=_.y+_.vy-$.y-$.vy||Hl(f),Q=Math.sqrt(L*L+U*U),Q=(Q-u[B])/Q*N*i[B],L*=Q,U*=Q,_.vx-=L*(D=m[B]),_.vy-=U*D,$.vx+=L*(D=1-D),$.vy+=U*D}function b(){if(d){var N,C=d.length,E=e.length,B=new Map(d.map(($,_)=>[n($,_,d),$])),R;for(N=0,h=new Array(C);N<E;++N)R=e[N],R.index=N,typeof R.source!="object"&&(R.source=Fg(B,R.source)),typeof R.target!="object"&&(R.target=Fg(B,R.target)),h[R.source.index]=(h[R.source.index]||0)+1,h[R.target.index]=(h[R.target.index]||0)+1;for(N=0,m=new Array(E);N<E;++N)R=e[N],m[N]=h[R.source.index]/(h[R.source.index]+h[R.target.index]);i=new Array(E),j(),u=new Array(E),k()}}function j(){if(d)for(var N=0,C=e.length;N<C;++N)i[N]=+a(e[N],N,e)}function k(){if(d)for(var N=0,C=e.length;N<C;++N)u[N]=+o(e[N],N,e)}return w.initialize=function(N,C){d=N,f=C,b()},w.links=function(N){return arguments.length?(e=N,b(),w):e},w.id=function(N){return arguments.length?(n=N,w):n},w.iterations=function(N){return arguments.length?(x=+N,w):x},w.strength=function(N){return arguments.length?(a=typeof N=="function"?N:Si(+N),j(),w):a},w.distance=function(N){return arguments.length?(o=typeof N=="function"?N:Si(+N),k(),w):o},w}var tN={value:()=>{}};function Ub(){for(var e=0,n=arguments.length,a={},i;e<n;++e){if(!(i=arguments[e]+"")||i in a||/[\s.]/.test(i))throw new Error("illegal type: "+i);a[i]=[]}return new Fu(a)}function Fu(e){this._=e}function nN(e,n){return e.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&&!n.hasOwnProperty(a))throw new Error("unknown type: "+a);return{type:a,name:i}})}Fu.prototype=Ub.prototype={constructor:Fu,on:function(e,n){var a=this._,i=nN(e+"",a),o,u=-1,d=i.length;if(arguments.length<2){for(;++u<d;)if((o=(e=i[u]).type)&&(o=rN(a[o],e.name)))return o;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++u<d;)if(o=(e=i[u]).type)a[o]=Mg(a[o],e.name,n);else if(n==null)for(o in a)a[o]=Mg(a[o],e.name,null);return this},copy:function(){var e={},n=this._;for(var a in n)e[a]=n[a].slice();return new Fu(e)},call:function(e,n){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(e))throw new Error("unknown type: "+e);for(u=this._[e],i=0,o=u.length;i<o;++i)u[i].value.apply(n,a)},apply:function(e,n,a){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],o=0,u=i.length;o<u;++o)i[o].value.apply(n,a)}};function rN(e,n){for(var a=0,i=e.length,o;a<i;++a)if((o=e[a]).name===n)return o.value}function Mg(e,n,a){for(var i=0,o=e.length;i<o;++i)if(e[i].name===n){e[i]=tN,e=e.slice(0,i).concat(e.slice(i+1));break}return a!=null&&e.push({name:n,value:a}),e}var ks=0,Mo=0,Ao=0,qb=1e3,Iu,Ro,Hu=0,Ai=0,Pu=0,Uo=typeof performance=="object"&&performance.now?performance:Date,Yb=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xb(){return Ai||(Yb(aN),Ai=Uo.now()+Pu)}function aN(){Ai=0}function lm(){this._call=this._time=this._next=null}lm.prototype=Wb.prototype={constructor:lm,restart:function(e,n,a){if(typeof e!="function")throw new TypeError("callback is not a function");a=(a==null?Xb():+a)+(n==null?0:+n),!this._next&&Ro!==this&&(Ro?Ro._next=this:Iu=this,Ro=this),this._call=e,this._time=a,im()},stop:function(){this._call&&(this._call=null,this._time=1/0,im())}};function Wb(e,n,a){var i=new lm;return i.restart(e,n,a),i}function lN(){Xb(),++ks;for(var e=Iu,n;e;)(n=Ai-e._time)>=0&&e._call.call(void 0,n),e=e._next;--ks}function Rg(){Ai=(Hu=Uo.now())+Pu,ks=Mo=0;try{lN()}finally{ks=0,sN(),Ai=0}}function iN(){var e=Uo.now(),n=e-Hu;n>qb&&(Pu-=n,Hu=e)}function sN(){for(var e,n=Iu,a,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(a=n._next,n._next=null,n=e?e._next=a:Iu=a);Ro=e,im(i)}function im(e){if(!ks){Mo&&(Mo=clearTimeout(Mo));var n=e-Ai;n>24?(e<1/0&&(Mo=setTimeout(Rg,e-Uo.now()-Pu)),Ao&&(Ao=clearInterval(Ao))):(Ao||(Hu=Uo.now(),Ao=setInterval(iN,qb)),ks=1,Yb(Rg))}}const oN=1664525,cN=1013904223,zg=4294967296;function uN(){let e=1;return()=>(e=(oN*e+cN)%zg)/zg}function dN(e){return e.x}function fN(e){return e.y}var hN=10,mN=Math.PI*(3-Math.sqrt(5));function pN(e){var n,a=1,i=.001,o=1-Math.pow(i,1/300),u=0,d=.6,h=new Map,m=Wb(g),f=Ub("tick","end"),x=uN();e==null&&(e=[]);function g(){w(),f.call("tick",n),a<i&&(m.stop(),f.call("end",n))}function w(k){var N,C=e.length,E;k===void 0&&(k=1);for(var B=0;B<k;++B)for(a+=(u-a)*o,h.forEach(function(R){R(a)}),N=0;N<C;++N)E=e[N],E.fx==null?E.x+=E.vx*=d:(E.x=E.fx,E.vx=0),E.fy==null?E.y+=E.vy*=d:(E.y=E.fy,E.vy=0);return n}function b(){for(var k=0,N=e.length,C;k<N;++k){if(C=e[k],C.index=k,C.fx!=null&&(C.x=C.fx),C.fy!=null&&(C.y=C.fy),isNaN(C.x)||isNaN(C.y)){var E=hN*Math.sqrt(.5+k),B=k*mN;C.x=E*Math.cos(B),C.y=E*Math.sin(B)}(isNaN(C.vx)||isNaN(C.vy))&&(C.vx=C.vy=0)}}function j(k){return k.initialize&&k.initialize(e,x),k}return b(),n={tick:w,restart:function(){return m.restart(g),n},stop:function(){return m.stop(),n},nodes:function(k){return arguments.length?(e=k,b(),h.forEach(j),n):e},alpha:function(k){return arguments.length?(a=+k,n):a},alphaMin:function(k){return arguments.length?(i=+k,n):i},alphaDecay:function(k){return arguments.length?(o=+k,n):+o},alphaTarget:function(k){return arguments.length?(u=+k,n):u},velocityDecay:function(k){return arguments.length?(d=1-k,n):1-d},randomSource:function(k){return arguments.length?(x=k,h.forEach(j),n):x},force:function(k,N){return arguments.length>1?(N==null?h.delete(k):h.set(k,j(N)),n):h.get(k)},find:function(k,N,C){var E=0,B=e.length,R,$,_,L,U;for(C==null?C=1/0:C*=C,E=0;E<B;++E)L=e[E],R=k-L.x,$=N-L.y,_=R*R+$*$,_<C&&(U=L,C=_);return U},on:function(k,N){return arguments.length>1?(f.on(k,N),n):f.on(k)}}}function xN(){var e,n,a,i,o=Si(-30),u,d=1,h=1/0,m=.81;function f(b){var j,k=e.length,N=Xm(e,dN,fN).visitAfter(g);for(i=b,j=0;j<k;++j)n=e[j],N.visit(w)}function x(){if(e){var b,j=e.length,k;for(u=new Array(j),b=0;b<j;++b)k=e[b],u[k.index]=+o(k,b,e)}}function g(b){var j=0,k,N,C=0,E,B,R;if(b.length){for(E=B=R=0;R<4;++R)(k=b[R])&&(N=Math.abs(k.value))&&(j+=k.value,C+=N,E+=N*k.x,B+=N*k.y);b.x=E/C,b.y=B/C}else{k=b,k.x=k.data.x,k.y=k.data.y;do j+=u[k.data.index];while(k=k.next)}b.value=j}function w(b,j,k,N){if(!b.value)return!0;var C=b.x-n.x,E=b.y-n.y,B=N-j,R=C*C+E*E;if(B*B/m<R)return R<h&&(C===0&&(C=Hl(a),R+=C*C),E===0&&(E=Hl(a),R+=E*E),R<d&&(R=Math.sqrt(d*R)),n.vx+=C*b.value*i/R,n.vy+=E*b.value*i/R),!0;if(b.length||R>=h)return;(b.data!==n||b.next)&&(C===0&&(C=Hl(a),R+=C*C),E===0&&(E=Hl(a),R+=E*E),R<d&&(R=Math.sqrt(d*R)));do b.data!==n&&(B=u[b.data.index]*i/R,n.vx+=C*B,n.vy+=E*B);while(b=b.next)}return f.initialize=function(b,j){e=b,a=j,x()},f.strength=function(b){return arguments.length?(o=typeof b=="function"?b:Si(+b),x(),f):o},f.distanceMin=function(b){return arguments.length?(d=b*b,f):Math.sqrt(d)},f.distanceMax=function(b){return arguments.length?(h=b*b,f):Math.sqrt(h)},f.theta=function(b){return arguments.length?(m=b*b,f):Math.sqrt(m)},f}function al(e){return Array.isArray?Array.isArray(e):Kb(e)==="[object Array]"}function gN(e){if(typeof e=="string")return e;let n=e+"";return n=="0"&&1/e==-1/0?"-0":n}function yN(e){return e==null?"":gN(e)}function Ca(e){return typeof e=="string"}function Gb(e){return typeof e=="number"}function bN(e){return e===!0||e===!1||vN(e)&&Kb(e)=="[object Boolean]"}function Vb(e){return typeof e=="object"}function vN(e){return Vb(e)&&e!==null}function zr(e){return e!=null}function Ch(e){return!e.trim().length}function Kb(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const wN="Incorrect 'index' type",kN=e=>`Invalid value for key ${e}`,jN=e=>`Pattern length exceeds max of ${e}.`,SN=e=>`Missing ${e} property in key`,CN=e=>`Property 'weight' in key '${e}' must be a positive integer`,_g=Object.prototype.hasOwnProperty;class NN{constructor(n){this._keys=[],this._keyMap={};let a=0;n.forEach(i=>{let o=Qb(i);this._keys.push(o),this._keyMap[o.id]=o,a+=o.weight}),this._keys.forEach(i=>{i.weight/=a})}get(n){return this._keyMap[n]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Qb(e){let n=null,a=null,i=null,o=1,u=null;if(Ca(e)||al(e))i=e,n=Bg(e),a=sm(e);else{if(!_g.call(e,"name"))throw new Error(SN("name"));const d=e.name;if(i=d,_g.call(e,"weight")&&(o=e.weight,o<=0))throw new Error(CN(d));n=Bg(d),a=sm(d),u=e.getFn}return{path:n,id:a,weight:o,src:i,getFn:u}}function Bg(e){return al(e)?e:e.split(".")}function sm(e){return al(e)?e.join("."):e}function EN(e,n){let a=[],i=!1;const o=(u,d,h)=>{if(zr(u))if(!d[h])a.push(u);else{let m=d[h];const f=u[m];if(!zr(f))return;if(h===d.length-1&&(Ca(f)||Gb(f)||bN(f)))a.push(yN(f));else if(al(f)){i=!0;for(let x=0,g=f.length;x<g;x+=1)o(f[x],d,h+1)}else d.length&&o(f,d,h+1)}};return o(e,Ca(n)?n.split("."):n,0),i?a:a[0]}const AN={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},DN={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,n)=>e.score===n.score?e.idx<n.idx?-1:1:e.score<n.score?-1:1},TN={location:0,threshold:.6,distance:100},FN={useExtendedSearch:!1,getFn:EN,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var ft={...DN,...AN,...TN,...FN};const MN=/[^ ]+/g;function RN(e=1,n=3){const a=new Map,i=Math.pow(10,n);return{get(o){const u=o.match(MN).length;if(a.has(u))return a.get(u);const d=1/Math.pow(u,.5*e),h=parseFloat(Math.round(d*i)/i);return a.set(u,h),h},clear(){a.clear()}}}class Gm{constructor({getFn:n=ft.getFn,fieldNormWeight:a=ft.fieldNormWeight}={}){this.norm=RN(a,3),this.getFn=n,this.isCreated=!1,this.setIndexRecords()}setSources(n=[]){this.docs=n}setIndexRecords(n=[]){this.records=n}setKeys(n=[]){this.keys=n,this._keysMap={},n.forEach((a,i)=>{this._keysMap[a.id]=i})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,Ca(this.docs[0])?this.docs.forEach((n,a)=>{this._addString(n,a)}):this.docs.forEach((n,a)=>{this._addObject(n,a)}),this.norm.clear())}add(n){const a=this.size();Ca(n)?this._addString(n,a):this._addObject(n,a)}removeAt(n){this.records.splice(n,1);for(let a=n,i=this.size();a<i;a+=1)this.records[a].i-=1}getValueForItemAtKeyId(n,a){return n[this._keysMap[a]]}size(){return this.records.length}_addString(n,a){if(!zr(n)||Ch(n))return;let i={v:n,i:a,n:this.norm.get(n)};this.records.push(i)}_addObject(n,a){let i={i:a,$:{}};this.keys.forEach((o,u)=>{let d=o.getFn?o.getFn(n):this.getFn(n,o.path);if(zr(d)){if(al(d)){let h=[];const m=[{nestedArrIndex:-1,value:d}];for(;m.length;){const{nestedArrIndex:f,value:x}=m.pop();if(zr(x))if(Ca(x)&&!Ch(x)){let g={v:x,i:f,n:this.norm.get(x)};h.push(g)}else al(x)&&x.forEach((g,w)=>{m.push({nestedArrIndex:w,value:g})})}i.$[u]=h}else if(Ca(d)&&!Ch(d)){let h={v:d,n:this.norm.get(d)};i.$[u]=h}}}),this.records.push(i)}toJSON(){return{keys:this.keys,records:this.records}}}function Pb(e,n,{getFn:a=ft.getFn,fieldNormWeight:i=ft.fieldNormWeight}={}){const o=new Gm({getFn:a,fieldNormWeight:i});return o.setKeys(e.map(Qb)),o.setSources(n),o.create(),o}function zN(e,{getFn:n=ft.getFn,fieldNormWeight:a=ft.fieldNormWeight}={}){const{keys:i,records:o}=e,u=new Gm({getFn:n,fieldNormWeight:a});return u.setKeys(i),u.setIndexRecords(o),u}function gu(e,{errors:n=0,currentLocation:a=0,expectedLocation:i=0,distance:o=ft.distance,ignoreLocation:u=ft.ignoreLocation}={}){const d=n/e.length;if(u)return d;const h=Math.abs(i-a);return o?d+h/o:h?1:d}function _N(e=[],n=ft.minMatchCharLength){let a=[],i=-1,o=-1,u=0;for(let d=e.length;u<d;u+=1){let h=e[u];h&&i===-1?i=u:!h&&i!==-1&&(o=u-1,o-i+1>=n&&a.push([i,o]),i=-1)}return e[u-1]&&u-i>=n&&a.push([i,u-1]),a}const ji=32;function BN(e,n,a,{location:i=ft.location,distance:o=ft.distance,threshold:u=ft.threshold,findAllMatches:d=ft.findAllMatches,minMatchCharLength:h=ft.minMatchCharLength,includeMatches:m=ft.includeMatches,ignoreLocation:f=ft.ignoreLocation}={}){if(n.length>ji)throw new Error(jN(ji));const x=n.length,g=e.length,w=Math.max(0,Math.min(i,g));let b=u,j=w;const k=h>1||m,N=k?Array(g):[];let C;for(;(C=e.indexOf(n,j))>-1;){let L=gu(n,{currentLocation:C,expectedLocation:w,distance:o,ignoreLocation:f});if(b=Math.min(L,b),j=C+x,k){let U=0;for(;U<x;)N[C+U]=1,U+=1}}j=-1;let E=[],B=1,R=x+g;const $=1<<x-1;for(let L=0;L<x;L+=1){let U=0,Q=R;for(;U<Q;)gu(n,{errors:L,currentLocation:w+Q,expectedLocation:w,distance:o,ignoreLocation:f})<=b?U=Q:R=Q,Q=Math.floor((R-U)/2+U);R=Q;let D=Math.max(1,w-Q+1),I=d?g:Math.min(w+Q,g)+x,H=Array(I+2);H[I+1]=(1<<L)-1;for(let ue=I;ue>=D;ue-=1){let te=ue-1,Y=a[e.charAt(te)];if(k&&(N[te]=+!!Y),H[ue]=(H[ue+1]<<1|1)&Y,L&&(H[ue]|=(E[ue+1]|E[ue])<<1|1|E[ue+1]),H[ue]&$&&(B=gu(n,{errors:L,currentLocation:te,expectedLocation:w,distance:o,ignoreLocation:f}),B<=b)){if(b=B,j=te,j<=w)break;D=Math.max(1,2*w-j)}}if(gu(n,{errors:L+1,currentLocation:w,expectedLocation:w,distance:o,ignoreLocation:f})>b)break;E=H}const _={isMatch:j>=0,score:Math.max(.001,B)};if(k){const L=_N(N,h);L.length?m&&(_.indices=L):_.isMatch=!1}return _}function ON(e){let n={};for(let a=0,i=e.length;a<i;a+=1){const o=e.charAt(a);n[o]=(n[o]||0)|1<<i-a-1}return n}const Uu=String.prototype.normalize?(e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"")):(e=>e);class Zb{constructor(n,{location:a=ft.location,threshold:i=ft.threshold,distance:o=ft.distance,includeMatches:u=ft.includeMatches,findAllMatches:d=ft.findAllMatches,minMatchCharLength:h=ft.minMatchCharLength,isCaseSensitive:m=ft.isCaseSensitive,ignoreDiacritics:f=ft.ignoreDiacritics,ignoreLocation:x=ft.ignoreLocation}={}){if(this.options={location:a,threshold:i,distance:o,includeMatches:u,findAllMatches:d,minMatchCharLength:h,isCaseSensitive:m,ignoreDiacritics:f,ignoreLocation:x},n=m?n:n.toLowerCase(),n=f?Uu(n):n,this.pattern=n,this.chunks=[],!this.pattern.length)return;const g=(b,j)=>{this.chunks.push({pattern:b,alphabet:ON(b),startIndex:j})},w=this.pattern.length;if(w>ji){let b=0;const j=w%ji,k=w-j;for(;b<k;)g(this.pattern.substr(b,ji),b),b+=ji;if(j){const N=w-ji;g(this.pattern.substr(N),N)}}else g(this.pattern,0)}searchIn(n){const{isCaseSensitive:a,ignoreDiacritics:i,includeMatches:o}=this.options;if(n=a?n:n.toLowerCase(),n=i?Uu(n):n,this.pattern===n){let k={isMatch:!0,score:0};return o&&(k.indices=[[0,n.length-1]]),k}const{location:u,distance:d,threshold:h,findAllMatches:m,minMatchCharLength:f,ignoreLocation:x}=this.options;let g=[],w=0,b=!1;this.chunks.forEach(({pattern:k,alphabet:N,startIndex:C})=>{const{isMatch:E,score:B,indices:R}=BN(n,k,N,{location:u+C,distance:d,threshold:h,findAllMatches:m,minMatchCharLength:f,includeMatches:o,ignoreLocation:x});E&&(b=!0),w+=B,E&&R&&(g=[...g,...R])});let j={isMatch:b,score:b?w/this.chunks.length:1};return b&&o&&(j.indices=g),j}}class Xl{constructor(n){this.pattern=n}static isMultiMatch(n){return Og(n,this.multiRegex)}static isSingleMatch(n){return Og(n,this.singleRegex)}search(){}}function Og(e,n){const a=e.match(n);return a?a[1]:null}class $N extends Xl{constructor(n){super(n)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(n){const a=n===this.pattern;return{isMatch:a,score:a?0:1,indices:[0,this.pattern.length-1]}}}class LN extends Xl{constructor(n){super(n)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(n){const i=n.indexOf(this.pattern)===-1;return{isMatch:i,score:i?0:1,indices:[0,n.length-1]}}}class IN extends Xl{constructor(n){super(n)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(n){const a=n.startsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[0,this.pattern.length-1]}}}class HN extends Xl{constructor(n){super(n)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(n){const a=!n.startsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[0,n.length-1]}}}class UN extends Xl{constructor(n){super(n)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(n){const a=n.endsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[n.length-this.pattern.length,n.length-1]}}}class qN extends Xl{constructor(n){super(n)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(n){const a=!n.endsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[0,n.length-1]}}}class Jb extends Xl{constructor(n,{location:a=ft.location,threshold:i=ft.threshold,distance:o=ft.distance,includeMatches:u=ft.includeMatches,findAllMatches:d=ft.findAllMatches,minMatchCharLength:h=ft.minMatchCharLength,isCaseSensitive:m=ft.isCaseSensitive,ignoreDiacritics:f=ft.ignoreDiacritics,ignoreLocation:x=ft.ignoreLocation}={}){super(n),this._bitapSearch=new Zb(n,{location:a,threshold:i,distance:o,includeMatches:u,findAllMatches:d,minMatchCharLength:h,isCaseSensitive:m,ignoreDiacritics:f,ignoreLocation:x})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(n){return this._bitapSearch.searchIn(n)}}class ev extends Xl{constructor(n){super(n)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(n){let a=0,i;const o=[],u=this.pattern.length;for(;(i=n.indexOf(this.pattern,a))>-1;)a=i+u,o.push([i,a-1]);const d=!!o.length;return{isMatch:d,score:d?0:1,indices:o}}}const om=[$N,ev,IN,HN,qN,UN,LN,Jb],$g=om.length,YN=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,XN="|";function WN(e,n={}){return e.split(XN).map(a=>{let i=a.trim().split(YN).filter(u=>u&&!!u.trim()),o=[];for(let u=0,d=i.length;u<d;u+=1){const h=i[u];let m=!1,f=-1;for(;!m&&++f<$g;){const x=om[f];let g=x.isMultiMatch(h);g&&(o.push(new x(g,n)),m=!0)}if(!m)for(f=-1;++f<$g;){const x=om[f];let g=x.isSingleMatch(h);if(g){o.push(new x(g,n));break}}}return o})}const GN=new Set([Jb.type,ev.type]);class VN{constructor(n,{isCaseSensitive:a=ft.isCaseSensitive,ignoreDiacritics:i=ft.ignoreDiacritics,includeMatches:o=ft.includeMatches,minMatchCharLength:u=ft.minMatchCharLength,ignoreLocation:d=ft.ignoreLocation,findAllMatches:h=ft.findAllMatches,location:m=ft.location,threshold:f=ft.threshold,distance:x=ft.distance}={}){this.query=null,this.options={isCaseSensitive:a,ignoreDiacritics:i,includeMatches:o,minMatchCharLength:u,findAllMatches:h,ignoreLocation:d,location:m,threshold:f,distance:x},n=a?n:n.toLowerCase(),n=i?Uu(n):n,this.pattern=n,this.query=WN(this.pattern,this.options)}static condition(n,a){return a.useExtendedSearch}searchIn(n){const a=this.query;if(!a)return{isMatch:!1,score:1};const{includeMatches:i,isCaseSensitive:o,ignoreDiacritics:u}=this.options;n=o?n:n.toLowerCase(),n=u?Uu(n):n;let d=0,h=[],m=0;for(let f=0,x=a.length;f<x;f+=1){const g=a[f];h.length=0,d=0;for(let w=0,b=g.length;w<b;w+=1){const j=g[w],{isMatch:k,indices:N,score:C}=j.search(n);if(k){if(d+=1,m+=C,i){const E=j.constructor.type;GN.has(E)?h=[...h,...N]:h.push(N)}}else{m=0,d=0,h.length=0;break}}if(d){let w={isMatch:!0,score:m/d};return i&&(w.indices=h),w}}return{isMatch:!1,score:1}}}const cm=[];function KN(...e){cm.push(...e)}function um(e,n){for(let a=0,i=cm.length;a<i;a+=1){let o=cm[a];if(o.condition(e,n))return new o(e,n)}return new Zb(e,n)}const qu={AND:"$and",OR:"$or"},dm={PATH:"$path",PATTERN:"$val"},fm=e=>!!(e[qu.AND]||e[qu.OR]),QN=e=>!!e[dm.PATH],PN=e=>!al(e)&&Vb(e)&&!fm(e),Lg=e=>({[qu.AND]:Object.keys(e).map(n=>({[n]:e[n]}))});function tv(e,n,{auto:a=!0}={}){const i=o=>{let u=Object.keys(o);const d=QN(o);if(!d&&u.length>1&&!fm(o))return i(Lg(o));if(PN(o)){const m=d?o[dm.PATH]:u[0],f=d?o[dm.PATTERN]:o[m];if(!Ca(f))throw new Error(kN(m));const x={keyId:sm(m),pattern:f};return a&&(x.searcher=um(f,n)),x}let h={children:[],operator:u[0]};return u.forEach(m=>{const f=o[m];al(f)&&f.forEach(x=>{h.children.push(i(x))})}),h};return fm(e)||(e=Lg(e)),i(e)}function ZN(e,{ignoreFieldNorm:n=ft.ignoreFieldNorm}){e.forEach(a=>{let i=1;a.matches.forEach(({key:o,norm:u,score:d})=>{const h=o?o.weight:null;i*=Math.pow(d===0&&h?Number.EPSILON:d,(h||1)*(n?1:u))}),a.score=i})}function JN(e,n){const a=e.matches;n.matches=[],zr(a)&&a.forEach(i=>{if(!zr(i.indices)||!i.indices.length)return;const{indices:o,value:u}=i;let d={indices:o,value:u};i.key&&(d.key=i.key.src),i.idx>-1&&(d.refIndex=i.idx),n.matches.push(d)})}function eE(e,n){n.score=e.score}function tE(e,n,{includeMatches:a=ft.includeMatches,includeScore:i=ft.includeScore}={}){const o=[];return a&&o.push(JN),i&&o.push(eE),e.map(u=>{const{idx:d}=u,h={item:n[d],refIndex:d};return o.length&&o.forEach(m=>{m(u,h)}),h})}class Ds{constructor(n,a={},i){this.options={...ft,...a},this.options.useExtendedSearch,this._keyStore=new NN(this.options.keys),this.setCollection(n,i)}setCollection(n,a){if(this._docs=n,a&&!(a instanceof Gm))throw new Error(wN);this._myIndex=a||Pb(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(n){zr(n)&&(this._docs.push(n),this._myIndex.add(n))}remove(n=()=>!1){const a=[];for(let i=0,o=this._docs.length;i<o;i+=1){const u=this._docs[i];n(u,i)&&(this.removeAt(i),i-=1,o-=1,a.push(u))}return a}removeAt(n){this._docs.splice(n,1),this._myIndex.removeAt(n)}getIndex(){return this._myIndex}search(n,{limit:a=-1}={}){const{includeMatches:i,includeScore:o,shouldSort:u,sortFn:d,ignoreFieldNorm:h}=this.options;let m=Ca(n)?Ca(this._docs[0])?this._searchStringList(n):this._searchObjectList(n):this._searchLogical(n);return ZN(m,{ignoreFieldNorm:h}),u&&m.sort(d),Gb(a)&&a>-1&&(m=m.slice(0,a)),tE(m,this._docs,{includeMatches:i,includeScore:o})}_searchStringList(n){const a=um(n,this.options),{records:i}=this._myIndex,o=[];return i.forEach(({v:u,i:d,n:h})=>{if(!zr(u))return;const{isMatch:m,score:f,indices:x}=a.searchIn(u);m&&o.push({item:u,idx:d,matches:[{score:f,value:u,norm:h,indices:x}]})}),o}_searchLogical(n){const a=tv(n,this.options),i=(h,m,f)=>{if(!h.children){const{keyId:g,searcher:w}=h,b=this._findMatches({key:this._keyStore.get(g),value:this._myIndex.getValueForItemAtKeyId(m,g),searcher:w});return b&&b.length?[{idx:f,item:m,matches:b}]:[]}const x=[];for(let g=0,w=h.children.length;g<w;g+=1){const b=h.children[g],j=i(b,m,f);if(j.length)x.push(...j);else if(h.operator===qu.AND)return[]}return x},o=this._myIndex.records,u={},d=[];return o.forEach(({$:h,i:m})=>{if(zr(h)){let f=i(a,h,m);f.length&&(u[m]||(u[m]={idx:m,item:h,matches:[]},d.push(u[m])),f.forEach(({matches:x})=>{u[m].matches.push(...x)}))}}),d}_searchObjectList(n){const a=um(n,this.options),{keys:i,records:o}=this._myIndex,u=[];return o.forEach(({$:d,i:h})=>{if(!zr(d))return;let m=[];i.forEach((f,x)=>{m.push(...this._findMatches({key:f,value:d[x],searcher:a}))}),m.length&&u.push({idx:h,item:d,matches:m})}),u}_findMatches({key:n,value:a,searcher:i}){if(!zr(a))return[];let o=[];if(al(a))a.forEach(({v:u,i:d,n:h})=>{if(!zr(u))return;const{isMatch:m,score:f,indices:x}=i.searchIn(u);m&&o.push({score:f,key:n,value:u,idx:d,norm:h,indices:x})});else{const{v:u,n:d}=a,{isMatch:h,score:m,indices:f}=i.searchIn(u);h&&o.push({score:m,key:n,value:u,norm:d,indices:f})}return o}}Ds.version="7.1.0";Ds.createIndex=Pb;Ds.parseIndex=zN;Ds.config=ft;Ds.parseQuery=tv;KN(VN);const ia={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 nE(e){return ia[e]??ia.general}function rE(e){return e>1600?"macro":e<800?"micro":"standard"}function aE(e){const n=new Map;for(const i of e){const o=i.category||"general";n.has(o)||n.set(o,[]),n.get(o).push(i)}const a=[];for(const[i,o]of n){let u=0,d=0;for(const m of o)u+=m.x??0,d+=m.y??0;const h=o.length;a.push({domain:i,count:h,centerX:u/h,centerY:d/h,nodes:o})}return a}function lE(e,n=60){if(!e)return"";const a=e.match(/^[^.!?]+[.!?]/),i=a?a[0]:e;return i.length>n?i.slice(0,n-2)+"..":i}function iE(e,n,a){const i=[...new Set(a.map(m=>m.category||"general"))],o=new Map,u=e/2,d=n/2,h=Math.min(e,n)*.3;return i.forEach((m,f)=>{const x=2*Math.PI*f/i.length-Math.PI/2;o.set(m,{x:u+h*Math.cos(x),y:d+h*Math.sin(x)})}),o}function sE(e,n=.12){let a;function i(o){for(const u of a){const d=e.get(u.category)||e.get("general");d&&u.x!==void 0&&u.y!==void 0&&(u.vx=(u.vx||0)+(d.x-u.x)*o*n,u.vy=(u.vy||0)+(d.y-u.y)*o*n)}}return i.initialize=function(o){a=o},i}function oE(e){return e.map(n=>{let a=0;for(const o of n.nodes){const u=(o.x??0)-n.centerX,d=(o.y??0)-n.centerY,h=Math.sqrt(u*u+d*d);h>a&&(a=h)}const i=Math.max(40,n.count*8);return{...n,radius:a+i}})}function cE(e,n,a,i){if(!e)return a;const o=new Set([e]),u=new Set;let d=new Set([e]);for(let h=0;h<i;h++){const m=new Set;for(const f of d)if(!u.has(f)){u.add(f);for(const x of n){const g=typeof x.source=="string"?x.source:x.source.id,w=typeof x.target=="string"?x.target:x.target.id;g===f&&!o.has(w)&&(o.add(w),m.add(w)),w===f&&!o.has(g)&&(o.add(g),m.add(g))}}d=m}return o}function uE({docs:e,onNodeClick:n,selectedDocId:a,matchedIds:i,localGraphMode:o,onLocalModeChange:u}){var J;const d=v.useRef(null),h=v.useRef(null),[m,f]=v.useState({width:600,height:400}),[x,g]=v.useState({nodes:[],links:[]}),[w,b]=v.useState(null),[j,k]=v.useState(null),[N,C]=v.useState({x:0,y:0}),[E,B]=v.useState({x:0,y:0,w:600,h:400}),R=v.useRef(!1),$=v.useRef({x:0,y:0,vx:0,vy:0}),_=v.useRef(null),L=v.useRef(null),U=v.useMemo(()=>rE(E.w),[E.w]),Q=v.useMemo(()=>aE(x.nodes),[x.nodes]),D=v.useMemo(()=>oE(Q),[Q]),I=v.useMemo(()=>{if(o==="global"||!a)return null;const Z=new Set(x.nodes.map(F=>F.id)),A=o==="1-hop"?1:2;return cE(a,x.links,Z,A)},[o,a,x.nodes,x.links]);v.useEffect(()=>{const Z=d.current;if(!Z)return;const A=new ResizeObserver(F=>{const{width:W,height:T}=F[0].contentRect;W>0&&T>0&&(f({width:W,height:T}),B(de=>({...de,w:W,h:T})))});return A.observe(Z),()=>A.disconnect()},[]),v.useEffect(()=>{if(e.length===0)return;const Z=new Set(e.map(De=>De.id)),A=e.map(De=>({id:De.id,title:De.title,category:De.category,akb_type:De.akb_type,tldr:De.tldr,tags:De.tags})),F=(De,yt)=>{if(!yt.startsWith(".")&&!yt.startsWith("/"))return yt;const ct=De.split("/");ct.pop();const pt=yt.split("/");for(const jt of pt)jt===".."?ct.pop():jt!=="."&&jt!==""&&ct.push(jt);return ct.join("/")},W=[];for(const De of e)for(const yt of De.links){const ct=F(De.id,yt.href);Z.has(ct)&&ct!==De.id&&(W.some(pt=>pt.source===De.id&&pt.target===ct||pt.source===ct&&pt.target===De.id)||W.push({source:De.id,target:ct,label:yt.text}))}const{width:T,height:de}=m,xe=A.length,ye=xe>100?-600:xe>50?-500:-400,Le=xe>100?180:xe>50?160:140,Xe=xe>100?60:50,Ye=Math.max(T,xe*12),ht=Math.max(de,xe*10),tt=iE(Ye,ht,A),Je=pN(A).force("link",eN(W).id(De=>De.id).distance(Le)).force("charge",xN().strength(ye)).force("center",RC(Ye/2,ht/2)).force("collide",ZC(Xe)).force("cluster",sE(tt,.15));L.current=Je,Je.on("tick",()=>{g({nodes:[...A],links:[...W]})}),Je.alpha(1).restart();const Ne=xe>100?300:150;for(let De=0;De<Ne;De++)Je.tick();if(Je.stop(),g({nodes:[...A],links:[...W]}),A.length>0){let De=1/0,yt=1/0,ct=-1/0,pt=-1/0;for(const Wt of A){const Ft=Wt.x??0,Nt=Wt.y??0;Ft<De&&(De=Ft),Nt<yt&&(yt=Nt),Ft>ct&&(ct=Ft),Nt>pt&&(pt=Nt)}const jt=100;B({x:De-jt,y:yt-jt,w:Math.max(T,ct-De+jt*2),h:Math.max(de,pt-yt+jt*2)})}return()=>{Je.stop()}},[e,m]);const H=Z=>{if(typeof Z=="string"){const A=x.nodes.find(F=>F.id===Z);return{x:(A==null?void 0:A.x)??0,y:(A==null?void 0:A.y)??0}}return{x:Z.x??0,y:Z.y??0}},q=v.useCallback(Z=>{Z.preventDefault();const A=Z.deltaY>0?1.1:.9;B(F=>{const W=Math.max(200,Math.min(m.width*3,F.w*A)),T=Math.max(150,Math.min(m.height*3,F.h*A)),de=(W-F.w)/2,xe=(T-F.h)/2;return{x:F.x-de,y:F.y-xe,w:W,h:T}})},[m]),ue=v.useCallback(Z=>{Z.button===0&&(R.current=!0,$.current={x:Z.clientX,y:Z.clientY,vx:E.x,vy:E.y})},[E]),te=v.useCallback(Z=>{var A;if(_.current){const F=h.current;if(!F)return;const W=F.getBoundingClientRect(),T=E.w/W.width,de=E.h/W.height,xe=E.x+(Z.clientX-W.left)*T,ye=E.y+(Z.clientY-W.top)*de;_.current.fx=xe,_.current.fy=ye,(A=L.current)==null||A.alpha(.3).restart();return}if(R.current){const F=(Z.clientX-$.current.x)*(E.w/m.width),W=(Z.clientY-$.current.y)*(E.h/m.height);B(T=>({...T,x:$.current.vx-F,y:$.current.vy-W}))}},[E,m]),Y=v.useCallback(()=>{R.current=!1,_.current&&(_.current.fx=null,_.current.fy=null,_.current=null)},[]),se=v.useCallback((Z,A)=>{var F;Z.stopPropagation(),_.current=A,(F=L.current)==null||F.alpha(.3).restart()},[]);return l.jsxs("div",{ref:d,className:"relative flex-1 overflow-hidden",style:{background:"#1e1e2e"},children:[l.jsxs("svg",{ref:h,width:m.width,height:m.height,viewBox:`${E.x} ${E.y} ${E.w} ${E.h}`,style:{display:"block",cursor:R.current?"grabbing":"grab"},onWheel:q,onMouseDown:ue,onMouseMove:te,onMouseUp:Y,onMouseLeave:Y,children:[l.jsx("defs",{children:l.jsx("pattern",{id:"grid",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:l.jsx("circle",{cx:"0",cy:"0",r:"0.5",fill:"rgba(255,255,255,0.06)"})})}),l.jsx("rect",{x:E.x-100,y:E.y-100,width:E.w+200,height:E.h+200,fill:"url(#grid)",pointerEvents:"none"}),U==="macro"&&l.jsx("g",{className:"macro-clusters",style:{transition:"opacity 0.3s ease"},children:Q.map(Z=>{const A=ia[Z.domain]??ia.general,F=Math.max(40,Math.sqrt(Z.count)*25),T=i===null||Z.nodes.some(de=>i.has(de.id))?1:.4;return l.jsxs("g",{transform:`translate(${Z.centerX}, ${Z.centerY})`,style:{cursor:"pointer",opacity:T,transition:"opacity 0.3s ease"},onMouseEnter:de=>{var ye;const xe=(ye=d.current)==null?void 0:ye.getBoundingClientRect();xe&&C({x:de.clientX-xe.left,y:de.clientY-xe.top}),b({id:`cluster-${Z.domain}`,title:`${Z.domain} (${Z.count})`,category:Z.domain,akb_type:"hub"})},onMouseLeave:()=>b(null),children:[l.jsx("circle",{r:F,fill:A.bg,stroke:A.border,strokeWidth:3,opacity:.8}),l.jsx("text",{textAnchor:"middle",dominantBaseline:"middle",fill:A.text,fontSize:16,fontFamily:"monospace",fontWeight:"bold",style:{pointerEvents:"none"},children:Z.domain}),l.jsxs("text",{y:20,textAnchor:"middle",dominantBaseline:"middle",fill:A.text,fontSize:12,fontFamily:"monospace",opacity:.8,style:{pointerEvents:"none"},children:["(",Z.count,")"]})]},Z.domain)})}),U!=="macro"&&l.jsxs(l.Fragment,{children:[U==="standard"&&D.map(Z=>{const A=ia[Z.domain]??ia.general;if(Z.count<2)return null;const F=i===null||Z.nodes.some(T=>i.has(T.id)),W=F?.08:.04;return l.jsxs("g",{children:[l.jsx("circle",{cx:Z.centerX,cy:Z.centerY,r:Z.radius,fill:A.bg,stroke:A.border,strokeWidth:1,strokeDasharray:"6 4",opacity:W,style:{transition:"opacity 0.3s ease"},pointerEvents:"none"}),l.jsxs("text",{x:Z.centerX,y:Z.centerY-Z.radius-8,textAnchor:"middle",fill:A.text,fontSize:10,fontFamily:"monospace",fontWeight:"600",opacity:F?.6:.2,style:{pointerEvents:"none",transition:"opacity 0.3s ease"},children:[Z.domain," (",Z.count,")"]})]},`cluster-bg-${Z.domain}`)}),x.links.map((Z,A)=>{const F=H(Z.source),W=H(Z.target),T=j===A,de=(F.x+W.x)/2,xe=(F.y+W.y)/2,ye=typeof Z.source=="string"?Z.source:Z.source.id,Le=typeof Z.target=="string"?Z.target:Z.target.id,Ye=I===null||I.has(ye)&&I.has(Le)?1:.25;return l.jsxs("g",{style:{opacity:Ye,transition:"opacity 0.3s ease"},children:[l.jsx("line",{x1:F.x,y1:F.y,x2:W.x,y2:W.y,stroke:"transparent",strokeWidth:12,style:{cursor:"default"},onMouseEnter:()=>k(A),onMouseLeave:()=>k(null)}),l.jsx("line",{x1:F.x,y1:F.y,x2:W.x,y2:W.y,stroke:T?"rgba(148,163,184,0.7)":"rgba(148,163,184,0.3)",strokeWidth:T?2:1.5,strokeDasharray:"4 3",pointerEvents:"none"}),T&&Z.label&&l.jsx("text",{x:de,y:xe-6,textAnchor:"middle",fill:"#e2e8f0",fontSize:9,fontFamily:"monospace",style:{pointerEvents:"none"},children:l.jsx("tspan",{style:{filter:"drop-shadow(0 0 2px rgba(0,0,0,0.8))"},children:Z.label.length>30?Z.label.slice(0,28)+"..":Z.label})})]},A)}),x.nodes.map(Z=>{const A=ia[Z.category]??ia.general,F=Z.akb_type==="hub",W=F?24:16,T=U==="micro"?W*1.5:W,de=(w==null?void 0:w.id)===Z.id,xe=a===Z.id,ye=de?1.1:xe?1.05:1,Le=i===null||i.has(Z.id),Xe=I===null||I.has(Z.id),Ye=Le&&Xe?1:.35,ht=U==="micro"?lE(Z.tldr,50):"",tt=U==="micro"&&Z.tags?Z.tags.slice(0,3):[];return l.jsxs("g",{transform:`translate(${Z.x??0}, ${Z.y??0}) scale(${ye})`,style:{cursor:"pointer",transition:"transform 0.2s ease, opacity 0.3s ease",opacity:Ye},onClick:Je=>{Je.stopPropagation();const Ne=e.find(De=>De.id===Z.id);Ne&&n(Ne)},onMouseDown:Je=>se(Je,Z),onMouseEnter:Je=>{var De;b(Z);const Ne=(De=d.current)==null?void 0:De.getBoundingClientRect();Ne&&C({x:Je.clientX-Ne.left,y:Je.clientY-Ne.top})},onMouseLeave:()=>b(null),children:[xe&&l.jsx("rect",{x:-T/2-4,y:-T/2-4,width:T+8,height:T+8,fill:"none",stroke:"#22c55e",strokeWidth:2,rx:F?5:2,opacity:.6}),l.jsx("rect",{x:-T/2,y:-T/2,width:T,height:T,fill:A.border,rx:F?4:2,opacity:de?1:.9}),l.jsx("rect",{x:-T/2+3,y:-T/2+3,width:Math.max(0,T-6),height:Math.max(0,T-6),fill:A.bg,rx:F?3:1}),l.jsx("text",{y:T/2+14,textAnchor:"middle",fill:xe?"#e2e8f0":"#94a3b8",fontSize:U==="micro"?10:11,fontFamily:"monospace",fontWeight:xe?"bold":"normal",style:{pointerEvents:"none"},children:Z.title.length>24?Z.title.slice(0,22)+"..":Z.title}),U==="micro"&&ht&&l.jsx("text",{y:T/2+28,textAnchor:"middle",fill:"#94a3b8",fontSize:8,fontFamily:"system-ui, sans-serif",opacity:.7,style:{pointerEvents:"none"},children:ht}),U==="micro"&&tt.length>0&&l.jsx("g",{transform:`translate(0, ${T/2+(ht?42:28)})`,children:tt.map((Je,Ne)=>{const De=Je.length*5+8;let ct=-tt.reduce((pt,jt)=>pt+jt.length*5+10,0)/2;for(let pt=0;pt<Ne;pt++)ct+=tt[pt].length*5+10;return l.jsxs("g",{transform:`translate(${ct+De/2}, 0)`,children:[l.jsx("rect",{x:-De/2,y:-6,width:De,height:12,fill:A.bg,stroke:A.border,strokeWidth:.5,rx:3}),l.jsx("text",{textAnchor:"middle",dominantBaseline:"middle",fill:A.text,fontSize:7,fontFamily:"monospace",style:{pointerEvents:"none"},children:Je})]},Je)})})]},Z.id)})]})]}),w&&!_.current&&l.jsxs("div",{className:"absolute z-10 pointer-events-none p-2.5 rounded text-xs max-w-[240px]",style:{left:Math.min(N.x+16,m.width-250),top:Math.max(N.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:[l.jsx("div",{className:"font-bold mb-1",children:w.title}),l.jsxs("div",{className:"text-[10px] opacity-60 mb-1",children:[w.akb_type.toUpperCase()," / ",w.category]}),w.id.startsWith("cluster-")?l.jsx("div",{className:"text-[10px] text-green-400",children:"Zoom in to see documents"}):l.jsxs(l.Fragment,{children:[((J=e.find(Z=>Z.id===w.id))==null?void 0:J.tldr)&&l.jsx("div",{className:"text-[10px] opacity-80 mb-1",children:e.find(Z=>Z.id===w.id).tldr}),l.jsx("div",{className:"text-[10px] text-green-400",children:"Click to open | Drag to move"})]})]}),l.jsxs("div",{className:"absolute bottom-3 left-3 px-2 py-1 rounded text-[10px] font-mono",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:U==="macro"?"#f59e0b":U==="micro"?"#22c55e":"#94a3b8",transition:"color 0.3s ease"},children:[U==="macro"&&"📍 Overview",U==="standard"&&"📍 Standard",U==="micro"&&"📍 Detail"]}),l.jsx("div",{className:"absolute bottom-3 right-3 flex gap-1 rounded overflow-hidden",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)"},children:["global","1-hop","2-hop"].map(Z=>{const A=o===Z,F=Z!=="global"&&!a,W=Z==="global"?"🌐 All":Z==="1-hop"?"1-hop":"2-hop";return l.jsx("button",{onClick:()=>!F&&u(Z),disabled:F,className:"px-2 py-1 text-[10px] font-medium cursor-pointer transition-all",style:{background:A?"rgba(22,163,106,0.3)":"transparent",color:F?"var(--terminal-text-muted)":A?"#4ade80":"var(--terminal-text-secondary)",opacity:F?.4:1,cursor:F?"not-allowed":"pointer"},title:F?"Select a node first":`Show ${Z==="global"?"all nodes":`nodes within ${Z}`}`,children:W},Z)})}),e.length===0&&l.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 dE(e){const n=[],a=new Map;return[...e].sort((o,u)=>o.id.localeCompare(u.id)).forEach(o=>{const u=o.id.split("/");let d=n,h="";for(let m=0;m<u.length-1;m++)if(h=h?`${h}/${u[m]}`:u[m],a.has(h))d=a.get(h).children;else{const f={type:"folder",name:u[m],path:h,children:[]};a.set(h,f),d.push(f),d=f.children}d.push({type:"file",name:u[u.length-1],path:o.id,doc:o})}),n}function fE({docs:e,onDocumentClick:n,selectedDocId:a,matchedIds:i}){const[o,u]=v.useState(new Set(["knowledge","projects","architecture","operations","company"])),[d,h]=v.useState(null),[m,f]=v.useState([]),[x,g]=v.useState(-1),w=v.useMemo(()=>dE(e),[e]),b=$=>{u(_=>{const L=new Set(_);return L.has($)?L.delete($):L.add($),L})},j=$=>{h($),n($);const _=m.slice(0,x+1);_.push($),_.length>10&&_.shift(),f(_),g(_.length-1)},k=()=>{h(null),n(null)},N=()=>{if(x>0){const $=x-1;g($),h(m[$]),n(m[$])}},C=()=>{if(x<m.length-1){const $=x+1;g($),h(m[$]),n(m[$])}},E=$=>{const _=m.indexOf($);_!==-1&&(g(_),h($),n($))},B=$=>{$==="hub"&&k()},R=d?e.find($=>$.id===d):null;return l.jsxs("div",{className:"flex-1 overflow-hidden flex animate-fadeIn",children:[l.jsxs("div",{className:"shrink-0 overflow-y-auto p-3",style:{width:220,background:"var(--hud-bg-alt)",borderRight:"1px solid var(--terminal-border)"},children:[l.jsx("div",{className:"text-[10px] font-bold uppercase mb-2",style:{color:"var(--terminal-text-muted)"},children:"📂 Explorer"}),w.map($=>l.jsx(nv,{node:$,level:0,expandedFolders:o,selectedDocId:a,viewingDocId:d,onToggleFolder:b,onFileClick:j,matchedIds:i},$.path))]}),l.jsx("div",{className:"flex-1 overflow-y-auto",children:R?l.jsx(mE,{doc:R,onClose:k,onBreadcrumbClick:B,history:m,historyIndex:x,onHistoryBack:N,onHistoryForward:C,onHistoryJump:E,allDocs:e}):l.jsx("div",{className:"flex items-center justify-center h-full text-xs",style:{color:"var(--terminal-text-muted)"},children:l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"text-2xl mb-2",children:"📄"}),l.jsx("div",{children:"Select a document to view"})]})})})]})}function nv({node:e,level:n,expandedFolders:a,selectedDocId:i,viewingDocId:o,onToggleFolder:u,onFileClick:d,matchedIds:h}){var b,j,k;const m=a.has(e.path),f=e.type==="file"&&e.path===i,x=e.type==="file"&&e.path===o,g=((b=e.doc)==null?void 0:b.akb_type)==="hub",w=e.type==="folder"||h===null||h.has(e.path);if(e.type==="folder"){const N=h===null||(((j=e.children)==null?void 0:j.some(C=>{if(C.type==="file")return h.has(C.path);const E=B=>{var R;return B.type==="file"?h.has(B.path):((R=B.children)==null?void 0:R.some(E))??!1};return E(C)}))??!1);return l.jsxs("div",{style:{opacity:N?1:.5,transition:"opacity 0.2s ease"},children:[l.jsxs("div",{className:"flex items-center gap-1 py-0.5 px-1 rounded cursor-pointer hover:bg-white/5",style:{paddingLeft:n*12+4},onClick:()=>u(e.path),children:[l.jsx("span",{className:"text-[10px]",children:m?"📂":"📁"}),l.jsx("span",{className:"text-[11px]",style:{color:"var(--terminal-text)"},children:e.name})]}),m&&((k=e.children)==null?void 0:k.map(C=>l.jsx(nv,{node:C,level:n+1,expandedFolders:a,selectedDocId:i,viewingDocId:o,onToggleFolder:u,onFileClick:d,matchedIds:h},C.path)))]})}return l.jsxs("div",{className:`flex items-center gap-1 py-0.5 px-1 rounded cursor-pointer transition-colors ${x?"bg-green-500/20":f?"bg-white/10":"hover:bg-white/5"}`,style:{paddingLeft:n*12+4,opacity:w?1:.45,transition:"opacity 0.2s ease"},onClick:()=>d(e.path),children:[l.jsx("span",{className:"text-[10px]",children:g?"📘":"📄"}),l.jsx("span",{className:`text-[11px] truncate ${g?"font-semibold":""}`,style:{color:g?"#16a34a":"var(--terminal-text)"},children:e.name})]})}function hE(e){const n=e.split(`
|
|
82
|
-
`),a=[],i=new Map;for(const o of n){const u=o.match(/^(#{2,3})\s+(.+)$/);if(!u)continue;const d=u[1].length,h=u[2].trim();let m=h.toLowerCase().replace(/[^a-z0-9가-힣\s-]/g,"").replace(/\s+/g,"-").slice(0,50);const f=i.get(m)||0;i.set(m,f+1);const x=f>0?`${m}-${f}`:m;a.push({id:x,text:h,level:d})}return a}function mE({doc:e,onClose:n,onBreadcrumbClick:a,history:i,historyIndex:o,onHistoryBack:u,onHistoryForward:d,onHistoryJump:h,allDocs:m}){const[f,x]=v.useState(null),[g,w]=v.useState(!1),[b,j]=v.useState(null),k=v.useRef(null),[N,C]=v.useState(null);v.useEffect(()=>{if("content"in e&&e.content){x(e);return}w(!0),j(null),ge.getKnowledgeDoc(e.id).then(x).catch(D=>j(D instanceof Error?D.message:"Failed to load")).finally(()=>w(!1))},[e]);const E=v.useMemo(()=>!f||e.format==="html"?[]:hE(f.content),[f,e.format]),B=D=>{if(!k.current)return;const I=k.current.querySelectorAll("h2, h3");for(const H of I){const ue=(H.textContent||"").toLowerCase().replace(/[^a-z0-9가-힣\s-]/g,"").replace(/\s+/g,"-").slice(0,50);if(D.startsWith(ue)){H.scrollIntoView({behavior:"smooth",block:"start"}),C(D);break}}},R=nE(e.category),$=e.akb_type==="hub",_=E.length>0&&!g&&!b,L=i.slice(0,o).reverse().filter(D=>D!==e.id).slice(0,3).map(D=>m.find(I=>I.id===D)).filter(D=>D!==void 0),U=o>0,Q=o<i.length-1;return l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsxs("div",{className:"shrink-0 p-4",style:{borderBottom:"1px solid var(--terminal-border)"},children:[l.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[l.jsx("button",{onClick:u,disabled:!U,className:"text-xs font-semibold cursor-pointer hover:opacity-70 disabled:opacity-30 disabled:cursor-not-allowed",style:{color:"var(--active-green)"},title:"Back",children:"←"}),l.jsx("button",{onClick:d,disabled:!Q,className:"text-xs font-semibold cursor-pointer hover:opacity-70 disabled:opacity-30 disabled:cursor-not-allowed",style:{color:"var(--active-green)"},title:"Forward",children:"→"}),l.jsx("div",{className:"flex-1 flex items-center gap-1 overflow-x-auto",children:L.map(D=>l.jsxs("button",{onClick:()=>h(D.id),className:"px-2 py-0.5 rounded text-[9px] hover:opacity-70 cursor-pointer whitespace-nowrap",style:{background:"var(--hud-bg)",color:"var(--terminal-text-secondary)"},title:D.title,children:["📄 ",D.title.length>15?D.title.slice(0,15)+"...":D.title]},D.id))})]}),l.jsxs("div",{className:"flex items-center gap-1 mb-2 text-[10px]",style:{color:"var(--terminal-text-muted)"},children:[l.jsx("button",{onClick:()=>a("hub"),className:"hover:underline cursor-pointer",style:{color:"var(--active-green)"},children:"Knowledge Hub"}),l.jsx("span",{children:"›"}),l.jsx("span",{style:{color:R.text},children:e.category}),l.jsx("span",{children:"›"}),l.jsx("span",{style:{color:"var(--terminal-text)"},children:e.title})]}),l.jsx("div",{className:"flex items-center gap-2 mb-2",children:l.jsxs("button",{onClick:n,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Back"]})}),l.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[l.jsx("span",{className:"text-lg",children:$?"📘":e.format==="html"?"🌐":"📄"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-sm font-bold mb-1",style:{color:"var(--terminal-text)"},children:e.title}),l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:e.status==="active"?"#16a34a":e.status==="draft"?"#f59e0b":"#94a3b8"},title:e.status}),l.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:e.id})]}),e.tags.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:e.tags.map(D=>l.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium",style:{background:R.bg,color:R.text,border:`1px solid ${R.border}`},children:D},D))})]})]}),e.tldr&&l.jsx("div",{className:"text-[11px] italic leading-relaxed p-2 rounded",style:{background:"var(--hud-bg)",color:"var(--terminal-text-secondary)"},children:e.tldr})]}),l.jsxs("div",{className:"flex-1 overflow-hidden flex",children:[l.jsxs("div",{ref:k,className:"flex-1 overflow-y-auto p-4",children:[g&&l.jsx("div",{className:"text-xs",style:{color:"var(--terminal-text-muted)"},children:"Loading..."}),b&&l.jsx("div",{className:"text-xs p-2 rounded",style:{background:"rgba(239,68,68,0.15)",color:"#f87171"},children:b}),f&&l.jsx(As,{content:f.content})]}),_&&l.jsxs("div",{className:"shrink-0 overflow-y-auto p-3",style:{width:180,background:"var(--hud-bg-alt)",borderLeft:"1px solid var(--terminal-border)"},children:[l.jsx("div",{className:"text-[10px] font-bold uppercase mb-2",style:{color:"var(--terminal-text-muted)"},children:"Contents"}),l.jsx("div",{className:"space-y-1",children:E.map(D=>l.jsx("button",{onClick:()=>B(D.id),className:"block w-full text-left text-[10px] py-1 px-2 rounded cursor-pointer hover:bg-white/5 transition-colors",style:{paddingLeft:(D.level-2)*8+8,color:N===D.id?"#4ade80":"var(--terminal-text-secondary)",fontWeight:N===D.id?"bold":"normal"},children:D.text.length>30?D.text.slice(0,28)+"..":D.text},D.id))})]})]})]})}const pE=500,Ig=360,xE=700;function Go(e,n,a){const i=n??pE,[o,u]=v.useState(i),[d,h]=v.useState(!1),m=v.useRef(0),f=v.useRef(0),x=v.useRef(a);x.current=a;const g=e>0,w=g?e:0,b=Math.max(xE,i),j=g?Math.max(Ig,window.innerWidth-e-100):b,k=Math.min(o,j),N=v.useCallback(C=>{C.preventDefault(),m.current=C.clientX,f.current=k,h(!0);const E=()=>{h(!1),document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",E)},B=R=>{const $=m.current-R.clientX,_=f.current+$;if(_>=window.innerWidth*.6&&x.current){E(),x.current();return}const L=Math.min(b,Math.max(Ig,_));u(L)};document.addEventListener("mousemove",B),document.addEventListener("mouseup",E)},[k]);return{panelRight:w,panelWidth:k,isResizing:d,handleResizeStart:N}}function Hg({docs:e,onClose:n,onRefresh:a,terminalWidth:i=0,initialDocId:o,onMaximize:u}){const[d,h]=v.useState(()=>{const D=localStorage.getItem("kb-view-mode");return D==="graph"||D==="tree"||D==="list"?D:"graph"}),[m,f]=v.useState(null),[x,g]=v.useState("global"),[w,b]=v.useState(""),[j,k]=v.useState(()=>new Set(Object.keys(ia)));v.useEffect(()=>{localStorage.setItem("kb-view-mode",d)},[d]);const N=v.useMemo(()=>new Ds(e,{keys:["title","tldr","tags"],threshold:.3,includeScore:!0}),[e]),C=v.useMemo(()=>{let D=new Set(e.map(I=>I.id));if(w.trim()){const I=N.search(w);D=new Set(I.map(H=>H.item.id))}return D=new Set(Array.from(D).filter(I=>{const H=e.find(q=>q.id===I);return H&&j.has(H.category)})),D.size===e.length?null:D},[e,w,N,j]),E=v.useMemo(()=>C===null?e:e.filter(D=>C.has(D.id)),[e,C]),B=D=>{k(I=>{const H=new Set(I);return H.has(D)?H.delete(D):H.add(D),H})},{panelRight:R,panelWidth:$,isResizing:_,handleResizeStart:L}=Go(i,void 0,u),U=D=>{f(D.id)},Q=m?e.find(D=>D.id===m):null;return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:R},onClick:n}),l.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:R,width:$,background:"var(--terminal-bg)",borderLeftColor:"#16a34a"},children:[l.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:L}),l.jsxs("div",{className:"p-5 text-white relative",style:{background:"#16a34a"},children:[l.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-1",children:[u&&l.jsx("button",{onClick:u,className:"w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-sm hover:bg-white/30 cursor-pointer",title:"Maximize (Pro View)",children:"⤢"}),l.jsx("button",{onClick:n,className:"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:"×"})]}),l.jsxs("div",{className:"text-lg font-bold",children:["📚"," Knowledge Base"]}),l.jsxs("div",{className:"text-xs opacity-80 mt-0.5",children:[e.length," documents"]})]}),l.jsxs("div",{className:"flex gap-1 p-2",style:{borderBottom:"1px solid var(--terminal-border)"},children:[l.jsx(Nh,{icon:"🕸️",label:"Graph",active:d==="graph",onClick:()=>h("graph")}),l.jsx(Nh,{icon:"🌲",label:"Tree",active:d==="tree",onClick:()=>{h("tree"),f(null)}}),l.jsx(Nh,{icon:"📋",label:"List",active:d==="list",onClick:()=>{h("list"),f(null)}})]}),l.jsxs("div",{className:"p-3 space-y-2",style:{borderBottom:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},children:[l.jsxs("div",{className:"relative",children:[l.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-sm",children:"🔍"}),l.jsx("input",{type:"text",value:w,onChange:D=>b(D.target.value),placeholder:"Search docs...",className:"w-full pl-8 pr-3 py-1.5 text-xs rounded focus:outline-none transition-colors",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}}),w&&l.jsx("button",{onClick:()=>b(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs hover:opacity-70",style:{color:"var(--terminal-text-muted)"},children:"✕"})]}),l.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(ia).map(([D,I])=>{const H=j.has(D);return l.jsx("button",{onClick:()=>B(D),className:"px-2 py-1 text-[10px] font-medium rounded cursor-pointer transition-all",style:{background:H?I.bg:"transparent",color:H?I.text:"var(--terminal-text-muted)",border:`1px solid ${H?I.border:"var(--terminal-border)"}`,opacity:H?1:.5},children:D},D)})}),l.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:E.length===e.length?`${e.length} documents`:`${E.length} of ${e.length} documents`})]}),d==="graph"&&l.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col animate-fadeIn",children:[l.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[l.jsx(uE,{docs:e,onNodeClick:U,selectedDocId:m,matchedIds:C,localGraphMode:x,onLocalModeChange:g}),Q&&l.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:[l.jsx("div",{className:"text-[10px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Selected"}),l.jsx("div",{className:"text-xs font-bold mb-1",style:{color:"var(--terminal-text)"},children:Q.title}),l.jsx("div",{className:"w-2 h-2 rounded-full mb-2",style:{background:Q.status==="active"?"#16a34a":Q.status==="draft"?"#f59e0b":"#94a3b8"}}),Q.tldr&&l.jsx("div",{className:"text-[10px] mb-2 leading-relaxed",style:{color:"var(--terminal-text-secondary)"},children:Q.tldr}),Q.links.length>0&&l.jsxs("div",{className:"mb-2",children:[l.jsx("div",{className:"text-[9px] font-bold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Links"}),Q.links.slice(0,5).map((D,I)=>l.jsxs("div",{className:"text-[9px] mb-0.5 truncate",style:{color:"var(--terminal-text-secondary)"},children:["🔗"," ",D.text]},I))]})]})]}),l.jsx("div",{className:"shrink-0 p-2",style:{borderTop:"1px solid var(--terminal-border)"},children:l.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(ia).map(([D,I])=>l.jsxs("div",{className:"flex items-center gap-1 text-[9px]",children:[l.jsx("div",{className:"w-2 h-2",style:{background:I.border}}),l.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:D})]},D))})})]}),d==="tree"&&l.jsx(fE,{docs:e,onDocumentClick:D=>f(D),selectedDocId:m,matchedIds:C}),d==="list"&&l.jsx(gE,{icon:"📋",title:"List View",message:"Coming soon in KB-002",description:"Table format with sortable columns and quick scanning"})]})]})}function Nh({icon:e,label:n,active:a,onClick:i}){return l.jsxs("button",{onClick:i,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-2 text-xs font-medium rounded cursor-pointer transition-all",style:{background:a?"rgba(22,163,106,0.2)":"transparent",color:a?"#4ade80":"var(--terminal-text-muted)",border:a?"1px solid rgba(22,163,106,0.4)":"1px solid transparent"},children:[l.jsx("span",{className:"text-sm",children:e}),l.jsx("span",{children:n})]})}function gE({icon:e,title:n,message:a,description:i}){return l.jsx("div",{className:"flex-1 flex items-center justify-center p-8 animate-fadeIn",children:l.jsxs("div",{className:"text-center max-w-md",children:[l.jsx("div",{className:"text-6xl mb-4",children:e}),l.jsx("div",{className:"text-lg font-bold mb-2",style:{color:"var(--terminal-text)"},children:n}),l.jsx("div",{className:"text-sm mb-3",style:{color:"#4ade80"},children:a}),l.jsx("div",{className:"text-xs leading-relaxed",style:{color:"var(--terminal-text-muted)"},children:i})]})})}function Ug({waves:e,decisions:n,mode:a,onClose:i,onOpenWaveCenter:o,onUpdateDecision:u,onDeleteDecision:d,terminalWidth:h=0,onMaximize:m}){const[f,x]=v.useState("decisions"),{panelRight:g,panelWidth:w,isResizing:b,handleResizeStart:j}=Go(h,void 0,m);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:g},onClick:i}),l.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)] ${b?"resizing":""}`,style:{right:g,width:w,background:"var(--terminal-bg)",borderLeftColor:"var(--desk-wood)"},children:[l.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${b?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:j}),l.jsxs("div",{className:"p-5 bg-[var(--desk-wood)] text-white relative",children:[l.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-1",children:[m&&l.jsx("button",{onClick:m,className:"w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-sm hover:bg-white/30 cursor-pointer",title:"Maximize (Pro View)",children:"⤢"}),l.jsx("button",{onClick:i,className:"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:"×"})]}),l.jsxs("div",{className:"text-lg font-bold",children:["📋"," Decisions"]})]}),l.jsxs("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:[l.jsx(Eh,{label:`Decisions (${n.length})`,active:f==="decisions",onClick:()=>x("decisions")}),o?l.jsx(Eh,{label:"Waves →",active:!1,onClick:o}):l.jsx(Eh,{label:`Waves (${e.length})`,active:f==="waves",onClick:()=>x("waves")})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[f==="decisions"&&(n.length>0?n.map(k=>l.jsx(yE,{decision:k,onSave:u,onDelete:d},k.id)):l.jsx("div",{className:"text-center py-10 text-sm",style:{color:"var(--terminal-text-muted)"},children:"No decisions yet"})),f==="waves"&&e.map((k,N)=>l.jsx(bE,{title:`Wave ${k.id}`,subtitle:k.startedAt,content:k.directive},N))]})]})]})}function yE({decision:e,onSave:n,onDelete:a}){const[i,o]=v.useState(!1),[u,d]=v.useState(!1),[h,m]=v.useState(e.content),[f,x]=v.useState(!1),g=rv(e.content).slice(0,160),w=e.content.length>100,b=v.useCallback(async()=>{if(!n||h===e.content){d(!1);return}x(!0);try{await n(e.id,h),d(!1)}finally{x(!1)}},[n,h,e.id,e.content]),j=v.useCallback(async()=>{if(a){x(!0);try{await a(e.id)}finally{x(!1)}}},[a,e.id]);return l.jsxs("div",{className:"mb-3 rounded-lg overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[l.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>{u||o(!i)},children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"font-medium text-sm",style:{color:"var(--terminal-text)"},children:["#",e.id," ",e.title]}),l.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 ml-2",children:[i&&!u&&n&&l.jsx("button",{onClick:k=>{k.stopPropagation(),m(e.content),d(!0)},className:"text-[10px] px-2 py-0.5 rounded hover:bg-white/10 transition-colors",style:{color:"var(--terminal-text-muted)",border:"1px solid var(--terminal-border)"},children:"Edit"}),l.jsx("span",{className:"text-xs",style:{color:"var(--terminal-text-muted)"},children:i?"▲":"▼"})]})]}),e.date&&l.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--terminal-text-muted)"},children:e.date})]}),i&&u?l.jsxs("div",{className:"px-3 pb-3 pt-2",style:{borderTop:"1px solid var(--terminal-border)"},children:[l.jsx("textarea",{value:h,onChange:k=>m(k.target.value),className:"w-full rounded-lg p-3 text-xs leading-relaxed resize-none font-mono terminal-scrollbar focus:outline-none",style:{background:"var(--terminal-inline-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",minHeight:200},rows:12}),l.jsxs("div",{className:"flex items-center justify-between mt-2",children:[l.jsx("div",{children:a&&l.jsx("button",{onClick:j,disabled:f,className:"text-[10px] px-2 py-1 rounded hover:bg-red-900/30 transition-colors disabled:opacity-40",style:{color:"#EF4444",border:"1px solid #EF444440"},children:"Delete"})}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>d(!1),disabled:f,className:"text-[10px] px-3 py-1 rounded hover:bg-white/5 transition-colors disabled:opacity-40",style:{color:"var(--terminal-text-muted)",border:"1px solid var(--terminal-border)"},children:"Cancel"}),l.jsx("button",{onClick:b,disabled:f||h===e.content,className:"text-[10px] px-3 py-1 rounded font-semibold transition-colors disabled:opacity-40",style:{background:"var(--desk-wood)",color:"#fff"},children:f?"Saving...":"Save"})]})]})]}):i?l.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:l.jsx(As,{content:e.content})}):null,!i&&w&&l.jsx("div",{className:"px-3 pb-2 text-xs line-clamp-2 leading-relaxed",style:{color:"var(--terminal-text-muted)"},children:g})]})}function Eh({label:e,active:n,onClick:a}){return l.jsx("button",{onClick:a,className:"px-4 py-2.5 text-sm font-medium cursor-pointer",style:{color:n?"var(--accent)":"var(--terminal-text-muted)",borderBottom:n?"2px solid var(--accent)":"2px solid transparent"},children:e})}function rv(e){return e.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 bE({title:e,subtitle:n,content:a}){const[i,o]=v.useState(!1),u=a.length>100,d=rv(a).slice(0,160);return l.jsxs("div",{className:"mb-3 rounded-lg overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[l.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>o(!i),children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("div",{className:"font-medium text-sm",style:{color:"var(--terminal-text)"},children:e}),l.jsx("span",{className:"text-xs shrink-0 ml-2",style:{color:"var(--terminal-text-muted)"},children:i?"▲":"▼"})]}),n&&l.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--terminal-text-muted)"},children:n})]}),i&&l.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:l.jsx(As,{content:a})}),!i&&u&&l.jsx("div",{className:"px-3 pb-2 text-xs line-clamp-2 leading-relaxed",style:{color:"var(--terminal-text-muted)"},children:d})]})}const js=[{id:"ch1-q1",chapter:1,title:"Hire your first employee",description:'Every company starts with its first hire. Click the HIRE button to open the recruitment panel. Choose a role name (e.g. "PM"), set a level, and bring them on board. Each role becomes an AI agent that works for your company.',type:"main",trigger:{type:"role_hired"},rewards:{coins:1e3},hint:{target:"hire-btn",message:"Click HIRE to recruit your first team member"}},{id:"ch1-q2",chapter:1,title:"Open the Terminal",description:"The Terminal is your command center — where you talk to your team. Click TERMINAL in the bottom bar to open it. You'll see a chat-like interface where you can select any role and give them instructions.",type:"main",trigger:{type:"terminal_opened"},rewards:{coins:500},hint:{target:"terminal-btn",message:"Click TERMINAL to open your command center"}},{id:"ch1-q3",chapter:1,title:"Talk to your team",description:`Use "Talk" mode to have a conversation with your team. Talk mode is for quick questions, brainstorming, and discussions — the AI role will respond with advice but won't modify any files. Select a role tab and type your message.`,type:"main",trigger:{type:"talk_mode_used"},rewards:{coins:1e3},hint:{target:"terminal-btn",message:"Open the terminal, select Talk mode, and chat"}},{id:"ch2-q1",chapter:2,title:"Create a project",description:"Projects organize your company's work. Click the Meeting Room in the office view to create one. Give it a name, description, and the system will scaffold a project folder with PRD, tasks, and design docs that your AI team will use.",type:"main",trigger:{type:"project_created"},rewards:{coins:1500},hint:{target:"meeting-room",message:"Click the Meeting Room to create a project"}},{id:"ch2-q2",chapter:2,title:"Give your first order",description:'Use "Do" mode to assign real work. Unlike Talk mode, Do mode lets roles execute tasks — they can read/write files, create documents, and run commands. Switch to Do mode in the terminal and give your team member a task.',type:"main",trigger:{type:"do_mode_used"},rewards:{badge:"first-launch",coins:2e3},hint:{target:"terminal-btn",message:"Open the terminal, switch to Do mode, and assign a task"}},{id:"ch3-q1",chapter:3,title:"Create a chat channel",description:'Chat channels let multiple roles discuss topics together — like Slack for your AI team. Click the "+" button next to channel tabs in the terminal to create a new channel. Add members and set a topic for focused collaboration.',type:"main",trigger:{type:"chat_channel_created"},rewards:{coins:1500},hint:{target:"terminal-btn",message:'Open the terminal and click "+" to create a chat channel'}},{id:"ch3-q2",chapter:3,title:"Dispatch a CEO Wave",description:"CEO Wave broadcasts a directive to your entire C-Level team at once. It's like an all-hands announcement — each C-Level role receives the wave and can delegate to their reports. Use it for company-wide initiatives, pivots, or big decisions.",type:"main",trigger:{type:"wave_dispatched"},rewards:{badge:"team-builder",coins:3e3},hint:{target:"wave-btn",message:"Click CEO WAVE to broadcast to your team"}},{id:"ch4-q1",chapter:4,title:"Hire a CTO",description:"C-Level roles are special — they can delegate work to their reports and make autonomous decisions. A CTO manages your technical team (Engineers, QA). Hire one with the C-Level tier to unlock the org hierarchy.",type:"main",trigger:{type:"role_hired",condition:{roleId:"cto"}},rewards:{coins:2e3},hint:{target:"hire-btn",message:"Hire a CTO to lead your tech team"}},{id:"ch4-q2",chapter:4,title:"Hire an Engineer",description:'Engineers are the builders. They read architecture docs, write code, and ship features. Set their "Reports To" to CTO so the org hierarchy works — when you wave, the CTO can delegate tasks down to engineers automatically.',type:"main",trigger:{type:"role_hired",condition:{roleId:"engineer"}},rewards:{coins:2500},hint:{target:"hire-btn",message:"Hire an Engineer to start building"}},{id:"ch4-q3",chapter:4,title:"Define a persona",description:"Each role has a persona — their personality, expertise, and communication style. Click a role in the office to open their panel, then edit their persona. A well-defined persona makes the AI role more consistent and specialized.",type:"main",trigger:{type:"persona_updated"},rewards:{coins:2e3},hint:{target:"terminal-btn",message:"Click a role in the office, then edit their persona"}},{id:"ch5-q1",chapter:5,title:"Explore the Knowledge Base",description:"The Knowledge Hub stores your company's documents — architecture decisions, domain knowledge, meeting notes. Your AI team reads these docs for context when working. Click the Knowledge bookshelf in the office to browse.",type:"main",trigger:{type:"knowledge_visited"},rewards:{coins:2e3},hint:{target:"knowledge-hub",message:"Click the Knowledge Hub to explore your docs"}},{id:"ch5-q2",chapter:5,title:"Check the Bulletin Board",description:"The Bulletin Board shows your company's daily standups and wave execution logs. Every time a role completes work, they post a standup. Waves show the full chain of delegation. It's your company's activity feed.",type:"main",trigger:{type:"bulletin_visited"},rewards:{badge:"scholar",coins:2e3},hint:{target:"bulletin-board",message:"Click the Bulletin Board for company updates"}},{id:"ch6-q1",chapter:6,title:"Visit the Character Store",description:"The Store has community-created characters with unique pixel art designs. Browse characters shared by other Tycono users, preview their look, and import them into your team. Open HIRE and switch to the Store tab.",type:"main",trigger:{type:"store_visited"},rewards:{coins:3e3},hint:{target:"hire-btn",message:"Open HIRE and check out the Store tab"}},{id:"ch6-q2",chapter:6,title:"Customize a character",description:"Every role has a pixel art character you can customize — change hair, skin, outfit, and accessories. Click a role in the office view to open their panel, then click the character sprite to enter the customization editor.",type:"main",trigger:{type:"accessory_changed"},rewards:{badge:"explorer",coins:5e3},hint:{target:"hire-btn",message:"Click a team member to customize their look"}},{id:"ch6-q3",chapter:6,title:"Change the office theme",description:"Your office supports multiple visual themes — each changes the color palette, mood, and atmosphere. Click the theme icon in the bottom bar to browse available themes and pick the one that matches your company's vibe.",type:"main",trigger:{type:"theme_changed"},rewards:{badge:"stylist",coins:2e3},hint:{target:"theme-btn",message:"Click the Theme button to change your office look"}},{id:"ch7-q1",chapter:7,title:"Decorate your office",description:"Enter Edit mode to rearrange your office layout. You can drag furniture, place decorations, and create different room zones. Click the EDIT button, then drag items to place them. Click DONE when finished.",type:"main",trigger:{type:"furniture_placed"},rewards:{coins:2e3},hint:{target:"edit-btn",message:"Click EDIT to enter furniture layout mode"}},{id:"ch7-q2",chapter:7,title:"Buy premium furniture",description:"Spend coins earned from quests and achievements to buy premium furniture. Enter Edit mode and browse the furniture shop — each item has a coin price. Premium items add unique visual flair to your office.",type:"main",trigger:{type:"furniture_purchased"},rewards:{badge:"interior-designer",coins:3e3},hint:{target:"edit-btn",message:"Enter EDIT mode and buy furniture with coins"}},{id:"ch8-q1",chapter:8,title:"Review company stats",description:"The Stats panel shows your company's performance metrics — token usage per role, activity levels, role leaderboard, and growth over time. Click the Stats facility in the office to see how your team is performing.",type:"main",trigger:{type:"stats_visited"},rewards:{coins:2e3},hint:{target:"stats-btn",message:"Click Stats to see your company metrics"}},{id:"ch8-q2",chapter:8,title:"Save your progress",description:"Tycono uses git to track all changes your AI team makes. Press Cmd+S (or click the save indicator) to commit your company's current state. Each save creates a git commit — you can view history and even restore previous states.",type:"main",trigger:{type:"save_committed"},rewards:{coins:2e3},hint:{target:"save-btn",message:"Press Cmd+S or click Save to commit changes"}},{id:"ch8-q3",chapter:8,title:"Open Settings",description:"The Settings panel lets you configure your company — adjust API keys, execution engine preferences, and other system options. Click the gear icon in the bottom bar to access it.",type:"main",trigger:{type:"settings_visited"},rewards:{coins:2e3},hint:{target:"settings-btn",message:"Click the Settings gear to configure your company"}},{id:"ch9-q1",chapter:9,title:"Hire a Designer",description:"A Designer handles UI/UX work — wireframes, mockups, and visual design decisions. They complement your Engineer by focusing on the user experience side. Hire one to round out your product team.",type:"main",trigger:{type:"role_hired",condition:{roleId:"designer"}},rewards:{coins:2500},hint:{target:"hire-btn",message:"Hire a Designer for your creative team"}},{id:"ch9-q2",chapter:9,title:"Hire a QA Engineer",description:"QA Engineers test your product, find bugs, and ensure quality. They review code changes, write test plans, and validate that features work as expected. Essential for any serious product team.",type:"main",trigger:{type:"role_hired",condition:{roleId:"qa"}},rewards:{coins:3e3},hint:{target:"hire-btn",message:"Hire a QA Engineer for quality assurance"}},{id:"ch9-q3",chapter:9,title:"Build a 5-person team",description:"Growing your team unlocks the full potential of delegation. With 5+ members, your C-Level roles can distribute work across specialized team members, creating a real organizational hierarchy.",type:"main",trigger:{type:"role_hired",condition:{minRoles:5}},rewards:{badge:"growing-company",coins:5e3},hint:{target:"hire-btn",message:"Keep hiring until you have 5+ team members"}},{id:"ch10-q1",chapter:10,title:"Build a 7-person team",description:"A full-size team with diverse roles means your company can handle any challenge. CEO at the top, C-Levels managing domains, and specialists executing. You've built a real AI-powered organization.",type:"main",trigger:{type:"role_hired",condition:{minRoles:7}},rewards:{badge:"tycoon-master",coins:1e4},hint:{target:"hire-btn",message:"Keep hiring until you have 7+ team members"}}],hm=[{num:1,title:"Getting Started",questIds:["ch1-q1","ch1-q2","ch1-q3"]},{num:2,title:"First Project",questIds:["ch2-q1","ch2-q2"]},{num:3,title:"Team Communication",questIds:["ch3-q1","ch3-q2"]},{num:4,title:"Building the Team",questIds:["ch4-q1","ch4-q2","ch4-q3"]},{num:5,title:"Knowledge & Docs",questIds:["ch5-q1","ch5-q2"]},{num:6,title:"Customization",questIds:["ch6-q1","ch6-q2","ch6-q3"]},{num:7,title:"Office Design",questIds:["ch7-q1","ch7-q2"]},{num:8,title:"Operations",questIds:["ch8-q1","ch8-q2","ch8-q3"]},{num:9,title:"Scaling Up",questIds:["ch9-q1","ch9-q2","ch9-q3"]},{num:10,title:"Tycoon Master",questIds:["ch10-q1"]}],vE={completedQuests:[],activeChapter:1,sideQuestsCompleted:[]};function qg(){return{...vE}}function mm(e,n){return n.completedQuests.includes(e.id)?"completed":"active"}function av(e){return js.filter(n=>mm(n,e)==="active")}function wE(e){const n=av(e);return n.find(i=>i.chapter===e.activeChapter)??n[0]??null}function kE(e,n){const a=js.find(o=>o.id===n);return a?e.completedQuests.includes(n)?{progress:e,quest:null}:{progress:{...e,completedQuests:[...e.completedQuests,n],firstCompletedAt:e.firstCompletedAt??new Date().toISOString()},quest:a}:{progress:e,quest:null}}function Yg(e){let n=1;for(const a of hm)if(a.questIds.every(i=>e.completedQuests.includes(i))){const i=hm.find(o=>o.num===a.num+1);i&&(n=i.num)}return n!==e.activeChapter?{...e,activeChapter:n}:e}function jE(e){const n=js.filter(i=>i.type==="main").length;return{completed:e.completedQuests.filter(i=>{var o;return((o=js.find(u=>u.id===i))==null?void 0:o.type)==="main"}).length,total:n}}function SE(e,n){if(e.trigger.type!==n.type)return!1;if(e.trigger.condition&&n.condition){for(const[a,i]of Object.entries(e.trigger.condition))if(a==="minRoles"){if(n.condition.roleCount<i)return!1}else if(n.condition[a]!==i)return!1}return!0}function CE({progress:e,onQuestAction:n,onClose:a,terminalWidth:i=0}){const{completed:o,total:u}=jE(e),d=u>0?Math.round(o/u*100):0,{panelRight:h,panelWidth:m,isResizing:f,handleResizeStart:x}=Go(i);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:h},onClick:a}),l.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)] ${f?"resizing":""}`,style:{right:h,width:m,background:"var(--terminal-bg)",borderLeftColor:"var(--desk-wood)"},children:[l.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${f?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:x}),l.jsxs("div",{className:"p-5 text-white relative",style:{background:"linear-gradient(135deg, #8B5E3C, #6B4226)"},children:[l.jsx("button",{onClick:a,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:"×"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xl",children:"🐾"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-lg font-bold",children:"Pupu's Quest Board"}),l.jsxs("div",{className:"text-xs opacity-70 mt-0.5",children:[o,"/",u," quests completed · ",d,"%"]})]})]}),l.jsx("div",{className:"mt-3",children:l.jsx("div",{className:"h-2 rounded-full overflow-hidden bg-white/15",children:l.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${d}%`,background:"#F4D03F"}})})})]}),l.jsx("div",{className:"flex-1 overflow-y-auto p-5 flex flex-col gap-3",children:hm.map(g=>{const w=js.filter(k=>g.questIds.includes(k.id)),b=w.every(k=>e.completedQuests.includes(k.id)),j=w.some(k=>mm(k,e)==="active");return l.jsxs("div",{className:"rounded-lg",style:{background:j?"var(--hud-bg-alt)":"transparent",border:j?"1px solid var(--accent)":"1px solid var(--terminal-border)"},children:[l.jsxs("div",{className:"px-3 py-2 flex items-center gap-2",children:[l.jsx("span",{className:"text-sm",children:b?"✅":"🟡"}),l.jsxs("span",{className:"text-sm font-medium",style:{color:j?"var(--accent)":"var(--terminal-text)"},children:["Chapter ",g.num,": ",g.title]})]}),l.jsx("div",{className:"px-3 pb-2 flex flex-col gap-1.5",children:w.map(k=>{const N=mm(k,e);return l.jsxs("div",{className:"flex items-start gap-2 pl-2",children:[l.jsx("span",{className:"text-xs mt-0.5 shrink-0",children:N==="completed"?"☑":"☐"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs",style:{color:N==="completed"?"var(--terminal-text-muted)":"var(--terminal-text)",textDecoration:N==="completed"?"line-through":"none"},children:k.title}),N==="active"&&k.hint&&n&&l.jsx("button",{onClick:()=>n(k.id),className:"shrink-0 text-[10px] px-2 py-0.5 rounded cursor-pointer hover:brightness-125 transition-all",style:{background:"var(--accent)",color:"#000",fontWeight:600},children:"GO →"})]}),N==="active"&&l.jsx("div",{className:"text-[10px] mt-1 leading-relaxed",style:{color:"var(--terminal-text-secondary)"},children:k.description}),N==="active"&&k.hint&&l.jsxs("div",{className:"text-[10px] mt-0.5",style:{color:"var(--accent)"},children:["💡 ",k.hint.message]})]})]},k.id)})})]},g.num)})})]})]})}function NE({projectId:e,onClose:n,terminalWidth:a=0}){const[i,o]=v.useState(null),{panelRight:u,panelWidth:d,isResizing:h,handleResizeStart:m}=Go(a);if(v.useEffect(()=>{ge.getProject(e).then(o).catch(console.error)},[e]),!i)return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:n}),l.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:d,background:"var(--terminal-bg)"},children:l.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading project..."})})]});const f=i.tasks.filter(w=>w.status==="done").length,x=i.tasks.length,g=x>0?Math.round(f/x*100):0;return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:n}),l.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)] ${h?"resizing":""}`,style:{right:u,width:d,background:"var(--terminal-bg)"},children:[l.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${h?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:m}),l.jsxs("div",{className:"p-5 bg-[var(--meeting-blue)] text-white relative",children:[l.jsx("div",{className:"text-sm opacity-70",children:"Meeting Room"}),l.jsx("button",{onClick:n,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:"×"}),l.jsx("div",{className:"text-xl font-bold mt-1",children:i.name}),l.jsxs("div",{className:"flex items-center gap-3 mt-3 text-sm",children:[l.jsxs("span",{children:["Tasks: ",x]}),l.jsxs("span",{children:["Done: ",f]}),l.jsxs("span",{children:["Progress: ",g,"%"]})]}),l.jsx("div",{className:"mt-2 h-1.5 bg-white/20 rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full bg-white rounded-full transition-all",style:{width:`${g}%`}})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[i.prd&&l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"PRD"}),l.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:l.jsx(As,{content:i.prd})})]}),l.jsxs("div",{children:[l.jsxs("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:["Tasks (",x,")"]}),l.jsx("div",{className:"space-y-2",children:i.tasks.map(w=>l.jsxs("div",{className:"rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-sm font-medium",style:{color:"var(--terminal-text)"},children:w.title}),l.jsx(EE,{status:w.status})]}),l.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-muted)"},children:w.role}),w.description&&l.jsx("div",{className:"text-xs mt-1.5 line-clamp-2",style:{color:"var(--terminal-text-secondary)"},children:w.description})]},w.id))})]})]})]})]})}function EE({status:e}){const n={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=n[e]??n.todo;return l.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:a.bg,color:a.color},children:e})}const AE={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function DE({roleId:e,roleName:n,mode:a="assign",onClose:i,onExecutionStart:o}){const[u,d]=v.useState(""),h=v.useRef(null);v.useEffect(()=>{var g;(g=h.current)==null||g.focus()},[]);const m=()=>{u.trim()&&(o(e,u.trim()),i())},f=g=>{g.key==="Enter"&&(g.metaKey||g.ctrlKey)&&m(),g.key==="Escape"&&i()},x=AE[e]??"#666";return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),l.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:[l.jsxs("div",{className:"p-5 text-white",style:{background:`linear-gradient(135deg, ${x}, ${x}cc)`},children:[l.jsx("div",{className:"text-lg font-bold",children:a==="ask"?"Ask":"Assign Task"}),l.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:a==="ask"?`to ${n}`:`to ${n} (${e})`})]}),l.jsxs("div",{className:"p-5",children:[l.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Task Description"}),l.jsx("textarea",{ref:h,value:u,onChange:g=>d(g.target.value),onKeyDown:f,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"}),l.jsx("div",{className:"text-[10px] text-white/30 mt-1",children:"Cmd+Enter to submit"})]}),l.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[l.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"}),l.jsx("button",{onClick:m,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:x},children:a==="ask"?"Ask":"Assign"})]})]})]})}const Xg={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function Vm({event:e,isThinkingCollapsed:n,onToggleThinking:a,onNavigateToJob:i,onOpenKnowledgeDoc:o,compact:u}){var h;const d=Xg[e.roleId]??"#888";switch(e.type){case"text":{const m=e.data.text??"",f=u?m.slice(0,300):m;return/[#*|`\[\]_~>-]/.test(f)?l.jsx("div",{className:"text-green-300/90 leading-relaxed event-markdown",children:l.jsx(Om,{remarkPlugins:[Hm],children:f})}):l.jsx("div",{className:"text-green-300/90 whitespace-pre-wrap leading-relaxed",children:f})}case"thinking":{const m=e.data.text??"";return l.jsxs("div",{className:"group",children:[l.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 select-text",children:[l.jsx("span",{children:n?"▶":"▼"}),l.jsx("span",{className:"italic",children:"thinking..."})]}),!n&&l.jsxs("div",{className:`ml-3 text-[var(--terminal-text-muted)] italic whitespace-pre-wrap opacity-60 text-[11px] overflow-hidden ${u?"max-h-[60px]":"max-h-[120px]"}`,children:[m.slice(0,u?200:500),m.length>(u?200:500)?"...":""]})]})}case"tool:start":{const m=String(e.data.name??""),f=e.data.input,x=typeof(f==null?void 0:f.command)=="string"?f.command.slice(0,80):"",g=typeof(f==null?void 0:f.file_path)=="string"?String(f.file_path):typeof(f==null?void 0:f.path)=="string"?String(f.path):"",w=g?g.split("/").pop()??"":"",b=/^(write_file|Write|edit_file|Edit)$/i.test(m),j=(h=g.match(/(?:^|\/)knowledge\/(.+\.md)$/))==null?void 0:h[1],k=b&&j&&o;return l.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[l.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?b&&m.toLowerCase().includes("edit")?"Edit":"Write":m}),k?l.jsx("button",{onClick:()=>o(j),className:"text-[10px] text-green-400 hover:text-green-300 underline underline-offset-2 cursor-pointer truncate",style:{maxWidth:u?200:400},children:w}):l.jsxs(l.Fragment,{children:[x&&l.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:x}),w&&l.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:w})]})]})}case"dispatch:start":{const m=e.data.targetRoleId??e.data.roleId??"",f=e.data.task??"",x=e.data.childJobId,g=Xg[m]??"#888";return l.jsx("div",{className:"my-1 p-2 rounded-lg border cursor-pointer hover:opacity-90 transition-opacity",style:{borderColor:`${g}44`,background:`${g}11`},onClick:()=>x&&(i==null?void 0:i(x)),children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("span",{style:{color:g},className:"font-bold text-[11px]",children:["→"," ",m.toUpperCase()]}),l.jsx("span",{className:"text-[var(--terminal-text-secondary)] text-[10px] truncate flex-1",children:f.slice(0,u?60:100)}),x&&i&&l.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 l.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 l.jsx("div",{className:"border-t border-[var(--terminal-border)] my-2 relative",children:l.jsxs("span",{className:"absolute -top-2 left-2 bg-[var(--terminal-bg)] px-2 text-[9px] text-[var(--terminal-text-muted)]",children:["Turn ",e.data.turn]})});case"stderr":return l.jsxs("div",{className:"text-red-400/80 text-[11px]",children:["⚠"," ",e.data.message]});case"job:start":return l.jsxs("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pb-1",children:[l.jsx("span",{style:{color:d},className:"font-bold",children:e.roleId.toUpperCase()})," ","started: ",(e.data.task??"").slice(0,u?50:80)]});case"job:done":{const m=e.data.turns??0,f=e.data.toolCalls??0;return l.jsx("div",{className:"mt-2 p-2 rounded-lg bg-green-900/20 border border-green-800/30",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"w-2 h-2 rounded-full bg-green-400"}),l.jsx("span",{className:"text-green-300 font-bold text-[11px]",children:"Complete"}),l.jsxs("span",{className:"text-[var(--terminal-text-muted)] text-[10px]",children:[m," turns · ",f," tools"]})]})})}case"job:error":return l.jsx("div",{className:"mt-2 p-2 rounded-lg bg-red-900/20 border border-red-800/30",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"w-2 h-2 rounded-full bg-red-400"}),l.jsx("span",{className:"text-red-300 font-bold text-[11px]",children:"Error"}),l.jsx("span",{className:"text-red-200/70 text-[10px]",children:e.data.message})]})});case"job:awaiting_input":{const m=e.data.question??"";return l.jsxs("div",{className:"mt-2 p-2 rounded-lg border",style:{background:"#F59E0B11",borderColor:"#F59E0B33"},children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:"#F59E0B",animation:"wave-pulse 1.5s ease-in-out infinite"}}),l.jsx("span",{className:"font-bold text-[11px]",style:{color:"#F59E0B"},children:"Awaiting Reply"})]}),m&&l.jsx("div",{className:"mt-1 text-[11px] text-[var(--terminal-text)] whitespace-pre-wrap",children:m})]})}case"job:reply":return l.jsx("div",{className:"mt-1 p-2 rounded-lg bg-blue-900/20 border border-blue-800/30",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-blue-300 font-bold text-[11px]",children:"CEO replied:"}),l.jsx("span",{className:"text-blue-200/80 text-[11px]",children:e.data.response??""})]})});case"import:scan":case"import:process":case"import:created":return l.jsxs("div",{className:"text-cyan-300/70 text-[11px]",children:["[",e.type,"] ",JSON.stringify(e.data)]});default:return null}}function TE({sessionId:e,title:n,color:a,variant:i,style:o,onClose:u,onMinimize:d,onDone:h,onNavigateToJob:m,onOpenKnowledgeDoc:f}){const{events:x,status:g,textOutput:w,childJobIds:b}=Ey(e),[j,k]=v.useState(0),[N,C]=v.useState(new Set),E=v.useRef(null),B=v.useRef(Date.now()),R=v.useRef(!1);v.useEffect(()=>{const I=setInterval(()=>{k(Math.floor((Date.now()-B.current)/1e3))},1e3);return()=>clearInterval(I)},[]),v.useEffect(()=>{E.current&&(E.current.scrollTop=E.current.scrollHeight)},[x]),v.useEffect(()=>{(g==="done"||g==="error")&&!R.current&&(R.current=!0,h==null||h())},[g,h]);const $=I=>{C(H=>{const q=new Set(H);return q.has(I)?q.delete(I):q.add(I),q})},_={idle:"Waiting",connecting:"Connecting...",streaming:"Working",done:"Complete",error:"Error"}[g],L={idle:"#888",connecting:"#888",streaming:a,done:"#2E7D32",error:"#C62828"}[g],U=I=>`${Math.floor(I/60)}:${String(I%60).padStart(2,"0")}`,Q=g==="done"||g==="error",D=l.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:[l.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{background:L}}),l.jsx("div",{children:l.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:n})})]}),l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:U(j)}),l.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:`${L}22`,color:L},children:_}),d&&i==="modal"&&l.jsx("button",{onClick:d,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),Q&&l.jsx("button",{onClick:u,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),l.jsxs("div",{ref:E,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[x.length===0&&g==="connecting"&&l.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:"Connecting to activity stream..."}),x.map(I=>l.jsx(Vm,{event:I,isThinkingCollapsed:N.has(I.seq),onToggleThinking:()=>$(I.seq),onNavigateToJob:m,onOpenKnowledgeDoc:f},I.seq)),g==="streaming"&&l.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),l.jsxs("div",{className:"px-5 py-3 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[l.jsxs("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:[x.length>0&&`${x.length} events`,w.length>0&&` · ${w.length} chars`,b.length>0&&` · ${b.length} dispatches`]}),Q&&l.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"?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:Q?u:void 0}),D]}):D}const FE={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function ME({orgNodes:e,rootId:n,activeRoles:a,onToggleRole:i}){const o=e[n];if(!o)return null;const u=!!a&&!!i,h=o.children.map(b=>e[b]).filter(Boolean),m=new Map,f=[];for(const b of h){const j=[];for(const k of b.children){const N=e[k];N&&(j.push(N),f.push(N))}m.set(b.id,j)}const x=b=>!a||a.has(b),g=u?h.filter(b=>a.has(b.id)).length+f.filter(b=>a.has(b.id)).length:h.length+f.length,w=h.length+f.length;return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider",children:u?"Select Target Roles":"Propagation Preview"}),u&&l.jsxs("span",{className:"text-[10px] text-white/50",children:[g,"/",w," selected"]})]}),l.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-lg p-4",children:[l.jsx("div",{className:"flex justify-center mb-2",children:l.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"})}),h.length>0&&l.jsx("div",{className:"flex justify-center mb-1",children:l.jsx("div",{className:"w-px h-3 bg-white/15"})}),h.length>1&&l.jsx("div",{className:"flex justify-center mb-1",children:l.jsx("div",{className:"h-px bg-white/15",style:{width:`${Math.min(h.length*80,320)}px`}})}),l.jsx("div",{className:"flex justify-center gap-3 mb-2 flex-wrap",children:h.map(b=>{const j=x(b.id),k=FE[b.id]??"#888";return l.jsx(RE,{node:b,active:j,color:k,interactive:u,onToggle:i,subRoles:m.get(b.id)??[],activeRoles:a},b.id)})}),f.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"flex justify-center mb-1",children:l.jsx("div",{className:"w-px h-2 bg-white/10"})}),l.jsx("div",{className:"flex justify-center gap-2 flex-wrap",children:f.map(b=>{var E;const j=x(b.id),k=(E=h.find(B=>B.children.includes(b.id)))==null?void 0:E.id,N=k?x(k):!0,C=u&&N;return l.jsx("span",{className:`px-2 py-0.5 text-[9px] font-semibold rounded border uppercase transition-all ${C?"cursor-pointer select-none":u?"cursor-not-allowed":""} ${j&&N?"border-white/15 text-white/40":"border-white/5 text-white/15 opacity-50"}`,onClick:C?()=>i(b.id,!j):void 0,title:u?N?j?"Click to exclude":"Click to include":`Enable ${k==null?void 0:k.toUpperCase()} first`:void 0,children:b.id},b.id)})}),l.jsx("div",{className:"text-center text-[8px] text-white/30 mt-1",children:"via re-dispatch"})]})]}),l.jsx("div",{className:"text-[10px] text-gray-400 mt-1.5",children:u?`${g} role${g!==1?"s":""} will receive this wave`:`${w} role${w!==1?"s":""} will receive this wave`})]})}function RE({node:e,active:n,color:a,interactive:i,onToggle:o,subRoles:u,activeRoles:d}){const h=v.useCallback(m=>{if(!(!i||!o)){if(n){o(e.id,!1);for(const f of u)d!=null&&d.has(f.id)&&o(f.id,!1)}else if(o(e.id,!0),m.shiftKey)for(const f of u)d!=null&&d.has(f.id)||o(f.id,!0)}},[i,o,n,e.id,u,d]);return l.jsxs("div",{className:"flex flex-col items-center",children:[l.jsx("span",{className:`px-2.5 py-1 text-[10px] font-bold rounded border-2 uppercase transition-all ${i?"cursor-pointer select-none hover:scale-105":""}`,style:{borderColor:n?a:`${a}44`,color:n?a:`${a}44`,background:n?`${a}22`:"transparent",opacity:n?1:.4},onClick:h,title:i?n?"Click to exclude (disables subordinates)":"Click to include / Shift+click to include with all subordinates":void 0,children:e.id}),l.jsx("span",{className:"text-[8px] text-white/30 mt-0.5",children:i?n?"active":"off":"direct"})]})}function zE({cLevelRoles:e,orgNodes:n,rootId:a,onClose:i,onDispatch:o}){const[u,d]=v.useState(""),h=v.useRef(null),[m,f]=v.useState(()=>{const k=new Set,N=n[a];if(N)for(const C of N.children){k.add(C);const E=n[C];if(E)for(const B of E.children)k.add(B)}return k});v.useEffect(()=>{var k;(k=h.current)==null||k.focus()},[]);const x=v.useCallback((k,N)=>{f(C=>{const E=new Set(C);return N?E.add(k):E.delete(k),E})},[]),g=e.filter(k=>m.has(k.id)).length,w=()=>{if(!u.trim()||g===0)return;const k=n[a];let N=0;if(k)for(const B of k.children){N++;const R=n[B];R&&(N+=R.children.length)}const E=m.size>=N?void 0:Array.from(m);o(u.trim(),E),i()},b=k=>{k.key==="Enter"&&(k.metaKey||k.ctrlKey)&&w(),k.key==="Escape"&&i()},j=a&&Object.keys(n).length>0;return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),l.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:[l.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[l.jsx("div",{className:"text-lg font-bold",children:"CEO Wave"}),l.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:j?"Select target roles and broadcast a directive":"Broadcast a directive to all C-Level reports"})]}),l.jsxs("div",{className:"p-5 space-y-4",children:[j&&l.jsx(ME,{orgNodes:n,rootId:a,activeRoles:m,onToggleRole:x}),!j&&l.jsxs("div",{children:[l.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Dispatching to"}),l.jsx("div",{className:"flex gap-2 flex-wrap",children:e.length>0?e.map(k=>l.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:[k.id.toUpperCase()," · ",k.name]},k.id)):l.jsx("span",{className:"text-xs text-gray-400 italic",children:"No C-Level roles found"})}),l.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Each C-Level receives the directive and delegates to their reports"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Directive"}),l.jsx("textarea",{ref:h,value:u,onChange:k=>d(k.target.value),onKeyDown:b,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"}),l.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Cmd+Enter to dispatch"})]})]}),l.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[l.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"}),l.jsxs("button",{onClick:w,disabled:!u.trim()||g===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 ",g," Role",g!==1?"s":""]})]})]})]})}function lv(e,n,a){const[i,o]=v.useState(new Map),[u,d]=v.useState(null),[h,m]=v.useState(new Set),f=v.useRef(new Map),x=v.useRef(i);x.current=i;const g=v.useRef(!1),w=v.useCallback(()=>{if(!a||Object.keys(n).length===0)return null;const R=new Map,$=new Set,_=U=>{const Q=n[U];Q&&($.add(U),R.set(U,{sessionId:"",roleId:U,roleName:Q.name,children:Q.children,status:"waiting",events:[],streamStatus:"idle"}),Q.children.forEach(_))},L=n[a];return L&&(R.set(a,{sessionId:"",roleId:a,roleName:"CEO",children:L.children,status:"not-dispatched",events:[],streamStatus:"idle"}),L.children.forEach(_)),{initial:R,allRoles:$}},[n,a]);v.useEffect(()=>{if(g.current)if(e.length>0)g.current=!1;else return;const R=w();if(!R)return;const{initial:$,allRoles:_}=R;for(const L of e){const U=$.get(L.roleId);U&&(U.sessionId=L.sessionId,U.status="running",U.streamStatus="connecting")}o($),m(L=>{if(L.size===0){const U=new Set(_);return U.delete(a),U}return L}),e.length>0&&d(L=>L??e[0].roleId)},[e,n,a,w]);const b=v.useCallback(R=>{m($=>{const _=new Set($);return _.has(R)?_.delete(R):_.add(R),_})},[]),j=v.useCallback(R=>{for(const[,$]of f.current)$.controller.abort();f.current.clear(),g.current=!0,o(R);for(const[$,_]of R)if($!==a&&_.events.length>0){d($);break}},[a]),k=v.useCallback((R,$)=>{const _=f.current.get(R);if(_&&!_.controller.signal.aborted){console.log(`[WaveTree] connectStream SKIP (already connected) → role=${$} session=${R}`);return}_&&_.controller.abort(),console.log(`[WaveTree] connectStream → role=${$} session=${R}`),o(D=>{const I=new Map(D),H=I.get($);return H&&I.set($,{...H,sessionId:R,status:"running",streamStatus:"connecting",events:[]}),I});const L=new AbortController,U={controller:L,lastSeq:-1};f.current.set(R,U);const Q=`/api/sessions/${R}/stream?from=0`;fetch(Q,{signal:L.signal}).then(async D=>{if(!D.ok||!D.body){o(te=>{const Y=new Map(te),se=Y.get($);return se&&Y.set($,{...se,streamStatus:"error"}),Y});return}console.log(`[WaveTree SSE] connected → role=${$} status=${D.status}`),o(te=>{const Y=new Map(te),se=Y.get($);return se&&Y.set($,{...se,streamStatus:"streaming",status:"running"}),Y});const I=D.body.getReader(),H=new TextDecoder;let q="",ue="";for(;;){const{done:te,value:Y}=await I.read();if(te)break;q+=H.decode(Y,{stream:!0});const se=q.split(`
|
|
83
|
-
`);q=se.pop()??"";for(const J of se)if(J.startsWith("event: "))ue=J.slice(7).trim();else if(J.startsWith("data: ")){try{const Z=JSON.parse(J.slice(6));if(console.log(`[WaveTree SSE] role=${$} event=${ue} type=${(Z==null?void 0:Z.type)??"?"} seq=${(Z==null?void 0:Z.seq)??"?"}`),ue==="activity"){const A=Z;A.seq>U.lastSeq&&(U.lastSeq=A.seq),o(F=>{const W=new Map(F),T=W.get($);if(!T||T.events.some(xe=>xe.seq===A.seq))return F;const de={...T,events:[...T.events,A]};if(A.type==="dispatch:start"&&A.data.childJobId){const xe=A.data.targetRoleId??A.data.roleId,ye=A.data.childSessionId;if(console.log(`[WaveTree] dispatch:start → target=${xe} childSession=${ye??"none"} from=${$}`),xe&&ye){const Le=W.get(xe);Le&&(W.set(xe,{...Le,sessionId:ye,status:"running",streamStatus:"connecting"}),setTimeout(()=>k(ye,xe),0))}}return A.type==="job:done"?(de.status="done",de.streamStatus="done"):A.type==="job:error"?(de.status="error",de.streamStatus="error"):A.type==="job:awaiting_input"?(de.status="awaiting_input",de.streamStatus="done"):A.type==="job:reply"&&(de.status="running",de.streamStatus="streaming"),W.set($,de),W})}else if(ue==="stream:end"){const A=Z.reason;A!=="replied"&&o(F=>{const W=new Map(F),T=W.get($);if(!T)return F;const de=A==="error"?"error":A==="awaiting_input"?"awaiting_input":"done";return W.set($,{...T,status:T.status==="running"?de:T.status,streamStatus:de==="error"?"error":"done"}),W})}}catch{}ue=""}}}).catch(D=>{D.name!=="AbortError"&&o(I=>{const H=new Map(I),q=H.get($);return q&&H.set($,{...q,streamStatus:"error"}),H})})},[]),N=v.useRef(new Set);v.useEffect(()=>{if(e.length===0)return;const R=new Set;for(const $ of e)R.add($.sessionId),k($.sessionId,$.roleId);return N.current=R,()=>{for(const $ of N.current){const _=f.current.get($);_&&(_.controller.abort(),f.current.delete($))}N.current.clear()}},[e,k]);const C=(()=>{let R=0,$=0,_=0,L=0;for(const[U,Q]of i)U!==a&&(L++,Q.status==="done"?R++:Q.status==="running"?$++:Q.status==="awaiting_input"&&_++);return{done:R,total:L,running:$,awaitingInput:_}})(),E=C.total>0&&C.running===0&&C.awaitingInput===0&&Array.from(i.values()).every(R=>R.status!=="running"&&R.status!=="awaiting_input"&&R.streamStatus!=="streaming"&&R.streamStatus!=="connecting");v.useEffect(()=>{E&&o(R=>{const $=new Map(R);let _=!1;for(const[L,U]of $)U.status==="waiting"&&($.set(L,{...U,status:"not-dispatched"}),_=!0);return _?$:R})},[E]);const B=v.useCallback(()=>{for(const[,$]of f.current)$.controller.abort();f.current.clear(),g.current=!1;const R=w();if(R){o(R.initial);const $=new Set(R.allRoles);$.delete(a),m($)}d(a)},[w,a]);return{nodes:i,selectedRoleId:u,selectNode:d,checkedRoles:h,toggleCheck:b,setCheckedRoles:m,progress:C,allDone:E,connectStream:k,injectStaticNodes:j,reset:B}}const Wg={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},ja=130,Gr=44,Gg=80;function _E(e,n){if(!e.get(n))return{layout:[],width:300,height:200};const i=[],o=[],u=[{id:n,depth:0,parentId:null}],d=new Set;for(;u.length>0;){const{id:x,depth:g,parentId:w}=u.shift();if(d.has(x))continue;for(d.add(x);o.length<=g;)o.push([]);o[g].push(x),i.push({roleId:x,x:0,y:g*Gg+20,parentId:w});const b=e.get(x);if(b)for(const j of b.children)e.has(j)&&!d.has(j)&&u.push({id:j,depth:g+1,parentId:x})}const h=Math.max(...o.map(x=>x.length))*(ja+16),m=Math.max(h,280);for(const x of o){const g=x.length*(ja+16)-16,w=(m-g)/2;x.forEach((b,j)=>{const k=i.find(N=>N.roleId===b);k&&(k.x=w+j*(ja+16))})}const f=o.length*Gg+40;return{layout:i,width:m,height:f}}function iv({nodes:e,rootId:n,selectedRoleId:a,onSelectNode:i,checkedRoles:o,onToggleCheck:u,eligibleRoles:d}){const{layout:h,width:m,height:f}=_E(e,n),x=!!u,g=b=>{const j=h.find(k=>k.roleId===b);return j?{cx:j.x+ja/2,cy:j.y+Gr/2}:{cx:0,cy:0}},w=b=>{switch(b.status){case"running":return Wg[b.roleId]??"#FBBF24";case"awaiting_input":return"#F59E0B";case"done":return"#2E7D32";case"error":return"#C62828";case"not-dispatched":return"#666";default:return"#888"}};return l.jsxs("svg",{viewBox:`0 0 ${m} ${f}`,width:Math.max(m,280),height:f,className:"block",style:{minWidth:m},children:[l.jsx("defs",{children:l.jsxs("filter",{id:"glow",children:[l.jsx("feGaussianBlur",{stdDeviation:"2",result:"blur"}),l.jsxs("feMerge",{children:[l.jsx("feMergeNode",{in:"blur"}),l.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),h.filter(b=>b.parentId).map(b=>{const j=g(b.parentId),k=g(b.roleId),N=e.get(b.roleId),C=e.get(b.parentId);let E="rgba(180,200,240,0.15)",B="4 4",R="";return(N==null?void 0:N.status)==="done"||(C==null?void 0:C.status)==="done"?(E="#2E7D3266",B=""):(N==null?void 0:N.status)==="awaiting_input"?(E="#F59E0B",B="6 4",R="wave-edge-flow"):(N==null?void 0:N.status)==="running"&&(E=Wg[b.roleId]??"#FBBF24",B="6 4",R="wave-edge-flow"),l.jsx("line",{x1:j.cx,y1:j.cy+Gr/2-4,x2:k.cx,y2:k.cy-Gr/2+4,stroke:E,strokeWidth:1.5,strokeDasharray:B,className:R},`${b.parentId}-${b.roleId}`)}),h.map(b=>{const j=e.get(b.roleId);if(!j)return null;const k=w(j),N=a===b.roleId,C=b.roleId===n,E=(o==null?void 0:o.has(b.roleId))??!1,B=C?N?.7:.5:j.status==="not-dispatched"&&!E?.35:1;return l.jsxs("g",{transform:`translate(${b.x}, ${b.y})`,style:{cursor:"pointer",opacity:B},onClick:()=>i(b.roleId),children:[l.jsx("rect",{x:0,y:0,width:ja,height:Gr,rx:8,ry:8,fill:"var(--terminal-bg-deeper, #181825)",stroke:N?"#fff":E?"#EF5350":k,strokeWidth:N||E?2:1.5,strokeDasharray:j.status==="not-dispatched"&&!E?"4 3":""}),l.jsx("circle",{cx:14,cy:Gr/2,r:4,fill:k,filter:j.status==="running"||j.status==="awaiting_input"?"url(#glow)":void 0,children:(j.status==="running"||j.status==="awaiting_input")&&l.jsx("animate",{attributeName:"opacity",values:"1;0.4;1",dur:"1.5s",repeatCount:"indefinite"})}),l.jsx("text",{x:26,y:Gr/2-4,fill:"var(--terminal-text, #fff)",fontSize:10,fontWeight:700,fontFamily:"var(--pixel-font)",children:j.roleId.toUpperCase()}),l.jsx("text",{x:26,y:Gr/2+10,fill:"var(--terminal-text-muted, #888)",fontSize:8,fontFamily:"var(--pixel-font)",children:j.status==="running"?"Working...":j.status==="awaiting_input"?"Awaiting Reply":j.status==="done"?"Complete":j.status==="error"?"Error":j.status==="waiting"?"Waiting":""}),j.status==="done"&&!x&&l.jsx("text",{x:ja-18,y:Gr/2+4,fontSize:14,fill:"#2E7D32",children:"✓"}),j.status==="error"&&!x&&l.jsx("text",{x:ja-18,y:Gr/2+4,fontSize:14,fill:"#C62828",children:"✗"}),x&&!C&&(()=>{const R=!d||d.has(b.roleId);return l.jsxs("g",{onClick:$=>{$.stopPropagation(),R&&(u==null||u(b.roleId))},style:{cursor:R?"pointer":"default",opacity:R?1:.2},children:[l.jsx("rect",{x:ja-24,y:Gr/2-10,width:20,height:20,fill:"transparent"}),l.jsx("rect",{x:ja-20,y:Gr/2-6,width:12,height:12,rx:2,ry:2,fill:E?"#EF5350":"transparent",stroke:E?"#EF5350":"#666",strokeWidth:1.5}),E&&l.jsx("text",{x:ja-18,y:Gr/2+4,fontSize:10,fontWeight:700,fill:"#fff",children:"✓"})]})})()]},b.roleId)})]})}const BE={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function OE({directive:e,rootJobs:n,orgNodes:a,rootRoleId:i,onClose:o,onMinimize:u,onDone:d,onOpenKnowledgeDoc:h,onSave:m}){const{nodes:f,selectedRoleId:x,selectNode:g,progress:w,allDone:b,connectStream:j}=lv(n,a,i),[k,N]=v.useState(0),[C,E]=v.useState(new Set),[B,R]=v.useState(""),[$,_]=v.useState(!1),[L,U]=v.useState(!1),Q=v.useRef(null),D=v.useRef(Date.now()),I=v.useRef(!1),H=v.useCallback(async()=>{if(m){U(!0);try{const F=n.map(W=>W.jobId).filter(W=>!!W);await m(F)}catch(F){console.error("Save failed:",F)}finally{U(!1),o()}}},[m,n,o]),q=v.useCallback(async()=>{if(!x||!B.trim())return;const F=f.get(x);if(!(!(F!=null&&F.sessionId)||F.status!=="awaiting_input"&&F.status!=="done")){_(!0);try{await ge.replyToSession(F.sessionId,B.trim()),R(""),j(F.sessionId,x)}catch(W){console.error("Reply failed:",W)}finally{_(!1)}}},[x,B,f,j]),ue=v.useCallback(async F=>{const W=f.get(F);if(W!=null&&W.sessionId)try{await ge.abortSession(W.sessionId)}catch(T){console.error("Abort failed:",T)}},[f]),te=v.useCallback(async()=>{for(const[,F]of f)if((F.status==="running"||F.status==="awaiting_input")&&F.sessionId)try{await ge.abortSession(F.sessionId)}catch{}},[f]);v.useEffect(()=>{const F=setInterval(()=>{N(Math.floor((Date.now()-D.current)/1e3))},1e3);return()=>clearInterval(F)},[]);const Y=v.useRef(!1);v.useEffect(()=>{const F=Q.current;if(!F)return;const W=()=>{const T=F.scrollHeight-F.scrollTop-F.clientHeight<60;Y.current=!T};return F.addEventListener("scroll",W),()=>F.removeEventListener("scroll",W)},[]),v.useEffect(()=>{Y.current=!1,Q.current&&(Q.current.scrollTop=Q.current.scrollHeight)},[x]),v.useEffect(()=>{Q.current&&!Y.current&&(Q.current.scrollTop=Q.current.scrollHeight)},[f]),v.useEffect(()=>{b&&!I.current&&(I.current=!0,d==null||d()),!b&&I.current&&(I.current=!1)},[b,d]);const se=F=>`${Math.floor(F/60)}:${String(F%60).padStart(2,"0")}`,J=x?f.get(x):null,Z=x?BE[x]??"#888":"#888",A=F=>{E(W=>{const T=new Set(W);return T.has(F)?T.delete(F):T.add(F),T})};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm pointer-events-none"}),l.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:[l.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.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"}}),l.jsx("div",{children:l.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:b?"WAVE COMPLETE":"WAVE COMMAND CENTER"})})]}),l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:se(k)}),w.awaitingInput>0&&l.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:"#F59E0B22",color:"#F59E0B"},children:[w.awaitingInput," awaiting reply"]}),l.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:b?"#2E7D3222":"#B71C1C22",color:b?"#2E7D32":"#B71C1C"},children:[w.done,"/",w.total," done"]}),!b&&(w.running>0||w.awaitingInput>0)&&l.jsx("button",{onClick:te,className:"text-xs px-2 py-0.5 rounded font-semibold cursor-pointer",style:{background:"#C6282822",color:"#C62828",border:"1px solid #C6282844"},title:"Stop all running jobs",children:"Stop All"}),l.jsx("button",{onClick:u,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),l.jsx("button",{onClick:o,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",title:b?"Dismiss wave":"Close (jobs keep running)",children:"×"})]})]}),l.jsx("div",{className:"px-5 py-2 border-b border-[var(--terminal-border)] shrink-0",children:l.jsxs("span",{className:"text-[var(--terminal-text-secondary)] text-xs italic",children:["“",e,"”"]})}),l.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[l.jsxs("div",{className:"shrink-0 border-b border-[var(--terminal-border)] flex flex-col",children:[l.jsxs("div",{className:"flex items-center gap-3 px-4 py-1.5",children:[l.jsx("span",{className:"text-[10px] font-bold text-[var(--terminal-text-secondary)] uppercase tracking-wider",children:"Org Propagation"}),l.jsx("div",{className:"flex gap-x-3 ml-auto",children:[{label:"running",color:"#FBBF24",dot:!0},{label:"awaiting",color:"#F59E0B",dot:!0},{label:"done",color:"#2E7D32",dot:!1},{label:"waiting",color:"#888",dot:!1},{label:"error",color:"#C62828",dot:!1}].map(F=>l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:F.color,animation:F.dot?"wave-pulse 1.5s ease-in-out infinite":void 0}}),l.jsx("span",{className:"text-[8px] text-[var(--terminal-text-muted)]",children:F.label})]},F.label))})]}),l.jsx("div",{className:"overflow-x-auto overflow-y-auto px-3 pb-2",style:{maxHeight:"35vh"},children:l.jsx(iv,{nodes:f,rootId:i,selectedRoleId:x,onSelectNode:g})})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[J&&l.jsxs("div",{className:"px-4 py-2 border-b border-[var(--terminal-border)] shrink-0 flex items-center gap-2",children:[l.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:Z}}),l.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-xs",children:J.roleId.toUpperCase()}),l.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs",children:J.roleName}),l.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full font-semibold",style:{background:J.status==="awaiting_input"?"#F59E0B22":`${Z}22`,color:J.status==="awaiting_input"?"#F59E0B":Z},children:J.status==="running"?"Working":J.status==="done"?"Complete":J.status==="error"?"Error":J.status==="waiting"?"Waiting":J.status==="awaiting_input"?"Awaiting Reply":"Not dispatched"}),(J.status==="running"||J.status==="awaiting_input")&&J.sessionId&&l.jsx("button",{onClick:()=>ue(J.roleId),className:"text-[10px] px-2 py-0.5 rounded font-semibold cursor-pointer ml-1",style:{background:"#C6282822",color:"#C62828",border:"1px solid #C6282844"},title:"Force stop this job",children:"Stop"})]}),l.jsxs("div",{ref:Q,className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-1 text-xs font-mono select-text",children:[J&&J.events.length===0&&l.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:J.status==="waiting"?"Waiting for dispatch...":J.status==="running"?"Connecting to activity stream...":J.status==="not-dispatched"?"This role was not dispatched in this wave.":""}),J==null?void 0:J.events.map(F=>l.jsx(Vm,{event:F,isThinkingCollapsed:C.has(F.seq),onToggleThinking:()=>A(F.seq),onNavigateToJob:W=>{const T=J==null?void 0:J.events.find(xe=>xe.type==="dispatch:start"&&xe.data.childJobId===W),de=T==null?void 0:T.data.targetRoleId;de&&f.has(de)&&g(de)},onOpenKnowledgeDoc:h},F.seq)),(J==null?void 0:J.status)==="running"&&l.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),(J==null?void 0:J.status)==="awaiting_input"&&l.jsxs("div",{className:"px-4 py-3 border-t border-[var(--terminal-border)] shrink-0",style:{background:"#F59E0B0A"},children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:"#F59E0B",animation:"wave-pulse 1.5s ease-in-out infinite"}}),l.jsxs("span",{className:"text-[11px] font-semibold",style:{color:"#F59E0B"},children:[J.roleName," is waiting for your response"]})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"text",value:B,onChange:F=>R(F.target.value),onKeyDown:F=>{F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),q())},placeholder:"Type your response...",disabled:$,className:"flex-1 px-3 py-1.5 text-xs rounded border bg-[var(--terminal-bg)] text-[var(--terminal-text)] border-[var(--terminal-border)] outline-none focus:border-[#F59E0B]",autoFocus:!0}),l.jsx("button",{onClick:q,disabled:$||!B.trim(),className:"px-4 py-1.5 text-xs rounded font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#F59E0B",color:"#000"},children:$?"...":"Reply"})]})]}),(J==null?void 0:J.status)==="done"&&J.sessionId&&l.jsxs("div",{className:"px-4 py-3 border-t border-[var(--terminal-border)] shrink-0",style:{background:"#1565C00A"},children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsxs("span",{className:"text-[11px] font-semibold",style:{color:"#64B5F6"},children:["Follow-up to ",J.roleName]}),l.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:"Send a follow-up directive"})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"text",value:B,onChange:F=>R(F.target.value),onKeyDown:F=>{F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),q())},placeholder:"e.g., 좋아 KB-3 진행해, Engineer에게 시켜...",disabled:$,className:"flex-1 px-3 py-1.5 text-xs rounded border bg-[var(--terminal-bg)] text-[var(--terminal-text)] border-[var(--terminal-border)] outline-none focus:border-[#64B5F6]"}),l.jsx("button",{onClick:q,disabled:$||!B.trim(),className:"px-4 py-1.5 text-xs rounded font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#1565C0",color:"#fff"},children:$?"...":"Send"})]})]}),!J&&l.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"}),l.jsxs("div",{className:"px-4 py-2 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[l.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:J&&J.events.length>0&&`${J.events.length} events`}),b&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:o,className:"px-4 py-1.5 text-xs rounded-lg font-semibold cursor-pointer",style:{background:"rgba(255,255,255,0.08)",color:"var(--terminal-text-muted)"},children:"Dismiss"}),m&&l.jsx("button",{onClick:H,disabled:L,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer disabled:opacity-50",style:{background:"#2E7D32"},children:L?"Saving...":"Save Wave"})]})]})]})]})]})]})}const $E={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function Vg({orgNodes:e,rootRoleId:n,cLevelRoles:a,pastWaves:i,activeWaves:o,onDispatch:u,onClose:d,onDone:h,onSave:m,onOpenKnowledgeDoc:f,onRefreshWaves:x,terminalWidth:g=0,onMaximize:w,inline:b=!1,onOpenSaveModal:j}){const[k,N]=v.useState(""),[C,E]=v.useState(null),[B,R]=v.useState(!1),[$,_]=v.useState(o.length>0?0:-1),[L,U]=v.useState(!1),Q=v.useRef(null),D=$>=0?o[$]??null:null,I=v.useMemo(()=>[],[]),H=(D==null?void 0:D.rootJobs)??I,q=lv(H,e,n);v.useEffect(()=>{if(C){const re=LE(e,n,C.roles);q.injectStaticNodes(re);for(const Ae of C.roles??[])if(Ae.status==="running"&&Ae.jobId){const We=re.get(Ae.roleId);We!=null&&We.sessionId&&setTimeout(()=>q.connectStream(We.sessionId,Ae.roleId),100)}}},[C,e,n]),v.useEffect(()=>{!q.selectedRoleId&&n&&q.selectNode(n)},[n]);const ue=v.useRef(o.length);v.useEffect(()=>{const re=o.length>ue.current;ue.current=o.length,re?(_(0),E(null),U(!1)):o.length>0&&$<0&&!L&&(_(0),E(null))},[o.length,$,L]);const[te,Y]=v.useState(null),se=v.useMemo(()=>{if(!te)return null;const re=te.modified.length+te.untracked.length;return{branch:te.branch,dirty:re>0,count:re}},[te]),J=v.useCallback(()=>{ge.getSaveStatus("code").then(re=>{Y({dirty:re.modified.length+re.untracked.length>0,modified:re.modified,untracked:re.untracked,lastCommit:re.lastCommit,branch:re.branch})}).catch(()=>{})},[]);v.useEffect(()=>{J()},[J]);const[Z,A]=v.useState(0);v.useEffect(()=>{if(!D)return;const re=setInterval(()=>{A(Math.floor((Date.now()-D.startedAt)/1e3))},1e3);return()=>clearInterval(re)},[D]);const[F,W]=v.useState(""),[T,de]=v.useState(!1),[xe,ye]=v.useState([]),[Le,Xe]=v.useState(!1),[Ye,ht]=v.useState(null),tt=v.useRef(null);v.useEffect(()=>{if(Ye){const re=setTimeout(()=>ht(null),3e3);return()=>clearTimeout(re)}},[Ye]);const Je=v.useCallback(async re=>["image/png","image/jpeg","image/gif","image/webp"].includes(re.type)?re.size>5*1024*1024?(ht(`Too large: ${(re.size/1024/1024).toFixed(1)}MB. Max 5MB.`),null):new Promise(We=>{const Et=new FileReader;Et.onload=()=>{const kn=Et.result.split(",")[1];We({type:"image",data:kn,name:re.name,mediaType:re.type})},Et.onerror=()=>{ht("Failed to read file"),We(null)},Et.readAsDataURL(re)}):(ht(`Unsupported: ${re.type}. Use PNG, JPG, GIF, or WebP.`),null),[]),Ne=v.useCallback(async re=>{const Ae=[];for(const We of Array.from(re)){const Et=await Je(We);Et&&Ae.push(Et)}Ae.length>0&&ye(We=>[...We,...Ae])},[Je]),De=v.useCallback(re=>{re.preventDefault(),re.stopPropagation(),Xe(!0)},[]),yt=v.useCallback(re=>{re.preventDefault(),re.stopPropagation(),Xe(!1)},[]),ct=v.useCallback(re=>{re.preventDefault(),re.stopPropagation(),Xe(!1),re.dataTransfer.files.length>0&&Ne(re.dataTransfer.files)},[Ne]),pt=v.useCallback(re=>{const Ae=[];for(let We=0;We<re.clipboardData.items.length;We++){const Et=re.clipboardData.items[We];if(Et.type.startsWith("image/")){const kn=Et.getAsFile();kn&&Ae.push(kn)}}Ae.length>0&&(re.preventDefault(),Ne(Ae))},[Ne]),[jt,Wt]=v.useState(320),Ft=v.useRef(!1),Nt=v.useRef(0),$n=v.useRef(0),me=v.useCallback(re=>{re.preventDefault(),Ft.current=!0,Nt.current=re.clientX,$n.current=jt;const Ae=Et=>{if(!Ft.current)return;const kn=Nt.current-Et.clientX;Wt(Math.max(200,Math.min(500,$n.current+kn)))},We=()=>{Ft.current=!1,window.removeEventListener("mousemove",Ae),window.removeEventListener("mouseup",We)};window.addEventListener("mousemove",Ae),window.addEventListener("mouseup",We)},[jt]),[Se,Ee]=v.useState(new Set),G=v.useRef(null),ce=v.useRef(!1);v.useEffect(()=>{const re=G.current;if(!re)return;const Ae=()=>{const We=re.scrollHeight-re.scrollTop-re.clientHeight<60;ce.current=!We};return re.addEventListener("scroll",Ae),()=>re.removeEventListener("scroll",Ae)},[]),v.useEffect(()=>{!ce.current&&G.current&&(G.current.scrollTop=G.current.scrollHeight)},[q.nodes,q.selectedRoleId]);const ne=q.selectedRoleId?q.nodes.get(q.selectedRoleId)??null:null,ke=ne?$E[ne.roleId]??"#888":"#888",ve=q.progress.running>0||q.progress.awaitingInput>0,ze=q.selectedRoleId===n,_e=!!C&&!D,Be=(D==null?void 0:D.directive)??(C==null?void 0:C.directive)??"",He=v.useCallback(re=>{const Ae=new Set,We=[re];for(;We.length>0;){const Et=We.shift();if(Ae.has(Et))continue;Ae.add(Et);const kn=e[Et];kn&&We.push(...kn.children)}return Ae},[e]),rt=v.useMemo(()=>{if(!q.selectedRoleId)return new Set;const re=He(q.selectedRoleId);return re.delete(n),re},[q.selectedRoleId,He,n]),Ve=v.useRef(null);v.useEffect(()=>{if(q.selectedRoleId===Ve.current||(Ve.current=q.selectedRoleId,!q.selectedRoleId))return;const re=He(q.selectedRoleId);re.delete(n),q.setCheckedRoles(re)},[q.selectedRoleId,He,n]);const bt=q.checkedRoles.size,Re=()=>{if(!k.trim()&&xe.length===0||bt===0)return;const Ae=Array.from(q.nodes.keys()).filter(Et=>Et!==n).every(Et=>q.checkedRoles.has(Et)),We=xe.length>0?xe:void 0;u(k.trim(),Ae?void 0:Array.from(q.checkedRoles),We),N(""),ye([])},Ie=re=>{re.key==="Enter"&&(re.metaKey||re.ctrlKey)&&(re.preventDefault(),Re()),re.key==="Escape"&&d()},_t=v.useCallback(async()=>{if(!q.selectedRoleId||!F.trim()&&xe.length===0)return;const re=q.nodes.get(q.selectedRoleId);if(!re)return;const Ae=xe.length>0?xe:void 0;de(!0);try{if(re.status==="awaiting_input"&&re.sessionId){const We=await ge.replyToSession(re.sessionId,F.trim(),Ae);W(""),ye([]),q.connectStream(We.sessionId||re.sessionId,q.selectedRoleId)}else{const We=(D==null?void 0:D.id)??(C==null?void 0:C.waveId)??(C==null?void 0:C.id),Et=await ge.startJob({type:"assign",roleId:q.selectedRoleId,task:F.trim(),...We&&{waveId:We},...Ae&&{attachments:Ae}});W(""),ye([]),Et.sessionId&&q.connectStream(Et.sessionId,q.selectedRoleId)}}catch(We){console.error("Reply failed:",We)}finally{de(!1)}},[q,F,xe,D,C]),Bt=v.useCallback(async re=>{const Ae=q.nodes.get(re);if(Ae!=null&&Ae.sessionId)try{await ge.abortSession(Ae.sessionId)}catch{}},[q.nodes]),Ot=v.useCallback(async()=>{for(const[,re]of q.nodes)if((re.status==="running"||re.status==="awaiting_input")&&re.sessionId)try{await ge.abortSession(re.sessionId)}catch{}},[q.nodes]),fn=v.useCallback(async re=>{R(!0),E(null),_(-1);try{const Ae=await ge.getWaveDetail(re);Ae.replay&&E(Ae.replay)}catch(Ae){console.error("Failed to load wave:",Ae)}finally{R(!1)}},[]),wn=v.useRef(!1);v.useEffect(()=>{q.allDone&&!wn.current&&D&&(wn.current=!0,J(),h==null||h())},[q.allDone,D,h,J]);const P=v.useCallback(async()=>{if(!m||!D)return;const re=D.rootJobs.map(Ae=>Ae.jobId).filter(Ae=>!!Ae);await m(D.directive,re,{waveId:D.id,sessionIds:D.sessionIds})},[m,D]),Oe=re=>{Ee(Ae=>{const We=new Set(Ae);return We.has(re)?We.delete(re):We.add(re),We})},nt=re=>{const Ae=Math.floor(re/60),We=re%60;return`${Ae}:${We.toString().padStart(2,"0")}`},{panelRight:Qt,panelWidth:we,isResizing:kt,handleResizeStart:ln}=Go(g,700,w),sn=l.jsxs(l.Fragment,{children:[!b&&l.jsxs("div",{className:"shrink-0 px-4 py-3",style:{background:"linear-gradient(180deg, #B71C1C 0%, #7f1d1d 100%)"},children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"text-white font-bold text-lg tracking-wide",style:{fontFamily:"var(--pixel-font)"},children:"Wave Center"}),ve&&l.jsxs("span",{className:"text-white/60 text-xs",children:[q.progress.running," running"]}),l.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[w&&l.jsx("button",{onClick:w,className:"text-white/50 hover:text-white text-xs cursor-pointer",children:"Maximize"}),l.jsx("button",{onClick:d,className:"text-white/50 hover:text-white text-xl leading-none cursor-pointer px-2",children:"✕"})]})]}),l.jsx("div",{className:"text-white/60 text-xs mt-0.5",children:D?`${o.length} active wave${o.length!==1?"s":""}`:_e?"Reviewing past wave":"Broadcast directives to your organization"})]}),l.jsxs("div",{className:"flex-1 flex min-h-0",children:[l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[(D||_e)&&l.jsxs("div",{className:"px-4 py-2 border-b flex items-center gap-3 shrink-0",style:{borderColor:"var(--terminal-border)"},children:[l.jsx("div",{className:"w-3 h-3 rounded-full shrink-0",style:{background:ve?"#FBBF24":q.allDone||_e?"#2E7D32":"#B71C1C",animation:ve?"wave-pulse 2s ease-in-out infinite":void 0}}),l.jsxs("span",{className:"text-[var(--terminal-text-secondary)] text-xs italic flex-1 min-w-0 truncate",children:["“",Be,"”"]}),D&&l.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono shrink-0",children:nt(Z)}),_e&&l.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-semibold shrink-0",style:{background:ve?"#FBBF2422":"#2E7D3222",color:ve?"#FBBF24":"#2E7D32"},children:ve?"LIVE":"REPLAY"}),_e&&(C==null?void 0:C.startedAt)&&l.jsx("span",{className:"text-[var(--terminal-text-muted)] text-[10px] shrink-0",children:new Date(C.startedAt).toLocaleString()}),q.progress.awaitingInput>0&&l.jsxs("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-semibold shrink-0",style:{background:"#F59E0B22",color:"#F59E0B"},children:[q.progress.awaitingInput," awaiting"]}),l.jsxs("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-semibold shrink-0",style:{background:q.allDone||_e&&!ve?"#2E7D3222":"#B71C1C22",color:q.allDone||_e&&!ve?"#2E7D32":"#B71C1C"},children:[q.progress.done,"/",q.progress.total]}),ve&&l.jsx("button",{onClick:Ot,className:"text-[10px] px-2 py-0.5 rounded font-semibold cursor-pointer shrink-0",style:{background:"#C6282822",color:"#C62828",border:"1px solid #C6282844"},children:"Stop All"})]}),l.jsxs("div",{className:"shrink-0 border-b flex flex-col",style:{borderColor:"var(--terminal-border)"},children:[l.jsxs("div",{className:"flex items-center gap-3 px-4 py-1.5",children:[l.jsx("span",{className:"text-[10px] font-bold text-[var(--terminal-text-secondary)] uppercase tracking-wider",children:D||_e?"Org Propagation":"Select Target Roles"}),l.jsxs("span",{className:"ml-auto text-[10px] text-[var(--terminal-text-muted)]",children:[q.checkedRoles.size,"/",q.progress.total," selected"]}),(D||_e)&&l.jsx("div",{className:"flex gap-x-3",children:[{label:"running",color:"#FBBF24",dot:!0},{label:"awaiting",color:"#F59E0B",dot:!0},{label:"done",color:"#2E7D32",dot:!1},{label:"waiting",color:"#888",dot:!1},{label:"error",color:"#C62828",dot:!1}].map(re=>l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:re.color,animation:re.dot?"wave-pulse 1.5s ease-in-out infinite":void 0}}),l.jsx("span",{className:"text-[8px] text-[var(--terminal-text-muted)]",children:re.label})]},re.label))})]}),l.jsx("div",{className:"overflow-x-auto overflow-y-auto px-3 pb-2",style:{maxHeight:"30vh"},children:l.jsx(iv,{nodes:q.nodes,rootId:n,selectedRoleId:q.selectedRoleId,onSelectNode:q.selectNode,checkedRoles:q.checkedRoles,onToggleCheck:q.toggleCheck,eligibleRoles:rt})})]}),B?l.jsx("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:"Loading wave data..."}):ze?l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[l.jsxs("div",{className:"px-4 py-2 border-b shrink-0 flex items-center gap-2",style:{borderColor:"var(--terminal-border)"},children:[l.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:"#B71C1C"}}),l.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-xs",children:"CEO"}),l.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs",children:"Directive Control"}),l.jsxs("span",{className:"ml-auto text-[10px] text-[var(--terminal-text-muted)]",children:[bt," target role",bt!==1?"s":""," selected"]})]}),l.jsxs("div",{ref:G,className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-2 text-xs font-mono select-text",children:[Be&&l.jsxs("div",{className:"flex items-start gap-2 pb-3 border-b",style:{borderColor:"var(--terminal-border)"},children:[l.jsx("span",{className:"text-[10px] font-bold px-1.5 py-0.5 rounded shrink-0",style:{background:"#B71C1C33",color:"#EF5350"},children:"CEO"}),l.jsxs("div",{children:[l.jsx("span",{className:"text-[var(--terminal-text-secondary)] whitespace-pre-wrap",children:Be}),D&&l.jsxs("div",{className:"text-[9px] text-[var(--terminal-text-muted)] mt-1",children:["dispatched ",nt(Z)," ago to ",D.rootJobs.length," role",D.rootJobs.length!==1?"s":""]})]})]}),!Be&&!D&&l.jsx("div",{className:"text-[var(--terminal-text-muted)] text-center py-8",children:"Select target roles using checkboxes, then dispatch a directive below."})]}),l.jsxs("div",{className:"px-4 py-3 border-t shrink-0",style:{borderColor:"var(--terminal-border)",background:"var(--hud-bg-alt)"},children:[xe.length>0&&l.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:xe.map((re,Ae)=>l.jsxs("div",{className:"relative group w-14 h-14 rounded-lg overflow-hidden border border-[var(--terminal-border)] bg-[var(--terminal-inline-bg)]",children:[l.jsx("img",{src:`data:${re.mediaType};base64,${re.data}`,alt:re.name,className:"w-full h-full object-cover"}),l.jsx("button",{onClick:()=>ye(We=>We.filter((Et,kn)=>kn!==Ae)),className:"absolute top-0.5 right-0.5 w-4 h-4 rounded-full bg-black/70 text-white text-[9px] flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:"x"}),l.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-[7px] text-white truncate px-1",children:re.name})]},Ae))}),Ye&&l.jsx("div",{className:"text-[10px] text-red-400 mb-1",children:Ye}),l.jsxs("div",{className:"flex gap-2 items-end",children:[l.jsx("button",{onClick:()=>{var re;return(re=tt.current)==null?void 0:re.click()},className:"w-8 h-8 rounded-lg bg-[var(--terminal-inline-bg)] border border-[var(--terminal-border)] text-[var(--terminal-text-muted)] flex items-center justify-center shrink-0 cursor-pointer hover:text-[var(--terminal-text-secondary)] transition-colors",title:"Attach image",children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})}),l.jsx("textarea",{ref:Q,value:k,onChange:re=>N(re.target.value),onKeyDown:Ie,onPaste:pt,placeholder:"e.g. Report current status across all departments",rows:2,className:"flex-1 px-3 py-2 text-sm rounded-lg border bg-[var(--terminal-bg)] text-[var(--terminal-text)] outline-none resize-none",style:{borderColor:"var(--terminal-border)"}}),l.jsxs("button",{onClick:Re,disabled:!k.trim()&&xe.length===0||bt===0,className:"px-4 py-2 text-xs font-bold rounded-lg cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed shrink-0",style:{background:k.trim()&&bt>0?"#B71C1C":"#333",color:"#fff",minWidth:140},children:["Dispatch to ",bt," Role",bt!==1?"s":""]})]}),l.jsx("div",{className:"text-[9px] text-[var(--terminal-text-muted)] mt-1",children:"Cmd+Enter to dispatch"})]})]}):l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[ne&&l.jsxs("div",{className:"px-4 py-2 border-b shrink-0 flex items-center gap-2",style:{borderColor:"var(--terminal-border)"},children:[l.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:ke}}),l.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-xs",children:ne.roleId.toUpperCase()}),l.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs",children:ne.roleName}),l.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full font-semibold",style:{background:ne.status==="awaiting_input"?"#F59E0B22":ne.status==="running"?"#FBBF2422":`${ke}22`,color:ne.status==="awaiting_input"?"#F59E0B":ne.status==="running"?"#FBBF24":ke},children:ne.status==="running"?"Working...":ne.status==="done"?"Complete":ne.status==="error"?"Error":ne.status==="waiting"?"Waiting":ne.status==="awaiting_input"?"Awaiting Reply":"Not dispatched"}),l.jsxs("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:[ne.events.length," events"]}),(ne.status==="running"||ne.status==="awaiting_input")&&ne.sessionId&&l.jsx("button",{onClick:()=>Bt(ne.roleId),className:"text-[10px] px-2 py-0.5 rounded font-semibold cursor-pointer ml-1",style:{background:"#C6282822",color:"#C62828",border:"1px solid #C6282844"},children:"Stop"})]}),l.jsx("input",{ref:tt,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,onChange:re=>{var Ae;(Ae=re.target.files)!=null&&Ae.length&&Ne(re.target.files),re.target.value=""},className:"hidden"}),l.jsxs("div",{ref:G,className:`flex-1 min-h-0 overflow-y-auto p-4 space-y-1 text-xs font-mono select-text transition-colors ${Le?"bg-amber-500/5 ring-1 ring-inset ring-amber-500/30":""}`,onDragOver:De,onDragLeave:yt,onDrop:ct,children:[ne&&Be&&ne.status!=="waiting"&&ne.status!=="not-dispatched"&&l.jsxs("div",{className:"flex items-start gap-2 mb-3 pb-2 border-b",style:{borderColor:"var(--terminal-border)"},children:[l.jsx("span",{className:"text-[10px] font-bold px-1.5 py-0.5 rounded shrink-0",style:{background:"#B71C1C33",color:"#EF5350"},children:"CEO"}),l.jsx("span",{className:"text-[var(--terminal-text-secondary)] whitespace-pre-wrap",children:Be})]}),ne&&ne.events.length===0&&l.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:ne.status==="waiting"?"Waiting for dispatch...":ne.status==="running"?"Connecting to activity stream...":ne.status==="not-dispatched"?"This role was not dispatched. Send a follow-up to activate.":""}),ne==null?void 0:ne.events.map((re,Ae)=>{const We=ne.events,Et=re.type==="job:start"&&Ae>0,kn=We[Ae+1];if((re.type==="job:done"||re.type==="job:error"||re.type==="job:awaiting_input")&&(kn==null?void 0:kn.type)==="job:start")return null;if(Et){const xn=re.data.task??"",gn=xn.match(/\[CEO Follow-up\]\n([\s\S]+)$/),dr=gn?gn[1].trim():xn;return l.jsx(v.Fragment,{children:l.jsxs("div",{className:"flex items-start gap-2 my-3 pt-2 pb-2 border-t border-b",style:{borderColor:"var(--terminal-border)"},children:[l.jsx("span",{className:"text-[10px] font-bold px-1.5 py-0.5 rounded shrink-0",style:{background:"#B71C1C33",color:"#EF5350"},children:"CEO"}),l.jsx("span",{className:"text-[var(--terminal-text-secondary)] whitespace-pre-wrap",children:dr})]})},`followup-${re.seq}`)}return l.jsx(Vm,{event:re,isThinkingCollapsed:Se.has(re.seq),onToggleThinking:()=>Oe(re.seq),onNavigateToJob:xn=>{for(const[,gn]of q.nodes)if(gn.events.some(dr=>dr.data.childJobId===xn)){q.selectNode(gn.roleId);return}},onOpenKnowledgeDoc:f},re.seq)}),(ne==null?void 0:ne.status)==="running"&&l.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"}),!ne&&l.jsx("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-xs h-full",children:"Click a node in the org tree to view activity"})]}),((ne==null?void 0:ne.status)==="awaiting_input"||(ne==null?void 0:ne.status)==="done"||(ne==null?void 0:ne.status)==="not-dispatched")&&(xe.length>0||Ye||Le)&&l.jsxs("div",{className:"px-4 pt-2 border-t shrink-0",style:{borderColor:"var(--terminal-border)"},children:[Ye&&l.jsx("div",{className:"text-[10px] text-red-400 mb-1",children:Ye}),Le&&l.jsx("div",{className:"text-[11px] text-amber-400 text-center mb-1",children:"Drop image here"}),xe.length>0&&l.jsx("div",{className:"flex flex-wrap gap-2 mb-1",children:xe.map((re,Ae)=>l.jsxs("div",{className:"relative group w-14 h-14 rounded-lg overflow-hidden border border-[var(--terminal-border)] bg-[var(--terminal-inline-bg)]",children:[l.jsx("img",{src:`data:${re.mediaType};base64,${re.data}`,alt:re.name,className:"w-full h-full object-cover"}),l.jsx("button",{onClick:()=>ye(We=>We.filter((Et,kn)=>kn!==Ae)),className:"absolute top-0.5 right-0.5 w-4 h-4 rounded-full bg-black/70 text-white text-[9px] flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:"x"}),l.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-[7px] text-white truncate px-1",children:re.name})]},Ae))})]}),(ne==null?void 0:ne.status)==="awaiting_input"&&l.jsxs("div",{className:"px-4 py-3 border-t shrink-0",style:{borderColor:"var(--terminal-border)",background:"#F59E0B0A"},children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:"#F59E0B",animation:"wave-pulse 1.5s ease-in-out infinite"}}),l.jsxs("span",{className:"text-[11px] font-semibold",style:{color:"#F59E0B"},children:[ne.roleName," is waiting for your response"]})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>{var re;return(re=tt.current)==null?void 0:re.click()},disabled:T,className:"w-7 h-7 rounded bg-[var(--terminal-inline-bg)] border border-[var(--terminal-border)] text-[var(--terminal-text-muted)] flex items-center justify-center shrink-0 cursor-pointer hover:text-[var(--terminal-text-secondary)] disabled:opacity-30 transition-colors",title:"Attach image",children:l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})}),l.jsx("input",{type:"text",value:F,onChange:re=>W(re.target.value),onKeyDown:re=>{re.key==="Enter"&&!re.shiftKey&&(re.preventDefault(),_t())},onPaste:pt,placeholder:"Type your response...",disabled:T,className:"flex-1 px-3 py-1.5 text-xs rounded border bg-[var(--terminal-bg)] text-[var(--terminal-text)] outline-none",style:{borderColor:"var(--terminal-border)"},autoFocus:!0}),l.jsx("button",{onClick:_t,disabled:T||!F.trim()&&xe.length===0,className:"px-4 py-1.5 text-xs rounded font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#F59E0B",color:"#000"},children:T?"...":"Reply"})]})]}),ne&&(ne.status==="done"||ne.status==="not-dispatched")&&l.jsxs("div",{className:"px-4 py-3 border-t shrink-0",style:{borderColor:"var(--terminal-border)",background:"#1565C00A"},children:[l.jsx("div",{className:"flex items-center gap-2 mb-2",children:l.jsxs("span",{className:"text-[11px] font-semibold",style:{color:"#64B5F6"},children:["Follow-up to ",ne.roleName]})}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>{var re;return(re=tt.current)==null?void 0:re.click()},disabled:T,className:"w-7 h-7 rounded bg-[var(--terminal-inline-bg)] border border-[var(--terminal-border)] text-[var(--terminal-text-muted)] flex items-center justify-center shrink-0 cursor-pointer hover:text-[var(--terminal-text-secondary)] disabled:opacity-30 transition-colors",title:"Attach image",children:l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})}),l.jsx("input",{type:"text",value:F,onChange:re=>W(re.target.value),onKeyDown:re=>{re.key==="Enter"&&!re.shiftKey&&(re.preventDefault(),_t())},onPaste:pt,placeholder:"Send a follow-up directive...",disabled:T,className:"flex-1 px-3 py-1.5 text-xs rounded border bg-[var(--terminal-bg)] text-[var(--terminal-text)] outline-none",style:{borderColor:"var(--terminal-border)"}}),l.jsx("button",{onClick:_t,disabled:T||!F.trim()&&xe.length===0,className:"px-4 py-1.5 text-xs rounded font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#1565C0",color:"#fff"},children:T?"...":"Send"})]})]}),q.allDone&&D&&m&&l.jsx("div",{className:"px-4 py-2 border-t shrink-0 flex justify-end",style:{borderColor:"var(--terminal-border)"},children:l.jsx("button",{onClick:P,className:"px-4 py-1.5 text-xs rounded font-semibold cursor-pointer",style:{background:"#1565C022",color:"#64B5F6",border:"1px solid #1565C044"},children:"Save Wave"})})]})]}),l.jsxs("div",{className:"shrink-0 border-l flex flex-col relative",style:{width:jt,borderColor:"var(--terminal-border)",background:"var(--hud-bg-alt)"},children:[l.jsx("div",{className:"absolute top-0 bottom-0 w-1.5 cursor-col-resize hover:bg-[var(--accent)] z-10",style:{left:-2},onMouseDown:me}),l.jsx("div",{className:"p-3 pb-0",children:l.jsx("button",{onClick:()=>{E(null),_(-1),U(!0),q.reset()},className:"w-full px-3 py-1.5 text-[11px] font-bold rounded-lg cursor-pointer transition-colors",style:{background:!C&&$<0?"#B71C1C":"var(--terminal-inline-bg)",color:!C&&$<0?"#fff":"var(--terminal-text-secondary)",border:"1px solid",borderColor:!C&&$<0?"#B71C1C":"var(--terminal-border)"},children:"+ New Wave"})}),o.length>0&&l.jsxs("div",{className:"p-3",children:[l.jsx("div",{className:"text-[10px] font-bold text-[var(--terminal-text-muted)] uppercase tracking-wider mb-2",children:"Active"}),l.jsx("div",{className:"flex flex-col gap-1.5",children:o.map((re,Ae)=>l.jsxs("button",{onClick:()=>{_(Ae),E(null),U(!1)},className:"text-left p-2 rounded-lg cursor-pointer transition-colors",style:{background:$===Ae&&!C?"var(--terminal-bg)":"transparent",border:$===Ae&&!C?"1px solid var(--accent)":"1px solid transparent"},children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500 shrink-0 animate-pulse"}),l.jsxs("span",{className:"text-[11px] text-[var(--terminal-text)] truncate font-medium",children:[re.directive.slice(0,40),re.directive.length>40?"...":""]})]}),l.jsxs("div",{className:"text-[9px] text-[var(--terminal-text-muted)] mt-0.5 pl-3.5",children:[re.rootJobs.length," role",re.rootJobs.length!==1?"s":""]})]},re.id))})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-3",children:[l.jsxs("div",{className:"text-[10px] font-bold text-[var(--terminal-text-muted)] uppercase tracking-wider mb-2",children:["Past Waves (",i.length,")"]}),i.length===0&&l.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] italic",children:"No past waves yet"}),l.jsx("div",{className:"flex flex-col gap-1.5",children:i.map(re=>l.jsx(IE,{wave:re,active:(C==null?void 0:C.id)===re.id,onLoad:()=>fn(re.id)},re.id))})]}),se&&l.jsxs("button",{onClick:j,disabled:!j,className:"px-3 py-2.5 border-t shrink-0 flex items-center gap-1.5 w-full text-left hover:bg-white/5 transition-colors cursor-pointer disabled:cursor-default",style:{borderColor:"var(--terminal-border)"},children:[l.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:se.dirty?"var(--idle-amber)":"#2E7D32"}}),l.jsx("span",{className:"text-[10px] font-mono text-[var(--terminal-text-muted)] truncate",children:se.branch}),se.dirty&&l.jsxs("span",{className:"text-[9px] ml-auto shrink-0",style:{color:"var(--idle-amber)"},children:[se.count," unsaved"]}),!se.dirty&&l.jsx("span",{className:"text-[9px] text-green-400 ml-auto shrink-0",children:"clean"})]})]})]})]});return b?l.jsx("div",{className:"flex flex-col h-full w-full",style:{background:"var(--terminal-bg)"},children:sn}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:Qt},onClick:d}),l.jsxs("div",{className:"fixed top-0 bottom-0 z-50 flex flex-col",style:{right:Qt,width:we,background:"var(--terminal-bg)",borderLeft:"1px solid var(--terminal-border)",transition:kt?"none":"width 0.2s ease"},children:[l.jsx("div",{className:"absolute top-0 bottom-0 w-1 cursor-col-resize hover:bg-[var(--accent)] z-50",style:{left:0},onMouseDown:ln}),sn]})]})}function LE(e,n,a){const i=new Map,o=d=>{const h=e[d];!h||i.has(d)||(i.set(d,{sessionId:"",roleId:d,roleName:h.name,children:h.children,status:"not-dispatched",events:[],streamStatus:"idle"}),h.children.forEach(o))},u=e[n];u&&(i.set(n,{sessionId:"",roleId:n,roleName:"CEO",children:u.children,status:"not-dispatched",events:[],streamStatus:"idle"}),u.children.forEach(o));for(const d of a){const h=i.get(d.roleId);if(h){const m=d.status==="running";i.set(d.roleId,{...h,sessionId:d.sessionId??d.jobId??"",status:d.status||"done",events:d.events,streamStatus:m?"connecting":"done"})}for(const m of d.childJobs){const f=i.get(m.roleId);f&&i.set(m.roleId,{...f,sessionId:m.jobId??"",status:m.status||"done",events:m.events,streamStatus:"done"})}}return i}function IE({wave:e,active:n,onLoad:a}){const i=e.id.match(/^(\d{4})(\d{2})(\d{2})-(\d{2})(\d{2})/),o=i?`${i[1]}-${i[2]}-${i[3]} ${i[4]}:${i[5]}`:e.id;return l.jsx("div",{className:"rounded-lg cursor-pointer transition-colors hover:bg-[var(--terminal-bg)]",style:{border:n?"1px solid var(--accent)":"1px solid var(--terminal-border)",background:n?"var(--terminal-bg)":void 0},onClick:a,children:l.jsxs("div",{className:"p-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[e.hasRunning?l.jsx("span",{className:"w-1.5 h-1.5 rounded-full animate-pulse shrink-0",style:{background:"#4CAF50"}}):l.jsx("span",{className:"text-[10px]",children:"▶"}),l.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:o}),e.hasRunning?l.jsx("span",{className:"text-[9px] ml-auto animate-pulse",style:{color:"#4CAF50"},children:"running"}):e.commit?l.jsx("span",{className:"text-[9px] text-green-400 ml-auto font-mono",title:`Committed: ${e.commit.sha}`,children:e.commit.sha.slice(0,7)}):e.rolesCount?l.jsx("span",{className:"text-[9px] ml-auto",style:{color:"var(--idle-amber)"},title:"No commit recorded",children:"uncommitted"}):null]}),l.jsx("div",{className:"text-[10px] text-[var(--terminal-text-secondary)] mt-0.5 line-clamp-2 leading-relaxed",children:e.directive.slice(0,80)}),e.rolesCount?l.jsxs("div",{className:"text-[9px] text-[var(--terminal-text-muted)] mt-0.5",children:[e.rolesCount," role",e.rolesCount!==1?"s":""]}):null]})})}const HE={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 Km(e){return HE[e]??{skinColor:"#B0BEC5",hairColor:"#78909C",shirtColor:"#607D8B",pantsColor:"#455A64",shoeColor:"#37474F"}}const sv=["#FDEBD0","#F5CBA7","#D4A07A","#C68642","#8D5524","#5C3A1E","#F3D1C7","#E8BEAC","#B07D62","#704214"],ov=["#1A0A00","#2C1810","#4E342E","#6D4C41","#8D6E63","#D4A574","#F5E6CA","#FFD700","#B71C1C","#AD1457","#4A148C","#1A237E","#004D40","#1A1A1A","#78909C","#E0E0E0"],cv=["#1565C0","#E65100","#2E7D32","#4A148C","#AD1457","#00695C","#D32F2F","#F57F17","#1B5E20","#283593","#4E342E","#37474F","#880E4F","#00838F","#6A1B9A","#FF6F00"],uv=["#37474F","#1A237E","#3E2723","#263238","#1B5E20","#455A64","#212121","#4E342E","#0D47A1","#311B92"],dv=["#212121","#1A1A1A","#37474F","#4E342E","#7B1FA2","#D32F2F","#1565C0","#F57F17","#2E7D32","#FFFFFF"],ll={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":"#f0f3f6","--hud-bg-alt":"#e4e8ec","--pixel-border":"#c0c8d0","--terminal-bg":"#ffffff","--terminal-border":"#d0d7de","--terminal-border-hover":"#0969da","--terminal-text":"#1f2328","--terminal-text-secondary":"#484f58","--terminal-text-muted":"#6e7781","--accent":"#0969da","--active-green":"#1a7f37","--idle-amber":"#9a6700","--bar-bg":"#24292f","--bar-text":"#e6edf3","--bar-border":"#444c56","--terminal-bg-deeper":"#e8ecf0"}},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 UE({color:e,selected:n,onClick:a}){return l.jsx("button",{onClick:a,className:"customize-swatch",style:{background:e,outline:n?"2px solid #fff":"2px solid transparent",boxShadow:n?`0 0 0 1px ${e}, 0 0 6px ${e}88`:"none"}})}function Do({label:e,presets:n,value:a,onChange:i}){return l.jsxs("div",{className:"customize-row",children:[l.jsxs("div",{className:"customize-row-header",children:[l.jsx("span",{className:"customize-row-label",children:e}),l.jsx("div",{className:"customize-row-current",style:{background:a}})]}),l.jsx("div",{className:"customize-swatches",children:n.map(o=>l.jsx(UE,{color:o,selected:o===a,onClick:()=>i(o)},o))})]})}function Ah({label:e,items:n,value:a,onChange:i,lockInfo:o}){return l.jsxs("div",{className:"customize-row",children:[l.jsx("div",{className:"customize-row-header",children:l.jsx("span",{className:"customize-row-label",children:e})}),l.jsx("div",{className:"customize-swatches",style:{gap:4},children:n.map(u=>{const d=o?o.getLockLevel(u.id):1,h=u.id===a,m=o?d>o.roleLevel&&!h:!1,f=o?h&&d>o.roleLevel:!1;return l.jsxs("button",{onClick:()=>{m||i(u.id===a?void 0:u.id)},className:"customize-swatch",style:{width:"auto",height:"auto",padding:m?"2px 6px 10px 6px":"2px 6px",fontSize:9,fontFamily:"var(--font-pixel, monospace)",background:h?"rgba(255,255,255,0.15)":m?"rgba(255,255,255,0.02)":"rgba(255,255,255,0.04)",outline:h?f?"2px solid #F59E0B":"2px solid #fff":"2px solid transparent",color:m?"rgba(255,255,255,0.25)":h?"#fff":"rgba(255,255,255,0.5)",borderRadius:4,cursor:m?"not-allowed":"pointer",opacity:m?.35:1,position:"relative"},children:[u.name,m&&l.jsxs("span",{style:{position:"absolute",bottom:1,left:"50%",transform:"translateX(-50%)",fontSize:8,color:"rgba(255,255,255,0.5)",whiteSpace:"nowrap"},children:["🔒"," Lv.",d]}),f&&l.jsxs("span",{style:{position:"absolute",bottom:-8,left:"50%",transform:"translateX(-50%)",fontSize:7,color:"#F59E0B",whiteSpace:"nowrap"},children:["⚠"," Lv.",d]})]},u.id)})})]})}function Dh({label:e,active:n,onClick:a}){return l.jsx("button",{onClick:a,style:{flex:1,padding:"6px 0",fontSize:10,fontFamily:"var(--font-pixel, monospace)",fontWeight:"bold",letterSpacing:1,background:n?"rgba(255,255,255,0.08)":"transparent",color:n?"#fff":"rgba(255,255,255,0.35)",border:"none",borderBottom:n?"2px solid #3B82F6":"2px solid transparent",cursor:"pointer",transition:"all 0.15s"},children:e})}function _l(e){return e[Math.floor(Math.random()*e.length)]}function ys(e){var o,u,d;const n=_b(),a=Bb(),i=Ob().filter(h=>!e||Lb(h.id,e));return{skinColor:_l(sv),hairColor:_l(ov),shirtColor:_l(cv),pantsColor:_l(uv),shoeColor:_l(dv),hairStyle:(o=_l(n))==null?void 0:o.id,outfitStyle:(u=_l(a))==null?void 0:u.id,accessory:(d=_l(i))==null?void 0:d.id}}function fv({roleId:e,appearance:n,onChange:a,onRandomize:i,onReset:o,label:u,roleLevel:d}){const[h,m]=v.useState("look"),f=v.useCallback((N,C)=>{a({...n,[N]:C})},[n,a]),x=v.useRef(null),g=v.useCallback(N=>{var B;const C=(B=N.target.files)==null?void 0:B[0];if(!C)return;const E=new Image;E.onload=()=>{const R=cC(E);a({...R,hairStyle:n.hairStyle,outfitStyle:n.outfitStyle,accessory:n.accessory}),URL.revokeObjectURL(E.src)},E.src=URL.createObjectURL(C),N.target.value=""},[n.hairStyle,n.outfitStyle,n.accessory,a]),w=_b(),b=Bb(),j=Ob(),k=d!==void 0?j.filter(N=>Lb(N.id,d)).length:j.length;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"customize-preview",children:[l.jsx("div",{className:"customize-preview-bg",children:l.jsx(Ul,{roleId:e,appearance:n,scale:12})}),u&&l.jsx("div",{className:"customize-preview-name",children:u}),l.jsxs("div",{className:"customize-preview-actions",children:[l.jsx("button",{className:"customize-btn customize-btn--random",onClick:i,children:"RANDOM"}),l.jsx("button",{className:"customize-btn customize-btn--reset",onClick:o,children:"RESET"}),l.jsx("button",{className:"customize-btn",onClick:()=>{var N;return(N=x.current)==null?void 0:N.click()},style:{fontSize:9,opacity:.7},children:"PHOTO"}),l.jsx("input",{ref:x,type:"file",accept:"image/*",onChange:g,style:{display:"none"}})]})]}),l.jsxs("div",{className:"customize-colors",children:[l.jsxs("div",{style:{display:"flex",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:[l.jsx(Dh,{label:"LOOK",active:h==="look",onClick:()=>m("look")}),l.jsx(Dh,{label:"OUTFIT",active:h==="outfit",onClick:()=>m("outfit")}),l.jsx(Dh,{label:"ACCESSORY",active:h==="accessory",onClick:()=>m("accessory")})]}),h==="look"&&l.jsxs(l.Fragment,{children:[l.jsx(Do,{label:"SKIN",presets:sv,value:n.skinColor,onChange:N=>f("skinColor",N)}),l.jsx(Do,{label:"HAIR COLOR",presets:ov,value:n.hairColor,onChange:N=>f("hairColor",N)}),l.jsx(Ah,{label:"HAIR STYLE",items:w,value:n.hairStyle,onChange:N=>f("hairStyle",N)})]}),h==="outfit"&&l.jsxs(l.Fragment,{children:[l.jsx(Ah,{label:"STYLE",items:b,value:n.outfitStyle,onChange:N=>f("outfitStyle",N)}),l.jsx(Do,{label:"TOP",presets:cv,value:n.shirtColor,onChange:N=>f("shirtColor",N)}),l.jsx(Do,{label:"PANTS",presets:uv,value:n.pantsColor,onChange:N=>f("pantsColor",N)}),l.jsx(Do,{label:"SHOES",presets:dv,value:n.shoeColor,onChange:N=>f("shoeColor",N)})]}),h==="accessory"&&l.jsxs(l.Fragment,{children:[d!==void 0&&l.jsxs("div",{style:{padding:"4px 8px",marginBottom:4,background:"rgba(255,255,255,0.04)",borderRadius:4,fontSize:9,fontFamily:"var(--font-pixel, monospace)",color:"rgba(255,255,255,0.5)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[l.jsxs("span",{children:["Lv.",d]}),l.jsxs("span",{children:[k,"/",j.length," unlocked"]})]}),l.jsx(Ah,{label:"ACCESSORY",items:j,value:n.accessory,onChange:N=>f("accessory",N),lockInfo:d!==void 0?{roleLevel:d,getLockLevel:$b}:void 0}),l.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:d!==void 0&&d<10?"Level up to unlock more accessories":"More accessories coming soon"})]})]})]})}const qE=[{value:"c-level",label:"C-Level"},{value:"member",label:"Member"}];function pm(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,24)}function Th(e){switch(e){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"}};default:return{authority:{autonomous:["Implementation within assigned tasks"],needsApproval:["Design changes","New dependencies"]},knowledge:{reads:["projects/"],writes:[]},reports:{daily:"standup",weekly:""}}}}const YE={cto:{name:"CTO",id:"cto",level:"c-level"},cbo:{name:"CBO",id:"cbo",level:"c-level"},pm:{name:"PM",id:"pm",level:"member"},engineer:{name:"Engineer",id:"engineer",level:"member"},designer:{name:"Designer",id:"designer",level:"member"},qa:{name:"QA Engineer",id:"qa",level:"member"}};let $l=null;async function XE(){if($l)return $l;try{const a=await ge.getPreferences();if(a.instanceId)return $l=a.instanceId,localStorage.setItem("tycono_instance_id",$l),$l}catch{}const e="tycono_instance_id";let n=localStorage.getItem(e);return n||(n=crypto.randomUUID(),localStorage.setItem(e,n)),$l=n,n}const To=4;function WE(e,n,a){const i=e.trim();if(!i||i.startsWith("#"))return null;const o=i.split(",").map(g=>g.trim()),u=o[0];if(!u)return null;const d=pm(u),m=(o[1]||"member").toLowerCase()==="c-level"?"c-level":"member",f=o[2]||"ceo";let x;return n.has(d)?x="ID already exists":a.has(d)&&(x="Duplicate ID in batch"),a.add(d),{name:u,id:d,level:m,reportsTo:f,error:x}}function GE({existingRoles:e,onClose:n,onHire:a,onStoreVisit:i,questHint:o}){const[u,d]=v.useState("single"),[h,m]=v.useState([]),[f,x]=v.useState(!1),[g,w]=v.useState("popular"),[b,j]=v.useState(""),[k,N]=v.useState(null),[C,E]=v.useState(!1),[B,R]=v.useState(""),[$,_]=v.useState("browse"),[L,U]=v.useState(""),[Q,D]=v.useState(""),[I,H]=v.useState("ceo"),[q,ue]=v.useState(null),[te,Y]=v.useState(1),[se,J]=v.useState(""),[Z,A]=v.useState(""),[F,W]=v.useState(!1),[T,de]=v.useState("member"),[xe,ye]=v.useState(()=>{const P=e.find(Oe=>Oe.level==="c-level");return(P==null?void 0:P.id)??"ceo"}),[Le,Xe]=v.useState(""),[Ye,ht]=v.useState(ys),[tt,Je]=v.useState(!1),[Ne,De]=v.useState(""),[yt,ct]=v.useState([]),[pt,jt]=v.useState(new Set),[Wt,Ft]=v.useState(""),[Nt,$n]=v.useState("input"),[me,Se]=v.useState({done:0,total:0}),Ee=v.useRef(null),G=v.useRef(null),ce=v.useRef(null);v.useEffect(()=>{ge.getSkills().then(P=>ct(P.filter(Oe=>Oe.installed))).catch(()=>{}),XE().then(P=>ue(P)).catch(()=>{})},[]),v.useEffect(()=>{var P,Oe,nt;u==="single"?(te===1&&((P=Ee.current)==null||P.focus()),te===2&&((Oe=G.current)==null||Oe.focus())):u==="bulk"&&Nt==="input"&&((nt=ce.current)==null||nt.focus())},[te,u,Nt]),v.useEffect(()=>{u==="store"&&$==="browse"&&h.length===0&&ne()},[u,$]);const ne=async()=>{x(!0);try{const P=await wr.getCharacters({sort:g,instanceId:q??void 0});m(P.characters)}catch{R("Failed to load job board")}x(!1)};v.useEffect(()=>{u==="store"&&$==="browse"&&ne()},[g,q]);const ke=v.useMemo(()=>{if(!b.trim())return h;const P=b.toLowerCase();return h.filter(Oe=>Oe.name.toLowerCase().includes(P)||Oe.id.toLowerCase().includes(P)||(Oe.tagline??"").toLowerCase().includes(P))},[h,b]),ve=v.useMemo(()=>new Set(e.map(P=>P.id)),[e]),ze=v.useMemo(()=>{const P=Wt.split(`
|
|
84
|
-
`),Oe=new Set;return P.map(nt=>WE(nt,ve,Oe)).filter(nt=>nt!==null)},[Wt,ve]),_e=ze.length>0&&ze.every(P=>!P.error),Be=P=>{J(P),F||A(pm(P))},He=se.trim().length>0&&Z.trim().length>0&&!e.some(P=>P.id===Z),rt=Le.trim().length>0,Ve=async()=>{Je(!0),De("");const P=Th(T);try{await a({id:Z,name:se.trim(),level:T,reportsTo:xe,persona:Le.trim(),...P,skills:pt.size>0?[...pt]:void 0},Ye),n()}catch(Oe){De(Oe instanceof Error?Oe.message:"Failed to create role"),Je(!1)}},bt=P=>P===1?He:P===2?rt:!0,Re=async()=>{Je(!0),De(""),Se({done:0,total:ze.length});try{for(let P=0;P<ze.length;P++){const Oe=ze[P],nt=Th(Oe.level),Qt=ys(),we=`${Oe.name}. A ${Oe.level} role reporting to ${Oe.reportsTo}.`;await a({id:Oe.id,name:Oe.name,level:Oe.level,reportsTo:Oe.reportsTo,persona:we,...nt},Qt),Se({done:P+1,total:ze.length})}n()}catch(P){De(P instanceof Error?P.message:"Failed to create roles"),Je(!1)}},Ie=async P=>{E(!0),R("");try{const Oe=await wr.getCharacter(P);N(Oe),U(Oe.name||""),D(pm(Oe.name||P)),_("review")}catch{R("Failed to load character details")}finally{E(!1)}},_t=async(P,Oe)=>{if(!q)return;const nt=h.find(we=>we.id===P);if(!nt)return;const Qt=nt.my_vote===Oe?0:Oe;try{const we=await wr.voteCharacter(P,q,Qt);m(kt=>kt.map(ln=>ln.id===P?{...ln,upvotes:we.upvotes,downvotes:we.downvotes,vote_score:we.upvotes-we.downvotes,my_vote:Qt===0?null:Qt}:ln))}catch{}},Bt=async()=>{if(!k)return;Je(!0),De("");const P=k,Oe=P.level==="c-level"?"c-level":"member",nt=Th(Oe),Qt=P.skills!=null&&typeof P.skills=="object"&&!Array.isArray(P.skills)&&"primary"in P.skills;try{await a({id:Q,name:L.trim(),level:Oe,reportsTo:I,persona:P.persona||`${L}. Imported from Job Board.`,authority:P.authority||nt.authority,knowledge:nt.knowledge,reports:nt.reports,source:{id:`tycono/${P.id}`,sync:"manual",forked_at:"1.0.0",upstream_version:"1.0.0"},skillContent:Qt?P.skills:void 0},P.appearance?P.appearance:ys()),wr.trackInstall(P.id).catch(()=>{}),n()}catch(we){De(we instanceof Error?we.message:"Failed to hire"),Je(!1)}},Ot=async P=>{if(q)try{await wr.deleteCharacter(P,q),m(Oe=>Oe.filter(nt=>nt.id!==P))}catch{}},fn=P=>{P.key==="Escape"&&n(),P.key==="Enter"&&(P.metaKey||P.ctrlKey)&&(u==="single"?te<To&&bt(te)?Y(te+1):te===To&&Ve():u==="bulk"?Nt==="input"&&_e?$n("review"):Nt==="review"&&Re():u==="store"&&$==="review"&&Bt())},wn=e.some(P=>P.id===Z)&&Z.length>0;return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:n}),l.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:fn,children:[l.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #2E7D32, #43A047)"},children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("div",{className:"text-lg font-bold",children:"Hire New Role"}),l.jsxs("div",{className:"flex bg-black/20 rounded-lg p-0.5",children:[l.jsx("button",{onClick:()=>{d("single"),De("")},className:`px-3 py-1 text-xs font-semibold rounded-md cursor-pointer transition-colors ${u==="single"?"bg-white/20 text-white":"text-white/50 hover:text-white/70"}`,children:"Single"}),l.jsx("button",{onClick:()=>{d("bulk"),De("")},className:`px-3 py-1 text-xs font-semibold rounded-md cursor-pointer transition-colors ${u==="bulk"?"bg-white/20 text-white":"text-white/50 hover:text-white/70"}`,children:"Bulk"}),l.jsx("button",{onClick:()=>{d("store"),De(""),i==null||i()},className:`px-3 py-1 text-xs font-semibold rounded-md cursor-pointer transition-colors ${u==="store"?"bg-white/20 text-white":"text-white/50 hover:text-white/70"}`,children:"Job Board"})]})]}),o&&l.jsxs("div",{className:"mt-2 px-3 py-1.5 rounded-lg text-xs flex items-center gap-2",style:{background:"rgba(0,0,0,0.2)"},children:[l.jsx("span",{children:"🐾"}),l.jsx("span",{className:"opacity-90",children:o.message}),o.roleId&&u==="single"&&te===1&&!se&&l.jsx("button",{className:"ml-auto px-2 py-0.5 rounded text-[10px] font-semibold cursor-pointer hover:brightness-125",style:{background:"rgba(255,255,255,0.15)",color:"#fff"},onClick:()=>{const P=YE[o.roleId];P&&(J(P.name),A(P.id),W(!0),de(P.level))},children:"Auto-fill →"})]}),l.jsxs("div",{className:"text-sm opacity-80 mt-0.5 flex items-center gap-2",children:[l.jsx("span",{children:u==="single"?`Step ${te} of ${To}`:u==="bulk"?Nt==="input"?"Enter roles, one per line":`Review ${ze.length} roles`:$==="browse"?`${h.length} roles available`:"Review & customize"}),u==="store"&&$==="browse"&&l.jsx("a",{href:"https://tycono.ai/jobs",target:"_blank",rel:"noopener noreferrer",className:"text-[10px] opacity-60 hover:opacity-100 transition-opacity",onClick:P=>P.stopPropagation(),children:"Open in browser ↗"})]})]}),u==="single"&&l.jsx("div",{className:"flex gap-1 px-5 pt-4",children:Array.from({length:To},(P,Oe)=>Oe+1).map(P=>l.jsx("div",{className:"flex-1 h-1 rounded-full transition-colors",style:{background:P<=te?"#2E7D32":"rgba(255,255,255,0.1)"}},P))}),l.jsx("div",{className:"p-5 min-h-[240px] overflow-y-auto flex-1",children:u==="store"?l.jsxs(l.Fragment,{children:[$==="browse"&&l.jsxs("div",{className:"space-y-3",children:[q?l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 rounded-lg bg-green-900/10 border border-green-800/20 text-[10px]",children:[l.jsxs("span",{className:"text-green-400/70",children:["Signed in · ",l.jsxs("span",{className:"font-mono text-white/40",children:[q.slice(0,8),"..."]})]}),l.jsx("button",{onClick:()=>{$l=null,localStorage.removeItem("tycono_instance_id"),ue(null)},className:"text-white/30 hover:text-white/60 cursor-pointer",children:"Sign out"})]}):l.jsx(VE,{onLogin:P=>{$l=P,localStorage.setItem("tycono_instance_id",P),ue(P)}}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{placeholder:"Paste ID (tycono:engineer)",className:"flex-1 p-2 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 focus:outline-none focus:border-accent/40 transition-colors font-mono",onKeyDown:P=>{if(P.key==="Enter"){const nt=P.target.value.trim().replace(/^tycono:/,"");nt&&(Ie(nt),P.target.value="")}}}),l.jsx("button",{onClick:()=>{const P=document.querySelector('[placeholder="Paste ID (tycono:engineer)"]');if(P){const nt=P.value.trim().replace(/^tycono:/,"");nt&&(Ie(nt),P.value="")}},disabled:C,className:"px-3 py-2 rounded-lg bg-accent/10 border border-accent/25 text-accent text-xs font-medium hover:bg-accent/20 transition-colors shrink-0 cursor-pointer disabled:opacity-50",children:C?"Loading...":"Fetch"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"flex-1 h-px bg-white/10"}),l.jsx("span",{className:"text-[10px] text-white/30",children:"or browse"}),l.jsx("div",{className:"flex-1 h-px bg-white/10"})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{value:b,onChange:P=>j(P.target.value),placeholder:"Search roles...",className:"flex-1 p-2 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",autoFocus:!0}),l.jsxs("select",{value:g,onChange:P=>w(P.target.value),className:"px-2 py-2 rounded-lg border border-white/10 bg-white/5 text-xs text-white/70 focus:outline-none cursor-pointer",children:[l.jsx("option",{value:"popular",className:"bg-[var(--wall)]",children:"Popular"}),l.jsx("option",{value:"installs",className:"bg-[var(--wall)]",children:"Most Hired"}),l.jsx("option",{value:"newest",className:"bg-[var(--wall)]",children:"Newest"}),l.jsx("option",{value:"name",className:"bg-[var(--wall)]",children:"A-Z"})]})]}),f?l.jsx("div",{className:"text-center py-8 text-sm text-white/40",children:"Loading store..."}):B?l.jsxs("div",{className:"text-center py-8",children:[l.jsx("div",{className:"text-xs text-red-400 mb-2",children:B}),l.jsx("button",{onClick:ne,className:"text-xs text-green-400 hover:underline cursor-pointer",children:"Retry"})]}):ke.length===0?l.jsx("div",{className:"text-center py-8 text-sm text-white/40",children:b?"No matches found":"No characters in store yet"}):l.jsx("div",{className:"space-y-2 max-h-[380px] overflow-y-auto pr-1",children:ke.map(P=>l.jsx(KE,{char:P,isHired:ve.has(P.id),onSelect:()=>Ie(P.id),onVote:Oe=>_t(P.id,Oe),onDelete:()=>Ot(P.id),fetching:C,token:q},P.id))})]}),$==="review"&&k&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"bg-white/5 rounded-xl p-4 border border-white/10",children:[l.jsxs("div",{className:"flex gap-4",children:[k.appearance&&l.jsx("div",{className:"flex-shrink-0 rounded-lg overflow-hidden",style:{background:"#0d1117",padding:8},children:l.jsx(Ul,{roleId:"store-preview",appearance:k.appearance,scale:4})}),l.jsxs("div",{className:"flex-1 space-y-2.5",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Name"}),l.jsx("input",{value:L,onChange:P=>U(P.target.value),className:"w-full p-2 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 focus:outline-none focus:border-white/25 transition-colors"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Role ID"}),l.jsx("input",{value:Q,onChange:P=>D(P.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),className:"w-full p-2 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 font-mono focus:outline-none focus:border-white/25 transition-colors"}),e.some(P=>P.id===Q)&&Q.length>0&&l.jsx("div",{className:"text-xs text-red-500 mt-1",children:"ID already exists"})]}),l.jsxs("div",{className:"flex gap-3",children:[l.jsxs("div",{className:"flex-1",children:[l.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Level"}),l.jsx("div",{className:"text-sm text-white/70 p-2 rounded-lg bg-white/5 border border-white/10",children:k.level==="c-level"?"C-Level":"Member"})]}),l.jsxs("div",{className:"flex-1",children:[l.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Reports To"}),l.jsxs("select",{value:I,onChange:P=>H(P.target.value),className:"w-full p-2 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 focus:outline-none focus:border-white/25 transition-colors",children:[l.jsx("option",{value:"ceo",className:"bg-[var(--wall)] text-white",children:"CEO"}),e.map(P=>l.jsxs("option",{value:P.id,className:"bg-[var(--wall)] text-white",children:[P.name," (",P.id,")"]},P.id))]})]})]})]})]}),k.persona&&l.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[l.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Persona"}),l.jsx("div",{className:"text-xs text-white/60 leading-relaxed line-clamp-3",children:k.persona})]}),k.skills&&l.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[l.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Skills"}),l.jsx("div",{className:"flex flex-wrap gap-1.5",children:(()=>{var Qt,we;const P=k.skills;if(P&&typeof P=="object"&&!Array.isArray(P)&&"primary"in P){const kt=[];return(we=(Qt=P.primary)==null?void 0:Qt.frontmatter)!=null&&we.name&&kt.push(P.primary.frontmatter.name),P.shared&&P.shared.forEach(ln=>{var sn;return kt.push(((sn=ln.frontmatter)==null?void 0:sn.name)||ln.id)}),kt.map(ln=>l.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono bg-green-900/20 border border-green-800/30 text-green-400",children:ln},ln))}return(Array.isArray(P)?P:[]).map((kt,ln)=>l.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono bg-green-900/20 border border-green-800/30 text-green-400",children:typeof kt=="string"?kt:kt.name},ln))})()})]})]}),Ne&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:Ne})]})]}):u==="single"?l.jsxs(l.Fragment,{children:[te===1&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role Name"}),l.jsx("input",{ref:Ee,value:se,onChange:P=>Be(P.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"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role ID (slug)"}),l.jsx("input",{value:Z,onChange:P=>{A(P.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),W(!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 ${wn?"border-red-400":"border-white/10 focus:border-white/25"}`}),wn&&l.jsx("div",{className:"text-xs text-red-500 mt-1",children:"ID already exists"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Level"}),l.jsx("div",{className:"flex gap-2",children:qE.map(P=>l.jsx("button",{onClick:()=>{if(de(P.value),P.value==="c-level")ye("ceo");else{const Oe=e.find(nt=>nt.level==="c-level");ye((Oe==null?void 0:Oe.id)??"ceo")}},className:`flex-1 p-2 text-xs font-semibold rounded-lg border cursor-pointer transition-colors ${T===P.value?"border-green-600 bg-green-900/30 text-green-400":"border-white/10 text-white/50 hover:border-white/20"}`,children:P.label},P.value))})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Reports To"}),T==="c-level"?l.jsx("div",{className:"w-full p-2.5 rounded-lg border border-white/10 bg-white/5 text-sm text-white/40",children:"CEO (automatic)"}):l.jsx("select",{value:xe,onChange:P=>ye(P.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:e.filter(P=>P.level==="c-level").map(P=>l.jsxs("option",{value:P.id,className:"bg-[var(--wall)] text-white",children:[P.name," (",P.id,")"]},P.id))})]})]}),te===2&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Persona"}),l.jsx("textarea",{ref:G,value:Le,onChange:P=>Xe(P.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"}),l.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"This defines how the AI agent will behave in this role"})]}),yt.length>0&&l.jsxs("div",{children:[l.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Skills"}),l.jsx("div",{className:"space-y-1.5 max-h-[120px] overflow-y-auto",children:yt.map(P=>l.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:[l.jsx("input",{type:"checkbox",checked:pt.has(P.id),onChange:()=>jt(Oe=>{const nt=new Set(Oe);return nt.has(P.id)?nt.delete(P.id):nt.add(P.id),nt}),className:"accent-green-600"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-xs font-semibold text-white/80",children:P.name}),l.jsx("div",{className:"text-[10px] text-white/40 truncate",children:P.description})]})]},P.id))})]})]}),te===3&&l.jsx("div",{className:"customize-body",style:{padding:0},children:l.jsx(fv,{roleId:"default",appearance:Ye,onChange:ht,onRandomize:()=>ht(ys()),onReset:()=>ht(ys()),label:l.jsxs("span",{children:[Z||"new-role"," — ",se||"New Role"]})})}),te===4&&l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Review"}),l.jsxs("div",{className:"bg-white/5 rounded-xl p-4 border border-white/10",children:[l.jsxs("div",{className:"flex gap-4",children:[l.jsx("div",{className:"flex-shrink-0 rounded-lg overflow-hidden",style:{background:"#0d1117",padding:8},children:l.jsx(Ul,{roleId:"default",appearance:Ye,scale:4})}),l.jsxs("div",{className:"flex-1 space-y-2.5",children:[l.jsx(Fo,{label:"Name",value:se}),l.jsx(Fo,{label:"ID",value:Z,mono:!0}),l.jsx(Fo,{label:"Level",value:T}),l.jsx(Fo,{label:"Reports To",value:xe}),pt.size>0&&l.jsx(Fo,{label:"Skills",value:[...pt].join(", ")})]})]}),l.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[l.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Persona"}),l.jsx("div",{className:"text-xs text-white/60 leading-relaxed",children:Le})]})]}),Ne&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:Ne})]})]}):l.jsxs(l.Fragment,{children:[Nt==="input"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Roles (one per line)"}),l.jsx("textarea",{ref:ce,value:Wt,onChange:P=>Ft(P.target.value),placeholder:`Name, Level, ReportsTo
|
|
85
|
-
e.g.
|
|
86
|
-
Data Analyst
|
|
87
|
-
DevOps Engineer, member, cto
|
|
88
|
-
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"}),l.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Format: Name, Level (member/c-level), ReportsTo. Level and ReportsTo are optional."})]}),ze.length>0&&l.jsxs("div",{children:[l.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Preview (",ze.length," role",ze.length!==1?"s":"",")"]}),l.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden",children:l.jsxs("table",{className:"w-full text-xs",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-white/10",children:[l.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),l.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),l.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),l.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),l.jsx("tbody",{children:ze.map((P,Oe)=>l.jsxs("tr",{className:`border-b border-white/5 ${P.error?"bg-red-900/10":""}`,children:[l.jsx("td",{className:"p-2 text-white/80",children:P.name}),l.jsx("td",{className:"p-2 text-white/60 font-mono",children:P.id}),l.jsx("td",{className:"p-2 text-white/60",children:P.level}),l.jsx("td",{className:"p-2 text-white/60",children:P.reportsTo}),P.error&&l.jsx("td",{className:"p-2 text-red-400 text-[10px]",children:P.error})]},Oe))})]})})]})]}),Nt==="review"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Confirm Bulk Hire — ",ze.length," roles"]}),l.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden max-h-[300px] overflow-y-auto",children:l.jsxs("table",{className:"w-full text-xs",children:[l.jsx("thead",{className:"sticky top-0 bg-[var(--wall)]",children:l.jsxs("tr",{className:"border-b border-white/10",children:[l.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"#"}),l.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),l.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),l.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),l.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),l.jsx("tbody",{children:ze.map((P,Oe)=>l.jsxs("tr",{className:"border-b border-white/5",children:[l.jsx("td",{className:"p-2 text-white/30",children:Oe+1}),l.jsx("td",{className:"p-2 text-white/80",children:P.name}),l.jsx("td",{className:"p-2 text-white/60 font-mono",children:P.id}),l.jsx("td",{className:"p-2 text-white/60",children:P.level}),l.jsx("td",{className:"p-2 text-white/60",children:P.reportsTo})]},Oe))})]})}),tt&&me.total>0&&l.jsxs("div",{children:[l.jsxs("div",{className:"flex justify-between text-[10px] text-white/40 mb-1",children:[l.jsx("span",{children:"Hiring..."}),l.jsxs("span",{children:[me.done,"/",me.total]})]}),l.jsx("div",{className:"h-1.5 bg-white/10 rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${me.done/me.total*100}%`,background:"#2E7D32"}})})]}),l.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."}),Ne&&l.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:Ne})]})]})}),l.jsxs("div",{className:"flex justify-between px-5 pb-5",children:[l.jsxs("div",{children:[u==="single"&&te>1&&l.jsx("button",{onClick:()=>Y(te-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"}),u==="bulk"&&Nt==="review"&&l.jsx("button",{onClick:()=>$n("input"),disabled:tt,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"}),u==="store"&&$==="review"&&l.jsx("button",{onClick:()=>{_("browse"),N(null),De("")},disabled:tt,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"})]}),l.jsxs("div",{className:"flex gap-3",children:[l.jsx("button",{onClick:n,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),u==="single"?te<To?l.jsx("button",{onClick:()=>Y(te+1),disabled:!bt(te),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"}):l.jsx("button",{onClick:Ve,disabled:tt,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:tt?"Hiring...":"HIRE"}):u==="bulk"?Nt==="input"?l.jsxs("button",{onClick:()=>$n("review"),disabled:!_e,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 (",ze.length,")"]}):l.jsx("button",{onClick:Re,disabled:tt,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:tt?`Hiring ${me.done}/${me.total}...`:`HIRE ALL (${ze.length})`}):$==="review"?l.jsx("button",{onClick:Bt,disabled:tt||!L.trim()||!Q.trim()||e.some(P=>P.id===Q),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:tt?"Hiring...":"HIRE"}):null]})]})]})]})}function VE({onLogin:e}){const[n,a]=v.useState(""),[i,o]=v.useState(!1),[u,d]=v.useState(""),h=()=>{const m=n.trim();if(m){if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(m)){d("Invalid token format");return}e(m)}};return l.jsxs("div",{className:"rounded-lg border border-white/10 bg-white/[0.03] p-3 space-y-2",children:[l.jsx("div",{className:"text-[11px] text-white/50",children:"Sign in to vote, publish, and manage your characters."}),i?l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{value:n,onChange:m=>{a(m.target.value),d("")},onKeyDown:m=>{m.key==="Enter"&&h()},placeholder:"Paste your token here...",className:"flex-1 px-2 py-1.5 rounded-lg border border-white/10 bg-white/5 text-xs text-white/90 font-mono placeholder-white/20 focus:outline-none focus:border-amber-800/40",autoFocus:!0}),l.jsx("button",{onClick:h,disabled:!n.trim(),className:"px-3 py-1.5 text-[11px] font-semibold rounded-lg cursor-pointer text-green-400 bg-green-900/20 border border-green-800/30 hover:bg-green-900/40 disabled:opacity-30 transition-colors",children:"Sign in"})]}),u&&l.jsx("div",{className:"text-[10px] text-red-400",children:u}),l.jsx("button",{onClick:o.bind(null,!1),className:"text-[10px] text-white/30 hover:text-white/50 cursor-pointer",children:"Cancel"})]}):l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:o.bind(null,!0),className:"px-3 py-1.5 text-[11px] font-semibold rounded-lg cursor-pointer text-amber-400 bg-amber-900/20 border border-amber-800/30 hover:bg-amber-900/40 transition-colors",children:"Paste Token"}),l.jsx("span",{className:"text-[10px] text-white/20 self-center",children:"from Settings → Token"})]})]})}function KE({char:e,isHired:n,onSelect:a,onVote:i,onDelete:o,fetching:u,token:d}){const[h,m]=v.useState(!1),f=d&&e.publisher_id===d,x=!!d;return l.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl border border-white/10 bg-white/[0.03] hover:bg-white/[0.06] transition-colors group",children:[l.jsxs("div",{className:"flex flex-col items-center gap-0.5 shrink-0 w-8",children:[l.jsx("button",{onClick:g=>{g.stopPropagation(),i(1)},disabled:!x,className:`text-[14px] leading-none transition-colors ${x?"cursor-pointer":"cursor-not-allowed opacity-30"} ${e.my_vote===1?"text-green-400":"text-white/20 hover:text-green-400/60"}`,title:x?"Upvote":"Sign in to vote",children:"▲"}),l.jsx("span",{className:`text-[11px] font-bold tabular-nums ${(e.vote_score??0)>0?"text-green-400/80":(e.vote_score??0)<0?"text-red-400/80":"text-white/30"}`,children:e.vote_score??0}),l.jsx("button",{onClick:g=>{g.stopPropagation(),i(-1)},disabled:!x,className:`text-[14px] leading-none transition-colors ${x?"cursor-pointer":"cursor-not-allowed opacity-30"} ${e.my_vote===-1?"text-red-400":"text-white/20 hover:text-red-400/60"}`,title:x?"Downvote":"Sign in to vote",children:"▼"})]}),l.jsxs("div",{className:"flex-1 min-w-0 cursor-pointer",onClick:a,children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm font-semibold text-white/90 truncate",children:e.name}),l.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded font-semibold uppercase ${e.level==="c-level"?"bg-amber-900/30 text-amber-400 border border-amber-800/30":"bg-white/5 text-white/40 border border-white/10"}`,children:e.level}),n&&l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-green-900/20 text-green-400/60 border border-green-800/20",children:"Hired"})]}),e.tagline&&l.jsx("div",{className:"text-[11px] text-white/40 truncate mt-0.5",children:e.tagline}),l.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[l.jsxs("span",{className:"text-[10px] text-white/25",children:[e.installs??0," installs"]}),l.jsxs("span",{className:"text-[10px] text-white/25",children:["v",e.version]}),l.jsx("span",{className:"text-[10px] text-white/25 font-mono",children:e.id})]})]}),l.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[l.jsx("button",{onClick:a,disabled:u,className:"px-3 py-1.5 text-[11px] font-semibold rounded-lg cursor-pointer transition-colors disabled:opacity-40 text-green-400 bg-green-900/20 border border-green-800/30 hover:bg-green-900/40",children:"Hire"}),f&&(h?l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:g=>{g.stopPropagation(),o(),m(!1)},className:"px-2 py-1.5 text-[10px] font-semibold rounded cursor-pointer text-red-400 bg-red-900/30 border border-red-800/40 hover:bg-red-900/50",children:"Confirm"}),l.jsx("button",{onClick:g=>{g.stopPropagation(),m(!1)},className:"px-2 py-1.5 text-[10px] rounded cursor-pointer text-white/40 hover:text-white/60",children:"No"})]}):l.jsx("button",{onClick:g=>{g.stopPropagation(),m(!0)},className:"w-7 h-7 rounded-lg flex items-center justify-center cursor-pointer text-white/15 hover:text-red-400/60 hover:bg-red-900/10 transition-colors opacity-0 group-hover:opacity-100",title:"Delete from store",children:l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2"})})}))]})]})}function Fo({label:e,value:n,mono:a}){return l.jsxs("div",{className:"flex justify-between text-sm",children:[l.jsx("span",{className:"text-white/40",children:e}),l.jsx("span",{className:`font-semibold text-white/80 ${a?"font-mono":""}`,children:n})]})}function QE({roleId:e,roleName:n,onClose:a,onConfirm:i}){const[o,u]=v.useState(!1),d=async()=>{u(!0);try{await i(e)}finally{u(!1)}};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:a}),l.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:[l.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[l.jsx("div",{className:"text-lg font-bold",children:"Fire Role"}),l.jsxs("div",{className:"text-sm opacity-80 mt-0.5",children:["Remove ",n," (",e,")"]})]}),l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"p-4 rounded-lg border-2 border-red-300 bg-red-50 mb-4",children:[l.jsx("div",{className:"text-sm font-bold text-red-800 mb-1",children:"Warning"}),l.jsxs("div",{className:"text-xs text-red-700 leading-relaxed",children:["This will permanently delete the role directory including",l.jsx("strong",{children:" role.yaml"}),", ",l.jsx("strong",{children:"profile.md"}),", ",l.jsx("strong",{children:"SKILL.md"}),", and all journal entries. This action cannot be undone."]})]}),l.jsxs("div",{className:"text-sm text-gray-600",children:["Are you sure you want to fire ",l.jsx("strong",{children:n}),"?"]})]}),l.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[l.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"}),l.jsx("button",{onClick:d,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 PE={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function ZE({roleId:e,title:n,roleColor:a,active:i,isWave:o,isWaveStreaming:u,onClick:d,onClose:h,"data-session-id":m}){const f=o?"#F59E0B":a;return l.jsxs("button",{onClick:d,"data-session-id":m,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 ${f}`}:void 0,children:[o&&u&&l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse shrink-0"}),l.jsx("span",{className:"text-xs",children:PE[e]??"👤"}),l.jsx("span",{className:`truncate ${o?"text-amber-400/90":""}`,children:n}),l.jsx("span",{onClick:h,className:"ml-auto text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none",children:"×"})]})}function JE({content:e,streaming:n}){let a=e;return n&&(e.match(/```/g)??[]).length%2!==0&&(a+="\n```"),l.jsx("div",{className:"terminal-markdown",children:l.jsx(Om,{remarkPlugins:[Hm],components:{code:e6,table:({children:i})=>l.jsx("div",{className:"overflow-x-auto my-2",children:l.jsx("table",{className:"terminal-table",children:i})})},children:a})})}function e6({className:e,children:n,...a}){const i=/language-(\w+)/.exec(e??"");return i||typeof n=="string"&&n.includes(`
|
|
89
|
-
`)?l.jsx(t6,{language:i==null?void 0:i[1],children:n}):l.jsx("code",{className:"terminal-inline-code",...a,children:n})}function t6({children:e,language:n}){const[a,i]=v.useState(!1),o=String(e).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(o),i(!0),setTimeout(()=>i(!1),1500)};return l.jsxs("div",{className:"terminal-code-block group relative my-2",children:[n&&l.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] px-3 pt-1.5",children:n}),l.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"}),l.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:l.jsx("code",{children:o})})]})}const n6={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function r6({attachments:e}){const[n,a]=v.useState(null);return e.length===0?null:l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:e.map((i,o)=>l.jsxs("button",{onClick:()=>a(o),className:"relative w-20 h-20 rounded-lg overflow-hidden border border-[var(--terminal-border)] bg-[var(--terminal-inline-bg)] cursor-pointer hover:border-[var(--terminal-border-hover)] transition-colors",children:[l.jsx("img",{src:`data:${i.mediaType};base64,${i.data}`,alt:i.name,className:"w-full h-full object-cover"}),l.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-[8px] text-white truncate px-1 py-0.5",children:i.name})]},o))}),n!==null&&l.jsx("div",{className:"fixed inset-0 z-[100] bg-black/80 flex items-center justify-center",onClick:()=>a(null),children:l.jsxs("div",{className:"relative max-w-[90vw] max-h-[90vh]",children:[l.jsx("img",{src:`data:${e[n].mediaType};base64,${e[n].data}`,alt:e[n].name,className:"max-w-full max-h-[90vh] object-contain rounded-lg"}),l.jsx("button",{onClick:()=>a(null),className:"absolute top-2 right-2 w-8 h-8 rounded-full bg-black/70 text-white flex items-center justify-center cursor-pointer hover:bg-black/90",children:"x"}),l.jsx("div",{className:"absolute bottom-2 left-1/2 -translate-x-1/2 bg-black/70 text-white text-sm px-3 py-1 rounded",children:e[n].name})]})})]})}function Fh(e,n){return n?n.file_path?String(n.file_path).replace(/^.*\/(?=[^/]+\/)/,""):n.path?String(n.path).replace(/^.*\/(?=[^/]+\/)/,""):n.pattern?String(n.pattern):n.command?String(n.command).slice(0,60):n.query?String(n.query).slice(0,60):n.url?String(n.url).slice(0,60):"":""}function a6(e){const n=[];let a="";for(const i of e)if(i.type==="thinking")i.text&&(a=i.text),n.length===0||n[n.length-1].type!=="thinking"?n.push({type:"thinking",text:i.text}):n[n.length-1].text=i.text;else if(i.type==="tool")n.push({type:"tool",toolName:i.toolName,toolSummary:Fh(i.toolName??"",i.toolInput),toolInput:i.toolInput});else if(i.type==="dispatch")n.push({type:"dispatch",roleId:i.roleId,task:i.task});else if(i.type==="dispatch:progress"){const o=n.length>0?n[n.length-1]:null;(o==null?void 0:o.type)==="dispatch:progress"&&o.roleId===i.roleId?i.progressType==="tool"?(o.toolName=i.toolName,o.toolSummary=Fh(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):n.push({type:"dispatch:progress",roleId:i.roleId,progressType:i.progressType,text:i.text,toolName:i.toolName,toolSummary:i.toolName?Fh(i.toolName,i.toolInput):void 0})}if(a){const i=n.filter(o=>o.type==="thinking");i.length>0&&(i[i.length-1].text=a)}return n}function l6({event:e,isStreaming:n}){var o,u,d;const[a,i]=v.useState(!1);switch(e.type){case"thinking":return l.jsxs("div",{className:"stream-event-thinking",children:[l.jsxs("div",{className:"stream-event-thinking-header",onClick:()=>i(!a),children:[l.jsx("span",{className:"stream-event-thinking-icon"}),l.jsxs("span",{className:"stream-event-thinking-label",children:["thinking",n?"...":""]}),e.text&&!n&&l.jsx("span",{className:"stream-event-thinking-toggle",children:a?"▾":"▸"})]}),(n||a)&&e.text&&l.jsx("div",{className:"stream-event-thinking-content",children:e.text.slice(-500)})]});case"tool":return l.jsxs("div",{className:"stream-event-tool",children:[l.jsx("span",{className:"stream-event-tool-badge",children:e.toolName}),e.toolSummary&&l.jsx("span",{className:"stream-event-tool-path",children:e.toolSummary}),e.toolInput&&l.jsx("span",{className:"stream-event-tool-toggle",onClick:()=>i(!a),children:a?"▾":"▸"}),a&&e.toolInput&&l.jsx("div",{className:"stream-event-tool-detail",children:JSON.stringify(e.toolInput,null,1).slice(0,300)})]});case"dispatch":return l.jsxs("div",{className:"stream-event-dispatch",children:[l.jsxs("span",{className:"stream-event-dispatch-badge",children:["→"," ",(o=e.roleId)==null?void 0:o.toUpperCase()]}),l.jsx("span",{className:"stream-event-dispatch-task",children:(u=e.task)==null?void 0:u.slice(0,80)})]});case"dispatch:progress":return l.jsxs("div",{className:"stream-event-dispatch-progress",children:[l.jsx("span",{className:"stream-event-dispatch-progress-role",children:(d=e.roleId)==null?void 0:d.toUpperCase()}),e.progressType==="thinking"&&l.jsxs("span",{className:"stream-event-dispatch-progress-status",children:["thinking",n?"...":""]}),e.progressType==="tool"&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"stream-event-tool-badge",children:e.toolName}),e.toolSummary&&l.jsx("span",{className:"stream-event-tool-path",children:e.toolSummary})]}),e.progressType==="text"&&e.text&&l.jsx("span",{className:"stream-event-dispatch-progress-status",children:"responding..."}),e.progressType==="done"&&l.jsx("span",{className:"stream-event-dispatch-progress-done",children:"done"}),e.progressType==="error"&&l.jsx("span",{className:"stream-event-dispatch-progress-error",children:"error"})]});default:return null}}function i6({events:e,isStreaming:n}){const[a,i]=v.useState(!1);if(e.length===0)return null;const o=a6(e);if(o.length===0)return null;const u=e.filter(w=>w.type==="thinking").length,d=e.filter(w=>w.type==="tool"),h=e.filter(w=>w.type==="dispatch"||w.type==="dispatch:progress"),m=e.filter(w=>w.type==="turn").reduce((w,b)=>Math.max(w,b.turn??0),0),f=[];if(u>0&&f.push("thinking"),d.length>0){const w=[...new Set(d.map(b=>b.toolName))];w.length<=3?f.push(w.join(", ")):f.push(`${d.length} tool calls`)}h.length>0&&f.push(`${h.length} dispatch`),m>1&&f.push(`${m} turns`);const x=f.join(" · "),g=!a;return l.jsxs("div",{className:"stream-activity-log",children:[l.jsxs("div",{className:"stream-activity-header",onClick:()=>i(!a),children:[n&&l.jsx("span",{className:"stream-activity-pulse"}),l.jsxs("span",{className:"stream-activity-summary",children:[a?"▸":"▾"," ",x,n?"...":""]})]}),g&&l.jsx("div",{className:"stream-activity-events",children:o.map((w,b)=>l.jsx(l6,{event:w,isStreaming:n&&b===o.length-1},b))})]})}function s6(e){return e.map(n=>({type:n.type==="tool:start"?"tool":n.type==="dispatch:start"?"dispatch":n.type,timestamp:new Date(n.ts).getTime(),text:n.data.text,toolName:n.data.name,toolInput:n.data.input,roleId:n.data.roleId,task:n.data.task}))}function o6({message:e,roleId:n,roleColor:a}){const i=e.from==="ceo",o=e.type==="system",u=e.status==="streaming";if(o)return l.jsx("div",{className:"flex justify-center my-2",children:l.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] bg-[var(--terminal-inline-bg)] px-3 py-1 rounded-full",children:e.content})});if(i)return l.jsx("div",{className:"flex justify-end mb-3",children:l.jsxs("div",{className:"max-w-[85%]",children:[l.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] text-right mb-1",children:"CEO"}),e.attachments&&e.attachments.length>0&&l.jsx("div",{className:"flex justify-end mb-1",children:l.jsx(r6,{attachments:e.attachments})}),l.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:[e.type==="directive"&&l.jsx("span",{className:"text-amber-400 text-[10px] font-bold mr-1.5",children:"DO"}),e.content]})]})});const d=e.streamEvents??(e.events?s6(e.events):void 0),h=((d==null?void 0:d.length)??0)>0,m=!!e.thinking,f=m&&!e.content&&u&&!h;return l.jsxs("div",{className:"flex gap-2.5 mb-3",children:[l.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:n6[n]??"👤"}),l.jsxs("div",{className:"max-w-[85%] min-w-0",children:[l.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] mb-1",children:n.toUpperCase()}),h&&l.jsx(i6,{events:d,isStreaming:u}),m&&!h&&l.jsxs("details",{open:f,className:"mb-1",children:[l.jsxs("summary",{className:"text-[10px] text-purple-400/70 cursor-pointer select-none flex items-center gap-1",children:[f&&l.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-purple-400 animate-pulse"}),"thinking",f?"...":` (${e.thinking.length} chars)`]}),l.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:e.thinking.slice(-500)})]}),l.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:[e.content?l.jsx(JE,{content:e.content,streaming:u}):u&&!m?l.jsxs("span",{className:"typing-dots",children:[l.jsx("span",{className:"typing-dot"}),l.jsx("span",{className:"typing-dot"}),l.jsx("span",{className:"typing-dot"})]}):u&&m?l.jsxs("span",{className:"typing-dots",children:[l.jsx("span",{className:"typing-dot"}),l.jsx("span",{className:"typing-dot"}),l.jsx("span",{className:"typing-dot"})]}):null,u&&e.content&&l.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-[var(--terminal-text-secondary)] animate-pulse ml-0.5 align-middle"})]}),e.status==="error"&&l.jsx("div",{className:"text-[10px] text-red-400 mt-1",children:"Error occurred"}),e.status==="done"&&(e.turns||e.tokens)&&l.jsxs("div",{className:"text-[9px] text-[var(--terminal-text-muted)] mt-1 flex gap-2",children:[e.turns&&l.jsxs("span",{children:[e.turns," turns"]}),e.tokens&&l.jsxs("span",{children:[(e.tokens.input+e.tokens.output).toLocaleString()," tokens"]}),e.readOnly&&l.jsx("span",{className:"text-blue-400/60",children:"read-only"})]}),e.knowledgeDebt&&e.knowledgeDebt.length>0&&l.jsxs("div",{className:"mt-1.5 px-3 py-2 rounded-lg text-[10px]",style:{background:"#FFA72615",border:"1px solid #FFA72630"},children:[l.jsxs("div",{className:"font-bold mb-1",style:{color:"#FFA726"},children:["Knowledge Debt (",e.knowledgeDebt.length,")"]}),e.knowledgeDebt.map((x,g)=>l.jsxs("div",{className:"flex gap-1.5 mb-0.5",style:{color:"var(--terminal-text-muted)"},children:[l.jsx("span",{style:{color:"#FFA726"},children:x.type==="orphan"?"⚠":x.type==="no-hub"?"📁":"🔗"}),l.jsxs("span",{children:[x.message,x.file?` (${x.file})`:""]})]},g))]})]})]})}function hv({messages:e,roleId:n,roleColor:a}){var o;const i=v.useRef(null);return v.useEffect(()=>{var u;(u=i.current)==null||u.scrollIntoView({behavior:"smooth"})},[e,(o=e[e.length-1])==null?void 0:o.content]),e.length===0?l.jsxs("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:["Start a conversation with ",n.toUpperCase()]}):l.jsxs("div",{className:"flex-1 overflow-y-auto p-4 terminal-scrollbar",children:[e.map(u=>l.jsx(o6,{message:u,roleId:n,roleColor:a},u.id)),l.jsx("div",{ref:i})]})}const c6=5*1024*1024,u6=["image/png","image/jpeg","image/gif","image/webp"];function Qm({mode:e,onModeChange:n,onSend:a,disabled:i,disabledReason:o,onStop:u}){const[d,h]=v.useState(""),[m,f]=v.useState([]),[x,g]=v.useState(!1),[w,b]=v.useState(null),j=v.useRef(null),k=v.useRef(null),N=v.useRef(!1);v.useEffect(()=>{const I=j.current;I&&(I.style.height="0",I.style.height=Math.min(I.scrollHeight,120)+"px")},[d]),v.useEffect(()=>{if(w){const I=setTimeout(()=>b(null),3e3);return()=>clearTimeout(I)}},[w]);const C=v.useCallback(async I=>u6.includes(I.type)?I.size>c6?(b(`File too large: ${(I.size/1024/1024).toFixed(1)}MB. Max 5MB.`),null):new Promise(H=>{const q=new FileReader;q.onload=()=>{const te=q.result.split(",")[1];H({type:"image",data:te,name:I.name,mediaType:I.type})},q.onerror=()=>{b("Failed to read file"),H(null)},q.readAsDataURL(I)}):(b(`Unsupported format: ${I.type}. Use PNG, JPG, GIF, or WebP.`),null),[]),E=v.useCallback(async I=>{const H=Array.from(I),q=[];for(const ue of H){const te=await C(ue);te&&q.push(te)}q.length>0&&f(ue=>[...ue,...q])},[C]),B=v.useCallback(I=>{I.preventDefault(),I.stopPropagation(),g(!0)},[]),R=v.useCallback(I=>{I.preventDefault(),I.stopPropagation(),g(!1)},[]),$=v.useCallback(I=>{I.preventDefault(),I.stopPropagation(),g(!1);const H=I.dataTransfer.files;H.length>0&&E(H)},[E]),_=v.useCallback(I=>{const H=I.clipboardData.items,q=[];for(let ue=0;ue<H.length;ue++){const te=H[ue];if(te.type.startsWith("image/")){const Y=te.getAsFile();Y&&q.push(Y)}}q.length>0&&(I.preventDefault(),E(q))},[E]),L=v.useCallback(I=>{const H=I.target.files;H&&H.length>0&&E(H),I.target.value=""},[E]),U=v.useCallback(I=>{f(H=>H.filter((q,ue)=>ue!==I))},[]),Q=()=>{const I=d.trim();!I&&m.length===0||i||(a(I,m.length>0?m:void 0),h(""),f([]))},D=I=>{if(I.key==="Enter"&&!I.shiftKey){if(N.current)return;I.preventDefault(),Q()}};return l.jsxs("div",{className:`border-t border-[var(--terminal-border)] p-3 shrink-0 transition-colors ${x?"bg-[var(--terminal-surface-light)] border-amber-500/50":""}`,onDragOver:B,onDragLeave:R,onDrop:$,children:[w&&l.jsx("div",{className:"text-[10px] text-red-400 mb-2 text-center",children:w}),o&&l.jsx("div",{className:"text-[10px] text-amber-400/70 mb-2 text-center",children:o}),m.length>0&&l.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:m.map((I,H)=>l.jsxs("div",{className:"relative group w-16 h-16 rounded-lg overflow-hidden border border-[var(--terminal-border)] bg-[var(--terminal-inline-bg)]",children:[l.jsx("img",{src:`data:${I.mediaType};base64,${I.data}`,alt:I.name,className:"w-full h-full object-cover"}),l.jsx("button",{onClick:()=>U(H),className:"absolute top-0.5 right-0.5 w-4 h-4 rounded-full bg-black/70 text-white text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:"x"}),l.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-[8px] text-white truncate px-1 py-0.5",children:I.name})]},H))}),x&&l.jsx("div",{className:"text-[11px] text-amber-400 text-center mb-2",children:"Drop image here"}),l.jsxs("div",{className:"flex items-end gap-2",children:[l.jsxs("div",{className:"flex rounded-lg overflow-hidden border border-[var(--terminal-border)] shrink-0",children:[l.jsx("button",{onClick:()=>n("talk"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${e==="talk"?"bg-[var(--desk-wood)] text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Talk"}),l.jsx("button",{onClick:()=>n("do"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${e==="do"?"bg-amber-700 text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Do"})]}),l.jsx("button",{onClick:()=>{var I;return(I=k.current)==null?void 0:I.click()},disabled:i,className:"w-8 h-8 rounded-lg bg-[var(--terminal-inline-bg)] border border-[var(--terminal-border)] text-[var(--terminal-text-muted)] flex items-center justify-center shrink-0 cursor-pointer hover:bg-[var(--terminal-surface-light)] hover:text-[var(--terminal-text-secondary)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:"Attach image (PNG, JPG, GIF, WebP)",children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})}),l.jsx("input",{ref:k,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,onChange:L,className:"hidden"}),l.jsx("textarea",{ref:j,value:d,onChange:I=>h(I.target.value),onKeyDown:D,onCompositionStart:()=>{N.current=!0},onCompositionEnd:()=>{N.current=!1},onPaste:_,placeholder:i?"Waiting...":e==="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"}),i&&u&&l.jsx("button",{onClick:u,className:"w-8 h-8 rounded-lg bg-red-900/40 text-red-400 flex items-center justify-center shrink-0 cursor-pointer hover:bg-red-900/60 hover:text-red-300 transition-colors",title:"Stop",children:l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:l.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})})}),l.jsx("button",{onClick:Q,disabled:i||!d.trim()&&m.length===0,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:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M22 2L11 13"}),l.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})]})}const d6={ceo:"#FFB300",cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},mv={ceo:"CEO (You)",cto:"CTO",cbo:"CBO",pm:"PM",engineer:"Engineer",designer:"Designer",qa:"QA","data-analyst":"Data Analyst"};function Kg(e){return new Date(e).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit"})}function f6({msg:e}){const n=d6[e.roleId]??"#888",a=mv[e.roleId]??e.roleId;if(e.type==="dispatch"){const i=e.text.includes("WAVE"),o=e.text.includes("completed")||e.text.includes("완료"),u=i?"📡":o?"✓":"→",d=o?"text-green-400/70":"text-[var(--terminal-text-muted)]";return l.jsxs("div",{className:"flex items-start gap-2 px-3 py-1 hover:bg-white/[0.02]",children:[l.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:Kg(e.ts)}),l.jsx("span",{className:"text-[10px] shrink-0 mt-0.5",children:u}),l.jsx("span",{className:`text-[11px] ${d}`,children:e.text})]})}return l.jsxs("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-white/[0.02]",children:[l.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:Kg(e.ts)}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"text-[11px] font-semibold mr-1.5",style:{color:n},children:a}),l.jsx("span",{className:"text-xs text-[var(--terminal-text-secondary)]",children:e.text})]})]})}function h6({channel:e,allRoles:n,onUpdateMembers:a,onUpdateTopic:i,onSendMessage:o}){const u=v.useRef(null),d=v.useRef(null),[h,m]=v.useState("");v.useEffect(()=>{var B;const C=d.current;if(!C)return;C.scrollHeight-C.scrollTop-C.clientHeight<80&&((B=u.current)==null||B.scrollIntoView({behavior:"smooth"}))},[e.messages.length]);const[f,x]=v.useState(!1),[g,w]=v.useState(!1),[b,j]=v.useState(""),k=o&&e.id!=="general",N=()=>{!h.trim()||!o||(o(e.id,h.trim()),m(""),setTimeout(()=>{var C;return(C=u.current)==null?void 0:C.scrollIntoView({behavior:"smooth"})},50))};return l.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[l.jsxs("div",{ref:d,className:"flex-1 overflow-y-auto terminal-scrollbar py-2 min-h-0",children:[l.jsxs("div",{className:"px-3 py-2 mb-2 border-b border-[var(--terminal-border)] flex items-center gap-2",children:[l.jsx("span",{className:"text-sm font-semibold text-[var(--terminal-text)]",children:e.name}),e.members.length>0&&l.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:e.members.map(C=>mv[C]??C).join(", ")}),e.members.length===0&&l.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:e.isDefault?"system logs":"no members"}),!e.isDefault&&n&&a&&l.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:()=>x(!f),children:f?"Done":"Invite"})]}),!e.isDefault&&i&&l.jsx("div",{className:"px-3 pb-2 mb-1",children:g?l.jsx("input",{autoFocus:!0,value:b,onChange:C=>j(C.target.value),onKeyDown:C=>{C.key==="Enter"&&(i(e.id,b.trim()),w(!1)),C.key==="Escape"&&w(!1)},onBlur:()=>{i(e.id,b.trim()),w(!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"}):l.jsx("button",{onClick:()=>{j(e.topic??""),w(!0)},className:"text-[10px] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] cursor-pointer italic",children:e.topic||"Click to set channel topic..."})}),f&&!e.isDefault&&n&&a&&l.jsx("div",{className:"px-3 pb-2 mb-2 border-b border-[var(--terminal-border)]",children:l.jsx("div",{className:"flex flex-wrap gap-1",children:n.map(C=>{const E=e.members.includes(C.id);return l.jsxs("button",{className:`text-[10px] px-2 py-1 rounded ${E?"bg-white/15 text-[var(--terminal-text)]":"bg-white/5 text-[var(--terminal-text-muted)]"}`,onClick:()=>{const B=E?e.members.filter(R=>R!==C.id):[...e.members,C.id];a(e.id,B)},children:[E?"✓ ":"",C.name]},C.id)})})}),e.messages.length===0&&l.jsx("div",{className:"flex-1 flex flex-col items-center justify-center text-[var(--terminal-text-muted)] text-xs gap-1 py-8",children:l.jsx("span",{children:e.isDefault?"No dispatch events yet":"No messages yet — invite roles to start chatting"})}),e.messages.map(C=>l.jsx(f6,{msg:C},C.id)),l.jsx("div",{ref:u})]}),k&&l.jsx("div",{className:"shrink-0 px-3 py-2 border-t border-[var(--terminal-border)]",children:l.jsxs("div",{className:"flex gap-2 items-center",children:[l.jsx("span",{className:"text-[10px] font-semibold shrink-0",style:{color:"#FFB300"},children:"CEO"}),l.jsx("input",{type:"text",value:h,onChange:C=>m(C.target.value),onKeyDown:C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),N())},placeholder:"Say something...",className:"flex-1 px-2 py-1 text-xs rounded border bg-transparent text-[var(--terminal-text)] border-[var(--terminal-border)] outline-none focus:border-[#FFB300]/50"})]})})]})}const Mh={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},m6=400,p6=800;function Qg({sessions:e,activeSessionId:n,roles:a,streamingSessionId:i,width:o,onWidthChange:u,onSwitchSession:d,onCloseSession:h,onCreateSession:m,onClearEmpty:f,onCloseAll:x,onSendMessage:g,onModeChange:w,onStopSession:b,onCloseTerminal:j,onMaximize:k,chatChannels:N,activeChatChannelId:C,onSwitchChatChannel:E,onCreateChatChannel:B,onDeleteChatChannel:R,onUpdateChatMembers:$,onUpdateChatTopic:_,onSendChatMessage:L,unreadChannels:U}){const[Q,D]=v.useState(!1),[I,H]=v.useState(!1),[q,ue]=v.useState(!1),[te,Y]=v.useState(""),se=C!=null,J=N==null?void 0:N.find(Ne=>Ne.id===C),[Z,A]=v.useState(!1),[F,W]=v.useState(!1),[T,de]=v.useState(!1),xe=v.useRef(0),ye=v.useRef(0),Le=v.useRef(null),Xe=e.find(Ne=>Ne.id===n),Ye=i===n,ht=e.filter(Ne=>Ne.messages.length===0).length,tt=v.useCallback(()=>{const Ne=Le.current;Ne&&(W(Ne.scrollLeft>0),de(Ne.scrollLeft+Ne.clientWidth<Ne.scrollWidth-1))},[]);v.useEffect(()=>{if(!n||!Le.current)return;const Ne=Le.current.querySelector(`[data-session-id="${n}"]`);Ne&&Ne.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),tt()},[n,e.length,tt]),v.useEffect(()=>{const Ne=Le.current;if(!Ne)return;tt(),Ne.addEventListener("scroll",tt);const De=new ResizeObserver(tt);return De.observe(Ne),()=>{Ne.removeEventListener("scroll",tt),De.disconnect()}},[tt]);const Je=v.useCallback(Ne=>{Ne.preventDefault(),xe.current=Ne.clientX,ye.current=o,A(!0);const De=k,yt=()=>{A(!1),document.removeEventListener("mousemove",ct),document.removeEventListener("mouseup",yt)},ct=pt=>{const jt=xe.current-pt.clientX,Wt=ye.current+jt;if(Wt>=window.innerWidth*.6&&De){yt(),De();return}const Ft=Math.min(p6,Math.max(m6,Wt));u==null||u(Ft)};document.addEventListener("mousemove",ct),document.addEventListener("mouseup",yt)},[o,u,k]);return l.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&&l.jsx("div",{className:`terminal-resize-handle absolute top-0 left-0 w-1 h-full cursor-col-resize z-10 transition-colors ${Z?"bg-[var(--terminal-border-hover)]":"bg-transparent"}`,onMouseDown:Je}),l.jsxs("div",{className:"flex items-center bg-[var(--terminal-bg-deeper)] border-b border-[var(--terminal-border)] shrink-0",children:[l.jsxs("div",{className:"relative flex-1 min-w-0",children:[F&&l.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"}),l.jsxs("div",{ref:Le,className:"flex items-center overflow-x-auto terminal-tab-scroll gap-px px-1 py-1",children:[N==null?void 0:N.map(Ne=>l.jsxs("button",{onClick:()=>{E==null||E(Ne.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 ${C===Ne.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:C===Ne.id?{borderTop:"2px solid #4CAF50"}:void 0,children:[l.jsx("span",{className:"text-[10px]",children:"💬"}),l.jsx("span",{className:"truncate",children:Ne.name}),(U==null?void 0:U.has(Ne.id))&&C!==Ne.id&&l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 shrink-0"}),!Ne.isDefault&&l.jsx("span",{onClick:De=>{De.stopPropagation(),R==null||R(Ne.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:"×"})]},Ne.id)),N&&N.length>0&&e.length>0&&l.jsx("div",{className:"w-px h-4 bg-[var(--terminal-border)] shrink-0 mx-1"}),e.map(Ne=>l.jsx(ZE,{roleId:Ne.roleId,title:Ne.title,roleColor:Mh[Ne.roleId]??"#666",active:!se&&Ne.id===n,isWave:Ne.source==="wave",isWaveStreaming:Ne.source==="wave"&&Ne.status==="active",onClick:()=>{E==null||E(null),d(Ne.id)},onClose:De=>{De.stopPropagation(),h(Ne.id)},"data-session-id":Ne.id},Ne.id))]}),T&&l.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"})]}),l.jsxs("div",{className:"relative shrink-0",children:[l.jsx("button",{onClick:()=>{D(!Q),H(!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:"+"}),Q&&l.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:[B&&l.jsxs(l.Fragment,{children:[q?l.jsxs("div",{className:"px-3 py-2 flex items-center gap-1",children:[l.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:"#"}),l.jsx("input",{autoFocus:!0,value:te,onChange:Ne=>Y(Ne.target.value),onKeyDown:Ne=>{Ne.key==="Enter"&&te.trim()&&(B(te.trim(),[]),Y(""),ue(!1),D(!1)),Ne.key==="Escape"&&(ue(!1),Y(""))},placeholder:"channel name",className:"flex-1 bg-transparent text-xs text-[var(--terminal-text)] outline-none border-b border-[var(--terminal-border)]"})]}):l.jsxs("button",{onClick:()=>ue(!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:[l.jsx("span",{className:"text-[10px]",children:"💬"}),"New Channel"]}),l.jsx("div",{className:"border-b border-[var(--terminal-border)] my-1"})]}),a.map(Ne=>l.jsxs("button",{onClick:()=>{m(Ne.id),E==null||E(null),D(!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:[l.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:Mh[Ne.id]??"#666"}}),Ne.id.toUpperCase()," — ",Ne.name]},Ne.id))]})]}),l.jsxs("div",{className:"relative shrink-0",children:[l.jsx("button",{onClick:()=>{H(!I),D(!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:"···"}),I&&l.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:[l.jsxs("div",{className:"px-3 py-1.5 text-[10px] text-[var(--terminal-text-muted)] border-b border-[var(--terminal-border)]",children:[e.length," session",e.length!==1?"s":""]}),ht>0&&f&&l.jsxs("button",{onClick:()=>{f(),H(!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 (",ht,")"]}),e.length>0&&x&&l.jsx("button",{onClick:()=>{x(),H(!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"}),e.length===0&&l.jsx("div",{className:"px-3 py-2 text-xs text-[var(--terminal-text-muted)]",children:"No sessions"})]})]}),k&&l.jsx("button",{onClick:k,className:"w-7 h-7 flex items-center justify-center text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm cursor-pointer shrink-0",title:"Maximize (Pro View)",children:"⤢"}),l.jsx("button",{onClick:j,className:"px-2 py-1 text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm cursor-pointer shrink-0",children:"×"})]}),se&&J?l.jsx(h6,{channel:J,allRoles:a,onUpdateMembers:$,onUpdateTopic:_,onSendMessage:L}):Xe?l.jsxs(l.Fragment,{children:[l.jsx(hv,{messages:Xe.messages,roleId:Xe.roleId,roleColor:Mh[Xe.roleId]??"#666"}),l.jsx(Qm,{mode:Xe.mode,onModeChange:Ne=>w(Xe.id,Ne),onSend:(Ne,De)=>g(Xe.id,Ne,Xe.mode,De),disabled:Ye,disabledReason:Ye?`${Xe.roleId.toUpperCase()} is responding...`:void 0,onStop:Ye&&b?()=>b(Xe.id):void 0})]}):l.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 x6(){const e=v.useRef(null),n=v.useCallback(()=>{var i;(i=e.current)==null||i.abort(),e.current=null},[]);return{sendMessage:v.useCallback((i,o,u,d,h)=>{n();const m=new AbortController;return e.current=m,fetch(`/api/exec/session/${i}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:o,mode:u,attachments:h}),signal:m.signal}).then(async f=>{var N,C,E,B,R;if(!f.ok||!f.body){d.onError("Failed to connect");return}const x=f.body.getReader(),g=new TextDecoder;let w="",b=Date.now();const j=6e4,k=setInterval(()=>{Date.now()-b>j&&(clearInterval(k),m.abort(),d.onError("Connection stale — no data received for 60s"))},1e4);try{for(;;){const{done:$,value:_}=await x.read();if($)break;b=Date.now(),w+=g.decode(_,{stream:!0});const L=w.split(`
|
|
90
|
-
`);w=L.pop()??"";let U="";for(let Q=0;Q<L.length;Q++){const D=L[Q];if(D.startsWith("event: ")){U=D.slice(7).trim();continue}if(D.startsWith("data: ")){let I;try{I=JSON.parse(D.slice(6))}catch{U="";continue}switch(U){case"thinking":I.text&&((N=d.onThinking)==null||N.call(d,I.text));break;case"output":I.text&&d.onText(I.text);break;case"tool":(C=d.onToolUse)==null||C.call(d,I.name,I.input);break;case"dispatch":(E=d.onDispatch)==null||E.call(d,I.roleId,I.task);break;case"dispatch:progress":(B=d.onDispatchProgress)==null||B.call(d,I.roleId,I.type,I);break;case"turn":(R=d.onTurn)==null||R.call(d,I.turn);break;case"done":d.onDone(I);break;case"error":d.onError(I.message??"Unknown error");break;default:I.text&&d.onText(I.text);break}U=""}}}}finally{clearInterval(k)}}).catch(f=>{f.name!=="AbortError"&&d.onError(f.message)}),{abort:n}},[n]),abort:n}}const pv="tycono-appearances",xm="tycono-theme";function Pg(){try{const e=localStorage.getItem(pv);return e?JSON.parse(e):{}}catch{return{}}}function Rh(e){localStorage.setItem(pv,JSON.stringify(e))}function Zg(){try{const e=localStorage.getItem(xm);if(e&&e in ll)return e}catch{}return"default"}const xv=new Set;for(const e of Object.values(ll))for(const n of Object.keys(e.vars))xv.add(n);function g6(e){var i;const n=(i=ll[e])==null?void 0:i.vars;if(!n)return;const a=document.documentElement;for(const o of xv)o in n||a.style.removeProperty(o);for(const[o,u]of Object.entries(n))a.style.setProperty(o,u)}const zh={mode:"auto",intervalSec:18,dailyBudgetUsd:1},gm="tycono-speech-settings",_h="tycono-language";function y6(){try{const e=localStorage.getItem(gm);return e?{...zh,...JSON.parse(e)}:zh}catch{return zh}}function b6(){const[e,n]=v.useState(Pg),[a,i]=v.useState(Zg),[o,u]=v.useState(y6),[d,h]=v.useState(()=>{try{return localStorage.getItem(_h)??"auto"}catch{return"auto"}}),m=v.useRef(!1);v.useEffect(()=>{m.current||(m.current=!0,ge.getPreferences().then(k=>{const N=Object.keys(k.appearances??{}).length>0||k.theme!=="default";if(k.speech&&(u(C=>({...C,...k.speech})),localStorage.setItem(gm,JSON.stringify(k.speech))),k.language&&(h(k.language),localStorage.setItem(_h,k.language)),N){const C=k.appearances;n(C),Rh(C),k.theme&&k.theme in ll&&(i(k.theme),localStorage.setItem(xm,k.theme))}else{const C=Pg(),E=Zg();(Object.keys(C).length>0||E!=="default")&&ge.updatePreferences({appearances:C,theme:E}).catch(()=>{})}}).catch(()=>{}))},[]),v.useEffect(()=>{g6(a)},[a]);const f=v.useCallback(k=>e[k]??Km(k),[e]),x=v.useCallback((k,N)=>{n(C=>{const E={...C,[k]:N};return Rh(E),ge.updatePreferences({appearances:E}).catch(()=>{}),E})},[]),g=v.useCallback(k=>{n(N=>{const C={...N};return delete C[k],Rh(C),ge.updatePreferences({appearances:C}).catch(()=>{}),C})},[]),w=v.useCallback(k=>{i(k),localStorage.setItem(xm,k),ge.updatePreferences({theme:k}).catch(()=>{})},[]),b=v.useCallback(k=>{u(N=>{const C={...N,...k};return localStorage.setItem(gm,JSON.stringify(C)),ge.updatePreferences({speech:C}).catch(()=>{}),C})},[]),j=v.useCallback(k=>{h(k),localStorage.setItem(_h,k),ge.updatePreferences({language:k}).catch(()=>{})},[]);return{appearances:e,getAppearance:f,setAppearance:x,resetAppearance:g,theme:a,setTheme:w,speechSettings:o,setSpeechSettings:b,language:d,setLanguage:j}}const v6=3e4,w6=3e5;function k6(){var I;const[e,n]=v.useState("akb"),[a,i]=v.useState(null),[o,u]=v.useState("synced"),[d,h]=v.useState([]),[m,f]=v.useState(null),[x,g]=v.useState(!1),w=v.useRef(null),b=v.useRef(null),j=v.useRef(e);j.current=e;const k=v.useCallback(async()=>{try{const H=await ge.getSaveStatus(j.current);i(H),H.noGit?u("no-git"):u(q=>q==="saving"?q:H.dirty?"dirty":"synced")}catch{u("error")}},[]),N=v.useCallback(async()=>{try{const H=await ge.getSyncStatus(j.current);f({ahead:H.ahead,behind:H.behind,branch:H.branch,hasRemote:H.hasRemote})}catch{}},[]),C=v.useCallback(()=>{w.current&&clearInterval(w.current),k(),w.current=setInterval(k,v6),b.current&&clearInterval(b.current),N(),b.current=setInterval(N,w6)},[k,N]);v.useEffect(()=>()=>{w.current&&clearInterval(w.current),b.current&&clearInterval(b.current)},[]);const E=v.useCallback(H=>{n(H),j.current=H,i(null),f(null),h([]),setTimeout(()=>{k(),N()},0)},[k,N]),B=v.useCallback(async H=>{u("saving");try{const q=await ge.save(H,j.current);return await k(),q}catch(q){throw u("error"),q}},[k]),R=v.useCallback(async()=>{try{const H=await ge.getSaveHistory(20,j.current);h(H)}catch{}},[]),$=v.useCallback(async H=>{u("saving");try{await ge.restoreSave(H,void 0,j.current),await k()}catch(q){throw u("error"),q}},[k]),_=v.useCallback(async()=>{g(!0);try{const H=await ge.pull(j.current);return await k(),await N(),H}catch(H){throw H}finally{g(!1)}},[k,N]),L=v.useCallback(async()=>{try{await ge.initGit(),await k()}catch{u("error")}},[k]),U=a?a.modified.length+a.untracked.length:0,Q=((I=a==null?void 0:a.lastCommit)==null?void 0:I.date)??null,D=v.useCallback(async()=>{C()},[C]);return{state:o,dirtyCount:U,lastSaved:Q,status:a,save:B,history:d,loadHistory:R,restore:$,refresh:D,initGit:L,repo:e,setRepo:E,syncInfo:m,fetchSyncStatus:N,pull:_,pulling:x}}const Jg={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."]},ey={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."]},j6=[{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."}]}],S6=18e3,ty=6e3,C6=2500,N6=30*6e4,gv="tycono:relationships";function E6(){try{const e=localStorage.getItem(gv);return e?JSON.parse(e):[]}catch{return[]}}function A6(e){localStorage.setItem(gv,JSON.stringify(e))}function yu(e,n,a){const[i,o]=n<a?[n,a]:[a,n];let u=e.find(d=>d.roleA===i&&d.roleB===o);return u||(u={roleA:i,roleB:o,dispatches:0,wavesTogether:0,conversations:0,familiarity:0,lastInteraction:new Date().toISOString()},e.push(u)),u}function bu(e){return Math.min(100,e.dispatches*5+e.wavesTogether*10+e.conversations*2)}function vu(e){return e[Math.floor(Math.random()*e.length)]}function D6(e,n,a){const i=a.find(h=>h.id===e),o=a.find(h=>h.id===n);if(!i||!o)return null;const u=i.level==="c-level",d=o.level==="c-level";return u&&d?"c-level":i.reportsTo===n||o.reportsTo===e?"superior-subordinate":(i.reportsTo===o.reportsTo,"peer")}function T6(e,n){return e.relation==="any"?!0:e.relation===n}function F6({roles:e,roleStatuses:n,activeExecs:a,getStandupSpeech:i}){const[o,u]=v.useState(new Map),[d,h]=v.useState(E6),m=v.useRef({}),f=v.useRef(null),x=v.useRef(e),g=v.useRef(n),w=v.useRef(a),b=v.useRef(i),j=v.useRef(d);x.current=e,g.current=n,w.current=a,b.current=i,j.current=d,v.useEffect(()=>{const R=Date.now();for(const[$,_]of Object.entries(n))_==="working"&&(m.current[$]=R)},[n]),v.useEffect(()=>{A6(d)},[d]);const k=v.useCallback(R=>{const $=g.current[R],_=w.current.find(I=>I.roleId===R);if($==="working"&&(_!=null&&_.task))return null;const L=b.current(R);if(L&&Math.random()<.3)return{text:L,type:"work",ts:Date.now()};const U=Date.now(),Q=m.current[R]??0;if(U-Q>N6&&Math.random()<.5){const I=ey[R]??ey.engineer;return{text:vu(I),type:"guilt",ts:U}}const D=Jg[R]??Jg.engineer;return{text:vu(D),type:"personality",ts:U}},[]),N=v.useCallback(R=>{if(f.current)return!1;const $=R.filter(se=>g.current[se.id]!=="working");if($.length<2)return!1;const _=[...$].sort(()=>Math.random()-.5),L=_[0],U=_[1],Q=D6(L.id,U.id,R);if(!Q)return!1;const D=yu(j.current,L.id,U.id),I=bu(D),H=j6.filter(se=>T6(se,Q)&&I>=se.minFamiliarity);if(H.length===0)return!1;const q=vu(H);let ue=L.id,te=U.id;q.relation==="superior-subordinate"&&(U.reportsTo===L.id||L.level==="c-level"?(ue=L.id,te=U.id):(ue=U.id,te=L.id)),f.current={templateId:q.id,roleA:ue,roleB:te,turnIdx:0,timer:null};const Y=se=>{if(!f.current||se>=q.turns.length){f.current=null,h(F=>{const W=[...F],T=yu(W,ue,te);return T.conversations++,T.familiarity=bu(T),T.lastInteraction=new Date().toISOString(),W}),setTimeout(()=>{u(F=>{const W=new Map(F);return W.delete(ue),W.delete(te),W})},ty);return}const J=q.turns[se],Z=J.speaker==="A"?ue:te,A=J.speaker==="A"?te:ue;u(F=>{const W=new Map(F);if(W.set(Z,{text:J.text,type:"social",partnerId:A,ts:Date.now()}),se>0){const T=q.turns[se-1].speaker==="A"?ue:te;T!==Z&&W.delete(T)}return W}),f.current.turnIdx=se,f.current.timer=setTimeout(()=>Y(se+1),C6)};return Y(0),!0},[]);v.useEffect(()=>{const R=setInterval(()=>{const $=x.current;if($.length===0||f.current||Math.random()<.35&&N($))return;const _=$.filter(Q=>g.current[Q.id]!=="working");if(_.length===0)return;const L=vu(_),U=k(L.id);U&&(u(Q=>{const D=new Map(Q);return D.set(L.id,U),D}),setTimeout(()=>{u(Q=>{const D=new Map(Q),I=D.get(L.id);return I&&I.ts===U.ts&&D.delete(L.id),D})},ty))},S6);return()=>{var $;clearInterval(R),($=f.current)!=null&&$.timer&&clearTimeout(f.current.timer)}},[k,N]);const C=v.useCallback(R=>{const $=o.get(R);return($==null?void 0:$.text)??""},[o]),E=v.useCallback((R,$)=>{h(_=>{const L=[..._],U=yu(L,R,$);return U.dispatches++,U.familiarity=bu(U),U.lastInteraction=new Date().toISOString(),L})},[]),B=v.useCallback(R=>{R.length<2||h($=>{const _=[...$];for(let L=0;L<R.length;L++)for(let U=L+1;U<R.length;U++){const Q=yu(_,R[L],R[U]);Q.wavesTogether++,Q.familiarity=bu(Q),Q.lastInteraction=new Date().toISOString()}return _})},[]);return{speeches:o,getSpeech:C,relationships:d,notifyDispatch:E,notifyWave:B}}const yv="tycono:office-chat";let M6=0;function R6(){return`chat-${Date.now()}-${++M6}`}function Bh(){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 z6(){try{const e=localStorage.getItem(yv);if(e){const n=JSON.parse(e);if(n.find(i=>i.id==="office")&&!n.find(i=>i.id==="general")){const i=n.filter(o=>o.id!=="office");return[...Bh(),...i]}const a=Bh();for(const i of a)n.find(o=>o.id===i.id)||n.unshift(i);return n}}catch{}return Bh()}function _6(e){const n=e.map(a=>({...a,messages:a.messages.slice(-200)}));localStorage.setItem(yv,JSON.stringify(n))}function B6(){const[e,n]=v.useState(z6),[a,i]=v.useState(null),[o,u]=v.useState(new Set);v.useEffect(()=>{_6(e)},[e]);const d=v.useCallback(b=>{i(b),b&&u(j=>{const k=new Set(j);return k.delete(b),k})},[]),h=v.useCallback(b=>{const j={...b,id:R6()};n(k=>{const N=k.map(C=>C.id==="general"?b.type==="dispatch"?{...C,messages:[...C.messages,j].slice(-200)}:C:b.channelId?C.id===b.channelId?{...C,messages:[...C.messages,j].slice(-200)}:C:C.members.length>0&&C.members.includes(b.roleId)?{...C,messages:[...C.messages,j].slice(-200)}:C);return u(C=>{const E=new Set(C);for(const B of N){const R=k.find($=>$.id===B.id);R&&B.messages.length>R.messages.length&&E.add(B.id)}return E}),N})},[]),m=v.useCallback((b,j,k)=>{const N=`ch-${Date.now()}`,C={id:N,name:b.startsWith("#")?b:`#${b}`,members:j,isDefault:!1,messages:[],topic:k};n(E=>[...E,C]),i(N)},[]),f=v.useCallback(b=>{n(j=>j.filter(k=>k.id!==b||k.isDefault)),i(j=>j===b?"general":j)},[]),x=v.useCallback((b,j)=>{n(k=>k.map(N=>N.id===b&&!N.isDefault?{...N,members:j}:N))},[]),g=v.useCallback((b,j)=>{n(k=>k.map(N=>N.id===b&&!N.isDefault?{...N,topic:j||void 0}:N))},[]),w=v.useCallback(b=>{n(j=>j.map(k=>{if(k.id==="watercooler"){const N=b.filter(C=>C.level!=="c-level").map(C=>C.id);if(k.members.length!==N.length||!N.every(C=>k.members.includes(C)))return{...k,members:N}}return k}))},[]);return{channels:e,activeChannelId:a,setActiveChannelId:d,pushMessage:h,createChannel:m,deleteChannel:f,updateMembers:x,updateTopic:g,unreadChannels:o,syncDefaultMembers:w}}const O6=45e3,ny=5e3,$6=4,L6=20;function I6({roles:e,roleStatuses:n,activeExecs:a,channels:i,relationships:o,pushMessage:u,speechSettings:d,engineType:h,hasApiKey:m}){const x=((d==null?void 0:d.mode)==="auto"?h==="claude-cli"||h==="local"?"llm":"template":(d==null?void 0:d.mode)??"template")==="llm"&&(m!==!1||h==="claude-cli"),g=((d==null?void 0:d.intervalSec)??O6/1e3)*1e3,w=v.useRef(e),b=v.useRef(n),j=v.useRef(a),k=v.useRef(i),N=v.useRef(o),C=v.useRef(u),E=v.useRef(0),B=v.useRef(!1);w.current=e,b.current=n,j.current=a,k.current=i,N.current=o,C.current=u;const R=v.useCallback(async(L,U)=>{if(B.current)return!1;B.current=!0;try{if(!w.current.find(Y=>Y.id===L))return!1;const D=U.messages.slice(-L6).map(Y=>({roleId:Y.roleId,text:Y.text,ts:Y.ts})),I=w.current.filter(Y=>U.members.includes(Y.id)),H=N.current.filter(Y=>Y.roleA===L||Y.roleB===L).map(Y=>({partnerId:Y.roleA===L?Y.roleB:Y.roleA,familiarity:Y.familiarity})),q=j.current.find(Y=>Y.roleId===L),ue=q?{currentTask:q.task,taskProgress:null}:{currentTask:null,taskProgress:null},te=await ge.chatInChannel({channelId:U.name.replace("#",""),channelTopic:U.topic,roleId:L,history:D,members:I.map(Y=>({id:Y.id,name:Y.name,level:Y.level})),relationships:H,workContext:ue});return te.message?(C.current({ts:Date.now(),roleId:L,text:te.message,type:"chat",channelId:U.id}),!0):!1}catch{return!1}finally{B.current=!1}},[]),$=v.useCallback(async(L,U)=>{if(E.current>=$6){E.current=0;return}const Q=L.members.filter(q=>q!==U&&b.current[q]!=="working");if(Q.length===0){E.current=0;return}const D=Q[Math.floor(Math.random()*Q.length)];if(Math.random()>.7){E.current=0;return}const I=E.current*2e3,H=Math.random()*5e3;setTimeout(async()=>{E.current++;const q=k.current.find(te=>te.id===L.id);if(!q)return;if(await R(D,q)){const te=.6-E.current*.1;Math.random()<te?$(q,D):E.current=0}else E.current=0},ny+I+H)},[R]);return v.useEffect(()=>{if(!x)return;const L=setInterval(async()=>{const U=w.current;if(U.length===0||B.current)return;const Q=U.filter(ue=>b.current[ue.id]!=="working");if(Q.length===0)return;const D=Q[Math.floor(Math.random()*Q.length)],I=k.current.filter(ue=>ue.members.length===0?!0:ue.members.includes(D.id));if(I.length===0)return;const H=I[Math.floor(Math.random()*I.length)];E.current=0,await R(D.id,H)&&$(H,D.id)},g);return()=>clearInterval(L)},[x,g,R,$]),{triggerCeoReaction:v.useCallback(L=>{if(!x)return;const U=k.current.find(Q=>Q.id===L);U&&(E.current=0,setTimeout(()=>{$(U,"ceo")},ny))},[x,$])}}const bv=[[1,8],[3,5],[8,1],[5,3]],H6=[[1,4],[2,3],[4,1],[3,2]];function wu(e){const n=e===1||e===3?-1:0,a=bv[e],i=e<2?[0,1]:[1,0],o=n;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 ku(e){const n=e===1||e===3?-1:0,a=bv[e],i=e<2?[0,1]:[1,0],o=n;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 Bl(e,n){const a=e===1||e===3?-1:0,i=H6[e],o=a,u=e%2===0?1:0;return n?[{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 ry={down:[wu(0),wu(1),wu(2),wu(3)],up:[ku(0),ku(1),ku(2),ku(3)],right:[Bl(0,!0),Bl(1,!0),Bl(2,!0),Bl(3,!0)],left:[Bl(0,!1),Bl(1,!1),Bl(2,!1),Bl(3,!1)]},Fe="#FAFAF7",Yn="#FFFFFF",Te="#EDE8E2",Qe="#DDD6CC",qo="#1A1A2E",Zu="#2A2A2A",Pm="#FFB0B0",ay=[{x:2,y:0,w:1,h:1,c:Te},{x:3,y:0,w:1,h:1,c:Fe},{x:4,y:0,w:1,h:1,c:Yn},{x:5,y:0,w:1,h:1,c:Fe},{x:6,y:0,w:1,h:1,c:Te},{x:1,y:1,w:1,h:1,c:Qe},{x:2,y:1,w:1,h:1,c:Fe},{x:3,y:1,w:1,h:1,c:Yn},{x:4,y:1,w:1,h:1,c:Fe},{x:5,y:1,w:1,h:1,c:Yn},{x:6,y:1,w:1,h:1,c:Fe},{x:7,y:1,w:1,h:1,c:Qe},{x:0,y:2,w:1,h:1,c:Qe},{x:1,y:2,w:1,h:1,c:Te},{x:2,y:2,w:1,h:1,c:Fe},{x:3,y:2,w:1,h:1,c:Fe},{x:4,y:2,w:1,h:1,c:Yn},{x:5,y:2,w:1,h:1,c:Fe},{x:6,y:2,w:1,h:1,c:Fe},{x:7,y:2,w:1,h:1,c:Te},{x:8,y:2,w:1,h:1,c:Qe},{x:1,y:3,w:1,h:1,c:Te},{x:2,y:3,w:1,h:1,c:Fe},{x:3,y:3,w:1,h:1,c:qo},{x:4,y:3,w:1,h:1,c:Fe},{x:5,y:3,w:1,h:1,c:qo},{x:6,y:3,w:1,h:1,c:Fe},{x:7,y:3,w:1,h:1,c:Te},{x:2,y:4,w:1,h:1,c:Te},{x:3,y:4,w:1,h:1,c:Fe},{x:4,y:4,w:1,h:1,c:Zu},{x:5,y:4,w:1,h:1,c:Fe},{x:6,y:4,w:1,h:1,c:Te},{x:3,y:5,w:1,h:1,c:Qe},{x:4,y:5,w:1,h:1,c:Te},{x:5,y:5,w:1,h:1,c:Qe},{x:2,y:6,w:1,h:1,c:Te},{x:3,y:6,w:1,h:1,c:Fe},{x:4,y:6,w:1,h:1,c:Yn},{x:5,y:6,w:1,h:1,c:Fe},{x:6,y:6,w:1,h:1,c:Te},{x:2,y:7,w:1,h:1,c:Qe},{x:3,y:7,w:1,h:1,c:Te},{x:4,y:7,w:1,h:1,c:Fe},{x:5,y:7,w:1,h:1,c:Te},{x:6,y:7,w:1,h:1,c:Qe}],U6=[{x:3,y:8,w:1,h:1,c:Te},{x:5,y:8,w:1,h:1,c:Te},{x:3,y:9,w:1,h:1,c:Qe},{x:5,y:9,w:1,h:1,c:Qe}],q6=[{x:2,y:8,w:1,h:1,c:Te},{x:6,y:8,w:1,h:1,c:Te},{x:2,y:9,w:1,h:1,c:Qe},{x:6,y:9,w:1,h:1,c:Qe}],ly=[{x:2,y:0,w:1,h:1,c:Te},{x:3,y:0,w:1,h:1,c:Fe},{x:4,y:0,w:1,h:1,c:Yn},{x:5,y:0,w:1,h:1,c:Fe},{x:6,y:0,w:1,h:1,c:Te},{x:1,y:1,w:1,h:1,c:Qe},{x:2,y:1,w:1,h:1,c:Te},{x:3,y:1,w:1,h:1,c:Fe},{x:4,y:1,w:1,h:1,c:Yn},{x:5,y:1,w:1,h:1,c:Fe},{x:6,y:1,w:1,h:1,c:Te},{x:7,y:1,w:1,h:1,c:Qe},{x:0,y:2,w:1,h:1,c:Qe},{x:1,y:2,w:1,h:1,c:Te},{x:2,y:2,w:1,h:1,c:Fe},{x:3,y:2,w:1,h:1,c:Fe},{x:4,y:2,w:1,h:1,c:Fe},{x:5,y:2,w:1,h:1,c:Fe},{x:6,y:2,w:1,h:1,c:Fe},{x:7,y:2,w:1,h:1,c:Te},{x:8,y:2,w:1,h:1,c:Qe},{x:1,y:3,w:1,h:1,c:Qe},{x:2,y:3,w:1,h:1,c:Te},{x:3,y:3,w:1,h:1,c:Fe},{x:4,y:3,w:1,h:1,c:Fe},{x:5,y:3,w:1,h:1,c:Fe},{x:6,y:3,w:1,h:1,c:Te},{x:7,y:3,w:1,h:1,c:Qe},{x:2,y:4,w:1,h:1,c:Qe},{x:3,y:4,w:1,h:1,c:Te},{x:4,y:4,w:1,h:1,c:Fe},{x:5,y:4,w:1,h:1,c:Te},{x:6,y:4,w:1,h:1,c:Qe},{x:3,y:5,w:1,h:1,c:Qe},{x:4,y:5,w:1,h:1,c:Te},{x:5,y:5,w:1,h:1,c:Qe},{x:2,y:6,w:1,h:1,c:Te},{x:3,y:6,w:1,h:1,c:Fe},{x:4,y:6,w:1,h:1,c:Fe},{x:5,y:6,w:1,h:1,c:Fe},{x:6,y:6,w:1,h:1,c:Te},{x:2,y:7,w:1,h:1,c:Qe},{x:3,y:7,w:1,h:1,c:Te},{x:4,y:7,w:1,h:1,c:Fe},{x:5,y:7,w:1,h:1,c:Te},{x:6,y:7,w:1,h:1,c:Qe},{x:4,y:5,w:1,h:1,c:Fe},{x:4,y:4,w:1,h:1,c:Yn}],Y6=[{x:3,y:8,w:1,h:1,c:Te},{x:5,y:8,w:1,h:1,c:Te},{x:3,y:9,w:1,h:1,c:Qe},{x:5,y:9,w:1,h:1,c:Qe}],X6=[{x:2,y:8,w:1,h:1,c:Te},{x:6,y:8,w:1,h:1,c:Te},{x:2,y:9,w:1,h:1,c:Qe},{x:6,y:9,w:1,h:1,c:Qe}],ym=[{x:8,y:0,w:1,h:1,c:Te},{x:9,y:0,w:1,h:1,c:Fe},{x:10,y:0,w:1,h:1,c:Yn},{x:11,y:0,w:1,h:1,c:Fe},{x:7,y:1,w:1,h:1,c:Qe},{x:8,y:1,w:1,h:1,c:Fe},{x:9,y:1,w:1,h:1,c:Yn},{x:10,y:1,w:1,h:1,c:Fe},{x:11,y:1,w:1,h:1,c:Fe},{x:12,y:1,w:1,h:1,c:Te},{x:0,y:2,w:1,h:1,c:Yn},{x:1,y:2,w:1,h:1,c:Fe},{x:3,y:2,w:1,h:1,c:Te},{x:4,y:2,w:1,h:1,c:Fe},{x:5,y:2,w:1,h:1,c:Fe},{x:6,y:2,w:1,h:1,c:Fe},{x:7,y:2,w:1,h:1,c:Te},{x:8,y:2,w:1,h:1,c:Fe},{x:9,y:2,w:1,h:1,c:Fe},{x:10,y:2,w:1,h:1,c:Fe},{x:11,y:2,w:1,h:1,c:Fe},{x:12,y:2,w:1,h:1,c:Te},{x:0,y:3,w:1,h:1,c:Te},{x:1,y:3,w:1,h:1,c:Qe},{x:3,y:3,w:1,h:1,c:Qe},{x:4,y:3,w:1,h:1,c:Te},{x:5,y:3,w:1,h:1,c:Fe},{x:6,y:3,w:1,h:1,c:Te},{x:7,y:3,w:1,h:1,c:Qe},{x:8,y:3,w:1,h:1,c:Fe},{x:9,y:3,w:1,h:1,c:qo},{x:10,y:3,w:1,h:1,c:Fe},{x:11,y:3,w:1,h:1,c:Te},{x:3,y:4,w:1,h:1,c:Qe},{x:4,y:4,w:1,h:1,c:Te},{x:5,y:4,w:1,h:1,c:Fe},{x:6,y:4,w:1,h:1,c:Te},{x:8,y:4,w:1,h:1,c:Te},{x:9,y:4,w:1,h:1,c:Fe},{x:10,y:4,w:1,h:1,c:Zu}],vv=[{x:4,y:5,w:1,h:1,c:Te},{x:6,y:5,w:1,h:1,c:Te},{x:8,y:5,w:1,h:1,c:Te},{x:10,y:5,w:1,h:1,c:Te},{x:4,y:6,w:1,h:1,c:Qe},{x:6,y:6,w:1,h:1,c:Qe},{x:8,y:6,w:1,h:1,c:Qe},{x:10,y:6,w:1,h:1,c:Qe}],wv=[{x:3,y:5,w:1,h:1,c:Te},{x:5,y:5,w:1,h:1,c:Te},{x:9,y:5,w:1,h:1,c:Te},{x:11,y:5,w:1,h:1,c:Te},{x:3,y:6,w:1,h:1,c:Qe},{x:5,y:6,w:1,h:1,c:Qe},{x:9,y:6,w:1,h:1,c:Qe},{x:11,y:6,w:1,h:1,c:Qe}];function Zm(e,n=13){return e.map(a=>({...a,x:n-1-a.x}))}const iy=Zm(ym),W6=Zm(vv),G6=Zm(wv),V6={down:[[...ay,...U6],[...ay,...q6]],up:[[...ly,...Y6],[...ly,...X6]],right:[[...ym,...vv],[...ym,...wv]],left:[[...iy,...W6],[...iy,...G6]]},K6=[{x:4,y:5,w:1,h:1,c:Pm}],On="#FFD4D4",Kr="#FFCCD5",Q6=[{x:2,y:0,w:1,h:1,c:Qe},{x:3,y:0,w:1,h:1,c:Te},{x:4,y:0,w:1,h:1,c:Fe},{x:5,y:0,w:1,h:1,c:Yn},{x:6,y:0,w:1,h:1,c:Te},{x:7,y:0,w:1,h:1,c:Qe},{x:1,y:1,w:1,h:1,c:Qe},{x:2,y:1,w:1,h:1,c:Te},{x:3,y:1,w:1,h:1,c:Fe},{x:4,y:1,w:1,h:1,c:Yn},{x:5,y:1,w:1,h:1,c:Fe},{x:6,y:1,w:1,h:1,c:Yn},{x:7,y:1,w:1,h:1,c:Te},{x:8,y:1,w:1,h:1,c:Qe},{x:1,y:2,w:1,h:1,c:Te},{x:2,y:2,w:1,h:1,c:Fe},{x:3,y:2,w:1,h:1,c:qo},{x:4,y:2,w:1,h:1,c:Fe},{x:5,y:2,w:1,h:1,c:Fe},{x:6,y:2,w:1,h:1,c:qo},{x:7,y:2,w:1,h:1,c:Fe},{x:8,y:2,w:1,h:1,c:Te},{x:2,y:3,w:1,h:1,c:Te},{x:3,y:3,w:1,h:1,c:Fe},{x:4,y:3,w:1,h:1,c:Zu},{x:5,y:3,w:1,h:1,c:Pm},{x:6,y:3,w:1,h:1,c:Fe},{x:7,y:3,w:1,h:1,c:Te},{x:2,y:4,w:1,h:1,c:Qe},{x:3,y:4,w:1,h:1,c:Te},{x:4,y:4,w:1,h:1,c:Fe},{x:5,y:4,w:1,h:1,c:Fe},{x:6,y:4,w:1,h:1,c:Te},{x:7,y:4,w:1,h:1,c:Qe},{x:0,y:5,w:1,h:1,c:Te},{x:1,y:5,w:1,h:1,c:Kr},{x:2,y:5,w:1,h:1,c:Fe},{x:3,y:5,w:1,h:1,c:On},{x:4,y:5,w:1,h:1,c:On},{x:5,y:5,w:1,h:1,c:On},{x:6,y:5,w:1,h:1,c:On},{x:7,y:5,w:1,h:1,c:Fe},{x:8,y:5,w:1,h:1,c:Kr},{x:9,y:5,w:1,h:1,c:Te},{x:1,y:6,w:1,h:1,c:Te},{x:2,y:6,w:1,h:1,c:Fe},{x:3,y:6,w:1,h:1,c:On},{x:4,y:6,w:1,h:1,c:Kr},{x:5,y:6,w:1,h:1,c:Kr},{x:6,y:6,w:1,h:1,c:On},{x:7,y:6,w:1,h:1,c:Fe},{x:8,y:6,w:1,h:1,c:Te},{x:2,y:7,w:1,h:1,c:Fe},{x:3,y:7,w:1,h:1,c:On},{x:4,y:7,w:1,h:1,c:On},{x:5,y:7,w:1,h:1,c:On},{x:6,y:7,w:1,h:1,c:On},{x:7,y:7,w:1,h:1,c:Fe},{x:0,y:8,w:1,h:1,c:Te},{x:1,y:8,w:1,h:1,c:Kr},{x:2,y:8,w:1,h:1,c:Qe},{x:3,y:8,w:1,h:1,c:Te},{x:4,y:8,w:1,h:1,c:Fe},{x:5,y:8,w:1,h:1,c:Fe},{x:6,y:8,w:1,h:1,c:Te},{x:7,y:8,w:1,h:1,c:Qe},{x:8,y:8,w:1,h:1,c:Kr},{x:9,y:8,w:1,h:1,c:Te},{x:4,y:9,w:1,h:1,c:Fe},{x:5,y:9,w:1,h:1,c:Yn}],P6=[{x:2,y:0,w:1,h:1,c:Qe},{x:3,y:0,w:1,h:1,c:Te},{x:4,y:0,w:1,h:1,c:Fe},{x:5,y:0,w:1,h:1,c:Yn},{x:6,y:0,w:1,h:1,c:Te},{x:7,y:0,w:1,h:1,c:Qe},{x:1,y:1,w:1,h:1,c:Qe},{x:2,y:1,w:1,h:1,c:Te},{x:3,y:1,w:1,h:1,c:Fe},{x:4,y:1,w:1,h:1,c:Yn},{x:5,y:1,w:1,h:1,c:Fe},{x:6,y:1,w:1,h:1,c:Yn},{x:7,y:1,w:1,h:1,c:Te},{x:8,y:1,w:1,h:1,c:Qe},{x:1,y:2,w:1,h:1,c:Te},{x:2,y:2,w:1,h:1,c:Fe},{x:3,y:2,w:1,h:1,c:Te},{x:4,y:2,w:1,h:1,c:Fe},{x:5,y:2,w:1,h:1,c:Fe},{x:6,y:2,w:1,h:1,c:Te},{x:7,y:2,w:1,h:1,c:Fe},{x:8,y:2,w:1,h:1,c:Te},{x:2,y:3,w:1,h:1,c:Te},{x:3,y:3,w:1,h:1,c:Fe},{x:4,y:3,w:1,h:1,c:Zu},{x:5,y:3,w:1,h:1,c:Pm},{x:6,y:3,w:1,h:1,c:Fe},{x:7,y:3,w:1,h:1,c:Te},{x:2,y:4,w:1,h:1,c:Qe},{x:3,y:4,w:1,h:1,c:Te},{x:4,y:4,w:1,h:1,c:Fe},{x:5,y:4,w:1,h:1,c:Fe},{x:6,y:4,w:1,h:1,c:Te},{x:7,y:4,w:1,h:1,c:Qe},{x:0,y:5,w:1,h:1,c:Te},{x:1,y:5,w:1,h:1,c:Kr},{x:2,y:5,w:1,h:1,c:Fe},{x:3,y:5,w:1,h:1,c:On},{x:4,y:5,w:1,h:1,c:On},{x:5,y:5,w:1,h:1,c:On},{x:6,y:5,w:1,h:1,c:On},{x:7,y:5,w:1,h:1,c:Fe},{x:8,y:5,w:1,h:1,c:Kr},{x:9,y:5,w:1,h:1,c:Te},{x:1,y:6,w:1,h:1,c:Te},{x:2,y:6,w:1,h:1,c:Fe},{x:3,y:6,w:1,h:1,c:On},{x:4,y:6,w:1,h:1,c:Kr},{x:5,y:6,w:1,h:1,c:Kr},{x:6,y:6,w:1,h:1,c:On},{x:7,y:6,w:1,h:1,c:Fe},{x:8,y:6,w:1,h:1,c:Te},{x:2,y:7,w:1,h:1,c:Fe},{x:3,y:7,w:1,h:1,c:On},{x:4,y:7,w:1,h:1,c:On},{x:5,y:7,w:1,h:1,c:On},{x:6,y:7,w:1,h:1,c:On},{x:7,y:7,w:1,h:1,c:Fe},{x:0,y:8,w:1,h:1,c:Te},{x:1,y:8,w:1,h:1,c:Kr},{x:2,y:8,w:1,h:1,c:Qe},{x:3,y:8,w:1,h:1,c:Te},{x:4,y:8,w:1,h:1,c:Fe},{x:5,y:8,w:1,h:1,c:Fe},{x:6,y:8,w:1,h:1,c:Te},{x:7,y:8,w:1,h:1,c:Qe},{x:8,y:8,w:1,h:1,c:Kr},{x:9,y:8,w:1,h:1,c:Te},{x:5,y:9,w:1,h:1,c:Fe},{x:6,y:9,w:1,h:1,c:Yn}],Z6=[{x:1,y:9,w:7,h:1,c:"#100A06",a:.12}],J6=[{x:2,y:6,w:9,h:1,c:"#100A06",a:.12}],eA=[{x:1,y:10,w:8,h:1,c:"#100A06",a:.12}],ot=4,an=28,qn=2,zt=4,Ct=4,rl=[{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 Jm(e,n,a){const u=e.fy+Math.max(10,Math.floor(e.fh*.18)),d=Math.min(n,a),h=Math.ceil(n/d),m=[],f=d*28,x=e.fx+Math.max(8,Math.floor((e.fw-f)/2));for(let g=0;g<h&&m.length<n;g++){const w=Math.min(d,n-g*d);for(let b=0;b<w;b++)m.push({dx:x+b*28,dy:u+g*28,room:e.id})}return m}function tA(e){const i=rl[0],o={id:"main",wx:ot+Ct,wy:ot,ww:160-2*(ot+Ct),wh:an,fx:ot+Ct,fy:ot+an+qn,fw:160-2*(ot+Ct),fh:120-ot-an-qn-ot,...i},u=Jm(o,Math.min(e,6),3),d=[{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*(ot+Ct))/2),offsetY:10}],h=[{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:d,furniture:h}}function nA(e){const o={id:"exec",wx:ot+Ct,wy:ot,ww:144-ot-Ct-zt/2,wh:an,fx:ot+Ct,fy:ot+an+qn,fw:144-ot-Ct-zt/2,fh:66,...rl[0]},u={id:"work",wx:144+zt/2+Ct,wy:ot,ww:144-zt/2-Ct-ot,wh:an,fx:144+zt/2+Ct,fy:ot+an+qn,fw:144-zt/2-Ct-ot,fh:66,...rl[1]},d={id:"meet",wx:ot+Ct,wy:ot+an+qn+66+zt,ww:144-ot-Ct-zt/2,wh:an,fx:ot+Ct,fy:ot+an+qn+66+zt+an+qn,fw:144-ot-Ct-zt/2,fh:70,...rl[2]},h={id:"comm",wx:144+zt/2+Ct,wy:ot+an+qn+66+zt,ww:144-zt/2-Ct-ot,wh:an,fx:144+zt/2+Ct,fy:ot+an+qn+66+zt+an+qn,fw:144-zt/2-Ct-ot,fh:70,...rl[3]},m={exec:o,work:u,meet:d,comm:h},f=[];let x=e;const g=[[o,Math.min(3,x)],[u,0]];g[1][1]=Math.min(3,x-g[0][1]);const w=[[d,0],[h,0]];let b=x-g[0][1]-g[1][1];b>0&&(w[0][1]=Math.min(2,b),b-=w[0][1]),b>0&&(w[1][1]=Math.min(2,b));for(const[_,L]of[...g,...w])L>0&&f.push(...Jm(_,L,3));const j=ot+an+qn+66,k=144-zt/2,N={exec_work:{id:"exec_work",type:"v",doorY:ot+an+qn+20+12,xA:k-2,xB:u.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:ot+an+qn+66+zt+an+qn+20+12,xA:k-2,xB:h.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:ot+Ct+40+14,yA:j-2,yB:d.fy+2},work_comm:{id:"work_comm",type:"h",doorX:144+zt/2+Ct+40+14,yA:j-2,yB:h.fy+2}},C={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"}]},E={exec:o.fy+52,work:u.fy+48,meet:d.fy+56,comm:h.fy+54},B={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:d.fx+60,y:d.fy+56},{x:d.fx+30,y:d.fy+54},{x:d.fx+110,y:d.fy+50},{x:d.fx+80,y:d.fy+56}],comm:[{x:h.fx+96,y:h.fy+8},{x:h.fx+60,y:h.fy+54},{x:h.fx+40,y:h.fy+54},{x:h.fx+20,y:h.fy+54}]},R=[{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",facility:{id:"theme",label:"THEME",icon:"🎨",color:"#42A5F5",hitW:12,hitH:10}},{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,facility:{id:"settings",label:"SETTINGS",icon:"⚙",color:"#78909C",hitW:10,hitH:10}},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:14,facility:{id:"stats",label:"STATS",icon:"📊",color:"#7E57C2",hitW:16,hitH:8}},{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}],$=[{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:42,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:m,desks:f,doors:N,adjacency:C,corridorY:E,waypoints:B,wallDecorations:R,furniture:$}}function rA(e){const d={id:"exec",wx:ot+Ct,wy:ot,ww:180-ot-Ct-zt/2,wh:an,fx:ot+Ct,fy:ot+an+qn,fw:180-ot-Ct-zt/2,fh:82,...rl[0]},h={id:"work",wx:180+zt/2+Ct,wy:ot,ww:180-zt/2-Ct-ot,wh:an,fx:180+zt/2+Ct,fy:ot+an+qn,fw:180-zt/2-Ct-ot,fh:82,...rl[1]},m=ot+an+qn+82,f={id:"meet",wx:ot+Ct,wy:m+zt,ww:180-ot-Ct-zt/2,wh:an,fx:ot+Ct,fy:m+zt+an+qn,fw:180-ot-Ct-zt/2,fh:86,...rl[2]},x={id:"comm",wx:180+zt/2+Ct,wy:m+zt,ww:180-zt/2-Ct-ot,wh:an,fx:180+zt/2+Ct,fy:m+zt+an+qn,fw:180-zt/2-Ct-ot,fh:86,...rl[3]},g={exec:d,work:h,meet:f,comm:x},w=[];let b=e;const j=[[d,Math.min(5,b)],[h,0]];j[1][1]=Math.min(5,b-j[0][1]);const k=[[f,0],[x,0]];let N=b-j[0][1]-j[1][1];N>0&&(k[0][1]=Math.min(3,N),N-=k[0][1]),N>0&&(k[1][1]=Math.min(3,N));for(const[U,Q]of[...j,...k])Q>0&&w.push(...Jm(U,Q,4));const C=180-zt/2,E={exec_work:{id:"exec_work",type:"v",doorY:d.fy+82/2,xA:C-2,xB:h.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:f.fy+86/2,xA:C-2,xB:x.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:d.fx+54,yA:m-2,yB:f.fy+2},work_comm:{id:"work_comm",type:"h",doorX:h.fx+54,yA:m-2,yB:x.fy+2}},B={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"}]},R={exec:d.fy+82-12,work:h.fy+82-12,meet:f.fy+86-12,comm:x.fy+86-12},$={exec:[{x:d.fx+10,y:R.exec},{x:d.fx+d.fw/2,y:R.exec},{x:d.fx+d.fw-10,y:R.exec}],work:[{x:h.fx+10,y:R.work},{x:h.fx+h.fw/2,y:R.work},{x:h.fx+h.fw-10,y:R.work}],meet:[{x:f.fx+10,y:R.meet},{x:f.fx+f.fw/2,y:R.meet},{x:f.fx+f.fw-10,y:R.meet}],comm:[{x:x.fx+10,y:R.comm},{x:x.fx+x.fw/2,y:R.comm},{x:x.fx+x.fw-10,y:R.comm}]},_=[{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",facility:{id:"theme",label:"THEME",icon:"🎨",color:"#42A5F5",hitW:12,hitH:10}},{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,facility:{id:"settings",label:"SETTINGS",icon:"⚙",color:"#78909C",hitW:10,hitH:10}},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:14,facility:{id:"stats",label:"STATS",icon:"📊",color:"#7E57C2",hitW:16,hitH:8}},{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}],L=[{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(d.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:42,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:g,desks:w,doors:E,adjacency:B,corridorY:R,waypoints:$,wallDecorations:_,furniture:L}}const aA=2;function kv(e,n,a){return a||(n?n==="L"&&e<=12-aA?"M":n==="M"&&e>12?"L":n:e<=12?"M":"L")}function jv(e,n){switch(n??kv(e)){case"S":return tA(e);case"M":return nA(e);case"L":return rA(e)}}function lA(e,n){if(!n||Object.keys(n).length===0)return e;const a=i=>i.map(o=>{const u=n[o.id];return u?{...o,offsetX:u.offsetX,offsetY:u.offsetY}:o});return{...e,wallDecorations:a(e.wallDecorations),furniture:a(e.furniture)}}function iA(e,n){if(n)for(const[a,i]of Object.entries(n))e[a]&&(e[a]={...e[a],dx:i.dx,dy:i.dy})}function sy(e,n){if(!n||n.length===0)return e;const a=new Set(n);return{...e,wallDecorations:e.wallDecorations.filter(i=>!a.has(i.id)),furniture:e.furniture.filter(i=>!a.has(i.id))}}function sA(e,n){if(!n||n.length===0)return e;const a=[],i=[];for(const o of n)o.zone==="wall"?a.push(o):i.push(o);return{...e,wallDecorations:[...e.wallDecorations,...a],furniture:[...e.furniture,...i]}}let zo;function oA(e){zo=e}function O(e,n,a,i,o,u){e=Math.round(e),n=Math.round(n),!(u!==void 0&&u<.01)&&(u!==void 0&&u!==1&&(zo.globalAlpha=u),zo.fillStyle=o,zo.fillRect(e,n,a,i),u!==void 0&&u!==1&&(zo.globalAlpha=1))}function it(e,n,a,i){O(e,n,1,1,a,i)}let Mu=1;function Ts(e){Mu=e}function Na(){return Mu=Mu*16807%2147483647,(Mu&65535)/65535}function Sv(e){const n=parseInt(e.slice(1,3),16)/255,a=parseInt(e.slice(3,5),16)/255,i=parseInt(e.slice(5,7),16)/255,o=Math.max(n,a,i),u=Math.min(n,a,i);let d=0,h=0;const m=(o+u)/2;if(o!==u){const f=o-u;h=m>.5?f/(2-o-u):f/(o+u),o===n?d=((a-i)/f+(a<i?6:0))/6:o===a?d=((i-n)/f+2)/6:d=((n-a)/f+4)/6}return[d*360,h*100,m*100]}function Cv(e,n,a){e=(e%360+360)%360,n=Math.max(0,Math.min(100,n))/100,a=Math.max(0,Math.min(100,a))/100;const i=n*Math.min(a,1-a),o=d=>{const h=(d+e/30)%12;return a-i*Math.max(-1,Math.min(h-3,9-h,1))},u=d=>Math.round(d*255).toString(16).padStart(2,"0");return"#"+u(o(0))+u(o(8))+u(o(4))}function Ea(e,n=1){const[a,i,o]=Sv(e);return Cv(a+15*n,Math.min(100,i+8),o-12*n)}function bn(e,n=1){const[a,i,o]=Sv(e);return Cv(a-10*n,i-3,o+10*n)}const Un={hi:"#D4AA5C",base:"#B08040",sh:"#7A5038",deep:"#4E3028"},_r={hi:"#8A6848",base:"#604832",sh:"#3A2E24",deep:"#2A1E18"},ba={hi:"#5A6A80",base:"#485868",sh:"#364858",deep:"#283848"},Qr="#100A06";function cA(e,n,a=14,i=12){O(e,n,a,i,"#4A3828"),O(e+1,n+1,a-2,i-2,"#5A4838"),O(e+2,n+2,a-4,i-4,"#4A7098"),O(e+2,n+2,a-4,Math.floor((i-4)/2),"#6A90B8",.35);const o=Math.floor(a/2);O(e+o,n+1,1,i-2,"#4A3828"),O(e+1,n+Math.floor(i/2),a-2,1,"#4A3828",.5),it(e+3,n+3,"#8AB8E8",.35),it(e+o+2,n+3,"#8AB8E8",.25),O(e-1,n+i,a+2,2,"#5A4838"),O(e-1,n+i,a+2,1,bn("#5A4838",.5),.35)}function uA(e,n,a){O(e,n,10,8,"#3A2818"),O(e+1,n+1,8,6,a),O(e+2,n+2,4,3,bn(a,1.2),.3),it(e+3,n+2,bn(a,2),.25)}function dA(e,n){O(e,n,7,7,"#3A2818"),O(e+1,n+1,5,5,"#F0EDE5"),it(e+3,n+1,"#AAA"),it(e+3,n+5,"#AAA"),it(e+1,n+3,"#AAA"),it(e+5,n+3,"#AAA"),it(e+3,n+3,"#222"),O(e+3,n+1,1,2,"#333"),it(e+4,n+3,"#D32F2F")}function fA(e,n){O(e,n,26,16,"#586878"),O(e+1,n+1,24,13,"#ECEFF1"),O(e+1,n+1,24,1,"#F5F5F5",.4),O(e+3,n+3,14,1,"#1565C0",.6),O(e+3,n+5,18,1,"#333",.2),O(e+3,n+7,12,1,"#D32F2F",.35),O(e+3,n+9,16,1,"#333",.15),O(e+1,n+14,24,2,"#708898"),O(e+3,n+14,3,1,"#D32F2F"),O(e+7,n+14,3,1,"#1565C0"),O(e+11,n+14,3,1,"#2E7D32")}function hA(e,n){O(e,n,22,16,"#6A5030"),O(e+1,n+1,20,14,"#C4A66A"),Ts(88);for(let a=0;a<14;a++)for(let i=0;i<20;i++)Na()>.5&&it(e+1+i,n+1+a,Na()>.5?"#B89858":"#D4B87A",.18);O(e+2,n+2,5,4,"#FFF176"),O(e+8,n+2,5,4,"#90CAF9"),O(e+14,n+3,5,4,"#CE93D8"),O(e+3,n+8,7,4,"#C8E6C9"),O(e+11,n+8,8,4,"#F8BBD0"),it(e+4,n+2,"#E53935"),it(e+10,n+2,"#1E88E5"),it(e+16,n+3,"#FF9800")}function mA(e,n){O(e,n,20,3,"#5A4030"),O(e,n,20,1,bn("#5A4030",.5),.35),O(e,n+2,20,1,Ea("#5A4030",.5),.3),O(e+2,n-4,3,4,"#E53935"),O(e+2,n-4,3,1,bn("#E53935",1),.3),O(e+6,n-3,2,3,"#1E88E5"),O(e+9,n-5,4,5,"#43A047"),O(e+14,n-3,3,3,"#FFD54F"),it(e+15,n-3,"#FFF176",.4)}function pA(e,n){O(e,n,16,12,"#1E1E28"),O(e+1,n+1,14,9,"#0C1420"),O(e+2,n+2,12,1,"#EF4444",.6),it(e+2,n+4,"#4CAF50"),O(e+4,n+4,7,1,"#8b949e",.4),it(e+2,n+6,"#FF9800"),O(e+4,n+6,5,1,"#8b949e",.3),it(e+2,n+8,"#42A5F5"),O(e+4,n+8,8,1,"#8b949e",.25),O(e+7,n+10,2,2,"#1E1E28"),O(e+5,n+11,6,1,"#586878")}function xA(e,n,a){O(e+2,n+20,22,2,Qr,.15),O(e,n,22,20,_r.deep),O(e+1,n+1,20,18,_r.base),O(e,n,22,1,_r.hi,.35),O(e,n,1,20,_r.hi,.2);for(const u of[6,12])O(e+1,n+u,20,2,_r.sh),O(e+1,n+u,20,1,_r.hi,.2);const i=["#E53935","#1E88E5","#43A047","#8E24AA","#FB8C00","#00897B","#5C6BC0"];let o=e+2;for(let u=0;u<5;u++){const d=2+u%2;O(o,n+1,d,5,i[u]),O(o,n+1,d,1,bn(i[u],1),.35),o+=d+1}o=e+2;for(let u=0;u<4;u++)O(o,n+7,4,5,i[u+3]),O(o,n+7,4,1,bn(i[u+3],1),.25),o+=5;O(e+2,n+14,4,4,"#FFD54F"),O(e+8,n+14,7,4,"#90CAF9"),a&&O(e,n-1,22,1,a,.7)}function gA(e,n){O(e+2,n+11,6,2,Qr,.1),O(e+2,n+8,6,4,"#8B5E3C"),O(e+1,n+7,8,2,Ea("#A06E48",.3)),O(e+2,n+7,6,1,bn("#A06E48",.5),.4),O(e+1,n+3,3,4,"#2E7D32"),O(e+5,n+2,3,4,"#2E7D32"),O(e+2,n+1,4,4,"#43A047"),O(e+3,n+0,3,3,"#66BB6A"),it(e+4,n,"#81C784"),it(e+3,n+1,"#A5D6A7",.4)}function yA(e,n){vi(e+4,n-4,"down"),vi(e+16,n-4,"down"),vi(e+28,n-4,"down"),O(e+3,n+24,34,3,Qr,.15),O(e,n+2,36,18,Un.deep),O(e+1,n+3,34,16,Un.base),O(e+1,n+3,34,1,Un.hi,.35);for(let a=0;a<14;a+=3)O(e+1,n+4+a,34,1,Ea(Un.base,.2),.08);O(e,n+20,36,4,Un.deep),O(e+1,n+21,34,2,Un.sh),O(e+6,n+7,10,6,"#1A1A24"),O(e+7,n+8,8,4,"#0C1420"),O(e+8,n+9,4,1,"#2A6898",.4),O(e+20,n+8,6,4,"#F0F0F0"),O(e+15,n+7,3,3,"#ECEFF1"),it(e+16,n+8,"#795548"),vi(e+4,n+24,"up"),vi(e+16,n+24,"up"),vi(e+28,n+24,"up")}function bA(e,n){O(e+2,n+16,36,3,Qr,.15),O(e,n,36,5,"#5D4037"),O(e+1,n+1,34,3,"#6D4C41"),O(e+1,n+1,34,1,bn("#6D4C41",.5),.3),O(e,n+5,36,8,"#5D4037"),O(e+2,n+6,15,6,"#6D4C41"),O(e+3,n+6,13,1,bn("#6D4C41",.5),.35),O(e+19,n+6,15,6,"#6D4C41"),O(e+20,n+6,13,1,bn("#6D4C41",.5),.35),O(e+17,n+6,2,6,"#5D4037"),O(e,n+13,36,3,Ea("#5D4037",1)),O(e-2,n+2,3,12,"#5D4037"),O(e+35,n+2,3,12,"#5D4037"),O(e+4,n+7,6,4,"#FF8A65"),O(e+5,n+7,4,1,bn("#FF8A65",1),.35)}function vA(e,n){O(e+2,n+10,22,2,Qr,.12),O(e,n,22,8,_r.deep),O(e+1,n+1,20,6,_r.base),O(e+1,n+1,20,1,_r.hi,.3),O(e,n+8,22,2,_r.sh),O(e+3,n+2,6,4,"#F0F0F0"),O(e+13,n+3,3,3,"#ECEFF1"),it(e+14,n+4,"#795548")}function wA(e,n){O(e+1,n+14,10,2,Qr,.12),O(e,n,10,14,"#546E7A"),O(e,n,10,1,bn("#546E7A",1),.35),O(e+1,n+1,8,3,"#78909C"),O(e+1,n+5,8,4,"#37474F"),it(e+2,n+6,"#EF5350"),it(e+4,n+6,"#66BB6A"),O(e+2,n+11,4,2,"#ECEFF1")}function kA(e,n){O(e+2,n+18,28,3,Qr,.12),O(e,n,28,18,"#37474F"),O(e+1,n+1,26,15,"#0D47A1"),O(e+2,n+2,24,13,"#1565C0"),O(e+2,n+2,24,4,"#1976D2",.4),O(e+2,n+12,24,3,"#F9A825",.35),O(e+4,n+8,2,5,"#2E7D32"),O(e+6,n+9,2,4,"#43A047"),O(e+20,n+7,2,6,"#2E7D32"),O(e+22,n+8,2,5,"#388E3C"),O(e+9,n+5,4,2,"#FF8A65"),it(e+12,n+5,"#FF5722"),O(e+16,n+8,3,2,"#FFD54F"),it(e+15,n+8,"#FFC107"),it(e+13,n+3,"#90CAF9",.5),it(e+14,n+4,"#BBDEFB",.35),it(e+8,n+3,"#BBDEFB",.3),O(e,n+16,28,2,"#455A64"),O(e+1,n+16,26,1,bn("#455A64",.5),.3)}function jA(e,n){O(e,n,24,10,"#1A1A2E"),O(e+2,n+1,20,8,"#E040FB",.15),O(e+3,n+2,4,6,"#E040FB",.7),O(e+4,n+3,2,4,"#1A1A2E"),O(e+8,n+2,1,6,"#00E5FF",.7),O(e+8,n+2,4,1,"#00E5FF",.7),O(e+8,n+4,4,1,"#00E5FF",.7),O(e+11,n+2,1,3,"#00E5FF",.7),O(e+13,n+2,1,6,"#E040FB",.7),O(e+13,n+2,4,1,"#E040FB",.7),O(e+13,n+4,3,1,"#E040FB",.7),O(e+13,n+7,4,1,"#E040FB",.7),O(e+18,n+2,1,6,"#00E5FF",.7),O(e+21,n+2,1,6,"#00E5FF",.7),O(e+19,n+3,1,2,"#00E5FF",.5),O(e+20,n+5,1,2,"#00E5FF",.5)}function SA(e,n){O(e+2,n+28,16,3,Qr,.15),O(e,n,16,28,"#1A237E"),O(e+1,n+1,14,3,"#283593"),O(e+2,n+4,12,10,"#0D1117"),O(e+3,n+5,10,8,"#1B5E20"),O(e+5,n+6,2,2,"#4CAF50"),O(e+9,n+8,2,2,"#FF5722"),O(e+7,n+10,3,1,"#FFD54F"),it(e+6,n+7,"#81C784"),O(e+1,n+14,14,6,"#1A237E"),O(e+2,n+15,4,4,"#212121"),it(e+4,n+16,"#F44336"),it(e+9,n+16,"#F44336"),it(e+11,n+16,"#2196F3"),it(e+10,n+18,"#FFEB3B"),O(e,n+20,16,8,"#0D47A1"),O(e+1,n+21,14,6,"#1565C0"),O(e,n+4,1,14,"#FF4081",.4),O(e+15,n+4,1,14,"#FF4081",.4)}function CA(e,n){O(e+2,n+24,20,3,Qr,.15),O(e,n,20,24,"#4E342E"),O(e+1,n+1,18,22,"#5D4037"),O(e+2,n+1,16,4,"#FF6F00"),O(e+3,n+2,14,2,"#FF8F00",.6),O(e+2,n+5,16,10,"#1A1A2E"),O(e+3,n+6,14,8,"#212121"),O(e+4,n+7,4,4,"#333"),O(e+5,n+8,2,2,"#E53935"),O(e+10,n+7,4,4,"#333"),O(e+11,n+8,2,2,"#1E88E5"),O(e+3,n+16,14,6,"#3E2723");for(let a=0;a<7;a++)O(e+4+a*2,n+17,1,4,"#5D4037",.5);O(e+1,n+5,18,1,"#FFD54F",.5),O(e+1,n+15,18,1,"#FFD54F",.5)}function NA(e,n){O(e+2,n+22,22,2,Qr,.12),O(e,n,22,22,_r.deep),O(e+1,n+1,20,20,"#37474F"),O(e+2,n+2,18,18,"#546E7A",.3),O(e+1,n+10,20,1,_r.base),O(e+1,n+10,20,1,_r.hi,.2),O(e+4,n+3,4,5,"#FFD54F"),O(e+5,n+4,2,3,"#FFC107"),O(e+4,n+7,4,1,"#FFA000"),it(e+5,n+3,"#FFF176",.5),O(e+13,n+4,4,4,"#B0BEC5"),O(e+14,n+3,2,1,"#CFD8DC"),it(e+14,n+5,"#ECEFF1",.6),O(e+5,n+12,3,3,"#A1887F"),O(e+6,n+11,1,1,"#D7CCC8"),O(e+12,n+12,6,4,"#5D4037"),O(e+13,n+13,4,2,"#FFD54F",.6),O(e+2,n+2,2,18,"#fff",.08)}function EA(e,n){O(e+2,n+16,26,3,Qr,.18),O(e,n,26,10,Un.deep),O(e+1,n+1,24,8,Un.base),O(e+1,n+2,24,1,Un.hi,.2),O(e+1,n+4,24,1,Ea(Un.base,.2),.1),O(e+1,n+6,24,1,Un.hi,.15),O(e+1,n+1,24,1,Un.hi,.4),O(e+1,n+1,1,8,Un.hi,.2),O(e,n+10,26,5,Un.deep),O(e+1,n+11,24,3,Un.sh),O(e+1,n+10,24,1,Ea(Un.base,1.5),.4),O(e+1,n+14,24,1,Un.base,.15),O(e+2,n+12,10,1,Un.deep,.4),O(e+14,n+12,10,1,Un.deep,.4),it(e+7,n+11,"#C8D0D8",.6),it(e+19,n+11,"#C8D0D8",.6),O(e+6,n-5,14,7,"#1E1E28"),O(e+7,n-4,12,5,"#0C1420"),O(e+8,n-3,5,1,"#2A6898",.6),O(e+8,n-2,8,1,"#1A3858",.4),O(e+8,n-1,3,1,"#2A6898",.35),it(e+7,n-4,"#4A98D8",.25),it(e+12,n+1,"#4CAF50",.4),O(e+12,n+2,2,3,"#586878"),O(e+10,n+4,6,1,"#8898A8"),O(e+6,n+4,12,4,"#222228"),O(e+6,n+4,12,1,"#333338",.4);for(let a=0;a<5;a++)it(e+7+a*2,n+5,"#444",.6),it(e+7+a*2,n+6,"#3A3A3E",.4);O(e+20,n+5,3,4,"#333338"),O(e+20,n+5,3,1,"#444448"),O(e+1,n+3,4,4,"#F0EDE8"),O(e+1,n+3,4,1,"#F8F6F2"),it(e+2,n+5,"#6D4C41")}function vi(e,n,a){O(e+1,n+9,10,2,Qr,.1),it(e+5,n+9,"#1E1E22"),it(e+1,n+10,"#1A1A1E"),it(e+9,n+10,"#1A1A1E"),it(e+3,n+11,"#1A1A1E"),it(e+7,n+11,"#1A1A1E"),O(e+1,n+2,8,6,ba.base),O(e+2,n+3,6,4,ba.hi,.35),O(e+2,n+3,6,1,bn(ba.hi,.5),.25),O(e+1,n+7,8,1,ba.deep),a==="up"?(O(e,n+7,10,3,ba.deep),O(e+1,n+8,8,1,ba.sh)):(O(e,n-1,10,3,ba.deep),O(e+1,n,8,1,ba.sh)),O(e,n+3,1,4,ba.sh),O(e+9,n+3,1,4,ba.sh)}const Nv={bookshelf:(e,n,a)=>xA(e,n,a.accent),plant:(e,n)=>gA(e,n),"meeting-table":(e,n)=>yA(e,n),sofa:(e,n)=>bA(e,n),"coffee-table":(e,n)=>vA(e,n),"coffee-machine":(e,n)=>wA(e,n),window:(e,n,a)=>cA(e,n,a.windowW??16,a.windowH??14),picture:(e,n,a)=>uA(e,n,a.pictureColor??"#1565C0"),clock:(e,n)=>dA(e,n),whiteboard:(e,n)=>fA(e,n),"bulletin-board":(e,n)=>hA(e,n),shelf:(e,n)=>mA(e,n),screen:(e,n)=>pA(e,n),aquarium:(e,n)=>kA(e,n),"neon-sign":(e,n)=>jA(e,n),arcade:(e,n)=>SA(e,n),jukebox:(e,n)=>CA(e,n),"trophy-case":(e,n)=>NA(e,n)};function Ss(e,n){const a=e.zone==="wall"?n.wx:n.fx,i=e.zone==="wall"?n.wy:n.fy;return{x:e.anchorX==="right"?(e.zone==="wall"?n.wx+n.ww:n.fx+n.fw)+e.offsetX:a+e.offsetX,y:i+e.offsetY}}function AA(e){for(const n of e.wallDecorations){const a=e.rooms[n.room];if(!a)continue;const{x:i,y:o}=Ss(n,a),u=Nv[n.type];u&&u(i,o,n)}}function DA(e,n,a){for(const i of e.furniture){const o=e.rooms[i.room];if(!o||i.condition==="no-desks"&&a.has(i.room))continue;const{x:u,y:d}=Ss(i,o),h=Nv[i.type];h&&n.push({y:d,draw:()=>h(u,d,i)})}}function wi(e){const n=[],a=[...e.wallDecorations,...e.furniture];for(const i of a){if(!i.facility)continue;const o=e.rooms[i.room];if(!o)continue;const{x:u,y:d}=Ss(i,o);n.push({id:i.facility.id,label:i.facility.label,icon:i.facility.icon,color:i.facility.color,dx:u,dy:d,pw:i.facility.hitW,ph:i.facility.hitH})}return n}const TA={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},aquarium:{w:28,h:18},"neon-sign":{w:24,h:10},arcade:{w:16,h:28},jukebox:{w:20,h:24},"trophy-case":{w:22,h:22}};function bm(e){return TA[e]??{w:16,h:16}}function Oh(e,n,a,i){for(let o=e.furniture.length-1;o>=0;o--){const u=e.furniture[o],d=e.rooms[u.room];if(!d||u.condition==="no-desks"&&i.has(u.room))continue;const{x:h,y:m}=Ss(u,d),f=bm(u.type);if(n>=h&&n<=h+f.w&&a>=m&&a<=m+f.h)return u.id}for(let o=e.wallDecorations.length-1;o>=0;o--){const u=e.wallDecorations[o],d=e.rooms[u.room];if(!d)continue;const{x:h,y:m}=Ss(u,d),f=bm(u.type);if(n>=h&&n<=h+f.w&&a>=m&&a<=m+f.h)return u.id}return null}function oy(e,n,a,i,o){const d=[...n.wallDecorations,...n.furniture].find(g=>g.id===a);if(!d||d.condition==="no-desks"&&o.has(d.room))return;const h=n.rooms[d.room];if(!h)return;const{x:m,y:f}=Ss(d,h),x=bm(d.type);e.save(),e.fillStyle=i,e.globalAlpha=.2,e.fillRect(m-1,f-1,x.w+2,x.h+2),e.globalAlpha=.9,e.strokeStyle=i,e.lineWidth=1,e.strokeRect(m-.5,f-.5,x.w+1,x.h+1),e.restore()}function cy(e,n,a,i){e.save(),e.fillStyle=i,e.globalAlpha=.2,e.fillRect(n-1,a-1,28,42),e.globalAlpha=.9,e.strokeStyle=i,e.lineWidth=1,e.strokeRect(n-.5,a-.5,27,41),e.restore()}function uy(e,n,a){for(const[i,o]of Object.entries(e))if(n>=o.dx&&n<=o.dx+26&&a>=o.dy&&a<=o.dy+40)return i;return null}const dy=[{type:"plant",zone:"floor",label:"Plant",icon:"🪴",price:0},{type:"clock",zone:"wall",label:"Clock",icon:"🕐",price:0},{type:"bookshelf",zone:"floor",label:"Bookshelf",icon:"📚",price:500},{type:"picture",zone:"wall",label:"Picture",icon:"🖼️",price:500},{type:"shelf",zone:"wall",label:"Shelf",icon:"📦",price:800},{type:"window",zone:"wall",label:"Window",icon:"🪟",price:1e3},{type:"sofa",zone:"floor",label:"Sofa",icon:"🛋️",price:1500},{type:"coffee-table",zone:"floor",label:"Coffee Table",icon:"☕",price:1500},{type:"coffee-machine",zone:"floor",label:"Coffee Machine",icon:"☕",price:2e3},{type:"meeting-table",zone:"floor",label:"Meeting Table",icon:"🪑",price:3e3},{type:"whiteboard",zone:"wall",label:"Whiteboard",icon:"📋",price:3e3},{type:"screen",zone:"wall",label:"Screen",icon:"🖥️",price:5e3},{type:"aquarium",zone:"floor",label:"Aquarium",icon:"🐠",price:5e3},{type:"neon-sign",zone:"wall",label:"Neon Sign",icon:"💡",price:3e3},{type:"arcade",zone:"floor",label:"Arcade",icon:"🕹️",price:8e3},{type:"jukebox",zone:"floor",label:"Jukebox",icon:"🎵",price:6e3},{type:"trophy-case",zone:"floor",label:"Trophy Case",icon:"🏆",price:7e3}],ju=16,FA=4,bi=4,Ru=2,Xt=4,Ll=4;let Ke=jv(7);const Yu={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},fy={ceo:{en:["Boss?","What's up?","Time for a meeting?","Got any ideas?","How's everyone doing?"],ko:["대표님?","무슨 일이신가요?","회의 시간이신가요?","좋은 아이디어 있으시면 말씀해주세요.","다들 잘하고 있나요?"],ja:["社長?","何かありますか?","会議の時間ですか?","良いアイデアがあれば教えてください。","みんな元気ですか?"]},cto:{en:["Need anything?","Tech question?","Reviewing architecture.","Deploy in a moment.","Want me to look at the code?"],ko:["뭐 필요하신 거 있으세요?","기술 관련 질문이신가요?","아키텍처 리뷰 중이에요.","배포는 조금만 기다려주세요.","코드 봐드릴까요?"],ja:["何かお手伝いしましょうか?","技術的な質問ですか?","アーキテクチャレビュー中です。","デプロイはもう少しお待ちください。","コード見ましょうか?"]},cbo:{en:["Business question?","Reviewing revenue model.","Want to see market research?","Analyzing competitors.","Can I help?"],ko:["비즈니스 관련 얘기신가요?","수익 모델 검토 중이에요.","시장 조사 결과 보실래요?","경쟁사 분석 중입니다.","뭔가 도와드릴까요?"],ja:["ビジネスの話ですか?","収益モデルを検討中です。","市場調査の結果を見ますか?","競合分析中です。","何かお手伝いしましょうか?"]},pm:{en:["Curious about progress?","Updating the roadmap.","Assigning tasks.","Need to re-prioritize?","Preparing sprint review."],ko:["프로젝트 진행 상황 궁금하신가요?","로드맵 업데이트 중이에요.","태스크 할당 중입니다.","우선순위 조정이 필요할까요?","스프린트 리뷰 준비 중이에요."],ja:["進捗が気になりますか?","ロードマップを更新中です。","タスクを割り当て中です。","優先順位の調整が必要ですか?","スプリントレビューの準備中です。"]},engineer:{en:["Working on it!","Fixing a bug.","Need a code review?","Writing tests.","Pushing a PR."],ko:["일하고 있어요!","버그 수정 중입니다.","코드 리뷰 필요하신가요?","테스트 작성 중이에요.","PR 올리고 있어요."],ja:["作業中です!","バグ修正中です。","コードレビュー必要ですか?","テスト書いてます。","PR出してます。"]},designer:{en:["Got design feedback?","Working on mockups.","Thinking about UI improvements.","Picking colors...","Want to see the prototype?"],ko:["디자인 피드백 있으신가요?","목업 작업 중이에요.","UI 개선안 생각 중입니다.","컬러 팔레트 고민 중이에요.","프로토타입 보여드릴까요?"],ja:["デザインのフィードバックありますか?","モックアップ作業中です。","UI改善案を考えています。","カラーパレットを検討中です。","プロトタイプ見せましょうか?"]},qa:{en:["Testing in progress.","Found a bug!","Writing test cases.","Running regression tests.","Quality check in progress."],ko:["테스트 중이에요.","버그 발견했어요!","테스트 케이스 작성 중입니다.","회귀 테스트 진행 중이에요.","품질 체크 중입니다."],ja:["テスト中です。","バグ見つけました!","テストケース作成中です。","回帰テスト実行中です。","品質チェック中です。"]},"data-analyst":{en:["Analyzing data.","Preparing a report.","Want to check the dashboard?","Tracking metrics.","Found an insight!"],ko:["데이터 분석 중이에요.","리포트 준비 중입니다.","대시보드 확인해보실래요?","지표 추적 중이에요.","인사이트 발견했어요!"],ja:["データ分析中です。","レポート準備中です。","ダッシュボード確認しますか?","指標追跡中です。","インサイト発見しました!"]},default:{en:["Hello!","How can I help?","Working hard.","Have a great day!"],ko:["안녕하세요!","무엇을 도와드릴까요?","열심히 일하고 있어요.","좋은 하루 되세요!"],ja:["こんにちは!","何かお手伝いしましょうか?","頑張って仕事してます。","良い一日を!"]}};function MA(e,n){const a=fy[e]||fy.default;return a[n]||a.en||a.default||[]}let wa=wi(Ke);function Ev(e){return{x:e.dx,y:e.dy,w:e.pw,h:e.ph}}function Av(e){return{cx:e.dx+e.pw/2,botY:e.dy+e.ph}}let vn={};function RA(e){const n={};for(let a=0;a<e.length&&a<Ke.desks.length;a++)n[e[a]]=Ke.desks[a];return n}let qe,er=null,ki=null,nl=!1,sa=null,Rr=null,Dv=0,rr=null,Hn=null,Ol=null,va=null,$h=900;function zA(e,n){const{wx:a,wy:i,ww:o,wh:u,wallColor:d,baseboardColor:h}=e,m=Ea(d,.5),f=bn(d,.5),x=[];if(n){const g=n.x-a,w=n.w;g>0&&x.push({sx:a,sw:g}),g+w<o&&x.push({sx:n.x+w,sw:o-g-w})}else x.push({sx:a,sw:o});for(const g of x){O(g.sx,i,g.sw,u,d);for(let w=0;w<u;w+=4)O(g.sx,i+w,g.sw,1,f,.08),O(g.sx,i+w+2,g.sw,1,m,.05);Ts(Math.round(g.sx*7+i*13));for(let w=0;w<g.sw;w+=3)Na()>.4&&O(g.sx+w,i,1,u,f,.04);O(g.sx,i,g.sw,2,f,.3),O(g.sx,i,g.sw,1,bn(d,1),.2),O(g.sx,i+u-2,g.sw,2,m,.3),O(g.sx,i+u,g.sw,Ru,h),O(g.sx,i+u,g.sw,1,bn(h,.5),.4)}n&&(O(n.x-1,i,1,u+Ru,"#4A3828"),O(n.x+n.w,i,1,u+Ru,"#4A3828"),O(n.x,i,n.w,1,"#0A0808",.12)),O(e.fx,e.fy,e.fw,3,"#0A0808",.12),O(e.fx,e.fy+3,e.fw,2,"#0A0808",.06)}function _A(e){const n="#504038",a=Ea(n,.5),i=bn(n,.5),o=e.wx-Ll,u=e.wy,d=e.wh+Ru+e.fh;O(o,u,Ll,d,n),O(o,u,1,d,i,.3),O(o+Ll-1,u,1,d,a,.4);for(let m=0;m<d;m+=6)O(o+1,u+m,Ll-2,1,i,.06);const h=e.wx+e.ww;O(h,u,Ll,d,n),O(h,u,1,d,i,.2),O(h+Ll-1,u,1,d,a,.3)}function Lh(e){const{fx:n,fy:a,fw:i,fh:o}=e,u="#B08040",d="#C89848",h="#8A6030",m="#6A4820";O(n,a,i,o,u),Ts(42);for(let f=0;f<o;f+=5){const x=Math.floor(f/5)%2*10;for(let g=-10;g<i+10;g+=20){const w=n+g+x,b=Math.max(n,w),j=Math.min(w+19,n+i)-b;if(j<=0)continue;const k=Na()>.5?d:u;O(b,a+f,j,4,k,.25),O(b,a+f,j,1,d,.3),O(b,a+f+4,j,1,m,.35),w>=n&&w<n+i&&O(w,a+f,1,4,m,.2),O(b,a+f+2,j,1,h,.1)}}O(n,a,i,2,"#0A0808",.08),O(n,a,2,o,"#0A0808",.06)}function hy(e){const{fx:n,fy:a,fw:i,fh:o}=e,u="#1C2A38",d="#101820";Ts(99),O(n,a,i,o,u);for(let h=0;h<o;h+=ju)for(let m=0;m<i;m+=ju){const f=Math.min(ju,i-m),x=Math.min(ju,o-h);Na()>.5&&O(n+m,a+h,f,x,bn(u,.2),.15),O(n+m+2,a+h+2,f-4,x-4,bn(u,.3),.08),O(n+m,a+h,f,1,d,.5),O(n+m,a+h,1,x,d,.5),O(n+m+1,a+h+1,1,x-1,bn(u,.4),.1),Na()>.85&&it(n+m+4+Math.floor(Na()*8),a+h+4+Math.floor(Na()*8),"#3A6A9A",.08)}}function BA(e){const{fx:n,fy:a,fw:i,fh:o}=e,u="#387848",d="#4A9058",h="#285E38";O(n,a,i,o,u),Ts(77);for(let f=0;f<o;f+=2)for(let x=0;x<i;x+=2)Na()>.5&&it(n+x,a+f,d,.1),Na()>.8&&it(n+x+1,a+f+1,h,.12);const m=5;O(n+m,a+m,i-m*2,1,d,.45),O(n+m,a+o-m-1,i-m*2,1,h,.45),O(n+m,a+m,1,o-m*2,d,.35),O(n+i-m-1,a+m,1,o-m*2,h,.35)}function OA(e){const{fx:n,fy:a,fw:i,fh:o}=e,u="#D8C490",d="#B09060",h="#907848";Ts(55);for(let m=0;m<o;m+=8)for(let f=0;f<i;f+=8){const x=Math.min(8,i-f),g=Math.min(8,o-m),w=(f/8+m/8)%2===0?d:u;O(n+f,a+m,x,g,w),O(n+f+1,a+m+1,x-2,1,bn(w,.4),.2),O(n+f+1,a+m+1,1,g-2,bn(w,.4),.15),O(n+f+x-2,a+m+2,1,g-3,Ea(w,.4),.15),O(n+f+2,a+m+g-2,x-3,1,Ea(w,.4),.15),O(n+f,a+m,x,1,h,.3),O(n+f,a+m,1,g,h,.3)}}function $A(){const{canvasW:e,canvasH:n,rooms:a,doors:i}=Ke,o="#2A1E14",u="#3A2E24";if(O(0,0,e,bi,o),O(0,n-bi,e,bi,o),O(0,0,bi,n,o),O(e-bi,0,bi,n,o),O(0,0,e,1,u,.3),O(0,0,1,n,u,.2),!a.exec||!a.work||!a.meet||!a.comm)return;const d=a.exec,h=a.meet,m=e/2,f=m-Xt/2,x=d.fy+d.fh,g=i.exec_work,w=i.meet_comm,b=i.exec_meet,j=i.work_comm,k=24,N=28,C=((g==null?void 0:g.doorY)??d.fy+20)-k/2,E=((b==null?void 0:b.doorX)??bi+Ll+54)-N/2,B=((j==null?void 0:j.doorX)??m+Xt/2+Ll+54)-N/2,R=((w==null?void 0:w.doorY)??h.fy+20)-k/2;O(0,x,E,Xt,o),O(E+N,x,f-E-N,Xt,o),O(f+Xt,x,B-f-Xt,Xt,o),O(B+N,x,e-B-N,Xt,o),O(0,x,E,1,u,.3),O(E+N,x,f-E-N,1,u,.3),O(f+Xt,x,B-f-Xt,1,u,.3),O(B+N,x,e-B-N,1,u,.3),O(f,0,Xt,C,o),O(f,C+k,Xt,x-C-k,o),O(f,x+Xt,Xt,R-x-Xt,o),O(f,R+k,Xt,n-R-k,o),O(f,0,1,C,u,.2),O(f,C+k,1,x-C-k,u,.2),O(f,x+Xt,1,R-x-Xt,u,.2),O(f,R+k,1,n-R-k,u,.2),O(f,C,Xt,k,"#C4A070"),O(f+Xt/2,C,Xt/2,k,"#3A4858"),O(f,R,Xt,k,"#7AA880"),O(f+Xt/2,R,Xt/2,k,"#C8B890");const $="#4A3828";O(f,C-1,Xt,1,$),O(f,C+k,Xt,1,$),O(E-1,x,1,Xt,$),O(E+N,x,1,Xt,$),O(B-1,x,1,Xt,$),O(B+N,x,1,Xt,$),O(f,R-1,Xt,1,$),O(f,R+k,Xt,1,$)}const my=new Map;function LA(e,n="right"){const a=`${e.hairStyle??""}|${e.outfitStyle??""}|${e.accessory??""}|${n}`;let i=my.get(a);if(!i){const o=am("mini-seated:default"),u=Ib(o,e);let d=u?u.layers.flatMap(h=>h.pixels):[];n==="left"&&d.length>0&&(d=nm(d,12)),i=d,my.set(a,i)}return i}function IA(e,n,a,i="right"){Il(qe,LA(a,i),e,n,a)}function HA(e,n,a,i,o,u="right"){vi(e+8,n+20,"up"),o||IA(e+8,n+0+i,a,u),EA(e,n+14)}function UA(e,n,a,i,o){const u=i in ry?i:"down",d=o%4,h=ry[u][d];Il(qe,h,e,n,a);const m=d===1||d===3?-1:0;if(a.accessory&&a.accessory!=="none"){const f=aC(a.accessory,u);f&&f.pixels.length>0&&Il(qe,f.pixels,e,n+m,a)}qe.globalAlpha=1}let $o=[],Ci=!1,Cs=0;function qA(){const e=Object.keys(Ke.rooms),n=e[Math.floor(Math.random()*e.length)],a=Ke.rooms[n];return{x:a.fx+a.fw/2,y:a.fy+a.fh/2,dir:"down",walkFrame:0,walkTimer:0,path:[],room:n,state:"walking",stateTimer:0,tongueTimer:0,idleTime:0}}function YA(e){if(e.stateTimer--,Ci){Cs++,e.dir="down",e.walkFrame=0,e.tongueTimer++,e.idleTime=0;return}else Cs=0;if(e.state==="idle"){if(e.tongueTimer++,e.idleTime++,e.stateTimer<=0){e.state="walking",e.tongueTimer=0;const n=Object.keys(Ke.rooms);if(Math.random()<.35&&n.length>1){const a=n.filter(d=>d!==e.room),i=a[Math.floor(Math.random()*a.length)],o=ep(e,i),u=Ke.waypoints[i];if(u&&u.length>0){const d=u[Math.floor(Math.random()*u.length)],h=o[o.length-1]??{x:e.x,y:e.y},m=Ni(h.x,h.y,d.x,d.y,i);e.path=[...o,...m]}else e.path=o}else{const a=Ke.waypoints[e.room];if(a&&a.length>0){const i=a[Math.floor(Math.random()*a.length)];e.path=Ni(e.x,e.y,i.x,i.y,e.room)}}e.walkTimer=0}}else if(e.state==="walking"){if(e.idleTime=0,e.path.length===0){e.state="idle",e.dir="down",e.stateTimer=120+Math.floor(Math.random()*240);return}const n=e.path[0],a=n.x-e.x,i=n.y-e.y,o=Math.sqrt(a*a+i*i);if(o<1.5){e.x=n.x,e.y=n.y,e.path.shift();for(const[u,d]of Object.entries(Ke.rooms))if(e.x>=d.fx&&e.x<=d.fx+d.fw&&e.y>=d.fy&&e.y<=d.fy+d.fh){e.room=u;break}}else e.x+=a/o*.15,e.y+=i/o*.15,Math.abs(a)>Math.abs(i)?e.dir=a>0?"right":"left":e.dir=i>0?"down":"up",e.walkTimer++,e.walkFrame=Math.floor(e.walkTimer/15)%2}}function XA(e){const n=Math.round(e.x),a=Math.round(e.y);if(Ci&&Cs>90){const d=Math.floor(Cs/12)%2===0?Q6:P6;Il(qe,eA,n,a),Il(qe,d,n,a);return}const i=e.state==="walking"?e.walkFrame:0,o=V6[e.dir][i],u=e.dir==="left"||e.dir==="right";Il(qe,u?J6:Z6,n,a),Il(qe,o,n,a),e.state==="idle"&&e.dir==="down"&&e.tongueTimer%80<50&&Il(qe,K6,n,a)}function WA(e){const n={};let a=0;for(const i of e){const o=vn[i];o&&(n[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:1200+Math.floor(Math.random()*1800),sittingTime:0,lookDir:"right",isStretching:!1,stretchTimer:0},a++)}return n}function Ni(e,n,a,i,o){const u=Ke.corridorY[o]??n,d=[];return n<u-4&&d.push({x:e,y:u}),Math.abs(e-a)>4&&d.push({x:a,y:u}),d.push({x:a,y:i}),d}function Ih(e,n,a,i){const o=Ke.adjacency[a];if(!o)return[];const u=o.find(x=>x.room===i);if(!u)return[];const d=Ke.doors[u.door];if(!d)return[];const h=[],m=Ke.corridorY[a]??n,f=Ke.corridorY[i]??n;if(Math.abs(n-m)>4&&h.push({x:e,y:m}),d.type==="v"){const x=u.side==="A"?d.xA:d.xB,g=u.side==="A"?d.xB:d.xA;h.push({x,y:m}),h.push({x,y:d.doorY}),h.push({x:g,y:d.doorY}),h.push({x:g,y:f})}else{const x=u.side==="A"?d.yA:d.yB,g=u.side==="A"?d.yB:d.yA;h.push({x:d.doorX,y:m}),h.push({x:d.doorX,y:x}),h.push({x:d.doorX,y:g}),h.push({x:d.doorX,y:f})}return h}function ep(e,n){const a=Ke.adjacency[e.room];if(!a)return[];if(!a.find(o=>o.room===n)){for(const o of a){const u=Ke.adjacency[o.room];if(u!=null&&u.find(d=>d.room===n)){const d=Ih(e.x,e.y,e.room,o.room),h=d[d.length-1],m=Ih((h==null?void 0:h.x)??e.x,(h==null?void 0:h.y)??e.y,o.room,n);return[...d,...m]}}return[]}return Ih(e.x,e.y,e.room,n)}function GA(e){if(e.room!==e.homeRoom){const n=ep({...e},e.homeRoom),a=n[n.length-1],i=Ni((a==null?void 0:a.x)??e.x,(a==null?void 0:a.y)??e.y,e.homeX,e.homeY,e.homeRoom);return[...n,...i]}return Ni(e.x,e.y,e.homeX,e.homeY,e.room)}function VA(e,n){if($h--,$h<=0){const a=Object.entries(e).filter(([,i])=>i.state==="sitting"&&!i.isStretching);if(a.length>0){const[,i]=a[Math.floor(Math.random()*a.length)];i.isStretching=!0,i.stretchTimer=120}$h=900}for(const[a,i]of Object.entries(e))if(i.stateTimer--,i.isStretching&&i.stretchTimer>0&&(i.stretchTimer--,i.stretchTimer<=0&&(i.isStretching=!1)),i.state==="sitting"){if(i.sittingTime++,er===a){i.sittingTime=0,i.bobY=-3;const u=vn[a];if(u){const d=u.dx+13;i.lookDir=Dv<d?"left":"right"}}else i.bobY=(n+i.bobOff)%60<30?1:0,i.lookDir="right";if(i.stateTimer<=0){i.state="walking",i.x=i.homeX,i.y=i.homeY,i.room=i.homeRoom;const u=Object.keys(Ke.rooms);if(Math.random()<.15&&u.length>1){const d=u.filter(x=>x!==i.room),h=d[Math.floor(Math.random()*d.length)],m=ep(i,h),f=Ke.waypoints[h];if(f&&f.length>0){const x=f[Math.floor(Math.random()*f.length)],g=m[m.length-1]??{x:i.x,y:i.y},w=Ni(g.x,g.y,x.x,x.y,h);i.path=[...m,...w]}else i.path=m;i.walkTimer=0}else{const d=Ke.waypoints[i.room];if(d&&d.length>0){const h=d[Math.floor(Math.random()*d.length)];i.path=Ni(i.x,i.y,h.x,h.y,i.room)}i.walkTimer=0}}}else if(i.state==="walking"||i.state==="returning"){if(i.sittingTime=0,er===a){i.dir="down",i.walkFrame=0;continue}if(i.path.length===0){i.state==="returning"?(i.state="sitting",i.room=i.homeRoom,i.stateTimer=1200+Math.floor(Math.random()*1800)):(i.state="idle",i.dir="down",i.stateTimer=180+Math.floor(Math.random()*360));continue}const u=i.path[0],d=u.x-i.x,h=u.y-i.y,m=Math.sqrt(d*d+h*h);if(m<1.5){i.x=u.x,i.y=u.y,i.path.shift();for(const[f,x]of Object.entries(Ke.rooms))if(i.x>=x.fx&&i.x<=x.fx+x.fw&&i.y>=x.fy&&i.y<=x.fy+x.fh){i.room=f;break}}else i.x+=d/m*.2,i.y+=h/m*.2,Math.abs(d)>Math.abs(h)?i.dir=d>0?"right":"left":i.dir=h>0?"down":"up",i.walkTimer++,i.walkFrame=Math.floor(i.walkTimer/12)%4}else if(i.state==="idle"){if(er===a){i.dir="down";continue}if(i.stateTimer<=0)if(Math.random()<.15){i.state="walking";const o=Ke.waypoints[i.room];if(o&&o.length>0){const u=o[Math.floor(Math.random()*o.length)];i.path=Ni(i.x,i.y,u.x,u.y,i.room)}i.walkTimer=0}else i.state="returning",i.path=GA(i),i.walkTimer=0}}function KA(e,n,a,i){const{canvasW:o,canvasH:u,rooms:d}=Ke;qe.clearRect(0,0,o,u),O(0,0,o,u,"#2A1E14");const h={wood:Lh,dark:hy,carpet:BA,tile:OA};for(const b of Object.values(d))(h[b.floorType]??Lh)(b);const m=Object.keys(d);if(m.length>=4){const b=d.exec,j=d.meet,{doors:k}=Ke;if(b&&j&&k.exec_meet&&k.work_comm){const C=(k.exec_meet.doorX??0)-14,E=(k.work_comm.doorX??0)-28/2,B=b.fy+b.fh,R=j.fy;Lh({fx:C,fy:B,fw:28,fh:R-B}),hy({fx:E,fy:B,fw:28,fh:R-B})}}const f={};if(m.length>=4){const{doors:b}=Ke,j=28,k=b.exec_meet,N=b.work_comm;k!=null&&k.doorX&&(f.meet={x:k.doorX-j/2,w:j}),N!=null&&N.doorX&&(f.comm={x:N.doorX-j/2,w:j})}for(const b of Object.values(d))zA(b,f[b.id]),_A(b);$A(),AA(Ke);const x=[],g=new Set(Object.values(vn).map(b=>b.room));DA(Ke,x,g);for(const[b,j]of Object.entries(vn)){const k=e[b];if(!k)continue;const N=k.state==="sitting",C=n(b),E=a[b]==="working",B=k.isStretching&&k.stretchTimer>0?Math.sin(k.stretchTimer*.15)*1:0;x.push({y:j.dy+14,draw:()=>{const R=N?k.bobY+B:0;if(HA(j.dx,j.dy,C,R,!N,k.lookDir),N&&E){const $=Yu[b]??"#388bfd";O(j.dx+7,j.dy+14-4,12,5,$,.15),it(j.dx+12,j.dy+14+1,"#4CAF50",.8)}}})}for(const[b,j]of Object.entries(e))if(j.state!=="sitting"){const k=n(b);x.push({y:j.y+14,draw:()=>UA(Math.round(j.x),Math.round(j.y),k,j.dir,j.walkFrame)})}i&&x.push({y:i.y+10,draw:()=>XA(i)}),x.sort((b,j)=>b.y-j.y);for(const b of x)b.draw();for(const b of wa){const j=ki===b.id,k=Av(b);if(qe.save(),qe.globalAlpha=j?.9:.5,qe.fillStyle=b.color,qe.fillRect(k.cx-1,k.botY-2,3,3),j){const N=Ev(b);qe.globalAlpha=.3,qe.strokeStyle=b.color,qe.lineWidth=1,qe.strokeRect(N.x-1,N.y-1,N.w+2,N.h+2)}qe.restore()}if(nl){const b=new Set(Object.values(vn).map(j=>j.room));if(sa&&sa!==Rr)if(sa.startsWith("desk:")){const j=sa.slice(5),k=vn[j];k&&cy(qe,k.dx,k.dy,"#FBBF24")}else oy(qe,Ke,sa,"#FBBF24",b);if(Rr)if(Rr.startsWith("desk:")){const j=Rr.slice(5),k=vn[j];k&&cy(qe,k.dx,k.dy,"#3B82F6")}else oy(qe,Ke,Rr,"#3B82F6",b)}if(er){const b=vn[er],j=e[er];if(b&&j){qe.save(),qe.globalAlpha=.25,qe.fillStyle=Yu[er]??"#fff",j.state==="sitting"?qe.fillRect(b.dx-1,b.dy+6,28,30):qe.fillRect(Math.round(j.x)-1,Math.round(j.y)-1,14,24),qe.globalAlpha=.95,qe.fillStyle="#FBBF24",qe.font="bold 8px monospace",qe.textAlign="center";const k=j.state==="sitting"?b.dx+13:Math.round(j.x)+6,N=j.state==="sitting"?b.dy-1:Math.round(j.y)-5;qe.fillText("!",k,N),qe.restore()}}const w=3600;for(const[,b]of Object.entries(e))if(b.state==="sitting"&&b.sittingTime>w&&!b.isStretching){const j=Object.values(vn).find(R=>R.dx+8===b.homeX&&R.dy+34===b.homeY);if(!j)continue;const k=j.dx+13,N=j.dy,C=Math.floor(b.sittingTime/40)%3;qe.save(),qe.font="5px monospace",qe.textAlign="center";const E=[.7,.5,.3],B=[{x:3,y:-2-C},{x:6,y:-5-(C+1)%3},{x:4,y:-8-(C+2)%3}];for(let R=0;R<3;R++)qe.globalAlpha=E[R],qe.fillStyle="#93C5FD",qe.font=`${4+R}px monospace`,qe.fillText("z",k+B[R].x,N+B[R].y);qe.restore()}$o=$o.filter(b=>b.life>0);for(const b of $o)b.x+=b.vx,b.y+=b.vy,b.life--,qe.save(),qe.globalAlpha=Math.min(1,b.life/(b.maxLife*.3)),qe.fillStyle=b.color??"#FF6B8A",qe.font="8px serif",qe.fillText(b.char,Math.round(b.x),Math.round(b.y)),qe.restore();if(Ci&&i&&Cs<=90){const b=Math.round(i.x),j=Math.round(i.y);qe.save(),qe.globalAlpha=.9,qe.fillStyle="#FBBF24",qe.font="bold 5px monospace",qe.textAlign="center",qe.fillText("!",b+4,j-2),qe.restore()}if(i&&!Ci&&i.state==="idle"&&i.idleTime>600){const b=Math.round(i.x),j=Math.round(i.y),k=Math.floor(i.idleTime/40)%3;qe.save();const N=[{x:3,y:-2-k},{x:5,y:-5-(k+1)%3},{x:4,y:-8-(k+2)%3}];for(let C=0;C<3;C++)qe.globalAlpha=[.7,.5,.3][C],qe.fillStyle="#93C5FD",qe.font=`${3+C}px monospace`,qe.textAlign="center",qe.fillText("z",b+N[C].x,j+N[C].y);qe.restore()}if(Ci&&i&&Cs<=90){const b=Math.round(i.x),j=Math.round(i.y),k=Math.floor(Date.now()/150)%2===0?-1:1;i.dir==="down"&&(qe.fillStyle="#FAFAF7",qe.fillRect(b+4+k,j-1,2,2))}}function QA(e,n){for(let a=0;a<4;a++)$o.push({x:e+(Math.random()-.5)*8,y:n,vx:(Math.random()-.5)*.3,vy:-.3-Math.random()*.2,life:60+Math.floor(Math.random()*30),maxLife:80,char:a%2===0?"♥":"♡",color:"#FF6B8A"})}function PA(e,n){for(let a=0;a<3;a++)$o.push({x:e+(Math.random()-.5)*8,y:n,vx:(Math.random()-.5)*.3,vy:-.3-Math.random()*.2,life:60+Math.floor(Math.random()*30),maxLife:80,char:"💧",color:"#64B5F6"})}function ZA({roles:e,projects:n,roleStatuses:a,activeExecs:i,onRoleClick:o,onProjectClick:u,onBulletinClick:d,onDecisionsClick:h,onKnowledgeClick:m,onSettingsClick:f,onThemeClick:x,onStatsClick:g,getRoleSpeech:w,getAppearance:b,onHireClick:j,onMascotClick:k,roleLevels:N,coinBalance:C=0,onCoinsSpent:E,onFurniturePlaced:B,purchasedPreset:R,language:$="en"}){const _=v.useRef(null),L=v.useRef(null),U=v.useRef(null),Q=v.useRef({}),D=v.useRef(null),I=v.useRef(0),H=v.useRef(FA),[q,ue]=v.useState(!1),[te,Y]=v.useState(null),[se,J]=v.useState(null),Z=v.useRef({}),A=v.useRef({}),F=v.useRef([]),W=v.useRef([]);v.useEffect(()=>{nl=q},[q]),v.useEffect(()=>{Ol=te,va=se},[te,se]);const[T,de]=v.useState(!1);v.useEffect(()=>{ge.getPreferences().then(me=>{const Se=me.furnitureOverrides;Se&&Object.keys(Se).length>0&&(Z.current=Se);const Ee=me.deskOverrides;Ee&&Object.keys(Ee).length>0&&(A.current=Ee);const G=me.removedFurniture;G&&G.length>0&&(F.current=G);const ce=me.addedFurniture;ce&&ce.length>0&&(W.current=ce),de(!0)}).catch(()=>{de(!0)})},[]);const xe=v.useRef({roleStatuses:a,activeExecs:i,getRoleSpeech:w,getAppearance:b});xe.current={roleStatuses:a,activeExecs:i,getRoleSpeech:w,getAppearance:b};const ye=v.useRef({}),Le=v.useMemo(()=>e.map(me=>me.id),[e]),Xe=v.useRef(Ke);v.useEffect(()=>{if(!T)return;const me=Le.length,Se=kv(me,Xe.current.preset,R),Ee=Xe.current.preset!==Se;let G=jv(me,Se);F.current.length>0&&(G=sy(G,F.current)),W.current.length>0&&(G=sA(G,W.current)),Object.keys(Z.current).length>0&&(G=lA(G,Z.current)),Ke=G,Xe.current=G,vn=RA(Le),Object.keys(A.current).length>0&&iA(vn,A.current),wa=wi(G),Q.current=WA(Le),D.current=qA();const ce=_.current;ce&&(ce.width=G.canvasW,ce.height=G.canvasH,Ee&&(ce.style.opacity="0",ce.style.transition="opacity 0.3s",setTimeout(()=>{ce.style.opacity="1"},50))),ht()},[Le,R,T]);const Ye=v.useCallback(me=>{var Se,Ee;return((Ee=(Se=xe.current).getAppearance)==null?void 0:Ee.call(Se,me))??Km(me)},[]),ht=v.useCallback(()=>{const me=L.current,Se=_.current;if(!me||!Se)return;const Ee=me.parentElement;if(!Ee)return;const G=Ee.clientWidth,ce=Ee.clientHeight;if(G===0||ce===0)return;const{canvasW:ne,canvasH:ke}=Ke;let ve=Math.min(G/ne,ce/ke);ve=Math.round(ve*2)/2,ve=Math.max(2,Math.min(ve,5)),H.current=ve,Se.style.width=ne*ve+"px",Se.style.height=ke*ve+"px",me.style.width=ne*ve+"px",me.style.height=ke*ve+"px"},[]);v.useEffect(()=>{var ke;const me=_.current;if(!me)return;const Se=me.getContext("2d");if(!Se)return;qe=Se,oA(Se),ht();const Ee=new ResizeObserver(()=>ht()),G=(ke=L.current)==null?void 0:ke.parentElement;G&&Ee.observe(G);let ce;const ne=()=>{I.current++,VA(Q.current,I.current),D.current&&YA(D.current),KA(Q.current,Ye,xe.current.roleStatuses,D.current),tt(),ce=requestAnimationFrame(ne)};return ce=requestAnimationFrame(ne),()=>{cancelAnimationFrame(ce),Ee.disconnect()}},[Ye,ht]),v.useEffect(()=>{var ne;const me=U.current;if(!me)return;me.innerHTML="";const Se={};for(const ke of e)Se[ke.id]=ke.name;for(const ke of Le){const ve=Yu[ke]??"#8b949e",ze=Se[ke],_e=ze&&ze.toLowerCase()!==ke.toLowerCase()?`${ke.toUpperCase()} · ${ze}`:ke.toUpperCase(),Be=document.createElement("div");Be.className="td-nametag",Be.dataset.role=ke;const He=document.createElement("span");He.className="td-dot",He.style.background=ve,Be.appendChild(He),Be.appendChild(document.createTextNode(_e));const rt=((ne=N==null?void 0:N[ke])==null?void 0:ne.level)??1;if(rt>1){const bt=document.createElement("span");bt.className="td-lvl",bt.textContent=`Lv.${rt}`,Be.appendChild(bt)}me.appendChild(Be);const Ve=document.createElement("div");Ve.className="td-bubble",Ve.dataset.role=ke,Ve.dataset.type="bubble",me.appendChild(Ve)}const Ee={meeting:()=>{const ke=n[0];ke?u(ke.id):d()},bulletin:d,decisions:h,knowledge:m,settings:f,theme:x,stats:g};for(const ke of wa){const ve=document.createElement("div");ve.className="td-facility-label",ve.dataset.facility=ke.id,ke.id==="meeting"&&(ve.dataset.questTarget="meeting-room"),ke.id==="knowledge"&&(ve.dataset.questTarget="knowledge-hub"),ke.id==="bulletin"&&(ve.dataset.questTarget="bulletin-board"),ke.id==="stats"&&(ve.dataset.questTarget="stats-btn"),ke.id==="settings"&&(ve.dataset.questTarget="settings-btn"),ke.id==="theme"&&(ve.dataset.questTarget="theme-btn"),ve.textContent=`${ke.icon} ${ke.label}`,ve.style.borderColor=`${ke.color}44`;const ze=Ee[ke.id];ze&&ve.addEventListener("click",ze),ve.addEventListener("mouseenter",()=>{ki=ke.id}),ve.addEventListener("mouseleave",()=>{ki=null}),me.appendChild(ve)}const G=document.createElement("div");G.className="td-nametag td-nametag-mascot",G.dataset.role="mascot";const ce=document.createElement("span");ce.className="td-dot",ce.style.background="#ffd700",G.appendChild(ce),G.appendChild(document.createTextNode("Pupu")),G.addEventListener("click",()=>k==null?void 0:k()),me.appendChild(G)},[Le,e,n,u,d,h,m,f,x,g,k,N]);const tt=v.useCallback(()=>{var ze;const me=U.current;if(!me)return;const Se=H.current,Ee=Q.current,{getRoleSpeech:G,roleStatuses:ce,activeExecs:ne}=xe.current;for(const _e of Object.keys(Ee)){const Be=Ee[_e],He=vn[_e];if(!He)continue;let rt,Ve,bt;Be.state==="sitting"?(rt=He.dx+13,bt=He.dy+2,Ve=He.dy+37):(rt=Math.round(Be.x)+6,bt=Math.round(Be.y)-2,Ve=Math.round(Be.y)+18);const Re=rt/Ke.canvasW*100,Ie=me.querySelector(`.td-nametag[data-role="${_e}"]`);if(Ie){Ie.style.left=Re+"%",Ie.style.top=Ve*Se+2+"px";const Bt=Ie.querySelector(".td-dot");if(Bt){const Ot=ce[_e]==="working";Bt.style.background=Ot?"#FBBF24":Yu[_e]??"#8b949e",Ot?Bt.style.animation="td-pulse 1s ease-in-out infinite":Bt.style.animation=""}}const _t=me.querySelector(`.td-bubble[data-role="${_e}"]`);if(_t){const Bt=Date.now(),Ot=ce[_e]==="working",fn=(ze=ne.find(Qt=>Qt.roleId===_e))==null?void 0:ze.task,wn=G(_e);let P="";const Oe=ye.current[_e];if(Oe){if(Oe.speechDismissTime&&Bt>=Oe.speechDismissTime&&(Oe.currentSpeech=null,Oe.speechDismissTime=null),Oe.hoverStartTime&&!Oe.currentSpeech){const Qt=Bt-Oe.hoverStartTime,we=!Oe.lastSpeechTime||Bt-Oe.lastSpeechTime>=5e3;if(Qt>=2e3&&we){const kt=MA(_e,$),ln=kt[Math.floor(Math.random()*kt.length)];Oe.currentSpeech=ln,Oe.lastSpeechTime=Bt,Oe.speechDismissTime=Bt+3e3}}P=Oe.currentSpeech||""}const nt=Ot&&fn?fn.slice(0,60):P?P.slice(0,60):wn?wn.slice(0,60):"";nt&&Be.state==="sitting"?(_t.style.display="",_t.style.left=Re+"%",_t.style.top=(bt-10)*Se+"px",_t.textContent=nt):_t.style.display="none"}}const ke=me.querySelector(".td-nametag-mascot"),ve=D.current;if(ke&&ve){const _e=ve.dir==="left"||ve.dir==="right",Be=Math.round(ve.x)+(_e?6:4),He=Math.round(ve.y)+(_e?7:10);ke.style.left=Be/Ke.canvasW*100+"%",ke.style.top=He*Se+2+"px"}for(const _e of wa){const Be=me.querySelector(`.td-facility-label[data-facility="${_e.id}"]`);if(Be){const He=Av(_e);Be.style.left=He.cx/Ke.canvasW*100+"%",Be.style.top=He.botY*Se-4+"px",Be.classList.toggle("td-facility-label--hover",ki===_e.id)}}},[]),Je=v.useCallback(me=>{const Se=_.current;if(!Se)return null;const Ee=Se.getBoundingClientRect(),G=H.current,ce=(me.clientX-Ee.left)/G,ne=(me.clientY-Ee.top)/G,ke=Q.current;for(const[ze,_e]of Object.entries(vn)){if(!ke[ze])continue;const Be=ke[ze];if(Be.state==="sitting"){if(ce>=_e.dx&&ce<=_e.dx+26&&ne>=_e.dy&&ne<=_e.dy+40)return{type:"role",id:ze}}else if(ce>=Be.x-2&&ce<=Be.x+14&&ne>=Be.y-2&&ne<=Be.y+20)return{type:"role",id:ze}}const ve=D.current;if(ve){const ze=ve.dir==="left"||ve.dir==="right",_e=ze?13:9,Be=ze?7:10;if(ce>=ve.x&&ce<=ve.x+_e&&ne>=ve.y&&ne<=ve.y+Be)return{type:"mascot",id:"mascot"}}for(const ze of wa){const _e=Ev(ze);if(ce>=_e.x&&ce<=_e.x+_e.w&&ne>=_e.y&&ne<=_e.y+_e.h)return{type:"facility",id:ze.id}}return null},[]),Ne=v.useCallback(me=>{const Se=_.current;if(!Se)return{mx:0,my:0};const Ee=Se.getBoundingClientRect(),G=H.current;return{mx:(me.clientX-Ee.left)/G,my:(me.clientY-Ee.top)/G}},[]),De=v.useCallback(me=>{ge.updatePreferences(me).catch(()=>{})},[]),yt=v.useCallback(me=>{const Se=W.current.some(G=>G.id===me),Ee={};if(Se){const G=W.current.filter(ce=>ce.id!==me);W.current=G,Ee.addedFurniture=G}else{const G=[...F.current,me];F.current=G,Ee.removedFurniture=G}Ke=sy(Ke,[me]),wa=wi(Ke),Rr=null,sa=null,De(Ee)},[De]),ct=v.useCallback((me,Se)=>{if(!Ol||!va)return;const Ee=dy.find(Be=>Be.type===Ol),G=(Ee==null?void 0:Ee.price)??0;if(G>0&&C<G)return;let ce=null;for(const[Be,He]of Object.entries(Ke.rooms)){const rt=va==="wall"?He.wx:He.fx,Ve=va==="wall"?He.wy:He.fy,bt=va==="wall"?He.ww:He.fw,Re=va==="wall"?He.wh:He.fh;if(me>=rt&&me<=rt+bt&&Se>=Ve&&Se<=Ve+Re){ce=Be;break}}if(!ce)return;const ne=Ke.rooms[ce],ke=va==="wall"?ne.wx:ne.fx,ve=va==="wall"?ne.wy:ne.fy,ze={id:`user-${Ol}-${Date.now()}`,type:Ol,room:ce,zone:va,offsetX:Math.round(me-ke),offsetY:Math.round(Se-ve)},_e=[...W.current,ze];if(W.current=_e,va==="wall"?Ke.wallDecorations.push(ze):Ke.furniture.push(ze),wa=wi(Ke),De({addedFurniture:_e}),B==null||B(Ol,G),G>0){const Be=ze.type;Ny(async()=>{const{api:He}=await Promise.resolve().then(()=>Sw);return{api:He}},void 0).then(({api:He})=>{He.spendCoins(G,`furniture: ${Be}`,ze.id).then(rt=>E==null?void 0:E(rt.balance)).catch(()=>{})})}Y(null),J(null)},[De,C,E,B]),pt=v.useCallback(me=>{const Se=_.current;if(nl&&rr){const{mx:ke,my:ve}=Ne(me),_e=[...Ke.furniture,...Ke.wallDecorations].find(rt=>rt.id===rr.defId);if(!_e)return;const Be=ke-rr.startMx,He=ve-rr.startMy;_e.offsetX=Math.round(rr.origOffX+Be),_e.offsetY=Math.round(rr.origOffY+He),wa=wi(Ke),Se&&(Se.style.cursor="grabbing");return}if(nl&&Hn){const{mx:ke,my:ve}=Ne(me),ze=vn[Hn.roleId];if(!ze)return;ze.dx=Math.round(Hn.origDx+(ke-Hn.startMx)),ze.dy=Math.round(Hn.origDy+(ve-Hn.startMy));const _e=Q.current[Hn.roleId];_e&&(_e.homeX=ze.dx+8,_e.homeY=ze.dy+34),Se&&(Se.style.cursor="grabbing");return}if(nl){const{mx:ke,my:ve}=Ne(me);if(Ol){Se&&(Se.style.cursor="crosshair");return}const ze=new Set(Object.values(vn).map(Be=>Be.room)),_e=Oh(Ke,ke,ve,ze);if(_e)sa=_e;else{const Be=uy(vn,ke,ve);sa=Be?`desk:${Be}`:null}er=null,ki=null,Se&&(Se.style.cursor=sa?"grab":"default");return}const Ee=Je(me),G=er;er=(Ee==null?void 0:Ee.type)==="role"?Ee.id:null,ki=(Ee==null?void 0:Ee.type)==="facility"?Ee.id:null,Ci=(Ee==null?void 0:Ee.type)==="mascot",sa=null,Se&&(Se.style.cursor=Ee?"pointer":"default");const{mx:ce}=Ne(me);Dv=ce;const ne=Date.now();if(er&&er!==G){ye.current[er]||(ye.current[er]={hoverStartTime:null,lastSpeechTime:null,currentSpeech:null,speechDismissTime:null});const ke=ye.current[er];ke.hoverStartTime=ne}else if(!er&&G){const ke=ye.current[G];ke&&(ke.hoverStartTime=null)}},[Je,Ne]),jt=v.useCallback(me=>{if(!nl)return;const{mx:Se,my:Ee}=Ne(me);if(Ol){ct(Se,Ee),me.preventDefault();return}const G=new Set(Object.values(vn).map(ke=>ke.room)),ce=Oh(Ke,Se,Ee,G);if(ce){const ve=[...Ke.furniture,...Ke.wallDecorations].find(ze=>ze.id===ce);ve&&(Rr=ce,rr={defId:ce,startMx:Se,startMy:Ee,origOffX:ve.offsetX,origOffY:ve.offsetY},me.preventDefault());return}const ne=uy(vn,Se,Ee);if(ne){const ke=vn[ne];Rr=`desk:${ne}`,Hn={roleId:ne,startMx:Se,startMy:Ee,origDx:ke.dx,origDy:ke.dy},me.preventDefault();return}Rr=null},[Ne,ct]),Wt=v.useCallback(me=>{if(rr){const Ee=[...Ke.furniture,...Ke.wallDecorations].find(G=>G.id===rr.defId);if(Ee){const G={...Z.current,[Ee.id]:{offsetX:Ee.offsetX,offsetY:Ee.offsetY}};Z.current=G,De({furnitureOverrides:G}),wa=wi(Ke)}rr=null,_.current&&(_.current.style.cursor="grab");return}if(Hn){const Se=vn[Hn.roleId];if(Se){const Ee={...A.current,[Hn.roleId]:{dx:Se.dx,dy:Se.dy}};A.current=Ee,De({deskOverrides:Ee})}Hn=null,_.current&&(_.current.style.cursor="grab")}},[De]),Ft=v.useCallback(me=>{if(!nl)return;me.preventDefault();const{mx:Se,my:Ee}=Ne(me),G=new Set(Object.values(vn).map(ne=>ne.room)),ce=Oh(Ke,Se,Ee,G);ce&&yt(ce)},[Ne,yt]);v.useEffect(()=>{const me=Se=>{!nl||!Rr||(Se.key==="Delete"||Se.key==="Backspace")&&(Rr.startsWith("desk:")||yt(Rr))};return window.addEventListener("keydown",me),()=>window.removeEventListener("keydown",me)},[yt]);const Nt=v.useCallback(()=>{if(rr){const Se=[...Ke.furniture,...Ke.wallDecorations].find(Ee=>Ee.id===rr.defId);Se&&(Se.offsetX=rr.origOffX,Se.offsetY=rr.origOffY,wa=wi(Ke)),rr=null}if(Hn){const me=vn[Hn.roleId];me&&(me.dx=Hn.origDx,me.dy=Hn.origDy);const Se=Q.current[Hn.roleId];Se&&(Se.homeX=me.dx+8,Se.homeY=me.dy+34),Hn=null}er=null,ki=null,Ci=!1,sa=null,_.current&&(_.current.style.cursor="default")},[]),$n=v.useCallback(me=>{if(nl)return;const Se=Je(me);if(Se){if(Se.type==="role"){const Ee=Q.current[Se.id],G=vn[Se.id];if(Ee&&G){const ce=Ee.state==="sitting"?G.dx+13:Math.round(Ee.x)+6,ne=Ee.state==="sitting"?G.dy+2:Math.round(Ee.y)-2;PA(ce,ne)}o(Se.id);return}if(Se.type==="mascot"){const Ee=D.current;Ee&&QA(Math.round(Ee.x)+4,Math.round(Ee.y)-2),k==null||k();return}switch(Se.id){case"meeting":{const Ee=n[0];Ee?u(Ee.id):d();break}case"bulletin":d();break;case"decisions":h();break;case"knowledge":m();break;case"settings":f==null||f();break;case"theme":x==null||x();break;case"stats":g==null||g();break}}},[Je,o,u,d,h,m,f,x,g]);return l.jsxs("div",{className:`td-scene${q?" td-scene--editing":""}`,children:[l.jsxs("div",{ref:L,className:"td-wrap",children:[l.jsx("canvas",{ref:_,width:Ke.canvasW,height:Ke.canvasH,className:"td-canvas",onClick:$n,onMouseDown:jt,onMouseUp:Wt,onMouseMove:pt,onMouseLeave:Nt,onContextMenu:Ft}),l.jsx("div",{ref:U,className:"td-overlay"})]}),q&&l.jsxs("div",{className:"td-edit-banner",children:[l.jsx("span",{className:"td-edit-banner__icon",children:"✎"})," EDIT MODE — Click DONE when finished"]}),l.jsxs("button",{className:`td-edit-btn${q?" td-edit-btn--active":""}`,"data-quest-target":"edit-btn",onClick:()=>{ue(me=>{const Se=!me;return Se||(Y(null),J(null)),Se}),Rr=null,rr=null,Hn=null},title:q?"Exit Edit Mode":"Edit Furniture Layout",children:[l.jsx("span",{className:"td-edit-btn__icon",children:q?"✓":"✎"}),l.jsx("span",{className:"td-edit-btn__label",children:q?"DONE":"EDIT"})]}),q&&l.jsx("div",{className:"td-palette",children:dy.map(me=>{const Se=me.price===0||C>=me.price,Ee=me.price===0?"Free":`${me.price>=1e3?`${(me.price/1e3).toFixed(me.price%1e3===0?0:1)}K`:me.price}`;return l.jsxs("button",{className:`td-palette__item${te===me.type?" td-palette__item--active":""}${Se?"":" td-palette__item--locked"}`,onClick:()=>{Se&&(te===me.type?(Y(null),J(null)):(Y(me.type),J(me.zone)))},title:`${me.label} — ${Ee}`,style:Se?void 0:{opacity:.4,cursor:"not-allowed"},children:[l.jsx("span",{children:me.icon}),l.jsx("span",{className:"td-palette__price",style:{fontSize:"7px",color:me.price===0?"#4CAF50":Se?"#FFD54F":"#EF5350"},children:Ee})]},me.type)})}),j&&l.jsxs("button",{className:"td-hire-btn","data-quest-target":"hire-btn",onClick:j,title:"Hire New Role",children:[l.jsx("span",{className:"td-hire-btn__icon",children:"+"}),l.jsx("span",{className:"td-hire-btn__label",children:"HIRE"})]})]})}function JA({role:e,appearance:n,onSave:a,onReset:i,onClose:o,theme:u,onThemeChange:d,onUpdateName:h,initialTab:m,characterOnly:f,speechSettings:x,onSpeechSettingsChange:g,language:w,onLanguageChange:b,roleLevel:j}){var I;const[k,N]=v.useState(m??"character"),[C,E]=v.useState({...n}),[B,R]=v.useState(e.name),[$,_]=v.useState(!1),L=v.useCallback(()=>E(ys(j)),[j]),U=v.useCallback(()=>{const H=Km(e.id);E({...H}),i()},[e.id,i]),Q=v.useCallback(async()=>{a(C);const H=B.trim();if(h&&H&&H!==e.name){_(!0);try{await h(e.id,H)}catch{}_(!1)}o()},[C,a,o,B,e.name,e.id,h]),D=l.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[l.jsxs("span",{children:[e.id.toUpperCase()," –"]}),h?l.jsx("input",{value:B,onChange:H=>R(H.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}}):l.jsx("span",{children:e.name})]});return l.jsx("div",{className:"customize-overlay",onClick:o,children:l.jsxs("div",{className:"customize-modal",onClick:H=>H.stopPropagation(),children:[l.jsxs("div",{className:"customize-header",children:[l.jsxs("div",{className:"customize-tabs",children:[l.jsx("button",{className:`customize-tab ${k==="character"?"active":""}`,onClick:()=>N("character"),children:"CHARACTER"}),!f&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:`customize-tab ${k==="office"?"active":""}`,onClick:()=>N("office"),children:"OFFICE THEME"}),l.jsx("button",{className:`customize-tab ${k==="settings"?"active":""}`,onClick:()=>N("settings"),children:"SETTINGS"})]})]}),l.jsx("button",{className:"customize-close",onClick:o,children:"X"})]}),k==="character"?l.jsx("div",{className:"customize-body",children:l.jsx(fv,{roleId:e.id,appearance:C,onChange:E,onRandomize:L,onReset:U,label:D,roleLevel:j})}):k==="office"?l.jsx("div",{className:"customize-body",children:l.jsx("div",{className:"customize-themes",children:Object.entries(ll).map(([H,q])=>l.jsxs("button",{className:`customize-theme-card ${u===H?"active":""}`,onClick:()=>d(H),children:[l.jsxs("div",{className:"customize-theme-preview",style:{background:q.vars["--floor-light"],borderColor:q.vars["--pixel-border"]},children:[l.jsx("div",{style:{background:q.vars["--hud-bg"],height:8,borderBottom:`2px solid ${q.vars["--pixel-border"]}`}}),l.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1 p-1",children:[l.jsx("div",{style:{width:10,height:14,background:q.vars["--accent"],borderRadius:1}}),l.jsx("div",{style:{width:10,height:14,background:q.vars["--active-green"],borderRadius:1}}),l.jsx("div",{style:{width:10,height:14,background:q.vars["--idle-amber"],borderRadius:1}})]}),l.jsx("div",{style:{background:q.vars["--hud-bg"],height:6,borderTop:`2px solid ${q.vars["--pixel-border"]}`}})]}),l.jsxs("div",{className:"customize-theme-name",children:[q.icon," ",q.name]})]},H))})}):l.jsx("div",{className:"customize-body",children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,padding:"8px 0"},children:[l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),l.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(H=>l.jsxs("button",{onClick:()=>g==null?void 0:g({mode:H}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(x==null?void 0:x.mode)===H?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(x==null?void 0:x.mode)===H?"rgba(255,255,255,0.08)":"transparent",color:(x==null?void 0:x.mode)===H?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[l.jsx("div",{style:{fontWeight:600,marginBottom:2},children:H==="template"?"TEMPLATE":H==="llm"?"AI":"AUTO"}),l.jsx("div",{style:{fontSize:9,opacity:.7},children:H==="template"?"Static pool ($0)":H==="llm"?"LLM generated":"Detect engine"})]},H))}),l.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),l.jsxs("div",{children:[l.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(x==null?void 0:x.intervalSec)??18,"s"]}),l.jsx("input",{type:"range",min:5,max:120,step:5,value:(x==null?void 0:x.intervalSec)??18,onChange:H=>g==null?void 0:g({intervalSec:Number(H.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[l.jsx("span",{children:"5s (frequent)"}),l.jsx("span",{children:"120s (rare)"})]})]}),(x==null?void 0:x.mode)!=="template"&&l.jsxs("div",{children:[l.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((I=x==null?void 0:x.dailyBudgetUsd)==null?void 0:I.toFixed(2))??"1.00"]}),l.jsx("input",{type:"range",min:0,max:5,step:.25,value:(x==null?void 0:x.dailyBudgetUsd)??1,onChange:H=>g==null?void 0:g({dailyBudgetUsd:Number(H.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[l.jsx("span",{children:"$0 (unlimited)"}),l.jsx("span",{children:"$5.00/day"})]})]}),l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),l.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:H,label:q})=>l.jsx("button",{onClick:()=>b==null?void 0:b(H),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(w??"auto")===H?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(w??"auto")===H?"rgba(255,255,255,0.08)":"transparent",color:(w??"auto")===H?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:q},H))}),l.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]})]})}),k==="character"&&l.jsxs("div",{className:"customize-footer",children:[l.jsx("button",{className:"customize-btn customize-btn--cancel",onClick:o,children:"CANCEL"}),l.jsx("button",{className:"customize-btn customize-btn--save",onClick:Q,children:"SAVE"})]})]})})}function py(e){if(e.length===0)return"";const n={};for(const{file:h}of e){const m=h.split("/"),f=m[0]==="."?m[1]??"root":m[0];(n[f]??(n[f]=[])).push(h)}const a={roles:"roles",projects:"projects",operations:"operations",knowledge:"knowledge",architecture:"architecture",company:"company",".tycono":"config",".claude":"skills"},i=[];for(const[h,m]of Object.entries(n)){const f=a[h]??h;if(m.length===1){const x=m[0].split("/").pop()??m[0];i.push(`${f}/${x}`)}else i.push(`${f} (${m.length} files)`)}const o=e.some(h=>h.status==="A"),u=e.some(h=>h.status==="M");return`${o&&!u?"add":"update"}: ${i.join(", ")}`}function xy(e){const n=Date.now()-new Date(e).getTime(),a=Math.floor(n/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 e8({onInitGit:e,onDelegate:n,delegateRoleName:a}){const[i,o]=v.useState(!1),[u,d]=v.useState(null),h=async()=>{o(!0),d(null);try{await e(),d({ok:!0,message:"Git repository initialized!"})}catch(f){const x=f instanceof Error?f.message:"Failed";x.includes("not installed")||x.includes("noGitBinary")?d({ok:!1,message:"git is not installed on this system"}):d({ok:!1,message:x})}finally{o(!1)}},m=u&&!u.ok&&u.message.includes("not installed");return l.jsxs("div",{className:"p-3 space-y-2",style:{background:"rgba(211,47,47,0.05)",border:"1px solid var(--pixel-border)"},children:[l.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"No Git Repository"}),!u&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:"This project has no git repository. Initialize one to start saving."}),l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsx("button",{onClick:h,disabled:i,className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer disabled:opacity-50",style:{background:"var(--accent)",color:"#fff",border:"none"},children:i?"INITIALIZING...":"GIT INIT"}),n&&l.jsxs("button",{onClick:n,className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer",style:{background:"var(--terminal-bg)",color:"var(--idle-amber)",border:"1px solid var(--idle-amber)"},children:["🤖"," ",(a==null?void 0:a.toUpperCase())??"AI"," FIX"]})]})]}),u&&u.ok&&l.jsx("div",{className:"text-[10px] p-1.5",style:{background:"rgba(59,185,80,0.1)",border:"1px solid var(--active-green)",color:"var(--active-green)"},children:u.message}),m&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("div",{className:"text-[10px]",style:{color:"#EF5350"},children:"git is not installed on this system."}),l.jsxs("div",{className:"text-[10px] space-y-1",style:{color:"var(--terminal-text-muted)"},children:[l.jsxs("div",{children:[l.jsx("b",{children:"macOS:"})," xcode-select --install"]}),l.jsxs("div",{children:[l.jsx("b",{children:"Ubuntu/Debian:"})," sudo apt install git"]}),l.jsxs("div",{children:[l.jsx("b",{children:"Windows:"})," ",l.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent)",textDecoration:"underline"},children:"git-scm.com/downloads"})]})]}),l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsx("button",{onClick:()=>{d(null)},className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--accent)",color:"#fff",border:"none"},children:"RETRY"}),n&&l.jsxs("button",{onClick:n,className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--terminal-bg)",color:"var(--idle-amber)",border:"1px solid var(--idle-amber)"},children:["🤖"," ",(a==null?void 0:a.toUpperCase())??"AI"," FIX"]})]})]}),u&&!u.ok&&!m&&l.jsx("div",{className:"text-[10px] p-1.5",style:{background:"rgba(211,47,47,0.1)",border:"1px solid #D32F2F",color:"#EF5350"},children:u.message})]})}function t8({repo:e,onConnected:n,onDelegate:a,delegateRoleName:i}){const[o,u]=v.useState("idle"),[d,h]=v.useState(null),[m,f]=v.useState(""),[x,g]=v.useState("private"),[w,b]=v.useState(""),[j,k]=v.useState(null),[N,C]=v.useState(!1),E=async()=>{u("checking"),k(null);try{const _=await ge.getGithubStatus(e);h(_),_.hasRemote?n():_.ghInstalled&&_.authenticated?u("ready"):u("idle")}catch{u("idle")}},B=async()=>{if(m.trim()){C(!0),k(null);try{const _=await ge.githubCreateRepo(m.trim(),x,e);k(_),_.ok&&setTimeout(n,1500)}catch(_){k({ok:!1,message:_ instanceof Error?_.message:"Failed"})}finally{C(!1)}}},R=async()=>{if(w.trim()){C(!0),k(null);try{const _=await ge.addRemote(w.trim(),e);k(_),_.ok&&setTimeout(n,1500)}catch(_){k({ok:!1,message:_ instanceof Error?_.message:"Failed"})}finally{C(!1)}}},$=a?l.jsxs("button",{onClick:a,className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer",style:{background:"var(--terminal-bg)",color:"var(--idle-amber)",border:"1px solid var(--idle-amber)"},title:`Ask ${i??"AI"} to set up GitHub remote`,children:["🤖"," ",(i==null?void 0:i.toUpperCase())??"AI"," FIX"]}):null;return l.jsxs("div",{className:"p-3 space-y-2",style:{background:"rgba(100,100,255,0.05)",border:"1px solid var(--pixel-border)"},children:[l.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"No Remote — Local Only"}),o==="idle"&&!d&&l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsx("button",{onClick:E,className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer",style:{background:"var(--accent)",color:"#fff",border:"none"},children:"CONNECT GITHUB"}),l.jsx("button",{onClick:()=>u("manual"),className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:"ADD REMOTE URL"}),$]}),o==="checking"&&l.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:"Checking GitHub CLI..."}),o==="idle"&&d&&!d.ghInstalled&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("div",{className:"text-[10px]",style:{color:"var(--idle-amber)"},children:"GitHub CLI (gh) not installed."}),l.jsxs("div",{className:"text-[10px] space-y-0.5",style:{color:"var(--terminal-text-muted)"},children:[l.jsxs("div",{children:["Install:"," ",l.jsx("a",{href:"https://cli.github.com",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent)",textDecoration:"underline"},children:"cli.github.com"})]}),l.jsx("div",{style:{fontFamily:"var(--pixel-font)"},children:"brew install gh && gh auth login"})]}),l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsx("button",{onClick:E,className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--accent)",color:"#fff",border:"none"},children:"RETRY"}),l.jsx("button",{onClick:()=>u("manual"),className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:"ADD URL MANUALLY"}),$]})]}),o==="idle"&&d&&d.ghInstalled&&!d.authenticated&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("div",{className:"text-[10px]",style:{color:"var(--idle-amber)"},children:"GitHub CLI installed but not logged in."}),l.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)",fontFamily:"var(--pixel-font)"},children:"Run in terminal: gh auth login"}),l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsx("button",{onClick:E,className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--accent)",color:"#fff",border:"none"},children:"RETRY"}),l.jsx("button",{onClick:()=>u("manual"),className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:"ADD REMOTE URL"}),$]})]}),o==="ready"&&d&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"text-[10px]",style:{color:"var(--active-green)"},children:["Logged in as ",d.username||"GitHub user"]}),l.jsxs("div",{className:"flex gap-2 items-center",children:[l.jsx("input",{type:"text",value:m,onChange:_=>f(_.target.value),placeholder:"repository-name",className:"flex-1 px-2 py-1.5 text-[11px] outline-none",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"}}),l.jsxs("select",{value:x,onChange:_=>g(_.target.value),className:"px-2 py-1.5 text-[10px] outline-none cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"},children:[l.jsx("option",{value:"private",children:"Private"}),l.jsx("option",{value:"public",children:"Public"})]})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:B,disabled:N||!m.trim(),className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer disabled:opacity-50",style:{background:"var(--accent)",color:"#fff",border:"none"},children:N?"CREATING...":"CREATE & PUSH"}),l.jsx("button",{onClick:()=>u("manual"),className:"text-[10px] px-2 py-1 cursor-pointer",style:{background:"transparent",color:"var(--terminal-text-muted)",border:"1px solid var(--terminal-border)"},children:"USE URL INSTEAD"})]})]}),o==="manual"&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:[l.jsx("a",{href:"https://github.com/new",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent)",textDecoration:"underline"},children:"Create a new repo on GitHub"})," ","then paste the URL below:"]}),l.jsx("input",{type:"text",value:w,onChange:_=>b(_.target.value),placeholder:"https://github.com/username/repo-name.git",className:"w-full px-2 py-1.5 text-[11px] outline-none",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"}}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:R,disabled:N||!w.trim(),className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer disabled:opacity-50",style:{background:"var(--accent)",color:"#fff",border:"none"},children:N?"ADDING...":"ADD REMOTE & PUSH"}),l.jsx("button",{onClick:()=>{u("idle"),h(null)},className:"text-[10px] px-2 py-1 cursor-pointer",style:{background:"transparent",color:"var(--terminal-text-muted)",border:"1px solid var(--terminal-border)"},children:"BACK"})]})]}),j&&l.jsx("div",{className:"text-[10px] p-1.5",style:{background:j.ok?"rgba(59,185,80,0.1)":"rgba(211,47,47,0.1)",border:`1px solid ${j.ok?"var(--active-green)":"#D32F2F"}`,color:j.ok?"var(--active-green)":"#EF5350"},children:j.message})]})}function n8({status:e,history:n,onClose:a,onSave:i,onLoadHistory:o,onRestore:u,saving:d,onDelegate:h,delegateRoleName:m,repo:f,onRepoChange:x,syncInfo:g,onPull:w,pulling:b,onRefresh:j,onInitGit:k}){const[N,C]=v.useState("save"),[E,B]=v.useState(""),[R,$]=v.useState(null),[_,L]=v.useState(!1),[U,Q]=v.useState(null),[D,I]=v.useState(null),H=v.useRef(null);v.useEffect(()=>{N==="history"&&o()},[N,o]),v.useEffect(()=>{var A;(A=H.current)==null||A.focus()},[]);const q=[...((e==null?void 0:e.modified)??[]).map(A=>({status:"M",file:A})),...((e==null?void 0:e.untracked)??[]).map(A=>({status:"A",file:A}))],ue=v.useRef(!1);v.useEffect(()=>{!ue.current&&q.length>0&&!E&&(B(py(q)),ue.current=!0)},[q.length]),v.useEffect(()=>{ue.current=!1,B(""),I(null),Q(null),$(null)},[f]);const te=v.useCallback(()=>{B(py(q))},[q]),Y=async()=>{$(null),Q(null);try{const A=await i(E||void 0);Q(A),B("")}catch(A){$(A instanceof Error?A.message:"Save failed")}},se=async()=>{I(null),$(null);try{const A=await w();I(A)}catch(A){$(A instanceof Error?A.message:"Pull failed")}},J=async A=>{if(confirm(`Restore from commit ${A.slice(0,7)}? This creates a new commit with those files.`)){L(!0);try{await u(A),L(!1)}catch(F){$(F instanceof Error?F.message:"Restore failed"),L(!1)}}};v.useEffect(()=>{const A=F=>{F.key==="Escape"&&a()};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[a]);const Z=A=>{A.key==="Enter"&&(A.metaKey||A.ctrlKey)&&Y()};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:a}),l.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:Z,children:[l.jsxs("div",{className:"px-5 py-3 flex items-center justify-between shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"text-lg font-black tracking-tight",children:"SAVE GAME"}),l.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:(e==null?void 0:e.branch)??""})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[g&&g.hasRemote&&(g.behind>0||g.ahead>0)&&l.jsxs("span",{className:"text-[10px] font-bold",style:{color:g.behind>0?"var(--idle-amber)":"var(--active-green)"},children:[g.behind>0&&`↓${g.behind}`,g.behind>0&&g.ahead>0&&" ",g.ahead>0&&`↑${g.ahead}`]}),l.jsx("button",{onClick:a,className:"text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] cursor-pointer text-lg",children:"×"})]})]}),l.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["akb","code"].map(A=>l.jsx("button",{onClick:()=>x(A),className:"flex-1 py-1.5 text-[10px] font-bold uppercase tracking-wider cursor-pointer",style:{background:f===A?"var(--hud-bg-alt)":"transparent",color:f===A?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:f===A?"2px solid var(--accent)":"2px solid transparent"},children:A==="akb"?"AKB":"CODE"},A))}),l.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["save","history"].map(A=>l.jsx("button",{onClick:()=>C(A),className:"flex-1 py-2 text-[11px] font-bold uppercase tracking-wider cursor-pointer",style:{background:N===A?"var(--hud-bg-alt)":"transparent",color:N===A?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:N===A?"2px solid var(--accent)":"2px solid transparent"},children:A==="save"?"SAVE":"HISTORY"},A))}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[N==="save"&&l.jsxs(l.Fragment,{children:[(e==null?void 0:e.noGit)&&l.jsx(e8,{onInitGit:async()=>{await(k==null?void 0:k()),j==null||j()},onDelegate:h?()=>{h(`Git is not initialized or not installed for this project. Please check if git is installed (run "git --version"). If git is available, initialize the repository with "git init" and make an initial commit. If git is not installed, provide clear instructions for the user's OS to install it.`)}:void 0,delegateRoleName:m}),g&&g.hasRemote&&g.behind>0&&l.jsxs("div",{className:"flex items-center justify-between p-2",style:{background:"rgba(255,180,0,0.08)",border:"1px solid var(--idle-amber)"},children:[l.jsxs("span",{className:"text-[11px]",style:{color:"var(--idle-amber)"},children:[g.behind," commit",g.behind>1?"s":""," behind remote"]}),l.jsx("button",{onClick:se,disabled:b,className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--idle-amber)",color:"#000",border:"none",opacity:b?.5:1},children:b?"PULLING...":"↓ PULL"})]}),D&&l.jsx("div",{className:"text-[11px] p-2",style:{background:D.status==="ok"||D.status==="up-to-date"?"rgba(59,185,80,0.1)":"rgba(211,47,47,0.1)",border:`1px solid ${D.status==="ok"||D.status==="up-to-date"?"var(--active-green)":"#D32F2F"}`,color:D.status==="ok"||D.status==="up-to-date"?"var(--active-green)":"#EF5350"},children:D.message}),l.jsx("div",{className:"text-[11px]",style:{color:"var(--terminal-text-secondary)"},children:q.length>0?l.jsxs("span",{style:{color:"var(--idle-amber)"},children:["* ",q.length," unsaved change",q.length>1?"s":""]}):l.jsx("span",{style:{color:"var(--active-green)"},children:"All changes saved"})}),q.length>0&&l.jsxs("div",{children:[l.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Changed Files"}),l.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:q.map(({status:A,file:F})=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx("span",{style:{color:A==="A"?"var(--active-green)":"var(--idle-amber)",width:"14px"},children:A}),l.jsx("span",{style:{color:"var(--terminal-text-secondary)"},children:F})]},F))})]}),q.length>0&&l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Save Message"}),l.jsxs("button",{onClick:te,className:"text-[9px] px-1.5 py-0.5 cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--accent)",fontFamily:"var(--pixel-font)"},title:"Auto-generate message from changes",children:["✨"," AUTO"]})]}),l.jsx("input",{ref:H,type:"text",value:E,onChange:A=>B(A.target.value),placeholder:"Auto-generated — edit if needed",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)"}})]}),q.length>0&&l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:Y,disabled:d,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:d?"SAVING...":e!=null&&e.hasRemote?"SAVE & PUSH":"SAVE"}),h&&l.jsxs("button",{onClick:()=>{const A=q.map(F=>`${F.status} ${F.file}`).join(`
|
|
91
|
-
`);h(A)},disabled:d,className:"py-2.5 px-4 text-[11px] font-bold uppercase tracking-wider cursor-pointer disabled:opacity-50",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"2px solid var(--pixel-border)"},title:`Delegate to ${m??"AI role"} — they'll review, commit, push & merge`,children:["🤖"," ",(m==null?void 0:m.toUpperCase())??"DELEGATE"]})]}),e&&!e.hasRemote&&!e.noGit&&l.jsx(t8,{repo:f,onConnected:()=>j==null?void 0:j(),onDelegate:h?()=>{h(`Set up a GitHub remote for the ${f==="akb"?"AKB":"Code"} repository and push all commits. If gh CLI is available, use "gh repo create". Otherwise, guide through manual setup. Current repo path can be found in config.`)}:void 0,delegateRoleName:m}),U&&l.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! ",U.filesChanged," file",U.filesChanged>1?"s":""," committed",U.pushed?" & pushed":"",U.pushError?` (push error: ${U.pushError})`:""]}),R&&l.jsx("div",{className:"text-[11px] p-2",style:{background:"rgba(211,47,47,0.1)",border:"1px solid #D32F2F",color:"#EF5350"},children:R}),(e==null?void 0:e.lastCommit)&&l.jsxs("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:["Last save: ",e.lastCommit.message," (",xy(e.lastCommit.date),")"]})]}),N==="history"&&l.jsxs(l.Fragment,{children:[n.length===0&&l.jsx("div",{className:"text-[11px] text-center py-8",style:{color:"var(--terminal-text-muted)"},children:"No save history"}),l.jsx("div",{className:"space-y-1",children:n.map(A=>l.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:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--accent)"},children:A.shortSha}),l.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--terminal-text)"},children:A.message})]}),l.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:xy(A.date)})]}),l.jsx("button",{onClick:()=>J(A.sha),disabled:_,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"})]},A.sha))})]})]})]})]})}function r8({onClose:e}){const[n,a]=v.useState(null),[i,o]=v.useState(!0),[u,d]=v.useState(null),[,h]=v.useState(!1);return v.useEffect(()=>{Promise.all([ge.getCompanyStats(),ge.getPreferences()]).then(async([m,f])=>{a(m);const x=f;if(x.instanceId)try{await wr.syncStats({instanceId:x.instanceId,roleCount:m.company.roleCount,totalTokens:m.company.totalTokens,rolesData:m.roles.map(g=>({roleId:g.roleId,name:g.name,tokens:g.totalTokens}))}),h(!0)}catch{}}).catch(m=>d(m.message)).finally(()=>o(!1))},[]),i?l.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading stats..."}):u||!n?l.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u||"Failed to load stats",l.jsx("button",{onClick:e,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]}):l.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:20},children:[l.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Company Stats"}),l.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]}),l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:20},children:[l.jsx(Su,{label:"Roles",value:String(n.company.roleCount)}),l.jsx(Su,{label:"Avg Level",value:`Lv.${n.company.avgLevel}`}),l.jsx(Su,{label:"Total Tokens",value:n.company.formattedTokens}),l.jsx(Su,{label:"Total Cost",value:`$${n.company.totalCostUsd.toFixed(2)}`})]}),l.jsx("h4",{style:{margin:"0 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Role Leaderboard"}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[n.roles.map((m,f)=>l.jsx(a8,{role:m,rank:f+1},m.roleId)),n.roles.length===0&&l.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"8px 0"},children:"No role activity yet. Assign tasks to start leveling up!"})]}),Object.keys(n.byModel).length>0&&l.jsxs(l.Fragment,{children:[l.jsx("h4",{style:{margin:"20px 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Model Usage"}),l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:Object.entries(n.byModel).map(([m,f])=>l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"6px 10px",background:"rgba(255,255,255,0.03)",borderRadius:6,fontSize:12},children:[l.jsx("span",{style:{color:"rgba(255,255,255,0.7)"},children:l8(m)}),l.jsxs("span",{style:{color:"rgba(255,255,255,0.5)"},children:["$",f.costUsd.toFixed(2)]})]},m))})]})]})}function Su({label:e,value:n}){return l.jsxs("div",{style:{padding:"12px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[l.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.45)",marginBottom:4},children:e}),l.jsx("div",{style:{fontSize:18,fontWeight:600},children:n})]})}function a8({role:e,rank:n}){const a=["🥇","🥈","🥉"],i=n<=3?a[n-1]:`#${n}`;return l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:8},children:[l.jsx("span",{style:{fontSize:14,width:28,textAlign:"center",flexShrink:0},children:i}),l.jsxs("div",{style:{flex:1,minWidth:0},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:4},children:[l.jsx("span",{style:{fontSize:13,fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),l.jsxs("span",{style:{fontSize:12,color:gy(e.level),fontWeight:600,flexShrink:0,marginLeft:8},children:["Lv.",e.level]})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[l.jsx("div",{style:{flex:1,height:4,background:"rgba(255,255,255,0.08)",borderRadius:2,overflow:"hidden"},children:l.jsx("div",{style:{width:`${e.progress*100}%`,height:"100%",background:gy(e.level),borderRadius:2,transition:"width 0.3s ease"}})}),l.jsx("span",{style:{fontSize:10,color:"rgba(255,255,255,0.4)",flexShrink:0},children:e.formattedTokens})]})]})]})}function gy(e){return e>=20?"#FFD700":e>=10?"#C0A0FF":e>=5?"#4FC3F7":e>=3?"#81C784":"rgba(255,255,255,0.4)"}function l8(e){return e.includes("opus")?"Opus":e.includes("sonnet")?"Sonnet":e.includes("haiku")?"Haiku":e.split("-").slice(0,2).join(" ")}function i8({onClose:e,onSyncComplete:n}){const[a,i]=v.useState([]),[o,u]=v.useState([]),[d,h]=v.useState(!0),[m,f]=v.useState(null),[x,g]=v.useState(new Set),[w,b]=v.useState(null),[j,k]=v.useState(null),N=v.useCallback(async()=>{h(!0),b(null);try{const{roles:E}=await ge.getSyncRoles();i(E);const B=E.filter(R=>R.source.sync!=="off");if(B.length===0){u([]),k(null);return}try{const R=await wr.syncCheck(B.map(_=>({roleId:_.roleId,sourceId:_.source.id,currentVersion:_.source.upstream_version??_.source.forked_at??"0.0.0"})));k(!0);const $=[];for(const _ of R.updates){if(!_.hasUpdate)continue;const L=B.find(H=>H.roleId===_.roleId);if(!L)continue;const{character:U}=await wr.syncPull(_.sourceId),Q=[];L.persona.trim()!==U.persona.trim()&&Q.push({field:"persona",local:L.persona.slice(0,120)+(L.persona.length>120?"...":""),upstream:U.persona.slice(0,120)+(U.persona.length>120?"...":"")});const D=JSON.stringify(L.authority),I=JSON.stringify(U.authority);D!==I&&Q.push({field:"authority",local:`${L.authority.autonomous.length} autonomous, ${L.authority.needsApproval.length} approval`,upstream:`${U.authority.autonomous.length} autonomous, ${U.authority.needsApproval.length} approval`}),Q.length>0&&$.push({roleId:_.roleId,roleName:L.name,sourceId:_.sourceId,currentVersion:_.currentVersion,latestVersion:_.latestVersion,fields:Q})}u($)}catch{k(!1),u([])}}catch(E){b(E instanceof Error?E.message:"Failed to check for updates")}finally{h(!1)}},[]);v.useEffect(()=>{N()},[N]);const C=async E=>{f(E.roleId);try{const{character:B,version:R}=await wr.syncPull(E.sourceId);await ge.applySyncUpdate({roleId:E.roleId,changes:{persona:B.persona,authority:B.authority},upstreamVersion:R}),g($=>new Set($).add(E.roleId)),n==null||n()}catch(B){b(B instanceof Error?B.message:"Failed to apply update")}finally{f(null)}};return l.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[l.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Role Sync"}),l.jsxs("div",{style:{display:"flex",gap:8},children:[l.jsx("button",{onClick:N,disabled:d,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:d?"wait":"pointer"},children:d?"Checking...":"Refresh"}),l.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),j===!1&&l.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,180,0,0.1)",borderRadius:6,color:"#FFB74D",fontSize:12,marginBottom:12},children:"Cloud API unreachable. Sync requires connection to api.tycono.ai."}),w&&l.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:w}),l.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[l.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Tracked roles: "}),l.jsx("span",{style:{fontWeight:500},children:a.length}),l.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),l.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Updates available: "}),l.jsx("span",{style:{fontWeight:500,color:o.length>0?"#4FC3F7":"rgba(255,255,255,0.7)"},children:o.filter(E=>!x.has(E.roleId)).length}),j===!0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),l.jsx("span",{style:{fontSize:11,color:"#81C784"},children:"Cloud connected"})]})]}),o.length===0&&!d&&l.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:a.length===0?"No roles with source tracking. Hire from the Store to enable sync.":"All roles are up to date!"}),o.map(E=>l.jsxs("div",{style:{marginBottom:12,padding:14,background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:14,fontWeight:500},children:E.roleName}),l.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.4)"},children:[E.sourceId," · v",E.currentVersion," → v",E.latestVersion]})]}),x.has(E.roleId)?l.jsx("span",{style:{fontSize:12,color:"#81C784"},children:"Applied ✓"}):l.jsx("button",{onClick:()=>C(E),disabled:m===E.roleId,style:{background:"#1565C0",border:"none",color:"white",borderRadius:6,padding:"5px 12px",fontSize:12,cursor:m===E.roleId?"wait":"pointer",opacity:m===E.roleId?.6:1},children:m===E.roleId?"Applying...":"Apply Update"})]}),E.fields.map(B=>l.jsxs("div",{style:{marginBottom:6,fontSize:12},children:[l.jsx("div",{style:{color:"rgba(255,255,255,0.5)",marginBottom:2,textTransform:"uppercase",fontSize:10,letterSpacing:.5},children:B.field}),l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},children:[l.jsxs("div",{style:{padding:"4px 8px",background:"rgba(255,100,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[l.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"LOCAL"}),l.jsx("br",{}),B.local]}),l.jsxs("div",{style:{padding:"4px 8px",background:"rgba(100,255,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[l.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"UPSTREAM"}),l.jsx("br",{}),B.upstream]})]})]},B.field))]},E.roleId)),a.length>0&&l.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Roles hired from the Store are tracked automatically. Set ",l.jsx("code",{style:{background:"rgba(255,255,255,0.06)",padding:"1px 4px",borderRadius:3},children:"sync: off"})," in role.yaml to stop tracking."]})]})}function s8({onClose:e}){const[n,a]=v.useState(null),[i,o]=v.useState(!0),[u,d]=v.useState(null),[h,m]=v.useState(null),f=v.useCallback(async()=>{o(!0),d(null);try{const E=await ge.getGitStatus();a(E)}catch(E){d(E instanceof Error?E.message:"Failed to load git status")}finally{o(!1)}},[]);v.useEffect(()=>{f()},[f]);const x=async E=>{m(E.path);try{await ge.deleteWorktree(E.path),await f()}catch(B){d(B instanceof Error?B.message:"Failed to remove worktree")}finally{m(null)}},g=async E=>{m(E);try{await ge.deleteBranch(E),await f()}catch(B){d(B instanceof Error?B.message:"Failed to delete branch")}finally{m(null)}};if(i&&!n)return l.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading git status..."});if(u&&!n)return l.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u,l.jsx("button",{onClick:e,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]});if(!n)return null;const w=n.worktrees.filter(E=>E.status==="active"),b=n.worktrees.filter(E=>E.status==="pending-merge"),j=n.worktrees.filter(E=>E.status==="stale");function k(E){const B=E.split("/");if(B.length>1){const R=B[B.length-1],$=["cto","cbo","pm","engineer","designer","qa","data-analyst"];for(const _ of $)if(R.toLowerCase().includes(_))return _}return null}function N(E,B=40){return E.length<=B?E:"..."+E.slice(E.length-B+3)}function C(E){const B=Date.now()-new Date(E).getTime(),R=Math.floor(B/6e4);if(R<1)return"just now";if(R<60)return`${R}m ago`;const $=Math.floor(R/60);return $<24?`${$}h ago`:`${Math.floor($/24)}d ago`}return l.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[l.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"GIT STATUS"}),l.jsxs("div",{style:{display:"flex",gap:8},children:[l.jsx("button",{onClick:f,disabled:i,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:i?"wait":"pointer"},children:i?"Checking...":"Refresh"}),l.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),u&&l.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:u}),l.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[l.jsxs("div",{children:[l.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Branch: "}),l.jsx("span",{style:{fontWeight:500},children:n.currentBranch})]}),l.jsx("div",{children:n.unsavedCount>0&&l.jsxs("span",{style:{color:"#FFB74D",fontSize:12},children:[n.unsavedCount," unsaved"]})})]}),n.lastCommit&&l.jsxs("div",{style:{marginTop:6,fontSize:11,color:"rgba(255,255,255,0.4)"},children:["Last commit: ",n.lastCommit.message.slice(0,60),n.lastCommit.message.length>60?"...":""," · ",C(n.lastCommit.date)]})]}),w.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Cu,{label:"Active Worktrees",count:w.length}),w.map(E=>l.jsx(Hh,{wt:E,roleFromBranch:E.roleId||k(E.branch),truncatePath:N,timeAgo:C,removing:h===E.path,onRemove:()=>x(E),statusColor:"#4FC3F7",statusIcon:"📂"},E.path))]}),b.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Cu,{label:"Pending Merge",count:b.length}),b.map(E=>l.jsx(Hh,{wt:E,roleFromBranch:E.roleId||k(E.branch),truncatePath:N,timeAgo:C,removing:h===E.path,onRemove:()=>x(E),statusColor:"#FFB74D",statusIcon:"⚠️"},E.path))]}),j.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Cu,{label:"Stale",count:j.length}),j.map(E=>l.jsx(Hh,{wt:E,roleFromBranch:E.roleId||k(E.branch),truncatePath:N,timeAgo:C,removing:h===E.path,onRemove:()=>x(E),statusColor:"#ff6b6b",statusIcon:"🔴"},E.path))]}),n.staleBranches.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Cu,{label:"Unmerged Branches",count:n.staleBranches.length}),n.staleBranches.map(E=>l.jsxs("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[l.jsxs("div",{style:{fontSize:13},children:[l.jsx("span",{style:{color:"rgba(255,255,255,0.5)",marginRight:6},children:"⚠️"}),l.jsx("span",{style:{fontWeight:500},children:E})]}),l.jsx("button",{onClick:()=>g(E),disabled:h===E,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:"#ff6b6b",borderRadius:4,padding:"3px 8px",fontSize:10,cursor:h===E?"wait":"pointer",opacity:h===E?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5},children:h===E?"...":"DELETE"})]},E))]}),w.length===0&&b.length===0&&j.length===0&&n.staleBranches.length===0&&l.jsxs("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:["✓"," All clean. No active worktrees or stale branches."]}),n.lastMerge&&l.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Last merge: ",l.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:n.lastMerge.branch})," · ",n.lastMerge.roleId," · ",C(n.lastMerge.mergedAt)]})]})}function Cu({label:e,count:n}){return l.jsxs("h4",{style:{margin:"16px 0 8px",fontSize:11,fontWeight:600,color:"rgba(255,255,255,0.5)",textTransform:"uppercase",letterSpacing:1},children:[e," (",n,")"]})}function Hh({wt:e,roleFromBranch:n,truncatePath:a,timeAgo:i,removing:o,onRemove:u,statusColor:d,statusIcon:h}){return l.jsx("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[l.jsxs("div",{style:{flex:1,minWidth:0},children:[l.jsxs("div",{style:{fontSize:13,fontWeight:500,marginBottom:2},children:[l.jsx("span",{style:{marginRight:6},children:h}),e.branch,n&&l.jsx("span",{style:{marginLeft:8,fontSize:10,padding:"1px 6px",background:"rgba(255,255,255,0.08)",borderRadius:3,color:"rgba(255,255,255,0.6)",textTransform:"uppercase"},children:n})]}),e.task&&l.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.5)",marginBottom:2},children:['"',e.task.slice(0,50),e.task.length>50?"...":"",'"']}),l.jsxs("div",{style:{fontSize:10,color:"rgba(255,255,255,0.35)"},children:[a(e.path)," · ",e.filesChanged," file",e.filesChanged!==1?"s":""," changed"," · ",i(e.createdAt)]}),e.conflictFiles&&e.conflictFiles.length>0&&l.jsxs("div",{style:{fontSize:10,color:"#ff6b6b",marginTop:4},children:["⛔"," CONFLICT: ",e.conflictFiles.join(", ")]})]}),l.jsx("button",{onClick:u,disabled:o,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:d,borderRadius:4,padding:"3px 8px",fontSize:10,cursor:o?"wait":"pointer",opacity:o?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5,flexShrink:0,marginLeft:8},children:o?"...":"REMOVE"})]})})}function o8({onClose:e}){const[n,a]=v.useState(null),[i,o]=v.useState(!0),[u,d]=v.useState(null),[h,m]=v.useState(null),f=v.useCallback(async()=>{o(!0),d(null);try{const k=await ge.getActiveSessions();a(k)}catch(k){d(k instanceof Error?k.message:"Failed to load sessions")}finally{o(!1)}},[]);v.useEffect(()=>{f();const k=setInterval(f,1e4);return()=>clearInterval(k)},[f]);const x=async k=>{m(k);try{await ge.deleteActiveSession(k),await f()}catch(N){d(N instanceof Error?N.message:"Failed to remove session")}finally{m(null)}},g=async()=>{try{await ge.cleanupActiveSessions(),await f()}catch(k){d(k instanceof Error?k.message:"Failed to cleanup sessions")}};if(i&&!n)return l.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading sessions..."});if(u&&!n)return l.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u,l.jsx("button",{onClick:e,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]});if(!n)return null;const w=n.sessions.filter(k=>k.status==="active"),b=n.sessions.filter(k=>k.status==="idle"),j=n.sessions.filter(k=>k.status==="dead");return l.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[l.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"ACTIVE SESSIONS"}),l.jsxs("div",{style:{display:"flex",gap:8},children:[j.length>0&&l.jsx("button",{onClick:g,style:{background:"rgba(255,180,100,0.15)",border:"1px solid rgba(255,180,100,0.2)",color:"#FFB74D",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:"pointer"},children:"Cleanup Dead"}),l.jsx("button",{onClick:f,disabled:i,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:i?"wait":"pointer"},children:i?"Checking...":"Refresh"}),l.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),u&&l.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:u}),l.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13,display:"flex",justifyContent:"space-between"},children:[l.jsxs("div",{children:[l.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Sessions: "}),l.jsx("span",{style:{fontWeight:500},children:n.summary.active})]}),l.jsxs("div",{children:[l.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Ports in use: "}),l.jsx("span",{style:{fontWeight:500},children:n.summary.totalPorts})]})]}),w.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Uh,{label:"Active",count:w.length}),w.map(k=>l.jsx(qh,{session:k,removing:h===k.sessionId,onRemove:()=>x(k.sessionId),statusColor:"#4FC3F7"},k.sessionId))]}),b.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Uh,{label:"Idle",count:b.length}),b.map(k=>l.jsx(qh,{session:k,removing:h===k.sessionId,onRemove:()=>x(k.sessionId),statusColor:"#FFB74D"},k.sessionId))]}),j.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Uh,{label:"Dead",count:j.length}),j.map(k=>l.jsx(qh,{session:k,removing:h===k.sessionId,onRemove:()=>x(k.sessionId),statusColor:"#ff6b6b"},k.sessionId))]}),n.sessions.length===0&&l.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:"No active sessions. Sessions appear when jobs run with port allocation."})]})}function Uh({label:e,count:n}){return l.jsxs("h4",{style:{margin:"16px 0 8px",fontSize:11,fontWeight:600,color:"rgba(255,255,255,0.5)",textTransform:"uppercase",letterSpacing:1},children:[e," (",n,")"]})}function c8(e){const n=Date.now()-new Date(e).getTime(),a=Math.floor(n/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 qh({session:e,removing:n,onRemove:a,statusColor:i}){const{ports:o}=e;return l.jsx("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[l.jsxs("div",{style:{flex:1,minWidth:0},children:[l.jsxs("div",{style:{fontSize:13,fontWeight:500,marginBottom:2},children:[l.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",backgroundColor:i,marginRight:8,verticalAlign:"middle"}}),l.jsx("span",{style:{textTransform:"uppercase"},children:e.roleName||e.roleId}),e.jobStatus&&l.jsx("span",{style:{marginLeft:8,fontSize:10,padding:"1px 6px",background:"rgba(255,255,255,0.08)",borderRadius:3,color:"rgba(255,255,255,0.6)"},children:e.jobStatus})]}),e.task&&l.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.5)",marginBottom:4},children:['"',e.task.slice(0,60),e.task.length>60?"...":"",'"']}),l.jsxs("div",{style:{fontSize:11,display:"flex",gap:8,marginBottom:2},children:[l.jsxs("span",{style:{color:"#81C784"},children:["API:",o.api||"?"]}),l.jsxs("span",{style:{color:"#64B5F6"},children:["Vite:",o.vite||"?"]}),o.hmr&&l.jsxs("span",{style:{color:"#FFB74D"},children:["HMR:",o.hmr]})]}),l.jsxs("div",{style:{fontSize:10,color:"rgba(255,255,255,0.35)"},children:[e.sessionId.slice(0,12),"...",e.worktreePath&&l.jsxs(l.Fragment,{children:[" · ",u8(e.worktreePath)]}),e.pid&&l.jsxs(l.Fragment,{children:[" · ","PID:",e.pid]})," · ",c8(e.startedAt)]})]}),l.jsx("button",{onClick:a,disabled:n,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:"#ff6b6b",borderRadius:4,padding:"3px 8px",fontSize:10,cursor:n?"wait":"pointer",opacity:n?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5,flexShrink:0,marginLeft:8},children:n?"...":"STOP"})]})})}function u8(e,n=35){return e.length<=n?e:"..."+e.slice(e.length-n+3)}function d8({onClose:e,speechSettings:n,onSpeechSettingsChange:a,language:i,onLanguageChange:o,onOpenSync:u,onOpenGitStatus:d,onOpenSessions:h,onOpenStats:m}){var se;const[f,x]=v.useState(null),[g,w]=v.useState(null),[b,j]=v.useState(!1),[k,N]=v.useState(!1),[C,E]=v.useState(!1),[B,R]=v.useState(null),[$,_]=v.useState(""),[L,U]=v.useState(!1),[Q,D]=v.useState(!1),[I,H]=v.useState(null),[q,ue]=v.useState(!1);v.useEffect(()=>{ge.getPreferences().then(async J=>{const Z=J;if(x(Z.instanceId??null),Z.instanceId)try{const{name:A}=await wr.getMyName(Z.instanceId);w(A)}catch{}}).catch(()=>{}),ge.getCodeRoot().then(({codeRoot:J})=>{R(J),J&&_(J)}).catch(()=>{})},[]);const te=async()=>{E(!0);try{const Z=await(await fetch("/api/preferences/regenerate-token",{method:"POST"})).json();Z.ok&&(x(Z.newInstanceId),N(!1))}catch{}E(!1)},Y=()=>{f&&navigator.clipboard.writeText(f).then(()=>{j(!0),setTimeout(()=>j(!1),2e3)})};return l.jsx("div",{className:"customize-overlay",onClick:e,children:l.jsxs("div",{className:"customize-modal",onClick:J=>J.stopPropagation(),style:{maxWidth:480},children:[l.jsxs("div",{className:"customize-header",children:[l.jsx("div",{style:{fontSize:12,fontWeight:700,letterSpacing:1,color:"var(--terminal-text)"},children:"SETTINGS"}),l.jsx("button",{className:"customize-close",onClick:e,children:"X"})]}),l.jsx("div",{className:"customize-body",style:{padding:"12px 20px 20px"},children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),l.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(J=>l.jsxs("button",{onClick:()=>a==null?void 0:a({mode:J}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(n==null?void 0:n.mode)===J?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(n==null?void 0:n.mode)===J?"rgba(255,255,255,0.08)":"transparent",color:(n==null?void 0:n.mode)===J?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[l.jsx("div",{style:{fontWeight:600,marginBottom:2},children:J==="template"?"TEMPLATE":J==="llm"?"AI":"AUTO"}),l.jsx("div",{style:{fontSize:9,opacity:.7},children:J==="template"?"Static pool ($0)":J==="llm"?"LLM generated":"Detect engine"})]},J))}),l.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),l.jsxs("div",{children:[l.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(n==null?void 0:n.intervalSec)??18,"s"]}),l.jsx("input",{type:"range",min:5,max:120,step:5,value:(n==null?void 0:n.intervalSec)??18,onChange:J=>a==null?void 0:a({intervalSec:Number(J.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[l.jsx("span",{children:"5s (frequent)"}),l.jsx("span",{children:"120s (rare)"})]})]}),(n==null?void 0:n.mode)!=="template"&&l.jsxs("div",{children:[l.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((se=n==null?void 0:n.dailyBudgetUsd)==null?void 0:se.toFixed(2))??"1.00"]}),l.jsx("input",{type:"range",min:0,max:5,step:.25,value:(n==null?void 0:n.dailyBudgetUsd)??1,onChange:J=>a==null?void 0:a({dailyBudgetUsd:Number(J.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[l.jsx("span",{children:"$0 (unlimited)"}),l.jsx("span",{children:"$5.00/day"})]})]}),l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),l.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:J,label:Z})=>l.jsx("button",{onClick:()=>o==null?void 0:o(J),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(i??"auto")===J?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(i??"auto")===J?"rgba(255,255,255,0.08)":"transparent",color:(i??"auto")===J?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:Z},J))}),l.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]}),l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"CODE REPOSITORY"}),L?l.jsxs("div",{children:[l.jsxs("div",{style:{display:"flex",gap:6},children:[l.jsx("input",{type:"text",value:$,onChange:J=>{_(J.target.value),H(null)},placeholder:"/path/to/code/repo",style:{flex:1,padding:"8px 10px",fontSize:11,background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:6,color:"var(--terminal-text)",fontFamily:"monospace",outline:"none"},autoFocus:!0}),l.jsx("button",{onClick:async()=>{if($.trim()){D(!0),H(null);try{const J=await ge.setCodeRoot($.trim());R(J.codeRoot),_(J.codeRoot),U(!1),ue(!0),setTimeout(()=>ue(!1),3e3)}catch(J){H(J instanceof Error?J.message:"Failed to set code root")}finally{D(!1)}}},disabled:Q||!$.trim(),style:{padding:"8px 12px",fontSize:10,fontWeight:600,background:"var(--accent)",border:"none",color:"#fff",borderRadius:6,cursor:"pointer",opacity:Q||!$.trim()?.5:1},children:Q?"...":"Save"}),l.jsx("button",{onClick:()=>{U(!1),_(B||""),H(null)},style:{padding:"8px 10px",fontSize:10,background:"transparent",border:"1px solid rgba(255,255,255,0.1)",color:"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer"},children:"Cancel"})]}),I&&l.jsx("div",{style:{fontSize:9,color:"#ff6b6b",marginTop:4},children:I})]}):l.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[l.jsx("code",{style:{flex:1,padding:"8px 10px",fontSize:10,background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:6,color:B?"var(--terminal-text)":"var(--terminal-text-muted)",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:B||"Not configured"}),l.jsx("button",{onClick:()=>{U(!0),H(null),ue(!1)},style:{padding:"8px 12px",fontSize:10,fontWeight:600,border:"2px solid rgba(255,255,255,0.1)",background:"transparent",color:"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer"},children:"Change"})]}),q&&l.jsx("div",{style:{fontSize:9,color:"#4ade80",marginTop:4},children:"Code repository updated!"}),l.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Path to your code repository (separate from AKB)"})]}),f&&l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"STORE TOKEN"}),l.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[l.jsx("code",{style:{flex:1,padding:"8px 10px",fontSize:10,background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:6,color:"var(--terminal-text-muted)",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f}),l.jsx("button",{onClick:Y,style:{padding:"8px 12px",fontSize:10,fontWeight:600,border:"2px solid rgba(255,255,255,0.1)",background:"transparent",color:b?"#4ade80":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",whiteSpace:"nowrap"},children:b?"Copied!":"Copy"})]}),l.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Use this token to sign in on the web Store. Keep it secret — anyone with this token can act as you."}),l.jsx("div",{style:{marginTop:6},children:k?l.jsxs("div",{style:{background:"rgba(255,50,50,0.08)",border:"1px solid rgba(255,50,50,0.2)",borderRadius:6,padding:"8px 10px"},children:[l.jsx("div",{style:{fontSize:9,color:"rgba(255,100,100,0.8)",marginBottom:6},children:"This will invalidate your current token. Published characters will lose ownership. No migration."}),l.jsxs("div",{style:{display:"flex",gap:6},children:[l.jsx("button",{onClick:te,disabled:C,style:{padding:"4px 12px",fontSize:9,fontWeight:700,border:"1px solid rgba(255,50,50,0.4)",background:"rgba(255,50,50,0.15)",color:"#ff6464",borderRadius:4,cursor:"pointer"},children:C?"...":"Confirm Regenerate"}),l.jsx("button",{onClick:()=>N(!1),style:{padding:"4px 12px",fontSize:9,border:"none",background:"transparent",color:"var(--terminal-text-muted)",cursor:"pointer"},children:"Cancel"})]})]}):l.jsx("button",{onClick:()=>N(!0),style:{padding:"4px 10px",fontSize:9,fontWeight:600,border:"1px solid rgba(255,100,100,0.2)",background:"transparent",color:"rgba(255,100,100,0.6)",borderRadius:4,cursor:"pointer"},children:"Regenerate Token"})})]}),l.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.08)",paddingTop:16,display:"flex",gap:8},children:[u&&l.jsx("button",{onClick:()=>{e(),u()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"🔄 ROLE SYNC"}),d&&l.jsx("button",{onClick:()=>{e(),d()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📂 GIT STATUS"}),h&&l.jsx("button",{onClick:()=>{e(),h()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"🖥 SESSIONS"}),m&&l.jsx("button",{onClick:()=>{e(),m()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📊 COMPANY STATS"}),l.jsx("button",{onClick:()=>window.open("https://tycono.ai/store.html","_blank"),className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"🌐 WEB STORE"})]}),g&&l.jsx("div",{style:{textAlign:"center",marginTop:-8},children:l.jsx("a",{href:`https://tycono.ai/profile.html?u=${encodeURIComponent(g)}`,target:"_blank",rel:"noopener noreferrer",style:{fontSize:10,color:"var(--terminal-text-muted)",textDecoration:"none"},onMouseEnter:J=>J.currentTarget.style.color="var(--accent)",onMouseLeave:J=>J.currentTarget.style.color="var(--terminal-text-muted)",children:"View public profile →"})})]})})]})})}function f8({theme:e,onThemeChange:n,onClose:a}){const i=v.useRef(null);return v.useEffect(()=>{const o=u=>{i.current&&!i.current.contains(u.target)&&a()};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[a]),l.jsx("div",{ref:i,className:"theme-dropup",children:Object.entries(ll).map(([o,u])=>l.jsxs("button",{className:`theme-dropup__item${e===o?" theme-dropup__item--active":""}`,onClick:()=>{n(o),a()},title:u.name,children:[l.jsxs("span",{className:"theme-dropup__swatch",style:{background:u.vars["--hud-bg"],borderColor:u.vars["--pixel-border"]},children:[l.jsx("span",{style:{background:u.vars["--accent"],width:5,height:5,borderRadius:1}}),l.jsx("span",{style:{background:u.vars["--active-green"],width:5,height:5,borderRadius:1}}),l.jsx("span",{style:{background:u.vars["--idle-amber"],width:5,height:5,borderRadius:1}})]}),l.jsx("span",{className:"theme-dropup__name",children:u.icon})]},o))})}const vs={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function h8({roles:e,roleStatuses:n,activeExecs:a,sessions:i,knowledgeDocs:o,roleLevels:u,companyName:d,getAppearance:h,waveCenterWaves:m,renderProfile:f,channel:x,onChannelChange:g,onClose:w,children:b}){const[j,k]=v.useState(!1),N=m.filter(L=>L.rootJobs.some(U=>{const Q=n[U.roleId];return Q==="working"||Q==="thinking"})),C=[...e].sort((L,U)=>L.level==="c-level"&&U.level!=="c-level"?-1:L.level!=="c-level"&&U.level==="c-level"?1:L.name.localeCompare(U.name)),E=e.filter(L=>n[L.id]==="working").length,B=i.filter(L=>L.status==="active").length,R=x.type==="role"?e.find(L=>L.id===x.roleId):null,$=x.type==="dashboard"?"Dashboard":x.type==="terminal"?"Chats":x.type==="wave"?"Wave Center":x.type==="knowledge"?"Knowledge Base":x.type==="operations"?"Operations":x.type==="role"?(R==null?void 0:R.name)??x.roleId:"Dashboard",_=x.type==="terminal"?`${B} active sessions`:x.type==="wave"?`${N.length} running`:x.type==="knowledge"?`${o.length} documents`:x.type==="role"?(R==null?void 0:R.level)==="c-level"?"C-Level":"Team member":`${E} working · ${e.length} total`;return l.jsxs("div",{className:"fixed inset-0 z-[60] flex",style:{background:"var(--terminal-bg, #1C1612)"},children:[l.jsxs("div",{className:"flex flex-col shrink-0 overflow-y-auto",style:{width:240,borderRight:"1px solid var(--terminal-border, #2E261F)",background:"var(--terminal-surface, #1a1510)"},children:[l.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border, #2E261F)"},children:[l.jsx("span",{className:"text-[11px] font-bold tracking-wider flex-1",style:{color:"var(--terminal-text, #fff5eb)",fontFamily:"var(--pixel-font)"},children:d}),E>0&&l.jsxs("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full animate-pulse",style:{background:"#4CAF5020",color:"#4CAF50"},children:[E," live"]})]}),N.length>0&&l.jsxs("button",{className:"mx-3 mt-3 px-3 py-2.5 rounded-lg text-left transition-all hover:opacity-90",style:{background:x.type==="wave"?"#EF444420":"#EF444410",border:"1px solid #EF444430"},onClick:()=>g({type:"wave"}),children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsxs("span",{className:"text-[10px] font-bold truncate flex-1",style:{color:"#EF4444"},children:["⚡"," ",N[0].directive.slice(0,28)]}),l.jsx("span",{className:"text-[7px] px-1.5 py-0.5 rounded font-bold shrink-0",style:{background:"#EF4444",color:"#fff"},children:"LIVE"})]}),l.jsxs("div",{className:"text-[9px]",style:{color:"var(--terminal-text-muted)"},children:[N[0].rootJobs.filter(L=>{const U=n[L.roleId];return U==="working"||U==="thinking"}).length,"/",N[0].rootJobs.length," roles working"]})]}),l.jsxs("div",{className:"mx-3 mt-3 grid grid-cols-2 gap-1.5",children:[l.jsx(Nu,{icon:"💬",label:"Chats",badge:B||void 0,active:x.type==="terminal",onClick:()=>g({type:"terminal"})}),l.jsx(Nu,{icon:"⚡",label:"Waves",live:N.length>0,active:x.type==="wave",onClick:()=>g({type:"wave"})}),l.jsx(Nu,{icon:"📋",label:"Decisions",active:x.type==="operations",onClick:()=>g({type:"operations"})}),l.jsx(Nu,{icon:"📚",label:"Knowledge",badge:o.length||void 0,active:x.type==="knowledge",onClick:()=>g({type:"knowledge"})})]}),l.jsxs("div",{className:"mt-4",children:[l.jsx("div",{className:"px-4 py-1 text-[9px] font-bold tracking-widest",style:{color:"var(--terminal-text-muted)"},children:"TEAM"}),C.map(L=>{var q;const U=n[L.id],Q=a.find(ue=>ue.roleId===L.id),D=vs[L.id]??"#666",I=(q=u[L.id])==null?void 0:q.level,H=x.type==="role"&&x.roleId===L.id;return l.jsxs("button",{onClick:()=>g({type:"role",roleId:L.id}),className:"flex items-center gap-2.5 w-full px-4 py-1.5 text-left hover:opacity-80 transition-all",style:{background:H?`${D}18`:"transparent",borderLeft:H?`2px solid ${D}`:"2px solid transparent"},children:[l.jsxs("div",{className:"relative shrink-0",style:{width:22,height:22},children:[l.jsx(Ul,{roleId:L.id,appearance:h(L.id),scale:1.3}),l.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 w-2 h-2 rounded-full",style:{background:U==="working"?"#4CAF50":U==="idle"?"#FFC107":"#9E9E9E",border:"1.5px solid var(--terminal-surface, #1a1510)"}})]}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"text-[11px] truncate",style:{color:"var(--terminal-text, #fff5eb)"},children:[L.name,I!=null&&l.jsxs("span",{className:"ml-1 opacity-40 text-[8px]",children:["Lv.",I]})]}),Q?l.jsx("div",{className:"text-[9px] truncate",style:{color:D},children:Q.task.slice(0,28)}):l.jsx("div",{className:"text-[9px]",style:{color:"var(--terminal-text-muted, #887766)"},children:L.level==="c-level"?L.id.toUpperCase():L.id})]}),U==="working"&&l.jsx("span",{className:"w-1.5 h-1.5 rounded-full animate-pulse shrink-0",style:{background:D}})]},L.id)})]}),l.jsx("div",{className:"flex-1"}),a.length>0&&l.jsxs("div",{className:"shrink-0 px-3 pb-2",style:{borderTop:"1px solid var(--terminal-border, #2E261F)"},children:[l.jsxs("div",{className:"px-1 py-1.5 text-[8px] font-bold tracking-widest",style:{color:"var(--terminal-text-muted)"},children:["ACTIVE JOBS (",a.length,")"]}),l.jsx("div",{className:"space-y-0.5 max-h-[140px] overflow-y-auto",children:a.map(L=>{const U=e.find(I=>I.id===L.roleId),Q=vs[L.roleId]??"#666",D=x.type==="role"&&x.roleId===L.roleId;return l.jsxs("button",{onClick:()=>g({type:"role",roleId:L.roleId}),className:"flex items-center gap-2 w-full px-2 py-1.5 rounded text-left hover:opacity-80 transition-all",style:{background:D?`${Q}18`:"transparent"},children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full animate-pulse shrink-0",style:{background:Q}}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text, #fff5eb)"},children:(U==null?void 0:U.name)??L.roleId}),l.jsx("div",{className:"text-[8px] truncate",style:{color:"var(--terminal-text-muted)"},children:L.task.slice(0,40)})]})]},L.jobId??L.roleId)})})]}),l.jsx("div",{className:"px-3 py-3 shrink-0",style:{borderTop:"1px solid var(--terminal-border, #2E261F)"},children:l.jsxs("button",{onClick:w,className:"flex items-center gap-2 w-full px-3 py-2.5 rounded-lg hover:opacity-80 transition-opacity",style:{background:"var(--terminal-border, #2E261F)",color:"var(--terminal-text, #fff5eb)"},children:[l.jsx("span",{className:"text-[12px]",children:"🏢"}),l.jsx("span",{className:"text-[11px] font-medium",children:"Office"})]})})]}),l.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"px-5 py-3 flex items-center gap-3 shrink-0",style:{borderBottom:"1px solid var(--terminal-border, #2E261F)"},children:[x.type==="role"&&R&&l.jsxs("button",{onClick:()=>k(L=>!L),className:"relative shrink-0 rounded-lg overflow-hidden hover:opacity-80 transition-opacity cursor-pointer",style:{width:28,height:28,background:`${vs[R.id]??"#666"}30`},title:"View profile",children:[l.jsx(Ul,{roleId:R.id,appearance:h(R.id),scale:1.5}),l.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-full",style:{background:n[R.id]==="working"?"#4CAF50":n[R.id]==="idle"?"#FFC107":"#9E9E9E",border:"2px solid var(--terminal-bg, #1C1612)"}})]}),l.jsx("span",{className:"text-[15px] font-semibold",style:{color:"var(--terminal-text, #fff5eb)"},children:$}),l.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted, #887766)"},children:_}),l.jsx("span",{className:"flex-1"}),x.type==="role"&&l.jsx("button",{onClick:()=>k(L=>!L),className:"text-[10px] px-2 py-1 rounded hover:opacity-80 transition-opacity",style:{color:j?"var(--terminal-text)":"var(--terminal-text-muted)",border:"1px solid var(--terminal-border)",background:j?"var(--terminal-border)":"transparent"},children:"Profile"}),x.type!=="dashboard"&&l.jsx("button",{onClick:()=>g({type:"dashboard"}),className:"text-[10px] px-2 py-1 rounded hover:opacity-80 transition-opacity",style:{color:"var(--terminal-text-muted)",border:"1px solid var(--terminal-border)"},children:"Dashboard"})]}),l.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[l.jsx("div",{className:"flex-1 overflow-hidden relative pro-panel-inline",children:b}),j&&x.type==="role"&&f&&l.jsx("div",{className:"shrink-0 overflow-hidden pro-panel-inline",style:{width:420,borderLeft:"1px solid var(--terminal-border, #2E261F)"},children:f(()=>k(!1))})]})]})]})}function m8({role:e,messages:n,isStreaming:a,mode:i,onModeChange:o,onSend:u,isWave:d}){const h=vs[e.id]??"#666";return l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsx(hv,{messages:n,roleId:e.id,roleColor:h}),d?l.jsxs("div",{className:"shrink-0 px-4 py-2 border-t flex items-center gap-2",style:{borderColor:"var(--terminal-border)",background:"var(--terminal-bg-deeper)"},children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 shrink-0",style:{animation:"pulse 2s infinite"}}),l.jsx("span",{className:"text-[11px] text-amber-400/80",children:"Wave execution · read-only"})]}):l.jsx(Qm,{mode:i,onModeChange:o,onSend:(m,f)=>u(m,i,f),disabled:a,disabledReason:a?`${e.id.toUpperCase()} is responding...`:void 0})]})}function p8({role:e,onSend:n,getAppearance:a,onOpenProfile:i}){const[o,u]=v.useState("talk"),d=vs[e.id]??"#666";return l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4",children:[l.jsx("button",{onClick:i,className:"cursor-pointer hover:opacity-80 transition-opacity",children:l.jsx("div",{className:"rounded-lg p-1",style:{background:`${d}20`},children:l.jsx(Ul,{roleId:e.id,appearance:a(e.id),scale:5})})}),l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--terminal-text)"},children:e.name}),l.jsxs("div",{className:"text-xs mt-0.5",style:{color:"var(--terminal-text-muted)"},children:[e.level==="c-level"?e.id.toUpperCase():e.id," · Start a conversation"]})]})]}),l.jsx(Qm,{mode:o,onModeChange:u,onSend:h=>n(h,o),disabled:!1})]})}function Nu({icon:e,label:n,active:a,badge:i,live:o,onClick:u}){return l.jsxs("button",{onClick:u,className:"flex flex-col items-center gap-1 py-3 rounded-lg transition-all hover:opacity-90",style:{background:a?"var(--desk-wood, #5C3D2E)":"var(--terminal-border, #2E261F)",border:a?"1px solid var(--desk-wood, #5C3D2E)":"1px solid transparent"},children:[l.jsxs("div",{className:"relative",children:[l.jsx("span",{className:"text-[16px]",children:e}),o&&l.jsx("span",{className:"absolute -top-1 -right-2 w-2 h-2 rounded-full animate-pulse",style:{background:"#EF4444"}}),i!==void 0&&i>0&&!o&&l.jsx("span",{className:"absolute -top-1.5 -right-3 text-[7px] px-1 py-0.5 rounded-full font-bold leading-none",style:{background:"var(--desk-wood, #5C3D2E)",color:"#fff",minWidth:14,textAlign:"center"},children:i})]}),l.jsx("span",{className:"text-[10px] font-semibold",style:{color:a?"#fff":"var(--terminal-text, #fff5eb)"},children:n})]})}function x8({roles:e,roleStatuses:n,activeExecs:a,waves:i,knowledgeDocs:o,roleLevels:u,getAppearance:d,onRoleClick:h,onWaveClick:m,onKnowledgeClick:f}){const x=e.filter(g=>n[g.id]==="working");return l.jsx("div",{className:"h-full overflow-y-auto px-6 py-5",children:l.jsxs("div",{className:"space-y-5 max-w-4xl",children:[l.jsxs("div",{className:"flex gap-3",children:[l.jsx(yy,{label:"New Wave",icon:"⚡",color:"#EF4444",onClick:m}),l.jsx(yy,{label:"Knowledge",icon:"📚",color:"#0D9488",onClick:f})]}),x.length>0&&l.jsx(Eu,{title:"Currently Working",count:x.length,children:a.map(g=>{const w=e.find(j=>j.id===g.roleId),b=vs[g.roleId]??"#666";return l.jsxs("button",{onClick:()=>h(g.roleId),className:"flex items-center gap-3 px-4 py-2.5 rounded hover:opacity-80 w-full text-left",style:{background:`${b}10`},children:[l.jsx("div",{className:"shrink-0",style:{width:24,height:24},children:l.jsx(Ul,{roleId:g.roleId,appearance:d(g.roleId),scale:1.2})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"text-[12px] font-medium",style:{color:b},children:w==null?void 0:w.name}),l.jsx("span",{className:"text-[11px] ml-2 truncate",style:{color:"var(--terminal-text-muted)"},children:g.task.slice(0,60)})]}),l.jsx("span",{className:"text-[10px] animate-pulse",style:{color:b},children:"●"})]},g.roleId)})}),l.jsx(Eu,{title:"Team",count:e.length,children:l.jsx("div",{className:"grid grid-cols-3 gap-1 px-2",children:e.map(g=>{var j;const w=n[g.id]??"offline",b=(j=u[g.id])==null?void 0:j.level;return l.jsxs("button",{onClick:()=>h(g.id),className:"flex items-center gap-2 px-3 py-2 rounded hover:opacity-80 text-left",children:[l.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:w==="working"?"#4CAF50":w==="idle"?"#FFC107":"#9E9E9E"}}),l.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--terminal-text)"},children:g.name}),b!=null&&l.jsxs("span",{className:"text-[9px] opacity-40",children:["Lv.",b]})]},g.id)})})}),i.length>0&&l.jsx(Eu,{title:"Recent Waves",count:i.length,children:i.slice(0,5).map(g=>{var w;return l.jsxs("div",{className:"px-4 py-2 text-[11px]",style:{color:"var(--terminal-text-muted)"},children:[l.jsxs("span",{style:{color:"var(--terminal-text)"},children:["Wave ",g.id]})," — ",(w=g.directive)==null?void 0:w.slice(0,80)]},g.id)})}),l.jsx(Eu,{title:"Knowledge Base",count:o.length,children:l.jsxs("button",{onClick:f,className:"px-4 py-3 text-[11px] hover:opacity-80",style:{color:"var(--terminal-text-muted)"},children:[o.length," documents · Click to explore ","→"]})})]})})}function yy({label:e,icon:n,color:a,onClick:i}){return l.jsxs("button",{onClick:i,className:"flex items-center gap-2 px-5 py-3 rounded-lg hover:opacity-80 transition-opacity",style:{background:`${a}15`,border:`1px solid ${a}30`},children:[l.jsx("span",{className:"text-sm",children:n}),l.jsx("span",{className:"text-[12px] font-medium",style:{color:a},children:e})]})}function Eu({title:e,count:n,children:a}){return l.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--terminal-surface, #241E19)",border:"1px solid var(--terminal-border, #2E261F)"},children:[l.jsxs("div",{className:"px-4 py-2.5 flex items-center gap-2",style:{borderBottom:"1px solid var(--terminal-border, #2E261F)"},children:[l.jsx("span",{className:"text-[10px] font-bold tracking-wider",style:{color:"var(--terminal-text-muted)"},children:e.toUpperCase()}),n!==void 0&&l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full",style:{background:"var(--terminal-border)",color:"var(--terminal-text-muted)"},children:n})]}),l.jsx("div",{className:"py-1",children:a})]})}const vm=5e4;function Tv(e){return e<vm?1:Math.max(1,Math.floor(Math.sqrt(e/vm)))}function by(e){return vm*e*e}function g8(e){const n=Tv(e),a=by(n),i=by(n+1);return Math.min(1,(e-a)/(i-a))}function Yh(e){const n={};for(const[a,i]of Object.entries(e)){const o=i.inputTokens+i.outputTokens;n[a]={level:Tv(o),totalTokens:o,progress:g8(o)}}return n}const y8=[{id:"first-employee",name:"First Employee",icon:"🏆",description:"Hired your first role",check:e=>e.roleCount>=1},{id:"full-team",name:"Full Team",icon:"👥",description:"Hired 5+ roles",check:e=>e.roleCount>=5},{id:"token-10k",name:"Getting Started",icon:"📊",description:"Used 10K tokens total",check:e=>e.totalTokens>=1e4},{id:"token-100k",name:"Power User",icon:"💪",description:"Used 100K tokens total",check:e=>e.totalTokens>=1e5},{id:"token-millionaire",name:"Token Millionaire",icon:"🎖",description:"Used 1M tokens total",check:e=>e.totalTokens>=1e6},{id:"token-mogul",name:"Token Mogul",icon:"💎",description:"Used 10M tokens total",check:e=>e.totalTokens>=1e7},{id:"first-promotion",name:"First Promotion",icon:"⭐",description:"Any role reached Lv.3",check:e=>e.roles.some(n=>n.level>=3)},{id:"senior-staff",name:"Senior Staff",icon:"🌟",description:"Any role reached Lv.5",check:e=>e.roles.some(n=>n.level>=5)},{id:"master-class",name:"Master Class",icon:"👑",description:"Any role reached Lv.10",check:e=>e.roles.some(n=>n.level>=10)},{id:"full-house",name:"Full House",icon:"🏠",description:"All roles Lv.5+",check:e=>e.roleCount>=3&&e.roles.every(n=>n.level>=5)},{id:"first-launch",name:"First Launch",icon:"🚀",description:"Completed Chapter 2 — gave your first order",check:e=>{var n;return((n=e.completedQuests)==null?void 0:n.includes("ch2-q2"))??!1}},{id:"team-builder",name:"Team Builder",icon:"🏗️",description:"Completed Chapter 4 — dispatched your first wave",check:e=>{var n;return((n=e.completedQuests)==null?void 0:n.includes("ch4-q2"))??!1}},{id:"explorer",name:"Explorer",icon:"🔍",description:"Completed Chapter 5 — customized a character",check:e=>{var n;return((n=e.completedQuests)==null?void 0:n.includes("ch5-q2"))??!1}},{id:"interior-designer",name:"Interior Designer",icon:"🎨",description:"Completed Chapter 7 — bought premium furniture",check:e=>{var n;return((n=e.completedQuests)==null?void 0:n.includes("ch7-q2"))??!1}},{id:"tycoon-master",name:"Tycoon Master",icon:"🎯",description:"Completed all 10 chapters",check:e=>{var n;return((n=e.completedQuests)==null?void 0:n.includes("ch10-q3"))??!1}}];function vy(e){return y8.filter(n=>n.check(e))}const wy={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function b8({importJob:e,onImportDone:n}){var ac,Li,lc,ic,sc;const[a,i]=v.useState([]),[o,u]=v.useState([]),[d,h]=v.useState([]),[m,f]=v.useState([]),[x,g]=v.useState([]),[w,b]=v.useState([]),[j,k]=v.useState("TYCONO"),[N,C]=v.useState(!0),[E,B]=v.useState(null),[R,$]=v.useState({type:"none"}),[_,L]=v.useState(null),[U,Q]=v.useState(null),[D,I]=v.useState([]),[H,q]=v.useState(!1),[ue,te]=v.useState(!1),[Y,se]=v.useState([]),[J,Z]=v.useState([]),[A,F]=v.useState(0),[W,T]=v.useState(!1),[de,xe]=v.useState({}),[ye,Le]=v.useState("ceo"),[Xe,Ye]=v.useState(null),[ht,tt]=v.useState(!1),[Je,Ne]=v.useState(!1),[De,yt]=v.useState({}),ct=v.useRef({}),[pt,jt]=v.useState(!1),[Wt,Ft]=v.useState(null),[Nt,$n]=v.useState({}),[me,Se]=v.useState([]),Ee=v.useMemo(()=>{const M={};for(const V of me)M[V.roleId]=V;return M},[me]),[G,ce]=v.useState([]),[ne,ke]=v.useState(0),[ve,ze]=v.useState(qg()),_e=v.useRef(qg()),Be=v.useRef(!1),He=v.useRef(-1),[rt,Ve]=v.useState(null),bt=v.useRef(null),[Re,Ie]=v.useState(void 0),[_t,Bt]=v.useState(!1);v.useEffect(()=>{ge.getStatus().then(M=>{Ie(M.engine),Bt(!!M.hasApiKey)}).catch(()=>{})},[]);const{getAppearance:Ot,setAppearance:fn,resetAppearance:wn,theme:P,setTheme:Oe,speechSettings:nt,setSpeechSettings:Qt,language:we,setLanguage:kt}=b6(),[ln,sn]=v.useState(null),[,re]=v.useState("character"),Ae=k6(),[We,Et]=v.useState(!1),[kn,ur]=v.useState(!1),[xn,gn]=v.useState(!1),[dr,sl]=v.useState(!1),[Ju,Fs]=v.useState(!1),[Vo,Ta]=v.useState(!1),[Ti,ca]=v.useState(!1),[Vn,Wl]=v.useState(null);v.useEffect(()=>{Ae.refresh()},[]),v.useEffect(()=>{const M=V=>{(V.metaKey||V.ctrlKey)&&V.key==="s"&&(V.preventDefault(),Et(!0))};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[]),v.useEffect(()=>{if(!dr)return;let M=!1;const V=async()=>{try{const he=await ge.getGitStatus();M||Wl(he)}catch{}};V();const ae=setInterval(V,1e4);return()=>{M=!0,clearInterval(ae)}},[dr]);const[jr,jn]=v.useState(null),[Fa,Ma]=v.useState(null),[fr,Ra]=v.useState([]),[ol,Ms]=v.useState(!1),Rs=v.useRef(!1),zs=v.useRef(null);let Gl=v.useRef(0);const Vl=v.useRef(new Set),Pr=v.useRef(Date.now()),Dn=(M,V,ae)=>{const he={id:Gl.current++,type:M,text:V,detail:ae};Ra(je=>[...je,he])};v.useEffect(()=>{var M;ol&&((M=zs.current)==null||M.scrollIntoView({behavior:"smooth"}))},[fr,ol]),v.useEffect(()=>{e&&(Rs.current||(Rs.current=!0,Ma("Scanning knowledge sources..."),Ra([{id:0,type:"scan",text:"Starting knowledge import..."}]),Gl.current=1,fetch("/api/setup/import-knowledge",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:e.paths,companyRoot:e.companyRoot})}).then(async M=>{var je;const V=(je=M.body)==null?void 0:je.getReader();if(!V)return;const ae=new TextDecoder;let he="";for(;;){const{done:$e,value:It}=await V.read();if($e)break;he+=ae.decode(It,{stream:!0});const ut=he.split(`
|
|
92
|
-
`);he=ut.pop()||"";let Pe="";for(const Ze of ut)if(Ze.startsWith("event: "))Pe=Ze.slice(7).trim();else if(Ze.startsWith("data: ")&&Pe){try{const dt=JSON.parse(Ze.slice(6));switch(Pe){case"scanning":Ma(`Scanning: ${dt.path} (${dt.fileCount} files)`),Dn("scan",`Found ${dt.fileCount} files`,dt.path);break;case"processing":jn({index:dt.index,total:dt.total}),Ma(`Importing knowledge... (${dt.index}/${dt.total})`),Dn("process",`Processing: ${dt.file}`,`${dt.index} / ${dt.total}`);break;case"created":Dn("created",dt.title,dt.summary);break;case"skipped":Dn("process",`Skipped: ${dt.file}`,dt.reason);break;case"done":Ma(null),jn(null),Dn("done",`Import complete! ${dt.created} created, ${dt.skipped} skipped.`),xt(`Knowledge import complete! ${dt.created} documents imported.`,"#2E7D32"),n==null||n();break;case"error":Ma(null),jn(null),Dn("error",dt.message),xt(`Import failed: ${dt.message}`,"#B71C1C"),n==null||n();break}}catch{}Pe=""}}}).catch(M=>{Ma(null),Dn("error",M.message),xt(`Import error: ${M.message}`,"#B71C1C"),n==null||n()})))},[e]);const[Zr,ua]=v.useState("iso"),Jr=v.useRef("iso"),[Or,Tn]=v.useState({type:"dashboard"}),[Ko,hr]=v.useState(typeof window<"u"?window.innerWidth:1200);v.useEffect(()=>{const M=()=>hr(window.innerWidth);return window.addEventListener("resize",M),()=>window.removeEventListener("resize",M)},[]);const Kl=Ko<1024,[Sr,da]=v.useState(!1),[mr,Qo]=v.useState(560),[Ln,Gt]=v.useState([]),[fa,Xn]=v.useState(null),[ea,ta]=v.useState(null),{sendMessage:ed}=x6(),Fi=v.useRef(new Map);v.useEffect(()=>{Promise.all([ge.getCompany().then(M=>{k(M.name),i(M.roles)}),ge.getOrgTree().then(M=>{xe(M.nodes),Le(M.root)}).catch(()=>{}),ge.getCostSummary().then(M=>$r(Yh(M.byRole))).catch(()=>{})]).catch(M=>B(`Failed to load: ${M.message}`)).finally(()=>C(!1)),ge.getProjects().then(u).catch(()=>{}),ge.getStandups().then(h).catch(()=>{}),ge.getWaves().then(f).catch(()=>{}),ge.getDecisions().then(g).catch(()=>{}),ge.getKnowledge().then(b).catch(()=>{}),ge.getQuestProgress().then(M=>{const V=Yg(M);V.activeChapter!==M.activeChapter&&ge.saveQuestProgress(V).catch(()=>{}),ze(V),_e.current=V,Be.current=!0,ge.getCoins().then(ae=>{var he;ae.totalEarned===0?ge.migrateCoins(((he=V.completedQuests)==null?void 0:he.length)??0).then(je=>ke(je.balance)).catch(()=>{}):ke(ae.balance)}).catch(()=>{})}).catch(()=>{Be.current=!0})},[]),v.useEffect(()=>{if(He.current===-1){He.current=o.length;return}o.length>He.current&&Pt({type:"project_created"}),He.current=o.length},[o.length]);const Ql=v.useRef(!1);v.useEffect(()=>{if(!(!Be.current||a.length===0||Ql.current)){Ql.current=!0;for(const M of a)Pt({type:"role_hired",condition:{roleId:M.id,roleCount:a.length}})}},[a.length]),v.useEffect(()=>{ge.getSessions().then(M=>{const V=M.filter(he=>he.source!=="wave");if(V.length>0){const he=V.map($e=>({...$e,messages:[]}));Gt(he);const je=he.find($e=>$e.status==="active")??he[0];Xn(je.id),_a()}const ae=M.filter(he=>he.source==="wave").map(he=>he.id);ae.length>0&&ge.deleteSessions(ae).catch(()=>{})}).catch(M=>{console.error("Failed to load sessions",M)})},[]),v.useEffect(()=>{const M=()=>{fetch("/api/exec/status").then(ae=>ae.json()).then(ae=>{$n(ae.statuses??{}),Se(ae.activeExecutions??[])}).catch(()=>{})};M();const V=setInterval(M,3e3);return()=>clearInterval(V)},[]);const tr=v.useMemo(()=>{const M={...Nt};if(ea){const V=Ln.find(ae=>ae.id===ea);V&&(M[V.roleId]="working")}return M},[Nt,ea,Ln]);v.useEffect(()=>{R.type==="role"?ge.getRole(R.roleId).then(L).catch(console.error):L(null)},[R]);const na=()=>$({type:"none"}),Mi=async(M,V)=>{const ae=await ge.updateDecision(M,V);g(he=>he.map(je=>je.id===M?ae:je))},za=async M=>{await ge.deleteDecision(M),g(V=>V.filter(ae=>ae.id!==M))},Fn=M=>{$(M),da(!1),te(!1)},_a=()=>{da(!0),$({type:"none"}),te(!1)},cl=()=>{te(!0),da(!1),$({type:"none"})},Po=async(M,V)=>{const ae=a.find(je=>je.id===M),he=(U==null?void 0:U.mode)==="ask";Q(null);try{const je=await ge.startJob({type:"assign",roleId:M,task:V,readOnly:he}),$e=je.jobId,It=je.sessionId??`job-${$e}`,ut=wy[M]??"#666",Pe=`${M.toUpperCase()} · ${(ae==null?void 0:ae.name)??M}`;T(!1),I([{sessionId:It,jobId:$e,title:Pe,color:ut}]),Pt({type:"task_executed",condition:{roleId:M}}),Zt.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO → ${(ae==null?void 0:ae.name)??M}] ${he?"Ask":"Assign"}: ${V}`,type:"dispatch",targetRoleId:M})}catch(je){xt(`Failed to start job: ${je instanceof Error?je.message:"unknown"}`,"#C62828")}},Pl=v.useRef(0),xt=(M,V)=>{const ae=++Pl.current;ce(he=>[...he,{id:ae,message:M,color:V}]),setTimeout(()=>ce(he=>he.filter(je=>je.id!==ae)),4e3)},_s=M=>{bt.current&&clearTimeout(bt.current),Ve(M),bt.current=setTimeout(()=>Ve(null),8e3)},Pt=M=>{if(!Be.current)return;let V=_e.current;const ae=av(V);let he=0;const je=[];for(const It of ae){if(!SE(It,M))continue;const{progress:ut,quest:Pe}=kE(V,It.id);Pe&&(V=ut,he+=Pe.rewards.coins??0,je.push(Pe.title))}if(je.length===0)return;V=Yg(V),_e.current=V,ze(V);const $e=he>0?` 💰 +${he.toLocaleString()}`:"";je.length===1?xt(`📋 Quest complete: ${je[0]}${$e}`,"#7C3AED"):xt(`📋 ${je.length} quests complete!${$e}`,"#7C3AED"),Ve(null),ge.saveQuestProgress(V).catch(()=>{}),he>0&&ge.earnCoins(he,`quests: ${je.length}`,je.join(",")).then(It=>ke(It.balance)).catch(()=>{})};v.useEffect(()=>{if(!rt)return;const M=document.querySelector(`[data-quest-target="${rt}"]`);if(!M)return;M.classList.add("quest-spotlight");const V=()=>{M.classList.remove("quest-spotlight"),Ve(null),bt.current&&clearTimeout(bt.current)};return M.addEventListener("click",V,{once:!0}),()=>{M.classList.remove("quest-spotlight"),M.removeEventListener("click",V)}},[rt]);const $r=M=>{var ae,he;const V=ct.current;for(const[je,$e]of Object.entries(M)){const It=((ae=V[je])==null?void 0:ae.level)??0;if(It>0&&$e.level>It){const ut=((he=a.find(Pe=>Pe.id===je))==null?void 0:he.name)??je.toUpperCase();xt(`${ut} leveled up to Lv.${$e.level}!`,"#7C3AED")}}ct.current=M,yt(M)};v.useEffect(()=>{const M={roles:Object.entries(De).map(([je,$e])=>({id:je,level:$e.level,totalTokens:$e.totalTokens})),totalTokens:Object.values(De).reduce((je,$e)=>je+$e.totalTokens,0),roleCount:a.length,completedQuests:ve.completedQuests},V=vy(M),ae=new Set(V.map(je=>je.id));if(Date.now()-Pr.current>5e3){const je=Vl.current;for(const $e of V)je.has($e.id)||xt(`${$e.icon} Badge earned: ${$e.name}!`,"#D4A017")}Vl.current=ae},[De,a.length,ve.completedQuests]);const Ba=v.useMemo(()=>wE(ve),[ve]),Ri=()=>{var V;const M=D[D.length-1];M&&(xt(`${M.title} completed`,M.color),Zt.pushMessage({ts:Date.now(),roleId:((V=M.title.split(" · ")[0])==null?void 0:V.toLowerCase())??"unknown",text:`[${M.title}] Job completed`,type:"dispatch"})),ge.getStandups().then(h).catch(console.error),ge.getCompany().then(ae=>i(ae.roles)).catch(console.error),ge.getCostSummary().then(ae=>$r(Yh(ae.byRole))).catch(()=>{})},ul=v.useRef(new Map),zi=M=>{if(ul.current.has(M))return;const V=new AbortController;ul.current.set(M,V),ta(ae=>ae??M),fetch(`/api/sessions/${M}/stream?from=0`,{signal:V.signal}).then(async ae=>{var It,ut;if(!ae.ok||!ae.body)return;const he=ae.body.getReader(),je=new TextDecoder;let $e="";for(;;){const{done:Pe,value:Ze}=await he.read();if(Pe)break;$e+=je.decode(Ze,{stream:!0});const dt=$e.split(`
|
|
93
|
-
`);$e=dt.pop()??"";let St="";for(const ti of dt)if(ti.startsWith("event: "))St=ti.slice(7).trim();else if(ti.startsWith("data: ")){try{const Kn=JSON.parse(ti.slice(6));St==="stream:end"?(Gt(st=>st.map($t=>{if($t.id!==M)return $t;const Nn=$t.messages.map(on=>on.status==="streaming"?{...on,status:"done"}:on);return{...$t,messages:Nn}})),ta(st=>st===M?null:st),ul.current.delete(M)):St==="activity"&&(Kn.type==="text"&&((It=Kn.data)!=null&&It.text)?Gt(st=>st.map($t=>{if($t.id!==M)return $t;const Nn=[...$t.messages],on=Nn[Nn.length-1];return(on==null?void 0:on.from)==="role"&&on.status==="streaming"&&(Nn[Nn.length-1]={...on,content:on.content+Kn.data.text}),{...$t,messages:Nn}})):Kn.type==="thinking"&&((ut=Kn.data)!=null&&ut.text)?Gt(st=>st.map($t=>{if($t.id!==M)return $t;const Nn=[...$t.messages],on=Nn[Nn.length-1];return(on==null?void 0:on.from)==="role"&&on.status==="streaming"&&(Nn[Nn.length-1]={...on,thinking:(on.thinking??"")+Kn.data.text}),{...$t,messages:Nn}})):(Kn.type==="job:done"||Kn.type==="job:error")&&(Gt(st=>st.map($t=>{if($t.id!==M)return $t;const Nn=$t.messages.map(on=>on.status==="streaming"?{...on,status:Kn.type==="job:done"?"done":"error"}:on);return{...$t,messages:Nn}})),ta(st=>st===M?null:st),ul.current.delete(M)))}catch{}St=""}}}).catch(()=>{ul.current.delete(M),ta(ae=>ae===M?null:ae)})},dl=async(M,V,ae)=>{q(!1);try{const he=await ge.startJob({type:"wave",directive:M,targetRoles:V,...ae&&{attachments:ae}});Pt({type:"wave_dispatched"});const je=he.jobIds??(he.jobId?[he.jobId]:[]),$e=ye&&de[ye]?de[ye].children.map(st=>a.find($t=>$t.id===st)).filter(st=>!!st):a.filter(st=>st.level==="c-level"),It=V?$e.filter(st=>V.includes(st.id)):$e,ut=he.waveId??`wave-${Date.now()}`,Pe=he.sessionIds??[],Ze=je.map((st,$t)=>{var Nn,on;return{jobId:st,roleId:((Nn=It[$t])==null?void 0:Nn.id)??`role-${$t}`,roleName:((on=It[$t])==null?void 0:on.name)??`C-Level ${$t+1}`,sessionId:Pe[$t]??`wave-${st}`}});Zt.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO WAVE] "${M}" → ${Ze.map(st=>st.roleName).join(", ")}`,type:"dispatch"});const dt={id:ut,directive:M,rootJobs:Ze,startedAt:Date.now(),sessionIds:Pe};se(st=>[dt,...st]),cl();const St=new Date().toISOString(),Kn=(Pe.length>0?Ze.map((st,$t)=>({id:Pe[$t]??`wave-${st.jobId}`,roleId:st.roleId,title:`WAVE: ${st.roleName}`,mode:"do",source:"wave",jobId:st.jobId,messages:[{id:`msg-wave-${st.jobId}-ceo`,from:"ceo",content:M,type:"directive",status:"done",timestamp:St}],status:"active",createdAt:St,updatedAt:St})):Ze.map(st=>({id:`wave-${st.jobId}`,roleId:st.roleId,title:`WAVE: ${st.roleName}`,mode:"do",source:"wave",jobId:st.jobId,messages:[{id:`msg-wave-${st.jobId}-ceo`,from:"ceo",content:M,type:"directive",status:"done",timestamp:St}],status:"active",createdAt:St,updatedAt:St}))).map((st,$t)=>({...st,messages:[...st.messages,{id:`msg-wave-${Ze[$t].jobId}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:St,jobId:Ze[$t].jobId}]}));Gt(st=>[...Kn,...st]),Kn.length>0&&(Xn(Kn[0].id),_a());for(const st of Kn)zi(st.id)}catch(he){xt(`Failed to start wave: ${he instanceof Error?he.message:"unknown"}`,"#C62828")}},ha=()=>{ge.getWaves().then(f).catch(console.error),ge.getStandups().then(h).catch(console.error)},Wn=()=>{ge.getCompany().then(M=>i(M.roles)).catch(console.error),ge.getOrgTree().then(M=>{xe(M.nodes),Le(M.root)}).catch(console.error),ge.getCostSummary().then(M=>$r(Yh(M.byRole))).catch(()=>{})},Oa=async(M,V)=>{await ge.createRole(M),fn(M.id,V),Wn(),xt(`${M.name} hired!`,"#2E7D32"),Pt({type:"role_hired",condition:{roleId:M.id,roleCount:a.length+1}})},_i=async M=>{var V;await ge.deleteRole(M),Wn(),Gt(ae=>ae.filter(he=>he.roleId!==M)),fa&&((V=Ln.find(ae=>ae.id===fa))==null?void 0:V.roleId)===M&&Xn(null),Ft(null),xt(`${M.toUpperCase()} removed`,"#B71C1C")},$a=async(M,V)=>{await ge.updateRole(M,V),Wn(),R.type==="role"&&R.roleId===M&&ge.getRole(M).then(L).catch(console.error),V.name&&xt(`${M.toUpperCase()} renamed to "${V.name}"`,"#1565C0"),V.persona!==void 0&&(xt(`${M.toUpperCase()} persona updated`,"#2E7D32"),Pt({type:"persona_updated"}))},td=M=>{_a(),Pt({type:"terminal_opened"})},Bi=async M=>{try{const V=await ge.createSession(M,"talk");Gt(ae=>[V,...ae]),Xn(V.id),_a()}catch(V){console.error("Failed to create session",V),xt(`Failed to create session: ${V instanceof Error?V.message:"API unreachable"}`,"#B71C1C")}},Oi=async M=>{try{const V=await ge.createSession(M,"talk");Gt(ae=>[V,...ae]),Xn(V.id)}catch(V){console.error("Failed to create session",V),xt(`Failed to create session: ${V instanceof Error?V.message:"API unreachable"}`,"#B71C1C")}},Zl=async M=>{const V=Ee[M],ae=(V==null?void 0:V.jobId)??(V==null?void 0:V.id);if(ae&&tr[M]==="working"){const je=a.find(Ze=>Ze.id===M),$e=wy[M]??"#666",It=`${M.toUpperCase()} · ${(je==null?void 0:je.name)??M}`,ut=Ln.find(Ze=>Ze.roleId===M&&Ze.status==="active"),Pe=(ut==null?void 0:ut.id)??`job-${ae}`;I([{sessionId:Pe,jobId:ae,title:It,color:$e}]),T(!1);return}const he=Ln.find(je=>je.roleId===M);if(he)Xn(he.id),Zt.setActiveChannelId(null);else try{const je=await ge.createSession(M,"talk");Gt($e=>[je,...$e]),Xn(je.id),Zt.setActiveChannelId(null)}catch(je){console.error("Failed to create session",je)}_a()},Jl=async M=>{const V=Ln.find(ae=>ae.id===M);if((V==null?void 0:V.source)==="wave"){if(V.jobId){const ae=Fi.current.get(V.jobId);ae&&(ae.abort(),Fi.current.delete(V.jobId))}Gt(ae=>{var je;const he=ae.filter($e=>$e.id!==M);return fa===M&&Xn(((je=he[0])==null?void 0:je.id)??null),he});return}try{await ge.deleteSession(M),Gt(ae=>{var je;const he=ae.filter($e=>$e.id!==M);return fa===M&&Xn(((je=he[0])==null?void 0:je.id)??null),he})}catch(ae){console.error("Failed to delete session",ae),xt(`Failed to close session: ${ae instanceof Error?ae.message:"API error"}`,"#B71C1C")}},Bs=async()=>{try{const{ids:M}=await ge.deleteEmptySessions();if(M.length===0)return;Gt(V=>{var he;const ae=V.filter(je=>!M.includes(je.id));return fa&&M.includes(fa)&&Xn(((he=ae[0])==null?void 0:he.id)??null),ae}),xt(`Cleared ${M.length} empty session${M.length!==1?"s":""}`,"#2E7D32")}catch(M){xt(`Failed to clear empty sessions: ${M instanceof Error?M.message:"API error"}`,"#B71C1C")}},Zo=async()=>{if(!confirm("Close all sessions? This cannot be undone."))return;const M=Ln.filter(V=>V.source!=="wave").map(V=>V.id);for(const V of Ln)if(V.source==="wave"&&V.jobId){const ae=Fi.current.get(V.jobId);ae&&(ae.abort(),Fi.current.delete(V.jobId))}try{M.length>0&&await ge.deleteSessions(M),Gt([]),Xn(null),xt("All sessions closed","#2E7D32")}catch(V){xt(`Failed to close sessions: ${V instanceof Error?V.message:"API error"}`,"#B71C1C")}},ma=(M,V)=>{Gt(ae=>ae.map(he=>{if(he.id!==M)return he;const je=[...he.messages],$e=je[je.length-1];if($e&&$e.from==="role"&&$e.status==="streaming"){const It=[...$e.streamEvents??[],V];je[je.length-1]={...$e,streamEvents:It}}return{...he,messages:je}}))},La=(M,V,ae,he)=>{const je={id:`msg-${Date.now()}-ceo`,from:"ceo",content:V,type:ae==="do"?"directive":"conversation",status:"done",timestamp:new Date().toISOString(),attachments:he},$e={id:`msg-${Date.now()+1}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:new Date().toISOString(),streamEvents:[]};Gt(ut=>ut.map(Pe=>Pe.id===M?{...Pe,messages:[...Pe.messages,je,$e],updatedAt:new Date().toISOString()}:Pe));const It=Ln.find(ut=>ut.id===M);ae==="talk"?Pt({type:"talk_mode_used"}):ae==="do"&&(Pt({type:"do_mode_used"}),It&&Pt({type:"task_executed",condition:{roleId:It.roleId}})),ta(M),ed(M,V,ae,{onThinking:ut=>{Gt(Pe=>Pe.map(Ze=>{if(Ze.id!==M)return Ze;const dt=[...Ze.messages],St=dt[dt.length-1];return St&&St.from==="role"&&St.status==="streaming"&&(dt[dt.length-1]={...St,thinking:(St.thinking??"")+ut}),{...Ze,messages:dt}})),ma(M,{type:"thinking",timestamp:Date.now(),text:ut})},onText:ut=>{Gt(Pe=>Pe.map(Ze=>{if(Ze.id!==M)return Ze;const dt=[...Ze.messages],St=dt[dt.length-1];return St&&St.from==="role"&&St.status==="streaming"&&(dt[dt.length-1]={...St,content:St.content+ut}),{...Ze,messages:dt}}))},onToolUse:(ut,Pe)=>{ma(M,{type:"tool",timestamp:Date.now(),toolName:ut,toolInput:Pe})},onDispatch:(ut,Pe)=>{ma(M,{type:"dispatch",timestamp:Date.now(),roleId:ut,task:Pe})},onDispatchProgress:(ut,Pe,Ze)=>{var dt;Pe==="tool"?ma(M,{type:"dispatch:progress",timestamp:Date.now(),roleId:ut,progressType:"tool",toolName:Ze.name,toolInput:Ze.input}):Pe==="thinking"?ma(M,{type:"dispatch:progress",timestamp:Date.now(),roleId:ut,progressType:"thinking",text:Ze.text}):Pe==="text"?ma(M,{type:"dispatch:progress",timestamp:Date.now(),roleId:ut,progressType:"text",text:(dt=Ze.text)==null?void 0:dt.slice(-200)}):(Pe==="done"||Pe==="error")&&ma(M,{type:"dispatch:progress",timestamp:Date.now(),roleId:ut,progressType:Pe})},onTurn:ut=>{ma(M,{type:"turn",timestamp:Date.now(),turn:ut})},onDone:()=>{Gt(ut=>ut.map(Pe=>{if(Pe.id!==M)return Pe;const Ze=Pe.messages.map(St=>St.status==="streaming"?{...St,status:"done"}:St),dt=Pe.messages.length<=2?V.slice(0,40).replace(/\n/g," "):Pe.title;return{...Pe,messages:Ze,title:dt}})),ta(null)},onError:ut=>{Gt(Pe=>Pe.map(Ze=>{if(Ze.id!==M)return Ze;const dt=Ze.messages.map(St=>St.status==="streaming"?{...St,status:"error",content:St.content||ut}:St);return{...Ze,messages:dt}})),ta(null)}},he)},ei=(M,V)=>{Gt(ae=>ae.map(he=>he.id===M?{...he,mode:V}:he)),ge.updateSession(M,{mode:V}).catch(console.error)},nd=new Date().toISOString().slice(0,10),Jo=o[0],ec={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},rd=M=>{const V=ec[M];if(!V)return"";for(const ae of d){const he=ae.content,je=he.indexOf(`## ${V}`);if(je===-1)continue;const $e=he.indexOf(`
|
|
94
|
-
## `,je+10),ut=($e===-1?he.slice(je):he.slice(je,$e)).split(`
|
|
95
|
-
`).filter(Pe=>Pe.trim().length>0);for(const Pe of ut){const Ze=Pe.replace(/^#+\s*/,"").replace(/\*\*/g,"").replace(/^[-*]\s+/,"").trim();if(!(Ze.startsWith("|")||Ze.startsWith("{")||Ze.startsWith("[")||Ze.startsWith("```")||Ze.startsWith("---")||Ze.includes("Journal")||Ze.includes("(c-level)")||Ze.includes("(team-lead)")||Ze.includes("(member)")||/^(CEO |작업 결과|생성\/수정|APPROVAL|비고|상황 보고|태스크$)/.test(Ze))&&Ze.length>15&&Ze.length<120)return Ze}}return""},tc=M=>{const V=ec[M];if(!V)return"";for(const ae of d){const he=ae.content,je=he.indexOf(`## ${V}`);if(je===-1)continue;const $e=he.indexOf(`
|
|
96
|
-
## `,je+10),ut=($e===-1?he.slice(je):he.slice(je,$e)).replace(/^## .+\n/,"").trim();if(ut)return ut.slice(0,1500)}return""},Zt=B6();v.useEffect(()=>{a.length>0&&Zt.syncDefaultMembers(a)},[a]);const $i=F6({roles:a,roleStatuses:Nt,activeExecs:me,getStandupSpeech:rd}),nc=I6({roles:a,roleStatuses:Nt,activeExecs:me,channels:Zt.channels,relationships:$i.relationships,pushMessage:Zt.pushMessage,speechSettings:nt,engineType:Re,hasApiKey:_t}),rc=v.useCallback((M,V)=>{Zt.pushMessage({ts:Date.now(),roleId:"ceo",text:V,type:"chat",channelId:M}),nc.triggerCeoReaction(M)},[Zt,nc]);return N?l.jsxs("div",{className:"h-screen flex flex-col bg-[var(--floor-light)]",style:{fontFamily:"var(--pixel-font)"},children:[(Fa||fr.length>0)&&l.jsxs("div",{className:"shrink-0 z-[44]",children:[l.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:()=>Ms(M=>!M),children:[Fa?l.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):l.jsx("span",{className:"shrink-0",children:"✅"}),l.jsx("span",{className:"flex-1",children:Fa||"Knowledge import finished"}),jr&&l.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:l.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${jr.index/jr.total*100}%`,background:"#fff"}})}),l.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:ol?"▲":"▼"})]}),ol&&l.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:[fr.map(M=>l.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[l.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[M.type==="scan"&&"🔍",M.type==="process"&&"⚙️",M.type==="created"&&"✅",M.type==="done"&&"🎉",M.type==="error"&&"❌"]}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{style:{color:M.type==="error"?"#EF4444":M.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:M.text}),M.detail&&l.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:M.detail})]})]},M.id)),l.jsx("div",{ref:zs})]})]}),l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"text-4xl mb-3",children:"🏢"}),l.jsx("div",{className:"text-gray-600 font-semibold text-xs",children:"LOADING OFFICE..."})]})})]}):E?l.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:l.jsxs("div",{className:"text-center max-w-md",style:{fontFamily:"var(--pixel-font)"},children:[l.jsx("div",{className:"text-4xl mb-3",children:"⚠️"}),l.jsx("div",{className:"text-gray-800 font-semibold mb-2 text-xs",children:"CONNECTION ERROR"}),l.jsx("div",{className:"text-gray-500 text-xs mb-4",children:E}),l.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"})]})}):l.jsxs("div",{className:"flex flex-col",style:{height:"100dvh",fontFamily:"var(--pixel-font)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-5 py-2 text-white text-sm shrink-0 z-[45]",style:{background:"var(--bar-bg, var(--hud-bg))",borderBottom:"3px solid var(--bar-border, var(--pixel-border))"},children:[l.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:["🏢"," ",l.jsx("span",{style:{color:"var(--bar-text, var(--terminal-text))"},children:j})]}),l.jsxs("div",{className:"flex gap-4 text-[11px] items-center",style:{color:"var(--bar-text, var(--terminal-text-secondary))"},children:[(()=>{const M=ne>=1e6?`${(ne/1e6).toFixed(1)}M`:ne>=1e3?`${(ne/1e3).toFixed(1)}K`:String(ne),V=me.length,ae=a.length>0?Math.round(V/a.length*100):0;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["💰",l.jsx("strong",{className:"text-[var(--active-green)]",children:M})]}),l.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["⚡",l.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:l.jsx("div",{className:"h-full",style:{width:`${ae}%`,background:"linear-gradient(90deg,#3b82f6,#60A5FA)"}})}),l.jsx("strong",{style:{color:"var(--bar-text, var(--terminal-text))"},children:ae})]})]})})(),l.jsxs("span",{className:"hidden sm:inline",children:["Roles: ",l.jsx("strong",{style:{color:"var(--bar-text, var(--terminal-text))"},children:a.length})]}),l.jsxs("span",{className:"hidden sm:inline",children:["Projects: ",l.jsx("strong",{style:{color:"var(--bar-text, var(--terminal-text))"},children:o.length})]}),me.length>0&&l.jsxs("span",{className:"text-amber-400",children:["Working: ",l.jsx("strong",{children:me.length})]}),(()=>{const M={roles:Object.entries(De).map(([ae,he])=>({id:ae,level:he.level,totalTokens:he.totalTokens})),totalTokens:Object.values(De).reduce((ae,he)=>ae+he.totalTokens,0),roleCount:a.length},V=vy(M);return V.length>0?l.jsx("div",{className:"hidden sm:flex",style:{gap:2,alignItems:"center",marginLeft:8,paddingLeft:8,borderLeft:"1px solid rgba(255,255,255,0.1)"},children:V.map(ae=>l.jsx("span",{title:`${ae.name}: ${ae.description}`,style:{fontSize:12,cursor:"default"},children:ae.icon},ae.id))}):null})(),l.jsx("span",{className:"px-1.5 py-0.5",style:{background:"var(--bar-border, var(--hud-bg-alt))",border:"1px solid var(--bar-border, var(--pixel-border))",color:"var(--bar-text, var(--terminal-text))"},children:nd})]})]}),(Fa||fr.length>0)&&l.jsxs("div",{className:"shrink-0 z-[44]",children:[l.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:()=>Ms(M=>!M),children:[Fa?l.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):l.jsx("span",{className:"shrink-0",children:"✅"}),l.jsx("span",{className:"flex-1",children:Fa||"Knowledge import finished"}),jr&&l.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:l.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${jr.index/jr.total*100}%`,background:"#fff"}})}),l.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:ol?"▲":"▼"})]}),ol&&l.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:[fr.map(M=>l.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[l.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[M.type==="scan"&&"🔍",M.type==="process"&&"⚙️",M.type==="created"&&"✅",M.type==="done"&&"🎉",M.type==="error"&&"❌"]}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{style:{color:M.type==="error"?"#EF4444":M.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:M.text}),M.detail&&l.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:M.detail})]})]},M.id)),l.jsx("div",{ref:zs}),fr.length===0&&l.jsx("div",{className:"px-5 py-4 text-center",style:{color:"var(--terminal-text-muted)"},children:"Waiting for events..."})]})]}),l.jsxs("div",{className:"flex-1 overflow-hidden flex relative",children:[l.jsx("div",{className:"flex-1 overflow-y-auto relative floor-grid",style:{background:"var(--floor-light)"},children:l.jsx(ZA,{roles:a,projects:o,waves:m,standups:d,decisions:x,roleStatuses:tr,activeExecs:me,onRoleClick:M=>Fn({type:"role",roleId:M}),onProjectClick:M=>Fn({type:"project",projectId:M}),onBulletinClick:()=>{Fn({type:"bulletin"}),Pt({type:"bulletin_visited"})},onDecisionsClick:()=>Fn({type:"decisions"}),onKnowledgeClick:()=>{Fn({type:"knowledge"}),Pt({type:"knowledge_visited"})},onSettingsClick:()=>{Ta(!0),Pt({type:"settings_visited"})},onThemeClick:()=>ca(M=>!M),onStatsClick:()=>{ur(!0),Pt({type:"stats_visited"})},knowledgeDocsCount:w.length,getRoleSpeech:$i.getSpeech,getAppearance:Ot,onHireClick:()=>jt(!0),onMascotClick:()=>Fn({type:"quest"}),roleLevels:De,language:we,coinBalance:ne,onCoinsSpent:M=>ke(M),onFurniturePlaced:(M,V)=>{Pt({type:"furniture_placed"}),V>0&&Pt({type:"furniture_purchased"})}})}),Sr&&l.jsx("div",{className:Kl?"absolute inset-0 z-50":"contents",children:l.jsx(Qg,{sessions:Ln,activeSessionId:fa,roles:a,streamingSessionId:ea,width:Kl?Ko:mr,onWidthChange:Kl?void 0:Qo,onSwitchSession:Xn,onCloseSession:Jl,onCreateSession:Bi,onClearEmpty:Bs,onCloseAll:Zo,onSendMessage:La,onModeChange:ei,onStopSession:M=>ge.abortSession(M).catch(()=>{}),onCloseTerminal:()=>da(!1),onMaximize:()=>{Jr.current="iso",Tn({type:"terminal"}),ua("pro")},chatChannels:Zt.channels,activeChatChannelId:Zt.activeChannelId,onSwitchChatChannel:Zt.setActiveChannelId,onCreateChatChannel:(...M)=>{const V=Zt.createChannel(...M);return Pt({type:"chat_channel_created"}),V},onDeleteChatChannel:Zt.deleteChannel,onUpdateChatMembers:Zt.updateMembers,onUpdateChatTopic:Zt.updateTopic,onSendChatMessage:rc,unreadChannels:Zt.unreadChannels})})]}),l.jsxs("div",{className:"flex items-center justify-between px-5 py-2 text-[10px] shrink-0 z-[45]",style:{background:"var(--bar-bg, var(--hud-bg))",color:"var(--bar-text, var(--terminal-text-secondary))",borderTop:"3px solid var(--bar-border, var(--pixel-border))"},children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:()=>ua("iso"),className:`view-toggle-btn ${Zr==="iso"?"active":""}`,children:"OFFICE"}),l.jsx("button",{onClick:()=>{Jr.current="iso",ua("pro")},className:`view-toggle-btn ${Zr==="pro"?"active":""}`,children:"PRO"}),l.jsx("span",{className:"mx-1",children:"|"}),l.jsxs("div",{style:{position:"relative"},children:[l.jsxs("button",{className:`theme-btn${Ti?" active":""}`,"data-quest-target":"theme-btn",onClick:()=>ca(M=>!M),title:"Office Theme",children:[((ac=ll[P])==null?void 0:ac.icon)??"","▾"]}),Ti&&l.jsx(f8,{theme:P,onThemeChange:M=>{Oe(M),Pt({type:"theme_changed"})},onClose:()=>ca(!1)})]}),l.jsx("button",{className:"theme-btn","data-quest-target":"settings-btn",onClick:()=>Ta(!0),title:"Settings",children:"⚙"}),l.jsx("span",{className:"mx-1",children:"|"}),l.jsxs("button",{"data-quest-target":"save-btn",onClick:()=>{Ae.state==="no-git"||Ae.state==="dirty"?Et(!0):sl(!0)},title:Ae.state==="dirty"?`${Ae.dirtyCount} unsaved — click to save`:"Git Status",style:{background:"none",border:"none",cursor:"pointer",fontSize:10,fontFamily:"var(--pixel-font)",color:"var(--bar-text, var(--terminal-text-muted))",display:"flex",alignItems:"center",gap:4},children:[l.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:Ae.state==="no-git"?"var(--terminal-text-muted)":Ae.state==="saving"||Ae.state==="dirty"?"var(--idle-amber)":Ae.state==="error"?"#EF5350":"var(--active-green)",animation:Ae.state==="saving"?"pulse 1s infinite":void 0}}),l.jsx("span",{style:{color:Ae.state==="dirty"?"var(--idle-amber)":"var(--bar-text, var(--terminal-text-muted))"},children:Ae.state==="no-git"?"No git":Ae.state==="saving"?"Saving...":Ae.state==="dirty"?`${Ae.dirtyCount} unsaved`:"Saved"}),Vn&&(Vn.worktrees.length>0||Vn.staleBranches.length>0)&&l.jsxs("span",{style:{color:Vn.worktrees.some(M=>M.status==="stale")?"#ff6b6b":Vn.worktrees.some(M=>M.status==="pending-merge")?"#FFB74D":"#4FC3F7"},children:["·"," ","📂"," ",Vn.worktrees.length," worktree",Vn.worktrees.length!==1?"s":"",Vn.staleBranches.length>0&&` · ⚠ ${Vn.staleBranches.length} branch${Vn.staleBranches.length!==1?"es":""}`]})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[Y.length>0&&!ue&&l.jsx("button",{onClick:()=>cl(),className:`px-3 py-1 font-black text-white cursor-pointer ${Je?"":"animate-pulse"}`,style:{background:Je?"#2E7D32":"#B71C1C",border:`2px solid ${Je?"#1b5e2088":"#7f121288"}`,fontFamily:"var(--pixel-font)",borderRadius:4},children:Je?"WAVE DONE":`WAVE (${Y.length})`}),Xe&&ht&&Y.length===0&&l.jsx("button",{onClick:()=>tt(!1),className:`px-3 py-1 font-black text-white cursor-pointer ${Je?"":"animate-pulse"}`,style:{background:Je?"#2E7D32":"#B71C1C",border:`2px solid ${Je?"#1b5e2088":"#7f121288"}`,fontFamily:"var(--pixel-font)",borderRadius:4},children:Je?"WAVE DONE":"WAVE"}),D.length>0&&W&&l.jsxs("button",{onClick:()=>T(!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?"..":""]}),l.jsxs("button",{onClick:()=>cl(),className:"wave-btn px-3 py-1 font-black text-white cursor-pointer","data-quest-target":"wave-btn",style:{background:"#B71C1C",border:"2px solid #7f1212",fontFamily:"var(--pixel-font)"},children:["🔴"," CEO WAVE"]}),l.jsx("button",{onClick:()=>Sr?da(!1):td(),className:"px-3 py-1 font-black cursor-pointer","data-quest-target":"terminal-btn",style:{background:Sr?"var(--terminal-bg)":"var(--hud-bg-alt)",color:"var(--terminal-text)",border:`2px solid ${Sr?"var(--terminal-border-hover)":"var(--pixel-border)"}`,fontFamily:"var(--pixel-font)"},children:"TERMINAL"})]})]}),Zr!=="pro"&&R.type==="role"&&_&&(()=>{var V,ae;const M=Ee[_.id];return l.jsx(Ag,{role:_,allRoles:a,recentActivity:tc(_.id),onClose:na,onFireRole:(he,je)=>{Ft({roleId:he,roleName:je}),na()},terminalWidth:Sr?mr:0,activeJobId:M==null?void 0:M.id,activeSessionId:(V=D.find(he=>he.jobId===(M==null?void 0:M.jobId)))==null?void 0:V.sessionId,activeTask:M==null?void 0:M.task,isWorking:tr[_.id]==="working",jobStartedAt:M==null?void 0:M.startedAt,onStopJob:he=>{const je=D.find($e=>$e.jobId===he);je&&ge.abortSession(je.sessionId)},sessions:Ln,streamingSessionId:ea,onCreateSessionSilent:Oi,onSendMessage:La,onFocusTerminal:Zl,onCustomize:he=>{const je=a.find($e=>$e.id===he);je&&(re("character"),sn(je))},onUpdateRole:$a,appearance:Ot(_.id),relationships:$i.relationships,roleLevel:(ae=De[_.id])==null?void 0:ae.level,onMaximize:()=>{Jr.current="iso",Tn({type:"role",roleId:_.id}),ua("pro")}})})(),Zr!=="pro"&&R.type==="project"&&Jo&&l.jsx(NE,{projectId:Jo.id,onClose:na,terminalWidth:Sr?mr:0}),Zr!=="pro"&&(R.type==="bulletin"||R.type==="decisions")&&l.jsx(Ug,{standups:d,waves:m,decisions:x,mode:R.type==="bulletin"?"bulletin":"decisions",onClose:na,onOpenWaveCenter:()=>cl(),onUpdateDecision:Mi,onDeleteDecision:za,terminalWidth:Sr?mr:0,onMaximize:()=>{Jr.current="iso",Tn({type:"operations"}),ua("pro")}}),Zr!=="pro"&&R.type==="quest"&&l.jsx(CE,{progress:ve,onClose:na,terminalWidth:Sr?mr:0,onQuestAction:M=>{var ae;na();const V=js.find(he=>he.id===M);(ae=V==null?void 0:V.hint)!=null&&ae.target&&_s(V.hint.target)}}),Zr!=="pro"&&R.type==="knowledge"&&l.jsx(Hg,{docs:w,onClose:na,onRefresh:()=>ge.getKnowledge().then(b).catch(()=>{}),terminalWidth:Sr?mr:0,initialDocId:R.docId,onMaximize:()=>{Jr.current="iso",Tn({type:"knowledge"}),ua("pro")}}),Zr==="pro"&&l.jsxs(h8,{roles:a,roleStatuses:tr,activeExecs:me,waves:m,knowledgeDocs:w,sessions:Ln,roleLevels:De,companyName:j,getAppearance:Ot,waveCenterWaves:Y,renderProfile:Or.type==="role"&&_?M=>{var ae,he;const V=Ee[_.id];return l.jsx(Ag,{role:_,allRoles:a,recentActivity:tc(_.id),onClose:M,onFireRole:(je,$e)=>{Ft({roleId:je,roleName:$e})},terminalWidth:0,activeJobId:V==null?void 0:V.id,activeSessionId:(ae=D.find(je=>je.jobId===(V==null?void 0:V.jobId)))==null?void 0:ae.sessionId,activeTask:V==null?void 0:V.task,isWorking:tr[_.id]==="working",jobStartedAt:V==null?void 0:V.startedAt,onStopJob:je=>{const $e=D.find(It=>It.jobId===je);$e&&ge.abortSession($e.sessionId)},sessions:Ln,streamingSessionId:ea,onCreateSessionSilent:Oi,onSendMessage:La,onFocusTerminal:()=>{},onCustomize:je=>{const $e=a.find(It=>It.id===je);$e&&(re("character"),sn($e))},onUpdateRole:$a,appearance:Ot(_.id),relationships:$i.relationships,roleLevel:(he=De[_.id])==null?void 0:he.level})}:void 0,channel:Or,onChannelChange:M=>{Tn(M),M.type==="role"?Fn({type:"role",roleId:M.roleId}):M.type==="knowledge"?Fn({type:"knowledge"}):M.type==="operations"?Fn({type:"bulletin"}):M.type==="wave"?te(!0):M.type==="terminal"?da(!0):($({type:"none"}),te(!1))},onClose:()=>{ua(Jr.current),$({type:"none"}),te(!1)},children:[Or.type==="dashboard"&&l.jsx(x8,{roles:a,roleStatuses:tr,activeExecs:me,waves:m,knowledgeDocs:w,roleLevels:De,getAppearance:Ot,onRoleClick:M=>Tn({type:"role",roleId:M}),onWaveClick:()=>Tn({type:"wave"}),onKnowledgeClick:()=>Tn({type:"knowledge"})}),Or.type==="terminal"&&l.jsx(Qg,{sessions:Ln,activeSessionId:fa,roles:a,streamingSessionId:ea,width:typeof window<"u"?window.innerWidth-240:1e3,onSwitchSession:Xn,onCloseSession:Jl,onCreateSession:Bi,onClearEmpty:Bs,onCloseAll:Zo,onSendMessage:La,onModeChange:ei,onStopSession:M=>ge.abortSession(M).catch(()=>{}),onCloseTerminal:()=>Tn({type:"dashboard"}),chatChannels:Zt.channels,activeChatChannelId:Zt.activeChannelId,onSwitchChatChannel:Zt.setActiveChannelId,onCreateChatChannel:(...M)=>{const V=Zt.createChannel(...M);return Pt({type:"chat_channel_created"}),V},onDeleteChatChannel:Zt.deleteChannel,onUpdateChatMembers:Zt.updateMembers,onUpdateChatTopic:Zt.updateTopic,onSendChatMessage:rc,unreadChannels:Zt.unreadChannels}),Or.type==="wave"&&l.jsx(Vg,{orgNodes:de,rootRoleId:ye,cLevelRoles:ye&&de[ye]?de[ye].children.map(M=>a.find(V=>V.id===M)).filter(M=>!!M):a.filter(M=>M.level==="c-level"),pastWaves:m,activeWaves:Y,onDispatch:(M,V)=>dl(M,V),onClose:()=>Tn({type:"dashboard"}),onDone:()=>{ha(),Ne(!0),xt("Wave complete","#2E7D32")},onSave:async(M,V,ae)=>{try{await ge.saveWave({directive:M,jobIds:V,waveId:ae==null?void 0:ae.waveId,sessionIds:ae==null?void 0:ae.sessionIds}),ha(),xt("Wave saved","#2E7D32")}catch(he){xt(`Save failed: ${he instanceof Error?he.message:"unknown"}`,"#C62828")}},onOpenKnowledgeDoc:M=>{Tn({type:"knowledge"}),Fn({type:"knowledge",docId:M}),ge.getKnowledge().then(b).catch(()=>{})},onRefreshWaves:()=>ge.getWaves().then(f).catch(()=>{}),terminalWidth:0,inline:!0,onOpenSaveModal:()=>Et(!0)}),Or.type==="knowledge"&&l.jsx(Hg,{docs:w,onClose:()=>Tn({type:"dashboard"}),onRefresh:()=>ge.getKnowledge().then(b).catch(()=>{}),terminalWidth:0}),Or.type==="operations"&&l.jsx(Ug,{standups:d,waves:m,decisions:x,mode:"bulletin",onClose:()=>Tn({type:"dashboard"}),onOpenWaveCenter:()=>Tn({type:"wave"}),onUpdateDecision:Mi,onDeleteDecision:za,terminalWidth:0}),Or.type==="role"&&(()=>{const M=Or.roleId,V=a.find(he=>he.id===M);if(!V)return null;const ae=Ln.find(he=>he.roleId===M);return ae?l.jsx(m8,{role:V,messages:ae.messages,isStreaming:ea===ae.id,mode:ae.mode,onModeChange:he=>ei(ae.id,he),onSend:(he,je,$e)=>La(ae.id,he,je,$e),isWave:ae.source==="wave"}):l.jsx(p8,{role:V,getAppearance:Ot,onSend:async(he,je)=>{try{const $e=await ge.createSession(M,"talk");Gt(It=>[$e,...It]),Xn($e.id),La($e.id,he,je)}catch($e){xt(`Failed to create session: ${$e instanceof Error?$e.message:"API unreachable"}`,"#B71C1C")}}})})()]}),U&&l.jsx(DE,{roleId:U.roleId,roleName:U.roleName,mode:U.mode,onClose:()=>Q(null),onExecutionStart:Po}),Xe&&!ht&&l.jsx(OE,{directive:Xe.directive,rootJobs:Xe.rootJobs,orgNodes:de,rootRoleId:ye,onClose:()=>{Ye(null),tt(!1),Ne(!1)},onMinimize:()=>tt(!0),onDone:()=>{ha(),Ne(!0),xt("Wave complete","#2E7D32")},onSave:async M=>{try{await ge.saveWave({directive:Xe.directive,jobIds:M}),ha(),xt("Wave saved to bulletin","#2E7D32")}catch(V){xt(`Save failed: ${V instanceof Error?V.message:"unknown"}`,"#C62828")}},onOpenKnowledgeDoc:M=>{Ye(null),tt(!1),Ne(!1),Fn({type:"knowledge",docId:M}),ge.getKnowledge().then(b).catch(()=>{})}}),ue&&l.jsx(Vg,{orgNodes:de,rootRoleId:ye,cLevelRoles:ye&&de[ye]?de[ye].children.map(M=>a.find(V=>V.id===M)).filter(M=>!!M):a.filter(M=>M.level==="c-level"),pastWaves:m,activeWaves:Y,onDispatch:(M,V)=>dl(M,V),onClose:()=>te(!1),onMaximize:()=>{Jr.current="iso",Tn({type:"wave"}),ua("pro")},onDone:()=>{ha(),Ne(!0),xt("Wave complete","#2E7D32")},onSave:async(M,V,ae)=>{try{await ge.saveWave({directive:M,jobIds:V,waveId:ae==null?void 0:ae.waveId,sessionIds:ae==null?void 0:ae.sessionIds}),ha(),xt("Wave saved","#2E7D32")}catch(he){xt(`Save failed: ${he instanceof Error?he.message:"unknown"}`,"#C62828")}},onOpenKnowledgeDoc:M=>{te(!1),Fn({type:"knowledge",docId:M}),ge.getKnowledge().then(b).catch(()=>{})},onRefreshWaves:()=>ge.getWaves().then(f).catch(()=>{}),terminalWidth:Sr?mr:0,onOpenSaveModal:()=>Et(!0)}),D.length>0&&!W&&(()=>{var ae;const M=D[D.length-1],V=J.length>1;return l.jsxs(l.Fragment,{children:[V&&D.length===1&&l.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:J.map((he,je)=>l.jsx("button",{onClick:()=>{F(je),I([{sessionId:he.sessionId,jobId:he.jobId??"",title:`CEO WAVE · ${he.roleId.toUpperCase()}`,color:"#B71C1C"}])},className:"px-3 py-1.5 text-xs font-bold rounded-t-lg cursor-pointer transition-colors",style:{background:A===je?"#B71C1C":"var(--terminal-bg)",color:A===je?"#fff":"var(--terminal-text-secondary)",border:`1px solid ${A===je?"#B71C1C":"var(--terminal-border)"}`,borderBottom:"none"},children:he.roleId.toUpperCase()},he.sessionId))}),l.jsx(TE,{sessionId:M.sessionId,title:D.length>1?M.title:V?`CEO WAVE · ${((ae=J[A])==null?void 0:ae.roleName)??""}`:M.title,color:M.color,variant:"modal",style:V&&D.length===1?{marginTop:28}:void 0,onClose:()=>{const he=Ln.filter(je=>je.source==="wave").map(je=>je.id);he.length>0&&(Gt(je=>je.filter($e=>$e.source!=="wave")),ge.deleteSessions(he).catch(()=>{})),I([]),Z([]),F(0),T(!1)},onMinimize:()=>T(!0),onDone:()=>{Ri(),ha()},onNavigateToJob:()=>{},onOpenKnowledgeDoc:he=>{I([]),Z([]),F(0),T(!1),Fn({type:"knowledge",docId:he}),ge.getKnowledge().then(b).catch(()=>{})}},M.sessionId)]})})(),D.length>1&&l.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[62] pointer-events-none",children:l.jsx("div",{className:"pointer-events-auto",children:l.jsxs("button",{onClick:()=>I(M=>M.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 ",(Li=D[D.length-2])==null?void 0:Li.title]})})}),H&&l.jsx(zE,{cLevelRoles:ye&&de[ye]?de[ye].children.map(M=>a.find(V=>V.id===M)).filter(M=>!!M):a.filter(M=>M.level==="c-level"),orgNodes:de,rootId:ye,onClose:()=>q(!1),onDispatch:(M,V)=>dl(M,V)}),pt&&l.jsx(GE,{existingRoles:a,onClose:()=>jt(!1),onHire:Oa,onStoreVisit:()=>Pt({type:"store_visited"}),questHint:((lc=Ba==null?void 0:Ba.hint)==null?void 0:lc.target)==="hire-btn"?{message:Ba.description,roleId:((ic=Ba.trigger.condition)==null?void 0:ic.roleId)??void 0}:void 0}),Wt&&l.jsx(QE,{roleId:Wt.roleId,roleName:Wt.roleName,onClose:()=>Ft(null),onConfirm:_i}),ln&&l.jsx(JA,{role:ln,appearance:Ot(ln.id),onSave:M=>{fn(ln.id,M),Pt({type:"accessory_changed"})},onReset:()=>wn(ln.id),onClose:()=>{sn(null),re("character")},theme:P,onThemeChange:M=>{Oe(M),Pt({type:"theme_changed"})},onUpdateName:async(M,V)=>{await $a(M,{name:V})},initialTab:"character",characterOnly:!0,speechSettings:nt,onSpeechSettingsChange:Qt,language:we,onLanguageChange:kt,roleLevel:(sc=De[ln.id])==null?void 0:sc.level}),We&&(()=>{const M=a.find(V=>V.id==="cto")??a.find(V=>V.level==="c-level")??a[0];return l.jsx(n8,{status:Ae.status,history:Ae.history,onClose:()=>Et(!1),onSave:async V=>{const ae=await Ae.save(V);return ae!=null&&ae.ok&&Pt({type:"save_committed"}),ae},onLoadHistory:Ae.loadHistory,onRestore:Ae.restore,saving:Ae.state==="saving",repo:Ae.repo,onRepoChange:Ae.setRepo,syncInfo:Ae.syncInfo,onPull:Ae.pull,pulling:Ae.pulling,onRefresh:Ae.refresh,onInitGit:Ae.initGit,delegateRoleName:(M==null?void 0:M.name)??(M==null?void 0:M.id),onDelegate:M?async V=>{Et(!1);try{const ae=await ge.createSession(M.id,"do");Gt(je=>[ae,...je]),Xn(ae.id),_a();const he=`Review the following unsaved changes, write a proper commit message, save (git add + commit), and push. If the current branch is not the main branch, create a PR and merge it.
|
|
97
|
-
|
|
98
|
-
Changed files:
|
|
99
|
-
${V}`;La(ae.id,he,"do")}catch(ae){xt(`Failed to delegate: ${ae instanceof Error?ae.message:"error"}`,"#B71C1C")}}:void 0})})(),kn&&l.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>ur(!1),children:l.jsx("div",{style:{width:420,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8},onClick:M=>M.stopPropagation(),children:l.jsx(r8,{onClose:()=>ur(!1)})})}),xn&&l.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>gn(!1),children:l.jsx("div",{style:{width:480,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8,overflowY:"auto"},onClick:M=>M.stopPropagation(),children:l.jsx(i8,{onClose:()=>gn(!1),onSyncComplete:()=>{}})})}),Vo&&l.jsx(d8,{onClose:()=>Ta(!1),speechSettings:nt,onSpeechSettingsChange:Qt,language:we,onLanguageChange:kt,onOpenSync:()=>gn(!0),onOpenGitStatus:()=>sl(!0),onOpenSessions:()=>Fs(!0),onOpenStats:()=>ur(!0)}),dr&&l.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>sl(!1),children:l.jsx("div",{style:{width:520,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8,overflowY:"auto"},onClick:M=>M.stopPropagation(),children:l.jsx(s8,{onClose:()=>sl(!1)})})}),Ju&&l.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>Fs(!1),children:l.jsx("div",{style:{width:520,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8,overflowY:"auto"},onClick:M=>M.stopPropagation(),children:l.jsx(o8,{onClose:()=>Fs(!1)})})}),l.jsx("div",{className:"fixed top-16 right-4 z-[70] flex flex-col gap-2",children:G.map(M=>l.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:M.color,border:"2px solid rgba(0,0,0,0.3)",fontFamily:"var(--pixel-font)"},children:[l.jsx("div",{className:"w-2 h-2 bg-white/60"}),M.message]},M.id))})]})}function Au({onSelect:e,onClose:n}){const[a,i]=v.useState(null),[o,u]=v.useState(!0),[d,h]=v.useState(""),[m,f]=v.useState(!1),[x,g]=v.useState(!1),w=v.useRef(null),b=v.useCallback(async k=>{u(!0);try{const N=await ge.browse(k);i(N)}catch{}finally{u(!1)}},[]);v.useEffect(()=>{b()},[b]),v.useEffect(()=>{var k;m&&((k=w.current)==null||k.focus())},[m]);const j=async()=>{if(!(!a||!d.trim())){g(!0);try{const k=await ge.mkdir(a.current,d.trim());k.ok&&(h(""),f(!1),await b(k.path))}catch{}finally{g(!1)}}};return o&&!a?l.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?l.jsxs("div",{className:"mt-3 rounded-lg overflow-hidden text-xs",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",maxHeight:260,overflowY:"auto"},children:[l.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 sticky top-0 z-10",style:{background:"var(--terminal-surface)",borderBottom:"1px solid var(--terminal-border)"},children:[l.jsx("span",{style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},className:"truncate flex-1",children:a.current}),l.jsx("button",{onClick:()=>{f(!m),h("")},className:"px-2 py-1 rounded text-[10px] font-medium shrink-0 cursor-pointer",style:{background:"var(--terminal-bg)",color:"var(--terminal-text-muted)",border:"1px solid var(--terminal-border)"},title:"New folder",children:"+ Folder"}),l.jsx("button",{onClick:()=>e(a.current),className:"px-2 py-1 rounded text-[10px] font-medium shrink-0 cursor-pointer",style:{background:"var(--active-green)",color:"#fff"},children:"Select"}),l.jsx("button",{onClick:n,className:"opacity-50 hover:opacity-100 shrink-0 cursor-pointer",style:{color:"var(--terminal-text)"},children:"✕"})]}),m&&l.jsxs("div",{className:"px-3 py-2 flex items-center gap-2",style:{borderBottom:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},children:[l.jsx("input",{ref:w,className:"flex-1 px-2 py-1 rounded text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",outline:"none"},placeholder:"folder name",value:d,onChange:k=>h(k.target.value),onKeyDown:k=>{k.key==="Enter"&&j(),k.key==="Escape"&&f(!1)}}),l.jsx("button",{onClick:j,disabled:x||!d.trim(),className:"px-2 py-1 rounded text-[10px] font-medium shrink-0 cursor-pointer",style:{background:"var(--accent)",color:"#fff",opacity:x||!d.trim()?.5:1},children:x?"...":"Create"})]}),a.parent&&l.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:()=>b(a.parent),children:[l.jsx("span",{children:"⬆️"}),l.jsx("span",{children:".."})]}),a.dirs.map(k=>l.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:()=>b(k.path),children:[l.jsx("span",{children:"📁"}),l.jsx("span",{children:k.name})]},k.path)),a.dirs.length===0&&!m&&l.jsx("div",{className:"px-3 py-3 text-center",style:{color:"var(--terminal-text-muted)"},children:"No subdirectories"})]}):null}const v8={engine:"AI Engine",company:"Company",workspace:"Workspace",team:"Team",create:"Create"};function ky(e){return e==="existing-akb"?["engine","workspace","create"]:["engine","company","workspace","team","create"]}function w8({onComplete:e}){const[n,a]=v.useState(0),[i,o]=v.useState(null),[u,d]=v.useState("none"),[h,m]=v.useState(""),[f,x]=v.useState(!0),[g,w]=v.useState(""),[b,j]=v.useState(""),[k,N]=v.useState("en"),C=v.useRef(null),[E,B]=v.useState("new"),[R,$]=v.useState(""),[_,L]=v.useState(""),[U,Q]=v.useState(!1),[D,I]=v.useState(!1),[H,q]=v.useState(!1),[ue,te]=v.useState(""),[Y,se]=v.useState(!1),[J,Z]=v.useState(!1),[A,F]=v.useState([]),[W,T]=v.useState(""),[de,xe]=v.useState(!1),[ye,Le]=v.useState(""),[Xe,Ye]=v.useState(null),[ht,tt]=v.useState(!1),[Je,Ne]=v.useState(!1),[De,yt]=v.useState([]),[ct,pt]=v.useState("startup"),[jt,Wt]=v.useState(!1),[Ft,Nt]=v.useState(!1),[$n,me]=v.useState(null),[Se,Ee]=v.useState([]),[G,ce]=v.useState(""),[ne,ke]=v.useState(!1),[ve,ze]=v.useState(!1),[_e,Be]=v.useState([]),He=v.useMemo(()=>ky(E),[E]),rt=He[n]??"engine";v.useEffect(()=>{ge.detectEngine().then(we=>{o(we),d(we.recommended),x(!1)}).catch(()=>x(!1)),ge.getTeams().then(yt).catch(()=>{}),ge.getStatus().then(we=>{L(we.companyRoot||"")}).catch(()=>{})},[]),v.useEffect(()=>{var we;rt==="company"&&((we=C.current)==null||we.focus())},[rt]),v.useEffect(()=>{if(U||!_)return;const we=g.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");$(we?`${_}/${we}`:_)},[g,_,U]);const Ve=()=>{switch(rt){case"engine":return u!=="none"||h.length>10;case"company":return g.trim().length>0;case"workspace":return E==="existing-akb"?Xe===!0:!0;case"team":return!0;case"create":return!Ft;default:return!1}},bt=()=>{n<He.length-1&&Ve()&&a(n+1),rt==="create"&&!jt&&!ne&&(E==="existing-akb"?wn():fn())},Re=()=>{n>0&&a(n-1)},Ie=v.useRef(E);v.useEffect(()=>{if(Ie.current===E)return;Ie.current=E;const kt=ky(E).indexOf("workspace");kt>=0&&a(kt)},[E]);const _t=async()=>{if(ye.trim()){tt(!0);try{const we=await ge.validatePath(ye.trim());Ye(we.valid&&we.hasClaudeMd===!0)}catch{Ye(!1)}finally{tt(!1)}}},Bt=()=>{const we=W.trim();we&&!A.includes(we)&&(F([...A,we]),T(""))},Ot=async we=>{ze(!0),Be([]);try{const{tools:kt}=await ge.getRequiredTools(we);if(kt.filter(sn=>!sn.installed).length===0){ze(!1);return}await ge.installTools(we,(sn,re)=>{const Ae=re.tool||"";sn==="checking"?Be(We=>[...We,{event:sn,tool:Ae,detail:"checking..."}]):sn==="installing"?Be(We=>[...We,{event:sn,tool:Ae,detail:"installing..."}]):sn==="installed"?Be(We=>[...We,{event:sn,tool:Ae,detail:"installed"}]):sn==="skipped"?Be(We=>[...We,{event:sn,tool:Ae,detail:re.reason||"skipped"}]):sn==="error"&&Be(We=>[...We,{event:sn,tool:Ae,detail:re.error||"failed"}])})}catch{}finally{ze(!1)}},fn=async()=>{Wt(!0),me(null);try{const we={companyName:g.trim(),description:b.trim()||"An AI-powered organization",team:ct,knowledgePaths:A.length>0?A:void 0,language:k!=="auto"?k:void 0,location:R.trim()||void 0,codeRoot:ue.trim()||void 0};(u==="direct-api"||h)&&(we.apiKey=h||void 0);const kt=await ge.scaffold(we);Ee(kt.created),ce(kt.projectRoot),Nt(!0),Wt(!1),ct!=="custom"&&Ot(ct)}catch(we){me(we instanceof Error?we.message:"Scaffold failed"),Wt(!1)}},wn=async()=>{ke(!0),me(null);try{const we=await ge.connectAkb(ye.trim());we.ok?(Nt(!0),Ee([`Connected to: ${we.companyRoot}`])):me(we.error||"Failed to connect")}catch(we){me(we instanceof Error?we.message:"Connect failed")}finally{ke(!1)}},P=()=>{A.length>0?e({paths:A,companyRoot:""}):e()},Oe=we=>{we.key==="Enter"&&Ve()&&(we.preventDefault(),bt())},nt=`w-full px-3 py-2 rounded text-sm outline-none transition-colors
|
|
100
|
-
bg-[var(--terminal-bg)] text-[var(--terminal-text)]
|
|
101
|
-
border border-[var(--terminal-border)]
|
|
102
|
-
focus:border-[var(--terminal-border-hover)]
|
|
103
|
-
placeholder:text-[var(--terminal-text-muted)]`,Qt=we=>`p-4 rounded-lg border-2 cursor-pointer transition-all text-[var(--terminal-text)] ${we?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--terminal-border)] bg-[var(--hud-bg-alt)] hover:border-[var(--accent)]/50"}`;return l.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},onKeyDown:Oe,children:l.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:[l.jsxs("div",{className:"px-6 py-5",style:{background:"var(--terminal-bg)",borderBottom:"1px solid var(--terminal-border)"},children:[l.jsx("div",{className:"text-lg font-bold",style:{color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"},children:"tycono"}),l.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-secondary)"},children:"Build an AI company. Watch them work."}),l.jsx("div",{className:"flex gap-1.5 mt-4",children:He.map((we,kt)=>l.jsxs("div",{className:"flex-1",children:[l.jsx("div",{className:"h-1 rounded-full transition-colors",style:{background:kt<=n?"var(--accent)":"var(--terminal-surface-light)"}}),l.jsx("div",{className:"text-[9px] mt-1 truncate",style:{color:kt===n?"var(--terminal-text)":"var(--terminal-text-muted)"},children:v8[we]})]},we))})]}),l.jsxs("div",{className:"px-6 py-5 min-h-[280px] max-h-[480px] overflow-y-auto",children:[rt==="engine"&&l.jsxs("div",{className:"space-y-4",children:[l.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"AI Engine Setup"}),f?l.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:"Detecting AI engine..."}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:Qt(u==="claude-cli"),onClick:()=>(i==null?void 0:i.claudeCli)&&d("claude-cli"),style:{opacity:i!=null&&i.claudeCli?1:.4},children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-lg",children:i!=null&&i.claudeCli?"✅":"❌"}),l.jsxs("div",{children:[l.jsx("div",{className:"font-medium text-sm",children:"Claude Code CLI"}),l.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"})]})]})}),l.jsxs("div",{className:Qt(u==="direct-api"),onClick:()=>d("direct-api"),children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-lg",children:i!=null&&i.apiKey?"✅":"🔑"}),l.jsxs("div",{className:"flex-1",children:[l.jsx("div",{className:"font-medium text-sm",children:"Anthropic API Key (BYOK)"}),l.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)&&l.jsx("input",{type:"password",className:`${nt} mt-3`,placeholder:"sk-ant-...",value:h,onChange:we=>m(we.target.value),autoFocus:!0})]})]})]}),rt==="company"&&l.jsxs("div",{className:"space-y-4",children:[l.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Company"}),l.jsxs("div",{children:[l.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Company Name *"}),l.jsx("input",{ref:C,className:nt,placeholder:"e.g. Acme Corp",value:g,onChange:we=>w(we.target.value)})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Description"}),l.jsx("textarea",{className:`${nt} resize-none`,rows:3,placeholder:"What does your AI company do?",value:b,onChange:we=>j(we.target.value)})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"AI Response Language"}),l.jsxs("select",{className:nt,value:k,onChange:we=>N(we.target.value),children:[l.jsx("option",{value:"en",children:"English"}),l.jsx("option",{value:"ko",children:"한국어"}),l.jsx("option",{value:"ja",children:"日本語"})]})]})]}),rt==="workspace"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Workspace"}),l.jsx(tp,{text:`"New Company" creates a fresh workspace with roles, knowledge base, and project structure.
|
|
104
|
-
|
|
105
|
-
"Connect Existing" links to an existing Tycono workspace you've set up before.`})]}),l.jsxs("div",{className:"flex rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:[l.jsx("button",{className:"flex-1 px-3 py-2 text-xs font-medium transition-colors",style:{background:E==="new"?"var(--accent)":"var(--hud-bg-alt)",color:E==="new"?"#fff":"var(--terminal-text-muted)"},onClick:()=>B("new"),children:"New Company"}),l.jsx("button",{className:"flex-1 px-3 py-2 text-xs font-medium transition-colors",style:{background:E==="existing-akb"?"var(--accent)":"var(--hud-bg-alt)",color:E==="existing-akb"?"#fff":"var(--terminal-text-muted)",borderLeft:"1px solid var(--terminal-border)"},onClick:()=>B("existing-akb"),children:"Connect Existing"})]}),E==="new"?l.jsxs("div",{className:"space-y-3",children:[l.jsxs(jy,{icon:"📁",title:"Company Location",hint:"Where your AI company files will be created.",help:"Roles, knowledge, decisions, and project files are stored here. This is your AI company's home directory. Auto-generated from your company name — change it if needed.",children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{className:`${nt} flex-1`,placeholder:"/path/to/your-company",value:R,onChange:we=>{$(we.target.value),Q(!0)}}),l.jsx("button",{onClick:()=>I(!D),className:"px-3 py-2 rounded text-xs font-medium transition-colors shrink-0 cursor-pointer hover:brightness-125",style:{background:"var(--terminal-surface)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},title:"Browse folders",children:"📁"})]}),D&&l.jsx(Au,{onSelect:we=>{$(we),Q(!0),I(!1)},onClose:()=>I(!1)})]}),l.jsxs(Sy,{icon:"💻",title:"Code Repository",hint:"Connect a separate code repo.",help:`Link your existing code repo so AI roles can read and write code there.
|
|
106
|
-
|
|
107
|
-
Skip this if you don't have a codebase yet — you can connect one later from Settings.`,tag:"optional",open:H,onToggle:()=>q(!H),children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{className:`${nt} flex-1`,placeholder:"/path/to/code/repo",value:ue,onChange:we=>te(we.target.value)}),l.jsx("button",{onClick:()=>se(!Y),className:"px-3 py-2 rounded text-xs font-medium transition-colors shrink-0 cursor-pointer hover:brightness-125",style:{background:"var(--terminal-surface)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},title:"Browse folders",children:"📁"})]}),Y&&l.jsx(Au,{onSelect:we=>{te(we),se(!1)},onClose:()=>se(!1)})]}),l.jsxs(Sy,{icon:"📚",title:"Knowledge Import",hint:"Import existing documents into knowledge base.",help:`Point to folders with docs (.md, .txt, etc.) — AI will read, summarize, and organize them into a searchable knowledge base.
|
|
108
|
-
|
|
109
|
-
Skip this to start with an empty knowledge base. You can import documents anytime from the office.`,tag:"optional",open:J,onToggle:()=>Z(!J),children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{className:`${nt} flex-1`,placeholder:"/path/to/docs",value:W,onChange:we=>T(we.target.value),onKeyDown:we=>{we.key==="Enter"&&(we.preventDefault(),Bt())}}),l.jsx("button",{onClick:()=>xe(!de),className:"px-3 py-2 rounded text-xs font-medium transition-colors shrink-0 cursor-pointer hover:brightness-125",style:{background:"var(--terminal-surface)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},title:"Browse folders",children:"📁"}),l.jsx("button",{onClick:Bt,disabled:!W.trim(),className:"px-3 py-2 rounded text-xs font-medium shrink-0",style:{background:"var(--accent)",color:"#fff",opacity:W.trim()?1:.5},children:"Add"})]}),de&&l.jsx(Au,{onSelect:we=>{A.includes(we)||F([...A,we]),xe(!1)},onClose:()=>xe(!1)}),A.length>0&&l.jsx("div",{className:"space-y-1 mt-2",children:A.map((we,kt)=>l.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:[l.jsx("span",{className:"flex-1 truncate",style:{fontFamily:"var(--pixel-font)"},children:we}),l.jsx("button",{onClick:()=>F(A.filter((ln,sn)=>sn!==kt)),className:"opacity-50 hover:opacity-100",children:"✕"})]},kt))})]})]}):l.jsx("div",{className:"space-y-3",children:l.jsxs(jy,{icon:"🔗",title:"AKB Path",hint:"Directory with existing CLAUDE.md and AKB structure.",help:"Connect to a directory that was previously set up with Tycono. It must contain a CLAUDE.md file. All existing roles, knowledge, and settings will be loaded.",children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{className:`${nt} flex-1`,placeholder:"/path/to/your/akb",value:ye,onChange:we=>{Le(we.target.value),Ye(null)},autoFocus:!0}),l.jsx("button",{onClick:()=>Ne(!Je),className:"px-3 py-2 rounded text-xs font-medium transition-colors shrink-0 cursor-pointer hover:brightness-125",style:{background:"var(--terminal-surface)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},title:"Browse folders",children:"📁"}),l.jsx("button",{onClick:_t,disabled:ht||!ye.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors shrink-0",style:{background:"var(--accent)",color:"#fff",opacity:ht||!ye.trim()?.5:1},children:ht?"...":"Verify"})]}),Xe===!0&&l.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Valid AKB found"]}),Xe===!1&&l.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," No valid AKB (CLAUDE.md required)"]}),Je&&l.jsx(Au,{onSelect:we=>{Le(we),Ye(null),Ne(!1)},onClose:()=>Ne(!1)})]})})]}),rt==="team"&&l.jsxs("div",{className:"space-y-4",children:[l.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Team Template"}),l.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"Choose a starting team. You can add or remove roles later."}),De.map(we=>l.jsxs("div",{className:Qt(ct===we.id),onClick:()=>pt(we.id),children:[l.jsx("div",{className:"font-medium text-sm capitalize",children:we.id}),l.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:we.roles.map(kt=>l.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:kt.name},kt.id))})]},we.id)),l.jsxs("div",{className:Qt(ct==="custom"),onClick:()=>pt("custom"),children:[l.jsx("div",{className:"font-medium text-sm",children:"Custom"}),l.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Start with no pre-built roles. Hire them from the office."})]})]}),rt==="create"&&l.jsxs("div",{className:"space-y-4",children:[l.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:Ft?E==="existing-akb"?"AKB Connected!":"Company Created!":"Review & Create"}),!Ft&&!jt&&!ne&&l.jsxs(l.Fragment,{children:[l.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:E==="existing-akb"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Mode:"})," Connect Existing AKB"]}),l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Path:"})," ",ye]}),l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Company:"})," ",g]}),l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Location:"})," ",R||"(default)"]}),l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]}),ue.trim()&&l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Code Repo:"})," ",ue]}),l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Knowledge:"})," ",A.length>0?`Import ${A.length} source(s)`:"Fresh (empty)"]}),l.jsxs("div",{children:[l.jsx("span",{className:"opacity-50",children:"Team:"})," ",ct]}),A.length>0&&l.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--idle-amber)"},children:"Knowledge import will run in the background after entering the office."})]})}),$n&&l.jsx("div",{className:"text-xs p-3 rounded",style:{background:"rgba(220,38,38,0.15)",color:"#f87171"},children:$n})]}),(jt||ne)&&l.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[l.jsx("div",{className:"w-8 h-8 border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),l.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:ne?"Connecting to AKB...":"Scaffolding your company..."})]}),Ft&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"text-center py-4 text-4xl",children:"🏢"}),G&&l.jsxs("div",{className:"rounded-lg p-3 text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:[l.jsx("span",{className:"opacity-50",children:"Location:"})," ",G]}),l.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:Se.map((we,kt)=>l.jsxs("div",{className:"py-0.5",children:[l.jsx("span",{style:{color:"var(--active-green)"},children:"✓"})," ",we]},kt))}),(ve||_e.length>0)&&l.jsxs("div",{className:"rounded-lg p-4 text-xs space-y-1",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:[l.jsx("div",{className:"font-medium mb-2",style:{color:"var(--terminal-text-secondary)"},children:ve?"Installing skill tools...":"Skill tools"}),_e.map((we,kt)=>l.jsxs("div",{className:"py-0.5 flex items-center gap-2",children:[l.jsx("span",{style:{color:we.event==="installed"||we.event==="skipped"?"var(--active-green)":we.event==="error"?"#f87171":"var(--terminal-text-muted)"},children:we.event==="installed"||we.event==="skipped"?"✓":we.event==="error"?"✗":"…"}),l.jsx("span",{children:we.tool}),l.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:we.detail})]},kt)),ve&&l.jsxs("div",{className:"flex items-center gap-2 mt-1",style:{color:"var(--terminal-text-muted)"},children:[l.jsx("div",{className:"w-3 h-3 border border-current rounded-full animate-spin",style:{borderTopColor:"var(--accent)"}}),l.jsx("span",{children:"Please wait..."})]})]}),A.length>0&&l.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."})]})]})]}),l.jsxs("div",{className:"px-6 py-4 flex justify-between items-center",style:{borderTop:"1px solid var(--terminal-border)"},children:[l.jsx("div",{children:n>0&&!Ft&&l.jsx("button",{onClick:Re,className:"px-4 py-2 rounded text-sm transition-colors",style:{color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Back"})}),l.jsxs("div",{className:"text-xs",style:{color:"var(--terminal-text-muted)"},children:[n+1," / ",He.length]}),l.jsx("div",{children:Ft?l.jsx("button",{onClick:P,disabled:ve,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:"var(--active-green)",color:"#fff",opacity:ve?.5:1},children:ve?"Setting up tools...":"Enter Office"}):l.jsx("button",{onClick:bt,disabled:!Ve()||jt||ne,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:Ve()?"var(--accent)":"var(--terminal-border)",color:"#fff",opacity:Ve()&&!jt&&!ne?1:.5},children:rt==="create"?jt||ne?ne?"Connecting...":"Creating...":E==="existing-akb"?"Connect AKB":"Create Company":"Next"})})]})]})})}function tp({text:e}){const[n,a]=v.useState(!1),[i,o]=v.useState({top:0,left:0}),u=v.useRef(null),d=()=>{if(u.current){const h=u.current.getBoundingClientRect();o({top:h.bottom+6,left:h.left})}a(!0)};return l.jsxs("span",{className:"inline-flex",ref:u,children:[l.jsx("span",{className:"w-4 h-4 rounded-full text-[9px] font-bold flex items-center justify-center cursor-help shrink-0 select-none",style:{background:"var(--terminal-surface)",color:"var(--terminal-text-muted)",border:"1px solid var(--terminal-border)"},onMouseEnter:d,onMouseLeave:()=>a(!1),onClick:h=>{h.stopPropagation(),n?a(!1):d()},children:"?"}),n&&l.jsxs("div",{className:"fixed z-[9999] px-3 py-2 rounded-lg text-[11px] leading-relaxed whitespace-pre-line w-60 shadow-lg pointer-events-none",style:{top:i.top,left:Math.min(i.left,window.innerWidth-260),background:"var(--terminal-bg)",color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:[l.jsx("div",{className:"absolute bottom-full w-0 h-0",style:{left:8,borderLeft:"5px solid transparent",borderRight:"5px solid transparent",borderBottom:"5px solid var(--terminal-border)"}}),e]})]})}function jy({icon:e,title:n,hint:a,help:i,children:o}){return l.jsxs("div",{className:"rounded-lg p-3 space-y-2",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm",children:e}),l.jsx("span",{className:"text-xs font-medium",style:{color:"var(--terminal-text)"},children:n}),i&&l.jsx(tp,{text:i})]}),l.jsx("div",{className:"text-[10px] mt-0.5 ml-6",style:{color:"var(--terminal-text-muted)"},children:a})]}),o]})}function Sy({icon:e,title:n,hint:a,help:i,tag:o,open:u,onToggle:d,children:h}){return l.jsxs("div",{className:"rounded-lg",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[l.jsxs("div",{className:"p-3 cursor-pointer flex items-center gap-2 hover:bg-[var(--terminal-surface-light)] transition-colors",onClick:d,children:[l.jsx("span",{className:"text-sm",children:e}),l.jsx("span",{className:"text-xs font-medium flex-1",style:{color:"var(--terminal-text)"},children:n}),i&&l.jsx(tp,{text:i}),o&&l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded",style:{background:"var(--terminal-surface)",color:"var(--terminal-text-muted)"},children:o}),l.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:u?"▲":"▼"})]}),!u&&l.jsx("div",{className:"px-3 pb-2 -mt-1",children:l.jsx("div",{className:"text-[10px] ml-6",style:{color:"var(--terminal-text-muted)"},children:a})}),u&&l.jsx("div",{className:"px-3 pb-3 space-y-2",children:h})]})}function k8(){const[e,n]=v.useState(null),[a,i]=v.useState(!0),[o,u]=v.useState(null),d=v.useCallback(async()=>{i(!0),u(null);try{const h=await ge.getStatus();n(h)}catch(h){u(h instanceof Error?h.message:"Failed to fetch status")}finally{i(!1)}},[]);return v.useEffect(()=>{d()},[d]),{initialized:(e==null?void 0:e.initialized)??!1,companyName:(e==null?void 0:e.companyName)??null,engine:(e==null?void 0:e.engine)??"none",companyRoot:(e==null?void 0:e.companyRoot)??"",loading:a,error:o,refetch:d}}const j8=v.lazy(()=>Ny(()=>import("./preview-app-WN7GvXXY.js"),[]));function Fv(){return l.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},children:l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"w-10 h-10 mx-auto border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),l.jsx("div",{className:"mt-4 text-sm",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Loading..."})]})})}function S8(){var e;try{const n=localStorage.getItem("tycono-theme"),a=n&&n in ll?n:"default",i=(e=ll[a])==null?void 0:e.vars;if(!i)return;const o=document.documentElement;for(const[u,d]of Object.entries(i))o.style.setProperty(u,d)}catch{}}function C8(){const{initialized:e,loading:n,refetch:a}=k8(),[i,o]=v.useState(null);v.useEffect(()=>{S8()},[]);const u=d=>{d&&o(d),a()};return n?l.jsx(Fv,{}):e?l.jsx(b8,{importJob:i,onImportDone:()=>o(null)}):l.jsx(w8,{onComplete:u})}function N8(){const e=new URLSearchParams(window.location.search).has("sprite-preview");return l.jsx(kw,{children:e?l.jsx(v.Suspense,{fallback:l.jsx(Fv,{}),children:l.jsx(j8,{})}):l.jsx(C8,{})})}bw.createRoot(document.getElementById("root")).render(l.jsx(v.StrictMode,{children:l.jsx(N8,{})}));export{ov as H,uv as P,dv as S,T8 as a,cv as b,sv as c,am as d,eC as e,A8 as f,D8 as g,F8 as h,l as j,v as r};
|