tycono 0.1.8 → 0.1.10
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/create-server.ts +6 -2
- package/src/api/src/engine/org-tree.ts +20 -0
- package/src/api/src/engine/role-lifecycle.ts +9 -1
- package/src/api/src/routes/execute.ts +13 -4
- package/src/api/src/routes/knowledge.ts +20 -8
- package/src/api/src/utils/role-level.ts +14 -0
- package/src/web/dist/assets/{index-BxDf0CSf.css → index-BaLxr7Du.css} +1 -1
- package/src/web/dist/assets/index-D1NrKtsx.js +96 -0
- package/src/web/dist/assets/{preview-app-DfJ0nbgX.js → preview-app-CGBZJEYG.js} +1 -1
- package/src/web/dist/index.html +2 -2
- package/src/web/dist/assets/index-FesWAu2a.js +0 -95
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
var Db=Object.defineProperty;var Tb=(t,l,a)=>l in t?Db(t,l,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[l]=a;var Zp=(t,l,a)=>Tb(t,typeof l!="symbol"?l+"":l,a);(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&i(f)}).observe(document,{childList:!0,subtree:!0});function a(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(o){if(o.ep)return;o.ep=!0;const u=a(o);fetch(o.href,u)}})();function O0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Lf={exports:{}},rs={};/**
|
|
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 Wp;function zb(){if(Wp)return rs;Wp=1;var t=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function a(i,o,u){var f=null;if(u!==void 0&&(f=""+u),o.key!==void 0&&(f=""+o.key),"key"in o){u={};for(var m in o)m!=="key"&&(u[m]=o[m])}else u=o;return o=u.ref,{$$typeof:t,type:i,key:f,ref:o!==void 0?o:null,props:u}}return rs.Fragment=l,rs.jsx=a,rs.jsxs=a,rs}var Jp;function Mb(){return Jp||(Jp=1,Lf.exports=zb()),Lf.exports}var c=Mb(),$f={exports:{}},Ye={};/**
|
|
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 Pp;function _b(){if(Pp)return Ye;Pp=1;var t=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),f=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function v(_){return _===null||typeof _!="object"?null:(_=b&&_[b]||_["@@iterator"],typeof _=="function"?_:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,C={};function E(_,P,A){this.props=_,this.context=P,this.refs=C,this.updater=A||j}E.prototype.isReactComponent={},E.prototype.setState=function(_,P){if(typeof _!="object"&&typeof _!="function"&&_!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,_,P,"setState")},E.prototype.forceUpdate=function(_){this.updater.enqueueForceUpdate(this,_,"forceUpdate")};function M(){}M.prototype=E.prototype;function H(_,P,A){this.props=_,this.context=P,this.refs=C,this.updater=A||j}var B=H.prototype=new M;B.constructor=H,k(B,E.prototype),B.isPureReactComponent=!0;var U=Array.isArray;function D(){}var Y={H:null,A:null,T:null,S:null},V=Object.prototype.hasOwnProperty;function ne(_,P,A){var pe=A.ref;return{$$typeof:t,type:_,key:P,ref:pe!==void 0?pe:null,props:A}}function T(_,P){return ne(_.type,P,_.props)}function L(_){return typeof _=="object"&&_!==null&&_.$$typeof===t}function $(_){var P={"=":"=0",":":"=2"};return"$"+_.replace(/[=:]/g,function(A){return P[A]})}var ee=/\/+/g;function ae(_,P){return typeof _=="object"&&_!==null&&_.key!=null?$(""+_.key):P.toString(36)}function X(_){switch(_.status){case"fulfilled":return _.value;case"rejected":throw _.reason;default:switch(typeof _.status=="string"?_.then(D,D):(_.status="pending",_.then(function(P){_.status==="pending"&&(_.status="fulfilled",_.value=P)},function(P){_.status==="pending"&&(_.status="rejected",_.reason=P)})),_.status){case"fulfilled":return _.value;case"rejected":throw _.reason}}throw _}function I(_,P,A,pe,Ee){var Ne=typeof _;(Ne==="undefined"||Ne==="boolean")&&(_=null);var Oe=!1;if(_===null)Oe=!0;else switch(Ne){case"bigint":case"string":case"number":Oe=!0;break;case"object":switch(_.$$typeof){case t:case l:Oe=!0;break;case g:return Oe=_._init,I(Oe(_._payload),P,A,pe,Ee)}}if(Oe)return Ee=Ee(_),Oe=pe===""?"."+ae(_,0):pe,U(Ee)?(A="",Oe!=null&&(A=Oe.replace(ee,"$&/")+"/"),I(Ee,P,A,"",function(K){return K})):Ee!=null&&(L(Ee)&&(Ee=T(Ee,A+(Ee.key==null||_&&_.key===Ee.key?"":(""+Ee.key).replace(ee,"$&/")+"/")+Oe)),P.push(Ee)),1;Oe=0;var Be=pe===""?".":pe+":";if(U(_))for(var oe=0;oe<_.length;oe++)pe=_[oe],Ne=Be+ae(pe,oe),Oe+=I(pe,P,A,Ne,Ee);else if(oe=v(_),typeof oe=="function")for(_=oe.call(_),oe=0;!(pe=_.next()).done;)pe=pe.value,Ne=Be+ae(pe,oe++),Oe+=I(pe,P,A,Ne,Ee);else if(Ne==="object"){if(typeof _.then=="function")return I(X(_),P,A,pe,Ee);throw P=String(_),Error("Objects are not valid as a React child (found: "+(P==="[object Object]"?"object with keys {"+Object.keys(_).join(", ")+"}":P)+"). If you meant to render a collection of children, use an array instead.")}return Oe}function Q(_,P,A){if(_==null)return _;var pe=[],Ee=0;return I(_,pe,"","",function(Ne){return P.call(A,Ne,Ee++)}),pe}function ie(_){if(_._status===-1){var P=_._result;P=P(),P.then(function(A){(_._status===0||_._status===-1)&&(_._status=1,_._result=A)},function(A){(_._status===0||_._status===-1)&&(_._status=2,_._result=A)}),_._status===-1&&(_._status=0,_._result=P)}if(_._status===1)return _._result.default;throw _._result}var Se=typeof reportError=="function"?reportError:function(_){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var P=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof _=="object"&&_!==null&&typeof _.message=="string"?String(_.message):String(_),error:_});if(!window.dispatchEvent(P))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",_);return}console.error(_)},z={map:Q,forEach:function(_,P,A){Q(_,function(){P.apply(this,arguments)},A)},count:function(_){var P=0;return Q(_,function(){P++}),P},toArray:function(_){return Q(_,function(P){return P})||[]},only:function(_){if(!L(_))throw Error("React.Children.only expected to receive a single React element child.");return _}};return Ye.Activity=y,Ye.Children=z,Ye.Component=E,Ye.Fragment=a,Ye.Profiler=o,Ye.PureComponent=H,Ye.StrictMode=i,Ye.Suspense=p,Ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Y,Ye.__COMPILER_RUNTIME={__proto__:null,c:function(_){return Y.H.useMemoCache(_)}},Ye.cache=function(_){return function(){return _.apply(null,arguments)}},Ye.cacheSignal=function(){return null},Ye.cloneElement=function(_,P,A){if(_==null)throw Error("The argument must be a React element, but you passed "+_+".");var pe=k({},_.props),Ee=_.key;if(P!=null)for(Ne in P.key!==void 0&&(Ee=""+P.key),P)!V.call(P,Ne)||Ne==="key"||Ne==="__self"||Ne==="__source"||Ne==="ref"&&P.ref===void 0||(pe[Ne]=P[Ne]);var Ne=arguments.length-2;if(Ne===1)pe.children=A;else if(1<Ne){for(var Oe=Array(Ne),Be=0;Be<Ne;Be++)Oe[Be]=arguments[Be+2];pe.children=Oe}return ne(_.type,Ee,pe)},Ye.createContext=function(_){return _={$$typeof:f,_currentValue:_,_currentValue2:_,_threadCount:0,Provider:null,Consumer:null},_.Provider=_,_.Consumer={$$typeof:u,_context:_},_},Ye.createElement=function(_,P,A){var pe,Ee={},Ne=null;if(P!=null)for(pe in P.key!==void 0&&(Ne=""+P.key),P)V.call(P,pe)&&pe!=="key"&&pe!=="__self"&&pe!=="__source"&&(Ee[pe]=P[pe]);var Oe=arguments.length-2;if(Oe===1)Ee.children=A;else if(1<Oe){for(var Be=Array(Oe),oe=0;oe<Oe;oe++)Be[oe]=arguments[oe+2];Ee.children=Be}if(_&&_.defaultProps)for(pe in Oe=_.defaultProps,Oe)Ee[pe]===void 0&&(Ee[pe]=Oe[pe]);return ne(_,Ne,Ee)},Ye.createRef=function(){return{current:null}},Ye.forwardRef=function(_){return{$$typeof:m,render:_}},Ye.isValidElement=L,Ye.lazy=function(_){return{$$typeof:g,_payload:{_status:-1,_result:_},_init:ie}},Ye.memo=function(_,P){return{$$typeof:h,type:_,compare:P===void 0?null:P}},Ye.startTransition=function(_){var P=Y.T,A={};Y.T=A;try{var pe=_(),Ee=Y.S;Ee!==null&&Ee(A,pe),typeof pe=="object"&&pe!==null&&typeof pe.then=="function"&&pe.then(D,Se)}catch(Ne){Se(Ne)}finally{P!==null&&A.types!==null&&(P.types=A.types),Y.T=P}},Ye.unstable_useCacheRefresh=function(){return Y.H.useCacheRefresh()},Ye.use=function(_){return Y.H.use(_)},Ye.useActionState=function(_,P,A){return Y.H.useActionState(_,P,A)},Ye.useCallback=function(_,P){return Y.H.useCallback(_,P)},Ye.useContext=function(_){return Y.H.useContext(_)},Ye.useDebugValue=function(){},Ye.useDeferredValue=function(_,P){return Y.H.useDeferredValue(_,P)},Ye.useEffect=function(_,P){return Y.H.useEffect(_,P)},Ye.useEffectEvent=function(_){return Y.H.useEffectEvent(_)},Ye.useId=function(){return Y.H.useId()},Ye.useImperativeHandle=function(_,P,A){return Y.H.useImperativeHandle(_,P,A)},Ye.useInsertionEffect=function(_,P){return Y.H.useInsertionEffect(_,P)},Ye.useLayoutEffect=function(_,P){return Y.H.useLayoutEffect(_,P)},Ye.useMemo=function(_,P){return Y.H.useMemo(_,P)},Ye.useOptimistic=function(_,P){return Y.H.useOptimistic(_,P)},Ye.useReducer=function(_,P,A){return Y.H.useReducer(_,P,A)},Ye.useRef=function(_){return Y.H.useRef(_)},Ye.useState=function(_){return Y.H.useState(_)},Ye.useSyncExternalStore=function(_,P,A){return Y.H.useSyncExternalStore(_,P,A)},Ye.useTransition=function(){return Y.H.useTransition()},Ye.version="19.2.4",Ye}var e1;function Vd(){return e1||(e1=1,$f.exports=_b()),$f.exports}var S=Vd(),Hf={exports:{}},is={},Uf={exports:{}},If={};/**
|
|
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 t1;function Fb(){return t1||(t1=1,(function(t){function l(I,Q){var ie=I.length;I.push(Q);e:for(;0<ie;){var Se=ie-1>>>1,z=I[Se];if(0<o(z,Q))I[Se]=Q,I[ie]=z,ie=Se;else break e}}function a(I){return I.length===0?null:I[0]}function i(I){if(I.length===0)return null;var Q=I[0],ie=I.pop();if(ie!==Q){I[0]=ie;e:for(var Se=0,z=I.length,_=z>>>1;Se<_;){var P=2*(Se+1)-1,A=I[P],pe=P+1,Ee=I[pe];if(0>o(A,ie))pe<z&&0>o(Ee,A)?(I[Se]=Ee,I[pe]=ie,Se=pe):(I[Se]=A,I[P]=ie,Se=P);else if(pe<z&&0>o(Ee,ie))I[Se]=Ee,I[pe]=ie,Se=pe;else break e}}return Q}function o(I,Q){var ie=I.sortIndex-Q.sortIndex;return ie!==0?ie:I.id-Q.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var f=Date,m=f.now();t.unstable_now=function(){return f.now()-m}}var p=[],h=[],g=1,y=null,b=3,v=!1,j=!1,k=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,H=typeof setImmediate<"u"?setImmediate:null;function B(I){for(var Q=a(h);Q!==null;){if(Q.callback===null)i(h);else if(Q.startTime<=I)i(h),Q.sortIndex=Q.expirationTime,l(p,Q);else break;Q=a(h)}}function U(I){if(k=!1,B(I),!j)if(a(p)!==null)j=!0,D||(D=!0,$());else{var Q=a(h);Q!==null&&X(U,Q.startTime-I)}}var D=!1,Y=-1,V=5,ne=-1;function T(){return C?!0:!(t.unstable_now()-ne<V)}function L(){if(C=!1,D){var I=t.unstable_now();ne=I;var Q=!0;try{e:{j=!1,k&&(k=!1,M(Y),Y=-1),v=!0;var ie=b;try{t:{for(B(I),y=a(p);y!==null&&!(y.expirationTime>I&&T());){var Se=y.callback;if(typeof Se=="function"){y.callback=null,b=y.priorityLevel;var z=Se(y.expirationTime<=I);if(I=t.unstable_now(),typeof z=="function"){y.callback=z,B(I),Q=!0;break t}y===a(p)&&i(p),B(I)}else i(p);y=a(p)}if(y!==null)Q=!0;else{var _=a(h);_!==null&&X(U,_.startTime-I),Q=!1}}break e}finally{y=null,b=ie,v=!1}Q=void 0}}finally{Q?$():D=!1}}}var $;if(typeof H=="function")$=function(){H(L)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,ae=ee.port2;ee.port1.onmessage=L,$=function(){ae.postMessage(null)}}else $=function(){E(L,0)};function X(I,Q){Y=E(function(){I(t.unstable_now())},Q)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(I){I.callback=null},t.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<I?Math.floor(1e3/I):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(I){switch(b){case 1:case 2:case 3:var Q=3;break;default:Q=b}var ie=b;b=Q;try{return I()}finally{b=ie}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(I,Q){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var ie=b;b=I;try{return Q()}finally{b=ie}},t.unstable_scheduleCallback=function(I,Q,ie){var Se=t.unstable_now();switch(typeof ie=="object"&&ie!==null?(ie=ie.delay,ie=typeof ie=="number"&&0<ie?Se+ie:Se):ie=Se,I){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=ie+z,I={id:g++,callback:Q,priorityLevel:I,startTime:ie,expirationTime:z,sortIndex:-1},ie>Se?(I.sortIndex=ie,l(h,I),a(p)===null&&I===a(h)&&(k?(M(Y),Y=-1):k=!0,X(U,ie-Se))):(I.sortIndex=z,l(p,I),j||v||(j=!0,D||(D=!0,$()))),I},t.unstable_shouldYield=T,t.unstable_wrapCallback=function(I){var Q=b;return function(){var ie=b;b=Q;try{return I.apply(this,arguments)}finally{b=ie}}}})(If)),If}var n1;function Rb(){return n1||(n1=1,Uf.exports=Fb()),Uf.exports}var Yf={exports:{}},dn={};/**
|
|
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 l1;function Ob(){if(l1)return dn;l1=1;var t=Vd();function l(p){var h="https://react.dev/errors/"+p;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+p+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var i={d:{f:a,r:function(){throw Error(l(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},o=Symbol.for("react.portal");function u(p,h,g){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:p,containerInfo:h,implementation:g}}var f=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(p,h){if(p==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return dn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,dn.createPortal=function(p,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(l(299));return u(p,h,null,g)},dn.flushSync=function(p){var h=f.T,g=i.p;try{if(f.T=null,i.p=2,p)return p()}finally{f.T=h,i.p=g,i.d.f()}},dn.preconnect=function(p,h){typeof p=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,i.d.C(p,h))},dn.prefetchDNS=function(p){typeof p=="string"&&i.d.D(p)},dn.preinit=function(p,h){if(typeof p=="string"&&h&&typeof h.as=="string"){var g=h.as,y=m(g,h.crossOrigin),b=typeof h.integrity=="string"?h.integrity:void 0,v=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?i.d.S(p,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:v}):g==="script"&&i.d.X(p,{crossOrigin:y,integrity:b,fetchPriority:v,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},dn.preinitModule=function(p,h){if(typeof p=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=m(h.as,h.crossOrigin);i.d.M(p,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&i.d.M(p)},dn.preload=function(p,h){if(typeof p=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,y=m(g,h.crossOrigin);i.d.L(p,g,{crossOrigin:y,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},dn.preloadModule=function(p,h){if(typeof p=="string")if(h){var g=m(h.as,h.crossOrigin);i.d.m(p,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else i.d.m(p)},dn.requestFormReset=function(p){i.d.r(p)},dn.unstable_batchedUpdates=function(p,h){return p(h)},dn.useFormState=function(p,h,g){return f.H.useFormState(p,h,g)},dn.useFormStatus=function(){return f.H.useHostTransitionStatus()},dn.version="19.2.4",dn}var a1;function Bb(){if(a1)return Yf.exports;a1=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(l){console.error(l)}}return t(),Yf.exports=Ob(),Yf.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 r1;function Lb(){if(r1)return is;r1=1;var t=Rb(),l=Vd(),a=Bb();function i(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)n+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var n=e,r=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(r=n.return),e=n.return;while(e)}return n.tag===3?r:null}function f(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(u(e)!==e)throw Error(i(188))}function h(e){var n=e.alternate;if(!n){if(n=u(e),n===null)throw Error(i(188));return n!==e?null:e}for(var r=e,s=n;;){var d=r.return;if(d===null)break;var x=d.alternate;if(x===null){if(s=d.return,s!==null){r=s;continue}break}if(d.child===x.child){for(x=d.child;x;){if(x===r)return p(d),e;if(x===s)return p(d),n;x=x.sibling}throw Error(i(188))}if(r.return!==s.return)r=d,s=x;else{for(var w=!1,N=d.child;N;){if(N===r){w=!0,r=d,s=x;break}if(N===s){w=!0,s=d,r=x;break}N=N.sibling}if(!w){for(N=x.child;N;){if(N===r){w=!0,r=x,s=d;break}if(N===s){w=!0,s=x,r=d;break}N=N.sibling}if(!w)throw Error(i(189))}}if(r.alternate!==s)throw Error(i(190))}if(r.tag!==3)throw Error(i(188));return r.stateNode.current===r?e:n}function g(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=g(e),n!==null)return n;e=e.sibling}return null}var y=Object.assign,b=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),H=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),ne=Symbol.for("react.activity"),T=Symbol.for("react.memo_cache_sentinel"),L=Symbol.iterator;function $(e){return e===null||typeof e!="object"?null:(e=L&&e[L]||e["@@iterator"],typeof e=="function"?e:null)}var ee=Symbol.for("react.client.reference");function ae(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ee?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case k:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case U:return"Suspense";case D:return"SuspenseList";case ne:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case j:return"Portal";case H:return e.displayName||"Context";case M:return(e._context.displayName||"Context")+".Consumer";case B:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Y:return n=e.displayName||null,n!==null?n:ae(e.type)||"Memo";case V:n=e._payload,e=e._init;try{return ae(e(n))}catch{}}return null}var X=Array.isArray,I=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},Se=[],z=-1;function _(e){return{current:e}}function P(e){0>z||(e.current=Se[z],Se[z]=null,z--)}function A(e,n){z++,Se[z]=e.current,e.current=n}var pe=_(null),Ee=_(null),Ne=_(null),Oe=_(null);function Be(e,n){switch(A(Ne,n),A(Ee,e),A(pe,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?bp(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=bp(n),e=vp(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}P(pe),A(pe,e)}function oe(){P(pe),P(Ee),P(Ne)}function K(e){e.memoizedState!==null&&A(Oe,e);var n=pe.current,r=vp(n,e.type);n!==r&&(A(Ee,e),A(pe,r))}function ue(e){Ee.current===e&&(P(pe),P(Ee)),Oe.current===e&&(P(Oe),ts._currentValue=ie)}var je,te;function ve(e){if(je===void 0)try{throw Error()}catch(r){var n=r.stack.trim().match(/\n( *(at )?)/);je=n&&n[1]||"",te=-1<r.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+je+e+te}var Ce=!1;function Ae(e,n){if(!e||Ce)return"";Ce=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(n){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(le){var J=le}Reflect.construct(e,[],fe)}else{try{fe.call()}catch(le){J=le}e.call(fe.prototype)}}else{try{throw Error()}catch(le){J=le}(fe=e())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(le){if(le&&J&&typeof le.stack=="string")return[le.stack,J.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=s.DetermineComponentFrameRoot(),w=x[0],N=x[1];if(w&&N){var O=w.split(`
|
|
44
|
-
`),W=N.split(`
|
|
45
|
-
`);for(d=s=0;s<O.length&&!O[s].includes("DetermineComponentFrameRoot");)s++;for(;d<W.length&&!W[d].includes("DetermineComponentFrameRoot");)d++;if(s===O.length||d===W.length)for(s=O.length-1,d=W.length-1;1<=s&&0<=d&&O[s]!==W[d];)d--;for(;1<=s&&0<=d;s--,d--)if(O[s]!==W[d]){if(s!==1||d!==1)do if(s--,d--,0>d||O[s]!==W[d]){var se=`
|
|
46
|
-
`+O[s].replace(" at new "," at ");return e.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",e.displayName)),se}while(1<=s&&0<=d);break}}}finally{Ce=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?ve(r):""}function ze(e,n){switch(e.tag){case 26:case 27:case 5:return ve(e.type);case 16:return ve("Lazy");case 13:return e.child!==n&&n!==null?ve("Suspense Fallback"):ve("Suspense");case 19:return ve("SuspenseList");case 0:case 15:return Ae(e.type,!1);case 11:return Ae(e.type.render,!1);case 1:return Ae(e.type,!0);case 31:return ve("Activity");default:return""}}function qe(e){try{var n="",r=null;do n+=ze(e,r),r=e,e=e.return;while(e);return n}catch(s){return`
|
|
47
|
-
Error generating stack: `+s.message+`
|
|
48
|
-
`+s.stack}}var kt=Object.prototype.hasOwnProperty,Rt=t.unstable_scheduleCallback,ft=t.unstable_cancelCallback,Lt=t.unstable_shouldYield,un=t.unstable_requestPaint,gt=t.unstable_now,qt=t.unstable_getCurrentPriorityLevel,re=t.unstable_ImmediatePriority,ye=t.unstable_UserBlockingPriority,Fe=t.unstable_NormalPriority,xe=t.unstable_LowPriority,ke=t.unstable_IdlePriority,bt=t.log,At=t.unstable_setDisableYieldValue,Ze=null,he=null;function ut(e){if(typeof bt=="function"&&At(e),he&&typeof he.setStrictMode=="function")try{he.setStrictMode(Ze,e)}catch{}}var dt=Math.clz32?Math.clz32:Fc,wn=Math.log,tt=Math.LN2;function Fc(e){return e>>>=0,e===0?32:31-(wn(e)/tt|0)|0}var Jl=256,ll=262144,Pl=4194304;function kn(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function al(e,n,r){var s=e.pendingLanes;if(s===0)return 0;var d=0,x=e.suspendedLanes,w=e.pingedLanes;e=e.warmLanes;var N=s&134217727;return N!==0?(s=N&~x,s!==0?d=kn(s):(w&=N,w!==0?d=kn(w):r||(r=N&~e,r!==0&&(d=kn(r))))):(N=s&~x,N!==0?d=kn(N):w!==0?d=kn(w):r||(r=s&~e,r!==0&&(d=kn(r)))),d===0?0:n!==0&&n!==d&&(n&x)===0&&(x=d&-d,r=n&-n,x>=r||x===32&&(r&4194048)!==0)?n:d}function qn(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function Fs(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Al(){var e=Pl;return Pl<<=1,(Pl&62914560)===0&&(Pl=4194304),e}function hr(e){for(var n=[],r=0;31>r;r++)n.push(e);return n}function ea(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ii(e,n,r,s,d,x){var w=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var N=e.entanglements,O=e.expirationTimes,W=e.hiddenUpdates;for(r=w&~r;0<r;){var se=31-dt(r),fe=1<<se;N[se]=0,O[se]=-1;var J=W[se];if(J!==null)for(W[se]=null,se=0;se<J.length;se++){var le=J[se];le!==null&&(le.lane&=-536870913)}r&=~fe}s!==0&&si(e,s,0),x!==0&&d===0&&e.tag!==0&&(e.suspendedLanes|=x&~(w&~n))}function si(e,n,r){e.pendingLanes|=n,e.suspendedLanes&=~n;var s=31-dt(n);e.entangledLanes|=n,e.entanglements[s]=e.entanglements[s]|1073741824|r&261930}function oi(e,n){var r=e.entangledLanes|=n;for(e=e.entanglements;r;){var s=31-dt(r),d=1<<s;d&n|e[s]&n&&(e[s]|=n),r&=~d}}function ml(e,n){var r=n&-n;return r=(r&42)!==0?1:La(r),(r&(e.suspendedLanes|n))!==0?0:r}function La(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function mr(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ci(){var e=Q.p;return e!==0?e:(e=window.event,e===void 0?32:Yp(e.type))}function Rs(e,n){var r=Q.p;try{return Q.p=e,n()}finally{Q.p=r}}var Xn=Math.random().toString(36).slice(2),St="__reactFiber$"+Xn,Xt="__reactProps$"+Xn,Vn="__reactContainer$"+Xn,ui="__reactEvents$"+Xn,xr="__reactListeners$"+Xn,fn="__reactHandles$"+Xn,$a="__reactResources$"+Xn,pn="__reactMarker$"+Xn;function pr(e){delete e[St],delete e[Xt],delete e[ui],delete e[xr],delete e[fn]}function xl(e){var n=e[St];if(n)return n;for(var r=e.parentNode;r;){if(n=r[Vn]||r[St]){if(r=n.alternate,n.child!==null||r!==null&&r.child!==null)for(e=Np(e);e!==null;){if(r=e[St])return r;e=Np(e)}return n}e=r,r=e.parentNode}return null}function ta(e){if(e=e[St]||e[Vn]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function rl(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(i(33))}function na(e){var n=e[$a];return n||(n=e[$a]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function et(e){e[pn]=!0}var fi=new Set,Os={};function Dl(e,n){Tl(e,n),Tl(e+"Capture",n)}function Tl(e,n){for(Os[e]=n,e=0;e<n.length;e++)fi.add(n[e])}var di=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]*$"),Bs={},Ls={};function $s(e){return kt.call(Ls,e)?!0:kt.call(Bs,e)?!1:di.test(e)?Ls[e]=!0:(Bs[e]=!0,!1)}function yr(e,n,r){if($s(n))if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var s=n.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+r)}}function gr(e,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+r)}}function il(e,n,r,s){if(s===null)e.removeAttribute(r);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttributeNS(n,r,""+s)}}function Sn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Hs(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Rc(e,n,r){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var d=s.get,x=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return d.call(this)},set:function(w){r=""+w,x.call(this,w)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return r},setValue:function(w){r=""+w},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function hi(e){if(!e._valueTracker){var n=Hs(e)?"checked":"value";e._valueTracker=Rc(e,n,""+e[n])}}function sl(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var r=n.getValue(),s="";return e&&(s=Hs(e)?e.checked?"true":"false":e.value),e=s,e!==r?(n.setValue(e),!0):!1}function Ha(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Oc=/[\n"\\]/g;function jn(e){return e.replace(Oc,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Gn(e,n,r,s,d,x,w,N){e.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.type=w:e.removeAttribute("type"),n!=null?w==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Sn(n)):e.value!==""+Sn(n)&&(e.value=""+Sn(n)):w!=="submit"&&w!=="reset"||e.removeAttribute("value"),n!=null?xi(e,w,Sn(n)):r!=null?xi(e,w,Sn(r)):s!=null&&e.removeAttribute("value"),d==null&&x!=null&&(e.defaultChecked=!!x),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+Sn(N):e.removeAttribute("name")}function mi(e,n,r,s,d,x,w,N){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.type=x),n!=null||r!=null){if(!(x!=="submit"&&x!=="reset"||n!=null)){hi(e);return}r=r!=null?""+Sn(r):"",n=n!=null?""+Sn(n):r,N||n===e.value||(e.value=n),e.defaultValue=n}s=s??d,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=N?e.checked:!!s,e.defaultChecked=!!s,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(e.name=w),hi(e)}function xi(e,n,r){n==="number"&&Ha(e.ownerDocument)===e||e.defaultValue===""+r||(e.defaultValue=""+r)}function la(e,n,r,s){if(e=e.options,n){n={};for(var d=0;d<r.length;d++)n["$"+r[d]]=!0;for(r=0;r<e.length;r++)d=n.hasOwnProperty("$"+e[r].value),e[r].selected!==d&&(e[r].selected=d),d&&s&&(e[r].defaultSelected=!0)}else{for(r=""+Sn(r),n=null,d=0;d<e.length;d++){if(e[d].value===r){e[d].selected=!0,s&&(e[d].defaultSelected=!0);return}n!==null||e[d].disabled||(n=e[d])}n!==null&&(n.selected=!0)}}function Pt(e,n,r){if(n!=null&&(n=""+Sn(n),n!==e.value&&(e.value=n),r==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=r!=null?""+Sn(r):""}function aa(e,n,r,s){if(n==null){if(s!=null){if(r!=null)throw Error(i(92));if(X(s)){if(1<s.length)throw Error(i(93));s=s[0]}r=s}r==null&&(r=""),n=r}r=Sn(n),e.defaultValue=r,s=e.textContent,s===r&&s!==""&&s!==null&&(e.value=s),hi(e)}function zl(e,n){if(n){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=n;return}}e.textContent=n}var Us=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 pi(e,n,r){var s=n.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?s?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":s?e.setProperty(n,r):typeof r!="number"||r===0||Us.has(n)?n==="float"?e.cssFloat=r:e[n]=(""+r).trim():e[n]=r+"px"}function yi(e,n,r){if(n!=null&&typeof n!="object")throw Error(i(62));if(e=e.style,r!=null){for(var s in r)!r.hasOwnProperty(s)||n!=null&&n.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var d in n)s=n[d],n.hasOwnProperty(d)&&r[d]!==s&&pi(e,d,s)}else for(var x in n)n.hasOwnProperty(x)&&pi(e,x,n[x])}function R(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var de=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"]]),me=/^[\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 ge(e){return me.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function be(){}var Me=null;function $e(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Xe=null,We=null;function Ve(e){var n=ta(e);if(n&&(e=n.stateNode)){var r=e[Xt]||null;e:switch(e=n.stateNode,n.type){case"input":if(Gn(e,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),n=r.name,r.type==="radio"&&n!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+jn(""+n)+'"][type="radio"]'),n=0;n<r.length;n++){var s=r[n];if(s!==e&&s.form===e.form){var d=s[Xt]||null;if(!d)throw Error(i(90));Gn(s,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(n=0;n<r.length;n++)s=r[n],s.form===e.form&&sl(s)}break e;case"textarea":Pt(e,r.value,r.defaultValue);break e;case"select":n=r.value,n!=null&&la(e,!!r.multiple,n,!1)}}}var Ot=!1;function bh(e,n,r){if(Ot)return e(n,r);Ot=!0;try{var s=e(n);return s}finally{if(Ot=!1,(Xe!==null||We!==null)&&(Do(),Xe&&(n=Xe,e=We,We=Xe=null,Ve(n),e)))for(n=0;n<e.length;n++)Ve(e[n])}}function gi(e,n){var r=e.stateNode;if(r===null)return null;var s=r[Xt]||null;if(s===null)return null;r=s[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(i(231,n,typeof r));return r}var Ml=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Bc=!1;if(Ml)try{var bi={};Object.defineProperty(bi,"passive",{get:function(){Bc=!0}}),window.addEventListener("test",bi,bi),window.removeEventListener("test",bi,bi)}catch{Bc=!1}var ra=null,Lc=null,Is=null;function vh(){if(Is)return Is;var e,n=Lc,r=n.length,s,d="value"in ra?ra.value:ra.textContent,x=d.length;for(e=0;e<r&&n[e]===d[e];e++);var w=r-e;for(s=1;s<=w&&n[r-s]===d[x-s];s++);return Is=d.slice(e,1<s?1-s:void 0)}function Ys(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function qs(){return!0}function wh(){return!1}function Cn(e){function n(r,s,d,x,w){this._reactName=r,this._targetInst=d,this.type=s,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(r=e[N],this[N]=r?r(x):x[N]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?qs:wh,this.isPropagationStopped=wh,this}return y(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=qs)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=qs)},persist:function(){},isPersistent:qs}),n}var Ua={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Xs=Cn(Ua),vi=y({},Ua,{view:0,detail:0}),Ng=Cn(vi),$c,Hc,wi,Vs=y({},vi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ic,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==wi&&(wi&&e.type==="mousemove"?($c=e.screenX-wi.screenX,Hc=e.screenY-wi.screenY):Hc=$c=0,wi=e),$c)},movementY:function(e){return"movementY"in e?e.movementY:Hc}}),kh=Cn(Vs),Ag=y({},Vs,{dataTransfer:0}),Dg=Cn(Ag),Tg=y({},vi,{relatedTarget:0}),Uc=Cn(Tg),zg=y({},Ua,{animationName:0,elapsedTime:0,pseudoElement:0}),Mg=Cn(zg),_g=y({},Ua,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Fg=Cn(_g),Rg=y({},Ua,{data:0}),Sh=Cn(Rg),Og={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Bg={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"},Lg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $g(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Lg[e])?!!n[e]:!1}function Ic(){return $g}var Hg=y({},vi,{key:function(e){if(e.key){var n=Og[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Ys(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Bg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ic,charCode:function(e){return e.type==="keypress"?Ys(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ys(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ug=Cn(Hg),Ig=y({},Vs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),jh=Cn(Ig),Yg=y({},vi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ic}),qg=Cn(Yg),Xg=y({},Ua,{propertyName:0,elapsedTime:0,pseudoElement:0}),Vg=Cn(Xg),Gg=y({},Vs,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Kg=Cn(Gg),Qg=y({},Ua,{newState:0,oldState:0}),Zg=Cn(Qg),Wg=[9,13,27,32],Yc=Ml&&"CompositionEvent"in window,ki=null;Ml&&"documentMode"in document&&(ki=document.documentMode);var Jg=Ml&&"TextEvent"in window&&!ki,Ch=Ml&&(!Yc||ki&&8<ki&&11>=ki),Eh=" ",Nh=!1;function Ah(e,n){switch(e){case"keyup":return Wg.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var br=!1;function Pg(e,n){switch(e){case"compositionend":return Dh(n);case"keypress":return n.which!==32?null:(Nh=!0,Eh);case"textInput":return e=n.data,e===Eh&&Nh?null:e;default:return null}}function e2(e,n){if(br)return e==="compositionend"||!Yc&&Ah(e,n)?(e=vh(),Is=Lc=ra=null,br=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Ch&&n.locale!=="ko"?null:n.data;default:return null}}var t2={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 Th(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!t2[e.type]:n==="textarea"}function zh(e,n,r,s){Xe?We?We.push(s):We=[s]:Xe=s,n=Oo(n,"onChange"),0<n.length&&(r=new Xs("onChange","change",null,r,s),e.push({event:r,listeners:n}))}var Si=null,ji=null;function n2(e){hp(e,0)}function Gs(e){var n=rl(e);if(sl(n))return e}function Mh(e,n){if(e==="change")return n}var _h=!1;if(Ml){var qc;if(Ml){var Xc="oninput"in document;if(!Xc){var Fh=document.createElement("div");Fh.setAttribute("oninput","return;"),Xc=typeof Fh.oninput=="function"}qc=Xc}else qc=!1;_h=qc&&(!document.documentMode||9<document.documentMode)}function Rh(){Si&&(Si.detachEvent("onpropertychange",Oh),ji=Si=null)}function Oh(e){if(e.propertyName==="value"&&Gs(ji)){var n=[];zh(n,ji,e,$e(e)),bh(n2,n)}}function l2(e,n,r){e==="focusin"?(Rh(),Si=n,ji=r,Si.attachEvent("onpropertychange",Oh)):e==="focusout"&&Rh()}function a2(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Gs(ji)}function r2(e,n){if(e==="click")return Gs(n)}function i2(e,n){if(e==="input"||e==="change")return Gs(n)}function s2(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var _n=typeof Object.is=="function"?Object.is:s2;function Ci(e,n){if(_n(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var r=Object.keys(e),s=Object.keys(n);if(r.length!==s.length)return!1;for(s=0;s<r.length;s++){var d=r[s];if(!kt.call(n,d)||!_n(e[d],n[d]))return!1}return!0}function Bh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Lh(e,n){var r=Bh(e);e=0;for(var s;r;){if(r.nodeType===3){if(s=e+r.textContent.length,e<=n&&s>=n)return{node:r,offset:n-e};e=s}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Bh(r)}}function $h(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?$h(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Hh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Ha(e.document);n instanceof e.HTMLIFrameElement;){try{var r=typeof n.contentWindow.location.href=="string"}catch{r=!1}if(r)e=n.contentWindow;else break;n=Ha(e.document)}return n}function Vc(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var o2=Ml&&"documentMode"in document&&11>=document.documentMode,vr=null,Gc=null,Ei=null,Kc=!1;function Uh(e,n,r){var s=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Kc||vr==null||vr!==Ha(s)||(s=vr,"selectionStart"in s&&Vc(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Ei&&Ci(Ei,s)||(Ei=s,s=Oo(Gc,"onSelect"),0<s.length&&(n=new Xs("onSelect","select",null,n,r),e.push({event:n,listeners:s}),n.target=vr)))}function Ia(e,n){var r={};return r[e.toLowerCase()]=n.toLowerCase(),r["Webkit"+e]="webkit"+n,r["Moz"+e]="moz"+n,r}var wr={animationend:Ia("Animation","AnimationEnd"),animationiteration:Ia("Animation","AnimationIteration"),animationstart:Ia("Animation","AnimationStart"),transitionrun:Ia("Transition","TransitionRun"),transitionstart:Ia("Transition","TransitionStart"),transitioncancel:Ia("Transition","TransitionCancel"),transitionend:Ia("Transition","TransitionEnd")},Qc={},Ih={};Ml&&(Ih=document.createElement("div").style,"AnimationEvent"in window||(delete wr.animationend.animation,delete wr.animationiteration.animation,delete wr.animationstart.animation),"TransitionEvent"in window||delete wr.transitionend.transition);function Ya(e){if(Qc[e])return Qc[e];if(!wr[e])return e;var n=wr[e],r;for(r in n)if(n.hasOwnProperty(r)&&r in Ih)return Qc[e]=n[r];return e}var Yh=Ya("animationend"),qh=Ya("animationiteration"),Xh=Ya("animationstart"),c2=Ya("transitionrun"),u2=Ya("transitionstart"),f2=Ya("transitioncancel"),Vh=Ya("transitionend"),Gh=new Map,Zc="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(" ");Zc.push("scrollEnd");function ol(e,n){Gh.set(e,n),Dl(n,[e])}var Ks=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Kn=[],kr=0,Wc=0;function Qs(){for(var e=kr,n=Wc=kr=0;n<e;){var r=Kn[n];Kn[n++]=null;var s=Kn[n];Kn[n++]=null;var d=Kn[n];Kn[n++]=null;var x=Kn[n];if(Kn[n++]=null,s!==null&&d!==null){var w=s.pending;w===null?d.next=d:(d.next=w.next,w.next=d),s.pending=d}x!==0&&Kh(r,d,x)}}function Zs(e,n,r,s){Kn[kr++]=e,Kn[kr++]=n,Kn[kr++]=r,Kn[kr++]=s,Wc|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Jc(e,n,r,s){return Zs(e,n,r,s),Ws(e)}function qa(e,n){return Zs(e,null,null,n),Ws(e)}function Kh(e,n,r){e.lanes|=r;var s=e.alternate;s!==null&&(s.lanes|=r);for(var d=!1,x=e.return;x!==null;)x.childLanes|=r,s=x.alternate,s!==null&&(s.childLanes|=r),x.tag===22&&(e=x.stateNode,e===null||e._visibility&1||(d=!0)),e=x,x=x.return;return e.tag===3?(x=e.stateNode,d&&n!==null&&(d=31-dt(r),e=x.hiddenUpdates,s=e[d],s===null?e[d]=[n]:s.push(n),n.lane=r|536870912),x):null}function Ws(e){if(50<Ki)throw Ki=0,of=null,Error(i(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Sr={};function d2(e,n,r,s){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fn(e,n,r,s){return new d2(e,n,r,s)}function Pc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _l(e,n){var r=e.alternate;return r===null?(r=Fn(e.tag,n,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=n,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,n=e.dependencies,r.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function Qh(e,n){e.flags&=65011714;var r=e.alternate;return r===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=r.childLanes,e.lanes=r.lanes,e.child=r.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=r.memoizedProps,e.memoizedState=r.memoizedState,e.updateQueue=r.updateQueue,e.type=r.type,n=r.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Js(e,n,r,s,d,x){var w=0;if(s=e,typeof e=="function")Pc(e)&&(w=1);else if(typeof e=="string")w=yb(e,r,pe.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ne:return e=Fn(31,r,n,d),e.elementType=ne,e.lanes=x,e;case k:return Xa(r.children,d,x,n);case C:w=8,d|=24;break;case E:return e=Fn(12,r,n,d|2),e.elementType=E,e.lanes=x,e;case U:return e=Fn(13,r,n,d),e.elementType=U,e.lanes=x,e;case D:return e=Fn(19,r,n,d),e.elementType=D,e.lanes=x,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case H:w=10;break e;case M:w=9;break e;case B:w=11;break e;case Y:w=14;break e;case V:w=16,s=null;break e}w=29,r=Error(i(130,e===null?"null":typeof e,"")),s=null}return n=Fn(w,r,n,d),n.elementType=e,n.type=s,n.lanes=x,n}function Xa(e,n,r,s){return e=Fn(7,e,s,n),e.lanes=r,e}function eu(e,n,r){return e=Fn(6,e,null,n),e.lanes=r,e}function Zh(e){var n=Fn(18,null,null,0);return n.stateNode=e,n}function tu(e,n,r){return n=Fn(4,e.children!==null?e.children:[],e.key,n),n.lanes=r,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Wh=new WeakMap;function Qn(e,n){if(typeof e=="object"&&e!==null){var r=Wh.get(e);return r!==void 0?r:(n={value:e,source:n,stack:qe(n)},Wh.set(e,n),n)}return{value:e,source:n,stack:qe(n)}}var jr=[],Cr=0,Ps=null,Ni=0,Zn=[],Wn=0,ia=null,pl=1,yl="";function Fl(e,n){jr[Cr++]=Ni,jr[Cr++]=Ps,Ps=e,Ni=n}function Jh(e,n,r){Zn[Wn++]=pl,Zn[Wn++]=yl,Zn[Wn++]=ia,ia=e;var s=pl;e=yl;var d=32-dt(s)-1;s&=~(1<<d),r+=1;var x=32-dt(n)+d;if(30<x){var w=d-d%5;x=(s&(1<<w)-1).toString(32),s>>=w,d-=w,pl=1<<32-dt(n)+d|r<<d|s,yl=x+e}else pl=1<<x|r<<d|s,yl=e}function nu(e){e.return!==null&&(Fl(e,1),Jh(e,1,0))}function lu(e){for(;e===Ps;)Ps=jr[--Cr],jr[Cr]=null,Ni=jr[--Cr],jr[Cr]=null;for(;e===ia;)ia=Zn[--Wn],Zn[Wn]=null,yl=Zn[--Wn],Zn[Wn]=null,pl=Zn[--Wn],Zn[Wn]=null}function Ph(e,n){Zn[Wn++]=pl,Zn[Wn++]=yl,Zn[Wn++]=ia,pl=n.id,yl=n.overflow,ia=e}var rn=null,Mt=null,ot=!1,sa=null,Jn=!1,au=Error(i(519));function oa(e){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ai(Qn(n,e)),au}function em(e){var n=e.stateNode,r=e.type,s=e.memoizedProps;switch(n[St]=e,n[Xt]=s,r){case"dialog":lt("cancel",n),lt("close",n);break;case"iframe":case"object":case"embed":lt("load",n);break;case"video":case"audio":for(r=0;r<Zi.length;r++)lt(Zi[r],n);break;case"source":lt("error",n);break;case"img":case"image":case"link":lt("error",n),lt("load",n);break;case"details":lt("toggle",n);break;case"input":lt("invalid",n),mi(n,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":lt("invalid",n);break;case"textarea":lt("invalid",n),aa(n,s.value,s.defaultValue,s.children)}r=s.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||n.textContent===""+r||s.suppressHydrationWarning===!0||yp(n.textContent,r)?(s.popover!=null&&(lt("beforetoggle",n),lt("toggle",n)),s.onScroll!=null&<("scroll",n),s.onScrollEnd!=null&<("scrollend",n),s.onClick!=null&&(n.onclick=be),n=!0):n=!1,n||oa(e,!0)}function tm(e){for(rn=e.return;rn;)switch(rn.tag){case 5:case 31:case 13:Jn=!1;return;case 27:case 3:Jn=!0;return;default:rn=rn.return}}function Er(e){if(e!==rn)return!1;if(!ot)return tm(e),ot=!0,!1;var n=e.tag,r;if((r=n!==3&&n!==27)&&((r=n===5)&&(r=e.type,r=!(r!=="form"&&r!=="button")||Sf(e.type,e.memoizedProps)),r=!r),r&&Mt&&oa(e),tm(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));Mt=Ep(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));Mt=Ep(e)}else n===27?(n=Mt,ka(e.type)?(e=Af,Af=null,Mt=e):Mt=n):Mt=rn?el(e.stateNode.nextSibling):null;return!0}function Va(){Mt=rn=null,ot=!1}function ru(){var e=sa;return e!==null&&(Dn===null?Dn=e:Dn.push.apply(Dn,e),sa=null),e}function Ai(e){sa===null?sa=[e]:sa.push(e)}var iu=_(null),Ga=null,Rl=null;function ca(e,n,r){A(iu,n._currentValue),n._currentValue=r}function Ol(e){e._currentValue=iu.current,P(iu)}function su(e,n,r){for(;e!==null;){var s=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,s!==null&&(s.childLanes|=n)):s!==null&&(s.childLanes&n)!==n&&(s.childLanes|=n),e===r)break;e=e.return}}function ou(e,n,r,s){var d=e.child;for(d!==null&&(d.return=e);d!==null;){var x=d.dependencies;if(x!==null){var w=d.child;x=x.firstContext;e:for(;x!==null;){var N=x;x=d;for(var O=0;O<n.length;O++)if(N.context===n[O]){x.lanes|=r,N=x.alternate,N!==null&&(N.lanes|=r),su(x.return,r,e),s||(w=null);break e}x=N.next}}else if(d.tag===18){if(w=d.return,w===null)throw Error(i(341));w.lanes|=r,x=w.alternate,x!==null&&(x.lanes|=r),su(w,r,e),w=null}else w=d.child;if(w!==null)w.return=d;else for(w=d;w!==null;){if(w===e){w=null;break}if(d=w.sibling,d!==null){d.return=w.return,w=d;break}w=w.return}d=w}}function Nr(e,n,r,s){e=null;for(var d=n,x=!1;d!==null;){if(!x){if((d.flags&524288)!==0)x=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var w=d.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var N=d.type;_n(d.pendingProps.value,w.value)||(e!==null?e.push(N):e=[N])}}else if(d===Oe.current){if(w=d.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(e!==null?e.push(ts):e=[ts])}d=d.return}e!==null&&ou(n,e,r,s),n.flags|=262144}function eo(e){for(e=e.firstContext;e!==null;){if(!_n(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ka(e){Ga=e,Rl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function sn(e){return nm(Ga,e)}function to(e,n){return Ga===null&&Ka(e),nm(e,n)}function nm(e,n){var r=n._currentValue;if(n={context:n,memoizedValue:r,next:null},Rl===null){if(e===null)throw Error(i(308));Rl=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Rl=Rl.next=n;return r}var h2=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(r,s){e.push(s)}};this.abort=function(){n.aborted=!0,e.forEach(function(r){return r()})}},m2=t.unstable_scheduleCallback,x2=t.unstable_NormalPriority,Kt={$$typeof:H,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function cu(){return{controller:new h2,data:new Map,refCount:0}}function Di(e){e.refCount--,e.refCount===0&&m2(x2,function(){e.controller.abort()})}var Ti=null,uu=0,Ar=0,Dr=null;function p2(e,n){if(Ti===null){var r=Ti=[];uu=0,Ar=mf(),Dr={status:"pending",value:void 0,then:function(s){r.push(s)}}}return uu++,n.then(lm,lm),n}function lm(){if(--uu===0&&Ti!==null){Dr!==null&&(Dr.status="fulfilled");var e=Ti;Ti=null,Ar=0,Dr=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function y2(e,n){var r=[],s={status:"pending",value:null,reason:null,then:function(d){r.push(d)}};return e.then(function(){s.status="fulfilled",s.value=n;for(var d=0;d<r.length;d++)(0,r[d])(n)},function(d){for(s.status="rejected",s.reason=d,d=0;d<r.length;d++)(0,r[d])(void 0)}),s}var am=I.S;I.S=function(e,n){Ux=gt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&p2(e,n),am!==null&&am(e,n)};var Qa=_(null);function fu(){var e=Qa.current;return e!==null?e:Dt.pooledCache}function no(e,n){n===null?A(Qa,Qa.current):A(Qa,n.pool)}function rm(){var e=fu();return e===null?null:{parent:Kt._currentValue,pool:e}}var Tr=Error(i(460)),du=Error(i(474)),lo=Error(i(542)),ao={then:function(){}};function im(e){return e=e.status,e==="fulfilled"||e==="rejected"}function sm(e,n,r){switch(r=e[r],r===void 0?e.push(n):r!==n&&(n.then(be,be),n=r),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,cm(e),e;default:if(typeof n.status=="string")n.then(be,be);else{if(e=Dt,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=n,e.status="pending",e.then(function(s){if(n.status==="pending"){var d=n;d.status="fulfilled",d.value=s}},function(s){if(n.status==="pending"){var d=n;d.status="rejected",d.reason=s}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,cm(e),e}throw Wa=n,Tr}}function Za(e){try{var n=e._init;return n(e._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Wa=r,Tr):r}}var Wa=null;function om(){if(Wa===null)throw Error(i(459));var e=Wa;return Wa=null,e}function cm(e){if(e===Tr||e===lo)throw Error(i(483))}var zr=null,zi=0;function ro(e){var n=zi;return zi+=1,zr===null&&(zr=[]),sm(zr,e,n)}function Mi(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function io(e,n){throw n.$$typeof===b?Error(i(525)):(e=Object.prototype.toString.call(n),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function um(e){function n(G,q){if(e){var Z=G.deletions;Z===null?(G.deletions=[q],G.flags|=16):Z.push(q)}}function r(G,q){if(!e)return null;for(;q!==null;)n(G,q),q=q.sibling;return null}function s(G){for(var q=new Map;G!==null;)G.key!==null?q.set(G.key,G):q.set(G.index,G),G=G.sibling;return q}function d(G,q){return G=_l(G,q),G.index=0,G.sibling=null,G}function x(G,q,Z){return G.index=Z,e?(Z=G.alternate,Z!==null?(Z=Z.index,Z<q?(G.flags|=67108866,q):Z):(G.flags|=67108866,q)):(G.flags|=1048576,q)}function w(G){return e&&G.alternate===null&&(G.flags|=67108866),G}function N(G,q,Z,ce){return q===null||q.tag!==6?(q=eu(Z,G.mode,ce),q.return=G,q):(q=d(q,Z),q.return=G,q)}function O(G,q,Z,ce){var Le=Z.type;return Le===k?se(G,q,Z.props.children,ce,Z.key):q!==null&&(q.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===V&&Za(Le)===q.type)?(q=d(q,Z.props),Mi(q,Z),q.return=G,q):(q=Js(Z.type,Z.key,Z.props,null,G.mode,ce),Mi(q,Z),q.return=G,q)}function W(G,q,Z,ce){return q===null||q.tag!==4||q.stateNode.containerInfo!==Z.containerInfo||q.stateNode.implementation!==Z.implementation?(q=tu(Z,G.mode,ce),q.return=G,q):(q=d(q,Z.children||[]),q.return=G,q)}function se(G,q,Z,ce,Le){return q===null||q.tag!==7?(q=Xa(Z,G.mode,ce,Le),q.return=G,q):(q=d(q,Z),q.return=G,q)}function fe(G,q,Z){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=eu(""+q,G.mode,Z),q.return=G,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case v:return Z=Js(q.type,q.key,q.props,null,G.mode,Z),Mi(Z,q),Z.return=G,Z;case j:return q=tu(q,G.mode,Z),q.return=G,q;case V:return q=Za(q),fe(G,q,Z)}if(X(q)||$(q))return q=Xa(q,G.mode,Z,null),q.return=G,q;if(typeof q.then=="function")return fe(G,ro(q),Z);if(q.$$typeof===H)return fe(G,to(G,q),Z);io(G,q)}return null}function J(G,q,Z,ce){var Le=q!==null?q.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Le!==null?null:N(G,q,""+Z,ce);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case v:return Z.key===Le?O(G,q,Z,ce):null;case j:return Z.key===Le?W(G,q,Z,ce):null;case V:return Z=Za(Z),J(G,q,Z,ce)}if(X(Z)||$(Z))return Le!==null?null:se(G,q,Z,ce,null);if(typeof Z.then=="function")return J(G,q,ro(Z),ce);if(Z.$$typeof===H)return J(G,q,to(G,Z),ce);io(G,Z)}return null}function le(G,q,Z,ce,Le){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return G=G.get(Z)||null,N(q,G,""+ce,Le);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case v:return G=G.get(ce.key===null?Z:ce.key)||null,O(q,G,ce,Le);case j:return G=G.get(ce.key===null?Z:ce.key)||null,W(q,G,ce,Le);case V:return ce=Za(ce),le(G,q,Z,ce,Le)}if(X(ce)||$(ce))return G=G.get(Z)||null,se(q,G,ce,Le,null);if(typeof ce.then=="function")return le(G,q,Z,ro(ce),Le);if(ce.$$typeof===H)return le(G,q,Z,to(q,ce),Le);io(q,ce)}return null}function De(G,q,Z,ce){for(var Le=null,ht=null,_e=q,Ke=q=0,it=null;_e!==null&&Ke<Z.length;Ke++){_e.index>Ke?(it=_e,_e=null):it=_e.sibling;var mt=J(G,_e,Z[Ke],ce);if(mt===null){_e===null&&(_e=it);break}e&&_e&&mt.alternate===null&&n(G,_e),q=x(mt,q,Ke),ht===null?Le=mt:ht.sibling=mt,ht=mt,_e=it}if(Ke===Z.length)return r(G,_e),ot&&Fl(G,Ke),Le;if(_e===null){for(;Ke<Z.length;Ke++)_e=fe(G,Z[Ke],ce),_e!==null&&(q=x(_e,q,Ke),ht===null?Le=_e:ht.sibling=_e,ht=_e);return ot&&Fl(G,Ke),Le}for(_e=s(_e);Ke<Z.length;Ke++)it=le(_e,G,Ke,Z[Ke],ce),it!==null&&(e&&it.alternate!==null&&_e.delete(it.key===null?Ke:it.key),q=x(it,q,Ke),ht===null?Le=it:ht.sibling=it,ht=it);return e&&_e.forEach(function(Na){return n(G,Na)}),ot&&Fl(G,Ke),Le}function Ue(G,q,Z,ce){if(Z==null)throw Error(i(151));for(var Le=null,ht=null,_e=q,Ke=q=0,it=null,mt=Z.next();_e!==null&&!mt.done;Ke++,mt=Z.next()){_e.index>Ke?(it=_e,_e=null):it=_e.sibling;var Na=J(G,_e,mt.value,ce);if(Na===null){_e===null&&(_e=it);break}e&&_e&&Na.alternate===null&&n(G,_e),q=x(Na,q,Ke),ht===null?Le=Na:ht.sibling=Na,ht=Na,_e=it}if(mt.done)return r(G,_e),ot&&Fl(G,Ke),Le;if(_e===null){for(;!mt.done;Ke++,mt=Z.next())mt=fe(G,mt.value,ce),mt!==null&&(q=x(mt,q,Ke),ht===null?Le=mt:ht.sibling=mt,ht=mt);return ot&&Fl(G,Ke),Le}for(_e=s(_e);!mt.done;Ke++,mt=Z.next())mt=le(_e,G,Ke,mt.value,ce),mt!==null&&(e&&mt.alternate!==null&&_e.delete(mt.key===null?Ke:mt.key),q=x(mt,q,Ke),ht===null?Le=mt:ht.sibling=mt,ht=mt);return e&&_e.forEach(function(Ab){return n(G,Ab)}),ot&&Fl(G,Ke),Le}function Et(G,q,Z,ce){if(typeof Z=="object"&&Z!==null&&Z.type===k&&Z.key===null&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case v:e:{for(var Le=Z.key;q!==null;){if(q.key===Le){if(Le=Z.type,Le===k){if(q.tag===7){r(G,q.sibling),ce=d(q,Z.props.children),ce.return=G,G=ce;break e}}else if(q.elementType===Le||typeof Le=="object"&&Le!==null&&Le.$$typeof===V&&Za(Le)===q.type){r(G,q.sibling),ce=d(q,Z.props),Mi(ce,Z),ce.return=G,G=ce;break e}r(G,q);break}else n(G,q);q=q.sibling}Z.type===k?(ce=Xa(Z.props.children,G.mode,ce,Z.key),ce.return=G,G=ce):(ce=Js(Z.type,Z.key,Z.props,null,G.mode,ce),Mi(ce,Z),ce.return=G,G=ce)}return w(G);case j:e:{for(Le=Z.key;q!==null;){if(q.key===Le)if(q.tag===4&&q.stateNode.containerInfo===Z.containerInfo&&q.stateNode.implementation===Z.implementation){r(G,q.sibling),ce=d(q,Z.children||[]),ce.return=G,G=ce;break e}else{r(G,q);break}else n(G,q);q=q.sibling}ce=tu(Z,G.mode,ce),ce.return=G,G=ce}return w(G);case V:return Z=Za(Z),Et(G,q,Z,ce)}if(X(Z))return De(G,q,Z,ce);if($(Z)){if(Le=$(Z),typeof Le!="function")throw Error(i(150));return Z=Le.call(Z),Ue(G,q,Z,ce)}if(typeof Z.then=="function")return Et(G,q,ro(Z),ce);if(Z.$$typeof===H)return Et(G,q,to(G,Z),ce);io(G,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,q!==null&&q.tag===6?(r(G,q.sibling),ce=d(q,Z),ce.return=G,G=ce):(r(G,q),ce=eu(Z,G.mode,ce),ce.return=G,G=ce),w(G)):r(G,q)}return function(G,q,Z,ce){try{zi=0;var Le=Et(G,q,Z,ce);return zr=null,Le}catch(_e){if(_e===Tr||_e===lo)throw _e;var ht=Fn(29,_e,null,G.mode);return ht.lanes=ce,ht.return=G,ht}finally{}}}var Ja=um(!0),fm=um(!1),ua=!1;function hu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function mu(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function fa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function da(e,n,r){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(pt&2)!==0){var d=s.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),s.pending=n,n=Ws(e),Kh(e,null,r),n}return Zs(e,s,n,r),Ws(e)}function _i(e,n,r){if(n=n.updateQueue,n!==null&&(n=n.shared,(r&4194048)!==0)){var s=n.lanes;s&=e.pendingLanes,r|=s,n.lanes=r,oi(e,r)}}function xu(e,n){var r=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,r===s)){var d=null,x=null;if(r=r.firstBaseUpdate,r!==null){do{var w={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};x===null?d=x=w:x=x.next=w,r=r.next}while(r!==null);x===null?d=x=n:x=x.next=n}else d=x=n;r={baseState:s.baseState,firstBaseUpdate:d,lastBaseUpdate:x,shared:s.shared,callbacks:s.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=n:e.next=n,r.lastBaseUpdate=n}var pu=!1;function Fi(){if(pu){var e=Dr;if(e!==null)throw e}}function Ri(e,n,r,s){pu=!1;var d=e.updateQueue;ua=!1;var x=d.firstBaseUpdate,w=d.lastBaseUpdate,N=d.shared.pending;if(N!==null){d.shared.pending=null;var O=N,W=O.next;O.next=null,w===null?x=W:w.next=W,w=O;var se=e.alternate;se!==null&&(se=se.updateQueue,N=se.lastBaseUpdate,N!==w&&(N===null?se.firstBaseUpdate=W:N.next=W,se.lastBaseUpdate=O))}if(x!==null){var fe=d.baseState;w=0,se=W=O=null,N=x;do{var J=N.lane&-536870913,le=J!==N.lane;if(le?(rt&J)===J:(s&J)===J){J!==0&&J===Ar&&(pu=!0),se!==null&&(se=se.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var De=e,Ue=N;J=n;var Et=r;switch(Ue.tag){case 1:if(De=Ue.payload,typeof De=="function"){fe=De.call(Et,fe,J);break e}fe=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=Ue.payload,J=typeof De=="function"?De.call(Et,fe,J):De,J==null)break e;fe=y({},fe,J);break e;case 2:ua=!0}}J=N.callback,J!==null&&(e.flags|=64,le&&(e.flags|=8192),le=d.callbacks,le===null?d.callbacks=[J]:le.push(J))}else le={lane:J,tag:N.tag,payload:N.payload,callback:N.callback,next:null},se===null?(W=se=le,O=fe):se=se.next=le,w|=J;if(N=N.next,N===null){if(N=d.shared.pending,N===null)break;le=N,N=le.next,le.next=null,d.lastBaseUpdate=le,d.shared.pending=null}}while(!0);se===null&&(O=fe),d.baseState=O,d.firstBaseUpdate=W,d.lastBaseUpdate=se,x===null&&(d.shared.lanes=0),ya|=w,e.lanes=w,e.memoizedState=fe}}function dm(e,n){if(typeof e!="function")throw Error(i(191,e));e.call(n)}function hm(e,n){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;e<r.length;e++)dm(r[e],n)}var Mr=_(null),so=_(0);function mm(e,n){e=Xl,A(so,e),A(Mr,n),Xl=e|n.baseLanes}function yu(){A(so,Xl),A(Mr,Mr.current)}function gu(){Xl=so.current,P(Mr),P(so)}var Rn=_(null),Pn=null;function ha(e){var n=e.alternate;A(Vt,Vt.current&1),A(Rn,e),Pn===null&&(n===null||Mr.current!==null||n.memoizedState!==null)&&(Pn=e)}function bu(e){A(Vt,Vt.current),A(Rn,e),Pn===null&&(Pn=e)}function xm(e){e.tag===22?(A(Vt,Vt.current),A(Rn,e),Pn===null&&(Pn=e)):ma()}function ma(){A(Vt,Vt.current),A(Rn,Rn.current)}function On(e){P(Rn),Pn===e&&(Pn=null),P(Vt)}var Vt=_(0);function oo(e){for(var n=e;n!==null;){if(n.tag===13){var r=n.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||Ef(r)||Nf(r)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Bl=0,Ge=null,jt=null,Qt=null,co=!1,_r=!1,Pa=!1,uo=0,Oi=0,Fr=null,g2=0;function Ht(){throw Error(i(321))}function vu(e,n){if(n===null)return!1;for(var r=0;r<n.length&&r<e.length;r++)if(!_n(e[r],n[r]))return!1;return!0}function wu(e,n,r,s,d,x){return Bl=x,Ge=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,I.H=e===null||e.memoizedState===null?Jm:Ou,Pa=!1,x=r(s,d),Pa=!1,_r&&(x=ym(n,r,s,d)),pm(e),x}function pm(e){I.H=$i;var n=jt!==null&&jt.next!==null;if(Bl=0,Qt=jt=Ge=null,co=!1,Oi=0,Fr=null,n)throw Error(i(300));e===null||Zt||(e=e.dependencies,e!==null&&eo(e)&&(Zt=!0))}function ym(e,n,r,s){Ge=e;var d=0;do{if(_r&&(Fr=null),Oi=0,_r=!1,25<=d)throw Error(i(301));if(d+=1,Qt=jt=null,e.updateQueue!=null){var x=e.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}I.H=Pm,x=n(r,s)}while(_r);return x}function b2(){var e=I.H,n=e.useState()[0];return n=typeof n.then=="function"?Bi(n):n,e=e.useState()[0],(jt!==null?jt.memoizedState:null)!==e&&(Ge.flags|=1024),n}function ku(){var e=uo!==0;return uo=0,e}function Su(e,n,r){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~r}function ju(e){if(co){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}co=!1}Bl=0,Qt=jt=Ge=null,_r=!1,Oi=uo=0,Fr=null}function yn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qt===null?Ge.memoizedState=Qt=e:Qt=Qt.next=e,Qt}function Gt(){if(jt===null){var e=Ge.alternate;e=e!==null?e.memoizedState:null}else e=jt.next;var n=Qt===null?Ge.memoizedState:Qt.next;if(n!==null)Qt=n,jt=e;else{if(e===null)throw Ge.alternate===null?Error(i(467)):Error(i(310));jt=e,e={memoizedState:jt.memoizedState,baseState:jt.baseState,baseQueue:jt.baseQueue,queue:jt.queue,next:null},Qt===null?Ge.memoizedState=Qt=e:Qt=Qt.next=e}return Qt}function fo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Bi(e){var n=Oi;return Oi+=1,Fr===null&&(Fr=[]),e=sm(Fr,e,n),n=Ge,(Qt===null?n.memoizedState:Qt.next)===null&&(n=n.alternate,I.H=n===null||n.memoizedState===null?Jm:Ou),e}function ho(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Bi(e);if(e.$$typeof===H)return sn(e)}throw Error(i(438,String(e)))}function Cu(e){var n=null,r=Ge.updateQueue;if(r!==null&&(n=r.memoCache),n==null){var s=Ge.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(n={data:s.data.map(function(d){return d.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),r===null&&(r=fo(),Ge.updateQueue=r),r.memoCache=n,r=n.data[n.index],r===void 0)for(r=n.data[n.index]=Array(e),s=0;s<e;s++)r[s]=T;return n.index++,r}function Ll(e,n){return typeof n=="function"?n(e):n}function mo(e){var n=Gt();return Eu(n,jt,e)}function Eu(e,n,r){var s=e.queue;if(s===null)throw Error(i(311));s.lastRenderedReducer=r;var d=e.baseQueue,x=s.pending;if(x!==null){if(d!==null){var w=d.next;d.next=x.next,x.next=w}n.baseQueue=d=x,s.pending=null}if(x=e.baseState,d===null)e.memoizedState=x;else{n=d.next;var N=w=null,O=null,W=n,se=!1;do{var fe=W.lane&-536870913;if(fe!==W.lane?(rt&fe)===fe:(Bl&fe)===fe){var J=W.revertLane;if(J===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null}),fe===Ar&&(se=!0);else if((Bl&J)===J){W=W.next,J===Ar&&(se=!0);continue}else fe={lane:0,revertLane:W.revertLane,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},O===null?(N=O=fe,w=x):O=O.next=fe,Ge.lanes|=J,ya|=J;fe=W.action,Pa&&r(x,fe),x=W.hasEagerState?W.eagerState:r(x,fe)}else J={lane:fe,revertLane:W.revertLane,gesture:W.gesture,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},O===null?(N=O=J,w=x):O=O.next=J,Ge.lanes|=fe,ya|=fe;W=W.next}while(W!==null&&W!==n);if(O===null?w=x:O.next=N,!_n(x,e.memoizedState)&&(Zt=!0,se&&(r=Dr,r!==null)))throw r;e.memoizedState=x,e.baseState=w,e.baseQueue=O,s.lastRenderedState=x}return d===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Nu(e){var n=Gt(),r=n.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=e;var s=r.dispatch,d=r.pending,x=n.memoizedState;if(d!==null){r.pending=null;var w=d=d.next;do x=e(x,w.action),w=w.next;while(w!==d);_n(x,n.memoizedState)||(Zt=!0),n.memoizedState=x,n.baseQueue===null&&(n.baseState=x),r.lastRenderedState=x}return[x,s]}function gm(e,n,r){var s=Ge,d=Gt(),x=ot;if(x){if(r===void 0)throw Error(i(407));r=r()}else r=n();var w=!_n((jt||d).memoizedState,r);if(w&&(d.memoizedState=r,Zt=!0),d=d.queue,Tu(wm.bind(null,s,d,e),[e]),d.getSnapshot!==n||w||Qt!==null&&Qt.memoizedState.tag&1){if(s.flags|=2048,Rr(9,{destroy:void 0},vm.bind(null,s,d,r,n),null),Dt===null)throw Error(i(349));x||(Bl&127)!==0||bm(s,n,r)}return r}function bm(e,n,r){e.flags|=16384,e={getSnapshot:n,value:r},n=Ge.updateQueue,n===null?(n=fo(),Ge.updateQueue=n,n.stores=[e]):(r=n.stores,r===null?n.stores=[e]:r.push(e))}function vm(e,n,r,s){n.value=r,n.getSnapshot=s,km(n)&&Sm(e)}function wm(e,n,r){return r(function(){km(n)&&Sm(e)})}function km(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!_n(e,r)}catch{return!0}}function Sm(e){var n=qa(e,2);n!==null&&Tn(n,e,2)}function Au(e){var n=yn();if(typeof e=="function"){var r=e;if(e=r(),Pa){ut(!0);try{r()}finally{ut(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ll,lastRenderedState:e},n}function jm(e,n,r,s){return e.baseState=r,Eu(e,jt,typeof s=="function"?s:Ll)}function v2(e,n,r,s,d){if(yo(e))throw Error(i(485));if(e=n.action,e!==null){var x={payload:d,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};I.T!==null?r(!0):x.isTransition=!1,s(x),r=n.pending,r===null?(x.next=n.pending=x,Cm(n,x)):(x.next=r.next,n.pending=r.next=x)}}function Cm(e,n){var r=n.action,s=n.payload,d=e.state;if(n.isTransition){var x=I.T,w={};I.T=w;try{var N=r(d,s),O=I.S;O!==null&&O(w,N),Em(e,n,N)}catch(W){Du(e,n,W)}finally{x!==null&&w.types!==null&&(x.types=w.types),I.T=x}}else try{x=r(d,s),Em(e,n,x)}catch(W){Du(e,n,W)}}function Em(e,n,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(s){Nm(e,n,s)},function(s){return Du(e,n,s)}):Nm(e,n,r)}function Nm(e,n,r){n.status="fulfilled",n.value=r,Am(n),e.state=r,n=e.pending,n!==null&&(r=n.next,r===n?e.pending=null:(r=r.next,n.next=r,Cm(e,r)))}function Du(e,n,r){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do n.status="rejected",n.reason=r,Am(n),n=n.next;while(n!==s)}e.action=null}function Am(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Dm(e,n){return n}function Tm(e,n){if(ot){var r=Dt.formState;if(r!==null){e:{var s=Ge;if(ot){if(Mt){t:{for(var d=Mt,x=Jn;d.nodeType!==8;){if(!x){d=null;break t}if(d=el(d.nextSibling),d===null){d=null;break t}}x=d.data,d=x==="F!"||x==="F"?d:null}if(d){Mt=el(d.nextSibling),s=d.data==="F!";break e}}oa(s)}s=!1}s&&(n=r[0])}}return r=yn(),r.memoizedState=r.baseState=n,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dm,lastRenderedState:n},r.queue=s,r=Qm.bind(null,Ge,s),s.dispatch=r,s=Au(!1),x=Ru.bind(null,Ge,!1,s.queue),s=yn(),d={state:n,dispatch:null,action:e,pending:null},s.queue=d,r=v2.bind(null,Ge,d,x,r),d.dispatch=r,s.memoizedState=e,[n,r,!1]}function zm(e){var n=Gt();return Mm(n,jt,e)}function Mm(e,n,r){if(n=Eu(e,n,Dm)[0],e=mo(Ll)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var s=Bi(n)}catch(w){throw w===Tr?lo:w}else s=n;n=Gt();var d=n.queue,x=d.dispatch;return r!==n.memoizedState&&(Ge.flags|=2048,Rr(9,{destroy:void 0},w2.bind(null,d,r),null)),[s,x,e]}function w2(e,n){e.action=n}function _m(e){var n=Gt(),r=jt;if(r!==null)return Mm(n,r,e);Gt(),n=n.memoizedState,r=Gt();var s=r.queue.dispatch;return r.memoizedState=e,[n,s,!1]}function Rr(e,n,r,s){return e={tag:e,create:r,deps:s,inst:n,next:null},n=Ge.updateQueue,n===null&&(n=fo(),Ge.updateQueue=n),r=n.lastEffect,r===null?n.lastEffect=e.next=e:(s=r.next,r.next=e,e.next=s,n.lastEffect=e),e}function Fm(){return Gt().memoizedState}function xo(e,n,r,s){var d=yn();Ge.flags|=e,d.memoizedState=Rr(1|n,{destroy:void 0},r,s===void 0?null:s)}function po(e,n,r,s){var d=Gt();s=s===void 0?null:s;var x=d.memoizedState.inst;jt!==null&&s!==null&&vu(s,jt.memoizedState.deps)?d.memoizedState=Rr(n,x,r,s):(Ge.flags|=e,d.memoizedState=Rr(1|n,x,r,s))}function Rm(e,n){xo(8390656,8,e,n)}function Tu(e,n){po(2048,8,e,n)}function k2(e){Ge.flags|=4;var n=Ge.updateQueue;if(n===null)n=fo(),Ge.updateQueue=n,n.events=[e];else{var r=n.events;r===null?n.events=[e]:r.push(e)}}function Om(e){var n=Gt().memoizedState;return k2({ref:n,nextImpl:e}),function(){if((pt&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function Bm(e,n){return po(4,2,e,n)}function Lm(e,n){return po(4,4,e,n)}function $m(e,n){if(typeof n=="function"){e=e();var r=n(e);return function(){typeof r=="function"?r():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Hm(e,n,r){r=r!=null?r.concat([e]):null,po(4,4,$m.bind(null,n,e),r)}function zu(){}function Um(e,n){var r=Gt();n=n===void 0?null:n;var s=r.memoizedState;return n!==null&&vu(n,s[1])?s[0]:(r.memoizedState=[e,n],e)}function Im(e,n){var r=Gt();n=n===void 0?null:n;var s=r.memoizedState;if(n!==null&&vu(n,s[1]))return s[0];if(s=e(),Pa){ut(!0);try{e()}finally{ut(!1)}}return r.memoizedState=[s,n],s}function Mu(e,n,r){return r===void 0||(Bl&1073741824)!==0&&(rt&261930)===0?e.memoizedState=n:(e.memoizedState=r,e=Yx(),Ge.lanes|=e,ya|=e,r)}function Ym(e,n,r,s){return _n(r,n)?r:Mr.current!==null?(e=Mu(e,r,s),_n(e,n)||(Zt=!0),e):(Bl&42)===0||(Bl&1073741824)!==0&&(rt&261930)===0?(Zt=!0,e.memoizedState=r):(e=Yx(),Ge.lanes|=e,ya|=e,n)}function qm(e,n,r,s,d){var x=Q.p;Q.p=x!==0&&8>x?x:8;var w=I.T,N={};I.T=N,Ru(e,!1,n,r);try{var O=d(),W=I.S;if(W!==null&&W(N,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var se=y2(O,s);Li(e,n,se,$n(e))}else Li(e,n,s,$n(e))}catch(fe){Li(e,n,{then:function(){},status:"rejected",reason:fe},$n())}finally{Q.p=x,w!==null&&N.types!==null&&(w.types=N.types),I.T=w}}function S2(){}function _u(e,n,r,s){if(e.tag!==5)throw Error(i(476));var d=Xm(e).queue;qm(e,d,n,ie,r===null?S2:function(){return Vm(e),r(s)})}function Xm(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ll,lastRenderedState:ie},next:null};var r={};return n.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ll,lastRenderedState:r},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Vm(e){var n=Xm(e);n.next===null&&(n=e.alternate.memoizedState),Li(e,n.next.queue,{},$n())}function Fu(){return sn(ts)}function Gm(){return Gt().memoizedState}function Km(){return Gt().memoizedState}function j2(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var r=$n();e=fa(r);var s=da(n,e,r);s!==null&&(Tn(s,n,r),_i(s,n,r)),n={cache:cu()},e.payload=n;return}n=n.return}}function C2(e,n,r){var s=$n();r={lane:s,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},yo(e)?Zm(n,r):(r=Jc(e,n,r,s),r!==null&&(Tn(r,e,s),Wm(r,n,s)))}function Qm(e,n,r){var s=$n();Li(e,n,r,s)}function Li(e,n,r,s){var d={lane:s,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(yo(e))Zm(n,d);else{var x=e.alternate;if(e.lanes===0&&(x===null||x.lanes===0)&&(x=n.lastRenderedReducer,x!==null))try{var w=n.lastRenderedState,N=x(w,r);if(d.hasEagerState=!0,d.eagerState=N,_n(N,w))return Zs(e,n,d,0),Dt===null&&Qs(),!1}catch{}finally{}if(r=Jc(e,n,d,s),r!==null)return Tn(r,e,s),Wm(r,n,s),!0}return!1}function Ru(e,n,r,s){if(s={lane:2,revertLane:mf(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},yo(e)){if(n)throw Error(i(479))}else n=Jc(e,r,s,2),n!==null&&Tn(n,e,2)}function yo(e){var n=e.alternate;return e===Ge||n!==null&&n===Ge}function Zm(e,n){_r=co=!0;var r=e.pending;r===null?n.next=n:(n.next=r.next,r.next=n),e.pending=n}function Wm(e,n,r){if((r&4194048)!==0){var s=n.lanes;s&=e.pendingLanes,r|=s,n.lanes=r,oi(e,r)}}var $i={readContext:sn,use:ho,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useLayoutEffect:Ht,useInsertionEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useSyncExternalStore:Ht,useId:Ht,useHostTransitionStatus:Ht,useFormState:Ht,useActionState:Ht,useOptimistic:Ht,useMemoCache:Ht,useCacheRefresh:Ht};$i.useEffectEvent=Ht;var Jm={readContext:sn,use:ho,useCallback:function(e,n){return yn().memoizedState=[e,n===void 0?null:n],e},useContext:sn,useEffect:Rm,useImperativeHandle:function(e,n,r){r=r!=null?r.concat([e]):null,xo(4194308,4,$m.bind(null,n,e),r)},useLayoutEffect:function(e,n){return xo(4194308,4,e,n)},useInsertionEffect:function(e,n){xo(4,2,e,n)},useMemo:function(e,n){var r=yn();n=n===void 0?null:n;var s=e();if(Pa){ut(!0);try{e()}finally{ut(!1)}}return r.memoizedState=[s,n],s},useReducer:function(e,n,r){var s=yn();if(r!==void 0){var d=r(n);if(Pa){ut(!0);try{r(n)}finally{ut(!1)}}}else d=n;return s.memoizedState=s.baseState=d,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:d},s.queue=e,e=e.dispatch=C2.bind(null,Ge,e),[s.memoizedState,e]},useRef:function(e){var n=yn();return e={current:e},n.memoizedState=e},useState:function(e){e=Au(e);var n=e.queue,r=Qm.bind(null,Ge,n);return n.dispatch=r,[e.memoizedState,r]},useDebugValue:zu,useDeferredValue:function(e,n){var r=yn();return Mu(r,e,n)},useTransition:function(){var e=Au(!1);return e=qm.bind(null,Ge,e.queue,!0,!1),yn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,r){var s=Ge,d=yn();if(ot){if(r===void 0)throw Error(i(407));r=r()}else{if(r=n(),Dt===null)throw Error(i(349));(rt&127)!==0||bm(s,n,r)}d.memoizedState=r;var x={value:r,getSnapshot:n};return d.queue=x,Rm(wm.bind(null,s,x,e),[e]),s.flags|=2048,Rr(9,{destroy:void 0},vm.bind(null,s,x,r,n),null),r},useId:function(){var e=yn(),n=Dt.identifierPrefix;if(ot){var r=yl,s=pl;r=(s&~(1<<32-dt(s)-1)).toString(32)+r,n="_"+n+"R_"+r,r=uo++,0<r&&(n+="H"+r.toString(32)),n+="_"}else r=g2++,n="_"+n+"r_"+r.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Fu,useFormState:Tm,useActionState:Tm,useOptimistic:function(e){var n=yn();n.memoizedState=n.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=r,n=Ru.bind(null,Ge,!0,r),r.dispatch=n,[e,n]},useMemoCache:Cu,useCacheRefresh:function(){return yn().memoizedState=j2.bind(null,Ge)},useEffectEvent:function(e){var n=yn(),r={impl:e};return n.memoizedState=r,function(){if((pt&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}},Ou={readContext:sn,use:ho,useCallback:Um,useContext:sn,useEffect:Tu,useImperativeHandle:Hm,useInsertionEffect:Bm,useLayoutEffect:Lm,useMemo:Im,useReducer:mo,useRef:Fm,useState:function(){return mo(Ll)},useDebugValue:zu,useDeferredValue:function(e,n){var r=Gt();return Ym(r,jt.memoizedState,e,n)},useTransition:function(){var e=mo(Ll)[0],n=Gt().memoizedState;return[typeof e=="boolean"?e:Bi(e),n]},useSyncExternalStore:gm,useId:Gm,useHostTransitionStatus:Fu,useFormState:zm,useActionState:zm,useOptimistic:function(e,n){var r=Gt();return jm(r,jt,e,n)},useMemoCache:Cu,useCacheRefresh:Km};Ou.useEffectEvent=Om;var Pm={readContext:sn,use:ho,useCallback:Um,useContext:sn,useEffect:Tu,useImperativeHandle:Hm,useInsertionEffect:Bm,useLayoutEffect:Lm,useMemo:Im,useReducer:Nu,useRef:Fm,useState:function(){return Nu(Ll)},useDebugValue:zu,useDeferredValue:function(e,n){var r=Gt();return jt===null?Mu(r,e,n):Ym(r,jt.memoizedState,e,n)},useTransition:function(){var e=Nu(Ll)[0],n=Gt().memoizedState;return[typeof e=="boolean"?e:Bi(e),n]},useSyncExternalStore:gm,useId:Gm,useHostTransitionStatus:Fu,useFormState:_m,useActionState:_m,useOptimistic:function(e,n){var r=Gt();return jt!==null?jm(r,jt,e,n):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:Cu,useCacheRefresh:Km};Pm.useEffectEvent=Om;function Bu(e,n,r,s){n=e.memoizedState,r=r(s,n),r=r==null?n:y({},n,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var Lu={enqueueSetState:function(e,n,r){e=e._reactInternals;var s=$n(),d=fa(s);d.payload=n,r!=null&&(d.callback=r),n=da(e,d,s),n!==null&&(Tn(n,e,s),_i(n,e,s))},enqueueReplaceState:function(e,n,r){e=e._reactInternals;var s=$n(),d=fa(s);d.tag=1,d.payload=n,r!=null&&(d.callback=r),n=da(e,d,s),n!==null&&(Tn(n,e,s),_i(n,e,s))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var r=$n(),s=fa(r);s.tag=2,n!=null&&(s.callback=n),n=da(e,s,r),n!==null&&(Tn(n,e,r),_i(n,e,r))}};function ex(e,n,r,s,d,x,w){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,x,w):n.prototype&&n.prototype.isPureReactComponent?!Ci(r,s)||!Ci(d,x):!0}function tx(e,n,r,s){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(r,s),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(r,s),n.state!==e&&Lu.enqueueReplaceState(n,n.state,null)}function er(e,n){var r=n;if("ref"in n){r={};for(var s in n)s!=="ref"&&(r[s]=n[s])}if(e=e.defaultProps){r===n&&(r=y({},r));for(var d in e)r[d]===void 0&&(r[d]=e[d])}return r}function nx(e){Ks(e)}function lx(e){console.error(e)}function ax(e){Ks(e)}function go(e,n){try{var r=e.onUncaughtError;r(n.value,{componentStack:n.stack})}catch(s){setTimeout(function(){throw s})}}function rx(e,n,r){try{var s=e.onCaughtError;s(r.value,{componentStack:r.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function $u(e,n,r){return r=fa(r),r.tag=3,r.payload={element:null},r.callback=function(){go(e,n)},r}function ix(e){return e=fa(e),e.tag=3,e}function sx(e,n,r,s){var d=r.type.getDerivedStateFromError;if(typeof d=="function"){var x=s.value;e.payload=function(){return d(x)},e.callback=function(){rx(n,r,s)}}var w=r.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(e.callback=function(){rx(n,r,s),typeof d!="function"&&(ga===null?ga=new Set([this]):ga.add(this));var N=s.stack;this.componentDidCatch(s.value,{componentStack:N!==null?N:""})})}function E2(e,n,r,s,d){if(r.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(n=r.alternate,n!==null&&Nr(n,r,d,!0),r=Rn.current,r!==null){switch(r.tag){case 31:case 13:return Pn===null?To():r.alternate===null&&Ut===0&&(Ut=3),r.flags&=-257,r.flags|=65536,r.lanes=d,s===ao?r.flags|=16384:(n=r.updateQueue,n===null?r.updateQueue=new Set([s]):n.add(s),ff(e,s,d)),!1;case 22:return r.flags|=65536,s===ao?r.flags|=16384:(n=r.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([s])},r.updateQueue=n):(r=n.retryQueue,r===null?n.retryQueue=new Set([s]):r.add(s)),ff(e,s,d)),!1}throw Error(i(435,r.tag))}return ff(e,s,d),To(),!1}if(ot)return n=Rn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=d,s!==au&&(e=Error(i(422),{cause:s}),Ai(Qn(e,r)))):(s!==au&&(n=Error(i(423),{cause:s}),Ai(Qn(n,r))),e=e.current.alternate,e.flags|=65536,d&=-d,e.lanes|=d,s=Qn(s,r),d=$u(e.stateNode,s,d),xu(e,d),Ut!==4&&(Ut=2)),!1;var x=Error(i(520),{cause:s});if(x=Qn(x,r),Gi===null?Gi=[x]:Gi.push(x),Ut!==4&&(Ut=2),n===null)return!0;s=Qn(s,r),r=n;do{switch(r.tag){case 3:return r.flags|=65536,e=d&-d,r.lanes|=e,e=$u(r.stateNode,s,e),xu(r,e),!1;case 1:if(n=r.type,x=r.stateNode,(r.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(ga===null||!ga.has(x))))return r.flags|=65536,d&=-d,r.lanes|=d,d=ix(d),sx(d,e,r,s),xu(r,d),!1}r=r.return}while(r!==null);return!1}var Hu=Error(i(461)),Zt=!1;function on(e,n,r,s){n.child=e===null?fm(n,null,r,s):Ja(n,e.child,r,s)}function ox(e,n,r,s,d){r=r.render;var x=n.ref;if("ref"in s){var w={};for(var N in s)N!=="ref"&&(w[N]=s[N])}else w=s;return Ka(n),s=wu(e,n,r,w,x,d),N=ku(),e!==null&&!Zt?(Su(e,n,d),$l(e,n,d)):(ot&&N&&nu(n),n.flags|=1,on(e,n,s,d),n.child)}function cx(e,n,r,s,d){if(e===null){var x=r.type;return typeof x=="function"&&!Pc(x)&&x.defaultProps===void 0&&r.compare===null?(n.tag=15,n.type=x,ux(e,n,x,s,d)):(e=Js(r.type,null,s,n,n.mode,d),e.ref=n.ref,e.return=n,n.child=e)}if(x=e.child,!Ku(e,d)){var w=x.memoizedProps;if(r=r.compare,r=r!==null?r:Ci,r(w,s)&&e.ref===n.ref)return $l(e,n,d)}return n.flags|=1,e=_l(x,s),e.ref=n.ref,e.return=n,n.child=e}function ux(e,n,r,s,d){if(e!==null){var x=e.memoizedProps;if(Ci(x,s)&&e.ref===n.ref)if(Zt=!1,n.pendingProps=s=x,Ku(e,d))(e.flags&131072)!==0&&(Zt=!0);else return n.lanes=e.lanes,$l(e,n,d)}return Uu(e,n,r,s,d)}function fx(e,n,r,s){var d=s.children,x=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((n.flags&128)!==0){if(x=x!==null?x.baseLanes|r:r,e!==null){for(s=n.child=e.child,d=0;s!==null;)d=d|s.lanes|s.childLanes,s=s.sibling;s=d&~x}else s=0,n.child=null;return dx(e,n,x,r,s)}if((r&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&no(n,x!==null?x.cachePool:null),x!==null?mm(n,x):yu(),xm(n);else return s=n.lanes=536870912,dx(e,n,x!==null?x.baseLanes|r:r,r,s)}else x!==null?(no(n,x.cachePool),mm(n,x),ma(),n.memoizedState=null):(e!==null&&no(n,null),yu(),ma());return on(e,n,d,r),n.child}function Hi(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function dx(e,n,r,s,d){var x=fu();return x=x===null?null:{parent:Kt._currentValue,pool:x},n.memoizedState={baseLanes:r,cachePool:x},e!==null&&no(n,null),yu(),xm(n),e!==null&&Nr(e,n,s,!0),n.childLanes=d,null}function bo(e,n){return n=wo({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function hx(e,n,r){return Ja(n,e.child,null,r),e=bo(n,n.pendingProps),e.flags|=2,On(n),n.memoizedState=null,e}function N2(e,n,r){var s=n.pendingProps,d=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(ot){if(s.mode==="hidden")return e=bo(n,s),n.lanes=536870912,Hi(null,e);if(bu(n),(e=Mt)?(e=Cp(e,Jn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ia!==null?{id:pl,overflow:yl}:null,retryLane:536870912,hydrationErrors:null},r=Zh(e),r.return=n,n.child=r,rn=n,Mt=null)):e=null,e===null)throw oa(n);return n.lanes=536870912,null}return bo(n,s)}var x=e.memoizedState;if(x!==null){var w=x.dehydrated;if(bu(n),d)if(n.flags&256)n.flags&=-257,n=hx(e,n,r);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(i(558));else if(Zt||Nr(e,n,r,!1),d=(r&e.childLanes)!==0,Zt||d){if(s=Dt,s!==null&&(w=ml(s,r),w!==0&&w!==x.retryLane))throw x.retryLane=w,qa(e,w),Tn(s,e,w),Hu;To(),n=hx(e,n,r)}else e=x.treeContext,Mt=el(w.nextSibling),rn=n,ot=!0,sa=null,Jn=!1,e!==null&&Ph(n,e),n=bo(n,s),n.flags|=4096;return n}return e=_l(e.child,{mode:s.mode,children:s.children}),e.ref=n.ref,n.child=e,e.return=n,e}function vo(e,n){var r=n.ref;if(r===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(i(284));(e===null||e.ref!==r)&&(n.flags|=4194816)}}function Uu(e,n,r,s,d){return Ka(n),r=wu(e,n,r,s,void 0,d),s=ku(),e!==null&&!Zt?(Su(e,n,d),$l(e,n,d)):(ot&&s&&nu(n),n.flags|=1,on(e,n,r,d),n.child)}function mx(e,n,r,s,d,x){return Ka(n),n.updateQueue=null,r=ym(n,s,r,d),pm(e),s=ku(),e!==null&&!Zt?(Su(e,n,x),$l(e,n,x)):(ot&&s&&nu(n),n.flags|=1,on(e,n,r,x),n.child)}function xx(e,n,r,s,d){if(Ka(n),n.stateNode===null){var x=Sr,w=r.contextType;typeof w=="object"&&w!==null&&(x=sn(w)),x=new r(s,x),n.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Lu,n.stateNode=x,x._reactInternals=n,x=n.stateNode,x.props=s,x.state=n.memoizedState,x.refs={},hu(n),w=r.contextType,x.context=typeof w=="object"&&w!==null?sn(w):Sr,x.state=n.memoizedState,w=r.getDerivedStateFromProps,typeof w=="function"&&(Bu(n,r,w,s),x.state=n.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(w=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),w!==x.state&&Lu.enqueueReplaceState(x,x.state,null),Ri(n,s,x,d),Fi(),x.state=n.memoizedState),typeof x.componentDidMount=="function"&&(n.flags|=4194308),s=!0}else if(e===null){x=n.stateNode;var N=n.memoizedProps,O=er(r,N);x.props=O;var W=x.context,se=r.contextType;w=Sr,typeof se=="object"&&se!==null&&(w=sn(se));var fe=r.getDerivedStateFromProps;se=typeof fe=="function"||typeof x.getSnapshotBeforeUpdate=="function",N=n.pendingProps!==N,se||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(N||W!==w)&&tx(n,x,s,w),ua=!1;var J=n.memoizedState;x.state=J,Ri(n,s,x,d),Fi(),W=n.memoizedState,N||J!==W||ua?(typeof fe=="function"&&(Bu(n,r,fe,s),W=n.memoizedState),(O=ua||ex(n,r,O,s,J,W,w))?(se||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(n.flags|=4194308)):(typeof x.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=s,n.memoizedState=W),x.props=s,x.state=W,x.context=w,s=O):(typeof x.componentDidMount=="function"&&(n.flags|=4194308),s=!1)}else{x=n.stateNode,mu(e,n),w=n.memoizedProps,se=er(r,w),x.props=se,fe=n.pendingProps,J=x.context,W=r.contextType,O=Sr,typeof W=="object"&&W!==null&&(O=sn(W)),N=r.getDerivedStateFromProps,(W=typeof N=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==fe||J!==O)&&tx(n,x,s,O),ua=!1,J=n.memoizedState,x.state=J,Ri(n,s,x,d),Fi();var le=n.memoizedState;w!==fe||J!==le||ua||e!==null&&e.dependencies!==null&&eo(e.dependencies)?(typeof N=="function"&&(Bu(n,r,N,s),le=n.memoizedState),(se=ua||ex(n,r,se,s,J,le,O)||e!==null&&e.dependencies!==null&&eo(e.dependencies))?(W||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(s,le,O),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(s,le,O)),typeof x.componentDidUpdate=="function"&&(n.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===e.memoizedProps&&J===e.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&J===e.memoizedState||(n.flags|=1024),n.memoizedProps=s,n.memoizedState=le),x.props=s,x.state=le,x.context=O,s=se):(typeof x.componentDidUpdate!="function"||w===e.memoizedProps&&J===e.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&J===e.memoizedState||(n.flags|=1024),s=!1)}return x=s,vo(e,n),s=(n.flags&128)!==0,x||s?(x=n.stateNode,r=s&&typeof r.getDerivedStateFromError!="function"?null:x.render(),n.flags|=1,e!==null&&s?(n.child=Ja(n,e.child,null,d),n.child=Ja(n,null,r,d)):on(e,n,r,d),n.memoizedState=x.state,e=n.child):e=$l(e,n,d),e}function px(e,n,r,s){return Va(),n.flags|=256,on(e,n,r,s),n.child}var Iu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Yu(e){return{baseLanes:e,cachePool:rm()}}function qu(e,n,r){return e=e!==null?e.childLanes&~r:0,n&&(e|=Ln),e}function yx(e,n,r){var s=n.pendingProps,d=!1,x=(n.flags&128)!==0,w;if((w=x)||(w=e!==null&&e.memoizedState===null?!1:(Vt.current&2)!==0),w&&(d=!0,n.flags&=-129),w=(n.flags&32)!==0,n.flags&=-33,e===null){if(ot){if(d?ha(n):ma(),(e=Mt)?(e=Cp(e,Jn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ia!==null?{id:pl,overflow:yl}:null,retryLane:536870912,hydrationErrors:null},r=Zh(e),r.return=n,n.child=r,rn=n,Mt=null)):e=null,e===null)throw oa(n);return Nf(e)?n.lanes=32:n.lanes=536870912,null}var N=s.children;return s=s.fallback,d?(ma(),d=n.mode,N=wo({mode:"hidden",children:N},d),s=Xa(s,d,r,null),N.return=n,s.return=n,N.sibling=s,n.child=N,s=n.child,s.memoizedState=Yu(r),s.childLanes=qu(e,w,r),n.memoizedState=Iu,Hi(null,s)):(ha(n),Xu(n,N))}var O=e.memoizedState;if(O!==null&&(N=O.dehydrated,N!==null)){if(x)n.flags&256?(ha(n),n.flags&=-257,n=Vu(e,n,r)):n.memoizedState!==null?(ma(),n.child=e.child,n.flags|=128,n=null):(ma(),N=s.fallback,d=n.mode,s=wo({mode:"visible",children:s.children},d),N=Xa(N,d,r,null),N.flags|=2,s.return=n,N.return=n,s.sibling=N,n.child=s,Ja(n,e.child,null,r),s=n.child,s.memoizedState=Yu(r),s.childLanes=qu(e,w,r),n.memoizedState=Iu,n=Hi(null,s));else if(ha(n),Nf(N)){if(w=N.nextSibling&&N.nextSibling.dataset,w)var W=w.dgst;w=W,s=Error(i(419)),s.stack="",s.digest=w,Ai({value:s,source:null,stack:null}),n=Vu(e,n,r)}else if(Zt||Nr(e,n,r,!1),w=(r&e.childLanes)!==0,Zt||w){if(w=Dt,w!==null&&(s=ml(w,r),s!==0&&s!==O.retryLane))throw O.retryLane=s,qa(e,s),Tn(w,e,s),Hu;Ef(N)||To(),n=Vu(e,n,r)}else Ef(N)?(n.flags|=192,n.child=e.child,n=null):(e=O.treeContext,Mt=el(N.nextSibling),rn=n,ot=!0,sa=null,Jn=!1,e!==null&&Ph(n,e),n=Xu(n,s.children),n.flags|=4096);return n}return d?(ma(),N=s.fallback,d=n.mode,O=e.child,W=O.sibling,s=_l(O,{mode:"hidden",children:s.children}),s.subtreeFlags=O.subtreeFlags&65011712,W!==null?N=_l(W,N):(N=Xa(N,d,r,null),N.flags|=2),N.return=n,s.return=n,s.sibling=N,n.child=s,Hi(null,s),s=n.child,N=e.child.memoizedState,N===null?N=Yu(r):(d=N.cachePool,d!==null?(O=Kt._currentValue,d=d.parent!==O?{parent:O,pool:O}:d):d=rm(),N={baseLanes:N.baseLanes|r,cachePool:d}),s.memoizedState=N,s.childLanes=qu(e,w,r),n.memoizedState=Iu,Hi(e.child,s)):(ha(n),r=e.child,e=r.sibling,r=_l(r,{mode:"visible",children:s.children}),r.return=n,r.sibling=null,e!==null&&(w=n.deletions,w===null?(n.deletions=[e],n.flags|=16):w.push(e)),n.child=r,n.memoizedState=null,r)}function Xu(e,n){return n=wo({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function wo(e,n){return e=Fn(22,e,null,n),e.lanes=0,e}function Vu(e,n,r){return Ja(n,e.child,null,r),e=Xu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function gx(e,n,r){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n),su(e.return,n,r)}function Gu(e,n,r,s,d,x){var w=e.memoizedState;w===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:s,tail:r,tailMode:d,treeForkCount:x}:(w.isBackwards=n,w.rendering=null,w.renderingStartTime=0,w.last=s,w.tail=r,w.tailMode=d,w.treeForkCount=x)}function bx(e,n,r){var s=n.pendingProps,d=s.revealOrder,x=s.tail;s=s.children;var w=Vt.current,N=(w&2)!==0;if(N?(w=w&1|2,n.flags|=128):w&=1,A(Vt,w),on(e,n,s,r),s=ot?Ni:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&gx(e,r,n);else if(e.tag===19)gx(e,r,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(d){case"forwards":for(r=n.child,d=null;r!==null;)e=r.alternate,e!==null&&oo(e)===null&&(d=r),r=r.sibling;r=d,r===null?(d=n.child,n.child=null):(d=r.sibling,r.sibling=null),Gu(n,!1,d,r,x,s);break;case"backwards":case"unstable_legacy-backwards":for(r=null,d=n.child,n.child=null;d!==null;){if(e=d.alternate,e!==null&&oo(e)===null){n.child=d;break}e=d.sibling,d.sibling=r,r=d,d=e}Gu(n,!0,r,null,x,s);break;case"together":Gu(n,!1,null,null,void 0,s);break;default:n.memoizedState=null}return n.child}function $l(e,n,r){if(e!==null&&(n.dependencies=e.dependencies),ya|=n.lanes,(r&n.childLanes)===0)if(e!==null){if(Nr(e,n,r,!1),(r&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(i(153));if(n.child!==null){for(e=n.child,r=_l(e,e.pendingProps),n.child=r,r.return=n;e.sibling!==null;)e=e.sibling,r=r.sibling=_l(e,e.pendingProps),r.return=n;r.sibling=null}return n.child}function Ku(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&eo(e)))}function A2(e,n,r){switch(n.tag){case 3:Be(n,n.stateNode.containerInfo),ca(n,Kt,e.memoizedState.cache),Va();break;case 27:case 5:K(n);break;case 4:Be(n,n.stateNode.containerInfo);break;case 10:ca(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,bu(n),null;break;case 13:var s=n.memoizedState;if(s!==null)return s.dehydrated!==null?(ha(n),n.flags|=128,null):(r&n.child.childLanes)!==0?yx(e,n,r):(ha(n),e=$l(e,n,r),e!==null?e.sibling:null);ha(n);break;case 19:var d=(e.flags&128)!==0;if(s=(r&n.childLanes)!==0,s||(Nr(e,n,r,!1),s=(r&n.childLanes)!==0),d){if(s)return bx(e,n,r);n.flags|=128}if(d=n.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),A(Vt,Vt.current),s)break;return null;case 22:return n.lanes=0,fx(e,n,r,n.pendingProps);case 24:ca(n,Kt,e.memoizedState.cache)}return $l(e,n,r)}function vx(e,n,r){if(e!==null)if(e.memoizedProps!==n.pendingProps)Zt=!0;else{if(!Ku(e,r)&&(n.flags&128)===0)return Zt=!1,A2(e,n,r);Zt=(e.flags&131072)!==0}else Zt=!1,ot&&(n.flags&1048576)!==0&&Jh(n,Ni,n.index);switch(n.lanes=0,n.tag){case 16:e:{var s=n.pendingProps;if(e=Za(n.elementType),n.type=e,typeof e=="function")Pc(e)?(s=er(e,s),n.tag=1,n=xx(null,n,e,s,r)):(n.tag=0,n=Uu(null,n,e,s,r));else{if(e!=null){var d=e.$$typeof;if(d===B){n.tag=11,n=ox(null,n,e,s,r);break e}else if(d===Y){n.tag=14,n=cx(null,n,e,s,r);break e}}throw n=ae(e)||e,Error(i(306,n,""))}}return n;case 0:return Uu(e,n,n.type,n.pendingProps,r);case 1:return s=n.type,d=er(s,n.pendingProps),xx(e,n,s,d,r);case 3:e:{if(Be(n,n.stateNode.containerInfo),e===null)throw Error(i(387));s=n.pendingProps;var x=n.memoizedState;d=x.element,mu(e,n),Ri(n,s,null,r);var w=n.memoizedState;if(s=w.cache,ca(n,Kt,s),s!==x.cache&&ou(n,[Kt],r,!0),Fi(),s=w.element,x.isDehydrated)if(x={element:s,isDehydrated:!1,cache:w.cache},n.updateQueue.baseState=x,n.memoizedState=x,n.flags&256){n=px(e,n,s,r);break e}else if(s!==d){d=Qn(Error(i(424)),n),Ai(d),n=px(e,n,s,r);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Mt=el(e.firstChild),rn=n,ot=!0,sa=null,Jn=!0,r=fm(n,null,s,r),n.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling}else{if(Va(),s===d){n=$l(e,n,r);break e}on(e,n,s,r)}n=n.child}return n;case 26:return vo(e,n),e===null?(r=zp(n.type,null,n.pendingProps,null))?n.memoizedState=r:ot||(r=n.type,e=n.pendingProps,s=Bo(Ne.current).createElement(r),s[St]=n,s[Xt]=e,cn(s,r,e),et(s),n.stateNode=s):n.memoizedState=zp(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return K(n),e===null&&ot&&(s=n.stateNode=Ap(n.type,n.pendingProps,Ne.current),rn=n,Jn=!0,d=Mt,ka(n.type)?(Af=d,Mt=el(s.firstChild)):Mt=d),on(e,n,n.pendingProps.children,r),vo(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&ot&&((d=s=Mt)&&(s=ab(s,n.type,n.pendingProps,Jn),s!==null?(n.stateNode=s,rn=n,Mt=el(s.firstChild),Jn=!1,d=!0):d=!1),d||oa(n)),K(n),d=n.type,x=n.pendingProps,w=e!==null?e.memoizedProps:null,s=x.children,Sf(d,x)?s=null:w!==null&&Sf(d,w)&&(n.flags|=32),n.memoizedState!==null&&(d=wu(e,n,b2,null,null,r),ts._currentValue=d),vo(e,n),on(e,n,s,r),n.child;case 6:return e===null&&ot&&((e=r=Mt)&&(r=rb(r,n.pendingProps,Jn),r!==null?(n.stateNode=r,rn=n,Mt=null,e=!0):e=!1),e||oa(n)),null;case 13:return yx(e,n,r);case 4:return Be(n,n.stateNode.containerInfo),s=n.pendingProps,e===null?n.child=Ja(n,null,s,r):on(e,n,s,r),n.child;case 11:return ox(e,n,n.type,n.pendingProps,r);case 7:return on(e,n,n.pendingProps,r),n.child;case 8:return on(e,n,n.pendingProps.children,r),n.child;case 12:return on(e,n,n.pendingProps.children,r),n.child;case 10:return s=n.pendingProps,ca(n,n.type,s.value),on(e,n,s.children,r),n.child;case 9:return d=n.type._context,s=n.pendingProps.children,Ka(n),d=sn(d),s=s(d),n.flags|=1,on(e,n,s,r),n.child;case 14:return cx(e,n,n.type,n.pendingProps,r);case 15:return ux(e,n,n.type,n.pendingProps,r);case 19:return bx(e,n,r);case 31:return N2(e,n,r);case 22:return fx(e,n,r,n.pendingProps);case 24:return Ka(n),s=sn(Kt),e===null?(d=fu(),d===null&&(d=Dt,x=cu(),d.pooledCache=x,x.refCount++,x!==null&&(d.pooledCacheLanes|=r),d=x),n.memoizedState={parent:s,cache:d},hu(n),ca(n,Kt,d)):((e.lanes&r)!==0&&(mu(e,n),Ri(n,null,null,r),Fi()),d=e.memoizedState,x=n.memoizedState,d.parent!==s?(d={parent:s,cache:s},n.memoizedState=d,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=d),ca(n,Kt,s)):(s=x.cache,ca(n,Kt,s),s!==d.cache&&ou(n,[Kt],r,!0))),on(e,n,n.pendingProps.children,r),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function Hl(e){e.flags|=4}function Qu(e,n,r,s,d){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(d&335544128)===d)if(e.stateNode.complete)e.flags|=8192;else if(Gx())e.flags|=8192;else throw Wa=ao,du}else e.flags&=-16777217}function wx(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Op(n))if(Gx())e.flags|=8192;else throw Wa=ao,du}function ko(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Al():536870912,e.lanes|=n,$r|=n)}function Ui(e,n){if(!ot)switch(e.tailMode){case"hidden":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var s=null;r!==null;)r.alternate!==null&&(s=r),r=r.sibling;s===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function _t(e){var n=e.alternate!==null&&e.alternate.child===e.child,r=0,s=0;if(n)for(var d=e.child;d!==null;)r|=d.lanes|d.childLanes,s|=d.subtreeFlags&65011712,s|=d.flags&65011712,d.return=e,d=d.sibling;else for(d=e.child;d!==null;)r|=d.lanes|d.childLanes,s|=d.subtreeFlags,s|=d.flags,d.return=e,d=d.sibling;return e.subtreeFlags|=s,e.childLanes=r,n}function D2(e,n,r){var s=n.pendingProps;switch(lu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _t(n),null;case 1:return _t(n),null;case 3:return r=n.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),n.memoizedState.cache!==s&&(n.flags|=2048),Ol(Kt),oe(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Er(n)?Hl(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,ru())),_t(n),null;case 26:var d=n.type,x=n.memoizedState;return e===null?(Hl(n),x!==null?(_t(n),wx(n,x)):(_t(n),Qu(n,d,null,s,r))):x?x!==e.memoizedState?(Hl(n),_t(n),wx(n,x)):(_t(n),n.flags&=-16777217):(e=e.memoizedProps,e!==s&&Hl(n),_t(n),Qu(n,d,e,s,r)),null;case 27:if(ue(n),r=Ne.current,d=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Hl(n);else{if(!s){if(n.stateNode===null)throw Error(i(166));return _t(n),null}e=pe.current,Er(n)?em(n):(e=Ap(d,s,r),n.stateNode=e,Hl(n))}return _t(n),null;case 5:if(ue(n),d=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Hl(n);else{if(!s){if(n.stateNode===null)throw Error(i(166));return _t(n),null}if(x=pe.current,Er(n))em(n);else{var w=Bo(Ne.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":x=w.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof s.is=="string"?w.createElement("select",{is:s.is}):w.createElement("select"),s.multiple?x.multiple=!0:s.size&&(x.size=s.size);break;default:x=typeof s.is=="string"?w.createElement(d,{is:s.is}):w.createElement(d)}}x[St]=n,x[Xt]=s;e:for(w=n.child;w!==null;){if(w.tag===5||w.tag===6)x.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===n)break e;for(;w.sibling===null;){if(w.return===null||w.return===n)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}n.stateNode=x;e:switch(cn(x,d,s),d){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Hl(n)}}return _t(n),Qu(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,r),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==s&&Hl(n);else{if(typeof s!="string"&&n.stateNode===null)throw Error(i(166));if(e=Ne.current,Er(n)){if(e=n.stateNode,r=n.memoizedProps,s=null,d=rn,d!==null)switch(d.tag){case 27:case 5:s=d.memoizedProps}e[St]=n,e=!!(e.nodeValue===r||s!==null&&s.suppressHydrationWarning===!0||yp(e.nodeValue,r)),e||oa(n,!0)}else e=Bo(e).createTextNode(s),e[St]=n,n.stateNode=e}return _t(n),null;case 31:if(r=n.memoizedState,e===null||e.memoizedState!==null){if(s=Er(n),r!==null){if(e===null){if(!s)throw Error(i(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(557));e[St]=n}else Va(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;_t(n),e=!1}else r=ru(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return n.flags&256?(On(n),n):(On(n),null);if((n.flags&128)!==0)throw Error(i(558))}return _t(n),null;case 13:if(s=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(d=Er(n),s!==null&&s.dehydrated!==null){if(e===null){if(!d)throw Error(i(318));if(d=n.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(i(317));d[St]=n}else Va(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;_t(n),d=!1}else d=ru(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return n.flags&256?(On(n),n):(On(n),null)}return On(n),(n.flags&128)!==0?(n.lanes=r,n):(r=s!==null,e=e!==null&&e.memoizedState!==null,r&&(s=n.child,d=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(d=s.alternate.memoizedState.cachePool.pool),x=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(x=s.memoizedState.cachePool.pool),x!==d&&(s.flags|=2048)),r!==e&&r&&(n.child.flags|=8192),ko(n,n.updateQueue),_t(n),null);case 4:return oe(),e===null&&gf(n.stateNode.containerInfo),_t(n),null;case 10:return Ol(n.type),_t(n),null;case 19:if(P(Vt),s=n.memoizedState,s===null)return _t(n),null;if(d=(n.flags&128)!==0,x=s.rendering,x===null)if(d)Ui(s,!1);else{if(Ut!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(x=oo(e),x!==null){for(n.flags|=128,Ui(s,!1),e=x.updateQueue,n.updateQueue=e,ko(n,e),n.subtreeFlags=0,e=r,r=n.child;r!==null;)Qh(r,e),r=r.sibling;return A(Vt,Vt.current&1|2),ot&&Fl(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&>()>No&&(n.flags|=128,d=!0,Ui(s,!1),n.lanes=4194304)}else{if(!d)if(e=oo(x),e!==null){if(n.flags|=128,d=!0,e=e.updateQueue,n.updateQueue=e,ko(n,e),Ui(s,!0),s.tail===null&&s.tailMode==="hidden"&&!x.alternate&&!ot)return _t(n),null}else 2*gt()-s.renderingStartTime>No&&r!==536870912&&(n.flags|=128,d=!0,Ui(s,!1),n.lanes=4194304);s.isBackwards?(x.sibling=n.child,n.child=x):(e=s.last,e!==null?e.sibling=x:n.child=x,s.last=x)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=gt(),e.sibling=null,r=Vt.current,A(Vt,d?r&1|2:r&1),ot&&Fl(n,s.treeForkCount),e):(_t(n),null);case 22:case 23:return On(n),gu(),s=n.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(n.flags|=8192):s&&(n.flags|=8192),s?(r&536870912)!==0&&(n.flags&128)===0&&(_t(n),n.subtreeFlags&6&&(n.flags|=8192)):_t(n),r=n.updateQueue,r!==null&&ko(n,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==r&&(n.flags|=2048),e!==null&&P(Qa),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),n.memoizedState.cache!==r&&(n.flags|=2048),Ol(Kt),_t(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function T2(e,n){switch(lu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Ol(Kt),oe(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return ue(n),null;case 31:if(n.memoizedState!==null){if(On(n),n.alternate===null)throw Error(i(340));Va()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(On(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));Va()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return P(Vt),null;case 4:return oe(),null;case 10:return Ol(n.type),null;case 22:case 23:return On(n),gu(),e!==null&&P(Qa),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Ol(Kt),null;case 25:return null;default:return null}}function kx(e,n){switch(lu(n),n.tag){case 3:Ol(Kt),oe();break;case 26:case 27:case 5:ue(n);break;case 4:oe();break;case 31:n.memoizedState!==null&&On(n);break;case 13:On(n);break;case 19:P(Vt);break;case 10:Ol(n.type);break;case 22:case 23:On(n),gu(),e!==null&&P(Qa);break;case 24:Ol(Kt)}}function Ii(e,n){try{var r=n.updateQueue,s=r!==null?r.lastEffect:null;if(s!==null){var d=s.next;r=d;do{if((r.tag&e)===e){s=void 0;var x=r.create,w=r.inst;s=x(),w.destroy=s}r=r.next}while(r!==d)}}catch(N){wt(n,n.return,N)}}function xa(e,n,r){try{var s=n.updateQueue,d=s!==null?s.lastEffect:null;if(d!==null){var x=d.next;s=x;do{if((s.tag&e)===e){var w=s.inst,N=w.destroy;if(N!==void 0){w.destroy=void 0,d=n;var O=r,W=N;try{W()}catch(se){wt(d,O,se)}}}s=s.next}while(s!==x)}}catch(se){wt(n,n.return,se)}}function Sx(e){var n=e.updateQueue;if(n!==null){var r=e.stateNode;try{hm(n,r)}catch(s){wt(e,e.return,s)}}}function jx(e,n,r){r.props=er(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(s){wt(e,n,s)}}function Yi(e,n){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof r=="function"?e.refCleanup=r(s):r.current=s}}catch(d){wt(e,n,d)}}function gl(e,n){var r=e.ref,s=e.refCleanup;if(r!==null)if(typeof s=="function")try{s()}catch(d){wt(e,n,d)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(d){wt(e,n,d)}else r.current=null}function Cx(e){var n=e.type,r=e.memoizedProps,s=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":r.autoFocus&&s.focus();break e;case"img":r.src?s.src=r.src:r.srcSet&&(s.srcset=r.srcSet)}}catch(d){wt(e,e.return,d)}}function Zu(e,n,r){try{var s=e.stateNode;J2(s,e.type,r,n),s[Xt]=n}catch(d){wt(e,e.return,d)}}function Ex(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ka(e.type)||e.tag===4}function Wu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ex(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ka(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ju(e,n,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(e,n):(n=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,n.appendChild(e),r=r._reactRootContainer,r!=null||n.onclick!==null||(n.onclick=be));else if(s!==4&&(s===27&&ka(e.type)&&(r=e.stateNode,n=null),e=e.child,e!==null))for(Ju(e,n,r),e=e.sibling;e!==null;)Ju(e,n,r),e=e.sibling}function So(e,n,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?r.insertBefore(e,n):r.appendChild(e);else if(s!==4&&(s===27&&ka(e.type)&&(r=e.stateNode),e=e.child,e!==null))for(So(e,n,r),e=e.sibling;e!==null;)So(e,n,r),e=e.sibling}function Nx(e){var n=e.stateNode,r=e.memoizedProps;try{for(var s=e.type,d=n.attributes;d.length;)n.removeAttributeNode(d[0]);cn(n,s,r),n[St]=e,n[Xt]=r}catch(x){wt(e,e.return,x)}}var Ul=!1,Wt=!1,Pu=!1,Ax=typeof WeakSet=="function"?WeakSet:Set,an=null;function z2(e,n){if(e=e.containerInfo,wf=qo,e=Hh(e),Vc(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var s=r.getSelection&&r.getSelection();if(s&&s.rangeCount!==0){r=s.anchorNode;var d=s.anchorOffset,x=s.focusNode;s=s.focusOffset;try{r.nodeType,x.nodeType}catch{r=null;break e}var w=0,N=-1,O=-1,W=0,se=0,fe=e,J=null;t:for(;;){for(var le;fe!==r||d!==0&&fe.nodeType!==3||(N=w+d),fe!==x||s!==0&&fe.nodeType!==3||(O=w+s),fe.nodeType===3&&(w+=fe.nodeValue.length),(le=fe.firstChild)!==null;)J=fe,fe=le;for(;;){if(fe===e)break t;if(J===r&&++W===d&&(N=w),J===x&&++se===s&&(O=w),(le=fe.nextSibling)!==null)break;fe=J,J=fe.parentNode}fe=le}r=N===-1||O===-1?null:{start:N,end:O}}else r=null}r=r||{start:0,end:0}}else r=null;for(kf={focusedElem:e,selectionRange:r},qo=!1,an=n;an!==null;)if(n=an,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,an=e;else for(;an!==null;){switch(n=an,x=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(r=0;r<e.length;r++)d=e[r],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&x!==null){e=void 0,r=n,d=x.memoizedProps,x=x.memoizedState,s=r.stateNode;try{var De=er(r.type,d);e=s.getSnapshotBeforeUpdate(De,x),s.__reactInternalSnapshotBeforeUpdate=e}catch(Ue){wt(r,r.return,Ue)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,r=e.nodeType,r===9)Cf(e);else if(r===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Cf(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(i(163))}if(e=n.sibling,e!==null){e.return=n.return,an=e;break}an=n.return}}function Dx(e,n,r){var s=r.flags;switch(r.tag){case 0:case 11:case 15:Yl(e,r),s&4&&Ii(5,r);break;case 1:if(Yl(e,r),s&4)if(e=r.stateNode,n===null)try{e.componentDidMount()}catch(w){wt(r,r.return,w)}else{var d=er(r.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(d,n,e.__reactInternalSnapshotBeforeUpdate)}catch(w){wt(r,r.return,w)}}s&64&&Sx(r),s&512&&Yi(r,r.return);break;case 3:if(Yl(e,r),s&64&&(e=r.updateQueue,e!==null)){if(n=null,r.child!==null)switch(r.child.tag){case 27:case 5:n=r.child.stateNode;break;case 1:n=r.child.stateNode}try{hm(e,n)}catch(w){wt(r,r.return,w)}}break;case 27:n===null&&s&4&&Nx(r);case 26:case 5:Yl(e,r),n===null&&s&4&&Cx(r),s&512&&Yi(r,r.return);break;case 12:Yl(e,r);break;case 31:Yl(e,r),s&4&&Mx(e,r);break;case 13:Yl(e,r),s&4&&_x(e,r),s&64&&(e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(r=H2.bind(null,r),ib(e,r))));break;case 22:if(s=r.memoizedState!==null||Ul,!s){n=n!==null&&n.memoizedState!==null||Wt,d=Ul;var x=Wt;Ul=s,(Wt=n)&&!x?ql(e,r,(r.subtreeFlags&8772)!==0):Yl(e,r),Ul=d,Wt=x}break;case 30:break;default:Yl(e,r)}}function Tx(e){var n=e.alternate;n!==null&&(e.alternate=null,Tx(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&pr(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Bt=null,En=!1;function Il(e,n,r){for(r=r.child;r!==null;)zx(e,n,r),r=r.sibling}function zx(e,n,r){if(he&&typeof he.onCommitFiberUnmount=="function")try{he.onCommitFiberUnmount(Ze,r)}catch{}switch(r.tag){case 26:Wt||gl(r,n),Il(e,n,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:Wt||gl(r,n);var s=Bt,d=En;ka(r.type)&&(Bt=r.stateNode,En=!1),Il(e,n,r),Ji(r.stateNode),Bt=s,En=d;break;case 5:Wt||gl(r,n);case 6:if(s=Bt,d=En,Bt=null,Il(e,n,r),Bt=s,En=d,Bt!==null)if(En)try{(Bt.nodeType===9?Bt.body:Bt.nodeName==="HTML"?Bt.ownerDocument.body:Bt).removeChild(r.stateNode)}catch(x){wt(r,n,x)}else try{Bt.removeChild(r.stateNode)}catch(x){wt(r,n,x)}break;case 18:Bt!==null&&(En?(e=Bt,Sp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,r.stateNode),Gr(e)):Sp(Bt,r.stateNode));break;case 4:s=Bt,d=En,Bt=r.stateNode.containerInfo,En=!0,Il(e,n,r),Bt=s,En=d;break;case 0:case 11:case 14:case 15:xa(2,r,n),Wt||xa(4,r,n),Il(e,n,r);break;case 1:Wt||(gl(r,n),s=r.stateNode,typeof s.componentWillUnmount=="function"&&jx(r,n,s)),Il(e,n,r);break;case 21:Il(e,n,r);break;case 22:Wt=(s=Wt)||r.memoizedState!==null,Il(e,n,r),Wt=s;break;default:Il(e,n,r)}}function Mx(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Gr(e)}catch(r){wt(n,n.return,r)}}}function _x(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Gr(e)}catch(r){wt(n,n.return,r)}}function M2(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Ax),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Ax),n;default:throw Error(i(435,e.tag))}}function jo(e,n){var r=M2(e);n.forEach(function(s){if(!r.has(s)){r.add(s);var d=U2.bind(null,e,s);s.then(d,d)}})}function Nn(e,n){var r=n.deletions;if(r!==null)for(var s=0;s<r.length;s++){var d=r[s],x=e,w=n,N=w;e:for(;N!==null;){switch(N.tag){case 27:if(ka(N.type)){Bt=N.stateNode,En=!1;break e}break;case 5:Bt=N.stateNode,En=!1;break e;case 3:case 4:Bt=N.stateNode.containerInfo,En=!0;break e}N=N.return}if(Bt===null)throw Error(i(160));zx(x,w,d),Bt=null,En=!1,x=d.alternate,x!==null&&(x.return=null),d.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Fx(n,e),n=n.sibling}var cl=null;function Fx(e,n){var r=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Nn(n,e),An(e),s&4&&(xa(3,e,e.return),Ii(3,e),xa(5,e,e.return));break;case 1:Nn(n,e),An(e),s&512&&(Wt||r===null||gl(r,r.return)),s&64&&Ul&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(r=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=r===null?s:r.concat(s))));break;case 26:var d=cl;if(Nn(n,e),An(e),s&512&&(Wt||r===null||gl(r,r.return)),s&4){var x=r!==null?r.memoizedState:null;if(s=e.memoizedState,r===null)if(s===null)if(e.stateNode===null){e:{s=e.type,r=e.memoizedProps,d=d.ownerDocument||d;t:switch(s){case"title":x=d.getElementsByTagName("title")[0],(!x||x[pn]||x[St]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=d.createElement(s),d.head.insertBefore(x,d.querySelector("head > title"))),cn(x,s,r),x[St]=e,et(x),s=x;break e;case"link":var w=Fp("link","href",d).get(s+(r.href||""));if(w){for(var N=0;N<w.length;N++)if(x=w[N],x.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&x.getAttribute("rel")===(r.rel==null?null:r.rel)&&x.getAttribute("title")===(r.title==null?null:r.title)&&x.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){w.splice(N,1);break t}}x=d.createElement(s),cn(x,s,r),d.head.appendChild(x);break;case"meta":if(w=Fp("meta","content",d).get(s+(r.content||""))){for(N=0;N<w.length;N++)if(x=w[N],x.getAttribute("content")===(r.content==null?null:""+r.content)&&x.getAttribute("name")===(r.name==null?null:r.name)&&x.getAttribute("property")===(r.property==null?null:r.property)&&x.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&x.getAttribute("charset")===(r.charSet==null?null:r.charSet)){w.splice(N,1);break t}}x=d.createElement(s),cn(x,s,r),d.head.appendChild(x);break;default:throw Error(i(468,s))}x[St]=e,et(x),s=x}e.stateNode=s}else Rp(d,e.type,e.stateNode);else e.stateNode=_p(d,s,e.memoizedProps);else x!==s?(x===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):x.count--,s===null?Rp(d,e.type,e.stateNode):_p(d,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Zu(e,e.memoizedProps,r.memoizedProps)}break;case 27:Nn(n,e),An(e),s&512&&(Wt||r===null||gl(r,r.return)),r!==null&&s&4&&Zu(e,e.memoizedProps,r.memoizedProps);break;case 5:if(Nn(n,e),An(e),s&512&&(Wt||r===null||gl(r,r.return)),e.flags&32){d=e.stateNode;try{zl(d,"")}catch(De){wt(e,e.return,De)}}s&4&&e.stateNode!=null&&(d=e.memoizedProps,Zu(e,d,r!==null?r.memoizedProps:d)),s&1024&&(Pu=!0);break;case 6:if(Nn(n,e),An(e),s&4){if(e.stateNode===null)throw Error(i(162));s=e.memoizedProps,r=e.stateNode;try{r.nodeValue=s}catch(De){wt(e,e.return,De)}}break;case 3:if(Ho=null,d=cl,cl=Lo(n.containerInfo),Nn(n,e),cl=d,An(e),s&4&&r!==null&&r.memoizedState.isDehydrated)try{Gr(n.containerInfo)}catch(De){wt(e,e.return,De)}Pu&&(Pu=!1,Rx(e));break;case 4:s=cl,cl=Lo(e.stateNode.containerInfo),Nn(n,e),An(e),cl=s;break;case 12:Nn(n,e),An(e);break;case 31:Nn(n,e),An(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,jo(e,s)));break;case 13:Nn(n,e),An(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Eo=gt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,jo(e,s)));break;case 22:d=e.memoizedState!==null;var O=r!==null&&r.memoizedState!==null,W=Ul,se=Wt;if(Ul=W||d,Wt=se||O,Nn(n,e),Wt=se,Ul=W,An(e),s&8192)e:for(n=e.stateNode,n._visibility=d?n._visibility&-2:n._visibility|1,d&&(r===null||O||Ul||Wt||tr(e)),r=null,n=e;;){if(n.tag===5||n.tag===26){if(r===null){O=r=n;try{if(x=O.stateNode,d)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{N=O.stateNode;var fe=O.memoizedProps.style,J=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;N.style.display=J==null||typeof J=="boolean"?"":(""+J).trim()}}catch(De){wt(O,O.return,De)}}}else if(n.tag===6){if(r===null){O=n;try{O.stateNode.nodeValue=d?"":O.memoizedProps}catch(De){wt(O,O.return,De)}}}else if(n.tag===18){if(r===null){O=n;try{var le=O.stateNode;d?jp(le,!0):jp(O.stateNode,!1)}catch(De){wt(O,O.return,De)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;r===n&&(r=null),n=n.return}r===n&&(r=null),n.sibling.return=n.return,n=n.sibling}s&4&&(s=e.updateQueue,s!==null&&(r=s.retryQueue,r!==null&&(s.retryQueue=null,jo(e,r))));break;case 19:Nn(n,e),An(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,jo(e,s)));break;case 30:break;case 21:break;default:Nn(n,e),An(e)}}function An(e){var n=e.flags;if(n&2){try{for(var r,s=e.return;s!==null;){if(Ex(s)){r=s;break}s=s.return}if(r==null)throw Error(i(160));switch(r.tag){case 27:var d=r.stateNode,x=Wu(e);So(e,x,d);break;case 5:var w=r.stateNode;r.flags&32&&(zl(w,""),r.flags&=-33);var N=Wu(e);So(e,N,w);break;case 3:case 4:var O=r.stateNode.containerInfo,W=Wu(e);Ju(e,W,O);break;default:throw Error(i(161))}}catch(se){wt(e,e.return,se)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Rx(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Rx(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Yl(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Dx(e,n.alternate,n),n=n.sibling}function tr(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:xa(4,n,n.return),tr(n);break;case 1:gl(n,n.return);var r=n.stateNode;typeof r.componentWillUnmount=="function"&&jx(n,n.return,r),tr(n);break;case 27:Ji(n.stateNode);case 26:case 5:gl(n,n.return),tr(n);break;case 22:n.memoizedState===null&&tr(n);break;case 30:tr(n);break;default:tr(n)}e=e.sibling}}function ql(e,n,r){for(r=r&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var s=n.alternate,d=e,x=n,w=x.flags;switch(x.tag){case 0:case 11:case 15:ql(d,x,r),Ii(4,x);break;case 1:if(ql(d,x,r),s=x,d=s.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(W){wt(s,s.return,W)}if(s=x,d=s.updateQueue,d!==null){var N=s.stateNode;try{var O=d.shared.hiddenCallbacks;if(O!==null)for(d.shared.hiddenCallbacks=null,d=0;d<O.length;d++)dm(O[d],N)}catch(W){wt(s,s.return,W)}}r&&w&64&&Sx(x),Yi(x,x.return);break;case 27:Nx(x);case 26:case 5:ql(d,x,r),r&&s===null&&w&4&&Cx(x),Yi(x,x.return);break;case 12:ql(d,x,r);break;case 31:ql(d,x,r),r&&w&4&&Mx(d,x);break;case 13:ql(d,x,r),r&&w&4&&_x(d,x);break;case 22:x.memoizedState===null&&ql(d,x,r),Yi(x,x.return);break;case 30:break;default:ql(d,x,r)}n=n.sibling}}function ef(e,n){var r=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==r&&(e!=null&&e.refCount++,r!=null&&Di(r))}function tf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Di(e))}function ul(e,n,r,s){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Ox(e,n,r,s),n=n.sibling}function Ox(e,n,r,s){var d=n.flags;switch(n.tag){case 0:case 11:case 15:ul(e,n,r,s),d&2048&&Ii(9,n);break;case 1:ul(e,n,r,s);break;case 3:ul(e,n,r,s),d&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Di(e)));break;case 12:if(d&2048){ul(e,n,r,s),e=n.stateNode;try{var x=n.memoizedProps,w=x.id,N=x.onPostCommit;typeof N=="function"&&N(w,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){wt(n,n.return,O)}}else ul(e,n,r,s);break;case 31:ul(e,n,r,s);break;case 13:ul(e,n,r,s);break;case 23:break;case 22:x=n.stateNode,w=n.alternate,n.memoizedState!==null?x._visibility&2?ul(e,n,r,s):qi(e,n):x._visibility&2?ul(e,n,r,s):(x._visibility|=2,Or(e,n,r,s,(n.subtreeFlags&10256)!==0||!1)),d&2048&&ef(w,n);break;case 24:ul(e,n,r,s),d&2048&&tf(n.alternate,n);break;default:ul(e,n,r,s)}}function Or(e,n,r,s,d){for(d=d&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var x=e,w=n,N=r,O=s,W=w.flags;switch(w.tag){case 0:case 11:case 15:Or(x,w,N,O,d),Ii(8,w);break;case 23:break;case 22:var se=w.stateNode;w.memoizedState!==null?se._visibility&2?Or(x,w,N,O,d):qi(x,w):(se._visibility|=2,Or(x,w,N,O,d)),d&&W&2048&&ef(w.alternate,w);break;case 24:Or(x,w,N,O,d),d&&W&2048&&tf(w.alternate,w);break;default:Or(x,w,N,O,d)}n=n.sibling}}function qi(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var r=e,s=n,d=s.flags;switch(s.tag){case 22:qi(r,s),d&2048&&ef(s.alternate,s);break;case 24:qi(r,s),d&2048&&tf(s.alternate,s);break;default:qi(r,s)}n=n.sibling}}var Xi=8192;function Br(e,n,r){if(e.subtreeFlags&Xi)for(e=e.child;e!==null;)Bx(e,n,r),e=e.sibling}function Bx(e,n,r){switch(e.tag){case 26:Br(e,n,r),e.flags&Xi&&e.memoizedState!==null&&gb(r,cl,e.memoizedState,e.memoizedProps);break;case 5:Br(e,n,r);break;case 3:case 4:var s=cl;cl=Lo(e.stateNode.containerInfo),Br(e,n,r),cl=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Xi,Xi=16777216,Br(e,n,r),Xi=s):Br(e,n,r));break;default:Br(e,n,r)}}function Lx(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function Vi(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];an=s,Hx(s,e)}Lx(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)$x(e),e=e.sibling}function $x(e){switch(e.tag){case 0:case 11:case 15:Vi(e),e.flags&2048&&xa(9,e,e.return);break;case 3:Vi(e);break;case 12:Vi(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Co(e)):Vi(e);break;default:Vi(e)}}function Co(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];an=s,Hx(s,e)}Lx(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:xa(8,n,n.return),Co(n);break;case 22:r=n.stateNode,r._visibility&2&&(r._visibility&=-3,Co(n));break;default:Co(n)}e=e.sibling}}function Hx(e,n){for(;an!==null;){var r=an;switch(r.tag){case 0:case 11:case 15:xa(8,r,n);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var s=r.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:Di(r.memoizedState.cache)}if(s=r.child,s!==null)s.return=r,an=s;else e:for(r=e;an!==null;){s=an;var d=s.sibling,x=s.return;if(Tx(s),s===r){an=null;break e}if(d!==null){d.return=x,an=d;break e}an=x}}}var _2={getCacheForType:function(e){var n=sn(Kt),r=n.data.get(e);return r===void 0&&(r=e(),n.data.set(e,r)),r},cacheSignal:function(){return sn(Kt).controller.signal}},F2=typeof WeakMap=="function"?WeakMap:Map,pt=0,Dt=null,nt=null,rt=0,vt=0,Bn=null,pa=!1,Lr=!1,nf=!1,Xl=0,Ut=0,ya=0,nr=0,lf=0,Ln=0,$r=0,Gi=null,Dn=null,af=!1,Eo=0,Ux=0,No=1/0,Ao=null,ga=null,en=0,ba=null,Hr=null,Vl=0,rf=0,sf=null,Ix=null,Ki=0,of=null;function $n(){return(pt&2)!==0&&rt!==0?rt&-rt:I.T!==null?mf():ci()}function Yx(){if(Ln===0)if((rt&536870912)===0||ot){var e=ll;ll<<=1,(ll&3932160)===0&&(ll=262144),Ln=e}else Ln=536870912;return e=Rn.current,e!==null&&(e.flags|=32),Ln}function Tn(e,n,r){(e===Dt&&(vt===2||vt===9)||e.cancelPendingCommit!==null)&&(Ur(e,0),va(e,rt,Ln,!1)),ea(e,r),((pt&2)===0||e!==Dt)&&(e===Dt&&((pt&2)===0&&(nr|=r),Ut===4&&va(e,rt,Ln,!1)),bl(e))}function qx(e,n,r){if((pt&6)!==0)throw Error(i(327));var s=!r&&(n&127)===0&&(n&e.expiredLanes)===0||qn(e,n),d=s?B2(e,n):uf(e,n,!0),x=s;do{if(d===0){Lr&&!s&&va(e,n,0,!1);break}else{if(r=e.current.alternate,x&&!R2(r)){d=uf(e,n,!1),x=!1;continue}if(d===2){if(x=n,e.errorRecoveryDisabledLanes&x)var w=0;else w=e.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){n=w;e:{var N=e;d=Gi;var O=N.current.memoizedState.isDehydrated;if(O&&(Ur(N,w).flags|=256),w=uf(N,w,!1),w!==2){if(nf&&!O){N.errorRecoveryDisabledLanes|=x,nr|=x,d=4;break e}x=Dn,Dn=d,x!==null&&(Dn===null?Dn=x:Dn.push.apply(Dn,x))}d=w}if(x=!1,d!==2)continue}}if(d===1){Ur(e,0),va(e,n,0,!0);break}e:{switch(s=e,x=d,x){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:va(s,n,Ln,!pa);break e;case 2:Dn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(d=Eo+300-gt(),10<d)){if(va(s,n,Ln,!pa),al(s,0,!0)!==0)break e;Vl=n,s.timeoutHandle=wp(Xx.bind(null,s,r,Dn,Ao,af,n,Ln,nr,$r,pa,x,"Throttled",-0,0),d);break e}Xx(s,r,Dn,Ao,af,n,Ln,nr,$r,pa,x,null,-0,0)}}break}while(!0);bl(e)}function Xx(e,n,r,s,d,x,w,N,O,W,se,fe,J,le){if(e.timeoutHandle=-1,fe=n.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:be},Bx(n,x,fe);var De=(x&62914560)===x?Eo-gt():(x&4194048)===x?Ux-gt():0;if(De=bb(fe,De),De!==null){Vl=x,e.cancelPendingCommit=De(Px.bind(null,e,n,x,r,s,d,w,N,O,se,fe,null,J,le)),va(e,x,w,!W);return}}Px(e,n,x,r,s,d,w,N,O)}function R2(e){for(var n=e;;){var r=n.tag;if((r===0||r===11||r===15)&&n.flags&16384&&(r=n.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var s=0;s<r.length;s++){var d=r[s],x=d.getSnapshot;d=d.value;try{if(!_n(x(),d))return!1}catch{return!1}}if(r=n.child,n.subtreeFlags&16384&&r!==null)r.return=n,n=r;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function va(e,n,r,s){n&=~lf,n&=~nr,e.suspendedLanes|=n,e.pingedLanes&=~n,s&&(e.warmLanes|=n),s=e.expirationTimes;for(var d=n;0<d;){var x=31-dt(d),w=1<<x;s[x]=-1,d&=~w}r!==0&&si(e,r,n)}function Do(){return(pt&6)===0?(Qi(0),!1):!0}function cf(){if(nt!==null){if(vt===0)var e=nt.return;else e=nt,Rl=Ga=null,ju(e),zr=null,zi=0,e=nt;for(;e!==null;)kx(e.alternate,e),e=e.return;nt=null}}function Ur(e,n){var r=e.timeoutHandle;r!==-1&&(e.timeoutHandle=-1,tb(r)),r=e.cancelPendingCommit,r!==null&&(e.cancelPendingCommit=null,r()),Vl=0,cf(),Dt=e,nt=r=_l(e.current,null),rt=n,vt=0,Bn=null,pa=!1,Lr=qn(e,n),nf=!1,$r=Ln=lf=nr=ya=Ut=0,Dn=Gi=null,af=!1,(n&8)!==0&&(n|=n&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=n;0<s;){var d=31-dt(s),x=1<<d;n|=e[d],s&=~x}return Xl=n,Qs(),r}function Vx(e,n){Ge=null,I.H=$i,n===Tr||n===lo?(n=om(),vt=3):n===du?(n=om(),vt=4):vt=n===Hu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Bn=n,nt===null&&(Ut=1,go(e,Qn(n,e.current)))}function Gx(){var e=Rn.current;return e===null?!0:(rt&4194048)===rt?Pn===null:(rt&62914560)===rt||(rt&536870912)!==0?e===Pn:!1}function Kx(){var e=I.H;return I.H=$i,e===null?$i:e}function Qx(){var e=I.A;return I.A=_2,e}function To(){Ut=4,pa||(rt&4194048)!==rt&&Rn.current!==null||(Lr=!0),(ya&134217727)===0&&(nr&134217727)===0||Dt===null||va(Dt,rt,Ln,!1)}function uf(e,n,r){var s=pt;pt|=2;var d=Kx(),x=Qx();(Dt!==e||rt!==n)&&(Ao=null,Ur(e,n)),n=!1;var w=Ut;e:do try{if(vt!==0&&nt!==null){var N=nt,O=Bn;switch(vt){case 8:cf(),w=6;break e;case 3:case 2:case 9:case 6:Rn.current===null&&(n=!0);var W=vt;if(vt=0,Bn=null,Ir(e,N,O,W),r&&Lr){w=0;break e}break;default:W=vt,vt=0,Bn=null,Ir(e,N,O,W)}}O2(),w=Ut;break}catch(se){Vx(e,se)}while(!0);return n&&e.shellSuspendCounter++,Rl=Ga=null,pt=s,I.H=d,I.A=x,nt===null&&(Dt=null,rt=0,Qs()),w}function O2(){for(;nt!==null;)Zx(nt)}function B2(e,n){var r=pt;pt|=2;var s=Kx(),d=Qx();Dt!==e||rt!==n?(Ao=null,No=gt()+500,Ur(e,n)):Lr=qn(e,n);e:do try{if(vt!==0&&nt!==null){n=nt;var x=Bn;t:switch(vt){case 1:vt=0,Bn=null,Ir(e,n,x,1);break;case 2:case 9:if(im(x)){vt=0,Bn=null,Wx(n);break}n=function(){vt!==2&&vt!==9||Dt!==e||(vt=7),bl(e)},x.then(n,n);break e;case 3:vt=7;break e;case 4:vt=5;break e;case 7:im(x)?(vt=0,Bn=null,Wx(n)):(vt=0,Bn=null,Ir(e,n,x,7));break;case 5:var w=null;switch(nt.tag){case 26:w=nt.memoizedState;case 5:case 27:var N=nt;if(w?Op(w):N.stateNode.complete){vt=0,Bn=null;var O=N.sibling;if(O!==null)nt=O;else{var W=N.return;W!==null?(nt=W,zo(W)):nt=null}break t}}vt=0,Bn=null,Ir(e,n,x,5);break;case 6:vt=0,Bn=null,Ir(e,n,x,6);break;case 8:cf(),Ut=6;break e;default:throw Error(i(462))}}L2();break}catch(se){Vx(e,se)}while(!0);return Rl=Ga=null,I.H=s,I.A=d,pt=r,nt!==null?0:(Dt=null,rt=0,Qs(),Ut)}function L2(){for(;nt!==null&&!Lt();)Zx(nt)}function Zx(e){var n=vx(e.alternate,e,Xl);e.memoizedProps=e.pendingProps,n===null?zo(e):nt=n}function Wx(e){var n=e,r=n.alternate;switch(n.tag){case 15:case 0:n=mx(r,n,n.pendingProps,n.type,void 0,rt);break;case 11:n=mx(r,n,n.pendingProps,n.type.render,n.ref,rt);break;case 5:ju(n);default:kx(r,n),n=nt=Qh(n,Xl),n=vx(r,n,Xl)}e.memoizedProps=e.pendingProps,n===null?zo(e):nt=n}function Ir(e,n,r,s){Rl=Ga=null,ju(n),zr=null,zi=0;var d=n.return;try{if(E2(e,d,n,r,rt)){Ut=1,go(e,Qn(r,e.current)),nt=null;return}}catch(x){if(d!==null)throw nt=d,x;Ut=1,go(e,Qn(r,e.current)),nt=null;return}n.flags&32768?(ot||s===1?e=!0:Lr||(rt&536870912)!==0?e=!1:(pa=e=!0,(s===2||s===9||s===3||s===6)&&(s=Rn.current,s!==null&&s.tag===13&&(s.flags|=16384))),Jx(n,e)):zo(n)}function zo(e){var n=e;do{if((n.flags&32768)!==0){Jx(n,pa);return}e=n.return;var r=D2(n.alternate,n,Xl);if(r!==null){nt=r;return}if(n=n.sibling,n!==null){nt=n;return}nt=n=e}while(n!==null);Ut===0&&(Ut=5)}function Jx(e,n){do{var r=T2(e.alternate,e);if(r!==null){r.flags&=32767,nt=r;return}if(r=e.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!n&&(e=e.sibling,e!==null)){nt=e;return}nt=e=r}while(e!==null);Ut=6,nt=null}function Px(e,n,r,s,d,x,w,N,O){e.cancelPendingCommit=null;do Mo();while(en!==0);if((pt&6)!==0)throw Error(i(327));if(n!==null){if(n===e.current)throw Error(i(177));if(x=n.lanes|n.childLanes,x|=Wc,ii(e,r,x,w,N,O),e===Dt&&(nt=Dt=null,rt=0),Hr=n,ba=e,Vl=r,rf=x,sf=d,Ix=s,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,I2(Fe,function(){return ap(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||s){s=I.T,I.T=null,d=Q.p,Q.p=2,w=pt,pt|=4;try{z2(e,n,r)}finally{pt=w,Q.p=d,I.T=s}}en=1,ep(),tp(),np()}}function ep(){if(en===1){en=0;var e=ba,n=Hr,r=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||r){r=I.T,I.T=null;var s=Q.p;Q.p=2;var d=pt;pt|=4;try{Fx(n,e);var x=kf,w=Hh(e.containerInfo),N=x.focusedElem,O=x.selectionRange;if(w!==N&&N&&N.ownerDocument&&$h(N.ownerDocument.documentElement,N)){if(O!==null&&Vc(N)){var W=O.start,se=O.end;if(se===void 0&&(se=W),"selectionStart"in N)N.selectionStart=W,N.selectionEnd=Math.min(se,N.value.length);else{var fe=N.ownerDocument||document,J=fe&&fe.defaultView||window;if(J.getSelection){var le=J.getSelection(),De=N.textContent.length,Ue=Math.min(O.start,De),Et=O.end===void 0?Ue:Math.min(O.end,De);!le.extend&&Ue>Et&&(w=Et,Et=Ue,Ue=w);var G=Lh(N,Ue),q=Lh(N,Et);if(G&&q&&(le.rangeCount!==1||le.anchorNode!==G.node||le.anchorOffset!==G.offset||le.focusNode!==q.node||le.focusOffset!==q.offset)){var Z=fe.createRange();Z.setStart(G.node,G.offset),le.removeAllRanges(),Ue>Et?(le.addRange(Z),le.extend(q.node,q.offset)):(Z.setEnd(q.node,q.offset),le.addRange(Z))}}}}for(fe=[],le=N;le=le.parentNode;)le.nodeType===1&&fe.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<fe.length;N++){var ce=fe[N];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}qo=!!wf,kf=wf=null}finally{pt=d,Q.p=s,I.T=r}}e.current=n,en=2}}function tp(){if(en===2){en=0;var e=ba,n=Hr,r=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||r){r=I.T,I.T=null;var s=Q.p;Q.p=2;var d=pt;pt|=4;try{Dx(e,n.alternate,n)}finally{pt=d,Q.p=s,I.T=r}}en=3}}function np(){if(en===4||en===3){en=0,un();var e=ba,n=Hr,r=Vl,s=Ix;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?en=5:(en=0,Hr=ba=null,lp(e,e.pendingLanes));var d=e.pendingLanes;if(d===0&&(ga=null),mr(r),n=n.stateNode,he&&typeof he.onCommitFiberRoot=="function")try{he.onCommitFiberRoot(Ze,n,void 0,(n.current.flags&128)===128)}catch{}if(s!==null){n=I.T,d=Q.p,Q.p=2,I.T=null;try{for(var x=e.onRecoverableError,w=0;w<s.length;w++){var N=s[w];x(N.value,{componentStack:N.stack})}}finally{I.T=n,Q.p=d}}(Vl&3)!==0&&Mo(),bl(e),d=e.pendingLanes,(r&261930)!==0&&(d&42)!==0?e===of?Ki++:(Ki=0,of=e):Ki=0,Qi(0)}}function lp(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Di(n)))}function Mo(){return ep(),tp(),np(),ap()}function ap(){if(en!==5)return!1;var e=ba,n=rf;rf=0;var r=mr(Vl),s=I.T,d=Q.p;try{Q.p=32>r?32:r,I.T=null,r=sf,sf=null;var x=ba,w=Vl;if(en=0,Hr=ba=null,Vl=0,(pt&6)!==0)throw Error(i(331));var N=pt;if(pt|=4,$x(x.current),Ox(x,x.current,w,r),pt=N,Qi(0,!1),he&&typeof he.onPostCommitFiberRoot=="function")try{he.onPostCommitFiberRoot(Ze,x)}catch{}return!0}finally{Q.p=d,I.T=s,lp(e,n)}}function rp(e,n,r){n=Qn(r,n),n=$u(e.stateNode,n,2),e=da(e,n,2),e!==null&&(ea(e,2),bl(e))}function wt(e,n,r){if(e.tag===3)rp(e,e,r);else for(;n!==null;){if(n.tag===3){rp(n,e,r);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(ga===null||!ga.has(s))){e=Qn(r,e),r=ix(2),s=da(n,r,2),s!==null&&(sx(r,s,n,e),ea(s,2),bl(s));break}}n=n.return}}function ff(e,n,r){var s=e.pingCache;if(s===null){s=e.pingCache=new F2;var d=new Set;s.set(n,d)}else d=s.get(n),d===void 0&&(d=new Set,s.set(n,d));d.has(r)||(nf=!0,d.add(r),e=$2.bind(null,e,n,r),n.then(e,e))}function $2(e,n,r){var s=e.pingCache;s!==null&&s.delete(n),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,Dt===e&&(rt&r)===r&&(Ut===4||Ut===3&&(rt&62914560)===rt&&300>gt()-Eo?(pt&2)===0&&Ur(e,0):lf|=r,$r===rt&&($r=0)),bl(e)}function ip(e,n){n===0&&(n=Al()),e=qa(e,n),e!==null&&(ea(e,n),bl(e))}function H2(e){var n=e.memoizedState,r=0;n!==null&&(r=n.retryLane),ip(e,r)}function U2(e,n){var r=0;switch(e.tag){case 31:case 13:var s=e.stateNode,d=e.memoizedState;d!==null&&(r=d.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(i(314))}s!==null&&s.delete(n),ip(e,r)}function I2(e,n){return Rt(e,n)}var _o=null,Yr=null,df=!1,Fo=!1,hf=!1,wa=0;function bl(e){e!==Yr&&e.next===null&&(Yr===null?_o=Yr=e:Yr=Yr.next=e),Fo=!0,df||(df=!0,q2())}function Qi(e,n){if(!hf&&Fo){hf=!0;do for(var r=!1,s=_o;s!==null;){if(e!==0){var d=s.pendingLanes;if(d===0)var x=0;else{var w=s.suspendedLanes,N=s.pingedLanes;x=(1<<31-dt(42|e)+1)-1,x&=d&~(w&~N),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(r=!0,up(s,x))}else x=rt,x=al(s,s===Dt?x:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(x&3)===0||qn(s,x)||(r=!0,up(s,x));s=s.next}while(r);hf=!1}}function Y2(){sp()}function sp(){Fo=df=!1;var e=0;wa!==0&&eb()&&(e=wa);for(var n=gt(),r=null,s=_o;s!==null;){var d=s.next,x=op(s,n);x===0?(s.next=null,r===null?_o=d:r.next=d,d===null&&(Yr=r)):(r=s,(e!==0||(x&3)!==0)&&(Fo=!0)),s=d}en!==0&&en!==5||Qi(e),wa!==0&&(wa=0)}function op(e,n){for(var r=e.suspendedLanes,s=e.pingedLanes,d=e.expirationTimes,x=e.pendingLanes&-62914561;0<x;){var w=31-dt(x),N=1<<w,O=d[w];O===-1?((N&r)===0||(N&s)!==0)&&(d[w]=Fs(N,n)):O<=n&&(e.expiredLanes|=N),x&=~N}if(n=Dt,r=rt,r=al(e,e===n?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,r===0||e===n&&(vt===2||vt===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&ft(s),e.callbackNode=null,e.callbackPriority=0;if((r&3)===0||qn(e,r)){if(n=r&-r,n===e.callbackPriority)return n;switch(s!==null&&ft(s),mr(r)){case 2:case 8:r=ye;break;case 32:r=Fe;break;case 268435456:r=ke;break;default:r=Fe}return s=cp.bind(null,e),r=Rt(r,s),e.callbackPriority=n,e.callbackNode=r,n}return s!==null&&s!==null&&ft(s),e.callbackPriority=2,e.callbackNode=null,2}function cp(e,n){if(en!==0&&en!==5)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if(Mo()&&e.callbackNode!==r)return null;var s=rt;return s=al(e,e===Dt?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(qx(e,s,n),op(e,gt()),e.callbackNode!=null&&e.callbackNode===r?cp.bind(null,e):null)}function up(e,n){if(Mo())return null;qx(e,n,!0)}function q2(){nb(function(){(pt&6)!==0?Rt(re,Y2):sp()})}function mf(){if(wa===0){var e=Ar;e===0&&(e=Jl,Jl<<=1,(Jl&261888)===0&&(Jl=256)),wa=e}return wa}function fp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ge(""+e)}function dp(e,n){var r=n.ownerDocument.createElement("input");return r.name=n.name,r.value=n.value,e.id&&r.setAttribute("form",e.id),n.parentNode.insertBefore(r,n),e=new FormData(e),r.parentNode.removeChild(r),e}function X2(e,n,r,s,d){if(n==="submit"&&r&&r.stateNode===d){var x=fp((d[Xt]||null).action),w=s.submitter;w&&(n=(n=w[Xt]||null)?fp(n.formAction):w.getAttribute("formAction"),n!==null&&(x=n,w=null));var N=new Xs("action","action",null,s,d);e.push({event:N,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(wa!==0){var O=w?dp(d,w):new FormData(d);_u(r,{pending:!0,data:O,method:d.method,action:x},null,O)}}else typeof x=="function"&&(N.preventDefault(),O=w?dp(d,w):new FormData(d),_u(r,{pending:!0,data:O,method:d.method,action:x},x,O))},currentTarget:d}]})}}for(var xf=0;xf<Zc.length;xf++){var pf=Zc[xf],V2=pf.toLowerCase(),G2=pf[0].toUpperCase()+pf.slice(1);ol(V2,"on"+G2)}ol(Yh,"onAnimationEnd"),ol(qh,"onAnimationIteration"),ol(Xh,"onAnimationStart"),ol("dblclick","onDoubleClick"),ol("focusin","onFocus"),ol("focusout","onBlur"),ol(c2,"onTransitionRun"),ol(u2,"onTransitionStart"),ol(f2,"onTransitionCancel"),ol(Vh,"onTransitionEnd"),Tl("onMouseEnter",["mouseout","mouseover"]),Tl("onMouseLeave",["mouseout","mouseover"]),Tl("onPointerEnter",["pointerout","pointerover"]),Tl("onPointerLeave",["pointerout","pointerover"]),Dl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Dl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Dl("onBeforeInput",["compositionend","keypress","textInput","paste"]),Dl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Dl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Dl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Zi="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(Zi));function hp(e,n){n=(n&4)!==0;for(var r=0;r<e.length;r++){var s=e[r],d=s.event;s=s.listeners;e:{var x=void 0;if(n)for(var w=s.length-1;0<=w;w--){var N=s[w],O=N.instance,W=N.currentTarget;if(N=N.listener,O!==x&&d.isPropagationStopped())break e;x=N,d.currentTarget=W;try{x(d)}catch(se){Ks(se)}d.currentTarget=null,x=O}else for(w=0;w<s.length;w++){if(N=s[w],O=N.instance,W=N.currentTarget,N=N.listener,O!==x&&d.isPropagationStopped())break e;x=N,d.currentTarget=W;try{x(d)}catch(se){Ks(se)}d.currentTarget=null,x=O}}}}function lt(e,n){var r=n[ui];r===void 0&&(r=n[ui]=new Set);var s=e+"__bubble";r.has(s)||(mp(n,e,2,!1),r.add(s))}function yf(e,n,r){var s=0;n&&(s|=4),mp(r,e,s,n)}var Ro="_reactListening"+Math.random().toString(36).slice(2);function gf(e){if(!e[Ro]){e[Ro]=!0,fi.forEach(function(r){r!=="selectionchange"&&(K2.has(r)||yf(r,!1,e),yf(r,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Ro]||(n[Ro]=!0,yf("selectionchange",!1,n))}}function mp(e,n,r,s){switch(Yp(n)){case 2:var d=kb;break;case 8:d=Sb;break;default:d=_f}r=d.bind(null,n,r,e),d=void 0,!Bc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(d=!0),s?d!==void 0?e.addEventListener(n,r,{capture:!0,passive:d}):e.addEventListener(n,r,!0):d!==void 0?e.addEventListener(n,r,{passive:d}):e.addEventListener(n,r,!1)}function bf(e,n,r,s,d){var x=s;if((n&1)===0&&(n&2)===0&&s!==null)e:for(;;){if(s===null)return;var w=s.tag;if(w===3||w===4){var N=s.stateNode.containerInfo;if(N===d)break;if(w===4)for(w=s.return;w!==null;){var O=w.tag;if((O===3||O===4)&&w.stateNode.containerInfo===d)return;w=w.return}for(;N!==null;){if(w=xl(N),w===null)return;if(O=w.tag,O===5||O===6||O===26||O===27){s=x=w;continue e}N=N.parentNode}}s=s.return}bh(function(){var W=x,se=$e(r),fe=[];e:{var J=Gh.get(e);if(J!==void 0){var le=Xs,De=e;switch(e){case"keypress":if(Ys(r)===0)break e;case"keydown":case"keyup":le=Ug;break;case"focusin":De="focus",le=Uc;break;case"focusout":De="blur",le=Uc;break;case"beforeblur":case"afterblur":le=Uc;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=kh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=Dg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=qg;break;case Yh:case qh:case Xh:le=Mg;break;case Vh:le=Vg;break;case"scroll":case"scrollend":le=Ng;break;case"wheel":le=Kg;break;case"copy":case"cut":case"paste":le=Fg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=jh;break;case"toggle":case"beforetoggle":le=Zg}var Ue=(n&4)!==0,Et=!Ue&&(e==="scroll"||e==="scrollend"),G=Ue?J!==null?J+"Capture":null:J;Ue=[];for(var q=W,Z;q!==null;){var ce=q;if(Z=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||Z===null||G===null||(ce=gi(q,G),ce!=null&&Ue.push(Wi(q,ce,Z))),Et)break;q=q.return}0<Ue.length&&(J=new le(J,De,null,r,se),fe.push({event:J,listeners:Ue}))}}if((n&7)===0){e:{if(J=e==="mouseover"||e==="pointerover",le=e==="mouseout"||e==="pointerout",J&&r!==Me&&(De=r.relatedTarget||r.fromElement)&&(xl(De)||De[Vn]))break e;if((le||J)&&(J=se.window===se?se:(J=se.ownerDocument)?J.defaultView||J.parentWindow:window,le?(De=r.relatedTarget||r.toElement,le=W,De=De?xl(De):null,De!==null&&(Et=u(De),Ue=De.tag,De!==Et||Ue!==5&&Ue!==27&&Ue!==6)&&(De=null)):(le=null,De=W),le!==De)){if(Ue=kh,ce="onMouseLeave",G="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(Ue=jh,ce="onPointerLeave",G="onPointerEnter",q="pointer"),Et=le==null?J:rl(le),Z=De==null?J:rl(De),J=new Ue(ce,q+"leave",le,r,se),J.target=Et,J.relatedTarget=Z,ce=null,xl(se)===W&&(Ue=new Ue(G,q+"enter",De,r,se),Ue.target=Z,Ue.relatedTarget=Et,ce=Ue),Et=ce,le&&De)t:{for(Ue=Q2,G=le,q=De,Z=0,ce=G;ce;ce=Ue(ce))Z++;ce=0;for(var Le=q;Le;Le=Ue(Le))ce++;for(;0<Z-ce;)G=Ue(G),Z--;for(;0<ce-Z;)q=Ue(q),ce--;for(;Z--;){if(G===q||q!==null&&G===q.alternate){Ue=G;break t}G=Ue(G),q=Ue(q)}Ue=null}else Ue=null;le!==null&&xp(fe,J,le,Ue,!1),De!==null&&Et!==null&&xp(fe,Et,De,Ue,!0)}}e:{if(J=W?rl(W):window,le=J.nodeName&&J.nodeName.toLowerCase(),le==="select"||le==="input"&&J.type==="file")var ht=Mh;else if(Th(J))if(_h)ht=i2;else{ht=a2;var _e=l2}else le=J.nodeName,!le||le.toLowerCase()!=="input"||J.type!=="checkbox"&&J.type!=="radio"?W&&R(W.elementType)&&(ht=Mh):ht=r2;if(ht&&(ht=ht(e,W))){zh(fe,ht,r,se);break e}_e&&_e(e,J,W),e==="focusout"&&W&&J.type==="number"&&W.memoizedProps.value!=null&&xi(J,"number",J.value)}switch(_e=W?rl(W):window,e){case"focusin":(Th(_e)||_e.contentEditable==="true")&&(vr=_e,Gc=W,Ei=null);break;case"focusout":Ei=Gc=vr=null;break;case"mousedown":Kc=!0;break;case"contextmenu":case"mouseup":case"dragend":Kc=!1,Uh(fe,r,se);break;case"selectionchange":if(o2)break;case"keydown":case"keyup":Uh(fe,r,se)}var Ke;if(Yc)e:{switch(e){case"compositionstart":var it="onCompositionStart";break e;case"compositionend":it="onCompositionEnd";break e;case"compositionupdate":it="onCompositionUpdate";break e}it=void 0}else br?Ah(e,r)&&(it="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(it="onCompositionStart");it&&(Ch&&r.locale!=="ko"&&(br||it!=="onCompositionStart"?it==="onCompositionEnd"&&br&&(Ke=vh()):(ra=se,Lc="value"in ra?ra.value:ra.textContent,br=!0)),_e=Oo(W,it),0<_e.length&&(it=new Sh(it,e,null,r,se),fe.push({event:it,listeners:_e}),Ke?it.data=Ke:(Ke=Dh(r),Ke!==null&&(it.data=Ke)))),(Ke=Jg?Pg(e,r):e2(e,r))&&(it=Oo(W,"onBeforeInput"),0<it.length&&(_e=new Sh("onBeforeInput","beforeinput",null,r,se),fe.push({event:_e,listeners:it}),_e.data=Ke)),X2(fe,e,W,r,se)}hp(fe,n)})}function Wi(e,n,r){return{instance:e,listener:n,currentTarget:r}}function Oo(e,n){for(var r=n+"Capture",s=[];e!==null;){var d=e,x=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||x===null||(d=gi(e,r),d!=null&&s.unshift(Wi(e,d,x)),d=gi(e,n),d!=null&&s.push(Wi(e,d,x))),e.tag===3)return s;e=e.return}return[]}function Q2(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function xp(e,n,r,s,d){for(var x=n._reactName,w=[];r!==null&&r!==s;){var N=r,O=N.alternate,W=N.stateNode;if(N=N.tag,O!==null&&O===s)break;N!==5&&N!==26&&N!==27||W===null||(O=W,d?(W=gi(r,x),W!=null&&w.unshift(Wi(r,W,O))):d||(W=gi(r,x),W!=null&&w.push(Wi(r,W,O)))),r=r.return}w.length!==0&&e.push({event:n,listeners:w})}var Z2=/\r\n?/g,W2=/\u0000|\uFFFD/g;function pp(e){return(typeof e=="string"?e:""+e).replace(Z2,`
|
|
49
|
-
`).replace(W2,"")}function yp(e,n){return n=pp(n),pp(e)===n}function Ct(e,n,r,s,d,x){switch(r){case"children":typeof s=="string"?n==="body"||n==="textarea"&&s===""||zl(e,s):(typeof s=="number"||typeof s=="bigint")&&n!=="body"&&zl(e,""+s);break;case"className":gr(e,"class",s);break;case"tabIndex":gr(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":gr(e,r,s);break;case"style":yi(e,s,x);break;case"data":if(n!=="object"){gr(e,"data",s);break}case"src":case"href":if(s===""&&(n!=="a"||r!=="href")){e.removeAttribute(r);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(r);break}s=ge(""+s),e.setAttribute(r,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(r,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(r==="formAction"?(n!=="input"&&Ct(e,n,"name",d.name,d,null),Ct(e,n,"formEncType",d.formEncType,d,null),Ct(e,n,"formMethod",d.formMethod,d,null),Ct(e,n,"formTarget",d.formTarget,d,null)):(Ct(e,n,"encType",d.encType,d,null),Ct(e,n,"method",d.method,d,null),Ct(e,n,"target",d.target,d,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(r);break}s=ge(""+s),e.setAttribute(r,s);break;case"onClick":s!=null&&(e.onclick=be);break;case"onScroll":s!=null&<("scroll",e);break;case"onScrollEnd":s!=null&<("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(i(61));if(r=s.__html,r!=null){if(d.children!=null)throw Error(i(60));e.innerHTML=r}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}r=ge(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(r,""+s):e.removeAttribute(r);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(r,""):e.removeAttribute(r);break;case"capture":case"download":s===!0?e.setAttribute(r,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(r,s):e.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(r,s):e.removeAttribute(r);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(r):e.setAttribute(r,s);break;case"popover":lt("beforetoggle",e),lt("toggle",e),yr(e,"popover",s);break;case"xlinkActuate":il(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":il(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":il(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":il(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":il(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":il(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":il(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":il(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":il(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":yr(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=de.get(r)||r,yr(e,r,s))}}function vf(e,n,r,s,d,x){switch(r){case"style":yi(e,s,x);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(i(61));if(r=s.__html,r!=null){if(d.children!=null)throw Error(i(60));e.innerHTML=r}}break;case"children":typeof s=="string"?zl(e,s):(typeof s=="number"||typeof s=="bigint")&&zl(e,""+s);break;case"onScroll":s!=null&<("scroll",e);break;case"onScrollEnd":s!=null&<("scrollend",e);break;case"onClick":s!=null&&(e.onclick=be);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Os.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(d=r.endsWith("Capture"),n=r.slice(2,d?r.length-7:void 0),x=e[Xt]||null,x=x!=null?x[r]:null,typeof x=="function"&&e.removeEventListener(n,x,d),typeof s=="function")){typeof x!="function"&&x!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(n,s,d);break e}r in e?e[r]=s:s===!0?e.setAttribute(r,""):yr(e,r,s)}}}function cn(e,n,r){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":lt("error",e),lt("load",e);var s=!1,d=!1,x;for(x in r)if(r.hasOwnProperty(x)){var w=r[x];if(w!=null)switch(x){case"src":s=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Ct(e,n,x,w,r,null)}}d&&Ct(e,n,"srcSet",r.srcSet,r,null),s&&Ct(e,n,"src",r.src,r,null);return;case"input":lt("invalid",e);var N=x=w=d=null,O=null,W=null;for(s in r)if(r.hasOwnProperty(s)){var se=r[s];if(se!=null)switch(s){case"name":d=se;break;case"type":w=se;break;case"checked":O=se;break;case"defaultChecked":W=se;break;case"value":x=se;break;case"defaultValue":N=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(i(137,n));break;default:Ct(e,n,s,se,r,null)}}mi(e,x,N,O,W,w,d,!1);return;case"select":lt("invalid",e),s=w=x=null;for(d in r)if(r.hasOwnProperty(d)&&(N=r[d],N!=null))switch(d){case"value":x=N;break;case"defaultValue":w=N;break;case"multiple":s=N;default:Ct(e,n,d,N,r,null)}n=x,r=w,e.multiple=!!s,n!=null?la(e,!!s,n,!1):r!=null&&la(e,!!s,r,!0);return;case"textarea":lt("invalid",e),x=d=s=null;for(w in r)if(r.hasOwnProperty(w)&&(N=r[w],N!=null))switch(w){case"value":s=N;break;case"defaultValue":d=N;break;case"children":x=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(i(91));break;default:Ct(e,n,w,N,r,null)}aa(e,s,d,x);return;case"option":for(O in r)if(r.hasOwnProperty(O)&&(s=r[O],s!=null))switch(O){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:Ct(e,n,O,s,r,null)}return;case"dialog":lt("beforetoggle",e),lt("toggle",e),lt("cancel",e),lt("close",e);break;case"iframe":case"object":lt("load",e);break;case"video":case"audio":for(s=0;s<Zi.length;s++)lt(Zi[s],e);break;case"image":lt("error",e),lt("load",e);break;case"details":lt("toggle",e);break;case"embed":case"source":case"link":lt("error",e),lt("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(W in r)if(r.hasOwnProperty(W)&&(s=r[W],s!=null))switch(W){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Ct(e,n,W,s,r,null)}return;default:if(R(n)){for(se in r)r.hasOwnProperty(se)&&(s=r[se],s!==void 0&&vf(e,n,se,s,r,void 0));return}}for(N in r)r.hasOwnProperty(N)&&(s=r[N],s!=null&&Ct(e,n,N,s,r,null))}function J2(e,n,r,s){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,x=null,w=null,N=null,O=null,W=null,se=null;for(le in r){var fe=r[le];if(r.hasOwnProperty(le)&&fe!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":O=fe;default:s.hasOwnProperty(le)||Ct(e,n,le,null,s,fe)}}for(var J in s){var le=s[J];if(fe=r[J],s.hasOwnProperty(J)&&(le!=null||fe!=null))switch(J){case"type":x=le;break;case"name":d=le;break;case"checked":W=le;break;case"defaultChecked":se=le;break;case"value":w=le;break;case"defaultValue":N=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(i(137,n));break;default:le!==fe&&Ct(e,n,J,le,s,fe)}}Gn(e,w,N,O,W,se,x,d);return;case"select":le=w=N=J=null;for(x in r)if(O=r[x],r.hasOwnProperty(x)&&O!=null)switch(x){case"value":break;case"multiple":le=O;default:s.hasOwnProperty(x)||Ct(e,n,x,null,s,O)}for(d in s)if(x=s[d],O=r[d],s.hasOwnProperty(d)&&(x!=null||O!=null))switch(d){case"value":J=x;break;case"defaultValue":N=x;break;case"multiple":w=x;default:x!==O&&Ct(e,n,d,x,s,O)}n=N,r=w,s=le,J!=null?la(e,!!r,J,!1):!!s!=!!r&&(n!=null?la(e,!!r,n,!0):la(e,!!r,r?[]:"",!1));return;case"textarea":le=J=null;for(N in r)if(d=r[N],r.hasOwnProperty(N)&&d!=null&&!s.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:Ct(e,n,N,null,s,d)}for(w in s)if(d=s[w],x=r[w],s.hasOwnProperty(w)&&(d!=null||x!=null))switch(w){case"value":J=d;break;case"defaultValue":le=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(i(91));break;default:d!==x&&Ct(e,n,w,d,s,x)}Pt(e,J,le);return;case"option":for(var De in r)if(J=r[De],r.hasOwnProperty(De)&&J!=null&&!s.hasOwnProperty(De))switch(De){case"selected":e.selected=!1;break;default:Ct(e,n,De,null,s,J)}for(O in s)if(J=s[O],le=r[O],s.hasOwnProperty(O)&&J!==le&&(J!=null||le!=null))switch(O){case"selected":e.selected=J&&typeof J!="function"&&typeof J!="symbol";break;default:Ct(e,n,O,J,s,le)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ue in r)J=r[Ue],r.hasOwnProperty(Ue)&&J!=null&&!s.hasOwnProperty(Ue)&&Ct(e,n,Ue,null,s,J);for(W in s)if(J=s[W],le=r[W],s.hasOwnProperty(W)&&J!==le&&(J!=null||le!=null))switch(W){case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(i(137,n));break;default:Ct(e,n,W,J,s,le)}return;default:if(R(n)){for(var Et in r)J=r[Et],r.hasOwnProperty(Et)&&J!==void 0&&!s.hasOwnProperty(Et)&&vf(e,n,Et,void 0,s,J);for(se in s)J=s[se],le=r[se],!s.hasOwnProperty(se)||J===le||J===void 0&&le===void 0||vf(e,n,se,J,s,le);return}}for(var G in r)J=r[G],r.hasOwnProperty(G)&&J!=null&&!s.hasOwnProperty(G)&&Ct(e,n,G,null,s,J);for(fe in s)J=s[fe],le=r[fe],!s.hasOwnProperty(fe)||J===le||J==null&&le==null||Ct(e,n,fe,J,s,le)}function gp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function P2(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,r=performance.getEntriesByType("resource"),s=0;s<r.length;s++){var d=r[s],x=d.transferSize,w=d.initiatorType,N=d.duration;if(x&&N&&gp(w)){for(w=0,N=d.responseEnd,s+=1;s<r.length;s++){var O=r[s],W=O.startTime;if(W>N)break;var se=O.transferSize,fe=O.initiatorType;se&&gp(fe)&&(O=O.responseEnd,w+=se*(O<N?1:(N-W)/(O-W)))}if(--s,n+=8*(x+w)/(d.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var wf=null,kf=null;function Bo(e){return e.nodeType===9?e:e.ownerDocument}function bp(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function vp(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function Sf(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var jf=null;function eb(){var e=window.event;return e&&e.type==="popstate"?e===jf?!1:(jf=e,!0):(jf=null,!1)}var wp=typeof setTimeout=="function"?setTimeout:void 0,tb=typeof clearTimeout=="function"?clearTimeout:void 0,kp=typeof Promise=="function"?Promise:void 0,nb=typeof queueMicrotask=="function"?queueMicrotask:typeof kp<"u"?function(e){return kp.resolve(null).then(e).catch(lb)}:wp;function lb(e){setTimeout(function(){throw e})}function ka(e){return e==="head"}function Sp(e,n){var r=n,s=0;do{var d=r.nextSibling;if(e.removeChild(r),d&&d.nodeType===8)if(r=d.data,r==="/$"||r==="/&"){if(s===0){e.removeChild(d),Gr(n);return}s--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")s++;else if(r==="html")Ji(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,Ji(r);for(var x=r.firstChild;x;){var w=x.nextSibling,N=x.nodeName;x[pn]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&x.rel.toLowerCase()==="stylesheet"||r.removeChild(x),x=w}}else r==="body"&&Ji(e.ownerDocument.body);r=d}while(r);Gr(n)}function jp(e,n){var r=e;e=0;do{var s=r.nextSibling;if(r.nodeType===1?n?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(n?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),s&&s.nodeType===8)if(r=s.data,r==="/$"){if(e===0)break;e--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||e++;r=s}while(r)}function Cf(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var r=n;switch(n=n.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":Cf(r),pr(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function ab(e,n,r,s){for(;e.nodeType===1;){var d=r;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[pn])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(x=e.getAttribute("rel"),x==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(x!==d.rel||e.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||e.getAttribute("title")!==(d.title==null?null:d.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(x=e.getAttribute("src"),(x!==(d.src==null?null:d.src)||e.getAttribute("type")!==(d.type==null?null:d.type)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&x&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var x=d.name==null?null:""+d.name;if(d.type==="hidden"&&e.getAttribute("name")===x)return e}else return e;if(e=el(e.nextSibling),e===null)break}return null}function rb(e,n,r){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=el(e.nextSibling),e===null))return null;return e}function Cp(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=el(e.nextSibling),e===null))return null;return e}function Ef(e){return e.data==="$?"||e.data==="$~"}function Nf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function ib(e,n){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||r.readyState!=="loading")n();else{var s=function(){n(),r.removeEventListener("DOMContentLoaded",s)};r.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function el(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Af=null;function Ep(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(n===0)return el(e.nextSibling);n--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||n++}e=e.nextSibling}return null}function Np(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(n===0)return e;n--}else r!=="/$"&&r!=="/&"||n++}e=e.previousSibling}return null}function Ap(e,n,r){switch(n=Bo(r),e){case"html":if(e=n.documentElement,!e)throw Error(i(452));return e;case"head":if(e=n.head,!e)throw Error(i(453));return e;case"body":if(e=n.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Ji(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);pr(e)}var tl=new Map,Dp=new Set;function Lo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Gl=Q.d;Q.d={f:sb,r:ob,D:cb,C:ub,L:fb,m:db,X:mb,S:hb,M:xb};function sb(){var e=Gl.f(),n=Do();return e||n}function ob(e){var n=ta(e);n!==null&&n.tag===5&&n.type==="form"?Vm(n):Gl.r(e)}var qr=typeof document>"u"?null:document;function Tp(e,n,r){var s=qr;if(s&&typeof n=="string"&&n){var d=jn(n);d='link[rel="'+e+'"][href="'+d+'"]',typeof r=="string"&&(d+='[crossorigin="'+r+'"]'),Dp.has(d)||(Dp.add(d),e={rel:e,crossOrigin:r,href:n},s.querySelector(d)===null&&(n=s.createElement("link"),cn(n,"link",e),et(n),s.head.appendChild(n)))}}function cb(e){Gl.D(e),Tp("dns-prefetch",e,null)}function ub(e,n){Gl.C(e,n),Tp("preconnect",e,n)}function fb(e,n,r){Gl.L(e,n,r);var s=qr;if(s&&e&&n){var d='link[rel="preload"][as="'+jn(n)+'"]';n==="image"&&r&&r.imageSrcSet?(d+='[imagesrcset="'+jn(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(d+='[imagesizes="'+jn(r.imageSizes)+'"]')):d+='[href="'+jn(e)+'"]';var x=d;switch(n){case"style":x=Xr(e);break;case"script":x=Vr(e)}tl.has(x)||(e=y({rel:"preload",href:n==="image"&&r&&r.imageSrcSet?void 0:e,as:n},r),tl.set(x,e),s.querySelector(d)!==null||n==="style"&&s.querySelector(Pi(x))||n==="script"&&s.querySelector(es(x))||(n=s.createElement("link"),cn(n,"link",e),et(n),s.head.appendChild(n)))}}function db(e,n){Gl.m(e,n);var r=qr;if(r&&e){var s=n&&typeof n.as=="string"?n.as:"script",d='link[rel="modulepreload"][as="'+jn(s)+'"][href="'+jn(e)+'"]',x=d;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Vr(e)}if(!tl.has(x)&&(e=y({rel:"modulepreload",href:e},n),tl.set(x,e),r.querySelector(d)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(es(x)))return}s=r.createElement("link"),cn(s,"link",e),et(s),r.head.appendChild(s)}}}function hb(e,n,r){Gl.S(e,n,r);var s=qr;if(s&&e){var d=na(s).hoistableStyles,x=Xr(e);n=n||"default";var w=d.get(x);if(!w){var N={loading:0,preload:null};if(w=s.querySelector(Pi(x)))N.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},r),(r=tl.get(x))&&Df(e,r);var O=w=s.createElement("link");et(O),cn(O,"link",e),O._p=new Promise(function(W,se){O.onload=W,O.onerror=se}),O.addEventListener("load",function(){N.loading|=1}),O.addEventListener("error",function(){N.loading|=2}),N.loading|=4,$o(w,n,s)}w={type:"stylesheet",instance:w,count:1,state:N},d.set(x,w)}}}function mb(e,n){Gl.X(e,n);var r=qr;if(r&&e){var s=na(r).hoistableScripts,d=Vr(e),x=s.get(d);x||(x=r.querySelector(es(d)),x||(e=y({src:e,async:!0},n),(n=tl.get(d))&&Tf(e,n),x=r.createElement("script"),et(x),cn(x,"link",e),r.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},s.set(d,x))}}function xb(e,n){Gl.M(e,n);var r=qr;if(r&&e){var s=na(r).hoistableScripts,d=Vr(e),x=s.get(d);x||(x=r.querySelector(es(d)),x||(e=y({src:e,async:!0,type:"module"},n),(n=tl.get(d))&&Tf(e,n),x=r.createElement("script"),et(x),cn(x,"link",e),r.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},s.set(d,x))}}function zp(e,n,r,s){var d=(d=Ne.current)?Lo(d):null;if(!d)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(n=Xr(r.href),r=na(d).hoistableStyles,s=r.get(n),s||(s={type:"style",instance:null,count:0,state:null},r.set(n,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=Xr(r.href);var x=na(d).hoistableStyles,w=x.get(e);if(w||(d=d.ownerDocument||d,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(e,w),(x=d.querySelector(Pi(e)))&&!x._p&&(w.instance=x,w.state.loading=5),tl.has(e)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},tl.set(e,r),x||pb(d,e,r,w.state))),n&&s===null)throw Error(i(528,""));return w}if(n&&s!==null)throw Error(i(529,""));return null;case"script":return n=r.async,r=r.src,typeof r=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Vr(r),r=na(d).hoistableScripts,s=r.get(n),s||(s={type:"script",instance:null,count:0,state:null},r.set(n,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Xr(e){return'href="'+jn(e)+'"'}function Pi(e){return'link[rel="stylesheet"]['+e+"]"}function Mp(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function pb(e,n,r,s){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?s.loading=1:(n=e.createElement("link"),s.preload=n,n.addEventListener("load",function(){return s.loading|=1}),n.addEventListener("error",function(){return s.loading|=2}),cn(n,"link",r),et(n),e.head.appendChild(n))}function Vr(e){return'[src="'+jn(e)+'"]'}function es(e){return"script[async]"+e}function _p(e,n,r){if(n.count++,n.instance===null)switch(n.type){case"style":var s=e.querySelector('style[data-href~="'+jn(r.href)+'"]');if(s)return n.instance=s,et(s),s;var d=y({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),et(s),cn(s,"style",d),$o(s,r.precedence,e),n.instance=s;case"stylesheet":d=Xr(r.href);var x=e.querySelector(Pi(d));if(x)return n.state.loading|=4,n.instance=x,et(x),x;s=Mp(r),(d=tl.get(d))&&Df(s,d),x=(e.ownerDocument||e).createElement("link"),et(x);var w=x;return w._p=new Promise(function(N,O){w.onload=N,w.onerror=O}),cn(x,"link",s),n.state.loading|=4,$o(x,r.precedence,e),n.instance=x;case"script":return x=Vr(r.src),(d=e.querySelector(es(x)))?(n.instance=d,et(d),d):(s=r,(d=tl.get(x))&&(s=y({},r),Tf(s,d)),e=e.ownerDocument||e,d=e.createElement("script"),et(d),cn(d,"link",s),e.head.appendChild(d),n.instance=d);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(s=n.instance,n.state.loading|=4,$o(s,r.precedence,e));return n.instance}function $o(e,n,r){for(var s=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=s.length?s[s.length-1]:null,x=d,w=0;w<s.length;w++){var N=s[w];if(N.dataset.precedence===n)x=N;else if(x!==d)break}x?x.parentNode.insertBefore(e,x.nextSibling):(n=r.nodeType===9?r.head:r,n.insertBefore(e,n.firstChild))}function Df(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Tf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Ho=null;function Fp(e,n,r){if(Ho===null){var s=new Map,d=Ho=new Map;d.set(r,s)}else d=Ho,s=d.get(r),s||(s=new Map,d.set(r,s));if(s.has(e))return s;for(s.set(e,null),r=r.getElementsByTagName(e),d=0;d<r.length;d++){var x=r[d];if(!(x[pn]||x[St]||e==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(n)||"";w=e+w;var N=s.get(w);N?N.push(x):s.set(w,[x])}}return s}function Rp(e,n,r){e=e.ownerDocument||e,e.head.insertBefore(r,n==="title"?e.querySelector("head > title"):null)}function yb(e,n,r){if(r===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Op(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function gb(e,n,r,s){if(r.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var d=Xr(s.href),x=n.querySelector(Pi(d));if(x){n=x._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Uo.bind(e),n.then(e,e)),r.state.loading|=4,r.instance=x,et(x);return}x=n.ownerDocument||n,s=Mp(s),(d=tl.get(d))&&Df(s,d),x=x.createElement("link"),et(x);var w=x;w._p=new Promise(function(N,O){w.onload=N,w.onerror=O}),cn(x,"link",s),r.instance=x}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,n),(n=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=Uo.bind(e),n.addEventListener("load",r),n.addEventListener("error",r))}}var zf=0;function bb(e,n){return e.stylesheets&&e.count===0&&Yo(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var s=setTimeout(function(){if(e.stylesheets&&Yo(e,e.stylesheets),e.unsuspend){var x=e.unsuspend;e.unsuspend=null,x()}},6e4+n);0<e.imgBytes&&zf===0&&(zf=62500*P2());var d=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Yo(e,e.stylesheets),e.unsuspend)){var x=e.unsuspend;e.unsuspend=null,x()}},(e.imgBytes>zf?50:800)+n);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(d)}}:null}function Uo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Yo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Io=null;function Yo(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Io=new Map,n.forEach(vb,e),Io=null,Uo.call(e))}function vb(e,n){if(!(n.state.loading&4)){var r=Io.get(e);if(r)var s=r.get(null);else{r=new Map,Io.set(e,r);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<d.length;x++){var w=d[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(r.set(w.dataset.precedence,w),s=w)}s&&r.set(null,s)}d=n.instance,w=d.getAttribute("data-precedence"),x=r.get(w)||s,x===s&&r.set(null,d),r.set(w,d),this.count++,s=Uo.bind(this),d.addEventListener("load",s),d.addEventListener("error",s),x?x.parentNode.insertBefore(d,x.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(d,e.firstChild)),n.state.loading|=4}}var ts={$$typeof:H,Provider:null,Consumer:null,_currentValue:ie,_currentValue2:ie,_threadCount:0};function wb(e,n,r,s,d,x,w,N,O){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=hr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=hr(0),this.hiddenUpdates=hr(null),this.identifierPrefix=s,this.onUncaughtError=d,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function Bp(e,n,r,s,d,x,w,N,O,W,se,fe){return e=new wb(e,n,r,w,O,W,se,fe,N),n=1,x===!0&&(n|=24),x=Fn(3,null,null,n),e.current=x,x.stateNode=e,n=cu(),n.refCount++,e.pooledCache=n,n.refCount++,x.memoizedState={element:s,isDehydrated:r,cache:n},hu(x),e}function Lp(e){return e?(e=Sr,e):Sr}function $p(e,n,r,s,d,x){d=Lp(d),s.context===null?s.context=d:s.pendingContext=d,s=fa(n),s.payload={element:r},x=x===void 0?null:x,x!==null&&(s.callback=x),r=da(e,s,n),r!==null&&(Tn(r,e,n),_i(r,e,n))}function Hp(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<n?r:n}}function Mf(e,n){Hp(e,n),(e=e.alternate)&&Hp(e,n)}function Up(e){if(e.tag===13||e.tag===31){var n=qa(e,67108864);n!==null&&Tn(n,e,67108864),Mf(e,67108864)}}function Ip(e){if(e.tag===13||e.tag===31){var n=$n();n=La(n);var r=qa(e,n);r!==null&&Tn(r,e,n),Mf(e,n)}}var qo=!0;function kb(e,n,r,s){var d=I.T;I.T=null;var x=Q.p;try{Q.p=2,_f(e,n,r,s)}finally{Q.p=x,I.T=d}}function Sb(e,n,r,s){var d=I.T;I.T=null;var x=Q.p;try{Q.p=8,_f(e,n,r,s)}finally{Q.p=x,I.T=d}}function _f(e,n,r,s){if(qo){var d=Ff(s);if(d===null)bf(e,n,s,Xo,r),qp(e,s);else if(Cb(d,e,n,r,s))s.stopPropagation();else if(qp(e,s),n&4&&-1<jb.indexOf(e)){for(;d!==null;){var x=ta(d);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=kn(x.pendingLanes);if(w!==0){var N=x;for(N.pendingLanes|=2,N.entangledLanes|=2;w;){var O=1<<31-dt(w);N.entanglements[1]|=O,w&=~O}bl(x),(pt&6)===0&&(No=gt()+500,Qi(0))}}break;case 31:case 13:N=qa(x,2),N!==null&&Tn(N,x,2),Do(),Mf(x,2)}if(x=Ff(s),x===null&&bf(e,n,s,Xo,r),x===d)break;d=x}d!==null&&s.stopPropagation()}else bf(e,n,s,null,r)}}function Ff(e){return e=$e(e),Rf(e)}var Xo=null;function Rf(e){if(Xo=null,e=xl(e),e!==null){var n=u(e);if(n===null)e=null;else{var r=n.tag;if(r===13){if(e=f(n),e!==null)return e;e=null}else if(r===31){if(e=m(n),e!==null)return e;e=null}else if(r===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Xo=e,null}function Yp(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(qt()){case re:return 2;case ye:return 8;case Fe:case xe:return 32;case ke:return 268435456;default:return 32}default:return 32}}var Of=!1,Sa=null,ja=null,Ca=null,ns=new Map,ls=new Map,Ea=[],jb="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 qp(e,n){switch(e){case"focusin":case"focusout":Sa=null;break;case"dragenter":case"dragleave":ja=null;break;case"mouseover":case"mouseout":Ca=null;break;case"pointerover":case"pointerout":ns.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":ls.delete(n.pointerId)}}function as(e,n,r,s,d,x){return e===null||e.nativeEvent!==x?(e={blockedOn:n,domEventName:r,eventSystemFlags:s,nativeEvent:x,targetContainers:[d]},n!==null&&(n=ta(n),n!==null&&Up(n)),e):(e.eventSystemFlags|=s,n=e.targetContainers,d!==null&&n.indexOf(d)===-1&&n.push(d),e)}function Cb(e,n,r,s,d){switch(n){case"focusin":return Sa=as(Sa,e,n,r,s,d),!0;case"dragenter":return ja=as(ja,e,n,r,s,d),!0;case"mouseover":return Ca=as(Ca,e,n,r,s,d),!0;case"pointerover":var x=d.pointerId;return ns.set(x,as(ns.get(x)||null,e,n,r,s,d)),!0;case"gotpointercapture":return x=d.pointerId,ls.set(x,as(ls.get(x)||null,e,n,r,s,d)),!0}return!1}function Xp(e){var n=xl(e.target);if(n!==null){var r=u(n);if(r!==null){if(n=r.tag,n===13){if(n=f(r),n!==null){e.blockedOn=n,Rs(e.priority,function(){Ip(r)});return}}else if(n===31){if(n=m(r),n!==null){e.blockedOn=n,Rs(e.priority,function(){Ip(r)});return}}else if(n===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Vo(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var r=Ff(e.nativeEvent);if(r===null){r=e.nativeEvent;var s=new r.constructor(r.type,r);Me=s,r.target.dispatchEvent(s),Me=null}else return n=ta(r),n!==null&&Up(n),e.blockedOn=r,!1;n.shift()}return!0}function Vp(e,n,r){Vo(e)&&r.delete(n)}function Eb(){Of=!1,Sa!==null&&Vo(Sa)&&(Sa=null),ja!==null&&Vo(ja)&&(ja=null),Ca!==null&&Vo(Ca)&&(Ca=null),ns.forEach(Vp),ls.forEach(Vp)}function Go(e,n){e.blockedOn===n&&(e.blockedOn=null,Of||(Of=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Eb)))}var Ko=null;function Gp(e){Ko!==e&&(Ko=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Ko===e&&(Ko=null);for(var n=0;n<e.length;n+=3){var r=e[n],s=e[n+1],d=e[n+2];if(typeof s!="function"){if(Rf(s||r)===null)continue;break}var x=ta(r);x!==null&&(e.splice(n,3),n-=3,_u(x,{pending:!0,data:d,method:r.method,action:s},s,d))}}))}function Gr(e){function n(O){return Go(O,e)}Sa!==null&&Go(Sa,e),ja!==null&&Go(ja,e),Ca!==null&&Go(Ca,e),ns.forEach(n),ls.forEach(n);for(var r=0;r<Ea.length;r++){var s=Ea[r];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Ea.length&&(r=Ea[0],r.blockedOn===null);)Xp(r),r.blockedOn===null&&Ea.shift();if(r=(e.ownerDocument||e).$$reactFormReplay,r!=null)for(s=0;s<r.length;s+=3){var d=r[s],x=r[s+1],w=d[Xt]||null;if(typeof x=="function")w||Gp(r);else if(w){var N=null;if(x&&x.hasAttribute("formAction")){if(d=x,w=x[Xt]||null)N=w.formAction;else if(Rf(d)!==null)continue}else N=w.action;typeof N=="function"?r[s+1]=N:(r.splice(s,3),s-=3),Gp(r)}}}function Kp(){function e(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return d=w})},focusReset:"manual",scroll:"manual"})}function n(){d!==null&&(d(),d=null),s||setTimeout(r,20)}function r(){if(!s&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,d=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(r,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),d!==null&&(d(),d=null)}}}function Bf(e){this._internalRoot=e}Qo.prototype.render=Bf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(i(409));var r=n.current,s=$n();$p(r,s,e,n,null,null)},Qo.prototype.unmount=Bf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;$p(e.current,2,null,e,null,null),Do(),n[Vn]=null}};function Qo(e){this._internalRoot=e}Qo.prototype.unstable_scheduleHydration=function(e){if(e){var n=ci();e={blockedOn:null,target:e,priority:n};for(var r=0;r<Ea.length&&n!==0&&n<Ea[r].priority;r++);Ea.splice(r,0,e),r===0&&Xp(e)}};var Qp=l.version;if(Qp!=="19.2.4")throw Error(i(527,Qp,"19.2.4"));Q.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=h(n),e=e!==null?g(e):null,e=e===null?null:e.stateNode,e};var Nb={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Zo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zo.isDisabled&&Zo.supportsFiber)try{Ze=Zo.inject(Nb),he=Zo}catch{}}return is.createRoot=function(e,n){if(!o(e))throw Error(i(299));var r=!1,s="",d=nx,x=lx,w=ax;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(d=n.onUncaughtError),n.onCaughtError!==void 0&&(x=n.onCaughtError),n.onRecoverableError!==void 0&&(w=n.onRecoverableError)),n=Bp(e,1,!1,null,null,r,s,null,d,x,w,Kp),e[Vn]=n.current,gf(e),new Bf(n)},is.hydrateRoot=function(e,n,r){if(!o(e))throw Error(i(299));var s=!1,d="",x=nx,w=lx,N=ax,O=null;return r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(d=r.identifierPrefix),r.onUncaughtError!==void 0&&(x=r.onUncaughtError),r.onCaughtError!==void 0&&(w=r.onCaughtError),r.onRecoverableError!==void 0&&(N=r.onRecoverableError),r.formState!==void 0&&(O=r.formState)),n=Bp(e,1,!0,n,r??null,s,d,O,x,w,N,Kp),n.context=Lp(null),r=n.current,s=$n(),s=La(s),d=fa(s),d.callback=null,da(r,d,s),r=s,n.current.lanes=r,ea(n,r),bl(n),e[Vn]=n.current,gf(e),new Qo(n)},is.version="19.2.4",is}var i1;function $b(){if(i1)return Hf.exports;i1=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(l){console.error(l)}}return t(),Hf.exports=Lb(),Hf.exports}var Hb=$b();const Ub="modulepreload",Ib=function(t){return"/"+t},s1={},Yb=function(l,a,i){let o=Promise.resolve();if(a&&a.length>0){let f=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),p=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));o=f(a.map(h=>{if(h=Ib(h),h in s1)return;s1[h]=!0;const g=h.endsWith(".css"),y=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${y}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":Ub,g||(b.as="script"),b.crossOrigin="",b.href=h,p&&b.setAttribute("nonce",p),document.head.appendChild(b),g)return new Promise((v,j)=>{b.addEventListener("load",v),b.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${h}`)))})}))}function u(f){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=f,window.dispatchEvent(m),!m.defaultPrevented)throw f}return o.then(f=>{for(const m of f||[])m.status==="rejected"&&u(m.reason);return l().catch(u)})};class qb extends S.Component{constructor(){super(...arguments);Zp(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(a){return{hasError:!0,error:a}}render(){var a;return this.state.hasError?c.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:c.jsxs("div",{className:"text-center max-w-md",children:[c.jsx("div",{className:"text-4xl mb-3",children:"🚨"}),c.jsx("div",{className:"text-gray-800 font-semibold mb-2",children:"Something went wrong"}),c.jsx("div",{className:"text-gray-500 text-sm mb-4",children:((a=this.state.error)==null?void 0:a.message)??"An unexpected error occurred."}),c.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-gray-800 text-white rounded-lg text-sm hover:bg-gray-700",children:"Reload"})]})}):this.props.children}}const Ds="/api";async function It(t){const l=await fetch(`${Ds}${t}`);if(!l.ok)throw new Error(`API error: ${l.status}`);return l.json()}async function Hn(t,l){const a=await fetch(`${Ds}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}async function qf(t,l){const a=await fetch(`${Ds}${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}async function Kr(t,l){const a={method:"DELETE"};l!==void 0&&(a.headers={"Content-Type":"application/json"},a.body=JSON.stringify(l));const i=await fetch(`${Ds}${t}`,a);if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()}const Te={getCompany:()=>It("/company"),getRoles:()=>It("/roles"),getRole:t=>It(`/roles/${t}`),getProjects:()=>It("/projects"),getProject:t=>It(`/projects/${t}`),getStandups:()=>It("/operations/standups"),getWaves:()=>It("/operations/waves"),getDecisions:()=>It("/operations/decisions"),getOrgTree:()=>It("/engine/org"),getSkills:()=>It("/skills"),createRole:t=>Hn("/engine/roles",t),updateRole:(t,l)=>qf(`/engine/roles/${t}`,l),deleteRole:t=>Kr(`/engine/roles/${t}`),getSessions:()=>It("/sessions"),getSession:t=>It(`/sessions/${t}`),createSession:(t,l="talk")=>Hn("/sessions",{roleId:t,mode:l}),deleteSession:t=>Kr(`/sessions/${t}`),deleteSessions:t=>Kr("/sessions",{ids:t}),deleteEmptySessions:()=>Kr("/sessions?empty=true"),updateSession:(t,l)=>qf(`/sessions/${t}`,l),startJob:t=>Hn("/jobs",t),getJob:t=>It(`/jobs/${t}`),listJobs:t=>{const l=new URLSearchParams;t!=null&&t.status&&l.set("status",t.status),t!=null&&t.roleId&&l.set("roleId",t.roleId);const a=l.toString();return It(`/jobs${a?"?"+a:""}`)},abortJob:t=>Kr(`/jobs/${t}`),getStatus:()=>It("/status"),detectEngine:()=>Hn("/setup/detect-engine",{}),validatePath:t=>Hn("/setup/validate-path",{path:t}),scaffold:t=>Hn("/setup/scaffold",t),getTeams:()=>It("/setup/teams"),browse:t=>Hn("/setup/browse",{path:t}),connectAkb:t=>Hn("/setup/connect-akb",{path:t}),getKnowledge:()=>It("/knowledge"),getKnowledgeDoc:t=>It(`/knowledge/${t}`),createKnowledgeDoc:t=>Hn("/knowledge",t),updateKnowledgeDoc:(t,l)=>fetch(`${Ds}/knowledge/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:l})}).then(a=>{if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}),deleteKnowledgeDoc:t=>Kr(`/knowledge/${t}`),getPreferences:()=>It("/preferences"),updatePreferences:t=>qf("/preferences",t),chatInChannel:t=>Hn("/speech/chat",t),getSaveStatus:()=>It("/save/status"),save:t=>Hn("/save",{message:t}),getSaveHistory:(t=20)=>It(`/save/history?limit=${t}`),restoreSave:(t,l)=>Hn("/save/restore",{sha:t,paths:l}),initGit:()=>Hn("/save/init",{}),getCostSummary:()=>It("/cost/summary")};function B0(t){const[l,a]=S.useState([]),[i,o]=S.useState("idle"),[u,f]=S.useState(""),[m,p]=S.useState([]),h=S.useRef(-1),g=S.useRef(null),y=S.useRef(0),b=S.useCallback(()=>{var E;if(!t)return;(E=g.current)==null||E.abort();const j=new AbortController;g.current=j,o("connecting");const k=h.current+1,C=`/api/jobs/${t}/stream?from=${k}`;fetch(C,{signal:j.signal}).then(async M=>{if(!M.ok||!M.body){o("error");return}o("streaming");const H=M.body.getReader(),B=new TextDecoder;let U="";for(;;){const{done:D,value:Y}=await H.read();if(D)break;U+=B.decode(Y,{stream:!0});const V=U.split(`
|
|
50
|
-
`);U=V.pop()??"";let ne="";for(const T of V)if(T.startsWith("event: "))ne=T.slice(7).trim();else if(T.startsWith("data: ")){try{const L=JSON.parse(T.slice(6));if(ne==="activity"){const $=L;$.seq>h.current&&(h.current=$.seq),a(ee=>ee.some(ae=>ae.seq===$.seq)?ee:[...ee,$]),$.type==="text"&&f(ee=>ee+($.data.text??"")),$.type==="dispatch:start"&&$.data.childJobId&&p(ee=>[...ee,$.data.childJobId]),$.type==="job:done"?o("done"):$.type==="job:error"&&o("error")}else if(ne==="stream:end"){const $=L.reason;o($==="done"?"done":$==="error"?"error":"done")}}catch{}ne=""}}i==="streaming"&&o("done")}).catch(M=>{M.name!=="AbortError"&&(o("error"),y.current<3&&(y.current++,setTimeout(b,1e3*y.current)))})},[t]),v=S.useCallback(()=>{y.current=0,b()},[b]);return S.useEffect(()=>{if(!t){a([]),o("idle"),f(""),p([]),h.current=-1;return}return a([]),f(""),p([]),h.current=-1,y.current=0,b(),()=>{var j;(j=g.current)==null||j.abort()}},[t,b]),{events:l,status:i,textOutput:u,childJobIds:m,reconnect:v}}function Xb(t,l){const a={};return(t[t.length-1]===""?[...t,""]:t).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const Vb=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Gb=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Kb={};function o1(t,l){return(Kb.jsx?Gb:Vb).test(t)}const Qb=/[ \t\n\f\r]/g;function Zb(t){return typeof t=="object"?t.type==="text"?c1(t.value):!1:c1(t)}function c1(t){return t.replace(Qb,"")===""}class Ts{constructor(l,a,i){this.normal=a,this.property=l,i&&(this.space=i)}}Ts.prototype.normal={};Ts.prototype.property={};Ts.prototype.space=void 0;function L0(t,l){const a={},i={};for(const o of t)Object.assign(a,o.property),Object.assign(i,o.normal);return new Ts(a,i,l)}function Ad(t){return t.toLowerCase()}class Mn{constructor(l,a){this.attribute=a,this.property=l}}Mn.prototype.attribute="";Mn.prototype.booleanish=!1;Mn.prototype.boolean=!1;Mn.prototype.commaOrSpaceSeparated=!1;Mn.prototype.commaSeparated=!1;Mn.prototype.defined=!1;Mn.prototype.mustUseProperty=!1;Mn.prototype.number=!1;Mn.prototype.overloadedBoolean=!1;Mn.prototype.property="";Mn.prototype.spaceSeparated=!1;Mn.prototype.space=void 0;let Wb=0;const Qe=dr(),Jt=dr(),Dd=dr(),we=dr(),zt=dr(),Pr=dr(),Un=dr();function dr(){return 2**++Wb}const Td=Object.freeze(Object.defineProperty({__proto__:null,boolean:Qe,booleanish:Jt,commaOrSpaceSeparated:Un,commaSeparated:Pr,number:we,overloadedBoolean:Dd,spaceSeparated:zt},Symbol.toStringTag,{value:"Module"})),Xf=Object.keys(Td);class Gd extends Mn{constructor(l,a,i,o){let u=-1;if(super(l,a),u1(this,"space",o),typeof i=="number")for(;++u<Xf.length;){const f=Xf[u];u1(this,Xf[u],(i&Td[f])===Td[f])}}}Gd.prototype.defined=!0;function u1(t,l,a){a&&(t[l]=a)}function li(t){const l={},a={};for(const[i,o]of Object.entries(t.properties)){const u=new Gd(i,t.transform(t.attributes||{},i),o,t.space);t.mustUseProperty&&t.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),l[i]=u,a[Ad(i)]=i,a[Ad(u.attribute)]=i}return new Ts(l,a,t.space)}const $0=li({properties:{ariaActiveDescendant:null,ariaAtomic:Jt,ariaAutoComplete:null,ariaBusy:Jt,ariaChecked:Jt,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:zt,ariaCurrent:null,ariaDescribedBy:zt,ariaDetails:null,ariaDisabled:Jt,ariaDropEffect:zt,ariaErrorMessage:null,ariaExpanded:Jt,ariaFlowTo:zt,ariaGrabbed:Jt,ariaHasPopup:null,ariaHidden:Jt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:zt,ariaLevel:we,ariaLive:null,ariaModal:Jt,ariaMultiLine:Jt,ariaMultiSelectable:Jt,ariaOrientation:null,ariaOwns:zt,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:Jt,ariaReadOnly:Jt,ariaRelevant:null,ariaRequired:Jt,ariaRoleDescription:zt,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:Jt,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(t,l){return l==="role"?l:"aria-"+l.slice(4).toLowerCase()}});function H0(t,l){return l in t?t[l]:l}function U0(t,l){return H0(t,l.toLowerCase())}const Jb=li({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Pr,acceptCharset:zt,accessKey:zt,action:null,allow:null,allowFullScreen:Qe,allowPaymentRequest:Qe,allowUserMedia:Qe,alt:null,as:null,async:Qe,autoCapitalize:null,autoComplete:zt,autoFocus:Qe,autoPlay:Qe,blocking:zt,capture:null,charSet:null,checked:Qe,cite:null,className:zt,cols:we,colSpan:null,content:null,contentEditable:Jt,controls:Qe,controlsList:zt,coords:we|Pr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Qe,defer:Qe,dir:null,dirName:null,disabled:Qe,download:Dd,draggable:Jt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Qe,formTarget:null,headers:zt,height:we,hidden:Dd,high:we,href:null,hrefLang:null,htmlFor:zt,httpEquiv:zt,id:null,imageSizes:null,imageSrcSet:null,inert:Qe,inputMode:null,integrity:null,is:null,isMap:Qe,itemId:null,itemProp:zt,itemRef:zt,itemScope:Qe,itemType:zt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Qe,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:Qe,muted:Qe,name:null,nonce:null,noModule:Qe,noValidate:Qe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Qe,optimum:we,pattern:null,ping:zt,placeholder:null,playsInline:Qe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Qe,referrerPolicy:null,rel:zt,required:Qe,reversed:Qe,rows:we,rowSpan:we,sandbox:zt,scope:null,scoped:Qe,seamless:Qe,selected:Qe,shadowRootClonable:Qe,shadowRootDelegatesFocus:Qe,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:Jt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:Qe,useMap:null,value:Jt,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:zt,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Qe,declare:Qe,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:Qe,noHref:Qe,noShade:Qe,noWrap:Qe,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:Jt,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Qe,disableRemotePlayback:Qe,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:U0}),Pb=li({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:Un,accentHeight:we,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:we,amplitude:we,arabicForm:null,ascent:we,attributeName:null,attributeType:null,azimuth:we,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:we,by:null,calcMode:null,capHeight:we,className:zt,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:we,diffuseConstant:we,direction:null,display:null,dur:null,divisor:we,dominantBaseline:null,download:Qe,dx:null,dy:null,edgeMode:null,editable:null,elevation:we,enableBackground:null,end:null,event:null,exponent:we,externalResourcesRequired:null,fill:null,fillOpacity:we,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:Pr,g2:Pr,glyphName:Pr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:we,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:we,horizOriginX:we,horizOriginY:we,id:null,ideographic:we,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:we,k:we,k1:we,k2:we,k3:we,k4:we,kernelMatrix:Un,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:we,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:we,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:we,overlineThickness:we,paintOrder:null,panose1:null,path:null,pathLength:we,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:zt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Un,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Un,rev:Un,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Un,requiredFeatures:Un,requiredFonts:Un,requiredFormats:Un,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:we,specularExponent:we,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:we,strikethroughThickness:we,string:null,stroke:null,strokeDashArray:Un,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:we,strokeOpacity:we,strokeWidth:null,style:null,surfaceScale:we,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Un,tabIndex:we,tableValues:null,target:null,targetX:we,targetY:we,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Un,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:we,underlineThickness:we,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:we,values:null,vAlphabetic:we,vMathematical:we,vectorEffect:null,vHanging:we,vIdeographic:we,version:null,vertAdvY:we,vertOriginX:we,vertOriginY:we,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:we,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:H0}),I0=li({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,l){return"xlink:"+l.slice(5).toLowerCase()}}),Y0=li({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:U0}),q0=li({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,l){return"xml:"+l.slice(3).toLowerCase()}}),ev={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,f1=/-[a-z]/g,nv=/^data[-\w.:]+$/i;function lv(t,l){const a=Ad(l);let i=l,o=Mn;if(a in t.normal)return t.property[t.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&nv.test(l)){if(l.charAt(4)==="-"){const u=l.slice(5).replace(f1,rv);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=l.slice(4);if(!f1.test(u)){let f=u.replace(tv,av);f.charAt(0)!=="-"&&(f="-"+f),l="data"+f}}o=Gd}return new o(i,l)}function av(t){return"-"+t.toLowerCase()}function rv(t){return t.charAt(1).toUpperCase()}const iv=L0([$0,Jb,I0,Y0,q0],"html"),Kd=L0([$0,Pb,I0,Y0,q0],"svg");function sv(t){return t.join(" ").trim()}var Qr={},Vf,d1;function ov(){if(d1)return Vf;d1=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,l=/\n/g,a=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,m=/^\s+|\s+$/g,p=`
|
|
51
|
-
`,h="/",g="*",y="",b="comment",v="declaration";function j(C,E){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];E=E||{};var M=1,H=1;function B(ae){var X=ae.match(l);X&&(M+=X.length);var I=ae.lastIndexOf(p);H=~I?ae.length-I:H+ae.length}function U(){var ae={line:M,column:H};return function(X){return X.position=new D(ae),ne(),X}}function D(ae){this.start=ae,this.end={line:M,column:H},this.source=E.source}D.prototype.content=C;function Y(ae){var X=new Error(E.source+":"+M+":"+H+": "+ae);if(X.reason=ae,X.filename=E.source,X.line=M,X.column=H,X.source=C,!E.silent)throw X}function V(ae){var X=ae.exec(C);if(X){var I=X[0];return B(I),C=C.slice(I.length),X}}function ne(){V(a)}function T(ae){var X;for(ae=ae||[];X=L();)X!==!1&&ae.push(X);return ae}function L(){var ae=U();if(!(h!=C.charAt(0)||g!=C.charAt(1))){for(var X=2;y!=C.charAt(X)&&(g!=C.charAt(X)||h!=C.charAt(X+1));)++X;if(X+=2,y===C.charAt(X-1))return Y("End of comment missing");var I=C.slice(2,X-2);return H+=2,B(I),C=C.slice(X),H+=2,ae({type:b,comment:I})}}function $(){var ae=U(),X=V(i);if(X){if(L(),!V(o))return Y("property missing ':'");var I=V(u),Q=ae({type:v,property:k(X[0].replace(t,y)),value:I?k(I[0].replace(t,y)):y});return V(f),Q}}function ee(){var ae=[];T(ae);for(var X;X=$();)X!==!1&&(ae.push(X),T(ae));return ae}return ne(),ee()}function k(C){return C?C.replace(m,y):y}return Vf=j,Vf}var h1;function cv(){if(h1)return Qr;h1=1;var t=Qr&&Qr.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.default=a;const l=t(ov());function a(i,o){let u=null;if(!i||typeof i!="string")return u;const f=(0,l.default)(i),m=typeof o=="function";return f.forEach(p=>{if(p.type!=="declaration")return;const{property:h,value:g}=p;m?o(h,g,p):g&&(u=u||{},u[h]=g)}),u}return Qr}var ss={},m1;function uv(){if(m1)return ss;m1=1,Object.defineProperty(ss,"__esModule",{value:!0}),ss.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,l=/-([a-z])/g,a=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,u=function(h){return!h||a.test(h)||t.test(h)},f=function(h,g){return g.toUpperCase()},m=function(h,g){return"".concat(g,"-")},p=function(h,g){return g===void 0&&(g={}),u(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(o,m):h=h.replace(i,m),h.replace(l,f))};return ss.camelCase=p,ss}var os,x1;function fv(){if(x1)return os;x1=1;var t=os&&os.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},l=t(cv()),a=uv();function i(o,u){var f={};return!o||typeof o!="string"||(0,l.default)(o,function(m,p){m&&p&&(f[(0,a.camelCase)(m,u)]=p)}),f}return i.default=i,os=i,os}var dv=fv();const hv=O0(dv),X0=V0("end"),Qd=V0("start");function V0(t){return l;function l(a){const i=a&&a.position&&a.position[t]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function mv(t){const l=Qd(t),a=X0(t);if(l&&a)return{start:l,end:a}}function vs(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?p1(t.position):"start"in t||"end"in t?p1(t):"line"in t||"column"in t?zd(t):""}function zd(t){return y1(t&&t.line)+":"+y1(t&&t.column)}function p1(t){return zd(t&&t.start)+"-"+zd(t&&t.end)}function y1(t){return t&&typeof t=="number"?t:1}class xn extends Error{constructor(l,a,i){super(),typeof a=="string"&&(i=a,a=void 0);let o="",u={},f=!1;if(a&&("line"in a&&"column"in a?u={place:a}:"start"in a&&"end"in a?u={place:a}:"type"in a?u={ancestors:[a],place:a.position}:u={...a}),typeof l=="string"?o=l:!u.cause&&l&&(f=!0,o=l.message,u.cause=l),!u.ruleId&&!u.source&&typeof i=="string"){const p=i.indexOf(":");p===-1?u.ruleId=i:(u.source=i.slice(0,p),u.ruleId=i.slice(p+1))}if(!u.place&&u.ancestors&&u.ancestors){const p=u.ancestors[u.ancestors.length-1];p&&(u.place=p.position)}const m=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=m?m.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=m?m.line:void 0,this.name=vs(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=f&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}xn.prototype.file="";xn.prototype.name="";xn.prototype.reason="";xn.prototype.message="";xn.prototype.stack="";xn.prototype.column=void 0;xn.prototype.line=void 0;xn.prototype.ancestors=void 0;xn.prototype.cause=void 0;xn.prototype.fatal=void 0;xn.prototype.place=void 0;xn.prototype.ruleId=void 0;xn.prototype.source=void 0;const Zd={}.hasOwnProperty,xv=new Map,pv=/[A-Z]/g,yv=new Set(["table","tbody","thead","tfoot","tr"]),gv=new Set(["td","th"]),G0="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function bv(t,l){if(!l||l.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=l.filePath||void 0;let i;if(l.development){if(typeof l.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=Nv(a,l.jsxDEV)}else{if(typeof l.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof l.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=Ev(a,l.jsx,l.jsxs)}const o={Fragment:l.Fragment,ancestors:[],components:l.components||{},create:i,elementAttributeNameCase:l.elementAttributeNameCase||"react",evaluater:l.createEvaluater?l.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:l.ignoreInvalidStyle||!1,passKeys:l.passKeys!==!1,passNode:l.passNode||!1,schema:l.space==="svg"?Kd:iv,stylePropertyNameCase:l.stylePropertyNameCase||"dom",tableCellAlignToStyle:l.tableCellAlignToStyle!==!1},u=K0(o,t,void 0);return u&&typeof u!="string"?u:o.create(t,o.Fragment,{children:u||void 0},void 0)}function K0(t,l,a){if(l.type==="element")return vv(t,l,a);if(l.type==="mdxFlowExpression"||l.type==="mdxTextExpression")return wv(t,l);if(l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement")return Sv(t,l,a);if(l.type==="mdxjsEsm")return kv(t,l);if(l.type==="root")return jv(t,l,a);if(l.type==="text")return Cv(t,l)}function vv(t,l,a){const i=t.schema;let o=i;l.tagName.toLowerCase()==="svg"&&i.space==="html"&&(o=Kd,t.schema=o),t.ancestors.push(l);const u=Z0(t,l.tagName,!1),f=Av(t,l);let m=Jd(t,l);return yv.has(l.tagName)&&(m=m.filter(function(p){return typeof p=="string"?!Zb(p):!0})),Q0(t,f,u,l),Wd(f,m),t.ancestors.pop(),t.schema=i,t.create(l,u,f,a)}function wv(t,l){if(l.data&&l.data.estree&&t.evaluater){const i=l.data.estree.body[0];return i.type,t.evaluater.evaluateExpression(i.expression)}js(t,l.position)}function kv(t,l){if(l.data&&l.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(l.data.estree);js(t,l.position)}function Sv(t,l,a){const i=t.schema;let o=i;l.name==="svg"&&i.space==="html"&&(o=Kd,t.schema=o),t.ancestors.push(l);const u=l.name===null?t.Fragment:Z0(t,l.name,!0),f=Dv(t,l),m=Jd(t,l);return Q0(t,f,u,l),Wd(f,m),t.ancestors.pop(),t.schema=i,t.create(l,u,f,a)}function jv(t,l,a){const i={};return Wd(i,Jd(t,l)),t.create(l,t.Fragment,i,a)}function Cv(t,l){return l.value}function Q0(t,l,a,i){typeof a!="string"&&a!==t.Fragment&&t.passNode&&(l.node=i)}function Wd(t,l){if(l.length>0){const a=l.length>1?l:l[0];a&&(t.children=a)}}function Ev(t,l,a){return i;function i(o,u,f,m){const h=Array.isArray(f.children)?a:l;return m?h(u,f,m):h(u,f)}}function Nv(t,l){return a;function a(i,o,u,f){const m=Array.isArray(u.children),p=Qd(i);return l(o,u,f,m,{columnNumber:p?p.column-1:void 0,fileName:t,lineNumber:p?p.line:void 0},void 0)}}function Av(t,l){const a={};let i,o;for(o in l.properties)if(o!=="children"&&Zd.call(l.properties,o)){const u=Tv(t,o,l.properties[o]);if(u){const[f,m]=u;t.tableCellAlignToStyle&&f==="align"&&typeof m=="string"&&gv.has(l.tagName)?i=m:a[f]=m}}if(i){const u=a.style||(a.style={});u[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return a}function Dv(t,l){const a={};for(const i of l.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&t.evaluater){const u=i.data.estree.body[0];u.type;const f=u.expression;f.type;const m=f.properties[0];m.type,Object.assign(a,t.evaluater.evaluateExpression(m.argument))}else js(t,l.position);else{const o=i.name;let u;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&t.evaluater){const m=i.value.data.estree.body[0];m.type,u=t.evaluater.evaluateExpression(m.expression)}else js(t,l.position);else u=i.value===null?!0:i.value;a[o]=u}return a}function Jd(t,l){const a=[];let i=-1;const o=t.passKeys?new Map:xv;for(;++i<l.children.length;){const u=l.children[i];let f;if(t.passKeys){const p=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(p){const h=o.get(p)||0;f=p+"-"+h,o.set(p,h+1)}}const m=K0(t,u,f);m!==void 0&&a.push(m)}return a}function Tv(t,l,a){const i=lv(t.schema,l);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=i.commaSeparated?Xb(a):sv(a)),i.property==="style"){let o=typeof a=="object"?a:zv(t,String(a));return t.stylePropertyNameCase==="css"&&(o=Mv(o)),["style",o]}return[t.elementAttributeNameCase==="react"&&i.space?ev[i.property]||i.property:i.attribute,a]}}function zv(t,l){try{return hv(l,{reactCompat:!0})}catch(a){if(t.ignoreInvalidStyle)return{};const i=a,o=new xn("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=t.filePath||void 0,o.url=G0+"#cannot-parse-style-attribute",o}}function Z0(t,l,a){let i;if(!a)i={type:"Literal",value:l};else if(l.includes(".")){const o=l.split(".");let u=-1,f;for(;++u<o.length;){const m=o1(o[u])?{type:"Identifier",name:o[u]}:{type:"Literal",value:o[u]};f=f?{type:"MemberExpression",object:f,property:m,computed:!!(u&&m.type==="Literal"),optional:!1}:m}i=f}else i=o1(l)&&!/^[a-z]/.test(l)?{type:"Identifier",name:l}:{type:"Literal",value:l};if(i.type==="Literal"){const o=i.value;return Zd.call(t.components,o)?t.components[o]:o}if(t.evaluater)return t.evaluater.evaluateExpression(i);js(t)}function js(t,l){const a=new xn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:l,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw a.file=t.filePath||void 0,a.url=G0+"#cannot-handle-mdx-estrees-without-createevaluater",a}function Mv(t){const l={};let a;for(a in t)Zd.call(t,a)&&(l[_v(a)]=t[a]);return l}function _v(t){let l=t.replace(pv,Fv);return l.slice(0,3)==="ms-"&&(l="-"+l),l}function Fv(t){return"-"+t.toLowerCase()}const Gf={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"]},Rv={};function Pd(t,l){const a=Rv,i=typeof a.includeImageAlt=="boolean"?a.includeImageAlt:!0,o=typeof a.includeHtml=="boolean"?a.includeHtml:!0;return W0(t,i,o)}function W0(t,l,a){if(Ov(t)){if("value"in t)return t.type==="html"&&!a?"":t.value;if(l&&"alt"in t&&t.alt)return t.alt;if("children"in t)return g1(t.children,l,a)}return Array.isArray(t)?g1(t,l,a):""}function g1(t,l,a){const i=[];let o=-1;for(;++o<t.length;)i[o]=W0(t[o],l,a);return i.join("")}function Ov(t){return!!(t&&typeof t=="object")}const b1=document.createElement("i");function eh(t){const l="&"+t+";";b1.innerHTML=l;const a=b1.textContent;return a.charCodeAt(a.length-1)===59&&t!=="semi"||a===l?!1:a}function Yn(t,l,a,i){const o=t.length;let u=0,f;if(l<0?l=-l>o?0:o+l:l=l>o?o:l,a=a>0?a:0,i.length<1e4)f=Array.from(i),f.unshift(l,a),t.splice(...f);else for(a&&t.splice(l,a);u<i.length;)f=i.slice(u,u+1e4),f.unshift(l,0),t.splice(...f),u+=1e4,l+=1e4}function nl(t,l){return t.length>0?(Yn(t,t.length,0,l),t):l}const v1={}.hasOwnProperty;function J0(t){const l={};let a=-1;for(;++a<t.length;)Bv(l,t[a]);return l}function Bv(t,l){let a;for(a in l){const o=(v1.call(t,a)?t[a]:void 0)||(t[a]={}),u=l[a];let f;if(u)for(f in u){v1.call(o,f)||(o[f]=[]);const m=u[f];Lv(o[f],Array.isArray(m)?m:m?[m]:[])}}}function Lv(t,l){let a=-1;const i=[];for(;++a<l.length;)(l[a].add==="after"?t:i).push(l[a]);Yn(t,0,0,i)}function P0(t,l){const a=Number.parseInt(t,l);return a<9||a===11||a>13&&a<32||a>126&&a<160||a>55295&&a<57344||a>64975&&a<65008||(a&65535)===65535||(a&65535)===65534||a>1114111?"�":String.fromCodePoint(a)}function hl(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const gn=Ra(/[A-Za-z]/),mn=Ra(/[\dA-Za-z]/),$v=Ra(/[#-'*+\--9=?A-Z^-~]/);function xc(t){return t!==null&&(t<32||t===127)}const Md=Ra(/\d/),Hv=Ra(/[\dA-Fa-f]/),Uv=Ra(/[!-/:-@[-`{-~]/);function He(t){return t!==null&&t<-2}function Tt(t){return t!==null&&(t<0||t===32)}function at(t){return t===-2||t===-1||t===32}const Ec=Ra(new RegExp("\\p{P}|\\p{S}","u")),ur=Ra(/\s/);function Ra(t){return l;function l(a){return a!==null&&a>-1&&t.test(String.fromCharCode(a))}}function ai(t){const l=[];let a=-1,i=0,o=0;for(;++a<t.length;){const u=t.charCodeAt(a);let f="";if(u===37&&mn(t.charCodeAt(a+1))&&mn(t.charCodeAt(a+2)))o=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(f=String.fromCharCode(u));else if(u>55295&&u<57344){const m=t.charCodeAt(a+1);u<56320&&m>56319&&m<57344?(f=String.fromCharCode(u,m),o=1):f="�"}else f=String.fromCharCode(u);f&&(l.push(t.slice(i,a),encodeURIComponent(f)),i=a+o+1,f=""),o&&(a+=o,o=0)}return l.join("")+t.slice(i)}function ct(t,l,a,i){const o=i?i-1:Number.POSITIVE_INFINITY;let u=0;return f;function f(p){return at(p)?(t.enter(a),m(p)):l(p)}function m(p){return at(p)&&u++<o?(t.consume(p),m):(t.exit(a),l(p))}}const Iv={tokenize:Yv};function Yv(t){const l=t.attempt(this.parser.constructs.contentInitial,i,o);let a;return l;function i(m){if(m===null){t.consume(m);return}return t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),ct(t,l,"linePrefix")}function o(m){return t.enter("paragraph"),u(m)}function u(m){const p=t.enter("chunkText",{contentType:"text",previous:a});return a&&(a.next=p),a=p,f(m)}function f(m){if(m===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(m);return}return He(m)?(t.consume(m),t.exit("chunkText"),u):(t.consume(m),f)}}const qv={tokenize:Xv},w1={tokenize:Vv};function Xv(t){const l=this,a=[];let i=0,o,u,f;return m;function m(H){if(i<a.length){const B=a[i];return l.containerState=B[1],t.attempt(B[0].continuation,p,h)(H)}return h(H)}function p(H){if(i++,l.containerState._closeFlow){l.containerState._closeFlow=void 0,o&&M();const B=l.events.length;let U=B,D;for(;U--;)if(l.events[U][0]==="exit"&&l.events[U][1].type==="chunkFlow"){D=l.events[U][1].end;break}E(i);let Y=B;for(;Y<l.events.length;)l.events[Y][1].end={...D},Y++;return Yn(l.events,U+1,0,l.events.slice(B)),l.events.length=Y,h(H)}return m(H)}function h(H){if(i===a.length){if(!o)return b(H);if(o.currentConstruct&&o.currentConstruct.concrete)return j(H);l.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return l.containerState={},t.check(w1,g,y)(H)}function g(H){return o&&M(),E(i),b(H)}function y(H){return l.parser.lazy[l.now().line]=i!==a.length,f=l.now().offset,j(H)}function b(H){return l.containerState={},t.attempt(w1,v,j)(H)}function v(H){return i++,a.push([l.currentConstruct,l.containerState]),b(H)}function j(H){if(H===null){o&&M(),E(0),t.consume(H);return}return o=o||l.parser.flow(l.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:u}),k(H)}function k(H){if(H===null){C(t.exit("chunkFlow"),!0),E(0),t.consume(H);return}return He(H)?(t.consume(H),C(t.exit("chunkFlow")),i=0,l.interrupt=void 0,m):(t.consume(H),k)}function C(H,B){const U=l.sliceStream(H);if(B&&U.push(null),H.previous=u,u&&(u.next=H),u=H,o.defineSkip(H.start),o.write(U),l.parser.lazy[H.start.line]){let D=o.events.length;for(;D--;)if(o.events[D][1].start.offset<f&&(!o.events[D][1].end||o.events[D][1].end.offset>f))return;const Y=l.events.length;let V=Y,ne,T;for(;V--;)if(l.events[V][0]==="exit"&&l.events[V][1].type==="chunkFlow"){if(ne){T=l.events[V][1].end;break}ne=!0}for(E(i),D=Y;D<l.events.length;)l.events[D][1].end={...T},D++;Yn(l.events,V+1,0,l.events.slice(Y)),l.events.length=D}}function E(H){let B=a.length;for(;B-- >H;){const U=a[B];l.containerState=U[1],U[0].exit.call(l,t)}a.length=H}function M(){o.write([null]),u=void 0,o=void 0,l.containerState._closeFlow=void 0}}function Vv(t,l,a){return ct(t,t.attempt(this.parser.constructs.document,l,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ei(t){if(t===null||Tt(t)||ur(t))return 1;if(Ec(t))return 2}function Nc(t,l,a){const i=[];let o=-1;for(;++o<t.length;){const u=t[o].resolveAll;u&&!i.includes(u)&&(l=u(l,a),i.push(u))}return l}const _d={name:"attention",resolveAll:Gv,tokenize:Kv};function Gv(t,l){let a=-1,i,o,u,f,m,p,h,g;for(;++a<t.length;)if(t[a][0]==="enter"&&t[a][1].type==="attentionSequence"&&t[a][1]._close){for(i=a;i--;)if(t[i][0]==="exit"&&t[i][1].type==="attentionSequence"&&t[i][1]._open&&l.sliceSerialize(t[i][1]).charCodeAt(0)===l.sliceSerialize(t[a][1]).charCodeAt(0)){if((t[i][1]._close||t[a][1]._open)&&(t[a][1].end.offset-t[a][1].start.offset)%3&&!((t[i][1].end.offset-t[i][1].start.offset+t[a][1].end.offset-t[a][1].start.offset)%3))continue;p=t[i][1].end.offset-t[i][1].start.offset>1&&t[a][1].end.offset-t[a][1].start.offset>1?2:1;const y={...t[i][1].end},b={...t[a][1].start};k1(y,-p),k1(b,p),f={type:p>1?"strongSequence":"emphasisSequence",start:y,end:{...t[i][1].end}},m={type:p>1?"strongSequence":"emphasisSequence",start:{...t[a][1].start},end:b},u={type:p>1?"strongText":"emphasisText",start:{...t[i][1].end},end:{...t[a][1].start}},o={type:p>1?"strong":"emphasis",start:{...f.start},end:{...m.end}},t[i][1].end={...f.start},t[a][1].start={...m.end},h=[],t[i][1].end.offset-t[i][1].start.offset&&(h=nl(h,[["enter",t[i][1],l],["exit",t[i][1],l]])),h=nl(h,[["enter",o,l],["enter",f,l],["exit",f,l],["enter",u,l]]),h=nl(h,Nc(l.parser.constructs.insideSpan.null,t.slice(i+1,a),l)),h=nl(h,[["exit",u,l],["enter",m,l],["exit",m,l],["exit",o,l]]),t[a][1].end.offset-t[a][1].start.offset?(g=2,h=nl(h,[["enter",t[a][1],l],["exit",t[a][1],l]])):g=0,Yn(t,i-1,a-i+3,h),a=i+h.length-g-2;break}}for(a=-1;++a<t.length;)t[a][1].type==="attentionSequence"&&(t[a][1].type="data");return t}function Kv(t,l){const a=this.parser.constructs.attentionMarkers.null,i=this.previous,o=ei(i);let u;return f;function f(p){return u=p,t.enter("attentionSequence"),m(p)}function m(p){if(p===u)return t.consume(p),m;const h=t.exit("attentionSequence"),g=ei(p),y=!g||g===2&&o||a.includes(p),b=!o||o===2&&g||a.includes(i);return h._open=!!(u===42?y:y&&(o||!b)),h._close=!!(u===42?b:b&&(g||!y)),l(p)}}function k1(t,l){t.column+=l,t.offset+=l,t._bufferIndex+=l}const Qv={name:"autolink",tokenize:Zv};function Zv(t,l,a){let i=0;return o;function o(v){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),u}function u(v){return gn(v)?(t.consume(v),f):v===64?a(v):h(v)}function f(v){return v===43||v===45||v===46||mn(v)?(i=1,m(v)):h(v)}function m(v){return v===58?(t.consume(v),i=0,p):(v===43||v===45||v===46||mn(v))&&i++<32?(t.consume(v),m):(i=0,h(v))}function p(v){return v===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),l):v===null||v===32||v===60||xc(v)?a(v):(t.consume(v),p)}function h(v){return v===64?(t.consume(v),g):$v(v)?(t.consume(v),h):a(v)}function g(v){return mn(v)?y(v):a(v)}function y(v){return v===46?(t.consume(v),i=0,g):v===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),l):b(v)}function b(v){if((v===45||mn(v))&&i++<63){const j=v===45?b:y;return t.consume(v),j}return a(v)}}const zs={partial:!0,tokenize:Wv};function Wv(t,l,a){return i;function i(u){return at(u)?ct(t,o,"linePrefix")(u):o(u)}function o(u){return u===null||He(u)?l(u):a(u)}}const ey={continuation:{tokenize:Pv},exit:ew,name:"blockQuote",tokenize:Jv};function Jv(t,l,a){const i=this;return o;function o(f){if(f===62){const m=i.containerState;return m.open||(t.enter("blockQuote",{_container:!0}),m.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(f),t.exit("blockQuoteMarker"),u}return a(f)}function u(f){return at(f)?(t.enter("blockQuotePrefixWhitespace"),t.consume(f),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),l):(t.exit("blockQuotePrefix"),l(f))}}function Pv(t,l,a){const i=this;return o;function o(f){return at(f)?ct(t,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):u(f)}function u(f){return t.attempt(ey,l,a)(f)}}function ew(t){t.exit("blockQuote")}const ty={name:"characterEscape",tokenize:tw};function tw(t,l,a){return i;function i(u){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(u),t.exit("escapeMarker"),o}function o(u){return Uv(u)?(t.enter("characterEscapeValue"),t.consume(u),t.exit("characterEscapeValue"),t.exit("characterEscape"),l):a(u)}}const ny={name:"characterReference",tokenize:nw};function nw(t,l,a){const i=this;let o=0,u,f;return m;function m(y){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),p}function p(y){return y===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(y),t.exit("characterReferenceMarkerNumeric"),h):(t.enter("characterReferenceValue"),u=31,f=mn,g(y))}function h(y){return y===88||y===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(y),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),u=6,f=Hv,g):(t.enter("characterReferenceValue"),u=7,f=Md,g(y))}function g(y){if(y===59&&o){const b=t.exit("characterReferenceValue");return f===mn&&!eh(i.sliceSerialize(b))?a(y):(t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),t.exit("characterReference"),l)}return f(y)&&o++<u?(t.consume(y),g):a(y)}}const S1={partial:!0,tokenize:aw},j1={concrete:!0,name:"codeFenced",tokenize:lw};function lw(t,l,a){const i=this,o={partial:!0,tokenize:U};let u=0,f=0,m;return p;function p(D){return h(D)}function h(D){const Y=i.events[i.events.length-1];return u=Y&&Y[1].type==="linePrefix"?Y[2].sliceSerialize(Y[1],!0).length:0,m=D,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),g(D)}function g(D){return D===m?(f++,t.consume(D),g):f<3?a(D):(t.exit("codeFencedFenceSequence"),at(D)?ct(t,y,"whitespace")(D):y(D))}function y(D){return D===null||He(D)?(t.exit("codeFencedFence"),i.interrupt?l(D):t.check(S1,k,B)(D)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),b(D))}function b(D){return D===null||He(D)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),y(D)):at(D)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),ct(t,v,"whitespace")(D)):D===96&&D===m?a(D):(t.consume(D),b)}function v(D){return D===null||He(D)?y(D):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),j(D))}function j(D){return D===null||He(D)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),y(D)):D===96&&D===m?a(D):(t.consume(D),j)}function k(D){return t.attempt(o,B,C)(D)}function C(D){return t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),E}function E(D){return u>0&&at(D)?ct(t,M,"linePrefix",u+1)(D):M(D)}function M(D){return D===null||He(D)?t.check(S1,k,B)(D):(t.enter("codeFlowValue"),H(D))}function H(D){return D===null||He(D)?(t.exit("codeFlowValue"),M(D)):(t.consume(D),H)}function B(D){return t.exit("codeFenced"),l(D)}function U(D,Y,V){let ne=0;return T;function T(X){return D.enter("lineEnding"),D.consume(X),D.exit("lineEnding"),L}function L(X){return D.enter("codeFencedFence"),at(X)?ct(D,$,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(X):$(X)}function $(X){return X===m?(D.enter("codeFencedFenceSequence"),ee(X)):V(X)}function ee(X){return X===m?(ne++,D.consume(X),ee):ne>=f?(D.exit("codeFencedFenceSequence"),at(X)?ct(D,ae,"whitespace")(X):ae(X)):V(X)}function ae(X){return X===null||He(X)?(D.exit("codeFencedFence"),Y(X)):V(X)}}}function aw(t,l,a){const i=this;return o;function o(f){return f===null?a(f):(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u)}function u(f){return i.parser.lazy[i.now().line]?a(f):l(f)}}const Kf={name:"codeIndented",tokenize:iw},rw={partial:!0,tokenize:sw};function iw(t,l,a){const i=this;return o;function o(h){return t.enter("codeIndented"),ct(t,u,"linePrefix",5)(h)}function u(h){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?f(h):a(h)}function f(h){return h===null?p(h):He(h)?t.attempt(rw,f,p)(h):(t.enter("codeFlowValue"),m(h))}function m(h){return h===null||He(h)?(t.exit("codeFlowValue"),f(h)):(t.consume(h),m)}function p(h){return t.exit("codeIndented"),l(h)}}function sw(t,l,a){const i=this;return o;function o(f){return i.parser.lazy[i.now().line]?a(f):He(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),o):ct(t,u,"linePrefix",5)(f)}function u(f){const m=i.events[i.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(f):He(f)?o(f):a(f)}}const ow={name:"codeText",previous:uw,resolve:cw,tokenize:fw};function cw(t){let l=t.length-4,a=3,i,o;if((t[a][1].type==="lineEnding"||t[a][1].type==="space")&&(t[l][1].type==="lineEnding"||t[l][1].type==="space")){for(i=a;++i<l;)if(t[i][1].type==="codeTextData"){t[a][1].type="codeTextPadding",t[l][1].type="codeTextPadding",a+=2,l-=2;break}}for(i=a-1,l++;++i<=l;)o===void 0?i!==l&&t[i][1].type!=="lineEnding"&&(o=i):(i===l||t[i][1].type==="lineEnding")&&(t[o][1].type="codeTextData",i!==o+2&&(t[o][1].end=t[i-1][1].end,t.splice(o+2,i-o-2),l-=i-o-2,i=o+2),o=void 0);return t}function uw(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function fw(t,l,a){let i=0,o,u;return f;function f(y){return t.enter("codeText"),t.enter("codeTextSequence"),m(y)}function m(y){return y===96?(t.consume(y),i++,m):(t.exit("codeTextSequence"),p(y))}function p(y){return y===null?a(y):y===32?(t.enter("space"),t.consume(y),t.exit("space"),p):y===96?(u=t.enter("codeTextSequence"),o=0,g(y)):He(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),p):(t.enter("codeTextData"),h(y))}function h(y){return y===null||y===32||y===96||He(y)?(t.exit("codeTextData"),p(y)):(t.consume(y),h)}function g(y){return y===96?(t.consume(y),o++,g):o===i?(t.exit("codeTextSequence"),t.exit("codeText"),l(y)):(u.type="codeTextData",h(y))}}class dw{constructor(l){this.left=l?[...l]:[],this.right=[]}get(l){if(l<0||l>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+l+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return l<this.left.length?this.left[l]:this.right[this.right.length-l+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(l,a){const i=a??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(l,i):l>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-l+this.left.length).reverse():this.left.slice(l).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(l,a,i){const o=a||0;this.setCursor(Math.trunc(l));const u=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return i&&cs(this.left,i),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(l){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(l)}pushMany(l){this.setCursor(Number.POSITIVE_INFINITY),cs(this.left,l)}unshift(l){this.setCursor(0),this.right.push(l)}unshiftMany(l){this.setCursor(0),cs(this.right,l.reverse())}setCursor(l){if(!(l===this.left.length||l>this.left.length&&this.right.length===0||l<0&&this.left.length===0))if(l<this.left.length){const a=this.left.splice(l,Number.POSITIVE_INFINITY);cs(this.right,a.reverse())}else{const a=this.right.splice(this.left.length+this.right.length-l,Number.POSITIVE_INFINITY);cs(this.left,a.reverse())}}}function cs(t,l){let a=0;if(l.length<1e4)t.push(...l);else for(;a<l.length;)t.push(...l.slice(a,a+1e4)),a+=1e4}function ly(t){const l={};let a=-1,i,o,u,f,m,p,h;const g=new dw(t);for(;++a<g.length;){for(;a in l;)a=l[a];if(i=g.get(a),a&&i[1].type==="chunkFlow"&&g.get(a-1)[1].type==="listItemPrefix"&&(p=i[1]._tokenizer.events,u=0,u<p.length&&p[u][1].type==="lineEndingBlank"&&(u+=2),u<p.length&&p[u][1].type==="content"))for(;++u<p.length&&p[u][1].type!=="content";)p[u][1].type==="chunkText"&&(p[u][1]._isInFirstContentOfListItem=!0,u++);if(i[0]==="enter")i[1].contentType&&(Object.assign(l,hw(g,a)),a=l[a],h=!0);else if(i[1]._container){for(u=a,o=void 0;u--;)if(f=g.get(u),f[1].type==="lineEnding"||f[1].type==="lineEndingBlank")f[0]==="enter"&&(o&&(g.get(o)[1].type="lineEndingBlank"),f[1].type="lineEnding",o=u);else if(!(f[1].type==="linePrefix"||f[1].type==="listItemIndent"))break;o&&(i[1].end={...g.get(o)[1].start},m=g.slice(o,a),m.unshift(i),g.splice(o,a-o+1,m))}}return Yn(t,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function hw(t,l){const a=t.get(l)[1],i=t.get(l)[2];let o=l-1;const u=[];let f=a._tokenizer;f||(f=i.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(f._contentTypeTextTrailing=!0));const m=f.events,p=[],h={};let g,y,b=-1,v=a,j=0,k=0;const C=[k];for(;v;){for(;t.get(++o)[1]!==v;);u.push(o),v._tokenizer||(g=i.sliceStream(v),v.next||g.push(null),y&&f.defineSkip(v.start),v._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=!0),f.write(g),v._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=void 0)),y=v,v=v.next}for(v=a;++b<m.length;)m[b][0]==="exit"&&m[b-1][0]==="enter"&&m[b][1].type===m[b-1][1].type&&m[b][1].start.line!==m[b][1].end.line&&(k=b+1,C.push(k),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(f.events=[],v?(v._tokenizer=void 0,v.previous=void 0):C.pop(),b=C.length;b--;){const E=m.slice(C[b],C[b+1]),M=u.pop();p.push([M,M+E.length-1]),t.splice(M,2,E)}for(p.reverse(),b=-1;++b<p.length;)h[j+p[b][0]]=j+p[b][1],j+=p[b][1]-p[b][0]-1;return h}const mw={resolve:pw,tokenize:yw},xw={partial:!0,tokenize:gw};function pw(t){return ly(t),t}function yw(t,l){let a;return i;function i(m){return t.enter("content"),a=t.enter("chunkContent",{contentType:"content"}),o(m)}function o(m){return m===null?u(m):He(m)?t.check(xw,f,u)(m):(t.consume(m),o)}function u(m){return t.exit("chunkContent"),t.exit("content"),l(m)}function f(m){return t.consume(m),t.exit("chunkContent"),a.next=t.enter("chunkContent",{contentType:"content",previous:a}),a=a.next,o}}function gw(t,l,a){const i=this;return o;function o(f){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),ct(t,u,"linePrefix")}function u(f){if(f===null||He(f))return a(f);const m=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(f):t.interrupt(i.parser.constructs.flow,a,l)(f)}}function ay(t,l,a,i,o,u,f,m,p){const h=p||Number.POSITIVE_INFINITY;let g=0;return y;function y(E){return E===60?(t.enter(i),t.enter(o),t.enter(u),t.consume(E),t.exit(u),b):E===null||E===32||E===41||xc(E)?a(E):(t.enter(i),t.enter(f),t.enter(m),t.enter("chunkString",{contentType:"string"}),k(E))}function b(E){return E===62?(t.enter(u),t.consume(E),t.exit(u),t.exit(o),t.exit(i),l):(t.enter(m),t.enter("chunkString",{contentType:"string"}),v(E))}function v(E){return E===62?(t.exit("chunkString"),t.exit(m),b(E)):E===null||E===60||He(E)?a(E):(t.consume(E),E===92?j:v)}function j(E){return E===60||E===62||E===92?(t.consume(E),v):v(E)}function k(E){return!g&&(E===null||E===41||Tt(E))?(t.exit("chunkString"),t.exit(m),t.exit(f),t.exit(i),l(E)):g<h&&E===40?(t.consume(E),g++,k):E===41?(t.consume(E),g--,k):E===null||E===32||E===40||xc(E)?a(E):(t.consume(E),E===92?C:k)}function C(E){return E===40||E===41||E===92?(t.consume(E),k):k(E)}}function ry(t,l,a,i,o,u){const f=this;let m=0,p;return h;function h(v){return t.enter(i),t.enter(o),t.consume(v),t.exit(o),t.enter(u),g}function g(v){return m>999||v===null||v===91||v===93&&!p||v===94&&!m&&"_hiddenFootnoteSupport"in f.parser.constructs?a(v):v===93?(t.exit(u),t.enter(o),t.consume(v),t.exit(o),t.exit(i),l):He(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),g):(t.enter("chunkString",{contentType:"string"}),y(v))}function y(v){return v===null||v===91||v===93||He(v)||m++>999?(t.exit("chunkString"),g(v)):(t.consume(v),p||(p=!at(v)),v===92?b:y)}function b(v){return v===91||v===92||v===93?(t.consume(v),m++,y):y(v)}}function iy(t,l,a,i,o,u){let f;return m;function m(b){return b===34||b===39||b===40?(t.enter(i),t.enter(o),t.consume(b),t.exit(o),f=b===40?41:b,p):a(b)}function p(b){return b===f?(t.enter(o),t.consume(b),t.exit(o),t.exit(i),l):(t.enter(u),h(b))}function h(b){return b===f?(t.exit(u),p(f)):b===null?a(b):He(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),ct(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===f||b===null||He(b)?(t.exit("chunkString"),h(b)):(t.consume(b),b===92?y:g)}function y(b){return b===f||b===92?(t.consume(b),g):g(b)}}function ws(t,l){let a;return i;function i(o){return He(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),a=!0,i):at(o)?ct(t,i,a?"linePrefix":"lineSuffix")(o):l(o)}}const bw={name:"definition",tokenize:ww},vw={partial:!0,tokenize:kw};function ww(t,l,a){const i=this;let o;return u;function u(v){return t.enter("definition"),f(v)}function f(v){return ry.call(i,t,m,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function m(v){return o=hl(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),p):a(v)}function p(v){return Tt(v)?ws(t,h)(v):h(v)}function h(v){return ay(t,g,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function g(v){return t.attempt(vw,y,y)(v)}function y(v){return at(v)?ct(t,b,"whitespace")(v):b(v)}function b(v){return v===null||He(v)?(t.exit("definition"),i.parser.defined.push(o),l(v)):a(v)}}function kw(t,l,a){return i;function i(m){return Tt(m)?ws(t,o)(m):a(m)}function o(m){return iy(t,u,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(m)}function u(m){return at(m)?ct(t,f,"whitespace")(m):f(m)}function f(m){return m===null||He(m)?l(m):a(m)}}const Sw={name:"hardBreakEscape",tokenize:jw};function jw(t,l,a){return i;function i(u){return t.enter("hardBreakEscape"),t.consume(u),o}function o(u){return He(u)?(t.exit("hardBreakEscape"),l(u)):a(u)}}const Cw={name:"headingAtx",resolve:Ew,tokenize:Nw};function Ew(t,l){let a=t.length-2,i=3,o,u;return t[i][1].type==="whitespace"&&(i+=2),a-2>i&&t[a][1].type==="whitespace"&&(a-=2),t[a][1].type==="atxHeadingSequence"&&(i===a-1||a-4>i&&t[a-2][1].type==="whitespace")&&(a-=i+1===a?2:4),a>i&&(o={type:"atxHeadingText",start:t[i][1].start,end:t[a][1].end},u={type:"chunkText",start:t[i][1].start,end:t[a][1].end,contentType:"text"},Yn(t,i,a-i+1,[["enter",o,l],["enter",u,l],["exit",u,l],["exit",o,l]])),t}function Nw(t,l,a){let i=0;return o;function o(g){return t.enter("atxHeading"),u(g)}function u(g){return t.enter("atxHeadingSequence"),f(g)}function f(g){return g===35&&i++<6?(t.consume(g),f):g===null||Tt(g)?(t.exit("atxHeadingSequence"),m(g)):a(g)}function m(g){return g===35?(t.enter("atxHeadingSequence"),p(g)):g===null||He(g)?(t.exit("atxHeading"),l(g)):at(g)?ct(t,m,"whitespace")(g):(t.enter("atxHeadingText"),h(g))}function p(g){return g===35?(t.consume(g),p):(t.exit("atxHeadingSequence"),m(g))}function h(g){return g===null||g===35||Tt(g)?(t.exit("atxHeadingText"),m(g)):(t.consume(g),h)}}const Aw=["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"],C1=["pre","script","style","textarea"],Dw={concrete:!0,name:"htmlFlow",resolveTo:Mw,tokenize:_w},Tw={partial:!0,tokenize:Rw},zw={partial:!0,tokenize:Fw};function Mw(t){let l=t.length;for(;l--&&!(t[l][0]==="enter"&&t[l][1].type==="htmlFlow"););return l>1&&t[l-2][1].type==="linePrefix"&&(t[l][1].start=t[l-2][1].start,t[l+1][1].start=t[l-2][1].start,t.splice(l-2,2)),t}function _w(t,l,a){const i=this;let o,u,f,m,p;return h;function h(A){return g(A)}function g(A){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(A),y}function y(A){return A===33?(t.consume(A),b):A===47?(t.consume(A),u=!0,k):A===63?(t.consume(A),o=3,i.interrupt?l:z):gn(A)?(t.consume(A),f=String.fromCharCode(A),C):a(A)}function b(A){return A===45?(t.consume(A),o=2,v):A===91?(t.consume(A),o=5,m=0,j):gn(A)?(t.consume(A),o=4,i.interrupt?l:z):a(A)}function v(A){return A===45?(t.consume(A),i.interrupt?l:z):a(A)}function j(A){const pe="CDATA[";return A===pe.charCodeAt(m++)?(t.consume(A),m===pe.length?i.interrupt?l:$:j):a(A)}function k(A){return gn(A)?(t.consume(A),f=String.fromCharCode(A),C):a(A)}function C(A){if(A===null||A===47||A===62||Tt(A)){const pe=A===47,Ee=f.toLowerCase();return!pe&&!u&&C1.includes(Ee)?(o=1,i.interrupt?l(A):$(A)):Aw.includes(f.toLowerCase())?(o=6,pe?(t.consume(A),E):i.interrupt?l(A):$(A)):(o=7,i.interrupt&&!i.parser.lazy[i.now().line]?a(A):u?M(A):H(A))}return A===45||mn(A)?(t.consume(A),f+=String.fromCharCode(A),C):a(A)}function E(A){return A===62?(t.consume(A),i.interrupt?l:$):a(A)}function M(A){return at(A)?(t.consume(A),M):T(A)}function H(A){return A===47?(t.consume(A),T):A===58||A===95||gn(A)?(t.consume(A),B):at(A)?(t.consume(A),H):T(A)}function B(A){return A===45||A===46||A===58||A===95||mn(A)?(t.consume(A),B):U(A)}function U(A){return A===61?(t.consume(A),D):at(A)?(t.consume(A),U):H(A)}function D(A){return A===null||A===60||A===61||A===62||A===96?a(A):A===34||A===39?(t.consume(A),p=A,Y):at(A)?(t.consume(A),D):V(A)}function Y(A){return A===p?(t.consume(A),p=null,ne):A===null||He(A)?a(A):(t.consume(A),Y)}function V(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||Tt(A)?U(A):(t.consume(A),V)}function ne(A){return A===47||A===62||at(A)?H(A):a(A)}function T(A){return A===62?(t.consume(A),L):a(A)}function L(A){return A===null||He(A)?$(A):at(A)?(t.consume(A),L):a(A)}function $(A){return A===45&&o===2?(t.consume(A),I):A===60&&o===1?(t.consume(A),Q):A===62&&o===4?(t.consume(A),_):A===63&&o===3?(t.consume(A),z):A===93&&o===5?(t.consume(A),Se):He(A)&&(o===6||o===7)?(t.exit("htmlFlowData"),t.check(Tw,P,ee)(A)):A===null||He(A)?(t.exit("htmlFlowData"),ee(A)):(t.consume(A),$)}function ee(A){return t.check(zw,ae,P)(A)}function ae(A){return t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),X}function X(A){return A===null||He(A)?ee(A):(t.enter("htmlFlowData"),$(A))}function I(A){return A===45?(t.consume(A),z):$(A)}function Q(A){return A===47?(t.consume(A),f="",ie):$(A)}function ie(A){if(A===62){const pe=f.toLowerCase();return C1.includes(pe)?(t.consume(A),_):$(A)}return gn(A)&&f.length<8?(t.consume(A),f+=String.fromCharCode(A),ie):$(A)}function Se(A){return A===93?(t.consume(A),z):$(A)}function z(A){return A===62?(t.consume(A),_):A===45&&o===2?(t.consume(A),z):$(A)}function _(A){return A===null||He(A)?(t.exit("htmlFlowData"),P(A)):(t.consume(A),_)}function P(A){return t.exit("htmlFlow"),l(A)}}function Fw(t,l,a){const i=this;return o;function o(f){return He(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u):a(f)}function u(f){return i.parser.lazy[i.now().line]?a(f):l(f)}}function Rw(t,l,a){return i;function i(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(zs,l,a)}}const Ow={name:"htmlText",tokenize:Bw};function Bw(t,l,a){const i=this;let o,u,f;return m;function m(z){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(z),p}function p(z){return z===33?(t.consume(z),h):z===47?(t.consume(z),U):z===63?(t.consume(z),H):gn(z)?(t.consume(z),V):a(z)}function h(z){return z===45?(t.consume(z),g):z===91?(t.consume(z),u=0,j):gn(z)?(t.consume(z),M):a(z)}function g(z){return z===45?(t.consume(z),v):a(z)}function y(z){return z===null?a(z):z===45?(t.consume(z),b):He(z)?(f=y,Q(z)):(t.consume(z),y)}function b(z){return z===45?(t.consume(z),v):y(z)}function v(z){return z===62?I(z):z===45?b(z):y(z)}function j(z){const _="CDATA[";return z===_.charCodeAt(u++)?(t.consume(z),u===_.length?k:j):a(z)}function k(z){return z===null?a(z):z===93?(t.consume(z),C):He(z)?(f=k,Q(z)):(t.consume(z),k)}function C(z){return z===93?(t.consume(z),E):k(z)}function E(z){return z===62?I(z):z===93?(t.consume(z),E):k(z)}function M(z){return z===null||z===62?I(z):He(z)?(f=M,Q(z)):(t.consume(z),M)}function H(z){return z===null?a(z):z===63?(t.consume(z),B):He(z)?(f=H,Q(z)):(t.consume(z),H)}function B(z){return z===62?I(z):H(z)}function U(z){return gn(z)?(t.consume(z),D):a(z)}function D(z){return z===45||mn(z)?(t.consume(z),D):Y(z)}function Y(z){return He(z)?(f=Y,Q(z)):at(z)?(t.consume(z),Y):I(z)}function V(z){return z===45||mn(z)?(t.consume(z),V):z===47||z===62||Tt(z)?ne(z):a(z)}function ne(z){return z===47?(t.consume(z),I):z===58||z===95||gn(z)?(t.consume(z),T):He(z)?(f=ne,Q(z)):at(z)?(t.consume(z),ne):I(z)}function T(z){return z===45||z===46||z===58||z===95||mn(z)?(t.consume(z),T):L(z)}function L(z){return z===61?(t.consume(z),$):He(z)?(f=L,Q(z)):at(z)?(t.consume(z),L):ne(z)}function $(z){return z===null||z===60||z===61||z===62||z===96?a(z):z===34||z===39?(t.consume(z),o=z,ee):He(z)?(f=$,Q(z)):at(z)?(t.consume(z),$):(t.consume(z),ae)}function ee(z){return z===o?(t.consume(z),o=void 0,X):z===null?a(z):He(z)?(f=ee,Q(z)):(t.consume(z),ee)}function ae(z){return z===null||z===34||z===39||z===60||z===61||z===96?a(z):z===47||z===62||Tt(z)?ne(z):(t.consume(z),ae)}function X(z){return z===47||z===62||Tt(z)?ne(z):a(z)}function I(z){return z===62?(t.consume(z),t.exit("htmlTextData"),t.exit("htmlText"),l):a(z)}function Q(z){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),ie}function ie(z){return at(z)?ct(t,Se,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):Se(z)}function Se(z){return t.enter("htmlTextData"),f(z)}}const th={name:"labelEnd",resolveAll:Uw,resolveTo:Iw,tokenize:Yw},Lw={tokenize:qw},$w={tokenize:Xw},Hw={tokenize:Vw};function Uw(t){let l=-1;const a=[];for(;++l<t.length;){const i=t[l][1];if(a.push(t[l]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const o=i.type==="labelImage"?4:2;i.type="data",l+=o}}return t.length!==a.length&&Yn(t,0,t.length,a),t}function Iw(t,l){let a=t.length,i=0,o,u,f,m;for(;a--;)if(o=t[a][1],u){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;t[a][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(f){if(t[a][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(u=a,o.type!=="labelLink")){i=2;break}}else o.type==="labelEnd"&&(f=a);const p={type:t[u][1].type==="labelLink"?"link":"image",start:{...t[u][1].start},end:{...t[t.length-1][1].end}},h={type:"label",start:{...t[u][1].start},end:{...t[f][1].end}},g={type:"labelText",start:{...t[u+i+2][1].end},end:{...t[f-2][1].start}};return m=[["enter",p,l],["enter",h,l]],m=nl(m,t.slice(u+1,u+i+3)),m=nl(m,[["enter",g,l]]),m=nl(m,Nc(l.parser.constructs.insideSpan.null,t.slice(u+i+4,f-3),l)),m=nl(m,[["exit",g,l],t[f-2],t[f-1],["exit",h,l]]),m=nl(m,t.slice(f+1)),m=nl(m,[["exit",p,l]]),Yn(t,u,t.length,m),t}function Yw(t,l,a){const i=this;let o=i.events.length,u,f;for(;o--;)if((i.events[o][1].type==="labelImage"||i.events[o][1].type==="labelLink")&&!i.events[o][1]._balanced){u=i.events[o][1];break}return m;function m(b){return u?u._inactive?y(b):(f=i.parser.defined.includes(hl(i.sliceSerialize({start:u.end,end:i.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(b),t.exit("labelMarker"),t.exit("labelEnd"),p):a(b)}function p(b){return b===40?t.attempt(Lw,g,f?g:y)(b):b===91?t.attempt($w,g,f?h:y)(b):f?g(b):y(b)}function h(b){return t.attempt(Hw,g,y)(b)}function g(b){return l(b)}function y(b){return u._balanced=!0,a(b)}}function qw(t,l,a){return i;function i(y){return t.enter("resource"),t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),o}function o(y){return Tt(y)?ws(t,u)(y):u(y)}function u(y){return y===41?g(y):ay(t,f,m,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function f(y){return Tt(y)?ws(t,p)(y):g(y)}function m(y){return a(y)}function p(y){return y===34||y===39||y===40?iy(t,h,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function h(y){return Tt(y)?ws(t,g)(y):g(y)}function g(y){return y===41?(t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),t.exit("resource"),l):a(y)}}function Xw(t,l,a){const i=this;return o;function o(m){return ry.call(i,t,u,f,"reference","referenceMarker","referenceString")(m)}function u(m){return i.parser.defined.includes(hl(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?l(m):a(m)}function f(m){return a(m)}}function Vw(t,l,a){return i;function i(u){return t.enter("reference"),t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),o}function o(u){return u===93?(t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),t.exit("reference"),l):a(u)}}const Gw={name:"labelStartImage",resolveAll:th.resolveAll,tokenize:Kw};function Kw(t,l,a){const i=this;return o;function o(m){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(m),t.exit("labelImageMarker"),u}function u(m){return m===91?(t.enter("labelMarker"),t.consume(m),t.exit("labelMarker"),t.exit("labelImage"),f):a(m)}function f(m){return m===94&&"_hiddenFootnoteSupport"in i.parser.constructs?a(m):l(m)}}const Qw={name:"labelStartLink",resolveAll:th.resolveAll,tokenize:Zw};function Zw(t,l,a){const i=this;return o;function o(f){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(f),t.exit("labelMarker"),t.exit("labelLink"),u}function u(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?a(f):l(f)}}const Qf={name:"lineEnding",tokenize:Ww};function Ww(t,l){return a;function a(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),ct(t,l,"linePrefix")}}const cc={name:"thematicBreak",tokenize:Jw};function Jw(t,l,a){let i=0,o;return u;function u(h){return t.enter("thematicBreak"),f(h)}function f(h){return o=h,m(h)}function m(h){return h===o?(t.enter("thematicBreakSequence"),p(h)):i>=3&&(h===null||He(h))?(t.exit("thematicBreak"),l(h)):a(h)}function p(h){return h===o?(t.consume(h),i++,p):(t.exit("thematicBreakSequence"),at(h)?ct(t,m,"whitespace")(h):m(h))}}const zn={continuation:{tokenize:n5},exit:a5,name:"list",tokenize:t5},Pw={partial:!0,tokenize:r5},e5={partial:!0,tokenize:l5};function t5(t,l,a){const i=this,o=i.events[i.events.length-1];let u=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,f=0;return m;function m(v){const j=i.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(j==="listUnordered"?!i.containerState.marker||v===i.containerState.marker:Md(v)){if(i.containerState.type||(i.containerState.type=j,t.enter(j,{_container:!0})),j==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(cc,a,h)(v):h(v);if(!i.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),p(v)}return a(v)}function p(v){return Md(v)&&++f<10?(t.consume(v),p):(!i.interrupt||f<2)&&(i.containerState.marker?v===i.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),h(v)):a(v)}function h(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||v,t.check(zs,i.interrupt?a:g,t.attempt(Pw,b,y))}function g(v){return i.containerState.initialBlankLine=!0,u++,b(v)}function y(v){return at(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),b):a(v)}function b(v){return i.containerState.size=u+i.sliceSerialize(t.exit("listItemPrefix"),!0).length,l(v)}}function n5(t,l,a){const i=this;return i.containerState._closeFlow=void 0,t.check(zs,o,u);function o(m){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,ct(t,l,"listItemIndent",i.containerState.size+1)(m)}function u(m){return i.containerState.furtherBlankLines||!at(m)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,f(m)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,t.attempt(e5,l,f)(m))}function f(m){return i.containerState._closeFlow=!0,i.interrupt=void 0,ct(t,t.attempt(zn,l,a),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m)}}function l5(t,l,a){const i=this;return ct(t,o,"listItemIndent",i.containerState.size+1);function o(u){const f=i.events[i.events.length-1];return f&&f[1].type==="listItemIndent"&&f[2].sliceSerialize(f[1],!0).length===i.containerState.size?l(u):a(u)}}function a5(t){t.exit(this.containerState.type)}function r5(t,l,a){const i=this;return ct(t,o,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(u){const f=i.events[i.events.length-1];return!at(u)&&f&&f[1].type==="listItemPrefixWhitespace"?l(u):a(u)}}const E1={name:"setextUnderline",resolveTo:i5,tokenize:s5};function i5(t,l){let a=t.length,i,o,u;for(;a--;)if(t[a][0]==="enter"){if(t[a][1].type==="content"){i=a;break}t[a][1].type==="paragraph"&&(o=a)}else t[a][1].type==="content"&&t.splice(a,1),!u&&t[a][1].type==="definition"&&(u=a);const f={type:"setextHeading",start:{...t[i][1].start},end:{...t[t.length-1][1].end}};return t[o][1].type="setextHeadingText",u?(t.splice(o,0,["enter",f,l]),t.splice(u+1,0,["exit",t[i][1],l]),t[i][1].end={...t[u][1].end}):t[i][1]=f,t.push(["exit",f,l]),t}function s5(t,l,a){const i=this;let o;return u;function u(h){let g=i.events.length,y;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){y=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||y)?(t.enter("setextHeadingLine"),o=h,f(h)):a(h)}function f(h){return t.enter("setextHeadingLineSequence"),m(h)}function m(h){return h===o?(t.consume(h),m):(t.exit("setextHeadingLineSequence"),at(h)?ct(t,p,"lineSuffix")(h):p(h))}function p(h){return h===null||He(h)?(t.exit("setextHeadingLine"),l(h)):a(h)}}const o5={tokenize:c5};function c5(t){const l=this,a=t.attempt(zs,i,t.attempt(this.parser.constructs.flowInitial,o,ct(t,t.attempt(this.parser.constructs.flow,o,t.attempt(mw,o)),"linePrefix")));return a;function i(u){if(u===null){t.consume(u);return}return t.enter("lineEndingBlank"),t.consume(u),t.exit("lineEndingBlank"),l.currentConstruct=void 0,a}function o(u){if(u===null){t.consume(u);return}return t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),l.currentConstruct=void 0,a}}const u5={resolveAll:oy()},f5=sy("string"),d5=sy("text");function sy(t){return{resolveAll:oy(t==="text"?h5:void 0),tokenize:l};function l(a){const i=this,o=this.parser.constructs[t],u=a.attempt(o,f,m);return f;function f(g){return h(g)?u(g):m(g)}function m(g){if(g===null){a.consume(g);return}return a.enter("data"),a.consume(g),p}function p(g){return h(g)?(a.exit("data"),u(g)):(a.consume(g),p)}function h(g){if(g===null)return!0;const y=o[g];let b=-1;if(y)for(;++b<y.length;){const v=y[b];if(!v.previous||v.previous.call(i,i.previous))return!0}return!1}}}function oy(t){return l;function l(a,i){let o=-1,u;for(;++o<=a.length;)u===void 0?a[o]&&a[o][1].type==="data"&&(u=o,o++):(!a[o]||a[o][1].type!=="data")&&(o!==u+2&&(a[u][1].end=a[o-1][1].end,a.splice(u+2,o-u-2),o=u+2),u=void 0);return t?t(a,i):a}}function h5(t,l){let a=0;for(;++a<=t.length;)if((a===t.length||t[a][1].type==="lineEnding")&&t[a-1][1].type==="data"){const i=t[a-1][1],o=l.sliceStream(i);let u=o.length,f=-1,m=0,p;for(;u--;){const h=o[u];if(typeof h=="string"){for(f=h.length;h.charCodeAt(f-1)===32;)m++,f--;if(f)break;f=-1}else if(h===-2)p=!0,m++;else if(h!==-1){u++;break}}if(l._contentTypeTextTrailing&&a===t.length&&(m=0),m){const h={type:a===t.length||p||m<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?f:i.start._bufferIndex+f,_index:i.start._index+u,line:i.end.line,column:i.end.column-m,offset:i.end.offset-m},end:{...i.end}};i.end={...h.start},i.start.offset===i.end.offset?Object.assign(i,h):(t.splice(a,0,["enter",h,l],["exit",h,l]),a+=2)}a++}return t}const m5={42:zn,43:zn,45:zn,48:zn,49:zn,50:zn,51:zn,52:zn,53:zn,54:zn,55:zn,56:zn,57:zn,62:ey},x5={91:bw},p5={[-2]:Kf,[-1]:Kf,32:Kf},y5={35:Cw,42:cc,45:[E1,cc],60:Dw,61:E1,95:cc,96:j1,126:j1},g5={38:ny,92:ty},b5={[-5]:Qf,[-4]:Qf,[-3]:Qf,33:Gw,38:ny,42:_d,60:[Qv,Ow],91:Qw,92:[Sw,ty],93:th,95:_d,96:ow},v5={null:[_d,u5]},w5={null:[42,95]},k5={null:[]},S5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:w5,contentInitial:x5,disable:k5,document:m5,flow:y5,flowInitial:p5,insideSpan:v5,string:g5,text:b5},Symbol.toStringTag,{value:"Module"}));function j5(t,l,a){let i={_bufferIndex:-1,_index:0,line:a&&a.line||1,column:a&&a.column||1,offset:a&&a.offset||0};const o={},u=[];let f=[],m=[];const p={attempt:Y(U),check:Y(D),consume:M,enter:H,exit:B,interrupt:Y(D,{interrupt:!0})},h={code:null,containerState:{},defineSkip:k,events:[],now:j,parser:t,previous:null,sliceSerialize:b,sliceStream:v,write:y};let g=l.tokenize.call(h,p);return l.resolveAll&&u.push(l),h;function y(L){return f=nl(f,L),C(),f[f.length-1]!==null?[]:(V(l,0),h.events=Nc(u,h.events,h),h.events)}function b(L,$){return E5(v(L),$)}function v(L){return C5(f,L)}function j(){const{_bufferIndex:L,_index:$,line:ee,column:ae,offset:X}=i;return{_bufferIndex:L,_index:$,line:ee,column:ae,offset:X}}function k(L){o[L.line]=L.column,T()}function C(){let L;for(;i._index<f.length;){const $=f[i._index];if(typeof $=="string")for(L=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===L&&i._bufferIndex<$.length;)E($.charCodeAt(i._bufferIndex));else E($)}}function E(L){g=g(L)}function M(L){He(L)?(i.line++,i.column=1,i.offset+=L===-3?2:1,T()):L!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===f[i._index].length&&(i._bufferIndex=-1,i._index++)),h.previous=L}function H(L,$){const ee=$||{};return ee.type=L,ee.start=j(),h.events.push(["enter",ee,h]),m.push(ee),ee}function B(L){const $=m.pop();return $.end=j(),h.events.push(["exit",$,h]),$}function U(L,$){V(L,$.from)}function D(L,$){$.restore()}function Y(L,$){return ee;function ee(ae,X,I){let Q,ie,Se,z;return Array.isArray(ae)?P(ae):"tokenize"in ae?P([ae]):_(ae);function _(Ne){return Oe;function Oe(Be){const oe=Be!==null&&Ne[Be],K=Be!==null&&Ne.null,ue=[...Array.isArray(oe)?oe:oe?[oe]:[],...Array.isArray(K)?K:K?[K]:[]];return P(ue)(Be)}}function P(Ne){return Q=Ne,ie=0,Ne.length===0?I:A(Ne[ie])}function A(Ne){return Oe;function Oe(Be){return z=ne(),Se=Ne,Ne.partial||(h.currentConstruct=Ne),Ne.name&&h.parser.constructs.disable.null.includes(Ne.name)?Ee():Ne.tokenize.call($?Object.assign(Object.create(h),$):h,p,pe,Ee)(Be)}}function pe(Ne){return L(Se,z),X}function Ee(Ne){return z.restore(),++ie<Q.length?A(Q[ie]):I}}}function V(L,$){L.resolveAll&&!u.includes(L)&&u.push(L),L.resolve&&Yn(h.events,$,h.events.length-$,L.resolve(h.events.slice($),h)),L.resolveTo&&(h.events=L.resolveTo(h.events,h))}function ne(){const L=j(),$=h.previous,ee=h.currentConstruct,ae=h.events.length,X=Array.from(m);return{from:ae,restore:I};function I(){i=L,h.previous=$,h.currentConstruct=ee,h.events.length=ae,m=X,T()}}function T(){i.line in o&&i.column<2&&(i.column=o[i.line],i.offset+=o[i.line]-1)}}function C5(t,l){const a=l.start._index,i=l.start._bufferIndex,o=l.end._index,u=l.end._bufferIndex;let f;if(a===o)f=[t[a].slice(i,u)];else{if(f=t.slice(a,o),i>-1){const m=f[0];typeof m=="string"?f[0]=m.slice(i):f.shift()}u>0&&f.push(t[o].slice(0,u))}return f}function E5(t,l){let a=-1;const i=[];let o;for(;++a<t.length;){const u=t[a];let f;if(typeof u=="string")f=u;else switch(u){case-5:{f="\r";break}case-4:{f=`
|
|
52
|
-
`;break}case-3:{f=`\r
|
|
53
|
-
`;break}case-2:{f=l?" ":" ";break}case-1:{if(!l&&o)continue;f=" ";break}default:f=String.fromCharCode(u)}o=u===-2,i.push(f)}return i.join("")}function N5(t){const i={constructs:J0([S5,...(t||{}).extensions||[]]),content:o(Iv),defined:[],document:o(qv),flow:o(o5),lazy:{},string:o(f5),text:o(d5)};return i;function o(u){return f;function f(m){return j5(i,u,m)}}}function A5(t){for(;!ly(t););return t}const N1=/[\0\t\n\r]/g;function D5(){let t=1,l="",a=!0,i;return o;function o(u,f,m){const p=[];let h,g,y,b,v;for(u=l+(typeof u=="string"?u.toString():new TextDecoder(f||void 0).decode(u)),y=0,l="",a&&(u.charCodeAt(0)===65279&&y++,a=void 0);y<u.length;){if(N1.lastIndex=y,h=N1.exec(u),b=h&&h.index!==void 0?h.index:u.length,v=u.charCodeAt(b),!h){l=u.slice(y);break}if(v===10&&y===b&&i)p.push(-3),i=void 0;else switch(i&&(p.push(-5),i=void 0),y<b&&(p.push(u.slice(y,b)),t+=b-y),v){case 0:{p.push(65533),t++;break}case 9:{for(g=Math.ceil(t/4)*4,p.push(-2);t++<g;)p.push(-1);break}case 10:{p.push(-4),t=1;break}default:i=!0,t=1}y=b+1}return m&&(i&&p.push(-5),l&&p.push(l),p.push(null)),p}}const T5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function z5(t){return t.replace(T5,M5)}function M5(t,l,a){if(l)return l;if(a.charCodeAt(0)===35){const o=a.charCodeAt(1),u=o===120||o===88;return P0(a.slice(u?2:1),u?16:10)}return eh(a)||t}const cy={}.hasOwnProperty;function _5(t,l,a){return l&&typeof l=="object"&&(a=l,l=void 0),F5(a)(A5(N5(a).document().write(D5()(t,l,!0))))}function F5(t){const l={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(kt),autolinkProtocol:ne,autolinkEmail:ne,atxHeading:u(Ce),blockQuote:u(K),characterEscape:ne,characterReference:ne,codeFenced:u(ue),codeFencedFenceInfo:f,codeFencedFenceMeta:f,codeIndented:u(ue,f),codeText:u(je,f),codeTextData:ne,data:ne,codeFlowValue:ne,definition:u(te),definitionDestinationString:f,definitionLabelString:f,definitionTitleString:f,emphasis:u(ve),hardBreakEscape:u(Ae),hardBreakTrailing:u(Ae),htmlFlow:u(ze,f),htmlFlowData:ne,htmlText:u(ze,f),htmlTextData:ne,image:u(qe),label:f,link:u(kt),listItem:u(ft),listItemValue:b,listOrdered:u(Rt,y),listUnordered:u(Rt),paragraph:u(Lt),reference:A,referenceString:f,resourceDestinationString:f,resourceTitleString:f,setextHeading:u(Ce),strong:u(un),thematicBreak:u(qt)},exit:{atxHeading:p(),atxHeadingSequence:U,autolink:p(),autolinkEmail:oe,autolinkProtocol:Be,blockQuote:p(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:Ee,characterReferenceMarkerNumeric:Ee,characterReferenceValue:Ne,characterReference:Oe,codeFenced:p(C),codeFencedFence:k,codeFencedFenceInfo:v,codeFencedFenceMeta:j,codeFlowValue:T,codeIndented:p(E),codeText:p(X),codeTextData:T,data:T,definition:p(),definitionDestinationString:B,definitionLabelString:M,definitionTitleString:H,emphasis:p(),hardBreakEscape:p($),hardBreakTrailing:p($),htmlFlow:p(ee),htmlFlowData:T,htmlText:p(ae),htmlTextData:T,image:p(Q),label:Se,labelText:ie,lineEnding:L,link:p(I),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:pe,resourceDestinationString:z,resourceTitleString:_,resource:P,setextHeading:p(V),setextHeadingLineSequence:Y,setextHeadingText:D,strong:p(),thematicBreak:p()}};uy(l,(t||{}).mdastExtensions||[]);const a={};return i;function i(re){let ye={type:"root",children:[]};const Fe={stack:[ye],tokenStack:[],config:l,enter:m,exit:h,buffer:f,resume:g,data:a},xe=[];let ke=-1;for(;++ke<re.length;)if(re[ke][1].type==="listOrdered"||re[ke][1].type==="listUnordered")if(re[ke][0]==="enter")xe.push(ke);else{const bt=xe.pop();ke=o(re,bt,ke)}for(ke=-1;++ke<re.length;){const bt=l[re[ke][0]];cy.call(bt,re[ke][1].type)&&bt[re[ke][1].type].call(Object.assign({sliceSerialize:re[ke][2].sliceSerialize},Fe),re[ke][1])}if(Fe.tokenStack.length>0){const bt=Fe.tokenStack[Fe.tokenStack.length-1];(bt[1]||A1).call(Fe,void 0,bt[0])}for(ye.position={start:Aa(re.length>0?re[0][1].start:{line:1,column:1,offset:0}),end:Aa(re.length>0?re[re.length-2][1].end:{line:1,column:1,offset:0})},ke=-1;++ke<l.transforms.length;)ye=l.transforms[ke](ye)||ye;return ye}function o(re,ye,Fe){let xe=ye-1,ke=-1,bt=!1,At,Ze,he,ut;for(;++xe<=Fe;){const dt=re[xe];switch(dt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{dt[0]==="enter"?ke++:ke--,ut=void 0;break}case"lineEndingBlank":{dt[0]==="enter"&&(At&&!ut&&!ke&&!he&&(he=xe),ut=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ut=void 0}if(!ke&&dt[0]==="enter"&&dt[1].type==="listItemPrefix"||ke===-1&&dt[0]==="exit"&&(dt[1].type==="listUnordered"||dt[1].type==="listOrdered")){if(At){let wn=xe;for(Ze=void 0;wn--;){const tt=re[wn];if(tt[1].type==="lineEnding"||tt[1].type==="lineEndingBlank"){if(tt[0]==="exit")continue;Ze&&(re[Ze][1].type="lineEndingBlank",bt=!0),tt[1].type="lineEnding",Ze=wn}else if(!(tt[1].type==="linePrefix"||tt[1].type==="blockQuotePrefix"||tt[1].type==="blockQuotePrefixWhitespace"||tt[1].type==="blockQuoteMarker"||tt[1].type==="listItemIndent"))break}he&&(!Ze||he<Ze)&&(At._spread=!0),At.end=Object.assign({},Ze?re[Ze][1].start:dt[1].end),re.splice(Ze||xe,0,["exit",At,dt[2]]),xe++,Fe++}if(dt[1].type==="listItemPrefix"){const wn={type:"listItem",_spread:!1,start:Object.assign({},dt[1].start),end:void 0};At=wn,re.splice(xe,0,["enter",wn,dt[2]]),xe++,Fe++,he=void 0,ut=!0}}}return re[ye][1]._spread=bt,Fe}function u(re,ye){return Fe;function Fe(xe){m.call(this,re(xe),xe),ye&&ye.call(this,xe)}}function f(){this.stack.push({type:"fragment",children:[]})}function m(re,ye,Fe){this.stack[this.stack.length-1].children.push(re),this.stack.push(re),this.tokenStack.push([ye,Fe||void 0]),re.position={start:Aa(ye.start),end:void 0}}function p(re){return ye;function ye(Fe){re&&re.call(this,Fe),h.call(this,Fe)}}function h(re,ye){const Fe=this.stack.pop(),xe=this.tokenStack.pop();if(xe)xe[0].type!==re.type&&(ye?ye.call(this,re,xe[0]):(xe[1]||A1).call(this,re,xe[0]));else throw new Error("Cannot close `"+re.type+"` ("+vs({start:re.start,end:re.end})+"): it’s not open");Fe.position.end=Aa(re.end)}function g(){return Pd(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function b(re){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(re),10),this.data.expectingFirstListItemValue=void 0}}function v(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=re}function j(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=re}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re.replace(/(\r?\n|\r)$/g,"")}function M(re){const ye=this.resume(),Fe=this.stack[this.stack.length-1];Fe.label=ye,Fe.identifier=hl(this.sliceSerialize(re)).toLowerCase()}function H(){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 U(re){const ye=this.stack[this.stack.length-1];if(!ye.depth){const Fe=this.sliceSerialize(re).length;ye.depth=Fe}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function Y(re){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(re).codePointAt(0)===61?1:2}function V(){this.data.setextHeadingSlurpLineEnding=void 0}function ne(re){const Fe=this.stack[this.stack.length-1].children;let xe=Fe[Fe.length-1];(!xe||xe.type!=="text")&&(xe=gt(),xe.position={start:Aa(re.start),end:void 0},Fe.push(xe)),this.stack.push(xe)}function T(re){const ye=this.stack.pop();ye.value+=this.sliceSerialize(re),ye.position.end=Aa(re.end)}function L(re){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Fe=ye.children[ye.children.length-1];Fe.position.end=Aa(re.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&l.canContainEols.includes(ye.type)&&(ne.call(this,re),T.call(this,re))}function $(){this.data.atHardBreak=!0}function ee(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re}function ae(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re}function X(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re}function I(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=ye,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function Q(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=ye,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function ie(re){const ye=this.sliceSerialize(re),Fe=this.stack[this.stack.length-2];Fe.label=z5(ye),Fe.identifier=hl(ye).toLowerCase()}function Se(){const re=this.stack[this.stack.length-1],ye=this.resume(),Fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Fe.type==="link"){const xe=re.children;Fe.children=xe}else Fe.alt=ye}function z(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.url=re}function _(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.title=re}function P(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function pe(re){const ye=this.resume(),Fe=this.stack[this.stack.length-1];Fe.label=ye,Fe.identifier=hl(this.sliceSerialize(re)).toLowerCase(),this.data.referenceType="full"}function Ee(re){this.data.characterReferenceType=re.type}function Ne(re){const ye=this.sliceSerialize(re),Fe=this.data.characterReferenceType;let xe;Fe?(xe=P0(ye,Fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):xe=eh(ye);const ke=this.stack[this.stack.length-1];ke.value+=xe}function Oe(re){const ye=this.stack.pop();ye.position.end=Aa(re.end)}function Be(re){T.call(this,re);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(re)}function oe(re){T.call(this,re);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(re)}function K(){return{type:"blockquote",children:[]}}function ue(){return{type:"code",lang:null,meta:null,value:""}}function je(){return{type:"inlineCode",value:""}}function te(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ve(){return{type:"emphasis",children:[]}}function Ce(){return{type:"heading",depth:0,children:[]}}function Ae(){return{type:"break"}}function ze(){return{type:"html",value:""}}function qe(){return{type:"image",title:null,url:"",alt:null}}function kt(){return{type:"link",title:null,url:"",children:[]}}function Rt(re){return{type:"list",ordered:re.type==="listOrdered",start:null,spread:re._spread,children:[]}}function ft(re){return{type:"listItem",spread:re._spread,checked:null,children:[]}}function Lt(){return{type:"paragraph",children:[]}}function un(){return{type:"strong",children:[]}}function gt(){return{type:"text",value:""}}function qt(){return{type:"thematicBreak"}}}function Aa(t){return{line:t.line,column:t.column,offset:t.offset}}function uy(t,l){let a=-1;for(;++a<l.length;){const i=l[a];Array.isArray(i)?uy(t,i):R5(t,i)}}function R5(t,l){let a;for(a in l)if(cy.call(l,a))switch(a){case"canContainEols":{const i=l[a];i&&t[a].push(...i);break}case"transforms":{const i=l[a];i&&t[a].push(...i);break}case"enter":case"exit":{const i=l[a];i&&Object.assign(t[a],i);break}}}function A1(t,l){throw t?new Error("Cannot close `"+t.type+"` ("+vs({start:t.start,end:t.end})+"): a different token (`"+l.type+"`, "+vs({start:l.start,end:l.end})+") is open"):new Error("Cannot close document, a token (`"+l.type+"`, "+vs({start:l.start,end:l.end})+") is still open")}function O5(t){const l=this;l.parser=a;function a(i){return _5(i,{...l.data("settings"),...t,extensions:l.data("micromarkExtensions")||[],mdastExtensions:l.data("fromMarkdownExtensions")||[]})}}function B5(t,l){const a={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(l),!0)};return t.patch(l,a),t.applyData(l,a)}function L5(t,l){const a={type:"element",tagName:"br",properties:{},children:[]};return t.patch(l,a),[t.applyData(l,a),{type:"text",value:`
|
|
54
|
-
`}]}function $5(t,l){const a=l.value?l.value+`
|
|
55
|
-
`:"",i={},o=l.lang?l.lang.split(/\s+/):[];o.length>0&&(i.className=["language-"+o[0]]);let u={type:"element",tagName:"code",properties:i,children:[{type:"text",value:a}]};return l.meta&&(u.data={meta:l.meta}),t.patch(l,u),u=t.applyData(l,u),u={type:"element",tagName:"pre",properties:{},children:[u]},t.patch(l,u),u}function H5(t,l){const a={type:"element",tagName:"del",properties:{},children:t.all(l)};return t.patch(l,a),t.applyData(l,a)}function U5(t,l){const a={type:"element",tagName:"em",properties:{},children:t.all(l)};return t.patch(l,a),t.applyData(l,a)}function I5(t,l){const a=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",i=String(l.identifier).toUpperCase(),o=ai(i.toLowerCase()),u=t.footnoteOrder.indexOf(i);let f,m=t.footnoteCounts.get(i);m===void 0?(m=0,t.footnoteOrder.push(i),f=t.footnoteOrder.length):f=u+1,m+=1,t.footnoteCounts.set(i,m);const p={type:"element",tagName:"a",properties:{href:"#"+a+"fn-"+o,id:a+"fnref-"+o+(m>1?"-"+m:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(f)}]};t.patch(l,p);const h={type:"element",tagName:"sup",properties:{},children:[p]};return t.patch(l,h),t.applyData(l,h)}function Y5(t,l){const a={type:"element",tagName:"h"+l.depth,properties:{},children:t.all(l)};return t.patch(l,a),t.applyData(l,a)}function q5(t,l){if(t.options.allowDangerousHtml){const a={type:"raw",value:l.value};return t.patch(l,a),t.applyData(l,a)}}function fy(t,l){const a=l.referenceType;let i="]";if(a==="collapsed"?i+="[]":a==="full"&&(i+="["+(l.label||l.identifier)+"]"),l.type==="imageReference")return[{type:"text",value:"!["+l.alt+i}];const o=t.all(l),u=o[0];u&&u.type==="text"?u.value="["+u.value:o.unshift({type:"text",value:"["});const f=o[o.length-1];return f&&f.type==="text"?f.value+=i:o.push({type:"text",value:i}),o}function X5(t,l){const a=String(l.identifier).toUpperCase(),i=t.definitionById.get(a);if(!i)return fy(t,l);const o={src:ai(i.url||""),alt:l.alt};i.title!==null&&i.title!==void 0&&(o.title=i.title);const u={type:"element",tagName:"img",properties:o,children:[]};return t.patch(l,u),t.applyData(l,u)}function V5(t,l){const a={src:ai(l.url)};l.alt!==null&&l.alt!==void 0&&(a.alt=l.alt),l.title!==null&&l.title!==void 0&&(a.title=l.title);const i={type:"element",tagName:"img",properties:a,children:[]};return t.patch(l,i),t.applyData(l,i)}function G5(t,l){const a={type:"text",value:l.value.replace(/\r?\n|\r/g," ")};t.patch(l,a);const i={type:"element",tagName:"code",properties:{},children:[a]};return t.patch(l,i),t.applyData(l,i)}function K5(t,l){const a=String(l.identifier).toUpperCase(),i=t.definitionById.get(a);if(!i)return fy(t,l);const o={href:ai(i.url||"")};i.title!==null&&i.title!==void 0&&(o.title=i.title);const u={type:"element",tagName:"a",properties:o,children:t.all(l)};return t.patch(l,u),t.applyData(l,u)}function Q5(t,l){const a={href:ai(l.url)};l.title!==null&&l.title!==void 0&&(a.title=l.title);const i={type:"element",tagName:"a",properties:a,children:t.all(l)};return t.patch(l,i),t.applyData(l,i)}function Z5(t,l,a){const i=t.all(l),o=a?W5(a):dy(l),u={},f=[];if(typeof l.checked=="boolean"){const g=i[0];let y;g&&g.type==="element"&&g.tagName==="p"?y=g:(y={type:"element",tagName:"p",properties:{},children:[]},i.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:l.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let m=-1;for(;++m<i.length;){const g=i[m];(o||m!==0||g.type!=="element"||g.tagName!=="p")&&f.push({type:"text",value:`
|
|
56
|
-
`}),g.type==="element"&&g.tagName==="p"&&!o?f.push(...g.children):f.push(g)}const p=i[i.length-1];p&&(o||p.type!=="element"||p.tagName!=="p")&&f.push({type:"text",value:`
|
|
57
|
-
`});const h={type:"element",tagName:"li",properties:u,children:f};return t.patch(l,h),t.applyData(l,h)}function W5(t){let l=!1;if(t.type==="list"){l=t.spread||!1;const a=t.children;let i=-1;for(;!l&&++i<a.length;)l=dy(a[i])}return l}function dy(t){const l=t.spread;return l??t.children.length>1}function J5(t,l){const a={},i=t.all(l);let o=-1;for(typeof l.start=="number"&&l.start!==1&&(a.start=l.start);++o<i.length;){const f=i[o];if(f.type==="element"&&f.tagName==="li"&&f.properties&&Array.isArray(f.properties.className)&&f.properties.className.includes("task-list-item")){a.className=["contains-task-list"];break}}const u={type:"element",tagName:l.ordered?"ol":"ul",properties:a,children:t.wrap(i,!0)};return t.patch(l,u),t.applyData(l,u)}function P5(t,l){const a={type:"element",tagName:"p",properties:{},children:t.all(l)};return t.patch(l,a),t.applyData(l,a)}function e3(t,l){const a={type:"root",children:t.wrap(t.all(l))};return t.patch(l,a),t.applyData(l,a)}function t3(t,l){const a={type:"element",tagName:"strong",properties:{},children:t.all(l)};return t.patch(l,a),t.applyData(l,a)}function n3(t,l){const a=t.all(l),i=a.shift(),o=[];if(i){const f={type:"element",tagName:"thead",properties:{},children:t.wrap([i],!0)};t.patch(l.children[0],f),o.push(f)}if(a.length>0){const f={type:"element",tagName:"tbody",properties:{},children:t.wrap(a,!0)},m=Qd(l.children[1]),p=X0(l.children[l.children.length-1]);m&&p&&(f.position={start:m,end:p}),o.push(f)}const u={type:"element",tagName:"table",properties:{},children:t.wrap(o,!0)};return t.patch(l,u),t.applyData(l,u)}function l3(t,l,a){const i=a?a.children:void 0,u=(i?i.indexOf(l):1)===0?"th":"td",f=a&&a.type==="table"?a.align:void 0,m=f?f.length:l.children.length;let p=-1;const h=[];for(;++p<m;){const y=l.children[p],b={},v=f?f[p]:void 0;v&&(b.align=v);let j={type:"element",tagName:u,properties:b,children:[]};y&&(j.children=t.all(y),t.patch(y,j),j=t.applyData(y,j)),h.push(j)}const g={type:"element",tagName:"tr",properties:{},children:t.wrap(h,!0)};return t.patch(l,g),t.applyData(l,g)}function a3(t,l){const a={type:"element",tagName:"td",properties:{},children:t.all(l)};return t.patch(l,a),t.applyData(l,a)}const D1=9,T1=32;function r3(t){const l=String(t),a=/\r?\n|\r/g;let i=a.exec(l),o=0;const u=[];for(;i;)u.push(z1(l.slice(o,i.index),o>0,!0),i[0]),o=i.index+i[0].length,i=a.exec(l);return u.push(z1(l.slice(o),o>0,!1)),u.join("")}function z1(t,l,a){let i=0,o=t.length;if(l){let u=t.codePointAt(i);for(;u===D1||u===T1;)i++,u=t.codePointAt(i)}if(a){let u=t.codePointAt(o-1);for(;u===D1||u===T1;)o--,u=t.codePointAt(o-1)}return o>i?t.slice(i,o):""}function i3(t,l){const a={type:"text",value:r3(String(l.value))};return t.patch(l,a),t.applyData(l,a)}function s3(t,l){const a={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(l,a),t.applyData(l,a)}const o3={blockquote:B5,break:L5,code:$5,delete:H5,emphasis:U5,footnoteReference:I5,heading:Y5,html:q5,imageReference:X5,image:V5,inlineCode:G5,linkReference:K5,link:Q5,listItem:Z5,list:J5,paragraph:P5,root:e3,strong:t3,table:n3,tableCell:a3,tableRow:l3,text:i3,thematicBreak:s3,toml:Wo,yaml:Wo,definition:Wo,footnoteDefinition:Wo};function Wo(){}const hy=-1,Ac=0,ks=1,pc=2,nh=3,lh=4,ah=5,rh=6,my=7,xy=8,M1=typeof self=="object"?self:globalThis,c3=(t,l)=>{const a=(o,u)=>(t.set(u,o),o),i=o=>{if(t.has(o))return t.get(o);const[u,f]=l[o];switch(u){case Ac:case hy:return a(f,o);case ks:{const m=a([],o);for(const p of f)m.push(i(p));return m}case pc:{const m=a({},o);for(const[p,h]of f)m[i(p)]=i(h);return m}case nh:return a(new Date(f),o);case lh:{const{source:m,flags:p}=f;return a(new RegExp(m,p),o)}case ah:{const m=a(new Map,o);for(const[p,h]of f)m.set(i(p),i(h));return m}case rh:{const m=a(new Set,o);for(const p of f)m.add(i(p));return m}case my:{const{name:m,message:p}=f;return a(new M1[m](p),o)}case xy:return a(BigInt(f),o);case"BigInt":return a(Object(BigInt(f)),o);case"ArrayBuffer":return a(new Uint8Array(f).buffer,f);case"DataView":{const{buffer:m}=new Uint8Array(f);return a(new DataView(m),f)}}return a(new M1[u](f),o)};return i},_1=t=>c3(new Map,t)(0),Zr="",{toString:u3}={},{keys:f3}=Object,us=t=>{const l=typeof t;if(l!=="object"||!t)return[Ac,l];const a=u3.call(t).slice(8,-1);switch(a){case"Array":return[ks,Zr];case"Object":return[pc,Zr];case"Date":return[nh,Zr];case"RegExp":return[lh,Zr];case"Map":return[ah,Zr];case"Set":return[rh,Zr];case"DataView":return[ks,a]}return a.includes("Array")?[ks,a]:a.includes("Error")?[my,a]:[pc,a]},Jo=([t,l])=>t===Ac&&(l==="function"||l==="symbol"),d3=(t,l,a,i)=>{const o=(f,m)=>{const p=i.push(f)-1;return a.set(m,p),p},u=f=>{if(a.has(f))return a.get(f);let[m,p]=us(f);switch(m){case Ac:{let g=f;switch(p){case"bigint":m=xy,g=f.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+p);g=null;break;case"undefined":return o([hy],f)}return o([m,g],f)}case ks:{if(p){let b=f;return p==="DataView"?b=new Uint8Array(f.buffer):p==="ArrayBuffer"&&(b=new Uint8Array(f)),o([p,[...b]],f)}const g=[],y=o([m,g],f);for(const b of f)g.push(u(b));return y}case pc:{if(p)switch(p){case"BigInt":return o([p,f.toString()],f);case"Boolean":case"Number":case"String":return o([p,f.valueOf()],f)}if(l&&"toJSON"in f)return u(f.toJSON());const g=[],y=o([m,g],f);for(const b of f3(f))(t||!Jo(us(f[b])))&&g.push([u(b),u(f[b])]);return y}case nh:return o([m,f.toISOString()],f);case lh:{const{source:g,flags:y}=f;return o([m,{source:g,flags:y}],f)}case ah:{const g=[],y=o([m,g],f);for(const[b,v]of f)(t||!(Jo(us(b))||Jo(us(v))))&&g.push([u(b),u(v)]);return y}case rh:{const g=[],y=o([m,g],f);for(const b of f)(t||!Jo(us(b)))&&g.push(u(b));return y}}const{message:h}=f;return o([m,{name:p,message:h}],f)};return u},F1=(t,{json:l,lossy:a}={})=>{const i=[];return d3(!(l||a),!!l,new Map,i)(t),i},yc=typeof structuredClone=="function"?(t,l)=>l&&("json"in l||"lossy"in l)?_1(F1(t,l)):structuredClone(t):(t,l)=>_1(F1(t,l));function h3(t,l){const a=[{type:"text",value:"↩"}];return l>1&&a.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(l)}]}),a}function m3(t,l){return"Back to reference "+(t+1)+(l>1?"-"+l:"")}function x3(t){const l=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",a=t.options.footnoteBackContent||h3,i=t.options.footnoteBackLabel||m3,o=t.options.footnoteLabel||"Footnotes",u=t.options.footnoteLabelTagName||"h2",f=t.options.footnoteLabelProperties||{className:["sr-only"]},m=[];let p=-1;for(;++p<t.footnoteOrder.length;){const h=t.footnoteById.get(t.footnoteOrder[p]);if(!h)continue;const g=t.all(h),y=String(h.identifier).toUpperCase(),b=ai(y.toLowerCase());let v=0;const j=[],k=t.footnoteCounts.get(y);for(;k!==void 0&&++v<=k;){j.length>0&&j.push({type:"text",value:" "});let M=typeof a=="string"?a:a(p,v);typeof M=="string"&&(M={type:"text",value:M}),j.push({type:"element",tagName:"a",properties:{href:"#"+l+"fnref-"+b+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(p,v),className:["data-footnote-backref"]},children:Array.isArray(M)?M:[M]})}const C=g[g.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const M=C.children[C.children.length-1];M&&M.type==="text"?M.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...j)}else g.push(...j);const E={type:"element",tagName:"li",properties:{id:l+"fn-"+b},children:t.wrap(g,!0)};t.patch(h,E),m.push(E)}if(m.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...yc(f),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
58
|
-
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(m,!0)},{type:"text",value:`
|
|
59
|
-
`}]}}const Dc=(function(t){if(t==null)return b3;if(typeof t=="function")return Tc(t);if(typeof t=="object")return Array.isArray(t)?p3(t):y3(t);if(typeof t=="string")return g3(t);throw new Error("Expected function, string, or object as test")});function p3(t){const l=[];let a=-1;for(;++a<t.length;)l[a]=Dc(t[a]);return Tc(i);function i(...o){let u=-1;for(;++u<l.length;)if(l[u].apply(this,o))return!0;return!1}}function y3(t){const l=t;return Tc(a);function a(i){const o=i;let u;for(u in t)if(o[u]!==l[u])return!1;return!0}}function g3(t){return Tc(l);function l(a){return a&&a.type===t}}function Tc(t){return l;function l(a,i,o){return!!(v3(a)&&t.call(this,a,typeof i=="number"?i:void 0,o||void 0))}}function b3(){return!0}function v3(t){return t!==null&&typeof t=="object"&&"type"in t}const py=[],w3=!0,Fd=!1,k3="skip";function yy(t,l,a,i){let o;typeof l=="function"&&typeof a!="function"?(i=a,a=l):o=l;const u=Dc(o),f=i?-1:1;m(t,void 0,[])();function m(p,h,g){const y=p&&typeof p=="object"?p:{};if(typeof y.type=="string"){const v=typeof y.tagName=="string"?y.tagName:typeof y.name=="string"?y.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(p.type+(v?"<"+v+">":""))+")"})}return b;function b(){let v=py,j,k,C;if((!l||u(p,h,g[g.length-1]||void 0))&&(v=S3(a(p,g)),v[0]===Fd))return v;if("children"in p&&p.children){const E=p;if(E.children&&v[0]!==k3)for(k=(i?E.children.length:-1)+f,C=g.concat(E);k>-1&&k<E.children.length;){const M=E.children[k];if(j=m(M,k,C)(),j[0]===Fd)return j;k=typeof j[1]=="number"?j[1]:k+f}}return v}}}function S3(t){return Array.isArray(t)?t:typeof t=="number"?[w3,t]:t==null?py:[t]}function ih(t,l,a,i){let o,u,f;typeof l=="function"&&typeof a!="function"?(u=void 0,f=l,o=a):(u=l,f=a,o=i),yy(t,u,m,o);function m(p,h){const g=h[h.length-1],y=g?g.children.indexOf(p):void 0;return f(p,y,g)}}const Rd={}.hasOwnProperty,j3={};function C3(t,l){const a=l||j3,i=new Map,o=new Map,u=new Map,f={...o3,...a.handlers},m={all:h,applyData:N3,definitionById:i,footnoteById:o,footnoteCounts:u,footnoteOrder:[],handlers:f,one:p,options:a,patch:E3,wrap:D3};return ih(t,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const y=g.type==="definition"?i:o,b=String(g.identifier).toUpperCase();y.has(b)||y.set(b,g)}}),m;function p(g,y){const b=g.type,v=m.handlers[b];if(Rd.call(m.handlers,b)&&v)return v(m,g,y);if(m.options.passThrough&&m.options.passThrough.includes(b)){if("children"in g){const{children:k,...C}=g,E=yc(C);return E.children=m.all(g),E}return yc(g)}return(m.options.unknownHandler||A3)(m,g,y)}function h(g){const y=[];if("children"in g){const b=g.children;let v=-1;for(;++v<b.length;){const j=m.one(b[v],g);if(j){if(v&&b[v-1].type==="break"&&(!Array.isArray(j)&&j.type==="text"&&(j.value=R1(j.value)),!Array.isArray(j)&&j.type==="element")){const k=j.children[0];k&&k.type==="text"&&(k.value=R1(k.value))}Array.isArray(j)?y.push(...j):y.push(j)}}}return y}}function E3(t,l){t.position&&(l.position=mv(t))}function N3(t,l){let a=l;if(t&&t.data){const i=t.data.hName,o=t.data.hChildren,u=t.data.hProperties;if(typeof i=="string")if(a.type==="element")a.tagName=i;else{const f="children"in a?a.children:[a];a={type:"element",tagName:i,properties:{},children:f}}a.type==="element"&&u&&Object.assign(a.properties,yc(u)),"children"in a&&a.children&&o!==null&&o!==void 0&&(a.children=o)}return a}function A3(t,l){const a=l.data||{},i="value"in l&&!(Rd.call(a,"hProperties")||Rd.call(a,"hChildren"))?{type:"text",value:l.value}:{type:"element",tagName:"div",properties:{},children:t.all(l)};return t.patch(l,i),t.applyData(l,i)}function D3(t,l){const a=[];let i=-1;for(l&&a.push({type:"text",value:`
|
|
60
|
-
`});++i<t.length;)i&&a.push({type:"text",value:`
|
|
61
|
-
`}),a.push(t[i]);return l&&t.length>0&&a.push({type:"text",value:`
|
|
62
|
-
`}),a}function R1(t){let l=0,a=t.charCodeAt(l);for(;a===9||a===32;)l++,a=t.charCodeAt(l);return t.slice(l)}function O1(t,l){const a=C3(t,l),i=a.one(t,void 0),o=x3(a),u=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return o&&u.children.push({type:"text",value:`
|
|
63
|
-
`},o),u}function T3(t,l){return t&&"run"in t?async function(a,i){const o=O1(a,{file:i,...l});await t.run(o,i)}:function(a,i){return O1(a,{file:i,...t||l})}}function B1(t){if(t)throw t}var Zf,L1;function z3(){if(L1)return Zf;L1=1;var t=Object.prototype.hasOwnProperty,l=Object.prototype.toString,a=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=function(h){return typeof Array.isArray=="function"?Array.isArray(h):l.call(h)==="[object Array]"},u=function(h){if(!h||l.call(h)!=="[object Object]")return!1;var g=t.call(h,"constructor"),y=h.constructor&&h.constructor.prototype&&t.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!y)return!1;var b;for(b in h);return typeof b>"u"||t.call(h,b)},f=function(h,g){a&&g.name==="__proto__"?a(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},m=function(h,g){if(g==="__proto__")if(t.call(h,g)){if(i)return i(h,g).value}else return;return h[g]};return Zf=function p(){var h,g,y,b,v,j,k=arguments[0],C=1,E=arguments.length,M=!1;for(typeof k=="boolean"&&(M=k,k=arguments[1]||{},C=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});C<E;++C)if(h=arguments[C],h!=null)for(g in h)y=m(k,g),b=m(h,g),k!==b&&(M&&b&&(u(b)||(v=o(b)))?(v?(v=!1,j=y&&o(y)?y:[]):j=y&&u(y)?y:{},f(k,{name:g,newValue:p(M,j,b)})):typeof b<"u"&&f(k,{name:g,newValue:b}));return k},Zf}var M3=z3();const Wf=O0(M3);function Od(t){if(typeof t!="object"||t===null)return!1;const l=Object.getPrototypeOf(t);return(l===null||l===Object.prototype||Object.getPrototypeOf(l)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function _3(){const t=[],l={run:a,use:i};return l;function a(...o){let u=-1;const f=o.pop();if(typeof f!="function")throw new TypeError("Expected function as last argument, not "+f);m(null,...o);function m(p,...h){const g=t[++u];let y=-1;if(p){f(p);return}for(;++y<o.length;)(h[y]===null||h[y]===void 0)&&(h[y]=o[y]);o=h,g?F3(g,m)(...h):f(null,...h)}}function i(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return t.push(o),l}}function F3(t,l){let a;return i;function i(...f){const m=t.length>f.length;let p;m&&f.push(o);try{p=t.apply(this,f)}catch(h){const g=h;if(m&&a)throw g;return o(g)}m||(p&&p.then&&typeof p.then=="function"?p.then(u,o):p instanceof Error?o(p):u(p))}function o(f,...m){a||(a=!0,l(f,...m))}function u(f){o(null,f)}}const kl={basename:R3,dirname:O3,extname:B3,join:L3,sep:"/"};function R3(t,l){if(l!==void 0&&typeof l!="string")throw new TypeError('"ext" argument must be a string');Ms(t);let a=0,i=-1,o=t.length,u;if(l===void 0||l.length===0||l.length>t.length){for(;o--;)if(t.codePointAt(o)===47){if(u){a=o+1;break}}else i<0&&(u=!0,i=o+1);return i<0?"":t.slice(a,i)}if(l===t)return"";let f=-1,m=l.length-1;for(;o--;)if(t.codePointAt(o)===47){if(u){a=o+1;break}}else f<0&&(u=!0,f=o+1),m>-1&&(t.codePointAt(o)===l.codePointAt(m--)?m<0&&(i=o):(m=-1,i=f));return a===i?i=f:i<0&&(i=t.length),t.slice(a,i)}function O3(t){if(Ms(t),t.length===0)return".";let l=-1,a=t.length,i;for(;--a;)if(t.codePointAt(a)===47){if(i){l=a;break}}else i||(i=!0);return l<0?t.codePointAt(0)===47?"/":".":l===1&&t.codePointAt(0)===47?"//":t.slice(0,l)}function B3(t){Ms(t);let l=t.length,a=-1,i=0,o=-1,u=0,f;for(;l--;){const m=t.codePointAt(l);if(m===47){if(f){i=l+1;break}continue}a<0&&(f=!0,a=l+1),m===46?o<0?o=l:u!==1&&(u=1):o>-1&&(u=-1)}return o<0||a<0||u===0||u===1&&o===a-1&&o===i+1?"":t.slice(o,a)}function L3(...t){let l=-1,a;for(;++l<t.length;)Ms(t[l]),t[l]&&(a=a===void 0?t[l]:a+"/"+t[l]);return a===void 0?".":$3(a)}function $3(t){Ms(t);const l=t.codePointAt(0)===47;let a=H3(t,!l);return a.length===0&&!l&&(a="."),a.length>0&&t.codePointAt(t.length-1)===47&&(a+="/"),l?"/"+a:a}function H3(t,l){let a="",i=0,o=-1,u=0,f=-1,m,p;for(;++f<=t.length;){if(f<t.length)m=t.codePointAt(f);else{if(m===47)break;m=47}if(m===47){if(!(o===f-1||u===1))if(o!==f-1&&u===2){if(a.length<2||i!==2||a.codePointAt(a.length-1)!==46||a.codePointAt(a.length-2)!==46){if(a.length>2){if(p=a.lastIndexOf("/"),p!==a.length-1){p<0?(a="",i=0):(a=a.slice(0,p),i=a.length-1-a.lastIndexOf("/")),o=f,u=0;continue}}else if(a.length>0){a="",i=0,o=f,u=0;continue}}l&&(a=a.length>0?a+"/..":"..",i=2)}else a.length>0?a+="/"+t.slice(o+1,f):a=t.slice(o+1,f),i=f-o-1;o=f,u=0}else m===46&&u>-1?u++:u=-1}return a}function Ms(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const U3={cwd:I3};function I3(){return"/"}function Bd(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function Y3(t){if(typeof t=="string")t=new URL(t);else if(!Bd(t)){const l=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw l.code="ERR_INVALID_ARG_TYPE",l}if(t.protocol!=="file:"){const l=new TypeError("The URL must be of scheme file");throw l.code="ERR_INVALID_URL_SCHEME",l}return q3(t)}function q3(t){if(t.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const l=t.pathname;let a=-1;for(;++a<l.length;)if(l.codePointAt(a)===37&&l.codePointAt(a+1)===50){const i=l.codePointAt(a+2);if(i===70||i===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(l)}const Jf=["history","path","basename","stem","extname","dirname"];class gy{constructor(l){let a;l?Bd(l)?a={path:l}:typeof l=="string"||X3(l)?a={value:l}:a=l:a={},this.cwd="cwd"in a?"":U3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Jf.length;){const u=Jf[i];u in a&&a[u]!==void 0&&a[u]!==null&&(this[u]=u==="history"?[...a[u]]:a[u])}let o;for(o in a)Jf.includes(o)||(this[o]=a[o])}get basename(){return typeof this.path=="string"?kl.basename(this.path):void 0}set basename(l){ed(l,"basename"),Pf(l,"basename"),this.path=kl.join(this.dirname||"",l)}get dirname(){return typeof this.path=="string"?kl.dirname(this.path):void 0}set dirname(l){$1(this.basename,"dirname"),this.path=kl.join(l||"",this.basename)}get extname(){return typeof this.path=="string"?kl.extname(this.path):void 0}set extname(l){if(Pf(l,"extname"),$1(this.dirname,"extname"),l){if(l.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(l.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=kl.join(this.dirname,this.stem+(l||""))}get path(){return this.history[this.history.length-1]}set path(l){Bd(l)&&(l=Y3(l)),ed(l,"path"),this.path!==l&&this.history.push(l)}get stem(){return typeof this.path=="string"?kl.basename(this.path,this.extname):void 0}set stem(l){ed(l,"stem"),Pf(l,"stem"),this.path=kl.join(this.dirname||"",l+(this.extname||""))}fail(l,a,i){const o=this.message(l,a,i);throw o.fatal=!0,o}info(l,a,i){const o=this.message(l,a,i);return o.fatal=void 0,o}message(l,a,i){const o=new xn(l,a,i);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(l){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(l||void 0).decode(this.value)}}function Pf(t,l){if(t&&t.includes(kl.sep))throw new Error("`"+l+"` cannot be a path: did not expect `"+kl.sep+"`")}function ed(t,l){if(!t)throw new Error("`"+l+"` cannot be empty")}function $1(t,l){if(!t)throw new Error("Setting `"+l+"` requires `path` to be set too")}function X3(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const V3=(function(t){const i=this.constructor.prototype,o=i[t],u=function(){return o.apply(u,arguments)};return Object.setPrototypeOf(u,i),u}),G3={}.hasOwnProperty;class sh 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=_3()}copy(){const l=new sh;let a=-1;for(;++a<this.attachers.length;){const i=this.attachers[a];l.use(...i)}return l.data(Wf(!0,{},this.namespace)),l}data(l,a){return typeof l=="string"?arguments.length===2?(ld("data",this.frozen),this.namespace[l]=a,this):G3.call(this.namespace,l)&&this.namespace[l]||void 0:l?(ld("data",this.frozen),this.namespace=l,this):this.namespace}freeze(){if(this.frozen)return this;const l=this;for(;++this.freezeIndex<this.attachers.length;){const[a,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const o=a.call(l,...i);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(l){this.freeze();const a=Po(l),i=this.parser||this.Parser;return td("parse",i),i(String(a),a)}process(l,a){const i=this;return this.freeze(),td("process",this.parser||this.Parser),nd("process",this.compiler||this.Compiler),a?o(void 0,a):new Promise(o);function o(u,f){const m=Po(l),p=i.parse(m);i.run(p,m,function(g,y,b){if(g||!y||!b)return h(g);const v=y,j=i.stringify(v,b);Z3(j)?b.value=j:b.result=j,h(g,b)});function h(g,y){g||!y?f(g):u?u(y):a(void 0,y)}}}processSync(l){let a=!1,i;return this.freeze(),td("processSync",this.parser||this.Parser),nd("processSync",this.compiler||this.Compiler),this.process(l,o),U1("processSync","process",a),i;function o(u,f){a=!0,B1(u),i=f}}run(l,a,i){H1(l),this.freeze();const o=this.transformers;return!i&&typeof a=="function"&&(i=a,a=void 0),i?u(void 0,i):new Promise(u);function u(f,m){const p=Po(a);o.run(l,p,h);function h(g,y,b){const v=y||l;g?m(g):f?f(v):i(void 0,v,b)}}}runSync(l,a){let i=!1,o;return this.run(l,a,u),U1("runSync","run",i),o;function u(f,m){B1(f),o=m,i=!0}}stringify(l,a){this.freeze();const i=Po(a),o=this.compiler||this.Compiler;return nd("stringify",o),H1(l),o(l,i)}use(l,...a){const i=this.attachers,o=this.namespace;if(ld("use",this.frozen),l!=null)if(typeof l=="function")p(l,a);else if(typeof l=="object")Array.isArray(l)?m(l):f(l);else throw new TypeError("Expected usable value, not `"+l+"`");return this;function u(h){if(typeof h=="function")p(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,...y]=h;p(g,y)}else f(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function f(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");m(h.plugins),h.settings&&(o.settings=Wf(!0,o.settings,h.settings))}function m(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const y=h[g];u(y)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function p(h,g){let y=-1,b=-1;for(;++y<i.length;)if(i[y][0]===h){b=y;break}if(b===-1)i.push([h,...g]);else if(g.length>0){let[v,...j]=g;const k=i[b][1];Od(k)&&Od(v)&&(v=Wf(!0,k,v)),i[b]=[h,v,...j]}}}}const K3=new sh().freeze();function td(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function nd(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function ld(t,l){if(l)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function H1(t){if(!Od(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function U1(t,l,a){if(!a)throw new Error("`"+t+"` finished async. Use `"+l+"` instead")}function Po(t){return Q3(t)?t:new gy(t)}function Q3(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Z3(t){return typeof t=="string"||W3(t)}function W3(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const J3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",I1=[],Y1={allowDangerousHtml:!0},P3=/^(https?|ircs?|mailto|xmpp)$/i,ek=[{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 by(t){const l=tk(t),a=nk(t);return lk(l.runSync(l.parse(a),a),t)}function tk(t){const l=t.rehypePlugins||I1,a=t.remarkPlugins||I1,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Y1}:Y1;return K3().use(O5).use(a).use(T3,i).use(l)}function nk(t){const l=t.children||"",a=new gy;return typeof l=="string"&&(a.value=l),a}function lk(t,l){const a=l.allowedElements,i=l.allowElement,o=l.components,u=l.disallowedElements,f=l.skipHtml,m=l.unwrapDisallowed,p=l.urlTransform||ak;for(const g of ek)Object.hasOwn(l,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+J3+g.id,void 0);return ih(t,h),bv(t,{Fragment:c.Fragment,components:o,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function h(g,y,b){if(g.type==="raw"&&b&&typeof y=="number")return f?b.children.splice(y,1):b.children[y]={type:"text",value:g.value},y;if(g.type==="element"){let v;for(v in Gf)if(Object.hasOwn(Gf,v)&&Object.hasOwn(g.properties,v)){const j=g.properties[v],k=Gf[v];(k===null||k.includes(g.tagName))&&(g.properties[v]=p(String(j||""),v,g))}}if(g.type==="element"){let v=a?!a.includes(g.tagName):u?u.includes(g.tagName):!1;if(!v&&i&&typeof y=="number"&&(v=!i(g,y,b)),v&&b&&typeof y=="number")return m&&g.children?b.children.splice(y,1,...g.children):b.children.splice(y,1),y}}}function ak(t){const l=t.indexOf(":"),a=t.indexOf("?"),i=t.indexOf("#"),o=t.indexOf("/");return l===-1||o!==-1&&l>o||a!==-1&&l>a||i!==-1&&l>i||P3.test(t.slice(0,l))?t:""}function q1(t,l){const a=String(t);if(typeof l!="string")throw new TypeError("Expected character");let i=0,o=a.indexOf(l);for(;o!==-1;)i++,o=a.indexOf(l,o+l.length);return i}function rk(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function ik(t,l,a){const o=Dc((a||{}).ignore||[]),u=sk(l);let f=-1;for(;++f<u.length;)yy(t,"text",m);function m(h,g){let y=-1,b;for(;++y<g.length;){const v=g[y],j=b?b.children:void 0;if(o(v,j?j.indexOf(v):void 0,b))return;b=v}if(b)return p(h,g)}function p(h,g){const y=g[g.length-1],b=u[f][0],v=u[f][1];let j=0;const C=y.children.indexOf(h);let E=!1,M=[];b.lastIndex=0;let H=b.exec(h.value);for(;H;){const B=H.index,U={index:H.index,input:H.input,stack:[...g,h]};let D=v(...H,U);if(typeof D=="string"&&(D=D.length>0?{type:"text",value:D}:void 0),D===!1?b.lastIndex=B+1:(j!==B&&M.push({type:"text",value:h.value.slice(j,B)}),Array.isArray(D)?M.push(...D):D&&M.push(D),j=B+H[0].length,E=!0),!b.global)break;H=b.exec(h.value)}return E?(j<h.value.length&&M.push({type:"text",value:h.value.slice(j)}),y.children.splice(C,1,...M)):M=[h],C+M.length}}function sk(t){const l=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const a=!t[0]||Array.isArray(t[0])?t:[t];let i=-1;for(;++i<a.length;){const o=a[i];l.push([ok(o[0]),ck(o[1])])}return l}function ok(t){return typeof t=="string"?new RegExp(rk(t),"g"):t}function ck(t){return typeof t=="function"?t:function(){return t}}const ad="phrasing",rd=["autolink","link","image","label"];function uk(){return{transforms:[yk],enter:{literalAutolink:dk,literalAutolinkEmail:id,literalAutolinkHttp:id,literalAutolinkWww:id},exit:{literalAutolink:pk,literalAutolinkEmail:xk,literalAutolinkHttp:hk,literalAutolinkWww:mk}}}function fk(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ad,notInConstruct:rd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ad,notInConstruct:rd},{character:":",before:"[ps]",after:"\\/",inConstruct:ad,notInConstruct:rd}]}}function dk(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function id(t){this.config.enter.autolinkProtocol.call(this,t)}function hk(t){this.config.exit.autolinkProtocol.call(this,t)}function mk(t){this.config.exit.data.call(this,t);const l=this.stack[this.stack.length-1];l.type,l.url="http://"+this.sliceSerialize(t)}function xk(t){this.config.exit.autolinkEmail.call(this,t)}function pk(t){this.exit(t)}function yk(t){ik(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,gk],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),bk]],{ignore:["link","linkReference"]})}function gk(t,l,a,i,o){let u="";if(!vy(o)||(/^w/i.test(l)&&(a=l+a,l="",u="http://"),!vk(a)))return!1;const f=wk(a+i);if(!f[0])return!1;const m={type:"link",title:null,url:u+l+f[0],children:[{type:"text",value:l+f[0]}]};return f[1]?[m,{type:"text",value:f[1]}]:m}function bk(t,l,a,i){return!vy(i,!0)||/[-\d_]$/.test(a)?!1:{type:"link",title:null,url:"mailto:"+l+"@"+a,children:[{type:"text",value:l+"@"+a}]}}function vk(t){const l=t.split(".");return!(l.length<2||l[l.length-1]&&(/_/.test(l[l.length-1])||!/[a-zA-Z\d]/.test(l[l.length-1]))||l[l.length-2]&&(/_/.test(l[l.length-2])||!/[a-zA-Z\d]/.test(l[l.length-2])))}function wk(t){const l=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!l)return[t,void 0];t=t.slice(0,l.index);let a=l[0],i=a.indexOf(")");const o=q1(t,"(");let u=q1(t,")");for(;i!==-1&&o>u;)t+=a.slice(0,i+1),a=a.slice(i+1),i=a.indexOf(")"),u++;return[t,a]}function vy(t,l){const a=t.input.charCodeAt(t.index-1);return(t.index===0||ur(a)||Ec(a))&&(!l||a!==47)}wy.peek=Tk;function kk(){this.buffer()}function Sk(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function jk(){this.buffer()}function Ck(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function Ek(t){const l=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=hl(this.sliceSerialize(t)).toLowerCase(),a.label=l}function Nk(t){this.exit(t)}function Ak(t){const l=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=hl(this.sliceSerialize(t)).toLowerCase(),a.label=l}function Dk(t){this.exit(t)}function Tk(){return"["}function wy(t,l,a,i){const o=a.createTracker(i);let u=o.move("[^");const f=a.enter("footnoteReference"),m=a.enter("reference");return u+=o.move(a.safe(a.associationId(t),{after:"]",before:u})),m(),f(),u+=o.move("]"),u}function zk(){return{enter:{gfmFootnoteCallString:kk,gfmFootnoteCall:Sk,gfmFootnoteDefinitionLabelString:jk,gfmFootnoteDefinition:Ck},exit:{gfmFootnoteCallString:Ek,gfmFootnoteCall:Nk,gfmFootnoteDefinitionLabelString:Ak,gfmFootnoteDefinition:Dk}}}function Mk(t){let l=!1;return t&&t.firstLineBlank&&(l=!0),{handlers:{footnoteDefinition:a,footnoteReference:wy},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function a(i,o,u,f){const m=u.createTracker(f);let p=m.move("[^");const h=u.enter("footnoteDefinition"),g=u.enter("label");return p+=m.move(u.safe(u.associationId(i),{before:p,after:"]"})),g(),p+=m.move("]:"),i.children&&i.children.length>0&&(m.shift(4),p+=m.move((l?`
|
|
64
|
-
`:" ")+u.indentLines(u.containerFlow(i,m.current()),l?ky:_k))),h(),p}}function _k(t,l,a){return l===0?t:ky(t,l,a)}function ky(t,l,a){return(a?"":" ")+t}const Fk=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Sy.peek=$k;function Rk(){return{canContainEols:["delete"],enter:{strikethrough:Bk},exit:{strikethrough:Lk}}}function Ok(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Fk}],handlers:{delete:Sy}}}function Bk(t){this.enter({type:"delete",children:[]},t)}function Lk(t){this.exit(t)}function Sy(t,l,a,i){const o=a.createTracker(i),u=a.enter("strikethrough");let f=o.move("~~");return f+=a.containerPhrasing(t,{...o.current(),before:f,after:"~"}),f+=o.move("~~"),u(),f}function $k(){return"~"}function Hk(t){return t.length}function Uk(t,l){const a=l||{},i=(a.align||[]).concat(),o=a.stringLength||Hk,u=[],f=[],m=[],p=[];let h=0,g=-1;for(;++g<t.length;){const k=[],C=[];let E=-1;for(t[g].length>h&&(h=t[g].length);++E<t[g].length;){const M=Ik(t[g][E]);if(a.alignDelimiters!==!1){const H=o(M);C[E]=H,(p[E]===void 0||H>p[E])&&(p[E]=H)}k.push(M)}f[g]=k,m[g]=C}let y=-1;if(typeof i=="object"&&"length"in i)for(;++y<h;)u[y]=X1(i[y]);else{const k=X1(i);for(;++y<h;)u[y]=k}y=-1;const b=[],v=[];for(;++y<h;){const k=u[y];let C="",E="";k===99?(C=":",E=":"):k===108?C=":":k===114&&(E=":");let M=a.alignDelimiters===!1?1:Math.max(1,p[y]-C.length-E.length);const H=C+"-".repeat(M)+E;a.alignDelimiters!==!1&&(M=C.length+M+E.length,M>p[y]&&(p[y]=M),v[y]=M),b[y]=H}f.splice(1,0,b),m.splice(1,0,v),g=-1;const j=[];for(;++g<f.length;){const k=f[g],C=m[g];y=-1;const E=[];for(;++y<h;){const M=k[y]||"";let H="",B="";if(a.alignDelimiters!==!1){const U=p[y]-(C[y]||0),D=u[y];D===114?H=" ".repeat(U):D===99?U%2?(H=" ".repeat(U/2+.5),B=" ".repeat(U/2-.5)):(H=" ".repeat(U/2),B=H):B=" ".repeat(U)}a.delimiterStart!==!1&&!y&&E.push("|"),a.padding!==!1&&!(a.alignDelimiters===!1&&M==="")&&(a.delimiterStart!==!1||y)&&E.push(" "),a.alignDelimiters!==!1&&E.push(H),E.push(M),a.alignDelimiters!==!1&&E.push(B),a.padding!==!1&&E.push(" "),(a.delimiterEnd!==!1||y!==h-1)&&E.push("|")}j.push(a.delimiterEnd===!1?E.join("").replace(/ +$/,""):E.join(""))}return j.join(`
|
|
65
|
-
`)}function Ik(t){return t==null?"":String(t)}function X1(t){const l=typeof t=="string"?t.codePointAt(0):0;return l===67||l===99?99:l===76||l===108?108:l===82||l===114?114:0}function Yk(t,l,a,i){const o=a.enter("blockquote"),u=a.createTracker(i);u.move("> "),u.shift(2);const f=a.indentLines(a.containerFlow(t,u.current()),qk);return o(),f}function qk(t,l,a){return">"+(a?"":" ")+t}function Xk(t,l){return V1(t,l.inConstruct,!0)&&!V1(t,l.notInConstruct,!1)}function V1(t,l,a){if(typeof l=="string"&&(l=[l]),!l||l.length===0)return a;let i=-1;for(;++i<l.length;)if(t.includes(l[i]))return!0;return!1}function G1(t,l,a,i){let o=-1;for(;++o<a.unsafe.length;)if(a.unsafe[o].character===`
|
|
66
|
-
`&&Xk(a.stack,a.unsafe[o]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
67
|
-
`}function Vk(t,l){const a=String(t);let i=a.indexOf(l),o=i,u=0,f=0;if(typeof l!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===o?++u>f&&(f=u):u=1,o=i+l.length,i=a.indexOf(l,o);return f}function Gk(t,l){return!!(l.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function Kk(t){const l=t.options.fence||"`";if(l!=="`"&&l!=="~")throw new Error("Cannot serialize code with `"+l+"` for `options.fence`, expected `` ` `` or `~`");return l}function Qk(t,l,a,i){const o=Kk(a),u=t.value||"",f=o==="`"?"GraveAccent":"Tilde";if(Gk(t,a)){const y=a.enter("codeIndented"),b=a.indentLines(u,Zk);return y(),b}const m=a.createTracker(i),p=o.repeat(Math.max(Vk(u,o)+1,3)),h=a.enter("codeFenced");let g=m.move(p);if(t.lang){const y=a.enter(`codeFencedLang${f}`);g+=m.move(a.safe(t.lang,{before:g,after:" ",encode:["`"],...m.current()})),y()}if(t.lang&&t.meta){const y=a.enter(`codeFencedMeta${f}`);g+=m.move(" "),g+=m.move(a.safe(t.meta,{before:g,after:`
|
|
68
|
-
`,encode:["`"],...m.current()})),y()}return g+=m.move(`
|
|
69
|
-
`),u&&(g+=m.move(u+`
|
|
70
|
-
`)),g+=m.move(p),h(),g}function Zk(t,l,a){return(a?"":" ")+t}function oh(t){const l=t.options.quote||'"';if(l!=='"'&&l!=="'")throw new Error("Cannot serialize title with `"+l+"` for `options.quote`, expected `\"`, or `'`");return l}function Wk(t,l,a,i){const o=oh(a),u=o==='"'?"Quote":"Apostrophe",f=a.enter("definition");let m=a.enter("label");const p=a.createTracker(i);let h=p.move("[");return h+=p.move(a.safe(a.associationId(t),{before:h,after:"]",...p.current()})),h+=p.move("]: "),m(),!t.url||/[\0- \u007F]/.test(t.url)?(m=a.enter("destinationLiteral"),h+=p.move("<"),h+=p.move(a.safe(t.url,{before:h,after:">",...p.current()})),h+=p.move(">")):(m=a.enter("destinationRaw"),h+=p.move(a.safe(t.url,{before:h,after:t.title?" ":`
|
|
71
|
-
`,...p.current()}))),m(),t.title&&(m=a.enter(`title${u}`),h+=p.move(" "+o),h+=p.move(a.safe(t.title,{before:h,after:o,...p.current()})),h+=p.move(o),m()),f(),h}function Jk(t){const l=t.options.emphasis||"*";if(l!=="*"&&l!=="_")throw new Error("Cannot serialize emphasis with `"+l+"` for `options.emphasis`, expected `*`, or `_`");return l}function Cs(t){return"&#x"+t.toString(16).toUpperCase()+";"}function gc(t,l,a){const i=ei(t),o=ei(l);return i===void 0?o===void 0?a==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}jy.peek=Pk;function jy(t,l,a,i){const o=Jk(a),u=a.enter("emphasis"),f=a.createTracker(i),m=f.move(o);let p=f.move(a.containerPhrasing(t,{after:o,before:m,...f.current()}));const h=p.charCodeAt(0),g=gc(i.before.charCodeAt(i.before.length-1),h,o);g.inside&&(p=Cs(h)+p.slice(1));const y=p.charCodeAt(p.length-1),b=gc(i.after.charCodeAt(0),y,o);b.inside&&(p=p.slice(0,-1)+Cs(y));const v=f.move(o);return u(),a.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},m+p+v}function Pk(t,l,a){return a.options.emphasis||"*"}function e4(t,l){let a=!1;return ih(t,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return a=!0,Fd}),!!((!t.depth||t.depth<3)&&Pd(t)&&(l.options.setext||a))}function t4(t,l,a,i){const o=Math.max(Math.min(6,t.depth||1),1),u=a.createTracker(i);if(e4(t,a)){const g=a.enter("headingSetext"),y=a.enter("phrasing"),b=a.containerPhrasing(t,{...u.current(),before:`
|
|
72
|
-
`,after:`
|
|
73
|
-
`});return y(),g(),b+`
|
|
74
|
-
`+(o===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
75
|
-
`))+1))}const f="#".repeat(o),m=a.enter("headingAtx"),p=a.enter("phrasing");u.move(f+" ");let h=a.containerPhrasing(t,{before:"# ",after:`
|
|
76
|
-
`,...u.current()});return/^[\t ]/.test(h)&&(h=Cs(h.charCodeAt(0))+h.slice(1)),h=h?f+" "+h:f,a.options.closeAtx&&(h+=" "+f),p(),m(),h}Cy.peek=n4;function Cy(t){return t.value||""}function n4(){return"<"}Ey.peek=l4;function Ey(t,l,a,i){const o=oh(a),u=o==='"'?"Quote":"Apostrophe",f=a.enter("image");let m=a.enter("label");const p=a.createTracker(i);let h=p.move("![");return h+=p.move(a.safe(t.alt,{before:h,after:"]",...p.current()})),h+=p.move("]("),m(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(m=a.enter("destinationLiteral"),h+=p.move("<"),h+=p.move(a.safe(t.url,{before:h,after:">",...p.current()})),h+=p.move(">")):(m=a.enter("destinationRaw"),h+=p.move(a.safe(t.url,{before:h,after:t.title?" ":")",...p.current()}))),m(),t.title&&(m=a.enter(`title${u}`),h+=p.move(" "+o),h+=p.move(a.safe(t.title,{before:h,after:o,...p.current()})),h+=p.move(o),m()),h+=p.move(")"),f(),h}function l4(){return"!"}Ny.peek=a4;function Ny(t,l,a,i){const o=t.referenceType,u=a.enter("imageReference");let f=a.enter("label");const m=a.createTracker(i);let p=m.move("![");const h=a.safe(t.alt,{before:p,after:"]",...m.current()});p+=m.move(h+"]["),f();const g=a.stack;a.stack=[],f=a.enter("reference");const y=a.safe(a.associationId(t),{before:p,after:"]",...m.current()});return f(),a.stack=g,u(),o==="full"||!h||h!==y?p+=m.move(y+"]"):o==="shortcut"?p=p.slice(0,-1):p+=m.move("]"),p}function a4(){return"!"}Ay.peek=r4;function Ay(t,l,a){let i=t.value||"",o="`",u=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(i);)o+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++u<a.unsafe.length;){const f=a.unsafe[u],m=a.compilePattern(f);let p;if(f.atBreak)for(;p=m.exec(i);){let h=p.index;i.charCodeAt(h)===10&&i.charCodeAt(h-1)===13&&h--,i=i.slice(0,h)+" "+i.slice(p.index+1)}}return o+i+o}function r4(){return"`"}function Dy(t,l){const a=Pd(t);return!!(!l.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(a===t.url||"mailto:"+a===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}Ty.peek=i4;function Ty(t,l,a,i){const o=oh(a),u=o==='"'?"Quote":"Apostrophe",f=a.createTracker(i);let m,p;if(Dy(t,a)){const g=a.stack;a.stack=[],m=a.enter("autolink");let y=f.move("<");return y+=f.move(a.containerPhrasing(t,{before:y,after:">",...f.current()})),y+=f.move(">"),m(),a.stack=g,y}m=a.enter("link"),p=a.enter("label");let h=f.move("[");return h+=f.move(a.containerPhrasing(t,{before:h,after:"](",...f.current()})),h+=f.move("]("),p(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(p=a.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(a.safe(t.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(p=a.enter("destinationRaw"),h+=f.move(a.safe(t.url,{before:h,after:t.title?" ":")",...f.current()}))),p(),t.title&&(p=a.enter(`title${u}`),h+=f.move(" "+o),h+=f.move(a.safe(t.title,{before:h,after:o,...f.current()})),h+=f.move(o),p()),h+=f.move(")"),m(),h}function i4(t,l,a){return Dy(t,a)?"<":"["}zy.peek=s4;function zy(t,l,a,i){const o=t.referenceType,u=a.enter("linkReference");let f=a.enter("label");const m=a.createTracker(i);let p=m.move("[");const h=a.containerPhrasing(t,{before:p,after:"]",...m.current()});p+=m.move(h+"]["),f();const g=a.stack;a.stack=[],f=a.enter("reference");const y=a.safe(a.associationId(t),{before:p,after:"]",...m.current()});return f(),a.stack=g,u(),o==="full"||!h||h!==y?p+=m.move(y+"]"):o==="shortcut"?p=p.slice(0,-1):p+=m.move("]"),p}function s4(){return"["}function ch(t){const l=t.options.bullet||"*";if(l!=="*"&&l!=="+"&&l!=="-")throw new Error("Cannot serialize items with `"+l+"` for `options.bullet`, expected `*`, `+`, or `-`");return l}function o4(t){const l=ch(t),a=t.options.bulletOther;if(!a)return l==="*"?"-":"*";if(a!=="*"&&a!=="+"&&a!=="-")throw new Error("Cannot serialize items with `"+a+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(a===l)throw new Error("Expected `bullet` (`"+l+"`) and `bulletOther` (`"+a+"`) to be different");return a}function c4(t){const l=t.options.bulletOrdered||".";if(l!=="."&&l!==")")throw new Error("Cannot serialize items with `"+l+"` for `options.bulletOrdered`, expected `.` or `)`");return l}function My(t){const l=t.options.rule||"*";if(l!=="*"&&l!=="-"&&l!=="_")throw new Error("Cannot serialize rules with `"+l+"` for `options.rule`, expected `*`, `-`, or `_`");return l}function u4(t,l,a,i){const o=a.enter("list"),u=a.bulletCurrent;let f=t.ordered?c4(a):ch(a);const m=t.ordered?f==="."?")":".":o4(a);let p=l&&a.bulletLastUsed?f===a.bulletLastUsed:!1;if(!t.ordered){const g=t.children?t.children[0]:void 0;if((f==="*"||f==="-")&&g&&(!g.children||!g.children[0])&&a.stack[a.stack.length-1]==="list"&&a.stack[a.stack.length-2]==="listItem"&&a.stack[a.stack.length-3]==="list"&&a.stack[a.stack.length-4]==="listItem"&&a.indexStack[a.indexStack.length-1]===0&&a.indexStack[a.indexStack.length-2]===0&&a.indexStack[a.indexStack.length-3]===0&&(p=!0),My(a)===f&&g){let y=-1;for(;++y<t.children.length;){const b=t.children[y];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){p=!0;break}}}}p&&(f=m),a.bulletCurrent=f;const h=a.containerFlow(t,i);return a.bulletLastUsed=f,a.bulletCurrent=u,o(),h}function f4(t){const l=t.options.listItemIndent||"one";if(l!=="tab"&&l!=="one"&&l!=="mixed")throw new Error("Cannot serialize items with `"+l+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return l}function d4(t,l,a,i){const o=f4(a);let u=a.bulletCurrent||ch(a);l&&l.type==="list"&&l.ordered&&(u=(typeof l.start=="number"&&l.start>-1?l.start:1)+(a.options.incrementListMarker===!1?0:l.children.indexOf(t))+u);let f=u.length+1;(o==="tab"||o==="mixed"&&(l&&l.type==="list"&&l.spread||t.spread))&&(f=Math.ceil(f/4)*4);const m=a.createTracker(i);m.move(u+" ".repeat(f-u.length)),m.shift(f);const p=a.enter("listItem"),h=a.indentLines(a.containerFlow(t,m.current()),g);return p(),h;function g(y,b,v){return b?(v?"":" ".repeat(f))+y:(v?u:u+" ".repeat(f-u.length))+y}}function h4(t,l,a,i){const o=a.enter("paragraph"),u=a.enter("phrasing"),f=a.containerPhrasing(t,i);return u(),o(),f}const m4=Dc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function x4(t,l,a,i){return(t.children.some(function(f){return m4(f)})?a.containerPhrasing:a.containerFlow).call(a,t,i)}function p4(t){const l=t.options.strong||"*";if(l!=="*"&&l!=="_")throw new Error("Cannot serialize strong with `"+l+"` for `options.strong`, expected `*`, or `_`");return l}_y.peek=y4;function _y(t,l,a,i){const o=p4(a),u=a.enter("strong"),f=a.createTracker(i),m=f.move(o+o);let p=f.move(a.containerPhrasing(t,{after:o,before:m,...f.current()}));const h=p.charCodeAt(0),g=gc(i.before.charCodeAt(i.before.length-1),h,o);g.inside&&(p=Cs(h)+p.slice(1));const y=p.charCodeAt(p.length-1),b=gc(i.after.charCodeAt(0),y,o);b.inside&&(p=p.slice(0,-1)+Cs(y));const v=f.move(o+o);return u(),a.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},m+p+v}function y4(t,l,a){return a.options.strong||"*"}function g4(t,l,a,i){return a.safe(t.value,i)}function b4(t){const l=t.options.ruleRepetition||3;if(l<3)throw new Error("Cannot serialize rules with repetition `"+l+"` for `options.ruleRepetition`, expected `3` or more");return l}function v4(t,l,a){const i=(My(a)+(a.options.ruleSpaces?" ":"")).repeat(b4(a));return a.options.ruleSpaces?i.slice(0,-1):i}const Fy={blockquote:Yk,break:G1,code:Qk,definition:Wk,emphasis:jy,hardBreak:G1,heading:t4,html:Cy,image:Ey,imageReference:Ny,inlineCode:Ay,link:Ty,linkReference:zy,list:u4,listItem:d4,paragraph:h4,root:x4,strong:_y,text:g4,thematicBreak:v4};function w4(){return{enter:{table:k4,tableData:K1,tableHeader:K1,tableRow:j4},exit:{codeText:C4,table:S4,tableData:sd,tableHeader:sd,tableRow:sd}}}function k4(t){const l=t._align;this.enter({type:"table",align:l.map(function(a){return a==="none"?null:a}),children:[]},t),this.data.inTable=!0}function S4(t){this.exit(t),this.data.inTable=void 0}function j4(t){this.enter({type:"tableRow",children:[]},t)}function sd(t){this.exit(t)}function K1(t){this.enter({type:"tableCell",children:[]},t)}function C4(t){let l=this.resume();this.data.inTable&&(l=l.replace(/\\([\\|])/g,E4));const a=this.stack[this.stack.length-1];a.type,a.value=l,this.exit(t)}function E4(t,l){return l==="|"?l:t}function N4(t){const l=t||{},a=l.tableCellPadding,i=l.tablePipeAlign,o=l.stringLength,u=a?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
77
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:f,tableCell:p,tableRow:m}};function f(v,j,k,C){return h(g(v,k,C),v.align)}function m(v,j,k,C){const E=y(v,k,C),M=h([E]);return M.slice(0,M.indexOf(`
|
|
78
|
-
`))}function p(v,j,k,C){const E=k.enter("tableCell"),M=k.enter("phrasing"),H=k.containerPhrasing(v,{...C,before:u,after:u});return M(),E(),H}function h(v,j){return Uk(v,{align:j,alignDelimiters:i,padding:a,stringLength:o})}function g(v,j,k){const C=v.children;let E=-1;const M=[],H=j.enter("table");for(;++E<C.length;)M[E]=y(C[E],j,k);return H(),M}function y(v,j,k){const C=v.children;let E=-1;const M=[],H=j.enter("tableRow");for(;++E<C.length;)M[E]=p(C[E],v,j,k);return H(),M}function b(v,j,k){let C=Fy.inlineCode(v,j,k);return k.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function A4(){return{exit:{taskListCheckValueChecked:Q1,taskListCheckValueUnchecked:Q1,paragraph:T4}}}function D4(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:z4}}}function Q1(t){const l=this.stack[this.stack.length-2];l.type,l.checked=t.type==="taskListCheckValueChecked"}function T4(t){const l=this.stack[this.stack.length-2];if(l&&l.type==="listItem"&&typeof l.checked=="boolean"){const a=this.stack[this.stack.length-1];a.type;const i=a.children[0];if(i&&i.type==="text"){const o=l.children;let u=-1,f;for(;++u<o.length;){const m=o[u];if(m.type==="paragraph"){f=m;break}}f===a&&(i.value=i.value.slice(1),i.value.length===0?a.children.shift():a.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,a.position.start=Object.assign({},i.position.start)))}}this.exit(t)}function z4(t,l,a,i){const o=t.children[0],u=typeof t.checked=="boolean"&&o&&o.type==="paragraph",f="["+(t.checked?"x":" ")+"] ",m=a.createTracker(i);u&&m.move(f);let p=Fy.listItem(t,l,a,{...i,...m.current()});return u&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),p;function h(g){return g+f}}function M4(){return[uk(),zk(),Rk(),w4(),A4()]}function _4(t){return{extensions:[fk(),Mk(t),Ok(),N4(t),D4()]}}const F4={tokenize:H4,partial:!0},Ry={tokenize:U4,partial:!0},Oy={tokenize:I4,partial:!0},By={tokenize:Y4,partial:!0},R4={tokenize:q4,partial:!0},Ly={name:"wwwAutolink",tokenize:L4,previous:Hy},$y={name:"protocolAutolink",tokenize:$4,previous:Uy},Wl={name:"emailAutolink",tokenize:B4,previous:Iy},El={};function O4(){return{text:El}}let lr=48;for(;lr<123;)El[lr]=Wl,lr++,lr===58?lr=65:lr===91&&(lr=97);El[43]=Wl;El[45]=Wl;El[46]=Wl;El[95]=Wl;El[72]=[Wl,$y];El[104]=[Wl,$y];El[87]=[Wl,Ly];El[119]=[Wl,Ly];function B4(t,l,a){const i=this;let o,u;return f;function f(y){return!Ld(y)||!Iy.call(i,i.previous)||uh(i.events)?a(y):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),m(y))}function m(y){return Ld(y)?(t.consume(y),m):y===64?(t.consume(y),p):a(y)}function p(y){return y===46?t.check(R4,g,h)(y):y===45||y===95||mn(y)?(u=!0,t.consume(y),p):g(y)}function h(y){return t.consume(y),o=!0,p}function g(y){return u&&o&&gn(i.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),l(y)):a(y)}}function L4(t,l,a){const i=this;return o;function o(f){return f!==87&&f!==119||!Hy.call(i,i.previous)||uh(i.events)?a(f):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(F4,t.attempt(Ry,t.attempt(Oy,u),a),a)(f))}function u(f){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),l(f)}}function $4(t,l,a){const i=this;let o="",u=!1;return f;function f(y){return(y===72||y===104)&&Uy.call(i,i.previous)&&!uh(i.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),o+=String.fromCodePoint(y),t.consume(y),m):a(y)}function m(y){if(gn(y)&&o.length<5)return o+=String.fromCodePoint(y),t.consume(y),m;if(y===58){const b=o.toLowerCase();if(b==="http"||b==="https")return t.consume(y),p}return a(y)}function p(y){return y===47?(t.consume(y),u?h:(u=!0,p)):a(y)}function h(y){return y===null||xc(y)||Tt(y)||ur(y)||Ec(y)?a(y):t.attempt(Ry,t.attempt(Oy,g),a)(y)}function g(y){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),l(y)}}function H4(t,l,a){let i=0;return o;function o(f){return(f===87||f===119)&&i<3?(i++,t.consume(f),o):f===46&&i===3?(t.consume(f),u):a(f)}function u(f){return f===null?a(f):l(f)}}function U4(t,l,a){let i,o,u;return f;function f(h){return h===46||h===95?t.check(By,p,m)(h):h===null||Tt(h)||ur(h)||h!==45&&Ec(h)?p(h):(u=!0,t.consume(h),f)}function m(h){return h===95?i=!0:(o=i,i=void 0),t.consume(h),f}function p(h){return o||i||!u?a(h):l(h)}}function I4(t,l){let a=0,i=0;return o;function o(f){return f===40?(a++,t.consume(f),o):f===41&&i<a?u(f):f===33||f===34||f===38||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===60||f===63||f===93||f===95||f===126?t.check(By,l,u)(f):f===null||Tt(f)||ur(f)?l(f):(t.consume(f),o)}function u(f){return f===41&&i++,t.consume(f),o}}function Y4(t,l,a){return i;function i(m){return m===33||m===34||m===39||m===41||m===42||m===44||m===46||m===58||m===59||m===63||m===95||m===126?(t.consume(m),i):m===38?(t.consume(m),u):m===93?(t.consume(m),o):m===60||m===null||Tt(m)||ur(m)?l(m):a(m)}function o(m){return m===null||m===40||m===91||Tt(m)||ur(m)?l(m):i(m)}function u(m){return gn(m)?f(m):a(m)}function f(m){return m===59?(t.consume(m),i):gn(m)?(t.consume(m),f):a(m)}}function q4(t,l,a){return i;function i(u){return t.consume(u),o}function o(u){return mn(u)?a(u):l(u)}}function Hy(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Tt(t)}function Uy(t){return!gn(t)}function Iy(t){return!(t===47||Ld(t))}function Ld(t){return t===43||t===45||t===46||t===95||mn(t)}function uh(t){let l=t.length,a=!1;for(;l--;){const i=t[l][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){a=!0;break}if(i._gfmAutolinkLiteralWalkedInto){a=!1;break}}return t.length>0&&!a&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const X4={tokenize:P4,partial:!0};function V4(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Z4,continuation:{tokenize:W4},exit:J4}},text:{91:{name:"gfmFootnoteCall",tokenize:Q4},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:G4,resolveTo:K4}}}}function G4(t,l,a){const i=this;let o=i.events.length;const u=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let f;for(;o--;){const p=i.events[o][1];if(p.type==="labelImage"){f=p;break}if(p.type==="gfmFootnoteCall"||p.type==="labelLink"||p.type==="label"||p.type==="image"||p.type==="link")break}return m;function m(p){if(!f||!f._balanced)return a(p);const h=hl(i.sliceSerialize({start:f.end,end:i.now()}));return h.codePointAt(0)!==94||!u.includes(h.slice(1))?a(p):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),l(p))}}function K4(t,l){let a=t.length;for(;a--;)if(t[a][1].type==="labelImage"&&t[a][0]==="enter"){t[a][1];break}t[a+1][1].type="data",t[a+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},t[a+3][1].start),end:Object.assign({},t[t.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},t[a+3][1].end),end:Object.assign({},t[a+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},t[t.length-1][1].start)},f={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},m=[t[a+1],t[a+2],["enter",i,l],t[a+3],t[a+4],["enter",o,l],["exit",o,l],["enter",u,l],["enter",f,l],["exit",f,l],["exit",u,l],t[t.length-2],t[t.length-1],["exit",i,l]];return t.splice(a,t.length-a+1,...m),t}function Q4(t,l,a){const i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u=0,f;return m;function m(y){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),p}function p(y){return y!==94?a(y):(t.enter("gfmFootnoteCallMarker"),t.consume(y),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(y){if(u>999||y===93&&!f||y===null||y===91||Tt(y))return a(y);if(y===93){t.exit("chunkString");const b=t.exit("gfmFootnoteCallString");return o.includes(hl(i.sliceSerialize(b)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),l):a(y)}return Tt(y)||(f=!0),u++,t.consume(y),y===92?g:h}function g(y){return y===91||y===92||y===93?(t.consume(y),u++,h):h(y)}}function Z4(t,l,a){const i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u,f=0,m;return p;function p(j){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(j),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(j){return j===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(j),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",g):a(j)}function g(j){if(f>999||j===93&&!m||j===null||j===91||Tt(j))return a(j);if(j===93){t.exit("chunkString");const k=t.exit("gfmFootnoteDefinitionLabelString");return u=hl(i.sliceSerialize(k)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(j),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),b}return Tt(j)||(m=!0),f++,t.consume(j),j===92?y:g}function y(j){return j===91||j===92||j===93?(t.consume(j),f++,g):g(j)}function b(j){return j===58?(t.enter("definitionMarker"),t.consume(j),t.exit("definitionMarker"),o.includes(u)||o.push(u),ct(t,v,"gfmFootnoteDefinitionWhitespace")):a(j)}function v(j){return l(j)}}function W4(t,l,a){return t.check(zs,l,t.attempt(X4,l,a))}function J4(t){t.exit("gfmFootnoteDefinition")}function P4(t,l,a){const i=this;return ct(t,o,"gfmFootnoteDefinitionIndent",5);function o(u){const f=i.events[i.events.length-1];return f&&f[1].type==="gfmFootnoteDefinitionIndent"&&f[2].sliceSerialize(f[1],!0).length===4?l(u):a(u)}}function eS(t){let a=(t||{}).singleTilde;const i={name:"strikethrough",tokenize:u,resolveAll:o};return a==null&&(a=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function o(f,m){let p=-1;for(;++p<f.length;)if(f[p][0]==="enter"&&f[p][1].type==="strikethroughSequenceTemporary"&&f[p][1]._close){let h=p;for(;h--;)if(f[h][0]==="exit"&&f[h][1].type==="strikethroughSequenceTemporary"&&f[h][1]._open&&f[p][1].end.offset-f[p][1].start.offset===f[h][1].end.offset-f[h][1].start.offset){f[p][1].type="strikethroughSequence",f[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},f[h][1].start),end:Object.assign({},f[p][1].end)},y={type:"strikethroughText",start:Object.assign({},f[h][1].end),end:Object.assign({},f[p][1].start)},b=[["enter",g,m],["enter",f[h][1],m],["exit",f[h][1],m],["enter",y,m]],v=m.parser.constructs.insideSpan.null;v&&Yn(b,b.length,0,Nc(v,f.slice(h+1,p),m)),Yn(b,b.length,0,[["exit",y,m],["enter",f[p][1],m],["exit",f[p][1],m],["exit",g,m]]),Yn(f,h-1,p-h+3,b),p=h+b.length-2;break}}for(p=-1;++p<f.length;)f[p][1].type==="strikethroughSequenceTemporary"&&(f[p][1].type="data");return f}function u(f,m,p){const h=this.previous,g=this.events;let y=0;return b;function b(j){return h===126&&g[g.length-1][1].type!=="characterEscape"?p(j):(f.enter("strikethroughSequenceTemporary"),v(j))}function v(j){const k=ei(h);if(j===126)return y>1?p(j):(f.consume(j),y++,v);if(y<2&&!a)return p(j);const C=f.exit("strikethroughSequenceTemporary"),E=ei(j);return C._open=!E||E===2&&!!k,C._close=!k||k===2&&!!E,m(j)}}}class tS{constructor(){this.map=[]}add(l,a,i){nS(this,l,a,i)}consume(l){if(this.map.sort(function(u,f){return u[0]-f[0]}),this.map.length===0)return;let a=this.map.length;const i=[];for(;a>0;)a-=1,i.push(l.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),l.length=this.map[a][0];i.push(l.slice()),l.length=0;let o=i.pop();for(;o;){for(const u of o)l.push(u);o=i.pop()}this.map.length=0}}function nS(t,l,a,i){let o=0;if(!(a===0&&i.length===0)){for(;o<t.map.length;){if(t.map[o][0]===l){t.map[o][1]+=a,t.map[o][2].push(...i);return}o+=1}t.map.push([l,a,i])}}function lS(t,l){let a=!1;const i=[];for(;l<t.length;){const o=t[l];if(a){if(o[0]==="enter")o[1].type==="tableContent"&&i.push(t[l+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(t[l-1][1].type==="tableDelimiterMarker"){const u=i.length-1;i[u]=i[u]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(a=!0);l+=1}return i}function aS(){return{flow:{null:{name:"table",tokenize:rS,resolveAll:iS}}}}function rS(t,l,a){const i=this;let o=0,u=0,f;return m;function m(T){let L=i.events.length-1;for(;L>-1;){const ae=i.events[L][1].type;if(ae==="lineEnding"||ae==="linePrefix")L--;else break}const $=L>-1?i.events[L][1].type:null,ee=$==="tableHead"||$==="tableRow"?D:p;return ee===D&&i.parser.lazy[i.now().line]?a(T):ee(T)}function p(T){return t.enter("tableHead"),t.enter("tableRow"),h(T)}function h(T){return T===124||(f=!0,u+=1),g(T)}function g(T){return T===null?a(T):He(T)?u>1?(u=0,i.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),v):a(T):at(T)?ct(t,g,"whitespace")(T):(u+=1,f&&(f=!1,o+=1),T===124?(t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),f=!0,g):(t.enter("data"),y(T)))}function y(T){return T===null||T===124||Tt(T)?(t.exit("data"),g(T)):(t.consume(T),T===92?b:y)}function b(T){return T===92||T===124?(t.consume(T),y):y(T)}function v(T){return i.interrupt=!1,i.parser.lazy[i.now().line]?a(T):(t.enter("tableDelimiterRow"),f=!1,at(T)?ct(t,j,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):j(T))}function j(T){return T===45||T===58?C(T):T===124?(f=!0,t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),k):U(T)}function k(T){return at(T)?ct(t,C,"whitespace")(T):C(T)}function C(T){return T===58?(u+=1,f=!0,t.enter("tableDelimiterMarker"),t.consume(T),t.exit("tableDelimiterMarker"),E):T===45?(u+=1,E(T)):T===null||He(T)?B(T):U(T)}function E(T){return T===45?(t.enter("tableDelimiterFiller"),M(T)):U(T)}function M(T){return T===45?(t.consume(T),M):T===58?(f=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(T),t.exit("tableDelimiterMarker"),H):(t.exit("tableDelimiterFiller"),H(T))}function H(T){return at(T)?ct(t,B,"whitespace")(T):B(T)}function B(T){return T===124?j(T):T===null||He(T)?!f||o!==u?U(T):(t.exit("tableDelimiterRow"),t.exit("tableHead"),l(T)):U(T)}function U(T){return a(T)}function D(T){return t.enter("tableRow"),Y(T)}function Y(T){return T===124?(t.enter("tableCellDivider"),t.consume(T),t.exit("tableCellDivider"),Y):T===null||He(T)?(t.exit("tableRow"),l(T)):at(T)?ct(t,Y,"whitespace")(T):(t.enter("data"),V(T))}function V(T){return T===null||T===124||Tt(T)?(t.exit("data"),Y(T)):(t.consume(T),T===92?ne:V)}function ne(T){return T===92||T===124?(t.consume(T),V):V(T)}}function iS(t,l){let a=-1,i=!0,o=0,u=[0,0,0,0],f=[0,0,0,0],m=!1,p=0,h,g,y;const b=new tS;for(;++a<t.length;){const v=t[a],j=v[1];v[0]==="enter"?j.type==="tableHead"?(m=!1,p!==0&&(Z1(b,l,p,h,g),g=void 0,p=0),h={type:"table",start:Object.assign({},j.start),end:Object.assign({},j.end)},b.add(a,0,[["enter",h,l]])):j.type==="tableRow"||j.type==="tableDelimiterRow"?(i=!0,y=void 0,u=[0,0,0,0],f=[0,a+1,0,0],m&&(m=!1,g={type:"tableBody",start:Object.assign({},j.start),end:Object.assign({},j.end)},b.add(a,0,[["enter",g,l]])),o=j.type==="tableDelimiterRow"?2:g?3:1):o&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")?(i=!1,f[2]===0&&(u[1]!==0&&(f[0]=f[1],y=ec(b,l,u,o,void 0,y),u=[0,0,0,0]),f[2]=a)):j.type==="tableCellDivider"&&(i?i=!1:(u[1]!==0&&(f[0]=f[1],y=ec(b,l,u,o,void 0,y)),u=f,f=[u[1],a,0,0])):j.type==="tableHead"?(m=!0,p=a):j.type==="tableRow"||j.type==="tableDelimiterRow"?(p=a,u[1]!==0?(f[0]=f[1],y=ec(b,l,u,o,a,y)):f[1]!==0&&(y=ec(b,l,f,o,a,y)),o=0):o&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")&&(f[3]=a)}for(p!==0&&Z1(b,l,p,h,g),b.consume(l.events),a=-1;++a<l.events.length;){const v=l.events[a];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=lS(l.events,a))}return t}function ec(t,l,a,i,o,u){const f=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",m="tableContent";a[0]!==0&&(u.end=Object.assign({},Jr(l.events,a[0])),t.add(a[0],0,[["exit",u,l]]));const p=Jr(l.events,a[1]);if(u={type:f,start:Object.assign({},p),end:Object.assign({},p)},t.add(a[1],0,[["enter",u,l]]),a[2]!==0){const h=Jr(l.events,a[2]),g=Jr(l.events,a[3]),y={type:m,start:Object.assign({},h),end:Object.assign({},g)};if(t.add(a[2],0,[["enter",y,l]]),i!==2){const b=l.events[a[2]],v=l.events[a[3]];if(b[1].end=Object.assign({},v[1].end),b[1].type="chunkText",b[1].contentType="text",a[3]>a[2]+1){const j=a[2]+1,k=a[3]-a[2]-1;t.add(j,k,[])}}t.add(a[3]+1,0,[["exit",y,l]])}return o!==void 0&&(u.end=Object.assign({},Jr(l.events,o)),t.add(o,0,[["exit",u,l]]),u=void 0),u}function Z1(t,l,a,i,o){const u=[],f=Jr(l.events,a);o&&(o.end=Object.assign({},f),u.push(["exit",o,l])),i.end=Object.assign({},f),u.push(["exit",i,l]),t.add(a+1,0,u)}function Jr(t,l){const a=t[l],i=a[0]==="enter"?"start":"end";return a[1][i]}const sS={name:"tasklistCheck",tokenize:cS};function oS(){return{text:{91:sS}}}function cS(t,l,a){const i=this;return o;function o(p){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?a(p):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(p),t.exit("taskListCheckMarker"),u)}function u(p){return Tt(p)?(t.enter("taskListCheckValueUnchecked"),t.consume(p),t.exit("taskListCheckValueUnchecked"),f):p===88||p===120?(t.enter("taskListCheckValueChecked"),t.consume(p),t.exit("taskListCheckValueChecked"),f):a(p)}function f(p){return p===93?(t.enter("taskListCheckMarker"),t.consume(p),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),m):a(p)}function m(p){return He(p)?l(p):at(p)?t.check({tokenize:uS},l,a)(p):a(p)}}function uS(t,l,a){return ct(t,i,"whitespace");function i(o){return o===null?a(o):l(o)}}function fS(t){return J0([O4(),V4(),eS(t),aS(),oS()])}const dS={};function Yy(t){const l=this,a=t||dS,i=l.data(),o=i.micromarkExtensions||(i.micromarkExtensions=[]),u=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),f=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);o.push(fS(a)),u.push(M4()),f.push(_4(a))}function _s({content:t,className:l=""}){return c.jsx("div",{className:`office-markdown ${l}`,children:c.jsx(by,{remarkPlugins:[Yy],components:{code:hS,table:({children:a})=>c.jsx("div",{className:"overflow-x-auto my-2",children:c.jsx("table",{className:"office-table",children:a})})},children:t})})}function hS({className:t,children:l,...a}){const i=/language-(\w+)/.exec(t??"");return i||typeof l=="string"&&l.includes(`
|
|
79
|
-
`)?c.jsx(mS,{language:i==null?void 0:i[1],children:l}):c.jsx("code",{className:"bg-gray-100 text-gray-700 px-1 py-0.5 rounded text-[0.9em] font-mono",...a,children:l})}function mS({children:t,language:l}){const[a,i]=S.useState(!1),o=String(t).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(o),i(!0),setTimeout(()=>i(!1),1500)};return c.jsxs("div",{className:"office-code-block group relative my-2",children:[l&&c.jsx("div",{className:"text-[10px] text-gray-400 px-3 pt-1.5",children:l}),c.jsx("button",{onClick:u,className:"absolute top-1.5 right-2 text-[10px] text-gray-400 hover:text-gray-600 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:a?"Copied!":"Copy"}),c.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:c.jsx("code",{children:o})})]})}const W1={$skin:"skinColor",$hair:"hairColor",$shirt:"shirtColor",$pants:"pantsColor",$shoes:"shoeColor"},xS=/^(darken|lighten)\((\$\w+),\s*(\d+)\)$/;function pS(t,l){const a=parseInt(t.replace("#",""),16),i=Math.max(0,(a>>16&255)-l),o=Math.max(0,(a>>8&255)-l),u=Math.max(0,(a&255)-l);return`#${(i<<16|o<<8|u).toString(16).padStart(6,"0")}`}function yS(t,l){const a=parseInt(t.replace("#",""),16),i=Math.min(255,(a>>16&255)+l),o=Math.min(255,(a>>8&255)+l),u=Math.min(255,(a&255)+l);return`#${(i<<16|o<<8|u).toString(16).padStart(6,"0")}`}function qy(t,l){const a=W1[t];if(a&&l)return l[a];const i=xS.exec(t);if(i){const[,o,u,f]=i,m=W1[u],p=m&&l?l[m]:u,h=parseInt(f,10);return o==="darken"?pS(p,h):yS(p,h)}return t}function J1(t,l=12){return t.map(a=>({...a,x:l-a.x-a.w}))}function gS(t,l){return l==="down"?t.down:l==="up"&&t.up?t.up:l==="left"&&t.left?t.left:l==="right"&&t.right?t.right:l==="right"&&t.left?{name:t.left.name,pixels:J1(t.left.pixels)}:l==="left"&&t.right?{name:t.right.name,pixels:J1(t.right.pixels)}:t.down}function bS(t,l){return $d(t,"hair",l,1)}function $d(t,l,a,i){const o=t.layers.findIndex(f=>f.name===l),u=[...t.layers];if(o>=0)u[o]={...a,name:l};else{const f=i??u.length;u.splice(f,0,{...a,name:l})}return{...t,layers:u}}const fh=new Map,dh=new Map;function Xy(t,l){fh.set(t,l)}function zc(t,l){dh.set(t,l)}function Hd(t){return fh.get(t)}function vS(t){return dh.get(t)}function lN(){return Array.from(fh.keys())}function aN(){return Array.from(dh.keys())}function wS(t,l,a,i,o=2){t.clearRect(0,0,l.width*o,l.height*o);for(const u of l.layers)Vy(t,u.pixels,o,a,i)}function Ud(t,l,a,i,o){for(const u of l){const f=qy(u.c,o);u.a!==void 0&&u.a!==1&&(t.globalAlpha=u.a),t.fillStyle=f,t.fillRect(a+u.x,i+u.y,u.w,u.h),u.a!==void 0&&u.a!==1&&(t.globalAlpha=1)}}function kS(t,l){const a=l.scale;t.clearRect(0,0,l.canvasWidth,l.canvasHeight),Vy(t,l.pixels,a,0)}function Vy(t,l,a,i,o){for(const u of l){const f=qy(u.c,o);u.a!==void 0&&u.a!==1&&(t.globalAlpha=u.a),t.fillStyle=f,t.fillRect(u.x*a,(u.y+i)*a,u.w*a,u.h*a),u.a!==void 0&&u.a!==1&&(t.globalAlpha=1)}}const bc=new Map;function Oa(t,l,a){if("down"in a&&!("pixels"in a)){const o=a;bc.set(t,{id:t,name:l,layer:{...o.down,name:"hair"},directions:{down:{...o.down,name:"hair"},up:o.up?{...o.up,name:"hair"}:void 0,left:o.left?{...o.left,name:"hair"}:void 0,right:o.right?{...o.right,name:"hair"}:void 0}})}else{const o=a;bc.set(t,{id:t,name:l,layer:{...o,name:"hair"}})}}function SS(t){return bc.get(t)}function Gy(){return Array.from(bc.values())}Oa("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}]}});Oa("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}]}});Oa("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}]}});Oa("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}]}});Oa("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"}]}});Oa("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}]}});Oa("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}]}});Oa("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 vc=new Map;function Nl(t,l,a){if("down"in a&&!("pixels"in a)){const o=a;vc.set(t,{id:t,name:l,layer:{...o.down,name:"torso"},directions:{down:{...o.down,name:"torso"},up:o.up?{...o.up,name:"torso"}:void 0,left:o.left?{...o.left,name:"torso"}:void 0,right:o.right?{...o.right,name:"torso"}:void 0}})}else{const o=a;vc.set(t,{id:t,name:l,layer:{...o,name:"torso"}})}}function jS(t){return vc.get(t)}function Ky(){return Array.from(vc.values())}Nl("tshirt","T-Shirt",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:5,y:10,w:2,h:3,c:"darken($shirt, 10)",a:.15},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:2,y:10,w:7,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Nl("suit","Suit",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 12)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:10,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:2,y:10,w:3,h:3,c:"darken($shirt, 20)",a:.3},{x:7,y:10,w:3,h:3,c:"darken($shirt, 20)",a:.3},{x:5,y:10,w:2,h:5,c:"#E8E8E8",a:.5},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:11,w:2,h:1,c:"darken($shirt, 20)",a:.2},{x:11,y:11,w:2,h:1,c:"darken($shirt, 20)",a:.2},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:10,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:5,y:12,w:2,h:4,c:"darken($shirt, 10)",a:.15},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:2,y:10,w:3,h:3,c:"darken($shirt, 20)",a:.3},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:11,w:3,h:1,c:"darken($shirt, 20)",a:.2},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Nl("hoodie","Hoodie",{down:{name:"torso",pixels:[{x:0,y:10,w:12,h:6,c:"$shirt"},{x:1,y:10,w:10,h:1,c:"lighten($shirt, 15)",a:.25},{x:0,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:2,y:8,w:8,h:2,c:"$shirt",a:.4},{x:3,y:13,w:6,h:2,c:"darken($shirt, 15)",a:.2},{x:5,y:10,w:1,h:2,c:"#DDD",a:.3},{x:6,y:10,w:1,h:2,c:"#DDD",a:.3},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:0,y:10,w:12,h:6,c:"$shirt"},{x:0,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:2,y:7,w:8,h:3,c:"$shirt",a:.5},{x:3,y:7,w:6,h:1,c:"darken($shirt, 10)",a:.3},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:0,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:8,h:1,c:"lighten($shirt, 15)",a:.25},{x:0,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:2,y:8,w:6,h:2,c:"$shirt",a:.4},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Nl("vest","Vest",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:5,y:10,w:2,h:2,c:"$skin",a:.6},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:3,h:5,c:"$skin"},{x:-1,y:15,w:3,h:1,c:"darken($skin, 10)"}]}});Nl("tank","Tank Top",{down:{name:"torso",pixels:[{x:2,y:10,w:8,h:6,c:"$shirt"},{x:3,y:10,w:6,h:1,c:"lighten($shirt, 18)",a:.3},{x:2,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:9,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:0,y:10,w:2,h:2,c:"$skin"},{x:10,y:10,w:2,h:2,c:"$skin"},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},up:{name:"torso",pixels:[{x:2,y:10,w:8,h:6,c:"$shirt"},{x:2,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:9,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:0,y:10,w:2,h:2,c:"$skin"},{x:10,y:10,w:2,h:2,c:"$skin"},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},left:{name:"torso",pixels:[{x:2,y:10,w:7,h:6,c:"$shirt"},{x:2,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:0,y:10,w:2,h:2,c:"$skin"},{x:-1,y:11,w:3,h:5,c:"$skin"},{x:-1,y:15,w:3,h:1,c:"darken($skin, 10)"}]}});Nl("polo","Polo",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:9,w:6,h:2,c:"lighten($shirt, 25)",a:.5},{x:5,y:9,w:2,h:1,c:"$skin",a:.4},{x:5,y:10,w:2,h:3,c:"darken($shirt, 15)",a:.15},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:9,w:6,h:1,c:"lighten($shirt, 25)",a:.5},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:9,w:4,h:2,c:"lighten($shirt, 25)",a:.5},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Nl("labcoat","Lab Coat",{down:{name:"torso",pixels:[{x:4,y:10,w:4,h:5,c:"$shirt"},{x:0,y:10,w:4,h:7,c:"#F0F0F0"},{x:8,y:10,w:4,h:7,c:"#F0F0F0"},{x:1,y:10,w:10,h:1,c:"#FAFAFA"},{x:0,y:10,w:1,h:7,c:"#DDD",a:.5},{x:11,y:10,w:1,h:7,c:"#DDD",a:.5},{x:1,y:13,w:2,h:2,c:"#E0E0E0",a:.4},{x:9,y:13,w:2,h:2,c:"#E0E0E0",a:.4},{x:-1,y:11,w:2,h:5,c:"#F0F0F0"},{x:11,y:11,w:2,h:5,c:"#F0F0F0"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:0,y:10,w:12,h:7,c:"#F0F0F0"},{x:0,y:10,w:1,h:7,c:"#DDD",a:.5},{x:11,y:10,w:1,h:7,c:"#DDD",a:.5},{x:5,y:11,w:2,h:5,c:"#E8E8E8",a:.3},{x:-1,y:11,w:2,h:5,c:"#F0F0F0"},{x:11,y:11,w:2,h:5,c:"#F0F0F0"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:3,y:10,w:3,h:5,c:"$shirt"},{x:0,y:10,w:3,h:7,c:"#F0F0F0"},{x:6,y:10,w:4,h:7,c:"#F0F0F0"},{x:1,y:10,w:8,h:1,c:"#FAFAFA"},{x:0,y:10,w:1,h:7,c:"#DDD",a:.5},{x:1,y:13,w:2,h:2,c:"#E0E0E0",a:.4},{x:-1,y:11,w:3,h:5,c:"#F0F0F0"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Nl("overalls","Overalls",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:3,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:3,y:11,w:6,h:5,c:"#3D6B99"},{x:3,y:10,w:2,h:1,c:"#3D6B99"},{x:7,y:10,w:2,h:1,c:"#3D6B99"},{x:3,y:11,w:1,h:1,c:"#FFD700",a:.6},{x:8,y:11,w:1,h:1,c:"#FFD700",a:.6},{x:1,y:13,w:2,h:3,c:"#3D6B99"},{x:9,y:13,w:2,h:3,c:"#3D6B99"},{x:5,y:13,w:2,h:2,c:"#345E87",a:.4},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:3,c:"$shirt"},{x:3,y:10,w:2,h:1,c:"#3D6B99"},{x:7,y:10,w:2,h:1,c:"#3D6B99"},{x:1,y:13,w:10,h:3,c:"#3D6B99"},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:3,c:"$shirt"},{x:3,y:11,w:5,h:5,c:"#3D6B99"},{x:3,y:10,w:2,h:1,c:"#3D6B99"},{x:3,y:11,w:1,h:1,c:"#FFD700",a:.6},{x:1,y:13,w:2,h:3,c:"#3D6B99"},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Nl("turtleneck","Turtleneck",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:8,w:6,h:2,c:"$shirt"},{x:4,y:8,w:4,h:1,c:"lighten($shirt, 12)",a:.3},{x:3,y:9,w:1,h:1,c:"darken($shirt, 15)",a:.2},{x:8,y:9,w:1,h:1,c:"darken($shirt, 15)",a:.2},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:8,w:6,h:2,c:"$shirt"},{x:4,y:8,w:4,h:1,c:"lighten($shirt, 12)",a:.3},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:8,w:4,h:2,c:"$shirt"},{x:3,y:8,w:3,h:1,c:"lighten($shirt, 12)",a:.3},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Nl("robe","Robe",{down:{name:"torso",pixels:[{x:0,y:10,w:12,h:7,c:"$shirt"},{x:0,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:3,y:10,w:3,h:4,c:"lighten($shirt, 15)",a:.25},{x:6,y:10,w:3,h:4,c:"darken($shirt, 10)",a:.2},{x:1,y:14,w:10,h:1,c:"darken($shirt, 35)"},{x:2,y:14,w:8,h:1,c:"darken($shirt, 25)",a:.4},{x:-2,y:11,w:3,h:5,c:"$shirt"},{x:11,y:11,w:3,h:5,c:"$shirt"},{x:-2,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:11,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:0,y:10,w:12,h:7,c:"$shirt"},{x:0,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:1,y:14,w:10,h:1,c:"darken($shirt, 35)"},{x:-2,y:11,w:3,h:5,c:"$shirt"},{x:11,y:11,w:3,h:5,c:"$shirt"},{x:-2,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:11,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:0,y:10,w:10,h:7,c:"$shirt"},{x:0,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:1,y:14,w:8,h:1,c:"darken($shirt, 35)"},{x:-2,y:11,w:4,h:5,c:"$shirt"},{x:-2,y:15,w:4,h:1,c:"darken($shirt, 15)",a:.3},{x:-1,y:15,w:2,h:1,c:"$skin"}]}});const Es=new Map;function yt(t,l,a){if("down"in a&&!("pixels"in a)){const o=a;Es.set(t,{id:t,name:l,layer:{...o.down,name:"accessory"},directions:{down:{...o.down,name:"accessory"},up:o.up?{...o.up,name:"accessory"}:void 0,left:o.left?{...o.left,name:"accessory"}:void 0,right:o.right?{...o.right,name:"accessory"}:void 0}})}else{const o=a;Es.set(t,{id:t,name:l,layer:{...o,name:"accessory"}})}}function CS(t){return Es.get(t)}function ES(t,l){const a=Es.get(t);if(!a)return;if(a.directions)return gS(a.directions,l);if(l==="down")return a.layer;const i=a.layer.pixels.filter(u=>u.y<2);if(i.length===0)return;const o=l==="right"?1:l==="left"?-1:0;return{name:a.layer.name,pixels:o?i.map(u=>({...u,x:u.x+o})):i}}function Qy(){return Array.from(Es.values())}yt("none","None",{name:"accessory",pixels:[]});yt("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}]}});yt("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}]}});yt("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}]}});yt("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}]}});yt("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}]}});yt("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}]}});yt("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}]}});yt("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}]}});yt("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}]}});yt("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}]}});yt("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}]}});yt("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"}]}});yt("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}]}});yt("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}]}});yt("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"}]}});yt("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}]}});yt("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}]}});yt("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}]}});yt("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}]}});yt("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"}]}});yt("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}]}});yt("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}]}});yt("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}]}});yt("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}]}});yt("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"}]}});yt("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"}]}});yt("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}]}});yt("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}]}});yt("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 NS={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 Zy(t){return NS[t]??1}function Wy(t,l){return l>=Zy(t)}yt("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 fs({r:t,g:l,b:a}){return`#${(t<<16|l<<8|a).toString(16).padStart(6,"0")}`}function uc(t,l){const a=t.r-l.r,i=t.g-l.g,o=t.b-l.b;return a*a+i*i+o*o}function AS(t,l){const a=[];a.push(t[Math.floor(Math.random()*t.length)]);for(let i=1;i<l;i++){const o=t.map(m=>{let p=1/0;for(const h of a)p=Math.min(p,uc(m,h));return p}),u=o.reduce((m,p)=>m+p,0);let f=Math.random()*u;for(let m=0;m<t.length;m++)if(f-=o[m],f<=0){a.push(t[m]);break}a.length<=i&&a.push(t[Math.floor(Math.random()*t.length)])}return a}function DS(t,l,a=20){if(t.length===0)return[];const i=AS(t,l);for(let u=0;u<a;u++){const f=Array.from({length:l},()=>[]);for(const p of t){let h=1/0,g=0;for(let y=0;y<l;y++){const b=uc(p,i[y]);b<h&&(h=b,g=y)}f[g].push(p)}let m=!0;for(let p=0;p<l;p++){if(f[p].length===0)continue;const h={r:0,g:0,b:0};for(const b of f[p])h.r+=b.r,h.g+=b.g,h.b+=b.b;const g=f[p].length,y={r:Math.round(h.r/g),g:Math.round(h.g/g),b:Math.round(h.b/g)};uc(y,i[p])>1&&(m=!1),i[p]=y}if(m)break}const o=new Array(l).fill(0);for(const u of t){let f=1/0,m=0;for(let p=0;p<l;p++){const h=uc(u,i[p]);h<f&&(f=h,m=p)}o[m]++}return i.map((u,f)=>({c:u,count:o[f]})).sort((u,f)=>f.count-u.count).map(u=>u.c)}function TS(t,l=1e4){const a=document.createElement("canvas"),i=t instanceof HTMLImageElement?t.naturalWidth:t.width,o=t instanceof HTMLImageElement?t.naturalHeight:t.height;a.width=i,a.height=o;const u=a.getContext("2d");u.drawImage(t,0,0);const f=u.getImageData(0,0,i,o).data,m=i*o,p=Math.max(1,Math.floor(m/l)),h=[];for(let g=0;g<m;g+=p){const y=g*4;f[y+3]<128||h.push({r:f[y],g:f[y+1],b:f[y+2]})}return h}function P1(t){return .299*t.r+.587*t.g+.114*t.b}function e0(t){const l=Math.max(t.r,t.g,t.b),a=Math.min(t.r,t.g,t.b);return l===0?0:(l-a)/l*255}function zS(t,l=8){const a=TS(t),i=DS(a,l);if(i.length<5)return{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121"};const o=[...i].sort((y,b)=>P1(b)-P1(y)),u=[...i].sort((y,b)=>e0(b)-e0(y)),f=o[0],m=o[o.length-1],p=u[0],h=o[o.length-2],g=o[o.length-1];return{skinColor:fs(f),hairColor:fs(m),shirtColor:fs(p),pantsColor:fs(h),shoeColor:fs(g)}}const MS=[{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}],_S=[{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"}],FS=[{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"}],RS=[{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 OS(){return{width:12,height:22,layers:[{name:"lower",pixels:MS},{name:"torso",pixels:_S},{name:"head",pixels:FS},{name:"hair",pixels:RS},{name:"accessory",pixels:[]}]}}const BS=["cto","cbo","pm","engineer","designer","qa","data-analyst","default"];for(const t of BS)Xy(`mini:${t}`,OS());const LS=[{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"}],$S=[{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"}],HS=[{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:"torso",pixels:LS},{name:"head",pixels:$S},{name:"hair",pixels:HS},{name:"accessory",pixels:[]}]}}Xy("mini-seated:default",US());const IS={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"}]},qS={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"}]},XS={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"}]};zc("meeting",IS);zc("bulletin",YS);zc("decision",XS);zc("knowledge",qS);const od=16,cd=24,VS=60,GS={cbo:0,cto:8,pm:15,engineer:22,designer:5,qa:12};function Jy(t,l){if(!t)return t;let a=t;if(l!=null&&l.hairStyle){const i=SS(l.hairStyle);i&&(a=bS(a,i.layer))}if(l!=null&&l.outfitStyle){const i=jS(l.outfitStyle);i&&(a=$d(a,"torso",i.layer,1))}if(l!=null&&l.accessory&&l.accessory!=="none"){const i=CS(l.accessory);i&&(a=$d(a,"accessory",i.layer))}return a}function Mc({roleId:t,className:l,appearance:a,scale:i}){const o=S.useRef(null),u=S.useRef(0),f=S.useRef(0),m=S.useRef(a);m.current=a;const p=i??4,h=od*p,g=cd*p,y=S.useMemo(()=>{const b=Hd(`mini:${t}`)??Hd("mini:default");return Jy(b,a)},[t,a==null?void 0:a.hairStyle,a==null?void 0:a.outfitStyle,a==null?void 0:a.accessory]);return S.useEffect(()=>{const b=o.current;if(!b)return;const v=b.getContext("2d");if(!v)return;const j=GS[t]??0,k=()=>{f.current++;const C=m.current;if(!C||!y){u.current=requestAnimationFrame(k);return}const M=(f.current+j)%VS<30?1:0;v.clearRect(0,0,od,cd),v.save(),v.translate(2,1),wS(v,y,M,C,1),v.restore(),u.current=requestAnimationFrame(k)};return u.current=requestAnimationFrame(k),()=>cancelAnimationFrame(u.current)},[t,y]),c.jsx("canvas",{ref:o,width:od,height:cd,className:l,style:{imageRendering:"pixelated",display:"block",width:h,height:g}})}const KS={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"},ud={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},QS={cto:8,cbo:7,pm:6,engineer:5,designer:5,qa:4,"data-analyst":4},ZS={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},WS=500,t0=360,n0=700,JS=t=>`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`;function PS({role:t,allRoles:l,recentActivity:a,onClose:i,onFireRole:o,terminalWidth:u=0,activeJobId:f,activeTask:m,isWorking:p,jobStartedAt:h,onStopJob:g,sessions:y,streamingSessionId:b,onCreateSessionSilent:v,onSendMessage:j,onFocusTerminal:k,onCustomize:C,onUpdateRole:E,appearance:M,relationships:H}){var ye,Fe;const[B,U]=S.useState(WS),[D,Y]=S.useState(!1),V=S.useRef(0),ne=S.useRef(0),[T,L]=S.useState(!1),[$,ee]=S.useState(!1),[ae,X]=S.useState(!1),[I,Q]=S.useState(!1),[ie,Se]=S.useState("talk"),[z,_]=S.useState(!1),[P,A]=S.useState(""),[pe,Ee]=S.useState(!1),Ne=S.useRef(null),{events:Oe,status:Be}=B0(f??null),[oe,K]=S.useState(0);S.useEffect(()=>{if(!p||!h){K(0);return}const xe=new Date(h).getTime(),ke=()=>K(Math.floor((Date.now()-xe)/1e3));ke();const bt=setInterval(ke,1e3);return()=>clearInterval(bt)},[p,h]);const ue=u>0,je=ue?u:0,te=ue?Math.max(t0,window.innerWidth-u-100):n0,ve=Math.min(B,te),Ce=S.useCallback(xe=>{xe.preventDefault(),V.current=xe.clientX,ne.current=ve,Y(!0);const ke=At=>{const Ze=V.current-At.clientX,he=Math.min(n0,Math.max(t0,ne.current+Ze));U(he)},bt=()=>{Y(!1),document.removeEventListener("mousemove",ke),document.removeEventListener("mouseup",bt)};document.addEventListener("mousemove",ke),document.addEventListener("mouseup",bt)},[ve]),Ae=S.useRef(null),ze=t?y.find(xe=>xe.roleId===t.id):null,qe=xe=>{if(!t)return;const ke=p?"talk":ie;ze?(j(ze.id,xe,ke),k(t.id)):(Ae.current={content:xe,mode:ke},v(t.id))};S.useEffect(()=>{if(ze&&Ae.current){const{content:xe,mode:ke}=Ae.current;Ae.current=null,j(ze.id,xe,ke),t&&k(t.id)}},[ze==null?void 0:ze.id]);const kt=(()=>{if(!Oe.length)return null;const xe=[];let ke=0,bt=0,At=0;for(const Ze of Oe)if(Ze.type==="thinking")ke++;else if(Ze.type==="text")bt++;else if(Ze.type==="tool:start"){const he=String(Ze.data.name??"");xe.includes(he)||xe.push(he)}else Ze.type==="dispatch:start"&&At++;return{tools:xe,thinkCount:ke,textCount:bt,dispatchCount:At,total:Oe.length}})(),Rt=m||(()=>{if(!ze)return null;const xe=ze.messages;for(let ke=xe.length-1;ke>=0;ke--)if(xe[ke].from==="ceo")return xe[ke].content;return null})(),ft=(()=>{if(!ze)return null;const xe=ze.messages;for(let ke=xe.length-1;ke>=0;ke--)if(xe[ke].from==="role"&&xe[ke].content)return xe[ke].content;return null})();if(!t)return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:je},onClick:i}),c.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px]",style:{right:je,width:ve,background:"var(--terminal-bg)",borderLeftColor:"var(--pixel-border)"},children:c.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading role..."})})]});const Lt=ud[t.id]??"#666",un=KS[t.id]??"👤",gt=l.filter(xe=>xe.reportsTo===t.id),qt=ze&&b===ze.id,re=t.name||ZS[t.id]||t.id;return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:je},onClick:i}),c.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${D?"resizing":""}`,style:{borderLeftColor:Lt,right:je,width:ve,background:"var(--terminal-bg)"},children:[c.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${D?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:Ce}),c.jsxs("div",{className:"relative shrink-0 overflow-hidden",style:{background:`linear-gradient(135deg, ${Lt}ee, ${Lt}99)`},children:[c.jsx("div",{className:"absolute inset-0 opacity-[0.06]",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 8px, white 8px, white 9px)"}}),c.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-1.5 z-10",children:[C&&c.jsx("button",{onClick:()=>C(t.id),className:"w-7 h-7 rounded-full bg-black/20 text-white flex items-center justify-center text-sm hover:bg-black/30 cursor-pointer backdrop-blur-sm",title:"Customize",children:"🎨"}),c.jsx("button",{onClick:i,className:"w-7 h-7 rounded-full bg-black/20 text-white flex items-center justify-center text-lg hover:bg-black/30 cursor-pointer backdrop-blur-sm",children:"×"})]}),c.jsxs("div",{className:"relative flex items-end gap-4 px-4 pt-4 pb-3",children:[c.jsx("div",{className:"shrink-0 relative",style:{marginBottom:-2},children:c.jsx("div",{className:"rounded-lg p-1",style:{background:"rgba(0,0,0,0.2)"},children:c.jsx(Mc,{roleId:t.id,appearance:M,scale:8})})}),c.jsxs("div",{className:"flex-1 min-w-0 text-white pb-1",children:[c.jsxs("div",{className:"text-lg font-bold flex items-center gap-2",style:{fontFamily:"var(--pixel-font)"},children:[un," ",t.id.toUpperCase(),p&&c.jsx("span",{className:"text-[9px] font-semibold px-2 py-0.5 rounded-full animate-pulse",style:{background:"rgba(251,191,36,0.25)",color:"#fde68a"},children:"WORKING"})]}),z?c.jsxs("form",{className:"flex items-center gap-1.5 mt-0.5",onSubmit:async xe=>{xe.preventDefault();const ke=P.trim();if(!ke||ke===re||!E){_(!1);return}Ee(!0);try{await E(t.id,{name:ke})}catch{}Ee(!1),_(!1)},children:[c.jsx("input",{ref:Ne,value:P,onChange:xe=>A(xe.target.value),onKeyDown:xe=>{xe.key==="Escape"&&_(!1)},disabled:pe,autoFocus:!0,className:"bg-white/20 text-white text-xs rounded px-1.5 py-0.5 outline-none focus:bg-white/30 w-full",style:{fontFamily:"inherit"}}),c.jsx("button",{type:"submit",disabled:pe,className:"text-white/80 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✓"}),c.jsx("button",{type:"button",onClick:()=>_(!1),className:"text-white/60 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✕"})]}):c.jsxs("div",{className:"text-xs opacity-75 mt-0.5 group/name flex items-center gap-1 cursor-pointer hover:opacity-100 transition-opacity",onClick:()=>{E&&(A(re),_(!0))},title:E?"Click to edit name":void 0,children:[re,E&&c.jsx("span",{className:"opacity-0 group-hover/name:opacity-60 text-[10px]",children:"✎"})]})]})]}),c.jsxs("div",{className:"relative flex items-center gap-3 px-4 py-2 text-[10px] font-bold text-white/80",style:{background:"rgba(0,0,0,0.2)",fontFamily:"var(--pixel-font)"},children:[c.jsxs("span",{children:["Lv.",QS[t.id]??1]}),c.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),c.jsxs("span",{className:"flex items-center gap-1.5",children:[c.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:p?"var(--idle-amber)":"var(--active-green)"}}),p?"Working":"Idle"]}),c.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),c.jsx("span",{children:t.level}),t.reportsTo&&c.jsxs(c.Fragment,{children:[c.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),c.jsxs("span",{className:"opacity-60",children:["→"," ",t.reportsTo]})]})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:[p&&c.jsxs("div",{className:"px-4 py-3 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"var(--idle-amber)"}}),c.jsxs("span",{className:"text-xs font-semibold",style:{color:"var(--idle-amber)"},children:["Working",oe>0?` · ${JS(oe)}`:""]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{onClick:()=>k(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"}),f&&g&&c.jsx("button",{onClick:()=>g(f),className:"text-[10px] px-2 py-0.5 rounded cursor-pointer font-semibold transition-colors",style:{background:"rgba(239,68,68,0.15)",color:"#ef4444"},children:"Stop"})]})]}),Rt&&c.jsx("div",{className:"text-xs truncate",style:{color:"var(--terminal-text-secondary)"},children:Rt})]}),p&&f&&kt&&c.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[c.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Activity"}),c.jsx("button",{onClick:()=>k(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"View details ↗"})]}),c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[kt.thinkCount>0&&c.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(168,85,247,0.15)",color:"#c084fc"},children:[c.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:"#a855f7"}}),"thinking ×",kt.thinkCount]}),kt.tools.map(xe=>c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa"},children:xe},xe)),kt.dispatchCount>0&&c.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(249,115,22,0.15)",color:"#fb923c"},children:["dispatch ×",kt.dispatchCount]}),kt.textCount>0&&c.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(34,197,94,0.15)",color:"#4ade80"},children:["output ×",kt.textCount]}),(Be==="streaming"||Be==="connecting")&&c.jsx("span",{className:"inline-block w-1.5 h-3 animate-pulse rounded-sm",style:{background:"var(--active-green)"}})]}),c.jsxs("div",{className:"text-[10px] mt-1",style:{color:"var(--terminal-text-muted)"},children:[kt.total," events"]})]}),p&&ft&&c.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[c.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Last Message"}),c.jsx("button",{onClick:()=>k(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"})]}),c.jsxs("div",{className:"rounded-lg p-2.5 text-xs leading-relaxed line-clamp-3 overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:[ft.slice(0,200),ft.length>200&&"..."]})]}),p&&c.jsx("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:c.jsx(l0,{onSend:qe,disabled:!!qt,placeholder:"Ask something...",color:Lt})}),!p&&c.jsxs("div",{className:"px-4 pt-4 pb-2",children:[c.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-secondary)"},children:"Latest"}),c.jsx(ej,{icon:un,roleId:t.id,roleName:re,color:Lt,text:a})]}),!p&&c.jsx("div",{className:"px-4 py-3",style:{borderBottom:"1px solid var(--terminal-border)"},children:c.jsxs("div",{className:"rounded-xl overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[ft&&c.jsxs("div",{className:"px-3 pt-2.5 pb-2 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--terminal-border)"},onClick:()=>k(t.id),children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Last response"}),c.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"View ↗"})]}),c.jsxs("div",{className:"text-xs leading-relaxed line-clamp-2 overflow-hidden",style:{color:"var(--terminal-text-secondary)"},children:[ft.slice(0,150),ft.length>150&&"..."]})]}),c.jsx("div",{className:"p-2",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("div",{className:"flex rounded-lg overflow-hidden shrink-0",style:{border:"1px solid var(--pixel-border)"},children:[c.jsx("button",{onClick:()=>Se("talk"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:ie==="talk"?"var(--accent)":"transparent",color:ie==="talk"?"#fff":"var(--terminal-text-secondary)"},children:"Talk"}),c.jsx("button",{onClick:()=>Se("do"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:ie==="do"?"var(--idle-amber)":"transparent",color:ie==="do"?"#fff":"var(--terminal-text-secondary)"},children:"Do"})]}),c.jsx(l0,{onSend:qe,disabled:!!qt,placeholder:ie==="talk"?"Ask something...":"Give a directive...",color:Lt})]})})]})}),c.jsxs("div",{className:"px-4 py-2 space-y-1",children:[c.jsxs(tc,{title:`Profile${t.persona?"":" (empty)"}`,open:T,onToggle:()=>L(xe=>!xe),children:[t.persona&&c.jsx("div",{className:"text-xs leading-relaxed rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:t.persona}),c.jsxs("div",{className:"space-y-0 mt-2",children:[c.jsx(fd,{label:"Level",value:t.level}),c.jsx(fd,{label:"Reports to",value:t.reportsTo}),c.jsx(fd,{label:"Status",value:t.status})]}),gt.length>0&&c.jsxs("div",{className:"mt-3",children:[c.jsx("div",{className:"text-[11px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Direct Reports"}),c.jsx("div",{className:"space-y-1",children:gt.map(xe=>c.jsxs("div",{className:"flex items-center gap-2 p-1.5 rounded-lg",style:{background:"var(--hud-bg-alt)"},children:[c.jsx("div",{className:"w-6 h-6 rounded flex items-center justify-center text-white text-[10px] font-bold",style:{background:ud[xe.id]??"#666"},children:xe.id.slice(0,2).toUpperCase()}),c.jsx("div",{className:"text-xs",style:{color:"var(--terminal-text)"},children:xe.name})]},xe.id))})]})]}),t.authority&&c.jsxs(tc,{title:"Authority",open:$,onToggle:()=>ee(xe=>!xe),children:[((ye=t.authority.autonomous)==null?void 0:ye.length)>0&&c.jsxs("div",{className:"mb-2",children:[c.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--active-green)"},children:"Autonomous"}),t.authority.autonomous.map((xe,ke)=>c.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",xe]},ke))]}),((Fe=t.authority.needsApproval)==null?void 0:Fe.length)>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--idle-amber)"},children:"Needs Approval"}),t.authority.needsApproval.map((xe,ke)=>c.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",xe]},ke))]})]}),t&&H&&(()=>{const xe=H.filter(ke=>ke.roleA===t.id||ke.roleB===t.id).filter(ke=>ke.familiarity>0).sort((ke,bt)=>bt.familiarity-ke.familiarity);return xe.length===0?null:c.jsx(tc,{title:`Relationships (${xe.length})`,open:ae,onToggle:()=>X(ke=>!ke),children:c.jsx("div",{className:"space-y-1.5",children:xe.map((ke,bt)=>{const At=ke.roleA===t.id?ke.roleB:ke.roleA,Ze=l.find(dt=>dt.id===At),he=ke.familiarity>=80?"Best Partner":ke.familiarity>=50?"Friend":ke.familiarity>=20?"Colleague":"Acquaintance",ut=ke.familiarity>=80?"#4CAF50":ke.familiarity>=50?"#2196F3":ke.familiarity>=20?"#FF9800":"#9E9E9E";return c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs w-20 truncate",style:{color:ud[At]??"var(--terminal-text-secondary)"},children:(Ze==null?void 0:Ze.name)??At}),c.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-white/10",children:c.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ke.familiarity}%`,background:ut}})}),c.jsx("span",{className:"text-[10px] w-16 text-right",style:{color:"var(--terminal-text-muted)"},children:he})]},bt)})})})})(),t.journal&&c.jsx(tc,{title:`Journal (${(t.journal.match(/### /g)??[]).length})`,open:I,onToggle:()=>Q(xe=>!xe),children:c.jsxs("div",{className:"text-xs leading-relaxed rounded-lg p-3 max-h-[300px] overflow-y-auto",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:[c.jsx(_s,{content:t.journal.slice(0,3e3)}),t.journal.length>3e3&&c.jsx("div",{className:"italic mt-2",style:{color:"var(--terminal-text-muted)"},children:"... (truncated)"})]})})]}),o&&c.jsx("div",{className:"px-4 pb-4 mt-auto shrink-0",children:c.jsx("button",{onClick:()=>{o(t.id,t.name),i()},className:"w-full p-2 text-center text-xs font-medium border-2 border-dashed rounded-lg cursor-pointer transition-colors",style:{borderColor:"rgba(239,68,68,0.3)",color:"rgba(239,68,68,0.5)"},children:"Fire Role"})})]})]})]})}function ej({icon:t,roleId:l,roleName:a,color:i,text:o}){const u=!!o;return c.jsx("div",{className:"relative",children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsxs("div",{className:"shrink-0",children:[c.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center text-xl shadow-sm",style:{background:`${i}18`,border:`2px solid ${i}44`},children:t}),c.jsx("div",{className:"text-[9px] font-bold text-center mt-0.5 uppercase tracking-wide",style:{color:i},children:l})]}),c.jsx("div",{className:"flex-1 min-w-0",children:c.jsxs("div",{className:"relative",children:[c.jsx("div",{className:"absolute top-3 -left-2 w-0 h-0",style:{borderTop:"6px solid transparent",borderBottom:"6px solid transparent",borderRight:`8px solid ${i}12`}}),c.jsxs("div",{className:"rounded-xl rounded-tl-sm p-4 border",style:{background:`${i}08`,borderColor:`${i}22`},children:[c.jsx("div",{className:"text-[10px] font-semibold mb-1.5 uppercase tracking-wider",style:{color:i},children:a}),u?c.jsx("div",{className:"text-sm leading-relaxed",style:{color:"var(--terminal-text)"},children:c.jsx(_s,{content:o})}):c.jsx("div",{className:"text-sm italic",style:{color:"var(--terminal-text-muted)"},children:"No recent activity."})]})]})})]})})}function tc({title:t,open:l,onToggle:a,children:i}){return c.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:[c.jsxs("button",{onClick:a,className:"w-full px-3 py-2.5 flex items-center justify-between cursor-pointer transition-colors group",style:{background:"var(--hud-bg-alt)"},children:[c.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:t}),c.jsx("span",{className:"text-[10px] transition-transform",style:{color:"var(--terminal-text-muted)",transform:l?"rotate(0deg)":"rotate(-90deg)"},children:"▼"})]}),l&&c.jsx("div",{className:"px-3 pb-3 pt-2",style:{borderTop:"1px solid var(--terminal-border)"},children:i})]})}function l0({onSend:t,disabled:l,placeholder:a,color:i}){const[o,u]=S.useState(""),f=()=>{const m=o.trim();!m||l||(t(m),u(""))};return c.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[c.jsx("input",{type:"text",value:o,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),f())},placeholder:l?"Waiting...":a,disabled:l,className:"flex-1 rounded-lg px-2.5 py-1.5 text-xs focus:outline-none disabled:opacity-40",style:{background:"var(--hud-bg)",border:"1px solid var(--pixel-border)",color:"var(--terminal-text)"}}),c.jsx("button",{onClick:f,disabled:l||!o.trim(),className:"w-7 h-7 rounded-lg flex items-center justify-center shrink-0 cursor-pointer text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",style:{background:l||!o.trim()?"#666":i},children:c.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("path",{d:"M22 2L11 13"}),c.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})}function fd({label:t,value:l}){return c.jsxs("div",{className:"flex justify-between py-1.5 text-xs",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:t}),c.jsx("span",{className:"font-semibold",style:{color:"var(--terminal-text)"},children:l})]})}function tj(t,l){var a,i=1;t==null&&(t=0),l==null&&(l=0);function o(){var u,f=a.length,m,p=0,h=0;for(u=0;u<f;++u)m=a[u],p+=m.x,h+=m.y;for(p=(p/f-t)*i,h=(h/f-l)*i,u=0;u<f;++u)m=a[u],m.x-=p,m.y-=h}return o.initialize=function(u){a=u},o.x=function(u){return arguments.length?(t=+u,o):t},o.y=function(u){return arguments.length?(l=+u,o):l},o.strength=function(u){return arguments.length?(i=+u,o):i},o}function nj(t){const l=+this._x.call(null,t),a=+this._y.call(null,t);return Py(this.cover(l,a),l,a,t)}function Py(t,l,a,i){if(isNaN(l)||isNaN(a))return t;var o,u=t._root,f={data:i},m=t._x0,p=t._y0,h=t._x1,g=t._y1,y,b,v,j,k,C,E,M;if(!u)return t._root=f,t;for(;u.length;)if((k=l>=(y=(m+h)/2))?m=y:h=y,(C=a>=(b=(p+g)/2))?p=b:g=b,o=u,!(u=u[E=C<<1|k]))return o[E]=f,t;if(v=+t._x.call(null,u.data),j=+t._y.call(null,u.data),l===v&&a===j)return f.next=u,o?o[E]=f:t._root=f,t;do o=o?o[E]=new Array(4):t._root=new Array(4),(k=l>=(y=(m+h)/2))?m=y:h=y,(C=a>=(b=(p+g)/2))?p=b:g=b;while((E=C<<1|k)===(M=(j>=b)<<1|v>=y));return o[M]=u,o[E]=f,t}function lj(t){var l,a,i=t.length,o,u,f=new Array(i),m=new Array(i),p=1/0,h=1/0,g=-1/0,y=-1/0;for(a=0;a<i;++a)isNaN(o=+this._x.call(null,l=t[a]))||isNaN(u=+this._y.call(null,l))||(f[a]=o,m[a]=u,o<p&&(p=o),o>g&&(g=o),u<h&&(h=u),u>y&&(y=u));if(p>g||h>y)return this;for(this.cover(p,h).cover(g,y),a=0;a<i;++a)Py(this,f[a],m[a],t[a]);return this}function aj(t,l){if(isNaN(t=+t)||isNaN(l=+l))return this;var a=this._x0,i=this._y0,o=this._x1,u=this._y1;if(isNaN(a))o=(a=Math.floor(t))+1,u=(i=Math.floor(l))+1;else{for(var f=o-a||1,m=this._root,p,h;a>t||t>=o||i>l||l>=u;)switch(h=(l<i)<<1|t<a,p=new Array(4),p[h]=m,m=p,f*=2,h){case 0:o=a+f,u=i+f;break;case 1:a=o-f,u=i+f;break;case 2:o=a+f,i=u-f;break;case 3:a=o-f,i=u-f;break}this._root&&this._root.length&&(this._root=m)}return this._x0=a,this._y0=i,this._x1=o,this._y1=u,this}function rj(){var t=[];return this.visit(function(l){if(!l.length)do t.push(l.data);while(l=l.next)}),t}function ij(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function bn(t,l,a,i,o){this.node=t,this.x0=l,this.y0=a,this.x1=i,this.y1=o}function sj(t,l,a){var i,o=this._x0,u=this._y0,f,m,p,h,g=this._x1,y=this._y1,b=[],v=this._root,j,k;for(v&&b.push(new bn(v,o,u,g,y)),a==null?a=1/0:(o=t-a,u=l-a,g=t+a,y=l+a,a*=a);j=b.pop();)if(!(!(v=j.node)||(f=j.x0)>g||(m=j.y0)>y||(p=j.x1)<o||(h=j.y1)<u))if(v.length){var C=(f+p)/2,E=(m+h)/2;b.push(new bn(v[3],C,E,p,h),new bn(v[2],f,E,C,h),new bn(v[1],C,m,p,E),new bn(v[0],f,m,C,E)),(k=(l>=E)<<1|t>=C)&&(j=b[b.length-1],b[b.length-1]=b[b.length-1-k],b[b.length-1-k]=j)}else{var M=t-+this._x.call(null,v.data),H=l-+this._y.call(null,v.data),B=M*M+H*H;if(B<a){var U=Math.sqrt(a=B);o=t-U,u=l-U,g=t+U,y=l+U,i=v.data}}return i}function oj(t){if(isNaN(g=+this._x.call(null,t))||isNaN(y=+this._y.call(null,t)))return this;var l,a=this._root,i,o,u,f=this._x0,m=this._y0,p=this._x1,h=this._y1,g,y,b,v,j,k,C,E;if(!a)return this;if(a.length)for(;;){if((j=g>=(b=(f+p)/2))?f=b:p=b,(k=y>=(v=(m+h)/2))?m=v:h=v,l=a,!(a=a[C=k<<1|j]))return this;if(!a.length)break;(l[C+1&3]||l[C+2&3]||l[C+3&3])&&(i=l,E=C)}for(;a.data!==t;)if(o=a,!(a=a.next))return this;return(u=a.next)&&delete a.next,o?(u?o.next=u:delete o.next,this):l?(u?l[C]=u:delete l[C],(a=l[0]||l[1]||l[2]||l[3])&&a===(l[3]||l[2]||l[1]||l[0])&&!a.length&&(i?i[E]=a:this._root=a),this):(this._root=u,this)}function cj(t){for(var l=0,a=t.length;l<a;++l)this.remove(t[l]);return this}function uj(){return this._root}function fj(){var t=0;return this.visit(function(l){if(!l.length)do++t;while(l=l.next)}),t}function dj(t){var l=[],a,i=this._root,o,u,f,m,p;for(i&&l.push(new bn(i,this._x0,this._y0,this._x1,this._y1));a=l.pop();)if(!t(i=a.node,u=a.x0,f=a.y0,m=a.x1,p=a.y1)&&i.length){var h=(u+m)/2,g=(f+p)/2;(o=i[3])&&l.push(new bn(o,h,g,m,p)),(o=i[2])&&l.push(new bn(o,u,g,h,p)),(o=i[1])&&l.push(new bn(o,h,f,m,g)),(o=i[0])&&l.push(new bn(o,u,f,h,g))}return this}function hj(t){var l=[],a=[],i;for(this._root&&l.push(new bn(this._root,this._x0,this._y0,this._x1,this._y1));i=l.pop();){var o=i.node;if(o.length){var u,f=i.x0,m=i.y0,p=i.x1,h=i.y1,g=(f+p)/2,y=(m+h)/2;(u=o[0])&&l.push(new bn(u,f,m,g,y)),(u=o[1])&&l.push(new bn(u,g,m,p,y)),(u=o[2])&&l.push(new bn(u,f,y,g,h)),(u=o[3])&&l.push(new bn(u,g,y,p,h))}a.push(i)}for(;i=a.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function mj(t){return t[0]}function xj(t){return arguments.length?(this._x=t,this):this._x}function pj(t){return t[1]}function yj(t){return arguments.length?(this._y=t,this):this._y}function hh(t,l,a){var i=new mh(l??mj,a??pj,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function mh(t,l,a,i,o,u){this._x=t,this._y=l,this._x0=a,this._y0=i,this._x1=o,this._y1=u,this._root=void 0}function a0(t){for(var l={data:t.data},a=l;t=t.next;)a=a.next={data:t.data};return l}var vn=hh.prototype=mh.prototype;vn.copy=function(){var t=new mh(this._x,this._y,this._x0,this._y0,this._x1,this._y1),l=this._root,a,i;if(!l)return t;if(!l.length)return t._root=a0(l),t;for(a=[{source:l,target:t._root=new Array(4)}];l=a.pop();)for(var o=0;o<4;++o)(i=l.source[o])&&(i.length?a.push({source:i,target:l.target[o]=new Array(4)}):l.target[o]=a0(i));return t};vn.add=nj;vn.addAll=lj;vn.cover=aj;vn.data=rj;vn.extent=ij;vn.find=sj;vn.remove=oj;vn.removeAll=cj;vn.root=uj;vn.size=fj;vn.visit=dj;vn.visitAfter=hj;vn.x=xj;vn.y=yj;function cr(t){return function(){return t}}function _a(t){return(t()-.5)*1e-6}function gj(t){return t.x+t.vx}function bj(t){return t.y+t.vy}function vj(t){var l,a,i,o=1,u=1;typeof t!="function"&&(t=cr(t==null?1:+t));function f(){for(var h,g=l.length,y,b,v,j,k,C,E=0;E<u;++E)for(y=hh(l,gj,bj).visitAfter(m),h=0;h<g;++h)b=l[h],k=a[b.index],C=k*k,v=b.x+b.vx,j=b.y+b.vy,y.visit(M);function M(H,B,U,D,Y){var V=H.data,ne=H.r,T=k+ne;if(V){if(V.index>b.index){var L=v-V.x-V.vx,$=j-V.y-V.vy,ee=L*L+$*$;ee<T*T&&(L===0&&(L=_a(i),ee+=L*L),$===0&&($=_a(i),ee+=$*$),ee=(T-(ee=Math.sqrt(ee)))/ee*o,b.vx+=(L*=ee)*(T=(ne*=ne)/(C+ne)),b.vy+=($*=ee)*T,V.vx-=L*(T=1-T),V.vy-=$*T)}return}return B>v+T||D<v-T||U>j+T||Y<j-T}}function m(h){if(h.data)return h.r=a[h.data.index];for(var g=h.r=0;g<4;++g)h[g]&&h[g].r>h.r&&(h.r=h[g].r)}function p(){if(l){var h,g=l.length,y;for(a=new Array(g),h=0;h<g;++h)y=l[h],a[y.index]=+t(y,h,l)}}return f.initialize=function(h,g){l=h,i=g,p()},f.iterations=function(h){return arguments.length?(u=+h,f):u},f.strength=function(h){return arguments.length?(o=+h,f):o},f.radius=function(h){return arguments.length?(t=typeof h=="function"?h:cr(+h),p(),f):t},f}function wj(t){return t.index}function r0(t,l){var a=t.get(l);if(!a)throw new Error("node not found: "+l);return a}function kj(t){var l=wj,a=y,i,o=cr(30),u,f,m,p,h,g=1;t==null&&(t=[]);function y(C){return 1/Math.min(m[C.source.index],m[C.target.index])}function b(C){for(var E=0,M=t.length;E<g;++E)for(var H=0,B,U,D,Y,V,ne,T;H<M;++H)B=t[H],U=B.source,D=B.target,Y=D.x+D.vx-U.x-U.vx||_a(h),V=D.y+D.vy-U.y-U.vy||_a(h),ne=Math.sqrt(Y*Y+V*V),ne=(ne-u[H])/ne*C*i[H],Y*=ne,V*=ne,D.vx-=Y*(T=p[H]),D.vy-=V*T,U.vx+=Y*(T=1-T),U.vy+=V*T}function v(){if(f){var C,E=f.length,M=t.length,H=new Map(f.map((U,D)=>[l(U,D,f),U])),B;for(C=0,m=new Array(E);C<M;++C)B=t[C],B.index=C,typeof B.source!="object"&&(B.source=r0(H,B.source)),typeof B.target!="object"&&(B.target=r0(H,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,p=new Array(M);C<M;++C)B=t[C],p[C]=m[B.source.index]/(m[B.source.index]+m[B.target.index]);i=new Array(M),j(),u=new Array(M),k()}}function j(){if(f)for(var C=0,E=t.length;C<E;++C)i[C]=+a(t[C],C,t)}function k(){if(f)for(var C=0,E=t.length;C<E;++C)u[C]=+o(t[C],C,t)}return b.initialize=function(C,E){f=C,h=E,v()},b.links=function(C){return arguments.length?(t=C,v(),b):t},b.id=function(C){return arguments.length?(l=C,b):l},b.iterations=function(C){return arguments.length?(g=+C,b):g},b.strength=function(C){return arguments.length?(a=typeof C=="function"?C:cr(+C),j(),b):a},b.distance=function(C){return arguments.length?(o=typeof C=="function"?C:cr(+C),k(),b):o},b}var Sj={value:()=>{}};function eg(){for(var t=0,l=arguments.length,a={},i;t<l;++t){if(!(i=arguments[t]+"")||i in a||/[\s.]/.test(i))throw new Error("illegal type: "+i);a[i]=[]}return new fc(a)}function fc(t){this._=t}function jj(t,l){return t.trim().split(/^|\s+/).map(function(a){var i="",o=a.indexOf(".");if(o>=0&&(i=a.slice(o+1),a=a.slice(0,o)),a&&!l.hasOwnProperty(a))throw new Error("unknown type: "+a);return{type:a,name:i}})}fc.prototype=eg.prototype={constructor:fc,on:function(t,l){var a=this._,i=jj(t+"",a),o,u=-1,f=i.length;if(arguments.length<2){for(;++u<f;)if((o=(t=i[u]).type)&&(o=Cj(a[o],t.name)))return o;return}if(l!=null&&typeof l!="function")throw new Error("invalid callback: "+l);for(;++u<f;)if(o=(t=i[u]).type)a[o]=i0(a[o],t.name,l);else if(l==null)for(o in a)a[o]=i0(a[o],t.name,null);return this},copy:function(){var t={},l=this._;for(var a in l)t[a]=l[a].slice();return new fc(t)},call:function(t,l){if((o=arguments.length-2)>0)for(var a=new Array(o),i=0,o,u;i<o;++i)a[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(u=this._[t],i=0,o=u.length;i<o;++i)u[i].value.apply(l,a)},apply:function(t,l,a){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],o=0,u=i.length;o<u;++o)i[o].value.apply(l,a)}};function Cj(t,l){for(var a=0,i=t.length,o;a<i;++a)if((o=t[a]).name===l)return o.value}function i0(t,l,a){for(var i=0,o=t.length;i<o;++i)if(t[i].name===l){t[i]=Sj,t=t.slice(0,i).concat(t.slice(i+1));break}return a!=null&&t.push({name:l,value:a}),t}var ti=0,ps=0,ds=0,tg=1e3,wc,ys,kc=0,fr=0,_c=0,Ns=typeof performance=="object"&&performance.now?performance:Date,ng=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function lg(){return fr||(ng(Ej),fr=Ns.now()+_c)}function Ej(){fr=0}function Id(){this._call=this._time=this._next=null}Id.prototype=ag.prototype={constructor:Id,restart:function(t,l,a){if(typeof t!="function")throw new TypeError("callback is not a function");a=(a==null?lg():+a)+(l==null?0:+l),!this._next&&ys!==this&&(ys?ys._next=this:wc=this,ys=this),this._call=t,this._time=a,Yd()},stop:function(){this._call&&(this._call=null,this._time=1/0,Yd())}};function ag(t,l,a){var i=new Id;return i.restart(t,l,a),i}function Nj(){lg(),++ti;for(var t=wc,l;t;)(l=fr-t._time)>=0&&t._call.call(void 0,l),t=t._next;--ti}function s0(){fr=(kc=Ns.now())+_c,ti=ps=0;try{Nj()}finally{ti=0,Dj(),fr=0}}function Aj(){var t=Ns.now(),l=t-kc;l>tg&&(_c-=l,kc=t)}function Dj(){for(var t,l=wc,a,i=1/0;l;)l._call?(i>l._time&&(i=l._time),t=l,l=l._next):(a=l._next,l._next=null,l=t?t._next=a:wc=a);ys=t,Yd(i)}function Yd(t){if(!ti){ps&&(ps=clearTimeout(ps));var l=t-fr;l>24?(t<1/0&&(ps=setTimeout(s0,t-Ns.now()-_c)),ds&&(ds=clearInterval(ds))):(ds||(kc=Ns.now(),ds=setInterval(Aj,tg)),ti=1,ng(s0))}}const Tj=1664525,zj=1013904223,o0=4294967296;function Mj(){let t=1;return()=>(t=(Tj*t+zj)%o0)/o0}function _j(t){return t.x}function Fj(t){return t.y}var Rj=10,Oj=Math.PI*(3-Math.sqrt(5));function Bj(t){var l,a=1,i=.001,o=1-Math.pow(i,1/300),u=0,f=.6,m=new Map,p=ag(y),h=eg("tick","end"),g=Mj();t==null&&(t=[]);function y(){b(),h.call("tick",l),a<i&&(p.stop(),h.call("end",l))}function b(k){var C,E=t.length,M;k===void 0&&(k=1);for(var H=0;H<k;++H)for(a+=(u-a)*o,m.forEach(function(B){B(a)}),C=0;C<E;++C)M=t[C],M.fx==null?M.x+=M.vx*=f:(M.x=M.fx,M.vx=0),M.fy==null?M.y+=M.vy*=f:(M.y=M.fy,M.vy=0);return l}function v(){for(var k=0,C=t.length,E;k<C;++k){if(E=t[k],E.index=k,E.fx!=null&&(E.x=E.fx),E.fy!=null&&(E.y=E.fy),isNaN(E.x)||isNaN(E.y)){var M=Rj*Math.sqrt(.5+k),H=k*Oj;E.x=M*Math.cos(H),E.y=M*Math.sin(H)}(isNaN(E.vx)||isNaN(E.vy))&&(E.vx=E.vy=0)}}function j(k){return k.initialize&&k.initialize(t,g),k}return v(),l={tick:b,restart:function(){return p.restart(y),l},stop:function(){return p.stop(),l},nodes:function(k){return arguments.length?(t=k,v(),m.forEach(j),l):t},alpha:function(k){return arguments.length?(a=+k,l):a},alphaMin:function(k){return arguments.length?(i=+k,l):i},alphaDecay:function(k){return arguments.length?(o=+k,l):+o},alphaTarget:function(k){return arguments.length?(u=+k,l):u},velocityDecay:function(k){return arguments.length?(f=1-k,l):1-f},randomSource:function(k){return arguments.length?(g=k,m.forEach(j),l):g},force:function(k,C){return arguments.length>1?(C==null?m.delete(k):m.set(k,j(C)),l):m.get(k)},find:function(k,C,E){var M=0,H=t.length,B,U,D,Y,V;for(E==null?E=1/0:E*=E,M=0;M<H;++M)Y=t[M],B=k-Y.x,U=C-Y.y,D=B*B+U*U,D<E&&(V=Y,E=D);return V},on:function(k,C){return arguments.length>1?(h.on(k,C),l):h.on(k)}}}function Lj(){var t,l,a,i,o=cr(-30),u,f=1,m=1/0,p=.81;function h(v){var j,k=t.length,C=hh(t,_j,Fj).visitAfter(y);for(i=v,j=0;j<k;++j)l=t[j],C.visit(b)}function g(){if(t){var v,j=t.length,k;for(u=new Array(j),v=0;v<j;++v)k=t[v],u[k.index]=+o(k,v,t)}}function y(v){var j=0,k,C,E=0,M,H,B;if(v.length){for(M=H=B=0;B<4;++B)(k=v[B])&&(C=Math.abs(k.value))&&(j+=k.value,E+=C,M+=C*k.x,H+=C*k.y);v.x=M/E,v.y=H/E}else{k=v,k.x=k.data.x,k.y=k.data.y;do j+=u[k.data.index];while(k=k.next)}v.value=j}function b(v,j,k,C){if(!v.value)return!0;var E=v.x-l.x,M=v.y-l.y,H=C-j,B=E*E+M*M;if(H*H/p<B)return B<m&&(E===0&&(E=_a(a),B+=E*E),M===0&&(M=_a(a),B+=M*M),B<f&&(B=Math.sqrt(f*B)),l.vx+=E*v.value*i/B,l.vy+=M*v.value*i/B),!0;if(v.length||B>=m)return;(v.data!==l||v.next)&&(E===0&&(E=_a(a),B+=E*E),M===0&&(M=_a(a),B+=M*M),B<f&&(B=Math.sqrt(f*B)));do v.data!==l&&(H=u[v.data.index]*i/B,l.vx+=E*H,l.vy+=M*H);while(v=v.next)}return h.initialize=function(v,j){t=v,a=j,g()},h.strength=function(v){return arguments.length?(o=typeof v=="function"?v:cr(+v),g(),h):o},h.distanceMin=function(v){return arguments.length?(f=v*v,h):Math.sqrt(f)},h.distanceMax=function(v){return arguments.length?(m=v*v,h):Math.sqrt(m)},h.theta=function(v){return arguments.length?(p=v*v,h):Math.sqrt(p)},h}const As={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 $j(t){return As[t]??As.general}function Hj({docs:t,onNodeClick:l,selectedDocId:a}){var L;const i=S.useRef(null),o=S.useRef(null),[u,f]=S.useState({width:600,height:400}),[m,p]=S.useState({nodes:[],links:[]}),[h,g]=S.useState(null),[y,b]=S.useState(null),[v,j]=S.useState({x:0,y:0}),[k,C]=S.useState({x:0,y:0,w:600,h:400}),E=S.useRef(!1),M=S.useRef({x:0,y:0,vx:0,vy:0}),H=S.useRef(null),B=S.useRef(null);S.useEffect(()=>{const $=i.current;if(!$)return;const ee=new ResizeObserver(ae=>{const{width:X,height:I}=ae[0].contentRect;X>0&&I>0&&(f({width:X,height:I}),C(Q=>({...Q,w:X,h:I})))});return ee.observe($),()=>ee.disconnect()},[]),S.useEffect(()=>{if(t.length===0)return;const $=new Set(t.map(ie=>ie.id)),ee=t.map(ie=>({id:ie.id,title:ie.title,category:ie.category,akb_type:ie.akb_type})),ae=[];for(const ie of t)for(const Se of ie.links){const z=Se.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,"");$.has(z)&&z!==ie.id&&(ae.some(_=>_.source===ie.id&&_.target===z||_.source===z&&_.target===ie.id)||ae.push({source:ie.id,target:z,label:Se.text}))}const{width:X,height:I}=u,Q=Bj(ee).force("link",kj(ae).id(ie=>ie.id).distance(140)).force("charge",Lj().strength(-400)).force("center",tj(X/2,I/2)).force("collide",vj(50));B.current=Q,Q.on("tick",()=>{for(const ie of ee)ie.x=Math.max(60,Math.min(X-60,ie.x??X/2)),ie.y=Math.max(60,Math.min(I-60,ie.y??I/2));p({nodes:[...ee],links:[...ae]})}),Q.alpha(1).restart();for(let ie=0;ie<150;ie++)Q.tick();return Q.stop(),p({nodes:[...ee],links:[...ae]}),()=>{Q.stop()}},[t,u]);const U=$=>{if(typeof $=="string"){const ee=m.nodes.find(ae=>ae.id===$);return{x:(ee==null?void 0:ee.x)??0,y:(ee==null?void 0:ee.y)??0}}return{x:$.x??0,y:$.y??0}},D=S.useCallback($=>{$.preventDefault();const ee=$.deltaY>0?1.1:.9;C(ae=>{const X=Math.max(200,Math.min(u.width*3,ae.w*ee)),I=Math.max(150,Math.min(u.height*3,ae.h*ee)),Q=(X-ae.w)/2,ie=(I-ae.h)/2;return{x:ae.x-Q,y:ae.y-ie,w:X,h:I}})},[u]),Y=S.useCallback($=>{$.button===0&&(E.current=!0,M.current={x:$.clientX,y:$.clientY,vx:k.x,vy:k.y})},[k]),V=S.useCallback($=>{var ee;if(H.current){const ae=o.current;if(!ae)return;const X=ae.getBoundingClientRect(),I=k.w/X.width,Q=k.h/X.height,ie=k.x+($.clientX-X.left)*I,Se=k.y+($.clientY-X.top)*Q;H.current.fx=ie,H.current.fy=Se,(ee=B.current)==null||ee.alpha(.3).restart();return}if(E.current){const ae=($.clientX-M.current.x)*(k.w/u.width),X=($.clientY-M.current.y)*(k.h/u.height);C(I=>({...I,x:M.current.vx-ae,y:M.current.vy-X}))}},[k,u]),ne=S.useCallback(()=>{E.current=!1,H.current&&(H.current.fx=null,H.current.fy=null,H.current=null)},[]),T=S.useCallback(($,ee)=>{var ae;$.stopPropagation(),H.current=ee,(ae=B.current)==null||ae.alpha(.3).restart()},[]);return c.jsxs("div",{ref:i,className:"relative flex-1 overflow-hidden",style:{background:"#1e1e2e"},children:[c.jsxs("svg",{ref:o,width:u.width,height:u.height,viewBox:`${k.x} ${k.y} ${k.w} ${k.h}`,style:{display:"block",cursor:E.current?"grabbing":"grab"},onWheel:D,onMouseDown:Y,onMouseMove:V,onMouseUp:ne,onMouseLeave:ne,children:[c.jsx("defs",{children:c.jsx("pattern",{id:"grid",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:c.jsx("circle",{cx:"0",cy:"0",r:"0.5",fill:"rgba(255,255,255,0.06)"})})}),c.jsx("rect",{x:k.x-100,y:k.y-100,width:k.w+200,height:k.h+200,fill:"url(#grid)",pointerEvents:"none"}),m.links.map(($,ee)=>{const ae=U($.source),X=U($.target),I=y===ee,Q=(ae.x+X.x)/2,ie=(ae.y+X.y)/2;return c.jsxs("g",{children:[c.jsx("line",{x1:ae.x,y1:ae.y,x2:X.x,y2:X.y,stroke:"transparent",strokeWidth:12,style:{cursor:"default"},onMouseEnter:()=>b(ee),onMouseLeave:()=>b(null)}),c.jsx("line",{x1:ae.x,y1:ae.y,x2:X.x,y2:X.y,stroke:I?"rgba(148,163,184,0.7)":"rgba(148,163,184,0.3)",strokeWidth:I?2:1.5,strokeDasharray:"4 3",pointerEvents:"none"}),I&&$.label&&c.jsx("text",{x:Q,y:ie-6,textAnchor:"middle",fill:"#e2e8f0",fontSize:9,fontFamily:"monospace",style:{pointerEvents:"none"},children:c.jsx("tspan",{style:{filter:"drop-shadow(0 0 2px rgba(0,0,0,0.8))"},children:$.label.length>30?$.label.slice(0,28)+"..":$.label})})]},ee)}),m.nodes.map($=>{const ee=As[$.category]??As.general,ae=$.akb_type==="hub",X=ae?24:16,I=(h==null?void 0:h.id)===$.id,Q=a===$.id,ie=I?1.2:Q?1.15:1;return c.jsxs("g",{transform:`translate(${$.x??0}, ${$.y??0}) scale(${ie})`,style:{cursor:"pointer",transition:"transform 0.15s ease"},onClick:Se=>{Se.stopPropagation();const z=t.find(_=>_.id===$.id);z&&l(z)},onMouseDown:Se=>T(Se,$),onMouseEnter:Se=>{var _;g($);const z=(_=i.current)==null?void 0:_.getBoundingClientRect();z&&j({x:Se.clientX-z.left,y:Se.clientY-z.top})},onMouseLeave:()=>g(null),children:[Q&&c.jsx("rect",{x:-X/2-4,y:-X/2-4,width:X+8,height:X+8,fill:"none",stroke:"#22c55e",strokeWidth:2,rx:ae?5:2,opacity:.6}),c.jsx("rect",{x:-X/2,y:-X/2,width:X,height:X,fill:ee.border,rx:ae?4:2,opacity:I?1:.9}),c.jsx("rect",{x:-X/2+3,y:-X/2+3,width:Math.max(0,X-6),height:Math.max(0,X-6),fill:ee.bg,rx:ae?3:1}),c.jsx("text",{y:X/2+14,textAnchor:"middle",fill:Q?"#e2e8f0":"#94a3b8",fontSize:11,fontFamily:"monospace",fontWeight:Q?"bold":"normal",style:{pointerEvents:"none"},children:$.title.length>24?$.title.slice(0,22)+"..":$.title})]},$.id)})]}),h&&!H.current&&c.jsxs("div",{className:"absolute z-10 pointer-events-none p-2.5 rounded text-xs max-w-[240px]",style:{left:Math.min(v.x+16,u.width-250),top:Math.max(v.y-30,8),background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",boxShadow:"0 4px 12px rgba(0,0,0,0.4)"},children:[c.jsx("div",{className:"font-bold mb-1",children:h.title}),c.jsxs("div",{className:"text-[10px] opacity-60 mb-1",children:[h.akb_type.toUpperCase()," / ",h.category]}),((L=t.find($=>$.id===h.id))==null?void 0:L.tldr)&&c.jsx("div",{className:"text-[10px] opacity-80 mb-1",children:t.find($=>$.id===h.id).tldr}),c.jsx("div",{className:"text-[10px] text-green-400",children:"Click to open | Drag to move"})]}),t.length===0&&c.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"No knowledge documents found"})]})}function Uj({doc:t,allDocs:l,onOpen:a,onNavigateDoc:i}){const[o,u]=S.useState(!1),f=$j(t.category),m=t.akb_type==="hub",p=new Set(l.map(h=>h.id));return c.jsxs("div",{className:"mb-2 rounded-lg overflow-hidden",style:{background:m?"rgba(22,163,106,0.08)":"var(--hud-bg-alt)",border:`2px solid ${m?"rgba(22,163,106,0.4)":"var(--terminal-border)"}`},children:[c.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>u(!o),children:[c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx("span",{className:"shrink-0 text-sm",children:m?"🗂":t.format==="html"?"🌐":"📄"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[c.jsx("span",{className:"font-semibold text-xs truncate",style:{color:"var(--terminal-text)"},children:t.title}),c.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:t.status==="active"?"#16a34a":t.status==="draft"?"#f59e0b":"#94a3b8"},title:t.status})]}),c.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:t.tags.slice(0,4).map(h=>c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium",style:{background:f.bg,color:f.text,border:`1px solid ${f.border}`},children:h},h))})]}),c.jsx("span",{className:"text-xs shrink-0",style:{color:"var(--terminal-text-muted)"},children:o?"▲":"▼"})]}),!o&&t.tldr&&c.jsx("div",{className:"mt-1.5 text-[10px] line-clamp-2 ml-6",style:{color:"var(--terminal-text-secondary)"},children:t.tldr})]}),o&&c.jsxs("div",{className:"px-3 pb-3",style:{borderTop:"1px solid var(--terminal-border)"},children:[t.tldr&&c.jsx("div",{className:"mt-2 text-[11px] leading-relaxed italic",style:{color:"var(--terminal-text-secondary)"},children:t.tldr}),t.links.length>0&&c.jsxs("div",{className:"mt-2",children:[c.jsx("div",{className:"text-[9px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Cross-links"}),c.jsx("div",{className:"flex flex-wrap gap-1",children:t.links.slice(0,5).map((h,g)=>{const y=h.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,""),b=p.has(y);return c.jsxs("span",{className:`px-1.5 py-0.5 text-[9px] rounded ${b?"cursor-pointer hover:opacity-70":""}`,style:{background:b?"rgba(22,163,106,0.15)":"rgba(148,163,184,0.1)",color:b?"#4ade80":"var(--terminal-text-muted)",border:`1px solid ${b?"rgba(22,163,106,0.3)":"var(--terminal-border)"}`},onClick:v=>{b&&(v.stopPropagation(),i(y))},children:["🔗"," ",h.text]},g)})})]}),c.jsxs("button",{className:"mt-2 text-[10px] font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},onClick:h=>{h.stopPropagation(),a(t)},children:["Open full ","→"]})]})]})}function Ij({docId:t,onBack:l,onDocUpdated:a,onDelete:i,onNavigateDoc:o,allDocs:u}){const[f,m]=S.useState(null),[p,h]=S.useState(!0),[g,y]=S.useState(!1),[b,v]=S.useState(""),[j,k]=S.useState(!1),C=new Set(u.map(U=>U.id)),E=S.useCallback(U=>{const D=U.split("#")[0];if(!D.match(/\.(md|html)$/))return null;const Y=t.includes("/")?t.replace(/\/[^/]+$/,""):"";let V;if(D.startsWith("./"))V=Y?`${Y}/${D.slice(2)}`:D.slice(2);else if(D.startsWith("../")){const L=Y.split("/").filter(Boolean);let $=D;for(;$.startsWith("../");)L.length>0&&L.pop(),$=$.slice(3);V=L.length>0?`${L.join("/")}/${$}`:$}else V=D;if(C.has(V))return V;const ne=V.split("/").pop()??"",T=u.find(L=>L.id===ne||L.id.endsWith("/"+ne));return T?T.id:null},[t,C,u]),M=S.useCallback(U=>{const Y=U.target.closest("a");if(!Y)return;const V=Y.getAttribute("href");if(!V||V.startsWith("http://")||V.startsWith("https://")||!V.match(/\.(md|html)(#.*)?$/))return;U.preventDefault(),U.stopPropagation();const ne=E(V);ne&&o(ne)},[E,o]);S.useEffect(()=>{h(!0),Te.getKnowledgeDoc(t).then(U=>{m(U),v(U.content)}).catch(console.error).finally(()=>h(!1))},[t]);const H=async()=>{if(f){k(!0);try{await Te.updateKnowledgeDoc(t,b),m({...f,content:b}),y(!1),a()}catch(U){console.error("Save failed:",U)}finally{k(!1)}}},B=async()=>{if(confirm(`Delete "${f==null?void 0:f.title}"?`))try{await Te.deleteKnowledgeDoc(t),i(t)}catch(U){console.error("Delete failed:",U)}};return p?c.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Loading..."}):f?c.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col",children:[c.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Back"]}),c.jsx("div",{className:"flex-1"}),g?c.jsxs(c.Fragment,{children:[c.jsx("button",{onClick:()=>{y(!1),v(f.content)},className:"px-2.5 py-1 text-[10px] rounded cursor-pointer",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Cancel"}),c.jsx("button",{onClick:H,disabled:j,className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold text-white",style:{background:j?"#86efac":"#16a34a"},children:j?"Saving...":"Save"})]}):c.jsxs(c.Fragment,{children:[c.jsx("button",{onClick:()=>y(!0),className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa",border:"1px solid rgba(59,130,246,0.3)"},children:"Edit"}),c.jsx("button",{onClick:B,className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold",style:{background:"rgba(239,68,68,0.15)",color:"#f87171",border:"1px solid rgba(239,68,68,0.3)"},children:"Delete"})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[c.jsx("h2",{className:"text-sm font-bold mb-1",style:{color:"var(--terminal-text)"},children:f.title}),f.tldr&&!g&&c.jsx("div",{className:"mb-3 text-xs italic",style:{color:"var(--terminal-text-secondary)"},children:f.tldr}),f.format==="html"?g?c.jsx("textarea",{className:"w-full h-full min-h-[400px] p-3 text-xs leading-relaxed rounded border resize-y",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',background:"var(--hud-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},value:b,onChange:U=>v(U.target.value),spellCheck:!1}):c.jsx("iframe",{srcDoc:f.content,sandbox:"allow-same-origin",className:"w-full flex-1 min-h-[400px] rounded",style:{border:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},title:f.title}):g?c.jsx("textarea",{className:"w-full h-full min-h-[400px] p-3 text-xs leading-relaxed rounded border resize-y",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',background:"#1e1e2e",color:"#e2e8f0",border:"1px solid #334155"},value:b,onChange:U=>v(U.target.value),spellCheck:!1}):c.jsx("div",{className:"text-xs leading-relaxed",style:{color:"var(--terminal-text-secondary)"},onClick:M,children:c.jsx(_s,{content:f.content})})]})]}):c.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Failed to load document"})}function Yj({onCreated:t,onCancel:l}){const[a,i]=S.useState(""),[o,u]=S.useState(""),[f,m]=S.useState(""),[p,h]=S.useState(!1),[g,y]=S.useState("");S.useEffect(()=>{if(!a){u("");return}const v=a.toLowerCase().replace(/[^a-z0-9가-힣\s-]/g,"").replace(/\s+/g,"-").slice(0,60);u(v)},[a]);const b=async()=>{if(!a.trim()||!o.trim()){y("Title and filename are required");return}h(!0),y("");try{const v=await Te.createKnowledgeDoc({filename:o,title:a,category:f||void 0});t(v.id)}catch(v){y(v instanceof Error?v.message:"Failed to create")}finally{h(!1)}};return c.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[c.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Cancel"]}),c.jsx("h2",{className:"text-sm font-bold",style:{color:"var(--terminal-text)"},children:"New Document"})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"TITLE"}),c.jsx("input",{type:"text",value:a,onChange:v=>i(v.target.value),placeholder:"Document title...",className:"w-full px-3 py-2 text-xs rounded focus:outline-none",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"FILENAME"}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("input",{type:"text",value:o,onChange:v=>u(v.target.value),className:"flex-1 px-3 py-2 text-xs rounded focus:outline-none font-mono",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}}),c.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:".md"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"CATEGORY (optional)"}),c.jsx("input",{type:"text",value:f,onChange:v=>m(v.target.value),placeholder:"e.g., tech, market, strategy",className:"w-full px-3 py-2 text-xs rounded focus:outline-none",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}})]}),g&&c.jsx("div",{className:"text-[10px] px-3 py-1.5 rounded",style:{background:"rgba(239,68,68,0.15)",color:"#f87171"},children:g}),c.jsx("button",{onClick:b,disabled:p||!a.trim(),className:"w-full py-2 text-xs font-semibold rounded cursor-pointer text-white",style:{background:p?"#86efac":"#16a34a"},children:p?"Creating...":"Create Document"})]})]})}const qj=500,c0=360,u0=700;function xh(t){const[l,a]=S.useState(qj),[i,o]=S.useState(!1),u=S.useRef(0),f=S.useRef(0),m=t>0,p=m?t:0,h=m?Math.max(c0,window.innerWidth-t-100):u0,g=Math.min(l,h),y=S.useCallback(b=>{b.preventDefault(),u.current=b.clientX,f.current=g,o(!0);const v=k=>{const C=u.current-k.clientX,E=Math.min(u0,Math.max(c0,f.current+C));a(E)},j=()=>{o(!1),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",j)};document.addEventListener("mousemove",v),document.addEventListener("mouseup",j)},[g]);return{panelRight:p,panelWidth:g,isResizing:i,handleResizeStart:y}}function Xj({docs:t,onClose:l,onRefresh:a,terminalWidth:i=0,initialDocId:o}){const[u,f]=S.useState("list"),[m,p]=S.useState("all"),[h,g]=S.useState(o??null),[y,b]=S.useState(""),[v,j]=S.useState(!1),[k,C]=S.useState(null),{panelRight:E,panelWidth:M,isResizing:H,handleResizeStart:B}=xh(i),U=["all",...Array.from(new Set(t.map(L=>L.category))).sort()],D=t.filter(L=>{if(m!=="all"&&L.category!==m)return!1;if(y){const $=y.toLowerCase();return L.title.toLowerCase().includes($)||(L.tldr??"").toLowerCase().includes($)||L.tags.some(ee=>ee.toLowerCase().includes($))}return!0}),Y=L=>{j(!1),a(),g(L)},V=L=>{g(null),a()},ne=L=>{C(L.id)},T=k?t.find(L=>L.id===k):null;return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:E},onClick:l}),c.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${H?"resizing":""}`,style:{right:E,width:M,background:"var(--terminal-bg)",borderLeftColor:"#16a34a"},children:[c.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${H?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:B}),c.jsxs("div",{className:"p-5 text-white relative",style:{background:"#16a34a"},children:[c.jsx("button",{onClick:l,className:"absolute top-3 right-3 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),c.jsxs("div",{className:"text-lg font-bold",children:["📚"," Knowledge Base"]}),c.jsxs("div",{className:"text-xs opacity-80 mt-0.5",children:[t.length," documents"]})]}),c.jsxs("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsx(f0,{label:"List",active:u==="list",onClick:()=>{f("list"),C(null)}}),c.jsx(f0,{label:"Graph",active:u==="graph",onClick:()=>f("graph")})]}),u==="list"&&!h&&!v&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsx("input",{type:"text",value:y,onChange:L=>b(L.target.value),placeholder:"Search docs...",className:"flex-1 px-2.5 py-1.5 text-[11px] rounded focus:outline-none",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}}),c.jsx("button",{onClick:()=>j(!0),className:"px-2.5 py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white shrink-0",style:{background:"#16a34a"},children:"+ New"})]}),c.jsx("div",{className:"flex overflow-x-auto shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",scrollbarWidth:"none"},children:U.map(L=>c.jsx("button",{onClick:()=>p(L),className:"px-3 py-1.5 text-[10px] font-medium cursor-pointer whitespace-nowrap",style:{color:m===L?"#4ade80":"var(--terminal-text-muted)",borderBottom:m===L?"2px solid #4ade80":"2px solid transparent"},children:L==="all"?`All (${t.length})`:`${L} (${t.filter($=>$.category===L).length})`},L))}),c.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:D.length===0?c.jsx("div",{className:"text-center text-xs py-8",style:{color:"var(--terminal-text-muted)"},children:y?"No matching documents":"No documents in this category"}):D.map(L=>c.jsx(Uj,{doc:L,allDocs:t,onOpen:$=>g($.id),onNavigateDoc:$=>g($)},L.id))})]}),u==="list"&&h&&!v&&c.jsx(Ij,{docId:h,onBack:()=>g(null),onDocUpdated:a,onDelete:V,onNavigateDoc:L=>g(L),allDocs:t}),u==="list"&&v&&c.jsx(Yj,{onCreated:Y,onCancel:()=>j(!1)}),u==="graph"&&c.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[c.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[c.jsx(Hj,{docs:t,onNodeClick:ne,selectedDocId:k}),T&&c.jsxs("div",{className:"shrink-0 overflow-y-auto p-3",style:{width:200,background:"var(--hud-bg-alt)",borderLeft:"1px solid var(--terminal-border)"},children:[c.jsx("div",{className:"text-[10px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Selected"}),c.jsx("div",{className:"text-xs font-bold mb-1",style:{color:"var(--terminal-text)"},children:T.title}),c.jsx("div",{className:"w-2 h-2 rounded-full mb-2",style:{background:T.status==="active"?"#16a34a":T.status==="draft"?"#f59e0b":"#94a3b8"}}),T.tldr&&c.jsx("div",{className:"text-[10px] mb-2 leading-relaxed",style:{color:"var(--terminal-text-secondary)"},children:T.tldr}),T.links.length>0&&c.jsxs("div",{className:"mb-2",children:[c.jsx("div",{className:"text-[9px] font-bold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Links"}),T.links.slice(0,5).map((L,$)=>c.jsxs("div",{className:"text-[9px] mb-0.5 truncate",style:{color:"var(--terminal-text-secondary)"},children:["🔗"," ",L.text]},$))]}),c.jsx("button",{className:"w-full py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white",style:{background:"#16a34a"},onClick:()=>{f("list"),g(T.id),C(null)},children:"Open Document"})]})]}),c.jsx("div",{className:"shrink-0 p-2",style:{borderTop:"1px solid var(--terminal-border)"},children:c.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(As).map(([L,$])=>c.jsxs("div",{className:"flex items-center gap-1 text-[9px]",children:[c.jsx("div",{className:"w-2 h-2",style:{background:$.border}}),c.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:L})]},L))})})]})]})]})}function f0({label:t,active:l,onClick:a}){return c.jsx("button",{onClick:a,className:"px-4 py-2.5 text-sm font-medium cursor-pointer",style:{color:l?"#4ade80":"var(--terminal-text-muted)",borderBottom:l?"2px solid #4ade80":"2px solid transparent"},children:t})}function Vj({standups:t,waves:l,decisions:a,mode:i,onClose:o,terminalWidth:u=0}){const[f,m]=S.useState(i==="decisions"?"decisions":"standups"),{panelRight:p,panelWidth:h,isResizing:g,handleResizeStart:y}=xh(u);return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:p},onClick:o}),c.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${g?"resizing":""}`,style:{right:p,width:h,background:"var(--terminal-bg)",borderLeftColor:"var(--desk-wood)"},children:[c.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${g?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:y}),c.jsxs("div",{className:"p-5 bg-[var(--desk-wood)] text-white relative",children:[c.jsx("button",{onClick:o,className:"absolute top-3 right-3 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),c.jsx("div",{className:"text-lg font-bold",children:i==="bulletin"?"📌 Bulletin Board":"📜 Decision Log"})]}),c.jsx("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:i==="bulletin"?c.jsxs(c.Fragment,{children:[c.jsx(dd,{label:`Standups (${t.length})`,active:f==="standups",onClick:()=>m("standups")}),c.jsx(dd,{label:`Waves (${l.length})`,active:f==="waves",onClick:()=>m("waves")})]}):c.jsx(dd,{label:`Decisions (${a.length})`,active:f==="decisions",onClick:()=>m("decisions")})}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[f==="standups"&&t.map((b,v)=>c.jsx(hd,{title:`Standup ${b.date}`,content:b.content},v)),f==="waves"&&l.map((b,v)=>c.jsx(hd,{title:`Wave ${b.id}`,subtitle:b.timestamp,content:b.content},v)),f==="decisions"&&a.map((b,v)=>c.jsx(hd,{title:`#${b.id} ${b.title}`,subtitle:b.date,content:b.content},v))]})]})]})}function dd({label:t,active:l,onClick:a}){return c.jsx("button",{onClick:a,className:"px-4 py-2.5 text-sm font-medium cursor-pointer",style:{color:l?"var(--accent)":"var(--terminal-text-muted)",borderBottom:l?"2px solid var(--accent)":"2px solid transparent"},children:t})}function Gj(t){return t.replace(/^#{1,6}\s+/gm,"").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/```[\s\S]*?```/g,"").replace(/^\s*[-*+]\s+/gm,"• ").replace(/^\s*\d+\.\s+/gm,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/^>\s+/gm,"").replace(/^---+$/gm,"").replace(/\|[^|]*\|/g,"").replace(/\n{2,}/g," · ").replace(/\n/g," ").trim()}function hd({title:t,subtitle:l,content:a}){const[i,o]=S.useState(!1),u=a.length>100,f=Gj(a).slice(0,160);return c.jsxs("div",{className:"mb-3 rounded-lg overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[c.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>o(!i),children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("div",{className:"font-medium text-sm",style:{color:"var(--terminal-text)"},children:t}),c.jsx("span",{className:"text-xs shrink-0 ml-2",style:{color:"var(--terminal-text-muted)"},children:i?"▲":"▼"})]}),l&&c.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--terminal-text-muted)"},children:l})]}),i&&c.jsx("div",{className:"px-3 pb-3 text-xs leading-relaxed pt-2",style:{borderTop:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:c.jsx(_s,{content:a})}),!i&&u&&c.jsx("div",{className:"px-3 pb-2 text-xs line-clamp-2 leading-relaxed",style:{color:"var(--terminal-text-muted)"},children:f})]})}function Kj({projectId:t,onClose:l,terminalWidth:a=0}){const[i,o]=S.useState(null),{panelRight:u,panelWidth:f,isResizing:m,handleResizeStart:p}=xh(a);if(S.useEffect(()=>{Te.getProject(t).then(o).catch(console.error)},[t]),!i)return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),c.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px] border-[var(--meeting-blue)]",style:{right:u,width:f,background:"var(--terminal-bg)"},children:c.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading project..."})})]});const h=i.tasks.filter(b=>b.status==="done").length,g=i.tasks.length,y=g>0?Math.round(h/g*100):0;return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),c.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] border-[var(--meeting-blue)] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${m?"resizing":""}`,style:{right:u,width:f,background:"var(--terminal-bg)"},children:[c.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${m?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:p}),c.jsxs("div",{className:"p-5 bg-[var(--meeting-blue)] text-white relative",children:[c.jsx("div",{className:"text-sm opacity-70",children:"Meeting Room"}),c.jsx("button",{onClick:l,className:"absolute top-3 right-3 z-10 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),c.jsx("div",{className:"text-xl font-bold mt-1",children:i.name}),c.jsxs("div",{className:"flex items-center gap-3 mt-3 text-sm",children:[c.jsxs("span",{children:["Tasks: ",g]}),c.jsxs("span",{children:["Done: ",h]}),c.jsxs("span",{children:["Progress: ",y,"%"]})]}),c.jsx("div",{className:"mt-2 h-1.5 bg-white/20 rounded-full overflow-hidden",children:c.jsx("div",{className:"h-full bg-white rounded-full transition-all",style:{width:`${y}%`}})})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[i.prd&&c.jsxs("div",{className:"mb-5",children:[c.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"PRD"}),c.jsx("div",{className:"rounded-lg p-4 text-xs leading-relaxed max-h-60 overflow-y-auto",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:c.jsx(_s,{content:i.prd})})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:["Tasks (",g,")"]}),c.jsx("div",{className:"space-y-2",children:i.tasks.map(b=>c.jsxs("div",{className:"rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-sm font-medium",style:{color:"var(--terminal-text)"},children:b.title}),c.jsx(Qj,{status:b.status})]}),c.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-muted)"},children:b.role}),b.description&&c.jsx("div",{className:"text-xs mt-1.5 line-clamp-2",style:{color:"var(--terminal-text-secondary)"},children:b.description})]},b.id))})]})]})]})]})}function Qj({status:t}){const l={done:{bg:"rgba(34,197,94,0.15)",color:"#4ade80"},"in-progress":{bg:"rgba(59,130,246,0.15)",color:"#60a5fa"},todo:{bg:"rgba(148,163,184,0.15)",color:"var(--terminal-text-muted)"}},a=l[t]??l.todo;return c.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:a.bg,color:a.color},children:t})}const Zj={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function Wj({roleId:t,roleName:l,mode:a="assign",onClose:i,onExecutionStart:o}){const[u,f]=S.useState(""),m=S.useRef(null);S.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const p=()=>{u.trim()&&(o(t,u.trim()),i())},h=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&p(),y.key==="Escape"&&i()},g=Zj[t]??"#666";return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),c.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[520px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[c.jsxs("div",{className:"p-5 text-white",style:{background:`linear-gradient(135deg, ${g}, ${g}cc)`},children:[c.jsx("div",{className:"text-lg font-bold",children:a==="ask"?"Ask":"Assign Task"}),c.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:a==="ask"?`to ${l}`:`to ${l} (${t})`})]}),c.jsxs("div",{className:"p-5",children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Task Description"}),c.jsx("textarea",{ref:m,value:u,onChange:y=>f(y.target.value),onKeyDown:h,placeholder:a==="ask"?"What would you like to ask?":"Describe the task...",className:"w-full h-32 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),c.jsx("div",{className:"text-[10px] text-white/30 mt-1",children:"Cmd+Enter to submit"})]}),c.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[c.jsx("button",{onClick:i,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),c.jsx("button",{onClick:p,disabled:!u.trim(),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:g},children:a==="ask"?"Ask":"Assign"})]})]})]})}const d0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function rg({event:t,isThinkingCollapsed:l,onToggleThinking:a,onNavigateToJob:i,onOpenKnowledgeDoc:o,compact:u}){var m;const f=d0[t.roleId]??"#888";switch(t.type){case"text":return c.jsx("div",{className:"text-green-300/90 whitespace-pre-wrap leading-relaxed",children:u?(t.data.text??"").slice(0,300):t.data.text});case"thinking":{const p=t.data.text??"";return c.jsxs("div",{className:"group",children:[c.jsxs("button",{onClick:a,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-[10px] cursor-pointer flex items-center gap-1",children:[c.jsx("span",{children:l?"▶":"▼"}),c.jsx("span",{className:"italic",children:"thinking..."})]}),!l&&c.jsxs("div",{className:`ml-3 text-[var(--terminal-text-muted)] italic whitespace-pre-wrap opacity-60 text-[11px] overflow-y-auto ${u?"max-h-[60px]":"max-h-[120px]"}`,children:[p.slice(0,u?200:500),p.length>(u?200:500)?"...":""]})]})}case"tool:start":{const p=String(t.data.name??""),h=t.data.input,g=typeof(h==null?void 0:h.command)=="string"?h.command.slice(0,80):"",y=typeof(h==null?void 0:h.file_path)=="string"?String(h.file_path):typeof(h==null?void 0:h.path)=="string"?String(h.path):"",b=y?y.split("/").pop()??"":"",v=/^(write_file|Write|edit_file|Edit)$/i.test(p),j=(m=y.match(/(?:^|\/)knowledge\/(.+\.md)$/))==null?void 0:m[1],k=v&&j&&o;return c.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[c.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${k?"text-green-400/80 bg-green-400/10":"text-blue-400/80 bg-blue-400/10"}`,children:k?v&&p.toLowerCase().includes("edit")?"Edit":"Write":p}),k?c.jsx("button",{onClick:()=>o(j),className:"text-[10px] text-green-400 hover:text-green-300 underline underline-offset-2 cursor-pointer truncate",style:{maxWidth:u?200:400},children:b}):c.jsxs(c.Fragment,{children:[g&&c.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:g}),b&&c.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:b})]})]})}case"dispatch:start":{const p=t.data.targetRoleId??t.data.roleId??"",h=t.data.task??"",g=t.data.childJobId,y=d0[p]??"#888";return c.jsx("div",{className:"my-1 p-2 rounded-lg border cursor-pointer hover:opacity-90 transition-opacity",style:{borderColor:`${y}44`,background:`${y}11`},onClick:()=>g&&(i==null?void 0:i(g)),children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("span",{style:{color:y},className:"font-bold text-[11px]",children:["→"," ",p.toUpperCase()]}),c.jsx("span",{className:"text-[var(--terminal-text-secondary)] text-[10px] truncate flex-1",children:h.slice(0,u?60:100)}),g&&i&&c.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/10 text-[var(--terminal-text-muted)]",children:["View ","→"]})]})})}case"dispatch:done":return c.jsx("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pl-3 border-l-2 border-[var(--terminal-border)] my-0.5",children:"Dispatch completed"});case"turn:complete":return c.jsx("div",{className:"border-t border-[var(--terminal-border)] my-2 relative",children:c.jsxs("span",{className:"absolute -top-2 left-2 bg-[var(--terminal-bg)] px-2 text-[9px] text-[var(--terminal-text-muted)]",children:["Turn ",t.data.turn]})});case"stderr":return c.jsxs("div",{className:"text-red-400/80 text-[11px]",children:["⚠"," ",t.data.message]});case"job:start":return c.jsxs("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pb-1",children:[c.jsx("span",{style:{color:f},className:"font-bold",children:t.roleId.toUpperCase()})," ","started: ",(t.data.task??"").slice(0,u?50:80)]});case"job:done":{const p=t.data.turns??0,h=t.data.toolCalls??0;return c.jsx("div",{className:"mt-2 p-2 rounded-lg bg-green-900/20 border border-green-800/30",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-2 h-2 rounded-full bg-green-400"}),c.jsx("span",{className:"text-green-300 font-bold text-[11px]",children:"Complete"}),c.jsxs("span",{className:"text-[var(--terminal-text-muted)] text-[10px]",children:[p," turns · ",h," tools"]})]})})}case"job:error":return c.jsx("div",{className:"mt-2 p-2 rounded-lg bg-red-900/20 border border-red-800/30",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-2 h-2 rounded-full bg-red-400"}),c.jsx("span",{className:"text-red-300 font-bold text-[11px]",children:"Error"}),c.jsx("span",{className:"text-red-200/70 text-[10px]",children:t.data.message})]})});case"import:scan":case"import:process":case"import:created":return c.jsxs("div",{className:"text-cyan-300/70 text-[11px]",children:["[",t.type,"] ",JSON.stringify(t.data)]});default:return null}}function Jj({jobId:t,title:l,color:a,variant:i,style:o,onClose:u,onMinimize:f,onDone:m,onNavigateToJob:p,onOpenKnowledgeDoc:h}){const{events:g,status:y,textOutput:b,childJobIds:v}=B0(t),[j,k]=S.useState(0),[C,E]=S.useState(new Set),M=S.useRef(null),H=S.useRef(Date.now()),B=S.useRef(!1);S.useEffect(()=>{const L=setInterval(()=>{k(Math.floor((Date.now()-H.current)/1e3))},1e3);return()=>clearInterval(L)},[]),S.useEffect(()=>{M.current&&(M.current.scrollTop=M.current.scrollHeight)},[g]),S.useEffect(()=>{(y==="done"||y==="error")&&!B.current&&(B.current=!0,m==null||m())},[y,m]);const U=L=>{E($=>{const ee=new Set($);return ee.has(L)?ee.delete(L):ee.add(L),ee})},D={idle:"Waiting",connecting:"Connecting...",streaming:"Working",done:"Complete",error:"Error"}[y],Y={idle:"#888",connecting:"#888",streaming:a,done:"#2E7D32",error:"#C62828"}[y],V=L=>`${Math.floor(L/60)}:${String(L%60).padStart(2,"0")}`,ne=y==="done"||y==="error",T=c.jsxs("div",{className:i==="modal"?"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] h-[85vh] z-[61] bg-[var(--terminal-bg)] rounded-2xl shadow-2xl overflow-hidden flex flex-col":"bg-[var(--terminal-bg)] rounded-xl border border-[var(--terminal-border)] overflow-hidden flex flex-col max-h-[400px]",style:o,children:[c.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{background:Y}}),c.jsx("div",{children:c.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:l})})]}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:V(j)}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:`${Y}22`,color:Y},children:D}),f&&i==="modal"&&c.jsx("button",{onClick:f,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),ne&&c.jsx("button",{onClick:u,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),c.jsxs("div",{ref:M,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[g.length===0&&y==="connecting"&&c.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:"Connecting to activity stream..."}),g.map(L=>c.jsx(rg,{event:L,isThinkingCollapsed:C.has(L.seq),onToggleThinking:()=>U(L.seq),onNavigateToJob:p,onOpenKnowledgeDoc:h},L.seq)),y==="streaming"&&c.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),c.jsxs("div",{className:"px-5 py-3 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[c.jsxs("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:[g.length>0&&`${g.length} events`,b.length>0&&` · ${b.length} chars`,v.length>0&&` · ${v.length} dispatches`]}),ne&&c.jsx("button",{onClick:u,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer",style:{background:a},children:"Close"})]})]});return i==="modal"?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:ne?u:void 0}),T]}):T}const md={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function Pj({orgNodes:t,rootId:l}){const a=t[l];if(!a)return null;const o=a.children.map(m=>t[m]).filter(Boolean),u=[];for(const m of o)for(const p of m.children){const h=t[p];h&&u.push({node:h,parentId:m.id})}const f=o.length+u.length;return c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Propagation Preview"}),c.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-lg p-4",children:[c.jsx("div",{className:"flex justify-center mb-2",children:c.jsx("span",{className:"px-3 py-1 text-[10px] font-bold rounded border-2 border-white/20 bg-white/5 text-white/30 uppercase",children:"CEO"})}),o.length>0&&c.jsx("div",{className:"flex justify-center mb-1",children:c.jsx("div",{className:"w-px h-3 bg-white/15"})}),o.length>1&&c.jsx("div",{className:"flex justify-center mb-1",children:c.jsx("div",{className:"h-px bg-white/15",style:{width:`${Math.min(o.length*80,320)}px`}})}),c.jsx("div",{className:"flex justify-center gap-3 mb-2 flex-wrap",children:o.map(m=>c.jsxs("div",{className:"flex flex-col items-center",children:[c.jsx("span",{className:"px-2.5 py-1 text-[10px] font-bold rounded border-2 uppercase",style:{borderColor:md[m.id]??"#888",color:md[m.id]??"#888",background:`${md[m.id]??"#888"}22`},children:m.id}),c.jsx("span",{className:"text-[8px] text-white/30 mt-0.5",children:"direct"})]},m.id))}),u.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"flex justify-center mb-1",children:c.jsx("div",{className:"w-px h-2 bg-white/10"})}),c.jsx("div",{className:"flex justify-center gap-2 flex-wrap",children:u.map(({node:m})=>c.jsx("span",{className:"px-2 py-0.5 text-[9px] font-semibold rounded border border-white/15 text-white/40 uppercase",children:m.id},m.id))}),c.jsx("div",{className:"text-center text-[8px] text-white/30 mt-1",children:"via re-dispatch"})]})]}),c.jsxs("div",{className:"text-[10px] text-gray-400 mt-1.5",children:[f," role",f!==1?"s":""," will receive this wave"]})]})}function eC({cLevelRoles:t,orgNodes:l,rootId:a,onClose:i,onDispatch:o}){const[u,f]=S.useState(""),m=S.useRef(null);S.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const p=()=>{!u.trim()||t.length===0||(o(u.trim()),i())},h=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&p(),y.key==="Escape"&&i()},g=a&&Object.keys(l).length>0;return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),c.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[560px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[c.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[c.jsx("div",{className:"text-lg font-bold",children:"CEO Wave"}),c.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:"Broadcast a directive to all C-Level reports"})]}),c.jsxs("div",{className:"p-5 space-y-4",children:[g&&c.jsx(Pj,{orgNodes:l,rootId:a}),!g&&c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Dispatching to"}),c.jsx("div",{className:"flex gap-2 flex-wrap",children:t.length>0?t.map(y=>c.jsxs("span",{className:"px-3 py-1.5 text-xs font-semibold rounded-lg border-2 border-red-200 bg-red-50 text-red-800",children:[y.id.toUpperCase()," · ",y.name]},y.id)):c.jsx("span",{className:"text-xs text-gray-400 italic",children:"No C-Level roles found"})}),c.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Each C-Level receives the directive and delegates to their reports"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Directive"}),c.jsx("textarea",{ref:m,value:u,onChange:y=>f(y.target.value),onKeyDown:h,placeholder:"e.g. Report current status across all departments",className:"w-full h-28 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),c.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Cmd+Enter to dispatch"})]})]}),c.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[c.jsx("button",{onClick:i,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),c.jsxs("button",{onClick:p,disabled:!u.trim()||t.length===0,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#B71C1C"},children:["Dispatch to ",t.length," Role",t.length!==1?"s":""]})]})]})]})}function tC(t,l,a){const[i,o]=S.useState(new Map),[u,f]=S.useState(null),m=S.useRef(new Map),p=S.useRef(i);p.current=i,S.useEffect(()=>{if(!a||Object.keys(l).length===0)return;const b=new Map,v=k=>{const C=l[k];C&&(b.set(k,{jobId:null,roleId:k,roleName:C.name,children:C.children,status:"waiting",events:[],streamStatus:"idle"}),C.children.forEach(v))},j=l[a];j&&(b.set(a,{jobId:null,roleId:a,roleName:"CEO",children:j.children,status:"not-dispatched",events:[],streamStatus:"idle"}),j.children.forEach(v));for(const k of t){const C=b.get(k.roleId);C&&(C.jobId=k.jobId,C.status="running",C.streamStatus="connecting")}o(b),t.length>0&&f(t[0].roleId)},[t,l,a]);const h=S.useCallback((b,v)=>{const j=m.current.get(b);j&&j.controller.abort();const k=new AbortController,C={controller:k,lastSeq:-1};m.current.set(b,C);const M=`/api/jobs/${b}/stream?from=0`;fetch(M,{signal:k.signal}).then(async H=>{if(!H.ok||!H.body){o(Y=>{const V=new Map(Y),ne=V.get(v);return ne&&V.set(v,{...ne,streamStatus:"error"}),V});return}o(Y=>{const V=new Map(Y),ne=V.get(v);return ne&&V.set(v,{...ne,streamStatus:"streaming",status:"running"}),V});const B=H.body.getReader(),U=new TextDecoder;let D="";for(;;){const{done:Y,value:V}=await B.read();if(Y)break;D+=U.decode(V,{stream:!0});const ne=D.split(`
|
|
80
|
-
`);D=ne.pop()??"";let T="";for(const L of ne)if(L.startsWith("event: "))T=L.slice(7).trim();else if(L.startsWith("data: ")){try{const $=JSON.parse(L.slice(6));if(T==="activity"){const ee=$;ee.seq>C.lastSeq&&(C.lastSeq=ee.seq),o(ae=>{const X=new Map(ae),I=X.get(v);if(!I||I.events.some(ie=>ie.seq===ee.seq))return ae;const Q={...I,events:[...I.events,ee]};if(ee.type==="dispatch:start"&&ee.data.childJobId){const ie=ee.data.childJobId,Se=ee.data.targetRoleId??ee.data.roleId;if(Se){const z=X.get(Se);z&&(X.set(Se,{...z,jobId:ie,status:"running",streamStatus:"connecting"}),setTimeout(()=>h(ie,Se),0))}}return ee.type==="job:done"?(Q.status="done",Q.streamStatus="done"):ee.type==="job:error"&&(Q.status="error",Q.streamStatus="error"),X.set(v,Q),X})}else if(T==="stream:end"){const ee=$.reason;o(ae=>{const X=new Map(ae),I=X.get(v);if(!I)return ae;const Q=ee==="error"?"error":"done";return X.set(v,{...I,status:I.status==="running"?Q:I.status,streamStatus:Q==="error"?"error":"done"}),X})}}catch{}T=""}}}).catch(H=>{H.name!=="AbortError"&&o(B=>{const U=new Map(B),D=U.get(v);return D&&U.set(v,{...D,streamStatus:"error"}),U})})},[]);S.useEffect(()=>{if(t.length!==0){for(const b of t)h(b.jobId,b.roleId);return()=>{for(const[,b]of m.current)b.controller.abort();m.current.clear()}}},[t,h]);const g=(()=>{let b=0,v=0,j=0;for(const[k,C]of i)k!==a&&(j++,C.status==="done"?b++:C.status==="running"&&v++);return{done:b,total:j,running:v}})(),y=g.total>0&&g.running===0&&Array.from(i.values()).every(b=>b.status!=="running"&&b.streamStatus!=="streaming"&&b.streamStatus!=="connecting");return S.useEffect(()=>{y&&o(b=>{const v=new Map(b);let j=!1;for(const[k,C]of v)C.status==="waiting"&&(v.set(k,{...C,status:"not-dispatched"}),j=!0);return j?v:b})},[y]),{nodes:i,selectedRoleId:u,selectNode:f,progress:g,allDone:y}}const h0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},sr=120,Kl=44,m0=80;function nC(t,l){if(!t.get(l))return{layout:[],width:300,height:200};const i=[],o=[],u=[{id:l,depth:0,parentId:null}],f=new Set;for(;u.length>0;){const{id:g,depth:y,parentId:b}=u.shift();if(f.has(g))continue;for(f.add(g);o.length<=y;)o.push([]);o[y].push(g),i.push({roleId:g,x:0,y:y*m0+20,parentId:b});const v=t.get(g);if(v)for(const j of v.children)t.has(j)&&!f.has(j)&&u.push({id:j,depth:y+1,parentId:g})}const m=Math.max(...o.map(g=>g.length))*(sr+16),p=Math.max(m,280);for(const g of o){const y=g.length*(sr+16)-16,b=(p-y)/2;g.forEach((v,j)=>{const k=i.find(C=>C.roleId===v);k&&(k.x=b+j*(sr+16))})}const h=o.length*m0+40;return{layout:i,width:p,height:h}}function lC({nodes:t,rootId:l,selectedRoleId:a,onSelectNode:i}){const{layout:o,width:u,height:f}=nC(t,l),m=h=>{const g=o.find(y=>y.roleId===h);return g?{cx:g.x+sr/2,cy:g.y+Kl/2}:{cx:0,cy:0}},p=h=>{switch(h.status){case"running":return h0[h.roleId]??"#FBBF24";case"done":return"#2E7D32";case"error":return"#C62828";case"not-dispatched":return"#666";default:return"#888"}};return c.jsxs("svg",{viewBox:`0 0 ${u} ${f}`,width:"100%",height:"100%",className:"block",children:[c.jsx("defs",{children:c.jsxs("filter",{id:"glow",children:[c.jsx("feGaussianBlur",{stdDeviation:"2",result:"blur"}),c.jsxs("feMerge",{children:[c.jsx("feMergeNode",{in:"blur"}),c.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),o.filter(h=>h.parentId).map(h=>{const g=m(h.parentId),y=m(h.roleId),b=t.get(h.roleId),v=t.get(h.parentId);let j="rgba(180,200,240,0.15)",k="4 4",C="";return(b==null?void 0:b.status)==="done"||(v==null?void 0:v.status)==="done"?(j="#2E7D3266",k=""):(b==null?void 0:b.status)==="running"&&(j=h0[h.roleId]??"#FBBF24",k="6 4",C="wave-edge-flow"),c.jsx("line",{x1:g.cx,y1:g.cy+Kl/2-4,x2:y.cx,y2:y.cy-Kl/2+4,stroke:j,strokeWidth:1.5,strokeDasharray:k,className:C},`${h.parentId}-${h.roleId}`)}),o.map(h=>{const g=t.get(h.roleId);if(!g)return null;const y=p(g),b=a===h.roleId,v=h.roleId===l,j=v?.4:g.status==="not-dispatched"?.35:1;return c.jsxs("g",{transform:`translate(${h.x}, ${h.y})`,style:{cursor:v?"default":"pointer",opacity:j},onClick:()=>!v&&i(h.roleId),children:[c.jsx("rect",{x:0,y:0,width:sr,height:Kl,rx:8,ry:8,fill:"var(--terminal-bg-deeper, #181825)",stroke:b?"#fff":y,strokeWidth:b?2:1.5,strokeDasharray:g.status==="not-dispatched"?"4 3":""}),c.jsx("circle",{cx:14,cy:Kl/2,r:4,fill:y,filter:g.status==="running"?"url(#glow)":void 0,children:g.status==="running"&&c.jsx("animate",{attributeName:"opacity",values:"1;0.4;1",dur:"1.5s",repeatCount:"indefinite"})}),c.jsx("text",{x:26,y:Kl/2-4,fill:"var(--terminal-text, #fff)",fontSize:10,fontWeight:700,fontFamily:"var(--pixel-font)",children:g.roleId.toUpperCase()}),c.jsx("text",{x:26,y:Kl/2+10,fill:"var(--terminal-text-muted, #888)",fontSize:8,fontFamily:"var(--pixel-font)",children:g.status==="running"?"Working...":g.status==="done"?"Complete":g.status==="error"?"Error":g.status==="waiting"?"Waiting":""}),g.status==="done"&&c.jsx("text",{x:sr-18,y:Kl/2+4,fontSize:14,fill:"#2E7D32",children:"✓"}),g.status==="error"&&c.jsx("text",{x:sr-18,y:Kl/2+4,fontSize:14,fill:"#C62828",children:"✗"})]},h.roleId)})]})}const aC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function rC({directive:t,rootJobs:l,orgNodes:a,rootRoleId:i,onClose:o,onMinimize:u,onDone:f,onOpenKnowledgeDoc:m}){const{nodes:p,selectedRoleId:h,selectNode:g,progress:y,allDone:b}=tC(l,a,i),[v,j]=S.useState(0),[k,C]=S.useState(new Set),E=S.useRef(null),M=S.useRef(Date.now()),H=S.useRef(!1);S.useEffect(()=>{const V=setInterval(()=>{j(Math.floor((Date.now()-M.current)/1e3))},1e3);return()=>clearInterval(V)},[]),S.useEffect(()=>{E.current&&(E.current.scrollTop=E.current.scrollHeight)},[h,p]),S.useEffect(()=>{b&&!H.current&&(H.current=!0,f==null||f())},[b,f]);const B=V=>`${Math.floor(V/60)}:${String(V%60).padStart(2,"0")}`,U=h?p.get(h):null,D=h?aC[h]??"#888":"#888",Y=V=>{C(ne=>{const T=new Set(ne);return T.has(V)?T.delete(V):T.add(V),T})};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:b?o:void 0}),c.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[960px] max-w-[95vw] h-[85vh] z-[61] bg-[var(--terminal-bg)] rounded-2xl shadow-2xl overflow-hidden flex flex-col",children:[c.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:b?"#2E7D32":"#B71C1C",animation:b?void 0:"wave-pulse 2s ease-in-out infinite"}}),c.jsx("div",{children:c.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:b?"WAVE COMPLETE":"WAVE COMMAND CENTER"})})]}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:B(v)}),c.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:b?"#2E7D3222":"#B71C1C22",color:b?"#2E7D32":"#B71C1C"},children:[y.done,"/",y.total," done"]}),c.jsx("button",{onClick:u,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),b&&c.jsx("button",{onClick:o,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),c.jsx("div",{className:"px-5 py-2 border-b border-[var(--terminal-border)] shrink-0",children:c.jsxs("span",{className:"text-[var(--terminal-text-secondary)] text-xs italic",children:["“",t,"”"]})}),c.jsxs("div",{className:"flex flex-1 min-h-0",children:[c.jsxs("div",{className:"w-[280px] shrink-0 border-r border-[var(--terminal-border)] flex flex-col",children:[c.jsx("div",{className:"px-3 py-2 border-b border-[var(--terminal-border)]",children:c.jsx("span",{className:"text-[10px] font-bold text-[var(--terminal-text-secondary)] uppercase tracking-wider",children:"Org Propagation"})}),c.jsx("div",{className:"flex-1 overflow-auto p-3",children:c.jsx(lC,{nodes:p,rootId:i,selectedRoleId:h,onSelectNode:g})}),c.jsx("div",{className:"px-3 py-2 border-t border-[var(--terminal-border)] flex flex-wrap gap-x-3 gap-y-1",children:[{label:"running",color:"#FBBF24",dot:!0},{label:"done",color:"#2E7D32",dot:!1},{label:"waiting",color:"#888",dot:!1},{label:"error",color:"#C62828",dot:!1}].map(V=>c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:V.color,animation:V.dot?"wave-pulse 1.5s ease-in-out infinite":void 0}}),c.jsx("span",{className:"text-[8px] text-[var(--terminal-text-muted)]",children:V.label})]},V.label))})]}),c.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[U&&c.jsxs("div",{className:"px-4 py-2 border-b border-[var(--terminal-border)] shrink-0 flex items-center gap-2",children:[c.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:D}}),c.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-xs",children:U.roleId.toUpperCase()}),c.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs",children:U.roleName}),c.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full font-semibold",style:{background:`${D}22`,color:D},children:U.status==="running"?"Working":U.status==="done"?"Complete":U.status==="error"?"Error":U.status==="waiting"?"Waiting":"Not dispatched"})]}),c.jsxs("div",{ref:E,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[U&&U.events.length===0&&c.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:U.status==="waiting"?"Waiting for dispatch...":U.status==="running"?"Connecting to activity stream...":U.status==="not-dispatched"?"This role was not dispatched in this wave.":""}),U==null?void 0:U.events.map(V=>c.jsx(rg,{event:V,isThinkingCollapsed:k.has(V.seq),onToggleThinking:()=>Y(V.seq),onNavigateToJob:ne=>{for(const[,T]of p)if(T.jobId===ne){g(T.roleId);return}},onOpenKnowledgeDoc:m},V.seq)),(U==null?void 0:U.status)==="running"&&c.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),!U&&c.jsx("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-xs",children:"Click a node in the org tree to view activity"}),c.jsxs("div",{className:"px-4 py-2 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[c.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:U&&U.events.length>0&&`${U.events.length} events`}),b&&c.jsx("button",{onClick:o,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer",style:{background:"#2E7D32"},children:"Close"})]})]})]})]})]})}const iC={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 ph(t){return iC[t]??{skinColor:"#B0BEC5",hairColor:"#78909C",shirtColor:"#607D8B",pantsColor:"#455A64",shoeColor:"#37474F"}}const ig=["#FDEBD0","#F5CBA7","#D4A07A","#C68642","#8D5524","#5C3A1E","#F3D1C7","#E8BEAC","#B07D62","#704214"],sg=["#1A0A00","#2C1810","#4E342E","#6D4C41","#8D6E63","#D4A574","#F5E6CA","#FFD700","#B71C1C","#AD1457","#4A148C","#1A237E","#004D40","#1A1A1A","#78909C","#E0E0E0"],og=["#1565C0","#E65100","#2E7D32","#4A148C","#AD1457","#00695C","#D32F2F","#F57F17","#1B5E20","#283593","#4E342E","#37474F","#880E4F","#00838F","#6A1B9A","#FF6F00"],cg=["#37474F","#1A237E","#3E2723","#263238","#1B5E20","#455A64","#212121","#4E342E","#0D47A1","#311B92"],ug=["#212121","#1A1A1A","#37474F","#4E342E","#7B1FA2","#D32F2F","#1565C0","#F57F17","#2E7D32","#FFFFFF"],Fa={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 sC({color:t,selected:l,onClick:a}){return c.jsx("button",{onClick:a,className:"customize-swatch",style:{background:t,outline:l?"2px solid #fff":"2px solid transparent",boxShadow:l?`0 0 0 1px ${t}, 0 0 6px ${t}88`:"none"}})}function hs({label:t,presets:l,value:a,onChange:i}){return c.jsxs("div",{className:"customize-row",children:[c.jsxs("div",{className:"customize-row-header",children:[c.jsx("span",{className:"customize-row-label",children:t}),c.jsx("div",{className:"customize-row-current",style:{background:a}})]}),c.jsx("div",{className:"customize-swatches",children:l.map(o=>c.jsx(sC,{color:o,selected:o===a,onClick:()=>i(o)},o))})]})}function xd({label:t,items:l,value:a,onChange:i,lockInfo:o}){return c.jsxs("div",{className:"customize-row",children:[c.jsx("div",{className:"customize-row-header",children:c.jsx("span",{className:"customize-row-label",children:t})}),c.jsx("div",{className:"customize-swatches",style:{gap:4},children:l.map(u=>{const f=o?o.getLockLevel(u.id):1,m=u.id===a,p=o?f>o.roleLevel&&!m:!1,h=o?m&&f>o.roleLevel:!1;return c.jsxs("button",{onClick:()=>{p||i(u.id===a?void 0:u.id)},className:"customize-swatch",style:{width:"auto",height:"auto",padding:p?"2px 6px 10px 6px":"2px 6px",fontSize:9,fontFamily:"var(--font-pixel, monospace)",background:m?"rgba(255,255,255,0.15)":p?"rgba(255,255,255,0.02)":"rgba(255,255,255,0.04)",outline:m?h?"2px solid #F59E0B":"2px solid #fff":"2px solid transparent",color:p?"rgba(255,255,255,0.25)":m?"#fff":"rgba(255,255,255,0.5)",borderRadius:4,cursor:p?"not-allowed":"pointer",opacity:p?.35:1,position:"relative"},children:[u.name,p&&c.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.",f]}),h&&c.jsxs("span",{style:{position:"absolute",bottom:-8,left:"50%",transform:"translateX(-50%)",fontSize:7,color:"#F59E0B",whiteSpace:"nowrap"},children:["⚠"," Lv.",f]})]},u.id)})})]})}function pd({label:t,active:l,onClick:a}){return c.jsx("button",{onClick:a,style:{flex:1,padding:"6px 0",fontSize:10,fontFamily:"var(--font-pixel, monospace)",fontWeight:"bold",letterSpacing:1,background:l?"rgba(255,255,255,0.08)":"transparent",color:l?"#fff":"rgba(255,255,255,0.35)",border:"none",borderBottom:l?"2px solid #3B82F6":"2px solid transparent",cursor:"pointer",transition:"all 0.15s"},children:t})}function Da(t){return t[Math.floor(Math.random()*t.length)]}function gs(t){var o,u,f;const l=Gy(),a=Ky(),i=Qy().filter(m=>!t||Wy(m.id,t));return{skinColor:Da(ig),hairColor:Da(sg),shirtColor:Da(og),pantsColor:Da(cg),shoeColor:Da(ug),hairStyle:(o=Da(l))==null?void 0:o.id,outfitStyle:(u=Da(a))==null?void 0:u.id,accessory:(f=Da(i))==null?void 0:f.id}}function fg({roleId:t,appearance:l,onChange:a,onRandomize:i,onReset:o,label:u,roleLevel:f}){const[m,p]=S.useState("look"),h=S.useCallback((C,E)=>{a({...l,[C]:E})},[l,a]),g=S.useRef(null),y=S.useCallback(C=>{var H;const E=(H=C.target.files)==null?void 0:H[0];if(!E)return;const M=new Image;M.onload=()=>{const B=zS(M);a({...B,hairStyle:l.hairStyle,outfitStyle:l.outfitStyle,accessory:l.accessory}),URL.revokeObjectURL(M.src)},M.src=URL.createObjectURL(E),C.target.value=""},[l.hairStyle,l.outfitStyle,l.accessory,a]),b=Gy(),v=Ky(),j=Qy(),k=f!==void 0?j.filter(C=>Wy(C.id,f)).length:j.length;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"customize-preview",children:[c.jsx("div",{className:"customize-preview-bg",children:c.jsx(Mc,{roleId:t,appearance:l,scale:12})}),u&&c.jsx("div",{className:"customize-preview-name",children:u}),c.jsxs("div",{className:"customize-preview-actions",children:[c.jsx("button",{className:"customize-btn customize-btn--random",onClick:i,children:"RANDOM"}),c.jsx("button",{className:"customize-btn customize-btn--reset",onClick:o,children:"RESET"}),c.jsx("button",{className:"customize-btn",onClick:()=>{var C;return(C=g.current)==null?void 0:C.click()},style:{fontSize:9,opacity:.7},children:"PHOTO"}),c.jsx("input",{ref:g,type:"file",accept:"image/*",onChange:y,style:{display:"none"}})]})]}),c.jsxs("div",{className:"customize-colors",children:[c.jsxs("div",{style:{display:"flex",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:[c.jsx(pd,{label:"LOOK",active:m==="look",onClick:()=>p("look")}),c.jsx(pd,{label:"OUTFIT",active:m==="outfit",onClick:()=>p("outfit")}),c.jsx(pd,{label:"ACCESSORY",active:m==="accessory",onClick:()=>p("accessory")})]}),m==="look"&&c.jsxs(c.Fragment,{children:[c.jsx(hs,{label:"SKIN",presets:ig,value:l.skinColor,onChange:C=>h("skinColor",C)}),c.jsx(hs,{label:"HAIR COLOR",presets:sg,value:l.hairColor,onChange:C=>h("hairColor",C)}),c.jsx(xd,{label:"HAIR STYLE",items:b,value:l.hairStyle,onChange:C=>h("hairStyle",C)})]}),m==="outfit"&&c.jsxs(c.Fragment,{children:[c.jsx(xd,{label:"STYLE",items:v,value:l.outfitStyle,onChange:C=>h("outfitStyle",C)}),c.jsx(hs,{label:"TOP",presets:og,value:l.shirtColor,onChange:C=>h("shirtColor",C)}),c.jsx(hs,{label:"PANTS",presets:cg,value:l.pantsColor,onChange:C=>h("pantsColor",C)}),c.jsx(hs,{label:"SHOES",presets:ug,value:l.shoeColor,onChange:C=>h("shoeColor",C)})]}),m==="accessory"&&c.jsxs(c.Fragment,{children:[f!==void 0&&c.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:[c.jsxs("span",{children:["Lv.",f]}),c.jsxs("span",{children:[k,"/",j.length," unlocked"]})]}),c.jsx(xd,{label:"ACCESSORY",items:j,value:l.accessory,onChange:C=>h("accessory",C),lockInfo:f!==void 0?{roleLevel:f,getLockLevel:Zy}:void 0}),c.jsx("div",{style:{marginTop:12,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:6,border:"1px dashed rgba(255,255,255,0.08)",color:"rgba(255,255,255,0.25)",fontSize:9,fontFamily:"var(--font-pixel, monospace)",textAlign:"center"},children:f!==void 0&&f<10?"Level up to unlock more accessories":"More accessories coming soon"})]})]})]})}const oC=[{value:"c-level",label:"C-Level"},{value:"team-lead",label:"Team Lead"},{value:"member",label:"Member"}];function dg(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,24)}function x0(t){switch(t){case"c-level":return{authority:{autonomous:["Strategic decisions within domain","Task delegation to reports"],needsApproval:["Budget over $5K","External commitments"]},knowledge:{reads:["company/","operations/","projects/"],writes:["operations/","knowledge/"]},reports:{daily:"standup",weekly:"summary"}};case"team-lead":return{authority:{autonomous:["Task planning","Sprint management"],needsApproval:["Architecture changes","New tool adoption"]},knowledge:{reads:["projects/","architecture/"],writes:["projects/"]},reports:{daily:"standup",weekly:"summary"}};default:return{authority:{autonomous:["Implementation within assigned tasks"],needsApproval:["Design changes","New dependencies"]},knowledge:{reads:["projects/"],writes:[]},reports:{daily:"standup",weekly:""}}}}const ms=4;function cC(t,l,a){const i=t.trim();if(!i||i.startsWith("#"))return null;const o=i.split(",").map(y=>y.trim()),u=o[0];if(!u)return null;const f=dg(u),m=(o[1]||"member").toLowerCase(),p=m==="c-level"?"c-level":m==="team-lead"?"team-lead":"member",h=o[2]||"ceo";let g;return l.has(f)?g="ID already exists":a.has(f)&&(g="Duplicate ID in batch"),a.add(f),{name:u,id:f,level:p,reportsTo:h,error:g}}function uC({existingRoles:t,onClose:l,onHire:a}){const[i,o]=S.useState("single"),[u,f]=S.useState(1),[m,p]=S.useState(""),[h,g]=S.useState(""),[y,b]=S.useState(!1),[v,j]=S.useState("member"),[k,C]=S.useState("ceo"),[E,M]=S.useState(""),[H,B]=S.useState(gs),[U,D]=S.useState(!1),[Y,V]=S.useState(""),[ne,T]=S.useState([]),[L,$]=S.useState(new Set),[ee,ae]=S.useState(""),[X,I]=S.useState("input"),[Q,ie]=S.useState({done:0,total:0}),Se=S.useRef(null),z=S.useRef(null),_=S.useRef(null);S.useEffect(()=>{Te.getSkills().then(te=>T(te.filter(ve=>ve.installed))).catch(()=>{})},[]),S.useEffect(()=>{var te,ve,Ce;i==="single"?(u===1&&((te=Se.current)==null||te.focus()),u===2&&((ve=z.current)==null||ve.focus())):X==="input"&&((Ce=_.current)==null||Ce.focus())},[u,i,X]);const P=S.useMemo(()=>new Set(t.map(te=>te.id)),[t]),A=S.useMemo(()=>{const te=ee.split(`
|
|
81
|
-
`),ve=new Set;return te.map(Ce=>cC(Ce,P,ve)).filter(Ce=>Ce!==null)},[ee,P]),pe=A.length>0&&A.every(te=>!te.error),Ee=te=>{p(te),y||g(dg(te))},Ne=m.trim().length>0&&h.trim().length>0&&!t.some(te=>te.id===h),Oe=E.trim().length>0,Be=async()=>{D(!0),V("");const te=x0(v);try{await a({id:h,name:m.trim(),level:v,reportsTo:k,persona:E.trim(),...te,skills:L.size>0?[...L]:void 0},H),l()}catch(ve){V(ve instanceof Error?ve.message:"Failed to create role"),D(!1)}},oe=te=>te===1?Ne:te===2?Oe:!0,K=async()=>{D(!0),V(""),ie({done:0,total:A.length});try{for(let te=0;te<A.length;te++){const ve=A[te],Ce=x0(ve.level),Ae=gs(),ze=`${ve.name}. A ${ve.level} role reporting to ${ve.reportsTo}.`;await a({id:ve.id,name:ve.name,level:ve.level,reportsTo:ve.reportsTo,persona:ze,...Ce},Ae),ie({done:te+1,total:A.length})}l()}catch(te){V(te instanceof Error?te.message:"Failed to create roles"),D(!1)}},ue=te=>{te.key==="Escape"&&l(),te.key==="Enter"&&(te.metaKey||te.ctrlKey)&&(i==="single"?u<ms&&oe(u)?f(u+1):u===ms&&Be():X==="input"&&pe?I("review"):X==="review"&&K())},je=t.some(te=>te.id===h)&&h.length>0;return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:l}),c.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[560px] max-h-[90vh] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden flex flex-col",onKeyDown:ue,children:[c.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #2E7D32, #43A047)"},children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("div",{className:"text-lg font-bold",children:"Hire New Role"}),c.jsxs("div",{className:"flex bg-black/20 rounded-lg p-0.5",children:[c.jsx("button",{onClick:()=>{o("single"),V("")},className:`px-3 py-1 text-xs font-semibold rounded-md cursor-pointer transition-colors ${i==="single"?"bg-white/20 text-white":"text-white/50 hover:text-white/70"}`,children:"Single"}),c.jsx("button",{onClick:()=>{o("bulk"),V("")},className:`px-3 py-1 text-xs font-semibold rounded-md cursor-pointer transition-colors ${i==="bulk"?"bg-white/20 text-white":"text-white/50 hover:text-white/70"}`,children:"Bulk"})]})]}),c.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:i==="single"?`Step ${u} of ${ms}`:X==="input"?"Enter roles, one per line":`Review ${A.length} roles`})]}),i==="single"&&c.jsx("div",{className:"flex gap-1 px-5 pt-4",children:Array.from({length:ms},(te,ve)=>ve+1).map(te=>c.jsx("div",{className:"flex-1 h-1 rounded-full transition-colors",style:{background:te<=u?"#2E7D32":"rgba(255,255,255,0.1)"}},te))}),c.jsx("div",{className:"p-5 min-h-[240px] overflow-y-auto flex-1",children:i==="single"?c.jsxs(c.Fragment,{children:[u===1&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role Name"}),c.jsx("input",{ref:Se,value:m,onChange:te=>Ee(te.target.value),placeholder:"e.g. Data Analyst",className:"w-full p-2.5 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 focus:outline-none focus:border-white/25 transition-colors"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role ID (slug)"}),c.jsx("input",{value:h,onChange:te=>{g(te.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),b(!0)},className:`w-full p-2.5 rounded-lg border bg-white/5 text-sm text-white/90 font-mono focus:outline-none transition-colors ${je?"border-red-400":"border-white/10 focus:border-white/25"}`}),je&&c.jsx("div",{className:"text-xs text-red-500 mt-1",children:"ID already exists"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Level"}),c.jsx("div",{className:"flex gap-2",children:oC.map(te=>c.jsx("button",{onClick:()=>j(te.value),className:`flex-1 p-2 text-xs font-semibold rounded-lg border cursor-pointer transition-colors ${v===te.value?"border-green-600 bg-green-900/30 text-green-400":"border-white/10 text-white/50 hover:border-white/20"}`,children:te.label},te.value))})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Reports To"}),c.jsxs("select",{value:k,onChange:te=>C(te.target.value),className:"w-full p-2.5 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 focus:outline-none focus:border-white/25 transition-colors",children:[c.jsx("option",{value:"ceo",className:"bg-[var(--wall)] text-white",children:"CEO"}),t.map(te=>c.jsxs("option",{value:te.id,className:"bg-[var(--wall)] text-white",children:[te.name," (",te.id,")"]},te.id))]})]})]}),u===2&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Persona"}),c.jsx("textarea",{ref:z,value:E,onChange:te=>M(te.target.value),placeholder:"Describe this role's personality, expertise, and working style...",className:"w-full h-32 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),c.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"This defines how the AI agent will behave in this role"})]}),ne.length>0&&c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Skills"}),c.jsx("div",{className:"space-y-1.5 max-h-[120px] overflow-y-auto",children:ne.map(te=>c.jsxs("label",{className:"flex items-center gap-2 p-2 rounded-lg border border-white/10 bg-white/5 cursor-pointer hover:border-white/20 transition-colors",children:[c.jsx("input",{type:"checkbox",checked:L.has(te.id),onChange:()=>$(ve=>{const Ce=new Set(ve);return Ce.has(te.id)?Ce.delete(te.id):Ce.add(te.id),Ce}),className:"accent-green-600"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"text-xs font-semibold text-white/80",children:te.name}),c.jsx("div",{className:"text-[10px] text-white/40 truncate",children:te.description})]})]},te.id))})]})]}),u===3&&c.jsx("div",{className:"customize-body",style:{padding:0},children:c.jsx(fg,{roleId:"default",appearance:H,onChange:B,onRandomize:()=>B(gs()),onReset:()=>B(gs()),label:c.jsxs("span",{children:[h||"new-role"," — ",m||"New Role"]})})}),u===4&&c.jsxs("div",{className:"space-y-3",children:[c.jsx("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Review"}),c.jsxs("div",{className:"bg-white/5 rounded-xl p-4 border border-white/10",children:[c.jsxs("div",{className:"flex gap-4",children:[c.jsx("div",{className:"flex-shrink-0 rounded-lg overflow-hidden",style:{background:"#0d1117",padding:8},children:c.jsx(Mc,{roleId:"default",appearance:H,scale:4})}),c.jsxs("div",{className:"flex-1 space-y-2.5",children:[c.jsx(xs,{label:"Name",value:m}),c.jsx(xs,{label:"ID",value:h,mono:!0}),c.jsx(xs,{label:"Level",value:v}),c.jsx(xs,{label:"Reports To",value:k}),L.size>0&&c.jsx(xs,{label:"Skills",value:[...L].join(", ")})]})]}),c.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[c.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Persona"}),c.jsx("div",{className:"text-xs text-white/60 leading-relaxed",children:E})]})]}),Y&&c.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:Y})]})]}):c.jsxs(c.Fragment,{children:[X==="input"&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Roles (one per line)"}),c.jsx("textarea",{ref:_,value:ee,onChange:te=>ae(te.target.value),placeholder:`Name, Level, ReportsTo
|
|
82
|
-
e.g.
|
|
83
|
-
Data Analyst
|
|
84
|
-
DevOps Engineer, member, cto
|
|
85
|
-
VP Marketing, c-level, ceo`,className:"w-full h-40 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors font-mono"}),c.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Format: Name, Level (member/team-lead/c-level), ReportsTo. Level and ReportsTo are optional."})]}),A.length>0&&c.jsxs("div",{children:[c.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Preview (",A.length," role",A.length!==1?"s":"",")"]}),c.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden",children:c.jsxs("table",{className:"w-full text-xs",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-white/10",children:[c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),c.jsx("tbody",{children:A.map((te,ve)=>c.jsxs("tr",{className:`border-b border-white/5 ${te.error?"bg-red-900/10":""}`,children:[c.jsx("td",{className:"p-2 text-white/80",children:te.name}),c.jsx("td",{className:"p-2 text-white/60 font-mono",children:te.id}),c.jsx("td",{className:"p-2 text-white/60",children:te.level}),c.jsx("td",{className:"p-2 text-white/60",children:te.reportsTo}),te.error&&c.jsx("td",{className:"p-2 text-red-400 text-[10px]",children:te.error})]},ve))})]})})]})]}),X==="review"&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Confirm Bulk Hire — ",A.length," roles"]}),c.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden max-h-[300px] overflow-y-auto",children:c.jsxs("table",{className:"w-full text-xs",children:[c.jsx("thead",{className:"sticky top-0 bg-[var(--wall)]",children:c.jsxs("tr",{className:"border-b border-white/10",children:[c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"#"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),c.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),c.jsx("tbody",{children:A.map((te,ve)=>c.jsxs("tr",{className:"border-b border-white/5",children:[c.jsx("td",{className:"p-2 text-white/30",children:ve+1}),c.jsx("td",{className:"p-2 text-white/80",children:te.name}),c.jsx("td",{className:"p-2 text-white/60 font-mono",children:te.id}),c.jsx("td",{className:"p-2 text-white/60",children:te.level}),c.jsx("td",{className:"p-2 text-white/60",children:te.reportsTo})]},ve))})]})}),U&&Q.total>0&&c.jsxs("div",{children:[c.jsxs("div",{className:"flex justify-between text-[10px] text-white/40 mb-1",children:[c.jsx("span",{children:"Hiring..."}),c.jsxs("span",{children:[Q.done,"/",Q.total]})]}),c.jsx("div",{className:"h-1.5 bg-white/10 rounded-full overflow-hidden",children:c.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Q.done/Q.total*100}%`,background:"#2E7D32"}})})]}),c.jsx("div",{className:"text-[10px] text-white/30",children:"Each role will get a random appearance and auto-generated persona. You can customize them later."}),Y&&c.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:Y})]})]})}),c.jsxs("div",{className:"flex justify-between px-5 pb-5",children:[c.jsxs("div",{children:[i==="single"&&u>1&&c.jsx("button",{onClick:()=>f(u-1),className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Back"}),i==="bulk"&&X==="review"&&c.jsx("button",{onClick:()=>I("input"),disabled:U,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer disabled:opacity-40",children:"Back"})]}),c.jsxs("div",{className:"flex gap-3",children:[c.jsx("button",{onClick:l,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),i==="single"?u<ms?c.jsx("button",{onClick:()=>f(u+1),disabled:!oe(u),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:"Next"}):c.jsx("button",{onClick:Be,disabled:U,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:U?"Hiring...":"HIRE"}):X==="input"?c.jsxs("button",{onClick:()=>I("review"),disabled:!pe,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:["Review (",A.length,")"]}):c.jsx("button",{onClick:K,disabled:U,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:U?`Hiring ${Q.done}/${Q.total}...`:`HIRE ALL (${A.length})`})]})]})]})]})}function xs({label:t,value:l,mono:a}){return c.jsxs("div",{className:"flex justify-between text-sm",children:[c.jsx("span",{className:"text-white/40",children:t}),c.jsx("span",{className:`font-semibold text-white/80 ${a?"font-mono":""}`,children:l})]})}function fC({roleId:t,roleName:l,onClose:a,onConfirm:i}){const[o,u]=S.useState(!1),f=async()=>{u(!0);try{await i(t)}finally{u(!1)}};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:a}),c.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[480px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[c.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[c.jsx("div",{className:"text-lg font-bold",children:"Fire Role"}),c.jsxs("div",{className:"text-sm opacity-80 mt-0.5",children:["Remove ",l," (",t,")"]})]}),c.jsxs("div",{className:"p-5",children:[c.jsxs("div",{className:"p-4 rounded-lg border-2 border-red-300 bg-red-50 mb-4",children:[c.jsx("div",{className:"text-sm font-bold text-red-800 mb-1",children:"Warning"}),c.jsxs("div",{className:"text-xs text-red-700 leading-relaxed",children:["This will permanently delete the role directory including",c.jsx("strong",{children:" role.yaml"}),", ",c.jsx("strong",{children:"profile.md"}),", ",c.jsx("strong",{children:"SKILL.md"}),", and all journal entries. This action cannot be undone."]})]}),c.jsxs("div",{className:"text-sm text-gray-600",children:["Are you sure you want to fire ",c.jsx("strong",{children:l}),"?"]})]}),c.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[c.jsx("button",{onClick:a,className:"px-4 py-2 text-sm rounded-lg border border-gray-300 hover:bg-gray-50 cursor-pointer",children:"Cancel"}),c.jsx("button",{onClick:f,disabled:o,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#B71C1C"},children:o?"Removing...":"Confirm Fire"})]})]})]})}const dC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function hC({roleId:t,title:l,roleColor:a,active:i,onClick:o,onClose:u,"data-session-id":f}){return c.jsxs("button",{onClick:o,"data-session-id":f,className:`flex items-center gap-1.5 px-3 py-1.5 text-[11px] rounded-t-lg shrink-0 cursor-pointer transition-colors max-w-[180px] group ${i?"bg-[var(--terminal-bg)] text-[var(--terminal-text)]":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] hover:bg-[var(--terminal-surface)]"}`,style:i?{borderTop:`2px solid ${a}`}:void 0,children:[c.jsx("span",{className:"text-xs",children:dC[t]??"👤"}),c.jsx("span",{className:"truncate",children:l}),c.jsx("span",{onClick:u,className:"ml-auto text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none",children:"×"})]})}function mC({content:t,streaming:l}){let a=t;return l&&(t.match(/```/g)??[]).length%2!==0&&(a+="\n```"),c.jsx("div",{className:"terminal-markdown",children:c.jsx(by,{remarkPlugins:[Yy],components:{code:xC,table:({children:i})=>c.jsx("div",{className:"overflow-x-auto my-2",children:c.jsx("table",{className:"terminal-table",children:i})})},children:a})})}function xC({className:t,children:l,...a}){const i=/language-(\w+)/.exec(t??"");return i||typeof l=="string"&&l.includes(`
|
|
86
|
-
`)?c.jsx(pC,{language:i==null?void 0:i[1],children:l}):c.jsx("code",{className:"terminal-inline-code",...a,children:l})}function pC({children:t,language:l}){const[a,i]=S.useState(!1),o=String(t).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(o),i(!0),setTimeout(()=>i(!1),1500)};return c.jsxs("div",{className:"terminal-code-block group relative my-2",children:[l&&c.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] px-3 pt-1.5",children:l}),c.jsx("button",{onClick:u,className:"absolute top-1.5 right-2 text-[10px] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:a?"Copied!":"Copy"}),c.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:c.jsx("code",{children:o})})]})}const yC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function yd(t,l){return l?l.file_path?String(l.file_path).replace(/^.*\/(?=[^/]+\/)/,""):l.path?String(l.path).replace(/^.*\/(?=[^/]+\/)/,""):l.pattern?String(l.pattern):l.command?String(l.command).slice(0,60):l.query?String(l.query).slice(0,60):l.url?String(l.url).slice(0,60):"":""}function gC(t){const l=[];let a="";for(const i of t)if(i.type==="thinking")i.text&&(a=i.text),l.length===0||l[l.length-1].type!=="thinking"?l.push({type:"thinking",text:i.text}):l[l.length-1].text=i.text;else if(i.type==="tool")l.push({type:"tool",toolName:i.toolName,toolSummary:yd(i.toolName??"",i.toolInput),toolInput:i.toolInput});else if(i.type==="dispatch")l.push({type:"dispatch",roleId:i.roleId,task:i.task});else if(i.type==="dispatch:progress"){const o=l.length>0?l[l.length-1]:null;(o==null?void 0:o.type)==="dispatch:progress"&&o.roleId===i.roleId?i.progressType==="tool"?(o.toolName=i.toolName,o.toolSummary=yd(i.toolName??"",i.toolInput),o.progressType="tool"):i.progressType==="thinking"?(o.text=i.text,o.progressType="thinking"):i.progressType==="text"?(o.text=i.text,o.progressType="text"):(i.progressType==="done"||i.progressType==="error")&&(o.progressType=i.progressType):l.push({type:"dispatch:progress",roleId:i.roleId,progressType:i.progressType,text:i.text,toolName:i.toolName,toolSummary:i.toolName?yd(i.toolName,i.toolInput):void 0})}if(a){const i=l.filter(o=>o.type==="thinking");i.length>0&&(i[i.length-1].text=a)}return l}function bC({event:t,isStreaming:l}){var o,u,f;const[a,i]=S.useState(!1);switch(t.type){case"thinking":return c.jsxs("div",{className:"stream-event-thinking",children:[c.jsxs("div",{className:"stream-event-thinking-header",onClick:()=>i(!a),children:[c.jsx("span",{className:"stream-event-thinking-icon"}),c.jsxs("span",{className:"stream-event-thinking-label",children:["thinking",l?"...":""]}),t.text&&!l&&c.jsx("span",{className:"stream-event-thinking-toggle",children:a?"▾":"▸"})]}),(l||a)&&t.text&&c.jsx("div",{className:"stream-event-thinking-content",children:t.text.slice(-500)})]});case"tool":return c.jsxs("div",{className:"stream-event-tool",children:[c.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&c.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary}),t.toolInput&&c.jsx("span",{className:"stream-event-tool-toggle",onClick:()=>i(!a),children:a?"▾":"▸"}),a&&t.toolInput&&c.jsx("div",{className:"stream-event-tool-detail",children:JSON.stringify(t.toolInput,null,1).slice(0,300)})]});case"dispatch":return c.jsxs("div",{className:"stream-event-dispatch",children:[c.jsxs("span",{className:"stream-event-dispatch-badge",children:["→"," ",(o=t.roleId)==null?void 0:o.toUpperCase()]}),c.jsx("span",{className:"stream-event-dispatch-task",children:(u=t.task)==null?void 0:u.slice(0,80)})]});case"dispatch:progress":return c.jsxs("div",{className:"stream-event-dispatch-progress",children:[c.jsx("span",{className:"stream-event-dispatch-progress-role",children:(f=t.roleId)==null?void 0:f.toUpperCase()}),t.progressType==="thinking"&&c.jsxs("span",{className:"stream-event-dispatch-progress-status",children:["thinking",l?"...":""]}),t.progressType==="tool"&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&c.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary})]}),t.progressType==="text"&&t.text&&c.jsx("span",{className:"stream-event-dispatch-progress-status",children:"responding..."}),t.progressType==="done"&&c.jsx("span",{className:"stream-event-dispatch-progress-done",children:"done"}),t.progressType==="error"&&c.jsx("span",{className:"stream-event-dispatch-progress-error",children:"error"})]});default:return null}}function vC({events:t,isStreaming:l}){const[a,i]=S.useState(!1);if(t.length===0)return null;const o=gC(t);if(o.length===0)return null;const u=t.filter(b=>b.type==="thinking").length,f=t.filter(b=>b.type==="tool"),m=t.filter(b=>b.type==="dispatch"||b.type==="dispatch:progress"),p=t.filter(b=>b.type==="turn").reduce((b,v)=>Math.max(b,v.turn??0),0),h=[];if(u>0&&h.push("thinking"),f.length>0){const b=[...new Set(f.map(v=>v.toolName))];b.length<=3?h.push(b.join(", ")):h.push(`${f.length} tool calls`)}m.length>0&&h.push(`${m.length} dispatch`),p>1&&h.push(`${p} turns`);const g=h.join(" · "),y=!a;return c.jsxs("div",{className:"stream-activity-log",children:[c.jsxs("div",{className:"stream-activity-header",onClick:()=>i(!a),children:[l&&c.jsx("span",{className:"stream-activity-pulse"}),c.jsxs("span",{className:"stream-activity-summary",children:[a?"▸":"▾"," ",g,l?"...":""]})]}),y&&c.jsx("div",{className:"stream-activity-events",children:o.map((b,v)=>c.jsx(bC,{event:b,isStreaming:l&&v===o.length-1},v))})]})}function wC({message:t,roleId:l,roleColor:a}){var h;const i=t.from==="ceo",o=t.type==="system",u=t.status==="streaming";if(o)return c.jsx("div",{className:"flex justify-center my-2",children:c.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] bg-[var(--terminal-inline-bg)] px-3 py-1 rounded-full",children:t.content})});if(i)return c.jsx("div",{className:"flex justify-end mb-3",children:c.jsxs("div",{className:"max-w-[85%]",children:[c.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] text-right mb-1",children:"CEO"}),c.jsxs("div",{className:"bg-[var(--terminal-surface-light)] rounded-xl rounded-tr-sm px-4 py-2.5 text-sm text-[var(--terminal-text)] leading-relaxed",children:[t.type==="directive"&&c.jsx("span",{className:"text-amber-400 text-[10px] font-bold mr-1.5",children:"DO"}),t.content]})]})});const f=(((h=t.streamEvents)==null?void 0:h.length)??0)>0,m=!!t.thinking,p=m&&!t.content&&u&&!f;return c.jsxs("div",{className:"flex gap-2.5 mb-3",children:[c.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center text-sm shrink-0 mt-5",style:{background:`${a}33`},children:yC[l]??"👤"}),c.jsxs("div",{className:"max-w-[85%] min-w-0",children:[c.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] mb-1",children:l.toUpperCase()}),f&&c.jsx(vC,{events:t.streamEvents,isStreaming:u}),m&&!f&&c.jsxs("details",{open:p,className:"mb-1",children:[c.jsxs("summary",{className:"text-[10px] text-purple-400/70 cursor-pointer select-none flex items-center gap-1",children:[p&&c.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-purple-400 animate-pulse"}),"thinking",p?"...":` (${t.thinking.length} chars)`]}),c.jsx("div",{className:"text-[11px] text-[var(--terminal-text-muted)] leading-relaxed mt-1 pl-2 border-l border-purple-400/20 max-h-32 overflow-y-auto",children:t.thinking.slice(-500)})]}),c.jsxs("div",{className:"rounded-xl rounded-tl-sm px-4 py-2.5 text-sm text-[var(--terminal-text)] leading-relaxed",style:{borderLeft:`3px solid ${a}`,background:"var(--terminal-surface)"},children:[t.content?c.jsx(mC,{content:t.content,streaming:u}):u&&!m?c.jsx("span",{className:"inline-block w-2 h-4 bg-[var(--terminal-text-secondary)] animate-pulse"}):u&&m?c.jsx("span",{className:"text-[11px] text-purple-400/50 italic",children:"analyzing..."}):null,u&&t.content&&c.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-[var(--terminal-text-secondary)] animate-pulse ml-0.5 align-middle"})]}),t.status==="error"&&c.jsx("div",{className:"text-[10px] text-red-400 mt-1",children:"Error occurred"})]})]})}function kC({messages:t,roleId:l,roleColor:a}){var o;const i=S.useRef(null);return S.useEffect(()=>{var u;(u=i.current)==null||u.scrollIntoView({behavior:"smooth"})},[t,(o=t[t.length-1])==null?void 0:o.content]),t.length===0?c.jsxs("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:["Start a conversation with ",l.toUpperCase()]}):c.jsxs("div",{className:"flex-1 overflow-y-auto p-4 terminal-scrollbar",children:[t.map(u=>c.jsx(wC,{message:u,roleId:l,roleColor:a},u.id)),c.jsx("div",{ref:i})]})}function SC({mode:t,onModeChange:l,onSend:a,disabled:i,disabledReason:o}){const[u,f]=S.useState(""),m=S.useRef(null);S.useEffect(()=>{const g=m.current;g&&(g.style.height="0",g.style.height=Math.min(g.scrollHeight,120)+"px")},[u]);const p=()=>{const g=u.trim();!g||i||(a(g),f(""))},h=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),p())};return c.jsxs("div",{className:"border-t border-[var(--terminal-border)] p-3 shrink-0",children:[o&&c.jsx("div",{className:"text-[10px] text-amber-400/70 mb-2 text-center",children:o}),c.jsxs("div",{className:"flex items-end gap-2",children:[c.jsxs("div",{className:"flex rounded-lg overflow-hidden border border-[var(--terminal-border)] shrink-0",children:[c.jsx("button",{onClick:()=>l("talk"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${t==="talk"?"bg-[var(--desk-wood)] text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Talk"}),c.jsx("button",{onClick:()=>l("do"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${t==="do"?"bg-amber-700 text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Do"})]}),c.jsx("textarea",{ref:m,value:u,onChange:g=>f(g.target.value),onKeyDown:h,placeholder:i?"Waiting...":t==="talk"?"Ask something...":"Give a directive...",disabled:i,rows:1,className:"flex-1 bg-[var(--terminal-inline-bg)] border border-[var(--terminal-border)] rounded-lg px-3 py-2 text-sm text-[var(--terminal-text)] placeholder:text-[var(--terminal-text-muted)] resize-none focus:outline-none focus:border-[var(--terminal-border-hover)] disabled:opacity-40 terminal-scrollbar"}),c.jsx("button",{onClick:p,disabled:i||!u.trim(),className:"w-8 h-8 rounded-lg bg-[var(--terminal-surface-light)] text-[var(--terminal-text-secondary)] flex items-center justify-center shrink-0 cursor-pointer hover:bg-[var(--desk-wood)] hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("path",{d:"M22 2L11 13"}),c.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})]})}const jC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},hg={cto:"CTO",cbo:"CBO",pm:"PM",engineer:"Engineer",designer:"Designer",qa:"QA","data-analyst":"Data Analyst"};function p0(t){return new Date(t).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit"})}function CC({msg:t}){const l=jC[t.roleId]??"#888",a=hg[t.roleId]??t.roleId;if(t.type==="dispatch"){const i=t.text.includes("WAVE"),o=t.text.includes("completed")||t.text.includes("완료"),u=i?"📡":o?"✓":"→",f=o?"text-green-400/70":"text-[var(--terminal-text-muted)]";return c.jsxs("div",{className:"flex items-start gap-2 px-3 py-1 hover:bg-white/[0.02]",children:[c.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:p0(t.ts)}),c.jsx("span",{className:"text-[10px] shrink-0 mt-0.5",children:u}),c.jsx("span",{className:`text-[11px] ${f}`,children:t.text})]})}return c.jsxs("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-white/[0.02]",children:[c.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:p0(t.ts)}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:"text-[11px] font-semibold mr-1.5",style:{color:l},children:a}),c.jsx("span",{className:"text-xs text-[var(--terminal-text-secondary)]",children:t.text})]})]})}function EC({channel:t,allRoles:l,onUpdateMembers:a,onUpdateTopic:i}){const o=S.useRef(null),u=S.useRef(null);S.useEffect(()=>{var j;const b=u.current;if(!b)return;b.scrollHeight-b.scrollTop-b.clientHeight<80&&((j=o.current)==null||j.scrollIntoView({behavior:"smooth"}))},[t.messages.length]);const[f,m]=S.useState(!1),[p,h]=S.useState(!1),[g,y]=S.useState("");return c.jsxs("div",{ref:u,className:"flex-1 overflow-y-auto terminal-scrollbar py-2",children:[c.jsxs("div",{className:"px-3 py-2 mb-2 border-b border-[var(--terminal-border)] flex items-center gap-2",children:[c.jsx("span",{className:"text-sm font-semibold text-[var(--terminal-text)]",children:t.name}),t.members.length>0&&c.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.members.map(b=>hg[b]??b).join(", ")}),t.members.length===0&&c.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.isDefault?"system logs":"no members"}),!t.isDefault&&l&&a&&c.jsx("button",{className:"ml-auto text-[10px] px-2 py-0.5 rounded bg-white/5 hover:bg-white/10 text-[var(--terminal-text-muted)]",onClick:()=>m(!f),children:f?"Done":"Invite"})]}),!t.isDefault&&i&&c.jsx("div",{className:"px-3 pb-2 mb-1",children:p?c.jsx("input",{autoFocus:!0,value:g,onChange:b=>y(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(i(t.id,g.trim()),h(!1)),b.key==="Escape"&&h(!1)},onBlur:()=>{i(t.id,g.trim()),h(!1)},placeholder:"Set a topic for this channel...",className:"w-full bg-transparent text-[10px] text-[var(--terminal-text-muted)] outline-none border-b border-[var(--terminal-border)] pb-0.5"}):c.jsx("button",{onClick:()=>{y(t.topic??""),h(!0)},className:"text-[10px] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] cursor-pointer italic",children:t.topic||"Click to set channel topic..."})}),f&&!t.isDefault&&l&&a&&c.jsx("div",{className:"px-3 pb-2 mb-2 border-b border-[var(--terminal-border)]",children:c.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(b=>{const v=t.members.includes(b.id);return c.jsxs("button",{className:`text-[10px] px-2 py-1 rounded ${v?"bg-white/15 text-[var(--terminal-text)]":"bg-white/5 text-[var(--terminal-text-muted)]"}`,onClick:()=>{const j=v?t.members.filter(k=>k!==b.id):[...t.members,b.id];a(t.id,j)},children:[v?"✓ ":"",b.name]},b.id)})})}),t.messages.length===0&&c.jsx("div",{className:"flex-1 flex flex-col items-center justify-center text-[var(--terminal-text-muted)] text-xs gap-1 py-8",children:c.jsx("span",{children:t.isDefault?"No dispatch events yet":"No messages yet — invite roles to start chatting"})}),t.messages.map(b=>c.jsx(CC,{msg:b},b.id)),c.jsx("div",{ref:o})]})}const gd={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},NC=400,AC=800;function DC({sessions:t,activeSessionId:l,roles:a,streamingSessionId:i,width:o,onWidthChange:u,onSwitchSession:f,onCloseSession:m,onCreateSession:p,onClearEmpty:h,onCloseAll:g,onSendMessage:y,onModeChange:b,onCloseTerminal:v,chatChannels:j,activeChatChannelId:k,onSwitchChatChannel:C,onCreateChatChannel:E,onDeleteChatChannel:M,onUpdateChatMembers:H,onUpdateChatTopic:B,unreadChannels:U}){const[D,Y]=S.useState(!1),[V,ne]=S.useState(!1),[T,L]=S.useState(!1),[$,ee]=S.useState(""),ae=k!=null,X=j==null?void 0:j.find(K=>K.id===k),[I,Q]=S.useState(!1),[ie,Se]=S.useState(!1),[z,_]=S.useState(!1),P=S.useRef(0),A=S.useRef(0),pe=S.useRef(null),Ee=t.find(K=>K.id===l),Ne=i===l,Oe=t.filter(K=>K.messages.length===0).length,Be=S.useCallback(()=>{const K=pe.current;K&&(Se(K.scrollLeft>0),_(K.scrollLeft+K.clientWidth<K.scrollWidth-1))},[]);S.useEffect(()=>{if(!l||!pe.current)return;const K=pe.current.querySelector(`[data-session-id="${l}"]`);K&&K.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),Be()},[l,t.length,Be]),S.useEffect(()=>{const K=pe.current;if(!K)return;Be(),K.addEventListener("scroll",Be);const ue=new ResizeObserver(Be);return ue.observe(K),()=>{K.removeEventListener("scroll",Be),ue.disconnect()}},[Be]);const oe=S.useCallback(K=>{K.preventDefault(),P.current=K.clientX,A.current=o,Q(!0);const ue=te=>{const ve=P.current-te.clientX,Ce=Math.min(AC,Math.max(NC,A.current+ve));u==null||u(Ce)},je=()=>{Q(!1),document.removeEventListener("mousemove",ue),document.removeEventListener("mouseup",je)};document.addEventListener("mousemove",ue),document.addEventListener("mouseup",je)},[o,u]);return c.jsxs("div",{className:"shrink-0 bg-[var(--terminal-bg)] border-l border-[var(--terminal-border)] flex flex-col h-full relative",style:{width:o},children:[u&&c.jsx("div",{className:`terminal-resize-handle absolute top-0 left-0 w-1 h-full cursor-col-resize z-10 transition-colors ${I?"bg-[var(--terminal-border-hover)]":"bg-transparent"}`,onMouseDown:oe}),c.jsxs("div",{className:"flex items-center bg-[var(--terminal-bg-deeper)] border-b border-[var(--terminal-border)] shrink-0",children:[c.jsxs("div",{className:"relative flex-1 min-w-0",children:[ie&&c.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-6 bg-gradient-to-r from-[var(--terminal-bg-deeper)] to-transparent z-10 pointer-events-none"}),c.jsxs("div",{ref:pe,className:"flex items-center overflow-x-auto terminal-tab-scroll gap-px px-1 py-1",children:[j==null?void 0:j.map(K=>c.jsxs("button",{onClick:()=>{C==null||C(K.id)},className:`flex items-center gap-1 px-2.5 py-1.5 text-[11px] rounded-t-lg shrink-0 cursor-pointer transition-colors group ${k===K.id?"bg-[var(--terminal-bg)] text-[var(--terminal-text)]":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface)]"}`,style:k===K.id?{borderTop:"2px solid #4CAF50"}:void 0,children:[c.jsx("span",{className:"text-[10px]",children:"💬"}),c.jsx("span",{className:"truncate",children:K.name}),(U==null?void 0:U.has(K.id))&&k!==K.id&&c.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 shrink-0"}),!K.isDefault&&c.jsx("span",{onClick:ue=>{ue.stopPropagation(),M==null||M(K.id)},className:"ml-1 text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none opacity-0 group-hover:opacity-100",children:"×"})]},K.id)),j&&j.length>0&&t.length>0&&c.jsx("div",{className:"w-px h-4 bg-[var(--terminal-border)] shrink-0 mx-1"}),t.map(K=>c.jsx(hC,{roleId:K.roleId,title:K.title,roleColor:gd[K.roleId]??"#666",active:!ae&&K.id===l,onClick:()=>{C==null||C(null),f(K.id)},onClose:ue=>{ue.stopPropagation(),m(K.id)},"data-session-id":K.id},K.id))]}),z&&c.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-6 bg-gradient-to-l from-[var(--terminal-bg-deeper)] to-transparent z-10 pointer-events-none"})]}),c.jsxs("div",{className:"relative shrink-0",children:[c.jsx("button",{onClick:()=>{Y(!D),ne(!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:"+"}),D&&c.jsxs("div",{className:"absolute top-full right-0 mt-1 bg-[var(--terminal-surface)] border border-[var(--terminal-border)] rounded-lg shadow-xl z-50 py-1 min-w-[200px]",children:[E&&c.jsxs(c.Fragment,{children:[T?c.jsxs("div",{className:"px-3 py-2 flex items-center gap-1",children:[c.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:"#"}),c.jsx("input",{autoFocus:!0,value:$,onChange:K=>ee(K.target.value),onKeyDown:K=>{K.key==="Enter"&&$.trim()&&(E($.trim(),[]),ee(""),L(!1),Y(!1)),K.key==="Escape"&&(L(!1),ee(""))},placeholder:"channel name",className:"flex-1 bg-transparent text-xs text-[var(--terminal-text)] outline-none border-b border-[var(--terminal-border)]"})]}):c.jsxs("button",{onClick:()=>L(!0),className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer flex items-center gap-2",children:[c.jsx("span",{className:"text-[10px]",children:"💬"}),"New Channel"]}),c.jsx("div",{className:"border-b border-[var(--terminal-border)] my-1"})]}),a.map(K=>c.jsxs("button",{onClick:()=>{p(K.id),C==null||C(null),Y(!1)},className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer flex items-center gap-2",children:[c.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:gd[K.id]??"#666"}}),K.id.toUpperCase()," — ",K.name]},K.id))]})]}),c.jsxs("div",{className:"relative shrink-0",children:[c.jsx("button",{onClick:()=>{ne(!V),Y(!1)},className:"w-7 h-7 flex items-center justify-center text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-xs cursor-pointer tracking-tight",title:"Manage sessions",children:"···"}),V&&c.jsxs("div",{className:"absolute top-full right-0 mt-1 bg-[var(--terminal-surface)] border border-[var(--terminal-border)] rounded-lg shadow-xl z-50 py-1 min-w-[200px]",children:[c.jsxs("div",{className:"px-3 py-1.5 text-[10px] text-[var(--terminal-text-muted)] border-b border-[var(--terminal-border)]",children:[t.length," session",t.length!==1?"s":""]}),Oe>0&&h&&c.jsxs("button",{onClick:()=>{h(),ne(!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 (",Oe,")"]}),t.length>0&&g&&c.jsx("button",{onClick:()=>{g(),ne(!1)},className:"w-full text-left px-3 py-2 text-xs text-[#E57373] hover:bg-[var(--terminal-surface-light)] cursor-pointer",children:"Close all sessions"}),t.length===0&&c.jsx("div",{className:"px-3 py-2 text-xs text-[var(--terminal-text-muted)]",children:"No sessions"})]})]}),c.jsx("button",{onClick:v,className:"px-2 py-1 text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm cursor-pointer shrink-0",children:"×"})]}),ae&&X?c.jsx(EC,{channel:X,allRoles:a,onUpdateMembers:H,onUpdateTopic:B}):Ee?c.jsxs(c.Fragment,{children:[c.jsx(kC,{messages:Ee.messages,roleId:Ee.roleId,roleColor:gd[Ee.roleId]??"#666"}),c.jsx(SC,{mode:Ee.mode,onModeChange:K=>b(Ee.id,K),onSend:K=>y(Ee.id,K,Ee.mode),disabled:Ne,disabledReason:Ne?`${Ee.roleId.toUpperCase()} is responding...`:void 0})]}):c.jsx("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:"No active session. Click [+] to start."})]})}function TC(){const t=S.useRef(null),l=S.useCallback(()=>{var i;(i=t.current)==null||i.abort(),t.current=null},[]);return{sendMessage:S.useCallback((i,o,u,f)=>{l();const m=new AbortController;return t.current=m,fetch(`/api/exec/session/${i}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:o,mode:u}),signal:m.signal}).then(async p=>{var b,v,j,k,C;if(!p.ok||!p.body){f.onError("Failed to connect");return}const h=p.body.getReader(),g=new TextDecoder;let y="";for(;;){const{done:E,value:M}=await h.read();if(E)break;y+=g.decode(M,{stream:!0});const H=y.split(`
|
|
87
|
-
`);y=H.pop()??"";let B="";for(let U=0;U<H.length;U++){const D=H[U];if(D.startsWith("event: ")){B=D.slice(7).trim();continue}if(D.startsWith("data: ")){let Y;try{Y=JSON.parse(D.slice(6))}catch{B="";continue}switch(B){case"thinking":Y.text&&((b=f.onThinking)==null||b.call(f,Y.text));break;case"output":Y.text&&f.onText(Y.text);break;case"tool":(v=f.onToolUse)==null||v.call(f,Y.name,Y.input);break;case"dispatch":(j=f.onDispatch)==null||j.call(f,Y.roleId,Y.task);break;case"dispatch:progress":(k=f.onDispatchProgress)==null||k.call(f,Y.roleId,Y.type,Y);break;case"turn":(C=f.onTurn)==null||C.call(f,Y.turn);break;case"done":f.onDone(Y);break;case"error":f.onError(Y.message??"Unknown error");break;default:Y.text&&f.onText(Y.text);break}B=""}}}}).catch(p=>{p.name!=="AbortError"&&f.onError(p.message)}),{abort:l}},[l]),abort:l}}const yh="tycono-appearances",Sc="tycono-theme";(()=>{try{for(const[t,l]of[["the-company-appearances",yh],["the-company-theme",Sc]]){const a=localStorage.getItem(t);a&&!localStorage.getItem(l)&&(localStorage.setItem(l,a),localStorage.removeItem(t))}}catch{}})();function y0(){try{const t=localStorage.getItem(yh);return t?JSON.parse(t):{}}catch{return{}}}function bd(t){localStorage.setItem(yh,JSON.stringify(t))}function g0(){try{const t=localStorage.getItem(Sc);if(t&&t in Fa)return t}catch{}return"default"}function zC(t){var i;const l=(i=Fa[t])==null?void 0:i.vars;if(!l)return;const a=document.documentElement;for(const[o,u]of Object.entries(l))a.style.setProperty(o,u)}const vd={mode:"auto",intervalSec:18,dailyBudgetUsd:1},qd="tycono-speech-settings",wd="tycono-language";function MC(){try{const t=localStorage.getItem(qd);return t?{...vd,...JSON.parse(t)}:vd}catch{return vd}}function _C(){const[t,l]=S.useState(y0),[a,i]=S.useState(g0),[o,u]=S.useState(MC),[f,m]=S.useState(()=>{try{return localStorage.getItem(wd)??"auto"}catch{return"auto"}}),p=S.useRef(!1);S.useEffect(()=>{p.current||(p.current=!0,Te.getPreferences().then(k=>{const C=Object.keys(k.appearances??{}).length>0||k.theme!=="default";if(k.speech&&(u(E=>({...E,...k.speech})),localStorage.setItem(qd,JSON.stringify(k.speech))),k.language&&(m(k.language),localStorage.setItem(wd,k.language)),C){const E=k.appearances;l(E),bd(E),k.theme&&k.theme in Fa&&(i(k.theme),localStorage.setItem(Sc,k.theme))}else{const E=y0(),M=g0();(Object.keys(E).length>0||M!=="default")&&Te.updatePreferences({appearances:E,theme:M}).catch(()=>{})}}).catch(()=>{}))},[]),S.useEffect(()=>{zC(a)},[a]);const h=S.useCallback(k=>t[k]??ph(k),[t]),g=S.useCallback((k,C)=>{l(E=>{const M={...E,[k]:C};return bd(M),Te.updatePreferences({appearances:M}).catch(()=>{}),M})},[]),y=S.useCallback(k=>{l(C=>{const E={...C};return delete E[k],bd(E),Te.updatePreferences({appearances:E}).catch(()=>{}),E})},[]),b=S.useCallback(k=>{i(k),localStorage.setItem(Sc,k),Te.updatePreferences({theme:k}).catch(()=>{})},[]),v=S.useCallback(k=>{u(C=>{const E={...C,...k};return localStorage.setItem(qd,JSON.stringify(E)),Te.updatePreferences({speech:E}).catch(()=>{}),E})},[]),j=S.useCallback(k=>{m(k),localStorage.setItem(wd,k),Te.updatePreferences({language:k}).catch(()=>{})},[]);return{appearances:t,getAppearance:h,setAppearance:g,resetAppearance:y,theme:a,setTheme:b,speechSettings:o,setSpeechSettings:v,language:f,setLanguage:j}}const FC=3e4;function RC(){var j;const[t,l]=S.useState(null),[a,i]=S.useState("synced"),[o,u]=S.useState([]),f=S.useRef(null),m=S.useCallback(async()=>{try{const k=await Te.getSaveStatus();l(k),k.noGit?i("no-git"):i(C=>C==="saving"?C:k.dirty?"dirty":"synced")}catch{i("error")}},[]);S.useEffect(()=>(m(),f.current=setInterval(m,FC),()=>{f.current&&clearInterval(f.current)}),[m]);const p=S.useCallback(async k=>{i("saving");try{const C=await Te.save(k);return await m(),C}catch(C){throw i("error"),C}},[m]),h=S.useCallback(async()=>{try{const k=await Te.getSaveHistory(20);u(k)}catch{}},[]),g=S.useCallback(async k=>{i("saving");try{await Te.restoreSave(k),await m()}catch(C){throw i("error"),C}},[m]),y=S.useCallback(async()=>{try{await Te.initGit(),await m()}catch{i("error")}},[m]),b=t?t.modified.length+t.untracked.length:0,v=((j=t==null?void 0:t.lastCommit)==null?void 0:j.date)??null;return{state:a,dirtyCount:b,lastSaved:v,status:t,save:p,history:o,loadHistory:h,restore:g,refresh:m,initGit:y}}const b0={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."]},v0={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."]},OC=[{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."}]}],BC=18e3,w0=6e3,LC=2500,$C=30*6e4,mg="tycono:relationships";function HC(){try{const t=localStorage.getItem(mg);return t?JSON.parse(t):[]}catch{return[]}}function UC(t){localStorage.setItem(mg,JSON.stringify(t))}function nc(t,l,a){const[i,o]=l<a?[l,a]:[a,l];let u=t.find(f=>f.roleA===i&&f.roleB===o);return u||(u={roleA:i,roleB:o,dispatches:0,wavesTogether:0,conversations:0,familiarity:0,lastInteraction:new Date().toISOString()},t.push(u)),u}function lc(t){return Math.min(100,t.dispatches*5+t.wavesTogether*10+t.conversations*2)}function ac(t){return t[Math.floor(Math.random()*t.length)]}function IC(t,l,a){const i=a.find(m=>m.id===t),o=a.find(m=>m.id===l);if(!i||!o)return null;const u=i.level==="c-level",f=o.level==="c-level";return u&&f?"c-level":i.reportsTo===l||o.reportsTo===t?"superior-subordinate":(i.reportsTo===o.reportsTo,"peer")}function YC(t,l){return t.relation==="any"?!0:t.relation===l}function qC({roles:t,roleStatuses:l,activeExecs:a,getStandupSpeech:i}){const[o,u]=S.useState(new Map),[f,m]=S.useState(HC),p=S.useRef({}),h=S.useRef(null),g=S.useRef(t),y=S.useRef(l),b=S.useRef(a),v=S.useRef(i),j=S.useRef(f);g.current=t,y.current=l,b.current=a,v.current=i,j.current=f,S.useEffect(()=>{const B=Date.now();for(const[U,D]of Object.entries(l))D==="working"&&(p.current[U]=B)},[l]),S.useEffect(()=>{UC(f)},[f]);const k=S.useCallback(B=>{const U=y.current[B],D=b.current.find(L=>L.roleId===B);if(U==="working"&&(D!=null&&D.task))return null;const Y=v.current(B);if(Y&&Math.random()<.3)return{text:Y,type:"work",ts:Date.now()};const V=Date.now(),ne=p.current[B]??0;if(V-ne>$C&&Math.random()<.5){const L=v0[B]??v0.engineer;return{text:ac(L),type:"guilt",ts:V}}const T=b0[B]??b0.engineer;return{text:ac(T),type:"personality",ts:V}},[]),C=S.useCallback(B=>{if(h.current)return!1;const U=B.filter(Q=>y.current[Q.id]!=="working");if(U.length<2)return!1;const D=[...U].sort(()=>Math.random()-.5),Y=D[0],V=D[1],ne=IC(Y.id,V.id,B);if(!ne)return!1;const T=nc(j.current,Y.id,V.id),L=lc(T),$=OC.filter(Q=>YC(Q,ne)&&L>=Q.minFamiliarity);if($.length===0)return!1;const ee=ac($);let ae=Y.id,X=V.id;ee.relation==="superior-subordinate"&&(V.reportsTo===Y.id||Y.level==="c-level"?(ae=Y.id,X=V.id):(ae=V.id,X=Y.id)),h.current={templateId:ee.id,roleA:ae,roleB:X,turnIdx:0,timer:null};const I=Q=>{if(!h.current||Q>=ee.turns.length){h.current=null,m(_=>{const P=[..._],A=nc(P,ae,X);return A.conversations++,A.familiarity=lc(A),A.lastInteraction=new Date().toISOString(),P}),setTimeout(()=>{u(_=>{const P=new Map(_);return P.delete(ae),P.delete(X),P})},w0);return}const ie=ee.turns[Q],Se=ie.speaker==="A"?ae:X,z=ie.speaker==="A"?X:ae;u(_=>{const P=new Map(_);if(P.set(Se,{text:ie.text,type:"social",partnerId:z,ts:Date.now()}),Q>0){const A=ee.turns[Q-1].speaker==="A"?ae:X;A!==Se&&P.delete(A)}return P}),h.current.turnIdx=Q,h.current.timer=setTimeout(()=>I(Q+1),LC)};return I(0),!0},[]);S.useEffect(()=>{const B=setInterval(()=>{const U=g.current;if(U.length===0||h.current||Math.random()<.35&&C(U))return;const D=U.filter(ne=>y.current[ne.id]!=="working");if(D.length===0)return;const Y=ac(D),V=k(Y.id);V&&(u(ne=>{const T=new Map(ne);return T.set(Y.id,V),T}),setTimeout(()=>{u(ne=>{const T=new Map(ne),L=T.get(Y.id);return L&&L.ts===V.ts&&T.delete(Y.id),T})},w0))},BC);return()=>{var U;clearInterval(B),(U=h.current)!=null&&U.timer&&clearTimeout(h.current.timer)}},[k,C]);const E=S.useCallback(B=>{const U=o.get(B);return(U==null?void 0:U.text)??""},[o]),M=S.useCallback((B,U)=>{m(D=>{const Y=[...D],V=nc(Y,B,U);return V.dispatches++,V.familiarity=lc(V),V.lastInteraction=new Date().toISOString(),Y})},[]),H=S.useCallback(B=>{B.length<2||m(U=>{const D=[...U];for(let Y=0;Y<B.length;Y++)for(let V=Y+1;V<B.length;V++){const ne=nc(D,B[Y],B[V]);ne.wavesTogether++,ne.familiarity=lc(ne),ne.lastInteraction=new Date().toISOString()}return D})},[]);return{speeches:o,getSpeech:E,relationships:f,notifyDispatch:M,notifyWave:H}}const xg="tycono:office-chat";let XC=0;function VC(){return`chat-${Date.now()}-${++XC}`}function kd(){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 GC(){try{const t=localStorage.getItem(xg);if(t){const l=JSON.parse(t);if(l.find(i=>i.id==="office")&&!l.find(i=>i.id==="general")){const i=l.filter(o=>o.id!=="office");return[...kd(),...i]}const a=kd();for(const i of a)l.find(o=>o.id===i.id)||l.unshift(i);return l}}catch{}return kd()}function KC(t){const l=t.map(a=>({...a,messages:a.messages.slice(-200)}));localStorage.setItem(xg,JSON.stringify(l))}function QC(){const[t,l]=S.useState(GC),[a,i]=S.useState(null),[o,u]=S.useState(new Set);S.useEffect(()=>{KC(t)},[t]);const f=S.useCallback(v=>{i(v),v&&u(j=>{const k=new Set(j);return k.delete(v),k})},[]),m=S.useCallback(v=>{const j={...v,id:VC()};l(k=>{const C=k.map(E=>E.id==="general"?v.type==="dispatch"?{...E,messages:[...E.messages,j].slice(-200)}:E:v.channelId?E.id===v.channelId?{...E,messages:[...E.messages,j].slice(-200)}:E:E.members.length>0&&E.members.includes(v.roleId)?{...E,messages:[...E.messages,j].slice(-200)}:E);return u(E=>{const M=new Set(E);for(const H of C){const B=k.find(U=>U.id===H.id);B&&H.messages.length>B.messages.length&&M.add(H.id)}return M}),C})},[]),p=S.useCallback((v,j,k)=>{const C=`ch-${Date.now()}`,E={id:C,name:v.startsWith("#")?v:`#${v}`,members:j,isDefault:!1,messages:[],topic:k};l(M=>[...M,E]),i(C)},[]),h=S.useCallback(v=>{l(j=>j.filter(k=>k.id!==v||k.isDefault)),i(j=>j===v?"general":j)},[]),g=S.useCallback((v,j)=>{l(k=>k.map(C=>C.id===v&&!C.isDefault?{...C,members:j}:C))},[]),y=S.useCallback((v,j)=>{l(k=>k.map(C=>C.id===v&&!C.isDefault?{...C,topic:j||void 0}:C))},[]),b=S.useCallback(v=>{l(j=>j.map(k=>{if(k.id==="watercooler"){const C=v.filter(E=>E.level!=="c-level").map(E=>E.id);if(k.members.length!==C.length||!C.every(E=>k.members.includes(E)))return{...k,members:C}}return k}))},[]);return{channels:t,activeChannelId:a,setActiveChannelId:f,pushMessage:m,createChannel:p,deleteChannel:h,updateMembers:g,updateTopic:y,unreadChannels:o,syncDefaultMembers:b}}const ZC=45e3,WC=3e3,JC=3,PC=20;function eE({roles:t,roleStatuses:l,activeExecs:a,channels:i,relationships:o,pushMessage:u,speechSettings:f,engineType:m,hasApiKey:p}){const g=((f==null?void 0:f.mode)==="auto"?m==="claude-cli"||m==="local"?"llm":"template":(f==null?void 0:f.mode)??"template")==="llm"&&(p!==!1||m==="claude-cli"),y=((f==null?void 0:f.intervalSec)??ZC/1e3)*1e3,b=S.useRef(t),v=S.useRef(l),j=S.useRef(a),k=S.useRef(i),C=S.useRef(o),E=S.useRef(u),M=S.useRef(0),H=S.useRef(!1);b.current=t,v.current=l,j.current=a,k.current=i,C.current=o,E.current=u;const B=S.useCallback(async(D,Y)=>{if(H.current)return!1;H.current=!0;try{if(!b.current.find(X=>X.id===D))return!1;const ne=Y.messages.slice(-PC).map(X=>({roleId:X.roleId,text:X.text,ts:X.ts})),T=b.current.filter(X=>Y.members.includes(X.id)),L=C.current.filter(X=>X.roleA===D||X.roleB===D).map(X=>({partnerId:X.roleA===D?X.roleB:X.roleA,familiarity:X.familiarity})),$=j.current.find(X=>X.roleId===D),ee=$?{currentTask:$.task,taskProgress:null}:{currentTask:null,taskProgress:null},ae=await Te.chatInChannel({channelId:Y.name.replace("#",""),channelTopic:Y.topic,roleId:D,history:ne,members:T.map(X=>({id:X.id,name:X.name,level:X.level})),relationships:L,workContext:ee});return ae.message?(E.current({ts:Date.now(),roleId:D,text:ae.message,type:"chat",channelId:Y.id}),!0):!1}catch{return!1}finally{H.current=!1}},[]),U=S.useCallback(async(D,Y)=>{if(M.current>=JC){M.current=0;return}const V=D.members.filter(T=>T!==Y&&v.current[T]!=="working");if(V.length===0){M.current=0;return}const ne=V[Math.floor(Math.random()*V.length)];if(Math.random()>.6){M.current=0;return}setTimeout(async()=>{M.current++;const T=k.current.find($=>$.id===D.id);if(!T)return;await B(ne,T)?U(T,ne):M.current=0},WC+Math.random()*2e3)},[B]);S.useEffect(()=>{if(!g)return;const D=setInterval(async()=>{const Y=b.current;if(Y.length===0||H.current)return;const V=Y.filter(ee=>v.current[ee.id]!=="working");if(V.length===0)return;const ne=V[Math.floor(Math.random()*V.length)],T=k.current.filter(ee=>ee.members.length===0?!0:ee.members.includes(ne.id));if(T.length===0)return;const L=T[Math.floor(Math.random()*T.length)];M.current=0,await B(ne.id,L)&&U(L,ne.id)},y);return()=>clearInterval(D)},[g,y,B,U])}function rc({type:t,className:l}){const a=S.useRef(null),i=vS(t);return S.useEffect(()=>{const o=a.current;if(!o||!i)return;const u=o.getContext("2d");u&&kS(u,i)},[t,i]),i?c.jsx("canvas",{ref:a,width:i.canvasWidth,height:i.canvasHeight,className:l,style:{imageRendering:"pixelated",display:"block"}}):null}const pg=[[1,8],[3,5],[8,1],[5,3]],tE=[[1,4],[2,3],[4,1],[3,2]];function ic(t){const l=t===1||t===3?-1:0,a=pg[t],i=t<2?[0,1]:[1,0],o=l;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:a[0],y:13,w:3,h:4,c:"$pants"},{x:a[1],y:13,w:3,h:4,c:"$pants"},{x:a[0]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:a[1]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:a[0],y:16,w:3,h:2,c:"$shoes"},{x:a[1],y:16,w:3,h:2,c:"$shoes"},{x:a[0],y:16,w:3,h:1,c:"lighten($shoes, 25)",a:.4},{x:a[1],y:16,w:3,h:1,c:"lighten($shoes, 25)",a:.4},{x:1,y:o+8,w:10,h:6,c:"$shirt"},{x:2,y:o+8,w:8,h:1,c:"lighten($shirt, 20)",a:.35},{x:1,y:o+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:10,y:o+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:-1,y:o+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:o+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:-1,y:o+12,w:2,h:1,c:"$skin"},{x:11,y:o+12,w:2,h:1,c:"$skin"},{x:4,y:o+6,w:4,h:3,c:"$skin"},{x:1,y:o+0,w:10,h:7,c:"$skin"},{x:3,y:o+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:o+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:o+3,w:1,h:1,c:"#FFF",a:.4},{x:7,y:o+3,w:1,h:1,c:"#FFF",a:.4},{x:5,y:o+6,w:2,h:1,c:"darken($skin, 25)",a:.35},{x:0,y:o+3,w:1,h:1,c:"$skin"},{x:11,y:o+3,w:1,h:1,c:"$skin"},{x:1,y:o+0,w:10,h:3,c:"$hair"},{x:0,y:o+1,w:2,h:3,c:"$hair"},{x:10,y:o+1,w:2,h:3,c:"$hair"},{x:2,y:o+0,w:8,h:1,c:"lighten($hair, 25)",a:.3}]}function sc(t){const l=t===1||t===3?-1:0,a=pg[t],i=t<2?[0,1]:[1,0],o=l;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:a[0],y:13,w:3,h:4,c:"$pants"},{x:a[1],y:13,w:3,h:4,c:"$pants"},{x:a[0],y:16,w:3,h:2,c:"$shoes"},{x:a[1],y:16,w:3,h:2,c:"$shoes"},{x:1,y:o+8,w:10,h:6,c:"$shirt"},{x:2,y:o+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:5,y:o+10,w:2,h:3,c:"darken($shirt, 30)",a:.12},{x:-1,y:o+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:o+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:4,y:o+6,w:4,h:3,c:"$skin"},{x:1,y:o+0,w:10,h:7,c:"$skin"},{x:1,y:o+0,w:10,h:6,c:"$hair"},{x:0,y:o+1,w:2,h:5,c:"$hair"},{x:10,y:o+1,w:2,h:5,c:"$hair"},{x:2,y:o+0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:0,y:o+4,w:1,h:1,c:"$skin",a:.6},{x:11,y:o+4,w:1,h:1,c:"$skin",a:.6}]}function Ta(t,l){const a=t===1||t===3?-1:0,i=tE[t],o=a,u=t%2===0?1:0;return l?[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:i[0],y:13,w:3,h:4,c:"$pants"},{x:i[1],y:13,w:3,h:4,c:"$pants"},{x:i[0],y:16,w:3,h:2,c:"$shoes"},{x:i[1],y:16,w:3,h:2,c:"$shoes"},{x:2,y:o+8,w:8,h:6,c:"$shirt"},{x:2,y:o+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:8,y:o+9+u,w:3,h:4-u,c:"$shirt"},{x:9,y:o+12,w:2,h:1,c:"$skin"},{x:4,y:o+6,w:4,h:3,c:"$skin"},{x:2,y:o+0,w:8,h:7,c:"$skin"},{x:7,y:o+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:o+3,w:1,h:1,c:"#FFF",a:.3},{x:9,y:o+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:o+0,w:8,h:3,c:"$hair"},{x:1,y:o+1,w:2,h:4,c:"$hair"},{x:9,y:o+1,w:2,h:3,c:"$hair"},{x:3,y:o+0,w:6,h:1,c:"lighten($hair, 25)",a:.25}]:[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:i[0],y:13,w:3,h:4,c:"$pants"},{x:i[1],y:13,w:3,h:4,c:"$pants"},{x:i[0],y:16,w:3,h:2,c:"$shoes"},{x:i[1],y:16,w:3,h:2,c:"$shoes"},{x:2,y:o+8,w:8,h:6,c:"$shirt"},{x:2,y:o+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:0,y:o+9+u,w:3,h:4-u,c:"$shirt"},{x:-1,y:o+12,w:2,h:1,c:"$skin"},{x:4,y:o+6,w:4,h:3,c:"$skin"},{x:2,y:o+0,w:8,h:7,c:"$skin"},{x:3,y:o+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:o+3,w:1,h:1,c:"#FFF",a:.3},{x:1,y:o+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:o+0,w:8,h:3,c:"$hair"},{x:1,y:o+1,w:2,h:3,c:"$hair"},{x:9,y:o+1,w:2,h:4,c:"$hair"},{x:3,y:o+0,w:6,h:1,c:"lighten($hair, 25)",a:.25}]}const k0={down:[ic(0),ic(1),ic(2),ic(3)],up:[sc(0),sc(1),sc(2),sc(3)],right:[Ta(0,!0),Ta(1,!0),Ta(2,!0),Ta(3,!0)],left:[Ta(0,!1),Ta(1,!1),Ta(2,!1),Ta(3,!1)]},Ie=4,Nt=28,ln=2,st=4,Je=4,Zl=[{wallColor:"#C8B898",baseboardColor:"#6A5840",floorType:"wood"},{wallColor:"#A8B8C8",baseboardColor:"#586878",floorType:"dark"},{wallColor:"#A8C8B0",baseboardColor:"#4A6A50",floorType:"carpet"},{wallColor:"#C8C0A8",baseboardColor:"#7A6A50",floorType:"tile"}];function gh(t,l,a){const u=t.fy+Math.max(10,Math.floor(t.fh*.18)),f=Math.min(l,a),m=Math.ceil(l/f),p=[],h=f*28,g=t.fx+Math.max(8,Math.floor((t.fw-h)/2));for(let y=0;y<m&&p.length<l;y++){const b=Math.min(f,l-y*f);for(let v=0;v<b;v++)p.push({dx:g+v*28,dy:u+y*28,room:t.id})}return p}function nE(t){const i=Zl[0],o={id:"main",wx:Ie+Je,wy:Ie,ww:160-2*(Ie+Je),wh:Nt,fx:Ie+Je,fy:Ie+Nt+ln,fw:160-2*(Ie+Je),fh:120-Ie-Nt-ln-Ie,...i},u=gh(o,Math.min(t,6),3),f=[{id:"s-window-l",type:"window",room:"main",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"s-window-r",type:"window",room:"main",zone:"wall",anchorX:"right",offsetX:-26,offsetY:6,windowW:16,windowH:14},{id:"s-clock",type:"clock",room:"main",zone:"wall",offsetX:Math.floor((160-2*(Ie+Je))/2),offsetY:10}],m=[{id:"s-plant-l",type:"plant",room:"main",zone:"floor",offsetX:4,offsetY:4},{id:"s-plant-r",type:"plant",room:"main",zone:"floor",anchorX:"right",offsetX:-8,offsetY:4}];return{preset:"S",canvasW:160,canvasH:120,rooms:{main:o},desks:u,doors:{},adjacency:{main:[]},corridorY:{main:o.fy+o.fh-12},waypoints:{main:[{x:o.fx+10,y:o.fy+o.fh-14},{x:o.fx+o.fw/2,y:o.fy+o.fh-14},{x:o.fx+o.fw-10,y:o.fy+o.fh-14}]},wallDecorations:f,furniture:m}}function lE(t){const o={id:"exec",wx:Ie+Je,wy:Ie,ww:144-Ie-Je-st/2,wh:Nt,fx:Ie+Je,fy:Ie+Nt+ln,fw:144-Ie-Je-st/2,fh:66,...Zl[0]},u={id:"work",wx:144+st/2+Je,wy:Ie,ww:144-st/2-Je-Ie,wh:Nt,fx:144+st/2+Je,fy:Ie+Nt+ln,fw:144-st/2-Je-Ie,fh:66,...Zl[1]},f={id:"meet",wx:Ie+Je,wy:Ie+Nt+ln+66+st,ww:144-Ie-Je-st/2,wh:Nt,fx:Ie+Je,fy:Ie+Nt+ln+66+st+Nt+ln,fw:144-Ie-Je-st/2,fh:70,...Zl[2]},m={id:"comm",wx:144+st/2+Je,wy:Ie+Nt+ln+66+st,ww:144-st/2-Je-Ie,wh:Nt,fx:144+st/2+Je,fy:Ie+Nt+ln+66+st+Nt+ln,fw:144-st/2-Je-Ie,fh:70,...Zl[3]},p={exec:o,work:u,meet:f,comm:m},h=[];let g=t;const y=[[o,Math.min(3,g)],[u,0]];y[1][1]=Math.min(3,g-y[0][1]);const b=[[f,0],[m,0]];let v=g-y[0][1]-y[1][1];v>0&&(b[0][1]=Math.min(2,v),v-=b[0][1]),v>0&&(b[1][1]=Math.min(2,v));for(const[D,Y]of[...y,...b])Y>0&&h.push(...gh(D,Y,3));const j=Ie+Nt+ln+66,k=144-st/2,C={exec_work:{id:"exec_work",type:"v",doorY:Ie+Nt+ln+20+12,xA:k-2,xB:u.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:Ie+Nt+ln+66+st+Nt+ln+20+12,xA:k-2,xB:m.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:Ie+Je+40+14,yA:j-2,yB:f.fy+2},work_comm:{id:"work_comm",type:"h",doorX:144+st/2+Je+40+14,yA:j-2,yB:m.fy+2}},E={exec:[{room:"work",door:"exec_work",side:"A"},{room:"meet",door:"exec_meet",side:"A"}],work:[{room:"exec",door:"exec_work",side:"B"},{room:"comm",door:"work_comm",side:"A"}],meet:[{room:"exec",door:"exec_meet",side:"B"},{room:"comm",door:"meet_comm",side:"A"}],comm:[{room:"work",door:"work_comm",side:"B"},{room:"meet",door:"meet_comm",side:"B"}]},M={exec:o.fy+52,work:u.fy+48,meet:f.fy+56,comm:m.fy+42},H={exec:[{x:o.fx+6,y:o.fy+52},{x:o.fx+60,y:o.fy+54},{x:o.fx+112,y:o.fy+50},{x:o.fx+50,y:o.fy+52}],work:[{x:u.fx+14,y:u.fy+48},{x:u.fx+44,y:u.fy+48},{x:u.fx+70,y:u.fy+48},{x:u.fx+100,y:u.fy+48}],meet:[{x:f.fx+60,y:f.fy+56},{x:f.fx+30,y:f.fy+54},{x:f.fx+110,y:f.fy+50},{x:f.fx+80,y:f.fy+56}],comm:[{x:m.fx+96,y:m.fy+8},{x:m.fx+60,y:m.fy+42},{x:m.fx+40,y:m.fy+42},{x:m.fx+20,y:m.fy+42}]},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"},{id:"exec-picture-2",type:"picture",room:"exec",zone:"wall",offsetX:48,offsetY:8,pictureColor:"#E65100"},{id:"exec-clock",type:"clock",room:"exec",zone:"wall",offsetX:64,offsetY:10},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:18},{id:"exec-window-2",type:"window",room:"exec",zone:"wall",offsetX:104,offsetY:6,windowW:16,windowH:14},{id:"work-whiteboard",type:"whiteboard",room:"work",zone:"wall",offsetX:6,offsetY:4},{id:"work-window-1",type:"window",room:"work",zone:"wall",offsetX:50,offsetY:6,windowW:16,windowH:14},{id:"work-window-2",type:"window",room:"work",zone:"wall",offsetX:92,offsetY:6,windowW:16,windowH:14},{id:"meet-bulletin",type:"bulletin-board",room:"meet",zone:"wall",offsetX:6,offsetY:4,facility:{id:"bulletin",label:"BULLETIN",icon:"📋",color:"#F59E0B",hitW:22,hitH:16}},{id:"meet-picture",type:"picture",room:"meet",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#10B981"},{id:"meet-window",type:"window",room:"meet",zone:"wall",offsetX:80,offsetY:6,windowW:16,windowH:14},{id:"meet-shelf",type:"shelf",room:"meet",zone:"wall",offsetX:102,offsetY:18},{id:"comm-screen",type:"screen",room:"comm",zone:"wall",offsetX:6,offsetY:6,facility:{id:"decisions",label:"DECISIONS",icon:"📜",color:"#EF4444",hitW:16,hitH:12}},{id:"comm-picture",type:"picture",room:"comm",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#d4956a"},{id:"comm-window",type:"window",room:"comm",zone:"wall",offsetX:76,offsetY:6,windowW:16,windowH:14},{id:"comm-clock",type:"clock",room:"comm",zone:"wall",offsetX:98,offsetY:10},{id:"comm-shelf",type:"shelf",room:"comm",zone:"wall",offsetX:108,offsetY:18}],U=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(o.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"M",canvasW:288,canvasH:208,rooms:p,desks:h,doors:C,adjacency:E,corridorY:M,waypoints:H,wallDecorations:B,furniture:U}}function aE(t){const f={id:"exec",wx:Ie+Je,wy:Ie,ww:180-Ie-Je-st/2,wh:Nt,fx:Ie+Je,fy:Ie+Nt+ln,fw:180-Ie-Je-st/2,fh:82,...Zl[0]},m={id:"work",wx:180+st/2+Je,wy:Ie,ww:180-st/2-Je-Ie,wh:Nt,fx:180+st/2+Je,fy:Ie+Nt+ln,fw:180-st/2-Je-Ie,fh:82,...Zl[1]},p=Ie+Nt+ln+82,h={id:"meet",wx:Ie+Je,wy:p+st,ww:180-Ie-Je-st/2,wh:Nt,fx:Ie+Je,fy:p+st+Nt+ln,fw:180-Ie-Je-st/2,fh:86,...Zl[2]},g={id:"comm",wx:180+st/2+Je,wy:p+st,ww:180-st/2-Je-Ie,wh:Nt,fx:180+st/2+Je,fy:p+st+Nt+ln,fw:180-st/2-Je-Ie,fh:86,...Zl[3]},y={exec:f,work:m,meet:h,comm:g},b=[];let v=t;const j=[[f,Math.min(5,v)],[m,0]];j[1][1]=Math.min(5,v-j[0][1]);const k=[[h,0],[g,0]];let C=v-j[0][1]-j[1][1];C>0&&(k[0][1]=Math.min(3,C),C-=k[0][1]),C>0&&(k[1][1]=Math.min(3,C));for(const[V,ne]of[...j,...k])ne>0&&b.push(...gh(V,ne,4));const E=180-st/2,M={exec_work:{id:"exec_work",type:"v",doorY:f.fy+82/2,xA:E-2,xB:m.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:h.fy+86/2,xA:E-2,xB:g.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:f.fx+54,yA:p-2,yB:h.fy+2},work_comm:{id:"work_comm",type:"h",doorX:m.fx+54,yA:p-2,yB:g.fy+2}},H={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:f.fy+82-12,work:m.fy+82-12,meet:h.fy+86-12,comm:g.fy+86-12},U={exec:[{x:f.fx+10,y:B.exec},{x:f.fx+f.fw/2,y:B.exec},{x:f.fx+f.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:h.fx+10,y:B.meet},{x:h.fx+h.fw/2,y:B.meet},{x:h.fx+h.fw-10,y:B.meet}],comm:[{x:g.fx+10,y:B.comm},{x:g.fx+g.fw/2,y:B.comm},{x:g.fx+g.fw-10,y:B.comm}]},D=[{id:"exec-window-1",type:"window",room:"exec",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"exec-picture-1",type:"picture",room:"exec",zone:"wall",offsetX:34,offsetY:8,pictureColor:"#1565C0"},{id:"exec-picture-2",type:"picture",room:"exec",zone:"wall",offsetX:48,offsetY:8,pictureColor:"#E65100"},{id:"exec-clock",type:"clock",room:"exec",zone:"wall",offsetX:64,offsetY:10},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:18},{id:"exec-window-2",type:"window",room:"exec",zone:"wall",offsetX:104,offsetY:6,windowW:16,windowH:14},{id:"work-whiteboard",type:"whiteboard",room:"work",zone:"wall",offsetX:6,offsetY:4},{id:"work-window-1",type:"window",room:"work",zone:"wall",offsetX:50,offsetY:6,windowW:16,windowH:14},{id:"work-window-2",type:"window",room:"work",zone:"wall",offsetX:92,offsetY:6,windowW:16,windowH:14},{id:"meet-bulletin",type:"bulletin-board",room:"meet",zone:"wall",offsetX:6,offsetY:4,facility:{id:"bulletin",label:"BULLETIN",icon:"📋",color:"#F59E0B",hitW:22,hitH:16}},{id:"meet-picture",type:"picture",room:"meet",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#10B981"},{id:"meet-window",type:"window",room:"meet",zone:"wall",offsetX:80,offsetY:6,windowW:16,windowH:14},{id:"meet-shelf",type:"shelf",room:"meet",zone:"wall",offsetX:102,offsetY:18},{id:"comm-screen",type:"screen",room:"comm",zone:"wall",offsetX:6,offsetY:6,facility:{id:"decisions",label:"DECISIONS",icon:"📜",color:"#EF4444",hitW:16,hitH:12}},{id:"comm-picture",type:"picture",room:"comm",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#d4956a"},{id:"comm-window",type:"window",room:"comm",zone:"wall",offsetX:76,offsetY:6,windowW:16,windowH:14},{id:"comm-clock",type:"clock",room:"comm",zone:"wall",offsetX:98,offsetY:10},{id:"comm-shelf",type:"shelf",room:"comm",zone:"wall",offsetX:108,offsetY:18}],Y=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(f.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"L",canvasW:360,canvasH:260,rooms:y,desks:b,doors:M,adjacency:H,corridorY:B,waypoints:U,wallDecorations:D,furniture:Y}}const rE=2;function yg(t,l){return l?l==="L"&&t<=12-rE?"M":l==="M"&&t>12?"L":l:t<=12?"M":"L"}function gg(t,l){switch(l??yg(t)){case"S":return nE(t);case"M":return lE(t);case"L":return aE(t)}}function S0(t,l){if(!l||Object.keys(l).length===0)return t;const a=i=>i.map(o=>{const u=l[o.id];return u?{...o,offsetX:u.offsetX,offsetY:u.offsetY}:o});return{...t,wallDecorations:a(t.wallDecorations),furniture:a(t.furniture)}}function j0(t,l){if(l)for(const[a,i]of Object.entries(l))t[a]&&(t[a]={...t[a],dx:i.dx,dy:i.dy})}function Sd(t,l){if(!l||l.length===0)return t;const a=new Set(l);return{...t,wallDecorations:t.wallDecorations.filter(i=>!a.has(i.id)),furniture:t.furniture.filter(i=>!a.has(i.id))}}function C0(t,l){if(!l||l.length===0)return t;const a=[],i=[];for(const o of l)o.zone==="wall"?a.push(o):i.push(o);return{...t,wallDecorations:[...t.wallDecorations,...a],furniture:[...t.furniture,...i]}}let bs;function iE(t){bs=t}function F(t,l,a,i,o,u){t=Math.round(t),l=Math.round(l),!(u!==void 0&&u<.01)&&(u!==void 0&&u!==1&&(bs.globalAlpha=u),bs.fillStyle=o,bs.fillRect(t,l,a,i),u!==void 0&&u!==1&&(bs.globalAlpha=1))}function Pe(t,l,a,i){F(t,l,1,1,a,i)}let dc=1;function ri(t){dc=t}function jl(){return dc=dc*16807%2147483647,(dc&65535)/65535}function bg(t){const l=parseInt(t.slice(1,3),16)/255,a=parseInt(t.slice(3,5),16)/255,i=parseInt(t.slice(5,7),16)/255,o=Math.max(l,a,i),u=Math.min(l,a,i);let f=0,m=0;const p=(o+u)/2;if(o!==u){const h=o-u;m=p>.5?h/(2-o-u):h/(o+u),o===l?f=((a-i)/h+(a<i?6:0))/6:o===a?f=((i-l)/h+2)/6:f=((l-a)/h+4)/6}return[f*360,m*100,p*100]}function vg(t,l,a){t=(t%360+360)%360,l=Math.max(0,Math.min(100,l))/100,a=Math.max(0,Math.min(100,a))/100;const i=l*Math.min(a,1-a),o=f=>{const m=(f+t/30)%12;return a-i*Math.max(-1,Math.min(m-3,9-m,1))},u=f=>Math.round(f*255).toString(16).padStart(2,"0");return"#"+u(o(0))+u(o(8))+u(o(4))}function Cl(t,l=1){const[a,i,o]=bg(t);return vg(a+15*l,Math.min(100,i+8),o-12*l)}function $t(t,l=1){const[a,i,o]=bg(t);return vg(a-10*l,i-3,o+10*l)}const nn={hi:"#D4AA5C",base:"#B08040",sh:"#7A5038",deep:"#4E3028"},Sl={hi:"#8A6848",base:"#604832",sh:"#3A2E24",deep:"#2A1E18"},vl={hi:"#5A6A80",base:"#485868",sh:"#364858",deep:"#283848"},Ba="#100A06";function sE(t,l,a=14,i=12){F(t,l,a,i,"#4A3828"),F(t+1,l+1,a-2,i-2,"#5A4838"),F(t+2,l+2,a-4,i-4,"#4A7098"),F(t+2,l+2,a-4,Math.floor((i-4)/2),"#6A90B8",.35);const o=Math.floor(a/2);F(t+o,l+1,1,i-2,"#4A3828"),F(t+1,l+Math.floor(i/2),a-2,1,"#4A3828",.5),Pe(t+3,l+3,"#8AB8E8",.35),Pe(t+o+2,l+3,"#8AB8E8",.25),F(t-1,l+i,a+2,2,"#5A4838"),F(t-1,l+i,a+2,1,$t("#5A4838",.5),.35)}function oE(t,l,a){F(t,l,10,8,"#3A2818"),F(t+1,l+1,8,6,a),F(t+2,l+2,4,3,$t(a,1.2),.3),Pe(t+3,l+2,$t(a,2),.25)}function cE(t,l){F(t,l,7,7,"#3A2818"),F(t+1,l+1,5,5,"#F0EDE5"),Pe(t+3,l+1,"#AAA"),Pe(t+3,l+5,"#AAA"),Pe(t+1,l+3,"#AAA"),Pe(t+5,l+3,"#AAA"),Pe(t+3,l+3,"#222"),F(t+3,l+1,1,2,"#333"),Pe(t+4,l+3,"#D32F2F")}function uE(t,l){F(t,l,26,16,"#586878"),F(t+1,l+1,24,13,"#ECEFF1"),F(t+1,l+1,24,1,"#F5F5F5",.4),F(t+3,l+3,14,1,"#1565C0",.6),F(t+3,l+5,18,1,"#333",.2),F(t+3,l+7,12,1,"#D32F2F",.35),F(t+3,l+9,16,1,"#333",.15),F(t+1,l+14,24,2,"#708898"),F(t+3,l+14,3,1,"#D32F2F"),F(t+7,l+14,3,1,"#1565C0"),F(t+11,l+14,3,1,"#2E7D32")}function fE(t,l){F(t,l,22,16,"#6A5030"),F(t+1,l+1,20,14,"#C4A66A"),ri(88);for(let a=0;a<14;a++)for(let i=0;i<20;i++)jl()>.5&&Pe(t+1+i,l+1+a,jl()>.5?"#B89858":"#D4B87A",.18);F(t+2,l+2,5,4,"#FFF176"),F(t+8,l+2,5,4,"#90CAF9"),F(t+14,l+3,5,4,"#CE93D8"),F(t+3,l+8,7,4,"#C8E6C9"),F(t+11,l+8,8,4,"#F8BBD0"),Pe(t+4,l+2,"#E53935"),Pe(t+10,l+2,"#1E88E5"),Pe(t+16,l+3,"#FF9800")}function dE(t,l){F(t,l,20,3,"#5A4030"),F(t,l,20,1,$t("#5A4030",.5),.35),F(t,l+2,20,1,Cl("#5A4030",.5),.3),F(t+2,l-4,3,4,"#E53935"),F(t+2,l-4,3,1,$t("#E53935",1),.3),F(t+6,l-3,2,3,"#1E88E5"),F(t+9,l-5,4,5,"#43A047"),F(t+14,l-3,3,3,"#FFD54F"),Pe(t+15,l-3,"#FFF176",.4)}function hE(t,l){F(t,l,16,12,"#1E1E28"),F(t+1,l+1,14,9,"#0C1420"),F(t+2,l+2,12,1,"#EF4444",.6),Pe(t+2,l+4,"#4CAF50"),F(t+4,l+4,7,1,"#8b949e",.4),Pe(t+2,l+6,"#FF9800"),F(t+4,l+6,5,1,"#8b949e",.3),Pe(t+2,l+8,"#42A5F5"),F(t+4,l+8,8,1,"#8b949e",.25),F(t+7,l+10,2,2,"#1E1E28"),F(t+5,l+11,6,1,"#586878")}function mE(t,l,a){F(t+2,l+20,22,2,Ba,.15),F(t,l,22,20,Sl.deep),F(t+1,l+1,20,18,Sl.base),F(t,l,22,1,Sl.hi,.35),F(t,l,1,20,Sl.hi,.2);for(const u of[6,12])F(t+1,l+u,20,2,Sl.sh),F(t+1,l+u,20,1,Sl.hi,.2);const i=["#E53935","#1E88E5","#43A047","#8E24AA","#FB8C00","#00897B","#5C6BC0"];let o=t+2;for(let u=0;u<5;u++){const f=2+u%2;F(o,l+1,f,5,i[u]),F(o,l+1,f,1,$t(i[u],1),.35),o+=f+1}o=t+2;for(let u=0;u<4;u++)F(o,l+7,4,5,i[u+3]),F(o,l+7,4,1,$t(i[u+3],1),.25),o+=5;F(t+2,l+14,4,4,"#FFD54F"),F(t+8,l+14,7,4,"#90CAF9"),a&&F(t,l-1,22,1,a,.7)}function xE(t,l){F(t+2,l+11,6,2,Ba,.1),F(t+2,l+8,6,4,"#8B5E3C"),F(t+1,l+7,8,2,Cl("#A06E48",.3)),F(t+2,l+7,6,1,$t("#A06E48",.5),.4),F(t+1,l+3,3,4,"#2E7D32"),F(t+5,l+2,3,4,"#2E7D32"),F(t+2,l+1,4,4,"#43A047"),F(t+3,l+0,3,3,"#66BB6A"),Pe(t+4,l,"#81C784"),Pe(t+3,l+1,"#A5D6A7",.4)}function pE(t,l){rr(t+4,l-4,"down"),rr(t+16,l-4,"down"),rr(t+28,l-4,"down"),F(t+3,l+24,34,3,Ba,.15),F(t,l+2,36,18,nn.deep),F(t+1,l+3,34,16,nn.base),F(t+1,l+3,34,1,nn.hi,.35);for(let a=0;a<14;a+=3)F(t+1,l+4+a,34,1,Cl(nn.base,.2),.08);F(t,l+20,36,4,nn.deep),F(t+1,l+21,34,2,nn.sh),F(t+6,l+7,10,6,"#1A1A24"),F(t+7,l+8,8,4,"#0C1420"),F(t+8,l+9,4,1,"#2A6898",.4),F(t+20,l+8,6,4,"#F0F0F0"),F(t+15,l+7,3,3,"#ECEFF1"),Pe(t+16,l+8,"#795548"),rr(t+4,l+24,"up"),rr(t+16,l+24,"up"),rr(t+28,l+24,"up")}function yE(t,l){F(t+2,l+16,36,3,Ba,.15),F(t,l,36,5,"#5D4037"),F(t+1,l+1,34,3,"#6D4C41"),F(t+1,l+1,34,1,$t("#6D4C41",.5),.3),F(t,l+5,36,8,"#5D4037"),F(t+2,l+6,15,6,"#6D4C41"),F(t+3,l+6,13,1,$t("#6D4C41",.5),.35),F(t+19,l+6,15,6,"#6D4C41"),F(t+20,l+6,13,1,$t("#6D4C41",.5),.35),F(t+17,l+6,2,6,"#5D4037"),F(t,l+13,36,3,Cl("#5D4037",1)),F(t-2,l+2,3,12,"#5D4037"),F(t+35,l+2,3,12,"#5D4037"),F(t+4,l+7,6,4,"#FF8A65"),F(t+5,l+7,4,1,$t("#FF8A65",1),.35)}function gE(t,l){F(t+2,l+10,22,2,Ba,.12),F(t,l,22,8,Sl.deep),F(t+1,l+1,20,6,Sl.base),F(t+1,l+1,20,1,Sl.hi,.3),F(t,l+8,22,2,Sl.sh),F(t+3,l+2,6,4,"#F0F0F0"),F(t+13,l+3,3,3,"#ECEFF1"),Pe(t+14,l+4,"#795548")}function bE(t,l){F(t+1,l+14,10,2,Ba,.12),F(t,l,10,14,"#546E7A"),F(t,l,10,1,$t("#546E7A",1),.35),F(t+1,l+1,8,3,"#78909C"),F(t+1,l+5,8,4,"#37474F"),Pe(t+2,l+6,"#EF5350"),Pe(t+4,l+6,"#66BB6A"),F(t+2,l+11,4,2,"#ECEFF1")}function vE(t,l){F(t+2,l+16,26,3,Ba,.18),F(t,l,26,10,nn.deep),F(t+1,l+1,24,8,nn.base),F(t+1,l+2,24,1,nn.hi,.2),F(t+1,l+4,24,1,Cl(nn.base,.2),.1),F(t+1,l+6,24,1,nn.hi,.15),F(t+1,l+1,24,1,nn.hi,.4),F(t+1,l+1,1,8,nn.hi,.2),F(t,l+10,26,5,nn.deep),F(t+1,l+11,24,3,nn.sh),F(t+1,l+10,24,1,Cl(nn.base,1.5),.4),F(t+1,l+14,24,1,nn.base,.15),F(t+2,l+12,10,1,nn.deep,.4),F(t+14,l+12,10,1,nn.deep,.4),Pe(t+7,l+11,"#C8D0D8",.6),Pe(t+19,l+11,"#C8D0D8",.6),F(t+6,l-5,14,7,"#1E1E28"),F(t+7,l-4,12,5,"#0C1420"),F(t+8,l-3,5,1,"#2A6898",.6),F(t+8,l-2,8,1,"#1A3858",.4),F(t+8,l-1,3,1,"#2A6898",.35),Pe(t+7,l-4,"#4A98D8",.25),Pe(t+12,l+1,"#4CAF50",.4),F(t+12,l+2,2,3,"#586878"),F(t+10,l+4,6,1,"#8898A8"),F(t+6,l+4,12,4,"#222228"),F(t+6,l+4,12,1,"#333338",.4);for(let a=0;a<5;a++)Pe(t+7+a*2,l+5,"#444",.6),Pe(t+7+a*2,l+6,"#3A3A3E",.4);F(t+20,l+5,3,4,"#333338"),F(t+20,l+5,3,1,"#444448"),F(t+1,l+3,4,4,"#F0EDE8"),F(t+1,l+3,4,1,"#F8F6F2"),Pe(t+2,l+5,"#6D4C41")}function rr(t,l,a){F(t+1,l+9,10,2,Ba,.1),Pe(t+5,l+9,"#1E1E22"),Pe(t+1,l+10,"#1A1A1E"),Pe(t+9,l+10,"#1A1A1E"),Pe(t+3,l+11,"#1A1A1E"),Pe(t+7,l+11,"#1A1A1E"),F(t+1,l+2,8,6,vl.base),F(t+2,l+3,6,4,vl.hi,.35),F(t+2,l+3,6,1,$t(vl.hi,.5),.25),F(t+1,l+7,8,1,vl.deep),a==="up"?(F(t,l+7,10,3,vl.deep),F(t+1,l+8,8,1,vl.sh)):(F(t,l-1,10,3,vl.deep),F(t+1,l,8,1,vl.sh)),F(t,l+3,1,4,vl.sh),F(t+9,l+3,1,4,vl.sh)}const wg={bookshelf:(t,l,a)=>mE(t,l,a.accent),plant:(t,l)=>xE(t,l),"meeting-table":(t,l)=>pE(t,l),sofa:(t,l)=>yE(t,l),"coffee-table":(t,l)=>gE(t,l),"coffee-machine":(t,l)=>bE(t,l),window:(t,l,a)=>sE(t,l,a.windowW??16,a.windowH??14),picture:(t,l,a)=>oE(t,l,a.pictureColor??"#1565C0"),clock:(t,l)=>cE(t,l),whiteboard:(t,l)=>uE(t,l),"bulletin-board":(t,l)=>fE(t,l),shelf:(t,l)=>dE(t,l),screen:(t,l)=>hE(t,l)};function ni(t,l){const a=t.zone==="wall"?l.wx:l.fx,i=t.zone==="wall"?l.wy:l.fy;return{x:t.anchorX==="right"?(t.zone==="wall"?l.wx+l.ww:l.fx+l.fw)+t.offsetX:a+t.offsetX,y:i+t.offsetY}}function wE(t){for(const l of t.wallDecorations){const a=t.rooms[l.room];if(!a)continue;const{x:i,y:o}=ni(l,a),u=wg[l.type];u&&u(i,o,l)}}function kE(t,l,a){for(const i of t.furniture){const o=t.rooms[i.room];if(!o||i.condition==="no-desks"&&a.has(i.room))continue;const{x:u,y:f}=ni(i,o),m=wg[i.type];m&&l.push({y:f,draw:()=>m(u,f,i)})}}function za(t){const l=[],a=[...t.wallDecorations,...t.furniture];for(const i of a){if(!i.facility)continue;const o=t.rooms[i.room];if(!o)continue;const{x:u,y:f}=ni(i,o);l.push({id:i.facility.id,label:i.facility.label,icon:i.facility.icon,color:i.facility.color,dx:u,dy:f,pw:i.facility.hitW,ph:i.facility.hitH})}return l}const SE={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 Xd(t){return SE[t]??{w:16,h:16}}function jd(t,l,a,i){for(let o=t.furniture.length-1;o>=0;o--){const u=t.furniture[o],f=t.rooms[u.room];if(!f||u.condition==="no-desks"&&i.has(u.room))continue;const{x:m,y:p}=ni(u,f),h=Xd(u.type);if(l>=m&&l<=m+h.w&&a>=p&&a<=p+h.h)return u.id}for(let o=t.wallDecorations.length-1;o>=0;o--){const u=t.wallDecorations[o],f=t.rooms[u.room];if(!f)continue;const{x:m,y:p}=ni(u,f),h=Xd(u.type);if(l>=m&&l<=m+h.w&&a>=p&&a<=p+h.h)return u.id}return null}function E0(t,l,a,i,o){const f=[...l.wallDecorations,...l.furniture].find(y=>y.id===a);if(!f||f.condition==="no-desks"&&o.has(f.room))return;const m=l.rooms[f.room];if(!m)return;const{x:p,y:h}=ni(f,m),g=Xd(f.type);t.save(),t.fillStyle=i,t.globalAlpha=.2,t.fillRect(p-1,h-1,g.w+2,g.h+2),t.globalAlpha=.9,t.strokeStyle=i,t.lineWidth=1,t.strokeRect(p-.5,h-.5,g.w+1,g.h+1),t.restore()}function N0(t,l,a,i){t.save(),t.fillStyle=i,t.globalAlpha=.2,t.fillRect(l-1,a-1,28,42),t.globalAlpha=.9,t.strokeStyle=i,t.lineWidth=1,t.strokeRect(l-.5,a-.5,27,41),t.restore()}function A0(t,l,a){for(const[i,o]of Object.entries(t))if(l>=o.dx&&l<=o.dx+26&&a>=o.dy&&a<=o.dy+40)return i;return null}const jE=[{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:"🖥️"}],oc=16,CE=4,ar=4,hc=2,xt=4,Ma=4;let Re=gg(7);const jc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};let fl=za(Re);function kg(t){return{x:t.dx,y:t.dy,w:t.pw,h:t.ph}}function Sg(t){return{cx:t.dx+t.pw/2,botY:t.dy+t.ph}}let Yt={};function EE(t){const l={};for(let a=0;a<t.length&&a<Re.desks.length;a++)l[t[a]]=Re.desks[a];return l}let Ft,or=null,ir=null,Ql=!1,dl=null,In=null,hn=null,tn=null,Wr=null,wl=null;function NE(t,l){const{wx:a,wy:i,ww:o,wh:u,wallColor:f,baseboardColor:m}=t,p=Cl(f,.5),h=$t(f,.5),g=[];if(l){const y=l.x-a,b=l.w;y>0&&g.push({sx:a,sw:y}),y+b<o&&g.push({sx:l.x+b,sw:o-y-b})}else g.push({sx:a,sw:o});for(const y of g){F(y.sx,i,y.sw,u,f);for(let b=0;b<u;b+=4)F(y.sx,i+b,y.sw,1,h,.08),F(y.sx,i+b+2,y.sw,1,p,.05);ri(Math.round(y.sx*7+i*13));for(let b=0;b<y.sw;b+=3)jl()>.4&&F(y.sx+b,i,1,u,h,.04);F(y.sx,i,y.sw,2,h,.3),F(y.sx,i,y.sw,1,$t(f,1),.2),F(y.sx,i+u-2,y.sw,2,p,.3),F(y.sx,i+u,y.sw,hc,m),F(y.sx,i+u,y.sw,1,$t(m,.5),.4)}l&&(F(l.x-1,i,1,u+hc,"#4A3828"),F(l.x+l.w,i,1,u+hc,"#4A3828"),F(l.x,i,l.w,1,"#0A0808",.12)),F(t.fx,t.fy,t.fw,3,"#0A0808",.12),F(t.fx,t.fy+3,t.fw,2,"#0A0808",.06)}function AE(t){const l="#504038",a=Cl(l,.5),i=$t(l,.5),o=t.wx-Ma,u=t.wy,f=t.wh+hc+t.fh;F(o,u,Ma,f,l),F(o,u,1,f,i,.3),F(o+Ma-1,u,1,f,a,.4);for(let p=0;p<f;p+=6)F(o+1,u+p,Ma-2,1,i,.06);const m=t.wx+t.ww;F(m,u,Ma,f,l),F(m,u,1,f,i,.2),F(m+Ma-1,u,1,f,a,.3)}function Cd(t){const{fx:l,fy:a,fw:i,fh:o}=t,u="#B08040",f="#C89848",m="#8A6030",p="#6A4820";F(l,a,i,o,u),ri(42);for(let h=0;h<o;h+=5){const g=Math.floor(h/5)%2*10;for(let y=-10;y<i+10;y+=20){const b=l+y+g,v=Math.max(l,b),j=Math.min(b+19,l+i)-v;if(j<=0)continue;const k=jl()>.5?f:u;F(v,a+h,j,4,k,.25),F(v,a+h,j,1,f,.3),F(v,a+h+4,j,1,p,.35),b>=l&&b<l+i&&F(b,a+h,1,4,p,.2),F(v,a+h+2,j,1,m,.1)}}F(l,a,i,2,"#0A0808",.08),F(l,a,2,o,"#0A0808",.06)}function D0(t){const{fx:l,fy:a,fw:i,fh:o}=t,u="#1C2A38",f="#101820";ri(99),F(l,a,i,o,u);for(let m=0;m<o;m+=oc)for(let p=0;p<i;p+=oc){const h=Math.min(oc,i-p),g=Math.min(oc,o-m);jl()>.5&&F(l+p,a+m,h,g,$t(u,.2),.15),F(l+p+2,a+m+2,h-4,g-4,$t(u,.3),.08),F(l+p,a+m,h,1,f,.5),F(l+p,a+m,1,g,f,.5),F(l+p+1,a+m+1,1,g-1,$t(u,.4),.1),jl()>.85&&Pe(l+p+4+Math.floor(jl()*8),a+m+4+Math.floor(jl()*8),"#3A6A9A",.08)}}function DE(t){const{fx:l,fy:a,fw:i,fh:o}=t,u="#387848",f="#4A9058",m="#285E38";F(l,a,i,o,u),ri(77);for(let h=0;h<o;h+=2)for(let g=0;g<i;g+=2)jl()>.5&&Pe(l+g,a+h,f,.1),jl()>.8&&Pe(l+g+1,a+h+1,m,.12);const p=5;F(l+p,a+p,i-p*2,1,f,.45),F(l+p,a+o-p-1,i-p*2,1,m,.45),F(l+p,a+p,1,o-p*2,f,.35),F(l+i-p-1,a+p,1,o-p*2,m,.35)}function TE(t){const{fx:l,fy:a,fw:i,fh:o}=t,u="#D8C490",f="#B09060",m="#907848";ri(55);for(let p=0;p<o;p+=8)for(let h=0;h<i;h+=8){const g=Math.min(8,i-h),y=Math.min(8,o-p),b=(h/8+p/8)%2===0?f:u;F(l+h,a+p,g,y,b),F(l+h+1,a+p+1,g-2,1,$t(b,.4),.2),F(l+h+1,a+p+1,1,y-2,$t(b,.4),.15),F(l+h+g-2,a+p+2,1,y-3,Cl(b,.4),.15),F(l+h+2,a+p+y-2,g-3,1,Cl(b,.4),.15),F(l+h,a+p,g,1,m,.3),F(l+h,a+p,1,y,m,.3)}}function zE(){const{canvasW:t,canvasH:l,rooms:a,doors:i}=Re,o="#2A1E14",u="#3A2E24";if(F(0,0,t,ar,o),F(0,l-ar,t,ar,o),F(0,0,ar,l,o),F(t-ar,0,ar,l,o),F(0,0,t,1,u,.3),F(0,0,1,l,u,.2),!a.exec||!a.work||!a.meet||!a.comm)return;const f=a.exec,m=a.meet,p=t/2,h=p-xt/2,g=f.fy+f.fh,y=i.exec_work,b=i.meet_comm,v=i.exec_meet,j=i.work_comm,k=24,C=28,E=((y==null?void 0:y.doorY)??f.fy+20)-k/2,M=((v==null?void 0:v.doorX)??ar+Ma+54)-C/2,H=((j==null?void 0:j.doorX)??p+xt/2+Ma+54)-C/2,B=((b==null?void 0:b.doorY)??m.fy+20)-k/2;F(0,g,M,xt,o),F(M+C,g,h-M-C,xt,o),F(h+xt,g,H-h-xt,xt,o),F(H+C,g,t-H-C,xt,o),F(0,g,M,1,u,.3),F(M+C,g,h-M-C,1,u,.3),F(h+xt,g,H-h-xt,1,u,.3),F(H+C,g,t-H-C,1,u,.3),F(h,0,xt,E,o),F(h,E+k,xt,g-E-k,o),F(h,g+xt,xt,B-g-xt,o),F(h,B+k,xt,l-B-k,o),F(h,0,1,E,u,.2),F(h,E+k,1,g-E-k,u,.2),F(h,g+xt,1,B-g-xt,u,.2),F(h,B+k,1,l-B-k,u,.2),F(h,E,xt,k,"#C4A070"),F(h+xt/2,E,xt/2,k,"#3A4858"),F(h,B,xt,k,"#7AA880"),F(h+xt/2,B,xt/2,k,"#C8B890");const U="#4A3828";F(h,E-1,xt,1,U),F(h,E+k,xt,1,U),F(M-1,g,1,xt,U),F(M+C,g,1,xt,U),F(H-1,g,1,xt,U),F(H+C,g,1,xt,U),F(h,B-1,xt,1,U),F(h,B+k,xt,1,U)}const T0=new Map;function ME(t){const l=`${t.hairStyle??""}|${t.outfitStyle??""}|${t.accessory??""}`;let a=T0.get(l);if(!a){const i=Hd("mini-seated:default"),o=Jy(i,t);a=o?o.layers.flatMap(u=>u.pixels):[],T0.set(l,a)}return a}function _E(t,l,a){Ud(Ft,ME(a),t,l,a)}function FE(t,l,a,i,o){rr(t+8,l+20,"up"),o||_E(t+8,l+0+i,a),vE(t,l+14)}function RE(t,l,a,i,o){const u=i in k0?i:"down",f=o%4,m=k0[u][f];Ud(Ft,m,t,l,a);const p=f===1||f===3?-1:0;if(a.accessory&&a.accessory!=="none"){const h=ES(a.accessory,u);h&&h.pixels.length>0&&Ud(Ft,h.pixels,t,l+p,a)}Ft.globalAlpha=1}function OE(t){const l={};let a=0;for(const i of t){const o=Yt[i];o&&(l[i]={state:"sitting",homeX:o.dx+8,homeY:o.dy+34,homeRoom:o.room,x:o.dx+8,y:o.dy+34,path:[],room:o.room,dir:"down",walkFrame:0,walkTimer:0,bobY:0,bobOff:a*17,stateTimer:600+Math.floor(Math.random()*900)},a++)}return l}function Ss(t,l,a,i,o){const u=Re.corridorY[o]??l,f=[];return l<u-4&&f.push({x:t,y:u}),Math.abs(t-a)>4&&f.push({x:a,y:u}),f.push({x:a,y:i}),f}function Ed(t,l,a,i){const o=Re.adjacency[a];if(!o)return[];const u=o.find(g=>g.room===i);if(!u)return[];const f=Re.doors[u.door];if(!f)return[];const m=[],p=Re.corridorY[a]??l,h=Re.corridorY[i]??l;if(Math.abs(l-p)>4&&m.push({x:t,y:p}),f.type==="v"){const g=u.side==="A"?f.xA:f.xB,y=u.side==="A"?f.xB:f.xA;m.push({x:g,y:p}),m.push({x:g,y:f.doorY}),m.push({x:y,y:f.doorY}),m.push({x:y,y:h})}else{const g=u.side==="A"?f.yA:f.yB,y=u.side==="A"?f.yB:f.yA;m.push({x:f.doorX,y:p}),m.push({x:f.doorX,y:g}),m.push({x:f.doorX,y}),m.push({x:f.doorX,y:h})}return m}function jg(t,l){const a=Re.adjacency[t.room];if(!a)return[];if(!a.find(o=>o.room===l)){for(const o of a){const u=Re.adjacency[o.room];if(u!=null&&u.find(f=>f.room===l)){const f=Ed(t.x,t.y,t.room,o.room),m=f[f.length-1],p=Ed((m==null?void 0:m.x)??t.x,(m==null?void 0:m.y)??t.y,o.room,l);return[...f,...p]}}return[]}return Ed(t.x,t.y,t.room,l)}function BE(t){if(t.room!==t.homeRoom){const l=jg({...t},t.homeRoom),a=l[l.length-1],i=Ss((a==null?void 0:a.x)??t.x,(a==null?void 0:a.y)??t.y,t.homeX,t.homeY,t.homeRoom);return[...l,...i]}return Ss(t.x,t.y,t.homeX,t.homeY,t.room)}function LE(t,l){for(const[,a]of Object.entries(t))if(a.stateTimer--,a.state==="sitting"){if(a.bobY=(l+a.bobOff)%60<30?1:0,a.stateTimer<=0){a.state="walking",a.x=a.homeX,a.y=a.homeY,a.room=a.homeRoom;const i=Object.keys(Re.rooms);if(Math.random()<.25&&i.length>1){const o=i.filter(p=>p!==a.room),u=o[Math.floor(Math.random()*o.length)],f=jg(a,u),m=Re.waypoints[u];if(m&&m.length>0){const p=m[Math.floor(Math.random()*m.length)],h=f[f.length-1]??{x:a.x,y:a.y},g=Ss(h.x,h.y,p.x,p.y,u);a.path=[...f,...g]}else a.path=f;a.walkTimer=0}else{const o=Re.waypoints[a.room];if(o&&o.length>0){const u=o[Math.floor(Math.random()*o.length)];a.path=Ss(a.x,a.y,u.x,u.y,a.room)}a.walkTimer=0}}}else if(a.state==="walking"||a.state==="returning"){if(a.path.length===0){a.state==="returning"?(a.state="sitting",a.room=a.homeRoom,a.stateTimer=800+Math.floor(Math.random()*1200)):(a.state="idle",a.dir="down",a.stateTimer=180+Math.floor(Math.random()*360));continue}const i=a.path[0],o=i.x-a.x,u=i.y-a.y,f=Math.sqrt(o*o+u*u);if(f<1.5){a.x=i.x,a.y=i.y,a.path.shift();for(const[m,p]of Object.entries(Re.rooms))if(a.x>=p.fx&&a.x<=p.fx+p.fw&&a.y>=p.fy&&a.y<=p.fy+p.fh){a.room=m;break}}else a.x+=o/f*.2,a.y+=u/f*.2,Math.abs(o)>Math.abs(u)?a.dir=o>0?"right":"left":a.dir=u>0?"down":"up",a.walkTimer++,a.walkFrame=Math.floor(a.walkTimer/12)%4}else if(a.state==="idle"&&a.stateTimer<=0)if(Math.random()<.3){a.state="walking";const i=Re.waypoints[a.room];if(i&&i.length>0){const o=i[Math.floor(Math.random()*i.length)];a.path=Ss(a.x,a.y,o.x,o.y,a.room)}a.walkTimer=0}else a.state="returning",a.path=BE(a),a.walkTimer=0}function $E(t,l,a){const{canvasW:i,canvasH:o,rooms:u}=Re;Ft.clearRect(0,0,i,o),F(0,0,i,o,"#2A1E14");const f={wood:Cd,dark:D0,carpet:DE,tile:TE};for(const y of Object.values(u))(f[y.floorType]??Cd)(y);const m=Object.keys(u);if(m.length>=4){const y=u.exec,b=u.meet,{doors:v}=Re;if(y&&b&&v.exec_meet&&v.work_comm){const k=(v.exec_meet.doorX??0)-14,C=(v.work_comm.doorX??0)-28/2,E=y.fy+y.fh,M=b.fy;Cd({fx:k,fy:E,fw:28,fh:M-E}),D0({fx:C,fy:E,fw:28,fh:M-E})}}const p={};if(m.length>=4){const{doors:y}=Re,b=28,v=y.exec_meet,j=y.work_comm;v!=null&&v.doorX&&(p.meet={x:v.doorX-b/2,w:b}),j!=null&&j.doorX&&(p.comm={x:j.doorX-b/2,w:b})}for(const y of Object.values(u))NE(y,p[y.id]),AE(y);zE(),wE(Re);const h=[],g=new Set(Object.values(Yt).map(y=>y.room));kE(Re,h,g);for(const[y,b]of Object.entries(Yt)){const v=t[y];if(!v)continue;const j=v.state==="sitting",k=l(y),C=a[y]==="working";h.push({y:b.dy+14,draw:()=>{if(FE(b.dx,b.dy,k,j?v.bobY:0,!j),j&&C){const E=jc[y]??"#388bfd";F(b.dx+7,b.dy+14-4,12,5,E,.15),Pe(b.dx+12,b.dy+14+1,"#4CAF50",.8)}}})}for(const[y,b]of Object.entries(t))if(b.state!=="sitting"){const v=l(y);h.push({y:b.y+14,draw:()=>RE(Math.round(b.x),Math.round(b.y),v,b.dir,b.walkFrame)})}h.sort((y,b)=>y.y-b.y);for(const y of h)y.draw();for(const y of fl){const b=ir===y.id,v=Sg(y);if(Ft.save(),Ft.globalAlpha=b?.9:.5,Ft.fillStyle=y.color,Ft.fillRect(v.cx-1,v.botY-2,3,3),b){const j=kg(y);Ft.globalAlpha=.3,Ft.strokeStyle=y.color,Ft.lineWidth=1,Ft.strokeRect(j.x-1,j.y-1,j.w+2,j.h+2)}Ft.restore()}if(Ql){const y=new Set(Object.values(Yt).map(b=>b.room));if(dl&&dl!==In)if(dl.startsWith("desk:")){const b=dl.slice(5),v=Yt[b];v&&N0(Ft,v.dx,v.dy,"#FBBF24")}else E0(Ft,Re,dl,"#FBBF24",y);if(In)if(In.startsWith("desk:")){const b=In.slice(5),v=Yt[b];v&&N0(Ft,v.dx,v.dy,"#3B82F6")}else E0(Ft,Re,In,"#3B82F6",y)}if(or){const y=Yt[or],b=t[or];y&&b&&(Ft.save(),Ft.globalAlpha=.25,Ft.fillStyle=jc[or]??"#fff",b.state==="sitting"?Ft.fillRect(y.dx-1,y.dy+6,28,30):Ft.fillRect(Math.round(b.x)-1,Math.round(b.y)-1,14,24),Ft.restore())}}function HE({roles:t,projects:l,roleStatuses:a,activeExecs:i,onRoleClick:o,onProjectClick:u,onBulletinClick:f,onDecisionsClick:m,onKnowledgeClick:p,getRoleSpeech:h,getAppearance:g,onHireClick:y}){const b=S.useRef(null),v=S.useRef(null),j=S.useRef(null),k=S.useRef({}),C=S.useRef(0),E=S.useRef(CE),[M,H]=S.useState(!1),[B,U]=S.useState(null),[D,Y]=S.useState(null),V=S.useRef({}),ne=S.useRef({}),T=S.useRef([]),L=S.useRef([]);S.useEffect(()=>{Ql=M},[M]),S.useEffect(()=>{Wr=B,wl=D},[B,D]),S.useEffect(()=>{Te.getPreferences().then(oe=>{const K=oe.furnitureOverrides;K&&Object.keys(K).length>0&&(V.current=K,Re=S0(Re,K));const ue=oe.deskOverrides;if(ue&&Object.keys(ue).length>0){ne.current=ue,j0(Yt,ue);for(const[ve,Ce]of Object.entries(Yt)){const Ae=k.current[ve];Ae&&(Ae.homeX=Ce.dx+8,Ae.homeY=Ce.dy+34)}}const je=oe.removedFurniture;je&&je.length>0&&(T.current=je,Re=Sd(Re,je));const te=oe.addedFurniture;te&&te.length>0&&(L.current=te,Re=C0(Re,te)),fl=za(Re)}).catch(()=>{})},[]);const $=S.useRef({roleStatuses:a,activeExecs:i,getRoleSpeech:h,getAppearance:g});$.current={roleStatuses:a,activeExecs:i,getRoleSpeech:h,getAppearance:g};const ee=S.useMemo(()=>t.map(oe=>oe.id),[t]),ae=S.useRef(Re);S.useEffect(()=>{const oe=ee.length,K=yg(oe,ae.current.preset);let ue=gg(oe,K);T.current.length>0&&(ue=Sd(ue,T.current)),L.current.length>0&&(ue=C0(ue,L.current)),Object.keys(V.current).length>0&&(ue=S0(ue,V.current)),Re=ue,ae.current=ue,Yt=EE(ee),Object.keys(ne.current).length>0&&j0(Yt,ne.current),fl=za(ue),k.current=OE(ee);const je=b.current;je&&(je.width=ue.canvasW,je.height=ue.canvasH),I()},[ee]);const X=S.useCallback(oe=>{var K,ue;return((ue=(K=$.current).getAppearance)==null?void 0:ue.call(K,oe))??ph(oe)},[]),I=S.useCallback(()=>{const oe=v.current,K=b.current;if(!oe||!K)return;const ue=oe.parentElement;if(!ue)return;const je=ue.clientWidth,te=ue.clientHeight;if(je===0||te===0)return;const{canvasW:ve,canvasH:Ce}=Re;let Ae=Math.floor(Math.min(je/ve,te/Ce));Ae=Math.max(2,Math.min(Ae,5)),E.current=Ae,K.style.width=ve*Ae+"px",K.style.height=Ce*Ae+"px",oe.style.width=ve*Ae+"px",oe.style.height=Ce*Ae+"px"},[]);S.useEffect(()=>{var Ce;const oe=b.current;if(!oe)return;const K=oe.getContext("2d");if(!K)return;Ft=K,iE(K),I();const ue=new ResizeObserver(()=>I()),je=(Ce=v.current)==null?void 0:Ce.parentElement;je&&ue.observe(je);let te;const ve=()=>{C.current++,LE(k.current,C.current),$E(k.current,X,$.current.roleStatuses),Q(),te=requestAnimationFrame(ve)};return te=requestAnimationFrame(ve),()=>{cancelAnimationFrame(te),ue.disconnect()}},[X,I]),S.useEffect(()=>{const oe=j.current;if(!oe)return;oe.innerHTML="";for(const ue of ee){const je=jc[ue]??"#8b949e",te=document.createElement("div");te.className="td-nametag",te.dataset.role=ue;const ve=document.createElement("span");ve.className="td-dot",ve.style.background=je,te.appendChild(ve),te.appendChild(document.createTextNode(ue.toUpperCase())),oe.appendChild(te);const Ce=document.createElement("div");Ce.className="td-bubble",Ce.dataset.role=ue,Ce.dataset.type="bubble",oe.appendChild(Ce)}const K={meeting:()=>{const ue=l[0];ue?u(ue.id):f()},bulletin:f,decisions:m,knowledge:p};for(const ue of fl){const je=document.createElement("div");je.className="td-facility-label",je.dataset.facility=ue.id,je.textContent=`${ue.icon} ${ue.label}`,je.style.borderColor=`${ue.color}44`;const te=K[ue.id];te&&je.addEventListener("click",te),je.addEventListener("mouseenter",()=>{ir=ue.id}),je.addEventListener("mouseleave",()=>{ir=null}),oe.appendChild(je)}},[ee,l,u,f,m,p]);const Q=S.useCallback(()=>{var Ce;const oe=j.current;if(!oe)return;const K=E.current,ue=k.current,{getRoleSpeech:je,roleStatuses:te,activeExecs:ve}=$.current;for(const Ae of Object.keys(ue)){const ze=ue[Ae],qe=Yt[Ae];if(!qe)continue;let kt,Rt,ft;ze.state==="sitting"?(kt=qe.dx+13,ft=qe.dy+2,Rt=qe.dy+37):(kt=Math.round(ze.x)+6,ft=Math.round(ze.y)-2,Rt=Math.round(ze.y)+18);const Lt=kt/Re.canvasW*100,un=oe.querySelector(`.td-nametag[data-role="${Ae}"]`);if(un){un.style.left=Lt+"%",un.style.top=Rt*K+2+"px";const qt=un.querySelector(".td-dot");if(qt){const re=te[Ae]==="working";qt.style.background=re?"#FBBF24":jc[Ae]??"#8b949e",re?qt.style.animation="td-pulse 1s ease-in-out infinite":qt.style.animation=""}}const gt=oe.querySelector(`.td-bubble[data-role="${Ae}"]`);if(gt){const qt=te[Ae]==="working",re=(Ce=ve.find(xe=>xe.roleId===Ae))==null?void 0:Ce.task,ye=je(Ae),Fe=qt&&re?re.slice(0,30):ye?ye.slice(0,30):"";Fe&&ze.state==="sitting"?(gt.style.display="",gt.style.left=Lt+"%",gt.style.top=(ft-5)*K+"px",gt.textContent=Fe):gt.style.display="none"}}for(const Ae of fl){const ze=oe.querySelector(`.td-facility-label[data-facility="${Ae.id}"]`);if(ze){const qe=Sg(Ae);ze.style.left=qe.cx/Re.canvasW*100+"%",ze.style.top=qe.botY*K+2+"px",ze.classList.toggle("td-facility-label--hover",ir===Ae.id)}}},[]),ie=S.useCallback(oe=>{const K=b.current;if(!K)return null;const ue=K.getBoundingClientRect(),je=E.current,te=(oe.clientX-ue.left)/je,ve=(oe.clientY-ue.top)/je,Ce=k.current;for(const[Ae,ze]of Object.entries(Yt)){if(!Ce[Ae])continue;const qe=Ce[Ae];if(qe.state==="sitting"){if(te>=ze.dx&&te<=ze.dx+26&&ve>=ze.dy&&ve<=ze.dy+40)return{type:"role",id:Ae}}else if(te>=qe.x-2&&te<=qe.x+14&&ve>=qe.y-2&&ve<=qe.y+20)return{type:"role",id:Ae}}for(const Ae of fl){const ze=kg(Ae);if(te>=ze.x&&te<=ze.x+ze.w&&ve>=ze.y&&ve<=ze.y+ze.h)return{type:"facility",id:Ae.id}}return null},[]),Se=S.useCallback(oe=>{const K=b.current;if(!K)return{mx:0,my:0};const ue=K.getBoundingClientRect(),je=E.current;return{mx:(oe.clientX-ue.left)/je,my:(oe.clientY-ue.top)/je}},[]),z=S.useCallback(oe=>{Te.updatePreferences(oe).catch(()=>{})},[]),_=S.useCallback(oe=>{const K=[...T.current,oe];T.current=K,Re=Sd(Re,[oe]),fl=za(Re),In=null,dl=null,z({removedFurniture:K})},[z]),P=S.useCallback((oe,K)=>{if(!Wr||!wl)return;let ue=null;for(const[ze,qe]of Object.entries(Re.rooms)){const kt=wl==="wall"?qe.wx:qe.fx,Rt=wl==="wall"?qe.wy:qe.fy,ft=wl==="wall"?qe.ww:qe.fw,Lt=wl==="wall"?qe.wh:qe.fh;if(oe>=kt&&oe<=kt+ft&&K>=Rt&&K<=Rt+Lt){ue=ze;break}}if(!ue)return;const je=Re.rooms[ue],te=wl==="wall"?je.wx:je.fx,ve=wl==="wall"?je.wy:je.fy,Ce={id:`user-${Wr}-${Date.now()}`,type:Wr,room:ue,zone:wl,offsetX:Math.round(oe-te),offsetY:Math.round(K-ve)},Ae=[...L.current,Ce];L.current=Ae,wl==="wall"?Re.wallDecorations.push(Ce):Re.furniture.push(Ce),fl=za(Re),z({addedFurniture:Ae}),U(null),Y(null)},[z]),A=S.useCallback(oe=>{const K=b.current;if(Ql&&hn){const{mx:je,my:te}=Se(oe),Ce=[...Re.furniture,...Re.wallDecorations].find(qe=>qe.id===hn.defId);if(!Ce)return;const Ae=je-hn.startMx,ze=te-hn.startMy;Ce.offsetX=Math.round(hn.origOffX+Ae),Ce.offsetY=Math.round(hn.origOffY+ze),fl=za(Re),K&&(K.style.cursor="grabbing");return}if(Ql&&tn){const{mx:je,my:te}=Se(oe),ve=Yt[tn.roleId];if(!ve)return;ve.dx=Math.round(tn.origDx+(je-tn.startMx)),ve.dy=Math.round(tn.origDy+(te-tn.startMy));const Ce=k.current[tn.roleId];Ce&&(Ce.homeX=ve.dx+8,Ce.homeY=ve.dy+34),K&&(K.style.cursor="grabbing");return}if(Ql){const{mx:je,my:te}=Se(oe);if(Wr){K&&(K.style.cursor="crosshair");return}const ve=new Set(Object.values(Yt).map(Ae=>Ae.room)),Ce=jd(Re,je,te,ve);if(Ce)dl=Ce;else{const Ae=A0(Yt,je,te);dl=Ae?`desk:${Ae}`:null}or=null,ir=null,K&&(K.style.cursor=dl?"grab":"default");return}const ue=ie(oe);or=(ue==null?void 0:ue.type)==="role"?ue.id:null,ir=(ue==null?void 0:ue.type)==="facility"?ue.id:null,dl=null,K&&(K.style.cursor=ue?"pointer":"default")},[ie,Se]),pe=S.useCallback(oe=>{if(!Ql)return;const{mx:K,my:ue}=Se(oe);if(Wr){P(K,ue),oe.preventDefault();return}const je=new Set(Object.values(Yt).map(Ce=>Ce.room)),te=jd(Re,K,ue,je);if(te){const Ae=[...Re.furniture,...Re.wallDecorations].find(ze=>ze.id===te);Ae&&(In=te,hn={defId:te,startMx:K,startMy:ue,origOffX:Ae.offsetX,origOffY:Ae.offsetY},oe.preventDefault());return}const ve=A0(Yt,K,ue);if(ve){const Ce=Yt[ve];In=`desk:${ve}`,tn={roleId:ve,startMx:K,startMy:ue,origDx:Ce.dx,origDy:Ce.dy},oe.preventDefault();return}In=null},[Se,P]),Ee=S.useCallback(oe=>{if(hn){const ue=[...Re.furniture,...Re.wallDecorations].find(je=>je.id===hn.defId);if(ue){const je={...V.current,[ue.id]:{offsetX:ue.offsetX,offsetY:ue.offsetY}};V.current=je,z({furnitureOverrides:je}),fl=za(Re)}hn=null,b.current&&(b.current.style.cursor="grab");return}if(tn){const K=Yt[tn.roleId];if(K){const ue={...ne.current,[tn.roleId]:{dx:K.dx,dy:K.dy}};ne.current=ue,z({deskOverrides:ue})}tn=null,b.current&&(b.current.style.cursor="grab")}},[z]),Ne=S.useCallback(oe=>{if(!Ql)return;oe.preventDefault();const{mx:K,my:ue}=Se(oe),je=new Set(Object.values(Yt).map(ve=>ve.room)),te=jd(Re,K,ue,je);te&&_(te)},[Se,_]);S.useEffect(()=>{const oe=K=>{!Ql||!In||(K.key==="Delete"||K.key==="Backspace")&&(In.startsWith("desk:")||_(In))};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[_]);const Oe=S.useCallback(()=>{if(hn){const K=[...Re.furniture,...Re.wallDecorations].find(ue=>ue.id===hn.defId);K&&(K.offsetX=hn.origOffX,K.offsetY=hn.origOffY,fl=za(Re)),hn=null}if(tn){const oe=Yt[tn.roleId];oe&&(oe.dx=tn.origDx,oe.dy=tn.origDy);const K=k.current[tn.roleId];K&&(K.homeX=oe.dx+8,K.homeY=oe.dy+34),tn=null}or=null,ir=null,dl=null,b.current&&(b.current.style.cursor="default")},[]),Be=S.useCallback(oe=>{if(Ql)return;const K=ie(oe);if(K){if(K.type==="role"){o(K.id);return}switch(K.id){case"meeting":{const ue=l[0];ue?u(ue.id):f();break}case"bulletin":f();break;case"decisions":m();break;case"knowledge":p();break}}},[ie,o,u,f,m,p]);return c.jsxs("div",{className:"td-scene",children:[c.jsxs("div",{ref:v,className:"td-wrap",children:[c.jsx("canvas",{ref:b,width:Re.canvasW,height:Re.canvasH,className:"td-canvas",onClick:Be,onMouseDown:pe,onMouseUp:Ee,onMouseMove:A,onMouseLeave:Oe,onContextMenu:Ne}),c.jsx("div",{ref:j,className:"td-overlay"})]}),c.jsxs("button",{className:`td-edit-btn${M?" td-edit-btn--active":""}`,onClick:()=>{H(oe=>{const K=!oe;return K||(U(null),Y(null)),K}),In=null,hn=null,tn=null},title:M?"Exit Edit Mode":"Edit Furniture Layout",children:[c.jsx("span",{className:"td-edit-btn__icon",children:M?"✓":"✎"}),c.jsx("span",{className:"td-edit-btn__label",children:M?"DONE":"EDIT"})]}),M&&c.jsx("div",{className:"td-palette",children:jE.map(oe=>c.jsx("button",{className:`td-palette__item${B===oe.type?" td-palette__item--active":""}`,onClick:()=>{B===oe.type?(U(null),Y(null)):(U(oe.type),Y(oe.zone))},title:oe.label,children:c.jsx("span",{children:oe.icon})},oe.type))}),y&&c.jsxs("button",{className:"td-hire-btn",onClick:y,title:"Hire New Role",children:[c.jsx("span",{className:"td-hire-btn__icon",children:"+"}),c.jsx("span",{className:"td-hire-btn__label",children:"HIRE"})]})]})}function UE({role:t,appearance:l,onSave:a,onReset:i,onClose:o,theme:u,onThemeChange:f,onUpdateName:m,initialTab:p,speechSettings:h,onSpeechSettingsChange:g,language:y,onLanguageChange:b,roleLevel:v}){var T;const[j,k]=S.useState(p??"character"),[C,E]=S.useState({...l}),[M,H]=S.useState(t.name),[B,U]=S.useState(!1),D=S.useCallback(()=>E(gs(v)),[v]),Y=S.useCallback(()=>{const L=ph(t.id);E({...L}),i()},[t.id,i]),V=S.useCallback(async()=>{a(C);const L=M.trim();if(m&&L&&L!==t.name){U(!0);try{await m(t.id,L)}catch{}U(!1)}o()},[C,a,o,M,t.name,t.id,m]),ne=c.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[c.jsxs("span",{children:[t.id.toUpperCase()," –"]}),m?c.jsx("input",{value:M,onChange:L=>H(L.target.value),disabled:B,className:"customize-name-input",style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:4,color:"inherit",font:"inherit",padding:"2px 6px",flex:1,minWidth:0}}):c.jsx("span",{children:t.name})]});return c.jsx("div",{className:"customize-overlay",onClick:o,children:c.jsxs("div",{className:"customize-modal",onClick:L=>L.stopPropagation(),children:[c.jsxs("div",{className:"customize-header",children:[c.jsxs("div",{className:"customize-tabs",children:[c.jsx("button",{className:`customize-tab ${j==="character"?"active":""}`,onClick:()=>k("character"),children:"CHARACTER"}),c.jsx("button",{className:`customize-tab ${j==="office"?"active":""}`,onClick:()=>k("office"),children:"OFFICE THEME"}),c.jsx("button",{className:`customize-tab ${j==="settings"?"active":""}`,onClick:()=>k("settings"),children:"SETTINGS"})]}),c.jsx("button",{className:"customize-close",onClick:o,children:"X"})]}),j==="character"?c.jsx("div",{className:"customize-body",children:c.jsx(fg,{roleId:t.id,appearance:C,onChange:E,onRandomize:D,onReset:Y,label:ne,roleLevel:v})}):j==="office"?c.jsx("div",{className:"customize-body",children:c.jsx("div",{className:"customize-themes",children:Object.entries(Fa).map(([L,$])=>c.jsxs("button",{className:`customize-theme-card ${u===L?"active":""}`,onClick:()=>f(L),children:[c.jsxs("div",{className:"customize-theme-preview",style:{background:$.vars["--floor-light"],borderColor:$.vars["--pixel-border"]},children:[c.jsx("div",{style:{background:$.vars["--hud-bg"],height:8,borderBottom:`2px solid ${$.vars["--pixel-border"]}`}}),c.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1 p-1",children:[c.jsx("div",{style:{width:10,height:14,background:$.vars["--accent"],borderRadius:1}}),c.jsx("div",{style:{width:10,height:14,background:$.vars["--active-green"],borderRadius:1}}),c.jsx("div",{style:{width:10,height:14,background:$.vars["--idle-amber"],borderRadius:1}})]}),c.jsx("div",{style:{background:$.vars["--hud-bg"],height:6,borderTop:`2px solid ${$.vars["--pixel-border"]}`}})]}),c.jsxs("div",{className:"customize-theme-name",children:[$.icon," ",$.name]})]},L))})}):c.jsx("div",{className:"customize-body",children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,padding:"8px 0"},children:[c.jsxs("div",{children:[c.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),c.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(L=>c.jsxs("button",{onClick:()=>g==null?void 0:g({mode:L}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(h==null?void 0:h.mode)===L?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(h==null?void 0:h.mode)===L?"rgba(255,255,255,0.08)":"transparent",color:(h==null?void 0:h.mode)===L?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[c.jsx("div",{style:{fontWeight:600,marginBottom:2},children:L==="template"?"TEMPLATE":L==="llm"?"AI":"AUTO"}),c.jsx("div",{style:{fontSize:9,opacity:.7},children:L==="template"?"Static pool ($0)":L==="llm"?"LLM generated":"Detect engine"})]},L))}),c.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),c.jsxs("div",{children:[c.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(h==null?void 0:h.intervalSec)??18,"s"]}),c.jsx("input",{type:"range",min:5,max:120,step:5,value:(h==null?void 0:h.intervalSec)??18,onChange:L=>g==null?void 0:g({intervalSec:Number(L.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),c.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[c.jsx("span",{children:"5s (frequent)"}),c.jsx("span",{children:"120s (rare)"})]})]}),(h==null?void 0:h.mode)!=="template"&&c.jsxs("div",{children:[c.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((T=h==null?void 0:h.dailyBudgetUsd)==null?void 0:T.toFixed(2))??"1.00"]}),c.jsx("input",{type:"range",min:0,max:5,step:.25,value:(h==null?void 0:h.dailyBudgetUsd)??1,onChange:L=>g==null?void 0:g({dailyBudgetUsd:Number(L.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),c.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[c.jsx("span",{children:"$0 (unlimited)"}),c.jsx("span",{children:"$5.00/day"})]})]}),c.jsxs("div",{children:[c.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),c.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:L,label:$})=>c.jsx("button",{onClick:()=>b==null?void 0:b(L),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(y??"auto")===L?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(y??"auto")===L?"rgba(255,255,255,0.08)":"transparent",color:(y??"auto")===L?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:$},L))}),c.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]})]})}),j==="character"&&c.jsxs("div",{className:"customize-footer",children:[c.jsx("button",{className:"customize-btn customize-btn--cancel",onClick:o,children:"CANCEL"}),c.jsx("button",{className:"customize-btn customize-btn--save",onClick:V,children:"SAVE"})]})]})})}function z0(t){const l=Date.now()-new Date(t).getTime(),a=Math.floor(l/6e4);if(a<1)return"just now";if(a<60)return`${a}m ago`;const i=Math.floor(a/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function IE({status:t,history:l,onClose:a,onSave:i,onLoadHistory:o,onRestore:u,saving:f}){const[m,p]=S.useState("save"),[h,g]=S.useState(""),[y,b]=S.useState(null),[v,j]=S.useState(!1),[k,C]=S.useState(null),E=S.useRef(null);S.useEffect(()=>{m==="history"&&o()},[m,o]),S.useEffect(()=>{var D;(D=E.current)==null||D.focus()},[]);const M=[...((t==null?void 0:t.modified)??[]).map(D=>({status:"M",file:D})),...((t==null?void 0:t.untracked)??[]).map(D=>({status:"A",file:D}))],H=async()=>{b(null),C(null);try{const D=await i(h||void 0);C(D),g("")}catch(D){b(D instanceof Error?D.message:"Save failed")}},B=async D=>{if(confirm(`Restore from commit ${D.slice(0,7)}? This creates a new commit with those files.`)){j(!0);try{await u(D),j(!1)}catch(Y){b(Y instanceof Error?Y.message:"Restore failed"),j(!1)}}};S.useEffect(()=>{const D=Y=>{Y.key==="Escape"&&a()};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[a]);const U=D=>{D.key==="Enter"&&(D.metaKey||D.ctrlKey)&&H()};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:a}),c.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[520px] max-h-[80vh] z-[61] overflow-hidden flex flex-col",style:{background:"var(--hud-bg)",border:"3px solid var(--pixel-border)",fontFamily:"var(--pixel-font)",color:"var(--terminal-text)"},onKeyDown:U,children:[c.jsxs("div",{className:"px-5 py-3 flex items-center justify-between shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("span",{className:"text-lg font-black tracking-tight",children:"SAVE GAME"}),c.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:(t==null?void 0:t.branch)??""})]}),c.jsx("button",{onClick:a,className:"text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] cursor-pointer text-lg",children:"×"})]}),c.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["save","history"].map(D=>c.jsx("button",{onClick:()=>p(D),className:"flex-1 py-2 text-[11px] font-bold uppercase tracking-wider cursor-pointer",style:{background:m===D?"var(--hud-bg-alt)":"transparent",color:m===D?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:m===D?"2px solid var(--accent)":"2px solid transparent"},children:D==="save"?"SAVE":"HISTORY"},D))}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[m==="save"&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"text-[11px]",style:{color:"var(--terminal-text-secondary)"},children:M.length>0?c.jsxs("span",{style:{color:"var(--idle-amber)"},children:["* ",M.length," unsaved change",M.length>1?"s":""]}):c.jsx("span",{style:{color:"var(--active-green)"},children:"All changes saved"})}),M.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Changed Files"}),c.jsx("div",{className:"text-[11px] max-h-[160px] overflow-y-auto p-2 space-y-0.5",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)"},children:M.map(({status:D,file:Y})=>c.jsxs("div",{className:"flex gap-2",children:[c.jsx("span",{style:{color:D==="A"?"var(--active-green)":"var(--idle-amber)",width:"14px"},children:D}),c.jsx("span",{style:{color:"var(--terminal-text-secondary)"},children:Y})]},Y))})]}),M.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Save Message"}),c.jsx("input",{ref:E,type:"text",value:h,onChange:D=>g(D.target.value),placeholder:"Optional: describe your progress...",className:"w-full px-3 py-2 text-[12px] outline-none",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"}})]}),M.length>0&&c.jsx("div",{className:"flex gap-3",children:c.jsx("button",{onClick:H,disabled:f,className:"flex-1 py-2.5 text-[12px] font-black uppercase tracking-wider cursor-pointer disabled:opacity-50",style:{background:"var(--accent)",color:"#fff",border:"2px solid var(--accent)"},children:f?"SAVING...":t!=null&&t.hasRemote?"SAVE & PUSH":"SAVE"})}),M.length>0&&t&&!t.hasRemote&&c.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"Local save only — add a git remote to enable push"}),k&&c.jsxs("div",{className:"text-[11px] p-2",style:{background:"rgba(59,185,80,0.1)",border:"1px solid var(--active-green)",color:"var(--active-green)"},children:["Saved! ",k.filesChanged," file",k.filesChanged>1?"s":""," committed",k.pushed?" & pushed":"",k.pushError?` (push error: ${k.pushError})`:""]}),y&&c.jsx("div",{className:"text-[11px] p-2",style:{background:"rgba(211,47,47,0.1)",border:"1px solid #D32F2F",color:"#EF5350"},children:y}),(t==null?void 0:t.lastCommit)&&c.jsxs("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:["Last save: ",t.lastCommit.message," (",z0(t.lastCommit.date),")"]})]}),m==="history"&&c.jsxs(c.Fragment,{children:[l.length===0&&c.jsx("div",{className:"text-[11px] text-center py-8",style:{color:"var(--terminal-text-muted)"},children:"No save history"}),c.jsx("div",{className:"space-y-1",children:l.map(D=>c.jsxs("div",{className:"flex items-center justify-between py-2 px-3 group",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--accent)"},children:D.shortSha}),c.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--terminal-text)"},children:D.message})]}),c.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:z0(D.date)})]}),c.jsx("button",{onClick:()=>B(D.sha),disabled:v,className:"text-[10px] font-bold px-2 py-1 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--idle-amber)"},children:"LOAD"})]},D.sha))})]})]})]})]})}const Cc=[0,1e4,5e4,15e4,4e5,1e6,25e5,5e6,1e7,25e6];function Cg(t){let l=1;for(let a=Cc.length-1;a>=0;a--)if(t>=Cc[a]){l=a+1;break}return Math.min(l,10)}function YE(t){const l=Cg(t);if(l>=10)return 1;const a=Cc[l-1],i=Cc[l];return Math.min(1,(t-a)/(i-a))}function M0(t){const l={};for(const[a,i]of Object.entries(t)){const o=i.inputTokens+i.outputTokens;l[a]={level:Cg(o),totalTokens:o,progress:YE(o)}}return l}const qE=[{id:"first-employee",name:"First Employee",icon:"🏆",description:"Hired your first role",check:t=>t.roleCount>=1},{id:"full-team",name:"Full Team",icon:"👥",description:"Hired 5+ roles",check:t=>t.roleCount>=5},{id:"token-10k",name:"Getting Started",icon:"📊",description:"Used 10K tokens total",check:t=>t.totalTokens>=1e4},{id:"token-100k",name:"Power User",icon:"💪",description:"Used 100K tokens total",check:t=>t.totalTokens>=1e5},{id:"token-millionaire",name:"Token Millionaire",icon:"🎖",description:"Used 1M tokens total",check:t=>t.totalTokens>=1e6},{id:"token-mogul",name:"Token Mogul",icon:"💎",description:"Used 10M tokens total",check:t=>t.totalTokens>=1e7},{id:"first-promotion",name:"First Promotion",icon:"⭐",description:"Any role reached Lv.3",check:t=>t.roles.some(l=>l.level>=3)},{id:"senior-staff",name:"Senior Staff",icon:"🌟",description:"Any role reached Lv.5",check:t=>t.roles.some(l=>l.level>=5)},{id:"master-class",name:"Master Class",icon:"👑",description:"Any role reached Lv.10",check:t=>t.roles.some(l=>l.level>=10)},{id:"full-house",name:"Full House",icon:"🏠",description:"All roles Lv.5+",check:t=>t.roleCount>=3&&t.roles.every(l=>l.level>=5)}];function _0(t){return qE.filter(l=>l.check(t))}const XE={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍","data-analyst":"📊"},mc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},VE={cto:"아키텍처",cbo:"시장 분석",pm:"PRD 작성",engineer:"코딩",designer:"시안 제작",qa:"품질 검증"};function GE(t){let l=0;for(let i=0;i<t.length;i++)l=t.charCodeAt(i)+((l<<5)-l);return`hsl(${(l%360+360)%360}, 50%, 40%)`}function KE({importJob:t,onImportDone:l}){var zl,Us,pi,yi;const[a,i]=S.useState([]),[o,u]=S.useState([]),[f,m]=S.useState([]),[p,h]=S.useState([]),[g,y]=S.useState([]),[b,v]=S.useState([]),[j,k]=S.useState("TYCONO"),[C,E]=S.useState(!0),[M,H]=S.useState(null),[B,U]=S.useState({type:"none"}),[D,Y]=S.useState(null),[V,ne]=S.useState(null),[T,L]=S.useState([]),[$,ee]=S.useState(!1),[ae,X]=S.useState([]),[I,Q]=S.useState(0),[ie,Se]=S.useState(!1),[z,_]=S.useState({}),[P,A]=S.useState("ceo"),[pe,Ee]=S.useState(null),[Ne,Oe]=S.useState(!1),[Be,oe]=S.useState({}),K=S.useRef({}),[ue,je]=S.useState(!1),[te,ve]=S.useState(null),[Ce,Ae]=S.useState({}),[ze,qe]=S.useState([]),[kt,Rt]=S.useState([]),[ft,Lt]=S.useState(void 0),[un,gt]=S.useState(!1);S.useEffect(()=>{Te.getStatus().then(R=>{Lt(R.engine),gt(!!R.hasApiKey)}).catch(()=>{})},[]);const{getAppearance:qt,setAppearance:re,resetAppearance:ye,theme:Fe,setTheme:xe,speechSettings:ke,setSpeechSettings:bt,language:At,setLanguage:Ze}=_C(),[he,ut]=S.useState(null),[dt,wn]=S.useState("character"),tt=RC(),[Fc,Jl]=S.useState(!1);S.useEffect(()=>{const R=de=>{(de.metaKey||de.ctrlKey)&&de.key==="s"&&(de.preventDefault(),tt.dirtyCount>0&&Jl(!0))};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[tt.dirtyCount]);const[ll,Pl]=S.useState(null),[kn,al]=S.useState(null),[qn,Fs]=S.useState([]),[Al,hr]=S.useState(!1),ea=S.useRef(!1),ii=S.useRef(null);let si=S.useRef(0);const oi=S.useRef(new Set),ml=(R,de,me)=>{const ge={id:si.current++,type:R,text:de,detail:me};Fs(be=>[...be,ge])};S.useEffect(()=>{var R;Al&&((R=ii.current)==null||R.scrollIntoView({behavior:"smooth"}))},[qn,Al]),S.useEffect(()=>{t&&(ea.current||(ea.current=!0,al("Scanning knowledge sources..."),Fs([{id:0,type:"scan",text:"Starting knowledge import..."}]),si.current=1,fetch("/api/setup/import-knowledge",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:t.paths,companyRoot:t.companyRoot})}).then(async R=>{var be;const de=(be=R.body)==null?void 0:be.getReader();if(!de)return;const me=new TextDecoder;let ge="";for(;;){const{done:Me,value:$e}=await de.read();if(Me)break;ge+=me.decode($e,{stream:!0});const Xe=ge.split(`
|
|
88
|
-
`);ge=Xe.pop()||"";let We="";for(const Ve of Xe)if(Ve.startsWith("event: "))We=Ve.slice(7).trim();else if(Ve.startsWith("data: ")&&We){try{const Ot=JSON.parse(Ve.slice(6));switch(We){case"scanning":al(`Scanning: ${Ot.path} (${Ot.fileCount} files)`),ml("scan",`Found ${Ot.fileCount} files`,Ot.path);break;case"processing":Pl({index:Ot.index,total:Ot.total}),al(`Importing knowledge... (${Ot.index}/${Ot.total})`),ml("process",`Processing: ${Ot.file}`,`${Ot.index} / ${Ot.total}`);break;case"created":ml("created",Ot.title,Ot.summary);break;case"skipped":ml("process",`Skipped: ${Ot.file}`,Ot.reason);break;case"done":al(null),Pl(null),ml("done",`Import complete! ${Ot.created} created, ${Ot.skipped} skipped.`),et(`Knowledge import complete! ${Ot.created} documents imported.`,"#2E7D32"),l==null||l();break;case"error":al(null),Pl(null),ml("error",Ot.message),et(`Import failed: ${Ot.message}`,"#B71C1C"),l==null||l();break}}catch{}We=""}}}).catch(R=>{al(null),ml("error",R.message),et(`Import error: ${R.message}`,"#B71C1C"),l==null||l()})))},[t]);const[La,mr]=S.useState("card"),[ci,Rs]=S.useState(typeof window<"u"?window.innerWidth:1200);S.useEffect(()=>{const R=()=>Rs(window.innerWidth);return window.addEventListener("resize",R),()=>window.removeEventListener("resize",R)},[]);const Xn=ci<1024,[St,Xt]=S.useState(!1),[Vn,ui]=S.useState(560),[xr,fn]=S.useState([]),[$a,pn]=S.useState(null),[pr,xl]=S.useState(null),{sendMessage:ta}=TC();S.useEffect(()=>{Promise.all([Te.getCompany().then(R=>{k(R.name),i(R.roles)}),Te.getProjects().then(u),Te.getStandups().then(m),Te.getWaves().then(h),Te.getDecisions().then(y),Te.getKnowledge().then(v).catch(()=>{}),Te.getOrgTree().then(R=>{_(R.nodes),A(R.root)}).catch(()=>{}),Te.getCostSummary().then(R=>fi(M0(R.byRole))).catch(()=>{})]).catch(R=>H(`Failed to load: ${R.message}`)).finally(()=>E(!1))},[]),S.useEffect(()=>{Te.deleteEmptySessions().catch(()=>{}),Te.getSessions().then(R=>{if(R.length>0){const de=R.map(ge=>({...ge,messages:[]}));fn(de);const me=de.find(ge=>ge.status==="active")??de[0];pn(me.id),Xt(!0)}}).catch(R=>{console.error("Failed to load sessions",R)})},[]),S.useEffect(()=>{const R=()=>{fetch("/api/exec/status").then(me=>me.json()).then(me=>{Ae(me.statuses??{}),qe(me.activeExecutions??[])}).catch(()=>{})};R();const de=setInterval(R,3e3);return()=>clearInterval(de)},[]),S.useEffect(()=>{B.type==="role"?Te.getRole(B.roleId).then(Y).catch(console.error):Y(null)},[B]);const rl=()=>U({type:"none"}),na=async(R,de)=>{const me=a.find(be=>be.id===R),ge=(V==null?void 0:V.mode)==="ask";ne(null);try{const{jobId:be}=await Te.startJob({type:"assign",roleId:R,task:de,readOnly:ge}),Me=mc[R]??"#666",$e=`${R.toUpperCase()} · ${(me==null?void 0:me.name)??R}`;Se(!1),L([{jobId:be,title:$e,color:Me}]),Pt.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO → ${(me==null?void 0:me.name)??R}] ${ge?"Ask":"Assign"}: ${de}`,type:"dispatch",targetRoleId:R})}catch(be){et(`Failed to start job: ${be instanceof Error?be.message:"unknown"}`,"#C62828")}},et=(R,de)=>{const me=Date.now();Rt(ge=>[...ge,{id:me,message:R,color:de}]),setTimeout(()=>Rt(ge=>ge.filter(be=>be.id!==me)),4e3)},fi=R=>{var me,ge;const de=K.current;for(const[be,Me]of Object.entries(R)){const $e=((me=de[be])==null?void 0:me.level)??0;if($e>0&&Me.level>$e){const Xe=((ge=a.find(We=>We.id===be))==null?void 0:ge.name)??be.toUpperCase();et(`${Xe} leveled up to Lv.${Me.level}!`,"#7C3AED")}}K.current=R,oe(R)};S.useEffect(()=>{const R={roles:Object.entries(Be).map(([ge,be])=>({id:ge,level:be.level,totalTokens:be.totalTokens})),totalTokens:Object.values(Be).reduce((ge,be)=>ge+be.totalTokens,0),roleCount:a.length},de=_0(R),me=oi.current;for(const ge of de)me.has(ge.id)||me.size>0&&et(`${ge.icon} Badge earned: ${ge.name}!`,"#D4A017");oi.current=new Set(de.map(ge=>ge.id))},[Be,a.length]);const Os=()=>{var de;const R=T[T.length-1];R&&(et(`${R.title} completed`,R.color),Pt.pushMessage({ts:Date.now(),roleId:((de=R.title.split(" · ")[0])==null?void 0:de.toLowerCase())??"unknown",text:`[${R.title}] Job completed`,type:"dispatch"})),Te.getStandups().then(m).catch(console.error),Te.getCompany().then(me=>i(me.roles)).catch(console.error),Te.getCostSummary().then(me=>fi(M0(me.byRole))).catch(()=>{})},Dl=async R=>{ee(!1);try{const de=await Te.startJob({type:"wave",directive:R}),me=de.jobIds??(de.jobId?[de.jobId]:[]),ge=a.filter(Me=>Me.level==="c-level"),be=me.map((Me,$e)=>{var Xe,We;return{jobId:Me,roleId:((Xe=ge[$e])==null?void 0:Xe.id)??`role-${$e}`,roleName:((We=ge[$e])==null?void 0:We.name)??`C-Level ${$e+1}`}});Pt.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO WAVE] "${R}" → ${be.map(Me=>Me.roleName).join(", ")}`,type:"dispatch"}),Object.keys(z).length>0?(Ee({directive:R,rootJobs:be}),Oe(!1)):(X(be),Q(0),Se(!1),be.length>0&&L([{jobId:be[0].jobId,title:`CEO WAVE · ${be[0].roleId.toUpperCase()}`,color:"#B71C1C"}]))}catch(de){et(`Failed to start wave: ${de instanceof Error?de.message:"unknown"}`,"#C62828")}},Tl=()=>{Te.getWaves().then(h).catch(console.error),Te.getStandups().then(m).catch(console.error)},di=()=>{Te.getCompany().then(R=>i(R.roles)).catch(console.error)},Bs=async(R,de)=>{await Te.createRole(R),re(R.id,de),di(),et(`${R.name} hired!`,"#2E7D32")},Ls=async R=>{await Te.deleteRole(R),di(),ve(null),et(`${R.toUpperCase()} removed`,"#B71C1C")},$s=async(R,de)=>{await Te.updateRole(R,de),di(),de.name&&et(`${R.toUpperCase()} renamed to "${de.name}"`,"#1565C0")},yr=R=>{Xt(!0)},gr=async R=>{try{const de=await Te.createSession(R,"talk");fn(me=>[de,...me]),pn(de.id),Xt(!0)}catch(de){console.error("Failed to create session",de),et(`Failed to create session: ${de instanceof Error?de.message:"API unreachable"}`,"#B71C1C")}},il=async R=>{try{const de=await Te.createSession(R,"talk");fn(me=>[de,...me]),pn(de.id)}catch(de){console.error("Failed to create session",de),et(`Failed to create session: ${de instanceof Error?de.message:"API unreachable"}`,"#B71C1C")}},Sn=async R=>{const de=ze.find(be=>be.roleId===R),me=(de==null?void 0:de.jobId)??(de==null?void 0:de.id);if(me&&Ce[R]==="working"){const be=a.find(Xe=>Xe.id===R),Me=mc[R]??"#666",$e=`${R.toUpperCase()} · ${(be==null?void 0:be.name)??R}`;L([{jobId:me,title:$e,color:Me}]),Se(!1);return}const ge=xr.find(be=>be.roleId===R);if(ge)pn(ge.id),Pt.setActiveChannelId(null);else try{const be=await Te.createSession(R,"talk");fn(Me=>[be,...Me]),pn(be.id),Pt.setActiveChannelId(null)}catch(be){console.error("Failed to create session",be)}Xt(!0)},Hs=async R=>{try{await Te.deleteSession(R),fn(de=>{var ge;const me=de.filter(be=>be.id!==R);return $a===R&&pn(((ge=me[0])==null?void 0:ge.id)??null),me})}catch(de){console.error("Failed to delete session",de),et(`Failed to close session: ${de instanceof Error?de.message:"API error"}`,"#B71C1C")}},Rc=async()=>{try{const{ids:R}=await Te.deleteEmptySessions();if(R.length===0)return;fn(de=>{var ge;const me=de.filter(be=>!R.includes(be.id));return $a&&R.includes($a)&&pn(((ge=me[0])==null?void 0:ge.id)??null),me}),et(`Cleared ${R.length} empty session${R.length!==1?"s":""}`,"#2E7D32")}catch(R){et(`Failed to clear empty sessions: ${R instanceof Error?R.message:"API error"}`,"#B71C1C")}},hi=async()=>{if(!confirm("Close all sessions? This cannot be undone."))return;const R=xr.map(de=>de.id);try{await Te.deleteSessions(R),fn([]),pn(null),et("All sessions closed","#2E7D32")}catch(de){et(`Failed to close sessions: ${de instanceof Error?de.message:"API error"}`,"#B71C1C")}},sl=(R,de)=>{fn(me=>me.map(ge=>{if(ge.id!==R)return ge;const be=[...ge.messages],Me=be[be.length-1];if(Me&&Me.from==="role"&&Me.status==="streaming"){const $e=[...Me.streamEvents??[],de];be[be.length-1]={...Me,streamEvents:$e}}return{...ge,messages:be}}))},Ha=(R,de,me)=>{const ge={id:`msg-${Date.now()}-ceo`,from:"ceo",content:de,type:me==="do"?"directive":"conversation",status:"done",timestamp:new Date().toISOString()},be={id:`msg-${Date.now()+1}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:new Date().toISOString(),streamEvents:[]};fn(Me=>Me.map($e=>$e.id===R?{...$e,messages:[...$e.messages,ge,be],updatedAt:new Date().toISOString()}:$e)),xl(R),ta(R,de,me,{onThinking:Me=>{fn($e=>$e.map(Xe=>{if(Xe.id!==R)return Xe;const We=[...Xe.messages],Ve=We[We.length-1];return Ve&&Ve.from==="role"&&Ve.status==="streaming"&&(We[We.length-1]={...Ve,thinking:(Ve.thinking??"")+Me}),{...Xe,messages:We}})),sl(R,{type:"thinking",timestamp:Date.now(),text:Me})},onText:Me=>{fn($e=>$e.map(Xe=>{if(Xe.id!==R)return Xe;const We=[...Xe.messages],Ve=We[We.length-1];return Ve&&Ve.from==="role"&&Ve.status==="streaming"&&(We[We.length-1]={...Ve,content:Ve.content+Me}),{...Xe,messages:We}}))},onToolUse:(Me,$e)=>{sl(R,{type:"tool",timestamp:Date.now(),toolName:Me,toolInput:$e})},onDispatch:(Me,$e)=>{sl(R,{type:"dispatch",timestamp:Date.now(),roleId:Me,task:$e})},onDispatchProgress:(Me,$e,Xe)=>{var We;$e==="tool"?sl(R,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:"tool",toolName:Xe.name,toolInput:Xe.input}):$e==="thinking"?sl(R,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:"thinking",text:Xe.text}):$e==="text"?sl(R,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:"text",text:(We=Xe.text)==null?void 0:We.slice(-200)}):($e==="done"||$e==="error")&&sl(R,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:$e})},onTurn:Me=>{sl(R,{type:"turn",timestamp:Date.now(),turn:Me})},onDone:()=>{fn(Me=>Me.map($e=>{if($e.id!==R)return $e;const Xe=$e.messages.map(Ve=>Ve.status==="streaming"?{...Ve,status:"done"}:Ve),We=$e.messages.length<=2?de.slice(0,40).replace(/\n/g," "):$e.title;return{...$e,messages:Xe,title:We}})),xl(null)},onError:Me=>{fn($e=>$e.map(Xe=>{if(Xe.id!==R)return Xe;const We=Xe.messages.map(Ve=>Ve.status==="streaming"?{...Ve,status:"error",content:Ve.content||Me}:Ve);return{...Xe,messages:We}})),xl(null)}})},Oc=(R,de)=>{fn(me=>me.map(ge=>ge.id===R?{...ge,mode:de}:ge)),Te.updateSession(R,{mode:de}).catch(console.error)},jn=new Date().toISOString().slice(0,10),Gn=o[0],mi={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},xi=R=>{const de=mi[R];if(!de)return"";for(const me of f){const ge=me.content,be=ge.indexOf(`## ${de}`);if(be===-1)continue;const Me=ge.indexOf(`
|
|
89
|
-
## `,be+10),Xe=(Me===-1?ge.slice(be):ge.slice(be,Me)).split(`
|
|
90
|
-
`).filter(We=>We.trim().length>0);for(const We of Xe){const Ve=We.replace(/^#+\s*/,"").replace(/\*\*/g,"").replace(/^[-*]\s+/,"").trim();if(!(Ve.startsWith("|")||Ve.startsWith("{")||Ve.startsWith("[")||Ve.startsWith("```")||Ve.startsWith("---")||Ve.includes("Journal")||Ve.includes("(c-level)")||Ve.includes("(team-lead)")||Ve.includes("(member)")||/^(CEO |작업 결과|생성\/수정|APPROVAL|비고|상황 보고|태스크$)/.test(Ve))&&Ve.length>15&&Ve.length<120)return Ve}}return""},la=R=>{const de=mi[R];if(!de)return"";for(const me of f){const ge=me.content,be=ge.indexOf(`## ${de}`);if(be===-1)continue;const Me=ge.indexOf(`
|
|
91
|
-
## `,be+10),Xe=(Me===-1?ge.slice(be):ge.slice(be,Me)).replace(/^## .+\n/,"").trim();if(Xe)return Xe.slice(0,1500)}return""},Pt=QC();S.useEffect(()=>{a.length>0&&Pt.syncDefaultMembers(a)},[a]);const aa=qC({roles:a,roleStatuses:Ce,activeExecs:ze,getStandupSpeech:xi});return eE({roles:a,roleStatuses:Ce,activeExecs:ze,channels:Pt.channels,relationships:aa.relationships,pushMessage:Pt.pushMessage,speechSettings:ke,engineType:ft,hasApiKey:un}),C?c.jsxs("div",{className:"h-screen flex flex-col bg-[var(--floor-light)]",style:{fontFamily:"var(--pixel-font)"},children:[(kn||qn.length>0)&&c.jsxs("div",{className:"shrink-0 z-[44]",children:[c.jsxs("div",{className:"flex items-center gap-3 px-5 py-2 text-xs cursor-pointer select-none",style:{background:"var(--accent)",color:"#fff",fontFamily:"var(--pixel-font)"},onClick:()=>hr(R=>!R),children:[kn?c.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):c.jsx("span",{className:"shrink-0",children:"✅"}),c.jsx("span",{className:"flex-1",children:kn||"Knowledge import finished"}),ll&&c.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:c.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ll.index/ll.total*100}%`,background:"#fff"}})}),c.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:Al?"▲":"▼"})]}),Al&&c.jsxs("div",{className:"overflow-y-auto text-xs",style:{background:"var(--terminal-bg)",borderBottom:"2px solid var(--accent)",maxHeight:240,fontFamily:"var(--pixel-font)"},children:[qn.map(R=>c.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[R.type==="scan"&&"🔍",R.type==="process"&&"⚙️",R.type==="created"&&"✅",R.type==="done"&&"🎉",R.type==="error"&&"❌"]}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{style:{color:R.type==="error"?"#EF4444":R.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:R.text}),R.detail&&c.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:R.detail})]})]},R.id)),c.jsx("div",{ref:ii})]})]}),c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsxs("div",{className:"text-center",children:[c.jsx("div",{className:"text-4xl mb-3",children:"🏢"}),c.jsx("div",{className:"text-gray-600 font-semibold text-xs",children:"LOADING OFFICE..."})]})})]}):M?c.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:c.jsxs("div",{className:"text-center max-w-md",style:{fontFamily:"var(--pixel-font)"},children:[c.jsx("div",{className:"text-4xl mb-3",children:"⚠️"}),c.jsx("div",{className:"text-gray-800 font-semibold mb-2 text-xs",children:"CONNECTION ERROR"}),c.jsx("div",{className:"text-gray-500 text-xs mb-4",children:M}),c.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-gray-800 text-white text-xs font-bold cursor-pointer border-2 border-gray-600",style:{fontFamily:"var(--pixel-font)"},children:"RETRY"})]})}):c.jsxs("div",{className:"flex flex-col",style:{height:"100dvh",fontFamily:"var(--pixel-font)"},children:[c.jsxs("div",{className:"flex items-center justify-between px-5 py-2 bg-[var(--hud-bg)] text-white text-sm shrink-0 z-[45]",style:{borderBottom:"3px solid var(--pixel-border)"},children:[c.jsxs("div",{className:"font-black text-[13px] tracking-tight",style:{color:"var(--idle-amber)",textShadow:"2px 2px 0 rgba(0,0,0,0.5)"},children:["🏢"," ",c.jsx("span",{style:{color:"var(--terminal-text)"},children:j})]}),c.jsxs("div",{className:"flex gap-4 text-[var(--terminal-text-secondary)] text-[11px] items-center",children:[(()=>{const R=Object.values(Be).reduce((Me,$e)=>Me+$e.totalTokens,0),de=R>=1e6?`${(R/1e6).toFixed(1)}M`:R>=1e3?`${Math.round(R/1e3)}K`:String(R),me=Math.min(100,Math.round(R/25e4*100)),ge=ze.length,be=a.length>0?Math.round(ge/a.length*100):0;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["💰",c.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:c.jsx("div",{className:"h-full",style:{width:`${me}%`,background:"linear-gradient(90deg,#22c55e,#34D399)"}})}),c.jsx("strong",{className:"text-[var(--active-green)]",children:de})]}),c.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["⚡",c.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:c.jsx("div",{className:"h-full",style:{width:`${be}%`,background:"linear-gradient(90deg,#3b82f6,#60A5FA)"}})}),c.jsx("strong",{className:"text-[var(--terminal-text)]",children:be})]})]})})(),c.jsxs("span",{className:"hidden sm:inline",children:["Roles: ",c.jsx("strong",{className:"text-[var(--terminal-text)]",children:a.length})]}),c.jsxs("span",{className:"hidden sm:inline",children:["Projects: ",c.jsx("strong",{className:"text-[var(--terminal-text)]",children:o.length})]}),ze.length>0&&c.jsxs("span",{className:"text-amber-400",children:["Working: ",c.jsx("strong",{children:ze.length})]}),(()=>{const R={roles:Object.entries(Be).map(([me,ge])=>({id:me,level:ge.level,totalTokens:ge.totalTokens})),totalTokens:Object.values(Be).reduce((me,ge)=>me+ge.totalTokens,0),roleCount:a.length},de=_0(R);return de.length>0?c.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:de.map(me=>c.jsx("span",{title:`${me.name}: ${me.description}`,style:{fontSize:12,cursor:"default"},children:me.icon},me.id))}):null})(),c.jsxs("button",{onClick:()=>{tt.state==="no-git"?tt.initGit():Jl(!0)},className:"flex items-center gap-1 cursor-pointer px-1.5 py-0.5",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--pixel-border)"},title:tt.state==="no-git"?"Click to initialize git repository":tt.state==="dirty"?`${tt.dirtyCount} unsaved changes`:"All saved",children:[c.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}}),c.jsx("span",{children:jn})]})]})]}),(kn||qn.length>0)&&c.jsxs("div",{className:"shrink-0 z-[44]",children:[c.jsxs("div",{className:"flex items-center gap-3 px-5 py-2 text-xs cursor-pointer select-none",style:{background:"var(--accent)",color:"#fff",fontFamily:"var(--pixel-font)"},onClick:()=>hr(R=>!R),children:[kn?c.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):c.jsx("span",{className:"shrink-0",children:"✅"}),c.jsx("span",{className:"flex-1",children:kn||"Knowledge import finished"}),ll&&c.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:c.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ll.index/ll.total*100}%`,background:"#fff"}})}),c.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:Al?"▲":"▼"})]}),Al&&c.jsxs("div",{className:"overflow-y-auto text-xs",style:{background:"var(--terminal-bg)",borderBottom:"2px solid var(--accent)",maxHeight:240,fontFamily:"var(--pixel-font)"},children:[qn.map(R=>c.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[c.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[R.type==="scan"&&"🔍",R.type==="process"&&"⚙️",R.type==="created"&&"✅",R.type==="done"&&"🎉",R.type==="error"&&"❌"]}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{style:{color:R.type==="error"?"#EF4444":R.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:R.text}),R.detail&&c.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:R.detail})]})]},R.id)),c.jsx("div",{ref:ii}),qn.length===0&&c.jsx("div",{className:"px-5 py-4 text-center",style:{color:"var(--terminal-text-muted)"},children:"Waiting for events..."})]})]}),c.jsxs("div",{className:"flex-1 overflow-hidden flex relative",children:[c.jsx("div",{className:"flex-1 overflow-y-auto relative floor-grid",style:{background:"var(--floor-light)"},children:La==="iso"?c.jsx(HE,{roles:a,projects:o,waves:p,standups:f,decisions:g,roleStatuses:Ce,activeExecs:ze,onRoleClick:R=>U({type:"role",roleId:R}),onProjectClick:R=>U({type:"project",projectId:R}),onBulletinClick:()=>U({type:"bulletin"}),onDecisionsClick:()=>U({type:"decisions"}),onKnowledgeClick:()=>U({type:"knowledge"}),knowledgeDocsCount:b.length,getRoleSpeech:aa.getSpeech,getAppearance:qt,onHireClick:()=>je(!0)}):c.jsxs("div",{className:`${St?"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(me=>me.level==="c-level"),de=a.filter(me=>me.level!=="c-level");return c.jsxs(c.Fragment,{children:[R.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"pixel-section-label",children:"LEADERSHIP"}),c.jsx("div",{className:`grid gap-2 ${R.length===1?"grid-cols-1":"grid-cols-2"}`,children:R.map(me=>{var ge,be;return c.jsx(F0,{role:me,speech:aa.getSpeech(me.id),onClick:()=>U({type:"role",roleId:me.id}),liveStatus:Ce[me.id],activeTask:(ge=ze.find(Me=>Me.roleId===me.id))==null?void 0:ge.task,featured:!0,appearance:qt(me.id),xpLevel:(be=Be[me.id])==null?void 0:be.level},me.id)})})]}),c.jsx("div",{className:"pixel-section-label",children:"TEAM"}),c.jsxs("div",{className:`grid gap-2 ${St?"grid-cols-3":"grid-cols-4"}`,children:[de.map(me=>{var ge,be;return c.jsx(F0,{role:me,speech:aa.getSpeech(me.id),onClick:()=>U({type:"role",roleId:me.id}),liveStatus:Ce[me.id],activeTask:(ge=ze.find(Me=>Me.roleId===me.id))==null?void 0:ge.task,appearance:qt(me.id),xpLevel:(be=Be[me.id])==null?void 0:be.level},me.id)}),c.jsx("div",{className:"pixel-card pixel-card--hire",onClick:()=>je(!0),children:c.jsxs("div",{className:"pixel-card--hire-inner",children:[c.jsx("span",{className:"pixel-card--hire-icon",children:"+"}),c.jsx("span",{className:"pixel-card--hire-label",children:"HIRE NEW ROLE"})]})})]})]})})(),c.jsx("div",{className:"pixel-section-label mt-1",children:"OFFICE"}),c.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[c.jsxs("div",{className:"facility-card-compact",onClick:Gn?()=>U({type:"project",projectId:Gn.id}):void 0,style:Gn?void 0:{borderStyle:"dashed",opacity:.5},children:[c.jsxs("div",{className:"fcc-hdr",style:{background:"#3B82F6"},children:["🏢"," MEETING ROOM"]}),c.jsx("div",{className:"fcc-canvas",children:c.jsx(rc,{type:"meeting"})}),c.jsxs("div",{className:"fcc-body",children:[c.jsx("div",{className:"fcc-desc",children:"Projects, PRDs, and task boards"}),Gn?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"fcc-title",children:['"',Gn.name,'"']}),c.jsxs("div",{className:"fcc-meta",children:["Status: ",c.jsx("strong",{style:{color:"var(--active-green)"},children:Gn.status})]})]}):c.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No active projects"})]})]}),c.jsxs("div",{className:"facility-card-compact",onClick:()=>U({type:"bulletin"}),children:[c.jsxs("div",{className:"fcc-hdr",style:{background:"#64748b"},children:["📋"," BULLETIN"]}),c.jsx("div",{className:"fcc-canvas",children:c.jsx(rc,{type:"bulletin"})}),c.jsxs("div",{className:"fcc-body",children:[c.jsx("div",{className:"fcc-desc",children:"Waves and daily standups"}),p.slice(0,1).map(R=>c.jsxs("div",{className:"fcc-item",children:["Wave ",R.id]},R.id)),f.slice(0,1).map(R=>c.jsxs("div",{className:"fcc-item",children:["Standup ",R.date]},R.date)),p.length===0&&f.length===0&&c.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No entries yet"})]})]}),c.jsxs("div",{className:"facility-card-compact",onClick:()=>U({type:"decisions"}),children:[c.jsxs("div",{className:"fcc-hdr",style:{background:"#EF4444"},children:["📜"," DECISIONS"]}),c.jsx("div",{className:"fcc-canvas",children:c.jsx(rc,{type:"decision"})}),c.jsxs("div",{className:"fcc-body",children:[c.jsx("div",{className:"fcc-desc",children:"CEO strategic decision log"}),c.jsxs("div",{className:"fcc-title",children:[g.length," decisions"]}),g.slice(0,2).map(R=>c.jsxs("div",{className:"fcc-item",children:["#",R.id," ",R.title]},R.id))]})]}),c.jsxs("div",{className:"facility-card-compact",onClick:()=>U({type:"knowledge"}),children:[c.jsxs("div",{className:"fcc-hdr",style:{background:"#0D9488"},children:["📚"," KNOWLEDGE"]}),c.jsx("div",{className:"fcc-canvas",children:c.jsx(rc,{type:"knowledge"})}),c.jsxs("div",{className:"fcc-body",children:[c.jsx("div",{className:"fcc-desc",children:"Research, analysis, and references"}),c.jsxs("div",{className:"fcc-title",children:[b.length," docs"]}),b.slice(0,2).map(R=>c.jsx("div",{className:"fcc-item",children:R.title},R.id))]})]})]})]})}),St&&c.jsx("div",{className:Xn?"absolute inset-0 z-50":"contents",children:c.jsx(DC,{sessions:xr,activeSessionId:$a,roles:a,streamingSessionId:pr,width:Xn?ci:Vn,onWidthChange:Xn?void 0:ui,onSwitchSession:pn,onCloseSession:Hs,onCreateSession:gr,onClearEmpty:Rc,onCloseAll:hi,onSendMessage:Ha,onModeChange:Oc,onCloseTerminal:()=>Xt(!1),chatChannels:Pt.channels,activeChatChannelId:Pt.activeChannelId,onSwitchChatChannel:Pt.setActiveChannelId,onCreateChatChannel:Pt.createChannel,onDeleteChatChannel:Pt.deleteChannel,onUpdateChatMembers:Pt.updateMembers,onUpdateChatTopic:Pt.updateTopic,unreadChannels:Pt.unreadChannels})})]}),c.jsxs("div",{className:"flex items-center justify-between px-5 py-2 bg-[var(--hud-bg)] text-[var(--terminal-text-secondary)] text-[10px] shrink-0 z-[45]",style:{borderTop:"3px solid var(--pixel-border)"},children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{onClick:()=>mr("card"),className:`view-toggle-btn ${La==="card"?"active":""}`,children:"CARD"}),c.jsx("button",{onClick:()=>mr("iso"),className:`view-toggle-btn ${La==="iso"?"active":""}`,children:"ISO"}),c.jsx("span",{className:"mx-1",children:"|"}),c.jsxs("button",{className:"theme-btn",onClick:()=>{wn("office"),ut(a[0]??null)},title:"Customize",children:[((zl=Fa[Fe])==null?void 0:zl.icon)??""," ",((Us=Fa[Fe])==null?void 0:Us.name)??"THEME"]}),c.jsx("span",{className:"mx-1",children:"|"}),c.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`:tt.lastSaved?`Saved ${(()=>{const R=Math.floor((Date.now()-new Date(tt.lastSaved).getTime())/6e4);return R<1?"just now":R<60?`${R}m ago`:`${Math.floor(R/60)}h ago`})()}`:"Saved"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[pe&&Ne&&c.jsx("button",{onClick:()=>Oe(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:"#B71C1C",border:"2px solid #7f121288",fontFamily:"var(--pixel-font)",borderRadius:4},children:"WAVE"}),T.length>0&&ie&&c.jsxs("button",{onClick:()=>Se(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:T[T.length-1].color,border:`2px solid ${T[T.length-1].color}88`,fontFamily:"var(--pixel-font)",borderRadius:4},children:[T[T.length-1].title.slice(0,20),T[T.length-1].title.length>20?"..":""]}),c.jsxs("button",{onClick:()=>ee(!0),className:"wave-btn px-3 py-1 font-black text-white cursor-pointer",style:{background:"#B71C1C",border:"2px solid #7f1212",fontFamily:"var(--pixel-font)"},children:["🔴"," CEO WAVE"]}),c.jsx("button",{onClick:()=>St?Xt(!1):yr(),className:"px-3 py-1 font-black cursor-pointer",style:{background:St?"var(--terminal-bg)":"var(--hud-bg-alt)",color:"var(--terminal-text)",border:`2px solid ${St?"var(--terminal-border-hover)":"var(--pixel-border)"}`,fontFamily:"var(--pixel-font)"},children:"TERMINAL"})]}),c.jsxs("span",{children:["Expand: +",Math.max(0,10-a.length)," desks available"]})]}),B.type==="role"&&D&&(()=>{const R=ze.find(de=>de.roleId===D.id);return c.jsx(PS,{role:D,allRoles:a,recentActivity:la(D.id),onClose:rl,onFireRole:(de,me)=>{ve({roleId:de,roleName:me}),rl()},terminalWidth:St?Vn:0,activeJobId:R==null?void 0:R.id,activeTask:R==null?void 0:R.task,isWorking:Ce[D.id]==="working",jobStartedAt:R==null?void 0:R.startedAt,onStopJob:de=>Te.abortJob(de),sessions:xr,streamingSessionId:pr,onCreateSessionSilent:il,onSendMessage:Ha,onFocusTerminal:Sn,onCustomize:de=>{const me=a.find(ge=>ge.id===de);me&&(wn("character"),ut(me))},onUpdateRole:$s,appearance:qt(D.id),relationships:aa.relationships})})(),B.type==="project"&&Gn&&c.jsx(Kj,{projectId:Gn.id,onClose:rl,terminalWidth:St?Vn:0}),(B.type==="bulletin"||B.type==="decisions")&&c.jsx(Vj,{standups:f,waves:p,decisions:g,mode:B.type==="bulletin"?"bulletin":"decisions",onClose:rl,terminalWidth:St?Vn:0}),B.type==="knowledge"&&c.jsx(Xj,{docs:b,onClose:rl,onRefresh:()=>Te.getKnowledge().then(v).catch(()=>{}),terminalWidth:St?Vn:0,initialDocId:B.docId}),V&&c.jsx(Wj,{roleId:V.roleId,roleName:V.roleName,mode:V.mode,onClose:()=>ne(null),onExecutionStart:na}),pe&&!Ne&&c.jsx(rC,{directive:pe.directive,rootJobs:pe.rootJobs,orgNodes:z,rootRoleId:P,onClose:()=>{Ee(null),Oe(!1)},onMinimize:()=>Oe(!0),onDone:()=>{Tl(),et("Wave complete","#2E7D32")},onOpenKnowledgeDoc:R=>{Ee(null),Oe(!1),U({type:"knowledge",docId:R}),Te.getKnowledge().then(v).catch(()=>{})}}),T.length>0&&!ie&&(()=>{var me;const R=T[T.length-1],de=ae.length>1;return c.jsxs(c.Fragment,{children:[de&&T.length===1&&c.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[63] flex gap-1 px-2 pt-2",children:ae.map((ge,be)=>c.jsx("button",{onClick:()=>{Q(be),L([{jobId:ge.jobId,title:`CEO WAVE · ${ge.roleId.toUpperCase()}`,color:"#B71C1C"}])},className:"px-3 py-1.5 text-xs font-bold rounded-t-lg cursor-pointer transition-colors",style:{background:I===be?"#B71C1C":"var(--terminal-bg)",color:I===be?"#fff":"var(--terminal-text-secondary)",border:`1px solid ${I===be?"#B71C1C":"var(--terminal-border)"}`,borderBottom:"none"},children:ge.roleId.toUpperCase()},ge.jobId))}),c.jsx(Jj,{jobId:R.jobId,title:T.length>1?R.title:de?`CEO WAVE · ${((me=ae[I])==null?void 0:me.roleName)??""}`:R.title,color:R.color,variant:"modal",style:de&&T.length===1?{marginTop:28}:void 0,onClose:()=>{L([]),X([]),Q(0),Se(!1)},onMinimize:()=>Se(!0),onDone:()=>{Os(),Tl()},onNavigateToJob:ge=>{Te.getJob(ge).then(be=>{const Me=mc[be.roleId]??"#888";L($e=>[...$e,{jobId:ge,title:`${be.roleId.toUpperCase()} · ${be.task.slice(0,40)}`,color:Me}])}).catch(console.error)},onOpenKnowledgeDoc:ge=>{L([]),X([]),Q(0),Se(!1),U({type:"knowledge",docId:ge}),Te.getKnowledge().then(v).catch(()=>{})}},R.jobId)]})})(),T.length>1&&c.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[62] pointer-events-none",children:c.jsx("div",{className:"pointer-events-auto",children:c.jsxs("button",{onClick:()=>L(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 ",(pi=T[T.length-2])==null?void 0:pi.title]})})}),$&&c.jsx(eC,{cLevelRoles:a.filter(R=>R.level==="c-level"),orgNodes:z,rootId:P,onClose:()=>ee(!1),onDispatch:Dl}),ue&&c.jsx(uC,{existingRoles:a,onClose:()=>je(!1),onHire:Bs}),te&&c.jsx(fC,{roleId:te.roleId,roleName:te.roleName,onClose:()=>ve(null),onConfirm:Ls}),he&&c.jsx(UE,{role:he,appearance:qt(he.id),onSave:R=>re(he.id,R),onReset:()=>ye(he.id),onClose:()=>{ut(null),wn("character")},theme:Fe,onThemeChange:xe,onUpdateName:async(R,de)=>{await $s(R,{name:de})},initialTab:dt,speechSettings:ke,onSpeechSettingsChange:bt,language:At,onLanguageChange:Ze,roleLevel:(yi=Be[he.id])==null?void 0:yi.level}),Fc&&c.jsx(IE,{status:tt.status,history:tt.history,onClose:()=>Jl(!1),onSave:async R=>await tt.save(R),onLoadHistory:tt.loadHistory,onRestore:tt.restore,saving:tt.state==="saving"}),c.jsx("div",{className:"fixed top-16 right-4 z-[70] flex flex-col gap-2",children:kt.map(R=>c.jsxs("div",{className:"toast-enter flex items-center gap-2 px-4 py-2.5 shadow-lg text-white text-xs font-black",style:{background:R.color,border:"2px solid rgba(0,0,0,0.3)",fontFamily:"var(--pixel-font)"},children:[c.jsx("div",{className:"w-2 h-2 bg-white/60"}),R.message]},R.id))})]})}function F0({role:t,speech:l,onClick:a,liveStatus:i,activeTask:o,featured:u,appearance:f,xpLevel:m}){const p=mc[t.id]??GE(t.id),h=m??1,g=VE[t.id]??t.name,y=i==="working",b=y&&o?o:l||g;return c.jsxs("div",{className:`pixel-card ${y?"working":""} ${u?"pixel-card--featured":""}`,onClick:a,children:[c.jsxs("div",{className:"pixel-card-hdr",style:{background:p},children:[c.jsxs("span",{children:[t.id.toUpperCase()," ","·"," ",t.name.toUpperCase()]}),c.jsxs("span",{className:"lvl",children:["Lv.",h]})]}),c.jsxs("div",{className:"pixel-card-body",children:[c.jsx("div",{className:"pixel-desk"}),c.jsx(Mc,{roleId:t.id,appearance:f}),c.jsx("div",{className:"pixel-status-dot",style:{background:y?"var(--idle-amber)":"var(--active-green)"}})]}),c.jsxs("div",{className:"pixel-card-task",children:[c.jsx("span",{className:"pixel-card-task-icon",children:y?"🛠️":XE[t.id]??"👤"}),c.jsx("span",{className:"pixel-card-task-text",children:b||g})]})]})}function Nd({onSelect:t,onClose:l}){const[a,i]=S.useState(null),[o,u]=S.useState(!0),f=S.useCallback(async m=>{u(!0);try{const p=await Te.browse(m);i(p)}catch{}finally{u(!1)}},[]);return S.useEffect(()=>{f()},[f]),o&&!a?c.jsx("div",{className:"mt-3 rounded-lg p-4 text-xs text-center",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-muted)"},children:"Loading..."}):a?c.jsxs("div",{className:"mt-3 rounded-lg overflow-hidden text-xs",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",maxHeight:220,overflowY:"auto"},children:[c.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 sticky top-0",style:{background:"var(--terminal-surface)",borderBottom:"1px solid var(--terminal-border)"},children:[c.jsx("span",{style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},className:"truncate flex-1",children:a.current}),c.jsx("button",{onClick:()=>t(a.current),className:"px-2 py-1 rounded text-[10px] font-medium shrink-0",style:{background:"var(--active-green)",color:"#fff"},children:"Select"}),c.jsx("button",{onClick:l,className:"opacity-50 hover:opacity-100 shrink-0",style:{color:"var(--terminal-text)"},children:"✕"})]}),a.parent&&c.jsxs("div",{className:"px-3 py-1.5 cursor-pointer flex items-center gap-2 hover:bg-[var(--terminal-surface-light)]",style:{color:"var(--terminal-text-secondary)"},onClick:()=>f(a.parent),children:[c.jsx("span",{children:"⬆️"}),c.jsx("span",{children:".."})]}),a.dirs.map(m=>c.jsxs("div",{className:"px-3 py-1.5 cursor-pointer flex items-center gap-2 hover:bg-[var(--terminal-surface-light)]",style:{color:"var(--terminal-text)"},onClick:()=>f(m.path),children:[c.jsx("span",{children:"📁"}),c.jsx("span",{children:m.name})]},m.path)),a.dirs.length===0&&c.jsx("div",{className:"px-3 py-3 text-center",style:{color:"var(--terminal-text-muted)"},children:"No subdirectories"})]}):null}const QE={engine:"AI Engine",company:"Company Info",project:"Project",knowledge:"Knowledge",team:"Team Template",create:"Create"};function R0(t){switch(t){case"skip":return["engine","company","project","knowledge","team","create"];case"import":return["engine","company","project","knowledge","team","create"];case"existing-akb":return["engine","knowledge","create"]}}function ZE({onComplete:t}){const[l,a]=S.useState(0),[i,o]=S.useState(null),[u,f]=S.useState("none"),[m,p]=S.useState(""),[h,g]=S.useState(!0),[y,b]=S.useState(""),[v,j]=S.useState(""),k=S.useRef(null),[C,E]=S.useState("fresh"),[M,H]=S.useState(""),[B,U]=S.useState(null),[D,Y]=S.useState(!1),[V,ne]=S.useState(!1),[T,L]=S.useState("skip"),[$,ee]=S.useState([]),[ae,X]=S.useState(""),[I,Q]=S.useState(!1),[ie,Se]=S.useState(""),[z,_]=S.useState(null),[P,A]=S.useState(!1),[pe,Ee]=S.useState(!1),[Ne,Oe]=S.useState([]),[Be,oe]=S.useState("startup"),[K,ue]=S.useState(!1),[je,te]=S.useState(!1),[ve,Ce]=S.useState(null),[Ae,ze]=S.useState([]),[qe,kt]=S.useState(!1),Rt=S.useMemo(()=>R0(T),[T]),ft=Rt[l]??"engine";S.useEffect(()=>{Te.detectEngine().then(he=>{o(he),f(he.recommended),g(!1)}).catch(()=>g(!1)),Te.getTeams().then(Oe).catch(()=>{})},[]),S.useEffect(()=>{var he;ft==="company"&&((he=k.current)==null||he.focus())},[ft]);const Lt=()=>{switch(ft){case"engine":return u!=="none"||m.length>10;case"company":return y.trim().length>0;case"project":return C==="fresh"||C==="existing"&&B===!0;case"knowledge":return T==="existing-akb"?z===!0:T==="import"?$.length>0:!0;case"team":return!0;case"create":return!je;default:return!1}},un=()=>{l<Rt.length-1&&Lt()&&a(l+1),ft==="create"&&!K&&!qe&&(T==="existing-akb"?xe():Fe())},gt=()=>{l>0&&a(l-1)};S.useEffect(()=>{const he=R0(T);l>=he.length&&a(he.length-1)},[T,l]);const qt=async()=>{if(M.trim()){Y(!0);try{const he=await Te.validatePath(M.trim());U(he.valid)}catch{U(!1)}finally{Y(!1)}}},re=async()=>{if(ie.trim()){A(!0);try{const he=await Te.validatePath(ie.trim());_(he.valid&&he.hasClaudeMd===!0)}catch{_(!1)}finally{A(!1)}}},ye=()=>{const he=ae.trim();he&&!$.includes(he)&&(ee([...$,he]),X(""))},Fe=async()=>{ue(!0),Ce(null);try{const he={companyName:y.trim(),description:v.trim()||"An AI-powered organization",team:Be,existingProjectPath:C==="existing"?M.trim():void 0,knowledgePaths:T==="import"&&$.length>0?$:void 0};(u==="direct-api"||m)&&(he.apiKey=m||void 0);const ut=await Te.scaffold(he);ze(ut.created),te(!0)}catch(he){Ce(he instanceof Error?he.message:"Scaffold failed")}finally{ue(!1)}},xe=async()=>{kt(!0),Ce(null);try{const he=await Te.connectAkb(ie.trim());he.ok?(te(!0),ze([`Connected to: ${he.companyRoot}`])):Ce(he.error||"Failed to connect")}catch(he){Ce(he instanceof Error?he.message:"Connect failed")}finally{kt(!1)}},ke=()=>{T==="import"&&$.length>0?t({paths:$,companyRoot:""}):t()},bt=he=>{he.key==="Enter"&&Lt()&&(he.preventDefault(),un())},At=`w-full px-3 py-2 rounded text-sm outline-none transition-colors
|
|
92
|
-
bg-[var(--terminal-bg)] text-[var(--terminal-text)]
|
|
93
|
-
border border-[var(--terminal-border)]
|
|
94
|
-
focus:border-[var(--terminal-border-hover)]
|
|
95
|
-
placeholder:text-[var(--terminal-text-muted)]`,Ze=he=>`p-4 rounded-lg border-2 cursor-pointer transition-all text-[var(--terminal-text)] ${he?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--terminal-border)] bg-[var(--hud-bg-alt)] hover:border-[var(--accent)]/50"}`;return c.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},onKeyDown:bt,children:c.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl overflow-hidden",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)"},children:[c.jsxs("div",{className:"px-6 py-5",style:{background:"var(--terminal-bg)",borderBottom:"1px solid var(--terminal-border)"},children:[c.jsx("div",{className:"text-lg font-bold",style:{color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"},children:"tycono"}),c.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-secondary)"},children:"Build an AI company. Watch them work."}),c.jsx("div",{className:"flex gap-1.5 mt-4",children:Rt.map((he,ut)=>c.jsxs("div",{className:"flex-1",children:[c.jsx("div",{className:"h-1 rounded-full transition-colors",style:{background:ut<=l?"var(--accent)":"var(--terminal-surface-light)"}}),c.jsx("div",{className:"text-[9px] mt-1 truncate",style:{color:ut===l?"var(--terminal-text)":"var(--terminal-text-muted)"},children:QE[he]})]},he))})]}),c.jsxs("div",{className:"px-6 py-5 min-h-[280px]",children:[ft==="engine"&&c.jsxs("div",{className:"space-y-4",children:[c.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"AI Engine Setup"}),h?c.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:"Detecting AI engine..."}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:Ze(u==="claude-cli"),onClick:()=>(i==null?void 0:i.claudeCli)&&f("claude-cli"),style:{opacity:i!=null&&i.claudeCli?1:.4},children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-lg",children:i!=null&&i.claudeCli?"✅":"❌"}),c.jsxs("div",{children:[c.jsx("div",{className:"font-medium text-sm",children:"Claude Code CLI"}),c.jsx("div",{className:"text-xs opacity-70",children:i!=null&&i.claudeCli?"Detected! Recommended — zero config needed.":"Not installed. Get it at claude.ai/download"})]})]})}),c.jsxs("div",{className:Ze(u==="direct-api"),onClick:()=>f("direct-api"),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-lg",children:i!=null&&i.apiKey?"✅":"🔑"}),c.jsxs("div",{className:"flex-1",children:[c.jsx("div",{className:"font-medium text-sm",children:"Anthropic API Key (BYOK)"}),c.jsx("div",{className:"text-xs opacity-70",children:i!=null&&i.apiKey?"API key found in environment.":"Enter your ANTHROPIC_API_KEY"})]})]}),u==="direct-api"&&!(i!=null&&i.apiKey)&&c.jsx("input",{type:"password",className:`${At} mt-3`,placeholder:"sk-ant-...",value:m,onChange:he=>p(he.target.value),autoFocus:!0})]})]})]}),ft==="company"&&c.jsxs("div",{className:"space-y-4",children:[c.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Company Info"}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Company Name *"}),c.jsx("input",{ref:k,className:At,placeholder:"e.g. Acme Corp",value:y,onChange:he=>b(he.target.value)})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Description"}),c.jsx("textarea",{className:`${At} resize-none`,rows:3,placeholder:"What does your AI company do?",value:v,onChange:he=>j(he.target.value)})]})]}),ft==="project"&&c.jsxs("div",{className:"space-y-4",children:[c.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Project Setup"}),c.jsxs("div",{className:Ze(C==="fresh"),onClick:()=>{E("fresh"),U(null)},children:[c.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),c.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Create a new AI company from scratch with clean directory structure."})]}),c.jsxs("div",{className:Ze(C==="existing"),onClick:()=>E("existing"),children:[c.jsxs("div",{className:"font-medium text-sm",children:["📂"," Connect Existing Project"]}),c.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Add AI company structure to an existing codebase or knowledge base."}),C==="existing"&&c.jsxs("div",{className:"mt-3",onClick:he=>he.stopPropagation(),children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{className:`${At} flex-1`,placeholder:"/path/to/your/project",value:M,onChange:he=>{H(he.target.value),U(null)},autoFocus:!0}),c.jsx("button",{onClick:()=>ne(!V),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),c.jsx("button",{onClick:qt,disabled:D||!M.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:D||!M.trim()?.5:1},children:D?"...":"Verify"})]}),B===!0&&c.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Path verified: ",M]}),B===!1&&c.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," Invalid path"]}),V&&c.jsx(Nd,{onSelect:he=>{H(he),U(!0),ne(!1)},onClose:()=>ne(!1)})]})]})]}),ft==="knowledge"&&c.jsxs("div",{className:"space-y-3",children:[c.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Knowledge Strategy"}),c.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"How should AI handle your knowledge base?"}),c.jsxs("div",{className:Ze(T==="skip"),onClick:()=>L("skip"),children:[c.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),c.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Empty knowledge base. Add documents later from the office."})]}),c.jsxs("div",{className:Ze(T==="import"),onClick:()=>L("import"),children:[c.jsxs("div",{className:"font-medium text-sm",children:["📚"," Import & Build"]}),c.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Select folders with documents — AI reads, summarizes, and organizes them."}),T==="import"&&c.jsxs("div",{className:"mt-3 space-y-2",onClick:he=>he.stopPropagation(),children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{className:`${At} flex-1`,placeholder:"/path/to/docs",value:ae,onChange:he=>X(he.target.value),onKeyDown:he=>{he.key==="Enter"&&(he.preventDefault(),ye())},autoFocus:!0}),c.jsx("button",{onClick:()=>Q(!I),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),c.jsx("button",{onClick:ye,disabled:!ae.trim(),className:"px-3 py-2 rounded text-xs font-medium",style:{background:"var(--accent)",color:"#fff",opacity:ae.trim()?1:.5},children:"Add"})]}),I&&c.jsx(Nd,{onSelect:he=>{$.includes(he)||ee([...$,he]),Q(!1)},onClose:()=>Q(!1)}),$.length>0&&c.jsx("div",{className:"space-y-1",children:$.map((he,ut)=>c.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:[c.jsx("span",{className:"flex-1 truncate",style:{fontFamily:"var(--pixel-font)"},children:he}),c.jsx("button",{onClick:()=>ee($.filter((dt,wn)=>wn!==ut)),className:"opacity-50 hover:opacity-100",children:"✕"})]},ut))}),$.length===0&&c.jsx("div",{className:"text-[10px] text-center py-2",style:{color:"var(--terminal-text-muted)"},children:"Add at least one folder to import."})]})]}),c.jsxs("div",{className:Ze(T==="existing-akb"),onClick:()=>L("existing-akb"),children:[c.jsxs("div",{className:"font-medium text-sm",children:["🔗"," Connect Existing AKB"]}),c.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Connect a directory that already has CLAUDE.md and AKB structure."}),T==="existing-akb"&&c.jsxs("div",{className:"mt-3",onClick:he=>he.stopPropagation(),children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{className:`${At} flex-1`,placeholder:"/path/to/your/akb",value:ie,onChange:he=>{Se(he.target.value),_(null)},autoFocus:!0}),c.jsx("button",{onClick:()=>Ee(!pe),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),c.jsx("button",{onClick:re,disabled:P||!ie.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:P||!ie.trim()?.5:1},children:P?"...":"Verify"})]}),z===!0&&c.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Valid AKB found: ",ie]}),z===!1&&c.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," No valid AKB (CLAUDE.md required)"]}),pe&&c.jsx(Nd,{onSelect:he=>{Se(he),_(null),Ee(!1)},onClose:()=>Ee(!1)})]})]})]}),ft==="team"&&c.jsxs("div",{className:"space-y-4",children:[c.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Team Template"}),c.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"Choose a starting team. You can add or remove roles later."}),Ne.map(he=>c.jsxs("div",{className:Ze(Be===he.id),onClick:()=>oe(he.id),children:[c.jsx("div",{className:"font-medium text-sm capitalize",children:he.id}),c.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:he.roles.map(ut=>c.jsx("span",{className:"px-2 py-0.5 rounded text-[10px]",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:ut.name},ut.id))})]},he.id)),c.jsxs("div",{className:Ze(Be==="custom"),onClick:()=>oe("custom"),children:[c.jsx("div",{className:"font-medium text-sm",children:"Custom"}),c.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Start with no pre-built roles. Hire them from the office."})]})]}),ft==="create"&&c.jsxs("div",{className:"space-y-4",children:[c.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:je?T==="existing-akb"?"AKB Connected!":"Company Created!":"Review & Create"}),!je&&!K&&!qe&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"rounded-lg p-4 space-y-2 text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:T==="existing-akb"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Mode:"})," Connect Existing AKB"]}),c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Path:"})," ",ie]}),c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Company:"})," ",y]}),c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]}),c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Project:"})," ",C==="fresh"?"Start Fresh":`Existing (${M})`]}),c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Knowledge:"})," ",T==="skip"?"Fresh (empty)":`Import ${$.length} source(s)`]}),c.jsxs("div",{children:[c.jsx("span",{className:"opacity-50",children:"Team:"})," ",Be]}),T==="import"&&$.length>0&&c.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--idle-amber)"},children:"Knowledge import will run in the background after entering the office."})]})}),ve&&c.jsx("div",{className:"text-xs p-3 rounded",style:{background:"rgba(220,38,38,0.15)",color:"#f87171"},children:ve})]}),(K||qe)&&c.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[c.jsx("div",{className:"w-8 h-8 border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),c.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:qe?"Connecting to AKB...":"Scaffolding your company..."})]}),je&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"text-center py-4 text-4xl",children:"🏢"}),c.jsx("div",{className:"rounded-lg p-4 text-xs max-h-40 overflow-y-auto",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:Ae.map((he,ut)=>c.jsxs("div",{className:"py-0.5",children:[c.jsx("span",{style:{color:"var(--active-green)"},children:"✓"})," ",he]},ut))}),T==="import"&&$.length>0&&c.jsx("div",{className:"text-xs p-3 rounded",style:{background:"var(--accent)",color:"#fff",opacity:.9},children:"Knowledge import will start in the background after entering the office."})]})]})]}),c.jsxs("div",{className:"px-6 py-4 flex justify-between items-center",style:{borderTop:"1px solid var(--terminal-border)"},children:[c.jsx("div",{children:l>0&&!je&&c.jsx("button",{onClick:gt,className:"px-4 py-2 rounded text-sm transition-colors",style:{color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Back"})}),c.jsxs("div",{className:"text-xs",style:{color:"var(--terminal-text-muted)"},children:[l+1," / ",Rt.length]}),c.jsx("div",{children:je?c.jsx("button",{onClick:ke,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:"var(--active-green)",color:"#fff"},children:"Enter Office"}):c.jsx("button",{onClick:un,disabled:!Lt()||K||qe,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:Lt()?"var(--accent)":"var(--terminal-border)",color:"#fff",opacity:Lt()&&!K&&!qe?1:.5},children:ft==="create"?K||qe?qe?"Connecting...":"Creating...":T==="existing-akb"?"Connect AKB":"Create Company":"Next"})})]})]})})}function WE(){const[t,l]=S.useState(null),[a,i]=S.useState(!0),[o,u]=S.useState(null),f=S.useCallback(async()=>{i(!0),u(null);try{const m=await Te.getStatus();l(m)}catch(m){u(m instanceof Error?m.message:"Failed to fetch status")}finally{i(!1)}},[]);return S.useEffect(()=>{f()},[f]),{initialized:(t==null?void 0:t.initialized)??!1,companyName:(t==null?void 0:t.companyName)??null,engine:(t==null?void 0:t.engine)??"none",companyRoot:(t==null?void 0:t.companyRoot)??"",loading:a,error:o,refetch:f}}const JE=S.lazy(()=>Yb(()=>import("./preview-app-DfJ0nbgX.js"),[]));function Eg(){return c.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},children:c.jsxs("div",{className:"text-center",children:[c.jsx("div",{className:"w-10 h-10 mx-auto border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),c.jsx("div",{className:"mt-4 text-sm",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Loading..."})]})})}function PE(){var t;try{const l=localStorage.getItem("tycono-theme")||localStorage.getItem("the-company-theme"),a=l&&l in Fa?l:"default",i=(t=Fa[a])==null?void 0:t.vars;if(!i)return;const o=document.documentElement;for(const[u,f]of Object.entries(i))o.style.setProperty(u,f)}catch{}}function eN(){const{initialized:t,loading:l,refetch:a}=WE(),[i,o]=S.useState(null);S.useEffect(()=>{PE()},[]);const u=f=>{f&&o(f),a()};return l?c.jsx(Eg,{}):t?c.jsx(KE,{importJob:i,onImportDone:()=>o(null)}):c.jsx(ZE,{onComplete:u})}function tN(){const t=new URLSearchParams(window.location.search).has("sprite-preview");return c.jsx(qb,{children:t?c.jsx(S.Suspense,{fallback:c.jsx(Eg,{}),children:c.jsx(JE,{})}):c.jsx(eN,{})})}Hb.createRoot(document.getElementById("root")).render(c.jsx(S.StrictMode,{children:c.jsx(tN,{})}));export{sg as H,cg as P,ug as S,aN as a,og as b,ig as c,Hd as d,wS as e,vS as f,lN as g,kS as h,c as j,S as r};
|