tycono 0.1.63 → 0.1.64
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/save.ts +40 -1
- package/src/api/src/routes/speech.ts +57 -57
- package/src/api/src/services/git-save.ts +154 -0
- package/src/web/dist/assets/index-B3dNhn76.js +101 -0
- package/src/web/dist/assets/{preview-app-Qc37pwGk.js → preview-app-qIFqrb-y.js} +1 -1
- package/src/web/dist/index.html +1 -1
- package/src/web/dist/assets/index-Btwm9L8u.js +0 -101
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
var rv=Object.defineProperty;var av=(e,r,a)=>r in e?rv(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a;var z1=(e,r,a)=>av(e,typeof r!="symbol"?r+"":r,a);(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))i(c);new MutationObserver(c=>{for(const u of c)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(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(c){if(c.ep)return;c.ep=!0;const u=a(c);fetch(c.href,u)}})();function vy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var mf={exports:{}},Us={};/**
|
|
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 R1;function lv(){if(R1)return Us;R1=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function a(i,c,u){var d=null;if(u!==void 0&&(d=""+u),c.key!==void 0&&(d=""+c.key),"key"in c){u={};for(var m in c)m!=="key"&&(u[m]=c[m])}else u=c;return c=u.ref,{$$typeof:e,type:i,key:d,ref:c!==void 0?c:null,props:u}}return Us.Fragment=r,Us.jsx=a,Us.jsxs=a,Us}var M1;function iv(){return M1||(M1=1,mf.exports=lv()),mf.exports}var s=iv(),xf={exports:{}},nt={};/**
|
|
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 F1;function sv(){if(F1)return nt;F1=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),d=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function v(z){return z===null||typeof z!="object"?null:(z=b&&z[b]||z["@@iterator"],typeof z=="function"?z:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,C={};function E(z,Z,D){this.props=z,this.context=Z,this.refs=C,this.updater=D||S}E.prototype.isReactComponent={},E.prototype.setState=function(z,Z){if(typeof z!="object"&&typeof z!="function"&&z!=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,z,Z,"setState")},E.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function N(){}N.prototype=E.prototype;function _(z,Z,D){this.props=z,this.context=Z,this.refs=C,this.updater=D||S}var B=_.prototype=new N;B.constructor=_,j(B,E.prototype),B.isPureReactComponent=!0;var I=Array.isArray;function F(){}var X={H:null,A:null,T:null,S:null},W=Object.prototype.hasOwnProperty;function U(z,Z,D){var xe=D.ref;return{$$typeof:e,type:z,key:Z,ref:xe!==void 0?xe:null,props:D}}function M(z,Z){return U(z.type,Z,z.props)}function G(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function O(z){var Z={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(D){return Z[D]})}var V=/\/+/g;function J(z,Z){return typeof z=="object"&&z!==null&&z.key!=null?O(""+z.key):Z.toString(36)}function Q(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(F,F):(z.status="pending",z.then(function(Z){z.status==="pending"&&(z.status="fulfilled",z.value=Z)},function(Z){z.status==="pending"&&(z.status="rejected",z.reason=Z)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function H(z,Z,D,xe,Ce){var ge=typeof z;(ge==="undefined"||ge==="boolean")&&(z=null);var Me=!1;if(z===null)Me=!0;else switch(ge){case"bigint":case"string":case"number":Me=!0;break;case"object":switch(z.$$typeof){case e:case r:Me=!0;break;case y:return Me=z._init,H(Me(z._payload),Z,D,xe,Ce)}}if(Me)return Ce=Ce(z),Me=xe===""?"."+J(z,0):xe,I(Ce)?(D="",Me!=null&&(D=Me.replace(V,"$&/")+"/"),H(Ce,Z,D,"",function(oe){return oe})):Ce!=null&&(G(Ce)&&(Ce=M(Ce,D+(Ce.key==null||z&&z.key===Ce.key?"":(""+Ce.key).replace(V,"$&/")+"/")+Me)),Z.push(Ce)),1;Me=0;var Ee=xe===""?".":xe+":";if(I(z))for(var Ie=0;Ie<z.length;Ie++)xe=z[Ie],ge=Ee+J(xe,Ie),Me+=H(xe,Z,D,ge,Ce);else if(Ie=v(z),typeof Ie=="function")for(z=Ie.call(z),Ie=0;!(xe=z.next()).done;)xe=xe.value,ge=Ee+J(xe,Ie++),Me+=H(xe,Z,D,ge,Ce);else if(ge==="object"){if(typeof z.then=="function")return H(Q(z),Z,D,xe,Ce);throw Z=String(z),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return Me}function Y(z,Z,D){if(z==null)return z;var xe=[],Ce=0;return H(z,xe,"","",function(ge){return Z.call(D,ge,Ce++)}),xe}function ne(z){if(z._status===-1){var Z=z._result;Z=Z(),Z.then(function(D){(z._status===0||z._status===-1)&&(z._status=1,z._result=D)},function(D){(z._status===0||z._status===-1)&&(z._status=2,z._result=D)}),z._status===-1&&(z._status=0,z._result=Z)}if(z._status===1)return z._result.default;throw z._result}var we=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(Z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)},T={map:Y,forEach:function(z,Z,D){Y(z,function(){Z.apply(this,arguments)},D)},count:function(z){var Z=0;return Y(z,function(){Z++}),Z},toArray:function(z){return Y(z,function(Z){return Z})||[]},only:function(z){if(!G(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return nt.Activity=g,nt.Children=T,nt.Component=E,nt.Fragment=a,nt.Profiler=c,nt.PureComponent=_,nt.StrictMode=i,nt.Suspense=x,nt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=X,nt.__COMPILER_RUNTIME={__proto__:null,c:function(z){return X.H.useMemoCache(z)}},nt.cache=function(z){return function(){return z.apply(null,arguments)}},nt.cacheSignal=function(){return null},nt.cloneElement=function(z,Z,D){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var xe=j({},z.props),Ce=z.key;if(Z!=null)for(ge in Z.key!==void 0&&(Ce=""+Z.key),Z)!W.call(Z,ge)||ge==="key"||ge==="__self"||ge==="__source"||ge==="ref"&&Z.ref===void 0||(xe[ge]=Z[ge]);var ge=arguments.length-2;if(ge===1)xe.children=D;else if(1<ge){for(var Me=Array(ge),Ee=0;Ee<ge;Ee++)Me[Ee]=arguments[Ee+2];xe.children=Me}return U(z.type,Ce,xe)},nt.createContext=function(z){return z={$$typeof:d,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:u,_context:z},z},nt.createElement=function(z,Z,D){var xe,Ce={},ge=null;if(Z!=null)for(xe in Z.key!==void 0&&(ge=""+Z.key),Z)W.call(Z,xe)&&xe!=="key"&&xe!=="__self"&&xe!=="__source"&&(Ce[xe]=Z[xe]);var Me=arguments.length-2;if(Me===1)Ce.children=D;else if(1<Me){for(var Ee=Array(Me),Ie=0;Ie<Me;Ie++)Ee[Ie]=arguments[Ie+2];Ce.children=Ee}if(z&&z.defaultProps)for(xe in Me=z.defaultProps,Me)Ce[xe]===void 0&&(Ce[xe]=Me[xe]);return U(z,ge,Ce)},nt.createRef=function(){return{current:null}},nt.forwardRef=function(z){return{$$typeof:m,render:z}},nt.isValidElement=G,nt.lazy=function(z){return{$$typeof:y,_payload:{_status:-1,_result:z},_init:ne}},nt.memo=function(z,Z){return{$$typeof:f,type:z,compare:Z===void 0?null:Z}},nt.startTransition=function(z){var Z=X.T,D={};X.T=D;try{var xe=z(),Ce=X.S;Ce!==null&&Ce(D,xe),typeof xe=="object"&&xe!==null&&typeof xe.then=="function"&&xe.then(F,we)}catch(ge){we(ge)}finally{Z!==null&&D.types!==null&&(Z.types=D.types),X.T=Z}},nt.unstable_useCacheRefresh=function(){return X.H.useCacheRefresh()},nt.use=function(z){return X.H.use(z)},nt.useActionState=function(z,Z,D){return X.H.useActionState(z,Z,D)},nt.useCallback=function(z,Z){return X.H.useCallback(z,Z)},nt.useContext=function(z){return X.H.useContext(z)},nt.useDebugValue=function(){},nt.useDeferredValue=function(z,Z){return X.H.useDeferredValue(z,Z)},nt.useEffect=function(z,Z){return X.H.useEffect(z,Z)},nt.useEffectEvent=function(z){return X.H.useEffectEvent(z)},nt.useId=function(){return X.H.useId()},nt.useImperativeHandle=function(z,Z,D){return X.H.useImperativeHandle(z,Z,D)},nt.useInsertionEffect=function(z,Z){return X.H.useInsertionEffect(z,Z)},nt.useLayoutEffect=function(z,Z){return X.H.useLayoutEffect(z,Z)},nt.useMemo=function(z,Z){return X.H.useMemo(z,Z)},nt.useOptimistic=function(z,Z){return X.H.useOptimistic(z,Z)},nt.useReducer=function(z,Z,D){return X.H.useReducer(z,Z,D)},nt.useRef=function(z){return X.H.useRef(z)},nt.useState=function(z){return X.H.useState(z)},nt.useSyncExternalStore=function(z,Z,D){return X.H.useSyncExternalStore(z,Z,D)},nt.useTransition=function(){return X.H.useTransition()},nt.version="19.2.4",nt}var _1;function Ah(){return _1||(_1=1,xf.exports=sv()),xf.exports}var w=Ah(),pf={exports:{}},qs={},yf={exports:{}},gf={};/**
|
|
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 O1;function ov(){return O1||(O1=1,(function(e){function r(H,Y){var ne=H.length;H.push(Y);e:for(;0<ne;){var we=ne-1>>>1,T=H[we];if(0<c(T,Y))H[we]=Y,H[ne]=T,ne=we;else break e}}function a(H){return H.length===0?null:H[0]}function i(H){if(H.length===0)return null;var Y=H[0],ne=H.pop();if(ne!==Y){H[0]=ne;e:for(var we=0,T=H.length,z=T>>>1;we<z;){var Z=2*(we+1)-1,D=H[Z],xe=Z+1,Ce=H[xe];if(0>c(D,ne))xe<T&&0>c(Ce,D)?(H[we]=Ce,H[xe]=ne,we=xe):(H[we]=D,H[Z]=ne,we=Z);else if(xe<T&&0>c(Ce,ne))H[we]=Ce,H[xe]=ne,we=xe;else break e}}return Y}function c(H,Y){var ne=H.sortIndex-Y.sortIndex;return ne!==0?ne:H.id-Y.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,m=d.now();e.unstable_now=function(){return d.now()-m}}var x=[],f=[],y=1,g=null,b=3,v=!1,S=!1,j=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function B(H){for(var Y=a(f);Y!==null;){if(Y.callback===null)i(f);else if(Y.startTime<=H)i(f),Y.sortIndex=Y.expirationTime,r(x,Y);else break;Y=a(f)}}function I(H){if(j=!1,B(H),!S)if(a(x)!==null)S=!0,F||(F=!0,O());else{var Y=a(f);Y!==null&&Q(I,Y.startTime-H)}}var F=!1,X=-1,W=5,U=-1;function M(){return C?!0:!(e.unstable_now()-U<W)}function G(){if(C=!1,F){var H=e.unstable_now();U=H;var Y=!0;try{e:{S=!1,j&&(j=!1,N(X),X=-1),v=!0;var ne=b;try{t:{for(B(H),g=a(x);g!==null&&!(g.expirationTime>H&&M());){var we=g.callback;if(typeof we=="function"){g.callback=null,b=g.priorityLevel;var T=we(g.expirationTime<=H);if(H=e.unstable_now(),typeof T=="function"){g.callback=T,B(H),Y=!0;break t}g===a(x)&&i(x),B(H)}else i(x);g=a(x)}if(g!==null)Y=!0;else{var z=a(f);z!==null&&Q(I,z.startTime-H),Y=!1}}break e}finally{g=null,b=ne,v=!1}Y=void 0}}finally{Y?O():F=!1}}}var O;if(typeof _=="function")O=function(){_(G)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,J=V.port2;V.port1.onmessage=G,O=function(){J.postMessage(null)}}else O=function(){E(G,0)};function Q(H,Y){X=E(function(){H(e.unstable_now())},Y)}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(H){H.callback=null},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(H){switch(b){case 1:case 2:case 3:var Y=3;break;default:Y=b}var ne=b;b=Y;try{return H()}finally{b=ne}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(H,Y){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var ne=b;b=H;try{return Y()}finally{b=ne}},e.unstable_scheduleCallback=function(H,Y,ne){var we=e.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?we+ne:we):ne=we,H){case 1:var T=-1;break;case 2:T=250;break;case 5:T=1073741823;break;case 4:T=1e4;break;default:T=5e3}return T=ne+T,H={id:y++,callback:Y,priorityLevel:H,startTime:ne,expirationTime:T,sortIndex:-1},ne>we?(H.sortIndex=ne,r(f,H),a(x)===null&&H===a(f)&&(j?(N(X),X=-1):j=!0,Q(I,ne-we))):(H.sortIndex=T,r(x,H),S||v||(S=!0,F||(F=!0,O()))),H},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(H){var Y=b;return function(){var ne=b;b=Y;try{return H.apply(this,arguments)}finally{b=ne}}}})(gf)),gf}var B1;function cv(){return B1||(B1=1,yf.exports=ov()),yf.exports}var bf={exports:{}},In={};/**
|
|
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 $1;function uv(){if($1)return In;$1=1;var e=Ah();function r(x){var f="https://react.dev/errors/"+x;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)f+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+x+"; 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(r(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},c=Symbol.for("react.portal");function u(x,f,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:g==null?null:""+g,children:x,containerInfo:f,implementation:y}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(x,f){if(x==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return In.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,In.createPortal=function(x,f){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(r(299));return u(x,f,null,y)},In.flushSync=function(x){var f=d.T,y=i.p;try{if(d.T=null,i.p=2,x)return x()}finally{d.T=f,i.p=y,i.d.f()}},In.preconnect=function(x,f){typeof x=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,i.d.C(x,f))},In.prefetchDNS=function(x){typeof x=="string"&&i.d.D(x)},In.preinit=function(x,f){if(typeof x=="string"&&f&&typeof f.as=="string"){var y=f.as,g=m(y,f.crossOrigin),b=typeof f.integrity=="string"?f.integrity:void 0,v=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;y==="style"?i.d.S(x,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:v}):y==="script"&&i.d.X(x,{crossOrigin:g,integrity:b,fetchPriority:v,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},In.preinitModule=function(x,f){if(typeof x=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var y=m(f.as,f.crossOrigin);i.d.M(x,{crossOrigin:y,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&i.d.M(x)},In.preload=function(x,f){if(typeof x=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var y=f.as,g=m(y,f.crossOrigin);i.d.L(x,y,{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})}},In.preloadModule=function(x,f){if(typeof x=="string")if(f){var y=m(f.as,f.crossOrigin);i.d.m(x,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:y,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else i.d.m(x)},In.requestFormReset=function(x){i.d.r(x)},In.unstable_batchedUpdates=function(x,f){return x(f)},In.useFormState=function(x,f,y){return d.H.useFormState(x,f,y)},In.useFormStatus=function(){return d.H.useHostTransitionStatus()},In.version="19.2.4",In}var L1;function dv(){if(L1)return bf.exports;L1=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(r){console.error(r)}}return e(),bf.exports=uv(),bf.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 H1;function fv(){if(H1)return qs;H1=1;var e=cv(),r=Ah(),a=dv();function i(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)n+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var n=t,l=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(l=n.return),t=n.return;while(t)}return n.tag===3?l:null}function d(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function m(t){if(t.tag===31){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function x(t){if(u(t)!==t)throw Error(i(188))}function f(t){var n=t.alternate;if(!n){if(n=u(t),n===null)throw Error(i(188));return n!==t?null:t}for(var l=t,o=n;;){var h=l.return;if(h===null)break;var p=h.alternate;if(p===null){if(o=h.return,o!==null){l=o;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===l)return x(h),t;if(p===o)return x(h),n;p=p.sibling}throw Error(i(188))}if(l.return!==o.return)l=h,o=p;else{for(var k=!1,A=h.child;A;){if(A===l){k=!0,l=h,o=p;break}if(A===o){k=!0,o=h,l=p;break}A=A.sibling}if(!k){for(A=p.child;A;){if(A===l){k=!0,l=p,o=h;break}if(A===o){k=!0,o=p,l=h;break}A=A.sibling}if(!k)throw Error(i(189))}}if(l.alternate!==o)throw Error(i(190))}if(l.tag!==3)throw Error(i(188));return l.stateNode.current===l?t:n}function y(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=y(t),n!==null)return n;t=t.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),_=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),M=Symbol.for("react.memo_cache_sentinel"),G=Symbol.iterator;function O(t){return t===null||typeof t!="object"?null:(t=G&&t[G]||t["@@iterator"],typeof t=="function"?t:null)}var V=Symbol.for("react.client.reference");function J(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===V?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case j:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case I:return"Suspense";case F:return"SuspenseList";case U:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case S:return"Portal";case _:return t.displayName||"Context";case N:return(t._context.displayName||"Context")+".Consumer";case B:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case X:return n=t.displayName||null,n!==null?n:J(t.type)||"Memo";case W:n=t._payload,t=t._init;try{return J(t(n))}catch{}}return null}var Q=Array.isArray,H=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},we=[],T=-1;function z(t){return{current:t}}function Z(t){0>T||(t.current=we[T],we[T]=null,T--)}function D(t,n){T++,we[T]=t.current,t.current=n}var xe=z(null),Ce=z(null),ge=z(null),Me=z(null);function Ee(t,n){switch(D(ge,n),D(Ce,t),D(xe,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?e1(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=e1(n),t=t1(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Z(xe),D(xe,t)}function Ie(){Z(xe),Z(Ce),Z(ge)}function oe(t){t.memoizedState!==null&&D(Me,t);var n=xe.current,l=t1(n,t.type);n!==l&&(D(Ce,t),D(xe,l))}function at(t){Ce.current===t&&(Z(xe),Z(Ce)),Me.current===t&&(Z(Me),$s._currentValue=ne)}var Ct,jt;function Vt(t){if(Ct===void 0)try{throw Error()}catch(l){var n=l.stack.trim().match(/\n( *(at )?)/);Ct=n&&n[1]||"",jt=-1<l.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+Ct+t+jt}var pe=!1;function he(t,n){if(!t||pe)return"";pe=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(n){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(se){var le=se}Reflect.construct(t,[],fe)}else{try{fe.call()}catch(se){le=se}t.call(fe.prototype)}}else{try{throw Error()}catch(se){le=se}(fe=t())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(se){if(se&&le&&typeof se.stack=="string")return[se.stack,le.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=o.DetermineComponentFrameRoot(),k=p[0],A=p[1];if(k&&A){var L=k.split(`
|
|
44
|
+
`),te=A.split(`
|
|
45
|
+
`);for(h=o=0;o<L.length&&!L[o].includes("DetermineComponentFrameRoot");)o++;for(;h<te.length&&!te[h].includes("DetermineComponentFrameRoot");)h++;if(o===L.length||h===te.length)for(o=L.length-1,h=te.length-1;1<=o&&0<=h&&L[o]!==te[h];)h--;for(;1<=o&&0<=h;o--,h--)if(L[o]!==te[h]){if(o!==1||h!==1)do if(o--,h--,0>h||L[o]!==te[h]){var ce=`
|
|
46
|
+
`+L[o].replace(" at new "," at ");return t.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",t.displayName)),ce}while(1<=o&&0<=h);break}}}finally{pe=!1,Error.prepareStackTrace=l}return(l=t?t.displayName||t.name:"")?Vt(l):""}function ke(t,n){switch(t.tag){case 26:case 27:case 5:return Vt(t.type);case 16:return Vt("Lazy");case 13:return t.child!==n&&n!==null?Vt("Suspense Fallback"):Vt("Suspense");case 19:return Vt("SuspenseList");case 0:case 15:return he(t.type,!1);case 11:return he(t.type.render,!1);case 1:return he(t.type,!0);case 31:return Vt("Activity");default:return""}}function Ae(t){try{var n="",l=null;do n+=ke(t,l),l=t,t=t.return;while(t);return n}catch(o){return`
|
|
47
|
+
Error generating stack: `+o.message+`
|
|
48
|
+
`+o.stack}}var Fe=Object.prototype.hasOwnProperty,Re=e.unstable_scheduleCallback,Ne=e.unstable_cancelCallback,ze=e.unstable_shouldYield,Pe=e.unstable_requestPaint,_e=e.unstable_now,et=e.unstable_getCurrentPriorityLevel,re=e.unstable_ImmediatePriority,ye=e.unstable_UserBlockingPriority,De=e.unstable_NormalPriority,He=e.unstable_LowPriority,de=e.unstable_IdlePriority,Te=e.log,wt=e.unstable_setDisableYieldValue,it=null,rt=null;function yt(t){if(typeof Te=="function"&&wt(t),rt&&typeof rt.setStrictMode=="function")try{rt.setStrictMode(it,t)}catch{}}var st=Math.clz32?Math.clz32:oa,bn=Math.log,Yt=Math.LN2;function oa(t){return t>>>=0,t===0?32:31-(bn(t)/Yt|0)|0}var $n=256,ln=262144,Xn=4194304;function Ln(t){var n=t&42;if(n!==0)return n;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 P(t,n,l){var o=t.pendingLanes;if(o===0)return 0;var h=0,p=t.suspendedLanes,k=t.pingedLanes;t=t.warmLanes;var A=o&134217727;return A!==0?(o=A&~p,o!==0?h=Ln(o):(k&=A,k!==0?h=Ln(k):l||(l=A&~t,l!==0&&(h=Ln(l))))):(A=o&~p,A!==0?h=Ln(A):k!==0?h=Ln(k):l||(l=o&~t,l!==0&&(h=Ln(l)))),h===0?0:n!==0&&n!==h&&(n&p)===0&&(p=h&-h,l=n&-n,p>=l||p===32&&(l&4194048)!==0)?n:h}function Ue(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Rt(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function tt(){var t=Xn;return Xn<<=1,(Xn&62914560)===0&&(Xn=4194304),t}function Pt(t){for(var n=[],l=0;31>l;l++)n.push(t);return n}function Jt(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function An(t,n,l,o,h,p){var k=t.pendingLanes;t.pendingLanes=l,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=l,t.entangledLanes&=l,t.errorRecoveryDisabledLanes&=l,t.shellSuspendCounter=0;var A=t.entanglements,L=t.expirationTimes,te=t.hiddenUpdates;for(l=k&~l;0<l;){var ce=31-st(l),fe=1<<ce;A[ce]=0,L[ce]=-1;var le=te[ce];if(le!==null)for(te[ce]=null,ce=0;ce<le.length;ce++){var se=le[ce];se!==null&&(se.lane&=-536870913)}l&=~fe}o!==0&&br(t,o,0),p!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=p&~(k&~n))}function br(t,n,l){t.pendingLanes|=n,t.suspendedLanes&=~n;var o=31-st(n);t.entangledLanes|=n,t.entanglements[o]=t.entanglements[o]|1073741824|l&261930}function Jl(t,n){var l=t.entangledLanes|=n;for(t=t.entanglements;l;){var o=31-st(l),h=1<<o;h&n|t[o]&n&&(t[o]|=n),l&=~h}}function Hn(t,n){var l=n&-n;return l=(l&42)!==0?1:Tn(l),(l&(t.suspendedLanes|n))!==0?0:l}function Tn(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 be(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Cn(){var t=Y.p;return t!==0?t:(t=window.event,t===void 0?32:S1(t.type))}function jl(t,n){var l=Y.p;try{return Y.p=t,n()}finally{Y.p=l}}var lr=Math.random().toString(36).slice(2),sn="__reactFiber$"+lr,Gt="__reactProps$"+lr,Fa="__reactContainer$"+lr,Ur="__reactEvents$"+lr,Wi="__reactListeners$"+lr,_a="__reactHandles$"+lr,ca="__reactResources$"+lr,vr="__reactMarker$"+lr;function ei(t){delete t[sn],delete t[Gt],delete t[Ur],delete t[Wi],delete t[_a]}function ir(t){var n=t[sn];if(n)return n;for(var l=t.parentNode;l;){if(n=l[Fa]||l[sn]){if(l=n.alternate,n.child!==null||l!==null&&l.child!==null)for(t=o1(t);t!==null;){if(l=t[sn])return l;t=o1(t)}return n}t=l,l=t.parentNode}return null}function ua(t){if(t=t[sn]||t[Fa]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function Oa(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(i(33))}function qr(t){var n=t[ca];return n||(n=t[ca]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function on(t){t[vr]=!0}var Ki=new Set,Yr={};function Mr(t,n){da(t,n),da(t+"Capture",n)}function da(t,n){for(Yr[t]=n,t=0;t<n.length;t++)Ki.add(n[t])}var bo=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]*$"),vo={},ti={};function wr(t){return Fe.call(ti,t)?!0:Fe.call(vo,t)?!1:bo.test(t)?ti[t]=!0:(vo[t]=!0,!1)}function sr(t,n,l){if(wr(n))if(l===null)t.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var o=n.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+l)}}function Xr(t,n,l){if(l===null)t.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttribute(n,""+l)}}function Fr(t,n,l,o){if(o===null)t.removeAttribute(l);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(l);return}t.setAttributeNS(n,l,""+o)}}function en(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Qt(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function fa(t,n,l){var o=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,p=o.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return h.call(this)},set:function(k){l=""+k,p.call(this,k)}}),Object.defineProperty(t,n,{enumerable:o.enumerable}),{getValue:function(){return l},setValue:function(k){l=""+k},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function Dn(t){if(!t._valueTracker){var n=Qt(t)?"checked":"value";t._valueTracker=fa(t,n,""+t[n])}}function Ba(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var l=n.getValue(),o="";return t&&(o=Qt(t)?t.checked?"true":"false":t.value),t=o,t!==l?(n.setValue(t),!0):!1}function $a(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 mu=/[\n"\\]/g;function En(t){return t.replace(mu,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function ha(t,n,l,o,h,p,k,A){t.name="",k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?t.type=k:t.removeAttribute("type"),n!=null?k==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+en(n)):t.value!==""+en(n)&&(t.value=""+en(n)):k!=="submit"&&k!=="reset"||t.removeAttribute("value"),n!=null?Zi(t,k,en(n)):l!=null?Zi(t,k,en(l)):o!=null&&t.removeAttribute("value"),h==null&&p!=null&&(t.defaultChecked=!!p),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?t.name=""+en(A):t.removeAttribute("name")}function ma(t,n,l,o,h,p,k,A){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(t.type=p),n!=null||l!=null){if(!(p!=="submit"&&p!=="reset"||n!=null)){Dn(t);return}l=l!=null?""+en(l):"",n=n!=null?""+en(n):l,A||n===t.value||(t.value=n),t.defaultValue=n}o=o??h,o=typeof o!="function"&&typeof o!="symbol"&&!!o,t.checked=A?t.checked:!!o,t.defaultChecked=!!o,k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(t.name=k),Dn(t)}function Zi(t,n,l){n==="number"&&$a(t.ownerDocument)===t||t.defaultValue===""+l||(t.defaultValue=""+l)}function Mt(t,n,l,o){if(t=t.options,n){n={};for(var h=0;h<l.length;h++)n["$"+l[h]]=!0;for(l=0;l<t.length;l++)h=n.hasOwnProperty("$"+t[l].value),t[l].selected!==h&&(t[l].selected=h),h&&o&&(t[l].defaultSelected=!0)}else{for(l=""+en(l),n=null,h=0;h<t.length;h++){if(t[h].value===l){t[h].selected=!0,o&&(t[h].defaultSelected=!0);return}n!==null||t[h].disabled||(n=t[h])}n!==null&&(n.selected=!0)}}function wo(t,n,l){if(n!=null&&(n=""+en(n),n!==t.value&&(t.value=n),l==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=l!=null?""+en(l):""}function Vr(t,n,l,o){if(n==null){if(o!=null){if(l!=null)throw Error(i(92));if(Q(o)){if(1<o.length)throw Error(i(93));o=o[0]}l=o}l==null&&(l=""),n=l}l=en(n),t.defaultValue=l,o=t.textContent,o===l&&o!==""&&o!==null&&(t.value=o),Dn(t)}function Gr(t,n){if(n){var l=t.firstChild;if(l&&l===t.lastChild&&l.nodeType===3){l.nodeValue=n;return}}t.textContent=n}var xu=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 ko(t,n,l){var o=n.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?o?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":o?t.setProperty(n,l):typeof l!="number"||l===0||xu.has(n)?n==="float"?t.cssFloat=l:t[n]=(""+l).trim():t[n]=l+"px"}function jo(t,n,l){if(n!=null&&typeof n!="object")throw Error(i(62));if(t=t.style,l!=null){for(var o in l)!l.hasOwnProperty(o)||n!=null&&n.hasOwnProperty(o)||(o.indexOf("--")===0?t.setProperty(o,""):o==="float"?t.cssFloat="":t[o]="");for(var h in n)o=n[h],n.hasOwnProperty(h)&&l[h]!==o&&ko(t,h,o)}else for(var p in n)n.hasOwnProperty(p)&&ko(t,p,n[p])}function Sl(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 Pi=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"]]),pu=/^[\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 ni(t){return pu.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function kr(){}var Ji=null;function es(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var La=null,Ha=null;function So(t){var n=ua(t);if(n&&(t=n.stateNode)){var l=t[Gt]||null;e:switch(t=n.stateNode,n.type){case"input":if(ha(t,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),n=l.name,l.type==="radio"&&n!=null){for(l=t;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+En(""+n)+'"][type="radio"]'),n=0;n<l.length;n++){var o=l[n];if(o!==t&&o.form===t.form){var h=o[Gt]||null;if(!h)throw Error(i(90));ha(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(n=0;n<l.length;n++)o=l[n],o.form===t.form&&Ba(o)}break e;case"textarea":wo(t,l.value,l.defaultValue);break e;case"select":n=l.value,n!=null&&Mt(t,!!l.multiple,n,!1)}}}var ts=!1;function Co(t,n,l){if(ts)return t(n,l);ts=!0;try{var o=t(n);return o}finally{if(ts=!1,(La!==null||Ha!==null)&&(oc(),La&&(n=La,t=Ha,Ha=La=null,So(n),t)))for(n=0;n<t.length;n++)So(t[n])}}function Kn(t,n){var l=t.stateNode;if(l===null)return null;var o=l[Gt]||null;if(o===null)return null;l=o[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(t=t.type,o=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!o;break e;default:t=!1}if(t)return null;if(l&&typeof l!="function")throw Error(i(231,n,typeof l));return l}var or=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ns=!1;if(or)try{var Cl={};Object.defineProperty(Cl,"passive",{get:function(){ns=!0}}),window.addEventListener("test",Cl,Cl),window.removeEventListener("test",Cl,Cl)}catch{ns=!1}var zn=null,ri=null,ai=null;function Eo(){if(ai)return ai;var t,n=ri,l=n.length,o,h="value"in zn?zn.value:zn.textContent,p=h.length;for(t=0;t<l&&n[t]===h[t];t++);var k=l-t;for(o=1;o<=k&&n[l-o]===h[p-o];o++);return ai=h.slice(t,1<o?1-o:void 0)}function cn(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function Qr(){return!0}function rs(){return!1}function Rn(t){function n(l,o,h,p,k){this._reactName=l,this._targetInst=h,this.type=o,this.nativeEvent=p,this.target=k,this.currentTarget=null;for(var A in t)t.hasOwnProperty(A)&&(l=t[A],this[A]=l?l(p):p[A]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Qr:rs,this.isPropagationStopped=rs,this}return g(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Qr)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Qr)},persist:function(){},isPersistent:Qr}),n}var Wr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},R=Rn(Wr),ae=g({},Wr,{view:0,detail:0}),ie=Rn(ae),me,ve,Ke,ht=g({},ae,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gu,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!==Ke&&(Ke&&t.type==="mousemove"?(me=t.screenX-Ke.screenX,ve=t.screenY-Ke.screenY):ve=me=0,Ke=t),me)},movementY:function(t){return"movementY"in t?t.movementY:ve}}),$e=Rn(ht),Ve=g({},ht,{dataTransfer:0}),Qe=Rn(Ve),Je=g({},ae,{relatedTarget:0}),It=Rn(Je),li=g({},Wr,{animationName:0,elapsedTime:0,pseudoElement:0}),ii=Rn(li),yu=g({},Wr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),un=Rn(yu),Ia=g({},Wr,{data:0}),jr=Rn(Ia),Mn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},as={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"},dn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function hb(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=dn[t])?!!n[t]:!1}function gu(){return hb}var mb=g({},ae,{key:function(t){if(t.key){var n=Mn[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=cn(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?as[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gu,charCode:function(t){return t.type==="keypress"?cn(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?cn(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),xb=Rn(mb),pb=g({},ht,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),lm=Rn(pb),yb=g({},ae,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gu}),gb=Rn(yb),bb=g({},Wr,{propertyName:0,elapsedTime:0,pseudoElement:0}),vb=Rn(bb),wb=g({},ht,{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}),kb=Rn(wb),jb=g({},Wr,{newState:0,oldState:0}),Sb=Rn(jb),Cb=[9,13,27,32],bu=or&&"CompositionEvent"in window,ls=null;or&&"documentMode"in document&&(ls=document.documentMode);var Eb=or&&"TextEvent"in window&&!ls,im=or&&(!bu||ls&&8<ls&&11>=ls),sm=" ",om=!1;function cm(t,n){switch(t){case"keyup":return Cb.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function um(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var si=!1;function Nb(t,n){switch(t){case"compositionend":return um(n);case"keypress":return n.which!==32?null:(om=!0,sm);case"textInput":return t=n.data,t===sm&&om?null:t;default:return null}}function Ab(t,n){if(si)return t==="compositionend"||!bu&&cm(t,n)?(t=Eo(),ai=ri=zn=null,si=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return im&&n.locale!=="ko"?null:n.data;default:return null}}var Tb={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 dm(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!Tb[t.type]:n==="textarea"}function fm(t,n,l,o){La?Ha?Ha.push(o):Ha=[o]:La=o,n=xc(n,"onChange"),0<n.length&&(l=new R("onChange","change",null,l,o),t.push({event:l,listeners:n}))}var is=null,ss=null;function Db(t){Qp(t,0)}function No(t){var n=Oa(t);if(Ba(n))return t}function hm(t,n){if(t==="change")return n}var mm=!1;if(or){var vu;if(or){var wu="oninput"in document;if(!wu){var xm=document.createElement("div");xm.setAttribute("oninput","return;"),wu=typeof xm.oninput=="function"}vu=wu}else vu=!1;mm=vu&&(!document.documentMode||9<document.documentMode)}function pm(){is&&(is.detachEvent("onpropertychange",ym),ss=is=null)}function ym(t){if(t.propertyName==="value"&&No(ss)){var n=[];fm(n,ss,t,es(t)),Co(Db,n)}}function zb(t,n,l){t==="focusin"?(pm(),is=n,ss=l,is.attachEvent("onpropertychange",ym)):t==="focusout"&&pm()}function Rb(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return No(ss)}function Mb(t,n){if(t==="click")return No(n)}function Fb(t,n){if(t==="input"||t==="change")return No(n)}function _b(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var cr=typeof Object.is=="function"?Object.is:_b;function os(t,n){if(cr(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var l=Object.keys(t),o=Object.keys(n);if(l.length!==o.length)return!1;for(o=0;o<l.length;o++){var h=l[o];if(!Fe.call(n,h)||!cr(t[h],n[h]))return!1}return!0}function gm(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function bm(t,n){var l=gm(t);t=0;for(var o;l;){if(l.nodeType===3){if(o=t+l.textContent.length,t<=n&&o>=n)return{node:l,offset:n-t};t=o}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=gm(l)}}function vm(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?vm(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function wm(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=$a(t.document);n instanceof t.HTMLIFrameElement;){try{var l=typeof n.contentWindow.location.href=="string"}catch{l=!1}if(l)t=n.contentWindow;else break;n=$a(t.document)}return n}function ku(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var Ob=or&&"documentMode"in document&&11>=document.documentMode,oi=null,ju=null,cs=null,Su=!1;function km(t,n,l){var o=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Su||oi==null||oi!==$a(o)||(o=oi,"selectionStart"in o&&ku(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),cs&&os(cs,o)||(cs=o,o=xc(ju,"onSelect"),0<o.length&&(n=new R("onSelect","select",null,n,l),t.push({event:n,listeners:o}),n.target=oi)))}function El(t,n){var l={};return l[t.toLowerCase()]=n.toLowerCase(),l["Webkit"+t]="webkit"+n,l["Moz"+t]="moz"+n,l}var ci={animationend:El("Animation","AnimationEnd"),animationiteration:El("Animation","AnimationIteration"),animationstart:El("Animation","AnimationStart"),transitionrun:El("Transition","TransitionRun"),transitionstart:El("Transition","TransitionStart"),transitioncancel:El("Transition","TransitionCancel"),transitionend:El("Transition","TransitionEnd")},Cu={},jm={};or&&(jm=document.createElement("div").style,"AnimationEvent"in window||(delete ci.animationend.animation,delete ci.animationiteration.animation,delete ci.animationstart.animation),"TransitionEvent"in window||delete ci.transitionend.transition);function Nl(t){if(Cu[t])return Cu[t];if(!ci[t])return t;var n=ci[t],l;for(l in n)if(n.hasOwnProperty(l)&&l in jm)return Cu[t]=n[l];return t}var Sm=Nl("animationend"),Cm=Nl("animationiteration"),Em=Nl("animationstart"),Bb=Nl("transitionrun"),$b=Nl("transitionstart"),Lb=Nl("transitioncancel"),Nm=Nl("transitionend"),Am=new Map,Eu="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(" ");Eu.push("scrollEnd");function _r(t,n){Am.set(t,n),Mr(n,[t])}var Ao=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=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(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Sr=[],ui=0,Nu=0;function To(){for(var t=ui,n=Nu=ui=0;n<t;){var l=Sr[n];Sr[n++]=null;var o=Sr[n];Sr[n++]=null;var h=Sr[n];Sr[n++]=null;var p=Sr[n];if(Sr[n++]=null,o!==null&&h!==null){var k=o.pending;k===null?h.next=h:(h.next=k.next,k.next=h),o.pending=h}p!==0&&Tm(l,h,p)}}function Do(t,n,l,o){Sr[ui++]=t,Sr[ui++]=n,Sr[ui++]=l,Sr[ui++]=o,Nu|=o,t.lanes|=o,t=t.alternate,t!==null&&(t.lanes|=o)}function Au(t,n,l,o){return Do(t,n,l,o),zo(t)}function Al(t,n){return Do(t,null,null,n),zo(t)}function Tm(t,n,l){t.lanes|=l;var o=t.alternate;o!==null&&(o.lanes|=l);for(var h=!1,p=t.return;p!==null;)p.childLanes|=l,o=p.alternate,o!==null&&(o.childLanes|=l),p.tag===22&&(t=p.stateNode,t===null||t._visibility&1||(h=!0)),t=p,p=p.return;return t.tag===3?(p=t.stateNode,h&&n!==null&&(h=31-st(l),t=p.hiddenUpdates,o=t[h],o===null?t[h]=[n]:o.push(n),n.lane=l|536870912),p):null}function zo(t){if(50<zs)throw zs=0,Bd=null,Error(i(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var di={};function Hb(t,n,l,o){this.tag=t,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ur(t,n,l,o){return new Hb(t,n,l,o)}function Tu(t){return t=t.prototype,!(!t||!t.isReactComponent)}function xa(t,n){var l=t.alternate;return l===null?(l=ur(t.tag,n,t.key,t.mode),l.elementType=t.elementType,l.type=t.type,l.stateNode=t.stateNode,l.alternate=t,t.alternate=l):(l.pendingProps=n,l.type=t.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=t.flags&65011712,l.childLanes=t.childLanes,l.lanes=t.lanes,l.child=t.child,l.memoizedProps=t.memoizedProps,l.memoizedState=t.memoizedState,l.updateQueue=t.updateQueue,n=t.dependencies,l.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},l.sibling=t.sibling,l.index=t.index,l.ref=t.ref,l.refCleanup=t.refCleanup,l}function Dm(t,n){t.flags&=65011714;var l=t.alternate;return l===null?(t.childLanes=0,t.lanes=n,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=l.childLanes,t.lanes=l.lanes,t.child=l.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=l.memoizedProps,t.memoizedState=l.memoizedState,t.updateQueue=l.updateQueue,t.type=l.type,n=l.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function Ro(t,n,l,o,h,p){var k=0;if(o=t,typeof t=="function")Tu(t)&&(k=1);else if(typeof t=="string")k=X2(t,l,xe.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case U:return t=ur(31,l,n,h),t.elementType=U,t.lanes=p,t;case j:return Tl(l.children,h,p,n);case C:k=8,h|=24;break;case E:return t=ur(12,l,n,h|2),t.elementType=E,t.lanes=p,t;case I:return t=ur(13,l,n,h),t.elementType=I,t.lanes=p,t;case F:return t=ur(19,l,n,h),t.elementType=F,t.lanes=p,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case _:k=10;break e;case N:k=9;break e;case B:k=11;break e;case X:k=14;break e;case W:k=16,o=null;break e}k=29,l=Error(i(130,t===null?"null":typeof t,"")),o=null}return n=ur(k,l,n,h),n.elementType=t,n.type=o,n.lanes=p,n}function Tl(t,n,l,o){return t=ur(7,t,o,n),t.lanes=l,t}function Du(t,n,l){return t=ur(6,t,null,n),t.lanes=l,t}function zm(t){var n=ur(18,null,null,0);return n.stateNode=t,n}function zu(t,n,l){return n=ur(4,t.children!==null?t.children:[],t.key,n),n.lanes=l,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var Rm=new WeakMap;function Cr(t,n){if(typeof t=="object"&&t!==null){var l=Rm.get(t);return l!==void 0?l:(n={value:t,source:n,stack:Ae(n)},Rm.set(t,n),n)}return{value:t,source:n,stack:Ae(n)}}var fi=[],hi=0,Mo=null,us=0,Er=[],Nr=0,Ua=null,Kr=1,Zr="";function pa(t,n){fi[hi++]=us,fi[hi++]=Mo,Mo=t,us=n}function Mm(t,n,l){Er[Nr++]=Kr,Er[Nr++]=Zr,Er[Nr++]=Ua,Ua=t;var o=Kr;t=Zr;var h=32-st(o)-1;o&=~(1<<h),l+=1;var p=32-st(n)+h;if(30<p){var k=h-h%5;p=(o&(1<<k)-1).toString(32),o>>=k,h-=k,Kr=1<<32-st(n)+h|l<<h|o,Zr=p+t}else Kr=1<<p|l<<h|o,Zr=t}function Ru(t){t.return!==null&&(pa(t,1),Mm(t,1,0))}function Mu(t){for(;t===Mo;)Mo=fi[--hi],fi[hi]=null,us=fi[--hi],fi[hi]=null;for(;t===Ua;)Ua=Er[--Nr],Er[Nr]=null,Zr=Er[--Nr],Er[Nr]=null,Kr=Er[--Nr],Er[Nr]=null}function Fm(t,n){Er[Nr++]=Kr,Er[Nr++]=Zr,Er[Nr++]=Ua,Kr=n.id,Zr=n.overflow,Ua=t}var Fn=null,Wt=null,kt=!1,qa=null,Ar=!1,Fu=Error(i(519));function Ya(t){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ds(Cr(n,t)),Fu}function _m(t){var n=t.stateNode,l=t.type,o=t.memoizedProps;switch(n[sn]=t,n[Gt]=o,l){case"dialog":xt("cancel",n),xt("close",n);break;case"iframe":case"object":case"embed":xt("load",n);break;case"video":case"audio":for(l=0;l<Ms.length;l++)xt(Ms[l],n);break;case"source":xt("error",n);break;case"img":case"image":case"link":xt("error",n),xt("load",n);break;case"details":xt("toggle",n);break;case"input":xt("invalid",n),ma(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":xt("invalid",n);break;case"textarea":xt("invalid",n),Vr(n,o.value,o.defaultValue,o.children)}l=o.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||n.textContent===""+l||o.suppressHydrationWarning===!0||Pp(n.textContent,l)?(o.popover!=null&&(xt("beforetoggle",n),xt("toggle",n)),o.onScroll!=null&&xt("scroll",n),o.onScrollEnd!=null&&xt("scrollend",n),o.onClick!=null&&(n.onclick=kr),n=!0):n=!1,n||Ya(t,!0)}function Om(t){for(Fn=t.return;Fn;)switch(Fn.tag){case 5:case 31:case 13:Ar=!1;return;case 27:case 3:Ar=!0;return;default:Fn=Fn.return}}function mi(t){if(t!==Fn)return!1;if(!kt)return Om(t),kt=!0,!1;var n=t.tag,l;if((l=n!==3&&n!==27)&&((l=n===5)&&(l=t.type,l=!(l!=="form"&&l!=="button")||Pd(t.type,t.memoizedProps)),l=!l),l&&Wt&&Ya(t),Om(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));Wt=s1(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));Wt=s1(t)}else n===27?(n=Wt,al(t.type)?(t=rf,rf=null,Wt=t):Wt=n):Wt=Fn?Dr(t.stateNode.nextSibling):null;return!0}function Dl(){Wt=Fn=null,kt=!1}function _u(){var t=qa;return t!==null&&(er===null?er=t:er.push.apply(er,t),qa=null),t}function ds(t){qa===null?qa=[t]:qa.push(t)}var Ou=z(null),zl=null,ya=null;function Xa(t,n,l){D(Ou,n._currentValue),n._currentValue=l}function ga(t){t._currentValue=Ou.current,Z(Ou)}function Bu(t,n,l){for(;t!==null;){var o=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),t===l)break;t=t.return}}function $u(t,n,l,o){var h=t.child;for(h!==null&&(h.return=t);h!==null;){var p=h.dependencies;if(p!==null){var k=h.child;p=p.firstContext;e:for(;p!==null;){var A=p;p=h;for(var L=0;L<n.length;L++)if(A.context===n[L]){p.lanes|=l,A=p.alternate,A!==null&&(A.lanes|=l),Bu(p.return,l,t),o||(k=null);break e}p=A.next}}else if(h.tag===18){if(k=h.return,k===null)throw Error(i(341));k.lanes|=l,p=k.alternate,p!==null&&(p.lanes|=l),Bu(k,l,t),k=null}else k=h.child;if(k!==null)k.return=h;else for(k=h;k!==null;){if(k===t){k=null;break}if(h=k.sibling,h!==null){h.return=k.return,k=h;break}k=k.return}h=k}}function xi(t,n,l,o){t=null;for(var h=n,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var k=h.alternate;if(k===null)throw Error(i(387));if(k=k.memoizedProps,k!==null){var A=h.type;cr(h.pendingProps.value,k.value)||(t!==null?t.push(A):t=[A])}}else if(h===Me.current){if(k=h.alternate,k===null)throw Error(i(387));k.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push($s):t=[$s])}h=h.return}t!==null&&$u(n,t,l,o),n.flags|=262144}function Fo(t){for(t=t.firstContext;t!==null;){if(!cr(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Rl(t){zl=t,ya=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function _n(t){return Bm(zl,t)}function _o(t,n){return zl===null&&Rl(t),Bm(t,n)}function Bm(t,n){var l=n._currentValue;if(n={context:n,memoizedValue:l,next:null},ya===null){if(t===null)throw Error(i(308));ya=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else ya=ya.next=n;return l}var Ib=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(l,o){t.push(o)}};this.abort=function(){n.aborted=!0,t.forEach(function(l){return l()})}},Ub=e.unstable_scheduleCallback,qb=e.unstable_NormalPriority,mn={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Lu(){return{controller:new Ib,data:new Map,refCount:0}}function fs(t){t.refCount--,t.refCount===0&&Ub(qb,function(){t.controller.abort()})}var hs=null,Hu=0,pi=0,yi=null;function Yb(t,n){if(hs===null){var l=hs=[];Hu=0,pi=qd(),yi={status:"pending",value:void 0,then:function(o){l.push(o)}}}return Hu++,n.then($m,$m),n}function $m(){if(--Hu===0&&hs!==null){yi!==null&&(yi.status="fulfilled");var t=hs;hs=null,pi=0,yi=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function Xb(t,n){var l=[],o={status:"pending",value:null,reason:null,then:function(h){l.push(h)}};return t.then(function(){o.status="fulfilled",o.value=n;for(var h=0;h<l.length;h++)(0,l[h])(n)},function(h){for(o.status="rejected",o.reason=h,h=0;h<l.length;h++)(0,l[h])(void 0)}),o}var Lm=H.S;H.S=function(t,n){kp=_e(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Yb(t,n),Lm!==null&&Lm(t,n)};var Ml=z(null);function Iu(){var t=Ml.current;return t!==null?t:Ut.pooledCache}function Oo(t,n){n===null?D(Ml,Ml.current):D(Ml,n.pool)}function Hm(){var t=Iu();return t===null?null:{parent:mn._currentValue,pool:t}}var gi=Error(i(460)),Uu=Error(i(474)),Bo=Error(i(542)),$o={then:function(){}};function Im(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Um(t,n,l){switch(l=t[l],l===void 0?t.push(n):l!==n&&(n.then(kr,kr),n=l),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,Ym(t),t;default:if(typeof n.status=="string")n.then(kr,kr);else{if(t=Ut,t!==null&&100<t.shellSuspendCounter)throw Error(i(482));t=n,t.status="pending",t.then(function(o){if(n.status==="pending"){var h=n;h.status="fulfilled",h.value=o}},function(o){if(n.status==="pending"){var h=n;h.status="rejected",h.reason=o}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,Ym(t),t}throw _l=n,gi}}function Fl(t){try{var n=t._init;return n(t._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(_l=l,gi):l}}var _l=null;function qm(){if(_l===null)throw Error(i(459));var t=_l;return _l=null,t}function Ym(t){if(t===gi||t===Bo)throw Error(i(483))}var bi=null,ms=0;function Lo(t){var n=ms;return ms+=1,bi===null&&(bi=[]),Um(bi,t,n)}function xs(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function Ho(t,n){throw n.$$typeof===b?Error(i(525)):(t=Object.prototype.toString.call(n),Error(i(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function Xm(t){function n(K,q){if(t){var ee=K.deletions;ee===null?(K.deletions=[q],K.flags|=16):ee.push(q)}}function l(K,q){if(!t)return null;for(;q!==null;)n(K,q),q=q.sibling;return null}function o(K){for(var q=new Map;K!==null;)K.key!==null?q.set(K.key,K):q.set(K.index,K),K=K.sibling;return q}function h(K,q){return K=xa(K,q),K.index=0,K.sibling=null,K}function p(K,q,ee){return K.index=ee,t?(ee=K.alternate,ee!==null?(ee=ee.index,ee<q?(K.flags|=67108866,q):ee):(K.flags|=67108866,q)):(K.flags|=1048576,q)}function k(K){return t&&K.alternate===null&&(K.flags|=67108866),K}function A(K,q,ee,ue){return q===null||q.tag!==6?(q=Du(ee,K.mode,ue),q.return=K,q):(q=h(q,ee),q.return=K,q)}function L(K,q,ee,ue){var Ye=ee.type;return Ye===j?ce(K,q,ee.props.children,ue,ee.key):q!==null&&(q.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===W&&Fl(Ye)===q.type)?(q=h(q,ee.props),xs(q,ee),q.return=K,q):(q=Ro(ee.type,ee.key,ee.props,null,K.mode,ue),xs(q,ee),q.return=K,q)}function te(K,q,ee,ue){return q===null||q.tag!==4||q.stateNode.containerInfo!==ee.containerInfo||q.stateNode.implementation!==ee.implementation?(q=zu(ee,K.mode,ue),q.return=K,q):(q=h(q,ee.children||[]),q.return=K,q)}function ce(K,q,ee,ue,Ye){return q===null||q.tag!==7?(q=Tl(ee,K.mode,ue,Ye),q.return=K,q):(q=h(q,ee),q.return=K,q)}function fe(K,q,ee){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Du(""+q,K.mode,ee),q.return=K,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case v:return ee=Ro(q.type,q.key,q.props,null,K.mode,ee),xs(ee,q),ee.return=K,ee;case S:return q=zu(q,K.mode,ee),q.return=K,q;case W:return q=Fl(q),fe(K,q,ee)}if(Q(q)||O(q))return q=Tl(q,K.mode,ee,null),q.return=K,q;if(typeof q.then=="function")return fe(K,Lo(q),ee);if(q.$$typeof===_)return fe(K,_o(K,q),ee);Ho(K,q)}return null}function le(K,q,ee,ue){var Ye=q!==null?q.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return Ye!==null?null:A(K,q,""+ee,ue);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case v:return ee.key===Ye?L(K,q,ee,ue):null;case S:return ee.key===Ye?te(K,q,ee,ue):null;case W:return ee=Fl(ee),le(K,q,ee,ue)}if(Q(ee)||O(ee))return Ye!==null?null:ce(K,q,ee,ue,null);if(typeof ee.then=="function")return le(K,q,Lo(ee),ue);if(ee.$$typeof===_)return le(K,q,_o(K,ee),ue);Ho(K,ee)}return null}function se(K,q,ee,ue,Ye){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return K=K.get(ee)||null,A(q,K,""+ue,Ye);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case v:return K=K.get(ue.key===null?ee:ue.key)||null,L(q,K,ue,Ye);case S:return K=K.get(ue.key===null?ee:ue.key)||null,te(q,K,ue,Ye);case W:return ue=Fl(ue),se(K,q,ee,ue,Ye)}if(Q(ue)||O(ue))return K=K.get(ee)||null,ce(q,K,ue,Ye,null);if(typeof ue.then=="function")return se(K,q,ee,Lo(ue),Ye);if(ue.$$typeof===_)return se(K,q,ee,_o(q,ue),Ye);Ho(q,ue)}return null}function Be(K,q,ee,ue){for(var Ye=null,Et=null,Le=q,ot=q=0,bt=null;Le!==null&&ot<ee.length;ot++){Le.index>ot?(bt=Le,Le=null):bt=Le.sibling;var Nt=le(K,Le,ee[ot],ue);if(Nt===null){Le===null&&(Le=bt);break}t&&Le&&Nt.alternate===null&&n(K,Le),q=p(Nt,q,ot),Et===null?Ye=Nt:Et.sibling=Nt,Et=Nt,Le=bt}if(ot===ee.length)return l(K,Le),kt&&pa(K,ot),Ye;if(Le===null){for(;ot<ee.length;ot++)Le=fe(K,ee[ot],ue),Le!==null&&(q=p(Le,q,ot),Et===null?Ye=Le:Et.sibling=Le,Et=Le);return kt&&pa(K,ot),Ye}for(Le=o(Le);ot<ee.length;ot++)bt=se(Le,K,ot,ee[ot],ue),bt!==null&&(t&&bt.alternate!==null&&Le.delete(bt.key===null?ot:bt.key),q=p(bt,q,ot),Et===null?Ye=bt:Et.sibling=bt,Et=bt);return t&&Le.forEach(function(cl){return n(K,cl)}),kt&&pa(K,ot),Ye}function We(K,q,ee,ue){if(ee==null)throw Error(i(151));for(var Ye=null,Et=null,Le=q,ot=q=0,bt=null,Nt=ee.next();Le!==null&&!Nt.done;ot++,Nt=ee.next()){Le.index>ot?(bt=Le,Le=null):bt=Le.sibling;var cl=le(K,Le,Nt.value,ue);if(cl===null){Le===null&&(Le=bt);break}t&&Le&&cl.alternate===null&&n(K,Le),q=p(cl,q,ot),Et===null?Ye=cl:Et.sibling=cl,Et=cl,Le=bt}if(Nt.done)return l(K,Le),kt&&pa(K,ot),Ye;if(Le===null){for(;!Nt.done;ot++,Nt=ee.next())Nt=fe(K,Nt.value,ue),Nt!==null&&(q=p(Nt,q,ot),Et===null?Ye=Nt:Et.sibling=Nt,Et=Nt);return kt&&pa(K,ot),Ye}for(Le=o(Le);!Nt.done;ot++,Nt=ee.next())Nt=se(Le,K,ot,Nt.value,ue),Nt!==null&&(t&&Nt.alternate!==null&&Le.delete(Nt.key===null?ot:Nt.key),q=p(Nt,q,ot),Et===null?Ye=Nt:Et.sibling=Nt,Et=Nt);return t&&Le.forEach(function(nv){return n(K,nv)}),kt&&pa(K,ot),Ye}function $t(K,q,ee,ue){if(typeof ee=="object"&&ee!==null&&ee.type===j&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case v:e:{for(var Ye=ee.key;q!==null;){if(q.key===Ye){if(Ye=ee.type,Ye===j){if(q.tag===7){l(K,q.sibling),ue=h(q,ee.props.children),ue.return=K,K=ue;break e}}else if(q.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===W&&Fl(Ye)===q.type){l(K,q.sibling),ue=h(q,ee.props),xs(ue,ee),ue.return=K,K=ue;break e}l(K,q);break}else n(K,q);q=q.sibling}ee.type===j?(ue=Tl(ee.props.children,K.mode,ue,ee.key),ue.return=K,K=ue):(ue=Ro(ee.type,ee.key,ee.props,null,K.mode,ue),xs(ue,ee),ue.return=K,K=ue)}return k(K);case S:e:{for(Ye=ee.key;q!==null;){if(q.key===Ye)if(q.tag===4&&q.stateNode.containerInfo===ee.containerInfo&&q.stateNode.implementation===ee.implementation){l(K,q.sibling),ue=h(q,ee.children||[]),ue.return=K,K=ue;break e}else{l(K,q);break}else n(K,q);q=q.sibling}ue=zu(ee,K.mode,ue),ue.return=K,K=ue}return k(K);case W:return ee=Fl(ee),$t(K,q,ee,ue)}if(Q(ee))return Be(K,q,ee,ue);if(O(ee)){if(Ye=O(ee),typeof Ye!="function")throw Error(i(150));return ee=Ye.call(ee),We(K,q,ee,ue)}if(typeof ee.then=="function")return $t(K,q,Lo(ee),ue);if(ee.$$typeof===_)return $t(K,q,_o(K,ee),ue);Ho(K,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,q!==null&&q.tag===6?(l(K,q.sibling),ue=h(q,ee),ue.return=K,K=ue):(l(K,q),ue=Du(ee,K.mode,ue),ue.return=K,K=ue),k(K)):l(K,q)}return function(K,q,ee,ue){try{ms=0;var Ye=$t(K,q,ee,ue);return bi=null,Ye}catch(Le){if(Le===gi||Le===Bo)throw Le;var Et=ur(29,Le,null,K.mode);return Et.lanes=ue,Et.return=K,Et}finally{}}}var Ol=Xm(!0),Vm=Xm(!1),Va=!1;function qu(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Yu(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Ga(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Qa(t,n,l){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(Tt&2)!==0){var h=o.pending;return h===null?n.next=n:(n.next=h.next,h.next=n),o.pending=n,n=zo(t),Tm(t,null,l),n}return Do(t,o,n,l),zo(t)}function ps(t,n,l){if(n=n.updateQueue,n!==null&&(n=n.shared,(l&4194048)!==0)){var o=n.lanes;o&=t.pendingLanes,l|=o,n.lanes=l,Jl(t,l)}}function Xu(t,n){var l=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,l===o)){var h=null,p=null;if(l=l.firstBaseUpdate,l!==null){do{var k={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};p===null?h=p=k:p=p.next=k,l=l.next}while(l!==null);p===null?h=p=n:p=p.next=n}else h=p=n;l={baseState:o.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},t.updateQueue=l;return}t=l.lastBaseUpdate,t===null?l.firstBaseUpdate=n:t.next=n,l.lastBaseUpdate=n}var Vu=!1;function ys(){if(Vu){var t=yi;if(t!==null)throw t}}function gs(t,n,l,o){Vu=!1;var h=t.updateQueue;Va=!1;var p=h.firstBaseUpdate,k=h.lastBaseUpdate,A=h.shared.pending;if(A!==null){h.shared.pending=null;var L=A,te=L.next;L.next=null,k===null?p=te:k.next=te,k=L;var ce=t.alternate;ce!==null&&(ce=ce.updateQueue,A=ce.lastBaseUpdate,A!==k&&(A===null?ce.firstBaseUpdate=te:A.next=te,ce.lastBaseUpdate=L))}if(p!==null){var fe=h.baseState;k=0,ce=te=L=null,A=p;do{var le=A.lane&-536870913,se=le!==A.lane;if(se?(gt&le)===le:(o&le)===le){le!==0&&le===pi&&(Vu=!0),ce!==null&&(ce=ce.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var Be=t,We=A;le=n;var $t=l;switch(We.tag){case 1:if(Be=We.payload,typeof Be=="function"){fe=Be.call($t,fe,le);break e}fe=Be;break e;case 3:Be.flags=Be.flags&-65537|128;case 0:if(Be=We.payload,le=typeof Be=="function"?Be.call($t,fe,le):Be,le==null)break e;fe=g({},fe,le);break e;case 2:Va=!0}}le=A.callback,le!==null&&(t.flags|=64,se&&(t.flags|=8192),se=h.callbacks,se===null?h.callbacks=[le]:se.push(le))}else se={lane:le,tag:A.tag,payload:A.payload,callback:A.callback,next:null},ce===null?(te=ce=se,L=fe):ce=ce.next=se,k|=le;if(A=A.next,A===null){if(A=h.shared.pending,A===null)break;se=A,A=se.next,se.next=null,h.lastBaseUpdate=se,h.shared.pending=null}}while(!0);ce===null&&(L=fe),h.baseState=L,h.firstBaseUpdate=te,h.lastBaseUpdate=ce,p===null&&(h.shared.lanes=0),Ja|=k,t.lanes=k,t.memoizedState=fe}}function Gm(t,n){if(typeof t!="function")throw Error(i(191,t));t.call(n)}function Qm(t,n){var l=t.callbacks;if(l!==null)for(t.callbacks=null,t=0;t<l.length;t++)Gm(l[t],n)}var vi=z(null),Io=z(0);function Wm(t,n){t=Na,D(Io,t),D(vi,n),Na=t|n.baseLanes}function Gu(){D(Io,Na),D(vi,vi.current)}function Qu(){Na=Io.current,Z(vi),Z(Io)}var dr=z(null),Tr=null;function Wa(t){var n=t.alternate;D(fn,fn.current&1),D(dr,t),Tr===null&&(n===null||vi.current!==null||n.memoizedState!==null)&&(Tr=t)}function Wu(t){D(fn,fn.current),D(dr,t),Tr===null&&(Tr=t)}function Km(t){t.tag===22?(D(fn,fn.current),D(dr,t),Tr===null&&(Tr=t)):Ka()}function Ka(){D(fn,fn.current),D(dr,dr.current)}function fr(t){Z(dr),Tr===t&&(Tr=null),Z(fn)}var fn=z(0);function Uo(t){for(var n=t;n!==null;){if(n.tag===13){var l=n.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||tf(l)||nf(l)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var ba=0,lt=null,Ot=null,xn=null,qo=!1,wi=!1,Bl=!1,Yo=0,bs=0,ki=null,Vb=0;function nn(){throw Error(i(321))}function Ku(t,n){if(n===null)return!1;for(var l=0;l<n.length&&l<t.length;l++)if(!cr(t[l],n[l]))return!1;return!0}function Zu(t,n,l,o,h,p){return ba=p,lt=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,H.H=t===null||t.memoizedState===null?Mx:fd,Bl=!1,p=l(o,h),Bl=!1,wi&&(p=Pm(n,l,o,h)),Zm(t),p}function Zm(t){H.H=ks;var n=Ot!==null&&Ot.next!==null;if(ba=0,xn=Ot=lt=null,qo=!1,bs=0,ki=null,n)throw Error(i(300));t===null||pn||(t=t.dependencies,t!==null&&Fo(t)&&(pn=!0))}function Pm(t,n,l,o){lt=t;var h=0;do{if(wi&&(ki=null),bs=0,wi=!1,25<=h)throw Error(i(301));if(h+=1,xn=Ot=null,t.updateQueue!=null){var p=t.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}H.H=Fx,p=n(l,o)}while(wi);return p}function Gb(){var t=H.H,n=t.useState()[0];return n=typeof n.then=="function"?vs(n):n,t=t.useState()[0],(Ot!==null?Ot.memoizedState:null)!==t&&(lt.flags|=1024),n}function Pu(){var t=Yo!==0;return Yo=0,t}function Ju(t,n,l){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~l}function ed(t){if(qo){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}qo=!1}ba=0,xn=Ot=lt=null,wi=!1,bs=Yo=0,ki=null}function Vn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xn===null?lt.memoizedState=xn=t:xn=xn.next=t,xn}function hn(){if(Ot===null){var t=lt.alternate;t=t!==null?t.memoizedState:null}else t=Ot.next;var n=xn===null?lt.memoizedState:xn.next;if(n!==null)xn=n,Ot=t;else{if(t===null)throw lt.alternate===null?Error(i(467)):Error(i(310));Ot=t,t={memoizedState:Ot.memoizedState,baseState:Ot.baseState,baseQueue:Ot.baseQueue,queue:Ot.queue,next:null},xn===null?lt.memoizedState=xn=t:xn=xn.next=t}return xn}function Xo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function vs(t){var n=bs;return bs+=1,ki===null&&(ki=[]),t=Um(ki,t,n),n=lt,(xn===null?n.memoizedState:xn.next)===null&&(n=n.alternate,H.H=n===null||n.memoizedState===null?Mx:fd),t}function Vo(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return vs(t);if(t.$$typeof===_)return _n(t)}throw Error(i(438,String(t)))}function td(t){var n=null,l=lt.updateQueue;if(l!==null&&(n=l.memoCache),n==null){var o=lt.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(n={data:o.data.map(function(h){return h.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),l===null&&(l=Xo(),lt.updateQueue=l),l.memoCache=n,l=n.data[n.index],l===void 0)for(l=n.data[n.index]=Array(t),o=0;o<t;o++)l[o]=M;return n.index++,l}function va(t,n){return typeof n=="function"?n(t):n}function Go(t){var n=hn();return nd(n,Ot,t)}function nd(t,n,l){var o=t.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=l;var h=t.baseQueue,p=o.pending;if(p!==null){if(h!==null){var k=h.next;h.next=p.next,p.next=k}n.baseQueue=h=p,o.pending=null}if(p=t.baseState,h===null)t.memoizedState=p;else{n=h.next;var A=k=null,L=null,te=n,ce=!1;do{var fe=te.lane&-536870913;if(fe!==te.lane?(gt&fe)===fe:(ba&fe)===fe){var le=te.revertLane;if(le===0)L!==null&&(L=L.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),fe===pi&&(ce=!0);else if((ba&le)===le){te=te.next,le===pi&&(ce=!0);continue}else fe={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},L===null?(A=L=fe,k=p):L=L.next=fe,lt.lanes|=le,Ja|=le;fe=te.action,Bl&&l(p,fe),p=te.hasEagerState?te.eagerState:l(p,fe)}else le={lane:fe,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},L===null?(A=L=le,k=p):L=L.next=le,lt.lanes|=fe,Ja|=fe;te=te.next}while(te!==null&&te!==n);if(L===null?k=p:L.next=A,!cr(p,t.memoizedState)&&(pn=!0,ce&&(l=yi,l!==null)))throw l;t.memoizedState=p,t.baseState=k,t.baseQueue=L,o.lastRenderedState=p}return h===null&&(o.lanes=0),[t.memoizedState,o.dispatch]}function rd(t){var n=hn(),l=n.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=t;var o=l.dispatch,h=l.pending,p=n.memoizedState;if(h!==null){l.pending=null;var k=h=h.next;do p=t(p,k.action),k=k.next;while(k!==h);cr(p,n.memoizedState)||(pn=!0),n.memoizedState=p,n.baseQueue===null&&(n.baseState=p),l.lastRenderedState=p}return[p,o]}function Jm(t,n,l){var o=lt,h=hn(),p=kt;if(p){if(l===void 0)throw Error(i(407));l=l()}else l=n();var k=!cr((Ot||h).memoizedState,l);if(k&&(h.memoizedState=l,pn=!0),h=h.queue,id(nx.bind(null,o,h,t),[t]),h.getSnapshot!==n||k||xn!==null&&xn.memoizedState.tag&1){if(o.flags|=2048,ji(9,{destroy:void 0},tx.bind(null,o,h,l,n),null),Ut===null)throw Error(i(349));p||(ba&127)!==0||ex(o,n,l)}return l}function ex(t,n,l){t.flags|=16384,t={getSnapshot:n,value:l},n=lt.updateQueue,n===null?(n=Xo(),lt.updateQueue=n,n.stores=[t]):(l=n.stores,l===null?n.stores=[t]:l.push(t))}function tx(t,n,l,o){n.value=l,n.getSnapshot=o,rx(n)&&ax(t)}function nx(t,n,l){return l(function(){rx(n)&&ax(t)})}function rx(t){var n=t.getSnapshot;t=t.value;try{var l=n();return!cr(t,l)}catch{return!0}}function ax(t){var n=Al(t,2);n!==null&&tr(n,t,2)}function ad(t){var n=Vn();if(typeof t=="function"){var l=t;if(t=l(),Bl){yt(!0);try{l()}finally{yt(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:va,lastRenderedState:t},n}function lx(t,n,l,o){return t.baseState=l,nd(t,Ot,typeof o=="function"?o:va)}function Qb(t,n,l,o,h){if(Ko(t))throw Error(i(485));if(t=n.action,t!==null){var p={payload:h,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(k){p.listeners.push(k)}};H.T!==null?l(!0):p.isTransition=!1,o(p),l=n.pending,l===null?(p.next=n.pending=p,ix(n,p)):(p.next=l.next,n.pending=l.next=p)}}function ix(t,n){var l=n.action,o=n.payload,h=t.state;if(n.isTransition){var p=H.T,k={};H.T=k;try{var A=l(h,o),L=H.S;L!==null&&L(k,A),sx(t,n,A)}catch(te){ld(t,n,te)}finally{p!==null&&k.types!==null&&(p.types=k.types),H.T=p}}else try{p=l(h,o),sx(t,n,p)}catch(te){ld(t,n,te)}}function sx(t,n,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(o){ox(t,n,o)},function(o){return ld(t,n,o)}):ox(t,n,l)}function ox(t,n,l){n.status="fulfilled",n.value=l,cx(n),t.state=l,n=t.pending,n!==null&&(l=n.next,l===n?t.pending=null:(l=l.next,n.next=l,ix(t,l)))}function ld(t,n,l){var o=t.pending;if(t.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=l,cx(n),n=n.next;while(n!==o)}t.action=null}function cx(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function ux(t,n){return n}function dx(t,n){if(kt){var l=Ut.formState;if(l!==null){e:{var o=lt;if(kt){if(Wt){t:{for(var h=Wt,p=Ar;h.nodeType!==8;){if(!p){h=null;break t}if(h=Dr(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Wt=Dr(h.nextSibling),o=h.data==="F!";break e}}Ya(o)}o=!1}o&&(n=l[0])}}return l=Vn(),l.memoizedState=l.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ux,lastRenderedState:n},l.queue=o,l=Dx.bind(null,lt,o),o.dispatch=l,o=ad(!1),p=dd.bind(null,lt,!1,o.queue),o=Vn(),h={state:n,dispatch:null,action:t,pending:null},o.queue=h,l=Qb.bind(null,lt,h,p,l),h.dispatch=l,o.memoizedState=t,[n,l,!1]}function fx(t){var n=hn();return hx(n,Ot,t)}function hx(t,n,l){if(n=nd(t,n,ux)[0],t=Go(va)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=vs(n)}catch(k){throw k===gi?Bo:k}else o=n;n=hn();var h=n.queue,p=h.dispatch;return l!==n.memoizedState&&(lt.flags|=2048,ji(9,{destroy:void 0},Wb.bind(null,h,l),null)),[o,p,t]}function Wb(t,n){t.action=n}function mx(t){var n=hn(),l=Ot;if(l!==null)return hx(n,l,t);hn(),n=n.memoizedState,l=hn();var o=l.queue.dispatch;return l.memoizedState=t,[n,o,!1]}function ji(t,n,l,o){return t={tag:t,create:l,deps:o,inst:n,next:null},n=lt.updateQueue,n===null&&(n=Xo(),lt.updateQueue=n),l=n.lastEffect,l===null?n.lastEffect=t.next=t:(o=l.next,l.next=t,t.next=o,n.lastEffect=t),t}function xx(){return hn().memoizedState}function Qo(t,n,l,o){var h=Vn();lt.flags|=t,h.memoizedState=ji(1|n,{destroy:void 0},l,o===void 0?null:o)}function Wo(t,n,l,o){var h=hn();o=o===void 0?null:o;var p=h.memoizedState.inst;Ot!==null&&o!==null&&Ku(o,Ot.memoizedState.deps)?h.memoizedState=ji(n,p,l,o):(lt.flags|=t,h.memoizedState=ji(1|n,p,l,o))}function px(t,n){Qo(8390656,8,t,n)}function id(t,n){Wo(2048,8,t,n)}function Kb(t){lt.flags|=4;var n=lt.updateQueue;if(n===null)n=Xo(),lt.updateQueue=n,n.events=[t];else{var l=n.events;l===null?n.events=[t]:l.push(t)}}function yx(t){var n=hn().memoizedState;return Kb({ref:n,nextImpl:t}),function(){if((Tt&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function gx(t,n){return Wo(4,2,t,n)}function bx(t,n){return Wo(4,4,t,n)}function vx(t,n){if(typeof n=="function"){t=t();var l=n(t);return function(){typeof l=="function"?l():n(null)}}if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function wx(t,n,l){l=l!=null?l.concat([t]):null,Wo(4,4,vx.bind(null,n,t),l)}function sd(){}function kx(t,n){var l=hn();n=n===void 0?null:n;var o=l.memoizedState;return n!==null&&Ku(n,o[1])?o[0]:(l.memoizedState=[t,n],t)}function jx(t,n){var l=hn();n=n===void 0?null:n;var o=l.memoizedState;if(n!==null&&Ku(n,o[1]))return o[0];if(o=t(),Bl){yt(!0);try{t()}finally{yt(!1)}}return l.memoizedState=[o,n],o}function od(t,n,l){return l===void 0||(ba&1073741824)!==0&&(gt&261930)===0?t.memoizedState=n:(t.memoizedState=l,t=Sp(),lt.lanes|=t,Ja|=t,l)}function Sx(t,n,l,o){return cr(l,n)?l:vi.current!==null?(t=od(t,l,o),cr(t,n)||(pn=!0),t):(ba&42)===0||(ba&1073741824)!==0&&(gt&261930)===0?(pn=!0,t.memoizedState=l):(t=Sp(),lt.lanes|=t,Ja|=t,n)}function Cx(t,n,l,o,h){var p=Y.p;Y.p=p!==0&&8>p?p:8;var k=H.T,A={};H.T=A,dd(t,!1,n,l);try{var L=h(),te=H.S;if(te!==null&&te(A,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var ce=Xb(L,o);ws(t,n,ce,xr(t))}else ws(t,n,o,xr(t))}catch(fe){ws(t,n,{then:function(){},status:"rejected",reason:fe},xr())}finally{Y.p=p,k!==null&&A.types!==null&&(k.types=A.types),H.T=k}}function Zb(){}function cd(t,n,l,o){if(t.tag!==5)throw Error(i(476));var h=Ex(t).queue;Cx(t,h,n,ne,l===null?Zb:function(){return Nx(t),l(o)})}function Ex(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:va,lastRenderedState:ne},next:null};var l={};return n.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:va,lastRenderedState:l},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function Nx(t){var n=Ex(t);n.next===null&&(n=t.alternate.memoizedState),ws(t,n.next.queue,{},xr())}function ud(){return _n($s)}function Ax(){return hn().memoizedState}function Tx(){return hn().memoizedState}function Pb(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var l=xr();t=Ga(l);var o=Qa(n,t,l);o!==null&&(tr(o,n,l),ps(o,n,l)),n={cache:Lu()},t.payload=n;return}n=n.return}}function Jb(t,n,l){var o=xr();l={lane:o,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ko(t)?zx(n,l):(l=Au(t,n,l,o),l!==null&&(tr(l,t,o),Rx(l,n,o)))}function Dx(t,n,l){var o=xr();ws(t,n,l,o)}function ws(t,n,l,o){var h={lane:o,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Ko(t))zx(n,h);else{var p=t.alternate;if(t.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var k=n.lastRenderedState,A=p(k,l);if(h.hasEagerState=!0,h.eagerState=A,cr(A,k))return Do(t,n,h,0),Ut===null&&To(),!1}catch{}finally{}if(l=Au(t,n,h,o),l!==null)return tr(l,t,o),Rx(l,n,o),!0}return!1}function dd(t,n,l,o){if(o={lane:2,revertLane:qd(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Ko(t)){if(n)throw Error(i(479))}else n=Au(t,l,o,2),n!==null&&tr(n,t,2)}function Ko(t){var n=t.alternate;return t===lt||n!==null&&n===lt}function zx(t,n){wi=qo=!0;var l=t.pending;l===null?n.next=n:(n.next=l.next,l.next=n),t.pending=n}function Rx(t,n,l){if((l&4194048)!==0){var o=n.lanes;o&=t.pendingLanes,l|=o,n.lanes=l,Jl(t,l)}}var ks={readContext:_n,use:Vo,useCallback:nn,useContext:nn,useEffect:nn,useImperativeHandle:nn,useLayoutEffect:nn,useInsertionEffect:nn,useMemo:nn,useReducer:nn,useRef:nn,useState:nn,useDebugValue:nn,useDeferredValue:nn,useTransition:nn,useSyncExternalStore:nn,useId:nn,useHostTransitionStatus:nn,useFormState:nn,useActionState:nn,useOptimistic:nn,useMemoCache:nn,useCacheRefresh:nn};ks.useEffectEvent=nn;var Mx={readContext:_n,use:Vo,useCallback:function(t,n){return Vn().memoizedState=[t,n===void 0?null:n],t},useContext:_n,useEffect:px,useImperativeHandle:function(t,n,l){l=l!=null?l.concat([t]):null,Qo(4194308,4,vx.bind(null,n,t),l)},useLayoutEffect:function(t,n){return Qo(4194308,4,t,n)},useInsertionEffect:function(t,n){Qo(4,2,t,n)},useMemo:function(t,n){var l=Vn();n=n===void 0?null:n;var o=t();if(Bl){yt(!0);try{t()}finally{yt(!1)}}return l.memoizedState=[o,n],o},useReducer:function(t,n,l){var o=Vn();if(l!==void 0){var h=l(n);if(Bl){yt(!0);try{l(n)}finally{yt(!1)}}}else h=n;return o.memoizedState=o.baseState=h,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:h},o.queue=t,t=t.dispatch=Jb.bind(null,lt,t),[o.memoizedState,t]},useRef:function(t){var n=Vn();return t={current:t},n.memoizedState=t},useState:function(t){t=ad(t);var n=t.queue,l=Dx.bind(null,lt,n);return n.dispatch=l,[t.memoizedState,l]},useDebugValue:sd,useDeferredValue:function(t,n){var l=Vn();return od(l,t,n)},useTransition:function(){var t=ad(!1);return t=Cx.bind(null,lt,t.queue,!0,!1),Vn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,l){var o=lt,h=Vn();if(kt){if(l===void 0)throw Error(i(407));l=l()}else{if(l=n(),Ut===null)throw Error(i(349));(gt&127)!==0||ex(o,n,l)}h.memoizedState=l;var p={value:l,getSnapshot:n};return h.queue=p,px(nx.bind(null,o,p,t),[t]),o.flags|=2048,ji(9,{destroy:void 0},tx.bind(null,o,p,l,n),null),l},useId:function(){var t=Vn(),n=Ut.identifierPrefix;if(kt){var l=Zr,o=Kr;l=(o&~(1<<32-st(o)-1)).toString(32)+l,n="_"+n+"R_"+l,l=Yo++,0<l&&(n+="H"+l.toString(32)),n+="_"}else l=Vb++,n="_"+n+"r_"+l.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:ud,useFormState:dx,useActionState:dx,useOptimistic:function(t){var n=Vn();n.memoizedState=n.baseState=t;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=l,n=dd.bind(null,lt,!0,l),l.dispatch=n,[t,n]},useMemoCache:td,useCacheRefresh:function(){return Vn().memoizedState=Pb.bind(null,lt)},useEffectEvent:function(t){var n=Vn(),l={impl:t};return n.memoizedState=l,function(){if((Tt&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}},fd={readContext:_n,use:Vo,useCallback:kx,useContext:_n,useEffect:id,useImperativeHandle:wx,useInsertionEffect:gx,useLayoutEffect:bx,useMemo:jx,useReducer:Go,useRef:xx,useState:function(){return Go(va)},useDebugValue:sd,useDeferredValue:function(t,n){var l=hn();return Sx(l,Ot.memoizedState,t,n)},useTransition:function(){var t=Go(va)[0],n=hn().memoizedState;return[typeof t=="boolean"?t:vs(t),n]},useSyncExternalStore:Jm,useId:Ax,useHostTransitionStatus:ud,useFormState:fx,useActionState:fx,useOptimistic:function(t,n){var l=hn();return lx(l,Ot,t,n)},useMemoCache:td,useCacheRefresh:Tx};fd.useEffectEvent=yx;var Fx={readContext:_n,use:Vo,useCallback:kx,useContext:_n,useEffect:id,useImperativeHandle:wx,useInsertionEffect:gx,useLayoutEffect:bx,useMemo:jx,useReducer:rd,useRef:xx,useState:function(){return rd(va)},useDebugValue:sd,useDeferredValue:function(t,n){var l=hn();return Ot===null?od(l,t,n):Sx(l,Ot.memoizedState,t,n)},useTransition:function(){var t=rd(va)[0],n=hn().memoizedState;return[typeof t=="boolean"?t:vs(t),n]},useSyncExternalStore:Jm,useId:Ax,useHostTransitionStatus:ud,useFormState:mx,useActionState:mx,useOptimistic:function(t,n){var l=hn();return Ot!==null?lx(l,Ot,t,n):(l.baseState=t,[t,l.queue.dispatch])},useMemoCache:td,useCacheRefresh:Tx};Fx.useEffectEvent=yx;function hd(t,n,l,o){n=t.memoizedState,l=l(o,n),l=l==null?n:g({},n,l),t.memoizedState=l,t.lanes===0&&(t.updateQueue.baseState=l)}var md={enqueueSetState:function(t,n,l){t=t._reactInternals;var o=xr(),h=Ga(o);h.payload=n,l!=null&&(h.callback=l),n=Qa(t,h,o),n!==null&&(tr(n,t,o),ps(n,t,o))},enqueueReplaceState:function(t,n,l){t=t._reactInternals;var o=xr(),h=Ga(o);h.tag=1,h.payload=n,l!=null&&(h.callback=l),n=Qa(t,h,o),n!==null&&(tr(n,t,o),ps(n,t,o))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var l=xr(),o=Ga(l);o.tag=2,n!=null&&(o.callback=n),n=Qa(t,o,l),n!==null&&(tr(n,t,l),ps(n,t,l))}};function _x(t,n,l,o,h,p,k){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(o,p,k):n.prototype&&n.prototype.isPureReactComponent?!os(l,o)||!os(h,p):!0}function Ox(t,n,l,o){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(l,o),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(l,o),n.state!==t&&md.enqueueReplaceState(n,n.state,null)}function $l(t,n){var l=n;if("ref"in n){l={};for(var o in n)o!=="ref"&&(l[o]=n[o])}if(t=t.defaultProps){l===n&&(l=g({},l));for(var h in t)l[h]===void 0&&(l[h]=t[h])}return l}function Bx(t){Ao(t)}function $x(t){console.error(t)}function Lx(t){Ao(t)}function Zo(t,n){try{var l=t.onUncaughtError;l(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function Hx(t,n,l){try{var o=t.onCaughtError;o(l.value,{componentStack:l.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function xd(t,n,l){return l=Ga(l),l.tag=3,l.payload={element:null},l.callback=function(){Zo(t,n)},l}function Ix(t){return t=Ga(t),t.tag=3,t}function Ux(t,n,l,o){var h=l.type.getDerivedStateFromError;if(typeof h=="function"){var p=o.value;t.payload=function(){return h(p)},t.callback=function(){Hx(n,l,o)}}var k=l.stateNode;k!==null&&typeof k.componentDidCatch=="function"&&(t.callback=function(){Hx(n,l,o),typeof h!="function"&&(el===null?el=new Set([this]):el.add(this));var A=o.stack;this.componentDidCatch(o.value,{componentStack:A!==null?A:""})})}function e2(t,n,l,o,h){if(l.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(n=l.alternate,n!==null&&xi(n,l,h,!0),l=dr.current,l!==null){switch(l.tag){case 31:case 13:return Tr===null?cc():l.alternate===null&&rn===0&&(rn=3),l.flags&=-257,l.flags|=65536,l.lanes=h,o===$o?l.flags|=16384:(n=l.updateQueue,n===null?l.updateQueue=new Set([o]):n.add(o),Hd(t,o,h)),!1;case 22:return l.flags|=65536,o===$o?l.flags|=16384:(n=l.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([o])},l.updateQueue=n):(l=n.retryQueue,l===null?n.retryQueue=new Set([o]):l.add(o)),Hd(t,o,h)),!1}throw Error(i(435,l.tag))}return Hd(t,o,h),cc(),!1}if(kt)return n=dr.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=h,o!==Fu&&(t=Error(i(422),{cause:o}),ds(Cr(t,l)))):(o!==Fu&&(n=Error(i(423),{cause:o}),ds(Cr(n,l))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,o=Cr(o,l),h=xd(t.stateNode,o,h),Xu(t,h),rn!==4&&(rn=2)),!1;var p=Error(i(520),{cause:o});if(p=Cr(p,l),Ds===null?Ds=[p]:Ds.push(p),rn!==4&&(rn=2),n===null)return!0;o=Cr(o,l),l=n;do{switch(l.tag){case 3:return l.flags|=65536,t=h&-h,l.lanes|=t,t=xd(l.stateNode,o,t),Xu(l,t),!1;case 1:if(n=l.type,p=l.stateNode,(l.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(el===null||!el.has(p))))return l.flags|=65536,h&=-h,l.lanes|=h,h=Ix(h),Ux(h,t,l,o),Xu(l,h),!1}l=l.return}while(l!==null);return!1}var pd=Error(i(461)),pn=!1;function On(t,n,l,o){n.child=t===null?Vm(n,null,l,o):Ol(n,t.child,l,o)}function qx(t,n,l,o,h){l=l.render;var p=n.ref;if("ref"in o){var k={};for(var A in o)A!=="ref"&&(k[A]=o[A])}else k=o;return Rl(n),o=Zu(t,n,l,k,p,h),A=Pu(),t!==null&&!pn?(Ju(t,n,h),wa(t,n,h)):(kt&&A&&Ru(n),n.flags|=1,On(t,n,o,h),n.child)}function Yx(t,n,l,o,h){if(t===null){var p=l.type;return typeof p=="function"&&!Tu(p)&&p.defaultProps===void 0&&l.compare===null?(n.tag=15,n.type=p,Xx(t,n,p,o,h)):(t=Ro(l.type,null,o,n,n.mode,h),t.ref=n.ref,t.return=n,n.child=t)}if(p=t.child,!Sd(t,h)){var k=p.memoizedProps;if(l=l.compare,l=l!==null?l:os,l(k,o)&&t.ref===n.ref)return wa(t,n,h)}return n.flags|=1,t=xa(p,o),t.ref=n.ref,t.return=n,n.child=t}function Xx(t,n,l,o,h){if(t!==null){var p=t.memoizedProps;if(os(p,o)&&t.ref===n.ref)if(pn=!1,n.pendingProps=o=p,Sd(t,h))(t.flags&131072)!==0&&(pn=!0);else return n.lanes=t.lanes,wa(t,n,h)}return yd(t,n,l,o,h)}function Vx(t,n,l,o){var h=o.children,p=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((n.flags&128)!==0){if(p=p!==null?p.baseLanes|l:l,t!==null){for(o=n.child=t.child,h=0;o!==null;)h=h|o.lanes|o.childLanes,o=o.sibling;o=h&~p}else o=0,n.child=null;return Gx(t,n,p,l,o)}if((l&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&Oo(n,p!==null?p.cachePool:null),p!==null?Wm(n,p):Gu(),Km(n);else return o=n.lanes=536870912,Gx(t,n,p!==null?p.baseLanes|l:l,l,o)}else p!==null?(Oo(n,p.cachePool),Wm(n,p),Ka(),n.memoizedState=null):(t!==null&&Oo(n,null),Gu(),Ka());return On(t,n,h,l),n.child}function js(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Gx(t,n,l,o,h){var p=Iu();return p=p===null?null:{parent:mn._currentValue,pool:p},n.memoizedState={baseLanes:l,cachePool:p},t!==null&&Oo(n,null),Gu(),Km(n),t!==null&&xi(t,n,o,!0),n.childLanes=h,null}function Po(t,n){return n=ec({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function Qx(t,n,l){return Ol(n,t.child,null,l),t=Po(n,n.pendingProps),t.flags|=2,fr(n),n.memoizedState=null,t}function t2(t,n,l){var o=n.pendingProps,h=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(kt){if(o.mode==="hidden")return t=Po(n,o),n.lanes=536870912,js(null,t);if(Wu(n),(t=Wt)?(t=i1(t,Ar),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Ua!==null?{id:Kr,overflow:Zr}:null,retryLane:536870912,hydrationErrors:null},l=zm(t),l.return=n,n.child=l,Fn=n,Wt=null)):t=null,t===null)throw Ya(n);return n.lanes=536870912,null}return Po(n,o)}var p=t.memoizedState;if(p!==null){var k=p.dehydrated;if(Wu(n),h)if(n.flags&256)n.flags&=-257,n=Qx(t,n,l);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(i(558));else if(pn||xi(t,n,l,!1),h=(l&t.childLanes)!==0,pn||h){if(o=Ut,o!==null&&(k=Hn(o,l),k!==0&&k!==p.retryLane))throw p.retryLane=k,Al(t,k),tr(o,t,k),pd;cc(),n=Qx(t,n,l)}else t=p.treeContext,Wt=Dr(k.nextSibling),Fn=n,kt=!0,qa=null,Ar=!1,t!==null&&Fm(n,t),n=Po(n,o),n.flags|=4096;return n}return t=xa(t.child,{mode:o.mode,children:o.children}),t.ref=n.ref,n.child=t,t.return=n,t}function Jo(t,n){var l=n.ref;if(l===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(i(284));(t===null||t.ref!==l)&&(n.flags|=4194816)}}function yd(t,n,l,o,h){return Rl(n),l=Zu(t,n,l,o,void 0,h),o=Pu(),t!==null&&!pn?(Ju(t,n,h),wa(t,n,h)):(kt&&o&&Ru(n),n.flags|=1,On(t,n,l,h),n.child)}function Wx(t,n,l,o,h,p){return Rl(n),n.updateQueue=null,l=Pm(n,o,l,h),Zm(t),o=Pu(),t!==null&&!pn?(Ju(t,n,p),wa(t,n,p)):(kt&&o&&Ru(n),n.flags|=1,On(t,n,l,p),n.child)}function Kx(t,n,l,o,h){if(Rl(n),n.stateNode===null){var p=di,k=l.contextType;typeof k=="object"&&k!==null&&(p=_n(k)),p=new l(o,p),n.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=md,n.stateNode=p,p._reactInternals=n,p=n.stateNode,p.props=o,p.state=n.memoizedState,p.refs={},qu(n),k=l.contextType,p.context=typeof k=="object"&&k!==null?_n(k):di,p.state=n.memoizedState,k=l.getDerivedStateFromProps,typeof k=="function"&&(hd(n,l,k,o),p.state=n.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(k=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),k!==p.state&&md.enqueueReplaceState(p,p.state,null),gs(n,o,p,h),ys(),p.state=n.memoizedState),typeof p.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(t===null){p=n.stateNode;var A=n.memoizedProps,L=$l(l,A);p.props=L;var te=p.context,ce=l.contextType;k=di,typeof ce=="object"&&ce!==null&&(k=_n(ce));var fe=l.getDerivedStateFromProps;ce=typeof fe=="function"||typeof p.getSnapshotBeforeUpdate=="function",A=n.pendingProps!==A,ce||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(A||te!==k)&&Ox(n,p,o,k),Va=!1;var le=n.memoizedState;p.state=le,gs(n,o,p,h),ys(),te=n.memoizedState,A||le!==te||Va?(typeof fe=="function"&&(hd(n,l,fe,o),te=n.memoizedState),(L=Va||_x(n,l,L,o,le,te,k))?(ce||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(n.flags|=4194308)):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=te),p.props=o,p.state=te,p.context=k,o=L):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{p=n.stateNode,Yu(t,n),k=n.memoizedProps,ce=$l(l,k),p.props=ce,fe=n.pendingProps,le=p.context,te=l.contextType,L=di,typeof te=="object"&&te!==null&&(L=_n(te)),A=l.getDerivedStateFromProps,(te=typeof A=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(k!==fe||le!==L)&&Ox(n,p,o,L),Va=!1,le=n.memoizedState,p.state=le,gs(n,o,p,h),ys();var se=n.memoizedState;k!==fe||le!==se||Va||t!==null&&t.dependencies!==null&&Fo(t.dependencies)?(typeof A=="function"&&(hd(n,l,A,o),se=n.memoizedState),(ce=Va||_x(n,l,ce,o,le,se,L)||t!==null&&t.dependencies!==null&&Fo(t.dependencies))?(te||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,se,L),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,se,L)),typeof p.componentDidUpdate=="function"&&(n.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof p.componentDidUpdate!="function"||k===t.memoizedProps&&le===t.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||k===t.memoizedProps&&le===t.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=se),p.props=o,p.state=se,p.context=L,o=ce):(typeof p.componentDidUpdate!="function"||k===t.memoizedProps&&le===t.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||k===t.memoizedProps&&le===t.memoizedState||(n.flags|=1024),o=!1)}return p=o,Jo(t,n),o=(n.flags&128)!==0,p||o?(p=n.stateNode,l=o&&typeof l.getDerivedStateFromError!="function"?null:p.render(),n.flags|=1,t!==null&&o?(n.child=Ol(n,t.child,null,h),n.child=Ol(n,null,l,h)):On(t,n,l,h),n.memoizedState=p.state,t=n.child):t=wa(t,n,h),t}function Zx(t,n,l,o){return Dl(),n.flags|=256,On(t,n,l,o),n.child}var gd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function bd(t){return{baseLanes:t,cachePool:Hm()}}function vd(t,n,l){return t=t!==null?t.childLanes&~l:0,n&&(t|=mr),t}function Px(t,n,l){var o=n.pendingProps,h=!1,p=(n.flags&128)!==0,k;if((k=p)||(k=t!==null&&t.memoizedState===null?!1:(fn.current&2)!==0),k&&(h=!0,n.flags&=-129),k=(n.flags&32)!==0,n.flags&=-33,t===null){if(kt){if(h?Wa(n):Ka(),(t=Wt)?(t=i1(t,Ar),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Ua!==null?{id:Kr,overflow:Zr}:null,retryLane:536870912,hydrationErrors:null},l=zm(t),l.return=n,n.child=l,Fn=n,Wt=null)):t=null,t===null)throw Ya(n);return nf(t)?n.lanes=32:n.lanes=536870912,null}var A=o.children;return o=o.fallback,h?(Ka(),h=n.mode,A=ec({mode:"hidden",children:A},h),o=Tl(o,h,l,null),A.return=n,o.return=n,A.sibling=o,n.child=A,o=n.child,o.memoizedState=bd(l),o.childLanes=vd(t,k,l),n.memoizedState=gd,js(null,o)):(Wa(n),wd(n,A))}var L=t.memoizedState;if(L!==null&&(A=L.dehydrated,A!==null)){if(p)n.flags&256?(Wa(n),n.flags&=-257,n=kd(t,n,l)):n.memoizedState!==null?(Ka(),n.child=t.child,n.flags|=128,n=null):(Ka(),A=o.fallback,h=n.mode,o=ec({mode:"visible",children:o.children},h),A=Tl(A,h,l,null),A.flags|=2,o.return=n,A.return=n,o.sibling=A,n.child=o,Ol(n,t.child,null,l),o=n.child,o.memoizedState=bd(l),o.childLanes=vd(t,k,l),n.memoizedState=gd,n=js(null,o));else if(Wa(n),nf(A)){if(k=A.nextSibling&&A.nextSibling.dataset,k)var te=k.dgst;k=te,o=Error(i(419)),o.stack="",o.digest=k,ds({value:o,source:null,stack:null}),n=kd(t,n,l)}else if(pn||xi(t,n,l,!1),k=(l&t.childLanes)!==0,pn||k){if(k=Ut,k!==null&&(o=Hn(k,l),o!==0&&o!==L.retryLane))throw L.retryLane=o,Al(t,o),tr(k,t,o),pd;tf(A)||cc(),n=kd(t,n,l)}else tf(A)?(n.flags|=192,n.child=t.child,n=null):(t=L.treeContext,Wt=Dr(A.nextSibling),Fn=n,kt=!0,qa=null,Ar=!1,t!==null&&Fm(n,t),n=wd(n,o.children),n.flags|=4096);return n}return h?(Ka(),A=o.fallback,h=n.mode,L=t.child,te=L.sibling,o=xa(L,{mode:"hidden",children:o.children}),o.subtreeFlags=L.subtreeFlags&65011712,te!==null?A=xa(te,A):(A=Tl(A,h,l,null),A.flags|=2),A.return=n,o.return=n,o.sibling=A,n.child=o,js(null,o),o=n.child,A=t.child.memoizedState,A===null?A=bd(l):(h=A.cachePool,h!==null?(L=mn._currentValue,h=h.parent!==L?{parent:L,pool:L}:h):h=Hm(),A={baseLanes:A.baseLanes|l,cachePool:h}),o.memoizedState=A,o.childLanes=vd(t,k,l),n.memoizedState=gd,js(t.child,o)):(Wa(n),l=t.child,t=l.sibling,l=xa(l,{mode:"visible",children:o.children}),l.return=n,l.sibling=null,t!==null&&(k=n.deletions,k===null?(n.deletions=[t],n.flags|=16):k.push(t)),n.child=l,n.memoizedState=null,l)}function wd(t,n){return n=ec({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function ec(t,n){return t=ur(22,t,null,n),t.lanes=0,t}function kd(t,n,l){return Ol(n,t.child,null,l),t=wd(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function Jx(t,n,l){t.lanes|=n;var o=t.alternate;o!==null&&(o.lanes|=n),Bu(t.return,n,l)}function jd(t,n,l,o,h,p){var k=t.memoizedState;k===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:l,tailMode:h,treeForkCount:p}:(k.isBackwards=n,k.rendering=null,k.renderingStartTime=0,k.last=o,k.tail=l,k.tailMode=h,k.treeForkCount=p)}function ep(t,n,l){var o=n.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var k=fn.current,A=(k&2)!==0;if(A?(k=k&1|2,n.flags|=128):k&=1,D(fn,k),On(t,n,o,l),o=kt?us:0,!A&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Jx(t,l,n);else if(t.tag===19)Jx(t,l,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(h){case"forwards":for(l=n.child,h=null;l!==null;)t=l.alternate,t!==null&&Uo(t)===null&&(h=l),l=l.sibling;l=h,l===null?(h=n.child,n.child=null):(h=l.sibling,l.sibling=null),jd(n,!1,h,l,p,o);break;case"backwards":case"unstable_legacy-backwards":for(l=null,h=n.child,n.child=null;h!==null;){if(t=h.alternate,t!==null&&Uo(t)===null){n.child=h;break}t=h.sibling,h.sibling=l,l=h,h=t}jd(n,!0,l,null,p,o);break;case"together":jd(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function wa(t,n,l){if(t!==null&&(n.dependencies=t.dependencies),Ja|=n.lanes,(l&n.childLanes)===0)if(t!==null){if(xi(t,n,l,!1),(l&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(i(153));if(n.child!==null){for(t=n.child,l=xa(t,t.pendingProps),n.child=l,l.return=n;t.sibling!==null;)t=t.sibling,l=l.sibling=xa(t,t.pendingProps),l.return=n;l.sibling=null}return n.child}function Sd(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&Fo(t)))}function n2(t,n,l){switch(n.tag){case 3:Ee(n,n.stateNode.containerInfo),Xa(n,mn,t.memoizedState.cache),Dl();break;case 27:case 5:oe(n);break;case 4:Ee(n,n.stateNode.containerInfo);break;case 10:Xa(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Wu(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(Wa(n),n.flags|=128,null):(l&n.child.childLanes)!==0?Px(t,n,l):(Wa(n),t=wa(t,n,l),t!==null?t.sibling:null);Wa(n);break;case 19:var h=(t.flags&128)!==0;if(o=(l&n.childLanes)!==0,o||(xi(t,n,l,!1),o=(l&n.childLanes)!==0),h){if(o)return ep(t,n,l);n.flags|=128}if(h=n.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),D(fn,fn.current),o)break;return null;case 22:return n.lanes=0,Vx(t,n,l,n.pendingProps);case 24:Xa(n,mn,t.memoizedState.cache)}return wa(t,n,l)}function tp(t,n,l){if(t!==null)if(t.memoizedProps!==n.pendingProps)pn=!0;else{if(!Sd(t,l)&&(n.flags&128)===0)return pn=!1,n2(t,n,l);pn=(t.flags&131072)!==0}else pn=!1,kt&&(n.flags&1048576)!==0&&Mm(n,us,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(t=Fl(n.elementType),n.type=t,typeof t=="function")Tu(t)?(o=$l(t,o),n.tag=1,n=Kx(null,n,t,o,l)):(n.tag=0,n=yd(null,n,t,o,l));else{if(t!=null){var h=t.$$typeof;if(h===B){n.tag=11,n=qx(null,n,t,o,l);break e}else if(h===X){n.tag=14,n=Yx(null,n,t,o,l);break e}}throw n=J(t)||t,Error(i(306,n,""))}}return n;case 0:return yd(t,n,n.type,n.pendingProps,l);case 1:return o=n.type,h=$l(o,n.pendingProps),Kx(t,n,o,h,l);case 3:e:{if(Ee(n,n.stateNode.containerInfo),t===null)throw Error(i(387));o=n.pendingProps;var p=n.memoizedState;h=p.element,Yu(t,n),gs(n,o,null,l);var k=n.memoizedState;if(o=k.cache,Xa(n,mn,o),o!==p.cache&&$u(n,[mn],l,!0),ys(),o=k.element,p.isDehydrated)if(p={element:o,isDehydrated:!1,cache:k.cache},n.updateQueue.baseState=p,n.memoizedState=p,n.flags&256){n=Zx(t,n,o,l);break e}else if(o!==h){h=Cr(Error(i(424)),n),ds(h),n=Zx(t,n,o,l);break e}else{switch(t=n.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(Wt=Dr(t.firstChild),Fn=n,kt=!0,qa=null,Ar=!0,l=Vm(n,null,o,l),n.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Dl(),o===h){n=wa(t,n,l);break e}On(t,n,o,l)}n=n.child}return n;case 26:return Jo(t,n),t===null?(l=f1(n.type,null,n.pendingProps,null))?n.memoizedState=l:kt||(l=n.type,t=n.pendingProps,o=pc(ge.current).createElement(l),o[sn]=n,o[Gt]=t,Bn(o,l,t),on(o),n.stateNode=o):n.memoizedState=f1(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return oe(n),t===null&&kt&&(o=n.stateNode=c1(n.type,n.pendingProps,ge.current),Fn=n,Ar=!0,h=Wt,al(n.type)?(rf=h,Wt=Dr(o.firstChild)):Wt=h),On(t,n,n.pendingProps.children,l),Jo(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&kt&&((h=o=Wt)&&(o=R2(o,n.type,n.pendingProps,Ar),o!==null?(n.stateNode=o,Fn=n,Wt=Dr(o.firstChild),Ar=!1,h=!0):h=!1),h||Ya(n)),oe(n),h=n.type,p=n.pendingProps,k=t!==null?t.memoizedProps:null,o=p.children,Pd(h,p)?o=null:k!==null&&Pd(h,k)&&(n.flags|=32),n.memoizedState!==null&&(h=Zu(t,n,Gb,null,null,l),$s._currentValue=h),Jo(t,n),On(t,n,o,l),n.child;case 6:return t===null&&kt&&((t=l=Wt)&&(l=M2(l,n.pendingProps,Ar),l!==null?(n.stateNode=l,Fn=n,Wt=null,t=!0):t=!1),t||Ya(n)),null;case 13:return Px(t,n,l);case 4:return Ee(n,n.stateNode.containerInfo),o=n.pendingProps,t===null?n.child=Ol(n,null,o,l):On(t,n,o,l),n.child;case 11:return qx(t,n,n.type,n.pendingProps,l);case 7:return On(t,n,n.pendingProps,l),n.child;case 8:return On(t,n,n.pendingProps.children,l),n.child;case 12:return On(t,n,n.pendingProps.children,l),n.child;case 10:return o=n.pendingProps,Xa(n,n.type,o.value),On(t,n,o.children,l),n.child;case 9:return h=n.type._context,o=n.pendingProps.children,Rl(n),h=_n(h),o=o(h),n.flags|=1,On(t,n,o,l),n.child;case 14:return Yx(t,n,n.type,n.pendingProps,l);case 15:return Xx(t,n,n.type,n.pendingProps,l);case 19:return ep(t,n,l);case 31:return t2(t,n,l);case 22:return Vx(t,n,l,n.pendingProps);case 24:return Rl(n),o=_n(mn),t===null?(h=Iu(),h===null&&(h=Ut,p=Lu(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=l),h=p),n.memoizedState={parent:o,cache:h},qu(n),Xa(n,mn,h)):((t.lanes&l)!==0&&(Yu(t,n),gs(n,null,null,l),ys()),h=t.memoizedState,p=n.memoizedState,h.parent!==o?(h={parent:o,cache:o},n.memoizedState=h,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=h),Xa(n,mn,o)):(o=p.cache,Xa(n,mn,o),o!==h.cache&&$u(n,[mn],l,!0))),On(t,n,n.pendingProps.children,l),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function ka(t){t.flags|=4}function Cd(t,n,l,o,h){if((n=(t.mode&32)!==0)&&(n=!1),n){if(t.flags|=16777216,(h&335544128)===h)if(t.stateNode.complete)t.flags|=8192;else if(Ap())t.flags|=8192;else throw _l=$o,Uu}else t.flags&=-16777217}function np(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!y1(n))if(Ap())t.flags|=8192;else throw _l=$o,Uu}function tc(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?tt():536870912,t.lanes|=n,Ni|=n)}function Ss(t,n){if(!kt)switch(t.tailMode){case"hidden":n=t.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?t.tail=null:l.sibling=null;break;case"collapsed":l=t.tail;for(var o=null;l!==null;)l.alternate!==null&&(o=l),l=l.sibling;o===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:o.sibling=null}}function Kt(t){var n=t.alternate!==null&&t.alternate.child===t.child,l=0,o=0;if(n)for(var h=t.child;h!==null;)l|=h.lanes|h.childLanes,o|=h.subtreeFlags&65011712,o|=h.flags&65011712,h.return=t,h=h.sibling;else for(h=t.child;h!==null;)l|=h.lanes|h.childLanes,o|=h.subtreeFlags,o|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=o,t.childLanes=l,n}function r2(t,n,l){var o=n.pendingProps;switch(Mu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(n),null;case 1:return Kt(n),null;case 3:return l=n.stateNode,o=null,t!==null&&(o=t.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),ga(mn),Ie(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(t===null||t.child===null)&&(mi(n)?ka(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,_u())),Kt(n),null;case 26:var h=n.type,p=n.memoizedState;return t===null?(ka(n),p!==null?(Kt(n),np(n,p)):(Kt(n),Cd(n,h,null,o,l))):p?p!==t.memoizedState?(ka(n),Kt(n),np(n,p)):(Kt(n),n.flags&=-16777217):(t=t.memoizedProps,t!==o&&ka(n),Kt(n),Cd(n,h,t,o,l)),null;case 27:if(at(n),l=ge.current,h=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==o&&ka(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return Kt(n),null}t=xe.current,mi(n)?_m(n):(t=c1(h,o,l),n.stateNode=t,ka(n))}return Kt(n),null;case 5:if(at(n),h=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==o&&ka(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return Kt(n),null}if(p=xe.current,mi(n))_m(n);else{var k=pc(ge.current);switch(p){case 1:p=k.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:p=k.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":p=k.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":p=k.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":p=k.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof o.is=="string"?k.createElement("select",{is:o.is}):k.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?k.createElement(h,{is:o.is}):k.createElement(h)}}p[sn]=n,p[Gt]=o;e:for(k=n.child;k!==null;){if(k.tag===5||k.tag===6)p.appendChild(k.stateNode);else if(k.tag!==4&&k.tag!==27&&k.child!==null){k.child.return=k,k=k.child;continue}if(k===n)break e;for(;k.sibling===null;){if(k.return===null||k.return===n)break e;k=k.return}k.sibling.return=k.return,k=k.sibling}n.stateNode=p;e:switch(Bn(p,h,o),h){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&ka(n)}}return Kt(n),Cd(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,l),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==o&&ka(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(i(166));if(t=ge.current,mi(n)){if(t=n.stateNode,l=n.memoizedProps,o=null,h=Fn,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}t[sn]=n,t=!!(t.nodeValue===l||o!==null&&o.suppressHydrationWarning===!0||Pp(t.nodeValue,l)),t||Ya(n,!0)}else t=pc(t).createTextNode(o),t[sn]=n,n.stateNode=t}return Kt(n),null;case 31:if(l=n.memoizedState,t===null||t.memoizedState!==null){if(o=mi(n),l!==null){if(t===null){if(!o)throw Error(i(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(557));t[sn]=n}else Dl(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Kt(n),t=!1}else l=_u(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=l),t=!0;if(!t)return n.flags&256?(fr(n),n):(fr(n),null);if((n.flags&128)!==0)throw Error(i(558))}return Kt(n),null;case 13:if(o=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=mi(n),o!==null&&o.dehydrated!==null){if(t===null){if(!h)throw Error(i(318));if(h=n.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(317));h[sn]=n}else Dl(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Kt(n),h=!1}else h=_u(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return n.flags&256?(fr(n),n):(fr(n),null)}return fr(n),(n.flags&128)!==0?(n.lanes=l,n):(l=o!==null,t=t!==null&&t.memoizedState!==null,l&&(o=n.child,h=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(h=o.alternate.memoizedState.cachePool.pool),p=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),p!==h&&(o.flags|=2048)),l!==t&&l&&(n.child.flags|=8192),tc(n,n.updateQueue),Kt(n),null);case 4:return Ie(),t===null&&Gd(n.stateNode.containerInfo),Kt(n),null;case 10:return ga(n.type),Kt(n),null;case 19:if(Z(fn),o=n.memoizedState,o===null)return Kt(n),null;if(h=(n.flags&128)!==0,p=o.rendering,p===null)if(h)Ss(o,!1);else{if(rn!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(p=Uo(t),p!==null){for(n.flags|=128,Ss(o,!1),t=p.updateQueue,n.updateQueue=t,tc(n,t),n.subtreeFlags=0,t=l,l=n.child;l!==null;)Dm(l,t),l=l.sibling;return D(fn,fn.current&1|2),kt&&pa(n,o.treeForkCount),n.child}t=t.sibling}o.tail!==null&&_e()>ic&&(n.flags|=128,h=!0,Ss(o,!1),n.lanes=4194304)}else{if(!h)if(t=Uo(p),t!==null){if(n.flags|=128,h=!0,t=t.updateQueue,n.updateQueue=t,tc(n,t),Ss(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!kt)return Kt(n),null}else 2*_e()-o.renderingStartTime>ic&&l!==536870912&&(n.flags|=128,h=!0,Ss(o,!1),n.lanes=4194304);o.isBackwards?(p.sibling=n.child,n.child=p):(t=o.last,t!==null?t.sibling=p:n.child=p,o.last=p)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=_e(),t.sibling=null,l=fn.current,D(fn,h?l&1|2:l&1),kt&&pa(n,o.treeForkCount),t):(Kt(n),null);case 22:case 23:return fr(n),Qu(),o=n.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(l&536870912)!==0&&(n.flags&128)===0&&(Kt(n),n.subtreeFlags&6&&(n.flags|=8192)):Kt(n),l=n.updateQueue,l!==null&&tc(n,l.retryQueue),l=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==l&&(n.flags|=2048),t!==null&&Z(Ml),null;case 24:return l=null,t!==null&&(l=t.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),ga(mn),Kt(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function a2(t,n){switch(Mu(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return ga(mn),Ie(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return at(n),null;case 31:if(n.memoizedState!==null){if(fr(n),n.alternate===null)throw Error(i(340));Dl()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(fr(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(i(340));Dl()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return Z(fn),null;case 4:return Ie(),null;case 10:return ga(n.type),null;case 22:case 23:return fr(n),Qu(),t!==null&&Z(Ml),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return ga(mn),null;case 25:return null;default:return null}}function rp(t,n){switch(Mu(n),n.tag){case 3:ga(mn),Ie();break;case 26:case 27:case 5:at(n);break;case 4:Ie();break;case 31:n.memoizedState!==null&&fr(n);break;case 13:fr(n);break;case 19:Z(fn);break;case 10:ga(n.type);break;case 22:case 23:fr(n),Qu(),t!==null&&Z(Ml);break;case 24:ga(mn)}}function Cs(t,n){try{var l=n.updateQueue,o=l!==null?l.lastEffect:null;if(o!==null){var h=o.next;l=h;do{if((l.tag&t)===t){o=void 0;var p=l.create,k=l.inst;o=p(),k.destroy=o}l=l.next}while(l!==h)}}catch(A){_t(n,n.return,A)}}function Za(t,n,l){try{var o=n.updateQueue,h=o!==null?o.lastEffect:null;if(h!==null){var p=h.next;o=p;do{if((o.tag&t)===t){var k=o.inst,A=k.destroy;if(A!==void 0){k.destroy=void 0,h=n;var L=l,te=A;try{te()}catch(ce){_t(h,L,ce)}}}o=o.next}while(o!==p)}}catch(ce){_t(n,n.return,ce)}}function ap(t){var n=t.updateQueue;if(n!==null){var l=t.stateNode;try{Qm(n,l)}catch(o){_t(t,t.return,o)}}}function lp(t,n,l){l.props=$l(t.type,t.memoizedProps),l.state=t.memoizedState;try{l.componentWillUnmount()}catch(o){_t(t,n,o)}}function Es(t,n){try{var l=t.ref;if(l!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:o=t.stateNode;break;default:o=t.stateNode}typeof l=="function"?t.refCleanup=l(o):l.current=o}}catch(h){_t(t,n,h)}}function Pr(t,n){var l=t.ref,o=t.refCleanup;if(l!==null)if(typeof o=="function")try{o()}catch(h){_t(t,n,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(h){_t(t,n,h)}else l.current=null}function ip(t){var n=t.type,l=t.memoizedProps,o=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":l.autoFocus&&o.focus();break e;case"img":l.src?o.src=l.src:l.srcSet&&(o.srcset=l.srcSet)}}catch(h){_t(t,t.return,h)}}function Ed(t,n,l){try{var o=t.stateNode;E2(o,t.type,l,n),o[Gt]=n}catch(h){_t(t,t.return,h)}}function sp(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&al(t.type)||t.tag===4}function Nd(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||sp(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 Ad(t,n,l){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(t,n):(n=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,n.appendChild(t),l=l._reactRootContainer,l!=null||n.onclick!==null||(n.onclick=kr));else if(o!==4&&(o===27&&al(t.type)&&(l=t.stateNode,n=null),t=t.child,t!==null))for(Ad(t,n,l),t=t.sibling;t!==null;)Ad(t,n,l),t=t.sibling}function nc(t,n,l){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?l.insertBefore(t,n):l.appendChild(t);else if(o!==4&&(o===27&&al(t.type)&&(l=t.stateNode),t=t.child,t!==null))for(nc(t,n,l),t=t.sibling;t!==null;)nc(t,n,l),t=t.sibling}function op(t){var n=t.stateNode,l=t.memoizedProps;try{for(var o=t.type,h=n.attributes;h.length;)n.removeAttributeNode(h[0]);Bn(n,o,l),n[sn]=t,n[Gt]=l}catch(p){_t(t,t.return,p)}}var ja=!1,yn=!1,Td=!1,cp=typeof WeakSet=="function"?WeakSet:Set,Nn=null;function l2(t,n){if(t=t.containerInfo,Kd=jc,t=wm(t),ku(t)){if("selectionStart"in t)var l={start:t.selectionStart,end:t.selectionEnd};else e:{l=(l=t.ownerDocument)&&l.defaultView||window;var o=l.getSelection&&l.getSelection();if(o&&o.rangeCount!==0){l=o.anchorNode;var h=o.anchorOffset,p=o.focusNode;o=o.focusOffset;try{l.nodeType,p.nodeType}catch{l=null;break e}var k=0,A=-1,L=-1,te=0,ce=0,fe=t,le=null;t:for(;;){for(var se;fe!==l||h!==0&&fe.nodeType!==3||(A=k+h),fe!==p||o!==0&&fe.nodeType!==3||(L=k+o),fe.nodeType===3&&(k+=fe.nodeValue.length),(se=fe.firstChild)!==null;)le=fe,fe=se;for(;;){if(fe===t)break t;if(le===l&&++te===h&&(A=k),le===p&&++ce===o&&(L=k),(se=fe.nextSibling)!==null)break;fe=le,le=fe.parentNode}fe=se}l=A===-1||L===-1?null:{start:A,end:L}}else l=null}l=l||{start:0,end:0}}else l=null;for(Zd={focusedElem:t,selectionRange:l},jc=!1,Nn=n;Nn!==null;)if(n=Nn,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,Nn=t;else for(;Nn!==null;){switch(n=Nn,p=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(l=0;l<t.length;l++)h=t[l],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&p!==null){t=void 0,l=n,h=p.memoizedProps,p=p.memoizedState,o=l.stateNode;try{var Be=$l(l.type,h);t=o.getSnapshotBeforeUpdate(Be,p),o.__reactInternalSnapshotBeforeUpdate=t}catch(We){_t(l,l.return,We)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,l=t.nodeType,l===9)ef(t);else if(l===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":ef(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=n.sibling,t!==null){t.return=n.return,Nn=t;break}Nn=n.return}}function up(t,n,l){var o=l.flags;switch(l.tag){case 0:case 11:case 15:Ca(t,l),o&4&&Cs(5,l);break;case 1:if(Ca(t,l),o&4)if(t=l.stateNode,n===null)try{t.componentDidMount()}catch(k){_t(l,l.return,k)}else{var h=$l(l.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(h,n,t.__reactInternalSnapshotBeforeUpdate)}catch(k){_t(l,l.return,k)}}o&64&&ap(l),o&512&&Es(l,l.return);break;case 3:if(Ca(t,l),o&64&&(t=l.updateQueue,t!==null)){if(n=null,l.child!==null)switch(l.child.tag){case 27:case 5:n=l.child.stateNode;break;case 1:n=l.child.stateNode}try{Qm(t,n)}catch(k){_t(l,l.return,k)}}break;case 27:n===null&&o&4&&op(l);case 26:case 5:Ca(t,l),n===null&&o&4&&ip(l),o&512&&Es(l,l.return);break;case 12:Ca(t,l);break;case 31:Ca(t,l),o&4&&hp(t,l);break;case 13:Ca(t,l),o&4&&mp(t,l),o&64&&(t=l.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(l=m2.bind(null,l),F2(t,l))));break;case 22:if(o=l.memoizedState!==null||ja,!o){n=n!==null&&n.memoizedState!==null||yn,h=ja;var p=yn;ja=o,(yn=n)&&!p?Ea(t,l,(l.subtreeFlags&8772)!==0):Ca(t,l),ja=h,yn=p}break;case 30:break;default:Ca(t,l)}}function dp(t){var n=t.alternate;n!==null&&(t.alternate=null,dp(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&ei(n)),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 Zt=null,Zn=!1;function Sa(t,n,l){for(l=l.child;l!==null;)fp(t,n,l),l=l.sibling}function fp(t,n,l){if(rt&&typeof rt.onCommitFiberUnmount=="function")try{rt.onCommitFiberUnmount(it,l)}catch{}switch(l.tag){case 26:yn||Pr(l,n),Sa(t,n,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:yn||Pr(l,n);var o=Zt,h=Zn;al(l.type)&&(Zt=l.stateNode,Zn=!1),Sa(t,n,l),_s(l.stateNode),Zt=o,Zn=h;break;case 5:yn||Pr(l,n);case 6:if(o=Zt,h=Zn,Zt=null,Sa(t,n,l),Zt=o,Zn=h,Zt!==null)if(Zn)try{(Zt.nodeType===9?Zt.body:Zt.nodeName==="HTML"?Zt.ownerDocument.body:Zt).removeChild(l.stateNode)}catch(p){_t(l,n,p)}else try{Zt.removeChild(l.stateNode)}catch(p){_t(l,n,p)}break;case 18:Zt!==null&&(Zn?(t=Zt,a1(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,l.stateNode),_i(t)):a1(Zt,l.stateNode));break;case 4:o=Zt,h=Zn,Zt=l.stateNode.containerInfo,Zn=!0,Sa(t,n,l),Zt=o,Zn=h;break;case 0:case 11:case 14:case 15:Za(2,l,n),yn||Za(4,l,n),Sa(t,n,l);break;case 1:yn||(Pr(l,n),o=l.stateNode,typeof o.componentWillUnmount=="function"&&lp(l,n,o)),Sa(t,n,l);break;case 21:Sa(t,n,l);break;case 22:yn=(o=yn)||l.memoizedState!==null,Sa(t,n,l),yn=o;break;default:Sa(t,n,l)}}function hp(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{_i(t)}catch(l){_t(n,n.return,l)}}}function mp(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{_i(t)}catch(l){_t(n,n.return,l)}}function i2(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new cp),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new cp),n;default:throw Error(i(435,t.tag))}}function rc(t,n){var l=i2(t);n.forEach(function(o){if(!l.has(o)){l.add(o);var h=x2.bind(null,t,o);o.then(h,h)}})}function Pn(t,n){var l=n.deletions;if(l!==null)for(var o=0;o<l.length;o++){var h=l[o],p=t,k=n,A=k;e:for(;A!==null;){switch(A.tag){case 27:if(al(A.type)){Zt=A.stateNode,Zn=!1;break e}break;case 5:Zt=A.stateNode,Zn=!1;break e;case 3:case 4:Zt=A.stateNode.containerInfo,Zn=!0;break e}A=A.return}if(Zt===null)throw Error(i(160));fp(p,k,h),Zt=null,Zn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)xp(n,t),n=n.sibling}var Or=null;function xp(t,n){var l=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Pn(n,t),Jn(t),o&4&&(Za(3,t,t.return),Cs(3,t),Za(5,t,t.return));break;case 1:Pn(n,t),Jn(t),o&512&&(yn||l===null||Pr(l,l.return)),o&64&&ja&&(t=t.updateQueue,t!==null&&(o=t.callbacks,o!==null&&(l=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=l===null?o:l.concat(o))));break;case 26:var h=Or;if(Pn(n,t),Jn(t),o&512&&(yn||l===null||Pr(l,l.return)),o&4){var p=l!==null?l.memoizedState:null;if(o=t.memoizedState,l===null)if(o===null)if(t.stateNode===null){e:{o=t.type,l=t.memoizedProps,h=h.ownerDocument||h;t:switch(o){case"title":p=h.getElementsByTagName("title")[0],(!p||p[vr]||p[sn]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),Bn(p,o,l),p[sn]=t,on(p),o=p;break e;case"link":var k=x1("link","href",h).get(o+(l.href||""));if(k){for(var A=0;A<k.length;A++)if(p=k[A],p.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&p.getAttribute("rel")===(l.rel==null?null:l.rel)&&p.getAttribute("title")===(l.title==null?null:l.title)&&p.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){k.splice(A,1);break t}}p=h.createElement(o),Bn(p,o,l),h.head.appendChild(p);break;case"meta":if(k=x1("meta","content",h).get(o+(l.content||""))){for(A=0;A<k.length;A++)if(p=k[A],p.getAttribute("content")===(l.content==null?null:""+l.content)&&p.getAttribute("name")===(l.name==null?null:l.name)&&p.getAttribute("property")===(l.property==null?null:l.property)&&p.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&p.getAttribute("charset")===(l.charSet==null?null:l.charSet)){k.splice(A,1);break t}}p=h.createElement(o),Bn(p,o,l),h.head.appendChild(p);break;default:throw Error(i(468,o))}p[sn]=t,on(p),o=p}t.stateNode=o}else p1(h,t.type,t.stateNode);else t.stateNode=m1(h,o,t.memoizedProps);else p!==o?(p===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):p.count--,o===null?p1(h,t.type,t.stateNode):m1(h,o,t.memoizedProps)):o===null&&t.stateNode!==null&&Ed(t,t.memoizedProps,l.memoizedProps)}break;case 27:Pn(n,t),Jn(t),o&512&&(yn||l===null||Pr(l,l.return)),l!==null&&o&4&&Ed(t,t.memoizedProps,l.memoizedProps);break;case 5:if(Pn(n,t),Jn(t),o&512&&(yn||l===null||Pr(l,l.return)),t.flags&32){h=t.stateNode;try{Gr(h,"")}catch(Be){_t(t,t.return,Be)}}o&4&&t.stateNode!=null&&(h=t.memoizedProps,Ed(t,h,l!==null?l.memoizedProps:h)),o&1024&&(Td=!0);break;case 6:if(Pn(n,t),Jn(t),o&4){if(t.stateNode===null)throw Error(i(162));o=t.memoizedProps,l=t.stateNode;try{l.nodeValue=o}catch(Be){_t(t,t.return,Be)}}break;case 3:if(bc=null,h=Or,Or=yc(n.containerInfo),Pn(n,t),Or=h,Jn(t),o&4&&l!==null&&l.memoizedState.isDehydrated)try{_i(n.containerInfo)}catch(Be){_t(t,t.return,Be)}Td&&(Td=!1,pp(t));break;case 4:o=Or,Or=yc(t.stateNode.containerInfo),Pn(n,t),Jn(t),Or=o;break;case 12:Pn(n,t),Jn(t);break;case 31:Pn(n,t),Jn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,rc(t,o)));break;case 13:Pn(n,t),Jn(t),t.child.flags&8192&&t.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(lc=_e()),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,rc(t,o)));break;case 22:h=t.memoizedState!==null;var L=l!==null&&l.memoizedState!==null,te=ja,ce=yn;if(ja=te||h,yn=ce||L,Pn(n,t),yn=ce,ja=te,Jn(t),o&8192)e:for(n=t.stateNode,n._visibility=h?n._visibility&-2:n._visibility|1,h&&(l===null||L||ja||yn||Ll(t)),l=null,n=t;;){if(n.tag===5||n.tag===26){if(l===null){L=l=n;try{if(p=L.stateNode,h)k=p.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none";else{A=L.stateNode;var fe=L.memoizedProps.style,le=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;A.style.display=le==null||typeof le=="boolean"?"":(""+le).trim()}}catch(Be){_t(L,L.return,Be)}}}else if(n.tag===6){if(l===null){L=n;try{L.stateNode.nodeValue=h?"":L.memoizedProps}catch(Be){_t(L,L.return,Be)}}}else if(n.tag===18){if(l===null){L=n;try{var se=L.stateNode;h?l1(se,!0):l1(L.stateNode,!1)}catch(Be){_t(L,L.return,Be)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===t)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break e;for(;n.sibling===null;){if(n.return===null||n.return===t)break e;l===n&&(l=null),n=n.return}l===n&&(l=null),n.sibling.return=n.return,n=n.sibling}o&4&&(o=t.updateQueue,o!==null&&(l=o.retryQueue,l!==null&&(o.retryQueue=null,rc(t,l))));break;case 19:Pn(n,t),Jn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,rc(t,o)));break;case 30:break;case 21:break;default:Pn(n,t),Jn(t)}}function Jn(t){var n=t.flags;if(n&2){try{for(var l,o=t.return;o!==null;){if(sp(o)){l=o;break}o=o.return}if(l==null)throw Error(i(160));switch(l.tag){case 27:var h=l.stateNode,p=Nd(t);nc(t,p,h);break;case 5:var k=l.stateNode;l.flags&32&&(Gr(k,""),l.flags&=-33);var A=Nd(t);nc(t,A,k);break;case 3:case 4:var L=l.stateNode.containerInfo,te=Nd(t);Ad(t,te,L);break;default:throw Error(i(161))}}catch(ce){_t(t,t.return,ce)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function pp(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;pp(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function Ca(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)up(t,n.alternate,n),n=n.sibling}function Ll(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Za(4,n,n.return),Ll(n);break;case 1:Pr(n,n.return);var l=n.stateNode;typeof l.componentWillUnmount=="function"&&lp(n,n.return,l),Ll(n);break;case 27:_s(n.stateNode);case 26:case 5:Pr(n,n.return),Ll(n);break;case 22:n.memoizedState===null&&Ll(n);break;case 30:Ll(n);break;default:Ll(n)}t=t.sibling}}function Ea(t,n,l){for(l=l&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var o=n.alternate,h=t,p=n,k=p.flags;switch(p.tag){case 0:case 11:case 15:Ea(h,p,l),Cs(4,p);break;case 1:if(Ea(h,p,l),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(te){_t(o,o.return,te)}if(o=p,h=o.updateQueue,h!==null){var A=o.stateNode;try{var L=h.shared.hiddenCallbacks;if(L!==null)for(h.shared.hiddenCallbacks=null,h=0;h<L.length;h++)Gm(L[h],A)}catch(te){_t(o,o.return,te)}}l&&k&64&&ap(p),Es(p,p.return);break;case 27:op(p);case 26:case 5:Ea(h,p,l),l&&o===null&&k&4&&ip(p),Es(p,p.return);break;case 12:Ea(h,p,l);break;case 31:Ea(h,p,l),l&&k&4&&hp(h,p);break;case 13:Ea(h,p,l),l&&k&4&&mp(h,p);break;case 22:p.memoizedState===null&&Ea(h,p,l),Es(p,p.return);break;case 30:break;default:Ea(h,p,l)}n=n.sibling}}function Dd(t,n){var l=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),t=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),t!==l&&(t!=null&&t.refCount++,l!=null&&fs(l))}function zd(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&fs(t))}function Br(t,n,l,o){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)yp(t,n,l,o),n=n.sibling}function yp(t,n,l,o){var h=n.flags;switch(n.tag){case 0:case 11:case 15:Br(t,n,l,o),h&2048&&Cs(9,n);break;case 1:Br(t,n,l,o);break;case 3:Br(t,n,l,o),h&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&fs(t)));break;case 12:if(h&2048){Br(t,n,l,o),t=n.stateNode;try{var p=n.memoizedProps,k=p.id,A=p.onPostCommit;typeof A=="function"&&A(k,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(L){_t(n,n.return,L)}}else Br(t,n,l,o);break;case 31:Br(t,n,l,o);break;case 13:Br(t,n,l,o);break;case 23:break;case 22:p=n.stateNode,k=n.alternate,n.memoizedState!==null?p._visibility&2?Br(t,n,l,o):Ns(t,n):p._visibility&2?Br(t,n,l,o):(p._visibility|=2,Si(t,n,l,o,(n.subtreeFlags&10256)!==0||!1)),h&2048&&Dd(k,n);break;case 24:Br(t,n,l,o),h&2048&&zd(n.alternate,n);break;default:Br(t,n,l,o)}}function Si(t,n,l,o,h){for(h=h&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var p=t,k=n,A=l,L=o,te=k.flags;switch(k.tag){case 0:case 11:case 15:Si(p,k,A,L,h),Cs(8,k);break;case 23:break;case 22:var ce=k.stateNode;k.memoizedState!==null?ce._visibility&2?Si(p,k,A,L,h):Ns(p,k):(ce._visibility|=2,Si(p,k,A,L,h)),h&&te&2048&&Dd(k.alternate,k);break;case 24:Si(p,k,A,L,h),h&&te&2048&&zd(k.alternate,k);break;default:Si(p,k,A,L,h)}n=n.sibling}}function Ns(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var l=t,o=n,h=o.flags;switch(o.tag){case 22:Ns(l,o),h&2048&&Dd(o.alternate,o);break;case 24:Ns(l,o),h&2048&&zd(o.alternate,o);break;default:Ns(l,o)}n=n.sibling}}var As=8192;function Ci(t,n,l){if(t.subtreeFlags&As)for(t=t.child;t!==null;)gp(t,n,l),t=t.sibling}function gp(t,n,l){switch(t.tag){case 26:Ci(t,n,l),t.flags&As&&t.memoizedState!==null&&V2(l,Or,t.memoizedState,t.memoizedProps);break;case 5:Ci(t,n,l);break;case 3:case 4:var o=Or;Or=yc(t.stateNode.containerInfo),Ci(t,n,l),Or=o;break;case 22:t.memoizedState===null&&(o=t.alternate,o!==null&&o.memoizedState!==null?(o=As,As=16777216,Ci(t,n,l),As=o):Ci(t,n,l));break;default:Ci(t,n,l)}}function bp(t){var n=t.alternate;if(n!==null&&(t=n.child,t!==null)){n.child=null;do n=t.sibling,t.sibling=null,t=n;while(t!==null)}}function Ts(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var l=0;l<n.length;l++){var o=n[l];Nn=o,wp(o,t)}bp(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)vp(t),t=t.sibling}function vp(t){switch(t.tag){case 0:case 11:case 15:Ts(t),t.flags&2048&&Za(9,t,t.return);break;case 3:Ts(t);break;case 12:Ts(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,ac(t)):Ts(t);break;default:Ts(t)}}function ac(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var l=0;l<n.length;l++){var o=n[l];Nn=o,wp(o,t)}bp(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Za(8,n,n.return),ac(n);break;case 22:l=n.stateNode,l._visibility&2&&(l._visibility&=-3,ac(n));break;default:ac(n)}t=t.sibling}}function wp(t,n){for(;Nn!==null;){var l=Nn;switch(l.tag){case 0:case 11:case 15:Za(8,l,n);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var o=l.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:fs(l.memoizedState.cache)}if(o=l.child,o!==null)o.return=l,Nn=o;else e:for(l=t;Nn!==null;){o=Nn;var h=o.sibling,p=o.return;if(dp(o),o===l){Nn=null;break e}if(h!==null){h.return=p,Nn=h;break e}Nn=p}}}var s2={getCacheForType:function(t){var n=_n(mn),l=n.data.get(t);return l===void 0&&(l=t(),n.data.set(t,l)),l},cacheSignal:function(){return _n(mn).controller.signal}},o2=typeof WeakMap=="function"?WeakMap:Map,Tt=0,Ut=null,mt=null,gt=0,Ft=0,hr=null,Pa=!1,Ei=!1,Rd=!1,Na=0,rn=0,Ja=0,Hl=0,Md=0,mr=0,Ni=0,Ds=null,er=null,Fd=!1,lc=0,kp=0,ic=1/0,sc=null,el=null,vn=0,tl=null,Ai=null,Aa=0,_d=0,Od=null,jp=null,zs=0,Bd=null;function xr(){return(Tt&2)!==0&>!==0?gt&-gt:H.T!==null?qd():Cn()}function Sp(){if(mr===0)if((gt&536870912)===0||kt){var t=ln;ln<<=1,(ln&3932160)===0&&(ln=262144),mr=t}else mr=536870912;return t=dr.current,t!==null&&(t.flags|=32),mr}function tr(t,n,l){(t===Ut&&(Ft===2||Ft===9)||t.cancelPendingCommit!==null)&&(Ti(t,0),nl(t,gt,mr,!1)),Jt(t,l),((Tt&2)===0||t!==Ut)&&(t===Ut&&((Tt&2)===0&&(Hl|=l),rn===4&&nl(t,gt,mr,!1)),Jr(t))}function Cp(t,n,l){if((Tt&6)!==0)throw Error(i(327));var o=!l&&(n&127)===0&&(n&t.expiredLanes)===0||Ue(t,n),h=o?d2(t,n):Ld(t,n,!0),p=o;do{if(h===0){Ei&&!o&&nl(t,n,0,!1);break}else{if(l=t.current.alternate,p&&!c2(l)){h=Ld(t,n,!1),p=!1;continue}if(h===2){if(p=n,t.errorRecoveryDisabledLanes&p)var k=0;else k=t.pendingLanes&-536870913,k=k!==0?k:k&536870912?536870912:0;if(k!==0){n=k;e:{var A=t;h=Ds;var L=A.current.memoizedState.isDehydrated;if(L&&(Ti(A,k).flags|=256),k=Ld(A,k,!1),k!==2){if(Rd&&!L){A.errorRecoveryDisabledLanes|=p,Hl|=p,h=4;break e}p=er,er=h,p!==null&&(er===null?er=p:er.push.apply(er,p))}h=k}if(p=!1,h!==2)continue}}if(h===1){Ti(t,0),nl(t,n,0,!0);break}e:{switch(o=t,p=h,p){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:nl(o,n,mr,!Pa);break e;case 2:er=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(h=lc+300-_e(),10<h)){if(nl(o,n,mr,!Pa),P(o,0,!0)!==0)break e;Aa=n,o.timeoutHandle=n1(Ep.bind(null,o,l,er,sc,Fd,n,mr,Hl,Ni,Pa,p,"Throttled",-0,0),h);break e}Ep(o,l,er,sc,Fd,n,mr,Hl,Ni,Pa,p,null,-0,0)}}break}while(!0);Jr(t)}function Ep(t,n,l,o,h,p,k,A,L,te,ce,fe,le,se){if(t.timeoutHandle=-1,fe=n.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:kr},gp(n,p,fe);var Be=(p&62914560)===p?lc-_e():(p&4194048)===p?kp-_e():0;if(Be=G2(fe,Be),Be!==null){Aa=p,t.cancelPendingCommit=Be(Fp.bind(null,t,n,p,l,o,h,k,A,L,ce,fe,null,le,se)),nl(t,p,k,!te);return}}Fp(t,n,p,l,o,h,k,A,L)}function c2(t){for(var n=t;;){var l=n.tag;if((l===0||l===11||l===15)&&n.flags&16384&&(l=n.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var o=0;o<l.length;o++){var h=l[o],p=h.getSnapshot;h=h.value;try{if(!cr(p(),h))return!1}catch{return!1}}if(l=n.child,n.subtreeFlags&16384&&l!==null)l.return=n,n=l;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function nl(t,n,l,o){n&=~Md,n&=~Hl,t.suspendedLanes|=n,t.pingedLanes&=~n,o&&(t.warmLanes|=n),o=t.expirationTimes;for(var h=n;0<h;){var p=31-st(h),k=1<<p;o[p]=-1,h&=~k}l!==0&&br(t,l,n)}function oc(){return(Tt&6)===0?(Rs(0),!1):!0}function $d(){if(mt!==null){if(Ft===0)var t=mt.return;else t=mt,ya=zl=null,ed(t),bi=null,ms=0,t=mt;for(;t!==null;)rp(t.alternate,t),t=t.return;mt=null}}function Ti(t,n){var l=t.timeoutHandle;l!==-1&&(t.timeoutHandle=-1,T2(l)),l=t.cancelPendingCommit,l!==null&&(t.cancelPendingCommit=null,l()),Aa=0,$d(),Ut=t,mt=l=xa(t.current,null),gt=n,Ft=0,hr=null,Pa=!1,Ei=Ue(t,n),Rd=!1,Ni=mr=Md=Hl=Ja=rn=0,er=Ds=null,Fd=!1,(n&8)!==0&&(n|=n&32);var o=t.entangledLanes;if(o!==0)for(t=t.entanglements,o&=n;0<o;){var h=31-st(o),p=1<<h;n|=t[h],o&=~p}return Na=n,To(),l}function Np(t,n){lt=null,H.H=ks,n===gi||n===Bo?(n=qm(),Ft=3):n===Uu?(n=qm(),Ft=4):Ft=n===pd?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,hr=n,mt===null&&(rn=1,Zo(t,Cr(n,t.current)))}function Ap(){var t=dr.current;return t===null?!0:(gt&4194048)===gt?Tr===null:(gt&62914560)===gt||(gt&536870912)!==0?t===Tr:!1}function Tp(){var t=H.H;return H.H=ks,t===null?ks:t}function Dp(){var t=H.A;return H.A=s2,t}function cc(){rn=4,Pa||(gt&4194048)!==gt&&dr.current!==null||(Ei=!0),(Ja&134217727)===0&&(Hl&134217727)===0||Ut===null||nl(Ut,gt,mr,!1)}function Ld(t,n,l){var o=Tt;Tt|=2;var h=Tp(),p=Dp();(Ut!==t||gt!==n)&&(sc=null,Ti(t,n)),n=!1;var k=rn;e:do try{if(Ft!==0&&mt!==null){var A=mt,L=hr;switch(Ft){case 8:$d(),k=6;break e;case 3:case 2:case 9:case 6:dr.current===null&&(n=!0);var te=Ft;if(Ft=0,hr=null,Di(t,A,L,te),l&&Ei){k=0;break e}break;default:te=Ft,Ft=0,hr=null,Di(t,A,L,te)}}u2(),k=rn;break}catch(ce){Np(t,ce)}while(!0);return n&&t.shellSuspendCounter++,ya=zl=null,Tt=o,H.H=h,H.A=p,mt===null&&(Ut=null,gt=0,To()),k}function u2(){for(;mt!==null;)zp(mt)}function d2(t,n){var l=Tt;Tt|=2;var o=Tp(),h=Dp();Ut!==t||gt!==n?(sc=null,ic=_e()+500,Ti(t,n)):Ei=Ue(t,n);e:do try{if(Ft!==0&&mt!==null){n=mt;var p=hr;t:switch(Ft){case 1:Ft=0,hr=null,Di(t,n,p,1);break;case 2:case 9:if(Im(p)){Ft=0,hr=null,Rp(n);break}n=function(){Ft!==2&&Ft!==9||Ut!==t||(Ft=7),Jr(t)},p.then(n,n);break e;case 3:Ft=7;break e;case 4:Ft=5;break e;case 7:Im(p)?(Ft=0,hr=null,Rp(n)):(Ft=0,hr=null,Di(t,n,p,7));break;case 5:var k=null;switch(mt.tag){case 26:k=mt.memoizedState;case 5:case 27:var A=mt;if(k?y1(k):A.stateNode.complete){Ft=0,hr=null;var L=A.sibling;if(L!==null)mt=L;else{var te=A.return;te!==null?(mt=te,uc(te)):mt=null}break t}}Ft=0,hr=null,Di(t,n,p,5);break;case 6:Ft=0,hr=null,Di(t,n,p,6);break;case 8:$d(),rn=6;break e;default:throw Error(i(462))}}f2();break}catch(ce){Np(t,ce)}while(!0);return ya=zl=null,H.H=o,H.A=h,Tt=l,mt!==null?0:(Ut=null,gt=0,To(),rn)}function f2(){for(;mt!==null&&!ze();)zp(mt)}function zp(t){var n=tp(t.alternate,t,Na);t.memoizedProps=t.pendingProps,n===null?uc(t):mt=n}function Rp(t){var n=t,l=n.alternate;switch(n.tag){case 15:case 0:n=Wx(l,n,n.pendingProps,n.type,void 0,gt);break;case 11:n=Wx(l,n,n.pendingProps,n.type.render,n.ref,gt);break;case 5:ed(n);default:rp(l,n),n=mt=Dm(n,Na),n=tp(l,n,Na)}t.memoizedProps=t.pendingProps,n===null?uc(t):mt=n}function Di(t,n,l,o){ya=zl=null,ed(n),bi=null,ms=0;var h=n.return;try{if(e2(t,h,n,l,gt)){rn=1,Zo(t,Cr(l,t.current)),mt=null;return}}catch(p){if(h!==null)throw mt=h,p;rn=1,Zo(t,Cr(l,t.current)),mt=null;return}n.flags&32768?(kt||o===1?t=!0:Ei||(gt&536870912)!==0?t=!1:(Pa=t=!0,(o===2||o===9||o===3||o===6)&&(o=dr.current,o!==null&&o.tag===13&&(o.flags|=16384))),Mp(n,t)):uc(n)}function uc(t){var n=t;do{if((n.flags&32768)!==0){Mp(n,Pa);return}t=n.return;var l=r2(n.alternate,n,Na);if(l!==null){mt=l;return}if(n=n.sibling,n!==null){mt=n;return}mt=n=t}while(n!==null);rn===0&&(rn=5)}function Mp(t,n){do{var l=a2(t.alternate,t);if(l!==null){l.flags&=32767,mt=l;return}if(l=t.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!n&&(t=t.sibling,t!==null)){mt=t;return}mt=t=l}while(t!==null);rn=6,mt=null}function Fp(t,n,l,o,h,p,k,A,L){t.cancelPendingCommit=null;do dc();while(vn!==0);if((Tt&6)!==0)throw Error(i(327));if(n!==null){if(n===t.current)throw Error(i(177));if(p=n.lanes|n.childLanes,p|=Nu,An(t,l,p,k,A,L),t===Ut&&(mt=Ut=null,gt=0),Ai=n,tl=t,Aa=l,_d=p,Od=h,jp=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,p2(De,function(){return Lp(),null})):(t.callbackNode=null,t.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=H.T,H.T=null,h=Y.p,Y.p=2,k=Tt,Tt|=4;try{l2(t,n,l)}finally{Tt=k,Y.p=h,H.T=o}}vn=1,_p(),Op(),Bp()}}function _p(){if(vn===1){vn=0;var t=tl,n=Ai,l=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||l){l=H.T,H.T=null;var o=Y.p;Y.p=2;var h=Tt;Tt|=4;try{xp(n,t);var p=Zd,k=wm(t.containerInfo),A=p.focusedElem,L=p.selectionRange;if(k!==A&&A&&A.ownerDocument&&vm(A.ownerDocument.documentElement,A)){if(L!==null&&ku(A)){var te=L.start,ce=L.end;if(ce===void 0&&(ce=te),"selectionStart"in A)A.selectionStart=te,A.selectionEnd=Math.min(ce,A.value.length);else{var fe=A.ownerDocument||document,le=fe&&fe.defaultView||window;if(le.getSelection){var se=le.getSelection(),Be=A.textContent.length,We=Math.min(L.start,Be),$t=L.end===void 0?We:Math.min(L.end,Be);!se.extend&&We>$t&&(k=$t,$t=We,We=k);var K=bm(A,We),q=bm(A,$t);if(K&&q&&(se.rangeCount!==1||se.anchorNode!==K.node||se.anchorOffset!==K.offset||se.focusNode!==q.node||se.focusOffset!==q.offset)){var ee=fe.createRange();ee.setStart(K.node,K.offset),se.removeAllRanges(),We>$t?(se.addRange(ee),se.extend(q.node,q.offset)):(ee.setEnd(q.node,q.offset),se.addRange(ee))}}}}for(fe=[],se=A;se=se.parentNode;)se.nodeType===1&&fe.push({element:se,left:se.scrollLeft,top:se.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<fe.length;A++){var ue=fe[A];ue.element.scrollLeft=ue.left,ue.element.scrollTop=ue.top}}jc=!!Kd,Zd=Kd=null}finally{Tt=h,Y.p=o,H.T=l}}t.current=n,vn=2}}function Op(){if(vn===2){vn=0;var t=tl,n=Ai,l=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||l){l=H.T,H.T=null;var o=Y.p;Y.p=2;var h=Tt;Tt|=4;try{up(t,n.alternate,n)}finally{Tt=h,Y.p=o,H.T=l}}vn=3}}function Bp(){if(vn===4||vn===3){vn=0,Pe();var t=tl,n=Ai,l=Aa,o=jp;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?vn=5:(vn=0,Ai=tl=null,$p(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(el=null),be(l),n=n.stateNode,rt&&typeof rt.onCommitFiberRoot=="function")try{rt.onCommitFiberRoot(it,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=H.T,h=Y.p,Y.p=2,H.T=null;try{for(var p=t.onRecoverableError,k=0;k<o.length;k++){var A=o[k];p(A.value,{componentStack:A.stack})}}finally{H.T=n,Y.p=h}}(Aa&3)!==0&&dc(),Jr(t),h=t.pendingLanes,(l&261930)!==0&&(h&42)!==0?t===Bd?zs++:(zs=0,Bd=t):zs=0,Rs(0)}}function $p(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,fs(n)))}function dc(){return _p(),Op(),Bp(),Lp()}function Lp(){if(vn!==5)return!1;var t=tl,n=_d;_d=0;var l=be(Aa),o=H.T,h=Y.p;try{Y.p=32>l?32:l,H.T=null,l=Od,Od=null;var p=tl,k=Aa;if(vn=0,Ai=tl=null,Aa=0,(Tt&6)!==0)throw Error(i(331));var A=Tt;if(Tt|=4,vp(p.current),yp(p,p.current,k,l),Tt=A,Rs(0,!1),rt&&typeof rt.onPostCommitFiberRoot=="function")try{rt.onPostCommitFiberRoot(it,p)}catch{}return!0}finally{Y.p=h,H.T=o,$p(t,n)}}function Hp(t,n,l){n=Cr(l,n),n=xd(t.stateNode,n,2),t=Qa(t,n,2),t!==null&&(Jt(t,2),Jr(t))}function _t(t,n,l){if(t.tag===3)Hp(t,t,l);else for(;n!==null;){if(n.tag===3){Hp(n,t,l);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(el===null||!el.has(o))){t=Cr(l,t),l=Ix(2),o=Qa(n,l,2),o!==null&&(Ux(l,o,n,t),Jt(o,2),Jr(o));break}}n=n.return}}function Hd(t,n,l){var o=t.pingCache;if(o===null){o=t.pingCache=new o2;var h=new Set;o.set(n,h)}else h=o.get(n),h===void 0&&(h=new Set,o.set(n,h));h.has(l)||(Rd=!0,h.add(l),t=h2.bind(null,t,n,l),n.then(t,t))}function h2(t,n,l){var o=t.pingCache;o!==null&&o.delete(n),t.pingedLanes|=t.suspendedLanes&l,t.warmLanes&=~l,Ut===t&&(gt&l)===l&&(rn===4||rn===3&&(gt&62914560)===gt&&300>_e()-lc?(Tt&2)===0&&Ti(t,0):Md|=l,Ni===gt&&(Ni=0)),Jr(t)}function Ip(t,n){n===0&&(n=tt()),t=Al(t,n),t!==null&&(Jt(t,n),Jr(t))}function m2(t){var n=t.memoizedState,l=0;n!==null&&(l=n.retryLane),Ip(t,l)}function x2(t,n){var l=0;switch(t.tag){case 31:case 13:var o=t.stateNode,h=t.memoizedState;h!==null&&(l=h.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(i(314))}o!==null&&o.delete(n),Ip(t,l)}function p2(t,n){return Re(t,n)}var fc=null,zi=null,Id=!1,hc=!1,Ud=!1,rl=0;function Jr(t){t!==zi&&t.next===null&&(zi===null?fc=zi=t:zi=zi.next=t),hc=!0,Id||(Id=!0,g2())}function Rs(t,n){if(!Ud&&hc){Ud=!0;do for(var l=!1,o=fc;o!==null;){if(t!==0){var h=o.pendingLanes;if(h===0)var p=0;else{var k=o.suspendedLanes,A=o.pingedLanes;p=(1<<31-st(42|t)+1)-1,p&=h&~(k&~A),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(l=!0,Xp(o,p))}else p=gt,p=P(o,o===Ut?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||Ue(o,p)||(l=!0,Xp(o,p));o=o.next}while(l);Ud=!1}}function y2(){Up()}function Up(){hc=Id=!1;var t=0;rl!==0&&A2()&&(t=rl);for(var n=_e(),l=null,o=fc;o!==null;){var h=o.next,p=qp(o,n);p===0?(o.next=null,l===null?fc=h:l.next=h,h===null&&(zi=l)):(l=o,(t!==0||(p&3)!==0)&&(hc=!0)),o=h}vn!==0&&vn!==5||Rs(t),rl!==0&&(rl=0)}function qp(t,n){for(var l=t.suspendedLanes,o=t.pingedLanes,h=t.expirationTimes,p=t.pendingLanes&-62914561;0<p;){var k=31-st(p),A=1<<k,L=h[k];L===-1?((A&l)===0||(A&o)!==0)&&(h[k]=Rt(A,n)):L<=n&&(t.expiredLanes|=A),p&=~A}if(n=Ut,l=gt,l=P(t,t===n?l:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o=t.callbackNode,l===0||t===n&&(Ft===2||Ft===9)||t.cancelPendingCommit!==null)return o!==null&&o!==null&&Ne(o),t.callbackNode=null,t.callbackPriority=0;if((l&3)===0||Ue(t,l)){if(n=l&-l,n===t.callbackPriority)return n;switch(o!==null&&Ne(o),be(l)){case 2:case 8:l=ye;break;case 32:l=De;break;case 268435456:l=de;break;default:l=De}return o=Yp.bind(null,t),l=Re(l,o),t.callbackPriority=n,t.callbackNode=l,n}return o!==null&&o!==null&&Ne(o),t.callbackPriority=2,t.callbackNode=null,2}function Yp(t,n){if(vn!==0&&vn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var l=t.callbackNode;if(dc()&&t.callbackNode!==l)return null;var o=gt;return o=P(t,t===Ut?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o===0?null:(Cp(t,o,n),qp(t,_e()),t.callbackNode!=null&&t.callbackNode===l?Yp.bind(null,t):null)}function Xp(t,n){if(dc())return null;Cp(t,n,!0)}function g2(){D2(function(){(Tt&6)!==0?Re(re,y2):Up()})}function qd(){if(rl===0){var t=pi;t===0&&(t=$n,$n<<=1,($n&261888)===0&&($n=256)),rl=t}return rl}function Vp(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:ni(""+t)}function Gp(t,n){var l=n.ownerDocument.createElement("input");return l.name=n.name,l.value=n.value,t.id&&l.setAttribute("form",t.id),n.parentNode.insertBefore(l,n),t=new FormData(t),l.parentNode.removeChild(l),t}function b2(t,n,l,o,h){if(n==="submit"&&l&&l.stateNode===h){var p=Vp((h[Gt]||null).action),k=o.submitter;k&&(n=(n=k[Gt]||null)?Vp(n.formAction):k.getAttribute("formAction"),n!==null&&(p=n,k=null));var A=new R("action","action",null,o,h);t.push({event:A,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(rl!==0){var L=k?Gp(h,k):new FormData(h);cd(l,{pending:!0,data:L,method:h.method,action:p},null,L)}}else typeof p=="function"&&(A.preventDefault(),L=k?Gp(h,k):new FormData(h),cd(l,{pending:!0,data:L,method:h.method,action:p},p,L))},currentTarget:h}]})}}for(var Yd=0;Yd<Eu.length;Yd++){var Xd=Eu[Yd],v2=Xd.toLowerCase(),w2=Xd[0].toUpperCase()+Xd.slice(1);_r(v2,"on"+w2)}_r(Sm,"onAnimationEnd"),_r(Cm,"onAnimationIteration"),_r(Em,"onAnimationStart"),_r("dblclick","onDoubleClick"),_r("focusin","onFocus"),_r("focusout","onBlur"),_r(Bb,"onTransitionRun"),_r($b,"onTransitionStart"),_r(Lb,"onTransitionCancel"),_r(Nm,"onTransitionEnd"),da("onMouseEnter",["mouseout","mouseover"]),da("onMouseLeave",["mouseout","mouseover"]),da("onPointerEnter",["pointerout","pointerover"]),da("onPointerLeave",["pointerout","pointerover"]),Mr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Mr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Mr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Mr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Mr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Mr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ms="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(" "),k2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ms));function Qp(t,n){n=(n&4)!==0;for(var l=0;l<t.length;l++){var o=t[l],h=o.event;o=o.listeners;e:{var p=void 0;if(n)for(var k=o.length-1;0<=k;k--){var A=o[k],L=A.instance,te=A.currentTarget;if(A=A.listener,L!==p&&h.isPropagationStopped())break e;p=A,h.currentTarget=te;try{p(h)}catch(ce){Ao(ce)}h.currentTarget=null,p=L}else for(k=0;k<o.length;k++){if(A=o[k],L=A.instance,te=A.currentTarget,A=A.listener,L!==p&&h.isPropagationStopped())break e;p=A,h.currentTarget=te;try{p(h)}catch(ce){Ao(ce)}h.currentTarget=null,p=L}}}}function xt(t,n){var l=n[Ur];l===void 0&&(l=n[Ur]=new Set);var o=t+"__bubble";l.has(o)||(Wp(n,t,2,!1),l.add(o))}function Vd(t,n,l){var o=0;n&&(o|=4),Wp(l,t,o,n)}var mc="_reactListening"+Math.random().toString(36).slice(2);function Gd(t){if(!t[mc]){t[mc]=!0,Ki.forEach(function(l){l!=="selectionchange"&&(k2.has(l)||Vd(l,!1,t),Vd(l,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[mc]||(n[mc]=!0,Vd("selectionchange",!1,n))}}function Wp(t,n,l,o){switch(S1(n)){case 2:var h=K2;break;case 8:h=Z2;break;default:h=cf}l=h.bind(null,n,l,t),h=void 0,!ns||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(h=!0),o?h!==void 0?t.addEventListener(n,l,{capture:!0,passive:h}):t.addEventListener(n,l,!0):h!==void 0?t.addEventListener(n,l,{passive:h}):t.addEventListener(n,l,!1)}function Qd(t,n,l,o,h){var p=o;if((n&1)===0&&(n&2)===0&&o!==null)e:for(;;){if(o===null)return;var k=o.tag;if(k===3||k===4){var A=o.stateNode.containerInfo;if(A===h)break;if(k===4)for(k=o.return;k!==null;){var L=k.tag;if((L===3||L===4)&&k.stateNode.containerInfo===h)return;k=k.return}for(;A!==null;){if(k=ir(A),k===null)return;if(L=k.tag,L===5||L===6||L===26||L===27){o=p=k;continue e}A=A.parentNode}}o=o.return}Co(function(){var te=p,ce=es(l),fe=[];e:{var le=Am.get(t);if(le!==void 0){var se=R,Be=t;switch(t){case"keypress":if(cn(l)===0)break e;case"keydown":case"keyup":se=xb;break;case"focusin":Be="focus",se=It;break;case"focusout":Be="blur",se=It;break;case"beforeblur":case"afterblur":se=It;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":se=$e;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=Qe;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=gb;break;case Sm:case Cm:case Em:se=ii;break;case Nm:se=vb;break;case"scroll":case"scrollend":se=ie;break;case"wheel":se=kb;break;case"copy":case"cut":case"paste":se=un;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=lm;break;case"toggle":case"beforetoggle":se=Sb}var We=(n&4)!==0,$t=!We&&(t==="scroll"||t==="scrollend"),K=We?le!==null?le+"Capture":null:le;We=[];for(var q=te,ee;q!==null;){var ue=q;if(ee=ue.stateNode,ue=ue.tag,ue!==5&&ue!==26&&ue!==27||ee===null||K===null||(ue=Kn(q,K),ue!=null&&We.push(Fs(q,ue,ee))),$t)break;q=q.return}0<We.length&&(le=new se(le,Be,null,l,ce),fe.push({event:le,listeners:We}))}}if((n&7)===0){e:{if(le=t==="mouseover"||t==="pointerover",se=t==="mouseout"||t==="pointerout",le&&l!==Ji&&(Be=l.relatedTarget||l.fromElement)&&(ir(Be)||Be[Fa]))break e;if((se||le)&&(le=ce.window===ce?ce:(le=ce.ownerDocument)?le.defaultView||le.parentWindow:window,se?(Be=l.relatedTarget||l.toElement,se=te,Be=Be?ir(Be):null,Be!==null&&($t=u(Be),We=Be.tag,Be!==$t||We!==5&&We!==27&&We!==6)&&(Be=null)):(se=null,Be=te),se!==Be)){if(We=$e,ue="onMouseLeave",K="onMouseEnter",q="mouse",(t==="pointerout"||t==="pointerover")&&(We=lm,ue="onPointerLeave",K="onPointerEnter",q="pointer"),$t=se==null?le:Oa(se),ee=Be==null?le:Oa(Be),le=new We(ue,q+"leave",se,l,ce),le.target=$t,le.relatedTarget=ee,ue=null,ir(ce)===te&&(We=new We(K,q+"enter",Be,l,ce),We.target=ee,We.relatedTarget=$t,ue=We),$t=ue,se&&Be)t:{for(We=j2,K=se,q=Be,ee=0,ue=K;ue;ue=We(ue))ee++;ue=0;for(var Ye=q;Ye;Ye=We(Ye))ue++;for(;0<ee-ue;)K=We(K),ee--;for(;0<ue-ee;)q=We(q),ue--;for(;ee--;){if(K===q||q!==null&&K===q.alternate){We=K;break t}K=We(K),q=We(q)}We=null}else We=null;se!==null&&Kp(fe,le,se,We,!1),Be!==null&&$t!==null&&Kp(fe,$t,Be,We,!0)}}e:{if(le=te?Oa(te):window,se=le.nodeName&&le.nodeName.toLowerCase(),se==="select"||se==="input"&&le.type==="file")var Et=hm;else if(dm(le))if(mm)Et=Fb;else{Et=Rb;var Le=zb}else se=le.nodeName,!se||se.toLowerCase()!=="input"||le.type!=="checkbox"&&le.type!=="radio"?te&&Sl(te.elementType)&&(Et=hm):Et=Mb;if(Et&&(Et=Et(t,te))){fm(fe,Et,l,ce);break e}Le&&Le(t,le,te),t==="focusout"&&te&&le.type==="number"&&te.memoizedProps.value!=null&&Zi(le,"number",le.value)}switch(Le=te?Oa(te):window,t){case"focusin":(dm(Le)||Le.contentEditable==="true")&&(oi=Le,ju=te,cs=null);break;case"focusout":cs=ju=oi=null;break;case"mousedown":Su=!0;break;case"contextmenu":case"mouseup":case"dragend":Su=!1,km(fe,l,ce);break;case"selectionchange":if(Ob)break;case"keydown":case"keyup":km(fe,l,ce)}var ot;if(bu)e:{switch(t){case"compositionstart":var bt="onCompositionStart";break e;case"compositionend":bt="onCompositionEnd";break e;case"compositionupdate":bt="onCompositionUpdate";break e}bt=void 0}else si?cm(t,l)&&(bt="onCompositionEnd"):t==="keydown"&&l.keyCode===229&&(bt="onCompositionStart");bt&&(im&&l.locale!=="ko"&&(si||bt!=="onCompositionStart"?bt==="onCompositionEnd"&&si&&(ot=Eo()):(zn=ce,ri="value"in zn?zn.value:zn.textContent,si=!0)),Le=xc(te,bt),0<Le.length&&(bt=new jr(bt,t,null,l,ce),fe.push({event:bt,listeners:Le}),ot?bt.data=ot:(ot=um(l),ot!==null&&(bt.data=ot)))),(ot=Eb?Nb(t,l):Ab(t,l))&&(bt=xc(te,"onBeforeInput"),0<bt.length&&(Le=new jr("onBeforeInput","beforeinput",null,l,ce),fe.push({event:Le,listeners:bt}),Le.data=ot)),b2(fe,t,te,l,ce)}Qp(fe,n)})}function Fs(t,n,l){return{instance:t,listener:n,currentTarget:l}}function xc(t,n){for(var l=n+"Capture",o=[];t!==null;){var h=t,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=Kn(t,l),h!=null&&o.unshift(Fs(t,h,p)),h=Kn(t,n),h!=null&&o.push(Fs(t,h,p))),t.tag===3)return o;t=t.return}return[]}function j2(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Kp(t,n,l,o,h){for(var p=n._reactName,k=[];l!==null&&l!==o;){var A=l,L=A.alternate,te=A.stateNode;if(A=A.tag,L!==null&&L===o)break;A!==5&&A!==26&&A!==27||te===null||(L=te,h?(te=Kn(l,p),te!=null&&k.unshift(Fs(l,te,L))):h||(te=Kn(l,p),te!=null&&k.push(Fs(l,te,L)))),l=l.return}k.length!==0&&t.push({event:n,listeners:k})}var S2=/\r\n?/g,C2=/\u0000|\uFFFD/g;function Zp(t){return(typeof t=="string"?t:""+t).replace(S2,`
|
|
49
|
+
`).replace(C2,"")}function Pp(t,n){return n=Zp(n),Zp(t)===n}function Bt(t,n,l,o,h,p){switch(l){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||Gr(t,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&Gr(t,""+o);break;case"className":Xr(t,"class",o);break;case"tabIndex":Xr(t,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Xr(t,l,o);break;case"style":jo(t,o,p);break;case"data":if(n!=="object"){Xr(t,"data",o);break}case"src":case"href":if(o===""&&(n!=="a"||l!=="href")){t.removeAttribute(l);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(l);break}o=ni(""+o),t.setAttribute(l,o);break;case"action":case"formAction":if(typeof o=="function"){t.setAttribute(l,"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 p=="function"&&(l==="formAction"?(n!=="input"&&Bt(t,n,"name",h.name,h,null),Bt(t,n,"formEncType",h.formEncType,h,null),Bt(t,n,"formMethod",h.formMethod,h,null),Bt(t,n,"formTarget",h.formTarget,h,null)):(Bt(t,n,"encType",h.encType,h,null),Bt(t,n,"method",h.method,h,null),Bt(t,n,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(l);break}o=ni(""+o),t.setAttribute(l,o);break;case"onClick":o!=null&&(t.onclick=kr);break;case"onScroll":o!=null&&xt("scroll",t);break;case"onScrollEnd":o!=null&&xt("scrollend",t);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(i(61));if(l=o.__html,l!=null){if(h.children!=null)throw Error(i(60));t.innerHTML=l}}break;case"multiple":t.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":t.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){t.removeAttribute("xlink:href");break}l=ni(""+o),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(l,""+o):t.removeAttribute(l);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":o&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(l,""):t.removeAttribute(l);break;case"capture":case"download":o===!0?t.setAttribute(l,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(l,o):t.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?t.setAttribute(l,o):t.removeAttribute(l);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?t.removeAttribute(l):t.setAttribute(l,o);break;case"popover":xt("beforetoggle",t),xt("toggle",t),sr(t,"popover",o);break;case"xlinkActuate":Fr(t,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":Fr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":Fr(t,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":Fr(t,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":Fr(t,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":Fr(t,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":Fr(t,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":Fr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":Fr(t,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":sr(t,"is",o);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Pi.get(l)||l,sr(t,l,o))}}function Wd(t,n,l,o,h,p){switch(l){case"style":jo(t,o,p);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(i(61));if(l=o.__html,l!=null){if(h.children!=null)throw Error(i(60));t.innerHTML=l}}break;case"children":typeof o=="string"?Gr(t,o):(typeof o=="number"||typeof o=="bigint")&&Gr(t,""+o);break;case"onScroll":o!=null&&xt("scroll",t);break;case"onScrollEnd":o!=null&&xt("scrollend",t);break;case"onClick":o!=null&&(t.onclick=kr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Yr.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(h=l.endsWith("Capture"),n=l.slice(2,h?l.length-7:void 0),p=t[Gt]||null,p=p!=null?p[l]:null,typeof p=="function"&&t.removeEventListener(n,p,h),typeof o=="function")){typeof p!="function"&&p!==null&&(l in t?t[l]=null:t.hasAttribute(l)&&t.removeAttribute(l)),t.addEventListener(n,o,h);break e}l in t?t[l]=o:o===!0?t.setAttribute(l,""):sr(t,l,o)}}}function Bn(t,n,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":xt("error",t),xt("load",t);var o=!1,h=!1,p;for(p in l)if(l.hasOwnProperty(p)){var k=l[p];if(k!=null)switch(p){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Bt(t,n,p,k,l,null)}}h&&Bt(t,n,"srcSet",l.srcSet,l,null),o&&Bt(t,n,"src",l.src,l,null);return;case"input":xt("invalid",t);var A=p=k=h=null,L=null,te=null;for(o in l)if(l.hasOwnProperty(o)){var ce=l[o];if(ce!=null)switch(o){case"name":h=ce;break;case"type":k=ce;break;case"checked":L=ce;break;case"defaultChecked":te=ce;break;case"value":p=ce;break;case"defaultValue":A=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(i(137,n));break;default:Bt(t,n,o,ce,l,null)}}ma(t,p,A,L,te,k,h,!1);return;case"select":xt("invalid",t),o=k=p=null;for(h in l)if(l.hasOwnProperty(h)&&(A=l[h],A!=null))switch(h){case"value":p=A;break;case"defaultValue":k=A;break;case"multiple":o=A;default:Bt(t,n,h,A,l,null)}n=p,l=k,t.multiple=!!o,n!=null?Mt(t,!!o,n,!1):l!=null&&Mt(t,!!o,l,!0);return;case"textarea":xt("invalid",t),p=h=o=null;for(k in l)if(l.hasOwnProperty(k)&&(A=l[k],A!=null))switch(k){case"value":o=A;break;case"defaultValue":h=A;break;case"children":p=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(i(91));break;default:Bt(t,n,k,A,l,null)}Vr(t,o,h,p);return;case"option":for(L in l)if(l.hasOwnProperty(L)&&(o=l[L],o!=null))switch(L){case"selected":t.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Bt(t,n,L,o,l,null)}return;case"dialog":xt("beforetoggle",t),xt("toggle",t),xt("cancel",t),xt("close",t);break;case"iframe":case"object":xt("load",t);break;case"video":case"audio":for(o=0;o<Ms.length;o++)xt(Ms[o],t);break;case"image":xt("error",t),xt("load",t);break;case"details":xt("toggle",t);break;case"embed":case"source":case"link":xt("error",t),xt("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(te in l)if(l.hasOwnProperty(te)&&(o=l[te],o!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Bt(t,n,te,o,l,null)}return;default:if(Sl(n)){for(ce in l)l.hasOwnProperty(ce)&&(o=l[ce],o!==void 0&&Wd(t,n,ce,o,l,void 0));return}}for(A in l)l.hasOwnProperty(A)&&(o=l[A],o!=null&&Bt(t,n,A,o,l,null))}function E2(t,n,l,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,k=null,A=null,L=null,te=null,ce=null;for(se in l){var fe=l[se];if(l.hasOwnProperty(se)&&fe!=null)switch(se){case"checked":break;case"value":break;case"defaultValue":L=fe;default:o.hasOwnProperty(se)||Bt(t,n,se,null,o,fe)}}for(var le in o){var se=o[le];if(fe=l[le],o.hasOwnProperty(le)&&(se!=null||fe!=null))switch(le){case"type":p=se;break;case"name":h=se;break;case"checked":te=se;break;case"defaultChecked":ce=se;break;case"value":k=se;break;case"defaultValue":A=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(i(137,n));break;default:se!==fe&&Bt(t,n,le,se,o,fe)}}ha(t,k,A,L,te,ce,p,h);return;case"select":se=k=A=le=null;for(p in l)if(L=l[p],l.hasOwnProperty(p)&&L!=null)switch(p){case"value":break;case"multiple":se=L;default:o.hasOwnProperty(p)||Bt(t,n,p,null,o,L)}for(h in o)if(p=o[h],L=l[h],o.hasOwnProperty(h)&&(p!=null||L!=null))switch(h){case"value":le=p;break;case"defaultValue":A=p;break;case"multiple":k=p;default:p!==L&&Bt(t,n,h,p,o,L)}n=A,l=k,o=se,le!=null?Mt(t,!!l,le,!1):!!o!=!!l&&(n!=null?Mt(t,!!l,n,!0):Mt(t,!!l,l?[]:"",!1));return;case"textarea":se=le=null;for(A in l)if(h=l[A],l.hasOwnProperty(A)&&h!=null&&!o.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:Bt(t,n,A,null,o,h)}for(k in o)if(h=o[k],p=l[k],o.hasOwnProperty(k)&&(h!=null||p!=null))switch(k){case"value":le=h;break;case"defaultValue":se=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(i(91));break;default:h!==p&&Bt(t,n,k,h,o,p)}wo(t,le,se);return;case"option":for(var Be in l)if(le=l[Be],l.hasOwnProperty(Be)&&le!=null&&!o.hasOwnProperty(Be))switch(Be){case"selected":t.selected=!1;break;default:Bt(t,n,Be,null,o,le)}for(L in o)if(le=o[L],se=l[L],o.hasOwnProperty(L)&&le!==se&&(le!=null||se!=null))switch(L){case"selected":t.selected=le&&typeof le!="function"&&typeof le!="symbol";break;default:Bt(t,n,L,le,o,se)}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 We in l)le=l[We],l.hasOwnProperty(We)&&le!=null&&!o.hasOwnProperty(We)&&Bt(t,n,We,null,o,le);for(te in o)if(le=o[te],se=l[te],o.hasOwnProperty(te)&&le!==se&&(le!=null||se!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(i(137,n));break;default:Bt(t,n,te,le,o,se)}return;default:if(Sl(n)){for(var $t in l)le=l[$t],l.hasOwnProperty($t)&&le!==void 0&&!o.hasOwnProperty($t)&&Wd(t,n,$t,void 0,o,le);for(ce in o)le=o[ce],se=l[ce],!o.hasOwnProperty(ce)||le===se||le===void 0&&se===void 0||Wd(t,n,ce,le,o,se);return}}for(var K in l)le=l[K],l.hasOwnProperty(K)&&le!=null&&!o.hasOwnProperty(K)&&Bt(t,n,K,null,o,le);for(fe in o)le=o[fe],se=l[fe],!o.hasOwnProperty(fe)||le===se||le==null&&se==null||Bt(t,n,fe,le,o,se)}function Jp(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function N2(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,l=performance.getEntriesByType("resource"),o=0;o<l.length;o++){var h=l[o],p=h.transferSize,k=h.initiatorType,A=h.duration;if(p&&A&&Jp(k)){for(k=0,A=h.responseEnd,o+=1;o<l.length;o++){var L=l[o],te=L.startTime;if(te>A)break;var ce=L.transferSize,fe=L.initiatorType;ce&&Jp(fe)&&(L=L.responseEnd,k+=ce*(L<A?1:(A-te)/(L-te)))}if(--o,n+=8*(p+k)/(h.duration/1e3),t++,10<t)break}}if(0<t)return n/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Kd=null,Zd=null;function pc(t){return t.nodeType===9?t:t.ownerDocument}function e1(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 t1(t,n){if(t===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&n==="foreignObject"?0:t}function Pd(t,n){return t==="textarea"||t==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Jd=null;function A2(){var t=window.event;return t&&t.type==="popstate"?t===Jd?!1:(Jd=t,!0):(Jd=null,!1)}var n1=typeof setTimeout=="function"?setTimeout:void 0,T2=typeof clearTimeout=="function"?clearTimeout:void 0,r1=typeof Promise=="function"?Promise:void 0,D2=typeof queueMicrotask=="function"?queueMicrotask:typeof r1<"u"?function(t){return r1.resolve(null).then(t).catch(z2)}:n1;function z2(t){setTimeout(function(){throw t})}function al(t){return t==="head"}function a1(t,n){var l=n,o=0;do{var h=l.nextSibling;if(t.removeChild(l),h&&h.nodeType===8)if(l=h.data,l==="/$"||l==="/&"){if(o===0){t.removeChild(h),_i(n);return}o--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")o++;else if(l==="html")_s(t.ownerDocument.documentElement);else if(l==="head"){l=t.ownerDocument.head,_s(l);for(var p=l.firstChild;p;){var k=p.nextSibling,A=p.nodeName;p[vr]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&p.rel.toLowerCase()==="stylesheet"||l.removeChild(p),p=k}}else l==="body"&&_s(t.ownerDocument.body);l=h}while(l);_i(n)}function l1(t,n){var l=t;t=0;do{var o=l.nextSibling;if(l.nodeType===1?n?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(n?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),o&&o.nodeType===8)if(l=o.data,l==="/$"){if(t===0)break;t--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||t++;l=o}while(l)}function ef(t){var n=t.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var l=n;switch(n=n.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":ef(l),ei(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}t.removeChild(l)}}function R2(t,n,l,o){for(;t.nodeType===1;){var h=l;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!o&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(o){if(!t[vr])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(p=t.getAttribute("rel"),p==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(p!==h.rel||t.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||t.getAttribute("title")!==(h.title==null?null:h.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(p=t.getAttribute("src"),(p!==(h.src==null?null:h.src)||t.getAttribute("type")!==(h.type==null?null:h.type)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&t.getAttribute("name")===p)return t}else return t;if(t=Dr(t.nextSibling),t===null)break}return null}function M2(t,n,l){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!l||(t=Dr(t.nextSibling),t===null))return null;return t}function i1(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Dr(t.nextSibling),t===null))return null;return t}function tf(t){return t.data==="$?"||t.data==="$~"}function nf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function F2(t,n){var l=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||l.readyState!=="loading")n();else{var o=function(){n(),l.removeEventListener("DOMContentLoaded",o)};l.addEventListener("DOMContentLoaded",o),t._reactRetry=o}}function Dr(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return t}var rf=null;function s1(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var l=t.data;if(l==="/$"||l==="/&"){if(n===0)return Dr(t.nextSibling);n--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||n++}t=t.nextSibling}return null}function o1(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var l=t.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(n===0)return t;n--}else l!=="/$"&&l!=="/&"||n++}t=t.previousSibling}return null}function c1(t,n,l){switch(n=pc(l),t){case"html":if(t=n.documentElement,!t)throw Error(i(452));return t;case"head":if(t=n.head,!t)throw Error(i(453));return t;case"body":if(t=n.body,!t)throw Error(i(454));return t;default:throw Error(i(451))}}function _s(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);ei(t)}var zr=new Map,u1=new Set;function yc(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Ta=Y.d;Y.d={f:_2,r:O2,D:B2,C:$2,L:L2,m:H2,X:U2,S:I2,M:q2};function _2(){var t=Ta.f(),n=oc();return t||n}function O2(t){var n=ua(t);n!==null&&n.tag===5&&n.type==="form"?Nx(n):Ta.r(t)}var Ri=typeof document>"u"?null:document;function d1(t,n,l){var o=Ri;if(o&&typeof n=="string"&&n){var h=En(n);h='link[rel="'+t+'"][href="'+h+'"]',typeof l=="string"&&(h+='[crossorigin="'+l+'"]'),u1.has(h)||(u1.add(h),t={rel:t,crossOrigin:l,href:n},o.querySelector(h)===null&&(n=o.createElement("link"),Bn(n,"link",t),on(n),o.head.appendChild(n)))}}function B2(t){Ta.D(t),d1("dns-prefetch",t,null)}function $2(t,n){Ta.C(t,n),d1("preconnect",t,n)}function L2(t,n,l){Ta.L(t,n,l);var o=Ri;if(o&&t&&n){var h='link[rel="preload"][as="'+En(n)+'"]';n==="image"&&l&&l.imageSrcSet?(h+='[imagesrcset="'+En(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(h+='[imagesizes="'+En(l.imageSizes)+'"]')):h+='[href="'+En(t)+'"]';var p=h;switch(n){case"style":p=Mi(t);break;case"script":p=Fi(t)}zr.has(p)||(t=g({rel:"preload",href:n==="image"&&l&&l.imageSrcSet?void 0:t,as:n},l),zr.set(p,t),o.querySelector(h)!==null||n==="style"&&o.querySelector(Os(p))||n==="script"&&o.querySelector(Bs(p))||(n=o.createElement("link"),Bn(n,"link",t),on(n),o.head.appendChild(n)))}}function H2(t,n){Ta.m(t,n);var l=Ri;if(l&&t){var o=n&&typeof n.as=="string"?n.as:"script",h='link[rel="modulepreload"][as="'+En(o)+'"][href="'+En(t)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Fi(t)}if(!zr.has(p)&&(t=g({rel:"modulepreload",href:t},n),zr.set(p,t),l.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Bs(p)))return}o=l.createElement("link"),Bn(o,"link",t),on(o),l.head.appendChild(o)}}}function I2(t,n,l){Ta.S(t,n,l);var o=Ri;if(o&&t){var h=qr(o).hoistableStyles,p=Mi(t);n=n||"default";var k=h.get(p);if(!k){var A={loading:0,preload:null};if(k=o.querySelector(Os(p)))A.loading=5;else{t=g({rel:"stylesheet",href:t,"data-precedence":n},l),(l=zr.get(p))&&af(t,l);var L=k=o.createElement("link");on(L),Bn(L,"link",t),L._p=new Promise(function(te,ce){L.onload=te,L.onerror=ce}),L.addEventListener("load",function(){A.loading|=1}),L.addEventListener("error",function(){A.loading|=2}),A.loading|=4,gc(k,n,o)}k={type:"stylesheet",instance:k,count:1,state:A},h.set(p,k)}}}function U2(t,n){Ta.X(t,n);var l=Ri;if(l&&t){var o=qr(l).hoistableScripts,h=Fi(t),p=o.get(h);p||(p=l.querySelector(Bs(h)),p||(t=g({src:t,async:!0},n),(n=zr.get(h))&&lf(t,n),p=l.createElement("script"),on(p),Bn(p,"link",t),l.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function q2(t,n){Ta.M(t,n);var l=Ri;if(l&&t){var o=qr(l).hoistableScripts,h=Fi(t),p=o.get(h);p||(p=l.querySelector(Bs(h)),p||(t=g({src:t,async:!0,type:"module"},n),(n=zr.get(h))&&lf(t,n),p=l.createElement("script"),on(p),Bn(p,"link",t),l.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function f1(t,n,l,o){var h=(h=ge.current)?yc(h):null;if(!h)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(n=Mi(l.href),l=qr(h).hoistableStyles,o=l.get(n),o||(o={type:"style",instance:null,count:0,state:null},l.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){t=Mi(l.href);var p=qr(h).hoistableStyles,k=p.get(t);if(k||(h=h.ownerDocument||h,k={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(t,k),(p=h.querySelector(Os(t)))&&!p._p&&(k.instance=p,k.state.loading=5),zr.has(t)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},zr.set(t,l),p||Y2(h,t,l,k.state))),n&&o===null)throw Error(i(528,""));return k}if(n&&o!==null)throw Error(i(529,""));return null;case"script":return n=l.async,l=l.src,typeof l=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Fi(l),l=qr(h).hoistableScripts,o=l.get(n),o||(o={type:"script",instance:null,count:0,state:null},l.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,t))}}function Mi(t){return'href="'+En(t)+'"'}function Os(t){return'link[rel="stylesheet"]['+t+"]"}function h1(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function Y2(t,n,l,o){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=t.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),Bn(n,"link",l),on(n),t.head.appendChild(n))}function Fi(t){return'[src="'+En(t)+'"]'}function Bs(t){return"script[async]"+t}function m1(t,n,l){if(n.count++,n.instance===null)switch(n.type){case"style":var o=t.querySelector('style[data-href~="'+En(l.href)+'"]');if(o)return n.instance=o,on(o),o;var h=g({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),on(o),Bn(o,"style",h),gc(o,l.precedence,t),n.instance=o;case"stylesheet":h=Mi(l.href);var p=t.querySelector(Os(h));if(p)return n.state.loading|=4,n.instance=p,on(p),p;o=h1(l),(h=zr.get(h))&&af(o,h),p=(t.ownerDocument||t).createElement("link"),on(p);var k=p;return k._p=new Promise(function(A,L){k.onload=A,k.onerror=L}),Bn(p,"link",o),n.state.loading|=4,gc(p,l.precedence,t),n.instance=p;case"script":return p=Fi(l.src),(h=t.querySelector(Bs(p)))?(n.instance=h,on(h),h):(o=l,(h=zr.get(p))&&(o=g({},l),lf(o,h)),t=t.ownerDocument||t,h=t.createElement("script"),on(h),Bn(h,"link",o),t.head.appendChild(h),n.instance=h);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,gc(o,l.precedence,t));return n.instance}function gc(t,n,l){for(var o=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=o.length?o[o.length-1]:null,p=h,k=0;k<o.length;k++){var A=o[k];if(A.dataset.precedence===n)p=A;else if(p!==h)break}p?p.parentNode.insertBefore(t,p.nextSibling):(n=l.nodeType===9?l.head:l,n.insertBefore(t,n.firstChild))}function af(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function lf(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var bc=null;function x1(t,n,l){if(bc===null){var o=new Map,h=bc=new Map;h.set(l,o)}else h=bc,o=h.get(l),o||(o=new Map,h.set(l,o));if(o.has(t))return o;for(o.set(t,null),l=l.getElementsByTagName(t),h=0;h<l.length;h++){var p=l[h];if(!(p[vr]||p[sn]||t==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var k=p.getAttribute(n)||"";k=t+k;var A=o.get(k);A?A.push(p):o.set(k,[p])}}return o}function p1(t,n,l){t=t.ownerDocument||t,t.head.insertBefore(l,n==="title"?t.querySelector("head > title"):null)}function X2(t,n,l){if(l===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return t=n.disabled,typeof n.precedence=="string"&&t==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function y1(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function V2(t,n,l,o){if(l.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var h=Mi(o.href),p=n.querySelector(Os(h));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=vc.bind(t),n.then(t,t)),l.state.loading|=4,l.instance=p,on(p);return}p=n.ownerDocument||n,o=h1(o),(h=zr.get(h))&&af(o,h),p=p.createElement("link"),on(p);var k=p;k._p=new Promise(function(A,L){k.onload=A,k.onerror=L}),Bn(p,"link",o),l.instance=p}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(l,n),(n=l.state.preload)&&(l.state.loading&3)===0&&(t.count++,l=vc.bind(t),n.addEventListener("load",l),n.addEventListener("error",l))}}var sf=0;function G2(t,n){return t.stylesheets&&t.count===0&&kc(t,t.stylesheets),0<t.count||0<t.imgCount?function(l){var o=setTimeout(function(){if(t.stylesheets&&kc(t,t.stylesheets),t.unsuspend){var p=t.unsuspend;t.unsuspend=null,p()}},6e4+n);0<t.imgBytes&&sf===0&&(sf=62500*N2());var h=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&kc(t,t.stylesheets),t.unsuspend)){var p=t.unsuspend;t.unsuspend=null,p()}},(t.imgBytes>sf?50:800)+n);return t.unsuspend=l,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function vc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)kc(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var wc=null;function kc(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,wc=new Map,n.forEach(Q2,t),wc=null,vc.call(t))}function Q2(t,n){if(!(n.state.loading&4)){var l=wc.get(t);if(l)var o=l.get(null);else{l=new Map,wc.set(t,l);for(var h=t.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var k=h[p];(k.nodeName==="LINK"||k.getAttribute("media")!=="not all")&&(l.set(k.dataset.precedence,k),o=k)}o&&l.set(null,o)}h=n.instance,k=h.getAttribute("data-precedence"),p=l.get(k)||o,p===o&&l.set(null,h),l.set(k,h),this.count++,o=vc.bind(this),h.addEventListener("load",o),h.addEventListener("error",o),p?p.parentNode.insertBefore(h,p.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(h,t.firstChild)),n.state.loading|=4}}var $s={$$typeof:_,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function W2(t,n,l,o,h,p,k,A,L){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=Pt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pt(0),this.hiddenUpdates=Pt(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=k,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=L,this.incompleteTransitions=new Map}function g1(t,n,l,o,h,p,k,A,L,te,ce,fe){return t=new W2(t,n,l,k,L,te,ce,fe,A),n=1,p===!0&&(n|=24),p=ur(3,null,null,n),t.current=p,p.stateNode=t,n=Lu(),n.refCount++,t.pooledCache=n,n.refCount++,p.memoizedState={element:o,isDehydrated:l,cache:n},qu(p),t}function b1(t){return t?(t=di,t):di}function v1(t,n,l,o,h,p){h=b1(h),o.context===null?o.context=h:o.pendingContext=h,o=Ga(n),o.payload={element:l},p=p===void 0?null:p,p!==null&&(o.callback=p),l=Qa(t,o,n),l!==null&&(tr(l,t,n),ps(l,t,n))}function w1(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var l=t.retryLane;t.retryLane=l!==0&&l<n?l:n}}function of(t,n){w1(t,n),(t=t.alternate)&&w1(t,n)}function k1(t){if(t.tag===13||t.tag===31){var n=Al(t,67108864);n!==null&&tr(n,t,67108864),of(t,67108864)}}function j1(t){if(t.tag===13||t.tag===31){var n=xr();n=Tn(n);var l=Al(t,n);l!==null&&tr(l,t,n),of(t,n)}}var jc=!0;function K2(t,n,l,o){var h=H.T;H.T=null;var p=Y.p;try{Y.p=2,cf(t,n,l,o)}finally{Y.p=p,H.T=h}}function Z2(t,n,l,o){var h=H.T;H.T=null;var p=Y.p;try{Y.p=8,cf(t,n,l,o)}finally{Y.p=p,H.T=h}}function cf(t,n,l,o){if(jc){var h=uf(o);if(h===null)Qd(t,n,o,Sc,l),C1(t,o);else if(J2(h,t,n,l,o))o.stopPropagation();else if(C1(t,o),n&4&&-1<P2.indexOf(t)){for(;h!==null;){var p=ua(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var k=Ln(p.pendingLanes);if(k!==0){var A=p;for(A.pendingLanes|=2,A.entangledLanes|=2;k;){var L=1<<31-st(k);A.entanglements[1]|=L,k&=~L}Jr(p),(Tt&6)===0&&(ic=_e()+500,Rs(0))}}break;case 31:case 13:A=Al(p,2),A!==null&&tr(A,p,2),oc(),of(p,2)}if(p=uf(o),p===null&&Qd(t,n,o,Sc,l),p===h)break;h=p}h!==null&&o.stopPropagation()}else Qd(t,n,o,null,l)}}function uf(t){return t=es(t),df(t)}var Sc=null;function df(t){if(Sc=null,t=ir(t),t!==null){var n=u(t);if(n===null)t=null;else{var l=n.tag;if(l===13){if(t=d(n),t!==null)return t;t=null}else if(l===31){if(t=m(n),t!==null)return t;t=null}else if(l===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null)}}return Sc=t,null}function S1(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(et()){case re:return 2;case ye:return 8;case De:case He:return 32;case de:return 268435456;default:return 32}default:return 32}}var ff=!1,ll=null,il=null,sl=null,Ls=new Map,Hs=new Map,ol=[],P2="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 C1(t,n){switch(t){case"focusin":case"focusout":ll=null;break;case"dragenter":case"dragleave":il=null;break;case"mouseover":case"mouseout":sl=null;break;case"pointerover":case"pointerout":Ls.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Hs.delete(n.pointerId)}}function Is(t,n,l,o,h,p){return t===null||t.nativeEvent!==p?(t={blockedOn:n,domEventName:l,eventSystemFlags:o,nativeEvent:p,targetContainers:[h]},n!==null&&(n=ua(n),n!==null&&k1(n)),t):(t.eventSystemFlags|=o,n=t.targetContainers,h!==null&&n.indexOf(h)===-1&&n.push(h),t)}function J2(t,n,l,o,h){switch(n){case"focusin":return ll=Is(ll,t,n,l,o,h),!0;case"dragenter":return il=Is(il,t,n,l,o,h),!0;case"mouseover":return sl=Is(sl,t,n,l,o,h),!0;case"pointerover":var p=h.pointerId;return Ls.set(p,Is(Ls.get(p)||null,t,n,l,o,h)),!0;case"gotpointercapture":return p=h.pointerId,Hs.set(p,Is(Hs.get(p)||null,t,n,l,o,h)),!0}return!1}function E1(t){var n=ir(t.target);if(n!==null){var l=u(n);if(l!==null){if(n=l.tag,n===13){if(n=d(l),n!==null){t.blockedOn=n,jl(t.priority,function(){j1(l)});return}}else if(n===31){if(n=m(l),n!==null){t.blockedOn=n,jl(t.priority,function(){j1(l)});return}}else if(n===3&&l.stateNode.current.memoizedState.isDehydrated){t.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Cc(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var l=uf(t.nativeEvent);if(l===null){l=t.nativeEvent;var o=new l.constructor(l.type,l);Ji=o,l.target.dispatchEvent(o),Ji=null}else return n=ua(l),n!==null&&k1(n),t.blockedOn=l,!1;n.shift()}return!0}function N1(t,n,l){Cc(t)&&l.delete(n)}function ev(){ff=!1,ll!==null&&Cc(ll)&&(ll=null),il!==null&&Cc(il)&&(il=null),sl!==null&&Cc(sl)&&(sl=null),Ls.forEach(N1),Hs.forEach(N1)}function Ec(t,n){t.blockedOn===n&&(t.blockedOn=null,ff||(ff=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,ev)))}var Nc=null;function A1(t){Nc!==t&&(Nc=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Nc===t&&(Nc=null);for(var n=0;n<t.length;n+=3){var l=t[n],o=t[n+1],h=t[n+2];if(typeof o!="function"){if(df(o||l)===null)continue;break}var p=ua(l);p!==null&&(t.splice(n,3),n-=3,cd(p,{pending:!0,data:h,method:l.method,action:o},o,h))}}))}function _i(t){function n(L){return Ec(L,t)}ll!==null&&Ec(ll,t),il!==null&&Ec(il,t),sl!==null&&Ec(sl,t),Ls.forEach(n),Hs.forEach(n);for(var l=0;l<ol.length;l++){var o=ol[l];o.blockedOn===t&&(o.blockedOn=null)}for(;0<ol.length&&(l=ol[0],l.blockedOn===null);)E1(l),l.blockedOn===null&&ol.shift();if(l=(t.ownerDocument||t).$$reactFormReplay,l!=null)for(o=0;o<l.length;o+=3){var h=l[o],p=l[o+1],k=h[Gt]||null;if(typeof p=="function")k||A1(l);else if(k){var A=null;if(p&&p.hasAttribute("formAction")){if(h=p,k=p[Gt]||null)A=k.formAction;else if(df(h)!==null)continue}else A=k.action;typeof A=="function"?l[o+1]=A:(l.splice(o,3),o-=3),A1(l)}}}function T1(){function t(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(k){return h=k})},focusReset:"manual",scroll:"manual"})}function n(){h!==null&&(h(),h=null),o||setTimeout(l,20)}function l(){if(!o&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,h=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(l,100),function(){o=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),h!==null&&(h(),h=null)}}}function hf(t){this._internalRoot=t}Ac.prototype.render=hf.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(i(409));var l=n.current,o=xr();v1(l,o,t,n,null,null)},Ac.prototype.unmount=hf.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;v1(t.current,2,null,t,null,null),oc(),n[Fa]=null}};function Ac(t){this._internalRoot=t}Ac.prototype.unstable_scheduleHydration=function(t){if(t){var n=Cn();t={blockedOn:null,target:t,priority:n};for(var l=0;l<ol.length&&n!==0&&n<ol[l].priority;l++);ol.splice(l,0,t),l===0&&E1(t)}};var D1=r.version;if(D1!=="19.2.4")throw Error(i(527,D1,"19.2.4"));Y.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(i(188)):(t=Object.keys(t).join(","),Error(i(268,t)));return t=f(n),t=t!==null?y(t):null,t=t===null?null:t.stateNode,t};var tv={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Tc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Tc.isDisabled&&Tc.supportsFiber)try{it=Tc.inject(tv),rt=Tc}catch{}}return qs.createRoot=function(t,n){if(!c(t))throw Error(i(299));var l=!1,o="",h=Bx,p=$x,k=Lx;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(h=n.onUncaughtError),n.onCaughtError!==void 0&&(p=n.onCaughtError),n.onRecoverableError!==void 0&&(k=n.onRecoverableError)),n=g1(t,1,!1,null,null,l,o,null,h,p,k,T1),t[Fa]=n.current,Gd(t),new hf(n)},qs.hydrateRoot=function(t,n,l){if(!c(t))throw Error(i(299));var o=!1,h="",p=Bx,k=$x,A=Lx,L=null;return l!=null&&(l.unstable_strictMode===!0&&(o=!0),l.identifierPrefix!==void 0&&(h=l.identifierPrefix),l.onUncaughtError!==void 0&&(p=l.onUncaughtError),l.onCaughtError!==void 0&&(k=l.onCaughtError),l.onRecoverableError!==void 0&&(A=l.onRecoverableError),l.formState!==void 0&&(L=l.formState)),n=g1(t,1,!0,n,l??null,o,h,L,p,k,A,T1),n.context=b1(null),l=n.current,o=xr(),o=Tn(o),h=Ga(o),h.callback=null,Qa(l,h,o),l=o,n.current.lanes=l,Jt(n,l),Jr(n),t[Fa]=n.current,Gd(t),new Ac(n)},qs.version="19.2.4",qs}var I1;function hv(){if(I1)return pf.exports;I1=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(r){console.error(r)}}return e(),pf.exports=fv(),pf.exports}var mv=hv();const xv="modulepreload",pv=function(e){return"/"+e},U1={},yv=function(r,a,i){let c=Promise.resolve();if(a&&a.length>0){let d=function(f){return Promise.all(f.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),x=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));c=d(a.map(f=>{if(f=pv(f),f in U1)return;U1[f]=!0;const y=f.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${g}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":xv,y||(b.as="script"),b.crossOrigin="",b.href=f,x&&b.setAttribute("nonce",x),document.head.appendChild(b),y)return new Promise((v,S)=>{b.addEventListener("load",v),b.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${f}`)))})}))}function u(d){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=d,window.dispatchEvent(m),!m.defaultPrevented)throw d}return c.then(d=>{for(const m of d||[])m.status==="rejected"&&u(m.reason);return r().catch(u)})};class gv extends w.Component{constructor(){super(...arguments);z1(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(a){return{hasError:!0,error:a}}render(){var a;return this.state.hasError?s.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:s.jsxs("div",{className:"text-center max-w-md",children:[s.jsx("div",{className:"text-4xl mb-3",children:"🚨"}),s.jsx("div",{className:"text-gray-800 font-semibold mb-2",children:"Something went wrong"}),s.jsx("div",{className:"text-gray-500 text-sm mb-4",children:((a=this.state.error)==null?void 0:a.message)??"An unexpected error occurred."}),s.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 yl="/api";async function Dt(e){const r=await fetch(`${yl}${e}`);if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}async function wn(e,r){const a=await fetch(`${yl}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}async function vf(e,r){const a=await fetch(`${yl}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}async function ul(e,r){const a={method:"DELETE"};r!==void 0&&(a.headers={"Content-Type":"application/json"},a.body=JSON.stringify(r));const i=await fetch(`${yl}${e}`,a);if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()}const Se={getCompany:()=>Dt("/company"),getRoles:()=>Dt("/roles"),getRole:e=>Dt(`/roles/${e}`),getProjects:()=>Dt("/projects"),getProject:e=>Dt(`/projects/${e}`),getStandups:()=>Dt("/operations/standups"),getWaves:()=>Dt("/operations/waves"),getDecisions:()=>Dt("/operations/decisions"),getOrgTree:()=>Dt("/engine/org"),getSkills:()=>Dt("/skills"),exportSkills:e=>Dt(`/skills/export/${e}`),getSkillRegistry:()=>Dt("/skills/registry"),installRegistrySkill:(e,r)=>wn("/skills/registry/install",{skillId:e,url:r}),createRole:e=>wn("/engine/roles",e),updateRole:(e,r)=>vf(`/engine/roles/${e}`,r),deleteRole:e=>ul(`/engine/roles/${e}`),getSessions:()=>Dt("/sessions"),getSession:e=>Dt(`/sessions/${e}`),createSession:(e,r="talk")=>wn("/sessions",{roleId:e,mode:r}),deleteSession:e=>ul(`/sessions/${e}`),deleteSessions:e=>ul("/sessions",{ids:e}),deleteEmptySessions:()=>ul("/sessions?empty=true"),updateSession:(e,r)=>vf(`/sessions/${e}`,r),startJob:e=>wn("/jobs",e),getJob:e=>Dt(`/jobs/${e}`),listJobs:e=>{const r=new URLSearchParams;e!=null&&e.status&&r.set("status",e.status),e!=null&&e.roleId&&r.set("roleId",e.roleId);const a=r.toString();return Dt(`/jobs${a?"?"+a:""}`)},abortJob:e=>ul(`/jobs/${e}`),replyToJob:(e,r)=>wn(`/jobs/${e}/reply`,{message:r}),saveWave:e=>wn("/waves/save",e),getStatus:()=>Dt("/status"),detectEngine:()=>wn("/setup/detect-engine",{}),validatePath:e=>wn("/setup/validate-path",{path:e}),scaffold:e=>wn("/setup/scaffold",e),getTeams:()=>Dt("/setup/teams"),browse:e=>wn("/setup/browse",{path:e}),connectAkb:e=>wn("/setup/connect-akb",{path:e}),getKnowledge:()=>Dt("/knowledge"),getKnowledgeDoc:e=>{const r=e.split("/").map(encodeURIComponent).join("/");return Dt(`/knowledge/${r}`)},createKnowledgeDoc:e=>wn("/knowledge",e),updateKnowledgeDoc:(e,r)=>{const a=e.split("/").map(encodeURIComponent).join("/");return fetch(`${yl}/knowledge/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:r})}).then(i=>{if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()})},deleteKnowledgeDoc:e=>{const r=e.split("/").map(encodeURIComponent).join("/");return ul(`/knowledge/${r}`)},getPreferences:()=>Dt("/preferences"),updatePreferences:e=>vf("/preferences",e),chatInChannel:e=>wn("/speech/chat",e),getSaveStatus:(e="akb")=>Dt(`/save/status?repo=${e}`),save:(e,r="akb")=>wn(`/save?repo=${r}`,{message:e}),getSaveHistory:(e=20,r="akb")=>Dt(`/save/history?limit=${e}&repo=${r}`),restoreSave:(e,r,a="akb")=>wn(`/save/restore?repo=${a}`,{sha:e,paths:r}),initGit:()=>wn("/save/init",{}),getSyncStatus:(e="akb")=>Dt(`/save/sync-status?repo=${e}`),pull:async(e="akb")=>await(await fetch(`${yl}/save/pull?repo=${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"})).json(),getGithubStatus:(e="akb")=>Dt(`/save/github-status?repo=${e}`),githubCreateRepo:(e,r="private",a="akb")=>wn(`/save/github-create-repo?repo=${a}`,{name:e,visibility:r}),addRemote:(e,r="akb")=>wn(`/save/remote?repo=${r}`,{url:e}),setCodeRoot:async e=>{const r=await fetch(`${yl}/setup/code-root`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({codeRoot:e})}),a=await r.json();if(!r.ok)throw new Error(a.error||`API error: ${r.status}`);return a},getCodeRoot:()=>Dt("/setup/code-root"),getCostSummary:()=>Dt("/cost/summary"),getSyncRoles:()=>Dt("/sync/roles"),applySyncUpdate:e=>wn("/sync/apply",e),getCompanyStats:()=>Dt("/sync/stats"),getQuestProgress:()=>Dt("/quests/progress"),saveQuestProgress:e=>fetch(`${yl}/quests/progress`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(r=>r.json()),getGitStatus:()=>Dt("/git/status"),deleteWorktree:e=>ul(`/git/worktrees/${encodeURIComponent(e)}`),deleteBranch:e=>ul(`/git/branches/${encodeURIComponent(e)}`)};function wy(e){const[r,a]=w.useState([]),[i,c]=w.useState("idle"),[u,d]=w.useState(""),[m,x]=w.useState([]),f=w.useRef(-1),y=w.useRef(null),g=w.useRef(0),b=w.useCallback(()=>{var E;if(!e)return;(E=y.current)==null||E.abort();const S=new AbortController;y.current=S,c("connecting");const j=f.current+1,C=`/api/jobs/${e}/stream?from=${j}`;fetch(C,{signal:S.signal}).then(async N=>{if(!N.ok||!N.body){c("error");return}c("streaming");const _=N.body.getReader(),B=new TextDecoder;let I="";for(;;){const{done:F,value:X}=await _.read();if(F)break;I+=B.decode(X,{stream:!0});const W=I.split(`
|
|
50
|
+
`);I=W.pop()??"";let U="";for(const M of W)if(M.startsWith("event: "))U=M.slice(7).trim();else if(M.startsWith("data: ")){try{const G=JSON.parse(M.slice(6));if(U==="activity"){const O=G;O.seq>f.current&&(f.current=O.seq),a(V=>V.some(J=>J.seq===O.seq)?V:[...V,O]),O.type==="text"&&d(V=>V+(O.data.text??"")),O.type==="dispatch:start"&&O.data.childJobId&&x(V=>[...V,O.data.childJobId]),O.type==="job:done"?c("done"):O.type==="job:error"&&c("error")}else if(U==="stream:end"){const O=G.reason;c(O==="done"?"done":O==="error"?"error":"done")}}catch{}U=""}}i==="streaming"&&c("done")}).catch(N=>{N.name!=="AbortError"&&(c("error"),g.current<3&&(g.current++,setTimeout(b,1e3*g.current)))})},[e]),v=w.useCallback(()=>{g.current=0,b()},[b]);return w.useEffect(()=>{if(!e){a([]),c("idle"),d(""),x([]),f.current=-1;return}return a([]),d(""),x([]),f.current=-1,g.current=0,b(),()=>{var S;(S=y.current)==null||S.abort()}},[e,b]),{events:r,status:i,textOutput:u,childJobIds:m,reconnect:v}}function bv(e,r){const a={};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const vv=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,wv=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,kv={};function q1(e,r){return(kv.jsx?wv:vv).test(e)}const jv=/[ \t\n\f\r]/g;function Sv(e){return typeof e=="object"?e.type==="text"?Y1(e.value):!1:Y1(e)}function Y1(e){return e.replace(jv,"")===""}class xo{constructor(r,a,i){this.normal=a,this.property=r,i&&(this.space=i)}}xo.prototype.normal={};xo.prototype.property={};xo.prototype.space=void 0;function ky(e,r){const a={},i={};for(const c of e)Object.assign(a,c.property),Object.assign(i,c.normal);return new xo(a,i,r)}function ih(e){return e.toLowerCase()}class ar{constructor(r,a){this.attribute=a,this.property=r}}ar.prototype.attribute="";ar.prototype.booleanish=!1;ar.prototype.boolean=!1;ar.prototype.commaOrSpaceSeparated=!1;ar.prototype.commaSeparated=!1;ar.prototype.defined=!1;ar.prototype.mustUseProperty=!1;ar.prototype.number=!1;ar.prototype.overloadedBoolean=!1;ar.prototype.property="";ar.prototype.spaceSeparated=!1;ar.prototype.space=void 0;let Cv=0;const ct=Pl(),gn=Pl(),sh=Pl(),je=Pl(),Xt=Pl(),Ii=Pl(),pr=Pl();function Pl(){return 2**++Cv}const oh=Object.freeze(Object.defineProperty({__proto__:null,boolean:ct,booleanish:gn,commaOrSpaceSeparated:pr,commaSeparated:Ii,number:je,overloadedBoolean:sh,spaceSeparated:Xt},Symbol.toStringTag,{value:"Module"})),wf=Object.keys(oh);class Th extends ar{constructor(r,a,i,c){let u=-1;if(super(r,a),X1(this,"space",c),typeof i=="number")for(;++u<wf.length;){const d=wf[u];X1(this,wf[u],(i&oh[d])===oh[d])}}}Th.prototype.defined=!0;function X1(e,r,a){a&&(e[r]=a)}function Vi(e){const r={},a={};for(const[i,c]of Object.entries(e.properties)){const u=new Th(i,e.transform(e.attributes||{},i),c,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),r[i]=u,a[ih(i)]=i,a[ih(u.attribute)]=i}return new xo(r,a,e.space)}const jy=Vi({properties:{ariaActiveDescendant:null,ariaAtomic:gn,ariaAutoComplete:null,ariaBusy:gn,ariaChecked:gn,ariaColCount:je,ariaColIndex:je,ariaColSpan:je,ariaControls:Xt,ariaCurrent:null,ariaDescribedBy:Xt,ariaDetails:null,ariaDisabled:gn,ariaDropEffect:Xt,ariaErrorMessage:null,ariaExpanded:gn,ariaFlowTo:Xt,ariaGrabbed:gn,ariaHasPopup:null,ariaHidden:gn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Xt,ariaLevel:je,ariaLive:null,ariaModal:gn,ariaMultiLine:gn,ariaMultiSelectable:gn,ariaOrientation:null,ariaOwns:Xt,ariaPlaceholder:null,ariaPosInSet:je,ariaPressed:gn,ariaReadOnly:gn,ariaRelevant:null,ariaRequired:gn,ariaRoleDescription:Xt,ariaRowCount:je,ariaRowIndex:je,ariaRowSpan:je,ariaSelected:gn,ariaSetSize:je,ariaSort:null,ariaValueMax:je,ariaValueMin:je,ariaValueNow:je,ariaValueText:null,role:null},transform(e,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function Sy(e,r){return r in e?e[r]:r}function Cy(e,r){return Sy(e,r.toLowerCase())}const Ev=Vi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ii,acceptCharset:Xt,accessKey:Xt,action:null,allow:null,allowFullScreen:ct,allowPaymentRequest:ct,allowUserMedia:ct,alt:null,as:null,async:ct,autoCapitalize:null,autoComplete:Xt,autoFocus:ct,autoPlay:ct,blocking:Xt,capture:null,charSet:null,checked:ct,cite:null,className:Xt,cols:je,colSpan:null,content:null,contentEditable:gn,controls:ct,controlsList:Xt,coords:je|Ii,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ct,defer:ct,dir:null,dirName:null,disabled:ct,download:sh,draggable:gn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ct,formTarget:null,headers:Xt,height:je,hidden:sh,high:je,href:null,hrefLang:null,htmlFor:Xt,httpEquiv:Xt,id:null,imageSizes:null,imageSrcSet:null,inert:ct,inputMode:null,integrity:null,is:null,isMap:ct,itemId:null,itemProp:Xt,itemRef:Xt,itemScope:ct,itemType:Xt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ct,low:je,manifest:null,max:null,maxLength:je,media:null,method:null,min:null,minLength:je,multiple:ct,muted:ct,name:null,nonce:null,noModule:ct,noValidate:ct,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:ct,optimum:je,pattern:null,ping:Xt,placeholder:null,playsInline:ct,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ct,referrerPolicy:null,rel:Xt,required:ct,reversed:ct,rows:je,rowSpan:je,sandbox:Xt,scope:null,scoped:ct,seamless:ct,selected:ct,shadowRootClonable:ct,shadowRootDelegatesFocus:ct,shadowRootMode:null,shape:null,size:je,sizes:null,slot:null,span:je,spellCheck:gn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:je,step:null,style:null,tabIndex:je,target:null,title:null,translate:null,type:null,typeMustMatch:ct,useMap:null,value:gn,width:je,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Xt,axis:null,background:null,bgColor:null,border:je,borderColor:null,bottomMargin:je,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ct,declare:ct,event:null,face:null,frame:null,frameBorder:null,hSpace:je,leftMargin:je,link:null,longDesc:null,lowSrc:null,marginHeight:je,marginWidth:je,noResize:ct,noHref:ct,noShade:ct,noWrap:ct,object:null,profile:null,prompt:null,rev:null,rightMargin:je,rules:null,scheme:null,scrolling:gn,standby:null,summary:null,text:null,topMargin:je,valueType:null,version:null,vAlign:null,vLink:null,vSpace:je,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ct,disableRemotePlayback:ct,prefix:null,property:null,results:je,security:null,unselectable:null},space:"html",transform:Cy}),Nv=Vi({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:pr,accentHeight:je,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:je,amplitude:je,arabicForm:null,ascent:je,attributeName:null,attributeType:null,azimuth:je,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:je,by:null,calcMode:null,capHeight:je,className:Xt,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:je,diffuseConstant:je,direction:null,display:null,dur:null,divisor:je,dominantBaseline:null,download:ct,dx:null,dy:null,edgeMode:null,editable:null,elevation:je,enableBackground:null,end:null,event:null,exponent:je,externalResourcesRequired:null,fill:null,fillOpacity:je,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:Ii,g2:Ii,glyphName:Ii,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:je,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:je,horizOriginX:je,horizOriginY:je,id:null,ideographic:je,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:je,k:je,k1:je,k2:je,k3:je,k4:je,kernelMatrix:pr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:je,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:je,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:je,overlineThickness:je,paintOrder:null,panose1:null,path:null,pathLength:je,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Xt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:je,pointsAtY:je,pointsAtZ:je,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:pr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:pr,rev:pr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:pr,requiredFeatures:pr,requiredFonts:pr,requiredFormats:pr,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:je,specularExponent:je,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:je,strikethroughThickness:je,string:null,stroke:null,strokeDashArray:pr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:je,strokeOpacity:je,strokeWidth:null,style:null,surfaceScale:je,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:pr,tabIndex:je,tableValues:null,target:null,targetX:je,targetY:je,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:pr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:je,underlineThickness:je,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:je,values:null,vAlphabetic:je,vMathematical:je,vectorEffect:null,vHanging:je,vIdeographic:je,version:null,vertAdvY:je,vertOriginX:je,vertOriginY:je,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:je,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Sy}),Ey=Vi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,r){return"xlink:"+r.slice(5).toLowerCase()}}),Ny=Vi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Cy}),Ay=Vi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,r){return"xml:"+r.slice(3).toLowerCase()}}),Av={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"},Tv=/[A-Z]/g,V1=/-[a-z]/g,Dv=/^data[-\w.:]+$/i;function zv(e,r){const a=ih(r);let i=r,c=ar;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&Dv.test(r)){if(r.charAt(4)==="-"){const u=r.slice(5).replace(V1,Mv);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=r.slice(4);if(!V1.test(u)){let d=u.replace(Tv,Rv);d.charAt(0)!=="-"&&(d="-"+d),r="data"+d}}c=Th}return new c(i,r)}function Rv(e){return"-"+e.toLowerCase()}function Mv(e){return e.charAt(1).toUpperCase()}const Fv=ky([jy,Ev,Ey,Ny,Ay],"html"),Dh=ky([jy,Nv,Ey,Ny,Ay],"svg");function _v(e){return e.join(" ").trim()}var Oi={},kf,G1;function Ov(){if(G1)return kf;G1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,a=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,m=/^\s+|\s+$/g,x=`
|
|
51
|
+
`,f="/",y="*",g="",b="comment",v="declaration";function S(C,E){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];E=E||{};var N=1,_=1;function B(J){var Q=J.match(r);Q&&(N+=Q.length);var H=J.lastIndexOf(x);_=~H?J.length-H:_+J.length}function I(){var J={line:N,column:_};return function(Q){return Q.position=new F(J),U(),Q}}function F(J){this.start=J,this.end={line:N,column:_},this.source=E.source}F.prototype.content=C;function X(J){var Q=new Error(E.source+":"+N+":"+_+": "+J);if(Q.reason=J,Q.filename=E.source,Q.line=N,Q.column=_,Q.source=C,!E.silent)throw Q}function W(J){var Q=J.exec(C);if(Q){var H=Q[0];return B(H),C=C.slice(H.length),Q}}function U(){W(a)}function M(J){var Q;for(J=J||[];Q=G();)Q!==!1&&J.push(Q);return J}function G(){var J=I();if(!(f!=C.charAt(0)||y!=C.charAt(1))){for(var Q=2;g!=C.charAt(Q)&&(y!=C.charAt(Q)||f!=C.charAt(Q+1));)++Q;if(Q+=2,g===C.charAt(Q-1))return X("End of comment missing");var H=C.slice(2,Q-2);return _+=2,B(H),C=C.slice(Q),_+=2,J({type:b,comment:H})}}function O(){var J=I(),Q=W(i);if(Q){if(G(),!W(c))return X("property missing ':'");var H=W(u),Y=J({type:v,property:j(Q[0].replace(e,g)),value:H?j(H[0].replace(e,g)):g});return W(d),Y}}function V(){var J=[];M(J);for(var Q;Q=O();)Q!==!1&&(J.push(Q),M(J));return J}return U(),V()}function j(C){return C?C.replace(m,g):g}return kf=S,kf}var Q1;function Bv(){if(Q1)return Oi;Q1=1;var e=Oi&&Oi.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Oi,"__esModule",{value:!0}),Oi.default=a;const r=e(Ov());function a(i,c){let u=null;if(!i||typeof i!="string")return u;const d=(0,r.default)(i),m=typeof c=="function";return d.forEach(x=>{if(x.type!=="declaration")return;const{property:f,value:y}=x;m?c(f,y,x):y&&(u=u||{},u[f]=y)}),u}return Oi}var Ys={},W1;function $v(){if(W1)return Ys;W1=1,Object.defineProperty(Ys,"__esModule",{value:!0}),Ys.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,a=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,u=function(f){return!f||a.test(f)||e.test(f)},d=function(f,y){return y.toUpperCase()},m=function(f,y){return"".concat(y,"-")},x=function(f,y){return y===void 0&&(y={}),u(f)?f:(f=f.toLowerCase(),y.reactCompat?f=f.replace(c,m):f=f.replace(i,m),f.replace(r,d))};return Ys.camelCase=x,Ys}var Xs,K1;function Lv(){if(K1)return Xs;K1=1;var e=Xs&&Xs.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},r=e(Bv()),a=$v();function i(c,u){var d={};return!c||typeof c!="string"||(0,r.default)(c,function(m,x){m&&x&&(d[(0,a.camelCase)(m,u)]=x)}),d}return i.default=i,Xs=i,Xs}var Hv=Lv();const Iv=vy(Hv),Ty=Dy("end"),zh=Dy("start");function Dy(e){return r;function r(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 Uv(e){const r=zh(e),a=Ty(e);if(r&&a)return{start:r,end:a}}function ao(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Z1(e.position):"start"in e||"end"in e?Z1(e):"line"in e||"column"in e?ch(e):""}function ch(e){return P1(e&&e.line)+":"+P1(e&&e.column)}function Z1(e){return ch(e&&e.start)+"-"+ch(e&&e.end)}function P1(e){return e&&typeof e=="number"?e:1}class Yn extends Error{constructor(r,a,i){super(),typeof a=="string"&&(i=a,a=void 0);let c="",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 r=="string"?c=r:!u.cause&&r&&(d=!0,c=r.message,u.cause=r),!u.ruleId&&!u.source&&typeof i=="string"){const x=i.indexOf(":");x===-1?u.ruleId=i:(u.source=i.slice(0,x),u.ruleId=i.slice(x+1))}if(!u.place&&u.ancestors&&u.ancestors){const x=u.ancestors[u.ancestors.length-1];x&&(u.place=x.position)}const m=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=m?m.column:void 0,this.fatal=void 0,this.file="",this.message=c,this.line=m?m.line:void 0,this.name=ao(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}}Yn.prototype.file="";Yn.prototype.name="";Yn.prototype.reason="";Yn.prototype.message="";Yn.prototype.stack="";Yn.prototype.column=void 0;Yn.prototype.line=void 0;Yn.prototype.ancestors=void 0;Yn.prototype.cause=void 0;Yn.prototype.fatal=void 0;Yn.prototype.place=void 0;Yn.prototype.ruleId=void 0;Yn.prototype.source=void 0;const Rh={}.hasOwnProperty,qv=new Map,Yv=/[A-Z]/g,Xv=new Set(["table","tbody","thead","tfoot","tr"]),Vv=new Set(["td","th"]),zy="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Gv(e,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=r.filePath||void 0;let i;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=tw(a,r.jsxDEV)}else{if(typeof r.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof r.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=ew(a,r.jsx,r.jsxs)}const c={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:i,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?Dh:Fv,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},u=Ry(c,e,void 0);return u&&typeof u!="string"?u:c.create(e,c.Fragment,{children:u||void 0},void 0)}function Ry(e,r,a){if(r.type==="element")return Qv(e,r,a);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return Wv(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return Zv(e,r,a);if(r.type==="mdxjsEsm")return Kv(e,r);if(r.type==="root")return Pv(e,r,a);if(r.type==="text")return Jv(e,r)}function Qv(e,r,a){const i=e.schema;let c=i;r.tagName.toLowerCase()==="svg"&&i.space==="html"&&(c=Dh,e.schema=c),e.ancestors.push(r);const u=Fy(e,r.tagName,!1),d=nw(e,r);let m=Fh(e,r);return Xv.has(r.tagName)&&(m=m.filter(function(x){return typeof x=="string"?!Sv(x):!0})),My(e,d,u,r),Mh(d,m),e.ancestors.pop(),e.schema=i,e.create(r,u,d,a)}function Wv(e,r){if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}so(e,r.position)}function Kv(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);so(e,r.position)}function Zv(e,r,a){const i=e.schema;let c=i;r.name==="svg"&&i.space==="html"&&(c=Dh,e.schema=c),e.ancestors.push(r);const u=r.name===null?e.Fragment:Fy(e,r.name,!0),d=rw(e,r),m=Fh(e,r);return My(e,d,u,r),Mh(d,m),e.ancestors.pop(),e.schema=i,e.create(r,u,d,a)}function Pv(e,r,a){const i={};return Mh(i,Fh(e,r)),e.create(r,e.Fragment,i,a)}function Jv(e,r){return r.value}function My(e,r,a,i){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(r.node=i)}function Mh(e,r){if(r.length>0){const a=r.length>1?r:r[0];a&&(e.children=a)}}function ew(e,r,a){return i;function i(c,u,d,m){const f=Array.isArray(d.children)?a:r;return m?f(u,d,m):f(u,d)}}function tw(e,r){return a;function a(i,c,u,d){const m=Array.isArray(u.children),x=zh(i);return r(c,u,d,m,{columnNumber:x?x.column-1:void 0,fileName:e,lineNumber:x?x.line:void 0},void 0)}}function nw(e,r){const a={};let i,c;for(c in r.properties)if(c!=="children"&&Rh.call(r.properties,c)){const u=aw(e,c,r.properties[c]);if(u){const[d,m]=u;e.tableCellAlignToStyle&&d==="align"&&typeof m=="string"&&Vv.has(r.tagName)?i=m:a[d]=m}}if(i){const u=a.style||(a.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return a}function rw(e,r){const a={};for(const i of r.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 m=d.properties[0];m.type,Object.assign(a,e.evaluater.evaluateExpression(m.argument))}else so(e,r.position);else{const c=i.name;let u;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const m=i.value.data.estree.body[0];m.type,u=e.evaluater.evaluateExpression(m.expression)}else so(e,r.position);else u=i.value===null?!0:i.value;a[c]=u}return a}function Fh(e,r){const a=[];let i=-1;const c=e.passKeys?new Map:qv;for(;++i<r.children.length;){const u=r.children[i];let d;if(e.passKeys){const x=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(x){const f=c.get(x)||0;d=x+"-"+f,c.set(x,f+1)}}const m=Ry(e,u,d);m!==void 0&&a.push(m)}return a}function aw(e,r,a){const i=zv(e.schema,r);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=i.commaSeparated?bv(a):_v(a)),i.property==="style"){let c=typeof a=="object"?a:lw(e,String(a));return e.stylePropertyNameCase==="css"&&(c=iw(c)),["style",c]}return[e.elementAttributeNameCase==="react"&&i.space?Av[i.property]||i.property:i.attribute,a]}}function lw(e,r){try{return Iv(r,{reactCompat:!0})}catch(a){if(e.ignoreInvalidStyle)return{};const i=a,c=new Yn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=e.filePath||void 0,c.url=zy+"#cannot-parse-style-attribute",c}}function Fy(e,r,a){let i;if(!a)i={type:"Literal",value:r};else if(r.includes(".")){const c=r.split(".");let u=-1,d;for(;++u<c.length;){const m=q1(c[u])?{type:"Identifier",name:c[u]}:{type:"Literal",value:c[u]};d=d?{type:"MemberExpression",object:d,property:m,computed:!!(u&&m.type==="Literal"),optional:!1}:m}i=d}else i=q1(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(i.type==="Literal"){const c=i.value;return Rh.call(e.components,c)?e.components[c]:c}if(e.evaluater)return e.evaluater.evaluateExpression(i);so(e)}function so(e,r){const a=new Yn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:r,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=zy+"#cannot-handle-mdx-estrees-without-createevaluater",a}function iw(e){const r={};let a;for(a in e)Rh.call(e,a)&&(r[sw(a)]=e[a]);return r}function sw(e){let r=e.replace(Yv,ow);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function ow(e){return"-"+e.toLowerCase()}const jf={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"]},cw={};function _h(e,r){const a=cw,i=typeof a.includeImageAlt=="boolean"?a.includeImageAlt:!0,c=typeof a.includeHtml=="boolean"?a.includeHtml:!0;return _y(e,i,c)}function _y(e,r,a){if(uw(e)){if("value"in e)return e.type==="html"&&!a?"":e.value;if(r&&"alt"in e&&e.alt)return e.alt;if("children"in e)return J1(e.children,r,a)}return Array.isArray(e)?J1(e,r,a):""}function J1(e,r,a){const i=[];let c=-1;for(;++c<e.length;)i[c]=_y(e[c],r,a);return i.join("")}function uw(e){return!!(e&&typeof e=="object")}const e0=document.createElement("i");function Oh(e){const r="&"+e+";";e0.innerHTML=r;const a=e0.textContent;return a.charCodeAt(a.length-1)===59&&e!=="semi"||a===r?!1:a}function gr(e,r,a,i){const c=e.length;let u=0,d;if(r<0?r=-r>c?0:c+r:r=r>c?c:r,a=a>0?a:0,i.length<1e4)d=Array.from(i),d.unshift(r,a),e.splice(...d);else for(a&&e.splice(r,a);u<i.length;)d=i.slice(u,u+1e4),d.unshift(r,0),e.splice(...d),u+=1e4,r+=1e4}function Rr(e,r){return e.length>0?(gr(e,e.length,0,r),e):r}const t0={}.hasOwnProperty;function Oy(e){const r={};let a=-1;for(;++a<e.length;)dw(r,e[a]);return r}function dw(e,r){let a;for(a in r){const c=(t0.call(e,a)?e[a]:void 0)||(e[a]={}),u=r[a];let d;if(u)for(d in u){t0.call(c,d)||(c[d]=[]);const m=u[d];fw(c[d],Array.isArray(m)?m:m?[m]:[])}}}function fw(e,r){let a=-1;const i=[];for(;++a<r.length;)(r[a].add==="after"?e:i).push(r[a]);gr(e,0,0,i)}function By(e,r){const a=Number.parseInt(e,r);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 Ir(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Gn=vl(/[A-Za-z]/),qn=vl(/[\dA-Za-z]/),hw=vl(/[#-'*+\--9=?A-Z^-~]/);function Zc(e){return e!==null&&(e<32||e===127)}const uh=vl(/\d/),mw=vl(/[\dA-Fa-f]/),xw=vl(/[!-/:-@[-`{-~]/);function Ge(e){return e!==null&&e<-2}function qt(e){return e!==null&&(e<0||e===32)}function pt(e){return e===-2||e===-1||e===32}const su=vl(new RegExp("\\p{P}|\\p{S}","u")),Kl=vl(/\s/);function vl(e){return r;function r(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}function Gi(e){const r=[];let a=-1,i=0,c=0;for(;++a<e.length;){const u=e.charCodeAt(a);let d="";if(u===37&&qn(e.charCodeAt(a+1))&&qn(e.charCodeAt(a+2)))c=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(d=String.fromCharCode(u));else if(u>55295&&u<57344){const m=e.charCodeAt(a+1);u<56320&&m>56319&&m<57344?(d=String.fromCharCode(u,m),c=1):d="�"}else d=String.fromCharCode(u);d&&(r.push(e.slice(i,a),encodeURIComponent(d)),i=a+c+1,d=""),c&&(a+=c,c=0)}return r.join("")+e.slice(i)}function St(e,r,a,i){const c=i?i-1:Number.POSITIVE_INFINITY;let u=0;return d;function d(x){return pt(x)?(e.enter(a),m(x)):r(x)}function m(x){return pt(x)&&u++<c?(e.consume(x),m):(e.exit(a),r(x))}}const pw={tokenize:yw};function yw(e){const r=e.attempt(this.parser.constructs.contentInitial,i,c);let a;return r;function i(m){if(m===null){e.consume(m);return}return e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),St(e,r,"linePrefix")}function c(m){return e.enter("paragraph"),u(m)}function u(m){const x=e.enter("chunkText",{contentType:"text",previous:a});return a&&(a.next=x),a=x,d(m)}function d(m){if(m===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(m);return}return Ge(m)?(e.consume(m),e.exit("chunkText"),u):(e.consume(m),d)}}const gw={tokenize:bw},n0={tokenize:vw};function bw(e){const r=this,a=[];let i=0,c,u,d;return m;function m(_){if(i<a.length){const B=a[i];return r.containerState=B[1],e.attempt(B[0].continuation,x,f)(_)}return f(_)}function x(_){if(i++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,c&&N();const B=r.events.length;let I=B,F;for(;I--;)if(r.events[I][0]==="exit"&&r.events[I][1].type==="chunkFlow"){F=r.events[I][1].end;break}E(i);let X=B;for(;X<r.events.length;)r.events[X][1].end={...F},X++;return gr(r.events,I+1,0,r.events.slice(B)),r.events.length=X,f(_)}return m(_)}function f(_){if(i===a.length){if(!c)return b(_);if(c.currentConstruct&&c.currentConstruct.concrete)return S(_);r.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(n0,y,g)(_)}function y(_){return c&&N(),E(i),b(_)}function g(_){return r.parser.lazy[r.now().line]=i!==a.length,d=r.now().offset,S(_)}function b(_){return r.containerState={},e.attempt(n0,v,S)(_)}function v(_){return i++,a.push([r.currentConstruct,r.containerState]),b(_)}function S(_){if(_===null){c&&N(),E(0),e.consume(_);return}return c=c||r.parser.flow(r.now()),e.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:u}),j(_)}function j(_){if(_===null){C(e.exit("chunkFlow"),!0),E(0),e.consume(_);return}return Ge(_)?(e.consume(_),C(e.exit("chunkFlow")),i=0,r.interrupt=void 0,m):(e.consume(_),j)}function C(_,B){const I=r.sliceStream(_);if(B&&I.push(null),_.previous=u,u&&(u.next=_),u=_,c.defineSkip(_.start),c.write(I),r.parser.lazy[_.start.line]){let F=c.events.length;for(;F--;)if(c.events[F][1].start.offset<d&&(!c.events[F][1].end||c.events[F][1].end.offset>d))return;const X=r.events.length;let W=X,U,M;for(;W--;)if(r.events[W][0]==="exit"&&r.events[W][1].type==="chunkFlow"){if(U){M=r.events[W][1].end;break}U=!0}for(E(i),F=X;F<r.events.length;)r.events[F][1].end={...M},F++;gr(r.events,W+1,0,r.events.slice(X)),r.events.length=F}}function E(_){let B=a.length;for(;B-- >_;){const I=a[B];r.containerState=I[1],I[0].exit.call(r,e)}a.length=_}function N(){c.write([null]),u=void 0,c=void 0,r.containerState._closeFlow=void 0}}function vw(e,r,a){return St(e,e.attempt(this.parser.constructs.document,r,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function qi(e){if(e===null||qt(e)||Kl(e))return 1;if(su(e))return 2}function ou(e,r,a){const i=[];let c=-1;for(;++c<e.length;){const u=e[c].resolveAll;u&&!i.includes(u)&&(r=u(r,a),i.push(u))}return r}const dh={name:"attention",resolveAll:ww,tokenize:kw};function ww(e,r){let a=-1,i,c,u,d,m,x,f,y;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&&r.sliceSerialize(e[i][1]).charCodeAt(0)===r.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;x=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},b={...e[a][1].start};r0(g,-x),r0(b,x),d={type:x>1?"strongSequence":"emphasisSequence",start:g,end:{...e[i][1].end}},m={type:x>1?"strongSequence":"emphasisSequence",start:{...e[a][1].start},end:b},u={type:x>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[a][1].start}},c={type:x>1?"strong":"emphasis",start:{...d.start},end:{...m.end}},e[i][1].end={...d.start},e[a][1].start={...m.end},f=[],e[i][1].end.offset-e[i][1].start.offset&&(f=Rr(f,[["enter",e[i][1],r],["exit",e[i][1],r]])),f=Rr(f,[["enter",c,r],["enter",d,r],["exit",d,r],["enter",u,r]]),f=Rr(f,ou(r.parser.constructs.insideSpan.null,e.slice(i+1,a),r)),f=Rr(f,[["exit",u,r],["enter",m,r],["exit",m,r],["exit",c,r]]),e[a][1].end.offset-e[a][1].start.offset?(y=2,f=Rr(f,[["enter",e[a][1],r],["exit",e[a][1],r]])):y=0,gr(e,i-1,a-i+3,f),a=i+f.length-y-2;break}}for(a=-1;++a<e.length;)e[a][1].type==="attentionSequence"&&(e[a][1].type="data");return e}function kw(e,r){const a=this.parser.constructs.attentionMarkers.null,i=this.previous,c=qi(i);let u;return d;function d(x){return u=x,e.enter("attentionSequence"),m(x)}function m(x){if(x===u)return e.consume(x),m;const f=e.exit("attentionSequence"),y=qi(x),g=!y||y===2&&c||a.includes(x),b=!c||c===2&&y||a.includes(i);return f._open=!!(u===42?g:g&&(c||!b)),f._close=!!(u===42?b:b&&(y||!g)),r(x)}}function r0(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const jw={name:"autolink",tokenize:Sw};function Sw(e,r,a){let i=0;return c;function c(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(v){return Gn(v)?(e.consume(v),d):v===64?a(v):f(v)}function d(v){return v===43||v===45||v===46||qn(v)?(i=1,m(v)):f(v)}function m(v){return v===58?(e.consume(v),i=0,x):(v===43||v===45||v===46||qn(v))&&i++<32?(e.consume(v),m):(i=0,f(v))}function x(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),r):v===null||v===32||v===60||Zc(v)?a(v):(e.consume(v),x)}function f(v){return v===64?(e.consume(v),y):hw(v)?(e.consume(v),f):a(v)}function y(v){return qn(v)?g(v):a(v)}function g(v){return v===46?(e.consume(v),i=0,y):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),r):b(v)}function b(v){if((v===45||qn(v))&&i++<63){const S=v===45?b:g;return e.consume(v),S}return a(v)}}const po={partial:!0,tokenize:Cw};function Cw(e,r,a){return i;function i(u){return pt(u)?St(e,c,"linePrefix")(u):c(u)}function c(u){return u===null||Ge(u)?r(u):a(u)}}const $y={continuation:{tokenize:Nw},exit:Aw,name:"blockQuote",tokenize:Ew};function Ew(e,r,a){const i=this;return c;function c(d){if(d===62){const m=i.containerState;return m.open||(e.enter("blockQuote",{_container:!0}),m.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),u}return a(d)}function u(d){return pt(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(d))}}function Nw(e,r,a){const i=this;return c;function c(d){return pt(d)?St(e,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):u(d)}function u(d){return e.attempt($y,r,a)(d)}}function Aw(e){e.exit("blockQuote")}const Ly={name:"characterEscape",tokenize:Tw};function Tw(e,r,a){return i;function i(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),c}function c(u){return xw(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):a(u)}}const Hy={name:"characterReference",tokenize:Dw};function Dw(e,r,a){const i=this;let c=0,u,d;return m;function m(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),x}function x(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),u=31,d=qn,y(g))}function f(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,d=mw,y):(e.enter("characterReferenceValue"),u=7,d=uh,y(g))}function y(g){if(g===59&&c){const b=e.exit("characterReferenceValue");return d===qn&&!Oh(i.sliceSerialize(b))?a(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)}return d(g)&&c++<u?(e.consume(g),y):a(g)}}const a0={partial:!0,tokenize:Rw},l0={concrete:!0,name:"codeFenced",tokenize:zw};function zw(e,r,a){const i=this,c={partial:!0,tokenize:I};let u=0,d=0,m;return x;function x(F){return f(F)}function f(F){const X=i.events[i.events.length-1];return u=X&&X[1].type==="linePrefix"?X[2].sliceSerialize(X[1],!0).length:0,m=F,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(F)}function y(F){return F===m?(d++,e.consume(F),y):d<3?a(F):(e.exit("codeFencedFenceSequence"),pt(F)?St(e,g,"whitespace")(F):g(F))}function g(F){return F===null||Ge(F)?(e.exit("codeFencedFence"),i.interrupt?r(F):e.check(a0,j,B)(F)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(F))}function b(F){return F===null||Ge(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(F)):pt(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),St(e,v,"whitespace")(F)):F===96&&F===m?a(F):(e.consume(F),b)}function v(F){return F===null||Ge(F)?g(F):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(F))}function S(F){return F===null||Ge(F)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(F)):F===96&&F===m?a(F):(e.consume(F),S)}function j(F){return e.attempt(c,B,C)(F)}function C(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),E}function E(F){return u>0&&pt(F)?St(e,N,"linePrefix",u+1)(F):N(F)}function N(F){return F===null||Ge(F)?e.check(a0,j,B)(F):(e.enter("codeFlowValue"),_(F))}function _(F){return F===null||Ge(F)?(e.exit("codeFlowValue"),N(F)):(e.consume(F),_)}function B(F){return e.exit("codeFenced"),r(F)}function I(F,X,W){let U=0;return M;function M(Q){return F.enter("lineEnding"),F.consume(Q),F.exit("lineEnding"),G}function G(Q){return F.enter("codeFencedFence"),pt(Q)?St(F,O,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Q):O(Q)}function O(Q){return Q===m?(F.enter("codeFencedFenceSequence"),V(Q)):W(Q)}function V(Q){return Q===m?(U++,F.consume(Q),V):U>=d?(F.exit("codeFencedFenceSequence"),pt(Q)?St(F,J,"whitespace")(Q):J(Q)):W(Q)}function J(Q){return Q===null||Ge(Q)?(F.exit("codeFencedFence"),X(Q)):W(Q)}}}function Rw(e,r,a){const i=this;return c;function c(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):r(d)}}const Sf={name:"codeIndented",tokenize:Fw},Mw={partial:!0,tokenize:_w};function Fw(e,r,a){const i=this;return c;function c(f){return e.enter("codeIndented"),St(e,u,"linePrefix",5)(f)}function u(f){const y=i.events[i.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?d(f):a(f)}function d(f){return f===null?x(f):Ge(f)?e.attempt(Mw,d,x)(f):(e.enter("codeFlowValue"),m(f))}function m(f){return f===null||Ge(f)?(e.exit("codeFlowValue"),d(f)):(e.consume(f),m)}function x(f){return e.exit("codeIndented"),r(f)}}function _w(e,r,a){const i=this;return c;function c(d){return i.parser.lazy[i.now().line]?a(d):Ge(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):St(e,u,"linePrefix",5)(d)}function u(d){const m=i.events[i.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?r(d):Ge(d)?c(d):a(d)}}const Ow={name:"codeText",previous:$w,resolve:Bw,tokenize:Lw};function Bw(e){let r=e.length-4,a=3,i,c;if((e[a][1].type==="lineEnding"||e[a][1].type==="space")&&(e[r][1].type==="lineEnding"||e[r][1].type==="space")){for(i=a;++i<r;)if(e[i][1].type==="codeTextData"){e[a][1].type="codeTextPadding",e[r][1].type="codeTextPadding",a+=2,r-=2;break}}for(i=a-1,r++;++i<=r;)c===void 0?i!==r&&e[i][1].type!=="lineEnding"&&(c=i):(i===r||e[i][1].type==="lineEnding")&&(e[c][1].type="codeTextData",i!==c+2&&(e[c][1].end=e[i-1][1].end,e.splice(c+2,i-c-2),r-=i-c-2,i=c+2),c=void 0);return e}function $w(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Lw(e,r,a){let i=0,c,u;return d;function d(g){return e.enter("codeText"),e.enter("codeTextSequence"),m(g)}function m(g){return g===96?(e.consume(g),i++,m):(e.exit("codeTextSequence"),x(g))}function x(g){return g===null?a(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),x):g===96?(u=e.enter("codeTextSequence"),c=0,y(g)):Ge(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),x):(e.enter("codeTextData"),f(g))}function f(g){return g===null||g===32||g===96||Ge(g)?(e.exit("codeTextData"),x(g)):(e.consume(g),f)}function y(g){return g===96?(e.consume(g),c++,y):c===i?(e.exit("codeTextSequence"),e.exit("codeText"),r(g)):(u.type="codeTextData",f(g))}}class Hw{constructor(r){this.left=r?[...r]:[],this.right=[]}get(r){if(r<0||r>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+r+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return r<this.left.length?this.left[r]:this.right[this.right.length-r+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(r,a){const i=a??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(r,i):r>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(r,a,i){const c=a||0;this.setCursor(Math.trunc(r));const u=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return i&&Vs(this.left,i),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(r){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(r)}pushMany(r){this.setCursor(Number.POSITIVE_INFINITY),Vs(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Vs(this.right,r.reverse())}setCursor(r){if(!(r===this.left.length||r>this.left.length&&this.right.length===0||r<0&&this.left.length===0))if(r<this.left.length){const a=this.left.splice(r,Number.POSITIVE_INFINITY);Vs(this.right,a.reverse())}else{const a=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);Vs(this.left,a.reverse())}}}function Vs(e,r){let a=0;if(r.length<1e4)e.push(...r);else for(;a<r.length;)e.push(...r.slice(a,a+1e4)),a+=1e4}function Iy(e){const r={};let a=-1,i,c,u,d,m,x,f;const y=new Hw(e);for(;++a<y.length;){for(;a in r;)a=r[a];if(i=y.get(a),a&&i[1].type==="chunkFlow"&&y.get(a-1)[1].type==="listItemPrefix"&&(x=i[1]._tokenizer.events,u=0,u<x.length&&x[u][1].type==="lineEndingBlank"&&(u+=2),u<x.length&&x[u][1].type==="content"))for(;++u<x.length&&x[u][1].type!=="content";)x[u][1].type==="chunkText"&&(x[u][1]._isInFirstContentOfListItem=!0,u++);if(i[0]==="enter")i[1].contentType&&(Object.assign(r,Iw(y,a)),a=r[a],f=!0);else if(i[1]._container){for(u=a,c=void 0;u--;)if(d=y.get(u),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(c&&(y.get(c)[1].type="lineEndingBlank"),d[1].type="lineEnding",c=u);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;c&&(i[1].end={...y.get(c)[1].start},m=y.slice(c,a),m.unshift(i),y.splice(c,a-c+1,m))}}return gr(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!f}function Iw(e,r){const a=e.get(r)[1],i=e.get(r)[2];let c=r-1;const u=[];let d=a._tokenizer;d||(d=i.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const m=d.events,x=[],f={};let y,g,b=-1,v=a,S=0,j=0;const C=[j];for(;v;){for(;e.get(++c)[1]!==v;);u.push(c),v._tokenizer||(y=i.sliceStream(v),v.next||y.push(null),g&&d.defineSkip(v.start),v._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(y),v._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),g=v,v=v.next}for(v=a;++b<m.length;)m[b][0]==="exit"&&m[b-1][0]==="enter"&&m[b][1].type===m[b-1][1].type&&m[b][1].start.line!==m[b][1].end.line&&(j=b+1,C.push(j),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(d.events=[],v?(v._tokenizer=void 0,v.previous=void 0):C.pop(),b=C.length;b--;){const E=m.slice(C[b],C[b+1]),N=u.pop();x.push([N,N+E.length-1]),e.splice(N,2,E)}for(x.reverse(),b=-1;++b<x.length;)f[S+x[b][0]]=S+x[b][1],S+=x[b][1]-x[b][0]-1;return f}const Uw={resolve:Yw,tokenize:Xw},qw={partial:!0,tokenize:Vw};function Yw(e){return Iy(e),e}function Xw(e,r){let a;return i;function i(m){return e.enter("content"),a=e.enter("chunkContent",{contentType:"content"}),c(m)}function c(m){return m===null?u(m):Ge(m)?e.check(qw,d,u)(m):(e.consume(m),c)}function u(m){return e.exit("chunkContent"),e.exit("content"),r(m)}function d(m){return e.consume(m),e.exit("chunkContent"),a.next=e.enter("chunkContent",{contentType:"content",previous:a}),a=a.next,c}}function Vw(e,r,a){const i=this;return c;function c(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),St(e,u,"linePrefix")}function u(d){if(d===null||Ge(d))return a(d);const m=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?r(d):e.interrupt(i.parser.constructs.flow,a,r)(d)}}function Uy(e,r,a,i,c,u,d,m,x){const f=x||Number.POSITIVE_INFINITY;let y=0;return g;function g(E){return E===60?(e.enter(i),e.enter(c),e.enter(u),e.consume(E),e.exit(u),b):E===null||E===32||E===41||Zc(E)?a(E):(e.enter(i),e.enter(d),e.enter(m),e.enter("chunkString",{contentType:"string"}),j(E))}function b(E){return E===62?(e.enter(u),e.consume(E),e.exit(u),e.exit(c),e.exit(i),r):(e.enter(m),e.enter("chunkString",{contentType:"string"}),v(E))}function v(E){return E===62?(e.exit("chunkString"),e.exit(m),b(E)):E===null||E===60||Ge(E)?a(E):(e.consume(E),E===92?S:v)}function S(E){return E===60||E===62||E===92?(e.consume(E),v):v(E)}function j(E){return!y&&(E===null||E===41||qt(E))?(e.exit("chunkString"),e.exit(m),e.exit(d),e.exit(i),r(E)):y<f&&E===40?(e.consume(E),y++,j):E===41?(e.consume(E),y--,j):E===null||E===32||E===40||Zc(E)?a(E):(e.consume(E),E===92?C:j)}function C(E){return E===40||E===41||E===92?(e.consume(E),j):j(E)}}function qy(e,r,a,i,c,u){const d=this;let m=0,x;return f;function f(v){return e.enter(i),e.enter(c),e.consume(v),e.exit(c),e.enter(u),y}function y(v){return m>999||v===null||v===91||v===93&&!x||v===94&&!m&&"_hiddenFootnoteSupport"in d.parser.constructs?a(v):v===93?(e.exit(u),e.enter(c),e.consume(v),e.exit(c),e.exit(i),r):Ge(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===null||v===91||v===93||Ge(v)||m++>999?(e.exit("chunkString"),y(v)):(e.consume(v),x||(x=!pt(v)),v===92?b:g)}function b(v){return v===91||v===92||v===93?(e.consume(v),m++,g):g(v)}}function Yy(e,r,a,i,c,u){let d;return m;function m(b){return b===34||b===39||b===40?(e.enter(i),e.enter(c),e.consume(b),e.exit(c),d=b===40?41:b,x):a(b)}function x(b){return b===d?(e.enter(c),e.consume(b),e.exit(c),e.exit(i),r):(e.enter(u),f(b))}function f(b){return b===d?(e.exit(u),x(d)):b===null?a(b):Ge(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),St(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===d||b===null||Ge(b)?(e.exit("chunkString"),f(b)):(e.consume(b),b===92?g:y)}function g(b){return b===d||b===92?(e.consume(b),y):y(b)}}function lo(e,r){let a;return i;function i(c){return Ge(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a=!0,i):pt(c)?St(e,i,a?"linePrefix":"lineSuffix")(c):r(c)}}const Gw={name:"definition",tokenize:Ww},Qw={partial:!0,tokenize:Kw};function Ww(e,r,a){const i=this;let c;return u;function u(v){return e.enter("definition"),d(v)}function d(v){return qy.call(i,e,m,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function m(v){return c=Ir(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),x):a(v)}function x(v){return qt(v)?lo(e,f)(v):f(v)}function f(v){return Uy(e,y,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function y(v){return e.attempt(Qw,g,g)(v)}function g(v){return pt(v)?St(e,b,"whitespace")(v):b(v)}function b(v){return v===null||Ge(v)?(e.exit("definition"),i.parser.defined.push(c),r(v)):a(v)}}function Kw(e,r,a){return i;function i(m){return qt(m)?lo(e,c)(m):a(m)}function c(m){return Yy(e,u,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(m)}function u(m){return pt(m)?St(e,d,"whitespace")(m):d(m)}function d(m){return m===null||Ge(m)?r(m):a(m)}}const Zw={name:"hardBreakEscape",tokenize:Pw};function Pw(e,r,a){return i;function i(u){return e.enter("hardBreakEscape"),e.consume(u),c}function c(u){return Ge(u)?(e.exit("hardBreakEscape"),r(u)):a(u)}}const Jw={name:"headingAtx",resolve:e5,tokenize:t5};function e5(e,r){let a=e.length-2,i=3,c,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&&(c={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"},gr(e,i,a-i+1,[["enter",c,r],["enter",u,r],["exit",u,r],["exit",c,r]])),e}function t5(e,r,a){let i=0;return c;function c(y){return e.enter("atxHeading"),u(y)}function u(y){return e.enter("atxHeadingSequence"),d(y)}function d(y){return y===35&&i++<6?(e.consume(y),d):y===null||qt(y)?(e.exit("atxHeadingSequence"),m(y)):a(y)}function m(y){return y===35?(e.enter("atxHeadingSequence"),x(y)):y===null||Ge(y)?(e.exit("atxHeading"),r(y)):pt(y)?St(e,m,"whitespace")(y):(e.enter("atxHeadingText"),f(y))}function x(y){return y===35?(e.consume(y),x):(e.exit("atxHeadingSequence"),m(y))}function f(y){return y===null||y===35||qt(y)?(e.exit("atxHeadingText"),m(y)):(e.consume(y),f)}}const n5=["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"],i0=["pre","script","style","textarea"],r5={concrete:!0,name:"htmlFlow",resolveTo:i5,tokenize:s5},a5={partial:!0,tokenize:c5},l5={partial:!0,tokenize:o5};function i5(e){let r=e.length;for(;r--&&!(e[r][0]==="enter"&&e[r][1].type==="htmlFlow"););return r>1&&e[r-2][1].type==="linePrefix"&&(e[r][1].start=e[r-2][1].start,e[r+1][1].start=e[r-2][1].start,e.splice(r-2,2)),e}function s5(e,r,a){const i=this;let c,u,d,m,x;return f;function f(D){return y(D)}function y(D){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(D),g}function g(D){return D===33?(e.consume(D),b):D===47?(e.consume(D),u=!0,j):D===63?(e.consume(D),c=3,i.interrupt?r:T):Gn(D)?(e.consume(D),d=String.fromCharCode(D),C):a(D)}function b(D){return D===45?(e.consume(D),c=2,v):D===91?(e.consume(D),c=5,m=0,S):Gn(D)?(e.consume(D),c=4,i.interrupt?r:T):a(D)}function v(D){return D===45?(e.consume(D),i.interrupt?r:T):a(D)}function S(D){const xe="CDATA[";return D===xe.charCodeAt(m++)?(e.consume(D),m===xe.length?i.interrupt?r:O:S):a(D)}function j(D){return Gn(D)?(e.consume(D),d=String.fromCharCode(D),C):a(D)}function C(D){if(D===null||D===47||D===62||qt(D)){const xe=D===47,Ce=d.toLowerCase();return!xe&&!u&&i0.includes(Ce)?(c=1,i.interrupt?r(D):O(D)):n5.includes(d.toLowerCase())?(c=6,xe?(e.consume(D),E):i.interrupt?r(D):O(D)):(c=7,i.interrupt&&!i.parser.lazy[i.now().line]?a(D):u?N(D):_(D))}return D===45||qn(D)?(e.consume(D),d+=String.fromCharCode(D),C):a(D)}function E(D){return D===62?(e.consume(D),i.interrupt?r:O):a(D)}function N(D){return pt(D)?(e.consume(D),N):M(D)}function _(D){return D===47?(e.consume(D),M):D===58||D===95||Gn(D)?(e.consume(D),B):pt(D)?(e.consume(D),_):M(D)}function B(D){return D===45||D===46||D===58||D===95||qn(D)?(e.consume(D),B):I(D)}function I(D){return D===61?(e.consume(D),F):pt(D)?(e.consume(D),I):_(D)}function F(D){return D===null||D===60||D===61||D===62||D===96?a(D):D===34||D===39?(e.consume(D),x=D,X):pt(D)?(e.consume(D),F):W(D)}function X(D){return D===x?(e.consume(D),x=null,U):D===null||Ge(D)?a(D):(e.consume(D),X)}function W(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||qt(D)?I(D):(e.consume(D),W)}function U(D){return D===47||D===62||pt(D)?_(D):a(D)}function M(D){return D===62?(e.consume(D),G):a(D)}function G(D){return D===null||Ge(D)?O(D):pt(D)?(e.consume(D),G):a(D)}function O(D){return D===45&&c===2?(e.consume(D),H):D===60&&c===1?(e.consume(D),Y):D===62&&c===4?(e.consume(D),z):D===63&&c===3?(e.consume(D),T):D===93&&c===5?(e.consume(D),we):Ge(D)&&(c===6||c===7)?(e.exit("htmlFlowData"),e.check(a5,Z,V)(D)):D===null||Ge(D)?(e.exit("htmlFlowData"),V(D)):(e.consume(D),O)}function V(D){return e.check(l5,J,Z)(D)}function J(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),Q}function Q(D){return D===null||Ge(D)?V(D):(e.enter("htmlFlowData"),O(D))}function H(D){return D===45?(e.consume(D),T):O(D)}function Y(D){return D===47?(e.consume(D),d="",ne):O(D)}function ne(D){if(D===62){const xe=d.toLowerCase();return i0.includes(xe)?(e.consume(D),z):O(D)}return Gn(D)&&d.length<8?(e.consume(D),d+=String.fromCharCode(D),ne):O(D)}function we(D){return D===93?(e.consume(D),T):O(D)}function T(D){return D===62?(e.consume(D),z):D===45&&c===2?(e.consume(D),T):O(D)}function z(D){return D===null||Ge(D)?(e.exit("htmlFlowData"),Z(D)):(e.consume(D),z)}function Z(D){return e.exit("htmlFlow"),r(D)}}function o5(e,r,a){const i=this;return c;function c(d){return Ge(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):r(d)}}function c5(e,r,a){return i;function i(c){return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),e.attempt(po,r,a)}}const u5={name:"htmlText",tokenize:d5};function d5(e,r,a){const i=this;let c,u,d;return m;function m(T){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(T),x}function x(T){return T===33?(e.consume(T),f):T===47?(e.consume(T),I):T===63?(e.consume(T),_):Gn(T)?(e.consume(T),W):a(T)}function f(T){return T===45?(e.consume(T),y):T===91?(e.consume(T),u=0,S):Gn(T)?(e.consume(T),N):a(T)}function y(T){return T===45?(e.consume(T),v):a(T)}function g(T){return T===null?a(T):T===45?(e.consume(T),b):Ge(T)?(d=g,Y(T)):(e.consume(T),g)}function b(T){return T===45?(e.consume(T),v):g(T)}function v(T){return T===62?H(T):T===45?b(T):g(T)}function S(T){const z="CDATA[";return T===z.charCodeAt(u++)?(e.consume(T),u===z.length?j:S):a(T)}function j(T){return T===null?a(T):T===93?(e.consume(T),C):Ge(T)?(d=j,Y(T)):(e.consume(T),j)}function C(T){return T===93?(e.consume(T),E):j(T)}function E(T){return T===62?H(T):T===93?(e.consume(T),E):j(T)}function N(T){return T===null||T===62?H(T):Ge(T)?(d=N,Y(T)):(e.consume(T),N)}function _(T){return T===null?a(T):T===63?(e.consume(T),B):Ge(T)?(d=_,Y(T)):(e.consume(T),_)}function B(T){return T===62?H(T):_(T)}function I(T){return Gn(T)?(e.consume(T),F):a(T)}function F(T){return T===45||qn(T)?(e.consume(T),F):X(T)}function X(T){return Ge(T)?(d=X,Y(T)):pt(T)?(e.consume(T),X):H(T)}function W(T){return T===45||qn(T)?(e.consume(T),W):T===47||T===62||qt(T)?U(T):a(T)}function U(T){return T===47?(e.consume(T),H):T===58||T===95||Gn(T)?(e.consume(T),M):Ge(T)?(d=U,Y(T)):pt(T)?(e.consume(T),U):H(T)}function M(T){return T===45||T===46||T===58||T===95||qn(T)?(e.consume(T),M):G(T)}function G(T){return T===61?(e.consume(T),O):Ge(T)?(d=G,Y(T)):pt(T)?(e.consume(T),G):U(T)}function O(T){return T===null||T===60||T===61||T===62||T===96?a(T):T===34||T===39?(e.consume(T),c=T,V):Ge(T)?(d=O,Y(T)):pt(T)?(e.consume(T),O):(e.consume(T),J)}function V(T){return T===c?(e.consume(T),c=void 0,Q):T===null?a(T):Ge(T)?(d=V,Y(T)):(e.consume(T),V)}function J(T){return T===null||T===34||T===39||T===60||T===61||T===96?a(T):T===47||T===62||qt(T)?U(T):(e.consume(T),J)}function Q(T){return T===47||T===62||qt(T)?U(T):a(T)}function H(T){return T===62?(e.consume(T),e.exit("htmlTextData"),e.exit("htmlText"),r):a(T)}function Y(T){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),ne}function ne(T){return pt(T)?St(e,we,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):we(T)}function we(T){return e.enter("htmlTextData"),d(T)}}const Bh={name:"labelEnd",resolveAll:x5,resolveTo:p5,tokenize:y5},f5={tokenize:g5},h5={tokenize:b5},m5={tokenize:v5};function x5(e){let r=-1;const a=[];for(;++r<e.length;){const i=e[r][1];if(a.push(e[r]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const c=i.type==="labelImage"?4:2;i.type="data",r+=c}}return e.length!==a.length&&gr(e,0,e.length,a),e}function p5(e,r){let a=e.length,i=0,c,u,d,m;for(;a--;)if(c=e[a][1],u){if(c.type==="link"||c.type==="labelLink"&&c._inactive)break;e[a][0]==="enter"&&c.type==="labelLink"&&(c._inactive=!0)}else if(d){if(e[a][0]==="enter"&&(c.type==="labelImage"||c.type==="labelLink")&&!c._balanced&&(u=a,c.type!=="labelLink")){i=2;break}}else c.type==="labelEnd"&&(d=a);const x={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}},y={type:"labelText",start:{...e[u+i+2][1].end},end:{...e[d-2][1].start}};return m=[["enter",x,r],["enter",f,r]],m=Rr(m,e.slice(u+1,u+i+3)),m=Rr(m,[["enter",y,r]]),m=Rr(m,ou(r.parser.constructs.insideSpan.null,e.slice(u+i+4,d-3),r)),m=Rr(m,[["exit",y,r],e[d-2],e[d-1],["exit",f,r]]),m=Rr(m,e.slice(d+1)),m=Rr(m,[["exit",x,r]]),gr(e,u,e.length,m),e}function y5(e,r,a){const i=this;let c=i.events.length,u,d;for(;c--;)if((i.events[c][1].type==="labelImage"||i.events[c][1].type==="labelLink")&&!i.events[c][1]._balanced){u=i.events[c][1];break}return m;function m(b){return u?u._inactive?g(b):(d=i.parser.defined.includes(Ir(i.sliceSerialize({start:u.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),x):a(b)}function x(b){return b===40?e.attempt(f5,y,d?y:g)(b):b===91?e.attempt(h5,y,d?f:g)(b):d?y(b):g(b)}function f(b){return e.attempt(m5,y,g)(b)}function y(b){return r(b)}function g(b){return u._balanced=!0,a(b)}}function g5(e,r,a){return i;function i(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),c}function c(g){return qt(g)?lo(e,u)(g):u(g)}function u(g){return g===41?y(g):Uy(e,d,m,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function d(g){return qt(g)?lo(e,x)(g):y(g)}function m(g){return a(g)}function x(g){return g===34||g===39||g===40?Yy(e,f,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function f(g){return qt(g)?lo(e,y)(g):y(g)}function y(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),r):a(g)}}function b5(e,r,a){const i=this;return c;function c(m){return qy.call(i,e,u,d,"reference","referenceMarker","referenceString")(m)}function u(m){return i.parser.defined.includes(Ir(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?r(m):a(m)}function d(m){return a(m)}}function v5(e,r,a){return i;function i(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),c}function c(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),r):a(u)}}const w5={name:"labelStartImage",resolveAll:Bh.resolveAll,tokenize:k5};function k5(e,r,a){const i=this;return c;function c(m){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(m),e.exit("labelImageMarker"),u}function u(m){return m===91?(e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelImage"),d):a(m)}function d(m){return m===94&&"_hiddenFootnoteSupport"in i.parser.constructs?a(m):r(m)}}const j5={name:"labelStartLink",resolveAll:Bh.resolveAll,tokenize:S5};function S5(e,r,a){const i=this;return c;function c(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):r(d)}}const Cf={name:"lineEnding",tokenize:C5};function C5(e,r){return a;function a(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),St(e,r,"linePrefix")}}const Xc={name:"thematicBreak",tokenize:E5};function E5(e,r,a){let i=0,c;return u;function u(f){return e.enter("thematicBreak"),d(f)}function d(f){return c=f,m(f)}function m(f){return f===c?(e.enter("thematicBreakSequence"),x(f)):i>=3&&(f===null||Ge(f))?(e.exit("thematicBreak"),r(f)):a(f)}function x(f){return f===c?(e.consume(f),i++,x):(e.exit("thematicBreakSequence"),pt(f)?St(e,m,"whitespace")(f):m(f))}}const nr={continuation:{tokenize:D5},exit:R5,name:"list",tokenize:T5},N5={partial:!0,tokenize:M5},A5={partial:!0,tokenize:z5};function T5(e,r,a){const i=this,c=i.events[i.events.length-1];let u=c&&c[1].type==="linePrefix"?c[2].sliceSerialize(c[1],!0).length:0,d=0;return m;function m(v){const S=i.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!i.containerState.marker||v===i.containerState.marker:uh(v)){if(i.containerState.type||(i.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Xc,a,f)(v):f(v);if(!i.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),x(v)}return a(v)}function x(v){return uh(v)&&++d<10?(e.consume(v),x):(!i.interrupt||d<2)&&(i.containerState.marker?v===i.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),f(v)):a(v)}function f(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||v,e.check(po,i.interrupt?a:y,e.attempt(N5,b,g))}function y(v){return i.containerState.initialBlankLine=!0,u++,b(v)}function g(v){return pt(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),b):a(v)}function b(v){return i.containerState.size=u+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(v)}}function D5(e,r,a){const i=this;return i.containerState._closeFlow=void 0,e.check(po,c,u);function c(m){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,St(e,r,"listItemIndent",i.containerState.size+1)(m)}function u(m){return i.containerState.furtherBlankLines||!pt(m)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,d(m)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(A5,r,d)(m))}function d(m){return i.containerState._closeFlow=!0,i.interrupt=void 0,St(e,e.attempt(nr,r,a),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m)}}function z5(e,r,a){const i=this;return St(e,c,"listItemIndent",i.containerState.size+1);function c(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?r(u):a(u)}}function R5(e){e.exit(this.containerState.type)}function M5(e,r,a){const i=this;return St(e,c,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(u){const d=i.events[i.events.length-1];return!pt(u)&&d&&d[1].type==="listItemPrefixWhitespace"?r(u):a(u)}}const s0={name:"setextUnderline",resolveTo:F5,tokenize:_5};function F5(e,r){let a=e.length,i,c,u;for(;a--;)if(e[a][0]==="enter"){if(e[a][1].type==="content"){i=a;break}e[a][1].type==="paragraph"&&(c=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[c][1].type="setextHeadingText",u?(e.splice(c,0,["enter",d,r]),e.splice(u+1,0,["exit",e[i][1],r]),e[i][1].end={...e[u][1].end}):e[i][1]=d,e.push(["exit",d,r]),e}function _5(e,r,a){const i=this;let c;return u;function u(f){let y=i.events.length,g;for(;y--;)if(i.events[y][1].type!=="lineEnding"&&i.events[y][1].type!=="linePrefix"&&i.events[y][1].type!=="content"){g=i.events[y][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||g)?(e.enter("setextHeadingLine"),c=f,d(f)):a(f)}function d(f){return e.enter("setextHeadingLineSequence"),m(f)}function m(f){return f===c?(e.consume(f),m):(e.exit("setextHeadingLineSequence"),pt(f)?St(e,x,"lineSuffix")(f):x(f))}function x(f){return f===null||Ge(f)?(e.exit("setextHeadingLine"),r(f)):a(f)}}const O5={tokenize:B5};function B5(e){const r=this,a=e.attempt(po,i,e.attempt(this.parser.constructs.flowInitial,c,St(e,e.attempt(this.parser.constructs.flow,c,e.attempt(Uw,c)),"linePrefix")));return a;function i(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),r.currentConstruct=void 0,a}function c(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),r.currentConstruct=void 0,a}}const $5={resolveAll:Vy()},L5=Xy("string"),H5=Xy("text");function Xy(e){return{resolveAll:Vy(e==="text"?I5:void 0),tokenize:r};function r(a){const i=this,c=this.parser.constructs[e],u=a.attempt(c,d,m);return d;function d(y){return f(y)?u(y):m(y)}function m(y){if(y===null){a.consume(y);return}return a.enter("data"),a.consume(y),x}function x(y){return f(y)?(a.exit("data"),u(y)):(a.consume(y),x)}function f(y){if(y===null)return!0;const g=c[y];let b=-1;if(g)for(;++b<g.length;){const v=g[b];if(!v.previous||v.previous.call(i,i.previous))return!0}return!1}}}function Vy(e){return r;function r(a,i){let c=-1,u;for(;++c<=a.length;)u===void 0?a[c]&&a[c][1].type==="data"&&(u=c,c++):(!a[c]||a[c][1].type!=="data")&&(c!==u+2&&(a[u][1].end=a[c-1][1].end,a.splice(u+2,c-u-2),c=u+2),u=void 0);return e?e(a,i):a}}function I5(e,r){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],c=r.sliceStream(i);let u=c.length,d=-1,m=0,x;for(;u--;){const f=c[u];if(typeof f=="string"){for(d=f.length;f.charCodeAt(d-1)===32;)m++,d--;if(d)break;d=-1}else if(f===-2)x=!0,m++;else if(f!==-1){u++;break}}if(r._contentTypeTextTrailing&&a===e.length&&(m=0),m){const f={type:a===e.length||x||m<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?d:i.start._bufferIndex+d,_index:i.start._index+u,line:i.end.line,column:i.end.column-m,offset:i.end.offset-m},end:{...i.end}};i.end={...f.start},i.start.offset===i.end.offset?Object.assign(i,f):(e.splice(a,0,["enter",f,r],["exit",f,r]),a+=2)}a++}return e}const U5={42:nr,43:nr,45:nr,48:nr,49:nr,50:nr,51:nr,52:nr,53:nr,54:nr,55:nr,56:nr,57:nr,62:$y},q5={91:Gw},Y5={[-2]:Sf,[-1]:Sf,32:Sf},X5={35:Jw,42:Xc,45:[s0,Xc],60:r5,61:s0,95:Xc,96:l0,126:l0},V5={38:Hy,92:Ly},G5={[-5]:Cf,[-4]:Cf,[-3]:Cf,33:w5,38:Hy,42:dh,60:[jw,u5],91:j5,92:[Zw,Ly],93:Bh,95:dh,96:Ow},Q5={null:[dh,$5]},W5={null:[42,95]},K5={null:[]},Z5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:W5,contentInitial:q5,disable:K5,document:U5,flow:X5,flowInitial:Y5,insideSpan:Q5,string:V5,text:G5},Symbol.toStringTag,{value:"Module"}));function P5(e,r,a){let i={_bufferIndex:-1,_index:0,line:a&&a.line||1,column:a&&a.column||1,offset:a&&a.offset||0};const c={},u=[];let d=[],m=[];const x={attempt:X(I),check:X(F),consume:N,enter:_,exit:B,interrupt:X(F,{interrupt:!0})},f={code:null,containerState:{},defineSkip:j,events:[],now:S,parser:e,previous:null,sliceSerialize:b,sliceStream:v,write:g};let y=r.tokenize.call(f,x);return r.resolveAll&&u.push(r),f;function g(G){return d=Rr(d,G),C(),d[d.length-1]!==null?[]:(W(r,0),f.events=ou(u,f.events,f),f.events)}function b(G,O){return ek(v(G),O)}function v(G){return J5(d,G)}function S(){const{_bufferIndex:G,_index:O,line:V,column:J,offset:Q}=i;return{_bufferIndex:G,_index:O,line:V,column:J,offset:Q}}function j(G){c[G.line]=G.column,M()}function C(){let G;for(;i._index<d.length;){const O=d[i._index];if(typeof O=="string")for(G=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===G&&i._bufferIndex<O.length;)E(O.charCodeAt(i._bufferIndex));else E(O)}}function E(G){y=y(G)}function N(G){Ge(G)?(i.line++,i.column=1,i.offset+=G===-3?2:1,M()):G!==-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=G}function _(G,O){const V=O||{};return V.type=G,V.start=S(),f.events.push(["enter",V,f]),m.push(V),V}function B(G){const O=m.pop();return O.end=S(),f.events.push(["exit",O,f]),O}function I(G,O){W(G,O.from)}function F(G,O){O.restore()}function X(G,O){return V;function V(J,Q,H){let Y,ne,we,T;return Array.isArray(J)?Z(J):"tokenize"in J?Z([J]):z(J);function z(ge){return Me;function Me(Ee){const Ie=Ee!==null&&ge[Ee],oe=Ee!==null&&ge.null,at=[...Array.isArray(Ie)?Ie:Ie?[Ie]:[],...Array.isArray(oe)?oe:oe?[oe]:[]];return Z(at)(Ee)}}function Z(ge){return Y=ge,ne=0,ge.length===0?H:D(ge[ne])}function D(ge){return Me;function Me(Ee){return T=U(),we=ge,ge.partial||(f.currentConstruct=ge),ge.name&&f.parser.constructs.disable.null.includes(ge.name)?Ce():ge.tokenize.call(O?Object.assign(Object.create(f),O):f,x,xe,Ce)(Ee)}}function xe(ge){return G(we,T),Q}function Ce(ge){return T.restore(),++ne<Y.length?D(Y[ne]):H}}}function W(G,O){G.resolveAll&&!u.includes(G)&&u.push(G),G.resolve&&gr(f.events,O,f.events.length-O,G.resolve(f.events.slice(O),f)),G.resolveTo&&(f.events=G.resolveTo(f.events,f))}function U(){const G=S(),O=f.previous,V=f.currentConstruct,J=f.events.length,Q=Array.from(m);return{from:J,restore:H};function H(){i=G,f.previous=O,f.currentConstruct=V,f.events.length=J,m=Q,M()}}function M(){i.line in c&&i.column<2&&(i.column=c[i.line],i.offset+=c[i.line]-1)}}function J5(e,r){const a=r.start._index,i=r.start._bufferIndex,c=r.end._index,u=r.end._bufferIndex;let d;if(a===c)d=[e[a].slice(i,u)];else{if(d=e.slice(a,c),i>-1){const m=d[0];typeof m=="string"?d[0]=m.slice(i):d.shift()}u>0&&d.push(e[c].slice(0,u))}return d}function ek(e,r){let a=-1;const i=[];let c;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=`
|
|
52
|
+
`;break}case-3:{d=`\r
|
|
53
|
+
`;break}case-2:{d=r?" ":" ";break}case-1:{if(!r&&c)continue;d=" ";break}default:d=String.fromCharCode(u)}c=u===-2,i.push(d)}return i.join("")}function tk(e){const i={constructs:Oy([Z5,...(e||{}).extensions||[]]),content:c(pw),defined:[],document:c(gw),flow:c(O5),lazy:{},string:c(L5),text:c(H5)};return i;function c(u){return d;function d(m){return P5(i,u,m)}}}function nk(e){for(;!Iy(e););return e}const o0=/[\0\t\n\r]/g;function rk(){let e=1,r="",a=!0,i;return c;function c(u,d,m){const x=[];let f,y,g,b,v;for(u=r+(typeof u=="string"?u.toString():new TextDecoder(d||void 0).decode(u)),g=0,r="",a&&(u.charCodeAt(0)===65279&&g++,a=void 0);g<u.length;){if(o0.lastIndex=g,f=o0.exec(u),b=f&&f.index!==void 0?f.index:u.length,v=u.charCodeAt(b),!f){r=u.slice(g);break}if(v===10&&g===b&&i)x.push(-3),i=void 0;else switch(i&&(x.push(-5),i=void 0),g<b&&(x.push(u.slice(g,b)),e+=b-g),v){case 0:{x.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,x.push(-2);e++<y;)x.push(-1);break}case 10:{x.push(-4),e=1;break}default:i=!0,e=1}g=b+1}return m&&(i&&x.push(-5),r&&x.push(r),x.push(null)),x}}const ak=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function lk(e){return e.replace(ak,ik)}function ik(e,r,a){if(r)return r;if(a.charCodeAt(0)===35){const c=a.charCodeAt(1),u=c===120||c===88;return By(a.slice(u?2:1),u?16:10)}return Oh(a)||e}const Gy={}.hasOwnProperty;function sk(e,r,a){return r&&typeof r=="object"&&(a=r,r=void 0),ok(a)(nk(tk(a).document().write(rk()(e,r,!0))))}function ok(e){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Fe),autolinkProtocol:U,autolinkEmail:U,atxHeading:u(pe),blockQuote:u(oe),characterEscape:U,characterReference:U,codeFenced:u(at),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:u(at,d),codeText:u(Ct,d),codeTextData:U,data:U,codeFlowValue:U,definition:u(jt),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:u(Vt),hardBreakEscape:u(he),hardBreakTrailing:u(he),htmlFlow:u(ke,d),htmlFlowData:U,htmlText:u(ke,d),htmlTextData:U,image:u(Ae),label:d,link:u(Fe),listItem:u(Ne),listItemValue:b,listOrdered:u(Re,g),listUnordered:u(Re),paragraph:u(ze),reference:D,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:u(pe),strong:u(Pe),thematicBreak:u(et)},exit:{atxHeading:x(),atxHeadingSequence:I,autolink:x(),autolinkEmail:Ie,autolinkProtocol:Ee,blockQuote:x(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:Ce,characterReferenceMarkerNumeric:Ce,characterReferenceValue:ge,characterReference:Me,codeFenced:x(C),codeFencedFence:j,codeFencedFenceInfo:v,codeFencedFenceMeta:S,codeFlowValue:M,codeIndented:x(E),codeText:x(Q),codeTextData:M,data:M,definition:x(),definitionDestinationString:B,definitionLabelString:N,definitionTitleString:_,emphasis:x(),hardBreakEscape:x(O),hardBreakTrailing:x(O),htmlFlow:x(V),htmlFlowData:M,htmlText:x(J),htmlTextData:M,image:x(Y),label:we,labelText:ne,lineEnding:G,link:x(H),listItem:x(),listOrdered:x(),listUnordered:x(),paragraph:x(),referenceString:xe,resourceDestinationString:T,resourceTitleString:z,resource:Z,setextHeading:x(W),setextHeadingLineSequence:X,setextHeadingText:F,strong:x(),thematicBreak:x()}};Qy(r,(e||{}).mdastExtensions||[]);const a={};return i;function i(re){let ye={type:"root",children:[]};const De={stack:[ye],tokenStack:[],config:r,enter:m,exit:f,buffer:d,resume:y,data:a},He=[];let de=-1;for(;++de<re.length;)if(re[de][1].type==="listOrdered"||re[de][1].type==="listUnordered")if(re[de][0]==="enter")He.push(de);else{const Te=He.pop();de=c(re,Te,de)}for(de=-1;++de<re.length;){const Te=r[re[de][0]];Gy.call(Te,re[de][1].type)&&Te[re[de][1].type].call(Object.assign({sliceSerialize:re[de][2].sliceSerialize},De),re[de][1])}if(De.tokenStack.length>0){const Te=De.tokenStack[De.tokenStack.length-1];(Te[1]||c0).call(De,void 0,Te[0])}for(ye.position={start:dl(re.length>0?re[0][1].start:{line:1,column:1,offset:0}),end:dl(re.length>0?re[re.length-2][1].end:{line:1,column:1,offset:0})},de=-1;++de<r.transforms.length;)ye=r.transforms[de](ye)||ye;return ye}function c(re,ye,De){let He=ye-1,de=-1,Te=!1,wt,it,rt,yt;for(;++He<=De;){const st=re[He];switch(st[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{st[0]==="enter"?de++:de--,yt=void 0;break}case"lineEndingBlank":{st[0]==="enter"&&(wt&&!yt&&!de&&!rt&&(rt=He),yt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:yt=void 0}if(!de&&st[0]==="enter"&&st[1].type==="listItemPrefix"||de===-1&&st[0]==="exit"&&(st[1].type==="listUnordered"||st[1].type==="listOrdered")){if(wt){let bn=He;for(it=void 0;bn--;){const Yt=re[bn];if(Yt[1].type==="lineEnding"||Yt[1].type==="lineEndingBlank"){if(Yt[0]==="exit")continue;it&&(re[it][1].type="lineEndingBlank",Te=!0),Yt[1].type="lineEnding",it=bn}else if(!(Yt[1].type==="linePrefix"||Yt[1].type==="blockQuotePrefix"||Yt[1].type==="blockQuotePrefixWhitespace"||Yt[1].type==="blockQuoteMarker"||Yt[1].type==="listItemIndent"))break}rt&&(!it||rt<it)&&(wt._spread=!0),wt.end=Object.assign({},it?re[it][1].start:st[1].end),re.splice(it||He,0,["exit",wt,st[2]]),He++,De++}if(st[1].type==="listItemPrefix"){const bn={type:"listItem",_spread:!1,start:Object.assign({},st[1].start),end:void 0};wt=bn,re.splice(He,0,["enter",bn,st[2]]),He++,De++,rt=void 0,yt=!0}}}return re[ye][1]._spread=Te,De}function u(re,ye){return De;function De(He){m.call(this,re(He),He),ye&&ye.call(this,He)}}function d(){this.stack.push({type:"fragment",children:[]})}function m(re,ye,De){this.stack[this.stack.length-1].children.push(re),this.stack.push(re),this.tokenStack.push([ye,De||void 0]),re.position={start:dl(ye.start),end:void 0}}function x(re){return ye;function ye(De){re&&re.call(this,De),f.call(this,De)}}function f(re,ye){const De=this.stack.pop(),He=this.tokenStack.pop();if(He)He[0].type!==re.type&&(ye?ye.call(this,re,He[0]):(He[1]||c0).call(this,re,He[0]));else throw new Error("Cannot close `"+re.type+"` ("+ao({start:re.start,end:re.end})+"): it’s not open");De.position.end=dl(re.end)}function y(){return _h(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function b(re){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(re),10),this.data.expectingFirstListItemValue=void 0}}function v(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=re}function S(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=re}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re.replace(/(\r?\n|\r)$/g,"")}function N(re){const ye=this.resume(),De=this.stack[this.stack.length-1];De.label=ye,De.identifier=Ir(this.sliceSerialize(re)).toLowerCase()}function _(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.title=re}function B(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.url=re}function I(re){const ye=this.stack[this.stack.length-1];if(!ye.depth){const De=this.sliceSerialize(re).length;ye.depth=De}}function F(){this.data.setextHeadingSlurpLineEnding=!0}function X(re){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(re).codePointAt(0)===61?1:2}function W(){this.data.setextHeadingSlurpLineEnding=void 0}function U(re){const De=this.stack[this.stack.length-1].children;let He=De[De.length-1];(!He||He.type!=="text")&&(He=_e(),He.position={start:dl(re.start),end:void 0},De.push(He)),this.stack.push(He)}function M(re){const ye=this.stack.pop();ye.value+=this.sliceSerialize(re),ye.position.end=dl(re.end)}function G(re){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const De=ye.children[ye.children.length-1];De.position.end=dl(re.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(ye.type)&&(U.call(this,re),M.call(this,re))}function O(){this.data.atHardBreak=!0}function V(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re}function J(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re}function Q(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re}function H(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=ye,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function Y(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=ye,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function ne(re){const ye=this.sliceSerialize(re),De=this.stack[this.stack.length-2];De.label=lk(ye),De.identifier=Ir(ye).toLowerCase()}function we(){const re=this.stack[this.stack.length-1],ye=this.resume(),De=this.stack[this.stack.length-1];if(this.data.inReference=!0,De.type==="link"){const He=re.children;De.children=He}else De.alt=ye}function T(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.url=re}function z(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.title=re}function Z(){this.data.inReference=void 0}function D(){this.data.referenceType="collapsed"}function xe(re){const ye=this.resume(),De=this.stack[this.stack.length-1];De.label=ye,De.identifier=Ir(this.sliceSerialize(re)).toLowerCase(),this.data.referenceType="full"}function Ce(re){this.data.characterReferenceType=re.type}function ge(re){const ye=this.sliceSerialize(re),De=this.data.characterReferenceType;let He;De?(He=By(ye,De==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):He=Oh(ye);const de=this.stack[this.stack.length-1];de.value+=He}function Me(re){const ye=this.stack.pop();ye.position.end=dl(re.end)}function Ee(re){M.call(this,re);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(re)}function Ie(re){M.call(this,re);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(re)}function oe(){return{type:"blockquote",children:[]}}function at(){return{type:"code",lang:null,meta:null,value:""}}function Ct(){return{type:"inlineCode",value:""}}function jt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Vt(){return{type:"emphasis",children:[]}}function pe(){return{type:"heading",depth:0,children:[]}}function he(){return{type:"break"}}function ke(){return{type:"html",value:""}}function Ae(){return{type:"image",title:null,url:"",alt:null}}function Fe(){return{type:"link",title:null,url:"",children:[]}}function Re(re){return{type:"list",ordered:re.type==="listOrdered",start:null,spread:re._spread,children:[]}}function Ne(re){return{type:"listItem",spread:re._spread,checked:null,children:[]}}function ze(){return{type:"paragraph",children:[]}}function Pe(){return{type:"strong",children:[]}}function _e(){return{type:"text",value:""}}function et(){return{type:"thematicBreak"}}}function dl(e){return{line:e.line,column:e.column,offset:e.offset}}function Qy(e,r){let a=-1;for(;++a<r.length;){const i=r[a];Array.isArray(i)?Qy(e,i):ck(e,i)}}function ck(e,r){let a;for(a in r)if(Gy.call(r,a))switch(a){case"canContainEols":{const i=r[a];i&&e[a].push(...i);break}case"transforms":{const i=r[a];i&&e[a].push(...i);break}case"enter":case"exit":{const i=r[a];i&&Object.assign(e[a],i);break}}}function c0(e,r){throw e?new Error("Cannot close `"+e.type+"` ("+ao({start:e.start,end:e.end})+"): a different token (`"+r.type+"`, "+ao({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+ao({start:r.start,end:r.end})+") is still open")}function uk(e){const r=this;r.parser=a;function a(i){return sk(i,{...r.data("settings"),...e,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function dk(e,r){const a={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(r),!0)};return e.patch(r,a),e.applyData(r,a)}function fk(e,r){const a={type:"element",tagName:"br",properties:{},children:[]};return e.patch(r,a),[e.applyData(r,a),{type:"text",value:`
|
|
54
|
+
`}]}function hk(e,r){const a=r.value?r.value+`
|
|
55
|
+
`:"",i={},c=r.lang?r.lang.split(/\s+/):[];c.length>0&&(i.className=["language-"+c[0]]);let u={type:"element",tagName:"code",properties:i,children:[{type:"text",value:a}]};return r.meta&&(u.data={meta:r.meta}),e.patch(r,u),u=e.applyData(r,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(r,u),u}function mk(e,r){const a={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,a),e.applyData(r,a)}function xk(e,r){const a={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,a),e.applyData(r,a)}function pk(e,r){const a=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(r.identifier).toUpperCase(),c=Gi(i.toLowerCase()),u=e.footnoteOrder.indexOf(i);let d,m=e.footnoteCounts.get(i);m===void 0?(m=0,e.footnoteOrder.push(i),d=e.footnoteOrder.length):d=u+1,m+=1,e.footnoteCounts.set(i,m);const x={type:"element",tagName:"a",properties:{href:"#"+a+"fn-"+c,id:a+"fnref-"+c+(m>1?"-"+m:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};e.patch(r,x);const f={type:"element",tagName:"sup",properties:{},children:[x]};return e.patch(r,f),e.applyData(r,f)}function yk(e,r){const a={type:"element",tagName:"h"+r.depth,properties:{},children:e.all(r)};return e.patch(r,a),e.applyData(r,a)}function gk(e,r){if(e.options.allowDangerousHtml){const a={type:"raw",value:r.value};return e.patch(r,a),e.applyData(r,a)}}function Wy(e,r){const a=r.referenceType;let i="]";if(a==="collapsed"?i+="[]":a==="full"&&(i+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+i}];const c=e.all(r),u=c[0];u&&u.type==="text"?u.value="["+u.value:c.unshift({type:"text",value:"["});const d=c[c.length-1];return d&&d.type==="text"?d.value+=i:c.push({type:"text",value:i}),c}function bk(e,r){const a=String(r.identifier).toUpperCase(),i=e.definitionById.get(a);if(!i)return Wy(e,r);const c={src:Gi(i.url||""),alt:r.alt};i.title!==null&&i.title!==void 0&&(c.title=i.title);const u={type:"element",tagName:"img",properties:c,children:[]};return e.patch(r,u),e.applyData(r,u)}function vk(e,r){const a={src:Gi(r.url)};r.alt!==null&&r.alt!==void 0&&(a.alt=r.alt),r.title!==null&&r.title!==void 0&&(a.title=r.title);const i={type:"element",tagName:"img",properties:a,children:[]};return e.patch(r,i),e.applyData(r,i)}function wk(e,r){const a={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};e.patch(r,a);const i={type:"element",tagName:"code",properties:{},children:[a]};return e.patch(r,i),e.applyData(r,i)}function kk(e,r){const a=String(r.identifier).toUpperCase(),i=e.definitionById.get(a);if(!i)return Wy(e,r);const c={href:Gi(i.url||"")};i.title!==null&&i.title!==void 0&&(c.title=i.title);const u={type:"element",tagName:"a",properties:c,children:e.all(r)};return e.patch(r,u),e.applyData(r,u)}function jk(e,r){const a={href:Gi(r.url)};r.title!==null&&r.title!==void 0&&(a.title=r.title);const i={type:"element",tagName:"a",properties:a,children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function Sk(e,r,a){const i=e.all(r),c=a?Ck(a):Ky(r),u={},d=[];if(typeof r.checked=="boolean"){const y=i[0];let g;y&&y.type==="element"&&y.tagName==="p"?g=y:(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:r.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let m=-1;for(;++m<i.length;){const y=i[m];(c||m!==0||y.type!=="element"||y.tagName!=="p")&&d.push({type:"text",value:`
|
|
56
|
+
`}),y.type==="element"&&y.tagName==="p"&&!c?d.push(...y.children):d.push(y)}const x=i[i.length-1];x&&(c||x.type!=="element"||x.tagName!=="p")&&d.push({type:"text",value:`
|
|
57
|
+
`});const f={type:"element",tagName:"li",properties:u,children:d};return e.patch(r,f),e.applyData(r,f)}function Ck(e){let r=!1;if(e.type==="list"){r=e.spread||!1;const a=e.children;let i=-1;for(;!r&&++i<a.length;)r=Ky(a[i])}return r}function Ky(e){const r=e.spread;return r??e.children.length>1}function Ek(e,r){const a={},i=e.all(r);let c=-1;for(typeof r.start=="number"&&r.start!==1&&(a.start=r.start);++c<i.length;){const d=i[c];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:r.ordered?"ol":"ul",properties:a,children:e.wrap(i,!0)};return e.patch(r,u),e.applyData(r,u)}function Nk(e,r){const a={type:"element",tagName:"p",properties:{},children:e.all(r)};return e.patch(r,a),e.applyData(r,a)}function Ak(e,r){const a={type:"root",children:e.wrap(e.all(r))};return e.patch(r,a),e.applyData(r,a)}function Tk(e,r){const a={type:"element",tagName:"strong",properties:{},children:e.all(r)};return e.patch(r,a),e.applyData(r,a)}function Dk(e,r){const a=e.all(r),i=a.shift(),c=[];if(i){const d={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(r.children[0],d),c.push(d)}if(a.length>0){const d={type:"element",tagName:"tbody",properties:{},children:e.wrap(a,!0)},m=zh(r.children[1]),x=Ty(r.children[r.children.length-1]);m&&x&&(d.position={start:m,end:x}),c.push(d)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(c,!0)};return e.patch(r,u),e.applyData(r,u)}function zk(e,r,a){const i=a?a.children:void 0,u=(i?i.indexOf(r):1)===0?"th":"td",d=a&&a.type==="table"?a.align:void 0,m=d?d.length:r.children.length;let x=-1;const f=[];for(;++x<m;){const g=r.children[x],b={},v=d?d[x]:void 0;v&&(b.align=v);let S={type:"element",tagName:u,properties:b,children:[]};g&&(S.children=e.all(g),e.patch(g,S),S=e.applyData(g,S)),f.push(S)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(r,y),e.applyData(r,y)}function Rk(e,r){const a={type:"element",tagName:"td",properties:{},children:e.all(r)};return e.patch(r,a),e.applyData(r,a)}const u0=9,d0=32;function Mk(e){const r=String(e),a=/\r?\n|\r/g;let i=a.exec(r),c=0;const u=[];for(;i;)u.push(f0(r.slice(c,i.index),c>0,!0),i[0]),c=i.index+i[0].length,i=a.exec(r);return u.push(f0(r.slice(c),c>0,!1)),u.join("")}function f0(e,r,a){let i=0,c=e.length;if(r){let u=e.codePointAt(i);for(;u===u0||u===d0;)i++,u=e.codePointAt(i)}if(a){let u=e.codePointAt(c-1);for(;u===u0||u===d0;)c--,u=e.codePointAt(c-1)}return c>i?e.slice(i,c):""}function Fk(e,r){const a={type:"text",value:Mk(String(r.value))};return e.patch(r,a),e.applyData(r,a)}function _k(e,r){const a={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,a),e.applyData(r,a)}const Ok={blockquote:dk,break:fk,code:hk,delete:mk,emphasis:xk,footnoteReference:pk,heading:yk,html:gk,imageReference:bk,image:vk,inlineCode:wk,linkReference:kk,link:jk,listItem:Sk,list:Ek,paragraph:Nk,root:Ak,strong:Tk,table:Dk,tableCell:Rk,tableRow:zk,text:Fk,thematicBreak:_k,toml:Dc,yaml:Dc,definition:Dc,footnoteDefinition:Dc};function Dc(){}const Zy=-1,cu=0,io=1,Pc=2,$h=3,Lh=4,Hh=5,Ih=6,Py=7,Jy=8,h0=typeof self=="object"?self:globalThis,Bk=(e,r)=>{const a=(c,u)=>(e.set(u,c),c),i=c=>{if(e.has(c))return e.get(c);const[u,d]=r[c];switch(u){case cu:case Zy:return a(d,c);case io:{const m=a([],c);for(const x of d)m.push(i(x));return m}case Pc:{const m=a({},c);for(const[x,f]of d)m[i(x)]=i(f);return m}case $h:return a(new Date(d),c);case Lh:{const{source:m,flags:x}=d;return a(new RegExp(m,x),c)}case Hh:{const m=a(new Map,c);for(const[x,f]of d)m.set(i(x),i(f));return m}case Ih:{const m=a(new Set,c);for(const x of d)m.add(i(x));return m}case Py:{const{name:m,message:x}=d;return a(new h0[m](x),c)}case Jy:return a(BigInt(d),c);case"BigInt":return a(Object(BigInt(d)),c);case"ArrayBuffer":return a(new Uint8Array(d).buffer,d);case"DataView":{const{buffer:m}=new Uint8Array(d);return a(new DataView(m),d)}}return a(new h0[u](d),c)};return i},m0=e=>Bk(new Map,e)(0),Bi="",{toString:$k}={},{keys:Lk}=Object,Gs=e=>{const r=typeof e;if(r!=="object"||!e)return[cu,r];const a=$k.call(e).slice(8,-1);switch(a){case"Array":return[io,Bi];case"Object":return[Pc,Bi];case"Date":return[$h,Bi];case"RegExp":return[Lh,Bi];case"Map":return[Hh,Bi];case"Set":return[Ih,Bi];case"DataView":return[io,a]}return a.includes("Array")?[io,a]:a.includes("Error")?[Py,a]:[Pc,a]},zc=([e,r])=>e===cu&&(r==="function"||r==="symbol"),Hk=(e,r,a,i)=>{const c=(d,m)=>{const x=i.push(d)-1;return a.set(m,x),x},u=d=>{if(a.has(d))return a.get(d);let[m,x]=Gs(d);switch(m){case cu:{let y=d;switch(x){case"bigint":m=Jy,y=d.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+x);y=null;break;case"undefined":return c([Zy],d)}return c([m,y],d)}case io:{if(x){let b=d;return x==="DataView"?b=new Uint8Array(d.buffer):x==="ArrayBuffer"&&(b=new Uint8Array(d)),c([x,[...b]],d)}const y=[],g=c([m,y],d);for(const b of d)y.push(u(b));return g}case Pc:{if(x)switch(x){case"BigInt":return c([x,d.toString()],d);case"Boolean":case"Number":case"String":return c([x,d.valueOf()],d)}if(r&&"toJSON"in d)return u(d.toJSON());const y=[],g=c([m,y],d);for(const b of Lk(d))(e||!zc(Gs(d[b])))&&y.push([u(b),u(d[b])]);return g}case $h:return c([m,d.toISOString()],d);case Lh:{const{source:y,flags:g}=d;return c([m,{source:y,flags:g}],d)}case Hh:{const y=[],g=c([m,y],d);for(const[b,v]of d)(e||!(zc(Gs(b))||zc(Gs(v))))&&y.push([u(b),u(v)]);return g}case Ih:{const y=[],g=c([m,y],d);for(const b of d)(e||!zc(Gs(b)))&&y.push(u(b));return g}}const{message:f}=d;return c([m,{name:x,message:f}],d)};return u},x0=(e,{json:r,lossy:a}={})=>{const i=[];return Hk(!(r||a),!!r,new Map,i)(e),i},Jc=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?m0(x0(e,r)):structuredClone(e):(e,r)=>m0(x0(e,r));function Ik(e,r){const a=[{type:"text",value:"↩"}];return r>1&&a.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),a}function Uk(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function qk(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=e.options.footnoteBackContent||Ik,i=e.options.footnoteBackLabel||Uk,c=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",d=e.options.footnoteLabelProperties||{className:["sr-only"]},m=[];let x=-1;for(;++x<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[x]);if(!f)continue;const y=e.all(f),g=String(f.identifier).toUpperCase(),b=Gi(g.toLowerCase());let v=0;const S=[],j=e.footnoteCounts.get(g);for(;j!==void 0&&++v<=j;){S.length>0&&S.push({type:"text",value:" "});let N=typeof a=="string"?a:a(x,v);typeof N=="string"&&(N={type:"text",value:N}),S.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+b+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(x,v),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const C=y[y.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const N=C.children[C.children.length-1];N&&N.type==="text"?N.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...S)}else y.push(...S);const E={type:"element",tagName:"li",properties:{id:r+"fn-"+b},children:e.wrap(y,!0)};e.patch(f,E),m.push(E)}if(m.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Jc(d),id:"footnote-label"},children:[{type:"text",value:c}]},{type:"text",value:`
|
|
58
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(m,!0)},{type:"text",value:`
|
|
59
|
+
`}]}}const uu=(function(e){if(e==null)return Gk;if(typeof e=="function")return du(e);if(typeof e=="object")return Array.isArray(e)?Yk(e):Xk(e);if(typeof e=="string")return Vk(e);throw new Error("Expected function, string, or object as test")});function Yk(e){const r=[];let a=-1;for(;++a<e.length;)r[a]=uu(e[a]);return du(i);function i(...c){let u=-1;for(;++u<r.length;)if(r[u].apply(this,c))return!0;return!1}}function Xk(e){const r=e;return du(a);function a(i){const c=i;let u;for(u in e)if(c[u]!==r[u])return!1;return!0}}function Vk(e){return du(r);function r(a){return a&&a.type===e}}function du(e){return r;function r(a,i,c){return!!(Qk(a)&&e.call(this,a,typeof i=="number"?i:void 0,c||void 0))}}function Gk(){return!0}function Qk(e){return e!==null&&typeof e=="object"&&"type"in e}const eg=[],Wk=!0,fh=!1,Kk="skip";function tg(e,r,a,i){let c;typeof r=="function"&&typeof a!="function"?(i=a,a=r):c=r;const u=uu(c),d=i?-1:1;m(e,void 0,[])();function m(x,f,y){const g=x&&typeof x=="object"?x:{};if(typeof g.type=="string"){const v=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(x.type+(v?"<"+v+">":""))+")"})}return b;function b(){let v=eg,S,j,C;if((!r||u(x,f,y[y.length-1]||void 0))&&(v=Zk(a(x,y)),v[0]===fh))return v;if("children"in x&&x.children){const E=x;if(E.children&&v[0]!==Kk)for(j=(i?E.children.length:-1)+d,C=y.concat(E);j>-1&&j<E.children.length;){const N=E.children[j];if(S=m(N,j,C)(),S[0]===fh)return S;j=typeof S[1]=="number"?S[1]:j+d}}return v}}}function Zk(e){return Array.isArray(e)?e:typeof e=="number"?[Wk,e]:e==null?eg:[e]}function Uh(e,r,a,i){let c,u,d;typeof r=="function"&&typeof a!="function"?(u=void 0,d=r,c=a):(u=r,d=a,c=i),tg(e,u,m,c);function m(x,f){const y=f[f.length-1],g=y?y.children.indexOf(x):void 0;return d(x,g,y)}}const hh={}.hasOwnProperty,Pk={};function Jk(e,r){const a=r||Pk,i=new Map,c=new Map,u=new Map,d={...Ok,...a.handlers},m={all:f,applyData:t3,definitionById:i,footnoteById:c,footnoteCounts:u,footnoteOrder:[],handlers:d,one:x,options:a,patch:e3,wrap:r3};return Uh(e,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const g=y.type==="definition"?i:c,b=String(y.identifier).toUpperCase();g.has(b)||g.set(b,y)}}),m;function x(y,g){const b=y.type,v=m.handlers[b];if(hh.call(m.handlers,b)&&v)return v(m,y,g);if(m.options.passThrough&&m.options.passThrough.includes(b)){if("children"in y){const{children:j,...C}=y,E=Jc(C);return E.children=m.all(y),E}return Jc(y)}return(m.options.unknownHandler||n3)(m,y,g)}function f(y){const g=[];if("children"in y){const b=y.children;let v=-1;for(;++v<b.length;){const S=m.one(b[v],y);if(S){if(v&&b[v-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=p0(S.value)),!Array.isArray(S)&&S.type==="element")){const j=S.children[0];j&&j.type==="text"&&(j.value=p0(j.value))}Array.isArray(S)?g.push(...S):g.push(S)}}}return g}}function e3(e,r){e.position&&(r.position=Uv(e))}function t3(e,r){let a=r;if(e&&e.data){const i=e.data.hName,c=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,Jc(u)),"children"in a&&a.children&&c!==null&&c!==void 0&&(a.children=c)}return a}function n3(e,r){const a=r.data||{},i="value"in r&&!(hh.call(a,"hProperties")||hh.call(a,"hChildren"))?{type:"text",value:r.value}:{type:"element",tagName:"div",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function r3(e,r){const a=[];let i=-1;for(r&&a.push({type:"text",value:`
|
|
60
|
+
`});++i<e.length;)i&&a.push({type:"text",value:`
|
|
61
|
+
`}),a.push(e[i]);return r&&e.length>0&&a.push({type:"text",value:`
|
|
62
|
+
`}),a}function p0(e){let r=0,a=e.charCodeAt(r);for(;a===9||a===32;)r++,a=e.charCodeAt(r);return e.slice(r)}function y0(e,r){const a=Jk(e,r),i=a.one(e,void 0),c=qk(a),u=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return c&&u.children.push({type:"text",value:`
|
|
63
|
+
`},c),u}function a3(e,r){return e&&"run"in e?async function(a,i){const c=y0(a,{file:i,...r});await e.run(c,i)}:function(a,i){return y0(a,{file:i,...e||r})}}function g0(e){if(e)throw e}var Ef,b0;function l3(){if(b0)return Ef;b0=1;var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,a=Object.defineProperty,i=Object.getOwnPropertyDescriptor,c=function(f){return typeof Array.isArray=="function"?Array.isArray(f):r.call(f)==="[object Array]"},u=function(f){if(!f||r.call(f)!=="[object Object]")return!1;var y=e.call(f,"constructor"),g=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!y&&!g)return!1;var b;for(b in f);return typeof b>"u"||e.call(f,b)},d=function(f,y){a&&y.name==="__proto__"?a(f,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):f[y.name]=y.newValue},m=function(f,y){if(y==="__proto__")if(e.call(f,y)){if(i)return i(f,y).value}else return;return f[y]};return Ef=function x(){var f,y,g,b,v,S,j=arguments[0],C=1,E=arguments.length,N=!1;for(typeof j=="boolean"&&(N=j,j=arguments[1]||{},C=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});C<E;++C)if(f=arguments[C],f!=null)for(y in f)g=m(j,y),b=m(f,y),j!==b&&(N&&b&&(u(b)||(v=c(b)))?(v?(v=!1,S=g&&c(g)?g:[]):S=g&&u(g)?g:{},d(j,{name:y,newValue:x(N,S,b)})):typeof b<"u"&&d(j,{name:y,newValue:b}));return j},Ef}var i3=l3();const Nf=vy(i3);function mh(e){if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function s3(){const e=[],r={run:a,use:i};return r;function a(...c){let u=-1;const d=c.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);m(null,...c);function m(x,...f){const y=e[++u];let g=-1;if(x){d(x);return}for(;++g<c.length;)(f[g]===null||f[g]===void 0)&&(f[g]=c[g]);c=f,y?o3(y,m)(...f):d(null,...f)}}function i(c){if(typeof c!="function")throw new TypeError("Expected `middelware` to be a function, not "+c);return e.push(c),r}}function o3(e,r){let a;return i;function i(...d){const m=e.length>d.length;let x;m&&d.push(c);try{x=e.apply(this,d)}catch(f){const y=f;if(m&&a)throw y;return c(y)}m||(x&&x.then&&typeof x.then=="function"?x.then(u,c):x instanceof Error?c(x):u(x))}function c(d,...m){a||(a=!0,r(d,...m))}function u(d){c(null,d)}}const na={basename:c3,dirname:u3,extname:d3,join:f3,sep:"/"};function c3(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');yo(e);let a=0,i=-1,c=e.length,u;if(r===void 0||r.length===0||r.length>e.length){for(;c--;)if(e.codePointAt(c)===47){if(u){a=c+1;break}}else i<0&&(u=!0,i=c+1);return i<0?"":e.slice(a,i)}if(r===e)return"";let d=-1,m=r.length-1;for(;c--;)if(e.codePointAt(c)===47){if(u){a=c+1;break}}else d<0&&(u=!0,d=c+1),m>-1&&(e.codePointAt(c)===r.codePointAt(m--)?m<0&&(i=c):(m=-1,i=d));return a===i?i=d:i<0&&(i=e.length),e.slice(a,i)}function u3(e){if(yo(e),e.length===0)return".";let r=-1,a=e.length,i;for(;--a;)if(e.codePointAt(a)===47){if(i){r=a;break}}else i||(i=!0);return r<0?e.codePointAt(0)===47?"/":".":r===1&&e.codePointAt(0)===47?"//":e.slice(0,r)}function d3(e){yo(e);let r=e.length,a=-1,i=0,c=-1,u=0,d;for(;r--;){const m=e.codePointAt(r);if(m===47){if(d){i=r+1;break}continue}a<0&&(d=!0,a=r+1),m===46?c<0?c=r:u!==1&&(u=1):c>-1&&(u=-1)}return c<0||a<0||u===0||u===1&&c===a-1&&c===i+1?"":e.slice(c,a)}function f3(...e){let r=-1,a;for(;++r<e.length;)yo(e[r]),e[r]&&(a=a===void 0?e[r]:a+"/"+e[r]);return a===void 0?".":h3(a)}function h3(e){yo(e);const r=e.codePointAt(0)===47;let a=m3(e,!r);return a.length===0&&!r&&(a="."),a.length>0&&e.codePointAt(e.length-1)===47&&(a+="/"),r?"/"+a:a}function m3(e,r){let a="",i=0,c=-1,u=0,d=-1,m,x;for(;++d<=e.length;){if(d<e.length)m=e.codePointAt(d);else{if(m===47)break;m=47}if(m===47){if(!(c===d-1||u===1))if(c!==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(x=a.lastIndexOf("/"),x!==a.length-1){x<0?(a="",i=0):(a=a.slice(0,x),i=a.length-1-a.lastIndexOf("/")),c=d,u=0;continue}}else if(a.length>0){a="",i=0,c=d,u=0;continue}}r&&(a=a.length>0?a+"/..":"..",i=2)}else a.length>0?a+="/"+e.slice(c+1,d):a=e.slice(c+1,d),i=d-c-1;c=d,u=0}else m===46&&u>-1?u++:u=-1}return a}function yo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const x3={cwd:p3};function p3(){return"/"}function xh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function y3(e){if(typeof e=="string")e=new URL(e);else if(!xh(e)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(e.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return g3(e)}function g3(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 r=e.pathname;let a=-1;for(;++a<r.length;)if(r.codePointAt(a)===37&&r.codePointAt(a+1)===50){const i=r.codePointAt(a+2);if(i===70||i===102){const c=new TypeError("File URL path must not include encoded / characters");throw c.code="ERR_INVALID_FILE_URL_PATH",c}}return decodeURIComponent(r)}const Af=["history","path","basename","stem","extname","dirname"];class ng{constructor(r){let a;r?xh(r)?a={path:r}:typeof r=="string"||b3(r)?a={value:r}:a=r:a={},this.cwd="cwd"in a?"":x3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Af.length;){const u=Af[i];u in a&&a[u]!==void 0&&a[u]!==null&&(this[u]=u==="history"?[...a[u]]:a[u])}let c;for(c in a)Af.includes(c)||(this[c]=a[c])}get basename(){return typeof this.path=="string"?na.basename(this.path):void 0}set basename(r){Df(r,"basename"),Tf(r,"basename"),this.path=na.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?na.dirname(this.path):void 0}set dirname(r){v0(this.basename,"dirname"),this.path=na.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?na.extname(this.path):void 0}set extname(r){if(Tf(r,"extname"),v0(this.dirname,"extname"),r){if(r.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(r.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=na.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){xh(r)&&(r=y3(r)),Df(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?na.basename(this.path,this.extname):void 0}set stem(r){Df(r,"stem"),Tf(r,"stem"),this.path=na.join(this.dirname||"",r+(this.extname||""))}fail(r,a,i){const c=this.message(r,a,i);throw c.fatal=!0,c}info(r,a,i){const c=this.message(r,a,i);return c.fatal=void 0,c}message(r,a,i){const c=new Yn(r,a,i);return this.path&&(c.name=this.path+":"+c.name,c.file=this.path),c.fatal=!1,this.messages.push(c),c}toString(r){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(r||void 0).decode(this.value)}}function Tf(e,r){if(e&&e.includes(na.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+na.sep+"`")}function Df(e,r){if(!e)throw new Error("`"+r+"` cannot be empty")}function v0(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function b3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const v3=(function(e){const i=this.constructor.prototype,c=i[e],u=function(){return c.apply(u,arguments)};return Object.setPrototypeOf(u,i),u}),w3={}.hasOwnProperty;class qh extends v3{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=s3()}copy(){const r=new qh;let a=-1;for(;++a<this.attachers.length;){const i=this.attachers[a];r.use(...i)}return r.data(Nf(!0,{},this.namespace)),r}data(r,a){return typeof r=="string"?arguments.length===2?(Mf("data",this.frozen),this.namespace[r]=a,this):w3.call(this.namespace,r)&&this.namespace[r]||void 0:r?(Mf("data",this.frozen),this.namespace=r,this):this.namespace}freeze(){if(this.frozen)return this;const r=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 c=a.call(r,...i);typeof c=="function"&&this.transformers.use(c)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const a=Rc(r),i=this.parser||this.Parser;return zf("parse",i),i(String(a),a)}process(r,a){const i=this;return this.freeze(),zf("process",this.parser||this.Parser),Rf("process",this.compiler||this.Compiler),a?c(void 0,a):new Promise(c);function c(u,d){const m=Rc(r),x=i.parse(m);i.run(x,m,function(y,g,b){if(y||!g||!b)return f(y);const v=g,S=i.stringify(v,b);S3(S)?b.value=S:b.result=S,f(y,b)});function f(y,g){y||!g?d(y):u?u(g):a(void 0,g)}}}processSync(r){let a=!1,i;return this.freeze(),zf("processSync",this.parser||this.Parser),Rf("processSync",this.compiler||this.Compiler),this.process(r,c),k0("processSync","process",a),i;function c(u,d){a=!0,g0(u),i=d}}run(r,a,i){w0(r),this.freeze();const c=this.transformers;return!i&&typeof a=="function"&&(i=a,a=void 0),i?u(void 0,i):new Promise(u);function u(d,m){const x=Rc(a);c.run(r,x,f);function f(y,g,b){const v=g||r;y?m(y):d?d(v):i(void 0,v,b)}}}runSync(r,a){let i=!1,c;return this.run(r,a,u),k0("runSync","run",i),c;function u(d,m){g0(d),c=m,i=!0}}stringify(r,a){this.freeze();const i=Rc(a),c=this.compiler||this.Compiler;return Rf("stringify",c),w0(r),c(r,i)}use(r,...a){const i=this.attachers,c=this.namespace;if(Mf("use",this.frozen),r!=null)if(typeof r=="function")x(r,a);else if(typeof r=="object")Array.isArray(r)?m(r):d(r);else throw new TypeError("Expected usable value, not `"+r+"`");return this;function u(f){if(typeof f=="function")x(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[y,...g]=f;x(y,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");m(f.plugins),f.settings&&(c.settings=Nf(!0,c.settings,f.settings))}function m(f){let y=-1;if(f!=null)if(Array.isArray(f))for(;++y<f.length;){const g=f[y];u(g)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function x(f,y){let g=-1,b=-1;for(;++g<i.length;)if(i[g][0]===f){b=g;break}if(b===-1)i.push([f,...y]);else if(y.length>0){let[v,...S]=y;const j=i[b][1];mh(j)&&mh(v)&&(v=Nf(!0,j,v)),i[b]=[f,v,...S]}}}}const k3=new qh().freeze();function zf(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Rf(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Mf(e,r){if(r)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function w0(e){if(!mh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function k0(e,r,a){if(!a)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function Rc(e){return j3(e)?e:new ng(e)}function j3(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function S3(e){return typeof e=="string"||C3(e)}function C3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const E3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",j0=[],S0={allowDangerousHtml:!0},N3=/^(https?|ircs?|mailto|xmpp)$/i,A3=[{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 Yh(e){const r=T3(e),a=D3(e);return z3(r.runSync(r.parse(a),a),e)}function T3(e){const r=e.rehypePlugins||j0,a=e.remarkPlugins||j0,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...S0}:S0;return k3().use(uk).use(a).use(a3,i).use(r)}function D3(e){const r=e.children||"",a=new ng;return typeof r=="string"&&(a.value=r),a}function z3(e,r){const a=r.allowedElements,i=r.allowElement,c=r.components,u=r.disallowedElements,d=r.skipHtml,m=r.unwrapDisallowed,x=r.urlTransform||R3;for(const y of A3)Object.hasOwn(r,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+E3+y.id,void 0);return Uh(e,f),Gv(e,{Fragment:s.Fragment,components:c,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0});function f(y,g,b){if(y.type==="raw"&&b&&typeof g=="number")return d?b.children.splice(g,1):b.children[g]={type:"text",value:y.value},g;if(y.type==="element"){let v;for(v in jf)if(Object.hasOwn(jf,v)&&Object.hasOwn(y.properties,v)){const S=y.properties[v],j=jf[v];(j===null||j.includes(y.tagName))&&(y.properties[v]=x(String(S||""),v,y))}}if(y.type==="element"){let v=a?!a.includes(y.tagName):u?u.includes(y.tagName):!1;if(!v&&i&&typeof g=="number"&&(v=!i(y,g,b)),v&&b&&typeof g=="number")return m&&y.children?b.children.splice(g,1,...y.children):b.children.splice(g,1),g}}}function R3(e){const r=e.indexOf(":"),a=e.indexOf("?"),i=e.indexOf("#"),c=e.indexOf("/");return r===-1||c!==-1&&r>c||a!==-1&&r>a||i!==-1&&r>i||N3.test(e.slice(0,r))?e:""}function C0(e,r){const a=String(e);if(typeof r!="string")throw new TypeError("Expected character");let i=0,c=a.indexOf(r);for(;c!==-1;)i++,c=a.indexOf(r,c+r.length);return i}function M3(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function F3(e,r,a){const c=uu((a||{}).ignore||[]),u=_3(r);let d=-1;for(;++d<u.length;)tg(e,"text",m);function m(f,y){let g=-1,b;for(;++g<y.length;){const v=y[g],S=b?b.children:void 0;if(c(v,S?S.indexOf(v):void 0,b))return;b=v}if(b)return x(f,y)}function x(f,y){const g=y[y.length-1],b=u[d][0],v=u[d][1];let S=0;const C=g.children.indexOf(f);let E=!1,N=[];b.lastIndex=0;let _=b.exec(f.value);for(;_;){const B=_.index,I={index:_.index,input:_.input,stack:[...y,f]};let F=v(..._,I);if(typeof F=="string"&&(F=F.length>0?{type:"text",value:F}:void 0),F===!1?b.lastIndex=B+1:(S!==B&&N.push({type:"text",value:f.value.slice(S,B)}),Array.isArray(F)?N.push(...F):F&&N.push(F),S=B+_[0].length,E=!0),!b.global)break;_=b.exec(f.value)}return E?(S<f.value.length&&N.push({type:"text",value:f.value.slice(S)}),g.children.splice(C,1,...N)):N=[f],C+N.length}}function _3(e){const r=[];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 c=a[i];r.push([O3(c[0]),B3(c[1])])}return r}function O3(e){return typeof e=="string"?new RegExp(M3(e),"g"):e}function B3(e){return typeof e=="function"?e:function(){return e}}const Ff="phrasing",_f=["autolink","link","image","label"];function $3(){return{transforms:[X3],enter:{literalAutolink:H3,literalAutolinkEmail:Of,literalAutolinkHttp:Of,literalAutolinkWww:Of},exit:{literalAutolink:Y3,literalAutolinkEmail:q3,literalAutolinkHttp:I3,literalAutolinkWww:U3}}}function L3(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ff,notInConstruct:_f},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ff,notInConstruct:_f},{character:":",before:"[ps]",after:"\\/",inConstruct:Ff,notInConstruct:_f}]}}function H3(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Of(e){this.config.enter.autolinkProtocol.call(this,e)}function I3(e){this.config.exit.autolinkProtocol.call(this,e)}function U3(e){this.config.exit.data.call(this,e);const r=this.stack[this.stack.length-1];r.type,r.url="http://"+this.sliceSerialize(e)}function q3(e){this.config.exit.autolinkEmail.call(this,e)}function Y3(e){this.exit(e)}function X3(e){F3(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,V3],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),G3]],{ignore:["link","linkReference"]})}function V3(e,r,a,i,c){let u="";if(!rg(c)||(/^w/i.test(r)&&(a=r+a,r="",u="http://"),!Q3(a)))return!1;const d=W3(a+i);if(!d[0])return!1;const m={type:"link",title:null,url:u+r+d[0],children:[{type:"text",value:r+d[0]}]};return d[1]?[m,{type:"text",value:d[1]}]:m}function G3(e,r,a,i){return!rg(i,!0)||/[-\d_]$/.test(a)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+a,children:[{type:"text",value:r+"@"+a}]}}function Q3(e){const r=e.split(".");return!(r.length<2||r[r.length-1]&&(/_/.test(r[r.length-1])||!/[a-zA-Z\d]/.test(r[r.length-1]))||r[r.length-2]&&(/_/.test(r[r.length-2])||!/[a-zA-Z\d]/.test(r[r.length-2])))}function W3(e){const r=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!r)return[e,void 0];e=e.slice(0,r.index);let a=r[0],i=a.indexOf(")");const c=C0(e,"(");let u=C0(e,")");for(;i!==-1&&c>u;)e+=a.slice(0,i+1),a=a.slice(i+1),i=a.indexOf(")"),u++;return[e,a]}function rg(e,r){const a=e.input.charCodeAt(e.index-1);return(e.index===0||Kl(a)||su(a))&&(!r||a!==47)}ag.peek=a4;function K3(){this.buffer()}function Z3(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function P3(){this.buffer()}function J3(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function e4(e){const r=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Ir(this.sliceSerialize(e)).toLowerCase(),a.label=r}function t4(e){this.exit(e)}function n4(e){const r=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Ir(this.sliceSerialize(e)).toLowerCase(),a.label=r}function r4(e){this.exit(e)}function a4(){return"["}function ag(e,r,a,i){const c=a.createTracker(i);let u=c.move("[^");const d=a.enter("footnoteReference"),m=a.enter("reference");return u+=c.move(a.safe(a.associationId(e),{after:"]",before:u})),m(),d(),u+=c.move("]"),u}function l4(){return{enter:{gfmFootnoteCallString:K3,gfmFootnoteCall:Z3,gfmFootnoteDefinitionLabelString:P3,gfmFootnoteDefinition:J3},exit:{gfmFootnoteCallString:e4,gfmFootnoteCall:t4,gfmFootnoteDefinitionLabelString:n4,gfmFootnoteDefinition:r4}}}function i4(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:a,footnoteReference:ag},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function a(i,c,u,d){const m=u.createTracker(d);let x=m.move("[^");const f=u.enter("footnoteDefinition"),y=u.enter("label");return x+=m.move(u.safe(u.associationId(i),{before:x,after:"]"})),y(),x+=m.move("]:"),i.children&&i.children.length>0&&(m.shift(4),x+=m.move((r?`
|
|
64
|
+
`:" ")+u.indentLines(u.containerFlow(i,m.current()),r?lg:s4))),f(),x}}function s4(e,r,a){return r===0?e:lg(e,r,a)}function lg(e,r,a){return(a?"":" ")+e}const o4=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];ig.peek=h4;function c4(){return{canContainEols:["delete"],enter:{strikethrough:d4},exit:{strikethrough:f4}}}function u4(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:o4}],handlers:{delete:ig}}}function d4(e){this.enter({type:"delete",children:[]},e)}function f4(e){this.exit(e)}function ig(e,r,a,i){const c=a.createTracker(i),u=a.enter("strikethrough");let d=c.move("~~");return d+=a.containerPhrasing(e,{...c.current(),before:d,after:"~"}),d+=c.move("~~"),u(),d}function h4(){return"~"}function m4(e){return e.length}function x4(e,r){const a=r||{},i=(a.align||[]).concat(),c=a.stringLength||m4,u=[],d=[],m=[],x=[];let f=0,y=-1;for(;++y<e.length;){const j=[],C=[];let E=-1;for(e[y].length>f&&(f=e[y].length);++E<e[y].length;){const N=p4(e[y][E]);if(a.alignDelimiters!==!1){const _=c(N);C[E]=_,(x[E]===void 0||_>x[E])&&(x[E]=_)}j.push(N)}d[y]=j,m[y]=C}let g=-1;if(typeof i=="object"&&"length"in i)for(;++g<f;)u[g]=E0(i[g]);else{const j=E0(i);for(;++g<f;)u[g]=j}g=-1;const b=[],v=[];for(;++g<f;){const j=u[g];let C="",E="";j===99?(C=":",E=":"):j===108?C=":":j===114&&(E=":");let N=a.alignDelimiters===!1?1:Math.max(1,x[g]-C.length-E.length);const _=C+"-".repeat(N)+E;a.alignDelimiters!==!1&&(N=C.length+N+E.length,N>x[g]&&(x[g]=N),v[g]=N),b[g]=_}d.splice(1,0,b),m.splice(1,0,v),y=-1;const S=[];for(;++y<d.length;){const j=d[y],C=m[y];g=-1;const E=[];for(;++g<f;){const N=j[g]||"";let _="",B="";if(a.alignDelimiters!==!1){const I=x[g]-(C[g]||0),F=u[g];F===114?_=" ".repeat(I):F===99?I%2?(_=" ".repeat(I/2+.5),B=" ".repeat(I/2-.5)):(_=" ".repeat(I/2),B=_):B=" ".repeat(I)}a.delimiterStart!==!1&&!g&&E.push("|"),a.padding!==!1&&!(a.alignDelimiters===!1&&N==="")&&(a.delimiterStart!==!1||g)&&E.push(" "),a.alignDelimiters!==!1&&E.push(_),E.push(N),a.alignDelimiters!==!1&&E.push(B),a.padding!==!1&&E.push(" "),(a.delimiterEnd!==!1||g!==f-1)&&E.push("|")}S.push(a.delimiterEnd===!1?E.join("").replace(/ +$/,""):E.join(""))}return S.join(`
|
|
65
|
+
`)}function p4(e){return e==null?"":String(e)}function E0(e){const r=typeof e=="string"?e.codePointAt(0):0;return r===67||r===99?99:r===76||r===108?108:r===82||r===114?114:0}function y4(e,r,a,i){const c=a.enter("blockquote"),u=a.createTracker(i);u.move("> "),u.shift(2);const d=a.indentLines(a.containerFlow(e,u.current()),g4);return c(),d}function g4(e,r,a){return">"+(a?"":" ")+e}function b4(e,r){return N0(e,r.inConstruct,!0)&&!N0(e,r.notInConstruct,!1)}function N0(e,r,a){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return a;let i=-1;for(;++i<r.length;)if(e.includes(r[i]))return!0;return!1}function A0(e,r,a,i){let c=-1;for(;++c<a.unsafe.length;)if(a.unsafe[c].character===`
|
|
66
|
+
`&&b4(a.stack,a.unsafe[c]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
67
|
+
`}function v4(e,r){const a=String(e);let i=a.indexOf(r),c=i,u=0,d=0;if(typeof r!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===c?++u>d&&(d=u):u=1,c=i+r.length,i=a.indexOf(r,c);return d}function w4(e,r){return!!(r.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function k4(e){const r=e.options.fence||"`";if(r!=="`"&&r!=="~")throw new Error("Cannot serialize code with `"+r+"` for `options.fence`, expected `` ` `` or `~`");return r}function j4(e,r,a,i){const c=k4(a),u=e.value||"",d=c==="`"?"GraveAccent":"Tilde";if(w4(e,a)){const g=a.enter("codeIndented"),b=a.indentLines(u,S4);return g(),b}const m=a.createTracker(i),x=c.repeat(Math.max(v4(u,c)+1,3)),f=a.enter("codeFenced");let y=m.move(x);if(e.lang){const g=a.enter(`codeFencedLang${d}`);y+=m.move(a.safe(e.lang,{before:y,after:" ",encode:["`"],...m.current()})),g()}if(e.lang&&e.meta){const g=a.enter(`codeFencedMeta${d}`);y+=m.move(" "),y+=m.move(a.safe(e.meta,{before:y,after:`
|
|
68
|
+
`,encode:["`"],...m.current()})),g()}return y+=m.move(`
|
|
69
|
+
`),u&&(y+=m.move(u+`
|
|
70
|
+
`)),y+=m.move(x),f(),y}function S4(e,r,a){return(a?"":" ")+e}function Xh(e){const r=e.options.quote||'"';if(r!=='"'&&r!=="'")throw new Error("Cannot serialize title with `"+r+"` for `options.quote`, expected `\"`, or `'`");return r}function C4(e,r,a,i){const c=Xh(a),u=c==='"'?"Quote":"Apostrophe",d=a.enter("definition");let m=a.enter("label");const x=a.createTracker(i);let f=x.move("[");return f+=x.move(a.safe(a.associationId(e),{before:f,after:"]",...x.current()})),f+=x.move("]: "),m(),!e.url||/[\0- \u007F]/.test(e.url)?(m=a.enter("destinationLiteral"),f+=x.move("<"),f+=x.move(a.safe(e.url,{before:f,after:">",...x.current()})),f+=x.move(">")):(m=a.enter("destinationRaw"),f+=x.move(a.safe(e.url,{before:f,after:e.title?" ":`
|
|
71
|
+
`,...x.current()}))),m(),e.title&&(m=a.enter(`title${u}`),f+=x.move(" "+c),f+=x.move(a.safe(e.title,{before:f,after:c,...x.current()})),f+=x.move(c),m()),d(),f}function E4(e){const r=e.options.emphasis||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize emphasis with `"+r+"` for `options.emphasis`, expected `*`, or `_`");return r}function oo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function eu(e,r,a){const i=qi(e),c=qi(r);return i===void 0?c===void 0?a==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}sg.peek=N4;function sg(e,r,a,i){const c=E4(a),u=a.enter("emphasis"),d=a.createTracker(i),m=d.move(c);let x=d.move(a.containerPhrasing(e,{after:c,before:m,...d.current()}));const f=x.charCodeAt(0),y=eu(i.before.charCodeAt(i.before.length-1),f,c);y.inside&&(x=oo(f)+x.slice(1));const g=x.charCodeAt(x.length-1),b=eu(i.after.charCodeAt(0),g,c);b.inside&&(x=x.slice(0,-1)+oo(g));const v=d.move(c);return u(),a.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},m+x+v}function N4(e,r,a){return a.options.emphasis||"*"}function A4(e,r){let a=!1;return Uh(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return a=!0,fh}),!!((!e.depth||e.depth<3)&&_h(e)&&(r.options.setext||a))}function T4(e,r,a,i){const c=Math.max(Math.min(6,e.depth||1),1),u=a.createTracker(i);if(A4(e,a)){const y=a.enter("headingSetext"),g=a.enter("phrasing"),b=a.containerPhrasing(e,{...u.current(),before:`
|
|
72
|
+
`,after:`
|
|
73
|
+
`});return g(),y(),b+`
|
|
74
|
+
`+(c===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
75
|
+
`))+1))}const d="#".repeat(c),m=a.enter("headingAtx"),x=a.enter("phrasing");u.move(d+" ");let f=a.containerPhrasing(e,{before:"# ",after:`
|
|
76
|
+
`,...u.current()});return/^[\t ]/.test(f)&&(f=oo(f.charCodeAt(0))+f.slice(1)),f=f?d+" "+f:d,a.options.closeAtx&&(f+=" "+d),x(),m(),f}og.peek=D4;function og(e){return e.value||""}function D4(){return"<"}cg.peek=z4;function cg(e,r,a,i){const c=Xh(a),u=c==='"'?"Quote":"Apostrophe",d=a.enter("image");let m=a.enter("label");const x=a.createTracker(i);let f=x.move("![");return f+=x.move(a.safe(e.alt,{before:f,after:"]",...x.current()})),f+=x.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=a.enter("destinationLiteral"),f+=x.move("<"),f+=x.move(a.safe(e.url,{before:f,after:">",...x.current()})),f+=x.move(">")):(m=a.enter("destinationRaw"),f+=x.move(a.safe(e.url,{before:f,after:e.title?" ":")",...x.current()}))),m(),e.title&&(m=a.enter(`title${u}`),f+=x.move(" "+c),f+=x.move(a.safe(e.title,{before:f,after:c,...x.current()})),f+=x.move(c),m()),f+=x.move(")"),d(),f}function z4(){return"!"}ug.peek=R4;function ug(e,r,a,i){const c=e.referenceType,u=a.enter("imageReference");let d=a.enter("label");const m=a.createTracker(i);let x=m.move("![");const f=a.safe(e.alt,{before:x,after:"]",...m.current()});x+=m.move(f+"]["),d();const y=a.stack;a.stack=[],d=a.enter("reference");const g=a.safe(a.associationId(e),{before:x,after:"]",...m.current()});return d(),a.stack=y,u(),c==="full"||!f||f!==g?x+=m.move(g+"]"):c==="shortcut"?x=x.slice(0,-1):x+=m.move("]"),x}function R4(){return"!"}dg.peek=M4;function dg(e,r,a){let i=e.value||"",c="`",u=-1;for(;new RegExp("(^|[^`])"+c+"([^`]|$)").test(i);)c+="`";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],m=a.compilePattern(d);let x;if(d.atBreak)for(;x=m.exec(i);){let f=x.index;i.charCodeAt(f)===10&&i.charCodeAt(f-1)===13&&f--,i=i.slice(0,f)+" "+i.slice(x.index+1)}}return c+i+c}function M4(){return"`"}function fg(e,r){const a=_h(e);return!!(!r.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))}hg.peek=F4;function hg(e,r,a,i){const c=Xh(a),u=c==='"'?"Quote":"Apostrophe",d=a.createTracker(i);let m,x;if(fg(e,a)){const y=a.stack;a.stack=[],m=a.enter("autolink");let g=d.move("<");return g+=d.move(a.containerPhrasing(e,{before:g,after:">",...d.current()})),g+=d.move(">"),m(),a.stack=y,g}m=a.enter("link"),x=a.enter("label");let f=d.move("[");return f+=d.move(a.containerPhrasing(e,{before:f,after:"](",...d.current()})),f+=d.move("]("),x(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(x=a.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(a.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(x=a.enter("destinationRaw"),f+=d.move(a.safe(e.url,{before:f,after:e.title?" ":")",...d.current()}))),x(),e.title&&(x=a.enter(`title${u}`),f+=d.move(" "+c),f+=d.move(a.safe(e.title,{before:f,after:c,...d.current()})),f+=d.move(c),x()),f+=d.move(")"),m(),f}function F4(e,r,a){return fg(e,a)?"<":"["}mg.peek=_4;function mg(e,r,a,i){const c=e.referenceType,u=a.enter("linkReference");let d=a.enter("label");const m=a.createTracker(i);let x=m.move("[");const f=a.containerPhrasing(e,{before:x,after:"]",...m.current()});x+=m.move(f+"]["),d();const y=a.stack;a.stack=[],d=a.enter("reference");const g=a.safe(a.associationId(e),{before:x,after:"]",...m.current()});return d(),a.stack=y,u(),c==="full"||!f||f!==g?x+=m.move(g+"]"):c==="shortcut"?x=x.slice(0,-1):x+=m.move("]"),x}function _4(){return"["}function Vh(e){const r=e.options.bullet||"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bullet`, expected `*`, `+`, or `-`");return r}function O4(e){const r=Vh(e),a=e.options.bulletOther;if(!a)return r==="*"?"-":"*";if(a!=="*"&&a!=="+"&&a!=="-")throw new Error("Cannot serialize items with `"+a+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(a===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+a+"`) to be different");return a}function B4(e){const r=e.options.bulletOrdered||".";if(r!=="."&&r!==")")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOrdered`, expected `.` or `)`");return r}function xg(e){const r=e.options.rule||"*";if(r!=="*"&&r!=="-"&&r!=="_")throw new Error("Cannot serialize rules with `"+r+"` for `options.rule`, expected `*`, `-`, or `_`");return r}function $4(e,r,a,i){const c=a.enter("list"),u=a.bulletCurrent;let d=e.ordered?B4(a):Vh(a);const m=e.ordered?d==="."?")":".":O4(a);let x=r&&a.bulletLastUsed?d===a.bulletLastUsed:!1;if(!e.ordered){const y=e.children?e.children[0]:void 0;if((d==="*"||d==="-")&&y&&(!y.children||!y.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&&(x=!0),xg(a)===d&&y){let g=-1;for(;++g<e.children.length;){const b=e.children[g];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){x=!0;break}}}}x&&(d=m),a.bulletCurrent=d;const f=a.containerFlow(e,i);return a.bulletLastUsed=d,a.bulletCurrent=u,c(),f}function L4(e){const r=e.options.listItemIndent||"one";if(r!=="tab"&&r!=="one"&&r!=="mixed")throw new Error("Cannot serialize items with `"+r+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return r}function H4(e,r,a,i){const c=L4(a);let u=a.bulletCurrent||Vh(a);r&&r.type==="list"&&r.ordered&&(u=(typeof r.start=="number"&&r.start>-1?r.start:1)+(a.options.incrementListMarker===!1?0:r.children.indexOf(e))+u);let d=u.length+1;(c==="tab"||c==="mixed"&&(r&&r.type==="list"&&r.spread||e.spread))&&(d=Math.ceil(d/4)*4);const m=a.createTracker(i);m.move(u+" ".repeat(d-u.length)),m.shift(d);const x=a.enter("listItem"),f=a.indentLines(a.containerFlow(e,m.current()),y);return x(),f;function y(g,b,v){return b?(v?"":" ".repeat(d))+g:(v?u:u+" ".repeat(d-u.length))+g}}function I4(e,r,a,i){const c=a.enter("paragraph"),u=a.enter("phrasing"),d=a.containerPhrasing(e,i);return u(),c(),d}const U4=uu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function q4(e,r,a,i){return(e.children.some(function(d){return U4(d)})?a.containerPhrasing:a.containerFlow).call(a,e,i)}function Y4(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}pg.peek=X4;function pg(e,r,a,i){const c=Y4(a),u=a.enter("strong"),d=a.createTracker(i),m=d.move(c+c);let x=d.move(a.containerPhrasing(e,{after:c,before:m,...d.current()}));const f=x.charCodeAt(0),y=eu(i.before.charCodeAt(i.before.length-1),f,c);y.inside&&(x=oo(f)+x.slice(1));const g=x.charCodeAt(x.length-1),b=eu(i.after.charCodeAt(0),g,c);b.inside&&(x=x.slice(0,-1)+oo(g));const v=d.move(c+c);return u(),a.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},m+x+v}function X4(e,r,a){return a.options.strong||"*"}function V4(e,r,a,i){return a.safe(e.value,i)}function G4(e){const r=e.options.ruleRepetition||3;if(r<3)throw new Error("Cannot serialize rules with repetition `"+r+"` for `options.ruleRepetition`, expected `3` or more");return r}function Q4(e,r,a){const i=(xg(a)+(a.options.ruleSpaces?" ":"")).repeat(G4(a));return a.options.ruleSpaces?i.slice(0,-1):i}const yg={blockquote:y4,break:A0,code:j4,definition:C4,emphasis:sg,hardBreak:A0,heading:T4,html:og,image:cg,imageReference:ug,inlineCode:dg,link:hg,linkReference:mg,list:$4,listItem:H4,paragraph:I4,root:q4,strong:pg,text:V4,thematicBreak:Q4};function W4(){return{enter:{table:K4,tableData:T0,tableHeader:T0,tableRow:P4},exit:{codeText:J4,table:Z4,tableData:Bf,tableHeader:Bf,tableRow:Bf}}}function K4(e){const r=e._align;this.enter({type:"table",align:r.map(function(a){return a==="none"?null:a}),children:[]},e),this.data.inTable=!0}function Z4(e){this.exit(e),this.data.inTable=void 0}function P4(e){this.enter({type:"tableRow",children:[]},e)}function Bf(e){this.exit(e)}function T0(e){this.enter({type:"tableCell",children:[]},e)}function J4(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,ej));const a=this.stack[this.stack.length-1];a.type,a.value=r,this.exit(e)}function ej(e,r){return r==="|"?r:e}function tj(e){const r=e||{},a=r.tableCellPadding,i=r.tablePipeAlign,c=r.stringLength,u=a?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
77
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:d,tableCell:x,tableRow:m}};function d(v,S,j,C){return f(y(v,j,C),v.align)}function m(v,S,j,C){const E=g(v,j,C),N=f([E]);return N.slice(0,N.indexOf(`
|
|
78
|
+
`))}function x(v,S,j,C){const E=j.enter("tableCell"),N=j.enter("phrasing"),_=j.containerPhrasing(v,{...C,before:u,after:u});return N(),E(),_}function f(v,S){return x4(v,{align:S,alignDelimiters:i,padding:a,stringLength:c})}function y(v,S,j){const C=v.children;let E=-1;const N=[],_=S.enter("table");for(;++E<C.length;)N[E]=g(C[E],S,j);return _(),N}function g(v,S,j){const C=v.children;let E=-1;const N=[],_=S.enter("tableRow");for(;++E<C.length;)N[E]=x(C[E],v,S,j);return _(),N}function b(v,S,j){let C=yg.inlineCode(v,S,j);return j.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function nj(){return{exit:{taskListCheckValueChecked:D0,taskListCheckValueUnchecked:D0,paragraph:aj}}}function rj(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:lj}}}function D0(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function aj(e){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const a=this.stack[this.stack.length-1];a.type;const i=a.children[0];if(i&&i.type==="text"){const c=r.children;let u=-1,d;for(;++u<c.length;){const m=c[u];if(m.type==="paragraph"){d=m;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 lj(e,r,a,i){const c=e.children[0],u=typeof e.checked=="boolean"&&c&&c.type==="paragraph",d="["+(e.checked?"x":" ")+"] ",m=a.createTracker(i);u&&m.move(d);let x=yg.listItem(e,r,a,{...i,...m.current()});return u&&(x=x.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),x;function f(y){return y+d}}function ij(){return[$3(),l4(),c4(),W4(),nj()]}function sj(e){return{extensions:[L3(),i4(e),u4(),tj(e),rj()]}}const oj={tokenize:mj,partial:!0},gg={tokenize:xj,partial:!0},bg={tokenize:pj,partial:!0},vg={tokenize:yj,partial:!0},cj={tokenize:gj,partial:!0},wg={name:"wwwAutolink",tokenize:fj,previous:jg},kg={name:"protocolAutolink",tokenize:hj,previous:Sg},Ma={name:"emailAutolink",tokenize:dj,previous:Cg},ia={};function uj(){return{text:ia}}let Il=48;for(;Il<123;)ia[Il]=Ma,Il++,Il===58?Il=65:Il===91&&(Il=97);ia[43]=Ma;ia[45]=Ma;ia[46]=Ma;ia[95]=Ma;ia[72]=[Ma,kg];ia[104]=[Ma,kg];ia[87]=[Ma,wg];ia[119]=[Ma,wg];function dj(e,r,a){const i=this;let c,u;return d;function d(g){return!ph(g)||!Cg.call(i,i.previous)||Gh(i.events)?a(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),m(g))}function m(g){return ph(g)?(e.consume(g),m):g===64?(e.consume(g),x):a(g)}function x(g){return g===46?e.check(cj,y,f)(g):g===45||g===95||qn(g)?(u=!0,e.consume(g),x):y(g)}function f(g){return e.consume(g),c=!0,x}function y(g){return u&&c&&Gn(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(g)):a(g)}}function fj(e,r,a){const i=this;return c;function c(d){return d!==87&&d!==119||!jg.call(i,i.previous)||Gh(i.events)?a(d):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(oj,e.attempt(gg,e.attempt(bg,u),a),a)(d))}function u(d){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(d)}}function hj(e,r,a){const i=this;let c="",u=!1;return d;function d(g){return(g===72||g===104)&&Sg.call(i,i.previous)&&!Gh(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),c+=String.fromCodePoint(g),e.consume(g),m):a(g)}function m(g){if(Gn(g)&&c.length<5)return c+=String.fromCodePoint(g),e.consume(g),m;if(g===58){const b=c.toLowerCase();if(b==="http"||b==="https")return e.consume(g),x}return a(g)}function x(g){return g===47?(e.consume(g),u?f:(u=!0,x)):a(g)}function f(g){return g===null||Zc(g)||qt(g)||Kl(g)||su(g)?a(g):e.attempt(gg,e.attempt(bg,y),a)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(g)}}function mj(e,r,a){let i=0;return c;function c(d){return(d===87||d===119)&&i<3?(i++,e.consume(d),c):d===46&&i===3?(e.consume(d),u):a(d)}function u(d){return d===null?a(d):r(d)}}function xj(e,r,a){let i,c,u;return d;function d(f){return f===46||f===95?e.check(vg,x,m)(f):f===null||qt(f)||Kl(f)||f!==45&&su(f)?x(f):(u=!0,e.consume(f),d)}function m(f){return f===95?i=!0:(c=i,i=void 0),e.consume(f),d}function x(f){return c||i||!u?a(f):r(f)}}function pj(e,r){let a=0,i=0;return c;function c(d){return d===40?(a++,e.consume(d),c):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(vg,r,u)(d):d===null||qt(d)||Kl(d)?r(d):(e.consume(d),c)}function u(d){return d===41&&i++,e.consume(d),c}}function yj(e,r,a){return i;function i(m){return m===33||m===34||m===39||m===41||m===42||m===44||m===46||m===58||m===59||m===63||m===95||m===126?(e.consume(m),i):m===38?(e.consume(m),u):m===93?(e.consume(m),c):m===60||m===null||qt(m)||Kl(m)?r(m):a(m)}function c(m){return m===null||m===40||m===91||qt(m)||Kl(m)?r(m):i(m)}function u(m){return Gn(m)?d(m):a(m)}function d(m){return m===59?(e.consume(m),i):Gn(m)?(e.consume(m),d):a(m)}}function gj(e,r,a){return i;function i(u){return e.consume(u),c}function c(u){return qn(u)?a(u):r(u)}}function jg(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||qt(e)}function Sg(e){return!Gn(e)}function Cg(e){return!(e===47||ph(e))}function ph(e){return e===43||e===45||e===46||e===95||qn(e)}function Gh(e){let r=e.length,a=!1;for(;r--;){const i=e[r][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 bj={tokenize:Nj,partial:!0};function vj(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Sj,continuation:{tokenize:Cj},exit:Ej}},text:{91:{name:"gfmFootnoteCall",tokenize:jj},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:wj,resolveTo:kj}}}}function wj(e,r,a){const i=this;let c=i.events.length;const u=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let d;for(;c--;){const x=i.events[c][1];if(x.type==="labelImage"){d=x;break}if(x.type==="gfmFootnoteCall"||x.type==="labelLink"||x.type==="label"||x.type==="image"||x.type==="link")break}return m;function m(x){if(!d||!d._balanced)return a(x);const f=Ir(i.sliceSerialize({start:d.end,end:i.now()}));return f.codePointAt(0)!==94||!u.includes(f.slice(1))?a(x):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),r(x))}}function kj(e,r){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)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},e[a+3][1].end),end:Object.assign({},e[a+3][1].end)};c.end.column++,c.end.offset++,c.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},c.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)},m=[e[a+1],e[a+2],["enter",i,r],e[a+3],e[a+4],["enter",c,r],["exit",c,r],["enter",u,r],["enter",d,r],["exit",d,r],["exit",u,r],e[e.length-2],e[e.length-1],["exit",i,r]];return e.splice(a,e.length-a+1,...m),e}function jj(e,r,a){const i=this,c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u=0,d;return m;function m(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),x}function x(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||qt(g))return a(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return c.includes(Ir(i.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):a(g)}return qt(g)||(d=!0),u++,e.consume(g),g===92?y:f}function y(g){return g===91||g===92||g===93?(e.consume(g),u++,f):f(g)}}function Sj(e,r,a){const i=this,c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u,d=0,m;return x;function x(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):a(S)}function y(S){if(d>999||S===93&&!m||S===null||S===91||qt(S))return a(S);if(S===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return u=Ir(i.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return qt(S)||(m=!0),d++,e.consume(S),S===92?g:y}function g(S){return S===91||S===92||S===93?(e.consume(S),d++,y):y(S)}function b(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),c.includes(u)||c.push(u),St(e,v,"gfmFootnoteDefinitionWhitespace")):a(S)}function v(S){return r(S)}}function Cj(e,r,a){return e.check(po,r,e.attempt(bj,r,a))}function Ej(e){e.exit("gfmFootnoteDefinition")}function Nj(e,r,a){const i=this;return St(e,c,"gfmFootnoteDefinitionIndent",5);function c(u){const d=i.events[i.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?r(u):a(u)}}function Aj(e){let a=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:u,resolveAll:c};return a==null&&(a=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function c(d,m){let x=-1;for(;++x<d.length;)if(d[x][0]==="enter"&&d[x][1].type==="strikethroughSequenceTemporary"&&d[x][1]._close){let f=x;for(;f--;)if(d[f][0]==="exit"&&d[f][1].type==="strikethroughSequenceTemporary"&&d[f][1]._open&&d[x][1].end.offset-d[x][1].start.offset===d[f][1].end.offset-d[f][1].start.offset){d[x][1].type="strikethroughSequence",d[f][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},d[f][1].start),end:Object.assign({},d[x][1].end)},g={type:"strikethroughText",start:Object.assign({},d[f][1].end),end:Object.assign({},d[x][1].start)},b=[["enter",y,m],["enter",d[f][1],m],["exit",d[f][1],m],["enter",g,m]],v=m.parser.constructs.insideSpan.null;v&&gr(b,b.length,0,ou(v,d.slice(f+1,x),m)),gr(b,b.length,0,[["exit",g,m],["enter",d[x][1],m],["exit",d[x][1],m],["exit",y,m]]),gr(d,f-1,x-f+3,b),x=f+b.length-2;break}}for(x=-1;++x<d.length;)d[x][1].type==="strikethroughSequenceTemporary"&&(d[x][1].type="data");return d}function u(d,m,x){const f=this.previous,y=this.events;let g=0;return b;function b(S){return f===126&&y[y.length-1][1].type!=="characterEscape"?x(S):(d.enter("strikethroughSequenceTemporary"),v(S))}function v(S){const j=qi(f);if(S===126)return g>1?x(S):(d.consume(S),g++,v);if(g<2&&!a)return x(S);const C=d.exit("strikethroughSequenceTemporary"),E=qi(S);return C._open=!E||E===2&&!!j,C._close=!j||j===2&&!!E,m(S)}}}class Tj{constructor(){this.map=[]}add(r,a,i){Dj(this,r,a,i)}consume(r){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(r.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),r.length=this.map[a][0];i.push(r.slice()),r.length=0;let c=i.pop();for(;c;){for(const u of c)r.push(u);c=i.pop()}this.map.length=0}}function Dj(e,r,a,i){let c=0;if(!(a===0&&i.length===0)){for(;c<e.map.length;){if(e.map[c][0]===r){e.map[c][1]+=a,e.map[c][2].push(...i);return}c+=1}e.map.push([r,a,i])}}function zj(e,r){let a=!1;const i=[];for(;r<e.length;){const c=e[r];if(a){if(c[0]==="enter")c[1].type==="tableContent"&&i.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(c[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const u=i.length-1;i[u]=i[u]==="left"?"center":"right"}}else if(c[1].type==="tableDelimiterRow")break}else c[0]==="enter"&&c[1].type==="tableDelimiterRow"&&(a=!0);r+=1}return i}function Rj(){return{flow:{null:{name:"table",tokenize:Mj,resolveAll:Fj}}}}function Mj(e,r,a){const i=this;let c=0,u=0,d;return m;function m(M){let G=i.events.length-1;for(;G>-1;){const J=i.events[G][1].type;if(J==="lineEnding"||J==="linePrefix")G--;else break}const O=G>-1?i.events[G][1].type:null,V=O==="tableHead"||O==="tableRow"?F:x;return V===F&&i.parser.lazy[i.now().line]?a(M):V(M)}function x(M){return e.enter("tableHead"),e.enter("tableRow"),f(M)}function f(M){return M===124||(d=!0,u+=1),y(M)}function y(M){return M===null?a(M):Ge(M)?u>1?(u=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),v):a(M):pt(M)?St(e,y,"whitespace")(M):(u+=1,d&&(d=!1,c+=1),M===124?(e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),d=!0,y):(e.enter("data"),g(M)))}function g(M){return M===null||M===124||qt(M)?(e.exit("data"),y(M)):(e.consume(M),M===92?b:g)}function b(M){return M===92||M===124?(e.consume(M),g):g(M)}function v(M){return i.interrupt=!1,i.parser.lazy[i.now().line]?a(M):(e.enter("tableDelimiterRow"),d=!1,pt(M)?St(e,S,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):S(M))}function S(M){return M===45||M===58?C(M):M===124?(d=!0,e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),j):I(M)}function j(M){return pt(M)?St(e,C,"whitespace")(M):C(M)}function C(M){return M===58?(u+=1,d=!0,e.enter("tableDelimiterMarker"),e.consume(M),e.exit("tableDelimiterMarker"),E):M===45?(u+=1,E(M)):M===null||Ge(M)?B(M):I(M)}function E(M){return M===45?(e.enter("tableDelimiterFiller"),N(M)):I(M)}function N(M){return M===45?(e.consume(M),N):M===58?(d=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(M),e.exit("tableDelimiterMarker"),_):(e.exit("tableDelimiterFiller"),_(M))}function _(M){return pt(M)?St(e,B,"whitespace")(M):B(M)}function B(M){return M===124?S(M):M===null||Ge(M)?!d||c!==u?I(M):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(M)):I(M)}function I(M){return a(M)}function F(M){return e.enter("tableRow"),X(M)}function X(M){return M===124?(e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),X):M===null||Ge(M)?(e.exit("tableRow"),r(M)):pt(M)?St(e,X,"whitespace")(M):(e.enter("data"),W(M))}function W(M){return M===null||M===124||qt(M)?(e.exit("data"),X(M)):(e.consume(M),M===92?U:W)}function U(M){return M===92||M===124?(e.consume(M),W):W(M)}}function Fj(e,r){let a=-1,i=!0,c=0,u=[0,0,0,0],d=[0,0,0,0],m=!1,x=0,f,y,g;const b=new Tj;for(;++a<e.length;){const v=e[a],S=v[1];v[0]==="enter"?S.type==="tableHead"?(m=!1,x!==0&&(z0(b,r,x,f,y),y=void 0,x=0),f={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},b.add(a,0,[["enter",f,r]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(i=!0,g=void 0,u=[0,0,0,0],d=[0,a+1,0,0],m&&(m=!1,y={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},b.add(a,0,[["enter",y,r]])),c=S.type==="tableDelimiterRow"?2:y?3:1):c&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(i=!1,d[2]===0&&(u[1]!==0&&(d[0]=d[1],g=Mc(b,r,u,c,void 0,g),u=[0,0,0,0]),d[2]=a)):S.type==="tableCellDivider"&&(i?i=!1:(u[1]!==0&&(d[0]=d[1],g=Mc(b,r,u,c,void 0,g)),u=d,d=[u[1],a,0,0])):S.type==="tableHead"?(m=!0,x=a):S.type==="tableRow"||S.type==="tableDelimiterRow"?(x=a,u[1]!==0?(d[0]=d[1],g=Mc(b,r,u,c,a,g)):d[1]!==0&&(g=Mc(b,r,d,c,a,g)),c=0):c&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(d[3]=a)}for(x!==0&&z0(b,r,x,f,y),b.consume(r.events),a=-1;++a<r.events.length;){const v=r.events[a];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=zj(r.events,a))}return e}function Mc(e,r,a,i,c,u){const d=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",m="tableContent";a[0]!==0&&(u.end=Object.assign({},Li(r.events,a[0])),e.add(a[0],0,[["exit",u,r]]));const x=Li(r.events,a[1]);if(u={type:d,start:Object.assign({},x),end:Object.assign({},x)},e.add(a[1],0,[["enter",u,r]]),a[2]!==0){const f=Li(r.events,a[2]),y=Li(r.events,a[3]),g={type:m,start:Object.assign({},f),end:Object.assign({},y)};if(e.add(a[2],0,[["enter",g,r]]),i!==2){const b=r.events[a[2]],v=r.events[a[3]];if(b[1].end=Object.assign({},v[1].end),b[1].type="chunkText",b[1].contentType="text",a[3]>a[2]+1){const S=a[2]+1,j=a[3]-a[2]-1;e.add(S,j,[])}}e.add(a[3]+1,0,[["exit",g,r]])}return c!==void 0&&(u.end=Object.assign({},Li(r.events,c)),e.add(c,0,[["exit",u,r]]),u=void 0),u}function z0(e,r,a,i,c){const u=[],d=Li(r.events,a);c&&(c.end=Object.assign({},d),u.push(["exit",c,r])),i.end=Object.assign({},d),u.push(["exit",i,r]),e.add(a+1,0,u)}function Li(e,r){const a=e[r],i=a[0]==="enter"?"start":"end";return a[1][i]}const _j={name:"tasklistCheck",tokenize:Bj};function Oj(){return{text:{91:_j}}}function Bj(e,r,a){const i=this;return c;function c(x){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?a(x):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(x),e.exit("taskListCheckMarker"),u)}function u(x){return qt(x)?(e.enter("taskListCheckValueUnchecked"),e.consume(x),e.exit("taskListCheckValueUnchecked"),d):x===88||x===120?(e.enter("taskListCheckValueChecked"),e.consume(x),e.exit("taskListCheckValueChecked"),d):a(x)}function d(x){return x===93?(e.enter("taskListCheckMarker"),e.consume(x),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),m):a(x)}function m(x){return Ge(x)?r(x):pt(x)?e.check({tokenize:$j},r,a)(x):a(x)}}function $j(e,r,a){return St(e,i,"whitespace");function i(c){return c===null?a(c):r(c)}}function Lj(e){return Oy([uj(),vj(),Aj(e),Rj(),Oj()])}const Hj={};function Qh(e){const r=this,a=e||Hj,i=r.data(),c=i.micromarkExtensions||(i.micromarkExtensions=[]),u=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),d=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);c.push(Lj(a)),u.push(ij()),d.push(sj(a))}function go({content:e,className:r=""}){return s.jsx("div",{className:`office-markdown ${r}`,children:s.jsx(Yh,{remarkPlugins:[Qh],components:{code:Ij,table:({children:a})=>s.jsx("div",{className:"overflow-x-auto my-2",children:s.jsx("table",{className:"office-table",children:a})})},children:e})})}function Ij({className:e,children:r,...a}){const i=/language-(\w+)/.exec(e??"");return i||typeof r=="string"&&r.includes(`
|
|
79
|
+
`)?s.jsx(Uj,{language:i==null?void 0:i[1],children:r}):s.jsx("code",{className:"bg-gray-100 text-gray-700 px-1 py-0.5 rounded text-[0.9em] font-mono",...a,children:r})}function Uj({children:e,language:r}){const[a,i]=w.useState(!1),c=String(e).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(c),i(!0),setTimeout(()=>i(!1),1500)};return s.jsxs("div",{className:"office-code-block group relative my-2",children:[r&&s.jsx("div",{className:"text-[10px] text-gray-400 px-3 pt-1.5",children:r}),s.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"}),s.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:s.jsx("code",{children:c})})]})}const R0={$skin:"skinColor",$hair:"hairColor",$shirt:"shirtColor",$pants:"pantsColor",$shoes:"shoeColor"},qj=/^(darken|lighten)\((\$\w+),\s*(\d+)\)$/;function Yj(e,r){const a=parseInt(e.replace("#",""),16),i=Math.max(0,(a>>16&255)-r),c=Math.max(0,(a>>8&255)-r),u=Math.max(0,(a&255)-r);return`#${(i<<16|c<<8|u).toString(16).padStart(6,"0")}`}function Xj(e,r){const a=parseInt(e.replace("#",""),16),i=Math.min(255,(a>>16&255)+r),c=Math.min(255,(a>>8&255)+r),u=Math.min(255,(a&255)+r);return`#${(i<<16|c<<8|u).toString(16).padStart(6,"0")}`}function Eg(e,r){const a=R0[e];if(a&&r)return r[a];const i=qj.exec(e);if(i){const[,c,u,d]=i,m=R0[u],x=m&&r?r[m]:u,f=parseInt(d,10);return c==="darken"?Yj(x,f):Xj(x,f)}return e}function M0(e,r=12){return e.map(a=>({...a,x:r-a.x-a.w}))}function Vj(e,r){return r==="down"?e.down:r==="up"&&e.up?e.up:r==="left"&&e.left?e.left:r==="right"&&e.right?e.right:r==="right"&&e.left?{name:e.left.name,pixels:M0(e.left.pixels)}:r==="left"&&e.right?{name:e.right.name,pixels:M0(e.right.pixels)}:e.down}function Gj(e,r){return yh(e,"hair",r,1)}function yh(e,r,a,i){const c=e.layers.findIndex(d=>d.name===r),u=[...e.layers];if(c>=0)u[c]={...a,name:r};else{const d=i??u.length;u.splice(d,0,{...a,name:r})}return{...e,layers:u}}const Wh=new Map,Kh=new Map;function Ng(e,r){Wh.set(e,r)}function fu(e,r){Kh.set(e,r)}function gh(e){return Wh.get(e)}function Qj(e){return Kh.get(e)}function p6(){return Array.from(Wh.keys())}function y6(){return Array.from(Kh.keys())}function Wj(e,r,a,i,c=2){e.clearRect(0,0,r.width*c,r.height*c);for(const u of r.layers)Ag(e,u.pixels,c,a,i)}function Ui(e,r,a,i,c){for(const u of r){const d=Eg(u.c,c);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 Kj(e,r){const a=r.scale;e.clearRect(0,0,r.canvasWidth,r.canvasHeight),Ag(e,r.pixels,a,0)}function Ag(e,r,a,i,c){for(const u of r){const d=Eg(u.c,c);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 tu=new Map;function wl(e,r,a){if("down"in a&&!("pixels"in a)){const c=a;tu.set(e,{id:e,name:r,layer:{...c.down,name:"hair"},directions:{down:{...c.down,name:"hair"},up:c.up?{...c.up,name:"hair"}:void 0,left:c.left?{...c.left,name:"hair"}:void 0,right:c.right?{...c.right,name:"hair"}:void 0}})}else{const c=a;tu.set(e,{id:e,name:r,layer:{...c,name:"hair"}})}}function Zj(e){return tu.get(e)}function Tg(){return Array.from(tu.values())}wl("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}]}});wl("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}]}});wl("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}]}});wl("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}]}});wl("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"}]}});wl("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}]}});wl("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}]}});wl("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 nu=new Map;function sa(e,r,a){if("down"in a&&!("pixels"in a)){const c=a;nu.set(e,{id:e,name:r,layer:{...c.down,name:"torso"},directions:{down:{...c.down,name:"torso"},up:c.up?{...c.up,name:"torso"}:void 0,left:c.left?{...c.left,name:"torso"}:void 0,right:c.right?{...c.right,name:"torso"}:void 0}})}else{const c=a;nu.set(e,{id:e,name:r,layer:{...c,name:"torso"}})}}function Pj(e){return nu.get(e)}function Dg(){return Array.from(nu.values())}sa("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"}]}});sa("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"}]}});sa("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"}]}});sa("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)"}]}});sa("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)"}]}});sa("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"}]}});sa("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"}]}});sa("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"}]}});sa("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"}]}});sa("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 co=new Map;function zt(e,r,a){if("down"in a&&!("pixels"in a)){const c=a;co.set(e,{id:e,name:r,layer:{...c.down,name:"accessory"},directions:{down:{...c.down,name:"accessory"},up:c.up?{...c.up,name:"accessory"}:void 0,left:c.left?{...c.left,name:"accessory"}:void 0,right:c.right?{...c.right,name:"accessory"}:void 0}})}else{const c=a;co.set(e,{id:e,name:r,layer:{...c,name:"accessory"}})}}function Jj(e){return co.get(e)}function eS(e,r){const a=co.get(e);if(!a)return;if(a.directions)return Vj(a.directions,r);if(r==="down")return a.layer;const i=a.layer.pixels.filter(u=>u.y<2);if(i.length===0)return;const c=r==="right"?1:r==="left"?-1:0;return{name:a.layer.name,pixels:c?i.map(u=>({...u,x:u.x+c})):i}}function zg(){return Array.from(co.values())}zt("none","None",{name:"accessory",pixels:[]});zt("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}]}});zt("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}]}});zt("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}]}});zt("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}]}});zt("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}]}});zt("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}]}});zt("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}]}});zt("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}]}});zt("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}]}});zt("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}]}});zt("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}]}});zt("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"}]}});zt("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}]}});zt("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}]}});zt("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"}]}});zt("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}]}});zt("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}]}});zt("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}]}});zt("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}]}});zt("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"}]}});zt("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}]}});zt("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}]}});zt("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}]}});zt("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}]}});zt("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"}]}});zt("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"}]}});zt("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}]}});zt("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}]}});zt("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 tS={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 Rg(e){return tS[e]??1}function Mg(e,r){return r>=Rg(e)}zt("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 Qs({r:e,g:r,b:a}){return`#${(e<<16|r<<8|a).toString(16).padStart(6,"0")}`}function Vc(e,r){const a=e.r-r.r,i=e.g-r.g,c=e.b-r.b;return a*a+i*i+c*c}function nS(e,r){const a=[];a.push(e[Math.floor(Math.random()*e.length)]);for(let i=1;i<r;i++){const c=e.map(m=>{let x=1/0;for(const f of a)x=Math.min(x,Vc(m,f));return x}),u=c.reduce((m,x)=>m+x,0);let d=Math.random()*u;for(let m=0;m<e.length;m++)if(d-=c[m],d<=0){a.push(e[m]);break}a.length<=i&&a.push(e[Math.floor(Math.random()*e.length)])}return a}function rS(e,r,a=20){if(e.length===0)return[];const i=nS(e,r);for(let u=0;u<a;u++){const d=Array.from({length:r},()=>[]);for(const x of e){let f=1/0,y=0;for(let g=0;g<r;g++){const b=Vc(x,i[g]);b<f&&(f=b,y=g)}d[y].push(x)}let m=!0;for(let x=0;x<r;x++){if(d[x].length===0)continue;const f={r:0,g:0,b:0};for(const b of d[x])f.r+=b.r,f.g+=b.g,f.b+=b.b;const y=d[x].length,g={r:Math.round(f.r/y),g:Math.round(f.g/y),b:Math.round(f.b/y)};Vc(g,i[x])>1&&(m=!1),i[x]=g}if(m)break}const c=new Array(r).fill(0);for(const u of e){let d=1/0,m=0;for(let x=0;x<r;x++){const f=Vc(u,i[x]);f<d&&(d=f,m=x)}c[m]++}return i.map((u,d)=>({c:u,count:c[d]})).sort((u,d)=>d.count-u.count).map(u=>u.c)}function aS(e,r=1e4){const a=document.createElement("canvas"),i=e instanceof HTMLImageElement?e.naturalWidth:e.width,c=e instanceof HTMLImageElement?e.naturalHeight:e.height;a.width=i,a.height=c;const u=a.getContext("2d");u.drawImage(e,0,0);const d=u.getImageData(0,0,i,c).data,m=i*c,x=Math.max(1,Math.floor(m/r)),f=[];for(let y=0;y<m;y+=x){const g=y*4;d[g+3]<128||f.push({r:d[g],g:d[g+1],b:d[g+2]})}return f}function F0(e){return .299*e.r+.587*e.g+.114*e.b}function _0(e){const r=Math.max(e.r,e.g,e.b),a=Math.min(e.r,e.g,e.b);return r===0?0:(r-a)/r*255}function lS(e,r=8){const a=aS(e),i=rS(a,r);if(i.length<5)return{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121"};const c=[...i].sort((g,b)=>F0(b)-F0(g)),u=[...i].sort((g,b)=>_0(b)-_0(g)),d=c[0],m=c[c.length-1],x=u[0],f=c[c.length-2],y=c[c.length-1];return{skinColor:Qs(d),hairColor:Qs(m),shirtColor:Qs(x),pantsColor:Qs(f),shoeColor:Qs(y)}}const iS=[{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}],sS=[{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"}],oS=[{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"}],cS=[{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 uS(){return{width:12,height:22,layers:[{name:"lower",pixels:iS},{name:"torso",pixels:sS},{name:"head",pixels:oS},{name:"hair",pixels:cS},{name:"accessory",pixels:[]}]}}const dS=["cto","cbo","pm","engineer","designer","qa","data-analyst","default"];for(const e of dS)Ng(`mini:${e}`,uS());const fS=[{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"}],hS=[{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"}],mS=[{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 xS(){return{width:12,height:22,layers:[{name:"torso",pixels:fS},{name:"head",pixels:hS},{name:"hair",pixels:mS},{name:"accessory",pixels:[]}]}}Ng("mini-seated:default",xS());const pS={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"}]},yS={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"}]},gS={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"}]},bS={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"}]};fu("meeting",pS);fu("bulletin",yS);fu("decision",bS);fu("knowledge",gS);const $f=16,Lf=24,vS=60,wS={cbo:0,cto:8,pm:15,engineer:22,designer:5,qa:12};function Fg(e,r){if(!e)return e;let a=e;if(r!=null&&r.hairStyle){const i=Zj(r.hairStyle);i&&(a=Gj(a,i.layer))}if(r!=null&&r.outfitStyle){const i=Pj(r.outfitStyle);i&&(a=yh(a,"torso",i.layer,1))}if(r!=null&&r.accessory&&r.accessory!=="none"){const i=Jj(r.accessory);i&&(a=yh(a,"accessory",i.layer))}return a}function uo({roleId:e,className:r,appearance:a,scale:i}){const c=w.useRef(null),u=w.useRef(0),d=w.useRef(0),m=w.useRef(a);m.current=a;const x=i??4,f=$f*x,y=Lf*x,g=w.useMemo(()=>{const b=gh(`mini:${e}`)??gh("mini:default");return Fg(b,a)},[e,a==null?void 0:a.hairStyle,a==null?void 0:a.outfitStyle,a==null?void 0:a.accessory]);return w.useEffect(()=>{const b=c.current;if(!b)return;const v=b.getContext("2d");if(!v)return;const S=wS[e]??0,j=()=>{d.current++;const C=m.current;if(!C||!g){u.current=requestAnimationFrame(j);return}const N=(d.current+S)%vS<30?1:0;v.clearRect(0,0,$f,Lf),v.save(),v.translate(2,1),Wj(v,g,N,C,1),v.restore(),u.current=requestAnimationFrame(j)};return u.current=requestAnimationFrame(j),()=>cancelAnimationFrame(u.current)},[e,g]),s.jsx("canvas",{ref:c,width:$f,height:Lf,className:r,style:{imageRendering:"pixelated",display:"block",width:f,height:y}})}const kS="https://api.tycono.ai",Zh=kS;async function Ws(e){const r=await fetch(`${Zh}${e}`);if(!r.ok)throw new Error(`Cloud API error: ${r.status}`);return r.json()}async function Ul(e,r){const a=await fetch(`${Zh}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok)throw new Error(`Cloud API error: ${a.status}`);return a.json()}const rr={health:()=>Ws("/api/health"),getMyName:e=>Ws(`/api/auth/my-name?instance_id=${encodeURIComponent(e)}`),getCharacters:e=>{const r=new URLSearchParams;e!=null&&e.sort&&r.set("sort",e.sort),e!=null&&e.instanceId&&r.set("instance_id",e.instanceId);const a=r.toString();return Ws(`/api/store/characters${a?`?${a}`:""}`)},getCharacter:e=>Ws(`/api/store/characters/${e}`),getCharacterVersion:e=>Ws(`/api/store/characters/${e}/version`),voteCharacter:(e,r,a)=>Ul(`/api/store/characters/${e}/vote`,{instanceId:r,vote:a}),trackInstall:e=>Ul(`/api/store/characters/${e}/install`,{}),syncCheck:e=>Ul("/api/sync/check",{roles:e}),syncPull:e=>Ul("/api/sync/pull",{sourceId:e}),publishCharacter:e=>Ul("/api/store/publish",e),deleteCharacter:(e,r)=>{const a=r?`?publisher_id=${encodeURIComponent(r)}`:"";return fetch(`${Zh}/api/store/characters/${e}${a}`,{method:"DELETE"}).then(i=>i.json())},uploadTelemetry:e=>Ul("/api/telemetry",e),syncStats:e=>Ul("/api/stats/sync",e)},jS={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"},Hf={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},SS={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},CS=500,O0=360,B0=700,ES=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`;function NS({role:e,allRoles:r,recentActivity:a,onClose:i,onFireRole:c,terminalWidth:u=0,activeJobId:d,activeTask:m,isWorking:x,jobStartedAt:f,onStopJob:y,sessions:g,streamingSessionId:b,onCreateSessionSilent:v,onSendMessage:S,onFocusTerminal:j,onCustomize:C,onUpdateRole:E,appearance:N,relationships:_,roleLevel:B}){var De,He;const[I,F]=w.useState(CS),[X,W]=w.useState(!1),U=w.useRef(0),M=w.useRef(0),[G,O]=w.useState(!1),[V,J]=w.useState(!1),[Q,H]=w.useState(!1),[Y,ne]=w.useState(!1),[we,T]=w.useState("talk"),[z,Z]=w.useState(!1),[D,xe]=w.useState(""),[Ce,ge]=w.useState(!1),Me=w.useRef(null),{events:Ee,status:Ie}=wy(d??null),[oe,at]=w.useState(0);w.useEffect(()=>{if(!x||!f){at(0);return}const de=new Date(f).getTime(),Te=()=>at(Math.floor((Date.now()-de)/1e3));Te();const wt=setInterval(Te,1e3);return()=>clearInterval(wt)},[x,f]);const Ct=u>0,jt=Ct?u:0,Vt=Ct?Math.max(O0,window.innerWidth-u-100):B0,pe=Math.min(I,Vt),he=w.useCallback(de=>{de.preventDefault(),U.current=de.clientX,M.current=pe,W(!0);const Te=it=>{const rt=U.current-it.clientX,yt=Math.min(B0,Math.max(O0,M.current+rt));F(yt)},wt=()=>{W(!1),document.removeEventListener("mousemove",Te),document.removeEventListener("mouseup",wt)};document.addEventListener("mousemove",Te),document.addEventListener("mouseup",wt)},[pe]),ke=w.useRef(null),Ae=e?g.find(de=>de.roleId===e.id):null,Fe=de=>{if(!e)return;const Te=x?"talk":we;Ae?(S(Ae.id,de,Te),j(e.id)):(ke.current={content:de,mode:Te},v(e.id))};w.useEffect(()=>{if(Ae&&ke.current){const{content:de,mode:Te}=ke.current;ke.current=null,S(Ae.id,de,Te),e&&j(e.id)}},[Ae==null?void 0:Ae.id]);const Re=(()=>{if(!Ee.length)return null;const de=[];let Te=0,wt=0,it=0;for(const rt of Ee)if(rt.type==="thinking")Te++;else if(rt.type==="text")wt++;else if(rt.type==="tool:start"){const yt=String(rt.data.name??"");de.includes(yt)||de.push(yt)}else rt.type==="dispatch:start"&&it++;return{tools:de,thinkCount:Te,textCount:wt,dispatchCount:it,total:Ee.length}})(),Ne=m||(()=>{if(!Ae)return null;const de=Ae.messages;for(let Te=de.length-1;Te>=0;Te--)if(de[Te].from==="ceo")return de[Te].content;return null})(),ze=(()=>{if(!Ae)return null;const de=Ae.messages;for(let Te=de.length-1;Te>=0;Te--)if(de[Te].from==="role"&&de[Te].content)return de[Te].content;return null})();if(!e)return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:jt},onClick:i}),s.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px]",style:{right:jt,width:pe,background:"var(--terminal-bg)",borderLeftColor:"var(--pixel-border)"},children:s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading role..."})})]});const Pe=Hf[e.id]??"#666",_e=jS[e.id]??"👤",et=r.filter(de=>de.reportsTo===e.id),re=Ae&&b===Ae.id,ye=e.name||SS[e.id]||e.id;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:jt},onClick:i}),s.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)] ${X?"resizing":""}`,style:{borderLeftColor:Pe,right:jt,width:pe,background:"var(--terminal-bg)"},children:[s.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${X?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:he}),s.jsxs("div",{className:"relative shrink-0 overflow-hidden",style:{background:`linear-gradient(135deg, ${Pe}ee, ${Pe}99)`},children:[s.jsx("div",{className:"absolute inset-0 opacity-[0.06]",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 8px, white 8px, white 9px)"}}),s.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-1.5 z-10",children:[C&&s.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:"🎨"}),s.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:"×"})]}),s.jsxs("div",{className:"relative flex items-end gap-4 px-4 pt-4 pb-3",children:[s.jsx("div",{className:"shrink-0 relative",style:{marginBottom:-2},children:s.jsx("div",{className:"rounded-lg p-1",style:{background:"rgba(0,0,0,0.2)"},children:s.jsx(uo,{roleId:e.id,appearance:N,scale:8})})}),s.jsxs("div",{className:"flex-1 min-w-0 text-white pb-1",children:[s.jsxs("div",{className:"text-lg font-bold flex items-center gap-2",style:{fontFamily:"var(--pixel-font)"},children:[_e," ",e.id.toUpperCase(),x&&s.jsx("span",{className:"text-[9px] font-semibold px-2 py-0.5 rounded-full animate-pulse",style:{background:"rgba(251,191,36,0.25)",color:"#fde68a"},children:"WORKING"})]}),z?s.jsxs("form",{className:"flex items-center gap-1.5 mt-0.5",onSubmit:async de=>{de.preventDefault();const Te=D.trim();if(!Te||Te===ye||!E){Z(!1);return}ge(!0);try{await E(e.id,{name:Te})}catch{}ge(!1),Z(!1)},children:[s.jsx("input",{ref:Me,value:D,onChange:de=>xe(de.target.value),onKeyDown:de=>{de.key==="Escape"&&Z(!1)},disabled:Ce,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"}}),s.jsx("button",{type:"submit",disabled:Ce,className:"text-white/80 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✓"}),s.jsx("button",{type:"button",onClick:()=>Z(!1),className:"text-white/60 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✕"})]}):s.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&&(xe(ye),Z(!0))},title:E?"Click to edit name":void 0,children:[ye,E&&s.jsx("span",{className:"opacity-0 group-hover/name:opacity-60 text-[10px]",children:"✎"})]})]})]}),s.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:[s.jsxs("span",{children:["Lv.",B??1]}),s.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:x?"var(--idle-amber)":"var(--active-green)"}}),x?"Working":"Idle"]}),s.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),s.jsx("span",{children:e.level}),e.reportsTo&&s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),s.jsxs("span",{className:"opacity-60",children:["→"," ",e.reportsTo]})]})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:[x&&s.jsxs("div",{className:"px-4 py-3 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"var(--idle-amber)"}}),s.jsxs("span",{className:"text-xs font-semibold",style:{color:"var(--idle-amber)"},children:["Working",oe>0?` · ${ES(oe)}`:""]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>j(e.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"}),d&&y&&s.jsx("button",{onClick:()=>y(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"})]})]}),Ne&&s.jsx("div",{className:"text-xs truncate",style:{color:"var(--terminal-text-secondary)"},children:Ne})]}),x&&d&&Re&&s.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Activity"}),s.jsx("button",{onClick:()=>j(e.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"View details ↗"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[Re.thinkCount>0&&s.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:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:"#a855f7"}}),"thinking ×",Re.thinkCount]}),Re.tools.map(de=>s.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa"},children:de},de)),Re.dispatchCount>0&&s.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(249,115,22,0.15)",color:"#fb923c"},children:["dispatch ×",Re.dispatchCount]}),Re.textCount>0&&s.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(34,197,94,0.15)",color:"#4ade80"},children:["output ×",Re.textCount]}),(Ie==="streaming"||Ie==="connecting")&&s.jsx("span",{className:"inline-block w-1.5 h-3 animate-pulse rounded-sm",style:{background:"var(--active-green)"}})]}),s.jsxs("div",{className:"text-[10px] mt-1",style:{color:"var(--terminal-text-muted)"},children:[Re.total," events"]})]}),x&&ze&&s.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Last Message"}),s.jsx("button",{onClick:()=>j(e.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"})]}),s.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:[ze.slice(0,200),ze.length>200&&"..."]})]}),x&&s.jsx("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:s.jsx($0,{onSend:Fe,disabled:!!re,placeholder:"Ask something...",color:Pe})}),!x&&s.jsxs("div",{className:"px-4 pt-4 pb-2",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-secondary)"},children:"Latest"}),s.jsx(TS,{icon:_e,roleId:e.id,roleName:ye,color:Pe,text:a})]}),!x&&s.jsx("div",{className:"px-4 py-3",style:{borderBottom:"1px solid var(--terminal-border)"},children:s.jsxs("div",{className:"rounded-xl overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[ze&&s.jsxs("div",{className:"px-3 pt-2.5 pb-2 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--terminal-border)"},onClick:()=>j(e.id),children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Last response"}),s.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"View ↗"})]}),s.jsxs("div",{className:"text-xs leading-relaxed line-clamp-2 overflow-hidden",style:{color:"var(--terminal-text-secondary)"},children:[ze.slice(0,150),ze.length>150&&"..."]})]}),s.jsx("div",{className:"p-2",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex rounded-lg overflow-hidden shrink-0",style:{border:"1px solid var(--pixel-border)"},children:[s.jsx("button",{onClick:()=>T("talk"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:we==="talk"?"var(--accent)":"transparent",color:we==="talk"?"#fff":"var(--terminal-text-secondary)"},children:"Talk"}),s.jsx("button",{onClick:()=>T("do"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:we==="do"?"var(--idle-amber)":"transparent",color:we==="do"?"#fff":"var(--terminal-text-secondary)"},children:"Do"})]}),s.jsx($0,{onSend:Fe,disabled:!!re,placeholder:we==="talk"?"Ask something...":"Give a directive...",color:Pe})]})})]})}),s.jsxs("div",{className:"px-4 py-2 space-y-1",children:[s.jsxs(Fc,{title:`Profile${e.persona?"":" (empty)"}`,open:G,onToggle:()=>O(de=>!de),children:[e.persona&&s.jsx("div",{className:"text-xs leading-relaxed rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:e.persona}),s.jsxs("div",{className:"space-y-0 mt-2",children:[s.jsx(If,{label:"Level",value:e.level}),s.jsx(If,{label:"Reports to",value:e.reportsTo}),s.jsx(If,{label:"Status",value:e.status})]}),et.length>0&&s.jsxs("div",{className:"mt-3",children:[s.jsx("div",{className:"text-[11px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Direct Reports"}),s.jsx("div",{className:"space-y-1",children:et.map(de=>s.jsxs("div",{className:"flex items-center gap-2 p-1.5 rounded-lg",style:{background:"var(--hud-bg-alt)"},children:[s.jsx("div",{className:"w-6 h-6 rounded flex items-center justify-center text-white text-[10px] font-bold",style:{background:Hf[de.id]??"#666"},children:de.id.slice(0,2).toUpperCase()}),s.jsx("div",{className:"text-xs",style:{color:"var(--terminal-text)"},children:de.name})]},de.id))})]})]}),e.authority&&s.jsxs(Fc,{title:"Authority",open:V,onToggle:()=>J(de=>!de),children:[((De=e.authority.autonomous)==null?void 0:De.length)>0&&s.jsxs("div",{className:"mb-2",children:[s.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--active-green)"},children:"Autonomous"}),e.authority.autonomous.map((de,Te)=>s.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",de]},Te))]}),((He=e.authority.needsApproval)==null?void 0:He.length)>0&&s.jsxs("div",{children:[s.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--idle-amber)"},children:"Needs Approval"}),e.authority.needsApproval.map((de,Te)=>s.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",de]},Te))]})]}),e&&_&&(()=>{const de=_.filter(Te=>Te.roleA===e.id||Te.roleB===e.id).filter(Te=>Te.familiarity>0).sort((Te,wt)=>wt.familiarity-Te.familiarity);return de.length===0?null:s.jsx(Fc,{title:`Relationships (${de.length})`,open:Q,onToggle:()=>H(Te=>!Te),children:s.jsx("div",{className:"space-y-1.5",children:de.map((Te,wt)=>{const it=Te.roleA===e.id?Te.roleB:Te.roleA,rt=r.find(bn=>bn.id===it),yt=Te.familiarity>=80?"Best Partner":Te.familiarity>=50?"Friend":Te.familiarity>=20?"Colleague":"Acquaintance",st=Te.familiarity>=80?"#4CAF50":Te.familiarity>=50?"#2196F3":Te.familiarity>=20?"#FF9800":"#9E9E9E";return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs w-20 truncate",style:{color:Hf[it]??"var(--terminal-text-secondary)"},children:(rt==null?void 0:rt.name)??it}),s.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-white/10",children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Te.familiarity}%`,background:st}})}),s.jsx("span",{className:"text-[10px] w-16 text-right",style:{color:"var(--terminal-text-muted)"},children:yt})]},wt)})})})})(),e.journal&&s.jsx(Fc,{title:`Journal (${(e.journal.match(/### /g)??[]).length})`,open:Y,onToggle:()=>ne(de=>!de),children:s.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:[s.jsx(go,{content:e.journal.slice(0,3e3)}),e.journal.length>3e3&&s.jsx("div",{className:"italic mt-2",style:{color:"var(--terminal-text-muted)"},children:"... (truncated)"})]})})]}),s.jsx(AS,{role:e,appearance:N}),c&&s.jsx("div",{className:"px-4 pb-4 mt-auto shrink-0",children:s.jsx("button",{onClick:()=>{c(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 AS({role:e,appearance:r}){const[a,i]=w.useState("idle"),[c,u]=w.useState(""),[d,m]=w.useState(!1),[x,f]=w.useState(null),[y,g]=w.useState(!1),[b,v]=w.useState(!1),[S,j]=w.useState(null);w.useEffect(()=>{rr.getCharacterVersion(e.id).then(N=>f((N==null?void 0:N.version)??null)).catch(()=>f(null)),Se.getPreferences().then(N=>j(N.instanceId??null)).catch(()=>{})},[e.id]);const C=async()=>{var N,_;if(!d){m(!0);return}i("publishing");try{let B=null;try{B=await Se.exportSkills(e.id)}catch{}const I={roleId:e.id,persona:e.persona??"",authority:e.authority??{autonomous:[],needsApproval:[]},level:e.level,tagline:((N=(e.persona??"").split(/[.\n]/)[0])==null?void 0:N.trim().slice(0,80))||e.name,chatStyle:"Professional and focused",skills:B??[],resume:{summary:((_=e.persona)==null?void 0:_.split(`
|
|
80
|
+
`)[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:""};r&&(I.appearance=r);let F="1.0.0";try{const X=await rr.getCharacterVersion(e.id);if(X!=null&&X.version){const W=X.version.split(".").map(Number);W[2]=(W[2]??0)+1,F=W.join(".")}}catch{}await rr.publishCharacter({id:e.id,name:e.name||e.id,version:F,data:I,publisherId:S??void 0}),i("done"),u(`Published v${F}`),f(F),m(!1)}catch(B){i("error"),u(B instanceof Error?B.message:"Failed"),m(!1)}},E=async()=>{v(!0);try{await rr.deleteCharacter(e.id,S??void 0),f(null),i("idle"),u(""),g(!1)}catch{u("Delete failed")}v(!1)};return s.jsx("div",{className:"px-4 pb-2 shrink-0",children:s.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:s.jsxs("div",{className:"px-3 py-2.5 flex items-center justify-between gap-2",style:{background:"var(--hud-bg-alt)"},children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.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"}),x&&s.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",x]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[a==="done"?s.jsxs(s.Fragment,{children:[s.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:N=>N.stopPropagation(),children:"View on Store ↗"}),s.jsx("span",{className:"text-[10px] font-semibold",style:{color:"var(--active-green)"},children:c})]}):a==="error"?s.jsx("span",{className:"text-[10px] font-semibold",style:{color:"#ef4444"},children:c}):s.jsx("button",{onClick:C,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?":x?"Update":"Publish"}),x&&!y&&s.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:"✕"}),y&&s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:E,disabled:b,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:b?"...":"Delete"}),s.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 TS({icon:e,roleId:r,roleName:a,color:i,text:c}){const u=!!c;return s.jsx("div",{className:"relative",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsxs("div",{className:"shrink-0",children:[s.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}),s.jsx("div",{className:"text-[9px] font-bold text-center mt-0.5 uppercase tracking-wide",style:{color:i},children:r})]}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsxs("div",{className:"relative",children:[s.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`}}),s.jsxs("div",{className:"rounded-xl rounded-tl-sm p-4 border",style:{background:`${i}08`,borderColor:`${i}22`},children:[s.jsx("div",{className:"text-[10px] font-semibold mb-1.5 uppercase tracking-wider",style:{color:i},children:a}),u?s.jsx("div",{className:"text-sm leading-relaxed",style:{color:"var(--terminal-text)"},children:s.jsx(go,{content:c})}):s.jsx("div",{className:"text-sm italic",style:{color:"var(--terminal-text-muted)"},children:"No recent activity."})]})]})})]})})}function Fc({title:e,open:r,onToggle:a,children:i}){return s.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:[s.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:[s.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:e}),s.jsx("span",{className:"text-[10px] transition-transform",style:{color:"var(--terminal-text-muted)",transform:r?"rotate(0deg)":"rotate(-90deg)"},children:"▼"})]}),r&&s.jsx("div",{className:"px-3 pb-3 pt-2",style:{borderTop:"1px solid var(--terminal-border)"},children:i})]})}function $0({onSend:e,disabled:r,placeholder:a,color:i}){const[c,u]=w.useState(""),d=()=>{const m=c.trim();!m||r||(e(m),u(""))};return s.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[s.jsx("input",{type:"text",value:c,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),d())},placeholder:r?"Waiting...":a,disabled:r,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)"}}),s.jsx("button",{onClick:d,disabled:r||!c.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:r||!c.trim()?"#666":i},children:s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M22 2L11 13"}),s.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})}function If({label:e,value:r}){return s.jsxs("div",{className:"flex justify-between py-1.5 text-xs",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:e}),s.jsx("span",{className:"font-semibold",style:{color:"var(--terminal-text)"},children:r})]})}const fo=[{id:"ch1-q1",chapter:1,title:"Hire your first employee",description:"Open the Hire menu and bring a PM on board.",type:"main",trigger:{type:"role_hired"},rewards:{nextQuest:"ch2-q1"},hint:{target:"hire-button",message:"Click HIRE to recruit your first team member"}},{id:"ch2-q1",chapter:2,title:"Create a project",description:"Head to the Meeting Room and start a new project.",type:"main",trigger:{type:"project_created"},rewards:{nextQuest:"ch2-q2"},hint:{target:"meeting-room",message:"Click the Meeting Room to create a project"}},{id:"ch2-q2",chapter:2,title:"Give your first order",description:"Select a role in the terminal and send them a task.",type:"main",trigger:{type:"task_executed"},rewards:{badge:"first-launch",nextQuest:"ch3-q1"},hint:{target:"terminal",message:"Open the terminal and talk to your team"}},{id:"ch3-q1",chapter:3,title:"Hire a CTO",description:"Your company needs technical leadership. Hire a CTO.",type:"main",trigger:{type:"role_hired",condition:{roleId:"cto"}},rewards:{nextQuest:"ch3-q2"},hint:{target:"hire-button",message:"Hire a CTO to lead your tech team"}},{id:"ch3-q2",chapter:3,title:"Request architecture design",description:"Ask your CTO to design the system architecture.",type:"main",trigger:{type:"task_executed",condition:{roleId:"cto"}},rewards:{nextQuest:"ch4-q1"},hint:{target:"terminal-btn",message:"Open the terminal and talk to your CTO"}},{id:"ch4-q1",chapter:4,title:"Hire an Engineer",description:"Time to build. Bring an Engineer onto the team.",type:"main",trigger:{type:"role_hired",condition:{roleId:"engineer"}},rewards:{nextQuest:"ch4-q2"},hint:{target:"hire-btn",message:"Hire an Engineer to start building"}},{id:"ch4-q2",chapter:4,title:"Dispatch a Wave",description:"Use CEO Wave to broadcast a directive to your whole team.",type:"main",trigger:{type:"wave_dispatched"},rewards:{badge:"team-builder",nextQuest:"ch5-q1"},hint:{target:"wave-button",message:"Click CEO WAVE to dispatch your first wave"}},{id:"ch5-q1",chapter:5,title:"Visit the Character Store",description:"Check out community characters in the Store.",type:"main",trigger:{type:"store_visited"},rewards:{nextQuest:"ch5-q2"},hint:{target:"hire-btn",message:"Open HIRE and check out the Store tab"}},{id:"ch5-q2",chapter:5,title:"Customize a character",description:"Give one of your team members a new look.",type:"main",trigger:{type:"accessory_changed"},rewards:{badge:"explorer"},hint:{target:"hire-btn",message:"Click a team member to customize their look"}}],ru=[{num:1,title:"First Hire",questIds:["ch1-q1"]},{num:2,title:"First Project",questIds:["ch2-q1","ch2-q2"]},{num:3,title:"Tech Leadership",questIds:["ch3-q1","ch3-q2"]},{num:4,title:"Team Building",questIds:["ch4-q1","ch4-q2"]},{num:5,title:"Growth & Discovery",questIds:["ch5-q1","ch5-q2"]}],DS={completedQuests:[],activeChapter:1,sideQuestsCompleted:[]};function zS(){return{...DS}}function _g(e,r){if(r.completedQuests.includes(e.id))return"completed";if(e.chapter>r.activeChapter)return"locked";if(e.chapter<r.activeChapter)return"active";const a=ru.find(i=>i.num===e.chapter);if(!a)return"locked";for(const i of a.questIds){if(i===e.id)return"active";if(!r.completedQuests.includes(i))return"locked"}return"locked"}function RS(e){for(const r of fo)if(_g(r,e)==="active")return r;return null}function MS(e,r){const a=fo.find(u=>u.id===r);if(!a)return{progress:e,quest:null};if(e.completedQuests.includes(r))return{progress:e,quest:null};const i={...e,completedQuests:[...e.completedQuests,r],firstCompletedAt:e.firstCompletedAt??new Date().toISOString()},c=ru.find(u=>u.num===a.chapter);if(c&&c.questIds.every(u=>i.completedQuests.includes(u))){const u=ru.find(d=>d.num===a.chapter+1);u&&(i.activeChapter=u.num)}return{progress:i,quest:a}}function FS(e){const r=fo.filter(i=>i.type==="main").length;return{completed:e.completedQuests.filter(i=>{var c;return((c=fo.find(u=>u.id===i))==null?void 0:c.type)==="main"}).length,total:r}}function _S(e,r){if(e.trigger.type!==r.type)return!1;if(e.trigger.condition&&r.condition){for(const[a,i]of Object.entries(e.trigger.condition))if(r.condition[a]!==i)return!1}return!0}function OS({progress:e,onQuestAction:r}){const{completed:a,total:i}=FS(e),c=i>0?Math.round(a/i*100):0;return s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2 px-1",children:[s.jsx("span",{className:"text-base",children:"🐾"}),s.jsx("span",{className:"text-sm font-medium",style:{color:"var(--terminal-text)"},children:"Pupu's Quest Board"})]}),s.jsxs("div",{className:"px-1",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs mb-1.5",style:{color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"Progress"}),s.jsxs("span",{children:[a,"/",i," quests · ",c,"%"]})]}),s.jsx("div",{className:"h-2 rounded-full overflow-hidden",style:{background:"var(--terminal-border)"},children:s.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${c}%`,background:"var(--accent)"}})})]}),ru.map(u=>{const d=fo.filter(y=>u.questIds.includes(y.id)),m=d.every(y=>e.completedQuests.includes(y.id)),x=u.num===e.activeChapter,f=u.num>e.activeChapter;return s.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:x?"var(--hud-bg-alt)":"transparent",border:x?"1px solid var(--accent)":"1px solid var(--terminal-border)",opacity:f?.4:1},children:[s.jsxs("div",{className:"px-3 py-2 flex items-center gap-2",children:[s.jsx("span",{className:"text-sm",children:m?"✅":f?"🔒":"🟡"}),s.jsxs("span",{className:"text-sm font-medium",style:{color:x?"var(--accent)":"var(--terminal-text)"},children:["Chapter ",u.num,": ",u.title]}),x&&s.jsx("span",{className:"ml-auto text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--accent)",color:"#000"},children:"ACTIVE"})]}),!f&&s.jsx("div",{className:"px-3 pb-2 flex flex-col gap-1.5",children:d.map(y=>{const g=_g(y,e);return s.jsxs("div",{className:"flex items-start gap-2 pl-2",children:[s.jsx("span",{className:"text-xs mt-0.5 shrink-0",children:g==="completed"?"☑":g==="active"?"☐":"·"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs",style:{color:g==="completed"?"var(--terminal-text-muted)":"var(--terminal-text)",textDecoration:g==="completed"?"line-through":"none"},children:y.title}),g==="active"&&y.hint&&r&&s.jsx("button",{onClick:()=>r(y.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 →"})]}),g==="active"&&y.hint&&s.jsxs("div",{className:"text-[10px] mt-0.5",style:{color:"var(--accent)"},children:["💡 ",y.hint.message]})]})]},y.id)})})]},u.num)})]})}function BS(e,r){var a,i=1;e==null&&(e=0),r==null&&(r=0);function c(){var u,d=a.length,m,x=0,f=0;for(u=0;u<d;++u)m=a[u],x+=m.x,f+=m.y;for(x=(x/d-e)*i,f=(f/d-r)*i,u=0;u<d;++u)m=a[u],m.x-=x,m.y-=f}return c.initialize=function(u){a=u},c.x=function(u){return arguments.length?(e=+u,c):e},c.y=function(u){return arguments.length?(r=+u,c):r},c.strength=function(u){return arguments.length?(i=+u,c):i},c}function $S(e){const r=+this._x.call(null,e),a=+this._y.call(null,e);return Og(this.cover(r,a),r,a,e)}function Og(e,r,a,i){if(isNaN(r)||isNaN(a))return e;var c,u=e._root,d={data:i},m=e._x0,x=e._y0,f=e._x1,y=e._y1,g,b,v,S,j,C,E,N;if(!u)return e._root=d,e;for(;u.length;)if((j=r>=(g=(m+f)/2))?m=g:f=g,(C=a>=(b=(x+y)/2))?x=b:y=b,c=u,!(u=u[E=C<<1|j]))return c[E]=d,e;if(v=+e._x.call(null,u.data),S=+e._y.call(null,u.data),r===v&&a===S)return d.next=u,c?c[E]=d:e._root=d,e;do c=c?c[E]=new Array(4):e._root=new Array(4),(j=r>=(g=(m+f)/2))?m=g:f=g,(C=a>=(b=(x+y)/2))?x=b:y=b;while((E=C<<1|j)===(N=(S>=b)<<1|v>=g));return c[N]=u,c[E]=d,e}function LS(e){var r,a,i=e.length,c,u,d=new Array(i),m=new Array(i),x=1/0,f=1/0,y=-1/0,g=-1/0;for(a=0;a<i;++a)isNaN(c=+this._x.call(null,r=e[a]))||isNaN(u=+this._y.call(null,r))||(d[a]=c,m[a]=u,c<x&&(x=c),c>y&&(y=c),u<f&&(f=u),u>g&&(g=u));if(x>y||f>g)return this;for(this.cover(x,f).cover(y,g),a=0;a<i;++a)Og(this,d[a],m[a],e[a]);return this}function HS(e,r){if(isNaN(e=+e)||isNaN(r=+r))return this;var a=this._x0,i=this._y0,c=this._x1,u=this._y1;if(isNaN(a))c=(a=Math.floor(e))+1,u=(i=Math.floor(r))+1;else{for(var d=c-a||1,m=this._root,x,f;a>e||e>=c||i>r||r>=u;)switch(f=(r<i)<<1|e<a,x=new Array(4),x[f]=m,m=x,d*=2,f){case 0:c=a+d,u=i+d;break;case 1:a=c-d,u=i+d;break;case 2:c=a+d,i=u-d;break;case 3:a=c-d,i=u-d;break}this._root&&this._root.length&&(this._root=m)}return this._x0=a,this._y0=i,this._x1=c,this._y1=u,this}function IS(){var e=[];return this.visit(function(r){if(!r.length)do e.push(r.data);while(r=r.next)}),e}function US(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 Qn(e,r,a,i,c){this.node=e,this.x0=r,this.y0=a,this.x1=i,this.y1=c}function qS(e,r,a){var i,c=this._x0,u=this._y0,d,m,x,f,y=this._x1,g=this._y1,b=[],v=this._root,S,j;for(v&&b.push(new Qn(v,c,u,y,g)),a==null?a=1/0:(c=e-a,u=r-a,y=e+a,g=r+a,a*=a);S=b.pop();)if(!(!(v=S.node)||(d=S.x0)>y||(m=S.y0)>g||(x=S.x1)<c||(f=S.y1)<u))if(v.length){var C=(d+x)/2,E=(m+f)/2;b.push(new Qn(v[3],C,E,x,f),new Qn(v[2],d,E,C,f),new Qn(v[1],C,m,x,E),new Qn(v[0],d,m,C,E)),(j=(r>=E)<<1|e>=C)&&(S=b[b.length-1],b[b.length-1]=b[b.length-1-j],b[b.length-1-j]=S)}else{var N=e-+this._x.call(null,v.data),_=r-+this._y.call(null,v.data),B=N*N+_*_;if(B<a){var I=Math.sqrt(a=B);c=e-I,u=r-I,y=e+I,g=r+I,i=v.data}}return i}function YS(e){if(isNaN(y=+this._x.call(null,e))||isNaN(g=+this._y.call(null,e)))return this;var r,a=this._root,i,c,u,d=this._x0,m=this._y0,x=this._x1,f=this._y1,y,g,b,v,S,j,C,E;if(!a)return this;if(a.length)for(;;){if((S=y>=(b=(d+x)/2))?d=b:x=b,(j=g>=(v=(m+f)/2))?m=v:f=v,r=a,!(a=a[C=j<<1|S]))return this;if(!a.length)break;(r[C+1&3]||r[C+2&3]||r[C+3&3])&&(i=r,E=C)}for(;a.data!==e;)if(c=a,!(a=a.next))return this;return(u=a.next)&&delete a.next,c?(u?c.next=u:delete c.next,this):r?(u?r[C]=u:delete r[C],(a=r[0]||r[1]||r[2]||r[3])&&a===(r[3]||r[2]||r[1]||r[0])&&!a.length&&(i?i[E]=a:this._root=a),this):(this._root=u,this)}function XS(e){for(var r=0,a=e.length;r<a;++r)this.remove(e[r]);return this}function VS(){return this._root}function GS(){var e=0;return this.visit(function(r){if(!r.length)do++e;while(r=r.next)}),e}function QS(e){var r=[],a,i=this._root,c,u,d,m,x;for(i&&r.push(new Qn(i,this._x0,this._y0,this._x1,this._y1));a=r.pop();)if(!e(i=a.node,u=a.x0,d=a.y0,m=a.x1,x=a.y1)&&i.length){var f=(u+m)/2,y=(d+x)/2;(c=i[3])&&r.push(new Qn(c,f,y,m,x)),(c=i[2])&&r.push(new Qn(c,u,y,f,x)),(c=i[1])&&r.push(new Qn(c,f,d,m,y)),(c=i[0])&&r.push(new Qn(c,u,d,f,y))}return this}function WS(e){var r=[],a=[],i;for(this._root&&r.push(new Qn(this._root,this._x0,this._y0,this._x1,this._y1));i=r.pop();){var c=i.node;if(c.length){var u,d=i.x0,m=i.y0,x=i.x1,f=i.y1,y=(d+x)/2,g=(m+f)/2;(u=c[0])&&r.push(new Qn(u,d,m,y,g)),(u=c[1])&&r.push(new Qn(u,y,m,x,g)),(u=c[2])&&r.push(new Qn(u,d,g,y,f)),(u=c[3])&&r.push(new Qn(u,y,g,x,f))}a.push(i)}for(;i=a.pop();)e(i.node,i.x0,i.y0,i.x1,i.y1);return this}function KS(e){return e[0]}function ZS(e){return arguments.length?(this._x=e,this):this._x}function PS(e){return e[1]}function JS(e){return arguments.length?(this._y=e,this):this._y}function Ph(e,r,a){var i=new Jh(r??KS,a??PS,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function Jh(e,r,a,i,c,u){this._x=e,this._y=r,this._x0=a,this._y0=i,this._x1=c,this._y1=u,this._root=void 0}function L0(e){for(var r={data:e.data},a=r;e=e.next;)a=a.next={data:e.data};return r}var Wn=Ph.prototype=Jh.prototype;Wn.copy=function(){var e=new Jh(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root,a,i;if(!r)return e;if(!r.length)return e._root=L0(r),e;for(a=[{source:r,target:e._root=new Array(4)}];r=a.pop();)for(var c=0;c<4;++c)(i=r.source[c])&&(i.length?a.push({source:i,target:r.target[c]=new Array(4)}):r.target[c]=L0(i));return e};Wn.add=$S;Wn.addAll=LS;Wn.cover=HS;Wn.data=IS;Wn.extent=US;Wn.find=qS;Wn.remove=YS;Wn.removeAll=XS;Wn.root=VS;Wn.size=GS;Wn.visit=QS;Wn.visitAfter=WS;Wn.x=ZS;Wn.y=JS;function Ql(e){return function(){return e}}function gl(e){return(e()-.5)*1e-6}function eC(e){return e.x+e.vx}function tC(e){return e.y+e.vy}function nC(e){var r,a,i,c=1,u=1;typeof e!="function"&&(e=Ql(e==null?1:+e));function d(){for(var f,y=r.length,g,b,v,S,j,C,E=0;E<u;++E)for(g=Ph(r,eC,tC).visitAfter(m),f=0;f<y;++f)b=r[f],j=a[b.index],C=j*j,v=b.x+b.vx,S=b.y+b.vy,g.visit(N);function N(_,B,I,F,X){var W=_.data,U=_.r,M=j+U;if(W){if(W.index>b.index){var G=v-W.x-W.vx,O=S-W.y-W.vy,V=G*G+O*O;V<M*M&&(G===0&&(G=gl(i),V+=G*G),O===0&&(O=gl(i),V+=O*O),V=(M-(V=Math.sqrt(V)))/V*c,b.vx+=(G*=V)*(M=(U*=U)/(C+U)),b.vy+=(O*=V)*M,W.vx-=G*(M=1-M),W.vy-=O*M)}return}return B>v+M||F<v-M||I>S+M||X<S-M}}function m(f){if(f.data)return f.r=a[f.data.index];for(var y=f.r=0;y<4;++y)f[y]&&f[y].r>f.r&&(f.r=f[y].r)}function x(){if(r){var f,y=r.length,g;for(a=new Array(y),f=0;f<y;++f)g=r[f],a[g.index]=+e(g,f,r)}}return d.initialize=function(f,y){r=f,i=y,x()},d.iterations=function(f){return arguments.length?(u=+f,d):u},d.strength=function(f){return arguments.length?(c=+f,d):c},d.radius=function(f){return arguments.length?(e=typeof f=="function"?f:Ql(+f),x(),d):e},d}function rC(e){return e.index}function H0(e,r){var a=e.get(r);if(!a)throw new Error("node not found: "+r);return a}function aC(e){var r=rC,a=g,i,c=Ql(30),u,d,m,x,f,y=1;e==null&&(e=[]);function g(C){return 1/Math.min(m[C.source.index],m[C.target.index])}function b(C){for(var E=0,N=e.length;E<y;++E)for(var _=0,B,I,F,X,W,U,M;_<N;++_)B=e[_],I=B.source,F=B.target,X=F.x+F.vx-I.x-I.vx||gl(f),W=F.y+F.vy-I.y-I.vy||gl(f),U=Math.sqrt(X*X+W*W),U=(U-u[_])/U*C*i[_],X*=U,W*=U,F.vx-=X*(M=x[_]),F.vy-=W*M,I.vx+=X*(M=1-M),I.vy+=W*M}function v(){if(d){var C,E=d.length,N=e.length,_=new Map(d.map((I,F)=>[r(I,F,d),I])),B;for(C=0,m=new Array(E);C<N;++C)B=e[C],B.index=C,typeof B.source!="object"&&(B.source=H0(_,B.source)),typeof B.target!="object"&&(B.target=H0(_,B.target)),m[B.source.index]=(m[B.source.index]||0)+1,m[B.target.index]=(m[B.target.index]||0)+1;for(C=0,x=new Array(N);C<N;++C)B=e[C],x[C]=m[B.source.index]/(m[B.source.index]+m[B.target.index]);i=new Array(N),S(),u=new Array(N),j()}}function S(){if(d)for(var C=0,E=e.length;C<E;++C)i[C]=+a(e[C],C,e)}function j(){if(d)for(var C=0,E=e.length;C<E;++C)u[C]=+c(e[C],C,e)}return b.initialize=function(C,E){d=C,f=E,v()},b.links=function(C){return arguments.length?(e=C,v(),b):e},b.id=function(C){return arguments.length?(r=C,b):r},b.iterations=function(C){return arguments.length?(y=+C,b):y},b.strength=function(C){return arguments.length?(a=typeof C=="function"?C:Ql(+C),S(),b):a},b.distance=function(C){return arguments.length?(c=typeof C=="function"?C:Ql(+C),j(),b):c},b}var lC={value:()=>{}};function Bg(){for(var e=0,r=arguments.length,a={},i;e<r;++e){if(!(i=arguments[e]+"")||i in a||/[\s.]/.test(i))throw new Error("illegal type: "+i);a[i]=[]}return new Gc(a)}function Gc(e){this._=e}function iC(e,r){return e.trim().split(/^|\s+/).map(function(a){var i="",c=a.indexOf(".");if(c>=0&&(i=a.slice(c+1),a=a.slice(0,c)),a&&!r.hasOwnProperty(a))throw new Error("unknown type: "+a);return{type:a,name:i}})}Gc.prototype=Bg.prototype={constructor:Gc,on:function(e,r){var a=this._,i=iC(e+"",a),c,u=-1,d=i.length;if(arguments.length<2){for(;++u<d;)if((c=(e=i[u]).type)&&(c=sC(a[c],e.name)))return c;return}if(r!=null&&typeof r!="function")throw new Error("invalid callback: "+r);for(;++u<d;)if(c=(e=i[u]).type)a[c]=I0(a[c],e.name,r);else if(r==null)for(c in a)a[c]=I0(a[c],e.name,null);return this},copy:function(){var e={},r=this._;for(var a in r)e[a]=r[a].slice();return new Gc(e)},call:function(e,r){if((c=arguments.length-2)>0)for(var a=new Array(c),i=0,c,u;i<c;++i)a[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(u=this._[e],i=0,c=u.length;i<c;++i)u[i].value.apply(r,a)},apply:function(e,r,a){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],c=0,u=i.length;c<u;++c)i[c].value.apply(r,a)}};function sC(e,r){for(var a=0,i=e.length,c;a<i;++a)if((c=e[a]).name===r)return c.value}function I0(e,r,a){for(var i=0,c=e.length;i<c;++i)if(e[i].name===r){e[i]=lC,e=e.slice(0,i).concat(e.slice(i+1));break}return a!=null&&e.push({name:r,value:a}),e}var Yi=0,to=0,Ks=0,$g=1e3,au,no,lu=0,Zl=0,hu=0,ho=typeof performance=="object"&&performance.now?performance:Date,Lg=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Hg(){return Zl||(Lg(oC),Zl=ho.now()+hu)}function oC(){Zl=0}function bh(){this._call=this._time=this._next=null}bh.prototype=Ig.prototype={constructor:bh,restart:function(e,r,a){if(typeof e!="function")throw new TypeError("callback is not a function");a=(a==null?Hg():+a)+(r==null?0:+r),!this._next&&no!==this&&(no?no._next=this:au=this,no=this),this._call=e,this._time=a,vh()},stop:function(){this._call&&(this._call=null,this._time=1/0,vh())}};function Ig(e,r,a){var i=new bh;return i.restart(e,r,a),i}function cC(){Hg(),++Yi;for(var e=au,r;e;)(r=Zl-e._time)>=0&&e._call.call(void 0,r),e=e._next;--Yi}function U0(){Zl=(lu=ho.now())+hu,Yi=to=0;try{cC()}finally{Yi=0,dC(),Zl=0}}function uC(){var e=ho.now(),r=e-lu;r>$g&&(hu-=r,lu=e)}function dC(){for(var e,r=au,a,i=1/0;r;)r._call?(i>r._time&&(i=r._time),e=r,r=r._next):(a=r._next,r._next=null,r=e?e._next=a:au=a);no=e,vh(i)}function vh(e){if(!Yi){to&&(to=clearTimeout(to));var r=e-Zl;r>24?(e<1/0&&(to=setTimeout(U0,e-ho.now()-hu)),Ks&&(Ks=clearInterval(Ks))):(Ks||(lu=ho.now(),Ks=setInterval(uC,$g)),Yi=1,Lg(U0))}}const fC=1664525,hC=1013904223,q0=4294967296;function mC(){let e=1;return()=>(e=(fC*e+hC)%q0)/q0}function xC(e){return e.x}function pC(e){return e.y}var yC=10,gC=Math.PI*(3-Math.sqrt(5));function bC(e){var r,a=1,i=.001,c=1-Math.pow(i,1/300),u=0,d=.6,m=new Map,x=Ig(g),f=Bg("tick","end"),y=mC();e==null&&(e=[]);function g(){b(),f.call("tick",r),a<i&&(x.stop(),f.call("end",r))}function b(j){var C,E=e.length,N;j===void 0&&(j=1);for(var _=0;_<j;++_)for(a+=(u-a)*c,m.forEach(function(B){B(a)}),C=0;C<E;++C)N=e[C],N.fx==null?N.x+=N.vx*=d:(N.x=N.fx,N.vx=0),N.fy==null?N.y+=N.vy*=d:(N.y=N.fy,N.vy=0);return r}function v(){for(var j=0,C=e.length,E;j<C;++j){if(E=e[j],E.index=j,E.fx!=null&&(E.x=E.fx),E.fy!=null&&(E.y=E.fy),isNaN(E.x)||isNaN(E.y)){var N=yC*Math.sqrt(.5+j),_=j*gC;E.x=N*Math.cos(_),E.y=N*Math.sin(_)}(isNaN(E.vx)||isNaN(E.vy))&&(E.vx=E.vy=0)}}function S(j){return j.initialize&&j.initialize(e,y),j}return v(),r={tick:b,restart:function(){return x.restart(g),r},stop:function(){return x.stop(),r},nodes:function(j){return arguments.length?(e=j,v(),m.forEach(S),r):e},alpha:function(j){return arguments.length?(a=+j,r):a},alphaMin:function(j){return arguments.length?(i=+j,r):i},alphaDecay:function(j){return arguments.length?(c=+j,r):+c},alphaTarget:function(j){return arguments.length?(u=+j,r):u},velocityDecay:function(j){return arguments.length?(d=1-j,r):1-d},randomSource:function(j){return arguments.length?(y=j,m.forEach(S),r):y},force:function(j,C){return arguments.length>1?(C==null?m.delete(j):m.set(j,S(C)),r):m.get(j)},find:function(j,C,E){var N=0,_=e.length,B,I,F,X,W;for(E==null?E=1/0:E*=E,N=0;N<_;++N)X=e[N],B=j-X.x,I=C-X.y,F=B*B+I*I,F<E&&(W=X,E=F);return W},on:function(j,C){return arguments.length>1?(f.on(j,C),r):f.on(j)}}}function vC(){var e,r,a,i,c=Ql(-30),u,d=1,m=1/0,x=.81;function f(v){var S,j=e.length,C=Ph(e,xC,pC).visitAfter(g);for(i=v,S=0;S<j;++S)r=e[S],C.visit(b)}function y(){if(e){var v,S=e.length,j;for(u=new Array(S),v=0;v<S;++v)j=e[v],u[j.index]=+c(j,v,e)}}function g(v){var S=0,j,C,E=0,N,_,B;if(v.length){for(N=_=B=0;B<4;++B)(j=v[B])&&(C=Math.abs(j.value))&&(S+=j.value,E+=C,N+=C*j.x,_+=C*j.y);v.x=N/E,v.y=_/E}else{j=v,j.x=j.data.x,j.y=j.data.y;do S+=u[j.data.index];while(j=j.next)}v.value=S}function b(v,S,j,C){if(!v.value)return!0;var E=v.x-r.x,N=v.y-r.y,_=C-S,B=E*E+N*N;if(_*_/x<B)return B<m&&(E===0&&(E=gl(a),B+=E*E),N===0&&(N=gl(a),B+=N*N),B<d&&(B=Math.sqrt(d*B)),r.vx+=E*v.value*i/B,r.vy+=N*v.value*i/B),!0;if(v.length||B>=m)return;(v.data!==r||v.next)&&(E===0&&(E=gl(a),B+=E*E),N===0&&(N=gl(a),B+=N*N),B<d&&(B=Math.sqrt(d*B)));do v.data!==r&&(_=u[v.data.index]*i/B,r.vx+=E*_,r.vy+=N*_);while(v=v.next)}return f.initialize=function(v,S){e=v,a=S,y()},f.strength=function(v){return arguments.length?(c=typeof v=="function"?v:Ql(+v),y(),f):c},f.distanceMin=function(v){return arguments.length?(d=v*v,f):Math.sqrt(d)},f.distanceMax=function(v){return arguments.length?(m=v*v,f):Math.sqrt(m)},f.theta=function(v){return arguments.length?(x=v*v,f):Math.sqrt(x)},f}const mo={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 wC(e){return mo[e]??mo.general}function kC({docs:e,onNodeClick:r,selectedDocId:a}){var G;const i=w.useRef(null),c=w.useRef(null),[u,d]=w.useState({width:600,height:400}),[m,x]=w.useState({nodes:[],links:[]}),[f,y]=w.useState(null),[g,b]=w.useState(null),[v,S]=w.useState({x:0,y:0}),[j,C]=w.useState({x:0,y:0,w:600,h:400}),E=w.useRef(!1),N=w.useRef({x:0,y:0,vx:0,vy:0}),_=w.useRef(null),B=w.useRef(null);w.useEffect(()=>{const O=i.current;if(!O)return;const V=new ResizeObserver(J=>{const{width:Q,height:H}=J[0].contentRect;Q>0&&H>0&&(d({width:Q,height:H}),C(Y=>({...Y,w:Q,h:H})))});return V.observe(O),()=>V.disconnect()},[]),w.useEffect(()=>{if(e.length===0)return;const O=new Set(e.map(ge=>ge.id)),V=e.map(ge=>({id:ge.id,title:ge.title,category:ge.category,akb_type:ge.akb_type})),J=(ge,Me)=>{if(!Me.startsWith(".")&&!Me.startsWith("/"))return Me;const Ee=ge.split("/");Ee.pop();const Ie=Me.split("/");for(const oe of Ie)oe===".."?Ee.pop():oe!=="."&&oe!==""&&Ee.push(oe);return Ee.join("/")},Q=[];for(const ge of e)for(const Me of ge.links){const Ee=J(ge.id,Me.href);O.has(Ee)&&Ee!==ge.id&&(Q.some(Ie=>Ie.source===ge.id&&Ie.target===Ee||Ie.source===Ee&&Ie.target===ge.id)||Q.push({source:ge.id,target:Ee,label:Me.text}))}const{width:H,height:Y}=u,ne=V.length,we=ne>100?-600:ne>50?-500:-400,T=ne>100?180:ne>50?160:140,z=ne>100?60:50,Z=Math.max(H,ne*12),D=Math.max(Y,ne*10),xe=bC(V).force("link",aC(Q).id(ge=>ge.id).distance(T)).force("charge",vC().strength(we)).force("center",BS(Z/2,D/2)).force("collide",nC(z));B.current=xe,xe.on("tick",()=>{x({nodes:[...V],links:[...Q]})}),xe.alpha(1).restart();const Ce=ne>100?300:150;for(let ge=0;ge<Ce;ge++)xe.tick();if(xe.stop(),x({nodes:[...V],links:[...Q]}),V.length>0){let ge=1/0,Me=1/0,Ee=-1/0,Ie=-1/0;for(const at of V){const Ct=at.x??0,jt=at.y??0;Ct<ge&&(ge=Ct),jt<Me&&(Me=jt),Ct>Ee&&(Ee=Ct),jt>Ie&&(Ie=jt)}const oe=100;C({x:ge-oe,y:Me-oe,w:Math.max(H,Ee-ge+oe*2),h:Math.max(Y,Ie-Me+oe*2)})}return()=>{xe.stop()}},[e,u]);const I=O=>{if(typeof O=="string"){const V=m.nodes.find(J=>J.id===O);return{x:(V==null?void 0:V.x)??0,y:(V==null?void 0:V.y)??0}}return{x:O.x??0,y:O.y??0}},F=w.useCallback(O=>{O.preventDefault();const V=O.deltaY>0?1.1:.9;C(J=>{const Q=Math.max(200,Math.min(u.width*3,J.w*V)),H=Math.max(150,Math.min(u.height*3,J.h*V)),Y=(Q-J.w)/2,ne=(H-J.h)/2;return{x:J.x-Y,y:J.y-ne,w:Q,h:H}})},[u]),X=w.useCallback(O=>{O.button===0&&(E.current=!0,N.current={x:O.clientX,y:O.clientY,vx:j.x,vy:j.y})},[j]),W=w.useCallback(O=>{var V;if(_.current){const J=c.current;if(!J)return;const Q=J.getBoundingClientRect(),H=j.w/Q.width,Y=j.h/Q.height,ne=j.x+(O.clientX-Q.left)*H,we=j.y+(O.clientY-Q.top)*Y;_.current.fx=ne,_.current.fy=we,(V=B.current)==null||V.alpha(.3).restart();return}if(E.current){const J=(O.clientX-N.current.x)*(j.w/u.width),Q=(O.clientY-N.current.y)*(j.h/u.height);C(H=>({...H,x:N.current.vx-J,y:N.current.vy-Q}))}},[j,u]),U=w.useCallback(()=>{E.current=!1,_.current&&(_.current.fx=null,_.current.fy=null,_.current=null)},[]),M=w.useCallback((O,V)=>{var J;O.stopPropagation(),_.current=V,(J=B.current)==null||J.alpha(.3).restart()},[]);return s.jsxs("div",{ref:i,className:"relative flex-1 overflow-hidden",style:{background:"#1e1e2e"},children:[s.jsxs("svg",{ref:c,width:u.width,height:u.height,viewBox:`${j.x} ${j.y} ${j.w} ${j.h}`,style:{display:"block",cursor:E.current?"grabbing":"grab"},onWheel:F,onMouseDown:X,onMouseMove:W,onMouseUp:U,onMouseLeave:U,children:[s.jsx("defs",{children:s.jsx("pattern",{id:"grid",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:s.jsx("circle",{cx:"0",cy:"0",r:"0.5",fill:"rgba(255,255,255,0.06)"})})}),s.jsx("rect",{x:j.x-100,y:j.y-100,width:j.w+200,height:j.h+200,fill:"url(#grid)",pointerEvents:"none"}),m.links.map((O,V)=>{const J=I(O.source),Q=I(O.target),H=g===V,Y=(J.x+Q.x)/2,ne=(J.y+Q.y)/2;return s.jsxs("g",{children:[s.jsx("line",{x1:J.x,y1:J.y,x2:Q.x,y2:Q.y,stroke:"transparent",strokeWidth:12,style:{cursor:"default"},onMouseEnter:()=>b(V),onMouseLeave:()=>b(null)}),s.jsx("line",{x1:J.x,y1:J.y,x2:Q.x,y2:Q.y,stroke:H?"rgba(148,163,184,0.7)":"rgba(148,163,184,0.3)",strokeWidth:H?2:1.5,strokeDasharray:"4 3",pointerEvents:"none"}),H&&O.label&&s.jsx("text",{x:Y,y:ne-6,textAnchor:"middle",fill:"#e2e8f0",fontSize:9,fontFamily:"monospace",style:{pointerEvents:"none"},children:s.jsx("tspan",{style:{filter:"drop-shadow(0 0 2px rgba(0,0,0,0.8))"},children:O.label.length>30?O.label.slice(0,28)+"..":O.label})})]},V)}),m.nodes.map(O=>{const V=mo[O.category]??mo.general,J=O.akb_type==="hub",Q=J?24:16,H=(f==null?void 0:f.id)===O.id,Y=a===O.id,ne=H?1.2:Y?1.15:1;return s.jsxs("g",{transform:`translate(${O.x??0}, ${O.y??0}) scale(${ne})`,style:{cursor:"pointer",transition:"transform 0.15s ease"},onClick:we=>{we.stopPropagation();const T=e.find(z=>z.id===O.id);T&&r(T)},onMouseDown:we=>M(we,O),onMouseEnter:we=>{var z;y(O);const T=(z=i.current)==null?void 0:z.getBoundingClientRect();T&&S({x:we.clientX-T.left,y:we.clientY-T.top})},onMouseLeave:()=>y(null),children:[Y&&s.jsx("rect",{x:-Q/2-4,y:-Q/2-4,width:Q+8,height:Q+8,fill:"none",stroke:"#22c55e",strokeWidth:2,rx:J?5:2,opacity:.6}),s.jsx("rect",{x:-Q/2,y:-Q/2,width:Q,height:Q,fill:V.border,rx:J?4:2,opacity:H?1:.9}),s.jsx("rect",{x:-Q/2+3,y:-Q/2+3,width:Math.max(0,Q-6),height:Math.max(0,Q-6),fill:V.bg,rx:J?3:1}),s.jsx("text",{y:Q/2+14,textAnchor:"middle",fill:Y?"#e2e8f0":"#94a3b8",fontSize:11,fontFamily:"monospace",fontWeight:Y?"bold":"normal",style:{pointerEvents:"none"},children:O.title.length>24?O.title.slice(0,22)+"..":O.title})]},O.id)})]}),f&&!_.current&&s.jsxs("div",{className:"absolute z-10 pointer-events-none p-2.5 rounded text-xs max-w-[240px]",style:{left:Math.min(v.x+16,u.width-250),top:Math.max(v.y-30,8),background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",boxShadow:"0 4px 12px rgba(0,0,0,0.4)"},children:[s.jsx("div",{className:"font-bold mb-1",children:f.title}),s.jsxs("div",{className:"text-[10px] opacity-60 mb-1",children:[f.akb_type.toUpperCase()," / ",f.category]}),((G=e.find(O=>O.id===f.id))==null?void 0:G.tldr)&&s.jsx("div",{className:"text-[10px] opacity-80 mb-1",children:e.find(O=>O.id===f.id).tldr}),s.jsx("div",{className:"text-[10px] text-green-400",children:"Click to open | Drag to move"})]}),e.length===0&&s.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 jC(e){const r=[],a=new Map;return[...e].sort((c,u)=>c.id.localeCompare(u.id)).forEach(c=>{const u=c.id.split("/");let d=r,m="";for(let x=0;x<u.length-1;x++)if(m=m?`${m}/${u[x]}`:u[x],a.has(m))d=a.get(m).children;else{const f={type:"folder",name:u[x],path:m,children:[]};a.set(m,f),d.push(f),d=f.children}d.push({type:"file",name:u[u.length-1],path:c.id,doc:c})}),r}function SC({docs:e,onDocumentClick:r,selectedDocId:a}){const[i,c]=w.useState(new Set(["knowledge","projects","architecture","operations","company"])),[u,d]=w.useState(null),m=w.useMemo(()=>jC(e),[e]),x=b=>{c(v=>{const S=new Set(v);return S.has(b)?S.delete(b):S.add(b),S})},f=b=>{d(b),r(b)},y=()=>{d(null),r(null)},g=u?e.find(b=>b.id===u):null;return s.jsxs("div",{className:"flex-1 overflow-hidden flex animate-fadeIn",children:[s.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:[s.jsx("div",{className:"text-[10px] font-bold uppercase mb-2",style:{color:"var(--terminal-text-muted)"},children:"📂 Explorer"}),m.map(b=>s.jsx(Ug,{node:b,level:0,expandedFolders:i,selectedDocId:a,viewingDocId:u,onToggleFolder:x,onFileClick:f},b.path))]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:g?s.jsx(CC,{doc:g,onClose:y}):s.jsx("div",{className:"flex items-center justify-center h-full text-xs",style:{color:"var(--terminal-text-muted)"},children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-2xl mb-2",children:"📄"}),s.jsx("div",{children:"Select a document to view"})]})})})]})}function Ug({node:e,level:r,expandedFolders:a,selectedDocId:i,viewingDocId:c,onToggleFolder:u,onFileClick:d}){var g,b;const m=a.has(e.path),x=e.type==="file"&&e.path===i,f=e.type==="file"&&e.path===c,y=((g=e.doc)==null?void 0:g.akb_type)==="hub";return e.type==="folder"?s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1 py-0.5 px-1 rounded cursor-pointer hover:bg-white/5",style:{paddingLeft:r*12+4},onClick:()=>u(e.path),children:[s.jsx("span",{className:"text-[10px]",children:m?"📂":"📁"}),s.jsx("span",{className:"text-[11px]",style:{color:"var(--terminal-text)"},children:e.name})]}),m&&((b=e.children)==null?void 0:b.map(v=>s.jsx(Ug,{node:v,level:r+1,expandedFolders:a,selectedDocId:i,viewingDocId:c,onToggleFolder:u,onFileClick:d},v.path)))]}):s.jsxs("div",{className:`flex items-center gap-1 py-0.5 px-1 rounded cursor-pointer transition-colors ${f?"bg-green-500/20":x?"bg-white/10":"hover:bg-white/5"}`,style:{paddingLeft:r*12+4},onClick:()=>d(e.path),children:[s.jsx("span",{className:"text-[10px]",children:y?"📘":"📄"}),s.jsx("span",{className:`text-[11px] truncate ${y?"font-semibold":""}`,style:{color:y?"#16a34a":"var(--terminal-text)"},children:e.name})]})}function CC({doc:e,onClose:r}){const[a,i]=w.useState(null),[c,u]=w.useState(!1),[d,m]=w.useState(null);w.useEffect(()=>{if("content"in e&&e.content){i(e);return}u(!0),m(null),Se.getKnowledgeDoc(e.id).then(i).catch(y=>m(y instanceof Error?y.message:"Failed to load")).finally(()=>u(!1))},[e]);const x=wC(e.category),f=e.akb_type==="hub";return s.jsxs("div",{className:"h-full flex flex-col",children:[s.jsxs("div",{className:"shrink-0 p-4",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx("div",{className:"flex items-center gap-2 mb-2",children:s.jsxs("button",{onClick:r,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Back"]})}),s.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[s.jsx("span",{className:"text-lg",children:f?"📘":e.format==="html"?"🌐":"📄"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-sm font-bold mb-1",style:{color:"var(--terminal-text)"},children:e.title}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:e.status==="active"?"#16a34a":e.status==="draft"?"#f59e0b":"#94a3b8"},title:e.status}),s.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:e.id})]}),e.tags.length>0&&s.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:e.tags.map(y=>s.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium",style:{background:x.bg,color:x.text,border:`1px solid ${x.border}`},children:y},y))})]})]}),e.tldr&&s.jsx("div",{className:"text-[11px] italic leading-relaxed p-2 rounded",style:{background:"var(--hud-bg)",color:"var(--terminal-text-secondary)"},children:e.tldr})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[c&&s.jsx("div",{className:"text-xs",style:{color:"var(--terminal-text-muted)"},children:"Loading..."}),d&&s.jsx("div",{className:"text-xs p-2 rounded",style:{background:"rgba(239,68,68,0.15)",color:"#f87171"},children:d}),a&&s.jsx(go,{content:a.content})]})]})}const EC=500,Y0=360,X0=700;function em(e){const[r,a]=w.useState(EC),[i,c]=w.useState(!1),u=w.useRef(0),d=w.useRef(0),m=e>0,x=m?e:0,f=m?Math.max(Y0,window.innerWidth-e-100):X0,y=Math.min(r,f),g=w.useCallback(b=>{b.preventDefault(),u.current=b.clientX,d.current=y,c(!0);const v=j=>{const C=u.current-j.clientX,E=Math.min(X0,Math.max(Y0,d.current+C));a(E)},S=()=>{c(!1),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",S)};document.addEventListener("mousemove",v),document.addEventListener("mouseup",S)},[y]);return{panelRight:x,panelWidth:y,isResizing:i,handleResizeStart:g}}function NC({docs:e,onClose:r,onRefresh:a,terminalWidth:i=0,initialDocId:c}){const[u,d]=w.useState(()=>{const j=localStorage.getItem("kb-view-mode");return j==="graph"||j==="tree"||j==="list"?j:"graph"}),[m,x]=w.useState(null);w.useEffect(()=>{localStorage.setItem("kb-view-mode",u)},[u]);const{panelRight:f,panelWidth:y,isResizing:g,handleResizeStart:b}=em(i),v=j=>{x(j.id)},S=m?e.find(j=>j.id===m):null;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:f},onClick:r}),s.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${g?"resizing":""}`,style:{right:f,width:y,background:"var(--terminal-bg)",borderLeftColor:"#16a34a"},children:[s.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${g?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:b}),s.jsxs("div",{className:"p-5 text-white relative",style:{background:"#16a34a"},children:[s.jsx("button",{onClick:r,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:"×"}),s.jsxs("div",{className:"text-lg font-bold",children:["📚"," Knowledge Base"]}),s.jsxs("div",{className:"text-xs opacity-80 mt-0.5",children:[e.length," documents"]})]}),s.jsxs("div",{className:"flex gap-1 p-2",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx(Uf,{icon:"🕸️",label:"Graph",active:u==="graph",onClick:()=>d("graph")}),s.jsx(Uf,{icon:"🌲",label:"Tree",active:u==="tree",onClick:()=>{d("tree"),x(null)}}),s.jsx(Uf,{icon:"📋",label:"List",active:u==="list",onClick:()=>{d("list"),x(null)}})]}),u==="graph"&&s.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col animate-fadeIn",children:[s.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[s.jsx(kC,{docs:e,onNodeClick:v,selectedDocId:m}),S&&s.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:[s.jsx("div",{className:"text-[10px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Selected"}),s.jsx("div",{className:"text-xs font-bold mb-1",style:{color:"var(--terminal-text)"},children:S.title}),s.jsx("div",{className:"w-2 h-2 rounded-full mb-2",style:{background:S.status==="active"?"#16a34a":S.status==="draft"?"#f59e0b":"#94a3b8"}}),S.tldr&&s.jsx("div",{className:"text-[10px] mb-2 leading-relaxed",style:{color:"var(--terminal-text-secondary)"},children:S.tldr}),S.links.length>0&&s.jsxs("div",{className:"mb-2",children:[s.jsx("div",{className:"text-[9px] font-bold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Links"}),S.links.slice(0,5).map((j,C)=>s.jsxs("div",{className:"text-[9px] mb-0.5 truncate",style:{color:"var(--terminal-text-secondary)"},children:["🔗"," ",j.text]},C))]})]})]}),s.jsx("div",{className:"shrink-0 p-2",style:{borderTop:"1px solid var(--terminal-border)"},children:s.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(mo).map(([j,C])=>s.jsxs("div",{className:"flex items-center gap-1 text-[9px]",children:[s.jsx("div",{className:"w-2 h-2",style:{background:C.border}}),s.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:j})]},j))})})]}),u==="tree"&&s.jsx(SC,{docs:e,onDocumentClick:j=>x(j),selectedDocId:m}),u==="list"&&s.jsx(AC,{icon:"📋",title:"List View",message:"Coming soon in KB-002",description:"Table format with sortable columns and quick scanning"})]})]})}function Uf({icon:e,label:r,active:a,onClick:i}){return s.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:[s.jsx("span",{className:"text-sm",children:e}),s.jsx("span",{children:r})]})}function AC({icon:e,title:r,message:a,description:i}){return s.jsx("div",{className:"flex-1 flex items-center justify-center p-8 animate-fadeIn",children:s.jsxs("div",{className:"text-center max-w-md",children:[s.jsx("div",{className:"text-6xl mb-4",children:e}),s.jsx("div",{className:"text-lg font-bold mb-2",style:{color:"var(--terminal-text)"},children:r}),s.jsx("div",{className:"text-sm mb-3",style:{color:"#4ade80"},children:a}),s.jsx("div",{className:"text-xs leading-relaxed",style:{color:"var(--terminal-text-muted)"},children:i})]})})}function TC({standups:e,waves:r,decisions:a,mode:i,onClose:c,terminalWidth:u=0,questProgress:d,onQuestAction:m}){const[x,f]=w.useState(i==="decisions"?"decisions":d?"quests":"standups"),{panelRight:y,panelWidth:g,isResizing:b,handleResizeStart:v}=em(u);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:y},onClick:c}),s.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:y,width:g,background:"var(--terminal-bg)",borderLeftColor:"var(--desk-wood)"},children:[s.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:v}),s.jsxs("div",{className:"p-5 bg-[var(--desk-wood)] text-white relative",children:[s.jsx("button",{onClick:c,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:"×"}),s.jsx("div",{className:"text-lg font-bold",children:i==="bulletin"?"📌 Bulletin Board":"📜 Decision Log"})]}),s.jsx("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:i==="bulletin"?s.jsxs(s.Fragment,{children:[s.jsx(_c,{label:"📋 Quests",active:x==="quests",onClick:()=>f("quests")}),s.jsx(_c,{label:`Standups (${e.length})`,active:x==="standups",onClick:()=>f("standups")}),s.jsx(_c,{label:`Waves (${r.length})`,active:x==="waves",onClick:()=>f("waves")})]}):s.jsx(_c,{label:`Decisions (${a.length})`,active:x==="decisions",onClick:()=>f("decisions")})}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[x==="quests"&&d&&s.jsx(OS,{progress:d,onQuestAction:m}),x==="standups"&&e.map((S,j)=>s.jsx(qf,{title:`Standup ${S.date}`,content:S.content},j)),x==="waves"&&r.map((S,j)=>s.jsx(qf,{title:`Wave ${S.id}`,subtitle:S.timestamp,content:S.content},j)),x==="decisions"&&a.map((S,j)=>s.jsx(qf,{title:`#${S.id} ${S.title}`,subtitle:S.date,content:S.content},j))]})]})]})}function _c({label:e,active:r,onClick:a}){return s.jsx("button",{onClick:a,className:"px-4 py-2.5 text-sm font-medium cursor-pointer",style:{color:r?"var(--accent)":"var(--terminal-text-muted)",borderBottom:r?"2px solid var(--accent)":"2px solid transparent"},children:e})}function DC(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 qf({title:e,subtitle:r,content:a}){const[i,c]=w.useState(!1),u=a.length>100,d=DC(a).slice(0,160);return s.jsxs("div",{className:"mb-3 rounded-lg overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>c(!i),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"font-medium text-sm",style:{color:"var(--terminal-text)"},children:e}),s.jsx("span",{className:"text-xs shrink-0 ml-2",style:{color:"var(--terminal-text-muted)"},children:i?"▲":"▼"})]}),r&&s.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--terminal-text-muted)"},children:r})]}),i&&s.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:s.jsx(go,{content:a})}),!i&&u&&s.jsx("div",{className:"px-3 pb-2 text-xs line-clamp-2 leading-relaxed",style:{color:"var(--terminal-text-muted)"},children:d})]})}function zC({projectId:e,onClose:r,terminalWidth:a=0}){const[i,c]=w.useState(null),{panelRight:u,panelWidth:d,isResizing:m,handleResizeStart:x}=em(a);if(w.useEffect(()=>{Se.getProject(e).then(c).catch(console.error)},[e]),!i)return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:r}),s.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:s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading project..."})})]});const f=i.tasks.filter(b=>b.status==="done").length,y=i.tasks.length,g=y>0?Math.round(f/y*100):0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:r}),s.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] border-[var(--meeting-blue)] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${m?"resizing":""}`,style:{right:u,width:d,background:"var(--terminal-bg)"},children:[s.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${m?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:x}),s.jsxs("div",{className:"p-5 bg-[var(--meeting-blue)] text-white relative",children:[s.jsx("div",{className:"text-sm opacity-70",children:"Meeting Room"}),s.jsx("button",{onClick:r,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:"×"}),s.jsx("div",{className:"text-xl font-bold mt-1",children:i.name}),s.jsxs("div",{className:"flex items-center gap-3 mt-3 text-sm",children:[s.jsxs("span",{children:["Tasks: ",y]}),s.jsxs("span",{children:["Done: ",f]}),s.jsxs("span",{children:["Progress: ",g,"%"]})]}),s.jsx("div",{className:"mt-2 h-1.5 bg-white/20 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-white rounded-full transition-all",style:{width:`${g}%`}})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[i.prd&&s.jsxs("div",{className:"mb-5",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"PRD"}),s.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:s.jsx(go,{content:i.prd})})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:["Tasks (",y,")"]}),s.jsx("div",{className:"space-y-2",children:i.tasks.map(b=>s.jsxs("div",{className:"rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sm font-medium",style:{color:"var(--terminal-text)"},children:b.title}),s.jsx(RC,{status:b.status})]}),s.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-muted)"},children:b.role}),b.description&&s.jsx("div",{className:"text-xs mt-1.5 line-clamp-2",style:{color:"var(--terminal-text-secondary)"},children:b.description})]},b.id))})]})]})]})]})}function RC({status:e}){const r={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=r[e]??r.todo;return s.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:a.bg,color:a.color},children:e})}const MC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function FC({roleId:e,roleName:r,mode:a="assign",onClose:i,onExecutionStart:c}){const[u,d]=w.useState(""),m=w.useRef(null);w.useEffect(()=>{var g;(g=m.current)==null||g.focus()},[]);const x=()=>{u.trim()&&(c(e,u.trim()),i())},f=g=>{g.key==="Enter"&&(g.metaKey||g.ctrlKey)&&x(),g.key==="Escape"&&i()},y=MC[e]??"#666";return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),s.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:[s.jsxs("div",{className:"p-5 text-white",style:{background:`linear-gradient(135deg, ${y}, ${y}cc)`},children:[s.jsx("div",{className:"text-lg font-bold",children:a==="ask"?"Ask":"Assign Task"}),s.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:a==="ask"?`to ${r}`:`to ${r} (${e})`})]}),s.jsxs("div",{className:"p-5",children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Task Description"}),s.jsx("textarea",{ref:m,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"}),s.jsx("div",{className:"text-[10px] text-white/30 mt-1",children:"Cmd+Enter to submit"})]}),s.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[s.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"}),s.jsx("button",{onClick:x,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:y},children:a==="ask"?"Ask":"Assign"})]})]})]})}const V0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function qg({event:e,isThinkingCollapsed:r,onToggleThinking:a,onNavigateToJob:i,onOpenKnowledgeDoc:c,compact:u}){var m;const d=V0[e.roleId]??"#888";switch(e.type){case"text":{const x=e.data.text??"",f=u?x.slice(0,300):x;return/[#*|`\[\]_~>-]/.test(f)?s.jsx("div",{className:"text-green-300/90 leading-relaxed event-markdown",children:s.jsx(Yh,{remarkPlugins:[Qh],children:f})}):s.jsx("div",{className:"text-green-300/90 whitespace-pre-wrap leading-relaxed",children:f})}case"thinking":{const x=e.data.text??"";return s.jsxs("div",{className:"group",children:[s.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:[s.jsx("span",{children:r?"▶":"▼"}),s.jsx("span",{className:"italic",children:"thinking..."})]}),!r&&s.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:[x.slice(0,u?200:500),x.length>(u?200:500)?"...":""]})]})}case"tool:start":{const x=String(e.data.name??""),f=e.data.input,y=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):"",b=g?g.split("/").pop()??"":"",v=/^(write_file|Write|edit_file|Edit)$/i.test(x),S=(m=g.match(/(?:^|\/)knowledge\/(.+\.md)$/))==null?void 0:m[1],j=v&&S&&c;return s.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[s.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${j?"text-green-400/80 bg-green-400/10":"text-blue-400/80 bg-blue-400/10"}`,children:j?v&&x.toLowerCase().includes("edit")?"Edit":"Write":x}),j?s.jsx("button",{onClick:()=>c(S),className:"text-[10px] text-green-400 hover:text-green-300 underline underline-offset-2 cursor-pointer truncate",style:{maxWidth:u?200:400},children:b}):s.jsxs(s.Fragment,{children:[y&&s.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:y}),b&&s.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:b})]})]})}case"dispatch:start":{const x=e.data.targetRoleId??e.data.roleId??"",f=e.data.task??"",y=e.data.childJobId,g=V0[x]??"#888";return s.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:()=>y&&(i==null?void 0:i(y)),children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{style:{color:g},className:"font-bold text-[11px]",children:["→"," ",x.toUpperCase()]}),s.jsx("span",{className:"text-[var(--terminal-text-secondary)] text-[10px] truncate flex-1",children:f.slice(0,u?60:100)}),y&&i&&s.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 s.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 s.jsx("div",{className:"border-t border-[var(--terminal-border)] my-2 relative",children:s.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 s.jsxs("div",{className:"text-red-400/80 text-[11px]",children:["⚠"," ",e.data.message]});case"job:start":return s.jsxs("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pb-1",children:[s.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 x=e.data.turns??0,f=e.data.toolCalls??0;return s.jsx("div",{className:"mt-2 p-2 rounded-lg bg-green-900/20 border border-green-800/30",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-green-400"}),s.jsx("span",{className:"text-green-300 font-bold text-[11px]",children:"Complete"}),s.jsxs("span",{className:"text-[var(--terminal-text-muted)] text-[10px]",children:[x," turns · ",f," tools"]})]})})}case"job:error":return s.jsx("div",{className:"mt-2 p-2 rounded-lg bg-red-900/20 border border-red-800/30",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-red-400"}),s.jsx("span",{className:"text-red-300 font-bold text-[11px]",children:"Error"}),s.jsx("span",{className:"text-red-200/70 text-[10px]",children:e.data.message})]})});case"job:awaiting_input":{const x=e.data.question??"";return s.jsxs("div",{className:"mt-2 p-2 rounded-lg border",style:{background:"#F59E0B11",borderColor:"#F59E0B33"},children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:"#F59E0B",animation:"wave-pulse 1.5s ease-in-out infinite"}}),s.jsx("span",{className:"font-bold text-[11px]",style:{color:"#F59E0B"},children:"Awaiting Reply"})]}),x&&s.jsx("div",{className:"mt-1 text-[11px] text-[var(--terminal-text)] whitespace-pre-wrap",children:x})]})}case"job:reply":return s.jsx("div",{className:"mt-1 p-2 rounded-lg bg-blue-900/20 border border-blue-800/30",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-blue-300 font-bold text-[11px]",children:"CEO replied:"}),s.jsx("span",{className:"text-blue-200/80 text-[11px]",children:e.data.response??""})]})});case"import:scan":case"import:process":case"import:created":return s.jsxs("div",{className:"text-cyan-300/70 text-[11px]",children:["[",e.type,"] ",JSON.stringify(e.data)]});default:return null}}function _C({jobId:e,title:r,color:a,variant:i,style:c,onClose:u,onMinimize:d,onDone:m,onNavigateToJob:x,onOpenKnowledgeDoc:f}){const{events:y,status:g,textOutput:b,childJobIds:v}=wy(e),[S,j]=w.useState(0),[C,E]=w.useState(new Set),N=w.useRef(null),_=w.useRef(Date.now()),B=w.useRef(!1);w.useEffect(()=>{const G=setInterval(()=>{j(Math.floor((Date.now()-_.current)/1e3))},1e3);return()=>clearInterval(G)},[]),w.useEffect(()=>{N.current&&(N.current.scrollTop=N.current.scrollHeight)},[y]),w.useEffect(()=>{(g==="done"||g==="error")&&!B.current&&(B.current=!0,m==null||m())},[g,m]);const I=G=>{E(O=>{const V=new Set(O);return V.has(G)?V.delete(G):V.add(G),V})},F={idle:"Waiting",connecting:"Connecting...",streaming:"Working",done:"Complete",error:"Error"}[g],X={idle:"#888",connecting:"#888",streaming:a,done:"#2E7D32",error:"#C62828"}[g],W=G=>`${Math.floor(G/60)}:${String(G%60).padStart(2,"0")}`,U=g==="done"||g==="error",M=s.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:c,children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{background:X}}),s.jsx("div",{children:s.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:r})})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:W(S)}),s.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:`${X}22`,color:X},children:F}),d&&i==="modal"&&s.jsx("button",{onClick:d,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),U&&s.jsx("button",{onClick:u,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),s.jsxs("div",{ref:N,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[y.length===0&&g==="connecting"&&s.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:"Connecting to activity stream..."}),y.map(G=>s.jsx(qg,{event:G,isThinkingCollapsed:C.has(G.seq),onToggleThinking:()=>I(G.seq),onNavigateToJob:x,onOpenKnowledgeDoc:f},G.seq)),g==="streaming"&&s.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),s.jsxs("div",{className:"px-5 py-3 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[s.jsxs("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:[y.length>0&&`${y.length} events`,b.length>0&&` · ${b.length} chars`,v.length>0&&` · ${v.length} dispatches`]}),U&&s.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"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:U?u:void 0}),M]}):M}const Yf={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function OC({orgNodes:e,rootId:r}){const a=e[r];if(!a)return null;const c=a.children.map(m=>e[m]).filter(Boolean),u=[];for(const m of c)for(const x of m.children){const f=e[x];f&&u.push({node:f,parentId:m.id})}const d=c.length+u.length;return s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Propagation Preview"}),s.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-lg p-4",children:[s.jsx("div",{className:"flex justify-center mb-2",children:s.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"})}),c.length>0&&s.jsx("div",{className:"flex justify-center mb-1",children:s.jsx("div",{className:"w-px h-3 bg-white/15"})}),c.length>1&&s.jsx("div",{className:"flex justify-center mb-1",children:s.jsx("div",{className:"h-px bg-white/15",style:{width:`${Math.min(c.length*80,320)}px`}})}),s.jsx("div",{className:"flex justify-center gap-3 mb-2 flex-wrap",children:c.map(m=>s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("span",{className:"px-2.5 py-1 text-[10px] font-bold rounded border-2 uppercase",style:{borderColor:Yf[m.id]??"#888",color:Yf[m.id]??"#888",background:`${Yf[m.id]??"#888"}22`},children:m.id}),s.jsx("span",{className:"text-[8px] text-white/30 mt-0.5",children:"direct"})]},m.id))}),u.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex justify-center mb-1",children:s.jsx("div",{className:"w-px h-2 bg-white/10"})}),s.jsx("div",{className:"flex justify-center gap-2 flex-wrap",children:u.map(({node:m})=>s.jsx("span",{className:"px-2 py-0.5 text-[9px] font-semibold rounded border border-white/15 text-white/40 uppercase",children:m.id},m.id))}),s.jsx("div",{className:"text-center text-[8px] text-white/30 mt-1",children:"via re-dispatch"})]})]}),s.jsxs("div",{className:"text-[10px] text-gray-400 mt-1.5",children:[d," role",d!==1?"s":""," will receive this wave"]})]})}function BC({cLevelRoles:e,orgNodes:r,rootId:a,onClose:i,onDispatch:c}){const[u,d]=w.useState(""),m=w.useRef(null);w.useEffect(()=>{var g;(g=m.current)==null||g.focus()},[]);const x=()=>{!u.trim()||e.length===0||(c(u.trim()),i())},f=g=>{g.key==="Enter"&&(g.metaKey||g.ctrlKey)&&x(),g.key==="Escape"&&i()},y=a&&Object.keys(r).length>0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),s.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:[s.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[s.jsx("div",{className:"text-lg font-bold",children:"CEO Wave"}),s.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:"Broadcast a directive to all C-Level reports"})]}),s.jsxs("div",{className:"p-5 space-y-4",children:[y&&s.jsx(OC,{orgNodes:r,rootId:a}),!y&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Dispatching to"}),s.jsx("div",{className:"flex gap-2 flex-wrap",children:e.length>0?e.map(g=>s.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:[g.id.toUpperCase()," · ",g.name]},g.id)):s.jsx("span",{className:"text-xs text-gray-400 italic",children:"No C-Level roles found"})}),s.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Each C-Level receives the directive and delegates to their reports"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Directive"}),s.jsx("textarea",{ref:m,value:u,onChange:g=>d(g.target.value),onKeyDown:f,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"}),s.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Cmd+Enter to dispatch"})]})]}),s.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[s.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"}),s.jsxs("button",{onClick:x,disabled:!u.trim()||e.length===0,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#B71C1C"},children:["Dispatch to ",e.length," Role",e.length!==1?"s":""]})]})]})]})}function $C(e,r,a){const[i,c]=w.useState(new Map),[u,d]=w.useState(null),m=w.useRef(new Map),x=w.useRef(i);x.current=i,w.useEffect(()=>{if(!a||Object.keys(r).length===0)return;const b=new Map,v=j=>{const C=r[j];C&&(b.set(j,{jobId:null,roleId:j,roleName:C.name,children:C.children,status:"waiting",events:[],streamStatus:"idle"}),C.children.forEach(v))},S=r[a];S&&(b.set(a,{jobId:null,roleId:a,roleName:"CEO",children:S.children,status:"not-dispatched",events:[],streamStatus:"idle"}),S.children.forEach(v));for(const j of e){const C=b.get(j.roleId);C&&(C.jobId=j.jobId,C.status="running",C.streamStatus="connecting")}c(b),e.length>0&&d(e[0].roleId)},[e,r,a]);const f=w.useCallback((b,v)=>{console.log(`[WaveTree] connectStream → role=${v} job=${b}`);const S=m.current.get(b);S&&S.controller.abort();const j=new AbortController,C={controller:j,lastSeq:-1};m.current.set(b,C);const N=`/api/jobs/${b}/stream?from=0`;fetch(N,{signal:j.signal}).then(async _=>{if(!_.ok||!_.body){c(X=>{const W=new Map(X),U=W.get(v);return U&&W.set(v,{...U,streamStatus:"error"}),W});return}c(X=>{const W=new Map(X),U=W.get(v);return U&&W.set(v,{...U,streamStatus:"streaming",status:"running"}),W});const B=_.body.getReader(),I=new TextDecoder;let F="";for(;;){const{done:X,value:W}=await B.read();if(X)break;F+=I.decode(W,{stream:!0});const U=F.split(`
|
|
81
|
+
`);F=U.pop()??"";let M="";for(const G of U)if(G.startsWith("event: "))M=G.slice(7).trim();else if(G.startsWith("data: ")){try{const O=JSON.parse(G.slice(6));if(M==="activity"){const V=O;V.seq>C.lastSeq&&(C.lastSeq=V.seq),c(J=>{const Q=new Map(J),H=Q.get(v);if(!H||H.events.some(ne=>ne.seq===V.seq))return J;const Y={...H,events:[...H.events,V]};if(V.type==="dispatch:start"&&V.data.childJobId){const ne=V.data.childJobId,we=V.data.targetRoleId??V.data.roleId;if(console.log(`[WaveTree] dispatch:start → target=${we} childJob=${ne} from=${v}/${b}`),we){const T=Q.get(we);T?(Q.set(we,{...T,jobId:ne,status:"running",streamStatus:"connecting"}),setTimeout(()=>f(ne,we),0)):console.warn(`[WaveTree] dispatch:start — no node found for role "${we}"`)}}return V.type==="job:done"?(console.log(`[WaveTree] job:done → role=${v} job=${b}`),Y.status="done",Y.streamStatus="done"):V.type==="job:error"?(console.log(`[WaveTree] job:error → role=${v} job=${b}`),Y.status="error",Y.streamStatus="error"):V.type==="job:awaiting_input"?(console.log(`[WaveTree] job:awaiting_input → role=${v} job=${b}`),Y.status="awaiting_input",Y.streamStatus="done"):V.type==="job:reply"&&(console.log(`[WaveTree] job:reply → role=${v} job=${b}`),Y.status="running",Y.streamStatus="streaming"),Q.set(v,Y),Q})}else if(M==="stream:end"){const V=O.reason;console.log(`[WaveTree] stream:end → role=${v} job=${b} reason=${V}`),V!=="replied"&&c(J=>{const Q=new Map(J),H=Q.get(v);if(!H)return J;const Y=V==="error"?"error":V==="awaiting_input"?"awaiting_input":"done";return Q.set(v,{...H,status:H.status==="running"?Y:H.status,streamStatus:Y==="error"?"error":"done"}),Q})}}catch{}M=""}}}).catch(_=>{_.name!=="AbortError"&&c(B=>{const I=new Map(B),F=I.get(v);return F&&I.set(v,{...F,streamStatus:"error"}),I})})},[]);w.useEffect(()=>{if(e.length!==0){for(const b of e)f(b.jobId,b.roleId);return()=>{for(const[,b]of m.current)b.controller.abort();m.current.clear()}}},[e,f]);const y=(()=>{let b=0,v=0,S=0,j=0;for(const[C,E]of i)C!==a&&(j++,E.status==="done"?b++:E.status==="running"?v++:E.status==="awaiting_input"&&S++);return{done:b,total:j,running:v,awaitingInput:S}})(),g=y.total>0&&y.running===0&&y.awaitingInput===0&&Array.from(i.values()).every(b=>b.status!=="running"&&b.status!=="awaiting_input"&&b.streamStatus!=="streaming"&&b.streamStatus!=="connecting");return w.useEffect(()=>{g&&c(b=>{const v=new Map(b);let S=!1;for(const[j,C]of v)C.status==="waiting"&&(v.set(j,{...C,status:"not-dispatched"}),S=!0);return S?v:b})},[g]),{nodes:i,selectedRoleId:u,selectNode:d,progress:y,allDone:g,connectStream:f}}const G0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},Vl=120,Da=44,Q0=80;function LC(e,r){if(!e.get(r))return{layout:[],width:300,height:200};const i=[],c=[],u=[{id:r,depth:0,parentId:null}],d=new Set;for(;u.length>0;){const{id:y,depth:g,parentId:b}=u.shift();if(d.has(y))continue;for(d.add(y);c.length<=g;)c.push([]);c[g].push(y),i.push({roleId:y,x:0,y:g*Q0+20,parentId:b});const v=e.get(y);if(v)for(const S of v.children)e.has(S)&&!d.has(S)&&u.push({id:S,depth:g+1,parentId:y})}const m=Math.max(...c.map(y=>y.length))*(Vl+16),x=Math.max(m,280);for(const y of c){const g=y.length*(Vl+16)-16,b=(x-g)/2;y.forEach((v,S)=>{const j=i.find(C=>C.roleId===v);j&&(j.x=b+S*(Vl+16))})}const f=c.length*Q0+40;return{layout:i,width:x,height:f}}function HC({nodes:e,rootId:r,selectedRoleId:a,onSelectNode:i}){const{layout:c,width:u,height:d}=LC(e,r),m=f=>{const y=c.find(g=>g.roleId===f);return y?{cx:y.x+Vl/2,cy:y.y+Da/2}:{cx:0,cy:0}},x=f=>{switch(f.status){case"running":return G0[f.roleId]??"#FBBF24";case"awaiting_input":return"#F59E0B";case"done":return"#2E7D32";case"error":return"#C62828";case"not-dispatched":return"#666";default:return"#888"}};return s.jsxs("svg",{viewBox:`0 0 ${u} ${d}`,width:Math.max(u,280),height:d,className:"block",style:{minWidth:u},children:[s.jsx("defs",{children:s.jsxs("filter",{id:"glow",children:[s.jsx("feGaussianBlur",{stdDeviation:"2",result:"blur"}),s.jsxs("feMerge",{children:[s.jsx("feMergeNode",{in:"blur"}),s.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),c.filter(f=>f.parentId).map(f=>{const y=m(f.parentId),g=m(f.roleId),b=e.get(f.roleId),v=e.get(f.parentId);let S="rgba(180,200,240,0.15)",j="4 4",C="";return(b==null?void 0:b.status)==="done"||(v==null?void 0:v.status)==="done"?(S="#2E7D3266",j=""):(b==null?void 0:b.status)==="awaiting_input"?(S="#F59E0B",j="6 4",C="wave-edge-flow"):(b==null?void 0:b.status)==="running"&&(S=G0[f.roleId]??"#FBBF24",j="6 4",C="wave-edge-flow"),s.jsx("line",{x1:y.cx,y1:y.cy+Da/2-4,x2:g.cx,y2:g.cy-Da/2+4,stroke:S,strokeWidth:1.5,strokeDasharray:j,className:C},`${f.parentId}-${f.roleId}`)}),c.map(f=>{const y=e.get(f.roleId);if(!y)return null;const g=x(y),b=a===f.roleId,v=f.roleId===r,S=v?.4:y.status==="not-dispatched"?.35:1;return s.jsxs("g",{transform:`translate(${f.x}, ${f.y})`,style:{cursor:v?"default":"pointer",opacity:S},onClick:()=>!v&&i(f.roleId),children:[s.jsx("rect",{x:0,y:0,width:Vl,height:Da,rx:8,ry:8,fill:"var(--terminal-bg-deeper, #181825)",stroke:b?"#fff":g,strokeWidth:b?2:1.5,strokeDasharray:y.status==="not-dispatched"?"4 3":""}),s.jsx("circle",{cx:14,cy:Da/2,r:4,fill:g,filter:y.status==="running"||y.status==="awaiting_input"?"url(#glow)":void 0,children:(y.status==="running"||y.status==="awaiting_input")&&s.jsx("animate",{attributeName:"opacity",values:"1;0.4;1",dur:"1.5s",repeatCount:"indefinite"})}),s.jsx("text",{x:26,y:Da/2-4,fill:"var(--terminal-text, #fff)",fontSize:10,fontWeight:700,fontFamily:"var(--pixel-font)",children:y.roleId.toUpperCase()}),s.jsx("text",{x:26,y:Da/2+10,fill:"var(--terminal-text-muted, #888)",fontSize:8,fontFamily:"var(--pixel-font)",children:y.status==="running"?"Working...":y.status==="awaiting_input"?"Awaiting Reply":y.status==="done"?"Complete":y.status==="error"?"Error":y.status==="waiting"?"Waiting":""}),y.status==="done"&&s.jsx("text",{x:Vl-18,y:Da/2+4,fontSize:14,fill:"#2E7D32",children:"✓"}),y.status==="error"&&s.jsx("text",{x:Vl-18,y:Da/2+4,fontSize:14,fill:"#C62828",children:"✗"})]},f.roleId)})]})}const IC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function UC({directive:e,rootJobs:r,orgNodes:a,rootRoleId:i,onClose:c,onMinimize:u,onDone:d,onOpenKnowledgeDoc:m,onSave:x}){const{nodes:f,selectedRoleId:y,selectNode:g,progress:b,allDone:v,connectStream:S}=$C(r,a,i),[j,C]=w.useState(0),[E,N]=w.useState(new Set),[_,B]=w.useState(""),[I,F]=w.useState(!1),[X,W]=w.useState(!1),U=w.useRef(null),M=w.useRef(Date.now()),G=w.useRef(!1),O=w.useCallback(async()=>{if(x){W(!0);try{const z=r.map(Z=>Z.jobId);await x(z)}catch(z){console.error("Save failed:",z)}finally{W(!1),c()}}},[x,r,c]),V=w.useCallback(async()=>{if(!y||!_.trim())return;const z=f.get(y);if(!(!(z!=null&&z.jobId)||z.status!=="awaiting_input")){F(!0);try{const{jobId:Z}=await Se.replyToJob(z.jobId,_.trim());B(""),S(Z,y)}catch(Z){console.error("Reply failed:",Z)}finally{F(!1)}}},[y,_,f,S]),J=w.useCallback(async z=>{const Z=f.get(z);if(Z!=null&&Z.jobId)try{await Se.abortJob(Z.jobId)}catch(D){console.error("Abort failed:",D)}},[f]),Q=w.useCallback(async()=>{for(const[,z]of f)if((z.status==="running"||z.status==="awaiting_input")&&z.jobId)try{await Se.abortJob(z.jobId)}catch{}},[f]);w.useEffect(()=>{const z=setInterval(()=>{C(Math.floor((Date.now()-M.current)/1e3))},1e3);return()=>clearInterval(z)},[]);const H=w.useRef(!1);w.useEffect(()=>{const z=U.current;if(!z)return;const Z=()=>{const D=z.scrollHeight-z.scrollTop-z.clientHeight<60;H.current=!D};return z.addEventListener("scroll",Z),()=>z.removeEventListener("scroll",Z)},[]),w.useEffect(()=>{H.current=!1,U.current&&(U.current.scrollTop=U.current.scrollHeight)},[y]),w.useEffect(()=>{U.current&&!H.current&&(U.current.scrollTop=U.current.scrollHeight)},[f]),w.useEffect(()=>{v&&!G.current&&(G.current=!0,d==null||d())},[v,d]);const Y=z=>`${Math.floor(z/60)}:${String(z%60).padStart(2,"0")}`,ne=y?f.get(y):null,we=y?IC[y]??"#888":"#888",T=z=>{N(Z=>{const D=new Set(Z);return D.has(z)?D.delete(z):D.add(z),D})};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm pointer-events-none"}),s.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:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:v?"#2E7D32":"#B71C1C",animation:v?void 0:"wave-pulse 2s ease-in-out infinite"}}),s.jsx("div",{children:s.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:v?"WAVE COMPLETE":"WAVE COMMAND CENTER"})})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:Y(j)}),b.awaitingInput>0&&s.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:"#F59E0B22",color:"#F59E0B"},children:[b.awaitingInput," awaiting reply"]}),s.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:v?"#2E7D3222":"#B71C1C22",color:v?"#2E7D32":"#B71C1C"},children:[b.done,"/",b.total," done"]}),!v&&(b.running>0||b.awaitingInput>0)&&s.jsx("button",{onClick:Q,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"}),s.jsx("button",{onClick:u,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),s.jsx("button",{onClick:c,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",title:v?"Dismiss wave":"Close (jobs keep running)",children:"×"})]})]}),s.jsx("div",{className:"px-5 py-2 border-b border-[var(--terminal-border)] shrink-0",children:s.jsxs("span",{className:"text-[var(--terminal-text-secondary)] text-xs italic",children:["“",e,"”"]})}),s.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[s.jsxs("div",{className:"shrink-0 border-b border-[var(--terminal-border)] flex flex-col",children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-1.5",children:[s.jsx("span",{className:"text-[10px] font-bold text-[var(--terminal-text-secondary)] uppercase tracking-wider",children:"Org Propagation"}),s.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(z=>s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:z.color,animation:z.dot?"wave-pulse 1.5s ease-in-out infinite":void 0}}),s.jsx("span",{className:"text-[8px] text-[var(--terminal-text-muted)]",children:z.label})]},z.label))})]}),s.jsx("div",{className:"overflow-x-auto overflow-y-auto px-3 pb-2",style:{maxHeight:"35vh"},children:s.jsx(HC,{nodes:f,rootId:i,selectedRoleId:y,onSelectNode:g})})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[ne&&s.jsxs("div",{className:"px-4 py-2 border-b border-[var(--terminal-border)] shrink-0 flex items-center gap-2",children:[s.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:we}}),s.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-xs",children:ne.roleId.toUpperCase()}),s.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs",children:ne.roleName}),s.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full font-semibold",style:{background:ne.status==="awaiting_input"?"#F59E0B22":`${we}22`,color:ne.status==="awaiting_input"?"#F59E0B":we},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"}),(ne.status==="running"||ne.status==="awaiting_input")&&ne.jobId&&s.jsx("button",{onClick:()=>J(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"},title:"Force stop this job",children:"Stop"})]}),s.jsxs("div",{ref:U,className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-1 text-xs font-mono select-text",children:[ne&&ne.events.length===0&&s.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 in this wave.":""}),ne==null?void 0:ne.events.map(z=>s.jsx(qg,{event:z,isThinkingCollapsed:E.has(z.seq),onToggleThinking:()=>T(z.seq),onNavigateToJob:Z=>{for(const[,D]of f)if(D.jobId===Z){g(D.roleId);return}},onOpenKnowledgeDoc:m},z.seq)),(ne==null?void 0:ne.status)==="running"&&s.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),(ne==null?void 0:ne.status)==="awaiting_input"&&s.jsxs("div",{className:"px-4 py-3 border-t border-[var(--terminal-border)] shrink-0",style:{background:"#F59E0B0A"},children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:"#F59E0B",animation:"wave-pulse 1.5s ease-in-out infinite"}}),s.jsxs("span",{className:"text-[11px] font-semibold",style:{color:"#F59E0B"},children:[ne.roleName," is waiting for your response"]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",value:_,onChange:z=>B(z.target.value),onKeyDown:z=>{z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),V())},placeholder:"Type your response...",disabled:I,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}),s.jsx("button",{onClick:V,disabled:I||!_.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:I?"...":"Reply"})]})]}),!ne&&s.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"}),s.jsxs("div",{className:"px-4 py-2 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:ne&&ne.events.length>0&&`${ne.events.length} events`}),v&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:c,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"}),x&&s.jsx("button",{onClick:O,disabled:X,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer disabled:opacity-50",style:{background:"#2E7D32"},children:X?"Saving...":"Save Wave"})]})]})]})]})]})]})}const qC={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 tm(e){return qC[e]??{skinColor:"#B0BEC5",hairColor:"#78909C",shirtColor:"#607D8B",pantsColor:"#455A64",shoeColor:"#37474F"}}const Yg=["#FDEBD0","#F5CBA7","#D4A07A","#C68642","#8D5524","#5C3A1E","#F3D1C7","#E8BEAC","#B07D62","#704214"],Xg=["#1A0A00","#2C1810","#4E342E","#6D4C41","#8D6E63","#D4A574","#F5E6CA","#FFD700","#B71C1C","#AD1457","#4A148C","#1A237E","#004D40","#1A1A1A","#78909C","#E0E0E0"],Vg=["#1565C0","#E65100","#2E7D32","#4A148C","#AD1457","#00695C","#D32F2F","#F57F17","#1B5E20","#283593","#4E342E","#37474F","#880E4F","#00838F","#6A1B9A","#FF6F00"],Gg=["#37474F","#1A237E","#3E2723","#263238","#1B5E20","#455A64","#212121","#4E342E","#0D47A1","#311B92"],Qg=["#212121","#1A1A1A","#37474F","#4E342E","#7B1FA2","#D32F2F","#1565C0","#F57F17","#2E7D32","#FFFFFF"],bl={default:{name:"MIDNIGHT",icon:"🌃",vars:{"--floor-light":"#0d1117","--floor-dark":"#0a0e14","--hud-bg":"#0d1117","--hud-bg-alt":"#161b22","--pixel-border":"#30363d","--terminal-bg":"#0d1117","--terminal-border":"#21262d","--terminal-border-hover":"#388bfd","--terminal-text":"#e6edf3","--terminal-text-secondary":"#8b949e","--terminal-text-muted":"#484f58","--accent":"#388bfd","--active-green":"#3fb950","--idle-amber":"#d29922"}},light:{name:"DAYLIGHT",icon:"☀️",vars:{"--floor-light":"#f6f8fa","--floor-dark":"#eaeef2","--hud-bg":"#24292f","--hud-bg-alt":"#32383f","--pixel-border":"#d0d7de","--terminal-bg":"#ffffff","--terminal-border":"#d0d7de","--terminal-border-hover":"#0969da","--terminal-text":"#1f2328","--terminal-text-secondary":"#656d76","--terminal-text-muted":"#8c959f","--accent":"#0969da","--active-green":"#1a7f37","--idle-amber":"#9a6700"}},retro:{name:"RETRO",icon:"🎮",vars:{"--floor-light":"#1a1410","--floor-dark":"#140f0a","--hud-bg":"#1a1410","--hud-bg-alt":"#2a2018","--pixel-border":"#5c4a32","--terminal-bg":"#1a1410","--terminal-border":"#3a2e20","--terminal-border-hover":"#d4a44e","--terminal-text":"#e8d5b0","--terminal-text-secondary":"#a08860","--terminal-text-muted":"#6b5840","--accent":"#d4a44e","--active-green":"#8bba4a","--idle-amber":"#e8a030"}},cyberpunk:{name:"NEON",icon:"🌌",vars:{"--floor-light":"#0a0014","--floor-dark":"#06000e","--hud-bg":"#0a0014","--hud-bg-alt":"#14002a","--pixel-border":"#4a1a80","--terminal-bg":"#0a0014","--terminal-border":"#2a0a50","--terminal-border-hover":"#e040fb","--terminal-text":"#e0d0ff","--terminal-text-secondary":"#9070c0","--terminal-text-muted":"#5a3a80","--accent":"#e040fb","--active-green":"#00ff88","--idle-amber":"#ffab00"}},forest:{name:"FOREST",icon:"🌲",vars:{"--floor-light":"#0a1410","--floor-dark":"#060e0a","--hud-bg":"#0a1410","--hud-bg-alt":"#142a1e","--pixel-border":"#2a5a3a","--terminal-bg":"#0a1410","--terminal-border":"#1a3a26","--terminal-border-hover":"#4ade80","--terminal-text":"#d0f0d8","--terminal-text-secondary":"#70a880","--terminal-text-muted":"#3a6848","--accent":"#4ade80","--active-green":"#86efac","--idle-amber":"#fcd34d"}},ocean:{name:"OCEAN",icon:"🌊",vars:{"--floor-light":"#0a1420","--floor-dark":"#060e18","--hud-bg":"#0a1420","--hud-bg-alt":"#142a40","--pixel-border":"#1e4a6a","--terminal-bg":"#0a1420","--terminal-border":"#163050","--terminal-border-hover":"#38bdf8","--terminal-text":"#d0e8f8","--terminal-text-secondary":"#6090b0","--terminal-text-muted":"#305070","--accent":"#38bdf8","--active-green":"#34d399","--idle-amber":"#fbbf24"}}};function YC({color:e,selected:r,onClick:a}){return s.jsx("button",{onClick:a,className:"customize-swatch",style:{background:e,outline:r?"2px solid #fff":"2px solid transparent",boxShadow:r?`0 0 0 1px ${e}, 0 0 6px ${e}88`:"none"}})}function Zs({label:e,presets:r,value:a,onChange:i}){return s.jsxs("div",{className:"customize-row",children:[s.jsxs("div",{className:"customize-row-header",children:[s.jsx("span",{className:"customize-row-label",children:e}),s.jsx("div",{className:"customize-row-current",style:{background:a}})]}),s.jsx("div",{className:"customize-swatches",children:r.map(c=>s.jsx(YC,{color:c,selected:c===a,onClick:()=>i(c)},c))})]})}function Xf({label:e,items:r,value:a,onChange:i,lockInfo:c}){return s.jsxs("div",{className:"customize-row",children:[s.jsx("div",{className:"customize-row-header",children:s.jsx("span",{className:"customize-row-label",children:e})}),s.jsx("div",{className:"customize-swatches",style:{gap:4},children:r.map(u=>{const d=c?c.getLockLevel(u.id):1,m=u.id===a,x=c?d>c.roleLevel&&!m:!1,f=c?m&&d>c.roleLevel:!1;return s.jsxs("button",{onClick:()=>{x||i(u.id===a?void 0:u.id)},className:"customize-swatch",style:{width:"auto",height:"auto",padding:x?"2px 6px 10px 6px":"2px 6px",fontSize:9,fontFamily:"var(--font-pixel, monospace)",background:m?"rgba(255,255,255,0.15)":x?"rgba(255,255,255,0.02)":"rgba(255,255,255,0.04)",outline:m?f?"2px solid #F59E0B":"2px solid #fff":"2px solid transparent",color:x?"rgba(255,255,255,0.25)":m?"#fff":"rgba(255,255,255,0.5)",borderRadius:4,cursor:x?"not-allowed":"pointer",opacity:x?.35:1,position:"relative"},children:[u.name,x&&s.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&&s.jsxs("span",{style:{position:"absolute",bottom:-8,left:"50%",transform:"translateX(-50%)",fontSize:7,color:"#F59E0B",whiteSpace:"nowrap"},children:["⚠"," Lv.",d]})]},u.id)})})]})}function Vf({label:e,active:r,onClick:a}){return s.jsx("button",{onClick:a,style:{flex:1,padding:"6px 0",fontSize:10,fontFamily:"var(--font-pixel, monospace)",fontWeight:"bold",letterSpacing:1,background:r?"rgba(255,255,255,0.08)":"transparent",color:r?"#fff":"rgba(255,255,255,0.35)",border:"none",borderBottom:r?"2px solid #3B82F6":"2px solid transparent",cursor:"pointer",transition:"all 0.15s"},children:e})}function fl(e){return e[Math.floor(Math.random()*e.length)]}function Hi(e){var c,u,d;const r=Tg(),a=Dg(),i=zg().filter(m=>!e||Mg(m.id,e));return{skinColor:fl(Yg),hairColor:fl(Xg),shirtColor:fl(Vg),pantsColor:fl(Gg),shoeColor:fl(Qg),hairStyle:(c=fl(r))==null?void 0:c.id,outfitStyle:(u=fl(a))==null?void 0:u.id,accessory:(d=fl(i))==null?void 0:d.id}}function Wg({roleId:e,appearance:r,onChange:a,onRandomize:i,onReset:c,label:u,roleLevel:d}){const[m,x]=w.useState("look"),f=w.useCallback((C,E)=>{a({...r,[C]:E})},[r,a]),y=w.useRef(null),g=w.useCallback(C=>{var _;const E=(_=C.target.files)==null?void 0:_[0];if(!E)return;const N=new Image;N.onload=()=>{const B=lS(N);a({...B,hairStyle:r.hairStyle,outfitStyle:r.outfitStyle,accessory:r.accessory}),URL.revokeObjectURL(N.src)},N.src=URL.createObjectURL(E),C.target.value=""},[r.hairStyle,r.outfitStyle,r.accessory,a]),b=Tg(),v=Dg(),S=zg(),j=d!==void 0?S.filter(C=>Mg(C.id,d)).length:S.length;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"customize-preview",children:[s.jsx("div",{className:"customize-preview-bg",children:s.jsx(uo,{roleId:e,appearance:r,scale:12})}),u&&s.jsx("div",{className:"customize-preview-name",children:u}),s.jsxs("div",{className:"customize-preview-actions",children:[s.jsx("button",{className:"customize-btn customize-btn--random",onClick:i,children:"RANDOM"}),s.jsx("button",{className:"customize-btn customize-btn--reset",onClick:c,children:"RESET"}),s.jsx("button",{className:"customize-btn",onClick:()=>{var C;return(C=y.current)==null?void 0:C.click()},style:{fontSize:9,opacity:.7},children:"PHOTO"}),s.jsx("input",{ref:y,type:"file",accept:"image/*",onChange:g,style:{display:"none"}})]})]}),s.jsxs("div",{className:"customize-colors",children:[s.jsxs("div",{style:{display:"flex",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:[s.jsx(Vf,{label:"LOOK",active:m==="look",onClick:()=>x("look")}),s.jsx(Vf,{label:"OUTFIT",active:m==="outfit",onClick:()=>x("outfit")}),s.jsx(Vf,{label:"ACCESSORY",active:m==="accessory",onClick:()=>x("accessory")})]}),m==="look"&&s.jsxs(s.Fragment,{children:[s.jsx(Zs,{label:"SKIN",presets:Yg,value:r.skinColor,onChange:C=>f("skinColor",C)}),s.jsx(Zs,{label:"HAIR COLOR",presets:Xg,value:r.hairColor,onChange:C=>f("hairColor",C)}),s.jsx(Xf,{label:"HAIR STYLE",items:b,value:r.hairStyle,onChange:C=>f("hairStyle",C)})]}),m==="outfit"&&s.jsxs(s.Fragment,{children:[s.jsx(Xf,{label:"STYLE",items:v,value:r.outfitStyle,onChange:C=>f("outfitStyle",C)}),s.jsx(Zs,{label:"TOP",presets:Vg,value:r.shirtColor,onChange:C=>f("shirtColor",C)}),s.jsx(Zs,{label:"PANTS",presets:Gg,value:r.pantsColor,onChange:C=>f("pantsColor",C)}),s.jsx(Zs,{label:"SHOES",presets:Qg,value:r.shoeColor,onChange:C=>f("shoeColor",C)})]}),m==="accessory"&&s.jsxs(s.Fragment,{children:[d!==void 0&&s.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:[s.jsxs("span",{children:["Lv.",d]}),s.jsxs("span",{children:[j,"/",S.length," unlocked"]})]}),s.jsx(Xf,{label:"ACCESSORY",items:S,value:r.accessory,onChange:C=>f("accessory",C),lockInfo:d!==void 0?{roleLevel:d,getLockLevel:Rg}:void 0}),s.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 XC=[{value:"c-level",label:"C-Level"},{value:"team-lead",label:"Team Lead"},{value:"member",label:"Member"}];function wh(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,24)}function Gf(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"}};case"team-lead":return{authority:{autonomous:["Task planning","Sprint management"],needsApproval:["Architecture changes","New tool adoption"]},knowledge:{reads:["projects/","architecture/"],writes:["projects/"]},reports:{daily:"standup",weekly:"summary"}};default:return{authority:{autonomous:["Implementation within assigned tasks"],needsApproval:["Design changes","New dependencies"]},knowledge:{reads:["projects/"],writes:[]},reports:{daily:"standup",weekly:""}}}}let xl=null;async function VC(){if(xl)return xl;try{const a=await Se.getPreferences();if(a.instanceId)return xl=a.instanceId,localStorage.setItem("tycono_instance_id",xl),xl}catch{}const e="tycono_instance_id";let r=localStorage.getItem(e);return r||(r=crypto.randomUUID(),localStorage.setItem(e,r)),xl=r,r}const Ps=4;function GC(e,r,a){const i=e.trim();if(!i||i.startsWith("#"))return null;const c=i.split(",").map(g=>g.trim()),u=c[0];if(!u)return null;const d=wh(u),m=(c[1]||"member").toLowerCase(),x=m==="c-level"?"c-level":m==="team-lead"?"team-lead":"member",f=c[2]||"ceo";let y;return r.has(d)?y="ID already exists":a.has(d)&&(y="Duplicate ID in batch"),a.add(d),{name:u,id:d,level:x,reportsTo:f,error:y}}function QC({existingRoles:e,onClose:r,onHire:a,onStoreVisit:i}){const[c,u]=w.useState("single"),[d,m]=w.useState([]),[x,f]=w.useState(!1),[y,g]=w.useState("popular"),[b,v]=w.useState(""),[S,j]=w.useState(null),[C,E]=w.useState(!1),[N,_]=w.useState(""),[B,I]=w.useState("browse"),[F,X]=w.useState(""),[W,U]=w.useState(""),[M,G]=w.useState("ceo"),[O,V]=w.useState(null),[J,Q]=w.useState(1),[H,Y]=w.useState(""),[ne,we]=w.useState(""),[T,z]=w.useState(!1),[Z,D]=w.useState("member"),[xe,Ce]=w.useState("ceo"),[ge,Me]=w.useState(""),[Ee,Ie]=w.useState(Hi),[oe,at]=w.useState(!1),[Ct,jt]=w.useState(""),[Vt,pe]=w.useState([]),[he,ke]=w.useState(new Set),[Ae,Fe]=w.useState(""),[Re,Ne]=w.useState("input"),[ze,Pe]=w.useState({done:0,total:0}),_e=w.useRef(null),et=w.useRef(null),re=w.useRef(null);w.useEffect(()=>{Se.getSkills().then(P=>pe(P.filter(Ue=>Ue.installed))).catch(()=>{}),VC().then(P=>V(P)).catch(()=>{})},[]),w.useEffect(()=>{var P,Ue,Rt;c==="single"?(J===1&&((P=_e.current)==null||P.focus()),J===2&&((Ue=et.current)==null||Ue.focus())):c==="bulk"&&Re==="input"&&((Rt=re.current)==null||Rt.focus())},[J,c,Re]),w.useEffect(()=>{c==="store"&&B==="browse"&&d.length===0&&ye()},[c,B]);const ye=async()=>{f(!0);try{const P=await rr.getCharacters({sort:y,instanceId:O??void 0});m(P.characters)}catch{_("Failed to load store")}f(!1)};w.useEffect(()=>{c==="store"&&B==="browse"&&ye()},[y,O]);const De=w.useMemo(()=>{if(!b.trim())return d;const P=b.toLowerCase();return d.filter(Ue=>Ue.name.toLowerCase().includes(P)||Ue.id.toLowerCase().includes(P)||(Ue.tagline??"").toLowerCase().includes(P))},[d,b]),He=w.useMemo(()=>new Set(e.map(P=>P.id)),[e]),de=w.useMemo(()=>{const P=Ae.split(`
|
|
82
|
+
`),Ue=new Set;return P.map(Rt=>GC(Rt,He,Ue)).filter(Rt=>Rt!==null)},[Ae,He]),Te=de.length>0&&de.every(P=>!P.error),wt=P=>{Y(P),T||we(wh(P))},it=H.trim().length>0&&ne.trim().length>0&&!e.some(P=>P.id===ne),rt=ge.trim().length>0,yt=async()=>{at(!0),jt("");const P=Gf(Z);try{await a({id:ne,name:H.trim(),level:Z,reportsTo:xe,persona:ge.trim(),...P,skills:he.size>0?[...he]:void 0},Ee),r()}catch(Ue){jt(Ue instanceof Error?Ue.message:"Failed to create role"),at(!1)}},st=P=>P===1?it:P===2?rt:!0,bn=async()=>{at(!0),jt(""),Pe({done:0,total:de.length});try{for(let P=0;P<de.length;P++){const Ue=de[P],Rt=Gf(Ue.level),tt=Hi(),Pt=`${Ue.name}. A ${Ue.level} role reporting to ${Ue.reportsTo}.`;await a({id:Ue.id,name:Ue.name,level:Ue.level,reportsTo:Ue.reportsTo,persona:Pt,...Rt},tt),Pe({done:P+1,total:de.length})}r()}catch(P){jt(P instanceof Error?P.message:"Failed to create roles"),at(!1)}},Yt=async P=>{E(!0),_("");try{const Ue=await rr.getCharacter(P);j(Ue),X(Ue.name||""),U(wh(Ue.name||P)),I("review")}catch{_("Failed to load character details")}finally{E(!1)}},oa=async(P,Ue)=>{if(!O)return;const Rt=d.find(Pt=>Pt.id===P);if(!Rt)return;const tt=Rt.my_vote===Ue?0:Ue;try{const Pt=await rr.voteCharacter(P,O,tt);m(Jt=>Jt.map(An=>An.id===P?{...An,upvotes:Pt.upvotes,downvotes:Pt.downvotes,vote_score:Pt.upvotes-Pt.downvotes,my_vote:tt===0?null:tt}:An))}catch{}},$n=async()=>{if(!S)return;at(!0),jt("");const P=S,Ue=P.level==="c-level"||P.level==="team-lead"?P.level:"member",Rt=Gf(Ue),tt=P.skills!=null&&typeof P.skills=="object"&&!Array.isArray(P.skills)&&"primary"in P.skills;try{await a({id:W,name:F.trim(),level:Ue,reportsTo:M,persona:P.persona||`${F}. Imported from Tycono Store.`,authority:P.authority||Rt.authority,knowledge:Rt.knowledge,reports:Rt.reports,source:{id:`tycono/${P.id}`,sync:"manual",forked_at:"1.0.0",upstream_version:"1.0.0"},skillContent:tt?P.skills:void 0},P.appearance?P.appearance:Hi()),rr.trackInstall(P.id).catch(()=>{}),r()}catch(Pt){jt(Pt instanceof Error?Pt.message:"Failed to hire"),at(!1)}},ln=async P=>{if(O)try{await rr.deleteCharacter(P,O),m(Ue=>Ue.filter(Rt=>Rt.id!==P))}catch{}},Xn=P=>{P.key==="Escape"&&r(),P.key==="Enter"&&(P.metaKey||P.ctrlKey)&&(c==="single"?J<Ps&&st(J)?Q(J+1):J===Ps&&yt():c==="bulk"?Re==="input"&&Te?Ne("review"):Re==="review"&&bn():c==="store"&&B==="review"&&$n())},Ln=e.some(P=>P.id===ne)&&ne.length>0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),s.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:Xn,children:[s.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #2E7D32, #43A047)"},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"text-lg font-bold",children:"Hire New Role"}),s.jsxs("div",{className:"flex bg-black/20 rounded-lg p-0.5",children:[s.jsx("button",{onClick:()=>{u("single"),jt("")},className:`px-3 py-1 text-xs font-semibold rounded-md cursor-pointer transition-colors ${c==="single"?"bg-white/20 text-white":"text-white/50 hover:text-white/70"}`,children:"Single"}),s.jsx("button",{onClick:()=>{u("bulk"),jt("")},className:`px-3 py-1 text-xs font-semibold rounded-md cursor-pointer transition-colors ${c==="bulk"?"bg-white/20 text-white":"text-white/50 hover:text-white/70"}`,children:"Bulk"}),s.jsx("button",{onClick:()=>{u("store"),jt(""),i==null||i()},className:`px-3 py-1 text-xs font-semibold rounded-md cursor-pointer transition-colors ${c==="store"?"bg-white/20 text-white":"text-white/50 hover:text-white/70"}`,children:"Store"})]})]}),s.jsxs("div",{className:"text-sm opacity-80 mt-0.5 flex items-center gap-2",children:[s.jsx("span",{children:c==="single"?`Step ${J} of ${Ps}`:c==="bulk"?Re==="input"?"Enter roles, one per line":`Review ${de.length} roles`:B==="browse"?`${d.length} characters available`:"Review & customize"}),c==="store"&&B==="browse"&&s.jsx("a",{href:"https://tycono.ai/store.html",target:"_blank",rel:"noopener noreferrer",className:"text-[10px] opacity-60 hover:opacity-100 transition-opacity",onClick:P=>P.stopPropagation(),children:"Open in browser ↗"})]})]}),c==="single"&&s.jsx("div",{className:"flex gap-1 px-5 pt-4",children:Array.from({length:Ps},(P,Ue)=>Ue+1).map(P=>s.jsx("div",{className:"flex-1 h-1 rounded-full transition-colors",style:{background:P<=J?"#2E7D32":"rgba(255,255,255,0.1)"}},P))}),s.jsx("div",{className:"p-5 min-h-[240px] overflow-y-auto flex-1",children:c==="store"?s.jsxs(s.Fragment,{children:[B==="browse"&&s.jsxs("div",{className:"space-y-3",children:[O?s.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:[s.jsxs("span",{className:"text-green-400/70",children:["Signed in · ",s.jsxs("span",{className:"font-mono text-white/40",children:[O.slice(0,8),"..."]})]}),s.jsx("button",{onClick:()=>{xl=null,localStorage.removeItem("tycono_instance_id"),V(null)},className:"text-white/30 hover:text-white/60 cursor-pointer",children:"Sign out"})]}):s.jsx(WC,{onLogin:P=>{xl=P,localStorage.setItem("tycono_instance_id",P),V(P)}}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{value:b,onChange:P=>v(P.target.value),placeholder:"Search characters...",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}),s.jsxs("select",{value:y,onChange:P=>g(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:[s.jsx("option",{value:"popular",className:"bg-[var(--wall)]",children:"Popular"}),s.jsx("option",{value:"installs",className:"bg-[var(--wall)]",children:"Most Hired"}),s.jsx("option",{value:"newest",className:"bg-[var(--wall)]",children:"Newest"}),s.jsx("option",{value:"name",className:"bg-[var(--wall)]",children:"A-Z"})]})]}),x?s.jsx("div",{className:"text-center py-8 text-sm text-white/40",children:"Loading store..."}):N?s.jsxs("div",{className:"text-center py-8",children:[s.jsx("div",{className:"text-xs text-red-400 mb-2",children:N}),s.jsx("button",{onClick:ye,className:"text-xs text-green-400 hover:underline cursor-pointer",children:"Retry"})]}):De.length===0?s.jsx("div",{className:"text-center py-8 text-sm text-white/40",children:b?"No matches found":"No characters in store yet"}):s.jsx("div",{className:"space-y-2 max-h-[380px] overflow-y-auto pr-1",children:De.map(P=>s.jsx(KC,{char:P,isHired:He.has(P.id),onSelect:()=>Yt(P.id),onVote:Ue=>oa(P.id,Ue),onDelete:()=>ln(P.id),fetching:C,token:O},P.id))})]}),B==="review"&&S&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"bg-white/5 rounded-xl p-4 border border-white/10",children:[s.jsxs("div",{className:"flex gap-4",children:[S.appearance&&s.jsx("div",{className:"flex-shrink-0 rounded-lg overflow-hidden",style:{background:"#0d1117",padding:8},children:s.jsx(uo,{roleId:"store-preview",appearance:S.appearance,scale:4})}),s.jsxs("div",{className:"flex-1 space-y-2.5",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Name"}),s.jsx("input",{value:F,onChange:P=>X(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"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Role ID"}),s.jsx("input",{value:W,onChange:P=>U(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===W)&&W.length>0&&s.jsx("div",{className:"text-xs text-red-500 mt-1",children:"ID already exists"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Level"}),s.jsx("div",{className:"text-sm text-white/70 p-2 rounded-lg bg-white/5 border border-white/10",children:S.level==="c-level"?"C-Level":S.level==="team-lead"?"Lead":"Member"})]}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Reports To"}),s.jsxs("select",{value:M,onChange:P=>G(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:[s.jsx("option",{value:"ceo",className:"bg-[var(--wall)] text-white",children:"CEO"}),e.map(P=>s.jsxs("option",{value:P.id,className:"bg-[var(--wall)] text-white",children:[P.name," (",P.id,")"]},P.id))]})]})]})]})]}),S.persona&&s.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[s.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Persona"}),s.jsx("div",{className:"text-xs text-white/60 leading-relaxed line-clamp-3",children:S.persona})]}),S.skills&&s.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[s.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Skills"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:(()=>{var tt,Pt;const P=S.skills;if(P&&typeof P=="object"&&!Array.isArray(P)&&"primary"in P){const Jt=[];return(Pt=(tt=P.primary)==null?void 0:tt.frontmatter)!=null&&Pt.name&&Jt.push(P.primary.frontmatter.name),P.shared&&P.shared.forEach(An=>{var br;return Jt.push(((br=An.frontmatter)==null?void 0:br.name)||An.id)}),Jt.map(An=>s.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:An},An))}return(Array.isArray(P)?P:[]).map((Jt,An)=>s.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 Jt=="string"?Jt:Jt.name},An))})()})]})]}),Ct&&s.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:Ct})]})]}):c==="single"?s.jsxs(s.Fragment,{children:[J===1&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role Name"}),s.jsx("input",{ref:_e,value:H,onChange:P=>wt(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"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role ID (slug)"}),s.jsx("input",{value:ne,onChange:P=>{we(P.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),z(!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 ${Ln?"border-red-400":"border-white/10 focus:border-white/25"}`}),Ln&&s.jsx("div",{className:"text-xs text-red-500 mt-1",children:"ID already exists"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Level"}),s.jsx("div",{className:"flex gap-2",children:XC.map(P=>s.jsx("button",{onClick:()=>D(P.value),className:`flex-1 p-2 text-xs font-semibold rounded-lg border cursor-pointer transition-colors ${Z===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))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Reports To"}),s.jsxs("select",{value:xe,onChange:P=>Ce(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:[s.jsx("option",{value:"ceo",className:"bg-[var(--wall)] text-white",children:"CEO"}),e.map(P=>s.jsxs("option",{value:P.id,className:"bg-[var(--wall)] text-white",children:[P.name," (",P.id,")"]},P.id))]})]})]}),J===2&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Persona"}),s.jsx("textarea",{ref:et,value:ge,onChange:P=>Me(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"}),s.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"This defines how the AI agent will behave in this role"})]}),Vt.length>0&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Skills"}),s.jsx("div",{className:"space-y-1.5 max-h-[120px] overflow-y-auto",children:Vt.map(P=>s.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:[s.jsx("input",{type:"checkbox",checked:he.has(P.id),onChange:()=>ke(Ue=>{const Rt=new Set(Ue);return Rt.has(P.id)?Rt.delete(P.id):Rt.add(P.id),Rt}),className:"accent-green-600"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-xs font-semibold text-white/80",children:P.name}),s.jsx("div",{className:"text-[10px] text-white/40 truncate",children:P.description})]})]},P.id))})]})]}),J===3&&s.jsx("div",{className:"customize-body",style:{padding:0},children:s.jsx(Wg,{roleId:"default",appearance:Ee,onChange:Ie,onRandomize:()=>Ie(Hi()),onReset:()=>Ie(Hi()),label:s.jsxs("span",{children:[ne||"new-role"," — ",H||"New Role"]})})}),J===4&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Review"}),s.jsxs("div",{className:"bg-white/5 rounded-xl p-4 border border-white/10",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsx("div",{className:"flex-shrink-0 rounded-lg overflow-hidden",style:{background:"#0d1117",padding:8},children:s.jsx(uo,{roleId:"default",appearance:Ee,scale:4})}),s.jsxs("div",{className:"flex-1 space-y-2.5",children:[s.jsx(Js,{label:"Name",value:H}),s.jsx(Js,{label:"ID",value:ne,mono:!0}),s.jsx(Js,{label:"Level",value:Z}),s.jsx(Js,{label:"Reports To",value:xe}),he.size>0&&s.jsx(Js,{label:"Skills",value:[...he].join(", ")})]})]}),s.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[s.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Persona"}),s.jsx("div",{className:"text-xs text-white/60 leading-relaxed",children:ge})]})]}),Ct&&s.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:Ct})]})]}):s.jsxs(s.Fragment,{children:[Re==="input"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Roles (one per line)"}),s.jsx("textarea",{ref:re,value:Ae,onChange:P=>Fe(P.target.value),placeholder:`Name, Level, ReportsTo
|
|
83
|
+
e.g.
|
|
84
|
+
Data Analyst
|
|
85
|
+
DevOps Engineer, member, cto
|
|
86
|
+
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"}),s.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Format: Name, Level (member/team-lead/c-level), ReportsTo. Level and ReportsTo are optional."})]}),de.length>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Preview (",de.length," role",de.length!==1?"s":"",")"]}),s.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden",children:s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-white/10",children:[s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),s.jsx("tbody",{children:de.map((P,Ue)=>s.jsxs("tr",{className:`border-b border-white/5 ${P.error?"bg-red-900/10":""}`,children:[s.jsx("td",{className:"p-2 text-white/80",children:P.name}),s.jsx("td",{className:"p-2 text-white/60 font-mono",children:P.id}),s.jsx("td",{className:"p-2 text-white/60",children:P.level}),s.jsx("td",{className:"p-2 text-white/60",children:P.reportsTo}),P.error&&s.jsx("td",{className:"p-2 text-red-400 text-[10px]",children:P.error})]},Ue))})]})})]})]}),Re==="review"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Confirm Bulk Hire — ",de.length," roles"]}),s.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden max-h-[300px] overflow-y-auto",children:s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{className:"sticky top-0 bg-[var(--wall)]",children:s.jsxs("tr",{className:"border-b border-white/10",children:[s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"#"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),s.jsx("tbody",{children:de.map((P,Ue)=>s.jsxs("tr",{className:"border-b border-white/5",children:[s.jsx("td",{className:"p-2 text-white/30",children:Ue+1}),s.jsx("td",{className:"p-2 text-white/80",children:P.name}),s.jsx("td",{className:"p-2 text-white/60 font-mono",children:P.id}),s.jsx("td",{className:"p-2 text-white/60",children:P.level}),s.jsx("td",{className:"p-2 text-white/60",children:P.reportsTo})]},Ue))})]})}),oe&&ze.total>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between text-[10px] text-white/40 mb-1",children:[s.jsx("span",{children:"Hiring..."}),s.jsxs("span",{children:[ze.done,"/",ze.total]})]}),s.jsx("div",{className:"h-1.5 bg-white/10 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ze.done/ze.total*100}%`,background:"#2E7D32"}})})]}),s.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."}),Ct&&s.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:Ct})]})]})}),s.jsxs("div",{className:"flex justify-between px-5 pb-5",children:[s.jsxs("div",{children:[c==="single"&&J>1&&s.jsx("button",{onClick:()=>Q(J-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"}),c==="bulk"&&Re==="review"&&s.jsx("button",{onClick:()=>Ne("input"),disabled:oe,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer disabled:opacity-40",children:"Back"}),c==="store"&&B==="review"&&s.jsx("button",{onClick:()=>{I("browse"),j(null),jt("")},disabled:oe,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"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{onClick:r,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),c==="single"?J<Ps?s.jsx("button",{onClick:()=>Q(J+1),disabled:!st(J),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"}):s.jsx("button",{onClick:yt,disabled:oe,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:oe?"Hiring...":"HIRE"}):c==="bulk"?Re==="input"?s.jsxs("button",{onClick:()=>Ne("review"),disabled:!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:["Review (",de.length,")"]}):s.jsx("button",{onClick:bn,disabled:oe,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:oe?`Hiring ${ze.done}/${ze.total}...`:`HIRE ALL (${de.length})`}):B==="review"?s.jsx("button",{onClick:$n,disabled:oe||!F.trim()||!W.trim()||e.some(P=>P.id===W),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:oe?"Hiring...":"HIRE"}):null]})]})]})]})}function WC({onLogin:e}){const[r,a]=w.useState(""),[i,c]=w.useState(!1),[u,d]=w.useState(""),m=()=>{const x=r.trim();if(x){if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(x)){d("Invalid token format");return}e(x)}};return s.jsxs("div",{className:"rounded-lg border border-white/10 bg-white/[0.03] p-3 space-y-2",children:[s.jsx("div",{className:"text-[11px] text-white/50",children:"Sign in to vote, publish, and manage your characters."}),i?s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{value:r,onChange:x=>{a(x.target.value),d("")},onKeyDown:x=>{x.key==="Enter"&&m()},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}),s.jsx("button",{onClick:m,disabled:!r.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&&s.jsx("div",{className:"text-[10px] text-red-400",children:u}),s.jsx("button",{onClick:c.bind(null,!1),className:"text-[10px] text-white/30 hover:text-white/50 cursor-pointer",children:"Cancel"})]}):s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:c.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"}),s.jsx("span",{className:"text-[10px] text-white/20 self-center",children:"from Settings → Token"})]})]})}function KC({char:e,isHired:r,onSelect:a,onVote:i,onDelete:c,fetching:u,token:d}){const[m,x]=w.useState(!1),f=d&&e.publisher_id===d,y=!!d;return s.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:[s.jsxs("div",{className:"flex flex-col items-center gap-0.5 shrink-0 w-8",children:[s.jsx("button",{onClick:g=>{g.stopPropagation(),i(1)},disabled:!y,className:`text-[14px] leading-none transition-colors ${y?"cursor-pointer":"cursor-not-allowed opacity-30"} ${e.my_vote===1?"text-green-400":"text-white/20 hover:text-green-400/60"}`,title:y?"Upvote":"Sign in to vote",children:"▲"}),s.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}),s.jsx("button",{onClick:g=>{g.stopPropagation(),i(-1)},disabled:!y,className:`text-[14px] leading-none transition-colors ${y?"cursor-pointer":"cursor-not-allowed opacity-30"} ${e.my_vote===-1?"text-red-400":"text-white/20 hover:text-red-400/60"}`,title:y?"Downvote":"Sign in to vote",children:"▼"})]}),s.jsxs("div",{className:"flex-1 min-w-0 cursor-pointer",onClick:a,children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-semibold text-white/90 truncate",children:e.name}),s.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":e.level==="team-lead"?"bg-blue-900/30 text-blue-400 border border-blue-800/30":"bg-white/5 text-white/40 border border-white/10"}`,children:e.level}),r&&s.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&&s.jsx("div",{className:"text-[11px] text-white/40 truncate mt-0.5",children:e.tagline}),s.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[s.jsxs("span",{className:"text-[10px] text-white/25",children:[e.installs??0," installs"]}),s.jsxs("span",{className:"text-[10px] text-white/25",children:["v",e.version]}),s.jsx("span",{className:"text-[10px] text-white/25 font-mono",children:e.id})]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.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&&(m?s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:g=>{g.stopPropagation(),c(),x(!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"}),s.jsx("button",{onClick:g=>{g.stopPropagation(),x(!1)},className:"px-2 py-1.5 text-[10px] rounded cursor-pointer text-white/40 hover:text-white/60",children:"No"})]}):s.jsx("button",{onClick:g=>{g.stopPropagation(),x(!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:s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.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 Js({label:e,value:r,mono:a}){return s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-white/40",children:e}),s.jsx("span",{className:`font-semibold text-white/80 ${a?"font-mono":""}`,children:r})]})}function ZC({roleId:e,roleName:r,onClose:a,onConfirm:i}){const[c,u]=w.useState(!1),d=async()=>{u(!0);try{await i(e)}finally{u(!1)}};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:a}),s.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:[s.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[s.jsx("div",{className:"text-lg font-bold",children:"Fire Role"}),s.jsxs("div",{className:"text-sm opacity-80 mt-0.5",children:["Remove ",r," (",e,")"]})]}),s.jsxs("div",{className:"p-5",children:[s.jsxs("div",{className:"p-4 rounded-lg border-2 border-red-300 bg-red-50 mb-4",children:[s.jsx("div",{className:"text-sm font-bold text-red-800 mb-1",children:"Warning"}),s.jsxs("div",{className:"text-xs text-red-700 leading-relaxed",children:["This will permanently delete the role directory including",s.jsx("strong",{children:" role.yaml"}),", ",s.jsx("strong",{children:"profile.md"}),", ",s.jsx("strong",{children:"SKILL.md"}),", and all journal entries. This action cannot be undone."]})]}),s.jsxs("div",{className:"text-sm text-gray-600",children:["Are you sure you want to fire ",s.jsx("strong",{children:r}),"?"]})]}),s.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[s.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"}),s.jsx("button",{onClick:d,disabled:c,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:c?"Removing...":"Confirm Fire"})]})]})]})}const PC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function JC({roleId:e,title:r,roleColor:a,active:i,isWave:c,isWaveStreaming:u,onClick:d,onClose:m,"data-session-id":x}){const f=c?"#F59E0B":a;return s.jsxs("button",{onClick:d,"data-session-id":x,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:[c&&u&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse shrink-0"}),s.jsx("span",{className:"text-xs",children:PC[e]??"👤"}),s.jsx("span",{className:`truncate ${c?"text-amber-400/90":""}`,children:r}),s.jsx("span",{onClick:m,className:"ml-auto text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none",children:"×"})]})}function eE({content:e,streaming:r}){let a=e;return r&&(e.match(/```/g)??[]).length%2!==0&&(a+="\n```"),s.jsx("div",{className:"terminal-markdown",children:s.jsx(Yh,{remarkPlugins:[Qh],components:{code:tE,table:({children:i})=>s.jsx("div",{className:"overflow-x-auto my-2",children:s.jsx("table",{className:"terminal-table",children:i})})},children:a})})}function tE({className:e,children:r,...a}){const i=/language-(\w+)/.exec(e??"");return i||typeof r=="string"&&r.includes(`
|
|
87
|
+
`)?s.jsx(nE,{language:i==null?void 0:i[1],children:r}):s.jsx("code",{className:"terminal-inline-code",...a,children:r})}function nE({children:e,language:r}){const[a,i]=w.useState(!1),c=String(e).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(c),i(!0),setTimeout(()=>i(!1),1500)};return s.jsxs("div",{className:"terminal-code-block group relative my-2",children:[r&&s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] px-3 pt-1.5",children:r}),s.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"}),s.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:s.jsx("code",{children:c})})]})}const rE={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function aE({attachments:e}){const[r,a]=w.useState(null);return e.length===0?null:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:e.map((i,c)=>s.jsxs("button",{onClick:()=>a(c),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:[s.jsx("img",{src:`data:${i.mediaType};base64,${i.data}`,alt:i.name,className:"w-full h-full object-cover"}),s.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})]},c))}),r!==null&&s.jsx("div",{className:"fixed inset-0 z-[100] bg-black/80 flex items-center justify-center",onClick:()=>a(null),children:s.jsxs("div",{className:"relative max-w-[90vw] max-h-[90vh]",children:[s.jsx("img",{src:`data:${e[r].mediaType};base64,${e[r].data}`,alt:e[r].name,className:"max-w-full max-h-[90vh] object-contain rounded-lg"}),s.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"}),s.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[r].name})]})})]})}function Qf(e,r){return r?r.file_path?String(r.file_path).replace(/^.*\/(?=[^/]+\/)/,""):r.path?String(r.path).replace(/^.*\/(?=[^/]+\/)/,""):r.pattern?String(r.pattern):r.command?String(r.command).slice(0,60):r.query?String(r.query).slice(0,60):r.url?String(r.url).slice(0,60):"":""}function lE(e){const r=[];let a="";for(const i of e)if(i.type==="thinking")i.text&&(a=i.text),r.length===0||r[r.length-1].type!=="thinking"?r.push({type:"thinking",text:i.text}):r[r.length-1].text=i.text;else if(i.type==="tool")r.push({type:"tool",toolName:i.toolName,toolSummary:Qf(i.toolName??"",i.toolInput),toolInput:i.toolInput});else if(i.type==="dispatch")r.push({type:"dispatch",roleId:i.roleId,task:i.task});else if(i.type==="dispatch:progress"){const c=r.length>0?r[r.length-1]:null;(c==null?void 0:c.type)==="dispatch:progress"&&c.roleId===i.roleId?i.progressType==="tool"?(c.toolName=i.toolName,c.toolSummary=Qf(i.toolName??"",i.toolInput),c.progressType="tool"):i.progressType==="thinking"?(c.text=i.text,c.progressType="thinking"):i.progressType==="text"?(c.text=i.text,c.progressType="text"):(i.progressType==="done"||i.progressType==="error")&&(c.progressType=i.progressType):r.push({type:"dispatch:progress",roleId:i.roleId,progressType:i.progressType,text:i.text,toolName:i.toolName,toolSummary:i.toolName?Qf(i.toolName,i.toolInput):void 0})}if(a){const i=r.filter(c=>c.type==="thinking");i.length>0&&(i[i.length-1].text=a)}return r}function iE({event:e,isStreaming:r}){var c,u,d;const[a,i]=w.useState(!1);switch(e.type){case"thinking":return s.jsxs("div",{className:"stream-event-thinking",children:[s.jsxs("div",{className:"stream-event-thinking-header",onClick:()=>i(!a),children:[s.jsx("span",{className:"stream-event-thinking-icon"}),s.jsxs("span",{className:"stream-event-thinking-label",children:["thinking",r?"...":""]}),e.text&&!r&&s.jsx("span",{className:"stream-event-thinking-toggle",children:a?"▾":"▸"})]}),(r||a)&&e.text&&s.jsx("div",{className:"stream-event-thinking-content",children:e.text.slice(-500)})]});case"tool":return s.jsxs("div",{className:"stream-event-tool",children:[s.jsx("span",{className:"stream-event-tool-badge",children:e.toolName}),e.toolSummary&&s.jsx("span",{className:"stream-event-tool-path",children:e.toolSummary}),e.toolInput&&s.jsx("span",{className:"stream-event-tool-toggle",onClick:()=>i(!a),children:a?"▾":"▸"}),a&&e.toolInput&&s.jsx("div",{className:"stream-event-tool-detail",children:JSON.stringify(e.toolInput,null,1).slice(0,300)})]});case"dispatch":return s.jsxs("div",{className:"stream-event-dispatch",children:[s.jsxs("span",{className:"stream-event-dispatch-badge",children:["→"," ",(c=e.roleId)==null?void 0:c.toUpperCase()]}),s.jsx("span",{className:"stream-event-dispatch-task",children:(u=e.task)==null?void 0:u.slice(0,80)})]});case"dispatch:progress":return s.jsxs("div",{className:"stream-event-dispatch-progress",children:[s.jsx("span",{className:"stream-event-dispatch-progress-role",children:(d=e.roleId)==null?void 0:d.toUpperCase()}),e.progressType==="thinking"&&s.jsxs("span",{className:"stream-event-dispatch-progress-status",children:["thinking",r?"...":""]}),e.progressType==="tool"&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"stream-event-tool-badge",children:e.toolName}),e.toolSummary&&s.jsx("span",{className:"stream-event-tool-path",children:e.toolSummary})]}),e.progressType==="text"&&e.text&&s.jsx("span",{className:"stream-event-dispatch-progress-status",children:"responding..."}),e.progressType==="done"&&s.jsx("span",{className:"stream-event-dispatch-progress-done",children:"done"}),e.progressType==="error"&&s.jsx("span",{className:"stream-event-dispatch-progress-error",children:"error"})]});default:return null}}function sE({events:e,isStreaming:r}){const[a,i]=w.useState(!1);if(e.length===0)return null;const c=lE(e);if(c.length===0)return null;const u=e.filter(b=>b.type==="thinking").length,d=e.filter(b=>b.type==="tool"),m=e.filter(b=>b.type==="dispatch"||b.type==="dispatch:progress"),x=e.filter(b=>b.type==="turn").reduce((b,v)=>Math.max(b,v.turn??0),0),f=[];if(u>0&&f.push("thinking"),d.length>0){const b=[...new Set(d.map(v=>v.toolName))];b.length<=3?f.push(b.join(", ")):f.push(`${d.length} tool calls`)}m.length>0&&f.push(`${m.length} dispatch`),x>1&&f.push(`${x} turns`);const y=f.join(" · "),g=!a;return s.jsxs("div",{className:"stream-activity-log",children:[s.jsxs("div",{className:"stream-activity-header",onClick:()=>i(!a),children:[r&&s.jsx("span",{className:"stream-activity-pulse"}),s.jsxs("span",{className:"stream-activity-summary",children:[a?"▸":"▾"," ",y,r?"...":""]})]}),g&&s.jsx("div",{className:"stream-activity-events",children:c.map((b,v)=>s.jsx(iE,{event:b,isStreaming:r&&v===c.length-1},v))})]})}function oE({message:e,roleId:r,roleColor:a}){var f;const i=e.from==="ceo",c=e.type==="system",u=e.status==="streaming";if(c)return s.jsx("div",{className:"flex justify-center my-2",children:s.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 s.jsx("div",{className:"flex justify-end mb-3",children:s.jsxs("div",{className:"max-w-[85%]",children:[s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] text-right mb-1",children:"CEO"}),e.attachments&&e.attachments.length>0&&s.jsx("div",{className:"flex justify-end mb-1",children:s.jsx(aE,{attachments:e.attachments})}),s.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"&&s.jsx("span",{className:"text-amber-400 text-[10px] font-bold mr-1.5",children:"DO"}),e.content]})]})});const d=(((f=e.streamEvents)==null?void 0:f.length)??0)>0,m=!!e.thinking,x=m&&!e.content&&u&&!d;return s.jsxs("div",{className:"flex gap-2.5 mb-3",children:[s.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:rE[r]??"👤"}),s.jsxs("div",{className:"max-w-[85%] min-w-0",children:[s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] mb-1",children:r.toUpperCase()}),d&&s.jsx(sE,{events:e.streamEvents,isStreaming:u}),m&&!d&&s.jsxs("details",{open:x,className:"mb-1",children:[s.jsxs("summary",{className:"text-[10px] text-purple-400/70 cursor-pointer select-none flex items-center gap-1",children:[x&&s.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-purple-400 animate-pulse"}),"thinking",x?"...":` (${e.thinking.length} chars)`]}),s.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)})]}),s.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?s.jsx(eE,{content:e.content,streaming:u}):u&&!m?s.jsx("span",{className:"inline-block w-2 h-4 bg-[var(--terminal-text-secondary)] animate-pulse"}):u&&m?s.jsx("span",{className:"text-[11px] text-purple-400/50 italic",children:"analyzing..."}):null,u&&e.content&&s.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"&&s.jsx("div",{className:"text-[10px] text-red-400 mt-1",children:"Error occurred"})]})]})}function cE({messages:e,roleId:r,roleColor:a}){var c;const i=w.useRef(null);return w.useEffect(()=>{var u;(u=i.current)==null||u.scrollIntoView({behavior:"smooth"})},[e,(c=e[e.length-1])==null?void 0:c.content]),e.length===0?s.jsxs("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:["Start a conversation with ",r.toUpperCase()]}):s.jsxs("div",{className:"flex-1 overflow-y-auto p-4 terminal-scrollbar",children:[e.map(u=>s.jsx(oE,{message:u,roleId:r,roleColor:a},u.id)),s.jsx("div",{ref:i})]})}const uE=5*1024*1024,dE=["image/png","image/jpeg","image/gif","image/webp"];function fE({mode:e,onModeChange:r,onSend:a,disabled:i,disabledReason:c}){const[u,d]=w.useState(""),[m,x]=w.useState([]),[f,y]=w.useState(!1),[g,b]=w.useState(null),v=w.useRef(null),S=w.useRef(null);w.useEffect(()=>{const U=v.current;U&&(U.style.height="0",U.style.height=Math.min(U.scrollHeight,120)+"px")},[u]),w.useEffect(()=>{if(g){const U=setTimeout(()=>b(null),3e3);return()=>clearTimeout(U)}},[g]);const j=w.useCallback(async U=>dE.includes(U.type)?U.size>uE?(b(`File too large: ${(U.size/1024/1024).toFixed(1)}MB. Max 5MB.`),null):new Promise(M=>{const G=new FileReader;G.onload=()=>{const V=G.result.split(",")[1];M({type:"image",data:V,name:U.name,mediaType:U.type})},G.onerror=()=>{b("Failed to read file"),M(null)},G.readAsDataURL(U)}):(b(`Unsupported format: ${U.type}. Use PNG, JPG, GIF, or WebP.`),null),[]),C=w.useCallback(async U=>{const M=Array.from(U),G=[];for(const O of M){const V=await j(O);V&&G.push(V)}G.length>0&&x(O=>[...O,...G])},[j]),E=w.useCallback(U=>{U.preventDefault(),U.stopPropagation(),y(!0)},[]),N=w.useCallback(U=>{U.preventDefault(),U.stopPropagation(),y(!1)},[]),_=w.useCallback(U=>{U.preventDefault(),U.stopPropagation(),y(!1);const M=U.dataTransfer.files;M.length>0&&C(M)},[C]),B=w.useCallback(U=>{const M=U.clipboardData.items,G=[];for(let O=0;O<M.length;O++){const V=M[O];if(V.type.startsWith("image/")){const J=V.getAsFile();J&&G.push(J)}}G.length>0&&(U.preventDefault(),C(G))},[C]),I=w.useCallback(U=>{const M=U.target.files;M&&M.length>0&&C(M),U.target.value=""},[C]),F=w.useCallback(U=>{x(M=>M.filter((G,O)=>O!==U))},[]),X=()=>{const U=u.trim();!U&&m.length===0||i||(a(U,m.length>0?m:void 0),d(""),x([]))},W=U=>{U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),X())};return s.jsxs("div",{className:`border-t border-[var(--terminal-border)] p-3 shrink-0 transition-colors ${f?"bg-[var(--terminal-surface-light)] border-amber-500/50":""}`,onDragOver:E,onDragLeave:N,onDrop:_,children:[g&&s.jsx("div",{className:"text-[10px] text-red-400 mb-2 text-center",children:g}),c&&s.jsx("div",{className:"text-[10px] text-amber-400/70 mb-2 text-center",children:c}),m.length>0&&s.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:m.map((U,M)=>s.jsxs("div",{className:"relative group w-16 h-16 rounded-lg overflow-hidden border border-[var(--terminal-border)] bg-[var(--terminal-inline-bg)]",children:[s.jsx("img",{src:`data:${U.mediaType};base64,${U.data}`,alt:U.name,className:"w-full h-full object-cover"}),s.jsx("button",{onClick:()=>F(M),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"}),s.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-[8px] text-white truncate px-1 py-0.5",children:U.name})]},M))}),f&&s.jsx("div",{className:"text-[11px] text-amber-400 text-center mb-2",children:"Drop image here"}),s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsxs("div",{className:"flex rounded-lg overflow-hidden border border-[var(--terminal-border)] shrink-0",children:[s.jsx("button",{onClick:()=>r("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"}),s.jsx("button",{onClick:()=>r("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"})]}),s.jsx("button",{onClick:()=>{var U;return(U=S.current)==null?void 0:U.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:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.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"})})}),s.jsx("input",{ref:S,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,onChange:I,className:"hidden"}),s.jsx("textarea",{ref:v,value:u,onChange:U=>d(U.target.value),onKeyDown:W,onPaste:B,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"}),s.jsx("button",{onClick:X,disabled:i||!u.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:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M22 2L11 13"}),s.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})]})}const hE={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},Kg={cto:"CTO",cbo:"CBO",pm:"PM",engineer:"Engineer",designer:"Designer",qa:"QA","data-analyst":"Data Analyst"};function W0(e){return new Date(e).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit"})}function mE({msg:e}){const r=hE[e.roleId]??"#888",a=Kg[e.roleId]??e.roleId;if(e.type==="dispatch"){const i=e.text.includes("WAVE"),c=e.text.includes("completed")||e.text.includes("완료"),u=i?"📡":c?"✓":"→",d=c?"text-green-400/70":"text-[var(--terminal-text-muted)]";return s.jsxs("div",{className:"flex items-start gap-2 px-3 py-1 hover:bg-white/[0.02]",children:[s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:W0(e.ts)}),s.jsx("span",{className:"text-[10px] shrink-0 mt-0.5",children:u}),s.jsx("span",{className:`text-[11px] ${d}`,children:e.text})]})}return s.jsxs("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-white/[0.02]",children:[s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:W0(e.ts)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("span",{className:"text-[11px] font-semibold mr-1.5",style:{color:r},children:a}),s.jsx("span",{className:"text-xs text-[var(--terminal-text-secondary)]",children:e.text})]})]})}function xE({channel:e,allRoles:r,onUpdateMembers:a,onUpdateTopic:i}){const c=w.useRef(null),u=w.useRef(null);w.useEffect(()=>{var S;const b=u.current;if(!b)return;b.scrollHeight-b.scrollTop-b.clientHeight<80&&((S=c.current)==null||S.scrollIntoView({behavior:"smooth"}))},[e.messages.length]);const[d,m]=w.useState(!1),[x,f]=w.useState(!1),[y,g]=w.useState("");return s.jsxs("div",{ref:u,className:"flex-1 overflow-y-auto terminal-scrollbar py-2",children:[s.jsxs("div",{className:"px-3 py-2 mb-2 border-b border-[var(--terminal-border)] flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-semibold text-[var(--terminal-text)]",children:e.name}),e.members.length>0&&s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:e.members.map(b=>Kg[b]??b).join(", ")}),e.members.length===0&&s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:e.isDefault?"system logs":"no members"}),!e.isDefault&&r&&a&&s.jsx("button",{className:"ml-auto text-[10px] px-2 py-0.5 rounded bg-white/5 hover:bg-white/10 text-[var(--terminal-text-muted)]",onClick:()=>m(!d),children:d?"Done":"Invite"})]}),!e.isDefault&&i&&s.jsx("div",{className:"px-3 pb-2 mb-1",children:x?s.jsx("input",{autoFocus:!0,value:y,onChange:b=>g(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(i(e.id,y.trim()),f(!1)),b.key==="Escape"&&f(!1)},onBlur:()=>{i(e.id,y.trim()),f(!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"}):s.jsx("button",{onClick:()=>{g(e.topic??""),f(!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..."})}),d&&!e.isDefault&&r&&a&&s.jsx("div",{className:"px-3 pb-2 mb-2 border-b border-[var(--terminal-border)]",children:s.jsx("div",{className:"flex flex-wrap gap-1",children:r.map(b=>{const v=e.members.includes(b.id);return s.jsxs("button",{className:`text-[10px] px-2 py-1 rounded ${v?"bg-white/15 text-[var(--terminal-text)]":"bg-white/5 text-[var(--terminal-text-muted)]"}`,onClick:()=>{const S=v?e.members.filter(j=>j!==b.id):[...e.members,b.id];a(e.id,S)},children:[v?"✓ ":"",b.name]},b.id)})})}),e.messages.length===0&&s.jsx("div",{className:"flex-1 flex flex-col items-center justify-center text-[var(--terminal-text-muted)] text-xs gap-1 py-8",children:s.jsx("span",{children:e.isDefault?"No dispatch events yet":"No messages yet — invite roles to start chatting"})}),e.messages.map(b=>s.jsx(mE,{msg:b},b.id)),s.jsx("div",{ref:c})]})}const Wf={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},pE=400,yE=800;function gE({sessions:e,activeSessionId:r,roles:a,streamingSessionId:i,width:c,onWidthChange:u,onSwitchSession:d,onCloseSession:m,onCreateSession:x,onClearEmpty:f,onCloseAll:y,onSendMessage:g,onModeChange:b,onCloseTerminal:v,chatChannels:S,activeChatChannelId:j,onSwitchChatChannel:C,onCreateChatChannel:E,onDeleteChatChannel:N,onUpdateChatMembers:_,onUpdateChatTopic:B,unreadChannels:I}){const[F,X]=w.useState(!1),[W,U]=w.useState(!1),[M,G]=w.useState(!1),[O,V]=w.useState(""),J=j!=null,Q=S==null?void 0:S.find(oe=>oe.id===j),[H,Y]=w.useState(!1),[ne,we]=w.useState(!1),[T,z]=w.useState(!1),Z=w.useRef(0),D=w.useRef(0),xe=w.useRef(null),Ce=e.find(oe=>oe.id===r),ge=i===r,Me=e.filter(oe=>oe.messages.length===0).length,Ee=w.useCallback(()=>{const oe=xe.current;oe&&(we(oe.scrollLeft>0),z(oe.scrollLeft+oe.clientWidth<oe.scrollWidth-1))},[]);w.useEffect(()=>{if(!r||!xe.current)return;const oe=xe.current.querySelector(`[data-session-id="${r}"]`);oe&&oe.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),Ee()},[r,e.length,Ee]),w.useEffect(()=>{const oe=xe.current;if(!oe)return;Ee(),oe.addEventListener("scroll",Ee);const at=new ResizeObserver(Ee);return at.observe(oe),()=>{oe.removeEventListener("scroll",Ee),at.disconnect()}},[Ee]);const Ie=w.useCallback(oe=>{oe.preventDefault(),Z.current=oe.clientX,D.current=c,Y(!0);const at=jt=>{const Vt=Z.current-jt.clientX,pe=Math.min(yE,Math.max(pE,D.current+Vt));u==null||u(pe)},Ct=()=>{Y(!1),document.removeEventListener("mousemove",at),document.removeEventListener("mouseup",Ct)};document.addEventListener("mousemove",at),document.addEventListener("mouseup",Ct)},[c,u]);return s.jsxs("div",{className:"shrink-0 bg-[var(--terminal-bg)] border-l border-[var(--terminal-border)] flex flex-col h-full relative",style:{width:c},children:[u&&s.jsx("div",{className:`terminal-resize-handle absolute top-0 left-0 w-1 h-full cursor-col-resize z-10 transition-colors ${H?"bg-[var(--terminal-border-hover)]":"bg-transparent"}`,onMouseDown:Ie}),s.jsxs("div",{className:"flex items-center bg-[var(--terminal-bg-deeper)] border-b border-[var(--terminal-border)] shrink-0",children:[s.jsxs("div",{className:"relative flex-1 min-w-0",children:[ne&&s.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"}),s.jsxs("div",{ref:xe,className:"flex items-center overflow-x-auto terminal-tab-scroll gap-px px-1 py-1",children:[S==null?void 0:S.map(oe=>s.jsxs("button",{onClick:()=>{C==null||C(oe.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 ${j===oe.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:j===oe.id?{borderTop:"2px solid #4CAF50"}:void 0,children:[s.jsx("span",{className:"text-[10px]",children:"💬"}),s.jsx("span",{className:"truncate",children:oe.name}),(I==null?void 0:I.has(oe.id))&&j!==oe.id&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 shrink-0"}),!oe.isDefault&&s.jsx("span",{onClick:at=>{at.stopPropagation(),N==null||N(oe.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:"×"})]},oe.id)),S&&S.length>0&&e.length>0&&s.jsx("div",{className:"w-px h-4 bg-[var(--terminal-border)] shrink-0 mx-1"}),e.map(oe=>s.jsx(JC,{roleId:oe.roleId,title:oe.title,roleColor:Wf[oe.roleId]??"#666",active:!J&&oe.id===r,isWave:oe.source==="wave",isWaveStreaming:oe.source==="wave"&&oe.status==="active",onClick:()=>{C==null||C(null),d(oe.id)},onClose:at=>{at.stopPropagation(),m(oe.id)},"data-session-id":oe.id},oe.id))]}),T&&s.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"})]}),s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("button",{onClick:()=>{X(!F),U(!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:"+"}),F&&s.jsxs("div",{className:"absolute top-full right-0 mt-1 bg-[var(--terminal-surface)] border border-[var(--terminal-border)] rounded-lg shadow-xl z-50 py-1 min-w-[200px]",children:[E&&s.jsxs(s.Fragment,{children:[M?s.jsxs("div",{className:"px-3 py-2 flex items-center gap-1",children:[s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:"#"}),s.jsx("input",{autoFocus:!0,value:O,onChange:oe=>V(oe.target.value),onKeyDown:oe=>{oe.key==="Enter"&&O.trim()&&(E(O.trim(),[]),V(""),G(!1),X(!1)),oe.key==="Escape"&&(G(!1),V(""))},placeholder:"channel name",className:"flex-1 bg-transparent text-xs text-[var(--terminal-text)] outline-none border-b border-[var(--terminal-border)]"})]}):s.jsxs("button",{onClick:()=>G(!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:[s.jsx("span",{className:"text-[10px]",children:"💬"}),"New Channel"]}),s.jsx("div",{className:"border-b border-[var(--terminal-border)] my-1"})]}),a.map(oe=>s.jsxs("button",{onClick:()=>{x(oe.id),C==null||C(null),X(!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:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:Wf[oe.id]??"#666"}}),oe.id.toUpperCase()," — ",oe.name]},oe.id))]})]}),s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("button",{onClick:()=>{U(!W),X(!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:"···"}),W&&s.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:[s.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":""]}),Me>0&&f&&s.jsxs("button",{onClick:()=>{f(),U(!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 (",Me,")"]}),e.length>0&&y&&s.jsx("button",{onClick:()=>{y(),U(!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&&s.jsx("div",{className:"px-3 py-2 text-xs text-[var(--terminal-text-muted)]",children:"No sessions"})]})]}),s.jsx("button",{onClick:v,className:"px-2 py-1 text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm cursor-pointer shrink-0",children:"×"})]}),J&&Q?s.jsx(xE,{channel:Q,allRoles:a,onUpdateMembers:_,onUpdateTopic:B}):Ce?s.jsxs(s.Fragment,{children:[s.jsx(cE,{messages:Ce.messages,roleId:Ce.roleId,roleColor:Wf[Ce.roleId]??"#666"}),Ce.source==="wave"?s.jsxs("div",{className:"shrink-0 px-4 py-2 border-t border-[var(--terminal-border)] bg-[var(--terminal-bg-deeper)] flex items-center gap-2",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 shrink-0",style:Ce.status==="active"?{animation:"pulse 2s infinite"}:void 0}),s.jsx("span",{className:"text-[11px] text-amber-400/80",children:"Wave execution · read-only"}),s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] ml-auto",children:"Interact via Wave Command Center"})]}):s.jsx(fE,{mode:Ce.mode,onModeChange:oe=>b(Ce.id,oe),onSend:(oe,at)=>g(Ce.id,oe,Ce.mode,at),disabled:ge,disabledReason:ge?`${Ce.roleId.toUpperCase()} is responding...`:void 0})]}):s.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 bE(){const e=w.useRef(null),r=w.useCallback(()=>{var i;(i=e.current)==null||i.abort(),e.current=null},[]);return{sendMessage:w.useCallback((i,c,u,d,m)=>{r();const x=new AbortController;return e.current=x,fetch(`/api/exec/session/${i}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:c,mode:u,attachments:m}),signal:x.signal}).then(async f=>{var C,E,N,_,B;if(!f.ok||!f.body){d.onError("Failed to connect");return}const y=f.body.getReader(),g=new TextDecoder;let b="",v=Date.now();const S=6e4,j=setInterval(()=>{Date.now()-v>S&&(clearInterval(j),x.abort(),d.onError("Connection stale — no data received for 60s"))},1e4);try{for(;;){const{done:I,value:F}=await y.read();if(I)break;v=Date.now(),b+=g.decode(F,{stream:!0});const X=b.split(`
|
|
88
|
+
`);b=X.pop()??"";let W="";for(let U=0;U<X.length;U++){const M=X[U];if(M.startsWith("event: ")){W=M.slice(7).trim();continue}if(M.startsWith("data: ")){let G;try{G=JSON.parse(M.slice(6))}catch{W="";continue}switch(W){case"thinking":G.text&&((C=d.onThinking)==null||C.call(d,G.text));break;case"output":G.text&&d.onText(G.text);break;case"tool":(E=d.onToolUse)==null||E.call(d,G.name,G.input);break;case"dispatch":(N=d.onDispatch)==null||N.call(d,G.roleId,G.task);break;case"dispatch:progress":(_=d.onDispatchProgress)==null||_.call(d,G.roleId,G.type,G);break;case"turn":(B=d.onTurn)==null||B.call(d,G.turn);break;case"done":d.onDone(G);break;case"error":d.onError(G.message??"Unknown error");break;default:G.text&&d.onText(G.text);break}W=""}}}}finally{clearInterval(j)}}).catch(f=>{f.name!=="AbortError"&&d.onError(f.message)}),{abort:r}},[r]),abort:r}}const Zg="tycono-appearances",kh="tycono-theme";function K0(){try{const e=localStorage.getItem(Zg);return e?JSON.parse(e):{}}catch{return{}}}function Kf(e){localStorage.setItem(Zg,JSON.stringify(e))}function Z0(){try{const e=localStorage.getItem(kh);if(e&&e in bl)return e}catch{}return"default"}function vE(e){var i;const r=(i=bl[e])==null?void 0:i.vars;if(!r)return;const a=document.documentElement;for(const[c,u]of Object.entries(r))a.style.setProperty(c,u)}const Zf={mode:"auto",intervalSec:18,dailyBudgetUsd:1},jh="tycono-speech-settings",Pf="tycono-language";function wE(){try{const e=localStorage.getItem(jh);return e?{...Zf,...JSON.parse(e)}:Zf}catch{return Zf}}function kE(){const[e,r]=w.useState(K0),[a,i]=w.useState(Z0),[c,u]=w.useState(wE),[d,m]=w.useState(()=>{try{return localStorage.getItem(Pf)??"auto"}catch{return"auto"}}),x=w.useRef(!1);w.useEffect(()=>{x.current||(x.current=!0,Se.getPreferences().then(j=>{const C=Object.keys(j.appearances??{}).length>0||j.theme!=="default";if(j.speech&&(u(E=>({...E,...j.speech})),localStorage.setItem(jh,JSON.stringify(j.speech))),j.language&&(m(j.language),localStorage.setItem(Pf,j.language)),C){const E=j.appearances;r(E),Kf(E),j.theme&&j.theme in bl&&(i(j.theme),localStorage.setItem(kh,j.theme))}else{const E=K0(),N=Z0();(Object.keys(E).length>0||N!=="default")&&Se.updatePreferences({appearances:E,theme:N}).catch(()=>{})}}).catch(()=>{}))},[]),w.useEffect(()=>{vE(a)},[a]);const f=w.useCallback(j=>e[j]??tm(j),[e]),y=w.useCallback((j,C)=>{r(E=>{const N={...E,[j]:C};return Kf(N),Se.updatePreferences({appearances:N}).catch(()=>{}),N})},[]),g=w.useCallback(j=>{r(C=>{const E={...C};return delete E[j],Kf(E),Se.updatePreferences({appearances:E}).catch(()=>{}),E})},[]),b=w.useCallback(j=>{i(j),localStorage.setItem(kh,j),Se.updatePreferences({theme:j}).catch(()=>{})},[]),v=w.useCallback(j=>{u(C=>{const E={...C,...j};return localStorage.setItem(jh,JSON.stringify(E)),Se.updatePreferences({speech:E}).catch(()=>{}),E})},[]),S=w.useCallback(j=>{m(j),localStorage.setItem(Pf,j),Se.updatePreferences({language:j}).catch(()=>{})},[]);return{appearances:e,getAppearance:f,setAppearance:y,resetAppearance:g,theme:a,setTheme:b,speechSettings:c,setSpeechSettings:v,language:d,setLanguage:S}}const jE=3e4,SE=3e5;function CE(){var G;const[e,r]=w.useState("akb"),[a,i]=w.useState(null),[c,u]=w.useState("synced"),[d,m]=w.useState([]),[x,f]=w.useState(null),[y,g]=w.useState(!1),b=w.useRef(null),v=w.useRef(null),S=w.useRef(e);S.current=e;const j=w.useCallback(async()=>{try{const O=await Se.getSaveStatus(S.current);i(O),O.noGit?u("no-git"):u(V=>V==="saving"?V:O.dirty?"dirty":"synced")}catch{u("error")}},[]),C=w.useCallback(async()=>{try{const O=await Se.getSyncStatus(S.current);f({ahead:O.ahead,behind:O.behind,branch:O.branch,hasRemote:O.hasRemote})}catch{}},[]),E=w.useCallback(()=>{b.current&&clearInterval(b.current),j(),b.current=setInterval(j,jE),v.current&&clearInterval(v.current),C(),v.current=setInterval(C,SE)},[j,C]);w.useEffect(()=>()=>{b.current&&clearInterval(b.current),v.current&&clearInterval(v.current)},[]);const N=w.useCallback(O=>{r(O),S.current=O,i(null),f(null),m([]),setTimeout(()=>{j(),C()},0)},[j,C]),_=w.useCallback(async O=>{u("saving");try{const V=await Se.save(O,S.current);return await j(),V}catch(V){throw u("error"),V}},[j]),B=w.useCallback(async()=>{try{const O=await Se.getSaveHistory(20,S.current);m(O)}catch{}},[]),I=w.useCallback(async O=>{u("saving");try{await Se.restoreSave(O,void 0,S.current),await j()}catch(V){throw u("error"),V}},[j]),F=w.useCallback(async()=>{g(!0);try{const O=await Se.pull(S.current);return await j(),await C(),O}catch(O){throw O}finally{g(!1)}},[j,C]),X=w.useCallback(async()=>{try{await Se.initGit(),await j()}catch{u("error")}},[j]),W=a?a.modified.length+a.untracked.length:0,U=((G=a==null?void 0:a.lastCommit)==null?void 0:G.date)??null,M=w.useCallback(async()=>{E()},[E]);return{state:c,dirtyCount:W,lastSaved:U,status:a,save:_,history:d,loadHistory:B,restore:I,refresh:M,initGit:X,repo:e,setRepo:N,syncInfo:x,fetchSyncStatus:C,pull:F,pulling:y}}const P0={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."]},J0={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."]},EE=[{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."}]}],NE=18e3,ey=6e3,AE=2500,TE=30*6e4,Pg="tycono:relationships";function DE(){try{const e=localStorage.getItem(Pg);return e?JSON.parse(e):[]}catch{return[]}}function zE(e){localStorage.setItem(Pg,JSON.stringify(e))}function Oc(e,r,a){const[i,c]=r<a?[r,a]:[a,r];let u=e.find(d=>d.roleA===i&&d.roleB===c);return u||(u={roleA:i,roleB:c,dispatches:0,wavesTogether:0,conversations:0,familiarity:0,lastInteraction:new Date().toISOString()},e.push(u)),u}function Bc(e){return Math.min(100,e.dispatches*5+e.wavesTogether*10+e.conversations*2)}function $c(e){return e[Math.floor(Math.random()*e.length)]}function RE(e,r,a){const i=a.find(m=>m.id===e),c=a.find(m=>m.id===r);if(!i||!c)return null;const u=i.level==="c-level",d=c.level==="c-level";return u&&d?"c-level":i.reportsTo===r||c.reportsTo===e?"superior-subordinate":(i.reportsTo===c.reportsTo,"peer")}function ME(e,r){return e.relation==="any"?!0:e.relation===r}function FE({roles:e,roleStatuses:r,activeExecs:a,getStandupSpeech:i}){const[c,u]=w.useState(new Map),[d,m]=w.useState(DE),x=w.useRef({}),f=w.useRef(null),y=w.useRef(e),g=w.useRef(r),b=w.useRef(a),v=w.useRef(i),S=w.useRef(d);y.current=e,g.current=r,b.current=a,v.current=i,S.current=d,w.useEffect(()=>{const B=Date.now();for(const[I,F]of Object.entries(r))F==="working"&&(x.current[I]=B)},[r]),w.useEffect(()=>{zE(d)},[d]);const j=w.useCallback(B=>{const I=g.current[B],F=b.current.find(G=>G.roleId===B);if(I==="working"&&(F!=null&&F.task))return null;const X=v.current(B);if(X&&Math.random()<.3)return{text:X,type:"work",ts:Date.now()};const W=Date.now(),U=x.current[B]??0;if(W-U>TE&&Math.random()<.5){const G=J0[B]??J0.engineer;return{text:$c(G),type:"guilt",ts:W}}const M=P0[B]??P0.engineer;return{text:$c(M),type:"personality",ts:W}},[]),C=w.useCallback(B=>{if(f.current)return!1;const I=B.filter(Y=>g.current[Y.id]!=="working");if(I.length<2)return!1;const F=[...I].sort(()=>Math.random()-.5),X=F[0],W=F[1],U=RE(X.id,W.id,B);if(!U)return!1;const M=Oc(S.current,X.id,W.id),G=Bc(M),O=EE.filter(Y=>ME(Y,U)&&G>=Y.minFamiliarity);if(O.length===0)return!1;const V=$c(O);let J=X.id,Q=W.id;V.relation==="superior-subordinate"&&(W.reportsTo===X.id||X.level==="c-level"?(J=X.id,Q=W.id):(J=W.id,Q=X.id)),f.current={templateId:V.id,roleA:J,roleB:Q,turnIdx:0,timer:null};const H=Y=>{if(!f.current||Y>=V.turns.length){f.current=null,m(z=>{const Z=[...z],D=Oc(Z,J,Q);return D.conversations++,D.familiarity=Bc(D),D.lastInteraction=new Date().toISOString(),Z}),setTimeout(()=>{u(z=>{const Z=new Map(z);return Z.delete(J),Z.delete(Q),Z})},ey);return}const ne=V.turns[Y],we=ne.speaker==="A"?J:Q,T=ne.speaker==="A"?Q:J;u(z=>{const Z=new Map(z);if(Z.set(we,{text:ne.text,type:"social",partnerId:T,ts:Date.now()}),Y>0){const D=V.turns[Y-1].speaker==="A"?J:Q;D!==we&&Z.delete(D)}return Z}),f.current.turnIdx=Y,f.current.timer=setTimeout(()=>H(Y+1),AE)};return H(0),!0},[]);w.useEffect(()=>{const B=setInterval(()=>{const I=y.current;if(I.length===0||f.current||Math.random()<.35&&C(I))return;const F=I.filter(U=>g.current[U.id]!=="working");if(F.length===0)return;const X=$c(F),W=j(X.id);W&&(u(U=>{const M=new Map(U);return M.set(X.id,W),M}),setTimeout(()=>{u(U=>{const M=new Map(U),G=M.get(X.id);return G&&G.ts===W.ts&&M.delete(X.id),M})},ey))},NE);return()=>{var I;clearInterval(B),(I=f.current)!=null&&I.timer&&clearTimeout(f.current.timer)}},[j,C]);const E=w.useCallback(B=>{const I=c.get(B);return(I==null?void 0:I.text)??""},[c]),N=w.useCallback((B,I)=>{m(F=>{const X=[...F],W=Oc(X,B,I);return W.dispatches++,W.familiarity=Bc(W),W.lastInteraction=new Date().toISOString(),X})},[]),_=w.useCallback(B=>{B.length<2||m(I=>{const F=[...I];for(let X=0;X<B.length;X++)for(let W=X+1;W<B.length;W++){const U=Oc(F,B[X],B[W]);U.wavesTogether++,U.familiarity=Bc(U),U.lastInteraction=new Date().toISOString()}return F})},[]);return{speeches:c,getSpeech:E,relationships:d,notifyDispatch:N,notifyWave:_}}const Jg="tycono:office-chat";let _E=0;function OE(){return`chat-${Date.now()}-${++_E}`}function Jf(){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 BE(){try{const e=localStorage.getItem(Jg);if(e){const r=JSON.parse(e);if(r.find(i=>i.id==="office")&&!r.find(i=>i.id==="general")){const i=r.filter(c=>c.id!=="office");return[...Jf(),...i]}const a=Jf();for(const i of a)r.find(c=>c.id===i.id)||r.unshift(i);return r}}catch{}return Jf()}function $E(e){const r=e.map(a=>({...a,messages:a.messages.slice(-200)}));localStorage.setItem(Jg,JSON.stringify(r))}function LE(){const[e,r]=w.useState(BE),[a,i]=w.useState(null),[c,u]=w.useState(new Set);w.useEffect(()=>{$E(e)},[e]);const d=w.useCallback(v=>{i(v),v&&u(S=>{const j=new Set(S);return j.delete(v),j})},[]),m=w.useCallback(v=>{const S={...v,id:OE()};r(j=>{const C=j.map(E=>E.id==="general"?v.type==="dispatch"?{...E,messages:[...E.messages,S].slice(-200)}:E:v.channelId?E.id===v.channelId?{...E,messages:[...E.messages,S].slice(-200)}:E:E.members.length>0&&E.members.includes(v.roleId)?{...E,messages:[...E.messages,S].slice(-200)}:E);return u(E=>{const N=new Set(E);for(const _ of C){const B=j.find(I=>I.id===_.id);B&&_.messages.length>B.messages.length&&N.add(_.id)}return N}),C})},[]),x=w.useCallback((v,S,j)=>{const C=`ch-${Date.now()}`,E={id:C,name:v.startsWith("#")?v:`#${v}`,members:S,isDefault:!1,messages:[],topic:j};r(N=>[...N,E]),i(C)},[]),f=w.useCallback(v=>{r(S=>S.filter(j=>j.id!==v||j.isDefault)),i(S=>S===v?"general":S)},[]),y=w.useCallback((v,S)=>{r(j=>j.map(C=>C.id===v&&!C.isDefault?{...C,members:S}:C))},[]),g=w.useCallback((v,S)=>{r(j=>j.map(C=>C.id===v&&!C.isDefault?{...C,topic:S||void 0}:C))},[]),b=w.useCallback(v=>{r(S=>S.map(j=>{if(j.id==="watercooler"){const C=v.filter(E=>E.level!=="c-level").map(E=>E.id);if(j.members.length!==C.length||!C.every(E=>j.members.includes(E)))return{...j,members:C}}return j}))},[]);return{channels:e,activeChannelId:a,setActiveChannelId:d,pushMessage:m,createChannel:x,deleteChannel:f,updateMembers:y,updateTopic:g,unreadChannels:c,syncDefaultMembers:b}}const HE=45e3,IE=5e3,UE=4,qE=20;function YE({roles:e,roleStatuses:r,activeExecs:a,channels:i,relationships:c,pushMessage:u,speechSettings:d,engineType:m,hasApiKey:x}){const y=((d==null?void 0:d.mode)==="auto"?m==="claude-cli"||m==="local"?"llm":"template":(d==null?void 0:d.mode)??"template")==="llm"&&(x!==!1||m==="claude-cli"),g=((d==null?void 0:d.intervalSec)??HE/1e3)*1e3,b=w.useRef(e),v=w.useRef(r),S=w.useRef(a),j=w.useRef(i),C=w.useRef(c),E=w.useRef(u),N=w.useRef(0),_=w.useRef(!1);b.current=e,v.current=r,S.current=a,j.current=i,C.current=c,E.current=u;const B=w.useCallback(async(F,X)=>{if(_.current)return!1;_.current=!0;try{if(!b.current.find(Q=>Q.id===F))return!1;const U=X.messages.slice(-qE).map(Q=>({roleId:Q.roleId,text:Q.text,ts:Q.ts})),M=b.current.filter(Q=>X.members.includes(Q.id)),G=C.current.filter(Q=>Q.roleA===F||Q.roleB===F).map(Q=>({partnerId:Q.roleA===F?Q.roleB:Q.roleA,familiarity:Q.familiarity})),O=S.current.find(Q=>Q.roleId===F),V=O?{currentTask:O.task,taskProgress:null}:{currentTask:null,taskProgress:null},J=await Se.chatInChannel({channelId:X.name.replace("#",""),channelTopic:X.topic,roleId:F,history:U,members:M.map(Q=>({id:Q.id,name:Q.name,level:Q.level})),relationships:G,workContext:V});return J.message?(E.current({ts:Date.now(),roleId:F,text:J.message,type:"chat",channelId:X.id}),!0):!1}catch{return!1}finally{_.current=!1}},[]),I=w.useCallback(async(F,X)=>{if(N.current>=UE){N.current=0;return}const W=F.members.filter(O=>O!==X&&v.current[O]!=="working");if(W.length===0){N.current=0;return}const U=W[Math.floor(Math.random()*W.length)];if(Math.random()>.7){N.current=0;return}const M=N.current*2e3,G=Math.random()*5e3;setTimeout(async()=>{N.current++;const O=j.current.find(J=>J.id===F.id);if(!O)return;if(await B(U,O)){const J=.6-N.current*.1;Math.random()<J?I(O,U):N.current=0}else N.current=0},IE+M+G)},[B]);w.useEffect(()=>{if(!y)return;const F=setInterval(async()=>{const X=b.current;if(X.length===0||_.current)return;const W=X.filter(V=>v.current[V.id]!=="working");if(W.length===0)return;const U=W[Math.floor(Math.random()*W.length)],M=j.current.filter(V=>V.members.length===0?!0:V.members.includes(U.id));if(M.length===0)return;const G=M[Math.floor(Math.random()*M.length)];N.current=0,await B(U.id,G)&&I(G,U.id)},g);return()=>clearInterval(F)},[y,g,B,I])}function Lc({type:e,className:r}){const a=w.useRef(null),i=Qj(e);return w.useEffect(()=>{const c=a.current;if(!c||!i)return;const u=c.getContext("2d");u&&Kj(u,i)},[e,i]),i?s.jsx("canvas",{ref:a,width:i.canvasWidth,height:i.canvasHeight,className:r,style:{imageRendering:"pixelated",display:"block"}}):null}const eb=[[1,8],[3,5],[8,1],[5,3]],XE=[[1,4],[2,3],[4,1],[3,2]];function Hc(e){const r=e===1||e===3?-1:0,a=eb[e],i=e<2?[0,1]:[1,0],c=r;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:c+8,w:10,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.35},{x:1,y:c+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:10,y:c+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:-1,y:c+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:c+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:-1,y:c+12,w:2,h:1,c:"$skin"},{x:11,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:1,y:c+0,w:10,h:7,c:"$skin"},{x:3,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:c+3,w:1,h:1,c:"#FFF",a:.4},{x:7,y:c+3,w:1,h:1,c:"#FFF",a:.4},{x:5,y:c+6,w:2,h:1,c:"darken($skin, 25)",a:.35},{x:0,y:c+3,w:1,h:1,c:"$skin"},{x:11,y:c+3,w:1,h:1,c:"$skin"},{x:1,y:c+0,w:10,h:3,c:"$hair"},{x:0,y:c+1,w:2,h:3,c:"$hair"},{x:10,y:c+1,w:2,h:3,c:"$hair"},{x:2,y:c+0,w:8,h:1,c:"lighten($hair, 25)",a:.3}]}function Ic(e){const r=e===1||e===3?-1:0,a=eb[e],i=e<2?[0,1]:[1,0],c=r;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:c+8,w:10,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:5,y:c+10,w:2,h:3,c:"darken($shirt, 30)",a:.12},{x:-1,y:c+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:c+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:1,y:c+0,w:10,h:7,c:"$skin"},{x:1,y:c+0,w:10,h:6,c:"$hair"},{x:0,y:c+1,w:2,h:5,c:"$hair"},{x:10,y:c+1,w:2,h:5,c:"$hair"},{x:2,y:c+0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:0,y:c+4,w:1,h:1,c:"$skin",a:.6},{x:11,y:c+4,w:1,h:1,c:"$skin",a:.6}]}function hl(e,r){const a=e===1||e===3?-1:0,i=XE[e],c=a,u=e%2===0?1:0;return r?[{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:c+8,w:8,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:8,y:c+9+u,w:3,h:4-u,c:"$shirt"},{x:9,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:2,y:c+0,w:8,h:7,c:"$skin"},{x:7,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:c+3,w:1,h:1,c:"#FFF",a:.3},{x:9,y:c+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:c+0,w:8,h:3,c:"$hair"},{x:1,y:c+1,w:2,h:4,c:"$hair"},{x:9,y:c+1,w:2,h:3,c:"$hair"},{x:3,y:c+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:c+8,w:8,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:0,y:c+9+u,w:3,h:4-u,c:"$shirt"},{x:-1,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:2,y:c+0,w:8,h:7,c:"$skin"},{x:3,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:c+3,w:1,h:1,c:"#FFF",a:.3},{x:1,y:c+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:c+0,w:8,h:3,c:"$hair"},{x:1,y:c+1,w:2,h:3,c:"$hair"},{x:9,y:c+1,w:2,h:4,c:"$hair"},{x:3,y:c+0,w:6,h:1,c:"lighten($hair, 25)",a:.25}]}const ty={down:[Hc(0),Hc(1),Hc(2),Hc(3)],up:[Ic(0),Ic(1),Ic(2),Ic(3)],right:[hl(0,!0),hl(1,!0),hl(2,!0),hl(3,!0)],left:[hl(0,!1),hl(1,!1),hl(2,!1),hl(3,!1)]},Xe="#FAFAF7",Hr="#FFFFFF",qe="#EDE8E2",ut="#DDD6CC",Sh="#1A1A2E",tb="#2A2A2A",VE="#FFB0B0",ny=[{x:2,y:0,w:1,h:1,c:qe},{x:3,y:0,w:1,h:1,c:Xe},{x:4,y:0,w:1,h:1,c:Hr},{x:5,y:0,w:1,h:1,c:Xe},{x:6,y:0,w:1,h:1,c:qe},{x:1,y:1,w:1,h:1,c:ut},{x:2,y:1,w:1,h:1,c:Xe},{x:3,y:1,w:1,h:1,c:Hr},{x:4,y:1,w:1,h:1,c:Xe},{x:5,y:1,w:1,h:1,c:Hr},{x:6,y:1,w:1,h:1,c:Xe},{x:7,y:1,w:1,h:1,c:ut},{x:0,y:2,w:1,h:1,c:ut},{x:1,y:2,w:1,h:1,c:qe},{x:2,y:2,w:1,h:1,c:Xe},{x:3,y:2,w:1,h:1,c:Xe},{x:4,y:2,w:1,h:1,c:Hr},{x:5,y:2,w:1,h:1,c:Xe},{x:6,y:2,w:1,h:1,c:Xe},{x:7,y:2,w:1,h:1,c:qe},{x:8,y:2,w:1,h:1,c:ut},{x:1,y:3,w:1,h:1,c:qe},{x:2,y:3,w:1,h:1,c:Xe},{x:3,y:3,w:1,h:1,c:Sh},{x:4,y:3,w:1,h:1,c:Xe},{x:5,y:3,w:1,h:1,c:Sh},{x:6,y:3,w:1,h:1,c:Xe},{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:Xe},{x:4,y:4,w:1,h:1,c:tb},{x:5,y:4,w:1,h:1,c:Xe},{x:6,y:4,w:1,h:1,c:qe},{x:3,y:5,w:1,h:1,c:ut},{x:4,y:5,w:1,h:1,c:qe},{x:5,y:5,w:1,h:1,c:ut},{x:2,y:6,w:1,h:1,c:qe},{x:3,y:6,w:1,h:1,c:Xe},{x:4,y:6,w:1,h:1,c:Hr},{x:5,y:6,w:1,h:1,c:Xe},{x:6,y:6,w:1,h:1,c:qe},{x:2,y:7,w:1,h:1,c:ut},{x:3,y:7,w:1,h:1,c:qe},{x:4,y:7,w:1,h:1,c:Xe},{x:5,y:7,w:1,h:1,c:qe},{x:6,y:7,w:1,h:1,c:ut}],GE=[{x:3,y:8,w:1,h:1,c:qe},{x:5,y:8,w:1,h:1,c:qe},{x:3,y:9,w:1,h:1,c:ut},{x:5,y:9,w:1,h:1,c:ut}],QE=[{x:2,y:8,w:1,h:1,c:qe},{x:6,y:8,w:1,h:1,c:qe},{x:2,y:9,w:1,h:1,c:ut},{x:6,y:9,w:1,h:1,c:ut}],ry=[{x:2,y:0,w:1,h:1,c:qe},{x:3,y:0,w:1,h:1,c:Xe},{x:4,y:0,w:1,h:1,c:Hr},{x:5,y:0,w:1,h:1,c:Xe},{x:6,y:0,w:1,h:1,c:qe},{x:1,y:1,w:1,h:1,c:ut},{x:2,y:1,w:1,h:1,c:qe},{x:3,y:1,w:1,h:1,c:Xe},{x:4,y:1,w:1,h:1,c:Hr},{x:5,y:1,w:1,h:1,c:Xe},{x:6,y:1,w:1,h:1,c:qe},{x:7,y:1,w:1,h:1,c:ut},{x:0,y:2,w:1,h:1,c:ut},{x:1,y:2,w:1,h:1,c:qe},{x:2,y:2,w:1,h:1,c:Xe},{x:3,y:2,w:1,h:1,c:Xe},{x:4,y:2,w:1,h:1,c:Xe},{x:5,y:2,w:1,h:1,c:Xe},{x:6,y:2,w:1,h:1,c:Xe},{x:7,y:2,w:1,h:1,c:qe},{x:8,y:2,w:1,h:1,c:ut},{x:1,y:3,w:1,h:1,c:ut},{x:2,y:3,w:1,h:1,c:qe},{x:3,y:3,w:1,h:1,c:Xe},{x:4,y:3,w:1,h:1,c:Xe},{x:5,y:3,w:1,h:1,c:Xe},{x:6,y:3,w:1,h:1,c:qe},{x:7,y:3,w:1,h:1,c:ut},{x:2,y:4,w:1,h:1,c:ut},{x:3,y:4,w:1,h:1,c:qe},{x:4,y:4,w:1,h:1,c:Xe},{x:5,y:4,w:1,h:1,c:qe},{x:6,y:4,w:1,h:1,c:ut},{x:3,y:5,w:1,h:1,c:ut},{x:4,y:5,w:1,h:1,c:qe},{x:5,y:5,w:1,h:1,c:ut},{x:2,y:6,w:1,h:1,c:qe},{x:3,y:6,w:1,h:1,c:Xe},{x:4,y:6,w:1,h:1,c:Xe},{x:5,y:6,w:1,h:1,c:Xe},{x:6,y:6,w:1,h:1,c:qe},{x:2,y:7,w:1,h:1,c:ut},{x:3,y:7,w:1,h:1,c:qe},{x:4,y:7,w:1,h:1,c:Xe},{x:5,y:7,w:1,h:1,c:qe},{x:6,y:7,w:1,h:1,c:ut},{x:4,y:5,w:1,h:1,c:Xe},{x:4,y:4,w:1,h:1,c:Hr}],WE=[{x:3,y:8,w:1,h:1,c:qe},{x:5,y:8,w:1,h:1,c:qe},{x:3,y:9,w:1,h:1,c:ut},{x:5,y:9,w:1,h:1,c:ut}],KE=[{x:2,y:8,w:1,h:1,c:qe},{x:6,y:8,w:1,h:1,c:qe},{x:2,y:9,w:1,h:1,c:ut},{x:6,y:9,w:1,h:1,c:ut}],Ch=[{x:8,y:0,w:1,h:1,c:qe},{x:9,y:0,w:1,h:1,c:Xe},{x:10,y:0,w:1,h:1,c:Hr},{x:11,y:0,w:1,h:1,c:Xe},{x:7,y:1,w:1,h:1,c:ut},{x:8,y:1,w:1,h:1,c:Xe},{x:9,y:1,w:1,h:1,c:Hr},{x:10,y:1,w:1,h:1,c:Xe},{x:11,y:1,w:1,h:1,c:Xe},{x:12,y:1,w:1,h:1,c:qe},{x:0,y:2,w:1,h:1,c:Hr},{x:1,y:2,w:1,h:1,c:Xe},{x:3,y:2,w:1,h:1,c:qe},{x:4,y:2,w:1,h:1,c:Xe},{x:5,y:2,w:1,h:1,c:Xe},{x:6,y:2,w:1,h:1,c:Xe},{x:7,y:2,w:1,h:1,c:qe},{x:8,y:2,w:1,h:1,c:Xe},{x:9,y:2,w:1,h:1,c:Xe},{x:10,y:2,w:1,h:1,c:Xe},{x:11,y:2,w:1,h:1,c:Xe},{x:12,y:2,w:1,h:1,c:qe},{x:0,y:3,w:1,h:1,c:qe},{x:1,y:3,w:1,h:1,c:ut},{x:3,y:3,w:1,h:1,c:ut},{x:4,y:3,w:1,h:1,c:qe},{x:5,y:3,w:1,h:1,c:Xe},{x:6,y:3,w:1,h:1,c:qe},{x:7,y:3,w:1,h:1,c:ut},{x:8,y:3,w:1,h:1,c:Xe},{x:9,y:3,w:1,h:1,c:Sh},{x:10,y:3,w:1,h:1,c:Xe},{x:11,y:3,w:1,h:1,c:qe},{x:3,y:4,w:1,h:1,c:ut},{x:4,y:4,w:1,h:1,c:qe},{x:5,y:4,w:1,h:1,c:Xe},{x:6,y:4,w:1,h:1,c:qe},{x:8,y:4,w:1,h:1,c:qe},{x:9,y:4,w:1,h:1,c:Xe},{x:10,y:4,w:1,h:1,c:tb}],nb=[{x:4,y:5,w:1,h:1,c:qe},{x:6,y:5,w:1,h:1,c:qe},{x:8,y:5,w:1,h:1,c:qe},{x:10,y:5,w:1,h:1,c:qe},{x:4,y:6,w:1,h:1,c:ut},{x:6,y:6,w:1,h:1,c:ut},{x:8,y:6,w:1,h:1,c:ut},{x:10,y:6,w:1,h:1,c:ut}],rb=[{x:3,y:5,w:1,h:1,c:qe},{x:5,y:5,w:1,h:1,c:qe},{x:9,y:5,w:1,h:1,c:qe},{x:11,y:5,w:1,h:1,c:qe},{x:3,y:6,w:1,h:1,c:ut},{x:5,y:6,w:1,h:1,c:ut},{x:9,y:6,w:1,h:1,c:ut},{x:11,y:6,w:1,h:1,c:ut}];function nm(e,r=13){return e.map(a=>({...a,x:r-1-a.x}))}const ay=nm(Ch),ZE=nm(nb),PE=nm(rb),JE={down:[[...ny,...GE],[...ny,...QE]],up:[[...ry,...WE],[...ry,...KE]],right:[[...Ch,...nb],[...Ch,...rb]],left:[[...ay,...ZE],[...ay,...PE]]},eN=[{x:4,y:5,w:1,h:1,c:VE}],tN=[{x:1,y:9,w:7,h:1,c:"#100A06",a:.12}],nN=[{x:2,y:6,w:9,h:1,c:"#100A06",a:.12}],Ze=4,Ht=28,Sn=2,vt=4,dt=4,Ra=[{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 rm(e,r,a){const u=e.fy+Math.max(10,Math.floor(e.fh*.18)),d=Math.min(r,a),m=Math.ceil(r/d),x=[],f=d*28,y=e.fx+Math.max(8,Math.floor((e.fw-f)/2));for(let g=0;g<m&&x.length<r;g++){const b=Math.min(d,r-g*d);for(let v=0;v<b;v++)x.push({dx:y+v*28,dy:u+g*28,room:e.id})}return x}function rN(e){const i=Ra[0],c={id:"main",wx:Ze+dt,wy:Ze,ww:160-2*(Ze+dt),wh:Ht,fx:Ze+dt,fy:Ze+Ht+Sn,fw:160-2*(Ze+dt),fh:120-Ze-Ht-Sn-Ze,...i},u=rm(c,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*(Ze+dt))/2),offsetY:10}],m=[{id:"s-plant-l",type:"plant",room:"main",zone:"floor",offsetX:4,offsetY:4},{id:"s-plant-r",type:"plant",room:"main",zone:"floor",anchorX:"right",offsetX:-8,offsetY:4}];return{preset:"S",canvasW:160,canvasH:120,rooms:{main:c},desks:u,doors:{},adjacency:{main:[]},corridorY:{main:c.fy+c.fh-12},waypoints:{main:[{x:c.fx+10,y:c.fy+c.fh-14},{x:c.fx+c.fw/2,y:c.fy+c.fh-14},{x:c.fx+c.fw-10,y:c.fy+c.fh-14}]},wallDecorations:d,furniture:m}}function aN(e){const c={id:"exec",wx:Ze+dt,wy:Ze,ww:144-Ze-dt-vt/2,wh:Ht,fx:Ze+dt,fy:Ze+Ht+Sn,fw:144-Ze-dt-vt/2,fh:66,...Ra[0]},u={id:"work",wx:144+vt/2+dt,wy:Ze,ww:144-vt/2-dt-Ze,wh:Ht,fx:144+vt/2+dt,fy:Ze+Ht+Sn,fw:144-vt/2-dt-Ze,fh:66,...Ra[1]},d={id:"meet",wx:Ze+dt,wy:Ze+Ht+Sn+66+vt,ww:144-Ze-dt-vt/2,wh:Ht,fx:Ze+dt,fy:Ze+Ht+Sn+66+vt+Ht+Sn,fw:144-Ze-dt-vt/2,fh:70,...Ra[2]},m={id:"comm",wx:144+vt/2+dt,wy:Ze+Ht+Sn+66+vt,ww:144-vt/2-dt-Ze,wh:Ht,fx:144+vt/2+dt,fy:Ze+Ht+Sn+66+vt+Ht+Sn,fw:144-vt/2-dt-Ze,fh:70,...Ra[3]},x={exec:c,work:u,meet:d,comm:m},f=[];let y=e;const g=[[c,Math.min(3,y)],[u,0]];g[1][1]=Math.min(3,y-g[0][1]);const b=[[d,0],[m,0]];let v=y-g[0][1]-g[1][1];v>0&&(b[0][1]=Math.min(2,v),v-=b[0][1]),v>0&&(b[1][1]=Math.min(2,v));for(const[F,X]of[...g,...b])X>0&&f.push(...rm(F,X,3));const S=Ze+Ht+Sn+66,j=144-vt/2,C={exec_work:{id:"exec_work",type:"v",doorY:Ze+Ht+Sn+20+12,xA:j-2,xB:u.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:Ze+Ht+Sn+66+vt+Ht+Sn+20+12,xA:j-2,xB:m.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:Ze+dt+40+14,yA:S-2,yB:d.fy+2},work_comm:{id:"work_comm",type:"h",doorX:144+vt/2+dt+40+14,yA:S-2,yB:m.fy+2}},E={exec:[{room:"work",door:"exec_work",side:"A"},{room:"meet",door:"exec_meet",side:"A"}],work:[{room:"exec",door:"exec_work",side:"B"},{room:"comm",door:"work_comm",side:"A"}],meet:[{room:"exec",door:"exec_meet",side:"B"},{room:"comm",door:"meet_comm",side:"A"}],comm:[{room:"work",door:"work_comm",side:"B"},{room:"meet",door:"meet_comm",side:"B"}]},N={exec:c.fy+52,work:u.fy+48,meet:d.fy+56,comm:m.fy+42},_={exec:[{x:c.fx+6,y:c.fy+52},{x:c.fx+60,y:c.fy+54},{x:c.fx+112,y:c.fy+50},{x:c.fx+50,y:c.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:m.fx+96,y:m.fy+8},{x:m.fx+60,y:m.fy+42},{x:m.fx+40,y:m.fy+42},{x:m.fx+20,y:m.fy+42}]},B=[{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}],I=[{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(c.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"M",canvasW:288,canvasH:208,rooms:x,desks:f,doors:C,adjacency:E,corridorY:N,waypoints:_,wallDecorations:B,furniture:I}}function lN(e){const d={id:"exec",wx:Ze+dt,wy:Ze,ww:180-Ze-dt-vt/2,wh:Ht,fx:Ze+dt,fy:Ze+Ht+Sn,fw:180-Ze-dt-vt/2,fh:82,...Ra[0]},m={id:"work",wx:180+vt/2+dt,wy:Ze,ww:180-vt/2-dt-Ze,wh:Ht,fx:180+vt/2+dt,fy:Ze+Ht+Sn,fw:180-vt/2-dt-Ze,fh:82,...Ra[1]},x=Ze+Ht+Sn+82,f={id:"meet",wx:Ze+dt,wy:x+vt,ww:180-Ze-dt-vt/2,wh:Ht,fx:Ze+dt,fy:x+vt+Ht+Sn,fw:180-Ze-dt-vt/2,fh:86,...Ra[2]},y={id:"comm",wx:180+vt/2+dt,wy:x+vt,ww:180-vt/2-dt-Ze,wh:Ht,fx:180+vt/2+dt,fy:x+vt+Ht+Sn,fw:180-vt/2-dt-Ze,fh:86,...Ra[3]},g={exec:d,work:m,meet:f,comm:y},b=[];let v=e;const S=[[d,Math.min(5,v)],[m,0]];S[1][1]=Math.min(5,v-S[0][1]);const j=[[f,0],[y,0]];let C=v-S[0][1]-S[1][1];C>0&&(j[0][1]=Math.min(3,C),C-=j[0][1]),C>0&&(j[1][1]=Math.min(3,C));for(const[W,U]of[...S,...j])U>0&&b.push(...rm(W,U,4));const E=180-vt/2,N={exec_work:{id:"exec_work",type:"v",doorY:d.fy+82/2,xA:E-2,xB:m.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:f.fy+86/2,xA:E-2,xB:y.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:d.fx+54,yA:x-2,yB:f.fy+2},work_comm:{id:"work_comm",type:"h",doorX:m.fx+54,yA:x-2,yB:y.fy+2}},_={exec:[{room:"work",door:"exec_work",side:"A"},{room:"meet",door:"exec_meet",side:"A"}],work:[{room:"exec",door:"exec_work",side:"B"},{room:"comm",door:"work_comm",side:"A"}],meet:[{room:"exec",door:"exec_meet",side:"B"},{room:"comm",door:"meet_comm",side:"A"}],comm:[{room:"work",door:"work_comm",side:"B"},{room:"meet",door:"meet_comm",side:"B"}]},B={exec:d.fy+82-12,work:m.fy+82-12,meet:f.fy+86-12,comm:y.fy+86-12},I={exec:[{x:d.fx+10,y:B.exec},{x:d.fx+d.fw/2,y:B.exec},{x:d.fx+d.fw-10,y:B.exec}],work:[{x:m.fx+10,y:B.work},{x:m.fx+m.fw/2,y:B.work},{x:m.fx+m.fw-10,y:B.work}],meet:[{x:f.fx+10,y:B.meet},{x:f.fx+f.fw/2,y:B.meet},{x:f.fx+f.fw-10,y:B.meet}],comm:[{x:y.fx+10,y:B.comm},{x:y.fx+y.fw/2,y:B.comm},{x:y.fx+y.fw-10,y:B.comm}]},F=[{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}],X=[{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:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"L",canvasW:360,canvasH:260,rooms:g,desks:b,doors:N,adjacency:_,corridorY:B,waypoints:I,wallDecorations:F,furniture:X}}const iN=2;function ab(e,r){return r?r==="L"&&e<=12-iN?"M":r==="M"&&e>12?"L":r:e<=12?"M":"L"}function lb(e,r){switch(r??ab(e)){case"S":return rN(e);case"M":return aN(e);case"L":return lN(e)}}function ly(e,r){if(!r||Object.keys(r).length===0)return e;const a=i=>i.map(c=>{const u=r[c.id];return u?{...c,offsetX:u.offsetX,offsetY:u.offsetY}:c});return{...e,wallDecorations:a(e.wallDecorations),furniture:a(e.furniture)}}function iy(e,r){if(r)for(const[a,i]of Object.entries(r))e[a]&&(e[a]={...e[a],dx:i.dx,dy:i.dy})}function eh(e,r){if(!r||r.length===0)return e;const a=new Set(r);return{...e,wallDecorations:e.wallDecorations.filter(i=>!a.has(i.id)),furniture:e.furniture.filter(i=>!a.has(i.id))}}function sy(e,r){if(!r||r.length===0)return e;const a=[],i=[];for(const c of r)c.zone==="wall"?a.push(c):i.push(c);return{...e,wallDecorations:[...e.wallDecorations,...a],furniture:[...e.furniture,...i]}}let ro;function sN(e){ro=e}function $(e,r,a,i,c,u){e=Math.round(e),r=Math.round(r),!(u!==void 0&&u<.01)&&(u!==void 0&&u!==1&&(ro.globalAlpha=u),ro.fillStyle=c,ro.fillRect(e,r,a,i),u!==void 0&&u!==1&&(ro.globalAlpha=1))}function ft(e,r,a,i){$(e,r,1,1,a,i)}let Qc=1;function Qi(e){Qc=e}function aa(){return Qc=Qc*16807%2147483647,(Qc&65535)/65535}function ib(e){const r=parseInt(e.slice(1,3),16)/255,a=parseInt(e.slice(3,5),16)/255,i=parseInt(e.slice(5,7),16)/255,c=Math.max(r,a,i),u=Math.min(r,a,i);let d=0,m=0;const x=(c+u)/2;if(c!==u){const f=c-u;m=x>.5?f/(2-c-u):f/(c+u),c===r?d=((a-i)/f+(a<i?6:0))/6:c===a?d=((i-r)/f+2)/6:d=((r-a)/f+4)/6}return[d*360,m*100,x*100]}function sb(e,r,a){e=(e%360+360)%360,r=Math.max(0,Math.min(100,r))/100,a=Math.max(0,Math.min(100,a))/100;const i=r*Math.min(a,1-a),c=d=>{const m=(d+e/30)%12;return a-i*Math.max(-1,Math.min(m-3,9-m,1))},u=d=>Math.round(d*255).toString(16).padStart(2,"0");return"#"+u(c(0))+u(c(8))+u(c(4))}function la(e,r=1){const[a,i,c]=ib(e);return sb(a+15*r,Math.min(100,i+8),c-12*r)}function tn(e,r=1){const[a,i,c]=ib(e);return sb(a-10*r,i-3,c+10*r)}const jn={hi:"#D4AA5C",base:"#B08040",sh:"#7A5038",deep:"#4E3028"},ra={hi:"#8A6848",base:"#604832",sh:"#3A2E24",deep:"#2A1E18"},ea={hi:"#5A6A80",base:"#485868",sh:"#364858",deep:"#283848"},kl="#100A06";function oN(e,r,a=14,i=12){$(e,r,a,i,"#4A3828"),$(e+1,r+1,a-2,i-2,"#5A4838"),$(e+2,r+2,a-4,i-4,"#4A7098"),$(e+2,r+2,a-4,Math.floor((i-4)/2),"#6A90B8",.35);const c=Math.floor(a/2);$(e+c,r+1,1,i-2,"#4A3828"),$(e+1,r+Math.floor(i/2),a-2,1,"#4A3828",.5),ft(e+3,r+3,"#8AB8E8",.35),ft(e+c+2,r+3,"#8AB8E8",.25),$(e-1,r+i,a+2,2,"#5A4838"),$(e-1,r+i,a+2,1,tn("#5A4838",.5),.35)}function cN(e,r,a){$(e,r,10,8,"#3A2818"),$(e+1,r+1,8,6,a),$(e+2,r+2,4,3,tn(a,1.2),.3),ft(e+3,r+2,tn(a,2),.25)}function uN(e,r){$(e,r,7,7,"#3A2818"),$(e+1,r+1,5,5,"#F0EDE5"),ft(e+3,r+1,"#AAA"),ft(e+3,r+5,"#AAA"),ft(e+1,r+3,"#AAA"),ft(e+5,r+3,"#AAA"),ft(e+3,r+3,"#222"),$(e+3,r+1,1,2,"#333"),ft(e+4,r+3,"#D32F2F")}function dN(e,r){$(e,r,26,16,"#586878"),$(e+1,r+1,24,13,"#ECEFF1"),$(e+1,r+1,24,1,"#F5F5F5",.4),$(e+3,r+3,14,1,"#1565C0",.6),$(e+3,r+5,18,1,"#333",.2),$(e+3,r+7,12,1,"#D32F2F",.35),$(e+3,r+9,16,1,"#333",.15),$(e+1,r+14,24,2,"#708898"),$(e+3,r+14,3,1,"#D32F2F"),$(e+7,r+14,3,1,"#1565C0"),$(e+11,r+14,3,1,"#2E7D32")}function fN(e,r){$(e,r,22,16,"#6A5030"),$(e+1,r+1,20,14,"#C4A66A"),Qi(88);for(let a=0;a<14;a++)for(let i=0;i<20;i++)aa()>.5&&ft(e+1+i,r+1+a,aa()>.5?"#B89858":"#D4B87A",.18);$(e+2,r+2,5,4,"#FFF176"),$(e+8,r+2,5,4,"#90CAF9"),$(e+14,r+3,5,4,"#CE93D8"),$(e+3,r+8,7,4,"#C8E6C9"),$(e+11,r+8,8,4,"#F8BBD0"),ft(e+4,r+2,"#E53935"),ft(e+10,r+2,"#1E88E5"),ft(e+16,r+3,"#FF9800")}function hN(e,r){$(e,r,20,3,"#5A4030"),$(e,r,20,1,tn("#5A4030",.5),.35),$(e,r+2,20,1,la("#5A4030",.5),.3),$(e+2,r-4,3,4,"#E53935"),$(e+2,r-4,3,1,tn("#E53935",1),.3),$(e+6,r-3,2,3,"#1E88E5"),$(e+9,r-5,4,5,"#43A047"),$(e+14,r-3,3,3,"#FFD54F"),ft(e+15,r-3,"#FFF176",.4)}function mN(e,r){$(e,r,16,12,"#1E1E28"),$(e+1,r+1,14,9,"#0C1420"),$(e+2,r+2,12,1,"#EF4444",.6),ft(e+2,r+4,"#4CAF50"),$(e+4,r+4,7,1,"#8b949e",.4),ft(e+2,r+6,"#FF9800"),$(e+4,r+6,5,1,"#8b949e",.3),ft(e+2,r+8,"#42A5F5"),$(e+4,r+8,8,1,"#8b949e",.25),$(e+7,r+10,2,2,"#1E1E28"),$(e+5,r+11,6,1,"#586878")}function xN(e,r,a){$(e+2,r+20,22,2,kl,.15),$(e,r,22,20,ra.deep),$(e+1,r+1,20,18,ra.base),$(e,r,22,1,ra.hi,.35),$(e,r,1,20,ra.hi,.2);for(const u of[6,12])$(e+1,r+u,20,2,ra.sh),$(e+1,r+u,20,1,ra.hi,.2);const i=["#E53935","#1E88E5","#43A047","#8E24AA","#FB8C00","#00897B","#5C6BC0"];let c=e+2;for(let u=0;u<5;u++){const d=2+u%2;$(c,r+1,d,5,i[u]),$(c,r+1,d,1,tn(i[u],1),.35),c+=d+1}c=e+2;for(let u=0;u<4;u++)$(c,r+7,4,5,i[u+3]),$(c,r+7,4,1,tn(i[u+3],1),.25),c+=5;$(e+2,r+14,4,4,"#FFD54F"),$(e+8,r+14,7,4,"#90CAF9"),a&&$(e,r-1,22,1,a,.7)}function pN(e,r){$(e+2,r+11,6,2,kl,.1),$(e+2,r+8,6,4,"#8B5E3C"),$(e+1,r+7,8,2,la("#A06E48",.3)),$(e+2,r+7,6,1,tn("#A06E48",.5),.4),$(e+1,r+3,3,4,"#2E7D32"),$(e+5,r+2,3,4,"#2E7D32"),$(e+2,r+1,4,4,"#43A047"),$(e+3,r+0,3,3,"#66BB6A"),ft(e+4,r,"#81C784"),ft(e+3,r+1,"#A5D6A7",.4)}function yN(e,r){Yl(e+4,r-4,"down"),Yl(e+16,r-4,"down"),Yl(e+28,r-4,"down"),$(e+3,r+24,34,3,kl,.15),$(e,r+2,36,18,jn.deep),$(e+1,r+3,34,16,jn.base),$(e+1,r+3,34,1,jn.hi,.35);for(let a=0;a<14;a+=3)$(e+1,r+4+a,34,1,la(jn.base,.2),.08);$(e,r+20,36,4,jn.deep),$(e+1,r+21,34,2,jn.sh),$(e+6,r+7,10,6,"#1A1A24"),$(e+7,r+8,8,4,"#0C1420"),$(e+8,r+9,4,1,"#2A6898",.4),$(e+20,r+8,6,4,"#F0F0F0"),$(e+15,r+7,3,3,"#ECEFF1"),ft(e+16,r+8,"#795548"),Yl(e+4,r+24,"up"),Yl(e+16,r+24,"up"),Yl(e+28,r+24,"up")}function gN(e,r){$(e+2,r+16,36,3,kl,.15),$(e,r,36,5,"#5D4037"),$(e+1,r+1,34,3,"#6D4C41"),$(e+1,r+1,34,1,tn("#6D4C41",.5),.3),$(e,r+5,36,8,"#5D4037"),$(e+2,r+6,15,6,"#6D4C41"),$(e+3,r+6,13,1,tn("#6D4C41",.5),.35),$(e+19,r+6,15,6,"#6D4C41"),$(e+20,r+6,13,1,tn("#6D4C41",.5),.35),$(e+17,r+6,2,6,"#5D4037"),$(e,r+13,36,3,la("#5D4037",1)),$(e-2,r+2,3,12,"#5D4037"),$(e+35,r+2,3,12,"#5D4037"),$(e+4,r+7,6,4,"#FF8A65"),$(e+5,r+7,4,1,tn("#FF8A65",1),.35)}function bN(e,r){$(e+2,r+10,22,2,kl,.12),$(e,r,22,8,ra.deep),$(e+1,r+1,20,6,ra.base),$(e+1,r+1,20,1,ra.hi,.3),$(e,r+8,22,2,ra.sh),$(e+3,r+2,6,4,"#F0F0F0"),$(e+13,r+3,3,3,"#ECEFF1"),ft(e+14,r+4,"#795548")}function vN(e,r){$(e+1,r+14,10,2,kl,.12),$(e,r,10,14,"#546E7A"),$(e,r,10,1,tn("#546E7A",1),.35),$(e+1,r+1,8,3,"#78909C"),$(e+1,r+5,8,4,"#37474F"),ft(e+2,r+6,"#EF5350"),ft(e+4,r+6,"#66BB6A"),$(e+2,r+11,4,2,"#ECEFF1")}function wN(e,r){$(e+2,r+16,26,3,kl,.18),$(e,r,26,10,jn.deep),$(e+1,r+1,24,8,jn.base),$(e+1,r+2,24,1,jn.hi,.2),$(e+1,r+4,24,1,la(jn.base,.2),.1),$(e+1,r+6,24,1,jn.hi,.15),$(e+1,r+1,24,1,jn.hi,.4),$(e+1,r+1,1,8,jn.hi,.2),$(e,r+10,26,5,jn.deep),$(e+1,r+11,24,3,jn.sh),$(e+1,r+10,24,1,la(jn.base,1.5),.4),$(e+1,r+14,24,1,jn.base,.15),$(e+2,r+12,10,1,jn.deep,.4),$(e+14,r+12,10,1,jn.deep,.4),ft(e+7,r+11,"#C8D0D8",.6),ft(e+19,r+11,"#C8D0D8",.6),$(e+6,r-5,14,7,"#1E1E28"),$(e+7,r-4,12,5,"#0C1420"),$(e+8,r-3,5,1,"#2A6898",.6),$(e+8,r-2,8,1,"#1A3858",.4),$(e+8,r-1,3,1,"#2A6898",.35),ft(e+7,r-4,"#4A98D8",.25),ft(e+12,r+1,"#4CAF50",.4),$(e+12,r+2,2,3,"#586878"),$(e+10,r+4,6,1,"#8898A8"),$(e+6,r+4,12,4,"#222228"),$(e+6,r+4,12,1,"#333338",.4);for(let a=0;a<5;a++)ft(e+7+a*2,r+5,"#444",.6),ft(e+7+a*2,r+6,"#3A3A3E",.4);$(e+20,r+5,3,4,"#333338"),$(e+20,r+5,3,1,"#444448"),$(e+1,r+3,4,4,"#F0EDE8"),$(e+1,r+3,4,1,"#F8F6F2"),ft(e+2,r+5,"#6D4C41")}function Yl(e,r,a){$(e+1,r+9,10,2,kl,.1),ft(e+5,r+9,"#1E1E22"),ft(e+1,r+10,"#1A1A1E"),ft(e+9,r+10,"#1A1A1E"),ft(e+3,r+11,"#1A1A1E"),ft(e+7,r+11,"#1A1A1E"),$(e+1,r+2,8,6,ea.base),$(e+2,r+3,6,4,ea.hi,.35),$(e+2,r+3,6,1,tn(ea.hi,.5),.25),$(e+1,r+7,8,1,ea.deep),a==="up"?($(e,r+7,10,3,ea.deep),$(e+1,r+8,8,1,ea.sh)):($(e,r-1,10,3,ea.deep),$(e+1,r,8,1,ea.sh)),$(e,r+3,1,4,ea.sh),$(e+9,r+3,1,4,ea.sh)}const ob={bookshelf:(e,r,a)=>xN(e,r,a.accent),plant:(e,r)=>pN(e,r),"meeting-table":(e,r)=>yN(e,r),sofa:(e,r)=>gN(e,r),"coffee-table":(e,r)=>bN(e,r),"coffee-machine":(e,r)=>vN(e,r),window:(e,r,a)=>oN(e,r,a.windowW??16,a.windowH??14),picture:(e,r,a)=>cN(e,r,a.pictureColor??"#1565C0"),clock:(e,r)=>uN(e,r),whiteboard:(e,r)=>dN(e,r),"bulletin-board":(e,r)=>fN(e,r),shelf:(e,r)=>hN(e,r),screen:(e,r)=>mN(e,r)};function Xi(e,r){const a=e.zone==="wall"?r.wx:r.fx,i=e.zone==="wall"?r.wy:r.fy;return{x:e.anchorX==="right"?(e.zone==="wall"?r.wx+r.ww:r.fx+r.fw)+e.offsetX:a+e.offsetX,y:i+e.offsetY}}function kN(e){for(const r of e.wallDecorations){const a=e.rooms[r.room];if(!a)continue;const{x:i,y:c}=Xi(r,a),u=ob[r.type];u&&u(i,c,r)}}function jN(e,r,a){for(const i of e.furniture){const c=e.rooms[i.room];if(!c||i.condition==="no-desks"&&a.has(i.room))continue;const{x:u,y:d}=Xi(i,c),m=ob[i.type];m&&r.push({y:d,draw:()=>m(u,d,i)})}}function ml(e){const r=[],a=[...e.wallDecorations,...e.furniture];for(const i of a){if(!i.facility)continue;const c=e.rooms[i.room];if(!c)continue;const{x:u,y:d}=Xi(i,c);r.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 r}const SN={bookshelf:{w:22,h:20},plant:{w:10,h:12},"meeting-table":{w:36,h:28},sofa:{w:38,h:16},"coffee-table":{w:22,h:10},"coffee-machine":{w:10,h:14},window:{w:16,h:14},picture:{w:10,h:8},clock:{w:7,h:7},whiteboard:{w:26,h:16},"bulletin-board":{w:22,h:16},shelf:{w:20,h:8},screen:{w:16,h:12}};function Eh(e){return SN[e]??{w:16,h:16}}function th(e,r,a,i){for(let c=e.furniture.length-1;c>=0;c--){const u=e.furniture[c],d=e.rooms[u.room];if(!d||u.condition==="no-desks"&&i.has(u.room))continue;const{x:m,y:x}=Xi(u,d),f=Eh(u.type);if(r>=m&&r<=m+f.w&&a>=x&&a<=x+f.h)return u.id}for(let c=e.wallDecorations.length-1;c>=0;c--){const u=e.wallDecorations[c],d=e.rooms[u.room];if(!d)continue;const{x:m,y:x}=Xi(u,d),f=Eh(u.type);if(r>=m&&r<=m+f.w&&a>=x&&a<=x+f.h)return u.id}return null}function oy(e,r,a,i,c){const d=[...r.wallDecorations,...r.furniture].find(g=>g.id===a);if(!d||d.condition==="no-desks"&&c.has(d.room))return;const m=r.rooms[d.room];if(!m)return;const{x,y:f}=Xi(d,m),y=Eh(d.type);e.save(),e.fillStyle=i,e.globalAlpha=.2,e.fillRect(x-1,f-1,y.w+2,y.h+2),e.globalAlpha=.9,e.strokeStyle=i,e.lineWidth=1,e.strokeRect(x-.5,f-.5,y.w+1,y.h+1),e.restore()}function cy(e,r,a,i){e.save(),e.fillStyle=i,e.globalAlpha=.2,e.fillRect(r-1,a-1,28,42),e.globalAlpha=.9,e.strokeStyle=i,e.lineWidth=1,e.strokeRect(r-.5,a-.5,27,41),e.restore()}function uy(e,r,a){for(const[i,c]of Object.entries(e))if(r>=c.dx&&r<=c.dx+26&&a>=c.dy&&a<=c.dy+40)return i;return null}const CN=[{type:"plant",zone:"floor",label:"Plant",icon:"🪴"},{type:"bookshelf",zone:"floor",label:"Bookshelf",icon:"📚"},{type:"sofa",zone:"floor",label:"Sofa",icon:"🛋️"},{type:"coffee-table",zone:"floor",label:"Coffee Table",icon:"☕"},{type:"coffee-machine",zone:"floor",label:"Coffee Machine",icon:"☕"},{type:"meeting-table",zone:"floor",label:"Meeting Table",icon:"🪑"},{type:"window",zone:"wall",label:"Window",icon:"🪟"},{type:"picture",zone:"wall",label:"Picture",icon:"🖼️"},{type:"clock",zone:"wall",label:"Clock",icon:"🕐"},{type:"whiteboard",zone:"wall",label:"Whiteboard",icon:"📋"},{type:"shelf",zone:"wall",label:"Shelf",icon:"📦"},{type:"screen",zone:"wall",label:"Screen",icon:"🖥️"}],Uc=16,EN=4,ql=4,Wc=2,At=4,pl=4;let Oe=lb(7);const iu={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};let $r=ml(Oe);function cb(e){return{x:e.dx,y:e.dy,w:e.pw,h:e.ph}}function ub(e){return{cx:e.dx+e.pw/2,botY:e.dy+e.ph}}let an={};function NN(e){const r={};for(let a=0;a<e.length&&a<Oe.desks.length;a++)r[e[a]]=Oe.desks[a];return r}let Lt,Gl=null,Xl=null,za=!1,Lr=null,yr=null,Un=null,kn=null,$i=null,ta=null;function AN(e,r){const{wx:a,wy:i,ww:c,wh:u,wallColor:d,baseboardColor:m}=e,x=la(d,.5),f=tn(d,.5),y=[];if(r){const g=r.x-a,b=r.w;g>0&&y.push({sx:a,sw:g}),g+b<c&&y.push({sx:r.x+b,sw:c-g-b})}else y.push({sx:a,sw:c});for(const g of y){$(g.sx,i,g.sw,u,d);for(let b=0;b<u;b+=4)$(g.sx,i+b,g.sw,1,f,.08),$(g.sx,i+b+2,g.sw,1,x,.05);Qi(Math.round(g.sx*7+i*13));for(let b=0;b<g.sw;b+=3)aa()>.4&&$(g.sx+b,i,1,u,f,.04);$(g.sx,i,g.sw,2,f,.3),$(g.sx,i,g.sw,1,tn(d,1),.2),$(g.sx,i+u-2,g.sw,2,x,.3),$(g.sx,i+u,g.sw,Wc,m),$(g.sx,i+u,g.sw,1,tn(m,.5),.4)}r&&($(r.x-1,i,1,u+Wc,"#4A3828"),$(r.x+r.w,i,1,u+Wc,"#4A3828"),$(r.x,i,r.w,1,"#0A0808",.12)),$(e.fx,e.fy,e.fw,3,"#0A0808",.12),$(e.fx,e.fy+3,e.fw,2,"#0A0808",.06)}function TN(e){const r="#504038",a=la(r,.5),i=tn(r,.5),c=e.wx-pl,u=e.wy,d=e.wh+Wc+e.fh;$(c,u,pl,d,r),$(c,u,1,d,i,.3),$(c+pl-1,u,1,d,a,.4);for(let x=0;x<d;x+=6)$(c+1,u+x,pl-2,1,i,.06);const m=e.wx+e.ww;$(m,u,pl,d,r),$(m,u,1,d,i,.2),$(m+pl-1,u,1,d,a,.3)}function nh(e){const{fx:r,fy:a,fw:i,fh:c}=e,u="#B08040",d="#C89848",m="#8A6030",x="#6A4820";$(r,a,i,c,u),Qi(42);for(let f=0;f<c;f+=5){const y=Math.floor(f/5)%2*10;for(let g=-10;g<i+10;g+=20){const b=r+g+y,v=Math.max(r,b),S=Math.min(b+19,r+i)-v;if(S<=0)continue;const j=aa()>.5?d:u;$(v,a+f,S,4,j,.25),$(v,a+f,S,1,d,.3),$(v,a+f+4,S,1,x,.35),b>=r&&b<r+i&&$(b,a+f,1,4,x,.2),$(v,a+f+2,S,1,m,.1)}}$(r,a,i,2,"#0A0808",.08),$(r,a,2,c,"#0A0808",.06)}function dy(e){const{fx:r,fy:a,fw:i,fh:c}=e,u="#1C2A38",d="#101820";Qi(99),$(r,a,i,c,u);for(let m=0;m<c;m+=Uc)for(let x=0;x<i;x+=Uc){const f=Math.min(Uc,i-x),y=Math.min(Uc,c-m);aa()>.5&&$(r+x,a+m,f,y,tn(u,.2),.15),$(r+x+2,a+m+2,f-4,y-4,tn(u,.3),.08),$(r+x,a+m,f,1,d,.5),$(r+x,a+m,1,y,d,.5),$(r+x+1,a+m+1,1,y-1,tn(u,.4),.1),aa()>.85&&ft(r+x+4+Math.floor(aa()*8),a+m+4+Math.floor(aa()*8),"#3A6A9A",.08)}}function DN(e){const{fx:r,fy:a,fw:i,fh:c}=e,u="#387848",d="#4A9058",m="#285E38";$(r,a,i,c,u),Qi(77);for(let f=0;f<c;f+=2)for(let y=0;y<i;y+=2)aa()>.5&&ft(r+y,a+f,d,.1),aa()>.8&&ft(r+y+1,a+f+1,m,.12);const x=5;$(r+x,a+x,i-x*2,1,d,.45),$(r+x,a+c-x-1,i-x*2,1,m,.45),$(r+x,a+x,1,c-x*2,d,.35),$(r+i-x-1,a+x,1,c-x*2,m,.35)}function zN(e){const{fx:r,fy:a,fw:i,fh:c}=e,u="#D8C490",d="#B09060",m="#907848";Qi(55);for(let x=0;x<c;x+=8)for(let f=0;f<i;f+=8){const y=Math.min(8,i-f),g=Math.min(8,c-x),b=(f/8+x/8)%2===0?d:u;$(r+f,a+x,y,g,b),$(r+f+1,a+x+1,y-2,1,tn(b,.4),.2),$(r+f+1,a+x+1,1,g-2,tn(b,.4),.15),$(r+f+y-2,a+x+2,1,g-3,la(b,.4),.15),$(r+f+2,a+x+g-2,y-3,1,la(b,.4),.15),$(r+f,a+x,y,1,m,.3),$(r+f,a+x,1,g,m,.3)}}function RN(){const{canvasW:e,canvasH:r,rooms:a,doors:i}=Oe,c="#2A1E14",u="#3A2E24";if($(0,0,e,ql,c),$(0,r-ql,e,ql,c),$(0,0,ql,r,c),$(e-ql,0,ql,r,c),$(0,0,e,1,u,.3),$(0,0,1,r,u,.2),!a.exec||!a.work||!a.meet||!a.comm)return;const d=a.exec,m=a.meet,x=e/2,f=x-At/2,y=d.fy+d.fh,g=i.exec_work,b=i.meet_comm,v=i.exec_meet,S=i.work_comm,j=24,C=28,E=((g==null?void 0:g.doorY)??d.fy+20)-j/2,N=((v==null?void 0:v.doorX)??ql+pl+54)-C/2,_=((S==null?void 0:S.doorX)??x+At/2+pl+54)-C/2,B=((b==null?void 0:b.doorY)??m.fy+20)-j/2;$(0,y,N,At,c),$(N+C,y,f-N-C,At,c),$(f+At,y,_-f-At,At,c),$(_+C,y,e-_-C,At,c),$(0,y,N,1,u,.3),$(N+C,y,f-N-C,1,u,.3),$(f+At,y,_-f-At,1,u,.3),$(_+C,y,e-_-C,1,u,.3),$(f,0,At,E,c),$(f,E+j,At,y-E-j,c),$(f,y+At,At,B-y-At,c),$(f,B+j,At,r-B-j,c),$(f,0,1,E,u,.2),$(f,E+j,1,y-E-j,u,.2),$(f,y+At,1,B-y-At,u,.2),$(f,B+j,1,r-B-j,u,.2),$(f,E,At,j,"#C4A070"),$(f+At/2,E,At/2,j,"#3A4858"),$(f,B,At,j,"#7AA880"),$(f+At/2,B,At/2,j,"#C8B890");const I="#4A3828";$(f,E-1,At,1,I),$(f,E+j,At,1,I),$(N-1,y,1,At,I),$(N+C,y,1,At,I),$(_-1,y,1,At,I),$(_+C,y,1,At,I),$(f,B-1,At,1,I),$(f,B+j,At,1,I)}const fy=new Map;function MN(e){const r=`${e.hairStyle??""}|${e.outfitStyle??""}|${e.accessory??""}`;let a=fy.get(r);if(!a){const i=gh("mini-seated:default"),c=Fg(i,e);a=c?c.layers.flatMap(u=>u.pixels):[],fy.set(r,a)}return a}function FN(e,r,a){Ui(Lt,MN(a),e,r,a)}function _N(e,r,a,i,c){Yl(e+8,r+20,"up"),c||FN(e+8,r+0+i,a),wN(e,r+14)}function ON(e,r,a,i,c){const u=i in ty?i:"down",d=c%4,m=ty[u][d];Ui(Lt,m,e,r,a);const x=d===1||d===3?-1:0;if(a.accessory&&a.accessory!=="none"){const f=eS(a.accessory,u);f&&f.pixels.length>0&&Ui(Lt,f.pixels,e,r+x,a)}Lt.globalAlpha=1}function BN(){const e=Object.keys(Oe.rooms),r=e[Math.floor(Math.random()*e.length)],a=Oe.rooms[r];return{x:a.fx+a.fw/2,y:a.fy+a.fh/2,dir:"down",walkFrame:0,walkTimer:0,path:[],room:r,state:"walking",stateTimer:0,tongueTimer:0}}function $N(e){if(e.stateTimer--,e.state==="idle"){if(e.tongueTimer++,e.stateTimer<=0){e.state="walking",e.tongueTimer=0;const r=Object.keys(Oe.rooms);if(Math.random()<.35&&r.length>1){const a=r.filter(d=>d!==e.room),i=a[Math.floor(Math.random()*a.length)],c=am(e,i),u=Oe.waypoints[i];if(u&&u.length>0){const d=u[Math.floor(Math.random()*u.length)],m=c[c.length-1]??{x:e.x,y:e.y},x=Wl(m.x,m.y,d.x,d.y,i);e.path=[...c,...x]}else e.path=c}else{const a=Oe.waypoints[e.room];if(a&&a.length>0){const i=a[Math.floor(Math.random()*a.length)];e.path=Wl(e.x,e.y,i.x,i.y,e.room)}}e.walkTimer=0}}else if(e.state==="walking"){if(e.path.length===0){e.state="idle",e.dir="down",e.stateTimer=120+Math.floor(Math.random()*240);return}const r=e.path[0],a=r.x-e.x,i=r.y-e.y,c=Math.sqrt(a*a+i*i);if(c<1.5){e.x=r.x,e.y=r.y,e.path.shift();for(const[u,d]of Object.entries(Oe.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/c*.15,e.y+=i/c*.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 LN(e){const r=e.state==="walking"?e.walkFrame:0,a=JE[e.dir][r],i=Math.round(e.x),c=Math.round(e.y),u=e.dir==="left"||e.dir==="right";Ui(Lt,u?nN:tN,i,c),Ui(Lt,a,i,c),e.state==="idle"&&e.dir==="down"&&e.tongueTimer%80<50&&Ui(Lt,eN,i,c)}function HN(e){const r={};let a=0;for(const i of e){const c=an[i];c&&(r[i]={state:"sitting",homeX:c.dx+8,homeY:c.dy+34,homeRoom:c.room,x:c.dx+8,y:c.dy+34,path:[],room:c.room,dir:"down",walkFrame:0,walkTimer:0,bobY:0,bobOff:a*17,stateTimer:600+Math.floor(Math.random()*900)},a++)}return r}function Wl(e,r,a,i,c){const u=Oe.corridorY[c]??r,d=[];return r<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 rh(e,r,a,i){const c=Oe.adjacency[a];if(!c)return[];const u=c.find(y=>y.room===i);if(!u)return[];const d=Oe.doors[u.door];if(!d)return[];const m=[],x=Oe.corridorY[a]??r,f=Oe.corridorY[i]??r;if(Math.abs(r-x)>4&&m.push({x:e,y:x}),d.type==="v"){const y=u.side==="A"?d.xA:d.xB,g=u.side==="A"?d.xB:d.xA;m.push({x:y,y:x}),m.push({x:y,y:d.doorY}),m.push({x:g,y:d.doorY}),m.push({x:g,y:f})}else{const y=u.side==="A"?d.yA:d.yB,g=u.side==="A"?d.yB:d.yA;m.push({x:d.doorX,y:x}),m.push({x:d.doorX,y}),m.push({x:d.doorX,y:g}),m.push({x:d.doorX,y:f})}return m}function am(e,r){const a=Oe.adjacency[e.room];if(!a)return[];if(!a.find(c=>c.room===r)){for(const c of a){const u=Oe.adjacency[c.room];if(u!=null&&u.find(d=>d.room===r)){const d=rh(e.x,e.y,e.room,c.room),m=d[d.length-1],x=rh((m==null?void 0:m.x)??e.x,(m==null?void 0:m.y)??e.y,c.room,r);return[...d,...x]}}return[]}return rh(e.x,e.y,e.room,r)}function IN(e){if(e.room!==e.homeRoom){const r=am({...e},e.homeRoom),a=r[r.length-1],i=Wl((a==null?void 0:a.x)??e.x,(a==null?void 0:a.y)??e.y,e.homeX,e.homeY,e.homeRoom);return[...r,...i]}return Wl(e.x,e.y,e.homeX,e.homeY,e.room)}function UN(e,r){for(const[,a]of Object.entries(e))if(a.stateTimer--,a.state==="sitting"){if(a.bobY=(r+a.bobOff)%60<30?1:0,a.stateTimer<=0){a.state="walking",a.x=a.homeX,a.y=a.homeY,a.room=a.homeRoom;const i=Object.keys(Oe.rooms);if(Math.random()<.25&&i.length>1){const c=i.filter(x=>x!==a.room),u=c[Math.floor(Math.random()*c.length)],d=am(a,u),m=Oe.waypoints[u];if(m&&m.length>0){const x=m[Math.floor(Math.random()*m.length)],f=d[d.length-1]??{x:a.x,y:a.y},y=Wl(f.x,f.y,x.x,x.y,u);a.path=[...d,...y]}else a.path=d;a.walkTimer=0}else{const c=Oe.waypoints[a.room];if(c&&c.length>0){const u=c[Math.floor(Math.random()*c.length)];a.path=Wl(a.x,a.y,u.x,u.y,a.room)}a.walkTimer=0}}}else if(a.state==="walking"||a.state==="returning"){if(a.path.length===0){a.state==="returning"?(a.state="sitting",a.room=a.homeRoom,a.stateTimer=800+Math.floor(Math.random()*1200)):(a.state="idle",a.dir="down",a.stateTimer=180+Math.floor(Math.random()*360));continue}const i=a.path[0],c=i.x-a.x,u=i.y-a.y,d=Math.sqrt(c*c+u*u);if(d<1.5){a.x=i.x,a.y=i.y,a.path.shift();for(const[m,x]of Object.entries(Oe.rooms))if(a.x>=x.fx&&a.x<=x.fx+x.fw&&a.y>=x.fy&&a.y<=x.fy+x.fh){a.room=m;break}}else a.x+=c/d*.2,a.y+=u/d*.2,Math.abs(c)>Math.abs(u)?a.dir=c>0?"right":"left":a.dir=u>0?"down":"up",a.walkTimer++,a.walkFrame=Math.floor(a.walkTimer/12)%4}else if(a.state==="idle"&&a.stateTimer<=0)if(Math.random()<.3){a.state="walking";const i=Oe.waypoints[a.room];if(i&&i.length>0){const c=i[Math.floor(Math.random()*i.length)];a.path=Wl(a.x,a.y,c.x,c.y,a.room)}a.walkTimer=0}else a.state="returning",a.path=IN(a),a.walkTimer=0}function qN(e,r,a,i){const{canvasW:c,canvasH:u,rooms:d}=Oe;Lt.clearRect(0,0,c,u),$(0,0,c,u,"#2A1E14");const m={wood:nh,dark:dy,carpet:DN,tile:zN};for(const b of Object.values(d))(m[b.floorType]??nh)(b);const x=Object.keys(d);if(x.length>=4){const b=d.exec,v=d.meet,{doors:S}=Oe;if(b&&v&&S.exec_meet&&S.work_comm){const C=(S.exec_meet.doorX??0)-14,E=(S.work_comm.doorX??0)-28/2,N=b.fy+b.fh,_=v.fy;nh({fx:C,fy:N,fw:28,fh:_-N}),dy({fx:E,fy:N,fw:28,fh:_-N})}}const f={};if(x.length>=4){const{doors:b}=Oe,v=28,S=b.exec_meet,j=b.work_comm;S!=null&&S.doorX&&(f.meet={x:S.doorX-v/2,w:v}),j!=null&&j.doorX&&(f.comm={x:j.doorX-v/2,w:v})}for(const b of Object.values(d))AN(b,f[b.id]),TN(b);RN(),kN(Oe);const y=[],g=new Set(Object.values(an).map(b=>b.room));jN(Oe,y,g);for(const[b,v]of Object.entries(an)){const S=e[b];if(!S)continue;const j=S.state==="sitting",C=r(b),E=a[b]==="working";y.push({y:v.dy+14,draw:()=>{if(_N(v.dx,v.dy,C,j?S.bobY:0,!j),j&&E){const N=iu[b]??"#388bfd";$(v.dx+7,v.dy+14-4,12,5,N,.15),ft(v.dx+12,v.dy+14+1,"#4CAF50",.8)}}})}for(const[b,v]of Object.entries(e))if(v.state!=="sitting"){const S=r(b);y.push({y:v.y+14,draw:()=>ON(Math.round(v.x),Math.round(v.y),S,v.dir,v.walkFrame)})}i&&y.push({y:i.y+10,draw:()=>LN(i)}),y.sort((b,v)=>b.y-v.y);for(const b of y)b.draw();for(const b of $r){const v=Xl===b.id,S=ub(b);if(Lt.save(),Lt.globalAlpha=v?.9:.5,Lt.fillStyle=b.color,Lt.fillRect(S.cx-1,S.botY-2,3,3),v){const j=cb(b);Lt.globalAlpha=.3,Lt.strokeStyle=b.color,Lt.lineWidth=1,Lt.strokeRect(j.x-1,j.y-1,j.w+2,j.h+2)}Lt.restore()}if(za){const b=new Set(Object.values(an).map(v=>v.room));if(Lr&&Lr!==yr)if(Lr.startsWith("desk:")){const v=Lr.slice(5),S=an[v];S&&cy(Lt,S.dx,S.dy,"#FBBF24")}else oy(Lt,Oe,Lr,"#FBBF24",b);if(yr)if(yr.startsWith("desk:")){const v=yr.slice(5),S=an[v];S&&cy(Lt,S.dx,S.dy,"#3B82F6")}else oy(Lt,Oe,yr,"#3B82F6",b)}if(Gl){const b=an[Gl],v=e[Gl];b&&v&&(Lt.save(),Lt.globalAlpha=.25,Lt.fillStyle=iu[Gl]??"#fff",v.state==="sitting"?Lt.fillRect(b.dx-1,b.dy+6,28,30):Lt.fillRect(Math.round(v.x)-1,Math.round(v.y)-1,14,24),Lt.restore())}}function YN({roles:e,projects:r,roleStatuses:a,activeExecs:i,onRoleClick:c,onProjectClick:u,onBulletinClick:d,onDecisionsClick:m,onKnowledgeClick:x,onSettingsClick:f,onThemeClick:y,onStatsClick:g,getRoleSpeech:b,getAppearance:v,onHireClick:S,onMascotClick:j,roleLevels:C}){const E=w.useRef(null),N=w.useRef(null),_=w.useRef(null),B=w.useRef({}),I=w.useRef(null),F=w.useRef(0),X=w.useRef(EN),[W,U]=w.useState(!1),[M,G]=w.useState(null),[O,V]=w.useState(null),J=w.useRef({}),Q=w.useRef({}),H=w.useRef([]),Y=w.useRef([]);w.useEffect(()=>{za=W},[W]),w.useEffect(()=>{$i=M,ta=O},[M,O]),w.useEffect(()=>{Se.getPreferences().then(pe=>{const he=pe.furnitureOverrides;he&&Object.keys(he).length>0&&(J.current=he,Oe=ly(Oe,he));const ke=pe.deskOverrides;if(ke&&Object.keys(ke).length>0){Q.current=ke,iy(an,ke);for(const[Re,Ne]of Object.entries(an)){const ze=B.current[Re];ze&&(ze.homeX=Ne.dx+8,ze.homeY=Ne.dy+34)}}const Ae=pe.removedFurniture;Ae&&Ae.length>0&&(H.current=Ae,Oe=eh(Oe,Ae));const Fe=pe.addedFurniture;Fe&&Fe.length>0&&(Y.current=Fe,Oe=sy(Oe,Fe)),$r=ml(Oe)}).catch(()=>{})},[]);const ne=w.useRef({roleStatuses:a,activeExecs:i,getRoleSpeech:b,getAppearance:v});ne.current={roleStatuses:a,activeExecs:i,getRoleSpeech:b,getAppearance:v};const we=w.useMemo(()=>e.map(pe=>pe.id),[e]),T=w.useRef(Oe);w.useEffect(()=>{const pe=we.length,he=ab(pe,T.current.preset);let ke=lb(pe,he);H.current.length>0&&(ke=eh(ke,H.current)),Y.current.length>0&&(ke=sy(ke,Y.current)),Object.keys(J.current).length>0&&(ke=ly(ke,J.current)),Oe=ke,T.current=ke,an=NN(we),Object.keys(Q.current).length>0&&iy(an,Q.current),$r=ml(ke),B.current=HN(we),I.current=BN();const Ae=E.current;Ae&&(Ae.width=ke.canvasW,Ae.height=ke.canvasH),Z()},[we]);const z=w.useCallback(pe=>{var he,ke;return((ke=(he=ne.current).getAppearance)==null?void 0:ke.call(he,pe))??tm(pe)},[]),Z=w.useCallback(()=>{const pe=N.current,he=E.current;if(!pe||!he)return;const ke=pe.parentElement;if(!ke)return;const Ae=ke.clientWidth,Fe=ke.clientHeight;if(Ae===0||Fe===0)return;const{canvasW:Re,canvasH:Ne}=Oe;let ze=Math.floor(Math.min(Ae/Re,Fe/Ne));ze=Math.max(2,Math.min(ze,5)),X.current=ze,he.style.width=Re*ze+"px",he.style.height=Ne*ze+"px",pe.style.width=Re*ze+"px",pe.style.height=Ne*ze+"px"},[]);w.useEffect(()=>{var Ne;const pe=E.current;if(!pe)return;const he=pe.getContext("2d");if(!he)return;Lt=he,sN(he),Z();const ke=new ResizeObserver(()=>Z()),Ae=(Ne=N.current)==null?void 0:Ne.parentElement;Ae&&ke.observe(Ae);let Fe;const Re=()=>{F.current++,UN(B.current,F.current),I.current&&$N(I.current),qN(B.current,z,ne.current.roleStatuses,I.current),D(),Fe=requestAnimationFrame(Re)};return Fe=requestAnimationFrame(Re),()=>{cancelAnimationFrame(Fe),ke.disconnect()}},[z,Z]),w.useEffect(()=>{var Re;const pe=_.current;if(!pe)return;pe.innerHTML="";const he={};for(const Ne of e)he[Ne.id]=Ne.name;for(const Ne of we){const ze=iu[Ne]??"#8b949e",Pe=he[Ne],_e=Pe&&Pe.toLowerCase()!==Ne.toLowerCase()?`${Ne.toUpperCase()} · ${Pe}`:Ne.toUpperCase(),et=document.createElement("div");et.className="td-nametag",et.dataset.role=Ne;const re=document.createElement("span");re.className="td-dot",re.style.background=ze,et.appendChild(re),et.appendChild(document.createTextNode(_e));const ye=((Re=C==null?void 0:C[Ne])==null?void 0:Re.level)??1;if(ye>1){const He=document.createElement("span");He.className="td-lvl",He.textContent=`Lv.${ye}`,et.appendChild(He)}pe.appendChild(et);const De=document.createElement("div");De.className="td-bubble",De.dataset.role=Ne,De.dataset.type="bubble",pe.appendChild(De)}const ke={meeting:()=>{const Ne=r[0];Ne?u(Ne.id):d()},bulletin:d,decisions:m,knowledge:x,settings:f,theme:y,stats:g};for(const Ne of $r){const ze=document.createElement("div");ze.className="td-facility-label",ze.dataset.facility=Ne.id,Ne.id==="meeting"&&(ze.dataset.questTarget="meeting-room"),ze.textContent=`${Ne.icon} ${Ne.label}`,ze.style.borderColor=`${Ne.color}44`;const Pe=ke[Ne.id];Pe&&ze.addEventListener("click",Pe),ze.addEventListener("mouseenter",()=>{Xl=Ne.id}),ze.addEventListener("mouseleave",()=>{Xl=null}),pe.appendChild(ze)}const Ae=document.createElement("div");Ae.className="td-nametag td-nametag-mascot",Ae.dataset.role="mascot";const Fe=document.createElement("span");Fe.className="td-dot",Fe.style.background="#ffd700",Ae.appendChild(Fe),Ae.appendChild(document.createTextNode("Pupu")),Ae.addEventListener("click",()=>j==null?void 0:j()),pe.appendChild(Ae)},[we,e,r,u,d,m,x,f,y,g,j,C]);const D=w.useCallback(()=>{var Pe;const pe=_.current;if(!pe)return;const he=X.current,ke=B.current,{getRoleSpeech:Ae,roleStatuses:Fe,activeExecs:Re}=ne.current;for(const _e of Object.keys(ke)){const et=ke[_e],re=an[_e];if(!re)continue;let ye,De,He;et.state==="sitting"?(ye=re.dx+13,He=re.dy+2,De=re.dy+37):(ye=Math.round(et.x)+6,He=Math.round(et.y)-2,De=Math.round(et.y)+18);const de=ye/Oe.canvasW*100,Te=pe.querySelector(`.td-nametag[data-role="${_e}"]`);if(Te){Te.style.left=de+"%",Te.style.top=De*he+2+"px";const it=Te.querySelector(".td-dot");if(it){const rt=Fe[_e]==="working";it.style.background=rt?"#FBBF24":iu[_e]??"#8b949e",rt?it.style.animation="td-pulse 1s ease-in-out infinite":it.style.animation=""}}const wt=pe.querySelector(`.td-bubble[data-role="${_e}"]`);if(wt){const it=Fe[_e]==="working",rt=(Pe=Re.find(bn=>bn.roleId===_e))==null?void 0:Pe.task,yt=Ae(_e),st=it&&rt?rt.slice(0,60):yt?yt.slice(0,60):"";st&&et.state==="sitting"?(wt.style.display="",wt.style.left=de+"%",wt.style.top=(He-10)*he+"px",wt.textContent=st):wt.style.display="none"}}const Ne=pe.querySelector(".td-nametag-mascot"),ze=I.current;if(Ne&&ze){const _e=ze.dir==="left"||ze.dir==="right",et=Math.round(ze.x)+(_e?6:4),re=Math.round(ze.y)+(_e?7:10);Ne.style.left=et/Oe.canvasW*100+"%",Ne.style.top=re*he+2+"px"}for(const _e of $r){const et=pe.querySelector(`.td-facility-label[data-facility="${_e.id}"]`);if(et){const re=ub(_e);et.style.left=re.cx/Oe.canvasW*100+"%",et.style.top=re.botY*he-4+"px",et.classList.toggle("td-facility-label--hover",Xl===_e.id)}}},[]),xe=w.useCallback(pe=>{const he=E.current;if(!he)return null;const ke=he.getBoundingClientRect(),Ae=X.current,Fe=(pe.clientX-ke.left)/Ae,Re=(pe.clientY-ke.top)/Ae,Ne=B.current;for(const[Pe,_e]of Object.entries(an)){if(!Ne[Pe])continue;const et=Ne[Pe];if(et.state==="sitting"){if(Fe>=_e.dx&&Fe<=_e.dx+26&&Re>=_e.dy&&Re<=_e.dy+40)return{type:"role",id:Pe}}else if(Fe>=et.x-2&&Fe<=et.x+14&&Re>=et.y-2&&Re<=et.y+20)return{type:"role",id:Pe}}const ze=I.current;if(ze){const Pe=ze.dir==="left"||ze.dir==="right",_e=Pe?13:9,et=Pe?7:10;if(Fe>=ze.x&&Fe<=ze.x+_e&&Re>=ze.y&&Re<=ze.y+et)return{type:"mascot",id:"mascot"}}for(const Pe of $r){const _e=cb(Pe);if(Fe>=_e.x&&Fe<=_e.x+_e.w&&Re>=_e.y&&Re<=_e.y+_e.h)return{type:"facility",id:Pe.id}}return null},[]),Ce=w.useCallback(pe=>{const he=E.current;if(!he)return{mx:0,my:0};const ke=he.getBoundingClientRect(),Ae=X.current;return{mx:(pe.clientX-ke.left)/Ae,my:(pe.clientY-ke.top)/Ae}},[]),ge=w.useCallback(pe=>{Se.updatePreferences(pe).catch(()=>{})},[]),Me=w.useCallback(pe=>{const he=[...H.current,pe];H.current=he,Oe=eh(Oe,[pe]),$r=ml(Oe),yr=null,Lr=null,ge({removedFurniture:he})},[ge]),Ee=w.useCallback((pe,he)=>{if(!$i||!ta)return;let ke=null;for(const[Pe,_e]of Object.entries(Oe.rooms)){const et=ta==="wall"?_e.wx:_e.fx,re=ta==="wall"?_e.wy:_e.fy,ye=ta==="wall"?_e.ww:_e.fw,De=ta==="wall"?_e.wh:_e.fh;if(pe>=et&&pe<=et+ye&&he>=re&&he<=re+De){ke=Pe;break}}if(!ke)return;const Ae=Oe.rooms[ke],Fe=ta==="wall"?Ae.wx:Ae.fx,Re=ta==="wall"?Ae.wy:Ae.fy,Ne={id:`user-${$i}-${Date.now()}`,type:$i,room:ke,zone:ta,offsetX:Math.round(pe-Fe),offsetY:Math.round(he-Re)},ze=[...Y.current,Ne];Y.current=ze,ta==="wall"?Oe.wallDecorations.push(Ne):Oe.furniture.push(Ne),$r=ml(Oe),ge({addedFurniture:ze}),G(null),V(null)},[ge]),Ie=w.useCallback(pe=>{const he=E.current;if(za&&Un){const{mx:Ae,my:Fe}=Ce(pe),Ne=[...Oe.furniture,...Oe.wallDecorations].find(_e=>_e.id===Un.defId);if(!Ne)return;const ze=Ae-Un.startMx,Pe=Fe-Un.startMy;Ne.offsetX=Math.round(Un.origOffX+ze),Ne.offsetY=Math.round(Un.origOffY+Pe),$r=ml(Oe),he&&(he.style.cursor="grabbing");return}if(za&&kn){const{mx:Ae,my:Fe}=Ce(pe),Re=an[kn.roleId];if(!Re)return;Re.dx=Math.round(kn.origDx+(Ae-kn.startMx)),Re.dy=Math.round(kn.origDy+(Fe-kn.startMy));const Ne=B.current[kn.roleId];Ne&&(Ne.homeX=Re.dx+8,Ne.homeY=Re.dy+34),he&&(he.style.cursor="grabbing");return}if(za){const{mx:Ae,my:Fe}=Ce(pe);if($i){he&&(he.style.cursor="crosshair");return}const Re=new Set(Object.values(an).map(ze=>ze.room)),Ne=th(Oe,Ae,Fe,Re);if(Ne)Lr=Ne;else{const ze=uy(an,Ae,Fe);Lr=ze?`desk:${ze}`:null}Gl=null,Xl=null,he&&(he.style.cursor=Lr?"grab":"default");return}const ke=xe(pe);Gl=(ke==null?void 0:ke.type)==="role"?ke.id:null,Xl=(ke==null?void 0:ke.type)==="facility"?ke.id:null,Lr=null,he&&(he.style.cursor=ke?"pointer":"default")},[xe,Ce]),oe=w.useCallback(pe=>{if(!za)return;const{mx:he,my:ke}=Ce(pe);if($i){Ee(he,ke),pe.preventDefault();return}const Ae=new Set(Object.values(an).map(Ne=>Ne.room)),Fe=th(Oe,he,ke,Ae);if(Fe){const ze=[...Oe.furniture,...Oe.wallDecorations].find(Pe=>Pe.id===Fe);ze&&(yr=Fe,Un={defId:Fe,startMx:he,startMy:ke,origOffX:ze.offsetX,origOffY:ze.offsetY},pe.preventDefault());return}const Re=uy(an,he,ke);if(Re){const Ne=an[Re];yr=`desk:${Re}`,kn={roleId:Re,startMx:he,startMy:ke,origDx:Ne.dx,origDy:Ne.dy},pe.preventDefault();return}yr=null},[Ce,Ee]),at=w.useCallback(pe=>{if(Un){const ke=[...Oe.furniture,...Oe.wallDecorations].find(Ae=>Ae.id===Un.defId);if(ke){const Ae={...J.current,[ke.id]:{offsetX:ke.offsetX,offsetY:ke.offsetY}};J.current=Ae,ge({furnitureOverrides:Ae}),$r=ml(Oe)}Un=null,E.current&&(E.current.style.cursor="grab");return}if(kn){const he=an[kn.roleId];if(he){const ke={...Q.current,[kn.roleId]:{dx:he.dx,dy:he.dy}};Q.current=ke,ge({deskOverrides:ke})}kn=null,E.current&&(E.current.style.cursor="grab")}},[ge]),Ct=w.useCallback(pe=>{if(!za)return;pe.preventDefault();const{mx:he,my:ke}=Ce(pe),Ae=new Set(Object.values(an).map(Re=>Re.room)),Fe=th(Oe,he,ke,Ae);Fe&&Me(Fe)},[Ce,Me]);w.useEffect(()=>{const pe=he=>{!za||!yr||(he.key==="Delete"||he.key==="Backspace")&&(yr.startsWith("desk:")||Me(yr))};return window.addEventListener("keydown",pe),()=>window.removeEventListener("keydown",pe)},[Me]);const jt=w.useCallback(()=>{if(Un){const he=[...Oe.furniture,...Oe.wallDecorations].find(ke=>ke.id===Un.defId);he&&(he.offsetX=Un.origOffX,he.offsetY=Un.origOffY,$r=ml(Oe)),Un=null}if(kn){const pe=an[kn.roleId];pe&&(pe.dx=kn.origDx,pe.dy=kn.origDy);const he=B.current[kn.roleId];he&&(he.homeX=pe.dx+8,he.homeY=pe.dy+34),kn=null}Gl=null,Xl=null,Lr=null,E.current&&(E.current.style.cursor="default")},[]),Vt=w.useCallback(pe=>{if(za)return;const he=xe(pe);if(he){if(he.type==="role"){c(he.id);return}if(he.type==="mascot"){j==null||j();return}switch(he.id){case"meeting":{const ke=r[0];ke?u(ke.id):d();break}case"bulletin":d();break;case"decisions":m();break;case"knowledge":x();break;case"settings":f==null||f();break;case"theme":y==null||y();break;case"stats":g==null||g();break}}},[xe,c,u,d,m,x,f,y,g]);return s.jsxs("div",{className:`td-scene${W?" td-scene--editing":""}`,children:[s.jsxs("div",{ref:N,className:"td-wrap",children:[s.jsx("canvas",{ref:E,width:Oe.canvasW,height:Oe.canvasH,className:"td-canvas",onClick:Vt,onMouseDown:oe,onMouseUp:at,onMouseMove:Ie,onMouseLeave:jt,onContextMenu:Ct}),s.jsx("div",{ref:_,className:"td-overlay"})]}),W&&s.jsxs("div",{className:"td-edit-banner",children:[s.jsx("span",{className:"td-edit-banner__icon",children:"✎"})," EDIT MODE — Click DONE when finished"]}),s.jsxs("button",{className:`td-edit-btn${W?" td-edit-btn--active":""}`,onClick:()=>{U(pe=>{const he=!pe;return he||(G(null),V(null)),he}),yr=null,Un=null,kn=null},title:W?"Exit Edit Mode":"Edit Furniture Layout",children:[s.jsx("span",{className:"td-edit-btn__icon",children:W?"✓":"✎"}),s.jsx("span",{className:"td-edit-btn__label",children:W?"DONE":"EDIT"})]}),W&&s.jsx("div",{className:"td-palette",children:CN.map(pe=>s.jsx("button",{className:`td-palette__item${M===pe.type?" td-palette__item--active":""}`,onClick:()=>{M===pe.type?(G(null),V(null)):(G(pe.type),V(pe.zone))},title:pe.label,children:s.jsx("span",{children:pe.icon})},pe.type))}),S&&s.jsxs("button",{className:"td-hire-btn","data-quest-target":"hire-btn",onClick:S,title:"Hire New Role",children:[s.jsx("span",{className:"td-hire-btn__icon",children:"+"}),s.jsx("span",{className:"td-hire-btn__label",children:"HIRE"})]})]})}function XN({role:e,appearance:r,onSave:a,onReset:i,onClose:c,theme:u,onThemeChange:d,onUpdateName:m,initialTab:x,characterOnly:f,speechSettings:y,onSpeechSettingsChange:g,language:b,onLanguageChange:v,roleLevel:S}){var G;const[j,C]=w.useState(x??"character"),[E,N]=w.useState({...r}),[_,B]=w.useState(e.name),[I,F]=w.useState(!1),X=w.useCallback(()=>N(Hi(S)),[S]),W=w.useCallback(()=>{const O=tm(e.id);N({...O}),i()},[e.id,i]),U=w.useCallback(async()=>{a(E);const O=_.trim();if(m&&O&&O!==e.name){F(!0);try{await m(e.id,O)}catch{}F(!1)}c()},[E,a,c,_,e.name,e.id,m]),M=s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsxs("span",{children:[e.id.toUpperCase()," –"]}),m?s.jsx("input",{value:_,onChange:O=>B(O.target.value),disabled:I,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}}):s.jsx("span",{children:e.name})]});return s.jsx("div",{className:"customize-overlay",onClick:c,children:s.jsxs("div",{className:"customize-modal",onClick:O=>O.stopPropagation(),children:[s.jsxs("div",{className:"customize-header",children:[s.jsxs("div",{className:"customize-tabs",children:[s.jsx("button",{className:`customize-tab ${j==="character"?"active":""}`,onClick:()=>C("character"),children:"CHARACTER"}),!f&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:`customize-tab ${j==="office"?"active":""}`,onClick:()=>C("office"),children:"OFFICE THEME"}),s.jsx("button",{className:`customize-tab ${j==="settings"?"active":""}`,onClick:()=>C("settings"),children:"SETTINGS"})]})]}),s.jsx("button",{className:"customize-close",onClick:c,children:"X"})]}),j==="character"?s.jsx("div",{className:"customize-body",children:s.jsx(Wg,{roleId:e.id,appearance:E,onChange:N,onRandomize:X,onReset:W,label:M,roleLevel:S})}):j==="office"?s.jsx("div",{className:"customize-body",children:s.jsx("div",{className:"customize-themes",children:Object.entries(bl).map(([O,V])=>s.jsxs("button",{className:`customize-theme-card ${u===O?"active":""}`,onClick:()=>d(O),children:[s.jsxs("div",{className:"customize-theme-preview",style:{background:V.vars["--floor-light"],borderColor:V.vars["--pixel-border"]},children:[s.jsx("div",{style:{background:V.vars["--hud-bg"],height:8,borderBottom:`2px solid ${V.vars["--pixel-border"]}`}}),s.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1 p-1",children:[s.jsx("div",{style:{width:10,height:14,background:V.vars["--accent"],borderRadius:1}}),s.jsx("div",{style:{width:10,height:14,background:V.vars["--active-green"],borderRadius:1}}),s.jsx("div",{style:{width:10,height:14,background:V.vars["--idle-amber"],borderRadius:1}})]}),s.jsx("div",{style:{background:V.vars["--hud-bg"],height:6,borderTop:`2px solid ${V.vars["--pixel-border"]}`}})]}),s.jsxs("div",{className:"customize-theme-name",children:[V.icon," ",V.name]})]},O))})}):s.jsx("div",{className:"customize-body",children:s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,padding:"8px 0"},children:[s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),s.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(O=>s.jsxs("button",{onClick:()=>g==null?void 0:g({mode:O}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(y==null?void 0:y.mode)===O?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(y==null?void 0:y.mode)===O?"rgba(255,255,255,0.08)":"transparent",color:(y==null?void 0:y.mode)===O?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[s.jsx("div",{style:{fontWeight:600,marginBottom:2},children:O==="template"?"TEMPLATE":O==="llm"?"AI":"AUTO"}),s.jsx("div",{style:{fontSize:9,opacity:.7},children:O==="template"?"Static pool ($0)":O==="llm"?"LLM generated":"Detect engine"})]},O))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(y==null?void 0:y.intervalSec)??18,"s"]}),s.jsx("input",{type:"range",min:5,max:120,step:5,value:(y==null?void 0:y.intervalSec)??18,onChange:O=>g==null?void 0:g({intervalSec:Number(O.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"5s (frequent)"}),s.jsx("span",{children:"120s (rare)"})]})]}),(y==null?void 0:y.mode)!=="template"&&s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((G=y==null?void 0:y.dailyBudgetUsd)==null?void 0:G.toFixed(2))??"1.00"]}),s.jsx("input",{type:"range",min:0,max:5,step:.25,value:(y==null?void 0:y.dailyBudgetUsd)??1,onChange:O=>g==null?void 0:g({dailyBudgetUsd:Number(O.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"$0 (unlimited)"}),s.jsx("span",{children:"$5.00/day"})]})]}),s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),s.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:O,label:V})=>s.jsx("button",{onClick:()=>v==null?void 0:v(O),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(b??"auto")===O?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(b??"auto")===O?"rgba(255,255,255,0.08)":"transparent",color:(b??"auto")===O?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:V},O))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]})]})}),j==="character"&&s.jsxs("div",{className:"customize-footer",children:[s.jsx("button",{className:"customize-btn customize-btn--cancel",onClick:c,children:"CANCEL"}),s.jsx("button",{className:"customize-btn customize-btn--save",onClick:U,children:"SAVE"})]})]})})}function hy(e){if(e.length===0)return"";const r={};for(const{file:m}of e){const x=m.split("/"),f=x[0]==="."?x[1]??"root":x[0];(r[f]??(r[f]=[])).push(m)}const a={roles:"roles",projects:"projects",operations:"operations",knowledge:"knowledge",architecture:"architecture",company:"company",".tycono":"config",".claude":"skills"},i=[];for(const[m,x]of Object.entries(r)){const f=a[m]??m;if(x.length===1){const y=x[0].split("/").pop()??x[0];i.push(`${f}/${y}`)}else i.push(`${f} (${x.length} files)`)}const c=e.some(m=>m.status==="A"),u=e.some(m=>m.status==="M");return`${c&&!u?"add":"update"}: ${i.join(", ")}`}function my(e){const r=Date.now()-new Date(e).getTime(),a=Math.floor(r/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 VN({onInitGit:e,onDelegate:r,delegateRoleName:a}){const[i,c]=w.useState(!1),[u,d]=w.useState(null),m=async()=>{c(!0),d(null);try{await e(),d({ok:!0,message:"Git repository initialized!"})}catch(f){const y=f instanceof Error?f.message:"Failed";y.includes("not installed")||y.includes("noGitBinary")?d({ok:!1,message:"git is not installed on this system"}):d({ok:!1,message:y})}finally{c(!1)}},x=u&&!u.ok&&u.message.includes("not installed");return s.jsxs("div",{className:"p-3 space-y-2",style:{background:"rgba(211,47,47,0.05)",border:"1px solid var(--pixel-border)"},children:[s.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"No Git Repository"}),!u&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:"This project has no git repository. Initialize one to start saving."}),s.jsxs("div",{className:"flex gap-2 flex-wrap",children:[s.jsx("button",{onClick:m,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"}),r&&s.jsxs("button",{onClick:r,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&&s.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}),x&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"text-[10px]",style:{color:"#EF5350"},children:"git is not installed on this system."}),s.jsxs("div",{className:"text-[10px] space-y-1",style:{color:"var(--terminal-text-muted)"},children:[s.jsxs("div",{children:[s.jsx("b",{children:"macOS:"})," xcode-select --install"]}),s.jsxs("div",{children:[s.jsx("b",{children:"Ubuntu/Debian:"})," sudo apt install git"]}),s.jsxs("div",{children:[s.jsx("b",{children:"Windows:"})," ",s.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent)",textDecoration:"underline"},children:"git-scm.com/downloads"})]})]}),s.jsxs("div",{className:"flex gap-2 flex-wrap",children:[s.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"}),r&&s.jsxs("button",{onClick:r,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&&!x&&s.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 GN({repo:e,onConnected:r,onDelegate:a,delegateRoleName:i}){const[c,u]=w.useState("idle"),[d,m]=w.useState(null),[x,f]=w.useState(""),[y,g]=w.useState("private"),[b,v]=w.useState(""),[S,j]=w.useState(null),[C,E]=w.useState(!1),N=async()=>{u("checking"),j(null);try{const F=await Se.getGithubStatus(e);m(F),F.hasRemote?r():F.ghInstalled&&F.authenticated?u("ready"):u("idle")}catch{u("idle")}},_=async()=>{if(x.trim()){E(!0),j(null);try{const F=await Se.githubCreateRepo(x.trim(),y,e);j(F),F.ok&&setTimeout(r,1500)}catch(F){j({ok:!1,message:F instanceof Error?F.message:"Failed"})}finally{E(!1)}}},B=async()=>{if(b.trim()){E(!0),j(null);try{const F=await Se.addRemote(b.trim(),e);j(F),F.ok&&setTimeout(r,1500)}catch(F){j({ok:!1,message:F instanceof Error?F.message:"Failed"})}finally{E(!1)}}},I=a?s.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 s.jsxs("div",{className:"p-3 space-y-2",style:{background:"rgba(100,100,255,0.05)",border:"1px solid var(--pixel-border)"},children:[s.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"No Remote — Local Only"}),c==="idle"&&!d&&s.jsxs("div",{className:"flex gap-2 flex-wrap",children:[s.jsx("button",{onClick:N,className:"text-[10px] font-bold px-3 py-1.5 cursor-pointer",style:{background:"var(--accent)",color:"#fff",border:"none"},children:"CONNECT GITHUB"}),s.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"}),I]}),c==="checking"&&s.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:"Checking GitHub CLI..."}),c==="idle"&&d&&!d.ghInstalled&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"text-[10px]",style:{color:"var(--idle-amber)"},children:"GitHub CLI (gh) not installed."}),s.jsxs("div",{className:"text-[10px] space-y-0.5",style:{color:"var(--terminal-text-muted)"},children:[s.jsxs("div",{children:["Install:"," ",s.jsx("a",{href:"https://cli.github.com",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent)",textDecoration:"underline"},children:"cli.github.com"})]}),s.jsx("div",{style:{fontFamily:"var(--pixel-font)"},children:"brew install gh && gh auth login"})]}),s.jsxs("div",{className:"flex gap-2 flex-wrap",children:[s.jsx("button",{onClick:N,className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--accent)",color:"#fff",border:"none"},children:"RETRY"}),s.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"}),I]})]}),c==="idle"&&d&&d.ghInstalled&&!d.authenticated&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"text-[10px]",style:{color:"var(--idle-amber)"},children:"GitHub CLI installed but not logged in."}),s.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)",fontFamily:"var(--pixel-font)"},children:"Run in terminal: gh auth login"}),s.jsxs("div",{className:"flex gap-2 flex-wrap",children:[s.jsx("button",{onClick:N,className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--accent)",color:"#fff",border:"none"},children:"RETRY"}),s.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"}),I]})]}),c==="ready"&&d&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"text-[10px]",style:{color:"var(--active-green)"},children:["Logged in as ",d.username||"GitHub user"]}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsx("input",{type:"text",value:x,onChange:F=>f(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)"}}),s.jsxs("select",{value:y,onChange:F=>g(F.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:[s.jsx("option",{value:"private",children:"Private"}),s.jsx("option",{value:"public",children:"Public"})]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:_,disabled:C||!x.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:C?"CREATING...":"CREATE & PUSH"}),s.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"})]})]}),c==="manual"&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:[s.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:"]}),s.jsx("input",{type:"text",value:b,onChange:F=>v(F.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)"}}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:B,disabled:C||!b.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:C?"ADDING...":"ADD REMOTE & PUSH"}),s.jsx("button",{onClick:()=>{u("idle"),m(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"})]})]}),S&&s.jsx("div",{className:"text-[10px] p-1.5",style:{background:S.ok?"rgba(59,185,80,0.1)":"rgba(211,47,47,0.1)",border:`1px solid ${S.ok?"var(--active-green)":"#D32F2F"}`,color:S.ok?"var(--active-green)":"#EF5350"},children:S.message})]})}function QN({status:e,history:r,onClose:a,onSave:i,onLoadHistory:c,onRestore:u,saving:d,onDelegate:m,delegateRoleName:x,repo:f,onRepoChange:y,syncInfo:g,onPull:b,pulling:v,onRefresh:S,onInitGit:j}){const[C,E]=w.useState("save"),[N,_]=w.useState(""),[B,I]=w.useState(null),[F,X]=w.useState(!1),[W,U]=w.useState(null),[M,G]=w.useState(null),O=w.useRef(null);w.useEffect(()=>{C==="history"&&c()},[C,c]),w.useEffect(()=>{var T;(T=O.current)==null||T.focus()},[]);const V=[...((e==null?void 0:e.modified)??[]).map(T=>({status:"M",file:T})),...((e==null?void 0:e.untracked)??[]).map(T=>({status:"A",file:T}))],J=w.useRef(!1);w.useEffect(()=>{!J.current&&V.length>0&&!N&&(_(hy(V)),J.current=!0)},[V.length]),w.useEffect(()=>{J.current=!1,_(""),G(null),U(null),I(null)},[f]);const Q=w.useCallback(()=>{_(hy(V))},[V]),H=async()=>{I(null),U(null);try{const T=await i(N||void 0);U(T),_("")}catch(T){I(T instanceof Error?T.message:"Save failed")}},Y=async()=>{G(null),I(null);try{const T=await b();G(T)}catch(T){I(T instanceof Error?T.message:"Pull failed")}},ne=async T=>{if(confirm(`Restore from commit ${T.slice(0,7)}? This creates a new commit with those files.`)){X(!0);try{await u(T),X(!1)}catch(z){I(z instanceof Error?z.message:"Restore failed"),X(!1)}}};w.useEffect(()=>{const T=z=>{z.key==="Escape"&&a()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[a]);const we=T=>{T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&H()};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:a}),s.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:we,children:[s.jsxs("div",{className:"px-5 py-3 flex items-center justify-between shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-lg font-black tracking-tight",children:"SAVE GAME"}),s.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:(e==null?void 0:e.branch)??""})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[g&&g.hasRemote&&(g.behind>0||g.ahead>0)&&s.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}`]}),s.jsx("button",{onClick:a,className:"text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] cursor-pointer text-lg",children:"×"})]})]}),s.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["akb","code"].map(T=>s.jsx("button",{onClick:()=>y(T),className:"flex-1 py-1.5 text-[10px] font-bold uppercase tracking-wider cursor-pointer",style:{background:f===T?"var(--hud-bg-alt)":"transparent",color:f===T?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:f===T?"2px solid var(--accent)":"2px solid transparent"},children:T==="akb"?"AKB":"CODE"},T))}),s.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["save","history"].map(T=>s.jsx("button",{onClick:()=>E(T),className:"flex-1 py-2 text-[11px] font-bold uppercase tracking-wider cursor-pointer",style:{background:C===T?"var(--hud-bg-alt)":"transparent",color:C===T?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:C===T?"2px solid var(--accent)":"2px solid transparent"},children:T==="save"?"SAVE":"HISTORY"},T))}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[C==="save"&&s.jsxs(s.Fragment,{children:[(e==null?void 0:e.noGit)&&s.jsx(VN,{onInitGit:async()=>{await(j==null?void 0:j()),S==null||S()},onDelegate:m?()=>{m(`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:x}),g&&g.hasRemote&&g.behind>0&&s.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:[s.jsxs("span",{className:"text-[11px]",style:{color:"var(--idle-amber)"},children:[g.behind," commit",g.behind>1?"s":""," behind remote"]}),s.jsx("button",{onClick:Y,disabled:v,className:"text-[10px] font-bold px-3 py-1 cursor-pointer",style:{background:"var(--idle-amber)",color:"#000",border:"none",opacity:v?.5:1},children:v?"PULLING...":"↓ PULL"})]}),M&&s.jsx("div",{className:"text-[11px] p-2",style:{background:M.status==="ok"||M.status==="up-to-date"?"rgba(59,185,80,0.1)":"rgba(211,47,47,0.1)",border:`1px solid ${M.status==="ok"||M.status==="up-to-date"?"var(--active-green)":"#D32F2F"}`,color:M.status==="ok"||M.status==="up-to-date"?"var(--active-green)":"#EF5350"},children:M.message}),s.jsx("div",{className:"text-[11px]",style:{color:"var(--terminal-text-secondary)"},children:V.length>0?s.jsxs("span",{style:{color:"var(--idle-amber)"},children:["* ",V.length," unsaved change",V.length>1?"s":""]}):s.jsx("span",{style:{color:"var(--active-green)"},children:"All changes saved"})}),V.length>0&&s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Changed Files"}),s.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:V.map(({status:T,file:z})=>s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{style:{color:T==="A"?"var(--active-green)":"var(--idle-amber)",width:"14px"},children:T}),s.jsx("span",{style:{color:"var(--terminal-text-secondary)"},children:z})]},z))})]}),V.length>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Save Message"}),s.jsxs("button",{onClick:Q,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"]})]}),s.jsx("input",{ref:O,type:"text",value:N,onChange:T=>_(T.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)"}})]}),V.length>0&&s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:H,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"}),m&&s.jsxs("button",{onClick:()=>{const T=V.map(z=>`${z.status} ${z.file}`).join(`
|
|
89
|
+
`);m(T)},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 ${x??"AI role"} — they'll review, commit, push & merge`,children:["🤖"," ",(x==null?void 0:x.toUpperCase())??"DELEGATE"]})]}),e&&!e.hasRemote&&!e.noGit&&s.jsx(GN,{repo:f,onConnected:()=>S==null?void 0:S(),onDelegate:m?()=>{m(`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:x}),W&&s.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! ",W.filesChanged," file",W.filesChanged>1?"s":""," committed",W.pushed?" & pushed":"",W.pushError?` (push error: ${W.pushError})`:""]}),B&&s.jsx("div",{className:"text-[11px] p-2",style:{background:"rgba(211,47,47,0.1)",border:"1px solid #D32F2F",color:"#EF5350"},children:B}),(e==null?void 0:e.lastCommit)&&s.jsxs("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:["Last save: ",e.lastCommit.message," (",my(e.lastCommit.date),")"]})]}),C==="history"&&s.jsxs(s.Fragment,{children:[r.length===0&&s.jsx("div",{className:"text-[11px] text-center py-8",style:{color:"var(--terminal-text-muted)"},children:"No save history"}),s.jsx("div",{className:"space-y-1",children:r.map(T=>s.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:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--accent)"},children:T.shortSha}),s.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--terminal-text)"},children:T.message})]}),s.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:my(T.date)})]}),s.jsx("button",{onClick:()=>ne(T.sha),disabled:F,className:"text-[10px] font-bold px-2 py-1 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--idle-amber)"},children:"LOAD"})]},T.sha))})]})]})]})]})}function WN({onClose:e}){const[r,a]=w.useState(null),[i,c]=w.useState(!0),[u,d]=w.useState(null),[,m]=w.useState(!1);return w.useEffect(()=>{Promise.all([Se.getCompanyStats(),Se.getPreferences()]).then(async([x,f])=>{a(x);const y=f;if(y.instanceId)try{await rr.syncStats({instanceId:y.instanceId,roleCount:x.company.roleCount,totalTokens:x.company.totalTokens,rolesData:x.roles.map(g=>({roleId:g.roleId,name:g.name,tokens:g.totalTokens}))}),m(!0)}catch{}}).catch(x=>d(x.message)).finally(()=>c(!1))},[]),i?s.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading stats..."}):u||!r?s.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u||"Failed to load stats",s.jsx("button",{onClick:e,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]}):s.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:20},children:[s.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Company Stats"}),s.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]}),s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:20},children:[s.jsx(qc,{label:"Roles",value:String(r.company.roleCount)}),s.jsx(qc,{label:"Avg Level",value:`Lv.${r.company.avgLevel}`}),s.jsx(qc,{label:"Total Tokens",value:r.company.formattedTokens}),s.jsx(qc,{label:"Total Cost",value:`$${r.company.totalCostUsd.toFixed(2)}`})]}),s.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"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[r.roles.map((x,f)=>s.jsx(KN,{role:x,rank:f+1},x.roleId)),r.roles.length===0&&s.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(r.byModel).length>0&&s.jsxs(s.Fragment,{children:[s.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"}),s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:Object.entries(r.byModel).map(([x,f])=>s.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:[s.jsx("span",{style:{color:"rgba(255,255,255,0.7)"},children:ZN(x)}),s.jsxs("span",{style:{color:"rgba(255,255,255,0.5)"},children:["$",f.costUsd.toFixed(2)]})]},x))})]})]})}function qc({label:e,value:r}){return s.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:[s.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.45)",marginBottom:4},children:e}),s.jsx("div",{style:{fontSize:18,fontWeight:600},children:r})]})}function KN({role:e,rank:r}){const a=["🥇","🥈","🥉"],i=r<=3?a[r-1]:`#${r}`;return s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:8},children:[s.jsx("span",{style:{fontSize:14,width:28,textAlign:"center",flexShrink:0},children:i}),s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:4},children:[s.jsx("span",{style:{fontSize:13,fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),s.jsxs("span",{style:{fontSize:12,color:xy(e.level),fontWeight:600,flexShrink:0,marginLeft:8},children:["Lv.",e.level]})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsx("div",{style:{flex:1,height:4,background:"rgba(255,255,255,0.08)",borderRadius:2,overflow:"hidden"},children:s.jsx("div",{style:{width:`${e.progress*100}%`,height:"100%",background:xy(e.level),borderRadius:2,transition:"width 0.3s ease"}})}),s.jsx("span",{style:{fontSize:10,color:"rgba(255,255,255,0.4)",flexShrink:0},children:e.formattedTokens})]})]})]})}function xy(e){return e>=20?"#FFD700":e>=10?"#C0A0FF":e>=5?"#4FC3F7":e>=3?"#81C784":"rgba(255,255,255,0.4)"}function ZN(e){return e.includes("opus")?"Opus":e.includes("sonnet")?"Sonnet":e.includes("haiku")?"Haiku":e.split("-").slice(0,2).join(" ")}function PN({onClose:e,onSyncComplete:r}){const[a,i]=w.useState([]),[c,u]=w.useState([]),[d,m]=w.useState(!0),[x,f]=w.useState(null),[y,g]=w.useState(new Set),[b,v]=w.useState(null),[S,j]=w.useState(null),C=w.useCallback(async()=>{m(!0),v(null);try{const{roles:N}=await Se.getSyncRoles();i(N);const _=N.filter(B=>B.source.sync!=="off");if(_.length===0){u([]),j(null);return}try{const B=await rr.syncCheck(_.map(F=>({roleId:F.roleId,sourceId:F.source.id,currentVersion:F.source.upstream_version??F.source.forked_at??"0.0.0"})));j(!0);const I=[];for(const F of B.updates){if(!F.hasUpdate)continue;const X=_.find(O=>O.roleId===F.roleId);if(!X)continue;const{character:W}=await rr.syncPull(F.sourceId),U=[];X.persona.trim()!==W.persona.trim()&&U.push({field:"persona",local:X.persona.slice(0,120)+(X.persona.length>120?"...":""),upstream:W.persona.slice(0,120)+(W.persona.length>120?"...":"")});const M=JSON.stringify(X.authority),G=JSON.stringify(W.authority);M!==G&&U.push({field:"authority",local:`${X.authority.autonomous.length} autonomous, ${X.authority.needsApproval.length} approval`,upstream:`${W.authority.autonomous.length} autonomous, ${W.authority.needsApproval.length} approval`}),U.length>0&&I.push({roleId:F.roleId,roleName:X.name,sourceId:F.sourceId,currentVersion:F.currentVersion,latestVersion:F.latestVersion,fields:U})}u(I)}catch{j(!1),u([])}}catch(N){v(N instanceof Error?N.message:"Failed to check for updates")}finally{m(!1)}},[]);w.useEffect(()=>{C()},[C]);const E=async N=>{f(N.roleId);try{const{character:_,version:B}=await rr.syncPull(N.sourceId);await Se.applySyncUpdate({roleId:N.roleId,changes:{persona:_.persona,authority:_.authority},upstreamVersion:B}),g(I=>new Set(I).add(N.roleId)),r==null||r()}catch(_){v(_ instanceof Error?_.message:"Failed to apply update")}finally{f(null)}};return s.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[s.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Role Sync"}),s.jsxs("div",{style:{display:"flex",gap:8},children:[s.jsx("button",{onClick:C,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"}),s.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),S===!1&&s.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."}),b&&s.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:b}),s.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:[s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Tracked roles: "}),s.jsx("span",{style:{fontWeight:500},children:a.length}),s.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Updates available: "}),s.jsx("span",{style:{fontWeight:500,color:c.length>0?"#4FC3F7":"rgba(255,255,255,0.7)"},children:c.filter(N=>!y.has(N.roleId)).length}),S===!0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),s.jsx("span",{style:{fontSize:11,color:"#81C784"},children:"Cloud connected"})]})]}),c.length===0&&!d&&s.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!"}),c.map(N=>s.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:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:14,fontWeight:500},children:N.roleName}),s.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.4)"},children:[N.sourceId," · v",N.currentVersion," → v",N.latestVersion]})]}),y.has(N.roleId)?s.jsx("span",{style:{fontSize:12,color:"#81C784"},children:"Applied ✓"}):s.jsx("button",{onClick:()=>E(N),disabled:x===N.roleId,style:{background:"#1565C0",border:"none",color:"white",borderRadius:6,padding:"5px 12px",fontSize:12,cursor:x===N.roleId?"wait":"pointer",opacity:x===N.roleId?.6:1},children:x===N.roleId?"Applying...":"Apply Update"})]}),N.fields.map(_=>s.jsxs("div",{style:{marginBottom:6,fontSize:12},children:[s.jsx("div",{style:{color:"rgba(255,255,255,0.5)",marginBottom:2,textTransform:"uppercase",fontSize:10,letterSpacing:.5},children:_.field}),s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},children:[s.jsxs("div",{style:{padding:"4px 8px",background:"rgba(255,100,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[s.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"LOCAL"}),s.jsx("br",{}),_.local]}),s.jsxs("div",{style:{padding:"4px 8px",background:"rgba(100,255,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[s.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"UPSTREAM"}),s.jsx("br",{}),_.upstream]})]})]},_.field))]},N.roleId)),a.length>0&&s.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 ",s.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 JN({onClose:e}){const[r,a]=w.useState(null),[i,c]=w.useState(!0),[u,d]=w.useState(null),[m,x]=w.useState(null),f=w.useCallback(async()=>{c(!0),d(null);try{const N=await Se.getGitStatus();a(N)}catch(N){d(N instanceof Error?N.message:"Failed to load git status")}finally{c(!1)}},[]);w.useEffect(()=>{f()},[f]);const y=async N=>{x(N.path);try{await Se.deleteWorktree(N.path),await f()}catch(_){d(_ instanceof Error?_.message:"Failed to remove worktree")}finally{x(null)}},g=async N=>{x(N);try{await Se.deleteBranch(N),await f()}catch(_){d(_ instanceof Error?_.message:"Failed to delete branch")}finally{x(null)}};if(i&&!r)return s.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading git status..."});if(u&&!r)return s.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u,s.jsx("button",{onClick:e,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]});if(!r)return null;const b=r.worktrees.filter(N=>N.status==="active"),v=r.worktrees.filter(N=>N.status==="pending-merge"),S=r.worktrees.filter(N=>N.status==="stale");function j(N){const _=N.split("/");if(_.length>1){const B=_[_.length-1],I=["cto","cbo","pm","engineer","designer","qa","data-analyst"];for(const F of I)if(B.toLowerCase().includes(F))return F}return null}function C(N,_=40){return N.length<=_?N:"..."+N.slice(N.length-_+3)}function E(N){const _=Date.now()-new Date(N).getTime(),B=Math.floor(_/6e4);if(B<1)return"just now";if(B<60)return`${B}m ago`;const I=Math.floor(B/60);return I<24?`${I}h ago`:`${Math.floor(I/24)}d ago`}return s.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[s.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"GIT STATUS"}),s.jsxs("div",{style:{display:"flex",gap:8},children:[s.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"}),s.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),u&&s.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:u}),s.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:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s.jsxs("div",{children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Branch: "}),s.jsx("span",{style:{fontWeight:500},children:r.currentBranch})]}),s.jsx("div",{children:r.unsavedCount>0&&s.jsxs("span",{style:{color:"#FFB74D",fontSize:12},children:[r.unsavedCount," unsaved"]})})]}),r.lastCommit&&s.jsxs("div",{style:{marginTop:6,fontSize:11,color:"rgba(255,255,255,0.4)"},children:["Last commit: ",r.lastCommit.message.slice(0,60),r.lastCommit.message.length>60?"...":""," · ",E(r.lastCommit.date)]})]}),b.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(Yc,{label:"Active Worktrees",count:b.length}),b.map(N=>s.jsx(ah,{wt:N,roleFromBranch:N.roleId||j(N.branch),truncatePath:C,timeAgo:E,removing:m===N.path,onRemove:()=>y(N),statusColor:"#4FC3F7",statusIcon:"📂"},N.path))]}),v.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(Yc,{label:"Pending Merge",count:v.length}),v.map(N=>s.jsx(ah,{wt:N,roleFromBranch:N.roleId||j(N.branch),truncatePath:C,timeAgo:E,removing:m===N.path,onRemove:()=>y(N),statusColor:"#FFB74D",statusIcon:"⚠️"},N.path))]}),S.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(Yc,{label:"Stale",count:S.length}),S.map(N=>s.jsx(ah,{wt:N,roleFromBranch:N.roleId||j(N.branch),truncatePath:C,timeAgo:E,removing:m===N.path,onRemove:()=>y(N),statusColor:"#ff6b6b",statusIcon:"🔴"},N.path))]}),r.staleBranches.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(Yc,{label:"Unmerged Branches",count:r.staleBranches.length}),r.staleBranches.map(N=>s.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:[s.jsxs("div",{style:{fontSize:13},children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.5)",marginRight:6},children:"⚠️"}),s.jsx("span",{style:{fontWeight:500},children:N})]}),s.jsx("button",{onClick:()=>g(N),disabled:m===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:m===N?"wait":"pointer",opacity:m===N?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5},children:m===N?"...":"DELETE"})]},N))]}),b.length===0&&v.length===0&&S.length===0&&r.staleBranches.length===0&&s.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."]}),r.lastMerge&&s.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Last merge: ",s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:r.lastMerge.branch})," · ",r.lastMerge.roleId," · ",E(r.lastMerge.mergedAt)]})]})}function Yc({label:e,count:r}){return s.jsxs("h4",{style:{margin:"16px 0 8px",fontSize:11,fontWeight:600,color:"rgba(255,255,255,0.5)",textTransform:"uppercase",letterSpacing:1},children:[e," (",r,")"]})}function ah({wt:e,roleFromBranch:r,truncatePath:a,timeAgo:i,removing:c,onRemove:u,statusColor:d,statusIcon:m}){return s.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:s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsxs("div",{style:{fontSize:13,fontWeight:500,marginBottom:2},children:[s.jsx("span",{style:{marginRight:6},children:m}),e.branch,r&&s.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:r})]}),e.task&&s.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.5)",marginBottom:2},children:['"',e.task.slice(0,50),e.task.length>50?"...":"",'"']}),s.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&&s.jsxs("div",{style:{fontSize:10,color:"#ff6b6b",marginTop:4},children:["⛔"," CONFLICT: ",e.conflictFiles.join(", ")]})]}),s.jsx("button",{onClick:u,disabled:c,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:c?"wait":"pointer",opacity:c?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5,flexShrink:0,marginLeft:8},children:c?"...":"REMOVE"})]})})}function e6({onClose:e,speechSettings:r,onSpeechSettingsChange:a,language:i,onLanguageChange:c,onOpenSync:u,onOpenGitStatus:d,onOpenStats:m}){var H;const[x,f]=w.useState(null),[y,g]=w.useState(null),[b,v]=w.useState(!1),[S,j]=w.useState(!1),[C,E]=w.useState(!1),[N,_]=w.useState(null),[B,I]=w.useState(""),[F,X]=w.useState(!1),[W,U]=w.useState(!1),[M,G]=w.useState(null),[O,V]=w.useState(!1);w.useEffect(()=>{Se.getPreferences().then(async Y=>{const ne=Y;if(f(ne.instanceId??null),ne.instanceId)try{const{name:we}=await rr.getMyName(ne.instanceId);g(we)}catch{}}).catch(()=>{}),Se.getCodeRoot().then(({codeRoot:Y})=>{_(Y),Y&&I(Y)}).catch(()=>{})},[]);const J=async()=>{E(!0);try{const ne=await(await fetch("/api/preferences/regenerate-token",{method:"POST"})).json();ne.ok&&(f(ne.newInstanceId),j(!1))}catch{}E(!1)},Q=()=>{x&&navigator.clipboard.writeText(x).then(()=>{v(!0),setTimeout(()=>v(!1),2e3)})};return s.jsx("div",{className:"customize-overlay",onClick:e,children:s.jsxs("div",{className:"customize-modal",onClick:Y=>Y.stopPropagation(),style:{maxWidth:480},children:[s.jsxs("div",{className:"customize-header",children:[s.jsx("div",{style:{fontSize:12,fontWeight:700,letterSpacing:1,color:"var(--terminal-text)"},children:"SETTINGS"}),s.jsx("button",{className:"customize-close",onClick:e,children:"X"})]}),s.jsx("div",{className:"customize-body",style:{padding:"12px 20px 20px"},children:s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),s.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(Y=>s.jsxs("button",{onClick:()=>a==null?void 0:a({mode:Y}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(r==null?void 0:r.mode)===Y?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(r==null?void 0:r.mode)===Y?"rgba(255,255,255,0.08)":"transparent",color:(r==null?void 0:r.mode)===Y?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[s.jsx("div",{style:{fontWeight:600,marginBottom:2},children:Y==="template"?"TEMPLATE":Y==="llm"?"AI":"AUTO"}),s.jsx("div",{style:{fontSize:9,opacity:.7},children:Y==="template"?"Static pool ($0)":Y==="llm"?"LLM generated":"Detect engine"})]},Y))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(r==null?void 0:r.intervalSec)??18,"s"]}),s.jsx("input",{type:"range",min:5,max:120,step:5,value:(r==null?void 0:r.intervalSec)??18,onChange:Y=>a==null?void 0:a({intervalSec:Number(Y.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"5s (frequent)"}),s.jsx("span",{children:"120s (rare)"})]})]}),(r==null?void 0:r.mode)!=="template"&&s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((H=r==null?void 0:r.dailyBudgetUsd)==null?void 0:H.toFixed(2))??"1.00"]}),s.jsx("input",{type:"range",min:0,max:5,step:.25,value:(r==null?void 0:r.dailyBudgetUsd)??1,onChange:Y=>a==null?void 0:a({dailyBudgetUsd:Number(Y.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"$0 (unlimited)"}),s.jsx("span",{children:"$5.00/day"})]})]}),s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),s.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:Y,label:ne})=>s.jsx("button",{onClick:()=>c==null?void 0:c(Y),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(i??"auto")===Y?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(i??"auto")===Y?"rgba(255,255,255,0.08)":"transparent",color:(i??"auto")===Y?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:ne},Y))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]}),s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"CODE REPOSITORY"}),F?s.jsxs("div",{children:[s.jsxs("div",{style:{display:"flex",gap:6},children:[s.jsx("input",{type:"text",value:B,onChange:Y=>{I(Y.target.value),G(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}),s.jsx("button",{onClick:async()=>{if(B.trim()){U(!0),G(null);try{const Y=await Se.setCodeRoot(B.trim());_(Y.codeRoot),I(Y.codeRoot),X(!1),V(!0),setTimeout(()=>V(!1),3e3)}catch(Y){G(Y instanceof Error?Y.message:"Failed to set code root")}finally{U(!1)}}},disabled:W||!B.trim(),style:{padding:"8px 12px",fontSize:10,fontWeight:600,background:"var(--accent)",border:"none",color:"#fff",borderRadius:6,cursor:"pointer",opacity:W||!B.trim()?.5:1},children:W?"...":"Save"}),s.jsx("button",{onClick:()=>{X(!1),I(N||""),G(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"})]}),M&&s.jsx("div",{style:{fontSize:9,color:"#ff6b6b",marginTop:4},children:M})]}):s.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[s.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:N?"var(--terminal-text)":"var(--terminal-text-muted)",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:N||"Not configured"}),s.jsx("button",{onClick:()=>{X(!0),G(null),V(!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"})]}),O&&s.jsx("div",{style:{fontSize:9,color:"#4ade80",marginTop:4},children:"Code repository updated!"}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Path to your code repository (separate from AKB)"})]}),x&&s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"STORE TOKEN"}),s.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[s.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:x}),s.jsx("button",{onClick:Q,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"})]}),s.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."}),s.jsx("div",{style:{marginTop:6},children:S?s.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:[s.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."}),s.jsxs("div",{style:{display:"flex",gap:6},children:[s.jsx("button",{onClick:J,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"}),s.jsx("button",{onClick:()=>j(!1),style:{padding:"4px 12px",fontSize:9,border:"none",background:"transparent",color:"var(--terminal-text-muted)",cursor:"pointer"},children:"Cancel"})]})]}):s.jsx("button",{onClick:()=>j(!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"})})]}),s.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.08)",paddingTop:16,display:"flex",gap:8},children:[u&&s.jsx("button",{onClick:()=>{e(),u()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"🔄 ROLE SYNC"}),d&&s.jsx("button",{onClick:()=>{e(),d()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📂 GIT STATUS"}),m&&s.jsx("button",{onClick:()=>{e(),m()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📊 COMPANY STATS"}),s.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"})]}),y&&s.jsx("div",{style:{textAlign:"center",marginTop:-8},children:s.jsx("a",{href:`https://tycono.ai/profile.html?u=${encodeURIComponent(y)}`,target:"_blank",rel:"noopener noreferrer",style:{fontSize:10,color:"var(--terminal-text-muted)",textDecoration:"none"},onMouseEnter:Y=>Y.currentTarget.style.color="var(--accent)",onMouseLeave:Y=>Y.currentTarget.style.color="var(--terminal-text-muted)",children:"View public profile →"})})]})})]})})}function t6({theme:e,onThemeChange:r,onClose:a}){const i=w.useRef(null);return w.useEffect(()=>{const c=u=>{i.current&&!i.current.contains(u.target)&&a()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[a]),s.jsx("div",{ref:i,className:"theme-dropup",children:Object.entries(bl).map(([c,u])=>s.jsxs("button",{className:`theme-dropup__item${e===c?" theme-dropup__item--active":""}`,onClick:()=>{r(c),a()},title:u.name,children:[s.jsxs("span",{className:"theme-dropup__swatch",style:{background:u.vars["--hud-bg"],borderColor:u.vars["--pixel-border"]},children:[s.jsx("span",{style:{background:u.vars["--accent"],width:5,height:5,borderRadius:1}}),s.jsx("span",{style:{background:u.vars["--active-green"],width:5,height:5,borderRadius:1}}),s.jsx("span",{style:{background:u.vars["--idle-amber"],width:5,height:5,borderRadius:1}})]}),s.jsx("span",{className:"theme-dropup__name",children:u.icon})]},c))})}const Nh=5e4;function db(e){return e<Nh?1:Math.max(1,Math.floor(Math.sqrt(e/Nh)))}function py(e){return Nh*e*e}function n6(e){const r=db(e),a=py(r),i=py(r+1);return Math.min(1,(e-a)/(i-a))}function lh(e){const r={};for(const[a,i]of Object.entries(e)){const c=i.inputTokens+i.outputTokens;r[a]={level:db(c),totalTokens:c,progress:n6(c)}}return r}const r6=[{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(r=>r.level>=3)},{id:"senior-staff",name:"Senior Staff",icon:"🌟",description:"Any role reached Lv.5",check:e=>e.roles.some(r=>r.level>=5)},{id:"master-class",name:"Master Class",icon:"👑",description:"Any role reached Lv.10",check:e=>e.roles.some(r=>r.level>=10)},{id:"full-house",name:"Full House",icon:"🏠",description:"All roles Lv.5+",check:e=>e.roleCount>=3&&e.roles.every(r=>r.level>=5)}];function yy(e){return r6.filter(r=>r.check(e))}const a6={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍","data-analyst":"📊"},Kc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},l6={cto:"아키텍처",cbo:"시장 분석",pm:"PRD 작성",engineer:"코딩",designer:"시안 제작",qa:"품질 검증"};function i6(e){let r=0;for(let i=0;i<e.length;i++)r=e.charCodeAt(i)+((r<<5)-r);return`hsl(${(r%360+360)%360}, 50%, 40%)`}function s6({importJob:e,onImportDone:r}){var rs,Rn,Wr;const[a,i]=w.useState([]),[c,u]=w.useState([]),[d,m]=w.useState([]),[x,f]=w.useState([]),[y,g]=w.useState([]),[b,v]=w.useState([]),[S,j]=w.useState("TYCONO"),[C,E]=w.useState(!0),[N,_]=w.useState(null),[B,I]=w.useState({type:"none"}),[F,X]=w.useState(null),[W,U]=w.useState(null),[M,G]=w.useState([]),[O,V]=w.useState(!1),[J,Q]=w.useState([]),[H,Y]=w.useState(0),[ne,we]=w.useState(!1),[T,z]=w.useState({}),[Z,D]=w.useState("ceo"),[xe,Ce]=w.useState(null),[ge,Me]=w.useState(!1),[Ee,Ie]=w.useState(!1),[oe,at]=w.useState({}),Ct=w.useRef({}),[jt,Vt]=w.useState(!1),[pe,he]=w.useState(null),[ke,Ae]=w.useState({}),[Fe,Re]=w.useState([]),Ne=w.useMemo(()=>{const R={};for(const ae of Fe)R[ae.roleId]=ae;return R},[Fe]),[ze,Pe]=w.useState([]),[_e,et]=w.useState(zS()),re=w.useRef(!1),ye=w.useRef(-1),[De,He]=w.useState(null),de=w.useRef(null),[Te,wt]=w.useState(void 0),[it,rt]=w.useState(!1);w.useEffect(()=>{Se.getStatus().then(R=>{wt(R.engine),rt(!!R.hasApiKey)}).catch(()=>{})},[]);const{getAppearance:yt,setAppearance:st,resetAppearance:bn,theme:Yt,setTheme:oa,speechSettings:$n,setSpeechSettings:ln,language:Xn,setLanguage:Ln}=kE(),[P,Ue]=w.useState(null),[,Rt]=w.useState("character"),tt=CE(),[Pt,Jt]=w.useState(!1),[An,br]=w.useState(!1),[Jl,Hn]=w.useState(!1),[Tn,be]=w.useState(!1),[Cn,jl]=w.useState(!1),[lr,sn]=w.useState(!1),[Gt,Fa]=w.useState(null);w.useEffect(()=>{tt.refresh()},[]),w.useEffect(()=>{const R=ae=>{(ae.metaKey||ae.ctrlKey)&&ae.key==="s"&&(ae.preventDefault(),Jt(!0))};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[]),w.useEffect(()=>{if(!Tn)return;let R=!1;const ae=async()=>{try{const me=await Se.getGitStatus();R||Fa(me)}catch{}};ae();const ie=setInterval(ae,1e4);return()=>{R=!0,clearInterval(ie)}},[Tn]);const[Ur,Wi]=w.useState(null),[_a,ca]=w.useState(null),[vr,ei]=w.useState([]),[ir,ua]=w.useState(!1),Oa=w.useRef(!1),qr=w.useRef(null);let on=w.useRef(0);const Ki=w.useRef(new Set),Yr=(R,ae,ie)=>{const me={id:on.current++,type:R,text:ae,detail:ie};ei(ve=>[...ve,me])};w.useEffect(()=>{var R;ir&&((R=qr.current)==null||R.scrollIntoView({behavior:"smooth"}))},[vr,ir]),w.useEffect(()=>{e&&(Oa.current||(Oa.current=!0,ca("Scanning knowledge sources..."),ei([{id:0,type:"scan",text:"Starting knowledge import..."}]),on.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 R=>{var ve;const ae=(ve=R.body)==null?void 0:ve.getReader();if(!ae)return;const ie=new TextDecoder;let me="";for(;;){const{done:Ke,value:ht}=await ae.read();if(Ke)break;me+=ie.decode(ht,{stream:!0});const $e=me.split(`
|
|
90
|
+
`);me=$e.pop()||"";let Ve="";for(const Qe of $e)if(Qe.startsWith("event: "))Ve=Qe.slice(7).trim();else if(Qe.startsWith("data: ")&&Ve){try{const Je=JSON.parse(Qe.slice(6));switch(Ve){case"scanning":ca(`Scanning: ${Je.path} (${Je.fileCount} files)`),Yr("scan",`Found ${Je.fileCount} files`,Je.path);break;case"processing":Wi({index:Je.index,total:Je.total}),ca(`Importing knowledge... (${Je.index}/${Je.total})`),Yr("process",`Processing: ${Je.file}`,`${Je.index} / ${Je.total}`);break;case"created":Yr("created",Je.title,Je.summary);break;case"skipped":Yr("process",`Skipped: ${Je.file}`,Je.reason);break;case"done":ca(null),Wi(null),Yr("done",`Import complete! ${Je.created} created, ${Je.skipped} skipped.`),Mt(`Knowledge import complete! ${Je.created} documents imported.`,"#2E7D32"),r==null||r();break;case"error":ca(null),Wi(null),Yr("error",Je.message),Mt(`Import failed: ${Je.message}`,"#B71C1C"),r==null||r();break}}catch{}Ve=""}}}).catch(R=>{ca(null),Yr("error",R.message),Mt(`Import error: ${R.message}`,"#B71C1C"),r==null||r()})))},[e]);const[Mr,da]=w.useState("iso"),[bo,vo]=w.useState(typeof window<"u"?window.innerWidth:1200);w.useEffect(()=>{const R=()=>vo(window.innerWidth);return window.addEventListener("resize",R),()=>window.removeEventListener("resize",R)},[]);const ti=bo<1024,[wr,sr]=w.useState(!1),[Xr,Fr]=w.useState(560),[en,Qt]=w.useState([]),[fa,Dn]=w.useState(null),[Ba,$a]=w.useState(null),{sendMessage:mu}=bE(),En=w.useRef(new Map);w.useEffect(()=>{Promise.all([Se.getCompany().then(R=>{j(R.name),i(R.roles)}),Se.getOrgTree().then(R=>{z(R.nodes),D(R.root)}).catch(()=>{}),Se.getCostSummary().then(R=>Gr(lh(R.byRole))).catch(()=>{})]).catch(R=>_(`Failed to load: ${R.message}`)).finally(()=>E(!1)),Se.getProjects().then(u).catch(()=>{}),Se.getStandups().then(m).catch(()=>{}),Se.getWaves().then(f).catch(()=>{}),Se.getDecisions().then(g).catch(()=>{}),Se.getKnowledge().then(v).catch(()=>{}),Se.getQuestProgress().then(R=>{et(R),re.current=!0}).catch(()=>{re.current=!0})},[]),w.useEffect(()=>{if(ye.current===-1){ye.current=c.length;return}c.length>ye.current&&Vr({type:"project_created"}),ye.current=c.length},[c.length]),w.useEffect(()=>{Se.getSessions().then(R=>{if(R.length>0){const ae=R.map(me=>({...me,messages:[]}));Qt(ae);const ie=ae.find(me=>me.status==="active")??ae[0];Dn(ie.id),sr(!0)}}).catch(R=>{console.error("Failed to load sessions",R)})},[]),w.useEffect(()=>{const R=()=>{fetch("/api/exec/status").then(ie=>ie.json()).then(ie=>{Ae(ie.statuses??{}),Re(ie.activeExecutions??[])}).catch(()=>{})};R();const ae=setInterval(R,3e3);return()=>clearInterval(ae)},[]);const ha=w.useMemo(()=>{const R={...ke};if(Ba){const ae=en.find(ie=>ie.id===Ba);ae&&(R[ae.roleId]="working")}return R},[ke,Ba,en]);w.useEffect(()=>{B.type==="role"?Se.getRole(B.roleId).then(X).catch(console.error):X(null)},[B]);const ma=()=>I({type:"none"}),Zi=async(R,ae)=>{const ie=a.find(ve=>ve.id===R),me=(W==null?void 0:W.mode)==="ask";U(null);try{const{jobId:ve}=await Se.startJob({type:"assign",roleId:R,task:ae,readOnly:me}),Ke=Kc[R]??"#666",ht=`${R.toUpperCase()} · ${(ie==null?void 0:ie.name)??R}`;we(!1),G([{jobId:ve,title:ht,color:Ke}]),Vr({type:"task_executed",condition:{roleId:R}}),cn.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO → ${(ie==null?void 0:ie.name)??R}] ${me?"Ask":"Assign"}: ${ae}`,type:"dispatch",targetRoleId:R})}catch(ve){Mt(`Failed to start job: ${ve instanceof Error?ve.message:"unknown"}`,"#C62828")}},Mt=(R,ae)=>{const ie=Date.now();Pe(me=>[...me,{id:ie,message:R,color:ae}]),setTimeout(()=>Pe(me=>me.filter(ve=>ve.id!==ie)),4e3)},wo=R=>{de.current&&clearTimeout(de.current),He(R),de.current=setTimeout(()=>He(null),8e3)},Vr=R=>{re.current&&et(ae=>{const ie=RS(ae);if(!ie||!_S(ie,R))return ae;const{progress:me,quest:ve}=MS(ae,ie.id);return ve&&(Mt(`📋 Quest complete: ${ve.title}`,"#7C3AED"),He(null),Se.saveQuestProgress(me).catch(()=>{})),me})};w.useEffect(()=>{if(!De)return;const R=document.querySelector(`[data-quest-target="${De}"]`);if(!R)return;R.classList.add("quest-spotlight");const ae=()=>{R.classList.remove("quest-spotlight"),He(null),de.current&&clearTimeout(de.current)};return R.addEventListener("click",ae,{once:!0}),()=>{R.classList.remove("quest-spotlight"),R.removeEventListener("click",ae)}},[De]);const Gr=R=>{var ie,me;const ae=Ct.current;for(const[ve,Ke]of Object.entries(R)){const ht=((ie=ae[ve])==null?void 0:ie.level)??0;if(ht>0&&Ke.level>ht){const $e=((me=a.find(Ve=>Ve.id===ve))==null?void 0:me.name)??ve.toUpperCase();Mt(`${$e} leveled up to Lv.${Ke.level}!`,"#7C3AED")}}Ct.current=R,at(R)};w.useEffect(()=>{const R={roles:Object.entries(oe).map(([me,ve])=>({id:me,level:ve.level,totalTokens:ve.totalTokens})),totalTokens:Object.values(oe).reduce((me,ve)=>me+ve.totalTokens,0),roleCount:a.length},ae=yy(R),ie=Ki.current;for(const me of ae)ie.has(me.id)||ie.size>0&&Mt(`${me.icon} Badge earned: ${me.name}!`,"#D4A017");Ki.current=new Set(ae.map(me=>me.id))},[oe,a.length]);const xu=()=>{var ae;const R=M[M.length-1];R&&(Mt(`${R.title} completed`,R.color),cn.pushMessage({ts:Date.now(),roleId:((ae=R.title.split(" · ")[0])==null?void 0:ae.toLowerCase())??"unknown",text:`[${R.title}] Job completed`,type:"dispatch"})),Se.getStandups().then(m).catch(console.error),Se.getCompany().then(ie=>i(ie.roles)).catch(console.error),Se.getCostSummary().then(ie=>Gr(lh(ie.byRole))).catch(()=>{})},ko=(R,ae)=>{const ie=`wave-${R}`,me=new AbortController;En.current.set(R,me);const ve={id:`msg-wave-${R}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:new Date().toISOString(),streamEvents:[]};Qt(Ke=>Ke.map(ht=>ht.id===ie?{...ht,messages:[...ht.messages,ve]}:ht)),fetch(`/api/jobs/${R}/stream?from=0`,{signal:me.signal}).then(async Ke=>{if(!Ke.ok||!Ke.body)return;const ht=Ke.body.getReader(),$e=new TextDecoder;let Ve="";for(;;){const{done:Qe,value:Je}=await ht.read();if(Qe)break;Ve+=$e.decode(Je,{stream:!0});const It=Ve.split(`
|
|
91
|
+
`);Ve=It.pop()??"";let li="";for(const ii of It)if(ii.startsWith("event: "))li=ii.slice(7).trim();else if(ii.startsWith("data: ")){try{const yu=JSON.parse(ii.slice(6));if(li==="activity"){const un=yu;Qt(Ia=>Ia.map(jr=>{if(jr.id!==ie)return jr;const Mn=[...jr.messages],as=Mn[Mn.length-1];if(!as||as.from!=="role")return jr;const dn={...as};if(un.type==="text")dn.content=(dn.content??"")+(un.data.text??"");else if(un.type==="thinking")dn.thinking=(dn.thinking??"")+(un.data.text??""),dn.streamEvents=[...dn.streamEvents??[],{type:"thinking",timestamp:Date.now(),text:un.data.text}];else if(un.type==="tool:start")dn.streamEvents=[...dn.streamEvents??[],{type:"tool",timestamp:Date.now(),toolName:un.data.name,toolInput:un.data.input}];else if(un.type==="dispatch:start")dn.streamEvents=[...dn.streamEvents??[],{type:"dispatch",timestamp:Date.now(),roleId:un.data.targetRoleId,task:un.data.task}];else if(un.type==="turn:complete")dn.streamEvents=[...dn.streamEvents??[],{type:"turn",timestamp:Date.now(),turn:un.data.turn}];else{if(un.type==="job:done")return dn.status="done",Mn[Mn.length-1]=dn,{...jr,messages:Mn,status:"closed"};if(un.type==="job:error")return dn.status="error",un.data.message&&(dn.content=dn.content||un.data.message),Mn[Mn.length-1]=dn,{...jr,messages:Mn,status:"closed"}}return Mn[Mn.length-1]=dn,{...jr,messages:Mn}}))}else li==="stream:end"&&Qt(un=>un.map(Ia=>{if(Ia.id!==ie)return Ia;const jr=Ia.messages.map(Mn=>Mn.status==="streaming"?{...Mn,status:"done"}:Mn);return{...Ia,messages:jr,status:"closed"}}))}catch{}li=""}}}).catch(Ke=>{Ke.name!=="AbortError"&&Qt(ht=>ht.map($e=>{if($e.id!==ie)return $e;const Ve=$e.messages.map(Qe=>Qe.status==="streaming"?{...Qe,status:"error"}:Qe);return{...$e,messages:Ve,status:"closed"}}))})},jo=async R=>{V(!1);try{const ae=await Se.startJob({type:"wave",directive:R});Vr({type:"wave_dispatched"});const ie=ae.jobIds??(ae.jobId?[ae.jobId]:[]),me=a.filter($e=>$e.level==="c-level"),ve=ie.map(($e,Ve)=>{var Qe,Je;return{jobId:$e,roleId:((Qe=me[Ve])==null?void 0:Qe.id)??`role-${Ve}`,roleName:((Je=me[Ve])==null?void 0:Je.name)??`C-Level ${Ve+1}`}});cn.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO WAVE] "${R}" → ${ve.map($e=>$e.roleName).join(", ")}`,type:"dispatch"}),Object.keys(T).length>0?(Ce({directive:R,rootJobs:ve}),Me(!1)):(Q(ve),Y(0),we(!1),ve.length>0&&G([{jobId:ve[0].jobId,title:`CEO WAVE · ${ve[0].roleId.toUpperCase()}`,color:"#B71C1C"}]));const Ke=new Date().toISOString(),ht=ve.map($e=>({id:`wave-${$e.jobId}`,roleId:$e.roleId,title:`WAVE: ${$e.roleName}`,mode:"do",source:"wave",jobId:$e.jobId,messages:[{id:`msg-wave-${$e.jobId}-ceo`,from:"ceo",content:R,type:"directive",status:"done",timestamp:Ke}],status:"active",createdAt:Ke,updatedAt:Ke}));Qt($e=>[...ht,...$e]),ht.length>0&&(Dn(ht[0].id),sr(!0));for(const $e of ve)ko($e.jobId,$e.roleId)}catch(ae){Mt(`Failed to start wave: ${ae instanceof Error?ae.message:"unknown"}`,"#C62828")}},Sl=()=>{Se.getWaves().then(f).catch(console.error),Se.getStandups().then(m).catch(console.error)},Pi=()=>{Se.getCompany().then(R=>i(R.roles)).catch(console.error),Se.getOrgTree().then(R=>{z(R.nodes),D(R.root)}).catch(console.error),Se.getCostSummary().then(R=>Gr(lh(R.byRole))).catch(()=>{})},pu=async(R,ae)=>{await Se.createRole(R),st(R.id,ae),Pi(),Mt(`${R.name} hired!`,"#2E7D32"),Vr({type:"role_hired",condition:{roleId:R.id}})},ni=async R=>{var ae;await Se.deleteRole(R),Pi(),Qt(ie=>ie.filter(me=>me.roleId!==R)),fa&&((ae=en.find(ie=>ie.id===fa))==null?void 0:ae.roleId)===R&&Dn(null),he(null),Mt(`${R.toUpperCase()} removed`,"#B71C1C")},kr=async(R,ae)=>{await Se.updateRole(R,ae),Pi(),B.type==="role"&&B.roleId===R&&Se.getRole(R).then(X).catch(console.error),ae.name&&Mt(`${R.toUpperCase()} renamed to "${ae.name}"`,"#1565C0")},Ji=R=>{sr(!0)},es=async R=>{try{const ae=await Se.createSession(R,"talk");Qt(ie=>[ae,...ie]),Dn(ae.id),sr(!0)}catch(ae){console.error("Failed to create session",ae),Mt(`Failed to create session: ${ae instanceof Error?ae.message:"API unreachable"}`,"#B71C1C")}},La=async R=>{try{const ae=await Se.createSession(R,"talk");Qt(ie=>[ae,...ie]),Dn(ae.id)}catch(ae){console.error("Failed to create session",ae),Mt(`Failed to create session: ${ae instanceof Error?ae.message:"API unreachable"}`,"#B71C1C")}},Ha=async R=>{const ae=Ne[R],ie=(ae==null?void 0:ae.jobId)??(ae==null?void 0:ae.id);if(ie&&ha[R]==="working"){const ve=a.find($e=>$e.id===R),Ke=Kc[R]??"#666",ht=`${R.toUpperCase()} · ${(ve==null?void 0:ve.name)??R}`;G([{jobId:ie,title:ht,color:Ke}]),we(!1);return}const me=en.find(ve=>ve.roleId===R);if(me)Dn(me.id),cn.setActiveChannelId(null);else try{const ve=await Se.createSession(R,"talk");Qt(Ke=>[ve,...Ke]),Dn(ve.id),cn.setActiveChannelId(null)}catch(ve){console.error("Failed to create session",ve)}sr(!0)},So=async R=>{const ae=en.find(ie=>ie.id===R);if((ae==null?void 0:ae.source)==="wave"){if(ae.jobId){const ie=En.current.get(ae.jobId);ie&&(ie.abort(),En.current.delete(ae.jobId))}Qt(ie=>{var ve;const me=ie.filter(Ke=>Ke.id!==R);return fa===R&&Dn(((ve=me[0])==null?void 0:ve.id)??null),me});return}try{await Se.deleteSession(R),Qt(ie=>{var ve;const me=ie.filter(Ke=>Ke.id!==R);return fa===R&&Dn(((ve=me[0])==null?void 0:ve.id)??null),me})}catch(ie){console.error("Failed to delete session",ie),Mt(`Failed to close session: ${ie instanceof Error?ie.message:"API error"}`,"#B71C1C")}},ts=async()=>{try{const{ids:R}=await Se.deleteEmptySessions();if(R.length===0)return;Qt(ae=>{var me;const ie=ae.filter(ve=>!R.includes(ve.id));return fa&&R.includes(fa)&&Dn(((me=ie[0])==null?void 0:me.id)??null),ie}),Mt(`Cleared ${R.length} empty session${R.length!==1?"s":""}`,"#2E7D32")}catch(R){Mt(`Failed to clear empty sessions: ${R instanceof Error?R.message:"API error"}`,"#B71C1C")}},Co=async()=>{if(!confirm("Close all sessions? This cannot be undone."))return;const R=en.filter(ae=>ae.source!=="wave").map(ae=>ae.id);for(const ae of en)if(ae.source==="wave"&&ae.jobId){const ie=En.current.get(ae.jobId);ie&&(ie.abort(),En.current.delete(ae.jobId))}try{R.length>0&&await Se.deleteSessions(R),Qt([]),Dn(null),Mt("All sessions closed","#2E7D32")}catch(ae){Mt(`Failed to close sessions: ${ae instanceof Error?ae.message:"API error"}`,"#B71C1C")}},Kn=(R,ae)=>{Qt(ie=>ie.map(me=>{if(me.id!==R)return me;const ve=[...me.messages],Ke=ve[ve.length-1];if(Ke&&Ke.from==="role"&&Ke.status==="streaming"){const ht=[...Ke.streamEvents??[],ae];ve[ve.length-1]={...Ke,streamEvents:ht}}return{...me,messages:ve}}))},or=(R,ae,ie,me)=>{const ve={id:`msg-${Date.now()}-ceo`,from:"ceo",content:ae,type:ie==="do"?"directive":"conversation",status:"done",timestamp:new Date().toISOString(),attachments:me},Ke={id:`msg-${Date.now()+1}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:new Date().toISOString(),streamEvents:[]};Qt($e=>$e.map(Ve=>Ve.id===R?{...Ve,messages:[...Ve.messages,ve,Ke],updatedAt:new Date().toISOString()}:Ve));const ht=en.find($e=>$e.id===R);ht&&ie==="do"&&Vr({type:"task_executed",condition:{roleId:ht.roleId}}),$a(R),mu(R,ae,ie,{onThinking:$e=>{Qt(Ve=>Ve.map(Qe=>{if(Qe.id!==R)return Qe;const Je=[...Qe.messages],It=Je[Je.length-1];return It&&It.from==="role"&&It.status==="streaming"&&(Je[Je.length-1]={...It,thinking:(It.thinking??"")+$e}),{...Qe,messages:Je}})),Kn(R,{type:"thinking",timestamp:Date.now(),text:$e})},onText:$e=>{Qt(Ve=>Ve.map(Qe=>{if(Qe.id!==R)return Qe;const Je=[...Qe.messages],It=Je[Je.length-1];return It&&It.from==="role"&&It.status==="streaming"&&(Je[Je.length-1]={...It,content:It.content+$e}),{...Qe,messages:Je}}))},onToolUse:($e,Ve)=>{Kn(R,{type:"tool",timestamp:Date.now(),toolName:$e,toolInput:Ve})},onDispatch:($e,Ve)=>{Kn(R,{type:"dispatch",timestamp:Date.now(),roleId:$e,task:Ve})},onDispatchProgress:($e,Ve,Qe)=>{var Je;Ve==="tool"?Kn(R,{type:"dispatch:progress",timestamp:Date.now(),roleId:$e,progressType:"tool",toolName:Qe.name,toolInput:Qe.input}):Ve==="thinking"?Kn(R,{type:"dispatch:progress",timestamp:Date.now(),roleId:$e,progressType:"thinking",text:Qe.text}):Ve==="text"?Kn(R,{type:"dispatch:progress",timestamp:Date.now(),roleId:$e,progressType:"text",text:(Je=Qe.text)==null?void 0:Je.slice(-200)}):(Ve==="done"||Ve==="error")&&Kn(R,{type:"dispatch:progress",timestamp:Date.now(),roleId:$e,progressType:Ve})},onTurn:$e=>{Kn(R,{type:"turn",timestamp:Date.now(),turn:$e})},onDone:()=>{Qt($e=>$e.map(Ve=>{if(Ve.id!==R)return Ve;const Qe=Ve.messages.map(It=>It.status==="streaming"?{...It,status:"done"}:It),Je=Ve.messages.length<=2?ae.slice(0,40).replace(/\n/g," "):Ve.title;return{...Ve,messages:Qe,title:Je}})),$a(null)},onError:$e=>{Qt(Ve=>Ve.map(Qe=>{if(Qe.id!==R)return Qe;const Je=Qe.messages.map(It=>It.status==="streaming"?{...It,status:"error",content:It.content||$e}:It);return{...Qe,messages:Je}})),$a(null)}},me)},ns=(R,ae)=>{Qt(ie=>ie.map(me=>me.id===R?{...me,mode:ae}:me)),Se.updateSession(R,{mode:ae}).catch(console.error)},Cl=new Date().toISOString().slice(0,10),zn=c[0],ri={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},ai=R=>{const ae=ri[R];if(!ae)return"";for(const ie of d){const me=ie.content,ve=me.indexOf(`## ${ae}`);if(ve===-1)continue;const Ke=me.indexOf(`
|
|
92
|
+
## `,ve+10),$e=(Ke===-1?me.slice(ve):me.slice(ve,Ke)).split(`
|
|
93
|
+
`).filter(Ve=>Ve.trim().length>0);for(const Ve of $e){const Qe=Ve.replace(/^#+\s*/,"").replace(/\*\*/g,"").replace(/^[-*]\s+/,"").trim();if(!(Qe.startsWith("|")||Qe.startsWith("{")||Qe.startsWith("[")||Qe.startsWith("```")||Qe.startsWith("---")||Qe.includes("Journal")||Qe.includes("(c-level)")||Qe.includes("(team-lead)")||Qe.includes("(member)")||/^(CEO |작업 결과|생성\/수정|APPROVAL|비고|상황 보고|태스크$)/.test(Qe))&&Qe.length>15&&Qe.length<120)return Qe}}return""},Eo=R=>{const ae=ri[R];if(!ae)return"";for(const ie of d){const me=ie.content,ve=me.indexOf(`## ${ae}`);if(ve===-1)continue;const Ke=me.indexOf(`
|
|
94
|
+
## `,ve+10),$e=(Ke===-1?me.slice(ve):me.slice(ve,Ke)).replace(/^## .+\n/,"").trim();if($e)return $e.slice(0,1500)}return""},cn=LE();w.useEffect(()=>{a.length>0&&cn.syncDefaultMembers(a)},[a]);const Qr=FE({roles:a,roleStatuses:ke,activeExecs:Fe,getStandupSpeech:ai});return YE({roles:a,roleStatuses:ke,activeExecs:Fe,channels:cn.channels,relationships:Qr.relationships,pushMessage:cn.pushMessage,speechSettings:$n,engineType:Te,hasApiKey:it}),C?s.jsxs("div",{className:"h-screen flex flex-col bg-[var(--floor-light)]",style:{fontFamily:"var(--pixel-font)"},children:[(_a||vr.length>0)&&s.jsxs("div",{className:"shrink-0 z-[44]",children:[s.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:()=>ua(R=>!R),children:[_a?s.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):s.jsx("span",{className:"shrink-0",children:"✅"}),s.jsx("span",{className:"flex-1",children:_a||"Knowledge import finished"}),Ur&&s.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Ur.index/Ur.total*100}%`,background:"#fff"}})}),s.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:ir?"▲":"▼"})]}),ir&&s.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:[vr.map(R=>s.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[R.type==="scan"&&"🔍",R.type==="process"&&"⚙️",R.type==="created"&&"✅",R.type==="done"&&"🎉",R.type==="error"&&"❌"]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{style:{color:R.type==="error"?"#EF4444":R.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:R.text}),R.detail&&s.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:R.detail})]})]},R.id)),s.jsx("div",{ref:qr})]})]}),s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-4xl mb-3",children:"🏢"}),s.jsx("div",{className:"text-gray-600 font-semibold text-xs",children:"LOADING OFFICE..."})]})})]}):N?s.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:s.jsxs("div",{className:"text-center max-w-md",style:{fontFamily:"var(--pixel-font)"},children:[s.jsx("div",{className:"text-4xl mb-3",children:"⚠️"}),s.jsx("div",{className:"text-gray-800 font-semibold mb-2 text-xs",children:"CONNECTION ERROR"}),s.jsx("div",{className:"text-gray-500 text-xs mb-4",children:N}),s.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"})]})}):s.jsxs("div",{className:"flex flex-col",style:{height:"100dvh",fontFamily:"var(--pixel-font)"},children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-2 bg-[var(--hud-bg)] text-white text-sm shrink-0 z-[45]",style:{borderBottom:"3px solid var(--pixel-border)"},children:[s.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:["🏢"," ",s.jsx("span",{style:{color:"var(--terminal-text)"},children:S})]}),s.jsxs("div",{className:"flex gap-4 text-[var(--terminal-text-secondary)] text-[11px] items-center",children:[(()=>{const R=Object.values(oe).reduce((Ke,ht)=>Ke+ht.totalTokens,0),ae=R>=1e6?`${(R/1e6).toFixed(1)}M`:R>=1e3?`${Math.round(R/1e3)}K`:String(R),ie=Math.min(100,Math.round(R/25e4*100)),me=Fe.length,ve=a.length>0?Math.round(me/a.length*100):0;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["💰",s.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:s.jsx("div",{className:"h-full",style:{width:`${ie}%`,background:"linear-gradient(90deg,#22c55e,#34D399)"}})}),s.jsx("strong",{className:"text-[var(--active-green)]",children:ae})]}),s.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["⚡",s.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:s.jsx("div",{className:"h-full",style:{width:`${ve}%`,background:"linear-gradient(90deg,#3b82f6,#60A5FA)"}})}),s.jsx("strong",{className:"text-[var(--terminal-text)]",children:ve})]})]})})(),s.jsxs("span",{className:"hidden sm:inline",children:["Roles: ",s.jsx("strong",{className:"text-[var(--terminal-text)]",children:a.length})]}),s.jsxs("span",{className:"hidden sm:inline",children:["Projects: ",s.jsx("strong",{className:"text-[var(--terminal-text)]",children:c.length})]}),Fe.length>0&&s.jsxs("span",{className:"text-amber-400",children:["Working: ",s.jsx("strong",{children:Fe.length})]}),(()=>{const R={roles:Object.entries(oe).map(([ie,me])=>({id:ie,level:me.level,totalTokens:me.totalTokens})),totalTokens:Object.values(oe).reduce((ie,me)=>ie+me.totalTokens,0),roleCount:a.length},ae=yy(R);return ae.length>0?s.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:ae.map(ie=>s.jsx("span",{title:`${ie.name}: ${ie.description}`,style:{fontSize:12,cursor:"default"},children:ie.icon},ie.id))}):null})(),s.jsx("span",{className:"px-1.5 py-0.5",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--pixel-border)"},children:Cl})]})]}),(_a||vr.length>0)&&s.jsxs("div",{className:"shrink-0 z-[44]",children:[s.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:()=>ua(R=>!R),children:[_a?s.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):s.jsx("span",{className:"shrink-0",children:"✅"}),s.jsx("span",{className:"flex-1",children:_a||"Knowledge import finished"}),Ur&&s.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Ur.index/Ur.total*100}%`,background:"#fff"}})}),s.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:ir?"▲":"▼"})]}),ir&&s.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:[vr.map(R=>s.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[R.type==="scan"&&"🔍",R.type==="process"&&"⚙️",R.type==="created"&&"✅",R.type==="done"&&"🎉",R.type==="error"&&"❌"]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{style:{color:R.type==="error"?"#EF4444":R.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:R.text}),R.detail&&s.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:R.detail})]})]},R.id)),s.jsx("div",{ref:qr}),vr.length===0&&s.jsx("div",{className:"px-5 py-4 text-center",style:{color:"var(--terminal-text-muted)"},children:"Waiting for events..."})]})]}),s.jsxs("div",{className:"flex-1 overflow-hidden flex relative",children:[s.jsx("div",{className:"flex-1 overflow-y-auto relative floor-grid",style:{background:"var(--floor-light)"},children:Mr==="iso"?s.jsx(YN,{roles:a,projects:c,waves:x,standups:d,decisions:y,roleStatuses:ha,activeExecs:Fe,onRoleClick:R=>I({type:"role",roleId:R}),onProjectClick:R=>I({type:"project",projectId:R}),onBulletinClick:()=>I({type:"bulletin"}),onDecisionsClick:()=>I({type:"decisions"}),onKnowledgeClick:()=>I({type:"knowledge"}),onSettingsClick:()=>jl(!0),onThemeClick:()=>sn(R=>!R),onStatsClick:()=>br(!0),knowledgeDocsCount:b.length,getRoleSpeech:Qr.getSpeech,getAppearance:yt,onHireClick:()=>Vt(!0),onMascotClick:()=>I({type:"bulletin"}),roleLevels:oe}):s.jsxs("div",{className:`${wr?"max-w-full":"max-w-[1100px]"} mx-auto h-full p-4 flex flex-col gap-3 relative z-[1]`,children:[(()=>{const R=a.filter(ie=>ie.level==="c-level"),ae=a.filter(ie=>ie.level!=="c-level");return s.jsxs(s.Fragment,{children:[R.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"pixel-section-label",children:"LEADERSHIP"}),s.jsx("div",{className:`grid gap-2 ${R.length===1?"grid-cols-1":"grid-cols-2"}`,children:R.map(ie=>{var me,ve;return s.jsx(gy,{role:ie,speech:Qr.getSpeech(ie.id),onClick:()=>I({type:"role",roleId:ie.id}),liveStatus:ha[ie.id],activeTask:(me=Ne[ie.id])==null?void 0:me.task,featured:!0,appearance:yt(ie.id),xpLevel:(ve=oe[ie.id])==null?void 0:ve.level},ie.id)})})]}),s.jsx("div",{className:"pixel-section-label",children:"TEAM"}),s.jsxs("div",{className:`grid gap-2 ${wr?"grid-cols-3":"grid-cols-4"}`,children:[ae.map(ie=>{var me,ve;return s.jsx(gy,{role:ie,speech:Qr.getSpeech(ie.id),onClick:()=>I({type:"role",roleId:ie.id}),liveStatus:ha[ie.id],activeTask:(me=Ne[ie.id])==null?void 0:me.task,appearance:yt(ie.id),xpLevel:(ve=oe[ie.id])==null?void 0:ve.level},ie.id)}),s.jsx("div",{className:"pixel-card pixel-card--hire",onClick:()=>Vt(!0),children:s.jsxs("div",{className:"pixel-card--hire-inner",children:[s.jsx("span",{className:"pixel-card--hire-icon",children:"+"}),s.jsx("span",{className:"pixel-card--hire-label",children:"HIRE NEW ROLE"})]})})]})]})})(),s.jsx("div",{className:"pixel-section-label mt-1",children:"OFFICE"}),s.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[s.jsxs("div",{className:"facility-card-compact",onClick:zn?()=>I({type:"project",projectId:zn.id}):void 0,style:zn?void 0:{borderStyle:"dashed",opacity:.5},children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#3B82F6"},children:["🏢"," MEETING ROOM"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(Lc,{type:"meeting"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"Projects, PRDs, and task boards"}),zn?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"fcc-title",children:['"',zn.name,'"']}),s.jsxs("div",{className:"fcc-meta",children:["Status: ",s.jsx("strong",{style:{color:"var(--active-green)"},children:zn.status})]})]}):s.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No active projects"})]})]}),s.jsxs("div",{className:"facility-card-compact",onClick:()=>I({type:"bulletin"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#64748b"},children:["📋"," BULLETIN"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(Lc,{type:"bulletin"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"Waves and daily standups"}),x.slice(0,1).map(R=>s.jsxs("div",{className:"fcc-item",children:["Wave ",R.id]},R.id)),d.slice(0,1).map(R=>s.jsxs("div",{className:"fcc-item",children:["Standup ",R.date]},R.date)),x.length===0&&d.length===0&&s.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No entries yet"})]})]}),s.jsxs("div",{className:"facility-card-compact",onClick:()=>I({type:"decisions"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#EF4444"},children:["📜"," DECISIONS"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(Lc,{type:"decision"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"CEO strategic decision log"}),s.jsxs("div",{className:"fcc-title",children:[y.length," decisions"]}),y.slice(0,2).map(R=>s.jsxs("div",{className:"fcc-item",children:["#",R.id," ",R.title]},R.id))]})]}),s.jsxs("div",{className:"facility-card-compact",onClick:()=>I({type:"knowledge"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#0D9488"},children:["📚"," KNOWLEDGE"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(Lc,{type:"knowledge"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"Research, analysis, and references"}),s.jsxs("div",{className:"fcc-title",children:[b.length," docs"]}),b.slice(0,2).map(R=>s.jsx("div",{className:"fcc-item",children:R.title},R.id))]})]})]})]})}),wr&&s.jsx("div",{className:ti?"absolute inset-0 z-50":"contents",children:s.jsx(gE,{sessions:en,activeSessionId:fa,roles:a,streamingSessionId:Ba,width:ti?bo:Xr,onWidthChange:ti?void 0:Fr,onSwitchSession:Dn,onCloseSession:So,onCreateSession:es,onClearEmpty:ts,onCloseAll:Co,onSendMessage:or,onModeChange:ns,onCloseTerminal:()=>sr(!1),chatChannels:cn.channels,activeChatChannelId:cn.activeChannelId,onSwitchChatChannel:cn.setActiveChannelId,onCreateChatChannel:cn.createChannel,onDeleteChatChannel:cn.deleteChannel,onUpdateChatMembers:cn.updateMembers,onUpdateChatTopic:cn.updateTopic,unreadChannels:cn.unreadChannels})})]}),s.jsxs("div",{className:"flex items-center justify-between px-5 py-2 bg-[var(--hud-bg)] text-[var(--terminal-text-secondary)] text-[10px] shrink-0 z-[45]",style:{borderTop:"3px solid var(--pixel-border)"},children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>da("card"),className:`view-toggle-btn ${Mr==="card"?"active":""}`,children:"CARD"}),s.jsx("button",{onClick:()=>da("iso"),className:`view-toggle-btn ${Mr==="iso"?"active":""}`,children:"OFFICE"}),s.jsx("span",{className:"mx-1",children:"|"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsxs("button",{className:`theme-btn${lr?" active":""}`,onClick:()=>sn(R=>!R),title:"Office Theme",children:[((rs=bl[Yt])==null?void 0:rs.icon)??"","▾"]}),lr&&s.jsx(t6,{theme:Yt,onThemeChange:oa,onClose:()=>sn(!1)})]}),s.jsx("button",{className:"theme-btn",onClick:()=>jl(!0),title:"Settings",children:"⚙"}),s.jsx("span",{className:"mx-1",children:"|"}),s.jsxs("button",{onClick:()=>{tt.state==="no-git"||tt.state==="dirty"?Jt(!0):be(!0)},title:tt.state==="dirty"?`${tt.dirtyCount} unsaved — click to save`:"Git Status",style:{background:"none",border:"none",cursor:"pointer",fontSize:10,fontFamily:"var(--pixel-font)",color:"var(--terminal-text-muted)",display:"flex",alignItems:"center",gap:4},children:[s.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:tt.state==="no-git"?"var(--terminal-text-muted)":tt.state==="saving"||tt.state==="dirty"?"var(--idle-amber)":tt.state==="error"?"#EF5350":"var(--active-green)",animation:tt.state==="saving"?"pulse 1s infinite":void 0}}),s.jsx("span",{style:{color:tt.state==="dirty"?"var(--idle-amber)":"var(--terminal-text-muted)"},children:tt.state==="no-git"?"No git":tt.state==="saving"?"Saving...":tt.state==="dirty"?`${tt.dirtyCount} unsaved`:"Saved"}),Gt&&(Gt.worktrees.length>0||Gt.staleBranches.length>0)&&s.jsxs("span",{style:{color:Gt.worktrees.some(R=>R.status==="stale")?"#ff6b6b":Gt.worktrees.some(R=>R.status==="pending-merge")?"#FFB74D":"#4FC3F7"},children:["·"," ","📂"," ",Gt.worktrees.length," worktree",Gt.worktrees.length!==1?"s":"",Gt.staleBranches.length>0&&` · ⚠ ${Gt.staleBranches.length} branch${Gt.staleBranches.length!==1?"es":""}`]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[xe&&ge&&s.jsx("button",{onClick:()=>Me(!1),className:`px-3 py-1 font-black text-white cursor-pointer ${Ee?"":"animate-pulse"}`,style:{background:Ee?"#2E7D32":"#B71C1C",border:`2px solid ${Ee?"#1b5e2088":"#7f121288"}`,fontFamily:"var(--pixel-font)",borderRadius:4},children:Ee?"WAVE DONE":"WAVE"}),M.length>0&&ne&&s.jsxs("button",{onClick:()=>we(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:M[M.length-1].color,border:`2px solid ${M[M.length-1].color}88`,fontFamily:"var(--pixel-font)",borderRadius:4},children:[M[M.length-1].title.slice(0,20),M[M.length-1].title.length>20?"..":""]}),s.jsxs("button",{onClick:()=>V(!0),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"]}),s.jsx("button",{onClick:()=>wr?sr(!1):Ji(),className:"px-3 py-1 font-black cursor-pointer","data-quest-target":"terminal-btn",style:{background:wr?"var(--terminal-bg)":"var(--hud-bg-alt)",color:"var(--terminal-text)",border:`2px solid ${wr?"var(--terminal-border-hover)":"var(--pixel-border)"}`,fontFamily:"var(--pixel-font)"},children:"TERMINAL"})]})]}),B.type==="role"&&F&&(()=>{var ae;const R=Ne[F.id];return s.jsx(NS,{role:F,allRoles:a,recentActivity:Eo(F.id),onClose:ma,onFireRole:(ie,me)=>{he({roleId:ie,roleName:me}),ma()},terminalWidth:wr?Xr:0,activeJobId:R==null?void 0:R.id,activeTask:R==null?void 0:R.task,isWorking:ha[F.id]==="working",jobStartedAt:R==null?void 0:R.startedAt,onStopJob:ie=>Se.abortJob(ie),sessions:en,streamingSessionId:Ba,onCreateSessionSilent:La,onSendMessage:or,onFocusTerminal:Ha,onCustomize:ie=>{const me=a.find(ve=>ve.id===ie);me&&(Rt("character"),Ue(me))},onUpdateRole:kr,appearance:yt(F.id),relationships:Qr.relationships,roleLevel:(ae=oe[F.id])==null?void 0:ae.level})})(),B.type==="project"&&zn&&s.jsx(zC,{projectId:zn.id,onClose:ma,terminalWidth:wr?Xr:0}),(B.type==="bulletin"||B.type==="decisions")&&s.jsx(TC,{standups:d,waves:x,decisions:y,mode:B.type==="bulletin"?"bulletin":"decisions",onClose:ma,terminalWidth:wr?Xr:0,questProgress:_e,onQuestAction:R=>{ma();const ie={"ch1-q1":"hire-btn","ch3-q1":"hire-btn","ch4-q1":"hire-btn","ch2-q1":"meeting-room","ch2-q2":"terminal-btn","ch3-q2":"terminal-btn","ch4-q2":"wave-btn","ch5-q1":"hire-btn","ch5-q2":"hire-btn"}[R];ie&&wo(ie)}}),B.type==="knowledge"&&s.jsx(NC,{docs:b,onClose:ma,onRefresh:()=>Se.getKnowledge().then(v).catch(()=>{}),terminalWidth:wr?Xr:0,initialDocId:B.docId}),W&&s.jsx(FC,{roleId:W.roleId,roleName:W.roleName,mode:W.mode,onClose:()=>U(null),onExecutionStart:Zi}),xe&&!ge&&s.jsx(UC,{directive:xe.directive,rootJobs:xe.rootJobs,orgNodes:T,rootRoleId:Z,onClose:()=>{Ce(null),Me(!1),Ie(!1)},onMinimize:()=>Me(!0),onDone:()=>{Sl(),Ie(!0),Mt("Wave complete — review & save results","#2E7D32")},onSave:async R=>{try{await Se.saveWave({directive:xe.directive,jobIds:R}),Sl(),Mt("Wave saved to bulletin","#2E7D32")}catch(ae){Mt(`Save failed: ${ae instanceof Error?ae.message:"unknown"}`,"#C62828")}},onOpenKnowledgeDoc:R=>{Ce(null),Me(!1),Ie(!1),I({type:"knowledge",docId:R}),Se.getKnowledge().then(v).catch(()=>{})}}),M.length>0&&!ne&&(()=>{var ie;const R=M[M.length-1],ae=J.length>1;return s.jsxs(s.Fragment,{children:[ae&&M.length===1&&s.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((me,ve)=>s.jsx("button",{onClick:()=>{Y(ve),G([{jobId:me.jobId,title:`CEO WAVE · ${me.roleId.toUpperCase()}`,color:"#B71C1C"}])},className:"px-3 py-1.5 text-xs font-bold rounded-t-lg cursor-pointer transition-colors",style:{background:H===ve?"#B71C1C":"var(--terminal-bg)",color:H===ve?"#fff":"var(--terminal-text-secondary)",border:`1px solid ${H===ve?"#B71C1C":"var(--terminal-border)"}`,borderBottom:"none"},children:me.roleId.toUpperCase()},me.jobId))}),s.jsx(_C,{jobId:R.jobId,title:M.length>1?R.title:ae?`CEO WAVE · ${((ie=J[H])==null?void 0:ie.roleName)??""}`:R.title,color:R.color,variant:"modal",style:ae&&M.length===1?{marginTop:28}:void 0,onClose:()=>{G([]),Q([]),Y(0),we(!1)},onMinimize:()=>we(!0),onDone:()=>{xu(),Sl()},onNavigateToJob:me=>{Se.getJob(me).then(ve=>{const Ke=Kc[ve.roleId]??"#888";G(ht=>[...ht,{jobId:me,title:`${ve.roleId.toUpperCase()} · ${ve.task.slice(0,40)}`,color:Ke}])}).catch(console.error)},onOpenKnowledgeDoc:me=>{G([]),Q([]),Y(0),we(!1),I({type:"knowledge",docId:me}),Se.getKnowledge().then(v).catch(()=>{})}},R.jobId)]})})(),M.length>1&&s.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[62] pointer-events-none",children:s.jsx("div",{className:"pointer-events-auto",children:s.jsxs("button",{onClick:()=>G(R=>R.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 ",(Rn=M[M.length-2])==null?void 0:Rn.title]})})}),O&&s.jsx(BC,{cLevelRoles:a.filter(R=>R.level==="c-level"),orgNodes:T,rootId:Z,onClose:()=>V(!1),onDispatch:jo}),jt&&s.jsx(QC,{existingRoles:a,onClose:()=>Vt(!1),onHire:pu,onStoreVisit:()=>Vr({type:"store_visited"})}),pe&&s.jsx(ZC,{roleId:pe.roleId,roleName:pe.roleName,onClose:()=>he(null),onConfirm:ni}),P&&s.jsx(XN,{role:P,appearance:yt(P.id),onSave:R=>{st(P.id,R),Vr({type:"accessory_changed"})},onReset:()=>bn(P.id),onClose:()=>{Ue(null),Rt("character")},theme:Yt,onThemeChange:oa,onUpdateName:async(R,ae)=>{await kr(R,{name:ae})},initialTab:"character",characterOnly:!0,speechSettings:$n,onSpeechSettingsChange:ln,language:Xn,onLanguageChange:Ln,roleLevel:(Wr=oe[P.id])==null?void 0:Wr.level}),Pt&&(()=>{const R=a.find(ae=>ae.id==="cto")??a.find(ae=>ae.level==="c-level")??a[0];return s.jsx(QN,{status:tt.status,history:tt.history,onClose:()=>Jt(!1),onSave:async ae=>await tt.save(ae),onLoadHistory:tt.loadHistory,onRestore:tt.restore,saving:tt.state==="saving",repo:tt.repo,onRepoChange:tt.setRepo,syncInfo:tt.syncInfo,onPull:tt.pull,pulling:tt.pulling,onRefresh:tt.refresh,onInitGit:tt.initGit,delegateRoleName:(R==null?void 0:R.name)??(R==null?void 0:R.id),onDelegate:R?async ae=>{Jt(!1);try{const ie=await Se.createSession(R.id,"do");Qt(ve=>[ie,...ve]),Dn(ie.id),sr(!0);const me=`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.
|
|
95
|
+
|
|
96
|
+
Changed files:
|
|
97
|
+
${ae}`;or(ie.id,me,"do")}catch(ie){Mt(`Failed to delegate: ${ie instanceof Error?ie.message:"error"}`,"#B71C1C")}}:void 0})})(),An&&s.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>br(!1),children:s.jsx("div",{style:{width:420,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8},onClick:R=>R.stopPropagation(),children:s.jsx(WN,{onClose:()=>br(!1)})})}),Jl&&s.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>Hn(!1),children:s.jsx("div",{style:{width:480,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8,overflowY:"auto"},onClick:R=>R.stopPropagation(),children:s.jsx(PN,{onClose:()=>Hn(!1),onSyncComplete:()=>{}})})}),Cn&&s.jsx(e6,{onClose:()=>jl(!1),speechSettings:$n,onSpeechSettingsChange:ln,language:Xn,onLanguageChange:Ln,onOpenSync:()=>Hn(!0),onOpenGitStatus:()=>be(!0),onOpenStats:()=>br(!0)}),Tn&&s.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>be(!1),children:s.jsx("div",{style:{width:520,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8,overflowY:"auto"},onClick:R=>R.stopPropagation(),children:s.jsx(JN,{onClose:()=>be(!1)})})}),s.jsx("div",{className:"fixed top-16 right-4 z-[70] flex flex-col gap-2",children:ze.map(R=>s.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:R.color,border:"2px solid rgba(0,0,0,0.3)",fontFamily:"var(--pixel-font)"},children:[s.jsx("div",{className:"w-2 h-2 bg-white/60"}),R.message]},R.id))})]})}function gy({role:e,speech:r,onClick:a,liveStatus:i,activeTask:c,featured:u,appearance:d,xpLevel:m}){const x=Kc[e.id]??i6(e.id),f=m??1,y=l6[e.id]??e.name,g=i==="working",b=g&&c?c:r||y;return s.jsxs("div",{className:`pixel-card ${g?"working":""} ${u?"pixel-card--featured":""}`,onClick:a,children:[s.jsxs("div",{className:"pixel-card-hdr",style:{background:x},children:[s.jsxs("span",{children:[e.id.toUpperCase()," ","·"," ",e.name.toUpperCase()]}),s.jsxs("span",{className:"lvl",children:["Lv.",f]})]}),s.jsxs("div",{className:"pixel-card-body",children:[s.jsx("div",{className:"pixel-desk"}),s.jsx(uo,{roleId:e.id,appearance:d}),s.jsx("div",{className:"pixel-status-dot",style:{background:g?"var(--idle-amber)":"var(--active-green)"}})]}),s.jsxs("div",{className:"pixel-card-task",children:[s.jsx("span",{className:"pixel-card-task-icon",children:g?"🛠️":a6[e.id]??"👤"}),s.jsx("span",{className:"pixel-card-task-text",children:b||y})]})]})}function eo({onSelect:e,onClose:r}){const[a,i]=w.useState(null),[c,u]=w.useState(!0),d=w.useCallback(async m=>{u(!0);try{const x=await Se.browse(m);i(x)}catch{}finally{u(!1)}},[]);return w.useEffect(()=>{d()},[d]),c&&!a?s.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?s.jsxs("div",{className:"mt-3 rounded-lg overflow-hidden text-xs",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",maxHeight:220,overflowY:"auto"},children:[s.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 sticky top-0",style:{background:"var(--terminal-surface)",borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx("span",{style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},className:"truncate flex-1",children:a.current}),s.jsx("button",{onClick:()=>e(a.current),className:"px-2 py-1 rounded text-[10px] font-medium shrink-0",style:{background:"var(--active-green)",color:"#fff"},children:"Select"}),s.jsx("button",{onClick:r,className:"opacity-50 hover:opacity-100 shrink-0",style:{color:"var(--terminal-text)"},children:"✕"})]}),a.parent&&s.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:()=>d(a.parent),children:[s.jsx("span",{children:"⬆️"}),s.jsx("span",{children:".."})]}),a.dirs.map(m=>s.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:()=>d(m.path),children:[s.jsx("span",{children:"📁"}),s.jsx("span",{children:m.name})]},m.path)),a.dirs.length===0&&s.jsx("div",{className:"px-3 py-3 text-center",style:{color:"var(--terminal-text-muted)"},children:"No subdirectories"})]}):null}const o6={engine:"AI Engine",company:"Company Info",project:"Project",knowledge:"Knowledge",team:"Team Template",create:"Create"};function by(e){switch(e){case"skip":return["engine","company","project","knowledge","team","create"];case"import":return["engine","company","project","knowledge","team","create"];case"existing-akb":return["engine","knowledge","create"]}}function c6({onComplete:e}){const[r,a]=w.useState(0),[i,c]=w.useState(null),[u,d]=w.useState("none"),[m,x]=w.useState(""),[f,y]=w.useState(!0),[g,b]=w.useState(""),[v,S]=w.useState(""),[j,C]=w.useState("auto"),[E,N]=w.useState(""),[_,B]=w.useState(""),[I,F]=w.useState(!1),[X,W]=w.useState(!1),U=w.useRef(null),[M,G]=w.useState("fresh"),[O,V]=w.useState(""),[J,Q]=w.useState(null),[H,Y]=w.useState(!1),[ne,we]=w.useState(!1),[T,z]=w.useState(""),[Z,D]=w.useState(null),[xe,Ce]=w.useState(!1),[ge,Me]=w.useState(!1),[Ee,Ie]=w.useState("skip"),[oe,at]=w.useState([]),[Ct,jt]=w.useState(""),[Vt,pe]=w.useState(!1),[he,ke]=w.useState(""),[Ae,Fe]=w.useState(null),[Re,Ne]=w.useState(!1),[ze,Pe]=w.useState(!1),[_e,et]=w.useState([]),[re,ye]=w.useState("startup"),[De,He]=w.useState(!1),[de,Te]=w.useState(!1),[wt,it]=w.useState(null),[rt,yt]=w.useState([]),[st,bn]=w.useState(""),[Yt,oa]=w.useState(!1),$n=w.useMemo(()=>by(Ee),[Ee]),ln=$n[r]??"engine";w.useEffect(()=>{Se.detectEngine().then(be=>{c(be),d(be.recommended),y(!1)}).catch(()=>y(!1)),Se.getTeams().then(et).catch(()=>{}),Se.getStatus().then(be=>{B(be.companyRoot||"")}).catch(()=>{})},[]),w.useEffect(()=>{var be;ln==="company"&&((be=U.current)==null||be.focus())},[ln]),w.useEffect(()=>{if(I||!_)return;const be=g.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");N(be?`${_}/${be}`:_)},[g,_,I]);const Xn=()=>{switch(ln){case"engine":return u!=="none"||m.length>10;case"company":return g.trim().length>0;case"project":return M==="fresh"||M==="existing"&&J===!0;case"knowledge":return Ee==="existing-akb"?Ae===!0:Ee==="import"?oe.length>0:!0;case"team":return!0;case"create":return!de;default:return!1}},Ln=()=>{r<$n.length-1&&Xn()&&a(r+1),ln==="create"&&!De&&!Yt&&(Ee==="existing-akb"?An():Jt())},P=()=>{r>0&&a(r-1)};w.useEffect(()=>{const be=by(Ee);r>=be.length&&a(be.length-1)},[Ee,r]);const Ue=async()=>{if(O.trim()){Y(!0);try{const be=await Se.validatePath(O.trim());Q(be.valid)}catch{Q(!1)}finally{Y(!1)}}},Rt=async()=>{if(T.trim()){Ce(!0);try{const be=await Se.validatePath(T.trim());D(be.valid)}catch{D(!1)}finally{Ce(!1)}}},tt=async()=>{if(he.trim()){Ne(!0);try{const be=await Se.validatePath(he.trim());Fe(be.valid&&be.hasClaudeMd===!0)}catch{Fe(!1)}finally{Ne(!1)}}},Pt=()=>{const be=Ct.trim();be&&!oe.includes(be)&&(at([...oe,be]),jt(""))},Jt=async()=>{He(!0),it(null);try{const be={companyName:g.trim(),description:v.trim()||"An AI-powered organization",team:re,existingProjectPath:M==="existing"?O.trim():void 0,knowledgePaths:Ee==="import"&&oe.length>0?oe:void 0,language:j!=="auto"?j:void 0,location:E.trim()||void 0,codeRoot:T.trim()||void 0};(u==="direct-api"||m)&&(be.apiKey=m||void 0);const Cn=await Se.scaffold(be);yt(Cn.created),bn(Cn.projectRoot),Te(!0)}catch(be){it(be instanceof Error?be.message:"Scaffold failed")}finally{He(!1)}},An=async()=>{oa(!0),it(null);try{const be=await Se.connectAkb(he.trim());be.ok?(Te(!0),yt([`Connected to: ${be.companyRoot}`])):it(be.error||"Failed to connect")}catch(be){it(be instanceof Error?be.message:"Connect failed")}finally{oa(!1)}},br=()=>{Ee==="import"&&oe.length>0?e({paths:oe,companyRoot:""}):e()},Jl=be=>{be.key==="Enter"&&Xn()&&(be.preventDefault(),Ln())},Hn=`w-full px-3 py-2 rounded text-sm outline-none transition-colors
|
|
98
|
+
bg-[var(--terminal-bg)] text-[var(--terminal-text)]
|
|
99
|
+
border border-[var(--terminal-border)]
|
|
100
|
+
focus:border-[var(--terminal-border-hover)]
|
|
101
|
+
placeholder:text-[var(--terminal-text-muted)]`,Tn=be=>`p-4 rounded-lg border-2 cursor-pointer transition-all text-[var(--terminal-text)] ${be?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--terminal-border)] bg-[var(--hud-bg-alt)] hover:border-[var(--accent)]/50"}`;return s.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},onKeyDown:Jl,children:s.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:[s.jsxs("div",{className:"px-6 py-5",style:{background:"var(--terminal-bg)",borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx("div",{className:"text-lg font-bold",style:{color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"},children:"tycono"}),s.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-secondary)"},children:"Build an AI company. Watch them work."}),s.jsx("div",{className:"flex gap-1.5 mt-4",children:$n.map((be,Cn)=>s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"h-1 rounded-full transition-colors",style:{background:Cn<=r?"var(--accent)":"var(--terminal-surface-light)"}}),s.jsx("div",{className:"text-[9px] mt-1 truncate",style:{color:Cn===r?"var(--terminal-text)":"var(--terminal-text-muted)"},children:o6[be]})]},be))})]}),s.jsxs("div",{className:"px-6 py-5 min-h-[280px]",children:[ln==="engine"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"AI Engine Setup"}),f?s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:"Detecting AI engine..."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:Tn(u==="claude-cli"),onClick:()=>(i==null?void 0:i.claudeCli)&&d("claude-cli"),style:{opacity:i!=null&&i.claudeCli?1:.4},children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-lg",children:i!=null&&i.claudeCli?"✅":"❌"}),s.jsxs("div",{children:[s.jsx("div",{className:"font-medium text-sm",children:"Claude Code CLI"}),s.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"})]})]})}),s.jsxs("div",{className:Tn(u==="direct-api"),onClick:()=>d("direct-api"),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-lg",children:i!=null&&i.apiKey?"✅":"🔑"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"font-medium text-sm",children:"Anthropic API Key (BYOK)"}),s.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)&&s.jsx("input",{type:"password",className:`${Hn} mt-3`,placeholder:"sk-ant-...",value:m,onChange:be=>x(be.target.value),autoFocus:!0})]})]})]}),ln==="company"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Company Info"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Company Name *"}),s.jsx("input",{ref:U,className:Hn,placeholder:"e.g. Acme Corp",value:g,onChange:be=>b(be.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Description"}),s.jsx("textarea",{className:`${Hn} resize-none`,rows:3,placeholder:"What does your AI company do?",value:v,onChange:be=>S(be.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Location"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${Hn} flex-1`,placeholder:"/path/to/your-company",value:E,onChange:be=>{N(be.target.value),F(!0)}}),s.jsx("button",{onClick:()=>W(!X),className:"px-3 py-2 rounded text-xs font-medium transition-colors shrink-0",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},title:"Browse folders",children:"📁"})]}),s.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--terminal-text-muted)"},children:"Where your AI company files will be created."}),X&&s.jsx(eo,{onSelect:be=>{N(be),F(!0),W(!1)},onClose:()=>W(!1)})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"AI Response Language"}),s.jsxs("select",{className:Hn,value:j,onChange:be=>C(be.target.value),children:[s.jsx("option",{value:"auto",children:"Auto"}),s.jsx("option",{value:"en",children:"English"}),s.jsx("option",{value:"ko",children:"한국어"}),s.jsx("option",{value:"ja",children:"日本語"})]})]})]}),ln==="project"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Project Setup"}),s.jsxs("div",{className:Tn(M==="fresh"),onClick:()=>{G("fresh"),Q(null)},children:[s.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Create a new AI company from scratch with clean directory structure."})]}),s.jsxs("div",{className:Tn(M==="existing"),onClick:()=>G("existing"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["📂"," Connect Existing Project"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Add AI company structure to an existing codebase or knowledge base."}),M==="existing"&&s.jsxs("div",{className:"mt-3",onClick:be=>be.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${Hn} flex-1`,placeholder:"/path/to/your/project",value:O,onChange:be=>{V(be.target.value),Q(null)},autoFocus:!0}),s.jsx("button",{onClick:()=>we(!ne),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),s.jsx("button",{onClick:Ue,disabled:H||!O.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:H||!O.trim()?.5:1},children:H?"...":"Verify"})]}),J===!0&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Path verified: ",O]}),J===!1&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," Invalid path"]}),ne&&s.jsx(eo,{onSelect:be=>{V(be),Q(!0),we(!1)},onClose:()=>we(!1)})]})]}),s.jsxs("div",{style:{borderTop:"1px solid var(--terminal-border)",paddingTop:16},children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Code Repository (optional)"}),s.jsx("div",{className:"text-[10px] mb-2",style:{color:"var(--terminal-text-muted)"},children:"Connect a separate code repo. AKB and code will be managed independently."}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${Hn} flex-1`,placeholder:"/path/to/code/repo",value:T,onChange:be=>{z(be.target.value),D(null)}}),s.jsx("button",{onClick:()=>Me(!ge),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),T.trim()&&s.jsx("button",{onClick:Rt,disabled:xe,className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:xe?.5:1},children:xe?"...":"Verify"})]}),Z===!0&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Path verified: ",T]}),Z===!1&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," Invalid path"]}),ge&&s.jsx(eo,{onSelect:be=>{z(be),D(!0),Me(!1)},onClose:()=>Me(!1)})]})]}),ln==="knowledge"&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Knowledge Strategy"}),s.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"How should AI handle your knowledge base?"}),s.jsxs("div",{className:Tn(Ee==="skip"),onClick:()=>Ie("skip"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Empty knowledge base. Add documents later from the office."})]}),s.jsxs("div",{className:Tn(Ee==="import"),onClick:()=>Ie("import"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["📚"," Import & Build"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Select folders with documents — AI reads, summarizes, and organizes them."}),Ee==="import"&&s.jsxs("div",{className:"mt-3 space-y-2",onClick:be=>be.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${Hn} flex-1`,placeholder:"/path/to/docs",value:Ct,onChange:be=>jt(be.target.value),onKeyDown:be=>{be.key==="Enter"&&(be.preventDefault(),Pt())},autoFocus:!0}),s.jsx("button",{onClick:()=>pe(!Vt),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),s.jsx("button",{onClick:Pt,disabled:!Ct.trim(),className:"px-3 py-2 rounded text-xs font-medium",style:{background:"var(--accent)",color:"#fff",opacity:Ct.trim()?1:.5},children:"Add"})]}),Vt&&s.jsx(eo,{onSelect:be=>{oe.includes(be)||at([...oe,be]),pe(!1)},onClose:()=>pe(!1)}),oe.length>0&&s.jsx("div",{className:"space-y-1",children:oe.map((be,Cn)=>s.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:[s.jsx("span",{className:"flex-1 truncate",style:{fontFamily:"var(--pixel-font)"},children:be}),s.jsx("button",{onClick:()=>at(oe.filter((jl,lr)=>lr!==Cn)),className:"opacity-50 hover:opacity-100",children:"✕"})]},Cn))}),oe.length===0&&s.jsx("div",{className:"text-[10px] text-center py-2",style:{color:"var(--terminal-text-muted)"},children:"Add at least one folder to import."})]})]}),s.jsxs("div",{className:Tn(Ee==="existing-akb"),onClick:()=>Ie("existing-akb"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["🔗"," Connect Existing AKB"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Connect a directory that already has CLAUDE.md and AKB structure."}),Ee==="existing-akb"&&s.jsxs("div",{className:"mt-3",onClick:be=>be.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${Hn} flex-1`,placeholder:"/path/to/your/akb",value:he,onChange:be=>{ke(be.target.value),Fe(null)},autoFocus:!0}),s.jsx("button",{onClick:()=>Pe(!ze),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),s.jsx("button",{onClick:tt,disabled:Re||!he.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:Re||!he.trim()?.5:1},children:Re?"...":"Verify"})]}),Ae===!0&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Valid AKB found: ",he]}),Ae===!1&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," No valid AKB (CLAUDE.md required)"]}),ze&&s.jsx(eo,{onSelect:be=>{ke(be),Fe(null),Pe(!1)},onClose:()=>Pe(!1)})]})]})]}),ln==="team"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Team Template"}),s.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"Choose a starting team. You can add or remove roles later."}),_e.map(be=>s.jsxs("div",{className:Tn(re===be.id),onClick:()=>ye(be.id),children:[s.jsx("div",{className:"font-medium text-sm capitalize",children:be.id}),s.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:be.roles.map(Cn=>s.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:Cn.name},Cn.id))})]},be.id)),s.jsxs("div",{className:Tn(re==="custom"),onClick:()=>ye("custom"),children:[s.jsx("div",{className:"font-medium text-sm",children:"Custom"}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Start with no pre-built roles. Hire them from the office."})]})]}),ln==="create"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:de?Ee==="existing-akb"?"AKB Connected!":"Company Created!":"Review & Create"}),!de&&!De&&!Yt&&s.jsxs(s.Fragment,{children:[s.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:Ee==="existing-akb"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Mode:"})," Connect Existing AKB"]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Path:"})," ",he]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Company:"})," ",g]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Location:"})," ",E||"(default)"]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Project:"})," ",M==="fresh"?"Start Fresh":`Existing (${O})`]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Knowledge:"})," ",Ee==="skip"?"Fresh (empty)":`Import ${oe.length} source(s)`]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Team:"})," ",re]}),Ee==="import"&&oe.length>0&&s.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--idle-amber)"},children:"Knowledge import will run in the background after entering the office."})]})}),wt&&s.jsx("div",{className:"text-xs p-3 rounded",style:{background:"rgba(220,38,38,0.15)",color:"#f87171"},children:wt})]}),(De||Yt)&&s.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[s.jsx("div",{className:"w-8 h-8 border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:Yt?"Connecting to AKB...":"Scaffolding your company..."})]}),de&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-center py-4 text-4xl",children:"🏢"}),st&&s.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:[s.jsx("span",{className:"opacity-50",children:"Location:"})," ",st]}),s.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:rt.map((be,Cn)=>s.jsxs("div",{className:"py-0.5",children:[s.jsx("span",{style:{color:"var(--active-green)"},children:"✓"})," ",be]},Cn))}),Ee==="import"&&oe.length>0&&s.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."})]})]})]}),s.jsxs("div",{className:"px-6 py-4 flex justify-between items-center",style:{borderTop:"1px solid var(--terminal-border)"},children:[s.jsx("div",{children:r>0&&!de&&s.jsx("button",{onClick:P,className:"px-4 py-2 rounded text-sm transition-colors",style:{color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Back"})}),s.jsxs("div",{className:"text-xs",style:{color:"var(--terminal-text-muted)"},children:[r+1," / ",$n.length]}),s.jsx("div",{children:de?s.jsx("button",{onClick:br,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:"var(--active-green)",color:"#fff"},children:"Enter Office"}):s.jsx("button",{onClick:Ln,disabled:!Xn()||De||Yt,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:Xn()?"var(--accent)":"var(--terminal-border)",color:"#fff",opacity:Xn()&&!De&&!Yt?1:.5},children:ln==="create"?De||Yt?Yt?"Connecting...":"Creating...":Ee==="existing-akb"?"Connect AKB":"Create Company":"Next"})})]})]})})}function u6(){const[e,r]=w.useState(null),[a,i]=w.useState(!0),[c,u]=w.useState(null),d=w.useCallback(async()=>{i(!0),u(null);try{const m=await Se.getStatus();r(m)}catch(m){u(m instanceof Error?m.message:"Failed to fetch status")}finally{i(!1)}},[]);return w.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:c,refetch:d}}const d6=w.lazy(()=>yv(()=>import("./preview-app-qIFqrb-y.js"),[]));function fb(){return s.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-10 h-10 mx-auto border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),s.jsx("div",{className:"mt-4 text-sm",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Loading..."})]})})}function f6(){var e;try{const r=localStorage.getItem("tycono-theme"),a=r&&r in bl?r:"default",i=(e=bl[a])==null?void 0:e.vars;if(!i)return;const c=document.documentElement;for(const[u,d]of Object.entries(i))c.style.setProperty(u,d)}catch{}}function h6(){const{initialized:e,loading:r,refetch:a}=u6(),[i,c]=w.useState(null);w.useEffect(()=>{f6()},[]);const u=d=>{d&&c(d),a()};return r?s.jsx(fb,{}):e?s.jsx(s6,{importJob:i,onImportDone:()=>c(null)}):s.jsx(c6,{onComplete:u})}function m6(){const e=new URLSearchParams(window.location.search).has("sprite-preview");return s.jsx(gv,{children:e?s.jsx(w.Suspense,{fallback:s.jsx(fb,{}),children:s.jsx(d6,{})}):s.jsx(h6,{})})}mv.createRoot(document.getElementById("root")).render(s.jsx(w.StrictMode,{children:s.jsx(m6,{})}));export{Xg as H,Gg as P,Qg as S,y6 as a,Vg as b,Yg as c,gh as d,Wj as e,Qj as f,p6 as g,Kj as h,s as j,w as r};
|