tycono 0.1.17 → 0.1.18

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.
@@ -1,4 +1,4 @@
1
- var Bb=Object.defineProperty;var Lb=(t,l,r)=>l in t?Bb(t,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[l]=r;var l1=(t,l,r)=>Lb(t,typeof l!="symbol"?l+"":l,r);(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))i(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&i(f)}).observe(document,{childList:!0,subtree:!0});function r(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(c){if(c.ep)return;c.ep=!0;const u=r(c);fetch(c.href,u)}})();function q0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Vf={exports:{}},fs={};/**
1
+ var Lb=Object.defineProperty;var $b=(t,l,r)=>l in t?Lb(t,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[l]=r;var l1=(t,l,r)=>$b(t,typeof l!="symbol"?l+"":l,r);(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))i(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&i(f)}).observe(document,{childList:!0,subtree:!0});function r(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(c){if(c.ep)return;c.ep=!0;const u=r(c);fetch(c.href,u)}})();function X0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Vf={exports:{}},fs={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@ var Bb=Object.defineProperty;var Lb=(t,l,r)=>l in t?Bb(t,l,{enumerable:!0,config
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var r1;function $b(){if(r1)return fs;r1=1;var t=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function r(i,c,u){var f=null;if(u!==void 0&&(f=""+u),c.key!==void 0&&(f=""+c.key),"key"in c){u={};for(var m in c)m!=="key"&&(u[m]=c[m])}else u=c;return c=u.ref,{$$typeof:t,type:i,key:f,ref:c!==void 0?c:null,props:u}}return fs.Fragment=l,fs.jsx=r,fs.jsxs=r,fs}var a1;function Hb(){return a1||(a1=1,Vf.exports=$b()),Vf.exports}var o=Hb(),Gf={exports:{}},Ge={};/**
9
+ */var r1;function Hb(){if(r1)return fs;r1=1;var t=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function r(i,c,u){var f=null;if(u!==void 0&&(f=""+u),c.key!==void 0&&(f=""+c.key),"key"in c){u={};for(var m in c)m!=="key"&&(u[m]=c[m])}else u=c;return c=u.ref,{$$typeof:t,type:i,key:f,ref:c!==void 0?c:null,props:u}}return fs.Fragment=l,fs.jsx=r,fs.jsxs=r,fs}var a1;function Ub(){return a1||(a1=1,Vf.exports=Hb()),Vf.exports}var o=Ub(),Gf={exports:{}},Ge={};/**
10
10
  * @license React
11
11
  * react.production.js
12
12
  *
@@ -14,7 +14,7 @@ var Bb=Object.defineProperty;var Lb=(t,l,r)=>l in t?Bb(t,l,{enumerable:!0,config
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var i1;function Ub(){if(i1)return Ge;i1=1;var t=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),c=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"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function v(B){return B===null||typeof B!="object"?null:(B=b&&B[b]||B["@@iterator"],typeof B=="function"?B:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,C={};function E(B,Q,T){this.props=B,this.context=Q,this.refs=C,this.updater=T||j}E.prototype.isReactComponent={},E.prototype.setState=function(B,Q){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,Q,"setState")},E.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function A(){}A.prototype=E.prototype;function R(B,Q,T){this.props=B,this.context=Q,this.refs=C,this.updater=T||j}var O=R.prototype=new A;O.constructor=R,k(O,E.prototype),O.isPureReactComponent=!0;var L=Array.isArray;function D(){}var U={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function ne(B,Q,T){var me=T.ref;return{$$typeof:t,type:B,key:Q,ref:me!==void 0?me:null,props:T}}function M(B,Q){return ne(B.type,Q,B.props)}function q(B){return typeof B=="object"&&B!==null&&B.$$typeof===t}function F(B){var Q={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(T){return Q[T]})}var W=/\/+/g;function ee(B,Q){return typeof B=="object"&&B!==null&&B.key!=null?F(""+B.key):Q.toString(36)}function V(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(D,D):(B.status="pending",B.then(function(Q){B.status==="pending"&&(B.status="fulfilled",B.value=Q)},function(Q){B.status==="pending"&&(B.status="rejected",B.reason=Q)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function I(B,Q,T,me,Se){var Ee=typeof B;(Ee==="undefined"||Ee==="boolean")&&(B=null);var Be=!1;if(B===null)Be=!0;else switch(Ee){case"bigint":case"string":case"number":Be=!0;break;case"object":switch(B.$$typeof){case t:case l:Be=!0;break;case g:return Be=B._init,I(Be(B._payload),Q,T,me,Se)}}if(Be)return Se=Se(B),Be=me===""?"."+ee(B,0):me,L(Se)?(T="",Be!=null&&(T=Be.replace(W,"$&/")+"/"),I(Se,Q,T,"",function(ke){return ke})):Se!=null&&(q(Se)&&(Se=M(Se,T+(Se.key==null||B&&B.key===Se.key?"":(""+Se.key).replace(W,"$&/")+"/")+Be)),Q.push(Se)),1;Be=0;var He=me===""?".":me+":";if(L(B))for(var Ke=0;Ke<B.length;Ke++)me=B[Ke],Ee=He+ee(me,Ke),Be+=I(me,Q,T,Ee,Se);else if(Ke=v(B),typeof Ke=="function")for(B=Ke.call(B),Ke=0;!(me=B.next()).done;)me=me.value,Ee=He+ee(me,Ke++),Be+=I(me,Q,T,Ee,Se);else if(Ee==="object"){if(typeof B.then=="function")return I(V(B),Q,T,me,Se);throw Q=String(B),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return Be}function Z(B,Q,T){if(B==null)return B;var me=[],Se=0;return I(B,me,"","",function(Ee){return Q.call(T,Ee,Se++)}),me}function ce(B){if(B._status===-1){var Q=B._result;Q=Q(),Q.then(function(T){(B._status===0||B._status===-1)&&(B._status=1,B._result=T)},function(T){(B._status===0||B._status===-1)&&(B._status=2,B._result=T)}),B._status===-1&&(B._status=0,B._result=Q)}if(B._status===1)return B._result.default;throw B._result}var we=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},z={map:Z,forEach:function(B,Q,T){Z(B,function(){Q.apply(this,arguments)},T)},count:function(B){var Q=0;return Z(B,function(){Q++}),Q},toArray:function(B){return Z(B,function(Q){return Q})||[]},only:function(B){if(!q(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return Ge.Activity=y,Ge.Children=z,Ge.Component=E,Ge.Fragment=r,Ge.Profiler=c,Ge.PureComponent=R,Ge.StrictMode=i,Ge.Suspense=p,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=U,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(B){return U.H.useMemoCache(B)}},Ge.cache=function(B){return function(){return B.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(B,Q,T){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var me=k({},B.props),Se=B.key;if(Q!=null)for(Ee in Q.key!==void 0&&(Se=""+Q.key),Q)!X.call(Q,Ee)||Ee==="key"||Ee==="__self"||Ee==="__source"||Ee==="ref"&&Q.ref===void 0||(me[Ee]=Q[Ee]);var Ee=arguments.length-2;if(Ee===1)me.children=T;else if(1<Ee){for(var Be=Array(Ee),He=0;He<Ee;He++)Be[He]=arguments[He+2];me.children=Be}return ne(B.type,Se,me)},Ge.createContext=function(B){return B={$$typeof:f,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:u,_context:B},B},Ge.createElement=function(B,Q,T){var me,Se={},Ee=null;if(Q!=null)for(me in Q.key!==void 0&&(Ee=""+Q.key),Q)X.call(Q,me)&&me!=="key"&&me!=="__self"&&me!=="__source"&&(Se[me]=Q[me]);var Be=arguments.length-2;if(Be===1)Se.children=T;else if(1<Be){for(var He=Array(Be),Ke=0;Ke<Be;Ke++)He[Ke]=arguments[Ke+2];Se.children=He}if(B&&B.defaultProps)for(me in Be=B.defaultProps,Be)Se[me]===void 0&&(Se[me]=Be[me]);return ne(B,Ee,Se)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(B){return{$$typeof:m,render:B}},Ge.isValidElement=q,Ge.lazy=function(B){return{$$typeof:g,_payload:{_status:-1,_result:B},_init:ce}},Ge.memo=function(B,Q){return{$$typeof:d,type:B,compare:Q===void 0?null:Q}},Ge.startTransition=function(B){var Q=U.T,T={};U.T=T;try{var me=B(),Se=U.S;Se!==null&&Se(T,me),typeof me=="object"&&me!==null&&typeof me.then=="function"&&me.then(D,we)}catch(Ee){we(Ee)}finally{Q!==null&&T.types!==null&&(Q.types=T.types),U.T=Q}},Ge.unstable_useCacheRefresh=function(){return U.H.useCacheRefresh()},Ge.use=function(B){return U.H.use(B)},Ge.useActionState=function(B,Q,T){return U.H.useActionState(B,Q,T)},Ge.useCallback=function(B,Q){return U.H.useCallback(B,Q)},Ge.useContext=function(B){return U.H.useContext(B)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(B,Q){return U.H.useDeferredValue(B,Q)},Ge.useEffect=function(B,Q){return U.H.useEffect(B,Q)},Ge.useEffectEvent=function(B){return U.H.useEffectEvent(B)},Ge.useId=function(){return U.H.useId()},Ge.useImperativeHandle=function(B,Q,T){return U.H.useImperativeHandle(B,Q,T)},Ge.useInsertionEffect=function(B,Q){return U.H.useInsertionEffect(B,Q)},Ge.useLayoutEffect=function(B,Q){return U.H.useLayoutEffect(B,Q)},Ge.useMemo=function(B,Q){return U.H.useMemo(B,Q)},Ge.useOptimistic=function(B,Q){return U.H.useOptimistic(B,Q)},Ge.useReducer=function(B,Q,T){return U.H.useReducer(B,Q,T)},Ge.useRef=function(B){return U.H.useRef(B)},Ge.useState=function(B){return U.H.useState(B)},Ge.useSyncExternalStore=function(B,Q,T){return U.H.useSyncExternalStore(B,Q,T)},Ge.useTransition=function(){return U.H.useTransition()},Ge.version="19.2.4",Ge}var s1;function th(){return s1||(s1=1,Gf.exports=Ub()),Gf.exports}var S=th(),Kf={exports:{}},ds={},Qf={exports:{}},Wf={};/**
17
+ */var i1;function Ib(){if(i1)return Ge;i1=1;var t=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),f=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function v(B){return B===null||typeof B!="object"?null:(B=b&&B[b]||B["@@iterator"],typeof B=="function"?B:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function E(B,Q,T){this.props=B,this.context=Q,this.refs=C,this.updater=T||j}E.prototype.isReactComponent={},E.prototype.setState=function(B,Q){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,Q,"setState")},E.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function A(){}A.prototype=E.prototype;function M(B,Q,T){this.props=B,this.context=Q,this.refs=C,this.updater=T||j}var O=M.prototype=new A;O.constructor=M,S(O,E.prototype),O.isPureReactComponent=!0;var L=Array.isArray;function F(){}var I={H:null,A:null,T:null,S:null},$=Object.prototype.hasOwnProperty;function ee(B,Q,T){var me=T.ref;return{$$typeof:t,type:B,key:Q,ref:me!==void 0?me:null,props:T}}function z(B,Q){return ee(B.type,Q,B.props)}function X(B){return typeof B=="object"&&B!==null&&B.$$typeof===t}function R(B){var Q={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(T){return Q[T]})}var W=/\/+/g;function te(B,Q){return typeof B=="object"&&B!==null&&B.key!=null?R(""+B.key):Q.toString(36)}function V(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(F,F):(B.status="pending",B.then(function(Q){B.status==="pending"&&(B.status="fulfilled",B.value=Q)},function(Q){B.status==="pending"&&(B.status="rejected",B.reason=Q)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function Y(B,Q,T,me,Se){var Ee=typeof B;(Ee==="undefined"||Ee==="boolean")&&(B=null);var Be=!1;if(B===null)Be=!0;else switch(Ee){case"bigint":case"string":case"number":Be=!0;break;case"object":switch(B.$$typeof){case t:case l:Be=!0;break;case g:return Be=B._init,Y(Be(B._payload),Q,T,me,Se)}}if(Be)return Se=Se(B),Be=me===""?"."+te(B,0):me,L(Se)?(T="",Be!=null&&(T=Be.replace(W,"$&/")+"/"),Y(Se,Q,T,"",function(ke){return ke})):Se!=null&&(X(Se)&&(Se=z(Se,T+(Se.key==null||B&&B.key===Se.key?"":(""+Se.key).replace(W,"$&/")+"/")+Be)),Q.push(Se)),1;Be=0;var He=me===""?".":me+":";if(L(B))for(var Ke=0;Ke<B.length;Ke++)me=B[Ke],Ee=He+te(me,Ke),Be+=Y(me,Q,T,Ee,Se);else if(Ke=v(B),typeof Ke=="function")for(B=Ke.call(B),Ke=0;!(me=B.next()).done;)me=me.value,Ee=He+te(me,Ke++),Be+=Y(me,Q,T,Ee,Se);else if(Ee==="object"){if(typeof B.then=="function")return Y(V(B),Q,T,me,Se);throw Q=String(B),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return Be}function Z(B,Q,T){if(B==null)return B;var me=[],Se=0;return Y(B,me,"","",function(Ee){return Q.call(T,Ee,Se++)}),me}function ce(B){if(B._status===-1){var Q=B._result;Q=Q(),Q.then(function(T){(B._status===0||B._status===-1)&&(B._status=1,B._result=T)},function(T){(B._status===0||B._status===-1)&&(B._status=2,B._result=T)}),B._status===-1&&(B._status=0,B._result=Q)}if(B._status===1)return B._result.default;throw B._result}var we=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},D={map:Z,forEach:function(B,Q,T){Z(B,function(){Q.apply(this,arguments)},T)},count:function(B){var Q=0;return Z(B,function(){Q++}),Q},toArray:function(B){return Z(B,function(Q){return Q})||[]},only:function(B){if(!X(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return Ge.Activity=y,Ge.Children=D,Ge.Component=E,Ge.Fragment=r,Ge.Profiler=c,Ge.PureComponent=M,Ge.StrictMode=i,Ge.Suspense=x,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(B){return I.H.useMemoCache(B)}},Ge.cache=function(B){return function(){return B.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(B,Q,T){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var me=S({},B.props),Se=B.key;if(Q!=null)for(Ee in Q.key!==void 0&&(Se=""+Q.key),Q)!$.call(Q,Ee)||Ee==="key"||Ee==="__self"||Ee==="__source"||Ee==="ref"&&Q.ref===void 0||(me[Ee]=Q[Ee]);var Ee=arguments.length-2;if(Ee===1)me.children=T;else if(1<Ee){for(var Be=Array(Ee),He=0;He<Ee;He++)Be[He]=arguments[He+2];me.children=Be}return ee(B.type,Se,me)},Ge.createContext=function(B){return B={$$typeof:f,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:u,_context:B},B},Ge.createElement=function(B,Q,T){var me,Se={},Ee=null;if(Q!=null)for(me in Q.key!==void 0&&(Ee=""+Q.key),Q)$.call(Q,me)&&me!=="key"&&me!=="__self"&&me!=="__source"&&(Se[me]=Q[me]);var Be=arguments.length-2;if(Be===1)Se.children=T;else if(1<Be){for(var He=Array(Be),Ke=0;Ke<Be;Ke++)He[Ke]=arguments[Ke+2];Se.children=He}if(B&&B.defaultProps)for(me in Be=B.defaultProps,Be)Se[me]===void 0&&(Se[me]=Be[me]);return ee(B,Ee,Se)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(B){return{$$typeof:m,render:B}},Ge.isValidElement=X,Ge.lazy=function(B){return{$$typeof:g,_payload:{_status:-1,_result:B},_init:ce}},Ge.memo=function(B,Q){return{$$typeof:d,type:B,compare:Q===void 0?null:Q}},Ge.startTransition=function(B){var Q=I.T,T={};I.T=T;try{var me=B(),Se=I.S;Se!==null&&Se(T,me),typeof me=="object"&&me!==null&&typeof me.then=="function"&&me.then(F,we)}catch(Ee){we(Ee)}finally{Q!==null&&T.types!==null&&(Q.types=T.types),I.T=Q}},Ge.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},Ge.use=function(B){return I.H.use(B)},Ge.useActionState=function(B,Q,T){return I.H.useActionState(B,Q,T)},Ge.useCallback=function(B,Q){return I.H.useCallback(B,Q)},Ge.useContext=function(B){return I.H.useContext(B)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(B,Q){return I.H.useDeferredValue(B,Q)},Ge.useEffect=function(B,Q){return I.H.useEffect(B,Q)},Ge.useEffectEvent=function(B){return I.H.useEffectEvent(B)},Ge.useId=function(){return I.H.useId()},Ge.useImperativeHandle=function(B,Q,T){return I.H.useImperativeHandle(B,Q,T)},Ge.useInsertionEffect=function(B,Q){return I.H.useInsertionEffect(B,Q)},Ge.useLayoutEffect=function(B,Q){return I.H.useLayoutEffect(B,Q)},Ge.useMemo=function(B,Q){return I.H.useMemo(B,Q)},Ge.useOptimistic=function(B,Q){return I.H.useOptimistic(B,Q)},Ge.useReducer=function(B,Q,T){return I.H.useReducer(B,Q,T)},Ge.useRef=function(B){return I.H.useRef(B)},Ge.useState=function(B){return I.H.useState(B)},Ge.useSyncExternalStore=function(B,Q,T){return I.H.useSyncExternalStore(B,Q,T)},Ge.useTransition=function(){return I.H.useTransition()},Ge.version="19.2.4",Ge}var s1;function th(){return s1||(s1=1,Gf.exports=Ib()),Gf.exports}var k=th(),Kf={exports:{}},ds={},Qf={exports:{}},Wf={};/**
18
18
  * @license React
19
19
  * scheduler.production.js
20
20
  *
@@ -22,7 +22,7 @@ var Bb=Object.defineProperty;var Lb=(t,l,r)=>l in t?Bb(t,l,{enumerable:!0,config
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */var o1;function Ib(){return o1||(o1=1,(function(t){function l(I,Z){var ce=I.length;I.push(Z);e:for(;0<ce;){var we=ce-1>>>1,z=I[we];if(0<c(z,Z))I[we]=Z,I[ce]=z,ce=we;else break e}}function r(I){return I.length===0?null:I[0]}function i(I){if(I.length===0)return null;var Z=I[0],ce=I.pop();if(ce!==Z){I[0]=ce;e:for(var we=0,z=I.length,B=z>>>1;we<B;){var Q=2*(we+1)-1,T=I[Q],me=Q+1,Se=I[me];if(0>c(T,ce))me<z&&0>c(Se,T)?(I[we]=Se,I[me]=ce,we=me):(I[we]=T,I[Q]=ce,we=Q);else if(me<z&&0>c(Se,ce))I[we]=Se,I[me]=ce,we=me;else break e}}return Z}function c(I,Z){var ce=I.sortIndex-Z.sortIndex;return ce!==0?ce:I.id-Z.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=[],d=[],g=1,y=null,b=3,v=!1,j=!1,k=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function O(I){for(var Z=r(d);Z!==null;){if(Z.callback===null)i(d);else if(Z.startTime<=I)i(d),Z.sortIndex=Z.expirationTime,l(p,Z);else break;Z=r(d)}}function L(I){if(k=!1,O(I),!j)if(r(p)!==null)j=!0,D||(D=!0,F());else{var Z=r(d);Z!==null&&V(L,Z.startTime-I)}}var D=!1,U=-1,X=5,ne=-1;function M(){return C?!0:!(t.unstable_now()-ne<X)}function q(){if(C=!1,D){var I=t.unstable_now();ne=I;var Z=!0;try{e:{j=!1,k&&(k=!1,A(U),U=-1),v=!0;var ce=b;try{t:{for(O(I),y=r(p);y!==null&&!(y.expirationTime>I&&M());){var we=y.callback;if(typeof we=="function"){y.callback=null,b=y.priorityLevel;var z=we(y.expirationTime<=I);if(I=t.unstable_now(),typeof z=="function"){y.callback=z,O(I),Z=!0;break t}y===r(p)&&i(p),O(I)}else i(p);y=r(p)}if(y!==null)Z=!0;else{var B=r(d);B!==null&&V(L,B.startTime-I),Z=!1}}break e}finally{y=null,b=ce,v=!1}Z=void 0}}finally{Z?F():D=!1}}}var F;if(typeof R=="function")F=function(){R(q)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,ee=W.port2;W.port1.onmessage=q,F=function(){ee.postMessage(null)}}else F=function(){E(q,0)};function V(I,Z){U=E(function(){I(t.unstable_now())},Z)}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"):X=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 Z=3;break;default:Z=b}var ce=b;b=Z;try{return I()}finally{b=ce}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(I,Z){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var ce=b;b=I;try{return Z()}finally{b=ce}},t.unstable_scheduleCallback=function(I,Z,ce){var we=t.unstable_now();switch(typeof ce=="object"&&ce!==null?(ce=ce.delay,ce=typeof ce=="number"&&0<ce?we+ce:we):ce=we,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=ce+z,I={id:g++,callback:Z,priorityLevel:I,startTime:ce,expirationTime:z,sortIndex:-1},ce>we?(I.sortIndex=ce,l(d,I),r(p)===null&&I===r(d)&&(k?(A(U),U=-1):k=!0,V(L,ce-we))):(I.sortIndex=z,l(p,I),j||v||(j=!0,D||(D=!0,F()))),I},t.unstable_shouldYield=M,t.unstable_wrapCallback=function(I){var Z=b;return function(){var ce=b;b=Z;try{return I.apply(this,arguments)}finally{b=ce}}}})(Wf)),Wf}var c1;function Yb(){return c1||(c1=1,Qf.exports=Ib()),Qf.exports}var Zf={exports:{}},xn={};/**
25
+ */var o1;function Yb(){return o1||(o1=1,(function(t){function l(Y,Z){var ce=Y.length;Y.push(Z);e:for(;0<ce;){var we=ce-1>>>1,D=Y[we];if(0<c(D,Z))Y[we]=Z,Y[ce]=D,ce=we;else break e}}function r(Y){return Y.length===0?null:Y[0]}function i(Y){if(Y.length===0)return null;var Z=Y[0],ce=Y.pop();if(ce!==Z){Y[0]=ce;e:for(var we=0,D=Y.length,B=D>>>1;we<B;){var Q=2*(we+1)-1,T=Y[Q],me=Q+1,Se=Y[me];if(0>c(T,ce))me<D&&0>c(Se,T)?(Y[we]=Se,Y[me]=ce,we=me):(Y[we]=T,Y[Q]=ce,we=Q);else if(me<D&&0>c(Se,ce))Y[we]=Se,Y[me]=ce,we=me;else break e}}return Z}function c(Y,Z){var ce=Y.sortIndex-Z.sortIndex;return ce!==0?ce:Y.id-Z.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 x=[],d=[],g=1,y=null,b=3,v=!1,j=!1,S=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function O(Y){for(var Z=r(d);Z!==null;){if(Z.callback===null)i(d);else if(Z.startTime<=Y)i(d),Z.sortIndex=Z.expirationTime,l(x,Z);else break;Z=r(d)}}function L(Y){if(S=!1,O(Y),!j)if(r(x)!==null)j=!0,F||(F=!0,R());else{var Z=r(d);Z!==null&&V(L,Z.startTime-Y)}}var F=!1,I=-1,$=5,ee=-1;function z(){return C?!0:!(t.unstable_now()-ee<$)}function X(){if(C=!1,F){var Y=t.unstable_now();ee=Y;var Z=!0;try{e:{j=!1,S&&(S=!1,A(I),I=-1),v=!0;var ce=b;try{t:{for(O(Y),y=r(x);y!==null&&!(y.expirationTime>Y&&z());){var we=y.callback;if(typeof we=="function"){y.callback=null,b=y.priorityLevel;var D=we(y.expirationTime<=Y);if(Y=t.unstable_now(),typeof D=="function"){y.callback=D,O(Y),Z=!0;break t}y===r(x)&&i(x),O(Y)}else i(x);y=r(x)}if(y!==null)Z=!0;else{var B=r(d);B!==null&&V(L,B.startTime-Y),Z=!1}}break e}finally{y=null,b=ce,v=!1}Z=void 0}}finally{Z?R():F=!1}}}var R;if(typeof M=="function")R=function(){M(X)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,te=W.port2;W.port1.onmessage=X,R=function(){te.postMessage(null)}}else R=function(){E(X,0)};function V(Y,Z){I=E(function(){Y(t.unstable_now())},Z)}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(Y){Y.callback=null},t.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<Y?Math.floor(1e3/Y):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(Y){switch(b){case 1:case 2:case 3:var Z=3;break;default:Z=b}var ce=b;b=Z;try{return Y()}finally{b=ce}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(Y,Z){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var ce=b;b=Y;try{return Z()}finally{b=ce}},t.unstable_scheduleCallback=function(Y,Z,ce){var we=t.unstable_now();switch(typeof ce=="object"&&ce!==null?(ce=ce.delay,ce=typeof ce=="number"&&0<ce?we+ce:we):ce=we,Y){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=ce+D,Y={id:g++,callback:Z,priorityLevel:Y,startTime:ce,expirationTime:D,sortIndex:-1},ce>we?(Y.sortIndex=ce,l(d,Y),r(x)===null&&Y===r(d)&&(S?(A(I),I=-1):S=!0,V(L,ce-we))):(Y.sortIndex=D,l(x,Y),j||v||(j=!0,F||(F=!0,R()))),Y},t.unstable_shouldYield=z,t.unstable_wrapCallback=function(Y){var Z=b;return function(){var ce=b;b=Z;try{return Y.apply(this,arguments)}finally{b=ce}}}})(Wf)),Wf}var c1;function qb(){return c1||(c1=1,Qf.exports=Yb()),Qf.exports}var Zf={exports:{}},xn={};/**
26
26
  * @license React
27
27
  * react-dom.production.js
28
28
  *
@@ -30,7 +30,7 @@ var Bb=Object.defineProperty;var Lb=(t,l,r)=>l in t?Bb(t,l,{enumerable:!0,config
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var u1;function qb(){if(u1)return xn;u1=1;var t=th();function l(p){var d="https://react.dev/errors/"+p;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)d+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+p+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var i={d:{f:r,r:function(){throw Error(l(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},c=Symbol.for("react.portal");function u(p,d,g){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:y==null?null:""+y,children:p,containerInfo:d,implementation:g}}var f=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(p,d){if(p==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return xn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,xn.createPortal=function(p,d){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(l(299));return u(p,d,null,g)},xn.flushSync=function(p){var d=f.T,g=i.p;try{if(f.T=null,i.p=2,p)return p()}finally{f.T=d,i.p=g,i.d.f()}},xn.preconnect=function(p,d){typeof p=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,i.d.C(p,d))},xn.prefetchDNS=function(p){typeof p=="string"&&i.d.D(p)},xn.preinit=function(p,d){if(typeof p=="string"&&d&&typeof d.as=="string"){var g=d.as,y=m(g,d.crossOrigin),b=typeof d.integrity=="string"?d.integrity:void 0,v=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;g==="style"?i.d.S(p,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:v}):g==="script"&&i.d.X(p,{crossOrigin:y,integrity:b,fetchPriority:v,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},xn.preinitModule=function(p,d){if(typeof p=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var g=m(d.as,d.crossOrigin);i.d.M(p,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&i.d.M(p)},xn.preload=function(p,d){if(typeof p=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var g=d.as,y=m(g,d.crossOrigin);i.d.L(p,g,{crossOrigin:y,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},xn.preloadModule=function(p,d){if(typeof p=="string")if(d){var g=m(d.as,d.crossOrigin);i.d.m(p,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else i.d.m(p)},xn.requestFormReset=function(p){i.d.r(p)},xn.unstable_batchedUpdates=function(p,d){return p(d)},xn.useFormState=function(p,d,g){return f.H.useFormState(p,d,g)},xn.useFormStatus=function(){return f.H.useHostTransitionStatus()},xn.version="19.2.4",xn}var f1;function Xb(){if(f1)return Zf.exports;f1=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(),Zf.exports=qb(),Zf.exports}/**
33
+ */var u1;function Xb(){if(u1)return xn;u1=1;var t=th();function l(x){var d="https://react.dev/errors/"+x;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)d+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+x+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var i={d:{f:r,r:function(){throw Error(l(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},c=Symbol.for("react.portal");function u(x,d,g){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:y==null?null:""+y,children:x,containerInfo:d,implementation:g}}var f=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(x,d){if(x==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return xn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,xn.createPortal=function(x,d){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(l(299));return u(x,d,null,g)},xn.flushSync=function(x){var d=f.T,g=i.p;try{if(f.T=null,i.p=2,x)return x()}finally{f.T=d,i.p=g,i.d.f()}},xn.preconnect=function(x,d){typeof x=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,i.d.C(x,d))},xn.prefetchDNS=function(x){typeof x=="string"&&i.d.D(x)},xn.preinit=function(x,d){if(typeof x=="string"&&d&&typeof d.as=="string"){var g=d.as,y=m(g,d.crossOrigin),b=typeof d.integrity=="string"?d.integrity:void 0,v=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;g==="style"?i.d.S(x,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:v}):g==="script"&&i.d.X(x,{crossOrigin:y,integrity:b,fetchPriority:v,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},xn.preinitModule=function(x,d){if(typeof x=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var g=m(d.as,d.crossOrigin);i.d.M(x,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&i.d.M(x)},xn.preload=function(x,d){if(typeof x=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var g=d.as,y=m(g,d.crossOrigin);i.d.L(x,g,{crossOrigin:y,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},xn.preloadModule=function(x,d){if(typeof x=="string")if(d){var g=m(d.as,d.crossOrigin);i.d.m(x,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else i.d.m(x)},xn.requestFormReset=function(x){i.d.r(x)},xn.unstable_batchedUpdates=function(x,d){return x(d)},xn.useFormState=function(x,d,g){return f.H.useFormState(x,d,g)},xn.useFormStatus=function(){return f.H.useHostTransitionStatus()},xn.version="19.2.4",xn}var f1;function Vb(){if(f1)return Zf.exports;f1=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(),Zf.exports=Xb(),Zf.exports}/**
34
34
  * @license React
35
35
  * react-dom-client.production.js
36
36
  *
@@ -38,59 +38,59 @@ var Bb=Object.defineProperty;var Lb=(t,l,r)=>l in t?Bb(t,l,{enumerable:!0,config
38
38
  *
39
39
  * This source code is licensed under the MIT license found in the
40
40
  * LICENSE file in the root directory of this source tree.
41
- */var d1;function Vb(){if(d1)return ds;d1=1;var t=Yb(),l=th(),r=Xb();function i(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}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 c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a: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 d(e){var n=e.alternate;if(!n){if(n=u(e),n===null)throw Error(i(188));return n!==e?null:e}for(var a=e,s=n;;){var h=a.return;if(h===null)break;var x=h.alternate;if(x===null){if(s=h.return,s!==null){a=s;continue}break}if(h.child===x.child){for(x=h.child;x;){if(x===a)return p(h),e;if(x===s)return p(h),n;x=x.sibling}throw Error(i(188))}if(a.return!==s.return)a=h,s=x;else{for(var w=!1,N=h.child;N;){if(N===a){w=!0,a=h,s=x;break}if(N===s){w=!0,s=h,a=x;break}N=N.sibling}if(!w){for(N=x.child;N;){if(N===a){w=!0,a=x,s=h;break}if(N===s){w=!0,s=x,a=h;break}N=N.sibling}if(!w)throw Error(i(189))}}if(a.alternate!==s)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?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"),A=Symbol.for("react.consumer"),R=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),ne=Symbol.for("react.activity"),M=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function F(e){return e===null||typeof e!="object"?null:(e=q&&e[q]||e["@@iterator"],typeof e=="function"?e:null)}var W=Symbol.for("react.client.reference");function ee(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===W?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 L:return"Suspense";case D:return"SuspenseList";case ne:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case j:return"Portal";case R:return e.displayName||"Context";case A:return(e._context.displayName||"Context")+".Consumer";case O:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case U:return n=e.displayName||null,n!==null?n:ee(e.type)||"Memo";case X:n=e._payload,e=e._init;try{return ee(e(n))}catch{}}return null}var V=Array.isArray,I=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},we=[],z=-1;function B(e){return{current:e}}function Q(e){0>z||(e.current=we[z],we[z]=null,z--)}function T(e,n){z++,we[z]=e.current,e.current=n}var me=B(null),Se=B(null),Ee=B(null),Be=B(null);function He(e,n){switch(T(Ee,n),T(Se,e),T(me,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?Ep(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=Ep(n),e=Np(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Q(me),T(me,e)}function Ke(){Q(me),Q(Se),Q(Ee)}function ke(e){e.memoizedState!==null&&T(Be,e);var n=me.current,a=Np(n,e.type);n!==a&&(T(Se,e),T(me,a))}function yt(e){Se.current===e&&(Q(me),Q(Se)),Be.current===e&&(Q(Be),ss._currentValue=ce)}var de,G;function re(e){if(de===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);de=n&&n[1]||"",G=-1<a.stack.indexOf(`
41
+ */var d1;function Gb(){if(d1)return ds;d1=1;var t=qb(),l=th(),r=Vb();function i(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}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 c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a: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 x(e){if(u(e)!==e)throw Error(i(188))}function d(e){var n=e.alternate;if(!n){if(n=u(e),n===null)throw Error(i(188));return n!==e?null:e}for(var a=e,s=n;;){var h=a.return;if(h===null)break;var p=h.alternate;if(p===null){if(s=h.return,s!==null){a=s;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===a)return x(h),e;if(p===s)return x(h),n;p=p.sibling}throw Error(i(188))}if(a.return!==s.return)a=h,s=p;else{for(var w=!1,N=h.child;N;){if(N===a){w=!0,a=h,s=p;break}if(N===s){w=!0,s=h,a=p;break}N=N.sibling}if(!w){for(N=p.child;N;){if(N===a){w=!0,a=p,s=h;break}if(N===s){w=!0,s=p,a=h;break}N=N.sibling}if(!w)throw Error(i(189))}}if(a.alternate!==s)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?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"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),M=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),X=Symbol.iterator;function R(e){return e===null||typeof e!="object"?null:(e=X&&e[X]||e["@@iterator"],typeof e=="function"?e:null)}var W=Symbol.for("react.client.reference");function te(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===W?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case L:return"Suspense";case F:return"SuspenseList";case ee:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case j:return"Portal";case M:return e.displayName||"Context";case A:return(e._context.displayName||"Context")+".Consumer";case O:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case I:return n=e.displayName||null,n!==null?n:te(e.type)||"Memo";case $:n=e._payload,e=e._init;try{return te(e(n))}catch{}}return null}var V=Array.isArray,Y=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},we=[],D=-1;function B(e){return{current:e}}function Q(e){0>D||(e.current=we[D],we[D]=null,D--)}function T(e,n){D++,we[D]=e.current,e.current=n}var me=B(null),Se=B(null),Ee=B(null),Be=B(null);function He(e,n){switch(T(Ee,n),T(Se,e),T(me,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?Ep(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=Ep(n),e=Np(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Q(me),T(me,e)}function Ke(){Q(me),Q(Se),Q(Ee)}function ke(e){e.memoizedState!==null&&T(Be,e);var n=me.current,a=Np(n,e.type);n!==a&&(T(Se,e),T(me,a))}function yt(e){Se.current===e&&(Q(me),Q(Se)),Be.current===e&&(Q(Be),ss._currentValue=ce)}var de,G;function re(e){if(de===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);de=n&&n[1]||"",G=-1<a.stack.indexOf(`
42
42
  at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+de+e+G}var ve=!1;function ze(e,n){if(!e||ve)return"";ve=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(n){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(le){var te=le}Reflect.construct(e,[],ue)}else{try{ue.call()}catch(le){te=le}e.call(ue.prototype)}}else{try{throw Error()}catch(le){te=le}(ue=e())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(le){if(le&&te&&typeof le.stack=="string")return[le.stack,te.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=s.DetermineComponentFrameRoot(),w=x[0],N=x[1];if(w&&N){var H=w.split(`
43
+ `+de+e+G}var ve=!1;function ze(e,n){if(!e||ve)return"";ve=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(n){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(le){var ne=le}Reflect.construct(e,[],ue)}else{try{ue.call()}catch(le){ne=le}e.call(ue.prototype)}}else{try{throw Error()}catch(le){ne=le}(ue=e())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(le){if(le&&ne&&typeof le.stack=="string")return[le.stack,ne.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=s.DetermineComponentFrameRoot(),w=p[0],N=p[1];if(w&&N){var U=w.split(`
44
44
  `),P=N.split(`
45
- `);for(h=s=0;s<H.length&&!H[s].includes("DetermineComponentFrameRoot");)s++;for(;h<P.length&&!P[h].includes("DetermineComponentFrameRoot");)h++;if(s===H.length||h===P.length)for(s=H.length-1,h=P.length-1;1<=s&&0<=h&&H[s]!==P[h];)h--;for(;1<=s&&0<=h;s--,h--)if(H[s]!==P[h]){if(s!==1||h!==1)do if(s--,h--,0>h||H[s]!==P[h]){var ie=`
46
- `+H[s].replace(" at new "," at ");return e.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",e.displayName)),ie}while(1<=s&&0<=h);break}}}finally{ve=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?re(a):""}function Ne(e,n){switch(e.tag){case 26:case 27:case 5:return re(e.type);case 16:return re("Lazy");case 13:return e.child!==n&&n!==null?re("Suspense Fallback"):re("Suspense");case 19:return re("SuspenseList");case 0:case 15:return ze(e.type,!1);case 11:return ze(e.type.render,!1);case 1:return ze(e.type,!0);case 31:return re("Activity");default:return""}}function Te(e){try{var n="",a=null;do n+=Ne(e,a),a=e,e=e.return;while(e);return n}catch(s){return`
45
+ `);for(h=s=0;s<U.length&&!U[s].includes("DetermineComponentFrameRoot");)s++;for(;h<P.length&&!P[h].includes("DetermineComponentFrameRoot");)h++;if(s===U.length||h===P.length)for(s=U.length-1,h=P.length-1;1<=s&&0<=h&&U[s]!==P[h];)h--;for(;1<=s&&0<=h;s--,h--)if(U[s]!==P[h]){if(s!==1||h!==1)do if(s--,h--,0>h||U[s]!==P[h]){var ie=`
46
+ `+U[s].replace(" at new "," at ");return e.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",e.displayName)),ie}while(1<=s&&0<=h);break}}}finally{ve=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?re(a):""}function Ne(e,n){switch(e.tag){case 26:case 27:case 5:return re(e.type);case 16:return re("Lazy");case 13:return e.child!==n&&n!==null?re("Suspense Fallback"):re("Suspense");case 19:return re("SuspenseList");case 0:case 15:return ze(e.type,!1);case 11:return ze(e.type.render,!1);case 1:return ze(e.type,!0);case 31:return re("Activity");default:return""}}function Te(e){try{var n="",a=null;do n+=Ne(e,a),a=e,e=e.return;while(e);return n}catch(s){return`
47
47
  Error generating stack: `+s.message+`
48
- `+s.stack}}var Me=Object.prototype.hasOwnProperty,Oe=t.unstable_scheduleCallback,tt=t.unstable_cancelCallback,Lt=t.unstable_shouldYield,gt=t.unstable_requestPaint,ht=t.unstable_now,Zt=t.unstable_getCurrentPriorityLevel,ae=t.unstable_ImmediatePriority,xe=t.unstable_UserBlockingPriority,De=t.unstable_NormalPriority,Ue=t.unstable_LowPriority,ye=t.unstable_IdlePriority,je=t.log,jt=t.unstable_setDisableYieldValue,wt=null,Xe=null;function ft(e){if(typeof je=="function"&&jt(e),Xe&&typeof Xe.setStrictMode=="function")try{Xe.setStrictMode(wt,e)}catch{}}var fe=Math.clz32?Math.clz32:mi,Mt=Math.log,nt=Math.LN2;function mi(e){return e>>>=0,e===0?32:31-(Mt(e)/nt|0)|0}var lr=256,wa=262144,Tl=4194304;function Dl(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 rr(e,n,a){var s=e.pendingLanes;if(s===0)return 0;var h=0,x=e.suspendedLanes,w=e.pingedLanes;e=e.warmLanes;var N=s&134217727;return N!==0?(s=N&~x,s!==0?h=Dl(s):(w&=N,w!==0?h=Dl(w):a||(a=N&~e,a!==0&&(h=Dl(a))))):(N=s&~x,N!==0?h=Dl(N):w!==0?h=Dl(w):a||(a=s&~e,a!==0&&(h=Dl(a)))),h===0?0:n!==0&&n!==h&&(n&x)===0&&(x=h&-h,a=n&-n,x>=a||x===32&&(a&4194048)!==0)?n:h}function qr(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function ka(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 Us(){var e=Tl;return Tl<<=1,(Tl&62914560)===0&&(Tl=4194304),e}function Xr(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function ar(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function xi(e,n,a,s,h,x){var w=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var N=e.entanglements,H=e.expirationTimes,P=e.hiddenUpdates;for(a=w&~a;0<a;){var ie=31-fe(a),ue=1<<ie;N[ie]=0,H[ie]=-1;var te=P[ie];if(te!==null)for(P[ie]=null,ie=0;ie<te.length;ie++){var le=te[ie];le!==null&&(le.lane&=-536870913)}a&=~ue}s!==0&&bn(e,s,0),x!==0&&h===0&&e.tag!==0&&(e.suspendedLanes|=x&~(w&~n))}function bn(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var s=31-fe(n);e.entangledLanes|=n,e.entanglements[s]=e.entanglements[s]|1073741824|a&261930}function Is(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var s=31-fe(a),h=1<<s;h&n|e[s]&n&&(e[s]|=n),a&=~h}}function zl(e,n){var a=n&-n;return a=(a&42)!==0?1:Vr(a),(a&(e.suspendedLanes|n))!==0?0:a}function Vr(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 ml(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ml(){var e=Z.p;return e!==0?e:(e=window.event,e===void 0?32:Wp(e.type))}function Rl(e,n){var a=Z.p;try{return Z.p=e,n()}finally{Z.p=a}}var il=Math.random().toString(36).slice(2),$t="__reactFiber$"+il,cn="__reactProps$"+il,Fl="__reactContainer$"+il,Gr="__reactEvents$"+il,Ys="__reactListeners$"+il,qs="__reactHandles$"+il,xl="__reactResources$"+il,_l="__reactMarker$"+il;function Sa(e){delete e[$t],delete e[cn],delete e[Gr],delete e[Ys],delete e[qs]}function Ol(e){var n=e[$t];if(n)return n;for(var a=e.parentNode;a;){if(n=a[Fl]||a[$t]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=Fp(e);e!==null;){if(a=e[$t])return a;e=Fp(e)}return n}e=a,a=e.parentNode}return null}function ir(e){if(e=e[$t]||e[Fl]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Bl(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(i(33))}function un(e){var n=e[xl];return n||(n=e[xl]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Ft(e){e[_l]=!0}var sr=new Set,Xs={};function En(e,n){Kt(e,n),Kt(e+"Capture",n)}function Kt(e,n){for(Xs[e]=n,e=0;e<n.length;e++)sr.add(n[e])}var ja=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]*$"),Kn={},or={};function pi(e){return Me.call(or,e)?!0:Me.call(Kn,e)?!1:ja.test(e)?or[e]=!0:(Kn[e]=!0,!1)}function Ca(e,n,a){if(pi(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){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,""+a)}}function pl(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function vn(e,n,a,s){if(s===null)e.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+s)}}function Nn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function qt(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Vs(e,n,a){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var h=s.get,x=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return h.call(this)},set:function(w){a=""+w,x.call(this,w)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function yi(e){if(!e._valueTracker){var n=qt(e)?"checked":"value";e._valueTracker=Vs(e,n,""+e[n])}}function Gs(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),s="";return e&&(s=qt(e)?e.checked?"true":"false":e.value),e=s,e!==a?(n.setValue(e),!0):!1}function Kr(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 gi=/[\n"\\]/g;function An(e){return e.replace(gi,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function bi(e,n,a,s,h,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=""+Nn(n)):e.value!==""+Nn(n)&&(e.value=""+Nn(n)):w!=="submit"&&w!=="reset"||e.removeAttribute("value"),n!=null?wi(e,w,Nn(n)):a!=null?wi(e,w,Nn(a)):s!=null&&e.removeAttribute("value"),h==null&&x!=null&&(e.defaultChecked=!!x),h!=null&&(e.checked=h&&typeof h!="function"&&typeof h!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+Nn(N):e.removeAttribute("name")}function vi(e,n,a,s,h,x,w,N){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.type=x),n!=null||a!=null){if(!(x!=="submit"&&x!=="reset"||n!=null)){yi(e);return}a=a!=null?""+Nn(a):"",n=n!=null?""+Nn(n):a,N||n===e.value||(e.value=n),e.defaultValue=n}s=s??h,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),yi(e)}function wi(e,n,a){n==="number"&&Kr(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function cr(e,n,a,s){if(e=e.options,n){n={};for(var h=0;h<a.length;h++)n["$"+a[h]]=!0;for(a=0;a<e.length;a++)h=n.hasOwnProperty("$"+e[a].value),e[a].selected!==h&&(e[a].selected=h),h&&s&&(e[a].defaultSelected=!0)}else{for(a=""+Nn(a),n=null,h=0;h<e.length;h++){if(e[h].value===a){e[h].selected=!0,s&&(e[h].defaultSelected=!0);return}n!==null||e[h].disabled||(n=e[h])}n!==null&&(n.selected=!0)}}function Ks(e,n,a){if(n!=null&&(n=""+Nn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+Nn(a):""}function Qs(e,n,a,s){if(n==null){if(s!=null){if(a!=null)throw Error(i(92));if(V(s)){if(1<s.length)throw Error(i(93));s=s[0]}a=s}a==null&&(a=""),n=a}a=Nn(n),e.defaultValue=a,s=e.textContent,s===a&&s!==""&&s!==null&&(e.value=s),yi(e)}function ur(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var qc=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 Ws(e,n,a){var s=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?s?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":s?e.setProperty(n,a):typeof a!="number"||a===0||qc.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function sl(e,n,a){if(n!=null&&typeof n!="object")throw Error(i(62));if(e=e.style,a!=null){for(var s in a)!a.hasOwnProperty(s)||n!=null&&n.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var h in n)s=n[h],n.hasOwnProperty(h)&&a[h]!==s&&Ws(e,h,s)}else for(var x in n)n.hasOwnProperty(x)&&Ws(e,x,n[x])}function Ea(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 Xc=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"]]),Vc=/^[\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 Bn(e){return Vc.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Qn(){}var ki=null;function Si(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ut=null,Wn=null;function ji(e){var n=ir(e);if(n&&(e=n.stateNode)){var a=e[cn]||null;e:switch(e=n.stateNode,n.type){case"input":if(bi(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+An(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var s=a[n];if(s!==e&&s.form===e.form){var h=s[cn]||null;if(!h)throw Error(i(90));bi(s,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(n=0;n<a.length;n++)s=a[n],s.form===e.form&&Gs(s)}break e;case"textarea":Ks(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&cr(e,!!a.multiple,n,!1)}}}var Na=!1;function Ci(e,n,a){if(Na)return e(n,a);Na=!0;try{var s=e(n);return s}finally{if(Na=!1,(Ut!==null||Wn!==null)&&(_o(),Ut&&(n=Ut,e=Wn,Wn=Ut=null,ji(n),e)))for(n=0;n<e.length;n++)ji(e[n])}}function _(e,n){var a=e.stateNode;if(a===null)return null;var s=a[cn]||null;if(s===null)return null;a=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(a&&typeof a!="function")throw Error(i(231,n,typeof a));return a}var se=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),he=!1;if(se)try{var pe={};Object.defineProperty(pe,"passive",{get:function(){he=!0}}),window.addEventListener("test",pe,pe),window.removeEventListener("test",pe,pe)}catch{he=!1}var ge=null,Re=null,Le=null;function Je(){if(Le)return Le;var e,n=Re,a=n.length,s,h="value"in ge?ge.value:ge.textContent,x=h.length;for(e=0;e<a&&n[e]===h[e];e++);var w=a-e;for(s=1;s<=w&&n[a-s]===h[x-s];s++);return Le=h.slice(e,1<s?1-s:void 0)}function lt(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 Ve(){return!0}function It(){return!1}function Tn(e){function n(a,s,h,x,w){this._reactName=a,this._targetInst=h,this.type=s,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(a=e[N],this[N]=a?a(x):x[N]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Ve:It,this.isPropagationStopped=It,this}return y(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Ve)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Ve)},persist:function(){},isPersistent:Ve}),n}var Qr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zs=Tn(Qr),Ei=y({},Qr,{view:0,detail:0}),_g=Tn(Ei),Gc,Kc,Ni,Js=y({},Ei,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wc,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!==Ni&&(Ni&&e.type==="mousemove"?(Gc=e.screenX-Ni.screenX,Kc=e.screenY-Ni.screenY):Kc=Gc=0,Ni=e),Gc)},movementY:function(e){return"movementY"in e?e.movementY:Kc}}),Th=Tn(Js),Og=y({},Js,{dataTransfer:0}),Bg=Tn(Og),Lg=y({},Ei,{relatedTarget:0}),Qc=Tn(Lg),$g=y({},Qr,{animationName:0,elapsedTime:0,pseudoElement:0}),Hg=Tn($g),Ug=y({},Qr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ig=Tn(Ug),Yg=y({},Qr,{data:0}),Dh=Tn(Yg),qg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Xg={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"},Vg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Gg(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Vg[e])?!!n[e]:!1}function Wc(){return Gg}var Kg=y({},Ei,{key:function(e){if(e.key){var n=qg[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=lt(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Xg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wc,charCode:function(e){return e.type==="keypress"?lt(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?lt(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Qg=Tn(Kg),Wg=y({},Js,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zh=Tn(Wg),Zg=y({},Ei,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wc}),Jg=Tn(Zg),Pg=y({},Qr,{propertyName:0,elapsedTime:0,pseudoElement:0}),e2=Tn(Pg),t2=y({},Js,{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}),n2=Tn(t2),l2=y({},Qr,{newState:0,oldState:0}),r2=Tn(l2),a2=[9,13,27,32],Zc=se&&"CompositionEvent"in window,Ai=null;se&&"documentMode"in document&&(Ai=document.documentMode);var i2=se&&"TextEvent"in window&&!Ai,Mh=se&&(!Zc||Ai&&8<Ai&&11>=Ai),Rh=" ",Fh=!1;function _h(e,n){switch(e){case"keyup":return a2.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Oh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Aa=!1;function s2(e,n){switch(e){case"compositionend":return Oh(n);case"keypress":return n.which!==32?null:(Fh=!0,Rh);case"textInput":return e=n.data,e===Rh&&Fh?null:e;default:return null}}function o2(e,n){if(Aa)return e==="compositionend"||!Zc&&_h(e,n)?(e=Je(),Le=Re=ge=null,Aa=!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 Mh&&n.locale!=="ko"?null:n.data;default:return null}}var c2={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 Bh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!c2[e.type]:n==="textarea"}function Lh(e,n,a,s){Ut?Wn?Wn.push(s):Wn=[s]:Ut=s,n=Io(n,"onChange"),0<n.length&&(a=new Zs("onChange","change",null,a,s),e.push({event:a,listeners:n}))}var Ti=null,Di=null;function u2(e){vp(e,0)}function Ps(e){var n=Bl(e);if(Gs(n))return e}function $h(e,n){if(e==="change")return n}var Hh=!1;if(se){var Jc;if(se){var Pc="oninput"in document;if(!Pc){var Uh=document.createElement("div");Uh.setAttribute("oninput","return;"),Pc=typeof Uh.oninput=="function"}Jc=Pc}else Jc=!1;Hh=Jc&&(!document.documentMode||9<document.documentMode)}function Ih(){Ti&&(Ti.detachEvent("onpropertychange",Yh),Di=Ti=null)}function Yh(e){if(e.propertyName==="value"&&Ps(Di)){var n=[];Lh(n,Di,e,Si(e)),Ci(u2,n)}}function f2(e,n,a){e==="focusin"?(Ih(),Ti=n,Di=a,Ti.attachEvent("onpropertychange",Yh)):e==="focusout"&&Ih()}function d2(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ps(Di)}function h2(e,n){if(e==="click")return Ps(n)}function m2(e,n){if(e==="input"||e==="change")return Ps(n)}function x2(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Ln=typeof Object.is=="function"?Object.is:x2;function zi(e,n){if(Ln(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),s=Object.keys(n);if(a.length!==s.length)return!1;for(s=0;s<a.length;s++){var h=a[s];if(!Me.call(n,h)||!Ln(e[h],n[h]))return!1}return!0}function qh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xh(e,n){var a=qh(e);e=0;for(var s;a;){if(a.nodeType===3){if(s=e+a.textContent.length,e<=n&&s>=n)return{node:a,offset:n-e};e=s}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=qh(a)}}function Vh(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Vh(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Gh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Kr(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=Kr(e.document)}return n}function eu(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 p2=se&&"documentMode"in document&&11>=document.documentMode,Ta=null,tu=null,Mi=null,nu=!1;function Kh(e,n,a){var s=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;nu||Ta==null||Ta!==Kr(s)||(s=Ta,"selectionStart"in s&&eu(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}),Mi&&zi(Mi,s)||(Mi=s,s=Io(tu,"onSelect"),0<s.length&&(n=new Zs("onSelect","select",null,n,a),e.push({event:n,listeners:s}),n.target=Ta)))}function Wr(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var Da={animationend:Wr("Animation","AnimationEnd"),animationiteration:Wr("Animation","AnimationIteration"),animationstart:Wr("Animation","AnimationStart"),transitionrun:Wr("Transition","TransitionRun"),transitionstart:Wr("Transition","TransitionStart"),transitioncancel:Wr("Transition","TransitionCancel"),transitionend:Wr("Transition","TransitionEnd")},lu={},Qh={};se&&(Qh=document.createElement("div").style,"AnimationEvent"in window||(delete Da.animationend.animation,delete Da.animationiteration.animation,delete Da.animationstart.animation),"TransitionEvent"in window||delete Da.transitionend.transition);function Zr(e){if(lu[e])return lu[e];if(!Da[e])return e;var n=Da[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Qh)return lu[e]=n[a];return e}var Wh=Zr("animationend"),Zh=Zr("animationiteration"),Jh=Zr("animationstart"),y2=Zr("transitionrun"),g2=Zr("transitionstart"),b2=Zr("transitioncancel"),Ph=Zr("transitionend"),em=new Map,ru="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(" ");ru.push("scrollEnd");function ol(e,n){em.set(e,n),En(n,[e])}var eo=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)},Zn=[],za=0,au=0;function to(){for(var e=za,n=au=za=0;n<e;){var a=Zn[n];Zn[n++]=null;var s=Zn[n];Zn[n++]=null;var h=Zn[n];Zn[n++]=null;var x=Zn[n];if(Zn[n++]=null,s!==null&&h!==null){var w=s.pending;w===null?h.next=h:(h.next=w.next,w.next=h),s.pending=h}x!==0&&tm(a,h,x)}}function no(e,n,a,s){Zn[za++]=e,Zn[za++]=n,Zn[za++]=a,Zn[za++]=s,au|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function iu(e,n,a,s){return no(e,n,a,s),lo(e)}function Jr(e,n){return no(e,null,null,n),lo(e)}function tm(e,n,a){e.lanes|=a;var s=e.alternate;s!==null&&(s.lanes|=a);for(var h=!1,x=e.return;x!==null;)x.childLanes|=a,s=x.alternate,s!==null&&(s.childLanes|=a),x.tag===22&&(e=x.stateNode,e===null||e._visibility&1||(h=!0)),e=x,x=x.return;return e.tag===3?(x=e.stateNode,h&&n!==null&&(h=31-fe(a),e=x.hiddenUpdates,s=e[h],s===null?e[h]=[n]:s.push(n),n.lane=a|536870912),x):null}function lo(e){if(50<es)throw es=0,pf=null,Error(i(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Ma={};function v2(e,n,a,s){this.tag=e,this.key=a,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 $n(e,n,a,s){return new v2(e,n,a,s)}function su(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ll(e,n){var a=e.alternate;return a===null?(a=$n(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function nm(e,n){e.flags&=65011714;var a=e.alternate;return a===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=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function ro(e,n,a,s,h,x){var w=0;if(s=e,typeof e=="function")su(e)&&(w=1);else if(typeof e=="string")w=Cb(e,a,me.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ne:return e=$n(31,a,n,h),e.elementType=ne,e.lanes=x,e;case k:return Pr(a.children,h,x,n);case C:w=8,h|=24;break;case E:return e=$n(12,a,n,h|2),e.elementType=E,e.lanes=x,e;case L:return e=$n(13,a,n,h),e.elementType=L,e.lanes=x,e;case D:return e=$n(19,a,n,h),e.elementType=D,e.lanes=x,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case R:w=10;break e;case A:w=9;break e;case O:w=11;break e;case U:w=14;break e;case X:w=16,s=null;break e}w=29,a=Error(i(130,e===null?"null":typeof e,"")),s=null}return n=$n(w,a,n,h),n.elementType=e,n.type=s,n.lanes=x,n}function Pr(e,n,a,s){return e=$n(7,e,s,n),e.lanes=a,e}function ou(e,n,a){return e=$n(6,e,null,n),e.lanes=a,e}function lm(e){var n=$n(18,null,null,0);return n.stateNode=e,n}function cu(e,n,a){return n=$n(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var rm=new WeakMap;function Jn(e,n){if(typeof e=="object"&&e!==null){var a=rm.get(e);return a!==void 0?a:(n={value:e,source:n,stack:Te(n)},rm.set(e,n),n)}return{value:e,source:n,stack:Te(n)}}var Ra=[],Fa=0,ao=null,Ri=0,Pn=[],el=0,fr=null,yl=1,gl="";function $l(e,n){Ra[Fa++]=Ri,Ra[Fa++]=ao,ao=e,Ri=n}function am(e,n,a){Pn[el++]=yl,Pn[el++]=gl,Pn[el++]=fr,fr=e;var s=yl;e=gl;var h=32-fe(s)-1;s&=~(1<<h),a+=1;var x=32-fe(n)+h;if(30<x){var w=h-h%5;x=(s&(1<<w)-1).toString(32),s>>=w,h-=w,yl=1<<32-fe(n)+h|a<<h|s,gl=x+e}else yl=1<<x|a<<h|s,gl=e}function uu(e){e.return!==null&&($l(e,1),am(e,1,0))}function fu(e){for(;e===ao;)ao=Ra[--Fa],Ra[Fa]=null,Ri=Ra[--Fa],Ra[Fa]=null;for(;e===fr;)fr=Pn[--el],Pn[el]=null,gl=Pn[--el],Pn[el]=null,yl=Pn[--el],Pn[el]=null}function im(e,n){Pn[el++]=yl,Pn[el++]=gl,Pn[el++]=fr,yl=n.id,gl=n.overflow,fr=e}var fn=null,_t=null,ut=!1,dr=null,tl=!1,du=Error(i(519));function hr(e){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Fi(Jn(n,e)),du}function sm(e){var n=e.stateNode,a=e.type,s=e.memoizedProps;switch(n[$t]=e,n[cn]=s,a){case"dialog":at("cancel",n),at("close",n);break;case"iframe":case"object":case"embed":at("load",n);break;case"video":case"audio":for(a=0;a<ns.length;a++)at(ns[a],n);break;case"source":at("error",n);break;case"img":case"image":case"link":at("error",n),at("load",n);break;case"details":at("toggle",n);break;case"input":at("invalid",n),vi(n,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":at("invalid",n);break;case"textarea":at("invalid",n),Qs(n,s.value,s.defaultValue,s.children)}a=s.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||s.suppressHydrationWarning===!0||jp(n.textContent,a)?(s.popover!=null&&(at("beforetoggle",n),at("toggle",n)),s.onScroll!=null&&at("scroll",n),s.onScrollEnd!=null&&at("scrollend",n),s.onClick!=null&&(n.onclick=Qn),n=!0):n=!1,n||hr(e,!0)}function om(e){for(fn=e.return;fn;)switch(fn.tag){case 5:case 31:case 13:tl=!1;return;case 27:case 3:tl=!0;return;default:fn=fn.return}}function _a(e){if(e!==fn)return!1;if(!ut)return om(e),ut=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||zf(e.type,e.memoizedProps)),a=!a),a&&_t&&hr(e),om(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));_t=Rp(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));_t=Rp(e)}else n===27?(n=_t,Nr(e.type)?(e=Of,Of=null,_t=e):_t=n):_t=fn?ll(e.stateNode.nextSibling):null;return!0}function ea(){_t=fn=null,ut=!1}function hu(){var e=dr;return e!==null&&(Rn===null?Rn=e:Rn.push.apply(Rn,e),dr=null),e}function Fi(e){dr===null?dr=[e]:dr.push(e)}var mu=B(null),ta=null,Hl=null;function mr(e,n,a){T(mu,n._currentValue),n._currentValue=a}function Ul(e){e._currentValue=mu.current,Q(mu)}function xu(e,n,a){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===a)break;e=e.return}}function pu(e,n,a,s){var h=e.child;for(h!==null&&(h.return=e);h!==null;){var x=h.dependencies;if(x!==null){var w=h.child;x=x.firstContext;e:for(;x!==null;){var N=x;x=h;for(var H=0;H<n.length;H++)if(N.context===n[H]){x.lanes|=a,N=x.alternate,N!==null&&(N.lanes|=a),xu(x.return,a,e),s||(w=null);break e}x=N.next}}else if(h.tag===18){if(w=h.return,w===null)throw Error(i(341));w.lanes|=a,x=w.alternate,x!==null&&(x.lanes|=a),xu(w,a,e),w=null}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===e){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}}function Oa(e,n,a,s){e=null;for(var h=n,x=!1;h!==null;){if(!x){if((h.flags&524288)!==0)x=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var w=h.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var N=h.type;Ln(h.pendingProps.value,w.value)||(e!==null?e.push(N):e=[N])}}else if(h===Be.current){if(w=h.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(e!==null?e.push(ss):e=[ss])}h=h.return}e!==null&&pu(n,e,a,s),n.flags|=262144}function io(e){for(e=e.firstContext;e!==null;){if(!Ln(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function na(e){ta=e,Hl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function dn(e){return cm(ta,e)}function so(e,n){return ta===null&&na(e),cm(e,n)}function cm(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Hl===null){if(e===null)throw Error(i(308));Hl=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Hl=Hl.next=n;return a}var w2=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,s){e.push(s)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},k2=t.unstable_scheduleCallback,S2=t.unstable_NormalPriority,Jt={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function yu(){return{controller:new w2,data:new Map,refCount:0}}function _i(e){e.refCount--,e.refCount===0&&k2(S2,function(){e.controller.abort()})}var Oi=null,gu=0,Ba=0,La=null;function j2(e,n){if(Oi===null){var a=Oi=[];gu=0,Ba=kf(),La={status:"pending",value:void 0,then:function(s){a.push(s)}}}return gu++,n.then(um,um),n}function um(){if(--gu===0&&Oi!==null){La!==null&&(La.status="fulfilled");var e=Oi;Oi=null,Ba=0,La=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function C2(e,n){var a=[],s={status:"pending",value:null,reason:null,then:function(h){a.push(h)}};return e.then(function(){s.status="fulfilled",s.value=n;for(var h=0;h<a.length;h++)(0,a[h])(n)},function(h){for(s.status="rejected",s.reason=h,h=0;h<a.length;h++)(0,a[h])(void 0)}),s}var fm=I.S;I.S=function(e,n){Kx=ht(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&j2(e,n),fm!==null&&fm(e,n)};var la=B(null);function bu(){var e=la.current;return e!==null?e:Tt.pooledCache}function oo(e,n){n===null?T(la,la.current):T(la,n.pool)}function dm(){var e=bu();return e===null?null:{parent:Jt._currentValue,pool:e}}var $a=Error(i(460)),vu=Error(i(474)),co=Error(i(542)),uo={then:function(){}};function hm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function mm(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(Qn,Qn),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,pm(e),e;default:if(typeof n.status=="string")n.then(Qn,Qn);else{if(e=Tt,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=n,e.status="pending",e.then(function(s){if(n.status==="pending"){var h=n;h.status="fulfilled",h.value=s}},function(s){if(n.status==="pending"){var h=n;h.status="rejected",h.reason=s}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,pm(e),e}throw aa=n,$a}}function ra(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(aa=a,$a):a}}var aa=null;function xm(){if(aa===null)throw Error(i(459));var e=aa;return aa=null,e}function pm(e){if(e===$a||e===co)throw Error(i(483))}var Ha=null,Bi=0;function fo(e){var n=Bi;return Bi+=1,Ha===null&&(Ha=[]),mm(Ha,e,n)}function Li(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function ho(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 ym(e){function n(K,Y){if(e){var J=K.deletions;J===null?(K.deletions=[Y],K.flags|=16):J.push(Y)}}function a(K,Y){if(!e)return null;for(;Y!==null;)n(K,Y),Y=Y.sibling;return null}function s(K){for(var Y=new Map;K!==null;)K.key!==null?Y.set(K.key,K):Y.set(K.index,K),K=K.sibling;return Y}function h(K,Y){return K=Ll(K,Y),K.index=0,K.sibling=null,K}function x(K,Y,J){return K.index=J,e?(J=K.alternate,J!==null?(J=J.index,J<Y?(K.flags|=67108866,Y):J):(K.flags|=67108866,Y)):(K.flags|=1048576,Y)}function w(K){return e&&K.alternate===null&&(K.flags|=67108866),K}function N(K,Y,J,oe){return Y===null||Y.tag!==6?(Y=ou(J,K.mode,oe),Y.return=K,Y):(Y=h(Y,J),Y.return=K,Y)}function H(K,Y,J,oe){var $e=J.type;return $e===k?ie(K,Y,J.props.children,oe,J.key):Y!==null&&(Y.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===X&&ra($e)===Y.type)?(Y=h(Y,J.props),Li(Y,J),Y.return=K,Y):(Y=ro(J.type,J.key,J.props,null,K.mode,oe),Li(Y,J),Y.return=K,Y)}function P(K,Y,J,oe){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==J.containerInfo||Y.stateNode.implementation!==J.implementation?(Y=cu(J,K.mode,oe),Y.return=K,Y):(Y=h(Y,J.children||[]),Y.return=K,Y)}function ie(K,Y,J,oe,$e){return Y===null||Y.tag!==7?(Y=Pr(J,K.mode,oe,$e),Y.return=K,Y):(Y=h(Y,J),Y.return=K,Y)}function ue(K,Y,J){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Y=ou(""+Y,K.mode,J),Y.return=K,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case v:return J=ro(Y.type,Y.key,Y.props,null,K.mode,J),Li(J,Y),J.return=K,J;case j:return Y=cu(Y,K.mode,J),Y.return=K,Y;case X:return Y=ra(Y),ue(K,Y,J)}if(V(Y)||F(Y))return Y=Pr(Y,K.mode,J,null),Y.return=K,Y;if(typeof Y.then=="function")return ue(K,fo(Y),J);if(Y.$$typeof===R)return ue(K,so(K,Y),J);ho(K,Y)}return null}function te(K,Y,J,oe){var $e=Y!==null?Y.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return $e!==null?null:N(K,Y,""+J,oe);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case v:return J.key===$e?H(K,Y,J,oe):null;case j:return J.key===$e?P(K,Y,J,oe):null;case X:return J=ra(J),te(K,Y,J,oe)}if(V(J)||F(J))return $e!==null?null:ie(K,Y,J,oe,null);if(typeof J.then=="function")return te(K,Y,fo(J),oe);if(J.$$typeof===R)return te(K,Y,so(K,J),oe);ho(K,J)}return null}function le(K,Y,J,oe,$e){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return K=K.get(J)||null,N(Y,K,""+oe,$e);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case v:return K=K.get(oe.key===null?J:oe.key)||null,H(Y,K,oe,$e);case j:return K=K.get(oe.key===null?J:oe.key)||null,P(Y,K,oe,$e);case X:return oe=ra(oe),le(K,Y,J,oe,$e)}if(V(oe)||F(oe))return K=K.get(J)||null,ie(Y,K,oe,$e,null);if(typeof oe.then=="function")return le(K,Y,J,fo(oe),$e);if(oe.$$typeof===R)return le(K,Y,J,so(Y,oe),$e);ho(Y,oe)}return null}function Ae(K,Y,J,oe){for(var $e=null,mt=null,Fe=Y,We=Y=0,ot=null;Fe!==null&&We<J.length;We++){Fe.index>We?(ot=Fe,Fe=null):ot=Fe.sibling;var xt=te(K,Fe,J[We],oe);if(xt===null){Fe===null&&(Fe=ot);break}e&&Fe&&xt.alternate===null&&n(K,Fe),Y=x(xt,Y,We),mt===null?$e=xt:mt.sibling=xt,mt=xt,Fe=ot}if(We===J.length)return a(K,Fe),ut&&$l(K,We),$e;if(Fe===null){for(;We<J.length;We++)Fe=ue(K,J[We],oe),Fe!==null&&(Y=x(Fe,Y,We),mt===null?$e=Fe:mt.sibling=Fe,mt=Fe);return ut&&$l(K,We),$e}for(Fe=s(Fe);We<J.length;We++)ot=le(Fe,K,We,J[We],oe),ot!==null&&(e&&ot.alternate!==null&&Fe.delete(ot.key===null?We:ot.key),Y=x(ot,Y,We),mt===null?$e=ot:mt.sibling=ot,mt=ot);return e&&Fe.forEach(function(Mr){return n(K,Mr)}),ut&&$l(K,We),$e}function Ye(K,Y,J,oe){if(J==null)throw Error(i(151));for(var $e=null,mt=null,Fe=Y,We=Y=0,ot=null,xt=J.next();Fe!==null&&!xt.done;We++,xt=J.next()){Fe.index>We?(ot=Fe,Fe=null):ot=Fe.sibling;var Mr=te(K,Fe,xt.value,oe);if(Mr===null){Fe===null&&(Fe=ot);break}e&&Fe&&Mr.alternate===null&&n(K,Fe),Y=x(Mr,Y,We),mt===null?$e=Mr:mt.sibling=Mr,mt=Mr,Fe=ot}if(xt.done)return a(K,Fe),ut&&$l(K,We),$e;if(Fe===null){for(;!xt.done;We++,xt=J.next())xt=ue(K,xt.value,oe),xt!==null&&(Y=x(xt,Y,We),mt===null?$e=xt:mt.sibling=xt,mt=xt);return ut&&$l(K,We),$e}for(Fe=s(Fe);!xt.done;We++,xt=J.next())xt=le(Fe,K,We,xt.value,oe),xt!==null&&(e&&xt.alternate!==null&&Fe.delete(xt.key===null?We:xt.key),Y=x(xt,Y,We),mt===null?$e=xt:mt.sibling=xt,mt=xt);return e&&Fe.forEach(function(Ob){return n(K,Ob)}),ut&&$l(K,We),$e}function Nt(K,Y,J,oe){if(typeof J=="object"&&J!==null&&J.type===k&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case v:e:{for(var $e=J.key;Y!==null;){if(Y.key===$e){if($e=J.type,$e===k){if(Y.tag===7){a(K,Y.sibling),oe=h(Y,J.props.children),oe.return=K,K=oe;break e}}else if(Y.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===X&&ra($e)===Y.type){a(K,Y.sibling),oe=h(Y,J.props),Li(oe,J),oe.return=K,K=oe;break e}a(K,Y);break}else n(K,Y);Y=Y.sibling}J.type===k?(oe=Pr(J.props.children,K.mode,oe,J.key),oe.return=K,K=oe):(oe=ro(J.type,J.key,J.props,null,K.mode,oe),Li(oe,J),oe.return=K,K=oe)}return w(K);case j:e:{for($e=J.key;Y!==null;){if(Y.key===$e)if(Y.tag===4&&Y.stateNode.containerInfo===J.containerInfo&&Y.stateNode.implementation===J.implementation){a(K,Y.sibling),oe=h(Y,J.children||[]),oe.return=K,K=oe;break e}else{a(K,Y);break}else n(K,Y);Y=Y.sibling}oe=cu(J,K.mode,oe),oe.return=K,K=oe}return w(K);case X:return J=ra(J),Nt(K,Y,J,oe)}if(V(J))return Ae(K,Y,J,oe);if(F(J)){if($e=F(J),typeof $e!="function")throw Error(i(150));return J=$e.call(J),Ye(K,Y,J,oe)}if(typeof J.then=="function")return Nt(K,Y,fo(J),oe);if(J.$$typeof===R)return Nt(K,Y,so(K,J),oe);ho(K,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,Y!==null&&Y.tag===6?(a(K,Y.sibling),oe=h(Y,J),oe.return=K,K=oe):(a(K,Y),oe=ou(J,K.mode,oe),oe.return=K,K=oe),w(K)):a(K,Y)}return function(K,Y,J,oe){try{Bi=0;var $e=Nt(K,Y,J,oe);return Ha=null,$e}catch(Fe){if(Fe===$a||Fe===co)throw Fe;var mt=$n(29,Fe,null,K.mode);return mt.lanes=oe,mt.return=K,mt}finally{}}}var ia=ym(!0),gm=ym(!1),xr=!1;function wu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ku(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 pr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function yr(e,n,a){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(bt&2)!==0){var h=s.pending;return h===null?n.next=n:(n.next=h.next,h.next=n),s.pending=n,n=lo(e),tm(e,null,a),n}return no(e,s,n,a),lo(e)}function $i(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var s=n.lanes;s&=e.pendingLanes,a|=s,n.lanes=a,Is(e,a)}}function Su(e,n){var a=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,a===s)){var h=null,x=null;if(a=a.firstBaseUpdate,a!==null){do{var w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};x===null?h=x=w:x=x.next=w,a=a.next}while(a!==null);x===null?h=x=n:x=x.next=n}else h=x=n;a={baseState:s.baseState,firstBaseUpdate:h,lastBaseUpdate:x,shared:s.shared,callbacks:s.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var ju=!1;function Hi(){if(ju){var e=La;if(e!==null)throw e}}function Ui(e,n,a,s){ju=!1;var h=e.updateQueue;xr=!1;var x=h.firstBaseUpdate,w=h.lastBaseUpdate,N=h.shared.pending;if(N!==null){h.shared.pending=null;var H=N,P=H.next;H.next=null,w===null?x=P:w.next=P,w=H;var ie=e.alternate;ie!==null&&(ie=ie.updateQueue,N=ie.lastBaseUpdate,N!==w&&(N===null?ie.firstBaseUpdate=P:N.next=P,ie.lastBaseUpdate=H))}if(x!==null){var ue=h.baseState;w=0,ie=P=H=null,N=x;do{var te=N.lane&-536870913,le=te!==N.lane;if(le?(st&te)===te:(s&te)===te){te!==0&&te===Ba&&(ju=!0),ie!==null&&(ie=ie.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Ae=e,Ye=N;te=n;var Nt=a;switch(Ye.tag){case 1:if(Ae=Ye.payload,typeof Ae=="function"){ue=Ae.call(Nt,ue,te);break e}ue=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=Ye.payload,te=typeof Ae=="function"?Ae.call(Nt,ue,te):Ae,te==null)break e;ue=y({},ue,te);break e;case 2:xr=!0}}te=N.callback,te!==null&&(e.flags|=64,le&&(e.flags|=8192),le=h.callbacks,le===null?h.callbacks=[te]:le.push(te))}else le={lane:te,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ie===null?(P=ie=le,H=ue):ie=ie.next=le,w|=te;if(N=N.next,N===null){if(N=h.shared.pending,N===null)break;le=N,N=le.next,le.next=null,h.lastBaseUpdate=le,h.shared.pending=null}}while(!0);ie===null&&(H=ue),h.baseState=H,h.firstBaseUpdate=P,h.lastBaseUpdate=ie,x===null&&(h.shared.lanes=0),kr|=w,e.lanes=w,e.memoizedState=ue}}function bm(e,n){if(typeof e!="function")throw Error(i(191,e));e.call(n)}function vm(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)bm(a[e],n)}var Ua=B(null),mo=B(0);function wm(e,n){e=Wl,T(mo,e),T(Ua,n),Wl=e|n.baseLanes}function Cu(){T(mo,Wl),T(Ua,Ua.current)}function Eu(){Wl=mo.current,Q(Ua),Q(mo)}var Hn=B(null),nl=null;function gr(e){var n=e.alternate;T(Qt,Qt.current&1),T(Hn,e),nl===null&&(n===null||Ua.current!==null||n.memoizedState!==null)&&(nl=e)}function Nu(e){T(Qt,Qt.current),T(Hn,e),nl===null&&(nl=e)}function km(e){e.tag===22?(T(Qt,Qt.current),T(Hn,e),nl===null&&(nl=e)):br()}function br(){T(Qt,Qt.current),T(Hn,Hn.current)}function Un(e){Q(Hn),nl===e&&(nl=null),Q(Qt)}var Qt=B(0);function xo(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Ff(a)||_f(a)))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 Il=0,Qe=null,Ct=null,Pt=null,po=!1,Ia=!1,sa=!1,yo=0,Ii=0,Ya=null,E2=0;function Xt(){throw Error(i(321))}function Au(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!Ln(e[a],n[a]))return!1;return!0}function Tu(e,n,a,s,h,x){return Il=x,Qe=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,I.H=e===null||e.memoizedState===null?ax:qu,sa=!1,x=a(s,h),sa=!1,Ia&&(x=jm(n,a,s,h)),Sm(e),x}function Sm(e){I.H=Xi;var n=Ct!==null&&Ct.next!==null;if(Il=0,Pt=Ct=Qe=null,po=!1,Ii=0,Ya=null,n)throw Error(i(300));e===null||en||(e=e.dependencies,e!==null&&io(e)&&(en=!0))}function jm(e,n,a,s){Qe=e;var h=0;do{if(Ia&&(Ya=null),Ii=0,Ia=!1,25<=h)throw Error(i(301));if(h+=1,Pt=Ct=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=ix,x=n(a,s)}while(Ia);return x}function N2(){var e=I.H,n=e.useState()[0];return n=typeof n.then=="function"?Yi(n):n,e=e.useState()[0],(Ct!==null?Ct.memoizedState:null)!==e&&(Qe.flags|=1024),n}function Du(){var e=yo!==0;return yo=0,e}function zu(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function Mu(e){if(po){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}po=!1}Il=0,Pt=Ct=Qe=null,Ia=!1,Ii=yo=0,Ya=null}function wn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pt===null?Qe.memoizedState=Pt=e:Pt=Pt.next=e,Pt}function Wt(){if(Ct===null){var e=Qe.alternate;e=e!==null?e.memoizedState:null}else e=Ct.next;var n=Pt===null?Qe.memoizedState:Pt.next;if(n!==null)Pt=n,Ct=e;else{if(e===null)throw Qe.alternate===null?Error(i(467)):Error(i(310));Ct=e,e={memoizedState:Ct.memoizedState,baseState:Ct.baseState,baseQueue:Ct.baseQueue,queue:Ct.queue,next:null},Pt===null?Qe.memoizedState=Pt=e:Pt=Pt.next=e}return Pt}function go(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Yi(e){var n=Ii;return Ii+=1,Ya===null&&(Ya=[]),e=mm(Ya,e,n),n=Qe,(Pt===null?n.memoizedState:Pt.next)===null&&(n=n.alternate,I.H=n===null||n.memoizedState===null?ax:qu),e}function bo(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Yi(e);if(e.$$typeof===R)return dn(e)}throw Error(i(438,String(e)))}function Ru(e){var n=null,a=Qe.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var s=Qe.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(n={data:s.data.map(function(h){return h.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=go(),Qe.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),s=0;s<e;s++)a[s]=M;return n.index++,a}function Yl(e,n){return typeof n=="function"?n(e):n}function vo(e){var n=Wt();return Fu(n,Ct,e)}function Fu(e,n,a){var s=e.queue;if(s===null)throw Error(i(311));s.lastRenderedReducer=a;var h=e.baseQueue,x=s.pending;if(x!==null){if(h!==null){var w=h.next;h.next=x.next,x.next=w}n.baseQueue=h=x,s.pending=null}if(x=e.baseState,h===null)e.memoizedState=x;else{n=h.next;var N=w=null,H=null,P=n,ie=!1;do{var ue=P.lane&-536870913;if(ue!==P.lane?(st&ue)===ue:(Il&ue)===ue){var te=P.revertLane;if(te===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),ue===Ba&&(ie=!0);else if((Il&te)===te){P=P.next,te===Ba&&(ie=!0);continue}else ue={lane:0,revertLane:P.revertLane,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},H===null?(N=H=ue,w=x):H=H.next=ue,Qe.lanes|=te,kr|=te;ue=P.action,sa&&a(x,ue),x=P.hasEagerState?P.eagerState:a(x,ue)}else te={lane:ue,revertLane:P.revertLane,gesture:P.gesture,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},H===null?(N=H=te,w=x):H=H.next=te,Qe.lanes|=ue,kr|=ue;P=P.next}while(P!==null&&P!==n);if(H===null?w=x:H.next=N,!Ln(x,e.memoizedState)&&(en=!0,ie&&(a=La,a!==null)))throw a;e.memoizedState=x,e.baseState=w,e.baseQueue=H,s.lastRenderedState=x}return h===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function _u(e){var n=Wt(),a=n.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=e;var s=a.dispatch,h=a.pending,x=n.memoizedState;if(h!==null){a.pending=null;var w=h=h.next;do x=e(x,w.action),w=w.next;while(w!==h);Ln(x,n.memoizedState)||(en=!0),n.memoizedState=x,n.baseQueue===null&&(n.baseState=x),a.lastRenderedState=x}return[x,s]}function Cm(e,n,a){var s=Qe,h=Wt(),x=ut;if(x){if(a===void 0)throw Error(i(407));a=a()}else a=n();var w=!Ln((Ct||h).memoizedState,a);if(w&&(h.memoizedState=a,en=!0),h=h.queue,Lu(Am.bind(null,s,h,e),[e]),h.getSnapshot!==n||w||Pt!==null&&Pt.memoizedState.tag&1){if(s.flags|=2048,qa(9,{destroy:void 0},Nm.bind(null,s,h,a,n),null),Tt===null)throw Error(i(349));x||(Il&127)!==0||Em(s,n,a)}return a}function Em(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Qe.updateQueue,n===null?(n=go(),Qe.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function Nm(e,n,a,s){n.value=a,n.getSnapshot=s,Tm(n)&&Dm(e)}function Am(e,n,a){return a(function(){Tm(n)&&Dm(e)})}function Tm(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!Ln(e,a)}catch{return!0}}function Dm(e){var n=Jr(e,2);n!==null&&Fn(n,e,2)}function Ou(e){var n=wn();if(typeof e=="function"){var a=e;if(e=a(),sa){ft(!0);try{a()}finally{ft(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yl,lastRenderedState:e},n}function zm(e,n,a,s){return e.baseState=a,Fu(e,Ct,typeof s=="function"?s:Yl)}function A2(e,n,a,s,h){if(So(e))throw Error(i(485));if(e=n.action,e!==null){var x={payload:h,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};I.T!==null?a(!0):x.isTransition=!1,s(x),a=n.pending,a===null?(x.next=n.pending=x,Mm(n,x)):(x.next=a.next,n.pending=a.next=x)}}function Mm(e,n){var a=n.action,s=n.payload,h=e.state;if(n.isTransition){var x=I.T,w={};I.T=w;try{var N=a(h,s),H=I.S;H!==null&&H(w,N),Rm(e,n,N)}catch(P){Bu(e,n,P)}finally{x!==null&&w.types!==null&&(x.types=w.types),I.T=x}}else try{x=a(h,s),Rm(e,n,x)}catch(P){Bu(e,n,P)}}function Rm(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(s){Fm(e,n,s)},function(s){return Bu(e,n,s)}):Fm(e,n,a)}function Fm(e,n,a){n.status="fulfilled",n.value=a,_m(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,Mm(e,a)))}function Bu(e,n,a){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do n.status="rejected",n.reason=a,_m(n),n=n.next;while(n!==s)}e.action=null}function _m(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Om(e,n){return n}function Bm(e,n){if(ut){var a=Tt.formState;if(a!==null){e:{var s=Qe;if(ut){if(_t){t:{for(var h=_t,x=tl;h.nodeType!==8;){if(!x){h=null;break t}if(h=ll(h.nextSibling),h===null){h=null;break t}}x=h.data,h=x==="F!"||x==="F"?h:null}if(h){_t=ll(h.nextSibling),s=h.data==="F!";break e}}hr(s)}s=!1}s&&(n=a[0])}}return a=wn(),a.memoizedState=a.baseState=n,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Om,lastRenderedState:n},a.queue=s,a=nx.bind(null,Qe,s),s.dispatch=a,s=Ou(!1),x=Yu.bind(null,Qe,!1,s.queue),s=wn(),h={state:n,dispatch:null,action:e,pending:null},s.queue=h,a=A2.bind(null,Qe,h,x,a),h.dispatch=a,s.memoizedState=e,[n,a,!1]}function Lm(e){var n=Wt();return $m(n,Ct,e)}function $m(e,n,a){if(n=Fu(e,n,Om)[0],e=vo(Yl)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var s=Yi(n)}catch(w){throw w===$a?co:w}else s=n;n=Wt();var h=n.queue,x=h.dispatch;return a!==n.memoizedState&&(Qe.flags|=2048,qa(9,{destroy:void 0},T2.bind(null,h,a),null)),[s,x,e]}function T2(e,n){e.action=n}function Hm(e){var n=Wt(),a=Ct;if(a!==null)return $m(n,a,e);Wt(),n=n.memoizedState,a=Wt();var s=a.queue.dispatch;return a.memoizedState=e,[n,s,!1]}function qa(e,n,a,s){return e={tag:e,create:a,deps:s,inst:n,next:null},n=Qe.updateQueue,n===null&&(n=go(),Qe.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(s=a.next,a.next=e,e.next=s,n.lastEffect=e),e}function Um(){return Wt().memoizedState}function wo(e,n,a,s){var h=wn();Qe.flags|=e,h.memoizedState=qa(1|n,{destroy:void 0},a,s===void 0?null:s)}function ko(e,n,a,s){var h=Wt();s=s===void 0?null:s;var x=h.memoizedState.inst;Ct!==null&&s!==null&&Au(s,Ct.memoizedState.deps)?h.memoizedState=qa(n,x,a,s):(Qe.flags|=e,h.memoizedState=qa(1|n,x,a,s))}function Im(e,n){wo(8390656,8,e,n)}function Lu(e,n){ko(2048,8,e,n)}function D2(e){Qe.flags|=4;var n=Qe.updateQueue;if(n===null)n=go(),Qe.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function Ym(e){var n=Wt().memoizedState;return D2({ref:n,nextImpl:e}),function(){if((bt&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function qm(e,n){return ko(4,2,e,n)}function Xm(e,n){return ko(4,4,e,n)}function Vm(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Gm(e,n,a){a=a!=null?a.concat([e]):null,ko(4,4,Vm.bind(null,n,e),a)}function $u(){}function Km(e,n){var a=Wt();n=n===void 0?null:n;var s=a.memoizedState;return n!==null&&Au(n,s[1])?s[0]:(a.memoizedState=[e,n],e)}function Qm(e,n){var a=Wt();n=n===void 0?null:n;var s=a.memoizedState;if(n!==null&&Au(n,s[1]))return s[0];if(s=e(),sa){ft(!0);try{e()}finally{ft(!1)}}return a.memoizedState=[s,n],s}function Hu(e,n,a){return a===void 0||(Il&1073741824)!==0&&(st&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Wx(),Qe.lanes|=e,kr|=e,a)}function Wm(e,n,a,s){return Ln(a,n)?a:Ua.current!==null?(e=Hu(e,a,s),Ln(e,n)||(en=!0),e):(Il&42)===0||(Il&1073741824)!==0&&(st&261930)===0?(en=!0,e.memoizedState=a):(e=Wx(),Qe.lanes|=e,kr|=e,n)}function Zm(e,n,a,s,h){var x=Z.p;Z.p=x!==0&&8>x?x:8;var w=I.T,N={};I.T=N,Yu(e,!1,n,a);try{var H=h(),P=I.S;if(P!==null&&P(N,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var ie=C2(H,s);qi(e,n,ie,qn(e))}else qi(e,n,s,qn(e))}catch(ue){qi(e,n,{then:function(){},status:"rejected",reason:ue},qn())}finally{Z.p=x,w!==null&&N.types!==null&&(w.types=N.types),I.T=w}}function z2(){}function Uu(e,n,a,s){if(e.tag!==5)throw Error(i(476));var h=Jm(e).queue;Zm(e,h,n,ce,a===null?z2:function(){return Pm(e),a(s)})}function Jm(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yl,lastRenderedState:ce},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yl,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Pm(e){var n=Jm(e);n.next===null&&(n=e.alternate.memoizedState),qi(e,n.next.queue,{},qn())}function Iu(){return dn(ss)}function ex(){return Wt().memoizedState}function tx(){return Wt().memoizedState}function M2(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=qn();e=pr(a);var s=yr(n,e,a);s!==null&&(Fn(s,n,a),$i(s,n,a)),n={cache:yu()},e.payload=n;return}n=n.return}}function R2(e,n,a){var s=qn();a={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},So(e)?lx(n,a):(a=iu(e,n,a,s),a!==null&&(Fn(a,e,s),rx(a,n,s)))}function nx(e,n,a){var s=qn();qi(e,n,a,s)}function qi(e,n,a,s){var h={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(So(e))lx(n,h);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,a);if(h.hasEagerState=!0,h.eagerState=N,Ln(N,w))return no(e,n,h,0),Tt===null&&to(),!1}catch{}finally{}if(a=iu(e,n,h,s),a!==null)return Fn(a,e,s),rx(a,n,s),!0}return!1}function Yu(e,n,a,s){if(s={lane:2,revertLane:kf(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},So(e)){if(n)throw Error(i(479))}else n=iu(e,a,s,2),n!==null&&Fn(n,e,2)}function So(e){var n=e.alternate;return e===Qe||n!==null&&n===Qe}function lx(e,n){Ia=po=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function rx(e,n,a){if((a&4194048)!==0){var s=n.lanes;s&=e.pendingLanes,a|=s,n.lanes=a,Is(e,a)}}var Xi={readContext:dn,use:bo,useCallback:Xt,useContext:Xt,useEffect:Xt,useImperativeHandle:Xt,useLayoutEffect:Xt,useInsertionEffect:Xt,useMemo:Xt,useReducer:Xt,useRef:Xt,useState:Xt,useDebugValue:Xt,useDeferredValue:Xt,useTransition:Xt,useSyncExternalStore:Xt,useId:Xt,useHostTransitionStatus:Xt,useFormState:Xt,useActionState:Xt,useOptimistic:Xt,useMemoCache:Xt,useCacheRefresh:Xt};Xi.useEffectEvent=Xt;var ax={readContext:dn,use:bo,useCallback:function(e,n){return wn().memoizedState=[e,n===void 0?null:n],e},useContext:dn,useEffect:Im,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,wo(4194308,4,Vm.bind(null,n,e),a)},useLayoutEffect:function(e,n){return wo(4194308,4,e,n)},useInsertionEffect:function(e,n){wo(4,2,e,n)},useMemo:function(e,n){var a=wn();n=n===void 0?null:n;var s=e();if(sa){ft(!0);try{e()}finally{ft(!1)}}return a.memoizedState=[s,n],s},useReducer:function(e,n,a){var s=wn();if(a!==void 0){var h=a(n);if(sa){ft(!0);try{a(n)}finally{ft(!1)}}}else h=n;return s.memoizedState=s.baseState=h,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:h},s.queue=e,e=e.dispatch=R2.bind(null,Qe,e),[s.memoizedState,e]},useRef:function(e){var n=wn();return e={current:e},n.memoizedState=e},useState:function(e){e=Ou(e);var n=e.queue,a=nx.bind(null,Qe,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:$u,useDeferredValue:function(e,n){var a=wn();return Hu(a,e,n)},useTransition:function(){var e=Ou(!1);return e=Zm.bind(null,Qe,e.queue,!0,!1),wn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var s=Qe,h=wn();if(ut){if(a===void 0)throw Error(i(407));a=a()}else{if(a=n(),Tt===null)throw Error(i(349));(st&127)!==0||Em(s,n,a)}h.memoizedState=a;var x={value:a,getSnapshot:n};return h.queue=x,Im(Am.bind(null,s,x,e),[e]),s.flags|=2048,qa(9,{destroy:void 0},Nm.bind(null,s,x,a,n),null),a},useId:function(){var e=wn(),n=Tt.identifierPrefix;if(ut){var a=gl,s=yl;a=(s&~(1<<32-fe(s)-1)).toString(32)+a,n="_"+n+"R_"+a,a=yo++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=E2++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Iu,useFormState:Bm,useActionState:Bm,useOptimistic:function(e){var n=wn();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Yu.bind(null,Qe,!0,a),a.dispatch=n,[e,n]},useMemoCache:Ru,useCacheRefresh:function(){return wn().memoizedState=M2.bind(null,Qe)},useEffectEvent:function(e){var n=wn(),a={impl:e};return n.memoizedState=a,function(){if((bt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},qu={readContext:dn,use:bo,useCallback:Km,useContext:dn,useEffect:Lu,useImperativeHandle:Gm,useInsertionEffect:qm,useLayoutEffect:Xm,useMemo:Qm,useReducer:vo,useRef:Um,useState:function(){return vo(Yl)},useDebugValue:$u,useDeferredValue:function(e,n){var a=Wt();return Wm(a,Ct.memoizedState,e,n)},useTransition:function(){var e=vo(Yl)[0],n=Wt().memoizedState;return[typeof e=="boolean"?e:Yi(e),n]},useSyncExternalStore:Cm,useId:ex,useHostTransitionStatus:Iu,useFormState:Lm,useActionState:Lm,useOptimistic:function(e,n){var a=Wt();return zm(a,Ct,e,n)},useMemoCache:Ru,useCacheRefresh:tx};qu.useEffectEvent=Ym;var ix={readContext:dn,use:bo,useCallback:Km,useContext:dn,useEffect:Lu,useImperativeHandle:Gm,useInsertionEffect:qm,useLayoutEffect:Xm,useMemo:Qm,useReducer:_u,useRef:Um,useState:function(){return _u(Yl)},useDebugValue:$u,useDeferredValue:function(e,n){var a=Wt();return Ct===null?Hu(a,e,n):Wm(a,Ct.memoizedState,e,n)},useTransition:function(){var e=_u(Yl)[0],n=Wt().memoizedState;return[typeof e=="boolean"?e:Yi(e),n]},useSyncExternalStore:Cm,useId:ex,useHostTransitionStatus:Iu,useFormState:Hm,useActionState:Hm,useOptimistic:function(e,n){var a=Wt();return Ct!==null?zm(a,Ct,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Ru,useCacheRefresh:tx};ix.useEffectEvent=Ym;function Xu(e,n,a,s){n=e.memoizedState,a=a(s,n),a=a==null?n:y({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Vu={enqueueSetState:function(e,n,a){e=e._reactInternals;var s=qn(),h=pr(s);h.payload=n,a!=null&&(h.callback=a),n=yr(e,h,s),n!==null&&(Fn(n,e,s),$i(n,e,s))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var s=qn(),h=pr(s);h.tag=1,h.payload=n,a!=null&&(h.callback=a),n=yr(e,h,s),n!==null&&(Fn(n,e,s),$i(n,e,s))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=qn(),s=pr(a);s.tag=2,n!=null&&(s.callback=n),n=yr(e,s,a),n!==null&&(Fn(n,e,a),$i(n,e,a))}};function sx(e,n,a,s,h,x,w){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,x,w):n.prototype&&n.prototype.isPureReactComponent?!zi(a,s)||!zi(h,x):!0}function ox(e,n,a,s){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,s),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,s),n.state!==e&&Vu.enqueueReplaceState(n,n.state,null)}function oa(e,n){var a=n;if("ref"in n){a={};for(var s in n)s!=="ref"&&(a[s]=n[s])}if(e=e.defaultProps){a===n&&(a=y({},a));for(var h in e)a[h]===void 0&&(a[h]=e[h])}return a}function cx(e){eo(e)}function ux(e){console.error(e)}function fx(e){eo(e)}function jo(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(s){setTimeout(function(){throw s})}}function dx(e,n,a){try{var s=e.onCaughtError;s(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Gu(e,n,a){return a=pr(a),a.tag=3,a.payload={element:null},a.callback=function(){jo(e,n)},a}function hx(e){return e=pr(e),e.tag=3,e}function mx(e,n,a,s){var h=a.type.getDerivedStateFromError;if(typeof h=="function"){var x=s.value;e.payload=function(){return h(x)},e.callback=function(){dx(n,a,s)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(e.callback=function(){dx(n,a,s),typeof h!="function"&&(Sr===null?Sr=new Set([this]):Sr.add(this));var N=s.stack;this.componentDidCatch(s.value,{componentStack:N!==null?N:""})})}function F2(e,n,a,s,h){if(a.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(n=a.alternate,n!==null&&Oa(n,a,h,!0),a=Hn.current,a!==null){switch(a.tag){case 31:case 13:return nl===null?Oo():a.alternate===null&&Vt===0&&(Vt=3),a.flags&=-257,a.flags|=65536,a.lanes=h,s===uo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([s]):n.add(s),bf(e,s,h)),!1;case 22:return a.flags|=65536,s===uo?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([s])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([s]):a.add(s)),bf(e,s,h)),!1}throw Error(i(435,a.tag))}return bf(e,s,h),Oo(),!1}if(ut)return n=Hn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=h,s!==du&&(e=Error(i(422),{cause:s}),Fi(Jn(e,a)))):(s!==du&&(n=Error(i(423),{cause:s}),Fi(Jn(n,a))),e=e.current.alternate,e.flags|=65536,h&=-h,e.lanes|=h,s=Jn(s,a),h=Gu(e.stateNode,s,h),Su(e,h),Vt!==4&&(Vt=2)),!1;var x=Error(i(520),{cause:s});if(x=Jn(x,a),Pi===null?Pi=[x]:Pi.push(x),Vt!==4&&(Vt=2),n===null)return!0;s=Jn(s,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=h&-h,a.lanes|=e,e=Gu(a.stateNode,s,e),Su(a,e),!1;case 1:if(n=a.type,x=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Sr===null||!Sr.has(x))))return a.flags|=65536,h&=-h,a.lanes|=h,h=hx(h),mx(h,e,a,s),Su(a,h),!1}a=a.return}while(a!==null);return!1}var Ku=Error(i(461)),en=!1;function hn(e,n,a,s){n.child=e===null?gm(n,null,a,s):ia(n,e.child,a,s)}function xx(e,n,a,s,h){a=a.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 na(n),s=Tu(e,n,a,w,x,h),N=Du(),e!==null&&!en?(zu(e,n,h),ql(e,n,h)):(ut&&N&&uu(n),n.flags|=1,hn(e,n,s,h),n.child)}function px(e,n,a,s,h){if(e===null){var x=a.type;return typeof x=="function"&&!su(x)&&x.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=x,yx(e,n,x,s,h)):(e=ro(a.type,null,s,n,n.mode,h),e.ref=n.ref,e.return=n,n.child=e)}if(x=e.child,!nf(e,h)){var w=x.memoizedProps;if(a=a.compare,a=a!==null?a:zi,a(w,s)&&e.ref===n.ref)return ql(e,n,h)}return n.flags|=1,e=Ll(x,s),e.ref=n.ref,e.return=n,n.child=e}function yx(e,n,a,s,h){if(e!==null){var x=e.memoizedProps;if(zi(x,s)&&e.ref===n.ref)if(en=!1,n.pendingProps=s=x,nf(e,h))(e.flags&131072)!==0&&(en=!0);else return n.lanes=e.lanes,ql(e,n,h)}return Qu(e,n,a,s,h)}function gx(e,n,a,s){var h=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|a:a,e!==null){for(s=n.child=e.child,h=0;s!==null;)h=h|s.lanes|s.childLanes,s=s.sibling;s=h&~x}else s=0,n.child=null;return bx(e,n,x,a,s)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&oo(n,x!==null?x.cachePool:null),x!==null?wm(n,x):Cu(),km(n);else return s=n.lanes=536870912,bx(e,n,x!==null?x.baseLanes|a:a,a,s)}else x!==null?(oo(n,x.cachePool),wm(n,x),br(),n.memoizedState=null):(e!==null&&oo(n,null),Cu(),br());return hn(e,n,h,a),n.child}function Vi(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function bx(e,n,a,s,h){var x=bu();return x=x===null?null:{parent:Jt._currentValue,pool:x},n.memoizedState={baseLanes:a,cachePool:x},e!==null&&oo(n,null),Cu(),km(n),e!==null&&Oa(e,n,s,!0),n.childLanes=h,null}function Co(e,n){return n=No({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function vx(e,n,a){return ia(n,e.child,null,a),e=Co(n,n.pendingProps),e.flags|=2,Un(n),n.memoizedState=null,e}function _2(e,n,a){var s=n.pendingProps,h=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(ut){if(s.mode==="hidden")return e=Co(n,s),n.lanes=536870912,Vi(null,e);if(Nu(n),(e=_t)?(e=Mp(e,tl),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:fr!==null?{id:yl,overflow:gl}:null,retryLane:536870912,hydrationErrors:null},a=lm(e),a.return=n,n.child=a,fn=n,_t=null)):e=null,e===null)throw hr(n);return n.lanes=536870912,null}return Co(n,s)}var x=e.memoizedState;if(x!==null){var w=x.dehydrated;if(Nu(n),h)if(n.flags&256)n.flags&=-257,n=vx(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(i(558));else if(en||Oa(e,n,a,!1),h=(a&e.childLanes)!==0,en||h){if(s=Tt,s!==null&&(w=zl(s,a),w!==0&&w!==x.retryLane))throw x.retryLane=w,Jr(e,w),Fn(s,e,w),Ku;Oo(),n=vx(e,n,a)}else e=x.treeContext,_t=ll(w.nextSibling),fn=n,ut=!0,dr=null,tl=!1,e!==null&&im(n,e),n=Co(n,s),n.flags|=4096;return n}return e=Ll(e.child,{mode:s.mode,children:s.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Eo(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Qu(e,n,a,s,h){return na(n),a=Tu(e,n,a,s,void 0,h),s=Du(),e!==null&&!en?(zu(e,n,h),ql(e,n,h)):(ut&&s&&uu(n),n.flags|=1,hn(e,n,a,h),n.child)}function wx(e,n,a,s,h,x){return na(n),n.updateQueue=null,a=jm(n,s,a,h),Sm(e),s=Du(),e!==null&&!en?(zu(e,n,x),ql(e,n,x)):(ut&&s&&uu(n),n.flags|=1,hn(e,n,a,x),n.child)}function kx(e,n,a,s,h){if(na(n),n.stateNode===null){var x=Ma,w=a.contextType;typeof w=="object"&&w!==null&&(x=dn(w)),x=new a(s,x),n.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Vu,n.stateNode=x,x._reactInternals=n,x=n.stateNode,x.props=s,x.state=n.memoizedState,x.refs={},wu(n),w=a.contextType,x.context=typeof w=="object"&&w!==null?dn(w):Ma,x.state=n.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(Xu(n,a,w,s),x.state=n.memoizedState),typeof a.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&&Vu.enqueueReplaceState(x,x.state,null),Ui(n,s,x,h),Hi(),x.state=n.memoizedState),typeof x.componentDidMount=="function"&&(n.flags|=4194308),s=!0}else if(e===null){x=n.stateNode;var N=n.memoizedProps,H=oa(a,N);x.props=H;var P=x.context,ie=a.contextType;w=Ma,typeof ie=="object"&&ie!==null&&(w=dn(ie));var ue=a.getDerivedStateFromProps;ie=typeof ue=="function"||typeof x.getSnapshotBeforeUpdate=="function",N=n.pendingProps!==N,ie||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(N||P!==w)&&ox(n,x,s,w),xr=!1;var te=n.memoizedState;x.state=te,Ui(n,s,x,h),Hi(),P=n.memoizedState,N||te!==P||xr?(typeof ue=="function"&&(Xu(n,a,ue,s),P=n.memoizedState),(H=xr||sx(n,a,H,s,te,P,w))?(ie||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=P),x.props=s,x.state=P,x.context=w,s=H):(typeof x.componentDidMount=="function"&&(n.flags|=4194308),s=!1)}else{x=n.stateNode,ku(e,n),w=n.memoizedProps,ie=oa(a,w),x.props=ie,ue=n.pendingProps,te=x.context,P=a.contextType,H=Ma,typeof P=="object"&&P!==null&&(H=dn(P)),N=a.getDerivedStateFromProps,(P=typeof N=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==ue||te!==H)&&ox(n,x,s,H),xr=!1,te=n.memoizedState,x.state=te,Ui(n,s,x,h),Hi();var le=n.memoizedState;w!==ue||te!==le||xr||e!==null&&e.dependencies!==null&&io(e.dependencies)?(typeof N=="function"&&(Xu(n,a,N,s),le=n.memoizedState),(ie=xr||sx(n,a,ie,s,te,le,H)||e!==null&&e.dependencies!==null&&io(e.dependencies))?(P||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(s,le,H),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(s,le,H)),typeof x.componentDidUpdate=="function"&&(n.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=1024),n.memoizedProps=s,n.memoizedState=le),x.props=s,x.state=le,x.context=H,s=ie):(typeof x.componentDidUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=1024),s=!1)}return x=s,Eo(e,n),s=(n.flags&128)!==0,x||s?(x=n.stateNode,a=s&&typeof a.getDerivedStateFromError!="function"?null:x.render(),n.flags|=1,e!==null&&s?(n.child=ia(n,e.child,null,h),n.child=ia(n,null,a,h)):hn(e,n,a,h),n.memoizedState=x.state,e=n.child):e=ql(e,n,h),e}function Sx(e,n,a,s){return ea(),n.flags|=256,hn(e,n,a,s),n.child}var Wu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Zu(e){return{baseLanes:e,cachePool:dm()}}function Ju(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=Yn),e}function jx(e,n,a){var s=n.pendingProps,h=!1,x=(n.flags&128)!==0,w;if((w=x)||(w=e!==null&&e.memoizedState===null?!1:(Qt.current&2)!==0),w&&(h=!0,n.flags&=-129),w=(n.flags&32)!==0,n.flags&=-33,e===null){if(ut){if(h?gr(n):br(),(e=_t)?(e=Mp(e,tl),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:fr!==null?{id:yl,overflow:gl}:null,retryLane:536870912,hydrationErrors:null},a=lm(e),a.return=n,n.child=a,fn=n,_t=null)):e=null,e===null)throw hr(n);return _f(e)?n.lanes=32:n.lanes=536870912,null}var N=s.children;return s=s.fallback,h?(br(),h=n.mode,N=No({mode:"hidden",children:N},h),s=Pr(s,h,a,null),N.return=n,s.return=n,N.sibling=s,n.child=N,s=n.child,s.memoizedState=Zu(a),s.childLanes=Ju(e,w,a),n.memoizedState=Wu,Vi(null,s)):(gr(n),Pu(n,N))}var H=e.memoizedState;if(H!==null&&(N=H.dehydrated,N!==null)){if(x)n.flags&256?(gr(n),n.flags&=-257,n=ef(e,n,a)):n.memoizedState!==null?(br(),n.child=e.child,n.flags|=128,n=null):(br(),N=s.fallback,h=n.mode,s=No({mode:"visible",children:s.children},h),N=Pr(N,h,a,null),N.flags|=2,s.return=n,N.return=n,s.sibling=N,n.child=s,ia(n,e.child,null,a),s=n.child,s.memoizedState=Zu(a),s.childLanes=Ju(e,w,a),n.memoizedState=Wu,n=Vi(null,s));else if(gr(n),_f(N)){if(w=N.nextSibling&&N.nextSibling.dataset,w)var P=w.dgst;w=P,s=Error(i(419)),s.stack="",s.digest=w,Fi({value:s,source:null,stack:null}),n=ef(e,n,a)}else if(en||Oa(e,n,a,!1),w=(a&e.childLanes)!==0,en||w){if(w=Tt,w!==null&&(s=zl(w,a),s!==0&&s!==H.retryLane))throw H.retryLane=s,Jr(e,s),Fn(w,e,s),Ku;Ff(N)||Oo(),n=ef(e,n,a)}else Ff(N)?(n.flags|=192,n.child=e.child,n=null):(e=H.treeContext,_t=ll(N.nextSibling),fn=n,ut=!0,dr=null,tl=!1,e!==null&&im(n,e),n=Pu(n,s.children),n.flags|=4096);return n}return h?(br(),N=s.fallback,h=n.mode,H=e.child,P=H.sibling,s=Ll(H,{mode:"hidden",children:s.children}),s.subtreeFlags=H.subtreeFlags&65011712,P!==null?N=Ll(P,N):(N=Pr(N,h,a,null),N.flags|=2),N.return=n,s.return=n,s.sibling=N,n.child=s,Vi(null,s),s=n.child,N=e.child.memoizedState,N===null?N=Zu(a):(h=N.cachePool,h!==null?(H=Jt._currentValue,h=h.parent!==H?{parent:H,pool:H}:h):h=dm(),N={baseLanes:N.baseLanes|a,cachePool:h}),s.memoizedState=N,s.childLanes=Ju(e,w,a),n.memoizedState=Wu,Vi(e.child,s)):(gr(n),a=e.child,e=a.sibling,a=Ll(a,{mode:"visible",children:s.children}),a.return=n,a.sibling=null,e!==null&&(w=n.deletions,w===null?(n.deletions=[e],n.flags|=16):w.push(e)),n.child=a,n.memoizedState=null,a)}function Pu(e,n){return n=No({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function No(e,n){return e=$n(22,e,null,n),e.lanes=0,e}function ef(e,n,a){return ia(n,e.child,null,a),e=Pu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Cx(e,n,a){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n),xu(e.return,n,a)}function tf(e,n,a,s,h,x){var w=e.memoizedState;w===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:s,tail:a,tailMode:h,treeForkCount:x}:(w.isBackwards=n,w.rendering=null,w.renderingStartTime=0,w.last=s,w.tail=a,w.tailMode=h,w.treeForkCount=x)}function Ex(e,n,a){var s=n.pendingProps,h=s.revealOrder,x=s.tail;s=s.children;var w=Qt.current,N=(w&2)!==0;if(N?(w=w&1|2,n.flags|=128):w&=1,T(Qt,w),hn(e,n,s,a),s=ut?Ri:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cx(e,a,n);else if(e.tag===19)Cx(e,a,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(h){case"forwards":for(a=n.child,h=null;a!==null;)e=a.alternate,e!==null&&xo(e)===null&&(h=a),a=a.sibling;a=h,a===null?(h=n.child,n.child=null):(h=a.sibling,a.sibling=null),tf(n,!1,h,a,x,s);break;case"backwards":case"unstable_legacy-backwards":for(a=null,h=n.child,n.child=null;h!==null;){if(e=h.alternate,e!==null&&xo(e)===null){n.child=h;break}e=h.sibling,h.sibling=a,a=h,h=e}tf(n,!0,a,null,x,s);break;case"together":tf(n,!1,null,null,void 0,s);break;default:n.memoizedState=null}return n.child}function ql(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),kr|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(Oa(e,n,a,!1),(a&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,a=Ll(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Ll(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function nf(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&io(e)))}function O2(e,n,a){switch(n.tag){case 3:He(n,n.stateNode.containerInfo),mr(n,Jt,e.memoizedState.cache),ea();break;case 27:case 5:ke(n);break;case 4:He(n,n.stateNode.containerInfo);break;case 10:mr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Nu(n),null;break;case 13:var s=n.memoizedState;if(s!==null)return s.dehydrated!==null?(gr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?jx(e,n,a):(gr(n),e=ql(e,n,a),e!==null?e.sibling:null);gr(n);break;case 19:var h=(e.flags&128)!==0;if(s=(a&n.childLanes)!==0,s||(Oa(e,n,a,!1),s=(a&n.childLanes)!==0),h){if(s)return Ex(e,n,a);n.flags|=128}if(h=n.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),T(Qt,Qt.current),s)break;return null;case 22:return n.lanes=0,gx(e,n,a,n.pendingProps);case 24:mr(n,Jt,e.memoizedState.cache)}return ql(e,n,a)}function Nx(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)en=!0;else{if(!nf(e,a)&&(n.flags&128)===0)return en=!1,O2(e,n,a);en=(e.flags&131072)!==0}else en=!1,ut&&(n.flags&1048576)!==0&&am(n,Ri,n.index);switch(n.lanes=0,n.tag){case 16:e:{var s=n.pendingProps;if(e=ra(n.elementType),n.type=e,typeof e=="function")su(e)?(s=oa(e,s),n.tag=1,n=kx(null,n,e,s,a)):(n.tag=0,n=Qu(null,n,e,s,a));else{if(e!=null){var h=e.$$typeof;if(h===O){n.tag=11,n=xx(null,n,e,s,a);break e}else if(h===U){n.tag=14,n=px(null,n,e,s,a);break e}}throw n=ee(e)||e,Error(i(306,n,""))}}return n;case 0:return Qu(e,n,n.type,n.pendingProps,a);case 1:return s=n.type,h=oa(s,n.pendingProps),kx(e,n,s,h,a);case 3:e:{if(He(n,n.stateNode.containerInfo),e===null)throw Error(i(387));s=n.pendingProps;var x=n.memoizedState;h=x.element,ku(e,n),Ui(n,s,null,a);var w=n.memoizedState;if(s=w.cache,mr(n,Jt,s),s!==x.cache&&pu(n,[Jt],a,!0),Hi(),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=Sx(e,n,s,a);break e}else if(s!==h){h=Jn(Error(i(424)),n),Fi(h),n=Sx(e,n,s,a);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(_t=ll(e.firstChild),fn=n,ut=!0,dr=null,tl=!0,a=gm(n,null,s,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ea(),s===h){n=ql(e,n,a);break e}hn(e,n,s,a)}n=n.child}return n;case 26:return Eo(e,n),e===null?(a=Lp(n.type,null,n.pendingProps,null))?n.memoizedState=a:ut||(a=n.type,e=n.pendingProps,s=Yo(Ee.current).createElement(a),s[$t]=n,s[cn]=e,mn(s,a,e),Ft(s),n.stateNode=s):n.memoizedState=Lp(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return ke(n),e===null&&ut&&(s=n.stateNode=_p(n.type,n.pendingProps,Ee.current),fn=n,tl=!0,h=_t,Nr(n.type)?(Of=h,_t=ll(s.firstChild)):_t=h),hn(e,n,n.pendingProps.children,a),Eo(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&ut&&((h=s=_t)&&(s=db(s,n.type,n.pendingProps,tl),s!==null?(n.stateNode=s,fn=n,_t=ll(s.firstChild),tl=!1,h=!0):h=!1),h||hr(n)),ke(n),h=n.type,x=n.pendingProps,w=e!==null?e.memoizedProps:null,s=x.children,zf(h,x)?s=null:w!==null&&zf(h,w)&&(n.flags|=32),n.memoizedState!==null&&(h=Tu(e,n,N2,null,null,a),ss._currentValue=h),Eo(e,n),hn(e,n,s,a),n.child;case 6:return e===null&&ut&&((e=a=_t)&&(a=hb(a,n.pendingProps,tl),a!==null?(n.stateNode=a,fn=n,_t=null,e=!0):e=!1),e||hr(n)),null;case 13:return jx(e,n,a);case 4:return He(n,n.stateNode.containerInfo),s=n.pendingProps,e===null?n.child=ia(n,null,s,a):hn(e,n,s,a),n.child;case 11:return xx(e,n,n.type,n.pendingProps,a);case 7:return hn(e,n,n.pendingProps,a),n.child;case 8:return hn(e,n,n.pendingProps.children,a),n.child;case 12:return hn(e,n,n.pendingProps.children,a),n.child;case 10:return s=n.pendingProps,mr(n,n.type,s.value),hn(e,n,s.children,a),n.child;case 9:return h=n.type._context,s=n.pendingProps.children,na(n),h=dn(h),s=s(h),n.flags|=1,hn(e,n,s,a),n.child;case 14:return px(e,n,n.type,n.pendingProps,a);case 15:return yx(e,n,n.type,n.pendingProps,a);case 19:return Ex(e,n,a);case 31:return _2(e,n,a);case 22:return gx(e,n,a,n.pendingProps);case 24:return na(n),s=dn(Jt),e===null?(h=bu(),h===null&&(h=Tt,x=yu(),h.pooledCache=x,x.refCount++,x!==null&&(h.pooledCacheLanes|=a),h=x),n.memoizedState={parent:s,cache:h},wu(n),mr(n,Jt,h)):((e.lanes&a)!==0&&(ku(e,n),Ui(n,null,null,a),Hi()),h=e.memoizedState,x=n.memoizedState,h.parent!==s?(h={parent:s,cache:s},n.memoizedState=h,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=h),mr(n,Jt,s)):(s=x.cache,mr(n,Jt,s),s!==h.cache&&pu(n,[Jt],a,!0))),hn(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function Xl(e){e.flags|=4}function lf(e,n,a,s,h){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(h&335544128)===h)if(e.stateNode.complete)e.flags|=8192;else if(ep())e.flags|=8192;else throw aa=uo,vu}else e.flags&=-16777217}function Ax(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Yp(n))if(ep())e.flags|=8192;else throw aa=uo,vu}function Ao(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Us():536870912,e.lanes|=n,Ka|=n)}function Gi(e,n){if(!ut)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var s=null;a!==null;)a.alternate!==null&&(s=a),a=a.sibling;s===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Ot(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,s=0;if(n)for(var h=e.child;h!==null;)a|=h.lanes|h.childLanes,s|=h.subtreeFlags&65011712,s|=h.flags&65011712,h.return=e,h=h.sibling;else for(h=e.child;h!==null;)a|=h.lanes|h.childLanes,s|=h.subtreeFlags,s|=h.flags,h.return=e,h=h.sibling;return e.subtreeFlags|=s,e.childLanes=a,n}function B2(e,n,a){var s=n.pendingProps;switch(fu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ot(n),null;case 1:return Ot(n),null;case 3:return a=n.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),n.memoizedState.cache!==s&&(n.flags|=2048),Ul(Jt),Ke(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(_a(n)?Xl(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,hu())),Ot(n),null;case 26:var h=n.type,x=n.memoizedState;return e===null?(Xl(n),x!==null?(Ot(n),Ax(n,x)):(Ot(n),lf(n,h,null,s,a))):x?x!==e.memoizedState?(Xl(n),Ot(n),Ax(n,x)):(Ot(n),n.flags&=-16777217):(e=e.memoizedProps,e!==s&&Xl(n),Ot(n),lf(n,h,e,s,a)),null;case 27:if(yt(n),a=Ee.current,h=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Xl(n);else{if(!s){if(n.stateNode===null)throw Error(i(166));return Ot(n),null}e=me.current,_a(n)?sm(n):(e=_p(h,s,a),n.stateNode=e,Xl(n))}return Ot(n),null;case 5:if(yt(n),h=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Xl(n);else{if(!s){if(n.stateNode===null)throw Error(i(166));return Ot(n),null}if(x=me.current,_a(n))sm(n);else{var w=Yo(Ee.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);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(h,{is:s.is}):w.createElement(h)}}x[$t]=n,x[cn]=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(mn(x,h,s),h){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Xl(n)}}return Ot(n),lf(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==s&&Xl(n);else{if(typeof s!="string"&&n.stateNode===null)throw Error(i(166));if(e=Ee.current,_a(n)){if(e=n.stateNode,a=n.memoizedProps,s=null,h=fn,h!==null)switch(h.tag){case 27:case 5:s=h.memoizedProps}e[$t]=n,e=!!(e.nodeValue===a||s!==null&&s.suppressHydrationWarning===!0||jp(e.nodeValue,a)),e||hr(n,!0)}else e=Yo(e).createTextNode(s),e[$t]=n,n.stateNode=e}return Ot(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(s=_a(n),a!==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[$t]=n}else ea(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ot(n),e=!1}else a=hu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(Un(n),n):(Un(n),null);if((n.flags&128)!==0)throw Error(i(558))}return Ot(n),null;case 13:if(s=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(h=_a(n),s!==null&&s.dehydrated!==null){if(e===null){if(!h)throw Error(i(318));if(h=n.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(317));h[$t]=n}else ea(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ot(n),h=!1}else h=hu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=h),h=!0;if(!h)return n.flags&256?(Un(n),n):(Un(n),null)}return Un(n),(n.flags&128)!==0?(n.lanes=a,n):(a=s!==null,e=e!==null&&e.memoizedState!==null,a&&(s=n.child,h=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(h=s.alternate.memoizedState.cachePool.pool),x=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(x=s.memoizedState.cachePool.pool),x!==h&&(s.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),Ao(n,n.updateQueue),Ot(n),null);case 4:return Ke(),e===null&&Ef(n.stateNode.containerInfo),Ot(n),null;case 10:return Ul(n.type),Ot(n),null;case 19:if(Q(Qt),s=n.memoizedState,s===null)return Ot(n),null;if(h=(n.flags&128)!==0,x=s.rendering,x===null)if(h)Gi(s,!1);else{if(Vt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(x=xo(e),x!==null){for(n.flags|=128,Gi(s,!1),e=x.updateQueue,n.updateQueue=e,Ao(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)nm(a,e),a=a.sibling;return T(Qt,Qt.current&1|2),ut&&$l(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&&ht()>Ro&&(n.flags|=128,h=!0,Gi(s,!1),n.lanes=4194304)}else{if(!h)if(e=xo(x),e!==null){if(n.flags|=128,h=!0,e=e.updateQueue,n.updateQueue=e,Ao(n,e),Gi(s,!0),s.tail===null&&s.tailMode==="hidden"&&!x.alternate&&!ut)return Ot(n),null}else 2*ht()-s.renderingStartTime>Ro&&a!==536870912&&(n.flags|=128,h=!0,Gi(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=ht(),e.sibling=null,a=Qt.current,T(Qt,h?a&1|2:a&1),ut&&$l(n,s.treeForkCount),e):(Ot(n),null);case 22:case 23:return Un(n),Eu(),s=n.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(n.flags|=8192):s&&(n.flags|=8192),s?(a&536870912)!==0&&(n.flags&128)===0&&(Ot(n),n.subtreeFlags&6&&(n.flags|=8192)):Ot(n),a=n.updateQueue,a!==null&&Ao(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==a&&(n.flags|=2048),e!==null&&Q(la),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Ul(Jt),Ot(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function L2(e,n){switch(fu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Ul(Jt),Ke(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return yt(n),null;case 31:if(n.memoizedState!==null){if(Un(n),n.alternate===null)throw Error(i(340));ea()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Un(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));ea()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Q(Qt),null;case 4:return Ke(),null;case 10:return Ul(n.type),null;case 22:case 23:return Un(n),Eu(),e!==null&&Q(la),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Ul(Jt),null;case 25:return null;default:return null}}function Tx(e,n){switch(fu(n),n.tag){case 3:Ul(Jt),Ke();break;case 26:case 27:case 5:yt(n);break;case 4:Ke();break;case 31:n.memoizedState!==null&&Un(n);break;case 13:Un(n);break;case 19:Q(Qt);break;case 10:Ul(n.type);break;case 22:case 23:Un(n),Eu(),e!==null&&Q(la);break;case 24:Ul(Jt)}}function Ki(e,n){try{var a=n.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var h=s.next;a=h;do{if((a.tag&e)===e){s=void 0;var x=a.create,w=a.inst;s=x(),w.destroy=s}a=a.next}while(a!==h)}}catch(N){St(n,n.return,N)}}function vr(e,n,a){try{var s=n.updateQueue,h=s!==null?s.lastEffect:null;if(h!==null){var x=h.next;s=x;do{if((s.tag&e)===e){var w=s.inst,N=w.destroy;if(N!==void 0){w.destroy=void 0,h=n;var H=a,P=N;try{P()}catch(ie){St(h,H,ie)}}}s=s.next}while(s!==x)}}catch(ie){St(n,n.return,ie)}}function Dx(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{vm(n,a)}catch(s){St(e,e.return,s)}}}function zx(e,n,a){a.props=oa(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(s){St(e,n,s)}}function Qi(e,n){try{var a=e.ref;if(a!==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 a=="function"?e.refCleanup=a(s):a.current=s}}catch(h){St(e,n,h)}}function bl(e,n){var a=e.ref,s=e.refCleanup;if(a!==null)if(typeof s=="function")try{s()}catch(h){St(e,n,h)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(h){St(e,n,h)}else a.current=null}function Mx(e){var n=e.type,a=e.memoizedProps,s=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&s.focus();break e;case"img":a.src?s.src=a.src:a.srcSet&&(s.srcset=a.srcSet)}}catch(h){St(e,e.return,h)}}function rf(e,n,a){try{var s=e.stateNode;ib(s,e.type,a,n),s[cn]=n}catch(h){St(e,e.return,h)}}function Rx(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Nr(e.type)||e.tag===4}function af(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Rx(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&&Nr(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 sf(e,n,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=Qn));else if(s!==4&&(s===27&&Nr(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(sf(e,n,a),e=e.sibling;e!==null;)sf(e,n,a),e=e.sibling}function To(e,n,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(s!==4&&(s===27&&Nr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(To(e,n,a),e=e.sibling;e!==null;)To(e,n,a),e=e.sibling}function Fx(e){var n=e.stateNode,a=e.memoizedProps;try{for(var s=e.type,h=n.attributes;h.length;)n.removeAttributeNode(h[0]);mn(n,s,a),n[$t]=e,n[cn]=a}catch(x){St(e,e.return,x)}}var Vl=!1,tn=!1,of=!1,_x=typeof WeakSet=="function"?WeakSet:Set,on=null;function $2(e,n){if(e=e.containerInfo,Tf=Wo,e=Gh(e),eu(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var s=a.getSelection&&a.getSelection();if(s&&s.rangeCount!==0){a=s.anchorNode;var h=s.anchorOffset,x=s.focusNode;s=s.focusOffset;try{a.nodeType,x.nodeType}catch{a=null;break e}var w=0,N=-1,H=-1,P=0,ie=0,ue=e,te=null;t:for(;;){for(var le;ue!==a||h!==0&&ue.nodeType!==3||(N=w+h),ue!==x||s!==0&&ue.nodeType!==3||(H=w+s),ue.nodeType===3&&(w+=ue.nodeValue.length),(le=ue.firstChild)!==null;)te=ue,ue=le;for(;;){if(ue===e)break t;if(te===a&&++P===h&&(N=w),te===x&&++ie===s&&(H=w),(le=ue.nextSibling)!==null)break;ue=te,te=ue.parentNode}ue=le}a=N===-1||H===-1?null:{start:N,end:H}}else a=null}a=a||{start:0,end:0}}else a=null;for(Df={focusedElem:e,selectionRange:a},Wo=!1,on=n;on!==null;)if(n=on,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,on=e;else for(;on!==null;){switch(n=on,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(a=0;a<e.length;a++)h=e[a],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&x!==null){e=void 0,a=n,h=x.memoizedProps,x=x.memoizedState,s=a.stateNode;try{var Ae=oa(a.type,h);e=s.getSnapshotBeforeUpdate(Ae,x),s.__reactInternalSnapshotBeforeUpdate=e}catch(Ye){St(a,a.return,Ye)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)Rf(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Rf(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,on=e;break}on=n.return}}function Ox(e,n,a){var s=a.flags;switch(a.tag){case 0:case 11:case 15:Kl(e,a),s&4&&Ki(5,a);break;case 1:if(Kl(e,a),s&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(w){St(a,a.return,w)}else{var h=oa(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(h,n,e.__reactInternalSnapshotBeforeUpdate)}catch(w){St(a,a.return,w)}}s&64&&Dx(a),s&512&&Qi(a,a.return);break;case 3:if(Kl(e,a),s&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{vm(e,n)}catch(w){St(a,a.return,w)}}break;case 27:n===null&&s&4&&Fx(a);case 26:case 5:Kl(e,a),n===null&&s&4&&Mx(a),s&512&&Qi(a,a.return);break;case 12:Kl(e,a);break;case 31:Kl(e,a),s&4&&$x(e,a);break;case 13:Kl(e,a),s&4&&Hx(e,a),s&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=K2.bind(null,a),mb(e,a))));break;case 22:if(s=a.memoizedState!==null||Vl,!s){n=n!==null&&n.memoizedState!==null||tn,h=Vl;var x=tn;Vl=s,(tn=n)&&!x?Ql(e,a,(a.subtreeFlags&8772)!==0):Kl(e,a),Vl=h,tn=x}break;case 30:break;default:Kl(e,a)}}function Bx(e){var n=e.alternate;n!==null&&(e.alternate=null,Bx(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Sa(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 Ht=null,Dn=!1;function Gl(e,n,a){for(a=a.child;a!==null;)Lx(e,n,a),a=a.sibling}function Lx(e,n,a){if(Xe&&typeof Xe.onCommitFiberUnmount=="function")try{Xe.onCommitFiberUnmount(wt,a)}catch{}switch(a.tag){case 26:tn||bl(a,n),Gl(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:tn||bl(a,n);var s=Ht,h=Dn;Nr(a.type)&&(Ht=a.stateNode,Dn=!1),Gl(e,n,a),rs(a.stateNode),Ht=s,Dn=h;break;case 5:tn||bl(a,n);case 6:if(s=Ht,h=Dn,Ht=null,Gl(e,n,a),Ht=s,Dn=h,Ht!==null)if(Dn)try{(Ht.nodeType===9?Ht.body:Ht.nodeName==="HTML"?Ht.ownerDocument.body:Ht).removeChild(a.stateNode)}catch(x){St(a,n,x)}else try{Ht.removeChild(a.stateNode)}catch(x){St(a,n,x)}break;case 18:Ht!==null&&(Dn?(e=Ht,Dp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),ni(e)):Dp(Ht,a.stateNode));break;case 4:s=Ht,h=Dn,Ht=a.stateNode.containerInfo,Dn=!0,Gl(e,n,a),Ht=s,Dn=h;break;case 0:case 11:case 14:case 15:vr(2,a,n),tn||vr(4,a,n),Gl(e,n,a);break;case 1:tn||(bl(a,n),s=a.stateNode,typeof s.componentWillUnmount=="function"&&zx(a,n,s)),Gl(e,n,a);break;case 21:Gl(e,n,a);break;case 22:tn=(s=tn)||a.memoizedState!==null,Gl(e,n,a),tn=s;break;default:Gl(e,n,a)}}function $x(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ni(e)}catch(a){St(n,n.return,a)}}}function Hx(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ni(e)}catch(a){St(n,n.return,a)}}function H2(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new _x),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new _x),n;default:throw Error(i(435,e.tag))}}function Do(e,n){var a=H2(e);n.forEach(function(s){if(!a.has(s)){a.add(s);var h=Q2.bind(null,e,s);s.then(h,h)}})}function zn(e,n){var a=n.deletions;if(a!==null)for(var s=0;s<a.length;s++){var h=a[s],x=e,w=n,N=w;e:for(;N!==null;){switch(N.tag){case 27:if(Nr(N.type)){Ht=N.stateNode,Dn=!1;break e}break;case 5:Ht=N.stateNode,Dn=!1;break e;case 3:case 4:Ht=N.stateNode.containerInfo,Dn=!0;break e}N=N.return}if(Ht===null)throw Error(i(160));Lx(x,w,h),Ht=null,Dn=!1,x=h.alternate,x!==null&&(x.return=null),h.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Ux(n,e),n=n.sibling}var cl=null;function Ux(e,n){var a=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:zn(n,e),Mn(e),s&4&&(vr(3,e,e.return),Ki(3,e),vr(5,e,e.return));break;case 1:zn(n,e),Mn(e),s&512&&(tn||a===null||bl(a,a.return)),s&64&&Vl&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?s:a.concat(s))));break;case 26:var h=cl;if(zn(n,e),Mn(e),s&512&&(tn||a===null||bl(a,a.return)),s&4){var x=a!==null?a.memoizedState:null;if(s=e.memoizedState,a===null)if(s===null)if(e.stateNode===null){e:{s=e.type,a=e.memoizedProps,h=h.ownerDocument||h;t:switch(s){case"title":x=h.getElementsByTagName("title")[0],(!x||x[_l]||x[$t]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=h.createElement(s),h.head.insertBefore(x,h.querySelector("head > title"))),mn(x,s,a),x[$t]=e,Ft(x),s=x;break e;case"link":var w=Up("link","href",h).get(s+(a.href||""));if(w){for(var N=0;N<w.length;N++)if(x=w[N],x.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&x.getAttribute("rel")===(a.rel==null?null:a.rel)&&x.getAttribute("title")===(a.title==null?null:a.title)&&x.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){w.splice(N,1);break t}}x=h.createElement(s),mn(x,s,a),h.head.appendChild(x);break;case"meta":if(w=Up("meta","content",h).get(s+(a.content||""))){for(N=0;N<w.length;N++)if(x=w[N],x.getAttribute("content")===(a.content==null?null:""+a.content)&&x.getAttribute("name")===(a.name==null?null:a.name)&&x.getAttribute("property")===(a.property==null?null:a.property)&&x.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&x.getAttribute("charset")===(a.charSet==null?null:a.charSet)){w.splice(N,1);break t}}x=h.createElement(s),mn(x,s,a),h.head.appendChild(x);break;default:throw Error(i(468,s))}x[$t]=e,Ft(x),s=x}e.stateNode=s}else Ip(h,e.type,e.stateNode);else e.stateNode=Hp(h,s,e.memoizedProps);else x!==s?(x===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):x.count--,s===null?Ip(h,e.type,e.stateNode):Hp(h,s,e.memoizedProps)):s===null&&e.stateNode!==null&&rf(e,e.memoizedProps,a.memoizedProps)}break;case 27:zn(n,e),Mn(e),s&512&&(tn||a===null||bl(a,a.return)),a!==null&&s&4&&rf(e,e.memoizedProps,a.memoizedProps);break;case 5:if(zn(n,e),Mn(e),s&512&&(tn||a===null||bl(a,a.return)),e.flags&32){h=e.stateNode;try{ur(h,"")}catch(Ae){St(e,e.return,Ae)}}s&4&&e.stateNode!=null&&(h=e.memoizedProps,rf(e,h,a!==null?a.memoizedProps:h)),s&1024&&(of=!0);break;case 6:if(zn(n,e),Mn(e),s&4){if(e.stateNode===null)throw Error(i(162));s=e.memoizedProps,a=e.stateNode;try{a.nodeValue=s}catch(Ae){St(e,e.return,Ae)}}break;case 3:if(Vo=null,h=cl,cl=qo(n.containerInfo),zn(n,e),cl=h,Mn(e),s&4&&a!==null&&a.memoizedState.isDehydrated)try{ni(n.containerInfo)}catch(Ae){St(e,e.return,Ae)}of&&(of=!1,Ix(e));break;case 4:s=cl,cl=qo(e.stateNode.containerInfo),zn(n,e),Mn(e),cl=s;break;case 12:zn(n,e),Mn(e);break;case 31:zn(n,e),Mn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Do(e,s)));break;case 13:zn(n,e),Mn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Mo=ht()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Do(e,s)));break;case 22:h=e.memoizedState!==null;var H=a!==null&&a.memoizedState!==null,P=Vl,ie=tn;if(Vl=P||h,tn=ie||H,zn(n,e),tn=ie,Vl=P,Mn(e),s&8192)e:for(n=e.stateNode,n._visibility=h?n._visibility&-2:n._visibility|1,h&&(a===null||H||Vl||tn||ca(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){H=a=n;try{if(x=H.stateNode,h)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{N=H.stateNode;var ue=H.memoizedProps.style,te=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;N.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(Ae){St(H,H.return,Ae)}}}else if(n.tag===6){if(a===null){H=n;try{H.stateNode.nodeValue=h?"":H.memoizedProps}catch(Ae){St(H,H.return,Ae)}}}else if(n.tag===18){if(a===null){H=n;try{var le=H.stateNode;h?zp(le,!0):zp(H.stateNode,!1)}catch(Ae){St(H,H.return,Ae)}}}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;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}s&4&&(s=e.updateQueue,s!==null&&(a=s.retryQueue,a!==null&&(s.retryQueue=null,Do(e,a))));break;case 19:zn(n,e),Mn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Do(e,s)));break;case 30:break;case 21:break;default:zn(n,e),Mn(e)}}function Mn(e){var n=e.flags;if(n&2){try{for(var a,s=e.return;s!==null;){if(Rx(s)){a=s;break}s=s.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var h=a.stateNode,x=af(e);To(e,x,h);break;case 5:var w=a.stateNode;a.flags&32&&(ur(w,""),a.flags&=-33);var N=af(e);To(e,N,w);break;case 3:case 4:var H=a.stateNode.containerInfo,P=af(e);sf(e,P,H);break;default:throw Error(i(161))}}catch(ie){St(e,e.return,ie)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Ix(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Ix(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Kl(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Ox(e,n.alternate,n),n=n.sibling}function ca(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:vr(4,n,n.return),ca(n);break;case 1:bl(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&zx(n,n.return,a),ca(n);break;case 27:rs(n.stateNode);case 26:case 5:bl(n,n.return),ca(n);break;case 22:n.memoizedState===null&&ca(n);break;case 30:ca(n);break;default:ca(n)}e=e.sibling}}function Ql(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var s=n.alternate,h=e,x=n,w=x.flags;switch(x.tag){case 0:case 11:case 15:Ql(h,x,a),Ki(4,x);break;case 1:if(Ql(h,x,a),s=x,h=s.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(P){St(s,s.return,P)}if(s=x,h=s.updateQueue,h!==null){var N=s.stateNode;try{var H=h.shared.hiddenCallbacks;if(H!==null)for(h.shared.hiddenCallbacks=null,h=0;h<H.length;h++)bm(H[h],N)}catch(P){St(s,s.return,P)}}a&&w&64&&Dx(x),Qi(x,x.return);break;case 27:Fx(x);case 26:case 5:Ql(h,x,a),a&&s===null&&w&4&&Mx(x),Qi(x,x.return);break;case 12:Ql(h,x,a);break;case 31:Ql(h,x,a),a&&w&4&&$x(h,x);break;case 13:Ql(h,x,a),a&&w&4&&Hx(h,x);break;case 22:x.memoizedState===null&&Ql(h,x,a),Qi(x,x.return);break;case 30:break;default:Ql(h,x,a)}n=n.sibling}}function cf(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&_i(a))}function uf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&_i(e))}function ul(e,n,a,s){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Yx(e,n,a,s),n=n.sibling}function Yx(e,n,a,s){var h=n.flags;switch(n.tag){case 0:case 11:case 15:ul(e,n,a,s),h&2048&&Ki(9,n);break;case 1:ul(e,n,a,s);break;case 3:ul(e,n,a,s),h&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&_i(e)));break;case 12:if(h&2048){ul(e,n,a,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(H){St(n,n.return,H)}}else ul(e,n,a,s);break;case 31:ul(e,n,a,s);break;case 13:ul(e,n,a,s);break;case 23:break;case 22:x=n.stateNode,w=n.alternate,n.memoizedState!==null?x._visibility&2?ul(e,n,a,s):Wi(e,n):x._visibility&2?ul(e,n,a,s):(x._visibility|=2,Xa(e,n,a,s,(n.subtreeFlags&10256)!==0||!1)),h&2048&&cf(w,n);break;case 24:ul(e,n,a,s),h&2048&&uf(n.alternate,n);break;default:ul(e,n,a,s)}}function Xa(e,n,a,s,h){for(h=h&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var x=e,w=n,N=a,H=s,P=w.flags;switch(w.tag){case 0:case 11:case 15:Xa(x,w,N,H,h),Ki(8,w);break;case 23:break;case 22:var ie=w.stateNode;w.memoizedState!==null?ie._visibility&2?Xa(x,w,N,H,h):Wi(x,w):(ie._visibility|=2,Xa(x,w,N,H,h)),h&&P&2048&&cf(w.alternate,w);break;case 24:Xa(x,w,N,H,h),h&&P&2048&&uf(w.alternate,w);break;default:Xa(x,w,N,H,h)}n=n.sibling}}function Wi(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,s=n,h=s.flags;switch(s.tag){case 22:Wi(a,s),h&2048&&cf(s.alternate,s);break;case 24:Wi(a,s),h&2048&&uf(s.alternate,s);break;default:Wi(a,s)}n=n.sibling}}var Zi=8192;function Va(e,n,a){if(e.subtreeFlags&Zi)for(e=e.child;e!==null;)qx(e,n,a),e=e.sibling}function qx(e,n,a){switch(e.tag){case 26:Va(e,n,a),e.flags&Zi&&e.memoizedState!==null&&Eb(a,cl,e.memoizedState,e.memoizedProps);break;case 5:Va(e,n,a);break;case 3:case 4:var s=cl;cl=qo(e.stateNode.containerInfo),Va(e,n,a),cl=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Zi,Zi=16777216,Va(e,n,a),Zi=s):Va(e,n,a));break;default:Va(e,n,a)}}function Xx(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 Ji(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var s=n[a];on=s,Gx(s,e)}Xx(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Vx(e),e=e.sibling}function Vx(e){switch(e.tag){case 0:case 11:case 15:Ji(e),e.flags&2048&&vr(9,e,e.return);break;case 3:Ji(e);break;case 12:Ji(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,zo(e)):Ji(e);break;default:Ji(e)}}function zo(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var s=n[a];on=s,Gx(s,e)}Xx(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:vr(8,n,n.return),zo(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,zo(n));break;default:zo(n)}e=e.sibling}}function Gx(e,n){for(;on!==null;){var a=on;switch(a.tag){case 0:case 11:case 15:vr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var s=a.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:_i(a.memoizedState.cache)}if(s=a.child,s!==null)s.return=a,on=s;else e:for(a=e;on!==null;){s=on;var h=s.sibling,x=s.return;if(Bx(s),s===a){on=null;break e}if(h!==null){h.return=x,on=h;break e}on=x}}}var U2={getCacheForType:function(e){var n=dn(Jt),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return dn(Jt).controller.signal}},I2=typeof WeakMap=="function"?WeakMap:Map,bt=0,Tt=null,rt=null,st=0,kt=0,In=null,wr=!1,Ga=!1,ff=!1,Wl=0,Vt=0,kr=0,ua=0,df=0,Yn=0,Ka=0,Pi=null,Rn=null,hf=!1,Mo=0,Kx=0,Ro=1/0,Fo=null,Sr=null,ln=0,jr=null,Qa=null,Zl=0,mf=0,xf=null,Qx=null,es=0,pf=null;function qn(){return(bt&2)!==0&&st!==0?st&-st:I.T!==null?kf():Ml()}function Wx(){if(Yn===0)if((st&536870912)===0||ut){var e=wa;wa<<=1,(wa&3932160)===0&&(wa=262144),Yn=e}else Yn=536870912;return e=Hn.current,e!==null&&(e.flags|=32),Yn}function Fn(e,n,a){(e===Tt&&(kt===2||kt===9)||e.cancelPendingCommit!==null)&&(Wa(e,0),Cr(e,st,Yn,!1)),ar(e,a),((bt&2)===0||e!==Tt)&&(e===Tt&&((bt&2)===0&&(ua|=a),Vt===4&&Cr(e,st,Yn,!1)),vl(e))}function Zx(e,n,a){if((bt&6)!==0)throw Error(i(327));var s=!a&&(n&127)===0&&(n&e.expiredLanes)===0||qr(e,n),h=s?X2(e,n):gf(e,n,!0),x=s;do{if(h===0){Ga&&!s&&Cr(e,n,0,!1);break}else{if(a=e.current.alternate,x&&!Y2(a)){h=gf(e,n,!1),x=!1;continue}if(h===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;h=Pi;var H=N.current.memoizedState.isDehydrated;if(H&&(Wa(N,w).flags|=256),w=gf(N,w,!1),w!==2){if(ff&&!H){N.errorRecoveryDisabledLanes|=x,ua|=x,h=4;break e}x=Rn,Rn=h,x!==null&&(Rn===null?Rn=x:Rn.push.apply(Rn,x))}h=w}if(x=!1,h!==2)continue}}if(h===1){Wa(e,0),Cr(e,n,0,!0);break}e:{switch(s=e,x=h,x){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:Cr(s,n,Yn,!wr);break e;case 2:Rn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(h=Mo+300-ht(),10<h)){if(Cr(s,n,Yn,!wr),rr(s,0,!0)!==0)break e;Zl=n,s.timeoutHandle=Ap(Jx.bind(null,s,a,Rn,Fo,hf,n,Yn,ua,Ka,wr,x,"Throttled",-0,0),h);break e}Jx(s,a,Rn,Fo,hf,n,Yn,ua,Ka,wr,x,null,-0,0)}}break}while(!0);vl(e)}function Jx(e,n,a,s,h,x,w,N,H,P,ie,ue,te,le){if(e.timeoutHandle=-1,ue=n.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Qn},qx(n,x,ue);var Ae=(x&62914560)===x?Mo-ht():(x&4194048)===x?Kx-ht():0;if(Ae=Nb(ue,Ae),Ae!==null){Zl=x,e.cancelPendingCommit=Ae(ip.bind(null,e,n,x,a,s,h,w,N,H,ie,ue,null,te,le)),Cr(e,x,w,!P);return}}ip(e,n,x,a,s,h,w,N,H)}function Y2(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var s=0;s<a.length;s++){var h=a[s],x=h.getSnapshot;h=h.value;try{if(!Ln(x(),h))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;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 Cr(e,n,a,s){n&=~df,n&=~ua,e.suspendedLanes|=n,e.pingedLanes&=~n,s&&(e.warmLanes|=n),s=e.expirationTimes;for(var h=n;0<h;){var x=31-fe(h),w=1<<x;s[x]=-1,h&=~w}a!==0&&bn(e,a,n)}function _o(){return(bt&6)===0?(ts(0),!1):!0}function yf(){if(rt!==null){if(kt===0)var e=rt.return;else e=rt,Hl=ta=null,Mu(e),Ha=null,Bi=0,e=rt;for(;e!==null;)Tx(e.alternate,e),e=e.return;rt=null}}function Wa(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,cb(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Zl=0,yf(),Tt=e,rt=a=Ll(e.current,null),st=n,kt=0,In=null,wr=!1,Ga=qr(e,n),ff=!1,Ka=Yn=df=ua=kr=Vt=0,Rn=Pi=null,hf=!1,(n&8)!==0&&(n|=n&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=n;0<s;){var h=31-fe(s),x=1<<h;n|=e[h],s&=~x}return Wl=n,to(),a}function Px(e,n){Qe=null,I.H=Xi,n===$a||n===co?(n=xm(),kt=3):n===vu?(n=xm(),kt=4):kt=n===Ku?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,In=n,rt===null&&(Vt=1,jo(e,Jn(n,e.current)))}function ep(){var e=Hn.current;return e===null?!0:(st&4194048)===st?nl===null:(st&62914560)===st||(st&536870912)!==0?e===nl:!1}function tp(){var e=I.H;return I.H=Xi,e===null?Xi:e}function np(){var e=I.A;return I.A=U2,e}function Oo(){Vt=4,wr||(st&4194048)!==st&&Hn.current!==null||(Ga=!0),(kr&134217727)===0&&(ua&134217727)===0||Tt===null||Cr(Tt,st,Yn,!1)}function gf(e,n,a){var s=bt;bt|=2;var h=tp(),x=np();(Tt!==e||st!==n)&&(Fo=null,Wa(e,n)),n=!1;var w=Vt;e:do try{if(kt!==0&&rt!==null){var N=rt,H=In;switch(kt){case 8:yf(),w=6;break e;case 3:case 2:case 9:case 6:Hn.current===null&&(n=!0);var P=kt;if(kt=0,In=null,Za(e,N,H,P),a&&Ga){w=0;break e}break;default:P=kt,kt=0,In=null,Za(e,N,H,P)}}q2(),w=Vt;break}catch(ie){Px(e,ie)}while(!0);return n&&e.shellSuspendCounter++,Hl=ta=null,bt=s,I.H=h,I.A=x,rt===null&&(Tt=null,st=0,to()),w}function q2(){for(;rt!==null;)lp(rt)}function X2(e,n){var a=bt;bt|=2;var s=tp(),h=np();Tt!==e||st!==n?(Fo=null,Ro=ht()+500,Wa(e,n)):Ga=qr(e,n);e:do try{if(kt!==0&&rt!==null){n=rt;var x=In;t:switch(kt){case 1:kt=0,In=null,Za(e,n,x,1);break;case 2:case 9:if(hm(x)){kt=0,In=null,rp(n);break}n=function(){kt!==2&&kt!==9||Tt!==e||(kt=7),vl(e)},x.then(n,n);break e;case 3:kt=7;break e;case 4:kt=5;break e;case 7:hm(x)?(kt=0,In=null,rp(n)):(kt=0,In=null,Za(e,n,x,7));break;case 5:var w=null;switch(rt.tag){case 26:w=rt.memoizedState;case 5:case 27:var N=rt;if(w?Yp(w):N.stateNode.complete){kt=0,In=null;var H=N.sibling;if(H!==null)rt=H;else{var P=N.return;P!==null?(rt=P,Bo(P)):rt=null}break t}}kt=0,In=null,Za(e,n,x,5);break;case 6:kt=0,In=null,Za(e,n,x,6);break;case 8:yf(),Vt=6;break e;default:throw Error(i(462))}}V2();break}catch(ie){Px(e,ie)}while(!0);return Hl=ta=null,I.H=s,I.A=h,bt=a,rt!==null?0:(Tt=null,st=0,to(),Vt)}function V2(){for(;rt!==null&&!Lt();)lp(rt)}function lp(e){var n=Nx(e.alternate,e,Wl);e.memoizedProps=e.pendingProps,n===null?Bo(e):rt=n}function rp(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=wx(a,n,n.pendingProps,n.type,void 0,st);break;case 11:n=wx(a,n,n.pendingProps,n.type.render,n.ref,st);break;case 5:Mu(n);default:Tx(a,n),n=rt=nm(n,Wl),n=Nx(a,n,Wl)}e.memoizedProps=e.pendingProps,n===null?Bo(e):rt=n}function Za(e,n,a,s){Hl=ta=null,Mu(n),Ha=null,Bi=0;var h=n.return;try{if(F2(e,h,n,a,st)){Vt=1,jo(e,Jn(a,e.current)),rt=null;return}}catch(x){if(h!==null)throw rt=h,x;Vt=1,jo(e,Jn(a,e.current)),rt=null;return}n.flags&32768?(ut||s===1?e=!0:Ga||(st&536870912)!==0?e=!1:(wr=e=!0,(s===2||s===9||s===3||s===6)&&(s=Hn.current,s!==null&&s.tag===13&&(s.flags|=16384))),ap(n,e)):Bo(n)}function Bo(e){var n=e;do{if((n.flags&32768)!==0){ap(n,wr);return}e=n.return;var a=B2(n.alternate,n,Wl);if(a!==null){rt=a;return}if(n=n.sibling,n!==null){rt=n;return}rt=n=e}while(n!==null);Vt===0&&(Vt=5)}function ap(e,n){do{var a=L2(e.alternate,e);if(a!==null){a.flags&=32767,rt=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){rt=e;return}rt=e=a}while(e!==null);Vt=6,rt=null}function ip(e,n,a,s,h,x,w,N,H){e.cancelPendingCommit=null;do Lo();while(ln!==0);if((bt&6)!==0)throw Error(i(327));if(n!==null){if(n===e.current)throw Error(i(177));if(x=n.lanes|n.childLanes,x|=au,xi(e,a,x,w,N,H),e===Tt&&(rt=Tt=null,st=0),Qa=n,jr=e,Zl=a,mf=x,xf=h,Qx=s,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,W2(De,function(){return fp(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||s){s=I.T,I.T=null,h=Z.p,Z.p=2,w=bt,bt|=4;try{$2(e,n,a)}finally{bt=w,Z.p=h,I.T=s}}ln=1,sp(),op(),cp()}}function sp(){if(ln===1){ln=0;var e=jr,n=Qa,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=I.T,I.T=null;var s=Z.p;Z.p=2;var h=bt;bt|=4;try{Ux(n,e);var x=Df,w=Gh(e.containerInfo),N=x.focusedElem,H=x.selectionRange;if(w!==N&&N&&N.ownerDocument&&Vh(N.ownerDocument.documentElement,N)){if(H!==null&&eu(N)){var P=H.start,ie=H.end;if(ie===void 0&&(ie=P),"selectionStart"in N)N.selectionStart=P,N.selectionEnd=Math.min(ie,N.value.length);else{var ue=N.ownerDocument||document,te=ue&&ue.defaultView||window;if(te.getSelection){var le=te.getSelection(),Ae=N.textContent.length,Ye=Math.min(H.start,Ae),Nt=H.end===void 0?Ye:Math.min(H.end,Ae);!le.extend&&Ye>Nt&&(w=Nt,Nt=Ye,Ye=w);var K=Xh(N,Ye),Y=Xh(N,Nt);if(K&&Y&&(le.rangeCount!==1||le.anchorNode!==K.node||le.anchorOffset!==K.offset||le.focusNode!==Y.node||le.focusOffset!==Y.offset)){var J=ue.createRange();J.setStart(K.node,K.offset),le.removeAllRanges(),Ye>Nt?(le.addRange(J),le.extend(Y.node,Y.offset)):(J.setEnd(Y.node,Y.offset),le.addRange(J))}}}}for(ue=[],le=N;le=le.parentNode;)le.nodeType===1&&ue.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<ue.length;N++){var oe=ue[N];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}Wo=!!Tf,Df=Tf=null}finally{bt=h,Z.p=s,I.T=a}}e.current=n,ln=2}}function op(){if(ln===2){ln=0;var e=jr,n=Qa,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=I.T,I.T=null;var s=Z.p;Z.p=2;var h=bt;bt|=4;try{Ox(e,n.alternate,n)}finally{bt=h,Z.p=s,I.T=a}}ln=3}}function cp(){if(ln===4||ln===3){ln=0,gt();var e=jr,n=Qa,a=Zl,s=Qx;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?ln=5:(ln=0,Qa=jr=null,up(e,e.pendingLanes));var h=e.pendingLanes;if(h===0&&(Sr=null),ml(a),n=n.stateNode,Xe&&typeof Xe.onCommitFiberRoot=="function")try{Xe.onCommitFiberRoot(wt,n,void 0,(n.current.flags&128)===128)}catch{}if(s!==null){n=I.T,h=Z.p,Z.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,Z.p=h}}(Zl&3)!==0&&Lo(),vl(e),h=e.pendingLanes,(a&261930)!==0&&(h&42)!==0?e===pf?es++:(es=0,pf=e):es=0,ts(0)}}function up(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,_i(n)))}function Lo(){return sp(),op(),cp(),fp()}function fp(){if(ln!==5)return!1;var e=jr,n=mf;mf=0;var a=ml(Zl),s=I.T,h=Z.p;try{Z.p=32>a?32:a,I.T=null,a=xf,xf=null;var x=jr,w=Zl;if(ln=0,Qa=jr=null,Zl=0,(bt&6)!==0)throw Error(i(331));var N=bt;if(bt|=4,Vx(x.current),Yx(x,x.current,w,a),bt=N,ts(0,!1),Xe&&typeof Xe.onPostCommitFiberRoot=="function")try{Xe.onPostCommitFiberRoot(wt,x)}catch{}return!0}finally{Z.p=h,I.T=s,up(e,n)}}function dp(e,n,a){n=Jn(a,n),n=Gu(e.stateNode,n,2),e=yr(e,n,2),e!==null&&(ar(e,2),vl(e))}function St(e,n,a){if(e.tag===3)dp(e,e,a);else for(;n!==null;){if(n.tag===3){dp(n,e,a);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Sr===null||!Sr.has(s))){e=Jn(a,e),a=hx(2),s=yr(n,a,2),s!==null&&(mx(a,s,n,e),ar(s,2),vl(s));break}}n=n.return}}function bf(e,n,a){var s=e.pingCache;if(s===null){s=e.pingCache=new I2;var h=new Set;s.set(n,h)}else h=s.get(n),h===void 0&&(h=new Set,s.set(n,h));h.has(a)||(ff=!0,h.add(a),e=G2.bind(null,e,n,a),n.then(e,e))}function G2(e,n,a){var s=e.pingCache;s!==null&&s.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Tt===e&&(st&a)===a&&(Vt===4||Vt===3&&(st&62914560)===st&&300>ht()-Mo?(bt&2)===0&&Wa(e,0):df|=a,Ka===st&&(Ka=0)),vl(e)}function hp(e,n){n===0&&(n=Us()),e=Jr(e,n),e!==null&&(ar(e,n),vl(e))}function K2(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),hp(e,a)}function Q2(e,n){var a=0;switch(e.tag){case 31:case 13:var s=e.stateNode,h=e.memoizedState;h!==null&&(a=h.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),hp(e,a)}function W2(e,n){return Oe(e,n)}var $o=null,Ja=null,vf=!1,Ho=!1,wf=!1,Er=0;function vl(e){e!==Ja&&e.next===null&&(Ja===null?$o=Ja=e:Ja=Ja.next=e),Ho=!0,vf||(vf=!0,J2())}function ts(e,n){if(!wf&&Ho){wf=!0;do for(var a=!1,s=$o;s!==null;){if(e!==0){var h=s.pendingLanes;if(h===0)var x=0;else{var w=s.suspendedLanes,N=s.pingedLanes;x=(1<<31-fe(42|e)+1)-1,x&=h&~(w&~N),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(a=!0,yp(s,x))}else x=st,x=rr(s,s===Tt?x:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(x&3)===0||qr(s,x)||(a=!0,yp(s,x));s=s.next}while(a);wf=!1}}function Z2(){mp()}function mp(){Ho=vf=!1;var e=0;Er!==0&&ob()&&(e=Er);for(var n=ht(),a=null,s=$o;s!==null;){var h=s.next,x=xp(s,n);x===0?(s.next=null,a===null?$o=h:a.next=h,h===null&&(Ja=a)):(a=s,(e!==0||(x&3)!==0)&&(Ho=!0)),s=h}ln!==0&&ln!==5||ts(e),Er!==0&&(Er=0)}function xp(e,n){for(var a=e.suspendedLanes,s=e.pingedLanes,h=e.expirationTimes,x=e.pendingLanes&-62914561;0<x;){var w=31-fe(x),N=1<<w,H=h[w];H===-1?((N&a)===0||(N&s)!==0)&&(h[w]=ka(N,n)):H<=n&&(e.expiredLanes|=N),x&=~N}if(n=Tt,a=st,a=rr(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,a===0||e===n&&(kt===2||kt===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&tt(s),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||qr(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(s!==null&&tt(s),ml(a)){case 2:case 8:a=xe;break;case 32:a=De;break;case 268435456:a=ye;break;default:a=De}return s=pp.bind(null,e),a=Oe(a,s),e.callbackPriority=n,e.callbackNode=a,n}return s!==null&&s!==null&&tt(s),e.callbackPriority=2,e.callbackNode=null,2}function pp(e,n){if(ln!==0&&ln!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Lo()&&e.callbackNode!==a)return null;var s=st;return s=rr(e,e===Tt?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Zx(e,s,n),xp(e,ht()),e.callbackNode!=null&&e.callbackNode===a?pp.bind(null,e):null)}function yp(e,n){if(Lo())return null;Zx(e,n,!0)}function J2(){ub(function(){(bt&6)!==0?Oe(ae,Z2):mp()})}function kf(){if(Er===0){var e=Ba;e===0&&(e=lr,lr<<=1,(lr&261888)===0&&(lr=256)),Er=e}return Er}function gp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Bn(""+e)}function bp(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function P2(e,n,a,s,h){if(n==="submit"&&a&&a.stateNode===h){var x=gp((h[cn]||null).action),w=s.submitter;w&&(n=(n=w[cn]||null)?gp(n.formAction):w.getAttribute("formAction"),n!==null&&(x=n,w=null));var N=new Zs("action","action",null,s,h);e.push({event:N,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Er!==0){var H=w?bp(h,w):new FormData(h);Uu(a,{pending:!0,data:H,method:h.method,action:x},null,H)}}else typeof x=="function"&&(N.preventDefault(),H=w?bp(h,w):new FormData(h),Uu(a,{pending:!0,data:H,method:h.method,action:x},x,H))},currentTarget:h}]})}}for(var Sf=0;Sf<ru.length;Sf++){var jf=ru[Sf],eb=jf.toLowerCase(),tb=jf[0].toUpperCase()+jf.slice(1);ol(eb,"on"+tb)}ol(Wh,"onAnimationEnd"),ol(Zh,"onAnimationIteration"),ol(Jh,"onAnimationStart"),ol("dblclick","onDoubleClick"),ol("focusin","onFocus"),ol("focusout","onBlur"),ol(y2,"onTransitionRun"),ol(g2,"onTransitionStart"),ol(b2,"onTransitionCancel"),ol(Ph,"onTransitionEnd"),Kt("onMouseEnter",["mouseout","mouseover"]),Kt("onMouseLeave",["mouseout","mouseover"]),Kt("onPointerEnter",["pointerout","pointerover"]),Kt("onPointerLeave",["pointerout","pointerover"]),En("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),En("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),En("onBeforeInput",["compositionend","keypress","textInput","paste"]),En("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),En("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),En("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ns="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(" "),nb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ns));function vp(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var s=e[a],h=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],H=N.instance,P=N.currentTarget;if(N=N.listener,H!==x&&h.isPropagationStopped())break e;x=N,h.currentTarget=P;try{x(h)}catch(ie){eo(ie)}h.currentTarget=null,x=H}else for(w=0;w<s.length;w++){if(N=s[w],H=N.instance,P=N.currentTarget,N=N.listener,H!==x&&h.isPropagationStopped())break e;x=N,h.currentTarget=P;try{x(h)}catch(ie){eo(ie)}h.currentTarget=null,x=H}}}}function at(e,n){var a=n[Gr];a===void 0&&(a=n[Gr]=new Set);var s=e+"__bubble";a.has(s)||(wp(n,e,2,!1),a.add(s))}function Cf(e,n,a){var s=0;n&&(s|=4),wp(a,e,s,n)}var Uo="_reactListening"+Math.random().toString(36).slice(2);function Ef(e){if(!e[Uo]){e[Uo]=!0,sr.forEach(function(a){a!=="selectionchange"&&(nb.has(a)||Cf(a,!1,e),Cf(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Uo]||(n[Uo]=!0,Cf("selectionchange",!1,n))}}function wp(e,n,a,s){switch(Wp(n)){case 2:var h=Db;break;case 8:h=zb;break;default:h=Uf}a=h.bind(null,n,a,e),h=void 0,!he||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(h=!0),s?h!==void 0?e.addEventListener(n,a,{capture:!0,passive:h}):e.addEventListener(n,a,!0):h!==void 0?e.addEventListener(n,a,{passive:h}):e.addEventListener(n,a,!1)}function Nf(e,n,a,s,h){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===h)break;if(w===4)for(w=s.return;w!==null;){var H=w.tag;if((H===3||H===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;N!==null;){if(w=Ol(N),w===null)return;if(H=w.tag,H===5||H===6||H===26||H===27){s=x=w;continue e}N=N.parentNode}}s=s.return}Ci(function(){var P=x,ie=Si(a),ue=[];e:{var te=em.get(e);if(te!==void 0){var le=Zs,Ae=e;switch(e){case"keypress":if(lt(a)===0)break e;case"keydown":case"keyup":le=Qg;break;case"focusin":Ae="focus",le=Qc;break;case"focusout":Ae="blur",le=Qc;break;case"beforeblur":case"afterblur":le=Qc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=Th;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=Bg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=Jg;break;case Wh:case Zh:case Jh:le=Hg;break;case Ph:le=e2;break;case"scroll":case"scrollend":le=_g;break;case"wheel":le=n2;break;case"copy":case"cut":case"paste":le=Ig;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=zh;break;case"toggle":case"beforetoggle":le=r2}var Ye=(n&4)!==0,Nt=!Ye&&(e==="scroll"||e==="scrollend"),K=Ye?te!==null?te+"Capture":null:te;Ye=[];for(var Y=P,J;Y!==null;){var oe=Y;if(J=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||J===null||K===null||(oe=_(Y,K),oe!=null&&Ye.push(ls(Y,oe,J))),Nt)break;Y=Y.return}0<Ye.length&&(te=new le(te,Ae,null,a,ie),ue.push({event:te,listeners:Ye}))}}if((n&7)===0){e:{if(te=e==="mouseover"||e==="pointerover",le=e==="mouseout"||e==="pointerout",te&&a!==ki&&(Ae=a.relatedTarget||a.fromElement)&&(Ol(Ae)||Ae[Fl]))break e;if((le||te)&&(te=ie.window===ie?ie:(te=ie.ownerDocument)?te.defaultView||te.parentWindow:window,le?(Ae=a.relatedTarget||a.toElement,le=P,Ae=Ae?Ol(Ae):null,Ae!==null&&(Nt=u(Ae),Ye=Ae.tag,Ae!==Nt||Ye!==5&&Ye!==27&&Ye!==6)&&(Ae=null)):(le=null,Ae=P),le!==Ae)){if(Ye=Th,oe="onMouseLeave",K="onMouseEnter",Y="mouse",(e==="pointerout"||e==="pointerover")&&(Ye=zh,oe="onPointerLeave",K="onPointerEnter",Y="pointer"),Nt=le==null?te:Bl(le),J=Ae==null?te:Bl(Ae),te=new Ye(oe,Y+"leave",le,a,ie),te.target=Nt,te.relatedTarget=J,oe=null,Ol(ie)===P&&(Ye=new Ye(K,Y+"enter",Ae,a,ie),Ye.target=J,Ye.relatedTarget=Nt,oe=Ye),Nt=oe,le&&Ae)t:{for(Ye=lb,K=le,Y=Ae,J=0,oe=K;oe;oe=Ye(oe))J++;oe=0;for(var $e=Y;$e;$e=Ye($e))oe++;for(;0<J-oe;)K=Ye(K),J--;for(;0<oe-J;)Y=Ye(Y),oe--;for(;J--;){if(K===Y||Y!==null&&K===Y.alternate){Ye=K;break t}K=Ye(K),Y=Ye(Y)}Ye=null}else Ye=null;le!==null&&kp(ue,te,le,Ye,!1),Ae!==null&&Nt!==null&&kp(ue,Nt,Ae,Ye,!0)}}e:{if(te=P?Bl(P):window,le=te.nodeName&&te.nodeName.toLowerCase(),le==="select"||le==="input"&&te.type==="file")var mt=$h;else if(Bh(te))if(Hh)mt=m2;else{mt=d2;var Fe=f2}else le=te.nodeName,!le||le.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?P&&Ea(P.elementType)&&(mt=$h):mt=h2;if(mt&&(mt=mt(e,P))){Lh(ue,mt,a,ie);break e}Fe&&Fe(e,te,P),e==="focusout"&&P&&te.type==="number"&&P.memoizedProps.value!=null&&wi(te,"number",te.value)}switch(Fe=P?Bl(P):window,e){case"focusin":(Bh(Fe)||Fe.contentEditable==="true")&&(Ta=Fe,tu=P,Mi=null);break;case"focusout":Mi=tu=Ta=null;break;case"mousedown":nu=!0;break;case"contextmenu":case"mouseup":case"dragend":nu=!1,Kh(ue,a,ie);break;case"selectionchange":if(p2)break;case"keydown":case"keyup":Kh(ue,a,ie)}var We;if(Zc)e:{switch(e){case"compositionstart":var ot="onCompositionStart";break e;case"compositionend":ot="onCompositionEnd";break e;case"compositionupdate":ot="onCompositionUpdate";break e}ot=void 0}else Aa?_h(e,a)&&(ot="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(ot="onCompositionStart");ot&&(Mh&&a.locale!=="ko"&&(Aa||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&Aa&&(We=Je()):(ge=ie,Re="value"in ge?ge.value:ge.textContent,Aa=!0)),Fe=Io(P,ot),0<Fe.length&&(ot=new Dh(ot,e,null,a,ie),ue.push({event:ot,listeners:Fe}),We?ot.data=We:(We=Oh(a),We!==null&&(ot.data=We)))),(We=i2?s2(e,a):o2(e,a))&&(ot=Io(P,"onBeforeInput"),0<ot.length&&(Fe=new Dh("onBeforeInput","beforeinput",null,a,ie),ue.push({event:Fe,listeners:ot}),Fe.data=We)),P2(ue,e,P,a,ie)}vp(ue,n)})}function ls(e,n,a){return{instance:e,listener:n,currentTarget:a}}function Io(e,n){for(var a=n+"Capture",s=[];e!==null;){var h=e,x=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||x===null||(h=_(e,a),h!=null&&s.unshift(ls(e,h,x)),h=_(e,n),h!=null&&s.push(ls(e,h,x))),e.tag===3)return s;e=e.return}return[]}function lb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function kp(e,n,a,s,h){for(var x=n._reactName,w=[];a!==null&&a!==s;){var N=a,H=N.alternate,P=N.stateNode;if(N=N.tag,H!==null&&H===s)break;N!==5&&N!==26&&N!==27||P===null||(H=P,h?(P=_(a,x),P!=null&&w.unshift(ls(a,P,H))):h||(P=_(a,x),P!=null&&w.push(ls(a,P,H)))),a=a.return}w.length!==0&&e.push({event:n,listeners:w})}var rb=/\r\n?/g,ab=/\u0000|\uFFFD/g;function Sp(e){return(typeof e=="string"?e:""+e).replace(rb,`
49
- `).replace(ab,"")}function jp(e,n){return n=Sp(n),Sp(e)===n}function Et(e,n,a,s,h,x){switch(a){case"children":typeof s=="string"?n==="body"||n==="textarea"&&s===""||ur(e,s):(typeof s=="number"||typeof s=="bigint")&&n!=="body"&&ur(e,""+s);break;case"className":pl(e,"class",s);break;case"tabIndex":pl(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":pl(e,a,s);break;case"style":sl(e,s,x);break;case"data":if(n!=="object"){pl(e,"data",s);break}case"src":case"href":if(s===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=Bn(""+s),e.setAttribute(a,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(a,"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"&&(a==="formAction"?(n!=="input"&&Et(e,n,"name",h.name,h,null),Et(e,n,"formEncType",h.formEncType,h,null),Et(e,n,"formMethod",h.formMethod,h,null),Et(e,n,"formTarget",h.formTarget,h,null)):(Et(e,n,"encType",h.encType,h,null),Et(e,n,"method",h.method,h,null),Et(e,n,"target",h.target,h,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=Bn(""+s),e.setAttribute(a,s);break;case"onClick":s!=null&&(e.onclick=Qn);break;case"onScroll":s!=null&&at("scroll",e);break;case"onScrollEnd":s!=null&&at("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(i(61));if(a=s.__html,a!=null){if(h.children!=null)throw Error(i(60));e.innerHTML=a}}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}a=Bn(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);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(a,""+s):e.removeAttribute(a);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(a,""):e.removeAttribute(a);break;case"capture":case"download":s===!0?e.setAttribute(a,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,s):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(a,s):e.removeAttribute(a);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(a):e.setAttribute(a,s);break;case"popover":at("beforetoggle",e),at("toggle",e),Ca(e,"popover",s);break;case"xlinkActuate":vn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":vn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":vn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":vn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":vn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":vn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":vn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":vn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":vn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Ca(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Xc.get(a)||a,Ca(e,a,s))}}function Af(e,n,a,s,h,x){switch(a){case"style":sl(e,s,x);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(i(61));if(a=s.__html,a!=null){if(h.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"children":typeof s=="string"?ur(e,s):(typeof s=="number"||typeof s=="bigint")&&ur(e,""+s);break;case"onScroll":s!=null&&at("scroll",e);break;case"onScrollEnd":s!=null&&at("scrollend",e);break;case"onClick":s!=null&&(e.onclick=Qn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xs.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(h=a.endsWith("Capture"),n=a.slice(2,h?a.length-7:void 0),x=e[cn]||null,x=x!=null?x[a]:null,typeof x=="function"&&e.removeEventListener(n,x,h),typeof s=="function")){typeof x!="function"&&x!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,s,h);break e}a in e?e[a]=s:s===!0?e.setAttribute(a,""):Ca(e,a,s)}}}function mn(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":at("error",e),at("load",e);var s=!1,h=!1,x;for(x in a)if(a.hasOwnProperty(x)){var w=a[x];if(w!=null)switch(x){case"src":s=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Et(e,n,x,w,a,null)}}h&&Et(e,n,"srcSet",a.srcSet,a,null),s&&Et(e,n,"src",a.src,a,null);return;case"input":at("invalid",e);var N=x=w=h=null,H=null,P=null;for(s in a)if(a.hasOwnProperty(s)){var ie=a[s];if(ie!=null)switch(s){case"name":h=ie;break;case"type":w=ie;break;case"checked":H=ie;break;case"defaultChecked":P=ie;break;case"value":x=ie;break;case"defaultValue":N=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(i(137,n));break;default:Et(e,n,s,ie,a,null)}}vi(e,x,N,H,P,w,h,!1);return;case"select":at("invalid",e),s=w=x=null;for(h in a)if(a.hasOwnProperty(h)&&(N=a[h],N!=null))switch(h){case"value":x=N;break;case"defaultValue":w=N;break;case"multiple":s=N;default:Et(e,n,h,N,a,null)}n=x,a=w,e.multiple=!!s,n!=null?cr(e,!!s,n,!1):a!=null&&cr(e,!!s,a,!0);return;case"textarea":at("invalid",e),x=h=s=null;for(w in a)if(a.hasOwnProperty(w)&&(N=a[w],N!=null))switch(w){case"value":s=N;break;case"defaultValue":h=N;break;case"children":x=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(i(91));break;default:Et(e,n,w,N,a,null)}Qs(e,s,h,x);return;case"option":for(H in a)if(a.hasOwnProperty(H)&&(s=a[H],s!=null))switch(H){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:Et(e,n,H,s,a,null)}return;case"dialog":at("beforetoggle",e),at("toggle",e),at("cancel",e),at("close",e);break;case"iframe":case"object":at("load",e);break;case"video":case"audio":for(s=0;s<ns.length;s++)at(ns[s],e);break;case"image":at("error",e),at("load",e);break;case"details":at("toggle",e);break;case"embed":case"source":case"link":at("error",e),at("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(P in a)if(a.hasOwnProperty(P)&&(s=a[P],s!=null))switch(P){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Et(e,n,P,s,a,null)}return;default:if(Ea(n)){for(ie in a)a.hasOwnProperty(ie)&&(s=a[ie],s!==void 0&&Af(e,n,ie,s,a,void 0));return}}for(N in a)a.hasOwnProperty(N)&&(s=a[N],s!=null&&Et(e,n,N,s,a,null))}function ib(e,n,a,s){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,x=null,w=null,N=null,H=null,P=null,ie=null;for(le in a){var ue=a[le];if(a.hasOwnProperty(le)&&ue!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":H=ue;default:s.hasOwnProperty(le)||Et(e,n,le,null,s,ue)}}for(var te in s){var le=s[te];if(ue=a[te],s.hasOwnProperty(te)&&(le!=null||ue!=null))switch(te){case"type":x=le;break;case"name":h=le;break;case"checked":P=le;break;case"defaultChecked":ie=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!==ue&&Et(e,n,te,le,s,ue)}}bi(e,w,N,H,P,ie,x,h);return;case"select":le=w=N=te=null;for(x in a)if(H=a[x],a.hasOwnProperty(x)&&H!=null)switch(x){case"value":break;case"multiple":le=H;default:s.hasOwnProperty(x)||Et(e,n,x,null,s,H)}for(h in s)if(x=s[h],H=a[h],s.hasOwnProperty(h)&&(x!=null||H!=null))switch(h){case"value":te=x;break;case"defaultValue":N=x;break;case"multiple":w=x;default:x!==H&&Et(e,n,h,x,s,H)}n=N,a=w,s=le,te!=null?cr(e,!!a,te,!1):!!s!=!!a&&(n!=null?cr(e,!!a,n,!0):cr(e,!!a,a?[]:"",!1));return;case"textarea":le=te=null;for(N in a)if(h=a[N],a.hasOwnProperty(N)&&h!=null&&!s.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:Et(e,n,N,null,s,h)}for(w in s)if(h=s[w],x=a[w],s.hasOwnProperty(w)&&(h!=null||x!=null))switch(w){case"value":te=h;break;case"defaultValue":le=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(i(91));break;default:h!==x&&Et(e,n,w,h,s,x)}Ks(e,te,le);return;case"option":for(var Ae in a)if(te=a[Ae],a.hasOwnProperty(Ae)&&te!=null&&!s.hasOwnProperty(Ae))switch(Ae){case"selected":e.selected=!1;break;default:Et(e,n,Ae,null,s,te)}for(H in s)if(te=s[H],le=a[H],s.hasOwnProperty(H)&&te!==le&&(te!=null||le!=null))switch(H){case"selected":e.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:Et(e,n,H,te,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 Ye in a)te=a[Ye],a.hasOwnProperty(Ye)&&te!=null&&!s.hasOwnProperty(Ye)&&Et(e,n,Ye,null,s,te);for(P in s)if(te=s[P],le=a[P],s.hasOwnProperty(P)&&te!==le&&(te!=null||le!=null))switch(P){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(i(137,n));break;default:Et(e,n,P,te,s,le)}return;default:if(Ea(n)){for(var Nt in a)te=a[Nt],a.hasOwnProperty(Nt)&&te!==void 0&&!s.hasOwnProperty(Nt)&&Af(e,n,Nt,void 0,s,te);for(ie in s)te=s[ie],le=a[ie],!s.hasOwnProperty(ie)||te===le||te===void 0&&le===void 0||Af(e,n,ie,te,s,le);return}}for(var K in a)te=a[K],a.hasOwnProperty(K)&&te!=null&&!s.hasOwnProperty(K)&&Et(e,n,K,null,s,te);for(ue in s)te=s[ue],le=a[ue],!s.hasOwnProperty(ue)||te===le||te==null&&le==null||Et(e,n,ue,te,s,le)}function Cp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function sb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),s=0;s<a.length;s++){var h=a[s],x=h.transferSize,w=h.initiatorType,N=h.duration;if(x&&N&&Cp(w)){for(w=0,N=h.responseEnd,s+=1;s<a.length;s++){var H=a[s],P=H.startTime;if(P>N)break;var ie=H.transferSize,ue=H.initiatorType;ie&&Cp(ue)&&(H=H.responseEnd,w+=ie*(H<N?1:(N-P)/(H-P)))}if(--s,n+=8*(x+w)/(h.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 Tf=null,Df=null;function Yo(e){return e.nodeType===9?e:e.ownerDocument}function Ep(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 Np(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 zf(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 Mf=null;function ob(){var e=window.event;return e&&e.type==="popstate"?e===Mf?!1:(Mf=e,!0):(Mf=null,!1)}var Ap=typeof setTimeout=="function"?setTimeout:void 0,cb=typeof clearTimeout=="function"?clearTimeout:void 0,Tp=typeof Promise=="function"?Promise:void 0,ub=typeof queueMicrotask=="function"?queueMicrotask:typeof Tp<"u"?function(e){return Tp.resolve(null).then(e).catch(fb)}:Ap;function fb(e){setTimeout(function(){throw e})}function Nr(e){return e==="head"}function Dp(e,n){var a=n,s=0;do{var h=a.nextSibling;if(e.removeChild(a),h&&h.nodeType===8)if(a=h.data,a==="/$"||a==="/&"){if(s===0){e.removeChild(h),ni(n);return}s--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")s++;else if(a==="html")rs(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,rs(a);for(var x=a.firstChild;x;){var w=x.nextSibling,N=x.nodeName;x[_l]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&x.rel.toLowerCase()==="stylesheet"||a.removeChild(x),x=w}}else a==="body"&&rs(e.ownerDocument.body);a=h}while(a);ni(n)}function zp(e,n){var a=e;e=0;do{var s=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),s&&s.nodeType===8)if(a=s.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=s}while(a)}function Rf(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Rf(a),Sa(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function db(e,n,a,s){for(;e.nodeType===1;){var h=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[_l])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!==h.rel||e.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||e.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||e.getAttribute("title")!==(h.title==null?null:h.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(x=e.getAttribute("src"),(x!==(h.src==null?null:h.src)||e.getAttribute("type")!==(h.type==null?null:h.type)||e.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&x&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var x=h.name==null?null:""+h.name;if(h.type==="hidden"&&e.getAttribute("name")===x)return e}else return e;if(e=ll(e.nextSibling),e===null)break}return null}function hb(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=ll(e.nextSibling),e===null))return null;return e}function Mp(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ll(e.nextSibling),e===null))return null;return e}function Ff(e){return e.data==="$?"||e.data==="$~"}function _f(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function mb(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var s=function(){n(),a.removeEventListener("DOMContentLoaded",s)};a.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function ll(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 Of=null;function Rp(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return ll(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function Fp(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function _p(e,n,a){switch(n=Yo(a),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 rs(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Sa(e)}var rl=new Map,Op=new Set;function qo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Jl=Z.d;Z.d={f:xb,r:pb,D:yb,C:gb,L:bb,m:vb,X:kb,S:wb,M:Sb};function xb(){var e=Jl.f(),n=_o();return e||n}function pb(e){var n=ir(e);n!==null&&n.tag===5&&n.type==="form"?Pm(n):Jl.r(e)}var Pa=typeof document>"u"?null:document;function Bp(e,n,a){var s=Pa;if(s&&typeof n=="string"&&n){var h=An(n);h='link[rel="'+e+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),Op.has(h)||(Op.add(h),e={rel:e,crossOrigin:a,href:n},s.querySelector(h)===null&&(n=s.createElement("link"),mn(n,"link",e),Ft(n),s.head.appendChild(n)))}}function yb(e){Jl.D(e),Bp("dns-prefetch",e,null)}function gb(e,n){Jl.C(e,n),Bp("preconnect",e,n)}function bb(e,n,a){Jl.L(e,n,a);var s=Pa;if(s&&e&&n){var h='link[rel="preload"][as="'+An(n)+'"]';n==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+An(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+An(a.imageSizes)+'"]')):h+='[href="'+An(e)+'"]';var x=h;switch(n){case"style":x=ei(e);break;case"script":x=ti(e)}rl.has(x)||(e=y({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),rl.set(x,e),s.querySelector(h)!==null||n==="style"&&s.querySelector(as(x))||n==="script"&&s.querySelector(is(x))||(n=s.createElement("link"),mn(n,"link",e),Ft(n),s.head.appendChild(n)))}}function vb(e,n){Jl.m(e,n);var a=Pa;if(a&&e){var s=n&&typeof n.as=="string"?n.as:"script",h='link[rel="modulepreload"][as="'+An(s)+'"][href="'+An(e)+'"]',x=h;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=ti(e)}if(!rl.has(x)&&(e=y({rel:"modulepreload",href:e},n),rl.set(x,e),a.querySelector(h)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(is(x)))return}s=a.createElement("link"),mn(s,"link",e),Ft(s),a.head.appendChild(s)}}}function wb(e,n,a){Jl.S(e,n,a);var s=Pa;if(s&&e){var h=un(s).hoistableStyles,x=ei(e);n=n||"default";var w=h.get(x);if(!w){var N={loading:0,preload:null};if(w=s.querySelector(as(x)))N.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},a),(a=rl.get(x))&&Bf(e,a);var H=w=s.createElement("link");Ft(H),mn(H,"link",e),H._p=new Promise(function(P,ie){H.onload=P,H.onerror=ie}),H.addEventListener("load",function(){N.loading|=1}),H.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Xo(w,n,s)}w={type:"stylesheet",instance:w,count:1,state:N},h.set(x,w)}}}function kb(e,n){Jl.X(e,n);var a=Pa;if(a&&e){var s=un(a).hoistableScripts,h=ti(e),x=s.get(h);x||(x=a.querySelector(is(h)),x||(e=y({src:e,async:!0},n),(n=rl.get(h))&&Lf(e,n),x=a.createElement("script"),Ft(x),mn(x,"link",e),a.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},s.set(h,x))}}function Sb(e,n){Jl.M(e,n);var a=Pa;if(a&&e){var s=un(a).hoistableScripts,h=ti(e),x=s.get(h);x||(x=a.querySelector(is(h)),x||(e=y({src:e,async:!0,type:"module"},n),(n=rl.get(h))&&Lf(e,n),x=a.createElement("script"),Ft(x),mn(x,"link",e),a.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},s.set(h,x))}}function Lp(e,n,a,s){var h=(h=Ee.current)?qo(h):null;if(!h)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=ei(a.href),a=un(h).hoistableStyles,s=a.get(n),s||(s={type:"style",instance:null,count:0,state:null},a.set(n,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=ei(a.href);var x=un(h).hoistableStyles,w=x.get(e);if(w||(h=h.ownerDocument||h,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(e,w),(x=h.querySelector(as(e)))&&!x._p&&(w.instance=x,w.state.loading=5),rl.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},rl.set(e,a),x||jb(h,e,a,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=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=ti(a),a=un(h).hoistableScripts,s=a.get(n),s||(s={type:"script",instance:null,count:0,state:null},a.set(n,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function ei(e){return'href="'+An(e)+'"'}function as(e){return'link[rel="stylesheet"]['+e+"]"}function $p(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function jb(e,n,a,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}),mn(n,"link",a),Ft(n),e.head.appendChild(n))}function ti(e){return'[src="'+An(e)+'"]'}function is(e){return"script[async]"+e}function Hp(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var s=e.querySelector('style[data-href~="'+An(a.href)+'"]');if(s)return n.instance=s,Ft(s),s;var h=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Ft(s),mn(s,"style",h),Xo(s,a.precedence,e),n.instance=s;case"stylesheet":h=ei(a.href);var x=e.querySelector(as(h));if(x)return n.state.loading|=4,n.instance=x,Ft(x),x;s=$p(a),(h=rl.get(h))&&Bf(s,h),x=(e.ownerDocument||e).createElement("link"),Ft(x);var w=x;return w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),mn(x,"link",s),n.state.loading|=4,Xo(x,a.precedence,e),n.instance=x;case"script":return x=ti(a.src),(h=e.querySelector(is(x)))?(n.instance=h,Ft(h),h):(s=a,(h=rl.get(x))&&(s=y({},a),Lf(s,h)),e=e.ownerDocument||e,h=e.createElement("script"),Ft(h),mn(h,"link",s),e.head.appendChild(h),n.instance=h);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(s=n.instance,n.state.loading|=4,Xo(s,a.precedence,e));return n.instance}function Xo(e,n,a){for(var s=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=s.length?s[s.length-1]:null,x=h,w=0;w<s.length;w++){var N=s[w];if(N.dataset.precedence===n)x=N;else if(x!==h)break}x?x.parentNode.insertBefore(e,x.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function Bf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Lf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Vo=null;function Up(e,n,a){if(Vo===null){var s=new Map,h=Vo=new Map;h.set(a,s)}else h=Vo,s=h.get(a),s||(s=new Map,h.set(a,s));if(s.has(e))return s;for(s.set(e,null),a=a.getElementsByTagName(e),h=0;h<a.length;h++){var x=a[h];if(!(x[_l]||x[$t]||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 Ip(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function Cb(e,n,a){if(a===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 Yp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Eb(e,n,a,s){if(a.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var h=ei(s.href),x=n.querySelector(as(h));if(x){n=x._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Go.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=x,Ft(x);return}x=n.ownerDocument||n,s=$p(s),(h=rl.get(h))&&Bf(s,h),x=x.createElement("link"),Ft(x);var w=x;w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),mn(x,"link",s),a.instance=x}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Go.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var $f=0;function Nb(e,n){return e.stylesheets&&e.count===0&&Qo(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var s=setTimeout(function(){if(e.stylesheets&&Qo(e,e.stylesheets),e.unsuspend){var x=e.unsuspend;e.unsuspend=null,x()}},6e4+n);0<e.imgBytes&&$f===0&&($f=62500*sb());var h=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Qo(e,e.stylesheets),e.unsuspend)){var x=e.unsuspend;e.unsuspend=null,x()}},(e.imgBytes>$f?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(h)}}:null}function Go(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Qo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ko=null;function Qo(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ko=new Map,n.forEach(Ab,e),Ko=null,Go.call(e))}function Ab(e,n){if(!(n.state.loading&4)){var a=Ko.get(e);if(a)var s=a.get(null);else{a=new Map,Ko.set(e,a);for(var h=e.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<h.length;x++){var w=h[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),s=w)}s&&a.set(null,s)}h=n.instance,w=h.getAttribute("data-precedence"),x=a.get(w)||s,x===s&&a.set(null,h),a.set(w,h),this.count++,s=Go.bind(this),h.addEventListener("load",s),h.addEventListener("error",s),x?x.parentNode.insertBefore(h,x.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(h,e.firstChild)),n.state.loading|=4}}var ss={$$typeof:R,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function Tb(e,n,a,s,h,x,w,N,H){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=Xr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xr(0),this.hiddenUpdates=Xr(null),this.identifierPrefix=s,this.onUncaughtError=h,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function qp(e,n,a,s,h,x,w,N,H,P,ie,ue){return e=new Tb(e,n,a,w,H,P,ie,ue,N),n=1,x===!0&&(n|=24),x=$n(3,null,null,n),e.current=x,x.stateNode=e,n=yu(),n.refCount++,e.pooledCache=n,n.refCount++,x.memoizedState={element:s,isDehydrated:a,cache:n},wu(x),e}function Xp(e){return e?(e=Ma,e):Ma}function Vp(e,n,a,s,h,x){h=Xp(h),s.context===null?s.context=h:s.pendingContext=h,s=pr(n),s.payload={element:a},x=x===void 0?null:x,x!==null&&(s.callback=x),a=yr(e,s,n),a!==null&&(Fn(a,e,n),$i(a,e,n))}function Gp(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function Hf(e,n){Gp(e,n),(e=e.alternate)&&Gp(e,n)}function Kp(e){if(e.tag===13||e.tag===31){var n=Jr(e,67108864);n!==null&&Fn(n,e,67108864),Hf(e,67108864)}}function Qp(e){if(e.tag===13||e.tag===31){var n=qn();n=Vr(n);var a=Jr(e,n);a!==null&&Fn(a,e,n),Hf(e,n)}}var Wo=!0;function Db(e,n,a,s){var h=I.T;I.T=null;var x=Z.p;try{Z.p=2,Uf(e,n,a,s)}finally{Z.p=x,I.T=h}}function zb(e,n,a,s){var h=I.T;I.T=null;var x=Z.p;try{Z.p=8,Uf(e,n,a,s)}finally{Z.p=x,I.T=h}}function Uf(e,n,a,s){if(Wo){var h=If(s);if(h===null)Nf(e,n,s,Zo,a),Zp(e,s);else if(Rb(h,e,n,a,s))s.stopPropagation();else if(Zp(e,s),n&4&&-1<Mb.indexOf(e)){for(;h!==null;){var x=ir(h);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=Dl(x.pendingLanes);if(w!==0){var N=x;for(N.pendingLanes|=2,N.entangledLanes|=2;w;){var H=1<<31-fe(w);N.entanglements[1]|=H,w&=~H}vl(x),(bt&6)===0&&(Ro=ht()+500,ts(0))}}break;case 31:case 13:N=Jr(x,2),N!==null&&Fn(N,x,2),_o(),Hf(x,2)}if(x=If(s),x===null&&Nf(e,n,s,Zo,a),x===h)break;h=x}h!==null&&s.stopPropagation()}else Nf(e,n,s,null,a)}}function If(e){return e=Si(e),Yf(e)}var Zo=null;function Yf(e){if(Zo=null,e=Ol(e),e!==null){var n=u(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=f(n),e!==null)return e;e=null}else if(a===31){if(e=m(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Zo=e,null}function Wp(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(Zt()){case ae:return 2;case xe:return 8;case De:case Ue:return 32;case ye:return 268435456;default:return 32}default:return 32}}var qf=!1,Ar=null,Tr=null,Dr=null,os=new Map,cs=new Map,zr=[],Mb="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 Zp(e,n){switch(e){case"focusin":case"focusout":Ar=null;break;case"dragenter":case"dragleave":Tr=null;break;case"mouseover":case"mouseout":Dr=null;break;case"pointerover":case"pointerout":os.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":cs.delete(n.pointerId)}}function us(e,n,a,s,h,x){return e===null||e.nativeEvent!==x?(e={blockedOn:n,domEventName:a,eventSystemFlags:s,nativeEvent:x,targetContainers:[h]},n!==null&&(n=ir(n),n!==null&&Kp(n)),e):(e.eventSystemFlags|=s,n=e.targetContainers,h!==null&&n.indexOf(h)===-1&&n.push(h),e)}function Rb(e,n,a,s,h){switch(n){case"focusin":return Ar=us(Ar,e,n,a,s,h),!0;case"dragenter":return Tr=us(Tr,e,n,a,s,h),!0;case"mouseover":return Dr=us(Dr,e,n,a,s,h),!0;case"pointerover":var x=h.pointerId;return os.set(x,us(os.get(x)||null,e,n,a,s,h)),!0;case"gotpointercapture":return x=h.pointerId,cs.set(x,us(cs.get(x)||null,e,n,a,s,h)),!0}return!1}function Jp(e){var n=Ol(e.target);if(n!==null){var a=u(n);if(a!==null){if(n=a.tag,n===13){if(n=f(a),n!==null){e.blockedOn=n,Rl(e.priority,function(){Qp(a)});return}}else if(n===31){if(n=m(a),n!==null){e.blockedOn=n,Rl(e.priority,function(){Qp(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Jo(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=If(e.nativeEvent);if(a===null){a=e.nativeEvent;var s=new a.constructor(a.type,a);ki=s,a.target.dispatchEvent(s),ki=null}else return n=ir(a),n!==null&&Kp(n),e.blockedOn=a,!1;n.shift()}return!0}function Pp(e,n,a){Jo(e)&&a.delete(n)}function Fb(){qf=!1,Ar!==null&&Jo(Ar)&&(Ar=null),Tr!==null&&Jo(Tr)&&(Tr=null),Dr!==null&&Jo(Dr)&&(Dr=null),os.forEach(Pp),cs.forEach(Pp)}function Po(e,n){e.blockedOn===n&&(e.blockedOn=null,qf||(qf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Fb)))}var ec=null;function e1(e){ec!==e&&(ec=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){ec===e&&(ec=null);for(var n=0;n<e.length;n+=3){var a=e[n],s=e[n+1],h=e[n+2];if(typeof s!="function"){if(Yf(s||a)===null)continue;break}var x=ir(a);x!==null&&(e.splice(n,3),n-=3,Uu(x,{pending:!0,data:h,method:a.method,action:s},s,h))}}))}function ni(e){function n(H){return Po(H,e)}Ar!==null&&Po(Ar,e),Tr!==null&&Po(Tr,e),Dr!==null&&Po(Dr,e),os.forEach(n),cs.forEach(n);for(var a=0;a<zr.length;a++){var s=zr[a];s.blockedOn===e&&(s.blockedOn=null)}for(;0<zr.length&&(a=zr[0],a.blockedOn===null);)Jp(a),a.blockedOn===null&&zr.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(s=0;s<a.length;s+=3){var h=a[s],x=a[s+1],w=h[cn]||null;if(typeof x=="function")w||e1(a);else if(w){var N=null;if(x&&x.hasAttribute("formAction")){if(h=x,w=x[cn]||null)N=w.formAction;else if(Yf(h)!==null)continue}else N=w.action;typeof N=="function"?a[s+1]=N:(a.splice(s,3),s-=3),e1(a)}}}function t1(){function e(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return h=w})},focusReset:"manual",scroll:"manual"})}function n(){h!==null&&(h(),h=null),s||setTimeout(a,20)}function a(){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,h=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),h!==null&&(h(),h=null)}}}function Xf(e){this._internalRoot=e}tc.prototype.render=Xf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(i(409));var a=n.current,s=qn();Vp(a,s,e,n,null,null)},tc.prototype.unmount=Xf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Vp(e.current,2,null,e,null,null),_o(),n[Fl]=null}};function tc(e){this._internalRoot=e}tc.prototype.unstable_scheduleHydration=function(e){if(e){var n=Ml();e={blockedOn:null,target:e,priority:n};for(var a=0;a<zr.length&&n!==0&&n<zr[a].priority;a++);zr.splice(a,0,e),a===0&&Jp(e)}};var n1=l.version;if(n1!=="19.2.4")throw Error(i(527,n1,"19.2.4"));Z.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=d(n),e=e!==null?g(e):null,e=e===null?null:e.stateNode,e};var _b={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nc.isDisabled&&nc.supportsFiber)try{wt=nc.inject(_b),Xe=nc}catch{}}return ds.createRoot=function(e,n){if(!c(e))throw Error(i(299));var a=!1,s="",h=cx,x=ux,w=fx;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(h=n.onUncaughtError),n.onCaughtError!==void 0&&(x=n.onCaughtError),n.onRecoverableError!==void 0&&(w=n.onRecoverableError)),n=qp(e,1,!1,null,null,a,s,null,h,x,w,t1),e[Fl]=n.current,Ef(e),new Xf(n)},ds.hydrateRoot=function(e,n,a){if(!c(e))throw Error(i(299));var s=!1,h="",x=cx,w=ux,N=fx,H=null;return a!=null&&(a.unstable_strictMode===!0&&(s=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(x=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(N=a.onRecoverableError),a.formState!==void 0&&(H=a.formState)),n=qp(e,1,!0,n,a??null,s,h,H,x,w,N,t1),n.context=Xp(null),a=n.current,s=qn(),s=Vr(s),h=pr(s),h.callback=null,yr(a,h,s),a=s,n.current.lanes=a,ar(n,a),vl(n),e[Fl]=n.current,Ef(e),new tc(n)},ds.version="19.2.4",ds}var h1;function Gb(){if(h1)return Kf.exports;h1=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(),Kf.exports=Vb(),Kf.exports}var Kb=Gb();const Qb="modulepreload",Wb=function(t){return"/"+t},m1={},Zb=function(l,r,i){let c=Promise.resolve();if(r&&r.length>0){let f=function(d){return Promise.all(d.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"));c=f(r.map(d=>{if(d=Wb(d),d in m1)return;m1[d]=!0;const g=d.endsWith(".css"),y=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${y}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":Qb,g||(b.as="script"),b.crossOrigin="",b.href=d,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 ${d}`)))})}))}function u(f){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=f,window.dispatchEvent(m),!m.defaultPrevented)throw f}return c.then(f=>{for(const m of f||[])m.status==="rejected"&&u(m.reason);return l().catch(u)})};class Jb extends S.Component{constructor(){super(...arguments);l1(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(r){return{hasError:!0,error:r}}render(){var r;return this.state.hasError?o.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:o.jsxs("div",{className:"text-center max-w-md",children:[o.jsx("div",{className:"text-4xl mb-3",children:"🚨"}),o.jsx("div",{className:"text-gray-800 font-semibold mb-2",children:"Something went wrong"}),o.jsx("div",{className:"text-gray-500 text-sm mb-4",children:((r=this.state.error)==null?void 0:r.message)??"An unexpected error occurred."}),o.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 Os="/api";async function Dt(t){const l=await fetch(`${Os}${t}`);if(!l.ok)throw new Error(`API error: ${l.status}`);return l.json()}async function kn(t,l){const r=await fetch(`${Os}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}async function Jf(t,l){const r=await fetch(`${Os}${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}async function Rr(t,l){const r={method:"DELETE"};l!==void 0&&(r.headers={"Content-Type":"application/json"},r.body=JSON.stringify(l));const i=await fetch(`${Os}${t}`,r);if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()}const Ce={getCompany:()=>Dt("/company"),getRoles:()=>Dt("/roles"),getRole:t=>Dt(`/roles/${t}`),getProjects:()=>Dt("/projects"),getProject:t=>Dt(`/projects/${t}`),getStandups:()=>Dt("/operations/standups"),getWaves:()=>Dt("/operations/waves"),getDecisions:()=>Dt("/operations/decisions"),getOrgTree:()=>Dt("/engine/org"),getSkills:()=>Dt("/skills"),exportSkills:t=>Dt(`/skills/export/${t}`),getSkillRegistry:()=>Dt("/skills/registry"),installRegistrySkill:(t,l)=>kn("/skills/registry/install",{skillId:t,url:l}),createRole:t=>kn("/engine/roles",t),updateRole:(t,l)=>Jf(`/engine/roles/${t}`,l),deleteRole:t=>Rr(`/engine/roles/${t}`),getSessions:()=>Dt("/sessions"),getSession:t=>Dt(`/sessions/${t}`),createSession:(t,l="talk")=>kn("/sessions",{roleId:t,mode:l}),deleteSession:t=>Rr(`/sessions/${t}`),deleteSessions:t=>Rr("/sessions",{ids:t}),deleteEmptySessions:()=>Rr("/sessions?empty=true"),updateSession:(t,l)=>Jf(`/sessions/${t}`,l),startJob:t=>kn("/jobs",t),getJob:t=>Dt(`/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 r=l.toString();return Dt(`/jobs${r?"?"+r:""}`)},abortJob:t=>Rr(`/jobs/${t}`),getStatus:()=>Dt("/status"),detectEngine:()=>kn("/setup/detect-engine",{}),validatePath:t=>kn("/setup/validate-path",{path:t}),scaffold:t=>kn("/setup/scaffold",t),getTeams:()=>Dt("/setup/teams"),browse:t=>kn("/setup/browse",{path:t}),connectAkb:t=>kn("/setup/connect-akb",{path:t}),getKnowledge:()=>Dt("/knowledge"),getKnowledgeDoc:t=>Dt(`/knowledge/${t}`),createKnowledgeDoc:t=>kn("/knowledge",t),updateKnowledgeDoc:(t,l)=>fetch(`${Os}/knowledge/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:l})}).then(r=>{if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}),deleteKnowledgeDoc:t=>Rr(`/knowledge/${t}`),getPreferences:()=>Dt("/preferences"),updatePreferences:t=>Jf("/preferences",t),chatInChannel:t=>kn("/speech/chat",t),getSaveStatus:()=>Dt("/save/status"),save:t=>kn("/save",{message:t}),getSaveHistory:(t=20)=>Dt(`/save/history?limit=${t}`),restoreSave:(t,l)=>kn("/save/restore",{sha:t,paths:l}),initGit:()=>kn("/save/init",{}),getCostSummary:()=>Dt("/cost/summary"),getSyncRoles:()=>Dt("/sync/roles"),applySyncUpdate:t=>kn("/sync/apply",t),getCompanyStats:()=>Dt("/sync/stats"),getGitStatus:()=>Dt("/git/status"),deleteWorktree:t=>Rr(`/git/worktrees/${encodeURIComponent(t)}`),deleteBranch:t=>Rr(`/git/branches/${encodeURIComponent(t)}`)};function X0(t){const[l,r]=S.useState([]),[i,c]=S.useState("idle"),[u,f]=S.useState(""),[m,p]=S.useState([]),d=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,c("connecting");const k=d.current+1,C=`/api/jobs/${t}/stream?from=${k}`;fetch(C,{signal:j.signal}).then(async A=>{if(!A.ok||!A.body){c("error");return}c("streaming");const R=A.body.getReader(),O=new TextDecoder;let L="";for(;;){const{done:D,value:U}=await R.read();if(D)break;L+=O.decode(U,{stream:!0});const X=L.split(`
50
- `);L=X.pop()??"";let ne="";for(const M of X)if(M.startsWith("event: "))ne=M.slice(7).trim();else if(M.startsWith("data: ")){try{const q=JSON.parse(M.slice(6));if(ne==="activity"){const F=q;F.seq>d.current&&(d.current=F.seq),r(W=>W.some(ee=>ee.seq===F.seq)?W:[...W,F]),F.type==="text"&&f(W=>W+(F.data.text??"")),F.type==="dispatch:start"&&F.data.childJobId&&p(W=>[...W,F.data.childJobId]),F.type==="job:done"?c("done"):F.type==="job:error"&&c("error")}else if(ne==="stream:end"){const F=q.reason;c(F==="done"?"done":F==="error"?"error":"done")}}catch{}ne=""}}i==="streaming"&&c("done")}).catch(A=>{A.name!=="AbortError"&&(c("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){r([]),c("idle"),f(""),p([]),d.current=-1;return}return r([]),f(""),p([]),d.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 Pb(t,l){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const ev=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,tv=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nv={};function x1(t,l){return(nv.jsx?tv:ev).test(t)}const lv=/[ \t\n\f\r]/g;function rv(t){return typeof t=="object"?t.type==="text"?p1(t.value):!1:p1(t)}function p1(t){return t.replace(lv,"")===""}class Bs{constructor(l,r,i){this.normal=r,this.property=l,i&&(this.space=i)}}Bs.prototype.normal={};Bs.prototype.property={};Bs.prototype.space=void 0;function V0(t,l){const r={},i={};for(const c of t)Object.assign(r,c.property),Object.assign(i,c.normal);return new Bs(r,i,l)}function Bd(t){return t.toLowerCase()}class On{constructor(l,r){this.attribute=r,this.property=l}}On.prototype.attribute="";On.prototype.booleanish=!1;On.prototype.boolean=!1;On.prototype.commaOrSpaceSeparated=!1;On.prototype.commaSeparated=!1;On.prototype.defined=!1;On.prototype.mustUseProperty=!1;On.prototype.number=!1;On.prototype.overloadedBoolean=!1;On.prototype.property="";On.prototype.spaceSeparated=!1;On.prototype.space=void 0;let av=0;const Ze=va(),nn=va(),Ld=va(),be=va(),Rt=va(),si=va(),Xn=va();function va(){return 2**++av}const $d=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ze,booleanish:nn,commaOrSpaceSeparated:Xn,commaSeparated:si,number:be,overloadedBoolean:Ld,spaceSeparated:Rt},Symbol.toStringTag,{value:"Module"})),Pf=Object.keys($d);class nh extends On{constructor(l,r,i,c){let u=-1;if(super(l,r),y1(this,"space",c),typeof i=="number")for(;++u<Pf.length;){const f=Pf[u];y1(this,Pf[u],(i&$d[f])===$d[f])}}}nh.prototype.defined=!0;function y1(t,l,r){r&&(t[l]=r)}function fi(t){const l={},r={};for(const[i,c]of Object.entries(t.properties)){const u=new nh(i,t.transform(t.attributes||{},i),c,t.space);t.mustUseProperty&&t.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),l[i]=u,r[Bd(i)]=i,r[Bd(u.attribute)]=i}return new Bs(l,r,t.space)}const G0=fi({properties:{ariaActiveDescendant:null,ariaAtomic:nn,ariaAutoComplete:null,ariaBusy:nn,ariaChecked:nn,ariaColCount:be,ariaColIndex:be,ariaColSpan:be,ariaControls:Rt,ariaCurrent:null,ariaDescribedBy:Rt,ariaDetails:null,ariaDisabled:nn,ariaDropEffect:Rt,ariaErrorMessage:null,ariaExpanded:nn,ariaFlowTo:Rt,ariaGrabbed:nn,ariaHasPopup:null,ariaHidden:nn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Rt,ariaLevel:be,ariaLive:null,ariaModal:nn,ariaMultiLine:nn,ariaMultiSelectable:nn,ariaOrientation:null,ariaOwns:Rt,ariaPlaceholder:null,ariaPosInSet:be,ariaPressed:nn,ariaReadOnly:nn,ariaRelevant:null,ariaRequired:nn,ariaRoleDescription:Rt,ariaRowCount:be,ariaRowIndex:be,ariaRowSpan:be,ariaSelected:nn,ariaSetSize:be,ariaSort:null,ariaValueMax:be,ariaValueMin:be,ariaValueNow:be,ariaValueText:null,role:null},transform(t,l){return l==="role"?l:"aria-"+l.slice(4).toLowerCase()}});function K0(t,l){return l in t?t[l]:l}function Q0(t,l){return K0(t,l.toLowerCase())}const iv=fi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:si,acceptCharset:Rt,accessKey:Rt,action:null,allow:null,allowFullScreen:Ze,allowPaymentRequest:Ze,allowUserMedia:Ze,alt:null,as:null,async:Ze,autoCapitalize:null,autoComplete:Rt,autoFocus:Ze,autoPlay:Ze,blocking:Rt,capture:null,charSet:null,checked:Ze,cite:null,className:Rt,cols:be,colSpan:null,content:null,contentEditable:nn,controls:Ze,controlsList:Rt,coords:be|si,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ze,defer:Ze,dir:null,dirName:null,disabled:Ze,download:Ld,draggable:nn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ze,formTarget:null,headers:Rt,height:be,hidden:Ld,high:be,href:null,hrefLang:null,htmlFor:Rt,httpEquiv:Rt,id:null,imageSizes:null,imageSrcSet:null,inert:Ze,inputMode:null,integrity:null,is:null,isMap:Ze,itemId:null,itemProp:Rt,itemRef:Rt,itemScope:Ze,itemType:Rt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ze,low:be,manifest:null,max:null,maxLength:be,media:null,method:null,min:null,minLength:be,multiple:Ze,muted:Ze,name:null,nonce:null,noModule:Ze,noValidate:Ze,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:Ze,optimum:be,pattern:null,ping:Rt,placeholder:null,playsInline:Ze,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ze,referrerPolicy:null,rel:Rt,required:Ze,reversed:Ze,rows:be,rowSpan:be,sandbox:Rt,scope:null,scoped:Ze,seamless:Ze,selected:Ze,shadowRootClonable:Ze,shadowRootDelegatesFocus:Ze,shadowRootMode:null,shape:null,size:be,sizes:null,slot:null,span:be,spellCheck:nn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:be,step:null,style:null,tabIndex:be,target:null,title:null,translate:null,type:null,typeMustMatch:Ze,useMap:null,value:nn,width:be,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Rt,axis:null,background:null,bgColor:null,border:be,borderColor:null,bottomMargin:be,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ze,declare:Ze,event:null,face:null,frame:null,frameBorder:null,hSpace:be,leftMargin:be,link:null,longDesc:null,lowSrc:null,marginHeight:be,marginWidth:be,noResize:Ze,noHref:Ze,noShade:Ze,noWrap:Ze,object:null,profile:null,prompt:null,rev:null,rightMargin:be,rules:null,scheme:null,scrolling:nn,standby:null,summary:null,text:null,topMargin:be,valueType:null,version:null,vAlign:null,vLink:null,vSpace:be,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ze,disableRemotePlayback:Ze,prefix:null,property:null,results:be,security:null,unselectable:null},space:"html",transform:Q0}),sv=fi({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:Xn,accentHeight:be,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:be,amplitude:be,arabicForm:null,ascent:be,attributeName:null,attributeType:null,azimuth:be,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:be,by:null,calcMode:null,capHeight:be,className:Rt,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:be,diffuseConstant:be,direction:null,display:null,dur:null,divisor:be,dominantBaseline:null,download:Ze,dx:null,dy:null,edgeMode:null,editable:null,elevation:be,enableBackground:null,end:null,event:null,exponent:be,externalResourcesRequired:null,fill:null,fillOpacity:be,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:si,g2:si,glyphName:si,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:be,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:be,horizOriginX:be,horizOriginY:be,id:null,ideographic:be,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:be,k:be,k1:be,k2:be,k3:be,k4:be,kernelMatrix:Xn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:be,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:be,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:be,overlineThickness:be,paintOrder:null,panose1:null,path:null,pathLength:be,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Rt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:be,pointsAtY:be,pointsAtZ:be,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Xn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Xn,rev:Xn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Xn,requiredFeatures:Xn,requiredFonts:Xn,requiredFormats:Xn,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:be,specularExponent:be,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:be,strikethroughThickness:be,string:null,stroke:null,strokeDashArray:Xn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:be,strokeOpacity:be,strokeWidth:null,style:null,surfaceScale:be,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Xn,tabIndex:be,tableValues:null,target:null,targetX:be,targetY:be,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Xn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:be,underlineThickness:be,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:be,values:null,vAlphabetic:be,vMathematical:be,vectorEffect:null,vHanging:be,vIdeographic:be,version:null,vertAdvY:be,vertOriginX:be,vertOriginY:be,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:be,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:K0}),W0=fi({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()}}),Z0=fi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Q0}),J0=fi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,l){return"xml:"+l.slice(3).toLowerCase()}}),ov={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"},cv=/[A-Z]/g,g1=/-[a-z]/g,uv=/^data[-\w.:]+$/i;function fv(t,l){const r=Bd(l);let i=l,c=On;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&uv.test(l)){if(l.charAt(4)==="-"){const u=l.slice(5).replace(g1,hv);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=l.slice(4);if(!g1.test(u)){let f=u.replace(cv,dv);f.charAt(0)!=="-"&&(f="-"+f),l="data"+f}}c=nh}return new c(i,l)}function dv(t){return"-"+t.toLowerCase()}function hv(t){return t.charAt(1).toUpperCase()}const mv=V0([G0,iv,W0,Z0,J0],"html"),lh=V0([G0,sv,W0,Z0,J0],"svg");function xv(t){return t.join(" ").trim()}var li={},ed,b1;function pv(){if(b1)return ed;b1=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,l=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,m=/^\s+|\s+$/g,p=`
51
- `,d="/",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 A=1,R=1;function O(ee){var V=ee.match(l);V&&(A+=V.length);var I=ee.lastIndexOf(p);R=~I?ee.length-I:R+ee.length}function L(){var ee={line:A,column:R};return function(V){return V.position=new D(ee),ne(),V}}function D(ee){this.start=ee,this.end={line:A,column:R},this.source=E.source}D.prototype.content=C;function U(ee){var V=new Error(E.source+":"+A+":"+R+": "+ee);if(V.reason=ee,V.filename=E.source,V.line=A,V.column=R,V.source=C,!E.silent)throw V}function X(ee){var V=ee.exec(C);if(V){var I=V[0];return O(I),C=C.slice(I.length),V}}function ne(){X(r)}function M(ee){var V;for(ee=ee||[];V=q();)V!==!1&&ee.push(V);return ee}function q(){var ee=L();if(!(d!=C.charAt(0)||g!=C.charAt(1))){for(var V=2;y!=C.charAt(V)&&(g!=C.charAt(V)||d!=C.charAt(V+1));)++V;if(V+=2,y===C.charAt(V-1))return U("End of comment missing");var I=C.slice(2,V-2);return R+=2,O(I),C=C.slice(V),R+=2,ee({type:b,comment:I})}}function F(){var ee=L(),V=X(i);if(V){if(q(),!X(c))return U("property missing ':'");var I=X(u),Z=ee({type:v,property:k(V[0].replace(t,y)),value:I?k(I[0].replace(t,y)):y});return X(f),Z}}function W(){var ee=[];M(ee);for(var V;V=F();)V!==!1&&(ee.push(V),M(ee));return ee}return ne(),W()}function k(C){return C?C.replace(m,y):y}return ed=j,ed}var v1;function yv(){if(v1)return li;v1=1;var t=li&&li.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(li,"__esModule",{value:!0}),li.default=r;const l=t(pv());function r(i,c){let u=null;if(!i||typeof i!="string")return u;const f=(0,l.default)(i),m=typeof c=="function";return f.forEach(p=>{if(p.type!=="declaration")return;const{property:d,value:g}=p;m?c(d,g,p):g&&(u=u||{},u[d]=g)}),u}return li}var hs={},w1;function gv(){if(w1)return hs;w1=1,Object.defineProperty(hs,"__esModule",{value:!0}),hs.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,l=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,u=function(d){return!d||r.test(d)||t.test(d)},f=function(d,g){return g.toUpperCase()},m=function(d,g){return"".concat(g,"-")},p=function(d,g){return g===void 0&&(g={}),u(d)?d:(d=d.toLowerCase(),g.reactCompat?d=d.replace(c,m):d=d.replace(i,m),d.replace(l,f))};return hs.camelCase=p,hs}var ms,k1;function bv(){if(k1)return ms;k1=1;var t=ms&&ms.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},l=t(yv()),r=gv();function i(c,u){var f={};return!c||typeof c!="string"||(0,l.default)(c,function(m,p){m&&p&&(f[(0,r.camelCase)(m,u)]=p)}),f}return i.default=i,ms=i,ms}var vv=bv();const wv=q0(vv),P0=ey("end"),rh=ey("start");function ey(t){return l;function l(r){const i=r&&r.position&&r.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 kv(t){const l=rh(t),r=P0(t);if(l&&r)return{start:l,end:r}}function Es(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?S1(t.position):"start"in t||"end"in t?S1(t):"line"in t||"column"in t?Hd(t):""}function Hd(t){return j1(t&&t.line)+":"+j1(t&&t.column)}function S1(t){return Hd(t&&t.start)+"-"+Hd(t&&t.end)}function j1(t){return t&&typeof t=="number"?t:1}class gn extends Error{constructor(l,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let c="",u={},f=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof l=="string"?c=l:!u.cause&&l&&(f=!0,c=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=c,this.line=m?m.line:void 0,this.name=Es(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}}gn.prototype.file="";gn.prototype.name="";gn.prototype.reason="";gn.prototype.message="";gn.prototype.stack="";gn.prototype.column=void 0;gn.prototype.line=void 0;gn.prototype.ancestors=void 0;gn.prototype.cause=void 0;gn.prototype.fatal=void 0;gn.prototype.place=void 0;gn.prototype.ruleId=void 0;gn.prototype.source=void 0;const ah={}.hasOwnProperty,Sv=new Map,jv=/[A-Z]/g,Cv=new Set(["table","tbody","thead","tfoot","tr"]),Ev=new Set(["td","th"]),ty="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Nv(t,l){if(!l||l.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=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=_v(r,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=Fv(r,l.jsx,l.jsxs)}const c={Fragment:l.Fragment,ancestors:[],components:l.components||{},create:i,elementAttributeNameCase:l.elementAttributeNameCase||"react",evaluater:l.createEvaluater?l.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:l.ignoreInvalidStyle||!1,passKeys:l.passKeys!==!1,passNode:l.passNode||!1,schema:l.space==="svg"?lh:mv,stylePropertyNameCase:l.stylePropertyNameCase||"dom",tableCellAlignToStyle:l.tableCellAlignToStyle!==!1},u=ny(c,t,void 0);return u&&typeof u!="string"?u:c.create(t,c.Fragment,{children:u||void 0},void 0)}function ny(t,l,r){if(l.type==="element")return Av(t,l,r);if(l.type==="mdxFlowExpression"||l.type==="mdxTextExpression")return Tv(t,l);if(l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement")return zv(t,l,r);if(l.type==="mdxjsEsm")return Dv(t,l);if(l.type==="root")return Mv(t,l,r);if(l.type==="text")return Rv(t,l)}function Av(t,l,r){const i=t.schema;let c=i;l.tagName.toLowerCase()==="svg"&&i.space==="html"&&(c=lh,t.schema=c),t.ancestors.push(l);const u=ry(t,l.tagName,!1),f=Ov(t,l);let m=sh(t,l);return Cv.has(l.tagName)&&(m=m.filter(function(p){return typeof p=="string"?!rv(p):!0})),ly(t,f,u,l),ih(f,m),t.ancestors.pop(),t.schema=i,t.create(l,u,f,r)}function Tv(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)}zs(t,l.position)}function Dv(t,l){if(l.data&&l.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(l.data.estree);zs(t,l.position)}function zv(t,l,r){const i=t.schema;let c=i;l.name==="svg"&&i.space==="html"&&(c=lh,t.schema=c),t.ancestors.push(l);const u=l.name===null?t.Fragment:ry(t,l.name,!0),f=Bv(t,l),m=sh(t,l);return ly(t,f,u,l),ih(f,m),t.ancestors.pop(),t.schema=i,t.create(l,u,f,r)}function Mv(t,l,r){const i={};return ih(i,sh(t,l)),t.create(l,t.Fragment,i,r)}function Rv(t,l){return l.value}function ly(t,l,r,i){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(l.node=i)}function ih(t,l){if(l.length>0){const r=l.length>1?l:l[0];r&&(t.children=r)}}function Fv(t,l,r){return i;function i(c,u,f,m){const d=Array.isArray(f.children)?r:l;return m?d(u,f,m):d(u,f)}}function _v(t,l){return r;function r(i,c,u,f){const m=Array.isArray(u.children),p=rh(i);return l(c,u,f,m,{columnNumber:p?p.column-1:void 0,fileName:t,lineNumber:p?p.line:void 0},void 0)}}function Ov(t,l){const r={};let i,c;for(c in l.properties)if(c!=="children"&&ah.call(l.properties,c)){const u=Lv(t,c,l.properties[c]);if(u){const[f,m]=u;t.tableCellAlignToStyle&&f==="align"&&typeof m=="string"&&Ev.has(l.tagName)?i=m:r[f]=m}}if(i){const u=r.style||(r.style={});u[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return r}function Bv(t,l){const r={};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(r,t.evaluater.evaluateExpression(m.argument))}else zs(t,l.position);else{const c=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 zs(t,l.position);else u=i.value===null?!0:i.value;r[c]=u}return r}function sh(t,l){const r=[];let i=-1;const c=t.passKeys?new Map:Sv;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 d=c.get(p)||0;f=p+"-"+d,c.set(p,d+1)}}const m=ny(t,u,f);m!==void 0&&r.push(m)}return r}function Lv(t,l,r){const i=fv(t.schema,l);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=i.commaSeparated?Pb(r):xv(r)),i.property==="style"){let c=typeof r=="object"?r:$v(t,String(r));return t.stylePropertyNameCase==="css"&&(c=Hv(c)),["style",c]}return[t.elementAttributeNameCase==="react"&&i.space?ov[i.property]||i.property:i.attribute,r]}}function $v(t,l){try{return wv(l,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const i=r,c=new gn("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=t.filePath||void 0,c.url=ty+"#cannot-parse-style-attribute",c}}function ry(t,l,r){let i;if(!r)i={type:"Literal",value:l};else if(l.includes(".")){const c=l.split(".");let u=-1,f;for(;++u<c.length;){const m=x1(c[u])?{type:"Identifier",name:c[u]}:{type:"Literal",value:c[u]};f=f?{type:"MemberExpression",object:f,property:m,computed:!!(u&&m.type==="Literal"),optional:!1}:m}i=f}else i=x1(l)&&!/^[a-z]/.test(l)?{type:"Identifier",name:l}:{type:"Literal",value:l};if(i.type==="Literal"){const c=i.value;return ah.call(t.components,c)?t.components[c]:c}if(t.evaluater)return t.evaluater.evaluateExpression(i);zs(t)}function zs(t,l){const r=new gn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:l,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=t.filePath||void 0,r.url=ty+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Hv(t){const l={};let r;for(r in t)ah.call(t,r)&&(l[Uv(r)]=t[r]);return l}function Uv(t){let l=t.replace(jv,Iv);return l.slice(0,3)==="ms-"&&(l="-"+l),l}function Iv(t){return"-"+t.toLowerCase()}const td={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"]},Yv={};function oh(t,l){const r=Yv,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,c=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return ay(t,i,c)}function ay(t,l,r){if(qv(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(l&&"alt"in t&&t.alt)return t.alt;if("children"in t)return C1(t.children,l,r)}return Array.isArray(t)?C1(t,l,r):""}function C1(t,l,r){const i=[];let c=-1;for(;++c<t.length;)i[c]=ay(t[c],l,r);return i.join("")}function qv(t){return!!(t&&typeof t=="object")}const E1=document.createElement("i");function ch(t){const l="&"+t+";";E1.innerHTML=l;const r=E1.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===l?!1:r}function Gn(t,l,r,i){const c=t.length;let u=0,f;if(l<0?l=-l>c?0:c+l:l=l>c?c:l,r=r>0?r:0,i.length<1e4)f=Array.from(i),f.unshift(l,r),t.splice(...f);else for(r&&t.splice(l,r);u<i.length;)f=i.slice(u,u+1e4),f.unshift(l,0),t.splice(...f),u+=1e4,l+=1e4}function al(t,l){return t.length>0?(Gn(t,t.length,0,l),t):l}const N1={}.hasOwnProperty;function iy(t){const l={};let r=-1;for(;++r<t.length;)Xv(l,t[r]);return l}function Xv(t,l){let r;for(r in l){const c=(N1.call(t,r)?t[r]:void 0)||(t[r]={}),u=l[r];let f;if(u)for(f in u){N1.call(c,f)||(c[f]=[]);const m=u[f];Vv(c[f],Array.isArray(m)?m:m?[m]:[])}}}function Vv(t,l){let r=-1;const i=[];for(;++r<l.length;)(l[r].add==="after"?t:i).push(l[r]);Gn(t,0,0,i)}function sy(t,l){const r=Number.parseInt(t,l);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function hl(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Sn=Ur(/[A-Za-z]/),yn=Ur(/[\dA-Za-z]/),Gv=Ur(/[#-'*+\--9=?A-Z^-~]/);function Cc(t){return t!==null&&(t<32||t===127)}const Ud=Ur(/\d/),Kv=Ur(/[\dA-Fa-f]/),Qv=Ur(/[!-/:-@[-`{-~]/);function Ie(t){return t!==null&&t<-2}function zt(t){return t!==null&&(t<0||t===32)}function it(t){return t===-2||t===-1||t===32}const Oc=Ur(new RegExp("\\p{P}|\\p{S}","u")),ga=Ur(/\s/);function Ur(t){return l;function l(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function di(t){const l=[];let r=-1,i=0,c=0;for(;++r<t.length;){const u=t.charCodeAt(r);let f="";if(u===37&&yn(t.charCodeAt(r+1))&&yn(t.charCodeAt(r+2)))c=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(r+1);u<56320&&m>56319&&m<57344?(f=String.fromCharCode(u,m),c=1):f="�"}else f=String.fromCharCode(u);f&&(l.push(t.slice(i,r),encodeURIComponent(f)),i=r+c+1,f=""),c&&(r+=c,c=0)}return l.join("")+t.slice(i)}function dt(t,l,r,i){const c=i?i-1:Number.POSITIVE_INFINITY;let u=0;return f;function f(p){return it(p)?(t.enter(r),m(p)):l(p)}function m(p){return it(p)&&u++<c?(t.consume(p),m):(t.exit(r),l(p))}}const Wv={tokenize:Zv};function Zv(t){const l=t.attempt(this.parser.constructs.contentInitial,i,c);let r;return l;function i(m){if(m===null){t.consume(m);return}return t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),dt(t,l,"linePrefix")}function c(m){return t.enter("paragraph"),u(m)}function u(m){const p=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=p),r=p,f(m)}function f(m){if(m===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(m);return}return Ie(m)?(t.consume(m),t.exit("chunkText"),u):(t.consume(m),f)}}const Jv={tokenize:Pv},A1={tokenize:ew};function Pv(t){const l=this,r=[];let i=0,c,u,f;return m;function m(R){if(i<r.length){const O=r[i];return l.containerState=O[1],t.attempt(O[0].continuation,p,d)(R)}return d(R)}function p(R){if(i++,l.containerState._closeFlow){l.containerState._closeFlow=void 0,c&&A();const O=l.events.length;let L=O,D;for(;L--;)if(l.events[L][0]==="exit"&&l.events[L][1].type==="chunkFlow"){D=l.events[L][1].end;break}E(i);let U=O;for(;U<l.events.length;)l.events[U][1].end={...D},U++;return Gn(l.events,L+1,0,l.events.slice(O)),l.events.length=U,d(R)}return m(R)}function d(R){if(i===r.length){if(!c)return b(R);if(c.currentConstruct&&c.currentConstruct.concrete)return j(R);l.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return l.containerState={},t.check(A1,g,y)(R)}function g(R){return c&&A(),E(i),b(R)}function y(R){return l.parser.lazy[l.now().line]=i!==r.length,f=l.now().offset,j(R)}function b(R){return l.containerState={},t.attempt(A1,v,j)(R)}function v(R){return i++,r.push([l.currentConstruct,l.containerState]),b(R)}function j(R){if(R===null){c&&A(),E(0),t.consume(R);return}return c=c||l.parser.flow(l.now()),t.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:u}),k(R)}function k(R){if(R===null){C(t.exit("chunkFlow"),!0),E(0),t.consume(R);return}return Ie(R)?(t.consume(R),C(t.exit("chunkFlow")),i=0,l.interrupt=void 0,m):(t.consume(R),k)}function C(R,O){const L=l.sliceStream(R);if(O&&L.push(null),R.previous=u,u&&(u.next=R),u=R,c.defineSkip(R.start),c.write(L),l.parser.lazy[R.start.line]){let D=c.events.length;for(;D--;)if(c.events[D][1].start.offset<f&&(!c.events[D][1].end||c.events[D][1].end.offset>f))return;const U=l.events.length;let X=U,ne,M;for(;X--;)if(l.events[X][0]==="exit"&&l.events[X][1].type==="chunkFlow"){if(ne){M=l.events[X][1].end;break}ne=!0}for(E(i),D=U;D<l.events.length;)l.events[D][1].end={...M},D++;Gn(l.events,X+1,0,l.events.slice(U)),l.events.length=D}}function E(R){let O=r.length;for(;O-- >R;){const L=r[O];l.containerState=L[1],L[0].exit.call(l,t)}r.length=R}function A(){c.write([null]),u=void 0,c=void 0,l.containerState._closeFlow=void 0}}function ew(t,l,r){return dt(t,t.attempt(this.parser.constructs.document,l,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function oi(t){if(t===null||zt(t)||ga(t))return 1;if(Oc(t))return 2}function Bc(t,l,r){const i=[];let c=-1;for(;++c<t.length;){const u=t[c].resolveAll;u&&!i.includes(u)&&(l=u(l,r),i.push(u))}return l}const Id={name:"attention",resolveAll:tw,tokenize:nw};function tw(t,l){let r=-1,i,c,u,f,m,p,d,g;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(i=r;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[r][1]).charCodeAt(0)){if((t[i][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[i][1].end.offset-t[i][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;p=t[i][1].end.offset-t[i][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;const y={...t[i][1].end},b={...t[r][1].start};T1(y,-p),T1(b,p),f={type:p>1?"strongSequence":"emphasisSequence",start:y,end:{...t[i][1].end}},m={type:p>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:b},u={type:p>1?"strongText":"emphasisText",start:{...t[i][1].end},end:{...t[r][1].start}},c={type:p>1?"strong":"emphasis",start:{...f.start},end:{...m.end}},t[i][1].end={...f.start},t[r][1].start={...m.end},d=[],t[i][1].end.offset-t[i][1].start.offset&&(d=al(d,[["enter",t[i][1],l],["exit",t[i][1],l]])),d=al(d,[["enter",c,l],["enter",f,l],["exit",f,l],["enter",u,l]]),d=al(d,Bc(l.parser.constructs.insideSpan.null,t.slice(i+1,r),l)),d=al(d,[["exit",u,l],["enter",m,l],["exit",m,l],["exit",c,l]]),t[r][1].end.offset-t[r][1].start.offset?(g=2,d=al(d,[["enter",t[r][1],l],["exit",t[r][1],l]])):g=0,Gn(t,i-1,r-i+3,d),r=i+d.length-g-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function nw(t,l){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,c=oi(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 d=t.exit("attentionSequence"),g=oi(p),y=!g||g===2&&c||r.includes(p),b=!c||c===2&&g||r.includes(i);return d._open=!!(u===42?y:y&&(c||!b)),d._close=!!(u===42?b:b&&(g||!y)),l(p)}}function T1(t,l){t.column+=l,t.offset+=l,t._bufferIndex+=l}const lw={name:"autolink",tokenize:rw};function rw(t,l,r){let i=0;return c;function c(v){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),u}function u(v){return Sn(v)?(t.consume(v),f):v===64?r(v):d(v)}function f(v){return v===43||v===45||v===46||yn(v)?(i=1,m(v)):d(v)}function m(v){return v===58?(t.consume(v),i=0,p):(v===43||v===45||v===46||yn(v))&&i++<32?(t.consume(v),m):(i=0,d(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||Cc(v)?r(v):(t.consume(v),p)}function d(v){return v===64?(t.consume(v),g):Gv(v)?(t.consume(v),d):r(v)}function g(v){return yn(v)?y(v):r(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||yn(v))&&i++<63){const j=v===45?b:y;return t.consume(v),j}return r(v)}}const Ls={partial:!0,tokenize:aw};function aw(t,l,r){return i;function i(u){return it(u)?dt(t,c,"linePrefix")(u):c(u)}function c(u){return u===null||Ie(u)?l(u):r(u)}}const oy={continuation:{tokenize:sw},exit:ow,name:"blockQuote",tokenize:iw};function iw(t,l,r){const i=this;return c;function c(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 r(f)}function u(f){return it(f)?(t.enter("blockQuotePrefixWhitespace"),t.consume(f),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),l):(t.exit("blockQuotePrefix"),l(f))}}function sw(t,l,r){const i=this;return c;function c(f){return it(f)?dt(t,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):u(f)}function u(f){return t.attempt(oy,l,r)(f)}}function ow(t){t.exit("blockQuote")}const cy={name:"characterEscape",tokenize:cw};function cw(t,l,r){return i;function i(u){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(u),t.exit("escapeMarker"),c}function c(u){return Qv(u)?(t.enter("characterEscapeValue"),t.consume(u),t.exit("characterEscapeValue"),t.exit("characterEscape"),l):r(u)}}const uy={name:"characterReference",tokenize:uw};function uw(t,l,r){const i=this;let c=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"),d):(t.enter("characterReferenceValue"),u=31,f=yn,g(y))}function d(y){return y===88||y===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(y),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),u=6,f=Kv,g):(t.enter("characterReferenceValue"),u=7,f=Ud,g(y))}function g(y){if(y===59&&c){const b=t.exit("characterReferenceValue");return f===yn&&!ch(i.sliceSerialize(b))?r(y):(t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),t.exit("characterReference"),l)}return f(y)&&c++<u?(t.consume(y),g):r(y)}}const D1={partial:!0,tokenize:dw},z1={concrete:!0,name:"codeFenced",tokenize:fw};function fw(t,l,r){const i=this,c={partial:!0,tokenize:L};let u=0,f=0,m;return p;function p(D){return d(D)}function d(D){const U=i.events[i.events.length-1];return u=U&&U[1].type==="linePrefix"?U[2].sliceSerialize(U[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?r(D):(t.exit("codeFencedFenceSequence"),it(D)?dt(t,y,"whitespace")(D):y(D))}function y(D){return D===null||Ie(D)?(t.exit("codeFencedFence"),i.interrupt?l(D):t.check(D1,k,O)(D)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),b(D))}function b(D){return D===null||Ie(D)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),y(D)):it(D)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),dt(t,v,"whitespace")(D)):D===96&&D===m?r(D):(t.consume(D),b)}function v(D){return D===null||Ie(D)?y(D):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),j(D))}function j(D){return D===null||Ie(D)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),y(D)):D===96&&D===m?r(D):(t.consume(D),j)}function k(D){return t.attempt(c,O,C)(D)}function C(D){return t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),E}function E(D){return u>0&&it(D)?dt(t,A,"linePrefix",u+1)(D):A(D)}function A(D){return D===null||Ie(D)?t.check(D1,k,O)(D):(t.enter("codeFlowValue"),R(D))}function R(D){return D===null||Ie(D)?(t.exit("codeFlowValue"),A(D)):(t.consume(D),R)}function O(D){return t.exit("codeFenced"),l(D)}function L(D,U,X){let ne=0;return M;function M(V){return D.enter("lineEnding"),D.consume(V),D.exit("lineEnding"),q}function q(V){return D.enter("codeFencedFence"),it(V)?dt(D,F,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):F(V)}function F(V){return V===m?(D.enter("codeFencedFenceSequence"),W(V)):X(V)}function W(V){return V===m?(ne++,D.consume(V),W):ne>=f?(D.exit("codeFencedFenceSequence"),it(V)?dt(D,ee,"whitespace")(V):ee(V)):X(V)}function ee(V){return V===null||Ie(V)?(D.exit("codeFencedFence"),U(V)):X(V)}}}function dw(t,l,r){const i=this;return c;function c(f){return f===null?r(f):(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u)}function u(f){return i.parser.lazy[i.now().line]?r(f):l(f)}}const nd={name:"codeIndented",tokenize:mw},hw={partial:!0,tokenize:xw};function mw(t,l,r){const i=this;return c;function c(d){return t.enter("codeIndented"),dt(t,u,"linePrefix",5)(d)}function u(d){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?f(d):r(d)}function f(d){return d===null?p(d):Ie(d)?t.attempt(hw,f,p)(d):(t.enter("codeFlowValue"),m(d))}function m(d){return d===null||Ie(d)?(t.exit("codeFlowValue"),f(d)):(t.consume(d),m)}function p(d){return t.exit("codeIndented"),l(d)}}function xw(t,l,r){const i=this;return c;function c(f){return i.parser.lazy[i.now().line]?r(f):Ie(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):dt(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):Ie(f)?c(f):r(f)}}const pw={name:"codeText",previous:gw,resolve:yw,tokenize:bw};function yw(t){let l=t.length-4,r=3,i,c;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[l][1].type==="lineEnding"||t[l][1].type==="space")){for(i=r;++i<l;)if(t[i][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[l][1].type="codeTextPadding",r+=2,l-=2;break}}for(i=r-1,l++;++i<=l;)c===void 0?i!==l&&t[i][1].type!=="lineEnding"&&(c=i):(i===l||t[i][1].type==="lineEnding")&&(t[c][1].type="codeTextData",i!==c+2&&(t[c][1].end=t[i-1][1].end,t.splice(c+2,i-c-2),l-=i-c-2,i=c+2),c=void 0);return t}function gw(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function bw(t,l,r){let i=0,c,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?r(y):y===32?(t.enter("space"),t.consume(y),t.exit("space"),p):y===96?(u=t.enter("codeTextSequence"),c=0,g(y)):Ie(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),p):(t.enter("codeTextData"),d(y))}function d(y){return y===null||y===32||y===96||Ie(y)?(t.exit("codeTextData"),p(y)):(t.consume(y),d)}function g(y){return y===96?(t.consume(y),c++,g):c===i?(t.exit("codeTextSequence"),t.exit("codeText"),l(y)):(u.type="codeTextData",d(y))}}class vw{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,r){const i=r??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,r,i){const c=r||0;this.setCursor(Math.trunc(l));const u=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return i&&xs(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),xs(this.left,l)}unshift(l){this.setCursor(0),this.right.push(l)}unshiftMany(l){this.setCursor(0),xs(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 r=this.left.splice(l,Number.POSITIVE_INFINITY);xs(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-l,Number.POSITIVE_INFINITY);xs(this.left,r.reverse())}}}function xs(t,l){let r=0;if(l.length<1e4)t.push(...l);else for(;r<l.length;)t.push(...l.slice(r,r+1e4)),r+=1e4}function fy(t){const l={};let r=-1,i,c,u,f,m,p,d;const g=new vw(t);for(;++r<g.length;){for(;r in l;)r=l[r];if(i=g.get(r),r&&i[1].type==="chunkFlow"&&g.get(r-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,ww(g,r)),r=l[r],d=!0);else if(i[1]._container){for(u=r,c=void 0;u--;)if(f=g.get(u),f[1].type==="lineEnding"||f[1].type==="lineEndingBlank")f[0]==="enter"&&(c&&(g.get(c)[1].type="lineEndingBlank"),f[1].type="lineEnding",c=u);else if(!(f[1].type==="linePrefix"||f[1].type==="listItemIndent"))break;c&&(i[1].end={...g.get(c)[1].start},m=g.slice(c,r),m.unshift(i),g.splice(c,r-c+1,m))}}return Gn(t,0,Number.POSITIVE_INFINITY,g.slice(0)),!d}function ww(t,l){const r=t.get(l)[1],i=t.get(l)[2];let c=l-1;const u=[];let f=r._tokenizer;f||(f=i.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(f._contentTypeTextTrailing=!0));const m=f.events,p=[],d={};let g,y,b=-1,v=r,j=0,k=0;const C=[k];for(;v;){for(;t.get(++c)[1]!==v;);u.push(c),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=r;++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]),A=u.pop();p.push([A,A+E.length-1]),t.splice(A,2,E)}for(p.reverse(),b=-1;++b<p.length;)d[j+p[b][0]]=j+p[b][1],j+=p[b][1]-p[b][0]-1;return d}const kw={resolve:jw,tokenize:Cw},Sw={partial:!0,tokenize:Ew};function jw(t){return fy(t),t}function Cw(t,l){let r;return i;function i(m){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),c(m)}function c(m){return m===null?u(m):Ie(m)?t.check(Sw,f,u)(m):(t.consume(m),c)}function u(m){return t.exit("chunkContent"),t.exit("content"),l(m)}function f(m){return t.consume(m),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,c}}function Ew(t,l,r){const i=this;return c;function c(f){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),dt(t,u,"linePrefix")}function u(f){if(f===null||Ie(f))return r(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,r,l)(f)}}function dy(t,l,r,i,c,u,f,m,p){const d=p||Number.POSITIVE_INFINITY;let g=0;return y;function y(E){return E===60?(t.enter(i),t.enter(c),t.enter(u),t.consume(E),t.exit(u),b):E===null||E===32||E===41||Cc(E)?r(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(c),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||Ie(E)?r(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||zt(E))?(t.exit("chunkString"),t.exit(m),t.exit(f),t.exit(i),l(E)):g<d&&E===40?(t.consume(E),g++,k):E===41?(t.consume(E),g--,k):E===null||E===32||E===40||Cc(E)?r(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 hy(t,l,r,i,c,u){const f=this;let m=0,p;return d;function d(v){return t.enter(i),t.enter(c),t.consume(v),t.exit(c),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?r(v):v===93?(t.exit(u),t.enter(c),t.consume(v),t.exit(c),t.exit(i),l):Ie(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||Ie(v)||m++>999?(t.exit("chunkString"),g(v)):(t.consume(v),p||(p=!it(v)),v===92?b:y)}function b(v){return v===91||v===92||v===93?(t.consume(v),m++,y):y(v)}}function my(t,l,r,i,c,u){let f;return m;function m(b){return b===34||b===39||b===40?(t.enter(i),t.enter(c),t.consume(b),t.exit(c),f=b===40?41:b,p):r(b)}function p(b){return b===f?(t.enter(c),t.consume(b),t.exit(c),t.exit(i),l):(t.enter(u),d(b))}function d(b){return b===f?(t.exit(u),p(f)):b===null?r(b):Ie(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),dt(t,d,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===f||b===null||Ie(b)?(t.exit("chunkString"),d(b)):(t.consume(b),b===92?y:g)}function y(b){return b===f||b===92?(t.consume(b),g):g(b)}}function Ns(t,l){let r;return i;function i(c){return Ie(c)?(t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),r=!0,i):it(c)?dt(t,i,r?"linePrefix":"lineSuffix")(c):l(c)}}const Nw={name:"definition",tokenize:Tw},Aw={partial:!0,tokenize:Dw};function Tw(t,l,r){const i=this;let c;return u;function u(v){return t.enter("definition"),f(v)}function f(v){return hy.call(i,t,m,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function m(v){return c=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):r(v)}function p(v){return zt(v)?Ns(t,d)(v):d(v)}function d(v){return dy(t,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function g(v){return t.attempt(Aw,y,y)(v)}function y(v){return it(v)?dt(t,b,"whitespace")(v):b(v)}function b(v){return v===null||Ie(v)?(t.exit("definition"),i.parser.defined.push(c),l(v)):r(v)}}function Dw(t,l,r){return i;function i(m){return zt(m)?Ns(t,c)(m):r(m)}function c(m){return my(t,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(m)}function u(m){return it(m)?dt(t,f,"whitespace")(m):f(m)}function f(m){return m===null||Ie(m)?l(m):r(m)}}const zw={name:"hardBreakEscape",tokenize:Mw};function Mw(t,l,r){return i;function i(u){return t.enter("hardBreakEscape"),t.consume(u),c}function c(u){return Ie(u)?(t.exit("hardBreakEscape"),l(u)):r(u)}}const Rw={name:"headingAtx",resolve:Fw,tokenize:_w};function Fw(t,l){let r=t.length-2,i=3,c,u;return t[i][1].type==="whitespace"&&(i+=2),r-2>i&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(i===r-1||r-4>i&&t[r-2][1].type==="whitespace")&&(r-=i+1===r?2:4),r>i&&(c={type:"atxHeadingText",start:t[i][1].start,end:t[r][1].end},u={type:"chunkText",start:t[i][1].start,end:t[r][1].end,contentType:"text"},Gn(t,i,r-i+1,[["enter",c,l],["enter",u,l],["exit",u,l],["exit",c,l]])),t}function _w(t,l,r){let i=0;return c;function c(g){return t.enter("atxHeading"),u(g)}function u(g){return t.enter("atxHeadingSequence"),f(g)}function f(g){return g===35&&i++<6?(t.consume(g),f):g===null||zt(g)?(t.exit("atxHeadingSequence"),m(g)):r(g)}function m(g){return g===35?(t.enter("atxHeadingSequence"),p(g)):g===null||Ie(g)?(t.exit("atxHeading"),l(g)):it(g)?dt(t,m,"whitespace")(g):(t.enter("atxHeadingText"),d(g))}function p(g){return g===35?(t.consume(g),p):(t.exit("atxHeadingSequence"),m(g))}function d(g){return g===null||g===35||zt(g)?(t.exit("atxHeadingText"),m(g)):(t.consume(g),d)}}const Ow=["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"],M1=["pre","script","style","textarea"],Bw={concrete:!0,name:"htmlFlow",resolveTo:Hw,tokenize:Uw},Lw={partial:!0,tokenize:Yw},$w={partial:!0,tokenize:Iw};function Hw(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 Uw(t,l,r){const i=this;let c,u,f,m,p;return d;function d(T){return g(T)}function g(T){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(T),y}function y(T){return T===33?(t.consume(T),b):T===47?(t.consume(T),u=!0,k):T===63?(t.consume(T),c=3,i.interrupt?l:z):Sn(T)?(t.consume(T),f=String.fromCharCode(T),C):r(T)}function b(T){return T===45?(t.consume(T),c=2,v):T===91?(t.consume(T),c=5,m=0,j):Sn(T)?(t.consume(T),c=4,i.interrupt?l:z):r(T)}function v(T){return T===45?(t.consume(T),i.interrupt?l:z):r(T)}function j(T){const me="CDATA[";return T===me.charCodeAt(m++)?(t.consume(T),m===me.length?i.interrupt?l:F:j):r(T)}function k(T){return Sn(T)?(t.consume(T),f=String.fromCharCode(T),C):r(T)}function C(T){if(T===null||T===47||T===62||zt(T)){const me=T===47,Se=f.toLowerCase();return!me&&!u&&M1.includes(Se)?(c=1,i.interrupt?l(T):F(T)):Ow.includes(f.toLowerCase())?(c=6,me?(t.consume(T),E):i.interrupt?l(T):F(T)):(c=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(T):u?A(T):R(T))}return T===45||yn(T)?(t.consume(T),f+=String.fromCharCode(T),C):r(T)}function E(T){return T===62?(t.consume(T),i.interrupt?l:F):r(T)}function A(T){return it(T)?(t.consume(T),A):M(T)}function R(T){return T===47?(t.consume(T),M):T===58||T===95||Sn(T)?(t.consume(T),O):it(T)?(t.consume(T),R):M(T)}function O(T){return T===45||T===46||T===58||T===95||yn(T)?(t.consume(T),O):L(T)}function L(T){return T===61?(t.consume(T),D):it(T)?(t.consume(T),L):R(T)}function D(T){return T===null||T===60||T===61||T===62||T===96?r(T):T===34||T===39?(t.consume(T),p=T,U):it(T)?(t.consume(T),D):X(T)}function U(T){return T===p?(t.consume(T),p=null,ne):T===null||Ie(T)?r(T):(t.consume(T),U)}function X(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||zt(T)?L(T):(t.consume(T),X)}function ne(T){return T===47||T===62||it(T)?R(T):r(T)}function M(T){return T===62?(t.consume(T),q):r(T)}function q(T){return T===null||Ie(T)?F(T):it(T)?(t.consume(T),q):r(T)}function F(T){return T===45&&c===2?(t.consume(T),I):T===60&&c===1?(t.consume(T),Z):T===62&&c===4?(t.consume(T),B):T===63&&c===3?(t.consume(T),z):T===93&&c===5?(t.consume(T),we):Ie(T)&&(c===6||c===7)?(t.exit("htmlFlowData"),t.check(Lw,Q,W)(T)):T===null||Ie(T)?(t.exit("htmlFlowData"),W(T)):(t.consume(T),F)}function W(T){return t.check($w,ee,Q)(T)}function ee(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),V}function V(T){return T===null||Ie(T)?W(T):(t.enter("htmlFlowData"),F(T))}function I(T){return T===45?(t.consume(T),z):F(T)}function Z(T){return T===47?(t.consume(T),f="",ce):F(T)}function ce(T){if(T===62){const me=f.toLowerCase();return M1.includes(me)?(t.consume(T),B):F(T)}return Sn(T)&&f.length<8?(t.consume(T),f+=String.fromCharCode(T),ce):F(T)}function we(T){return T===93?(t.consume(T),z):F(T)}function z(T){return T===62?(t.consume(T),B):T===45&&c===2?(t.consume(T),z):F(T)}function B(T){return T===null||Ie(T)?(t.exit("htmlFlowData"),Q(T)):(t.consume(T),B)}function Q(T){return t.exit("htmlFlow"),l(T)}}function Iw(t,l,r){const i=this;return c;function c(f){return Ie(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u):r(f)}function u(f){return i.parser.lazy[i.now().line]?r(f):l(f)}}function Yw(t,l,r){return i;function i(c){return t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),t.attempt(Ls,l,r)}}const qw={name:"htmlText",tokenize:Xw};function Xw(t,l,r){const i=this;let c,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),d):z===47?(t.consume(z),L):z===63?(t.consume(z),R):Sn(z)?(t.consume(z),X):r(z)}function d(z){return z===45?(t.consume(z),g):z===91?(t.consume(z),u=0,j):Sn(z)?(t.consume(z),A):r(z)}function g(z){return z===45?(t.consume(z),v):r(z)}function y(z){return z===null?r(z):z===45?(t.consume(z),b):Ie(z)?(f=y,Z(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 B="CDATA[";return z===B.charCodeAt(u++)?(t.consume(z),u===B.length?k:j):r(z)}function k(z){return z===null?r(z):z===93?(t.consume(z),C):Ie(z)?(f=k,Z(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 A(z){return z===null||z===62?I(z):Ie(z)?(f=A,Z(z)):(t.consume(z),A)}function R(z){return z===null?r(z):z===63?(t.consume(z),O):Ie(z)?(f=R,Z(z)):(t.consume(z),R)}function O(z){return z===62?I(z):R(z)}function L(z){return Sn(z)?(t.consume(z),D):r(z)}function D(z){return z===45||yn(z)?(t.consume(z),D):U(z)}function U(z){return Ie(z)?(f=U,Z(z)):it(z)?(t.consume(z),U):I(z)}function X(z){return z===45||yn(z)?(t.consume(z),X):z===47||z===62||zt(z)?ne(z):r(z)}function ne(z){return z===47?(t.consume(z),I):z===58||z===95||Sn(z)?(t.consume(z),M):Ie(z)?(f=ne,Z(z)):it(z)?(t.consume(z),ne):I(z)}function M(z){return z===45||z===46||z===58||z===95||yn(z)?(t.consume(z),M):q(z)}function q(z){return z===61?(t.consume(z),F):Ie(z)?(f=q,Z(z)):it(z)?(t.consume(z),q):ne(z)}function F(z){return z===null||z===60||z===61||z===62||z===96?r(z):z===34||z===39?(t.consume(z),c=z,W):Ie(z)?(f=F,Z(z)):it(z)?(t.consume(z),F):(t.consume(z),ee)}function W(z){return z===c?(t.consume(z),c=void 0,V):z===null?r(z):Ie(z)?(f=W,Z(z)):(t.consume(z),W)}function ee(z){return z===null||z===34||z===39||z===60||z===61||z===96?r(z):z===47||z===62||zt(z)?ne(z):(t.consume(z),ee)}function V(z){return z===47||z===62||zt(z)?ne(z):r(z)}function I(z){return z===62?(t.consume(z),t.exit("htmlTextData"),t.exit("htmlText"),l):r(z)}function Z(z){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),ce}function ce(z){return it(z)?dt(t,we,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):we(z)}function we(z){return t.enter("htmlTextData"),f(z)}}const uh={name:"labelEnd",resolveAll:Qw,resolveTo:Ww,tokenize:Zw},Vw={tokenize:Jw},Gw={tokenize:Pw},Kw={tokenize:e5};function Qw(t){let l=-1;const r=[];for(;++l<t.length;){const i=t[l][1];if(r.push(t[l]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const c=i.type==="labelImage"?4:2;i.type="data",l+=c}}return t.length!==r.length&&Gn(t,0,t.length,r),t}function Ww(t,l){let r=t.length,i=0,c,u,f,m;for(;r--;)if(c=t[r][1],u){if(c.type==="link"||c.type==="labelLink"&&c._inactive)break;t[r][0]==="enter"&&c.type==="labelLink"&&(c._inactive=!0)}else if(f){if(t[r][0]==="enter"&&(c.type==="labelImage"||c.type==="labelLink")&&!c._balanced&&(u=r,c.type!=="labelLink")){i=2;break}}else c.type==="labelEnd"&&(f=r);const p={type:t[u][1].type==="labelLink"?"link":"image",start:{...t[u][1].start},end:{...t[t.length-1][1].end}},d={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",d,l]],m=al(m,t.slice(u+1,u+i+3)),m=al(m,[["enter",g,l]]),m=al(m,Bc(l.parser.constructs.insideSpan.null,t.slice(u+i+4,f-3),l)),m=al(m,[["exit",g,l],t[f-2],t[f-1],["exit",d,l]]),m=al(m,t.slice(f+1)),m=al(m,[["exit",p,l]]),Gn(t,u,t.length,m),t}function Zw(t,l,r){const i=this;let c=i.events.length,u,f;for(;c--;)if((i.events[c][1].type==="labelImage"||i.events[c][1].type==="labelLink")&&!i.events[c][1]._balanced){u=i.events[c][1];break}return m;function m(b){return u?u._inactive?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):r(b)}function p(b){return b===40?t.attempt(Vw,g,f?g:y)(b):b===91?t.attempt(Gw,g,f?d:y)(b):f?g(b):y(b)}function d(b){return t.attempt(Kw,g,y)(b)}function g(b){return l(b)}function y(b){return u._balanced=!0,r(b)}}function Jw(t,l,r){return i;function i(y){return t.enter("resource"),t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),c}function c(y){return zt(y)?Ns(t,u)(y):u(y)}function u(y){return y===41?g(y):dy(t,f,m,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function f(y){return zt(y)?Ns(t,p)(y):g(y)}function m(y){return r(y)}function p(y){return y===34||y===39||y===40?my(t,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function d(y){return zt(y)?Ns(t,g)(y):g(y)}function g(y){return y===41?(t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),t.exit("resource"),l):r(y)}}function Pw(t,l,r){const i=this;return c;function c(m){return hy.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):r(m)}function f(m){return r(m)}}function e5(t,l,r){return i;function i(u){return t.enter("reference"),t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),c}function c(u){return u===93?(t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),t.exit("reference"),l):r(u)}}const t5={name:"labelStartImage",resolveAll:uh.resolveAll,tokenize:n5};function n5(t,l,r){const i=this;return c;function c(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):r(m)}function f(m){return m===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(m):l(m)}}const l5={name:"labelStartLink",resolveAll:uh.resolveAll,tokenize:r5};function r5(t,l,r){const i=this;return c;function c(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?r(f):l(f)}}const ld={name:"lineEnding",tokenize:a5};function a5(t,l){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),dt(t,l,"linePrefix")}}const bc={name:"thematicBreak",tokenize:i5};function i5(t,l,r){let i=0,c;return u;function u(d){return t.enter("thematicBreak"),f(d)}function f(d){return c=d,m(d)}function m(d){return d===c?(t.enter("thematicBreakSequence"),p(d)):i>=3&&(d===null||Ie(d))?(t.exit("thematicBreak"),l(d)):r(d)}function p(d){return d===c?(t.consume(d),i++,p):(t.exit("thematicBreakSequence"),it(d)?dt(t,m,"whitespace")(d):m(d))}}const _n={continuation:{tokenize:u5},exit:d5,name:"list",tokenize:c5},s5={partial:!0,tokenize:h5},o5={partial:!0,tokenize:f5};function c5(t,l,r){const i=this,c=i.events[i.events.length-1];let u=c&&c[1].type==="linePrefix"?c[2].sliceSerialize(c[1],!0).length:0,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:Ud(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(bc,r,d)(v):d(v);if(!i.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),p(v)}return r(v)}function p(v){return Ud(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"),d(v)):r(v)}function d(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||v,t.check(Ls,i.interrupt?r:g,t.attempt(s5,b,y))}function g(v){return i.containerState.initialBlankLine=!0,u++,b(v)}function y(v){return it(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),b):r(v)}function b(v){return i.containerState.size=u+i.sliceSerialize(t.exit("listItemPrefix"),!0).length,l(v)}}function u5(t,l,r){const i=this;return i.containerState._closeFlow=void 0,t.check(Ls,c,u);function c(m){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,dt(t,l,"listItemIndent",i.containerState.size+1)(m)}function u(m){return i.containerState.furtherBlankLines||!it(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(o5,l,f)(m))}function f(m){return i.containerState._closeFlow=!0,i.interrupt=void 0,dt(t,t.attempt(_n,l,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m)}}function f5(t,l,r){const i=this;return dt(t,c,"listItemIndent",i.containerState.size+1);function c(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):r(u)}}function d5(t){t.exit(this.containerState.type)}function h5(t,l,r){const i=this;return dt(t,c,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(u){const f=i.events[i.events.length-1];return!it(u)&&f&&f[1].type==="listItemPrefixWhitespace"?l(u):r(u)}}const R1={name:"setextUnderline",resolveTo:m5,tokenize:x5};function m5(t,l){let r=t.length,i,c,u;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){i=r;break}t[r][1].type==="paragraph"&&(c=r)}else t[r][1].type==="content"&&t.splice(r,1),!u&&t[r][1].type==="definition"&&(u=r);const f={type:"setextHeading",start:{...t[i][1].start},end:{...t[t.length-1][1].end}};return t[c][1].type="setextHeadingText",u?(t.splice(c,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 x5(t,l,r){const i=this;let c;return u;function u(d){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"),c=d,f(d)):r(d)}function f(d){return t.enter("setextHeadingLineSequence"),m(d)}function m(d){return d===c?(t.consume(d),m):(t.exit("setextHeadingLineSequence"),it(d)?dt(t,p,"lineSuffix")(d):p(d))}function p(d){return d===null||Ie(d)?(t.exit("setextHeadingLine"),l(d)):r(d)}}const p5={tokenize:y5};function y5(t){const l=this,r=t.attempt(Ls,i,t.attempt(this.parser.constructs.flowInitial,c,dt(t,t.attempt(this.parser.constructs.flow,c,t.attempt(kw,c)),"linePrefix")));return r;function i(u){if(u===null){t.consume(u);return}return t.enter("lineEndingBlank"),t.consume(u),t.exit("lineEndingBlank"),l.currentConstruct=void 0,r}function c(u){if(u===null){t.consume(u);return}return t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),l.currentConstruct=void 0,r}}const g5={resolveAll:py()},b5=xy("string"),v5=xy("text");function xy(t){return{resolveAll:py(t==="text"?w5:void 0),tokenize:l};function l(r){const i=this,c=this.parser.constructs[t],u=r.attempt(c,f,m);return f;function f(g){return d(g)?u(g):m(g)}function m(g){if(g===null){r.consume(g);return}return r.enter("data"),r.consume(g),p}function p(g){return d(g)?(r.exit("data"),u(g)):(r.consume(g),p)}function d(g){if(g===null)return!0;const y=c[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 py(t){return l;function l(r,i){let c=-1,u;for(;++c<=r.length;)u===void 0?r[c]&&r[c][1].type==="data"&&(u=c,c++):(!r[c]||r[c][1].type!=="data")&&(c!==u+2&&(r[u][1].end=r[c-1][1].end,r.splice(u+2,c-u-2),c=u+2),u=void 0);return t?t(r,i):r}}function w5(t,l){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){const i=t[r-1][1],c=l.sliceStream(i);let u=c.length,f=-1,m=0,p;for(;u--;){const d=c[u];if(typeof d=="string"){for(f=d.length;d.charCodeAt(f-1)===32;)m++,f--;if(f)break;f=-1}else if(d===-2)p=!0,m++;else if(d!==-1){u++;break}}if(l._contentTypeTextTrailing&&r===t.length&&(m=0),m){const d={type:r===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={...d.start},i.start.offset===i.end.offset?Object.assign(i,d):(t.splice(r,0,["enter",d,l],["exit",d,l]),r+=2)}r++}return t}const k5={42:_n,43:_n,45:_n,48:_n,49:_n,50:_n,51:_n,52:_n,53:_n,54:_n,55:_n,56:_n,57:_n,62:oy},S5={91:Nw},j5={[-2]:nd,[-1]:nd,32:nd},C5={35:Rw,42:bc,45:[R1,bc],60:Bw,61:R1,95:bc,96:z1,126:z1},E5={38:uy,92:cy},N5={[-5]:ld,[-4]:ld,[-3]:ld,33:t5,38:uy,42:Id,60:[lw,qw],91:l5,92:[zw,cy],93:uh,95:Id,96:pw},A5={null:[Id,g5]},T5={null:[42,95]},D5={null:[]},z5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:T5,contentInitial:S5,disable:D5,document:k5,flow:C5,flowInitial:j5,insideSpan:A5,string:E5,text:N5},Symbol.toStringTag,{value:"Module"}));function M5(t,l,r){let i={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const c={},u=[];let f=[],m=[];const p={attempt:U(L),check:U(D),consume:A,enter:R,exit:O,interrupt:U(D,{interrupt:!0})},d={code:null,containerState:{},defineSkip:k,events:[],now:j,parser:t,previous:null,sliceSerialize:b,sliceStream:v,write:y};let g=l.tokenize.call(d,p);return l.resolveAll&&u.push(l),d;function y(q){return f=al(f,q),C(),f[f.length-1]!==null?[]:(X(l,0),d.events=Bc(u,d.events,d),d.events)}function b(q,F){return F5(v(q),F)}function v(q){return R5(f,q)}function j(){const{_bufferIndex:q,_index:F,line:W,column:ee,offset:V}=i;return{_bufferIndex:q,_index:F,line:W,column:ee,offset:V}}function k(q){c[q.line]=q.column,M()}function C(){let q;for(;i._index<f.length;){const F=f[i._index];if(typeof F=="string")for(q=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===q&&i._bufferIndex<F.length;)E(F.charCodeAt(i._bufferIndex));else E(F)}}function E(q){g=g(q)}function A(q){Ie(q)?(i.line++,i.column=1,i.offset+=q===-3?2:1,M()):q!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===f[i._index].length&&(i._bufferIndex=-1,i._index++)),d.previous=q}function R(q,F){const W=F||{};return W.type=q,W.start=j(),d.events.push(["enter",W,d]),m.push(W),W}function O(q){const F=m.pop();return F.end=j(),d.events.push(["exit",F,d]),F}function L(q,F){X(q,F.from)}function D(q,F){F.restore()}function U(q,F){return W;function W(ee,V,I){let Z,ce,we,z;return Array.isArray(ee)?Q(ee):"tokenize"in ee?Q([ee]):B(ee);function B(Ee){return Be;function Be(He){const Ke=He!==null&&Ee[He],ke=He!==null&&Ee.null,yt=[...Array.isArray(Ke)?Ke:Ke?[Ke]:[],...Array.isArray(ke)?ke:ke?[ke]:[]];return Q(yt)(He)}}function Q(Ee){return Z=Ee,ce=0,Ee.length===0?I:T(Ee[ce])}function T(Ee){return Be;function Be(He){return z=ne(),we=Ee,Ee.partial||(d.currentConstruct=Ee),Ee.name&&d.parser.constructs.disable.null.includes(Ee.name)?Se():Ee.tokenize.call(F?Object.assign(Object.create(d),F):d,p,me,Se)(He)}}function me(Ee){return q(we,z),V}function Se(Ee){return z.restore(),++ce<Z.length?T(Z[ce]):I}}}function X(q,F){q.resolveAll&&!u.includes(q)&&u.push(q),q.resolve&&Gn(d.events,F,d.events.length-F,q.resolve(d.events.slice(F),d)),q.resolveTo&&(d.events=q.resolveTo(d.events,d))}function ne(){const q=j(),F=d.previous,W=d.currentConstruct,ee=d.events.length,V=Array.from(m);return{from:ee,restore:I};function I(){i=q,d.previous=F,d.currentConstruct=W,d.events.length=ee,m=V,M()}}function M(){i.line in c&&i.column<2&&(i.column=c[i.line],i.offset+=c[i.line]-1)}}function R5(t,l){const r=l.start._index,i=l.start._bufferIndex,c=l.end._index,u=l.end._bufferIndex;let f;if(r===c)f=[t[r].slice(i,u)];else{if(f=t.slice(r,c),i>-1){const m=f[0];typeof m=="string"?f[0]=m.slice(i):f.shift()}u>0&&f.push(t[c].slice(0,u))}return f}function F5(t,l){let r=-1;const i=[];let c;for(;++r<t.length;){const u=t[r];let f;if(typeof u=="string")f=u;else switch(u){case-5:{f="\r";break}case-4:{f=`
48
+ `+s.stack}}var Me=Object.prototype.hasOwnProperty,Oe=t.unstable_scheduleCallback,tt=t.unstable_cancelCallback,Lt=t.unstable_shouldYield,gt=t.unstable_requestPaint,ht=t.unstable_now,Zt=t.unstable_getCurrentPriorityLevel,ae=t.unstable_ImmediatePriority,xe=t.unstable_UserBlockingPriority,De=t.unstable_NormalPriority,Ue=t.unstable_LowPriority,ye=t.unstable_IdlePriority,je=t.log,jt=t.unstable_setDisableYieldValue,wt=null,Xe=null;function ft(e){if(typeof je=="function"&&jt(e),Xe&&typeof Xe.setStrictMode=="function")try{Xe.setStrictMode(wt,e)}catch{}}var fe=Math.clz32?Math.clz32:mi,Mt=Math.log,it=Math.LN2;function mi(e){return e>>>=0,e===0?32:31-(Mt(e)/it|0)|0}var lr=256,wa=262144,Tl=4194304;function Dl(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 rr(e,n,a){var s=e.pendingLanes;if(s===0)return 0;var h=0,p=e.suspendedLanes,w=e.pingedLanes;e=e.warmLanes;var N=s&134217727;return N!==0?(s=N&~p,s!==0?h=Dl(s):(w&=N,w!==0?h=Dl(w):a||(a=N&~e,a!==0&&(h=Dl(a))))):(N=s&~p,N!==0?h=Dl(N):w!==0?h=Dl(w):a||(a=s&~e,a!==0&&(h=Dl(a)))),h===0?0:n!==0&&n!==h&&(n&p)===0&&(p=h&-h,a=n&-n,p>=a||p===32&&(a&4194048)!==0)?n:h}function qr(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function ka(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 Us(){var e=Tl;return Tl<<=1,(Tl&62914560)===0&&(Tl=4194304),e}function Xr(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function ar(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function xi(e,n,a,s,h,p){var w=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var N=e.entanglements,U=e.expirationTimes,P=e.hiddenUpdates;for(a=w&~a;0<a;){var ie=31-fe(a),ue=1<<ie;N[ie]=0,U[ie]=-1;var ne=P[ie];if(ne!==null)for(P[ie]=null,ie=0;ie<ne.length;ie++){var le=ne[ie];le!==null&&(le.lane&=-536870913)}a&=~ue}s!==0&&On(e,s,0),p!==0&&h===0&&e.tag!==0&&(e.suspendedLanes|=p&~(w&~n))}function On(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var s=31-fe(n);e.entangledLanes|=n,e.entanglements[s]=e.entanglements[s]|1073741824|a&261930}function Is(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var s=31-fe(a),h=1<<s;h&n|e[s]&n&&(e[s]|=n),a&=~h}}function zl(e,n){var a=n&-n;return a=(a&42)!==0?1:Vr(a),(a&(e.suspendedLanes|n))!==0?0:a}function Vr(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 ml(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ml(){var e=Z.p;return e!==0?e:(e=window.event,e===void 0?32:Wp(e.type))}function Rl(e,n){var a=Z.p;try{return Z.p=e,n()}finally{Z.p=a}}var il=Math.random().toString(36).slice(2),$t="__reactFiber$"+il,cn="__reactProps$"+il,Fl="__reactContainer$"+il,Gr="__reactEvents$"+il,Ys="__reactListeners$"+il,qs="__reactHandles$"+il,xl="__reactResources$"+il,_l="__reactMarker$"+il;function Sa(e){delete e[$t],delete e[cn],delete e[Gr],delete e[Ys],delete e[qs]}function Ol(e){var n=e[$t];if(n)return n;for(var a=e.parentNode;a;){if(n=a[Fl]||a[$t]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=Fp(e);e!==null;){if(a=e[$t])return a;e=Fp(e)}return n}e=a,a=e.parentNode}return null}function ir(e){if(e=e[$t]||e[Fl]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Bl(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(i(33))}function un(e){var n=e[xl];return n||(n=e[xl]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Ft(e){e[_l]=!0}var sr=new Set,Xs={};function Cn(e,n){Kt(e,n),Kt(e+"Capture",n)}function Kt(e,n){for(Xs[e]=n,e=0;e<n.length;e++)sr.add(n[e])}var ja=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]*$"),Kn={},or={};function pi(e){return Me.call(or,e)?!0:Me.call(Kn,e)?!1:ja.test(e)?or[e]=!0:(Kn[e]=!0,!1)}function Ca(e,n,a){if(pi(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){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,""+a)}}function pl(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function bn(e,n,a,s){if(s===null)e.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+s)}}function En(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function qt(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Vs(e,n,a){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var h=s.get,p=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return h.call(this)},set:function(w){a=""+w,p.call(this,w)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function yi(e){if(!e._valueTracker){var n=qt(e)?"checked":"value";e._valueTracker=Vs(e,n,""+e[n])}}function Gs(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),s="";return e&&(s=qt(e)?e.checked?"true":"false":e.value),e=s,e!==a?(n.setValue(e),!0):!1}function Kr(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 gi=/[\n"\\]/g;function Nn(e){return e.replace(gi,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function bi(e,n,a,s,h,p,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=""+En(n)):e.value!==""+En(n)&&(e.value=""+En(n)):w!=="submit"&&w!=="reset"||e.removeAttribute("value"),n!=null?wi(e,w,En(n)):a!=null?wi(e,w,En(a)):s!=null&&e.removeAttribute("value"),h==null&&p!=null&&(e.defaultChecked=!!p),h!=null&&(e.checked=h&&typeof h!="function"&&typeof h!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+En(N):e.removeAttribute("name")}function vi(e,n,a,s,h,p,w,N){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),n!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||n!=null)){yi(e);return}a=a!=null?""+En(a):"",n=n!=null?""+En(n):a,N||n===e.value||(e.value=n),e.defaultValue=n}s=s??h,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),yi(e)}function wi(e,n,a){n==="number"&&Kr(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function cr(e,n,a,s){if(e=e.options,n){n={};for(var h=0;h<a.length;h++)n["$"+a[h]]=!0;for(a=0;a<e.length;a++)h=n.hasOwnProperty("$"+e[a].value),e[a].selected!==h&&(e[a].selected=h),h&&s&&(e[a].defaultSelected=!0)}else{for(a=""+En(a),n=null,h=0;h<e.length;h++){if(e[h].value===a){e[h].selected=!0,s&&(e[h].defaultSelected=!0);return}n!==null||e[h].disabled||(n=e[h])}n!==null&&(n.selected=!0)}}function Ks(e,n,a){if(n!=null&&(n=""+En(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+En(a):""}function Qs(e,n,a,s){if(n==null){if(s!=null){if(a!=null)throw Error(i(92));if(V(s)){if(1<s.length)throw Error(i(93));s=s[0]}a=s}a==null&&(a=""),n=a}a=En(n),e.defaultValue=a,s=e.textContent,s===a&&s!==""&&s!==null&&(e.value=s),yi(e)}function ur(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var qc=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 Ws(e,n,a){var s=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?s?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":s?e.setProperty(n,a):typeof a!="number"||a===0||qc.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function sl(e,n,a){if(n!=null&&typeof n!="object")throw Error(i(62));if(e=e.style,a!=null){for(var s in a)!a.hasOwnProperty(s)||n!=null&&n.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var h in n)s=n[h],n.hasOwnProperty(h)&&a[h]!==s&&Ws(e,h,s)}else for(var p in n)n.hasOwnProperty(p)&&Ws(e,p,n[p])}function Ea(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 Xc=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"]]),Vc=/^[\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 Bn(e){return Vc.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Qn(){}var ki=null;function Si(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ut=null,Wn=null;function ji(e){var n=ir(e);if(n&&(e=n.stateNode)){var a=e[cn]||null;e:switch(e=n.stateNode,n.type){case"input":if(bi(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Nn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var s=a[n];if(s!==e&&s.form===e.form){var h=s[cn]||null;if(!h)throw Error(i(90));bi(s,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(n=0;n<a.length;n++)s=a[n],s.form===e.form&&Gs(s)}break e;case"textarea":Ks(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&cr(e,!!a.multiple,n,!1)}}}var Na=!1;function Ci(e,n,a){if(Na)return e(n,a);Na=!0;try{var s=e(n);return s}finally{if(Na=!1,(Ut!==null||Wn!==null)&&(_o(),Ut&&(n=Ut,e=Wn,Wn=Ut=null,ji(n),e)))for(n=0;n<e.length;n++)ji(e[n])}}function _(e,n){var a=e.stateNode;if(a===null)return null;var s=a[cn]||null;if(s===null)return null;a=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(a&&typeof a!="function")throw Error(i(231,n,typeof a));return a}var se=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),he=!1;if(se)try{var pe={};Object.defineProperty(pe,"passive",{get:function(){he=!0}}),window.addEventListener("test",pe,pe),window.removeEventListener("test",pe,pe)}catch{he=!1}var ge=null,Re=null,Le=null;function Je(){if(Le)return Le;var e,n=Re,a=n.length,s,h="value"in ge?ge.value:ge.textContent,p=h.length;for(e=0;e<a&&n[e]===h[e];e++);var w=a-e;for(s=1;s<=w&&n[a-s]===h[p-s];s++);return Le=h.slice(e,1<s?1-s:void 0)}function nt(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 Ve(){return!0}function It(){return!1}function An(e){function n(a,s,h,p,w){this._reactName=a,this._targetInst=h,this.type=s,this.nativeEvent=p,this.target=w,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(a=e[N],this[N]=a?a(p):p[N]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Ve:It,this.isPropagationStopped=It,this}return y(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Ve)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Ve)},persist:function(){},isPersistent:Ve}),n}var Qr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zs=An(Qr),Ei=y({},Qr,{view:0,detail:0}),Og=An(Ei),Gc,Kc,Ni,Js=y({},Ei,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wc,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!==Ni&&(Ni&&e.type==="mousemove"?(Gc=e.screenX-Ni.screenX,Kc=e.screenY-Ni.screenY):Kc=Gc=0,Ni=e),Gc)},movementY:function(e){return"movementY"in e?e.movementY:Kc}}),Th=An(Js),Bg=y({},Js,{dataTransfer:0}),Lg=An(Bg),$g=y({},Ei,{relatedTarget:0}),Qc=An($g),Hg=y({},Qr,{animationName:0,elapsedTime:0,pseudoElement:0}),Ug=An(Hg),Ig=y({},Qr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Yg=An(Ig),qg=y({},Qr,{data:0}),Dh=An(qg),Xg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Vg={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"},Gg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Kg(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Gg[e])?!!n[e]:!1}function Wc(){return Kg}var Qg=y({},Ei,{key:function(e){if(e.key){var n=Xg[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=nt(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Vg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wc,charCode:function(e){return e.type==="keypress"?nt(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?nt(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Wg=An(Qg),Zg=y({},Js,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zh=An(Zg),Jg=y({},Ei,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wc}),Pg=An(Jg),e2=y({},Qr,{propertyName:0,elapsedTime:0,pseudoElement:0}),t2=An(e2),n2=y({},Js,{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}),l2=An(n2),r2=y({},Qr,{newState:0,oldState:0}),a2=An(r2),i2=[9,13,27,32],Zc=se&&"CompositionEvent"in window,Ai=null;se&&"documentMode"in document&&(Ai=document.documentMode);var s2=se&&"TextEvent"in window&&!Ai,Mh=se&&(!Zc||Ai&&8<Ai&&11>=Ai),Rh=" ",Fh=!1;function _h(e,n){switch(e){case"keyup":return i2.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Oh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Aa=!1;function o2(e,n){switch(e){case"compositionend":return Oh(n);case"keypress":return n.which!==32?null:(Fh=!0,Rh);case"textInput":return e=n.data,e===Rh&&Fh?null:e;default:return null}}function c2(e,n){if(Aa)return e==="compositionend"||!Zc&&_h(e,n)?(e=Je(),Le=Re=ge=null,Aa=!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 Mh&&n.locale!=="ko"?null:n.data;default:return null}}var u2={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 Bh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!u2[e.type]:n==="textarea"}function Lh(e,n,a,s){Ut?Wn?Wn.push(s):Wn=[s]:Ut=s,n=Io(n,"onChange"),0<n.length&&(a=new Zs("onChange","change",null,a,s),e.push({event:a,listeners:n}))}var Ti=null,Di=null;function f2(e){vp(e,0)}function Ps(e){var n=Bl(e);if(Gs(n))return e}function $h(e,n){if(e==="change")return n}var Hh=!1;if(se){var Jc;if(se){var Pc="oninput"in document;if(!Pc){var Uh=document.createElement("div");Uh.setAttribute("oninput","return;"),Pc=typeof Uh.oninput=="function"}Jc=Pc}else Jc=!1;Hh=Jc&&(!document.documentMode||9<document.documentMode)}function Ih(){Ti&&(Ti.detachEvent("onpropertychange",Yh),Di=Ti=null)}function Yh(e){if(e.propertyName==="value"&&Ps(Di)){var n=[];Lh(n,Di,e,Si(e)),Ci(f2,n)}}function d2(e,n,a){e==="focusin"?(Ih(),Ti=n,Di=a,Ti.attachEvent("onpropertychange",Yh)):e==="focusout"&&Ih()}function h2(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ps(Di)}function m2(e,n){if(e==="click")return Ps(n)}function x2(e,n){if(e==="input"||e==="change")return Ps(n)}function p2(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Ln=typeof Object.is=="function"?Object.is:p2;function zi(e,n){if(Ln(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),s=Object.keys(n);if(a.length!==s.length)return!1;for(s=0;s<a.length;s++){var h=a[s];if(!Me.call(n,h)||!Ln(e[h],n[h]))return!1}return!0}function qh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xh(e,n){var a=qh(e);e=0;for(var s;a;){if(a.nodeType===3){if(s=e+a.textContent.length,e<=n&&s>=n)return{node:a,offset:n-e};e=s}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=qh(a)}}function Vh(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Vh(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Gh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Kr(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=Kr(e.document)}return n}function eu(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 y2=se&&"documentMode"in document&&11>=document.documentMode,Ta=null,tu=null,Mi=null,nu=!1;function Kh(e,n,a){var s=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;nu||Ta==null||Ta!==Kr(s)||(s=Ta,"selectionStart"in s&&eu(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}),Mi&&zi(Mi,s)||(Mi=s,s=Io(tu,"onSelect"),0<s.length&&(n=new Zs("onSelect","select",null,n,a),e.push({event:n,listeners:s}),n.target=Ta)))}function Wr(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var Da={animationend:Wr("Animation","AnimationEnd"),animationiteration:Wr("Animation","AnimationIteration"),animationstart:Wr("Animation","AnimationStart"),transitionrun:Wr("Transition","TransitionRun"),transitionstart:Wr("Transition","TransitionStart"),transitioncancel:Wr("Transition","TransitionCancel"),transitionend:Wr("Transition","TransitionEnd")},lu={},Qh={};se&&(Qh=document.createElement("div").style,"AnimationEvent"in window||(delete Da.animationend.animation,delete Da.animationiteration.animation,delete Da.animationstart.animation),"TransitionEvent"in window||delete Da.transitionend.transition);function Zr(e){if(lu[e])return lu[e];if(!Da[e])return e;var n=Da[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Qh)return lu[e]=n[a];return e}var Wh=Zr("animationend"),Zh=Zr("animationiteration"),Jh=Zr("animationstart"),g2=Zr("transitionrun"),b2=Zr("transitionstart"),v2=Zr("transitioncancel"),Ph=Zr("transitionend"),em=new Map,ru="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(" ");ru.push("scrollEnd");function ol(e,n){em.set(e,n),Cn(n,[e])}var eo=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)},Zn=[],za=0,au=0;function to(){for(var e=za,n=au=za=0;n<e;){var a=Zn[n];Zn[n++]=null;var s=Zn[n];Zn[n++]=null;var h=Zn[n];Zn[n++]=null;var p=Zn[n];if(Zn[n++]=null,s!==null&&h!==null){var w=s.pending;w===null?h.next=h:(h.next=w.next,w.next=h),s.pending=h}p!==0&&tm(a,h,p)}}function no(e,n,a,s){Zn[za++]=e,Zn[za++]=n,Zn[za++]=a,Zn[za++]=s,au|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function iu(e,n,a,s){return no(e,n,a,s),lo(e)}function Jr(e,n){return no(e,null,null,n),lo(e)}function tm(e,n,a){e.lanes|=a;var s=e.alternate;s!==null&&(s.lanes|=a);for(var h=!1,p=e.return;p!==null;)p.childLanes|=a,s=p.alternate,s!==null&&(s.childLanes|=a),p.tag===22&&(e=p.stateNode,e===null||e._visibility&1||(h=!0)),e=p,p=p.return;return e.tag===3?(p=e.stateNode,h&&n!==null&&(h=31-fe(a),e=p.hiddenUpdates,s=e[h],s===null?e[h]=[n]:s.push(n),n.lane=a|536870912),p):null}function lo(e){if(50<es)throw es=0,pf=null,Error(i(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Ma={};function w2(e,n,a,s){this.tag=e,this.key=a,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 $n(e,n,a,s){return new w2(e,n,a,s)}function su(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ll(e,n){var a=e.alternate;return a===null?(a=$n(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function nm(e,n){e.flags&=65011714;var a=e.alternate;return a===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=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function ro(e,n,a,s,h,p){var w=0;if(s=e,typeof e=="function")su(e)&&(w=1);else if(typeof e=="string")w=Eb(e,a,me.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ee:return e=$n(31,a,n,h),e.elementType=ee,e.lanes=p,e;case S:return Pr(a.children,h,p,n);case C:w=8,h|=24;break;case E:return e=$n(12,a,n,h|2),e.elementType=E,e.lanes=p,e;case L:return e=$n(13,a,n,h),e.elementType=L,e.lanes=p,e;case F:return e=$n(19,a,n,h),e.elementType=F,e.lanes=p,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case M:w=10;break e;case A:w=9;break e;case O:w=11;break e;case I:w=14;break e;case $:w=16,s=null;break e}w=29,a=Error(i(130,e===null?"null":typeof e,"")),s=null}return n=$n(w,a,n,h),n.elementType=e,n.type=s,n.lanes=p,n}function Pr(e,n,a,s){return e=$n(7,e,s,n),e.lanes=a,e}function ou(e,n,a){return e=$n(6,e,null,n),e.lanes=a,e}function lm(e){var n=$n(18,null,null,0);return n.stateNode=e,n}function cu(e,n,a){return n=$n(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var rm=new WeakMap;function Jn(e,n){if(typeof e=="object"&&e!==null){var a=rm.get(e);return a!==void 0?a:(n={value:e,source:n,stack:Te(n)},rm.set(e,n),n)}return{value:e,source:n,stack:Te(n)}}var Ra=[],Fa=0,ao=null,Ri=0,Pn=[],el=0,fr=null,yl=1,gl="";function $l(e,n){Ra[Fa++]=Ri,Ra[Fa++]=ao,ao=e,Ri=n}function am(e,n,a){Pn[el++]=yl,Pn[el++]=gl,Pn[el++]=fr,fr=e;var s=yl;e=gl;var h=32-fe(s)-1;s&=~(1<<h),a+=1;var p=32-fe(n)+h;if(30<p){var w=h-h%5;p=(s&(1<<w)-1).toString(32),s>>=w,h-=w,yl=1<<32-fe(n)+h|a<<h|s,gl=p+e}else yl=1<<p|a<<h|s,gl=e}function uu(e){e.return!==null&&($l(e,1),am(e,1,0))}function fu(e){for(;e===ao;)ao=Ra[--Fa],Ra[Fa]=null,Ri=Ra[--Fa],Ra[Fa]=null;for(;e===fr;)fr=Pn[--el],Pn[el]=null,gl=Pn[--el],Pn[el]=null,yl=Pn[--el],Pn[el]=null}function im(e,n){Pn[el++]=yl,Pn[el++]=gl,Pn[el++]=fr,yl=n.id,gl=n.overflow,fr=e}var fn=null,_t=null,ut=!1,dr=null,tl=!1,du=Error(i(519));function hr(e){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Fi(Jn(n,e)),du}function sm(e){var n=e.stateNode,a=e.type,s=e.memoizedProps;switch(n[$t]=e,n[cn]=s,a){case"dialog":rt("cancel",n),rt("close",n);break;case"iframe":case"object":case"embed":rt("load",n);break;case"video":case"audio":for(a=0;a<ns.length;a++)rt(ns[a],n);break;case"source":rt("error",n);break;case"img":case"image":case"link":rt("error",n),rt("load",n);break;case"details":rt("toggle",n);break;case"input":rt("invalid",n),vi(n,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":rt("invalid",n);break;case"textarea":rt("invalid",n),Qs(n,s.value,s.defaultValue,s.children)}a=s.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||s.suppressHydrationWarning===!0||jp(n.textContent,a)?(s.popover!=null&&(rt("beforetoggle",n),rt("toggle",n)),s.onScroll!=null&&rt("scroll",n),s.onScrollEnd!=null&&rt("scrollend",n),s.onClick!=null&&(n.onclick=Qn),n=!0):n=!1,n||hr(e,!0)}function om(e){for(fn=e.return;fn;)switch(fn.tag){case 5:case 31:case 13:tl=!1;return;case 27:case 3:tl=!0;return;default:fn=fn.return}}function _a(e){if(e!==fn)return!1;if(!ut)return om(e),ut=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||zf(e.type,e.memoizedProps)),a=!a),a&&_t&&hr(e),om(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));_t=Rp(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));_t=Rp(e)}else n===27?(n=_t,Nr(e.type)?(e=Of,Of=null,_t=e):_t=n):_t=fn?ll(e.stateNode.nextSibling):null;return!0}function ea(){_t=fn=null,ut=!1}function hu(){var e=dr;return e!==null&&(Mn===null?Mn=e:Mn.push.apply(Mn,e),dr=null),e}function Fi(e){dr===null?dr=[e]:dr.push(e)}var mu=B(null),ta=null,Hl=null;function mr(e,n,a){T(mu,n._currentValue),n._currentValue=a}function Ul(e){e._currentValue=mu.current,Q(mu)}function xu(e,n,a){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===a)break;e=e.return}}function pu(e,n,a,s){var h=e.child;for(h!==null&&(h.return=e);h!==null;){var p=h.dependencies;if(p!==null){var w=h.child;p=p.firstContext;e:for(;p!==null;){var N=p;p=h;for(var U=0;U<n.length;U++)if(N.context===n[U]){p.lanes|=a,N=p.alternate,N!==null&&(N.lanes|=a),xu(p.return,a,e),s||(w=null);break e}p=N.next}}else if(h.tag===18){if(w=h.return,w===null)throw Error(i(341));w.lanes|=a,p=w.alternate,p!==null&&(p.lanes|=a),xu(w,a,e),w=null}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===e){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}}function Oa(e,n,a,s){e=null;for(var h=n,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var w=h.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var N=h.type;Ln(h.pendingProps.value,w.value)||(e!==null?e.push(N):e=[N])}}else if(h===Be.current){if(w=h.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(e!==null?e.push(ss):e=[ss])}h=h.return}e!==null&&pu(n,e,a,s),n.flags|=262144}function io(e){for(e=e.firstContext;e!==null;){if(!Ln(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function na(e){ta=e,Hl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function dn(e){return cm(ta,e)}function so(e,n){return ta===null&&na(e),cm(e,n)}function cm(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Hl===null){if(e===null)throw Error(i(308));Hl=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Hl=Hl.next=n;return a}var k2=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,s){e.push(s)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},S2=t.unstable_scheduleCallback,j2=t.unstable_NormalPriority,Jt={$$typeof:M,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function yu(){return{controller:new k2,data:new Map,refCount:0}}function _i(e){e.refCount--,e.refCount===0&&S2(j2,function(){e.controller.abort()})}var Oi=null,gu=0,Ba=0,La=null;function C2(e,n){if(Oi===null){var a=Oi=[];gu=0,Ba=kf(),La={status:"pending",value:void 0,then:function(s){a.push(s)}}}return gu++,n.then(um,um),n}function um(){if(--gu===0&&Oi!==null){La!==null&&(La.status="fulfilled");var e=Oi;Oi=null,Ba=0,La=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function E2(e,n){var a=[],s={status:"pending",value:null,reason:null,then:function(h){a.push(h)}};return e.then(function(){s.status="fulfilled",s.value=n;for(var h=0;h<a.length;h++)(0,a[h])(n)},function(h){for(s.status="rejected",s.reason=h,h=0;h<a.length;h++)(0,a[h])(void 0)}),s}var fm=Y.S;Y.S=function(e,n){Kx=ht(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&C2(e,n),fm!==null&&fm(e,n)};var la=B(null);function bu(){var e=la.current;return e!==null?e:Tt.pooledCache}function oo(e,n){n===null?T(la,la.current):T(la,n.pool)}function dm(){var e=bu();return e===null?null:{parent:Jt._currentValue,pool:e}}var $a=Error(i(460)),vu=Error(i(474)),co=Error(i(542)),uo={then:function(){}};function hm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function mm(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(Qn,Qn),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,pm(e),e;default:if(typeof n.status=="string")n.then(Qn,Qn);else{if(e=Tt,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=n,e.status="pending",e.then(function(s){if(n.status==="pending"){var h=n;h.status="fulfilled",h.value=s}},function(s){if(n.status==="pending"){var h=n;h.status="rejected",h.reason=s}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,pm(e),e}throw aa=n,$a}}function ra(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(aa=a,$a):a}}var aa=null;function xm(){if(aa===null)throw Error(i(459));var e=aa;return aa=null,e}function pm(e){if(e===$a||e===co)throw Error(i(483))}var Ha=null,Bi=0;function fo(e){var n=Bi;return Bi+=1,Ha===null&&(Ha=[]),mm(Ha,e,n)}function Li(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function ho(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 ym(e){function n(K,q){if(e){var J=K.deletions;J===null?(K.deletions=[q],K.flags|=16):J.push(q)}}function a(K,q){if(!e)return null;for(;q!==null;)n(K,q),q=q.sibling;return null}function s(K){for(var q=new Map;K!==null;)K.key!==null?q.set(K.key,K):q.set(K.index,K),K=K.sibling;return q}function h(K,q){return K=Ll(K,q),K.index=0,K.sibling=null,K}function p(K,q,J){return K.index=J,e?(J=K.alternate,J!==null?(J=J.index,J<q?(K.flags|=67108866,q):J):(K.flags|=67108866,q)):(K.flags|=1048576,q)}function w(K){return e&&K.alternate===null&&(K.flags|=67108866),K}function N(K,q,J,oe){return q===null||q.tag!==6?(q=ou(J,K.mode,oe),q.return=K,q):(q=h(q,J),q.return=K,q)}function U(K,q,J,oe){var $e=J.type;return $e===S?ie(K,q,J.props.children,oe,J.key):q!==null&&(q.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===$&&ra($e)===q.type)?(q=h(q,J.props),Li(q,J),q.return=K,q):(q=ro(J.type,J.key,J.props,null,K.mode,oe),Li(q,J),q.return=K,q)}function P(K,q,J,oe){return q===null||q.tag!==4||q.stateNode.containerInfo!==J.containerInfo||q.stateNode.implementation!==J.implementation?(q=cu(J,K.mode,oe),q.return=K,q):(q=h(q,J.children||[]),q.return=K,q)}function ie(K,q,J,oe,$e){return q===null||q.tag!==7?(q=Pr(J,K.mode,oe,$e),q.return=K,q):(q=h(q,J),q.return=K,q)}function ue(K,q,J){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=ou(""+q,K.mode,J),q.return=K,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case v:return J=ro(q.type,q.key,q.props,null,K.mode,J),Li(J,q),J.return=K,J;case j:return q=cu(q,K.mode,J),q.return=K,q;case $:return q=ra(q),ue(K,q,J)}if(V(q)||R(q))return q=Pr(q,K.mode,J,null),q.return=K,q;if(typeof q.then=="function")return ue(K,fo(q),J);if(q.$$typeof===M)return ue(K,so(K,q),J);ho(K,q)}return null}function ne(K,q,J,oe){var $e=q!==null?q.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return $e!==null?null:N(K,q,""+J,oe);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case v:return J.key===$e?U(K,q,J,oe):null;case j:return J.key===$e?P(K,q,J,oe):null;case $:return J=ra(J),ne(K,q,J,oe)}if(V(J)||R(J))return $e!==null?null:ie(K,q,J,oe,null);if(typeof J.then=="function")return ne(K,q,fo(J),oe);if(J.$$typeof===M)return ne(K,q,so(K,J),oe);ho(K,J)}return null}function le(K,q,J,oe,$e){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return K=K.get(J)||null,N(q,K,""+oe,$e);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case v:return K=K.get(oe.key===null?J:oe.key)||null,U(q,K,oe,$e);case j:return K=K.get(oe.key===null?J:oe.key)||null,P(q,K,oe,$e);case $:return oe=ra(oe),le(K,q,J,oe,$e)}if(V(oe)||R(oe))return K=K.get(J)||null,ie(q,K,oe,$e,null);if(typeof oe.then=="function")return le(K,q,J,fo(oe),$e);if(oe.$$typeof===M)return le(K,q,J,so(q,oe),$e);ho(q,oe)}return null}function Ae(K,q,J,oe){for(var $e=null,mt=null,Fe=q,We=q=0,ot=null;Fe!==null&&We<J.length;We++){Fe.index>We?(ot=Fe,Fe=null):ot=Fe.sibling;var xt=ne(K,Fe,J[We],oe);if(xt===null){Fe===null&&(Fe=ot);break}e&&Fe&&xt.alternate===null&&n(K,Fe),q=p(xt,q,We),mt===null?$e=xt:mt.sibling=xt,mt=xt,Fe=ot}if(We===J.length)return a(K,Fe),ut&&$l(K,We),$e;if(Fe===null){for(;We<J.length;We++)Fe=ue(K,J[We],oe),Fe!==null&&(q=p(Fe,q,We),mt===null?$e=Fe:mt.sibling=Fe,mt=Fe);return ut&&$l(K,We),$e}for(Fe=s(Fe);We<J.length;We++)ot=le(Fe,K,We,J[We],oe),ot!==null&&(e&&ot.alternate!==null&&Fe.delete(ot.key===null?We:ot.key),q=p(ot,q,We),mt===null?$e=ot:mt.sibling=ot,mt=ot);return e&&Fe.forEach(function(Mr){return n(K,Mr)}),ut&&$l(K,We),$e}function Ye(K,q,J,oe){if(J==null)throw Error(i(151));for(var $e=null,mt=null,Fe=q,We=q=0,ot=null,xt=J.next();Fe!==null&&!xt.done;We++,xt=J.next()){Fe.index>We?(ot=Fe,Fe=null):ot=Fe.sibling;var Mr=ne(K,Fe,xt.value,oe);if(Mr===null){Fe===null&&(Fe=ot);break}e&&Fe&&Mr.alternate===null&&n(K,Fe),q=p(Mr,q,We),mt===null?$e=Mr:mt.sibling=Mr,mt=Mr,Fe=ot}if(xt.done)return a(K,Fe),ut&&$l(K,We),$e;if(Fe===null){for(;!xt.done;We++,xt=J.next())xt=ue(K,xt.value,oe),xt!==null&&(q=p(xt,q,We),mt===null?$e=xt:mt.sibling=xt,mt=xt);return ut&&$l(K,We),$e}for(Fe=s(Fe);!xt.done;We++,xt=J.next())xt=le(Fe,K,We,xt.value,oe),xt!==null&&(e&&xt.alternate!==null&&Fe.delete(xt.key===null?We:xt.key),q=p(xt,q,We),mt===null?$e=xt:mt.sibling=xt,mt=xt);return e&&Fe.forEach(function(Bb){return n(K,Bb)}),ut&&$l(K,We),$e}function Nt(K,q,J,oe){if(typeof J=="object"&&J!==null&&J.type===S&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case v:e:{for(var $e=J.key;q!==null;){if(q.key===$e){if($e=J.type,$e===S){if(q.tag===7){a(K,q.sibling),oe=h(q,J.props.children),oe.return=K,K=oe;break e}}else if(q.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===$&&ra($e)===q.type){a(K,q.sibling),oe=h(q,J.props),Li(oe,J),oe.return=K,K=oe;break e}a(K,q);break}else n(K,q);q=q.sibling}J.type===S?(oe=Pr(J.props.children,K.mode,oe,J.key),oe.return=K,K=oe):(oe=ro(J.type,J.key,J.props,null,K.mode,oe),Li(oe,J),oe.return=K,K=oe)}return w(K);case j:e:{for($e=J.key;q!==null;){if(q.key===$e)if(q.tag===4&&q.stateNode.containerInfo===J.containerInfo&&q.stateNode.implementation===J.implementation){a(K,q.sibling),oe=h(q,J.children||[]),oe.return=K,K=oe;break e}else{a(K,q);break}else n(K,q);q=q.sibling}oe=cu(J,K.mode,oe),oe.return=K,K=oe}return w(K);case $:return J=ra(J),Nt(K,q,J,oe)}if(V(J))return Ae(K,q,J,oe);if(R(J)){if($e=R(J),typeof $e!="function")throw Error(i(150));return J=$e.call(J),Ye(K,q,J,oe)}if(typeof J.then=="function")return Nt(K,q,fo(J),oe);if(J.$$typeof===M)return Nt(K,q,so(K,J),oe);ho(K,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,q!==null&&q.tag===6?(a(K,q.sibling),oe=h(q,J),oe.return=K,K=oe):(a(K,q),oe=ou(J,K.mode,oe),oe.return=K,K=oe),w(K)):a(K,q)}return function(K,q,J,oe){try{Bi=0;var $e=Nt(K,q,J,oe);return Ha=null,$e}catch(Fe){if(Fe===$a||Fe===co)throw Fe;var mt=$n(29,Fe,null,K.mode);return mt.lanes=oe,mt.return=K,mt}finally{}}}var ia=ym(!0),gm=ym(!1),xr=!1;function wu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ku(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 pr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function yr(e,n,a){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(bt&2)!==0){var h=s.pending;return h===null?n.next=n:(n.next=h.next,h.next=n),s.pending=n,n=lo(e),tm(e,null,a),n}return no(e,s,n,a),lo(e)}function $i(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var s=n.lanes;s&=e.pendingLanes,a|=s,n.lanes=a,Is(e,a)}}function Su(e,n){var a=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,a===s)){var h=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?h=p=w:p=p.next=w,a=a.next}while(a!==null);p===null?h=p=n:p=p.next=n}else h=p=n;a={baseState:s.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:s.shared,callbacks:s.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var ju=!1;function Hi(){if(ju){var e=La;if(e!==null)throw e}}function Ui(e,n,a,s){ju=!1;var h=e.updateQueue;xr=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,N=h.shared.pending;if(N!==null){h.shared.pending=null;var U=N,P=U.next;U.next=null,w===null?p=P:w.next=P,w=U;var ie=e.alternate;ie!==null&&(ie=ie.updateQueue,N=ie.lastBaseUpdate,N!==w&&(N===null?ie.firstBaseUpdate=P:N.next=P,ie.lastBaseUpdate=U))}if(p!==null){var ue=h.baseState;w=0,ie=P=U=null,N=p;do{var ne=N.lane&-536870913,le=ne!==N.lane;if(le?(st&ne)===ne:(s&ne)===ne){ne!==0&&ne===Ba&&(ju=!0),ie!==null&&(ie=ie.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Ae=e,Ye=N;ne=n;var Nt=a;switch(Ye.tag){case 1:if(Ae=Ye.payload,typeof Ae=="function"){ue=Ae.call(Nt,ue,ne);break e}ue=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=Ye.payload,ne=typeof Ae=="function"?Ae.call(Nt,ue,ne):Ae,ne==null)break e;ue=y({},ue,ne);break e;case 2:xr=!0}}ne=N.callback,ne!==null&&(e.flags|=64,le&&(e.flags|=8192),le=h.callbacks,le===null?h.callbacks=[ne]:le.push(ne))}else le={lane:ne,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ie===null?(P=ie=le,U=ue):ie=ie.next=le,w|=ne;if(N=N.next,N===null){if(N=h.shared.pending,N===null)break;le=N,N=le.next,le.next=null,h.lastBaseUpdate=le,h.shared.pending=null}}while(!0);ie===null&&(U=ue),h.baseState=U,h.firstBaseUpdate=P,h.lastBaseUpdate=ie,p===null&&(h.shared.lanes=0),kr|=w,e.lanes=w,e.memoizedState=ue}}function bm(e,n){if(typeof e!="function")throw Error(i(191,e));e.call(n)}function vm(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)bm(a[e],n)}var Ua=B(null),mo=B(0);function wm(e,n){e=Wl,T(mo,e),T(Ua,n),Wl=e|n.baseLanes}function Cu(){T(mo,Wl),T(Ua,Ua.current)}function Eu(){Wl=mo.current,Q(Ua),Q(mo)}var Hn=B(null),nl=null;function gr(e){var n=e.alternate;T(Qt,Qt.current&1),T(Hn,e),nl===null&&(n===null||Ua.current!==null||n.memoizedState!==null)&&(nl=e)}function Nu(e){T(Qt,Qt.current),T(Hn,e),nl===null&&(nl=e)}function km(e){e.tag===22?(T(Qt,Qt.current),T(Hn,e),nl===null&&(nl=e)):br()}function br(){T(Qt,Qt.current),T(Hn,Hn.current)}function Un(e){Q(Hn),nl===e&&(nl=null),Q(Qt)}var Qt=B(0);function xo(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Ff(a)||_f(a)))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 Il=0,Qe=null,Ct=null,Pt=null,po=!1,Ia=!1,sa=!1,yo=0,Ii=0,Ya=null,N2=0;function Xt(){throw Error(i(321))}function Au(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!Ln(e[a],n[a]))return!1;return!0}function Tu(e,n,a,s,h,p){return Il=p,Qe=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,Y.H=e===null||e.memoizedState===null?ax:qu,sa=!1,p=a(s,h),sa=!1,Ia&&(p=jm(n,a,s,h)),Sm(e),p}function Sm(e){Y.H=Xi;var n=Ct!==null&&Ct.next!==null;if(Il=0,Pt=Ct=Qe=null,po=!1,Ii=0,Ya=null,n)throw Error(i(300));e===null||en||(e=e.dependencies,e!==null&&io(e)&&(en=!0))}function jm(e,n,a,s){Qe=e;var h=0;do{if(Ia&&(Ya=null),Ii=0,Ia=!1,25<=h)throw Error(i(301));if(h+=1,Pt=Ct=null,e.updateQueue!=null){var p=e.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}Y.H=ix,p=n(a,s)}while(Ia);return p}function A2(){var e=Y.H,n=e.useState()[0];return n=typeof n.then=="function"?Yi(n):n,e=e.useState()[0],(Ct!==null?Ct.memoizedState:null)!==e&&(Qe.flags|=1024),n}function Du(){var e=yo!==0;return yo=0,e}function zu(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function Mu(e){if(po){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}po=!1}Il=0,Pt=Ct=Qe=null,Ia=!1,Ii=yo=0,Ya=null}function vn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pt===null?Qe.memoizedState=Pt=e:Pt=Pt.next=e,Pt}function Wt(){if(Ct===null){var e=Qe.alternate;e=e!==null?e.memoizedState:null}else e=Ct.next;var n=Pt===null?Qe.memoizedState:Pt.next;if(n!==null)Pt=n,Ct=e;else{if(e===null)throw Qe.alternate===null?Error(i(467)):Error(i(310));Ct=e,e={memoizedState:Ct.memoizedState,baseState:Ct.baseState,baseQueue:Ct.baseQueue,queue:Ct.queue,next:null},Pt===null?Qe.memoizedState=Pt=e:Pt=Pt.next=e}return Pt}function go(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Yi(e){var n=Ii;return Ii+=1,Ya===null&&(Ya=[]),e=mm(Ya,e,n),n=Qe,(Pt===null?n.memoizedState:Pt.next)===null&&(n=n.alternate,Y.H=n===null||n.memoizedState===null?ax:qu),e}function bo(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Yi(e);if(e.$$typeof===M)return dn(e)}throw Error(i(438,String(e)))}function Ru(e){var n=null,a=Qe.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var s=Qe.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(n={data:s.data.map(function(h){return h.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=go(),Qe.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),s=0;s<e;s++)a[s]=z;return n.index++,a}function Yl(e,n){return typeof n=="function"?n(e):n}function vo(e){var n=Wt();return Fu(n,Ct,e)}function Fu(e,n,a){var s=e.queue;if(s===null)throw Error(i(311));s.lastRenderedReducer=a;var h=e.baseQueue,p=s.pending;if(p!==null){if(h!==null){var w=h.next;h.next=p.next,p.next=w}n.baseQueue=h=p,s.pending=null}if(p=e.baseState,h===null)e.memoizedState=p;else{n=h.next;var N=w=null,U=null,P=n,ie=!1;do{var ue=P.lane&-536870913;if(ue!==P.lane?(st&ue)===ue:(Il&ue)===ue){var ne=P.revertLane;if(ne===0)U!==null&&(U=U.next={lane:0,revertLane:0,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),ue===Ba&&(ie=!0);else if((Il&ne)===ne){P=P.next,ne===Ba&&(ie=!0);continue}else ue={lane:0,revertLane:P.revertLane,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},U===null?(N=U=ue,w=p):U=U.next=ue,Qe.lanes|=ne,kr|=ne;ue=P.action,sa&&a(p,ue),p=P.hasEagerState?P.eagerState:a(p,ue)}else ne={lane:ue,revertLane:P.revertLane,gesture:P.gesture,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},U===null?(N=U=ne,w=p):U=U.next=ne,Qe.lanes|=ue,kr|=ue;P=P.next}while(P!==null&&P!==n);if(U===null?w=p:U.next=N,!Ln(p,e.memoizedState)&&(en=!0,ie&&(a=La,a!==null)))throw a;e.memoizedState=p,e.baseState=w,e.baseQueue=U,s.lastRenderedState=p}return h===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function _u(e){var n=Wt(),a=n.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=e;var s=a.dispatch,h=a.pending,p=n.memoizedState;if(h!==null){a.pending=null;var w=h=h.next;do p=e(p,w.action),w=w.next;while(w!==h);Ln(p,n.memoizedState)||(en=!0),n.memoizedState=p,n.baseQueue===null&&(n.baseState=p),a.lastRenderedState=p}return[p,s]}function Cm(e,n,a){var s=Qe,h=Wt(),p=ut;if(p){if(a===void 0)throw Error(i(407));a=a()}else a=n();var w=!Ln((Ct||h).memoizedState,a);if(w&&(h.memoizedState=a,en=!0),h=h.queue,Lu(Am.bind(null,s,h,e),[e]),h.getSnapshot!==n||w||Pt!==null&&Pt.memoizedState.tag&1){if(s.flags|=2048,qa(9,{destroy:void 0},Nm.bind(null,s,h,a,n),null),Tt===null)throw Error(i(349));p||(Il&127)!==0||Em(s,n,a)}return a}function Em(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Qe.updateQueue,n===null?(n=go(),Qe.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function Nm(e,n,a,s){n.value=a,n.getSnapshot=s,Tm(n)&&Dm(e)}function Am(e,n,a){return a(function(){Tm(n)&&Dm(e)})}function Tm(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!Ln(e,a)}catch{return!0}}function Dm(e){var n=Jr(e,2);n!==null&&Rn(n,e,2)}function Ou(e){var n=vn();if(typeof e=="function"){var a=e;if(e=a(),sa){ft(!0);try{a()}finally{ft(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yl,lastRenderedState:e},n}function zm(e,n,a,s){return e.baseState=a,Fu(e,Ct,typeof s=="function"?s:Yl)}function T2(e,n,a,s,h){if(So(e))throw Error(i(485));if(e=n.action,e!==null){var p={payload:h,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){p.listeners.push(w)}};Y.T!==null?a(!0):p.isTransition=!1,s(p),a=n.pending,a===null?(p.next=n.pending=p,Mm(n,p)):(p.next=a.next,n.pending=a.next=p)}}function Mm(e,n){var a=n.action,s=n.payload,h=e.state;if(n.isTransition){var p=Y.T,w={};Y.T=w;try{var N=a(h,s),U=Y.S;U!==null&&U(w,N),Rm(e,n,N)}catch(P){Bu(e,n,P)}finally{p!==null&&w.types!==null&&(p.types=w.types),Y.T=p}}else try{p=a(h,s),Rm(e,n,p)}catch(P){Bu(e,n,P)}}function Rm(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(s){Fm(e,n,s)},function(s){return Bu(e,n,s)}):Fm(e,n,a)}function Fm(e,n,a){n.status="fulfilled",n.value=a,_m(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,Mm(e,a)))}function Bu(e,n,a){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do n.status="rejected",n.reason=a,_m(n),n=n.next;while(n!==s)}e.action=null}function _m(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Om(e,n){return n}function Bm(e,n){if(ut){var a=Tt.formState;if(a!==null){e:{var s=Qe;if(ut){if(_t){t:{for(var h=_t,p=tl;h.nodeType!==8;){if(!p){h=null;break t}if(h=ll(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){_t=ll(h.nextSibling),s=h.data==="F!";break e}}hr(s)}s=!1}s&&(n=a[0])}}return a=vn(),a.memoizedState=a.baseState=n,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Om,lastRenderedState:n},a.queue=s,a=nx.bind(null,Qe,s),s.dispatch=a,s=Ou(!1),p=Yu.bind(null,Qe,!1,s.queue),s=vn(),h={state:n,dispatch:null,action:e,pending:null},s.queue=h,a=T2.bind(null,Qe,h,p,a),h.dispatch=a,s.memoizedState=e,[n,a,!1]}function Lm(e){var n=Wt();return $m(n,Ct,e)}function $m(e,n,a){if(n=Fu(e,n,Om)[0],e=vo(Yl)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var s=Yi(n)}catch(w){throw w===$a?co:w}else s=n;n=Wt();var h=n.queue,p=h.dispatch;return a!==n.memoizedState&&(Qe.flags|=2048,qa(9,{destroy:void 0},D2.bind(null,h,a),null)),[s,p,e]}function D2(e,n){e.action=n}function Hm(e){var n=Wt(),a=Ct;if(a!==null)return $m(n,a,e);Wt(),n=n.memoizedState,a=Wt();var s=a.queue.dispatch;return a.memoizedState=e,[n,s,!1]}function qa(e,n,a,s){return e={tag:e,create:a,deps:s,inst:n,next:null},n=Qe.updateQueue,n===null&&(n=go(),Qe.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(s=a.next,a.next=e,e.next=s,n.lastEffect=e),e}function Um(){return Wt().memoizedState}function wo(e,n,a,s){var h=vn();Qe.flags|=e,h.memoizedState=qa(1|n,{destroy:void 0},a,s===void 0?null:s)}function ko(e,n,a,s){var h=Wt();s=s===void 0?null:s;var p=h.memoizedState.inst;Ct!==null&&s!==null&&Au(s,Ct.memoizedState.deps)?h.memoizedState=qa(n,p,a,s):(Qe.flags|=e,h.memoizedState=qa(1|n,p,a,s))}function Im(e,n){wo(8390656,8,e,n)}function Lu(e,n){ko(2048,8,e,n)}function z2(e){Qe.flags|=4;var n=Qe.updateQueue;if(n===null)n=go(),Qe.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function Ym(e){var n=Wt().memoizedState;return z2({ref:n,nextImpl:e}),function(){if((bt&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function qm(e,n){return ko(4,2,e,n)}function Xm(e,n){return ko(4,4,e,n)}function Vm(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Gm(e,n,a){a=a!=null?a.concat([e]):null,ko(4,4,Vm.bind(null,n,e),a)}function $u(){}function Km(e,n){var a=Wt();n=n===void 0?null:n;var s=a.memoizedState;return n!==null&&Au(n,s[1])?s[0]:(a.memoizedState=[e,n],e)}function Qm(e,n){var a=Wt();n=n===void 0?null:n;var s=a.memoizedState;if(n!==null&&Au(n,s[1]))return s[0];if(s=e(),sa){ft(!0);try{e()}finally{ft(!1)}}return a.memoizedState=[s,n],s}function Hu(e,n,a){return a===void 0||(Il&1073741824)!==0&&(st&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Wx(),Qe.lanes|=e,kr|=e,a)}function Wm(e,n,a,s){return Ln(a,n)?a:Ua.current!==null?(e=Hu(e,a,s),Ln(e,n)||(en=!0),e):(Il&42)===0||(Il&1073741824)!==0&&(st&261930)===0?(en=!0,e.memoizedState=a):(e=Wx(),Qe.lanes|=e,kr|=e,n)}function Zm(e,n,a,s,h){var p=Z.p;Z.p=p!==0&&8>p?p:8;var w=Y.T,N={};Y.T=N,Yu(e,!1,n,a);try{var U=h(),P=Y.S;if(P!==null&&P(N,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var ie=E2(U,s);qi(e,n,ie,qn(e))}else qi(e,n,s,qn(e))}catch(ue){qi(e,n,{then:function(){},status:"rejected",reason:ue},qn())}finally{Z.p=p,w!==null&&N.types!==null&&(w.types=N.types),Y.T=w}}function M2(){}function Uu(e,n,a,s){if(e.tag!==5)throw Error(i(476));var h=Jm(e).queue;Zm(e,h,n,ce,a===null?M2:function(){return Pm(e),a(s)})}function Jm(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yl,lastRenderedState:ce},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yl,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Pm(e){var n=Jm(e);n.next===null&&(n=e.alternate.memoizedState),qi(e,n.next.queue,{},qn())}function Iu(){return dn(ss)}function ex(){return Wt().memoizedState}function tx(){return Wt().memoizedState}function R2(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=qn();e=pr(a);var s=yr(n,e,a);s!==null&&(Rn(s,n,a),$i(s,n,a)),n={cache:yu()},e.payload=n;return}n=n.return}}function F2(e,n,a){var s=qn();a={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},So(e)?lx(n,a):(a=iu(e,n,a,s),a!==null&&(Rn(a,e,s),rx(a,n,s)))}function nx(e,n,a){var s=qn();qi(e,n,a,s)}function qi(e,n,a,s){var h={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(So(e))lx(n,h);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var w=n.lastRenderedState,N=p(w,a);if(h.hasEagerState=!0,h.eagerState=N,Ln(N,w))return no(e,n,h,0),Tt===null&&to(),!1}catch{}finally{}if(a=iu(e,n,h,s),a!==null)return Rn(a,e,s),rx(a,n,s),!0}return!1}function Yu(e,n,a,s){if(s={lane:2,revertLane:kf(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},So(e)){if(n)throw Error(i(479))}else n=iu(e,a,s,2),n!==null&&Rn(n,e,2)}function So(e){var n=e.alternate;return e===Qe||n!==null&&n===Qe}function lx(e,n){Ia=po=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function rx(e,n,a){if((a&4194048)!==0){var s=n.lanes;s&=e.pendingLanes,a|=s,n.lanes=a,Is(e,a)}}var Xi={readContext:dn,use:bo,useCallback:Xt,useContext:Xt,useEffect:Xt,useImperativeHandle:Xt,useLayoutEffect:Xt,useInsertionEffect:Xt,useMemo:Xt,useReducer:Xt,useRef:Xt,useState:Xt,useDebugValue:Xt,useDeferredValue:Xt,useTransition:Xt,useSyncExternalStore:Xt,useId:Xt,useHostTransitionStatus:Xt,useFormState:Xt,useActionState:Xt,useOptimistic:Xt,useMemoCache:Xt,useCacheRefresh:Xt};Xi.useEffectEvent=Xt;var ax={readContext:dn,use:bo,useCallback:function(e,n){return vn().memoizedState=[e,n===void 0?null:n],e},useContext:dn,useEffect:Im,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,wo(4194308,4,Vm.bind(null,n,e),a)},useLayoutEffect:function(e,n){return wo(4194308,4,e,n)},useInsertionEffect:function(e,n){wo(4,2,e,n)},useMemo:function(e,n){var a=vn();n=n===void 0?null:n;var s=e();if(sa){ft(!0);try{e()}finally{ft(!1)}}return a.memoizedState=[s,n],s},useReducer:function(e,n,a){var s=vn();if(a!==void 0){var h=a(n);if(sa){ft(!0);try{a(n)}finally{ft(!1)}}}else h=n;return s.memoizedState=s.baseState=h,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:h},s.queue=e,e=e.dispatch=F2.bind(null,Qe,e),[s.memoizedState,e]},useRef:function(e){var n=vn();return e={current:e},n.memoizedState=e},useState:function(e){e=Ou(e);var n=e.queue,a=nx.bind(null,Qe,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:$u,useDeferredValue:function(e,n){var a=vn();return Hu(a,e,n)},useTransition:function(){var e=Ou(!1);return e=Zm.bind(null,Qe,e.queue,!0,!1),vn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var s=Qe,h=vn();if(ut){if(a===void 0)throw Error(i(407));a=a()}else{if(a=n(),Tt===null)throw Error(i(349));(st&127)!==0||Em(s,n,a)}h.memoizedState=a;var p={value:a,getSnapshot:n};return h.queue=p,Im(Am.bind(null,s,p,e),[e]),s.flags|=2048,qa(9,{destroy:void 0},Nm.bind(null,s,p,a,n),null),a},useId:function(){var e=vn(),n=Tt.identifierPrefix;if(ut){var a=gl,s=yl;a=(s&~(1<<32-fe(s)-1)).toString(32)+a,n="_"+n+"R_"+a,a=yo++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=N2++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Iu,useFormState:Bm,useActionState:Bm,useOptimistic:function(e){var n=vn();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Yu.bind(null,Qe,!0,a),a.dispatch=n,[e,n]},useMemoCache:Ru,useCacheRefresh:function(){return vn().memoizedState=R2.bind(null,Qe)},useEffectEvent:function(e){var n=vn(),a={impl:e};return n.memoizedState=a,function(){if((bt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},qu={readContext:dn,use:bo,useCallback:Km,useContext:dn,useEffect:Lu,useImperativeHandle:Gm,useInsertionEffect:qm,useLayoutEffect:Xm,useMemo:Qm,useReducer:vo,useRef:Um,useState:function(){return vo(Yl)},useDebugValue:$u,useDeferredValue:function(e,n){var a=Wt();return Wm(a,Ct.memoizedState,e,n)},useTransition:function(){var e=vo(Yl)[0],n=Wt().memoizedState;return[typeof e=="boolean"?e:Yi(e),n]},useSyncExternalStore:Cm,useId:ex,useHostTransitionStatus:Iu,useFormState:Lm,useActionState:Lm,useOptimistic:function(e,n){var a=Wt();return zm(a,Ct,e,n)},useMemoCache:Ru,useCacheRefresh:tx};qu.useEffectEvent=Ym;var ix={readContext:dn,use:bo,useCallback:Km,useContext:dn,useEffect:Lu,useImperativeHandle:Gm,useInsertionEffect:qm,useLayoutEffect:Xm,useMemo:Qm,useReducer:_u,useRef:Um,useState:function(){return _u(Yl)},useDebugValue:$u,useDeferredValue:function(e,n){var a=Wt();return Ct===null?Hu(a,e,n):Wm(a,Ct.memoizedState,e,n)},useTransition:function(){var e=_u(Yl)[0],n=Wt().memoizedState;return[typeof e=="boolean"?e:Yi(e),n]},useSyncExternalStore:Cm,useId:ex,useHostTransitionStatus:Iu,useFormState:Hm,useActionState:Hm,useOptimistic:function(e,n){var a=Wt();return Ct!==null?zm(a,Ct,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Ru,useCacheRefresh:tx};ix.useEffectEvent=Ym;function Xu(e,n,a,s){n=e.memoizedState,a=a(s,n),a=a==null?n:y({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Vu={enqueueSetState:function(e,n,a){e=e._reactInternals;var s=qn(),h=pr(s);h.payload=n,a!=null&&(h.callback=a),n=yr(e,h,s),n!==null&&(Rn(n,e,s),$i(n,e,s))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var s=qn(),h=pr(s);h.tag=1,h.payload=n,a!=null&&(h.callback=a),n=yr(e,h,s),n!==null&&(Rn(n,e,s),$i(n,e,s))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=qn(),s=pr(a);s.tag=2,n!=null&&(s.callback=n),n=yr(e,s,a),n!==null&&(Rn(n,e,a),$i(n,e,a))}};function sx(e,n,a,s,h,p,w){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,p,w):n.prototype&&n.prototype.isPureReactComponent?!zi(a,s)||!zi(h,p):!0}function ox(e,n,a,s){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,s),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,s),n.state!==e&&Vu.enqueueReplaceState(n,n.state,null)}function oa(e,n){var a=n;if("ref"in n){a={};for(var s in n)s!=="ref"&&(a[s]=n[s])}if(e=e.defaultProps){a===n&&(a=y({},a));for(var h in e)a[h]===void 0&&(a[h]=e[h])}return a}function cx(e){eo(e)}function ux(e){console.error(e)}function fx(e){eo(e)}function jo(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(s){setTimeout(function(){throw s})}}function dx(e,n,a){try{var s=e.onCaughtError;s(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Gu(e,n,a){return a=pr(a),a.tag=3,a.payload={element:null},a.callback=function(){jo(e,n)},a}function hx(e){return e=pr(e),e.tag=3,e}function mx(e,n,a,s){var h=a.type.getDerivedStateFromError;if(typeof h=="function"){var p=s.value;e.payload=function(){return h(p)},e.callback=function(){dx(n,a,s)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(e.callback=function(){dx(n,a,s),typeof h!="function"&&(Sr===null?Sr=new Set([this]):Sr.add(this));var N=s.stack;this.componentDidCatch(s.value,{componentStack:N!==null?N:""})})}function _2(e,n,a,s,h){if(a.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(n=a.alternate,n!==null&&Oa(n,a,h,!0),a=Hn.current,a!==null){switch(a.tag){case 31:case 13:return nl===null?Oo():a.alternate===null&&Vt===0&&(Vt=3),a.flags&=-257,a.flags|=65536,a.lanes=h,s===uo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([s]):n.add(s),bf(e,s,h)),!1;case 22:return a.flags|=65536,s===uo?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([s])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([s]):a.add(s)),bf(e,s,h)),!1}throw Error(i(435,a.tag))}return bf(e,s,h),Oo(),!1}if(ut)return n=Hn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=h,s!==du&&(e=Error(i(422),{cause:s}),Fi(Jn(e,a)))):(s!==du&&(n=Error(i(423),{cause:s}),Fi(Jn(n,a))),e=e.current.alternate,e.flags|=65536,h&=-h,e.lanes|=h,s=Jn(s,a),h=Gu(e.stateNode,s,h),Su(e,h),Vt!==4&&(Vt=2)),!1;var p=Error(i(520),{cause:s});if(p=Jn(p,a),Pi===null?Pi=[p]:Pi.push(p),Vt!==4&&(Vt=2),n===null)return!0;s=Jn(s,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=h&-h,a.lanes|=e,e=Gu(a.stateNode,s,e),Su(a,e),!1;case 1:if(n=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Sr===null||!Sr.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=hx(h),mx(h,e,a,s),Su(a,h),!1}a=a.return}while(a!==null);return!1}var Ku=Error(i(461)),en=!1;function hn(e,n,a,s){n.child=e===null?gm(n,null,a,s):ia(n,e.child,a,s)}function xx(e,n,a,s,h){a=a.render;var p=n.ref;if("ref"in s){var w={};for(var N in s)N!=="ref"&&(w[N]=s[N])}else w=s;return na(n),s=Tu(e,n,a,w,p,h),N=Du(),e!==null&&!en?(zu(e,n,h),ql(e,n,h)):(ut&&N&&uu(n),n.flags|=1,hn(e,n,s,h),n.child)}function px(e,n,a,s,h){if(e===null){var p=a.type;return typeof p=="function"&&!su(p)&&p.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=p,yx(e,n,p,s,h)):(e=ro(a.type,null,s,n,n.mode,h),e.ref=n.ref,e.return=n,n.child=e)}if(p=e.child,!nf(e,h)){var w=p.memoizedProps;if(a=a.compare,a=a!==null?a:zi,a(w,s)&&e.ref===n.ref)return ql(e,n,h)}return n.flags|=1,e=Ll(p,s),e.ref=n.ref,e.return=n,n.child=e}function yx(e,n,a,s,h){if(e!==null){var p=e.memoizedProps;if(zi(p,s)&&e.ref===n.ref)if(en=!1,n.pendingProps=s=p,nf(e,h))(e.flags&131072)!==0&&(en=!0);else return n.lanes=e.lanes,ql(e,n,h)}return Qu(e,n,a,s,h)}function gx(e,n,a,s){var h=s.children,p=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(p=p!==null?p.baseLanes|a:a,e!==null){for(s=n.child=e.child,h=0;s!==null;)h=h|s.lanes|s.childLanes,s=s.sibling;s=h&~p}else s=0,n.child=null;return bx(e,n,p,a,s)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&oo(n,p!==null?p.cachePool:null),p!==null?wm(n,p):Cu(),km(n);else return s=n.lanes=536870912,bx(e,n,p!==null?p.baseLanes|a:a,a,s)}else p!==null?(oo(n,p.cachePool),wm(n,p),br(),n.memoizedState=null):(e!==null&&oo(n,null),Cu(),br());return hn(e,n,h,a),n.child}function Vi(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function bx(e,n,a,s,h){var p=bu();return p=p===null?null:{parent:Jt._currentValue,pool:p},n.memoizedState={baseLanes:a,cachePool:p},e!==null&&oo(n,null),Cu(),km(n),e!==null&&Oa(e,n,s,!0),n.childLanes=h,null}function Co(e,n){return n=No({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function vx(e,n,a){return ia(n,e.child,null,a),e=Co(n,n.pendingProps),e.flags|=2,Un(n),n.memoizedState=null,e}function O2(e,n,a){var s=n.pendingProps,h=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(ut){if(s.mode==="hidden")return e=Co(n,s),n.lanes=536870912,Vi(null,e);if(Nu(n),(e=_t)?(e=Mp(e,tl),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:fr!==null?{id:yl,overflow:gl}:null,retryLane:536870912,hydrationErrors:null},a=lm(e),a.return=n,n.child=a,fn=n,_t=null)):e=null,e===null)throw hr(n);return n.lanes=536870912,null}return Co(n,s)}var p=e.memoizedState;if(p!==null){var w=p.dehydrated;if(Nu(n),h)if(n.flags&256)n.flags&=-257,n=vx(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(i(558));else if(en||Oa(e,n,a,!1),h=(a&e.childLanes)!==0,en||h){if(s=Tt,s!==null&&(w=zl(s,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,Jr(e,w),Rn(s,e,w),Ku;Oo(),n=vx(e,n,a)}else e=p.treeContext,_t=ll(w.nextSibling),fn=n,ut=!0,dr=null,tl=!1,e!==null&&im(n,e),n=Co(n,s),n.flags|=4096;return n}return e=Ll(e.child,{mode:s.mode,children:s.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Eo(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Qu(e,n,a,s,h){return na(n),a=Tu(e,n,a,s,void 0,h),s=Du(),e!==null&&!en?(zu(e,n,h),ql(e,n,h)):(ut&&s&&uu(n),n.flags|=1,hn(e,n,a,h),n.child)}function wx(e,n,a,s,h,p){return na(n),n.updateQueue=null,a=jm(n,s,a,h),Sm(e),s=Du(),e!==null&&!en?(zu(e,n,p),ql(e,n,p)):(ut&&s&&uu(n),n.flags|=1,hn(e,n,a,p),n.child)}function kx(e,n,a,s,h){if(na(n),n.stateNode===null){var p=Ma,w=a.contextType;typeof w=="object"&&w!==null&&(p=dn(w)),p=new a(s,p),n.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Vu,n.stateNode=p,p._reactInternals=n,p=n.stateNode,p.props=s,p.state=n.memoizedState,p.refs={},wu(n),w=a.contextType,p.context=typeof w=="object"&&w!==null?dn(w):Ma,p.state=n.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(Xu(n,a,w,s),p.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(w=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),w!==p.state&&Vu.enqueueReplaceState(p,p.state,null),Ui(n,s,p,h),Hi(),p.state=n.memoizedState),typeof p.componentDidMount=="function"&&(n.flags|=4194308),s=!0}else if(e===null){p=n.stateNode;var N=n.memoizedProps,U=oa(a,N);p.props=U;var P=p.context,ie=a.contextType;w=Ma,typeof ie=="object"&&ie!==null&&(w=dn(ie));var ue=a.getDerivedStateFromProps;ie=typeof ue=="function"||typeof p.getSnapshotBeforeUpdate=="function",N=n.pendingProps!==N,ie||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(N||P!==w)&&ox(n,p,s,w),xr=!1;var ne=n.memoizedState;p.state=ne,Ui(n,s,p,h),Hi(),P=n.memoizedState,N||ne!==P||xr?(typeof ue=="function"&&(Xu(n,a,ue,s),P=n.memoizedState),(U=xr||sx(n,a,U,s,ne,P,w))?(ie||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(n.flags|=4194308)):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=s,n.memoizedState=P),p.props=s,p.state=P,p.context=w,s=U):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),s=!1)}else{p=n.stateNode,ku(e,n),w=n.memoizedProps,ie=oa(a,w),p.props=ie,ue=n.pendingProps,ne=p.context,P=a.contextType,U=Ma,typeof P=="object"&&P!==null&&(U=dn(P)),N=a.getDerivedStateFromProps,(P=typeof N=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==ue||ne!==U)&&ox(n,p,s,U),xr=!1,ne=n.memoizedState,p.state=ne,Ui(n,s,p,h),Hi();var le=n.memoizedState;w!==ue||ne!==le||xr||e!==null&&e.dependencies!==null&&io(e.dependencies)?(typeof N=="function"&&(Xu(n,a,N,s),le=n.memoizedState),(ie=xr||sx(n,a,ie,s,ne,le,U)||e!==null&&e.dependencies!==null&&io(e.dependencies))?(P||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(s,le,U),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(s,le,U)),typeof p.componentDidUpdate=="function"&&(n.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&ne===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&ne===e.memoizedState||(n.flags|=1024),n.memoizedProps=s,n.memoizedState=le),p.props=s,p.state=le,p.context=U,s=ie):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&ne===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&ne===e.memoizedState||(n.flags|=1024),s=!1)}return p=s,Eo(e,n),s=(n.flags&128)!==0,p||s?(p=n.stateNode,a=s&&typeof a.getDerivedStateFromError!="function"?null:p.render(),n.flags|=1,e!==null&&s?(n.child=ia(n,e.child,null,h),n.child=ia(n,null,a,h)):hn(e,n,a,h),n.memoizedState=p.state,e=n.child):e=ql(e,n,h),e}function Sx(e,n,a,s){return ea(),n.flags|=256,hn(e,n,a,s),n.child}var Wu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Zu(e){return{baseLanes:e,cachePool:dm()}}function Ju(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=Yn),e}function jx(e,n,a){var s=n.pendingProps,h=!1,p=(n.flags&128)!==0,w;if((w=p)||(w=e!==null&&e.memoizedState===null?!1:(Qt.current&2)!==0),w&&(h=!0,n.flags&=-129),w=(n.flags&32)!==0,n.flags&=-33,e===null){if(ut){if(h?gr(n):br(),(e=_t)?(e=Mp(e,tl),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:fr!==null?{id:yl,overflow:gl}:null,retryLane:536870912,hydrationErrors:null},a=lm(e),a.return=n,n.child=a,fn=n,_t=null)):e=null,e===null)throw hr(n);return _f(e)?n.lanes=32:n.lanes=536870912,null}var N=s.children;return s=s.fallback,h?(br(),h=n.mode,N=No({mode:"hidden",children:N},h),s=Pr(s,h,a,null),N.return=n,s.return=n,N.sibling=s,n.child=N,s=n.child,s.memoizedState=Zu(a),s.childLanes=Ju(e,w,a),n.memoizedState=Wu,Vi(null,s)):(gr(n),Pu(n,N))}var U=e.memoizedState;if(U!==null&&(N=U.dehydrated,N!==null)){if(p)n.flags&256?(gr(n),n.flags&=-257,n=ef(e,n,a)):n.memoizedState!==null?(br(),n.child=e.child,n.flags|=128,n=null):(br(),N=s.fallback,h=n.mode,s=No({mode:"visible",children:s.children},h),N=Pr(N,h,a,null),N.flags|=2,s.return=n,N.return=n,s.sibling=N,n.child=s,ia(n,e.child,null,a),s=n.child,s.memoizedState=Zu(a),s.childLanes=Ju(e,w,a),n.memoizedState=Wu,n=Vi(null,s));else if(gr(n),_f(N)){if(w=N.nextSibling&&N.nextSibling.dataset,w)var P=w.dgst;w=P,s=Error(i(419)),s.stack="",s.digest=w,Fi({value:s,source:null,stack:null}),n=ef(e,n,a)}else if(en||Oa(e,n,a,!1),w=(a&e.childLanes)!==0,en||w){if(w=Tt,w!==null&&(s=zl(w,a),s!==0&&s!==U.retryLane))throw U.retryLane=s,Jr(e,s),Rn(w,e,s),Ku;Ff(N)||Oo(),n=ef(e,n,a)}else Ff(N)?(n.flags|=192,n.child=e.child,n=null):(e=U.treeContext,_t=ll(N.nextSibling),fn=n,ut=!0,dr=null,tl=!1,e!==null&&im(n,e),n=Pu(n,s.children),n.flags|=4096);return n}return h?(br(),N=s.fallback,h=n.mode,U=e.child,P=U.sibling,s=Ll(U,{mode:"hidden",children:s.children}),s.subtreeFlags=U.subtreeFlags&65011712,P!==null?N=Ll(P,N):(N=Pr(N,h,a,null),N.flags|=2),N.return=n,s.return=n,s.sibling=N,n.child=s,Vi(null,s),s=n.child,N=e.child.memoizedState,N===null?N=Zu(a):(h=N.cachePool,h!==null?(U=Jt._currentValue,h=h.parent!==U?{parent:U,pool:U}:h):h=dm(),N={baseLanes:N.baseLanes|a,cachePool:h}),s.memoizedState=N,s.childLanes=Ju(e,w,a),n.memoizedState=Wu,Vi(e.child,s)):(gr(n),a=e.child,e=a.sibling,a=Ll(a,{mode:"visible",children:s.children}),a.return=n,a.sibling=null,e!==null&&(w=n.deletions,w===null?(n.deletions=[e],n.flags|=16):w.push(e)),n.child=a,n.memoizedState=null,a)}function Pu(e,n){return n=No({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function No(e,n){return e=$n(22,e,null,n),e.lanes=0,e}function ef(e,n,a){return ia(n,e.child,null,a),e=Pu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Cx(e,n,a){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n),xu(e.return,n,a)}function tf(e,n,a,s,h,p){var w=e.memoizedState;w===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:s,tail:a,tailMode:h,treeForkCount:p}:(w.isBackwards=n,w.rendering=null,w.renderingStartTime=0,w.last=s,w.tail=a,w.tailMode=h,w.treeForkCount=p)}function Ex(e,n,a){var s=n.pendingProps,h=s.revealOrder,p=s.tail;s=s.children;var w=Qt.current,N=(w&2)!==0;if(N?(w=w&1|2,n.flags|=128):w&=1,T(Qt,w),hn(e,n,s,a),s=ut?Ri:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cx(e,a,n);else if(e.tag===19)Cx(e,a,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(h){case"forwards":for(a=n.child,h=null;a!==null;)e=a.alternate,e!==null&&xo(e)===null&&(h=a),a=a.sibling;a=h,a===null?(h=n.child,n.child=null):(h=a.sibling,a.sibling=null),tf(n,!1,h,a,p,s);break;case"backwards":case"unstable_legacy-backwards":for(a=null,h=n.child,n.child=null;h!==null;){if(e=h.alternate,e!==null&&xo(e)===null){n.child=h;break}e=h.sibling,h.sibling=a,a=h,h=e}tf(n,!0,a,null,p,s);break;case"together":tf(n,!1,null,null,void 0,s);break;default:n.memoizedState=null}return n.child}function ql(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),kr|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(Oa(e,n,a,!1),(a&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,a=Ll(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Ll(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function nf(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&io(e)))}function B2(e,n,a){switch(n.tag){case 3:He(n,n.stateNode.containerInfo),mr(n,Jt,e.memoizedState.cache),ea();break;case 27:case 5:ke(n);break;case 4:He(n,n.stateNode.containerInfo);break;case 10:mr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Nu(n),null;break;case 13:var s=n.memoizedState;if(s!==null)return s.dehydrated!==null?(gr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?jx(e,n,a):(gr(n),e=ql(e,n,a),e!==null?e.sibling:null);gr(n);break;case 19:var h=(e.flags&128)!==0;if(s=(a&n.childLanes)!==0,s||(Oa(e,n,a,!1),s=(a&n.childLanes)!==0),h){if(s)return Ex(e,n,a);n.flags|=128}if(h=n.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),T(Qt,Qt.current),s)break;return null;case 22:return n.lanes=0,gx(e,n,a,n.pendingProps);case 24:mr(n,Jt,e.memoizedState.cache)}return ql(e,n,a)}function Nx(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)en=!0;else{if(!nf(e,a)&&(n.flags&128)===0)return en=!1,B2(e,n,a);en=(e.flags&131072)!==0}else en=!1,ut&&(n.flags&1048576)!==0&&am(n,Ri,n.index);switch(n.lanes=0,n.tag){case 16:e:{var s=n.pendingProps;if(e=ra(n.elementType),n.type=e,typeof e=="function")su(e)?(s=oa(e,s),n.tag=1,n=kx(null,n,e,s,a)):(n.tag=0,n=Qu(null,n,e,s,a));else{if(e!=null){var h=e.$$typeof;if(h===O){n.tag=11,n=xx(null,n,e,s,a);break e}else if(h===I){n.tag=14,n=px(null,n,e,s,a);break e}}throw n=te(e)||e,Error(i(306,n,""))}}return n;case 0:return Qu(e,n,n.type,n.pendingProps,a);case 1:return s=n.type,h=oa(s,n.pendingProps),kx(e,n,s,h,a);case 3:e:{if(He(n,n.stateNode.containerInfo),e===null)throw Error(i(387));s=n.pendingProps;var p=n.memoizedState;h=p.element,ku(e,n),Ui(n,s,null,a);var w=n.memoizedState;if(s=w.cache,mr(n,Jt,s),s!==p.cache&&pu(n,[Jt],a,!0),Hi(),s=w.element,p.isDehydrated)if(p={element:s,isDehydrated:!1,cache:w.cache},n.updateQueue.baseState=p,n.memoizedState=p,n.flags&256){n=Sx(e,n,s,a);break e}else if(s!==h){h=Jn(Error(i(424)),n),Fi(h),n=Sx(e,n,s,a);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(_t=ll(e.firstChild),fn=n,ut=!0,dr=null,tl=!0,a=gm(n,null,s,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ea(),s===h){n=ql(e,n,a);break e}hn(e,n,s,a)}n=n.child}return n;case 26:return Eo(e,n),e===null?(a=Lp(n.type,null,n.pendingProps,null))?n.memoizedState=a:ut||(a=n.type,e=n.pendingProps,s=Yo(Ee.current).createElement(a),s[$t]=n,s[cn]=e,mn(s,a,e),Ft(s),n.stateNode=s):n.memoizedState=Lp(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return ke(n),e===null&&ut&&(s=n.stateNode=_p(n.type,n.pendingProps,Ee.current),fn=n,tl=!0,h=_t,Nr(n.type)?(Of=h,_t=ll(s.firstChild)):_t=h),hn(e,n,n.pendingProps.children,a),Eo(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&ut&&((h=s=_t)&&(s=hb(s,n.type,n.pendingProps,tl),s!==null?(n.stateNode=s,fn=n,_t=ll(s.firstChild),tl=!1,h=!0):h=!1),h||hr(n)),ke(n),h=n.type,p=n.pendingProps,w=e!==null?e.memoizedProps:null,s=p.children,zf(h,p)?s=null:w!==null&&zf(h,w)&&(n.flags|=32),n.memoizedState!==null&&(h=Tu(e,n,A2,null,null,a),ss._currentValue=h),Eo(e,n),hn(e,n,s,a),n.child;case 6:return e===null&&ut&&((e=a=_t)&&(a=mb(a,n.pendingProps,tl),a!==null?(n.stateNode=a,fn=n,_t=null,e=!0):e=!1),e||hr(n)),null;case 13:return jx(e,n,a);case 4:return He(n,n.stateNode.containerInfo),s=n.pendingProps,e===null?n.child=ia(n,null,s,a):hn(e,n,s,a),n.child;case 11:return xx(e,n,n.type,n.pendingProps,a);case 7:return hn(e,n,n.pendingProps,a),n.child;case 8:return hn(e,n,n.pendingProps.children,a),n.child;case 12:return hn(e,n,n.pendingProps.children,a),n.child;case 10:return s=n.pendingProps,mr(n,n.type,s.value),hn(e,n,s.children,a),n.child;case 9:return h=n.type._context,s=n.pendingProps.children,na(n),h=dn(h),s=s(h),n.flags|=1,hn(e,n,s,a),n.child;case 14:return px(e,n,n.type,n.pendingProps,a);case 15:return yx(e,n,n.type,n.pendingProps,a);case 19:return Ex(e,n,a);case 31:return O2(e,n,a);case 22:return gx(e,n,a,n.pendingProps);case 24:return na(n),s=dn(Jt),e===null?(h=bu(),h===null&&(h=Tt,p=yu(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),n.memoizedState={parent:s,cache:h},wu(n),mr(n,Jt,h)):((e.lanes&a)!==0&&(ku(e,n),Ui(n,null,null,a),Hi()),h=e.memoizedState,p=n.memoizedState,h.parent!==s?(h={parent:s,cache:s},n.memoizedState=h,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=h),mr(n,Jt,s)):(s=p.cache,mr(n,Jt,s),s!==h.cache&&pu(n,[Jt],a,!0))),hn(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function Xl(e){e.flags|=4}function lf(e,n,a,s,h){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(h&335544128)===h)if(e.stateNode.complete)e.flags|=8192;else if(ep())e.flags|=8192;else throw aa=uo,vu}else e.flags&=-16777217}function Ax(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Yp(n))if(ep())e.flags|=8192;else throw aa=uo,vu}function Ao(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Us():536870912,e.lanes|=n,Ka|=n)}function Gi(e,n){if(!ut)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var s=null;a!==null;)a.alternate!==null&&(s=a),a=a.sibling;s===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Ot(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,s=0;if(n)for(var h=e.child;h!==null;)a|=h.lanes|h.childLanes,s|=h.subtreeFlags&65011712,s|=h.flags&65011712,h.return=e,h=h.sibling;else for(h=e.child;h!==null;)a|=h.lanes|h.childLanes,s|=h.subtreeFlags,s|=h.flags,h.return=e,h=h.sibling;return e.subtreeFlags|=s,e.childLanes=a,n}function L2(e,n,a){var s=n.pendingProps;switch(fu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ot(n),null;case 1:return Ot(n),null;case 3:return a=n.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),n.memoizedState.cache!==s&&(n.flags|=2048),Ul(Jt),Ke(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(_a(n)?Xl(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,hu())),Ot(n),null;case 26:var h=n.type,p=n.memoizedState;return e===null?(Xl(n),p!==null?(Ot(n),Ax(n,p)):(Ot(n),lf(n,h,null,s,a))):p?p!==e.memoizedState?(Xl(n),Ot(n),Ax(n,p)):(Ot(n),n.flags&=-16777217):(e=e.memoizedProps,e!==s&&Xl(n),Ot(n),lf(n,h,e,s,a)),null;case 27:if(yt(n),a=Ee.current,h=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Xl(n);else{if(!s){if(n.stateNode===null)throw Error(i(166));return Ot(n),null}e=me.current,_a(n)?sm(n):(e=_p(h,s,a),n.stateNode=e,Xl(n))}return Ot(n),null;case 5:if(yt(n),h=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Xl(n);else{if(!s){if(n.stateNode===null)throw Error(i(166));return Ot(n),null}if(p=me.current,_a(n))sm(n);else{var w=Yo(Ee.current);switch(p){case 1:p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":p=w.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof s.is=="string"?w.createElement("select",{is:s.is}):w.createElement("select"),s.multiple?p.multiple=!0:s.size&&(p.size=s.size);break;default:p=typeof s.is=="string"?w.createElement(h,{is:s.is}):w.createElement(h)}}p[$t]=n,p[cn]=s;e:for(w=n.child;w!==null;){if(w.tag===5||w.tag===6)p.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=p;e:switch(mn(p,h,s),h){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Xl(n)}}return Ot(n),lf(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==s&&Xl(n);else{if(typeof s!="string"&&n.stateNode===null)throw Error(i(166));if(e=Ee.current,_a(n)){if(e=n.stateNode,a=n.memoizedProps,s=null,h=fn,h!==null)switch(h.tag){case 27:case 5:s=h.memoizedProps}e[$t]=n,e=!!(e.nodeValue===a||s!==null&&s.suppressHydrationWarning===!0||jp(e.nodeValue,a)),e||hr(n,!0)}else e=Yo(e).createTextNode(s),e[$t]=n,n.stateNode=e}return Ot(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(s=_a(n),a!==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[$t]=n}else ea(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ot(n),e=!1}else a=hu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(Un(n),n):(Un(n),null);if((n.flags&128)!==0)throw Error(i(558))}return Ot(n),null;case 13:if(s=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(h=_a(n),s!==null&&s.dehydrated!==null){if(e===null){if(!h)throw Error(i(318));if(h=n.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(317));h[$t]=n}else ea(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ot(n),h=!1}else h=hu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=h),h=!0;if(!h)return n.flags&256?(Un(n),n):(Un(n),null)}return Un(n),(n.flags&128)!==0?(n.lanes=a,n):(a=s!==null,e=e!==null&&e.memoizedState!==null,a&&(s=n.child,h=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(h=s.alternate.memoizedState.cachePool.pool),p=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(p=s.memoizedState.cachePool.pool),p!==h&&(s.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),Ao(n,n.updateQueue),Ot(n),null);case 4:return Ke(),e===null&&Ef(n.stateNode.containerInfo),Ot(n),null;case 10:return Ul(n.type),Ot(n),null;case 19:if(Q(Qt),s=n.memoizedState,s===null)return Ot(n),null;if(h=(n.flags&128)!==0,p=s.rendering,p===null)if(h)Gi(s,!1);else{if(Vt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(p=xo(e),p!==null){for(n.flags|=128,Gi(s,!1),e=p.updateQueue,n.updateQueue=e,Ao(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)nm(a,e),a=a.sibling;return T(Qt,Qt.current&1|2),ut&&$l(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&&ht()>Ro&&(n.flags|=128,h=!0,Gi(s,!1),n.lanes=4194304)}else{if(!h)if(e=xo(p),e!==null){if(n.flags|=128,h=!0,e=e.updateQueue,n.updateQueue=e,Ao(n,e),Gi(s,!0),s.tail===null&&s.tailMode==="hidden"&&!p.alternate&&!ut)return Ot(n),null}else 2*ht()-s.renderingStartTime>Ro&&a!==536870912&&(n.flags|=128,h=!0,Gi(s,!1),n.lanes=4194304);s.isBackwards?(p.sibling=n.child,n.child=p):(e=s.last,e!==null?e.sibling=p:n.child=p,s.last=p)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=ht(),e.sibling=null,a=Qt.current,T(Qt,h?a&1|2:a&1),ut&&$l(n,s.treeForkCount),e):(Ot(n),null);case 22:case 23:return Un(n),Eu(),s=n.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(n.flags|=8192):s&&(n.flags|=8192),s?(a&536870912)!==0&&(n.flags&128)===0&&(Ot(n),n.subtreeFlags&6&&(n.flags|=8192)):Ot(n),a=n.updateQueue,a!==null&&Ao(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==a&&(n.flags|=2048),e!==null&&Q(la),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Ul(Jt),Ot(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function $2(e,n){switch(fu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Ul(Jt),Ke(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return yt(n),null;case 31:if(n.memoizedState!==null){if(Un(n),n.alternate===null)throw Error(i(340));ea()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Un(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));ea()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Q(Qt),null;case 4:return Ke(),null;case 10:return Ul(n.type),null;case 22:case 23:return Un(n),Eu(),e!==null&&Q(la),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Ul(Jt),null;case 25:return null;default:return null}}function Tx(e,n){switch(fu(n),n.tag){case 3:Ul(Jt),Ke();break;case 26:case 27:case 5:yt(n);break;case 4:Ke();break;case 31:n.memoizedState!==null&&Un(n);break;case 13:Un(n);break;case 19:Q(Qt);break;case 10:Ul(n.type);break;case 22:case 23:Un(n),Eu(),e!==null&&Q(la);break;case 24:Ul(Jt)}}function Ki(e,n){try{var a=n.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var h=s.next;a=h;do{if((a.tag&e)===e){s=void 0;var p=a.create,w=a.inst;s=p(),w.destroy=s}a=a.next}while(a!==h)}}catch(N){St(n,n.return,N)}}function vr(e,n,a){try{var s=n.updateQueue,h=s!==null?s.lastEffect:null;if(h!==null){var p=h.next;s=p;do{if((s.tag&e)===e){var w=s.inst,N=w.destroy;if(N!==void 0){w.destroy=void 0,h=n;var U=a,P=N;try{P()}catch(ie){St(h,U,ie)}}}s=s.next}while(s!==p)}}catch(ie){St(n,n.return,ie)}}function Dx(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{vm(n,a)}catch(s){St(e,e.return,s)}}}function zx(e,n,a){a.props=oa(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(s){St(e,n,s)}}function Qi(e,n){try{var a=e.ref;if(a!==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 a=="function"?e.refCleanup=a(s):a.current=s}}catch(h){St(e,n,h)}}function bl(e,n){var a=e.ref,s=e.refCleanup;if(a!==null)if(typeof s=="function")try{s()}catch(h){St(e,n,h)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(h){St(e,n,h)}else a.current=null}function Mx(e){var n=e.type,a=e.memoizedProps,s=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&s.focus();break e;case"img":a.src?s.src=a.src:a.srcSet&&(s.srcset=a.srcSet)}}catch(h){St(e,e.return,h)}}function rf(e,n,a){try{var s=e.stateNode;sb(s,e.type,a,n),s[cn]=n}catch(h){St(e,e.return,h)}}function Rx(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Nr(e.type)||e.tag===4}function af(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Rx(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&&Nr(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 sf(e,n,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=Qn));else if(s!==4&&(s===27&&Nr(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(sf(e,n,a),e=e.sibling;e!==null;)sf(e,n,a),e=e.sibling}function To(e,n,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(s!==4&&(s===27&&Nr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(To(e,n,a),e=e.sibling;e!==null;)To(e,n,a),e=e.sibling}function Fx(e){var n=e.stateNode,a=e.memoizedProps;try{for(var s=e.type,h=n.attributes;h.length;)n.removeAttributeNode(h[0]);mn(n,s,a),n[$t]=e,n[cn]=a}catch(p){St(e,e.return,p)}}var Vl=!1,tn=!1,of=!1,_x=typeof WeakSet=="function"?WeakSet:Set,on=null;function H2(e,n){if(e=e.containerInfo,Tf=Wo,e=Gh(e),eu(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var s=a.getSelection&&a.getSelection();if(s&&s.rangeCount!==0){a=s.anchorNode;var h=s.anchorOffset,p=s.focusNode;s=s.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var w=0,N=-1,U=-1,P=0,ie=0,ue=e,ne=null;t:for(;;){for(var le;ue!==a||h!==0&&ue.nodeType!==3||(N=w+h),ue!==p||s!==0&&ue.nodeType!==3||(U=w+s),ue.nodeType===3&&(w+=ue.nodeValue.length),(le=ue.firstChild)!==null;)ne=ue,ue=le;for(;;){if(ue===e)break t;if(ne===a&&++P===h&&(N=w),ne===p&&++ie===s&&(U=w),(le=ue.nextSibling)!==null)break;ue=ne,ne=ue.parentNode}ue=le}a=N===-1||U===-1?null:{start:N,end:U}}else a=null}a=a||{start:0,end:0}}else a=null;for(Df={focusedElem:e,selectionRange:a},Wo=!1,on=n;on!==null;)if(n=on,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,on=e;else for(;on!==null;){switch(n=on,p=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(a=0;a<e.length;a++)h=e[a],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&p!==null){e=void 0,a=n,h=p.memoizedProps,p=p.memoizedState,s=a.stateNode;try{var Ae=oa(a.type,h);e=s.getSnapshotBeforeUpdate(Ae,p),s.__reactInternalSnapshotBeforeUpdate=e}catch(Ye){St(a,a.return,Ye)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)Rf(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Rf(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,on=e;break}on=n.return}}function Ox(e,n,a){var s=a.flags;switch(a.tag){case 0:case 11:case 15:Kl(e,a),s&4&&Ki(5,a);break;case 1:if(Kl(e,a),s&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(w){St(a,a.return,w)}else{var h=oa(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(h,n,e.__reactInternalSnapshotBeforeUpdate)}catch(w){St(a,a.return,w)}}s&64&&Dx(a),s&512&&Qi(a,a.return);break;case 3:if(Kl(e,a),s&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{vm(e,n)}catch(w){St(a,a.return,w)}}break;case 27:n===null&&s&4&&Fx(a);case 26:case 5:Kl(e,a),n===null&&s&4&&Mx(a),s&512&&Qi(a,a.return);break;case 12:Kl(e,a);break;case 31:Kl(e,a),s&4&&$x(e,a);break;case 13:Kl(e,a),s&4&&Hx(e,a),s&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Q2.bind(null,a),xb(e,a))));break;case 22:if(s=a.memoizedState!==null||Vl,!s){n=n!==null&&n.memoizedState!==null||tn,h=Vl;var p=tn;Vl=s,(tn=n)&&!p?Ql(e,a,(a.subtreeFlags&8772)!==0):Kl(e,a),Vl=h,tn=p}break;case 30:break;default:Kl(e,a)}}function Bx(e){var n=e.alternate;n!==null&&(e.alternate=null,Bx(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Sa(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 Ht=null,Tn=!1;function Gl(e,n,a){for(a=a.child;a!==null;)Lx(e,n,a),a=a.sibling}function Lx(e,n,a){if(Xe&&typeof Xe.onCommitFiberUnmount=="function")try{Xe.onCommitFiberUnmount(wt,a)}catch{}switch(a.tag){case 26:tn||bl(a,n),Gl(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:tn||bl(a,n);var s=Ht,h=Tn;Nr(a.type)&&(Ht=a.stateNode,Tn=!1),Gl(e,n,a),rs(a.stateNode),Ht=s,Tn=h;break;case 5:tn||bl(a,n);case 6:if(s=Ht,h=Tn,Ht=null,Gl(e,n,a),Ht=s,Tn=h,Ht!==null)if(Tn)try{(Ht.nodeType===9?Ht.body:Ht.nodeName==="HTML"?Ht.ownerDocument.body:Ht).removeChild(a.stateNode)}catch(p){St(a,n,p)}else try{Ht.removeChild(a.stateNode)}catch(p){St(a,n,p)}break;case 18:Ht!==null&&(Tn?(e=Ht,Dp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),ni(e)):Dp(Ht,a.stateNode));break;case 4:s=Ht,h=Tn,Ht=a.stateNode.containerInfo,Tn=!0,Gl(e,n,a),Ht=s,Tn=h;break;case 0:case 11:case 14:case 15:vr(2,a,n),tn||vr(4,a,n),Gl(e,n,a);break;case 1:tn||(bl(a,n),s=a.stateNode,typeof s.componentWillUnmount=="function"&&zx(a,n,s)),Gl(e,n,a);break;case 21:Gl(e,n,a);break;case 22:tn=(s=tn)||a.memoizedState!==null,Gl(e,n,a),tn=s;break;default:Gl(e,n,a)}}function $x(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ni(e)}catch(a){St(n,n.return,a)}}}function Hx(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ni(e)}catch(a){St(n,n.return,a)}}function U2(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new _x),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new _x),n;default:throw Error(i(435,e.tag))}}function Do(e,n){var a=U2(e);n.forEach(function(s){if(!a.has(s)){a.add(s);var h=W2.bind(null,e,s);s.then(h,h)}})}function Dn(e,n){var a=n.deletions;if(a!==null)for(var s=0;s<a.length;s++){var h=a[s],p=e,w=n,N=w;e:for(;N!==null;){switch(N.tag){case 27:if(Nr(N.type)){Ht=N.stateNode,Tn=!1;break e}break;case 5:Ht=N.stateNode,Tn=!1;break e;case 3:case 4:Ht=N.stateNode.containerInfo,Tn=!0;break e}N=N.return}if(Ht===null)throw Error(i(160));Lx(p,w,h),Ht=null,Tn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Ux(n,e),n=n.sibling}var cl=null;function Ux(e,n){var a=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Dn(n,e),zn(e),s&4&&(vr(3,e,e.return),Ki(3,e),vr(5,e,e.return));break;case 1:Dn(n,e),zn(e),s&512&&(tn||a===null||bl(a,a.return)),s&64&&Vl&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?s:a.concat(s))));break;case 26:var h=cl;if(Dn(n,e),zn(e),s&512&&(tn||a===null||bl(a,a.return)),s&4){var p=a!==null?a.memoizedState:null;if(s=e.memoizedState,a===null)if(s===null)if(e.stateNode===null){e:{s=e.type,a=e.memoizedProps,h=h.ownerDocument||h;t:switch(s){case"title":p=h.getElementsByTagName("title")[0],(!p||p[_l]||p[$t]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(s),h.head.insertBefore(p,h.querySelector("head > title"))),mn(p,s,a),p[$t]=e,Ft(p),s=p;break e;case"link":var w=Up("link","href",h).get(s+(a.href||""));if(w){for(var N=0;N<w.length;N++)if(p=w[N],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){w.splice(N,1);break t}}p=h.createElement(s),mn(p,s,a),h.head.appendChild(p);break;case"meta":if(w=Up("meta","content",h).get(s+(a.content||""))){for(N=0;N<w.length;N++)if(p=w[N],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){w.splice(N,1);break t}}p=h.createElement(s),mn(p,s,a),h.head.appendChild(p);break;default:throw Error(i(468,s))}p[$t]=e,Ft(p),s=p}e.stateNode=s}else Ip(h,e.type,e.stateNode);else e.stateNode=Hp(h,s,e.memoizedProps);else p!==s?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,s===null?Ip(h,e.type,e.stateNode):Hp(h,s,e.memoizedProps)):s===null&&e.stateNode!==null&&rf(e,e.memoizedProps,a.memoizedProps)}break;case 27:Dn(n,e),zn(e),s&512&&(tn||a===null||bl(a,a.return)),a!==null&&s&4&&rf(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Dn(n,e),zn(e),s&512&&(tn||a===null||bl(a,a.return)),e.flags&32){h=e.stateNode;try{ur(h,"")}catch(Ae){St(e,e.return,Ae)}}s&4&&e.stateNode!=null&&(h=e.memoizedProps,rf(e,h,a!==null?a.memoizedProps:h)),s&1024&&(of=!0);break;case 6:if(Dn(n,e),zn(e),s&4){if(e.stateNode===null)throw Error(i(162));s=e.memoizedProps,a=e.stateNode;try{a.nodeValue=s}catch(Ae){St(e,e.return,Ae)}}break;case 3:if(Vo=null,h=cl,cl=qo(n.containerInfo),Dn(n,e),cl=h,zn(e),s&4&&a!==null&&a.memoizedState.isDehydrated)try{ni(n.containerInfo)}catch(Ae){St(e,e.return,Ae)}of&&(of=!1,Ix(e));break;case 4:s=cl,cl=qo(e.stateNode.containerInfo),Dn(n,e),zn(e),cl=s;break;case 12:Dn(n,e),zn(e);break;case 31:Dn(n,e),zn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Do(e,s)));break;case 13:Dn(n,e),zn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Mo=ht()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Do(e,s)));break;case 22:h=e.memoizedState!==null;var U=a!==null&&a.memoizedState!==null,P=Vl,ie=tn;if(Vl=P||h,tn=ie||U,Dn(n,e),tn=ie,Vl=P,zn(e),s&8192)e:for(n=e.stateNode,n._visibility=h?n._visibility&-2:n._visibility|1,h&&(a===null||U||Vl||tn||ca(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){U=a=n;try{if(p=U.stateNode,h)w=p.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{N=U.stateNode;var ue=U.memoizedProps.style,ne=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;N.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Ae){St(U,U.return,Ae)}}}else if(n.tag===6){if(a===null){U=n;try{U.stateNode.nodeValue=h?"":U.memoizedProps}catch(Ae){St(U,U.return,Ae)}}}else if(n.tag===18){if(a===null){U=n;try{var le=U.stateNode;h?zp(le,!0):zp(U.stateNode,!1)}catch(Ae){St(U,U.return,Ae)}}}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;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}s&4&&(s=e.updateQueue,s!==null&&(a=s.retryQueue,a!==null&&(s.retryQueue=null,Do(e,a))));break;case 19:Dn(n,e),zn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Do(e,s)));break;case 30:break;case 21:break;default:Dn(n,e),zn(e)}}function zn(e){var n=e.flags;if(n&2){try{for(var a,s=e.return;s!==null;){if(Rx(s)){a=s;break}s=s.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var h=a.stateNode,p=af(e);To(e,p,h);break;case 5:var w=a.stateNode;a.flags&32&&(ur(w,""),a.flags&=-33);var N=af(e);To(e,N,w);break;case 3:case 4:var U=a.stateNode.containerInfo,P=af(e);sf(e,P,U);break;default:throw Error(i(161))}}catch(ie){St(e,e.return,ie)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Ix(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Ix(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Kl(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Ox(e,n.alternate,n),n=n.sibling}function ca(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:vr(4,n,n.return),ca(n);break;case 1:bl(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&zx(n,n.return,a),ca(n);break;case 27:rs(n.stateNode);case 26:case 5:bl(n,n.return),ca(n);break;case 22:n.memoizedState===null&&ca(n);break;case 30:ca(n);break;default:ca(n)}e=e.sibling}}function Ql(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var s=n.alternate,h=e,p=n,w=p.flags;switch(p.tag){case 0:case 11:case 15:Ql(h,p,a),Ki(4,p);break;case 1:if(Ql(h,p,a),s=p,h=s.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(P){St(s,s.return,P)}if(s=p,h=s.updateQueue,h!==null){var N=s.stateNode;try{var U=h.shared.hiddenCallbacks;if(U!==null)for(h.shared.hiddenCallbacks=null,h=0;h<U.length;h++)bm(U[h],N)}catch(P){St(s,s.return,P)}}a&&w&64&&Dx(p),Qi(p,p.return);break;case 27:Fx(p);case 26:case 5:Ql(h,p,a),a&&s===null&&w&4&&Mx(p),Qi(p,p.return);break;case 12:Ql(h,p,a);break;case 31:Ql(h,p,a),a&&w&4&&$x(h,p);break;case 13:Ql(h,p,a),a&&w&4&&Hx(h,p);break;case 22:p.memoizedState===null&&Ql(h,p,a),Qi(p,p.return);break;case 30:break;default:Ql(h,p,a)}n=n.sibling}}function cf(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&_i(a))}function uf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&_i(e))}function ul(e,n,a,s){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Yx(e,n,a,s),n=n.sibling}function Yx(e,n,a,s){var h=n.flags;switch(n.tag){case 0:case 11:case 15:ul(e,n,a,s),h&2048&&Ki(9,n);break;case 1:ul(e,n,a,s);break;case 3:ul(e,n,a,s),h&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&_i(e)));break;case 12:if(h&2048){ul(e,n,a,s),e=n.stateNode;try{var p=n.memoizedProps,w=p.id,N=p.onPostCommit;typeof N=="function"&&N(w,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(U){St(n,n.return,U)}}else ul(e,n,a,s);break;case 31:ul(e,n,a,s);break;case 13:ul(e,n,a,s);break;case 23:break;case 22:p=n.stateNode,w=n.alternate,n.memoizedState!==null?p._visibility&2?ul(e,n,a,s):Wi(e,n):p._visibility&2?ul(e,n,a,s):(p._visibility|=2,Xa(e,n,a,s,(n.subtreeFlags&10256)!==0||!1)),h&2048&&cf(w,n);break;case 24:ul(e,n,a,s),h&2048&&uf(n.alternate,n);break;default:ul(e,n,a,s)}}function Xa(e,n,a,s,h){for(h=h&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var p=e,w=n,N=a,U=s,P=w.flags;switch(w.tag){case 0:case 11:case 15:Xa(p,w,N,U,h),Ki(8,w);break;case 23:break;case 22:var ie=w.stateNode;w.memoizedState!==null?ie._visibility&2?Xa(p,w,N,U,h):Wi(p,w):(ie._visibility|=2,Xa(p,w,N,U,h)),h&&P&2048&&cf(w.alternate,w);break;case 24:Xa(p,w,N,U,h),h&&P&2048&&uf(w.alternate,w);break;default:Xa(p,w,N,U,h)}n=n.sibling}}function Wi(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,s=n,h=s.flags;switch(s.tag){case 22:Wi(a,s),h&2048&&cf(s.alternate,s);break;case 24:Wi(a,s),h&2048&&uf(s.alternate,s);break;default:Wi(a,s)}n=n.sibling}}var Zi=8192;function Va(e,n,a){if(e.subtreeFlags&Zi)for(e=e.child;e!==null;)qx(e,n,a),e=e.sibling}function qx(e,n,a){switch(e.tag){case 26:Va(e,n,a),e.flags&Zi&&e.memoizedState!==null&&Nb(a,cl,e.memoizedState,e.memoizedProps);break;case 5:Va(e,n,a);break;case 3:case 4:var s=cl;cl=qo(e.stateNode.containerInfo),Va(e,n,a),cl=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Zi,Zi=16777216,Va(e,n,a),Zi=s):Va(e,n,a));break;default:Va(e,n,a)}}function Xx(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 Ji(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var s=n[a];on=s,Gx(s,e)}Xx(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Vx(e),e=e.sibling}function Vx(e){switch(e.tag){case 0:case 11:case 15:Ji(e),e.flags&2048&&vr(9,e,e.return);break;case 3:Ji(e);break;case 12:Ji(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,zo(e)):Ji(e);break;default:Ji(e)}}function zo(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var s=n[a];on=s,Gx(s,e)}Xx(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:vr(8,n,n.return),zo(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,zo(n));break;default:zo(n)}e=e.sibling}}function Gx(e,n){for(;on!==null;){var a=on;switch(a.tag){case 0:case 11:case 15:vr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var s=a.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:_i(a.memoizedState.cache)}if(s=a.child,s!==null)s.return=a,on=s;else e:for(a=e;on!==null;){s=on;var h=s.sibling,p=s.return;if(Bx(s),s===a){on=null;break e}if(h!==null){h.return=p,on=h;break e}on=p}}}var I2={getCacheForType:function(e){var n=dn(Jt),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return dn(Jt).controller.signal}},Y2=typeof WeakMap=="function"?WeakMap:Map,bt=0,Tt=null,lt=null,st=0,kt=0,In=null,wr=!1,Ga=!1,ff=!1,Wl=0,Vt=0,kr=0,ua=0,df=0,Yn=0,Ka=0,Pi=null,Mn=null,hf=!1,Mo=0,Kx=0,Ro=1/0,Fo=null,Sr=null,ln=0,jr=null,Qa=null,Zl=0,mf=0,xf=null,Qx=null,es=0,pf=null;function qn(){return(bt&2)!==0&&st!==0?st&-st:Y.T!==null?kf():Ml()}function Wx(){if(Yn===0)if((st&536870912)===0||ut){var e=wa;wa<<=1,(wa&3932160)===0&&(wa=262144),Yn=e}else Yn=536870912;return e=Hn.current,e!==null&&(e.flags|=32),Yn}function Rn(e,n,a){(e===Tt&&(kt===2||kt===9)||e.cancelPendingCommit!==null)&&(Wa(e,0),Cr(e,st,Yn,!1)),ar(e,a),((bt&2)===0||e!==Tt)&&(e===Tt&&((bt&2)===0&&(ua|=a),Vt===4&&Cr(e,st,Yn,!1)),vl(e))}function Zx(e,n,a){if((bt&6)!==0)throw Error(i(327));var s=!a&&(n&127)===0&&(n&e.expiredLanes)===0||qr(e,n),h=s?V2(e,n):gf(e,n,!0),p=s;do{if(h===0){Ga&&!s&&Cr(e,n,0,!1);break}else{if(a=e.current.alternate,p&&!q2(a)){h=gf(e,n,!1),p=!1;continue}if(h===2){if(p=n,e.errorRecoveryDisabledLanes&p)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;h=Pi;var U=N.current.memoizedState.isDehydrated;if(U&&(Wa(N,w).flags|=256),w=gf(N,w,!1),w!==2){if(ff&&!U){N.errorRecoveryDisabledLanes|=p,ua|=p,h=4;break e}p=Mn,Mn=h,p!==null&&(Mn===null?Mn=p:Mn.push.apply(Mn,p))}h=w}if(p=!1,h!==2)continue}}if(h===1){Wa(e,0),Cr(e,n,0,!0);break}e:{switch(s=e,p=h,p){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:Cr(s,n,Yn,!wr);break e;case 2:Mn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(h=Mo+300-ht(),10<h)){if(Cr(s,n,Yn,!wr),rr(s,0,!0)!==0)break e;Zl=n,s.timeoutHandle=Ap(Jx.bind(null,s,a,Mn,Fo,hf,n,Yn,ua,Ka,wr,p,"Throttled",-0,0),h);break e}Jx(s,a,Mn,Fo,hf,n,Yn,ua,Ka,wr,p,null,-0,0)}}break}while(!0);vl(e)}function Jx(e,n,a,s,h,p,w,N,U,P,ie,ue,ne,le){if(e.timeoutHandle=-1,ue=n.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Qn},qx(n,p,ue);var Ae=(p&62914560)===p?Mo-ht():(p&4194048)===p?Kx-ht():0;if(Ae=Ab(ue,Ae),Ae!==null){Zl=p,e.cancelPendingCommit=Ae(ip.bind(null,e,n,p,a,s,h,w,N,U,ie,ue,null,ne,le)),Cr(e,p,w,!P);return}}ip(e,n,p,a,s,h,w,N,U)}function q2(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var s=0;s<a.length;s++){var h=a[s],p=h.getSnapshot;h=h.value;try{if(!Ln(p(),h))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;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 Cr(e,n,a,s){n&=~df,n&=~ua,e.suspendedLanes|=n,e.pingedLanes&=~n,s&&(e.warmLanes|=n),s=e.expirationTimes;for(var h=n;0<h;){var p=31-fe(h),w=1<<p;s[p]=-1,h&=~w}a!==0&&On(e,a,n)}function _o(){return(bt&6)===0?(ts(0),!1):!0}function yf(){if(lt!==null){if(kt===0)var e=lt.return;else e=lt,Hl=ta=null,Mu(e),Ha=null,Bi=0,e=lt;for(;e!==null;)Tx(e.alternate,e),e=e.return;lt=null}}function Wa(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,ub(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Zl=0,yf(),Tt=e,lt=a=Ll(e.current,null),st=n,kt=0,In=null,wr=!1,Ga=qr(e,n),ff=!1,Ka=Yn=df=ua=kr=Vt=0,Mn=Pi=null,hf=!1,(n&8)!==0&&(n|=n&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=n;0<s;){var h=31-fe(s),p=1<<h;n|=e[h],s&=~p}return Wl=n,to(),a}function Px(e,n){Qe=null,Y.H=Xi,n===$a||n===co?(n=xm(),kt=3):n===vu?(n=xm(),kt=4):kt=n===Ku?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,In=n,lt===null&&(Vt=1,jo(e,Jn(n,e.current)))}function ep(){var e=Hn.current;return e===null?!0:(st&4194048)===st?nl===null:(st&62914560)===st||(st&536870912)!==0?e===nl:!1}function tp(){var e=Y.H;return Y.H=Xi,e===null?Xi:e}function np(){var e=Y.A;return Y.A=I2,e}function Oo(){Vt=4,wr||(st&4194048)!==st&&Hn.current!==null||(Ga=!0),(kr&134217727)===0&&(ua&134217727)===0||Tt===null||Cr(Tt,st,Yn,!1)}function gf(e,n,a){var s=bt;bt|=2;var h=tp(),p=np();(Tt!==e||st!==n)&&(Fo=null,Wa(e,n)),n=!1;var w=Vt;e:do try{if(kt!==0&&lt!==null){var N=lt,U=In;switch(kt){case 8:yf(),w=6;break e;case 3:case 2:case 9:case 6:Hn.current===null&&(n=!0);var P=kt;if(kt=0,In=null,Za(e,N,U,P),a&&Ga){w=0;break e}break;default:P=kt,kt=0,In=null,Za(e,N,U,P)}}X2(),w=Vt;break}catch(ie){Px(e,ie)}while(!0);return n&&e.shellSuspendCounter++,Hl=ta=null,bt=s,Y.H=h,Y.A=p,lt===null&&(Tt=null,st=0,to()),w}function X2(){for(;lt!==null;)lp(lt)}function V2(e,n){var a=bt;bt|=2;var s=tp(),h=np();Tt!==e||st!==n?(Fo=null,Ro=ht()+500,Wa(e,n)):Ga=qr(e,n);e:do try{if(kt!==0&&lt!==null){n=lt;var p=In;t:switch(kt){case 1:kt=0,In=null,Za(e,n,p,1);break;case 2:case 9:if(hm(p)){kt=0,In=null,rp(n);break}n=function(){kt!==2&&kt!==9||Tt!==e||(kt=7),vl(e)},p.then(n,n);break e;case 3:kt=7;break e;case 4:kt=5;break e;case 7:hm(p)?(kt=0,In=null,rp(n)):(kt=0,In=null,Za(e,n,p,7));break;case 5:var w=null;switch(lt.tag){case 26:w=lt.memoizedState;case 5:case 27:var N=lt;if(w?Yp(w):N.stateNode.complete){kt=0,In=null;var U=N.sibling;if(U!==null)lt=U;else{var P=N.return;P!==null?(lt=P,Bo(P)):lt=null}break t}}kt=0,In=null,Za(e,n,p,5);break;case 6:kt=0,In=null,Za(e,n,p,6);break;case 8:yf(),Vt=6;break e;default:throw Error(i(462))}}G2();break}catch(ie){Px(e,ie)}while(!0);return Hl=ta=null,Y.H=s,Y.A=h,bt=a,lt!==null?0:(Tt=null,st=0,to(),Vt)}function G2(){for(;lt!==null&&!Lt();)lp(lt)}function lp(e){var n=Nx(e.alternate,e,Wl);e.memoizedProps=e.pendingProps,n===null?Bo(e):lt=n}function rp(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=wx(a,n,n.pendingProps,n.type,void 0,st);break;case 11:n=wx(a,n,n.pendingProps,n.type.render,n.ref,st);break;case 5:Mu(n);default:Tx(a,n),n=lt=nm(n,Wl),n=Nx(a,n,Wl)}e.memoizedProps=e.pendingProps,n===null?Bo(e):lt=n}function Za(e,n,a,s){Hl=ta=null,Mu(n),Ha=null,Bi=0;var h=n.return;try{if(_2(e,h,n,a,st)){Vt=1,jo(e,Jn(a,e.current)),lt=null;return}}catch(p){if(h!==null)throw lt=h,p;Vt=1,jo(e,Jn(a,e.current)),lt=null;return}n.flags&32768?(ut||s===1?e=!0:Ga||(st&536870912)!==0?e=!1:(wr=e=!0,(s===2||s===9||s===3||s===6)&&(s=Hn.current,s!==null&&s.tag===13&&(s.flags|=16384))),ap(n,e)):Bo(n)}function Bo(e){var n=e;do{if((n.flags&32768)!==0){ap(n,wr);return}e=n.return;var a=L2(n.alternate,n,Wl);if(a!==null){lt=a;return}if(n=n.sibling,n!==null){lt=n;return}lt=n=e}while(n!==null);Vt===0&&(Vt=5)}function ap(e,n){do{var a=$2(e.alternate,e);if(a!==null){a.flags&=32767,lt=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){lt=e;return}lt=e=a}while(e!==null);Vt=6,lt=null}function ip(e,n,a,s,h,p,w,N,U){e.cancelPendingCommit=null;do Lo();while(ln!==0);if((bt&6)!==0)throw Error(i(327));if(n!==null){if(n===e.current)throw Error(i(177));if(p=n.lanes|n.childLanes,p|=au,xi(e,a,p,w,N,U),e===Tt&&(lt=Tt=null,st=0),Qa=n,jr=e,Zl=a,mf=p,xf=h,Qx=s,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Z2(De,function(){return fp(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||s){s=Y.T,Y.T=null,h=Z.p,Z.p=2,w=bt,bt|=4;try{H2(e,n,a)}finally{bt=w,Z.p=h,Y.T=s}}ln=1,sp(),op(),cp()}}function sp(){if(ln===1){ln=0;var e=jr,n=Qa,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=Y.T,Y.T=null;var s=Z.p;Z.p=2;var h=bt;bt|=4;try{Ux(n,e);var p=Df,w=Gh(e.containerInfo),N=p.focusedElem,U=p.selectionRange;if(w!==N&&N&&N.ownerDocument&&Vh(N.ownerDocument.documentElement,N)){if(U!==null&&eu(N)){var P=U.start,ie=U.end;if(ie===void 0&&(ie=P),"selectionStart"in N)N.selectionStart=P,N.selectionEnd=Math.min(ie,N.value.length);else{var ue=N.ownerDocument||document,ne=ue&&ue.defaultView||window;if(ne.getSelection){var le=ne.getSelection(),Ae=N.textContent.length,Ye=Math.min(U.start,Ae),Nt=U.end===void 0?Ye:Math.min(U.end,Ae);!le.extend&&Ye>Nt&&(w=Nt,Nt=Ye,Ye=w);var K=Xh(N,Ye),q=Xh(N,Nt);if(K&&q&&(le.rangeCount!==1||le.anchorNode!==K.node||le.anchorOffset!==K.offset||le.focusNode!==q.node||le.focusOffset!==q.offset)){var J=ue.createRange();J.setStart(K.node,K.offset),le.removeAllRanges(),Ye>Nt?(le.addRange(J),le.extend(q.node,q.offset)):(J.setEnd(q.node,q.offset),le.addRange(J))}}}}for(ue=[],le=N;le=le.parentNode;)le.nodeType===1&&ue.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<ue.length;N++){var oe=ue[N];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}Wo=!!Tf,Df=Tf=null}finally{bt=h,Z.p=s,Y.T=a}}e.current=n,ln=2}}function op(){if(ln===2){ln=0;var e=jr,n=Qa,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=Y.T,Y.T=null;var s=Z.p;Z.p=2;var h=bt;bt|=4;try{Ox(e,n.alternate,n)}finally{bt=h,Z.p=s,Y.T=a}}ln=3}}function cp(){if(ln===4||ln===3){ln=0,gt();var e=jr,n=Qa,a=Zl,s=Qx;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?ln=5:(ln=0,Qa=jr=null,up(e,e.pendingLanes));var h=e.pendingLanes;if(h===0&&(Sr=null),ml(a),n=n.stateNode,Xe&&typeof Xe.onCommitFiberRoot=="function")try{Xe.onCommitFiberRoot(wt,n,void 0,(n.current.flags&128)===128)}catch{}if(s!==null){n=Y.T,h=Z.p,Z.p=2,Y.T=null;try{for(var p=e.onRecoverableError,w=0;w<s.length;w++){var N=s[w];p(N.value,{componentStack:N.stack})}}finally{Y.T=n,Z.p=h}}(Zl&3)!==0&&Lo(),vl(e),h=e.pendingLanes,(a&261930)!==0&&(h&42)!==0?e===pf?es++:(es=0,pf=e):es=0,ts(0)}}function up(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,_i(n)))}function Lo(){return sp(),op(),cp(),fp()}function fp(){if(ln!==5)return!1;var e=jr,n=mf;mf=0;var a=ml(Zl),s=Y.T,h=Z.p;try{Z.p=32>a?32:a,Y.T=null,a=xf,xf=null;var p=jr,w=Zl;if(ln=0,Qa=jr=null,Zl=0,(bt&6)!==0)throw Error(i(331));var N=bt;if(bt|=4,Vx(p.current),Yx(p,p.current,w,a),bt=N,ts(0,!1),Xe&&typeof Xe.onPostCommitFiberRoot=="function")try{Xe.onPostCommitFiberRoot(wt,p)}catch{}return!0}finally{Z.p=h,Y.T=s,up(e,n)}}function dp(e,n,a){n=Jn(a,n),n=Gu(e.stateNode,n,2),e=yr(e,n,2),e!==null&&(ar(e,2),vl(e))}function St(e,n,a){if(e.tag===3)dp(e,e,a);else for(;n!==null;){if(n.tag===3){dp(n,e,a);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Sr===null||!Sr.has(s))){e=Jn(a,e),a=hx(2),s=yr(n,a,2),s!==null&&(mx(a,s,n,e),ar(s,2),vl(s));break}}n=n.return}}function bf(e,n,a){var s=e.pingCache;if(s===null){s=e.pingCache=new Y2;var h=new Set;s.set(n,h)}else h=s.get(n),h===void 0&&(h=new Set,s.set(n,h));h.has(a)||(ff=!0,h.add(a),e=K2.bind(null,e,n,a),n.then(e,e))}function K2(e,n,a){var s=e.pingCache;s!==null&&s.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Tt===e&&(st&a)===a&&(Vt===4||Vt===3&&(st&62914560)===st&&300>ht()-Mo?(bt&2)===0&&Wa(e,0):df|=a,Ka===st&&(Ka=0)),vl(e)}function hp(e,n){n===0&&(n=Us()),e=Jr(e,n),e!==null&&(ar(e,n),vl(e))}function Q2(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),hp(e,a)}function W2(e,n){var a=0;switch(e.tag){case 31:case 13:var s=e.stateNode,h=e.memoizedState;h!==null&&(a=h.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),hp(e,a)}function Z2(e,n){return Oe(e,n)}var $o=null,Ja=null,vf=!1,Ho=!1,wf=!1,Er=0;function vl(e){e!==Ja&&e.next===null&&(Ja===null?$o=Ja=e:Ja=Ja.next=e),Ho=!0,vf||(vf=!0,P2())}function ts(e,n){if(!wf&&Ho){wf=!0;do for(var a=!1,s=$o;s!==null;){if(e!==0){var h=s.pendingLanes;if(h===0)var p=0;else{var w=s.suspendedLanes,N=s.pingedLanes;p=(1<<31-fe(42|e)+1)-1,p&=h&~(w&~N),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,yp(s,p))}else p=st,p=rr(s,s===Tt?p:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(p&3)===0||qr(s,p)||(a=!0,yp(s,p));s=s.next}while(a);wf=!1}}function J2(){mp()}function mp(){Ho=vf=!1;var e=0;Er!==0&&cb()&&(e=Er);for(var n=ht(),a=null,s=$o;s!==null;){var h=s.next,p=xp(s,n);p===0?(s.next=null,a===null?$o=h:a.next=h,h===null&&(Ja=a)):(a=s,(e!==0||(p&3)!==0)&&(Ho=!0)),s=h}ln!==0&&ln!==5||ts(e),Er!==0&&(Er=0)}function xp(e,n){for(var a=e.suspendedLanes,s=e.pingedLanes,h=e.expirationTimes,p=e.pendingLanes&-62914561;0<p;){var w=31-fe(p),N=1<<w,U=h[w];U===-1?((N&a)===0||(N&s)!==0)&&(h[w]=ka(N,n)):U<=n&&(e.expiredLanes|=N),p&=~N}if(n=Tt,a=st,a=rr(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,a===0||e===n&&(kt===2||kt===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&tt(s),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||qr(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(s!==null&&tt(s),ml(a)){case 2:case 8:a=xe;break;case 32:a=De;break;case 268435456:a=ye;break;default:a=De}return s=pp.bind(null,e),a=Oe(a,s),e.callbackPriority=n,e.callbackNode=a,n}return s!==null&&s!==null&&tt(s),e.callbackPriority=2,e.callbackNode=null,2}function pp(e,n){if(ln!==0&&ln!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Lo()&&e.callbackNode!==a)return null;var s=st;return s=rr(e,e===Tt?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Zx(e,s,n),xp(e,ht()),e.callbackNode!=null&&e.callbackNode===a?pp.bind(null,e):null)}function yp(e,n){if(Lo())return null;Zx(e,n,!0)}function P2(){fb(function(){(bt&6)!==0?Oe(ae,J2):mp()})}function kf(){if(Er===0){var e=Ba;e===0&&(e=lr,lr<<=1,(lr&261888)===0&&(lr=256)),Er=e}return Er}function gp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Bn(""+e)}function bp(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function eb(e,n,a,s,h){if(n==="submit"&&a&&a.stateNode===h){var p=gp((h[cn]||null).action),w=s.submitter;w&&(n=(n=w[cn]||null)?gp(n.formAction):w.getAttribute("formAction"),n!==null&&(p=n,w=null));var N=new Zs("action","action",null,s,h);e.push({event:N,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Er!==0){var U=w?bp(h,w):new FormData(h);Uu(a,{pending:!0,data:U,method:h.method,action:p},null,U)}}else typeof p=="function"&&(N.preventDefault(),U=w?bp(h,w):new FormData(h),Uu(a,{pending:!0,data:U,method:h.method,action:p},p,U))},currentTarget:h}]})}}for(var Sf=0;Sf<ru.length;Sf++){var jf=ru[Sf],tb=jf.toLowerCase(),nb=jf[0].toUpperCase()+jf.slice(1);ol(tb,"on"+nb)}ol(Wh,"onAnimationEnd"),ol(Zh,"onAnimationIteration"),ol(Jh,"onAnimationStart"),ol("dblclick","onDoubleClick"),ol("focusin","onFocus"),ol("focusout","onBlur"),ol(g2,"onTransitionRun"),ol(b2,"onTransitionStart"),ol(v2,"onTransitionCancel"),ol(Ph,"onTransitionEnd"),Kt("onMouseEnter",["mouseout","mouseover"]),Kt("onMouseLeave",["mouseout","mouseover"]),Kt("onPointerEnter",["pointerout","pointerover"]),Kt("onPointerLeave",["pointerout","pointerover"]),Cn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Cn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Cn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Cn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Cn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Cn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ns="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(" "),lb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ns));function vp(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var s=e[a],h=s.event;s=s.listeners;e:{var p=void 0;if(n)for(var w=s.length-1;0<=w;w--){var N=s[w],U=N.instance,P=N.currentTarget;if(N=N.listener,U!==p&&h.isPropagationStopped())break e;p=N,h.currentTarget=P;try{p(h)}catch(ie){eo(ie)}h.currentTarget=null,p=U}else for(w=0;w<s.length;w++){if(N=s[w],U=N.instance,P=N.currentTarget,N=N.listener,U!==p&&h.isPropagationStopped())break e;p=N,h.currentTarget=P;try{p(h)}catch(ie){eo(ie)}h.currentTarget=null,p=U}}}}function rt(e,n){var a=n[Gr];a===void 0&&(a=n[Gr]=new Set);var s=e+"__bubble";a.has(s)||(wp(n,e,2,!1),a.add(s))}function Cf(e,n,a){var s=0;n&&(s|=4),wp(a,e,s,n)}var Uo="_reactListening"+Math.random().toString(36).slice(2);function Ef(e){if(!e[Uo]){e[Uo]=!0,sr.forEach(function(a){a!=="selectionchange"&&(lb.has(a)||Cf(a,!1,e),Cf(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Uo]||(n[Uo]=!0,Cf("selectionchange",!1,n))}}function wp(e,n,a,s){switch(Wp(n)){case 2:var h=zb;break;case 8:h=Mb;break;default:h=Uf}a=h.bind(null,n,a,e),h=void 0,!he||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(h=!0),s?h!==void 0?e.addEventListener(n,a,{capture:!0,passive:h}):e.addEventListener(n,a,!0):h!==void 0?e.addEventListener(n,a,{passive:h}):e.addEventListener(n,a,!1)}function Nf(e,n,a,s,h){var p=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===h)break;if(w===4)for(w=s.return;w!==null;){var U=w.tag;if((U===3||U===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;N!==null;){if(w=Ol(N),w===null)return;if(U=w.tag,U===5||U===6||U===26||U===27){s=p=w;continue e}N=N.parentNode}}s=s.return}Ci(function(){var P=p,ie=Si(a),ue=[];e:{var ne=em.get(e);if(ne!==void 0){var le=Zs,Ae=e;switch(e){case"keypress":if(nt(a)===0)break e;case"keydown":case"keyup":le=Wg;break;case"focusin":Ae="focus",le=Qc;break;case"focusout":Ae="blur",le=Qc;break;case"beforeblur":case"afterblur":le=Qc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=Th;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=Lg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=Pg;break;case Wh:case Zh:case Jh:le=Ug;break;case Ph:le=t2;break;case"scroll":case"scrollend":le=Og;break;case"wheel":le=l2;break;case"copy":case"cut":case"paste":le=Yg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=zh;break;case"toggle":case"beforetoggle":le=a2}var Ye=(n&4)!==0,Nt=!Ye&&(e==="scroll"||e==="scrollend"),K=Ye?ne!==null?ne+"Capture":null:ne;Ye=[];for(var q=P,J;q!==null;){var oe=q;if(J=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||J===null||K===null||(oe=_(q,K),oe!=null&&Ye.push(ls(q,oe,J))),Nt)break;q=q.return}0<Ye.length&&(ne=new le(ne,Ae,null,a,ie),ue.push({event:ne,listeners:Ye}))}}if((n&7)===0){e:{if(ne=e==="mouseover"||e==="pointerover",le=e==="mouseout"||e==="pointerout",ne&&a!==ki&&(Ae=a.relatedTarget||a.fromElement)&&(Ol(Ae)||Ae[Fl]))break e;if((le||ne)&&(ne=ie.window===ie?ie:(ne=ie.ownerDocument)?ne.defaultView||ne.parentWindow:window,le?(Ae=a.relatedTarget||a.toElement,le=P,Ae=Ae?Ol(Ae):null,Ae!==null&&(Nt=u(Ae),Ye=Ae.tag,Ae!==Nt||Ye!==5&&Ye!==27&&Ye!==6)&&(Ae=null)):(le=null,Ae=P),le!==Ae)){if(Ye=Th,oe="onMouseLeave",K="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(Ye=zh,oe="onPointerLeave",K="onPointerEnter",q="pointer"),Nt=le==null?ne:Bl(le),J=Ae==null?ne:Bl(Ae),ne=new Ye(oe,q+"leave",le,a,ie),ne.target=Nt,ne.relatedTarget=J,oe=null,Ol(ie)===P&&(Ye=new Ye(K,q+"enter",Ae,a,ie),Ye.target=J,Ye.relatedTarget=Nt,oe=Ye),Nt=oe,le&&Ae)t:{for(Ye=rb,K=le,q=Ae,J=0,oe=K;oe;oe=Ye(oe))J++;oe=0;for(var $e=q;$e;$e=Ye($e))oe++;for(;0<J-oe;)K=Ye(K),J--;for(;0<oe-J;)q=Ye(q),oe--;for(;J--;){if(K===q||q!==null&&K===q.alternate){Ye=K;break t}K=Ye(K),q=Ye(q)}Ye=null}else Ye=null;le!==null&&kp(ue,ne,le,Ye,!1),Ae!==null&&Nt!==null&&kp(ue,Nt,Ae,Ye,!0)}}e:{if(ne=P?Bl(P):window,le=ne.nodeName&&ne.nodeName.toLowerCase(),le==="select"||le==="input"&&ne.type==="file")var mt=$h;else if(Bh(ne))if(Hh)mt=x2;else{mt=h2;var Fe=d2}else le=ne.nodeName,!le||le.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?P&&Ea(P.elementType)&&(mt=$h):mt=m2;if(mt&&(mt=mt(e,P))){Lh(ue,mt,a,ie);break e}Fe&&Fe(e,ne,P),e==="focusout"&&P&&ne.type==="number"&&P.memoizedProps.value!=null&&wi(ne,"number",ne.value)}switch(Fe=P?Bl(P):window,e){case"focusin":(Bh(Fe)||Fe.contentEditable==="true")&&(Ta=Fe,tu=P,Mi=null);break;case"focusout":Mi=tu=Ta=null;break;case"mousedown":nu=!0;break;case"contextmenu":case"mouseup":case"dragend":nu=!1,Kh(ue,a,ie);break;case"selectionchange":if(y2)break;case"keydown":case"keyup":Kh(ue,a,ie)}var We;if(Zc)e:{switch(e){case"compositionstart":var ot="onCompositionStart";break e;case"compositionend":ot="onCompositionEnd";break e;case"compositionupdate":ot="onCompositionUpdate";break e}ot=void 0}else Aa?_h(e,a)&&(ot="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(ot="onCompositionStart");ot&&(Mh&&a.locale!=="ko"&&(Aa||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&Aa&&(We=Je()):(ge=ie,Re="value"in ge?ge.value:ge.textContent,Aa=!0)),Fe=Io(P,ot),0<Fe.length&&(ot=new Dh(ot,e,null,a,ie),ue.push({event:ot,listeners:Fe}),We?ot.data=We:(We=Oh(a),We!==null&&(ot.data=We)))),(We=s2?o2(e,a):c2(e,a))&&(ot=Io(P,"onBeforeInput"),0<ot.length&&(Fe=new Dh("onBeforeInput","beforeinput",null,a,ie),ue.push({event:Fe,listeners:ot}),Fe.data=We)),eb(ue,e,P,a,ie)}vp(ue,n)})}function ls(e,n,a){return{instance:e,listener:n,currentTarget:a}}function Io(e,n){for(var a=n+"Capture",s=[];e!==null;){var h=e,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=_(e,a),h!=null&&s.unshift(ls(e,h,p)),h=_(e,n),h!=null&&s.push(ls(e,h,p))),e.tag===3)return s;e=e.return}return[]}function rb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function kp(e,n,a,s,h){for(var p=n._reactName,w=[];a!==null&&a!==s;){var N=a,U=N.alternate,P=N.stateNode;if(N=N.tag,U!==null&&U===s)break;N!==5&&N!==26&&N!==27||P===null||(U=P,h?(P=_(a,p),P!=null&&w.unshift(ls(a,P,U))):h||(P=_(a,p),P!=null&&w.push(ls(a,P,U)))),a=a.return}w.length!==0&&e.push({event:n,listeners:w})}var ab=/\r\n?/g,ib=/\u0000|\uFFFD/g;function Sp(e){return(typeof e=="string"?e:""+e).replace(ab,`
49
+ `).replace(ib,"")}function jp(e,n){return n=Sp(n),Sp(e)===n}function Et(e,n,a,s,h,p){switch(a){case"children":typeof s=="string"?n==="body"||n==="textarea"&&s===""||ur(e,s):(typeof s=="number"||typeof s=="bigint")&&n!=="body"&&ur(e,""+s);break;case"className":pl(e,"class",s);break;case"tabIndex":pl(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":pl(e,a,s);break;case"style":sl(e,s,p);break;case"data":if(n!=="object"){pl(e,"data",s);break}case"src":case"href":if(s===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=Bn(""+s),e.setAttribute(a,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(a==="formAction"?(n!=="input"&&Et(e,n,"name",h.name,h,null),Et(e,n,"formEncType",h.formEncType,h,null),Et(e,n,"formMethod",h.formMethod,h,null),Et(e,n,"formTarget",h.formTarget,h,null)):(Et(e,n,"encType",h.encType,h,null),Et(e,n,"method",h.method,h,null),Et(e,n,"target",h.target,h,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=Bn(""+s),e.setAttribute(a,s);break;case"onClick":s!=null&&(e.onclick=Qn);break;case"onScroll":s!=null&&rt("scroll",e);break;case"onScrollEnd":s!=null&&rt("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(i(61));if(a=s.__html,a!=null){if(h.children!=null)throw Error(i(60));e.innerHTML=a}}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}a=Bn(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);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(a,""+s):e.removeAttribute(a);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(a,""):e.removeAttribute(a);break;case"capture":case"download":s===!0?e.setAttribute(a,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,s):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(a,s):e.removeAttribute(a);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(a):e.setAttribute(a,s);break;case"popover":rt("beforetoggle",e),rt("toggle",e),Ca(e,"popover",s);break;case"xlinkActuate":bn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":bn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":bn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":bn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":bn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":bn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":bn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":bn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":bn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Ca(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Xc.get(a)||a,Ca(e,a,s))}}function Af(e,n,a,s,h,p){switch(a){case"style":sl(e,s,p);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(i(61));if(a=s.__html,a!=null){if(h.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"children":typeof s=="string"?ur(e,s):(typeof s=="number"||typeof s=="bigint")&&ur(e,""+s);break;case"onScroll":s!=null&&rt("scroll",e);break;case"onScrollEnd":s!=null&&rt("scrollend",e);break;case"onClick":s!=null&&(e.onclick=Qn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xs.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(h=a.endsWith("Capture"),n=a.slice(2,h?a.length-7:void 0),p=e[cn]||null,p=p!=null?p[a]:null,typeof p=="function"&&e.removeEventListener(n,p,h),typeof s=="function")){typeof p!="function"&&p!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,s,h);break e}a in e?e[a]=s:s===!0?e.setAttribute(a,""):Ca(e,a,s)}}}function mn(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":rt("error",e),rt("load",e);var s=!1,h=!1,p;for(p in a)if(a.hasOwnProperty(p)){var w=a[p];if(w!=null)switch(p){case"src":s=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Et(e,n,p,w,a,null)}}h&&Et(e,n,"srcSet",a.srcSet,a,null),s&&Et(e,n,"src",a.src,a,null);return;case"input":rt("invalid",e);var N=p=w=h=null,U=null,P=null;for(s in a)if(a.hasOwnProperty(s)){var ie=a[s];if(ie!=null)switch(s){case"name":h=ie;break;case"type":w=ie;break;case"checked":U=ie;break;case"defaultChecked":P=ie;break;case"value":p=ie;break;case"defaultValue":N=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(i(137,n));break;default:Et(e,n,s,ie,a,null)}}vi(e,p,N,U,P,w,h,!1);return;case"select":rt("invalid",e),s=w=p=null;for(h in a)if(a.hasOwnProperty(h)&&(N=a[h],N!=null))switch(h){case"value":p=N;break;case"defaultValue":w=N;break;case"multiple":s=N;default:Et(e,n,h,N,a,null)}n=p,a=w,e.multiple=!!s,n!=null?cr(e,!!s,n,!1):a!=null&&cr(e,!!s,a,!0);return;case"textarea":rt("invalid",e),p=h=s=null;for(w in a)if(a.hasOwnProperty(w)&&(N=a[w],N!=null))switch(w){case"value":s=N;break;case"defaultValue":h=N;break;case"children":p=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(i(91));break;default:Et(e,n,w,N,a,null)}Qs(e,s,h,p);return;case"option":for(U in a)if(a.hasOwnProperty(U)&&(s=a[U],s!=null))switch(U){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:Et(e,n,U,s,a,null)}return;case"dialog":rt("beforetoggle",e),rt("toggle",e),rt("cancel",e),rt("close",e);break;case"iframe":case"object":rt("load",e);break;case"video":case"audio":for(s=0;s<ns.length;s++)rt(ns[s],e);break;case"image":rt("error",e),rt("load",e);break;case"details":rt("toggle",e);break;case"embed":case"source":case"link":rt("error",e),rt("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(P in a)if(a.hasOwnProperty(P)&&(s=a[P],s!=null))switch(P){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Et(e,n,P,s,a,null)}return;default:if(Ea(n)){for(ie in a)a.hasOwnProperty(ie)&&(s=a[ie],s!==void 0&&Af(e,n,ie,s,a,void 0));return}}for(N in a)a.hasOwnProperty(N)&&(s=a[N],s!=null&&Et(e,n,N,s,a,null))}function sb(e,n,a,s){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,w=null,N=null,U=null,P=null,ie=null;for(le in a){var ue=a[le];if(a.hasOwnProperty(le)&&ue!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":U=ue;default:s.hasOwnProperty(le)||Et(e,n,le,null,s,ue)}}for(var ne in s){var le=s[ne];if(ue=a[ne],s.hasOwnProperty(ne)&&(le!=null||ue!=null))switch(ne){case"type":p=le;break;case"name":h=le;break;case"checked":P=le;break;case"defaultChecked":ie=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!==ue&&Et(e,n,ne,le,s,ue)}}bi(e,w,N,U,P,ie,p,h);return;case"select":le=w=N=ne=null;for(p in a)if(U=a[p],a.hasOwnProperty(p)&&U!=null)switch(p){case"value":break;case"multiple":le=U;default:s.hasOwnProperty(p)||Et(e,n,p,null,s,U)}for(h in s)if(p=s[h],U=a[h],s.hasOwnProperty(h)&&(p!=null||U!=null))switch(h){case"value":ne=p;break;case"defaultValue":N=p;break;case"multiple":w=p;default:p!==U&&Et(e,n,h,p,s,U)}n=N,a=w,s=le,ne!=null?cr(e,!!a,ne,!1):!!s!=!!a&&(n!=null?cr(e,!!a,n,!0):cr(e,!!a,a?[]:"",!1));return;case"textarea":le=ne=null;for(N in a)if(h=a[N],a.hasOwnProperty(N)&&h!=null&&!s.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:Et(e,n,N,null,s,h)}for(w in s)if(h=s[w],p=a[w],s.hasOwnProperty(w)&&(h!=null||p!=null))switch(w){case"value":ne=h;break;case"defaultValue":le=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(i(91));break;default:h!==p&&Et(e,n,w,h,s,p)}Ks(e,ne,le);return;case"option":for(var Ae in a)if(ne=a[Ae],a.hasOwnProperty(Ae)&&ne!=null&&!s.hasOwnProperty(Ae))switch(Ae){case"selected":e.selected=!1;break;default:Et(e,n,Ae,null,s,ne)}for(U in s)if(ne=s[U],le=a[U],s.hasOwnProperty(U)&&ne!==le&&(ne!=null||le!=null))switch(U){case"selected":e.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:Et(e,n,U,ne,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 Ye in a)ne=a[Ye],a.hasOwnProperty(Ye)&&ne!=null&&!s.hasOwnProperty(Ye)&&Et(e,n,Ye,null,s,ne);for(P in s)if(ne=s[P],le=a[P],s.hasOwnProperty(P)&&ne!==le&&(ne!=null||le!=null))switch(P){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(i(137,n));break;default:Et(e,n,P,ne,s,le)}return;default:if(Ea(n)){for(var Nt in a)ne=a[Nt],a.hasOwnProperty(Nt)&&ne!==void 0&&!s.hasOwnProperty(Nt)&&Af(e,n,Nt,void 0,s,ne);for(ie in s)ne=s[ie],le=a[ie],!s.hasOwnProperty(ie)||ne===le||ne===void 0&&le===void 0||Af(e,n,ie,ne,s,le);return}}for(var K in a)ne=a[K],a.hasOwnProperty(K)&&ne!=null&&!s.hasOwnProperty(K)&&Et(e,n,K,null,s,ne);for(ue in s)ne=s[ue],le=a[ue],!s.hasOwnProperty(ue)||ne===le||ne==null&&le==null||Et(e,n,ue,ne,s,le)}function Cp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function ob(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),s=0;s<a.length;s++){var h=a[s],p=h.transferSize,w=h.initiatorType,N=h.duration;if(p&&N&&Cp(w)){for(w=0,N=h.responseEnd,s+=1;s<a.length;s++){var U=a[s],P=U.startTime;if(P>N)break;var ie=U.transferSize,ue=U.initiatorType;ie&&Cp(ue)&&(U=U.responseEnd,w+=ie*(U<N?1:(N-P)/(U-P)))}if(--s,n+=8*(p+w)/(h.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 Tf=null,Df=null;function Yo(e){return e.nodeType===9?e:e.ownerDocument}function Ep(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 Np(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 zf(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 Mf=null;function cb(){var e=window.event;return e&&e.type==="popstate"?e===Mf?!1:(Mf=e,!0):(Mf=null,!1)}var Ap=typeof setTimeout=="function"?setTimeout:void 0,ub=typeof clearTimeout=="function"?clearTimeout:void 0,Tp=typeof Promise=="function"?Promise:void 0,fb=typeof queueMicrotask=="function"?queueMicrotask:typeof Tp<"u"?function(e){return Tp.resolve(null).then(e).catch(db)}:Ap;function db(e){setTimeout(function(){throw e})}function Nr(e){return e==="head"}function Dp(e,n){var a=n,s=0;do{var h=a.nextSibling;if(e.removeChild(a),h&&h.nodeType===8)if(a=h.data,a==="/$"||a==="/&"){if(s===0){e.removeChild(h),ni(n);return}s--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")s++;else if(a==="html")rs(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,rs(a);for(var p=a.firstChild;p;){var w=p.nextSibling,N=p.nodeName;p[_l]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=w}}else a==="body"&&rs(e.ownerDocument.body);a=h}while(a);ni(n)}function zp(e,n){var a=e;e=0;do{var s=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),s&&s.nodeType===8)if(a=s.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=s}while(a)}function Rf(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Rf(a),Sa(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function hb(e,n,a,s){for(;e.nodeType===1;){var h=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[_l])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(p=e.getAttribute("rel"),p==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(p!==h.rel||e.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||e.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||e.getAttribute("title")!==(h.title==null?null:h.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(p=e.getAttribute("src"),(p!==(h.src==null?null:h.src)||e.getAttribute("type")!==(h.type==null?null:h.type)||e.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&e.getAttribute("name")===p)return e}else return e;if(e=ll(e.nextSibling),e===null)break}return null}function mb(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=ll(e.nextSibling),e===null))return null;return e}function Mp(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ll(e.nextSibling),e===null))return null;return e}function Ff(e){return e.data==="$?"||e.data==="$~"}function _f(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function xb(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var s=function(){n(),a.removeEventListener("DOMContentLoaded",s)};a.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function ll(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 Of=null;function Rp(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return ll(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function Fp(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function _p(e,n,a){switch(n=Yo(a),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 rs(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Sa(e)}var rl=new Map,Op=new Set;function qo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Jl=Z.d;Z.d={f:pb,r:yb,D:gb,C:bb,L:vb,m:wb,X:Sb,S:kb,M:jb};function pb(){var e=Jl.f(),n=_o();return e||n}function yb(e){var n=ir(e);n!==null&&n.tag===5&&n.type==="form"?Pm(n):Jl.r(e)}var Pa=typeof document>"u"?null:document;function Bp(e,n,a){var s=Pa;if(s&&typeof n=="string"&&n){var h=Nn(n);h='link[rel="'+e+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),Op.has(h)||(Op.add(h),e={rel:e,crossOrigin:a,href:n},s.querySelector(h)===null&&(n=s.createElement("link"),mn(n,"link",e),Ft(n),s.head.appendChild(n)))}}function gb(e){Jl.D(e),Bp("dns-prefetch",e,null)}function bb(e,n){Jl.C(e,n),Bp("preconnect",e,n)}function vb(e,n,a){Jl.L(e,n,a);var s=Pa;if(s&&e&&n){var h='link[rel="preload"][as="'+Nn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+Nn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+Nn(a.imageSizes)+'"]')):h+='[href="'+Nn(e)+'"]';var p=h;switch(n){case"style":p=ei(e);break;case"script":p=ti(e)}rl.has(p)||(e=y({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),rl.set(p,e),s.querySelector(h)!==null||n==="style"&&s.querySelector(as(p))||n==="script"&&s.querySelector(is(p))||(n=s.createElement("link"),mn(n,"link",e),Ft(n),s.head.appendChild(n)))}}function wb(e,n){Jl.m(e,n);var a=Pa;if(a&&e){var s=n&&typeof n.as=="string"?n.as:"script",h='link[rel="modulepreload"][as="'+Nn(s)+'"][href="'+Nn(e)+'"]',p=h;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=ti(e)}if(!rl.has(p)&&(e=y({rel:"modulepreload",href:e},n),rl.set(p,e),a.querySelector(h)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(is(p)))return}s=a.createElement("link"),mn(s,"link",e),Ft(s),a.head.appendChild(s)}}}function kb(e,n,a){Jl.S(e,n,a);var s=Pa;if(s&&e){var h=un(s).hoistableStyles,p=ei(e);n=n||"default";var w=h.get(p);if(!w){var N={loading:0,preload:null};if(w=s.querySelector(as(p)))N.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},a),(a=rl.get(p))&&Bf(e,a);var U=w=s.createElement("link");Ft(U),mn(U,"link",e),U._p=new Promise(function(P,ie){U.onload=P,U.onerror=ie}),U.addEventListener("load",function(){N.loading|=1}),U.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Xo(w,n,s)}w={type:"stylesheet",instance:w,count:1,state:N},h.set(p,w)}}}function Sb(e,n){Jl.X(e,n);var a=Pa;if(a&&e){var s=un(a).hoistableScripts,h=ti(e),p=s.get(h);p||(p=a.querySelector(is(h)),p||(e=y({src:e,async:!0},n),(n=rl.get(h))&&Lf(e,n),p=a.createElement("script"),Ft(p),mn(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},s.set(h,p))}}function jb(e,n){Jl.M(e,n);var a=Pa;if(a&&e){var s=un(a).hoistableScripts,h=ti(e),p=s.get(h);p||(p=a.querySelector(is(h)),p||(e=y({src:e,async:!0,type:"module"},n),(n=rl.get(h))&&Lf(e,n),p=a.createElement("script"),Ft(p),mn(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},s.set(h,p))}}function Lp(e,n,a,s){var h=(h=Ee.current)?qo(h):null;if(!h)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=ei(a.href),a=un(h).hoistableStyles,s=a.get(n),s||(s={type:"style",instance:null,count:0,state:null},a.set(n,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=ei(a.href);var p=un(h).hoistableStyles,w=p.get(e);if(w||(h=h.ownerDocument||h,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,w),(p=h.querySelector(as(e)))&&!p._p&&(w.instance=p,w.state.loading=5),rl.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},rl.set(e,a),p||Cb(h,e,a,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=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=ti(a),a=un(h).hoistableScripts,s=a.get(n),s||(s={type:"script",instance:null,count:0,state:null},a.set(n,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function ei(e){return'href="'+Nn(e)+'"'}function as(e){return'link[rel="stylesheet"]['+e+"]"}function $p(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function Cb(e,n,a,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}),mn(n,"link",a),Ft(n),e.head.appendChild(n))}function ti(e){return'[src="'+Nn(e)+'"]'}function is(e){return"script[async]"+e}function Hp(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var s=e.querySelector('style[data-href~="'+Nn(a.href)+'"]');if(s)return n.instance=s,Ft(s),s;var h=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Ft(s),mn(s,"style",h),Xo(s,a.precedence,e),n.instance=s;case"stylesheet":h=ei(a.href);var p=e.querySelector(as(h));if(p)return n.state.loading|=4,n.instance=p,Ft(p),p;s=$p(a),(h=rl.get(h))&&Bf(s,h),p=(e.ownerDocument||e).createElement("link"),Ft(p);var w=p;return w._p=new Promise(function(N,U){w.onload=N,w.onerror=U}),mn(p,"link",s),n.state.loading|=4,Xo(p,a.precedence,e),n.instance=p;case"script":return p=ti(a.src),(h=e.querySelector(is(p)))?(n.instance=h,Ft(h),h):(s=a,(h=rl.get(p))&&(s=y({},a),Lf(s,h)),e=e.ownerDocument||e,h=e.createElement("script"),Ft(h),mn(h,"link",s),e.head.appendChild(h),n.instance=h);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(s=n.instance,n.state.loading|=4,Xo(s,a.precedence,e));return n.instance}function Xo(e,n,a){for(var s=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=s.length?s[s.length-1]:null,p=h,w=0;w<s.length;w++){var N=s[w];if(N.dataset.precedence===n)p=N;else if(p!==h)break}p?p.parentNode.insertBefore(e,p.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function Bf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Lf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Vo=null;function Up(e,n,a){if(Vo===null){var s=new Map,h=Vo=new Map;h.set(a,s)}else h=Vo,s=h.get(a),s||(s=new Map,h.set(a,s));if(s.has(e))return s;for(s.set(e,null),a=a.getElementsByTagName(e),h=0;h<a.length;h++){var p=a[h];if(!(p[_l]||p[$t]||e==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var w=p.getAttribute(n)||"";w=e+w;var N=s.get(w);N?N.push(p):s.set(w,[p])}}return s}function Ip(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function Eb(e,n,a){if(a===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 Yp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Nb(e,n,a,s){if(a.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var h=ei(s.href),p=n.querySelector(as(h));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Go.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=p,Ft(p);return}p=n.ownerDocument||n,s=$p(s),(h=rl.get(h))&&Bf(s,h),p=p.createElement("link"),Ft(p);var w=p;w._p=new Promise(function(N,U){w.onload=N,w.onerror=U}),mn(p,"link",s),a.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Go.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var $f=0;function Ab(e,n){return e.stylesheets&&e.count===0&&Qo(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var s=setTimeout(function(){if(e.stylesheets&&Qo(e,e.stylesheets),e.unsuspend){var p=e.unsuspend;e.unsuspend=null,p()}},6e4+n);0<e.imgBytes&&$f===0&&($f=62500*ob());var h=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Qo(e,e.stylesheets),e.unsuspend)){var p=e.unsuspend;e.unsuspend=null,p()}},(e.imgBytes>$f?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(h)}}:null}function Go(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Qo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ko=null;function Qo(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ko=new Map,n.forEach(Tb,e),Ko=null,Go.call(e))}function Tb(e,n){if(!(n.state.loading&4)){var a=Ko.get(e);if(a)var s=a.get(null);else{a=new Map,Ko.set(e,a);for(var h=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var w=h[p];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),s=w)}s&&a.set(null,s)}h=n.instance,w=h.getAttribute("data-precedence"),p=a.get(w)||s,p===s&&a.set(null,h),a.set(w,h),this.count++,s=Go.bind(this),h.addEventListener("load",s),h.addEventListener("error",s),p?p.parentNode.insertBefore(h,p.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(h,e.firstChild)),n.state.loading|=4}}var ss={$$typeof:M,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function Db(e,n,a,s,h,p,w,N,U){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=Xr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xr(0),this.hiddenUpdates=Xr(null),this.identifierPrefix=s,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=U,this.incompleteTransitions=new Map}function qp(e,n,a,s,h,p,w,N,U,P,ie,ue){return e=new Db(e,n,a,w,U,P,ie,ue,N),n=1,p===!0&&(n|=24),p=$n(3,null,null,n),e.current=p,p.stateNode=e,n=yu(),n.refCount++,e.pooledCache=n,n.refCount++,p.memoizedState={element:s,isDehydrated:a,cache:n},wu(p),e}function Xp(e){return e?(e=Ma,e):Ma}function Vp(e,n,a,s,h,p){h=Xp(h),s.context===null?s.context=h:s.pendingContext=h,s=pr(n),s.payload={element:a},p=p===void 0?null:p,p!==null&&(s.callback=p),a=yr(e,s,n),a!==null&&(Rn(a,e,n),$i(a,e,n))}function Gp(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function Hf(e,n){Gp(e,n),(e=e.alternate)&&Gp(e,n)}function Kp(e){if(e.tag===13||e.tag===31){var n=Jr(e,67108864);n!==null&&Rn(n,e,67108864),Hf(e,67108864)}}function Qp(e){if(e.tag===13||e.tag===31){var n=qn();n=Vr(n);var a=Jr(e,n);a!==null&&Rn(a,e,n),Hf(e,n)}}var Wo=!0;function zb(e,n,a,s){var h=Y.T;Y.T=null;var p=Z.p;try{Z.p=2,Uf(e,n,a,s)}finally{Z.p=p,Y.T=h}}function Mb(e,n,a,s){var h=Y.T;Y.T=null;var p=Z.p;try{Z.p=8,Uf(e,n,a,s)}finally{Z.p=p,Y.T=h}}function Uf(e,n,a,s){if(Wo){var h=If(s);if(h===null)Nf(e,n,s,Zo,a),Zp(e,s);else if(Fb(h,e,n,a,s))s.stopPropagation();else if(Zp(e,s),n&4&&-1<Rb.indexOf(e)){for(;h!==null;){var p=ir(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=Dl(p.pendingLanes);if(w!==0){var N=p;for(N.pendingLanes|=2,N.entangledLanes|=2;w;){var U=1<<31-fe(w);N.entanglements[1]|=U,w&=~U}vl(p),(bt&6)===0&&(Ro=ht()+500,ts(0))}}break;case 31:case 13:N=Jr(p,2),N!==null&&Rn(N,p,2),_o(),Hf(p,2)}if(p=If(s),p===null&&Nf(e,n,s,Zo,a),p===h)break;h=p}h!==null&&s.stopPropagation()}else Nf(e,n,s,null,a)}}function If(e){return e=Si(e),Yf(e)}var Zo=null;function Yf(e){if(Zo=null,e=Ol(e),e!==null){var n=u(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=f(n),e!==null)return e;e=null}else if(a===31){if(e=m(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Zo=e,null}function Wp(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(Zt()){case ae:return 2;case xe:return 8;case De:case Ue:return 32;case ye:return 268435456;default:return 32}default:return 32}}var qf=!1,Ar=null,Tr=null,Dr=null,os=new Map,cs=new Map,zr=[],Rb="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 Zp(e,n){switch(e){case"focusin":case"focusout":Ar=null;break;case"dragenter":case"dragleave":Tr=null;break;case"mouseover":case"mouseout":Dr=null;break;case"pointerover":case"pointerout":os.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":cs.delete(n.pointerId)}}function us(e,n,a,s,h,p){return e===null||e.nativeEvent!==p?(e={blockedOn:n,domEventName:a,eventSystemFlags:s,nativeEvent:p,targetContainers:[h]},n!==null&&(n=ir(n),n!==null&&Kp(n)),e):(e.eventSystemFlags|=s,n=e.targetContainers,h!==null&&n.indexOf(h)===-1&&n.push(h),e)}function Fb(e,n,a,s,h){switch(n){case"focusin":return Ar=us(Ar,e,n,a,s,h),!0;case"dragenter":return Tr=us(Tr,e,n,a,s,h),!0;case"mouseover":return Dr=us(Dr,e,n,a,s,h),!0;case"pointerover":var p=h.pointerId;return os.set(p,us(os.get(p)||null,e,n,a,s,h)),!0;case"gotpointercapture":return p=h.pointerId,cs.set(p,us(cs.get(p)||null,e,n,a,s,h)),!0}return!1}function Jp(e){var n=Ol(e.target);if(n!==null){var a=u(n);if(a!==null){if(n=a.tag,n===13){if(n=f(a),n!==null){e.blockedOn=n,Rl(e.priority,function(){Qp(a)});return}}else if(n===31){if(n=m(a),n!==null){e.blockedOn=n,Rl(e.priority,function(){Qp(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Jo(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=If(e.nativeEvent);if(a===null){a=e.nativeEvent;var s=new a.constructor(a.type,a);ki=s,a.target.dispatchEvent(s),ki=null}else return n=ir(a),n!==null&&Kp(n),e.blockedOn=a,!1;n.shift()}return!0}function Pp(e,n,a){Jo(e)&&a.delete(n)}function _b(){qf=!1,Ar!==null&&Jo(Ar)&&(Ar=null),Tr!==null&&Jo(Tr)&&(Tr=null),Dr!==null&&Jo(Dr)&&(Dr=null),os.forEach(Pp),cs.forEach(Pp)}function Po(e,n){e.blockedOn===n&&(e.blockedOn=null,qf||(qf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,_b)))}var ec=null;function e1(e){ec!==e&&(ec=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){ec===e&&(ec=null);for(var n=0;n<e.length;n+=3){var a=e[n],s=e[n+1],h=e[n+2];if(typeof s!="function"){if(Yf(s||a)===null)continue;break}var p=ir(a);p!==null&&(e.splice(n,3),n-=3,Uu(p,{pending:!0,data:h,method:a.method,action:s},s,h))}}))}function ni(e){function n(U){return Po(U,e)}Ar!==null&&Po(Ar,e),Tr!==null&&Po(Tr,e),Dr!==null&&Po(Dr,e),os.forEach(n),cs.forEach(n);for(var a=0;a<zr.length;a++){var s=zr[a];s.blockedOn===e&&(s.blockedOn=null)}for(;0<zr.length&&(a=zr[0],a.blockedOn===null);)Jp(a),a.blockedOn===null&&zr.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(s=0;s<a.length;s+=3){var h=a[s],p=a[s+1],w=h[cn]||null;if(typeof p=="function")w||e1(a);else if(w){var N=null;if(p&&p.hasAttribute("formAction")){if(h=p,w=p[cn]||null)N=w.formAction;else if(Yf(h)!==null)continue}else N=w.action;typeof N=="function"?a[s+1]=N:(a.splice(s,3),s-=3),e1(a)}}}function t1(){function e(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(w){return h=w})},focusReset:"manual",scroll:"manual"})}function n(){h!==null&&(h(),h=null),s||setTimeout(a,20)}function a(){if(!s&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,h=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),h!==null&&(h(),h=null)}}}function Xf(e){this._internalRoot=e}tc.prototype.render=Xf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(i(409));var a=n.current,s=qn();Vp(a,s,e,n,null,null)},tc.prototype.unmount=Xf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Vp(e.current,2,null,e,null,null),_o(),n[Fl]=null}};function tc(e){this._internalRoot=e}tc.prototype.unstable_scheduleHydration=function(e){if(e){var n=Ml();e={blockedOn:null,target:e,priority:n};for(var a=0;a<zr.length&&n!==0&&n<zr[a].priority;a++);zr.splice(a,0,e),a===0&&Jp(e)}};var n1=l.version;if(n1!=="19.2.4")throw Error(i(527,n1,"19.2.4"));Z.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=d(n),e=e!==null?g(e):null,e=e===null?null:e.stateNode,e};var Ob={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Y,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nc.isDisabled&&nc.supportsFiber)try{wt=nc.inject(Ob),Xe=nc}catch{}}return ds.createRoot=function(e,n){if(!c(e))throw Error(i(299));var a=!1,s="",h=cx,p=ux,w=fx;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(h=n.onUncaughtError),n.onCaughtError!==void 0&&(p=n.onCaughtError),n.onRecoverableError!==void 0&&(w=n.onRecoverableError)),n=qp(e,1,!1,null,null,a,s,null,h,p,w,t1),e[Fl]=n.current,Ef(e),new Xf(n)},ds.hydrateRoot=function(e,n,a){if(!c(e))throw Error(i(299));var s=!1,h="",p=cx,w=ux,N=fx,U=null;return a!=null&&(a.unstable_strictMode===!0&&(s=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(N=a.onRecoverableError),a.formState!==void 0&&(U=a.formState)),n=qp(e,1,!0,n,a??null,s,h,U,p,w,N,t1),n.context=Xp(null),a=n.current,s=qn(),s=Vr(s),h=pr(s),h.callback=null,yr(a,h,s),a=s,n.current.lanes=a,ar(n,a),vl(n),e[Fl]=n.current,Ef(e),new tc(n)},ds.version="19.2.4",ds}var h1;function Kb(){if(h1)return Kf.exports;h1=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(),Kf.exports=Gb(),Kf.exports}var Qb=Kb();const Wb="modulepreload",Zb=function(t){return"/"+t},m1={},Jb=function(l,r,i){let c=Promise.resolve();if(r&&r.length>0){let f=function(d){return Promise.all(d.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]"),x=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));c=f(r.map(d=>{if(d=Zb(d),d in m1)return;m1[d]=!0;const g=d.endsWith(".css"),y=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${y}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":Wb,g||(b.as="script"),b.crossOrigin="",b.href=d,x&&b.setAttribute("nonce",x),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 ${d}`)))})}))}function u(f){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=f,window.dispatchEvent(m),!m.defaultPrevented)throw f}return c.then(f=>{for(const m of f||[])m.status==="rejected"&&u(m.reason);return l().catch(u)})};class Pb extends k.Component{constructor(){super(...arguments);l1(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(r){return{hasError:!0,error:r}}render(){var r;return this.state.hasError?o.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:o.jsxs("div",{className:"text-center max-w-md",children:[o.jsx("div",{className:"text-4xl mb-3",children:"🚨"}),o.jsx("div",{className:"text-gray-800 font-semibold mb-2",children:"Something went wrong"}),o.jsx("div",{className:"text-gray-500 text-sm mb-4",children:((r=this.state.error)==null?void 0:r.message)??"An unexpected error occurred."}),o.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 Os="/api";async function Dt(t){const l=await fetch(`${Os}${t}`);if(!l.ok)throw new Error(`API error: ${l.status}`);return l.json()}async function wn(t,l){const r=await fetch(`${Os}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}async function Jf(t,l){const r=await fetch(`${Os}${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}async function Rr(t,l){const r={method:"DELETE"};l!==void 0&&(r.headers={"Content-Type":"application/json"},r.body=JSON.stringify(l));const i=await fetch(`${Os}${t}`,r);if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()}const Ce={getCompany:()=>Dt("/company"),getRoles:()=>Dt("/roles"),getRole:t=>Dt(`/roles/${t}`),getProjects:()=>Dt("/projects"),getProject:t=>Dt(`/projects/${t}`),getStandups:()=>Dt("/operations/standups"),getWaves:()=>Dt("/operations/waves"),getDecisions:()=>Dt("/operations/decisions"),getOrgTree:()=>Dt("/engine/org"),getSkills:()=>Dt("/skills"),exportSkills:t=>Dt(`/skills/export/${t}`),getSkillRegistry:()=>Dt("/skills/registry"),installRegistrySkill:(t,l)=>wn("/skills/registry/install",{skillId:t,url:l}),createRole:t=>wn("/engine/roles",t),updateRole:(t,l)=>Jf(`/engine/roles/${t}`,l),deleteRole:t=>Rr(`/engine/roles/${t}`),getSessions:()=>Dt("/sessions"),getSession:t=>Dt(`/sessions/${t}`),createSession:(t,l="talk")=>wn("/sessions",{roleId:t,mode:l}),deleteSession:t=>Rr(`/sessions/${t}`),deleteSessions:t=>Rr("/sessions",{ids:t}),deleteEmptySessions:()=>Rr("/sessions?empty=true"),updateSession:(t,l)=>Jf(`/sessions/${t}`,l),startJob:t=>wn("/jobs",t),getJob:t=>Dt(`/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 r=l.toString();return Dt(`/jobs${r?"?"+r:""}`)},abortJob:t=>Rr(`/jobs/${t}`),getStatus:()=>Dt("/status"),detectEngine:()=>wn("/setup/detect-engine",{}),validatePath:t=>wn("/setup/validate-path",{path:t}),scaffold:t=>wn("/setup/scaffold",t),getTeams:()=>Dt("/setup/teams"),browse:t=>wn("/setup/browse",{path:t}),connectAkb:t=>wn("/setup/connect-akb",{path:t}),getKnowledge:()=>Dt("/knowledge"),getKnowledgeDoc:t=>Dt(`/knowledge/${t}`),createKnowledgeDoc:t=>wn("/knowledge",t),updateKnowledgeDoc:(t,l)=>fetch(`${Os}/knowledge/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:l})}).then(r=>{if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}),deleteKnowledgeDoc:t=>Rr(`/knowledge/${t}`),getPreferences:()=>Dt("/preferences"),updatePreferences:t=>Jf("/preferences",t),chatInChannel:t=>wn("/speech/chat",t),getSaveStatus:()=>Dt("/save/status"),save:t=>wn("/save",{message:t}),getSaveHistory:(t=20)=>Dt(`/save/history?limit=${t}`),restoreSave:(t,l)=>wn("/save/restore",{sha:t,paths:l}),initGit:()=>wn("/save/init",{}),getCostSummary:()=>Dt("/cost/summary"),getSyncRoles:()=>Dt("/sync/roles"),applySyncUpdate:t=>wn("/sync/apply",t),getCompanyStats:()=>Dt("/sync/stats"),getGitStatus:()=>Dt("/git/status"),deleteWorktree:t=>Rr(`/git/worktrees/${encodeURIComponent(t)}`),deleteBranch:t=>Rr(`/git/branches/${encodeURIComponent(t)}`)};function V0(t){const[l,r]=k.useState([]),[i,c]=k.useState("idle"),[u,f]=k.useState(""),[m,x]=k.useState([]),d=k.useRef(-1),g=k.useRef(null),y=k.useRef(0),b=k.useCallback(()=>{var E;if(!t)return;(E=g.current)==null||E.abort();const j=new AbortController;g.current=j,c("connecting");const S=d.current+1,C=`/api/jobs/${t}/stream?from=${S}`;fetch(C,{signal:j.signal}).then(async A=>{if(!A.ok||!A.body){c("error");return}c("streaming");const M=A.body.getReader(),O=new TextDecoder;let L="";for(;;){const{done:F,value:I}=await M.read();if(F)break;L+=O.decode(I,{stream:!0});const $=L.split(`
50
+ `);L=$.pop()??"";let ee="";for(const z of $)if(z.startsWith("event: "))ee=z.slice(7).trim();else if(z.startsWith("data: ")){try{const X=JSON.parse(z.slice(6));if(ee==="activity"){const R=X;R.seq>d.current&&(d.current=R.seq),r(W=>W.some(te=>te.seq===R.seq)?W:[...W,R]),R.type==="text"&&f(W=>W+(R.data.text??"")),R.type==="dispatch:start"&&R.data.childJobId&&x(W=>[...W,R.data.childJobId]),R.type==="job:done"?c("done"):R.type==="job:error"&&c("error")}else if(ee==="stream:end"){const R=X.reason;c(R==="done"?"done":R==="error"?"error":"done")}}catch{}ee=""}}i==="streaming"&&c("done")}).catch(A=>{A.name!=="AbortError"&&(c("error"),y.current<3&&(y.current++,setTimeout(b,1e3*y.current)))})},[t]),v=k.useCallback(()=>{y.current=0,b()},[b]);return k.useEffect(()=>{if(!t){r([]),c("idle"),f(""),x([]),d.current=-1;return}return r([]),f(""),x([]),d.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 ev(t,l){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const tv=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nv=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lv={};function x1(t,l){return(lv.jsx?nv:tv).test(t)}const rv=/[ \t\n\f\r]/g;function av(t){return typeof t=="object"?t.type==="text"?p1(t.value):!1:p1(t)}function p1(t){return t.replace(rv,"")===""}class Bs{constructor(l,r,i){this.normal=r,this.property=l,i&&(this.space=i)}}Bs.prototype.normal={};Bs.prototype.property={};Bs.prototype.space=void 0;function G0(t,l){const r={},i={};for(const c of t)Object.assign(r,c.property),Object.assign(i,c.normal);return new Bs(r,i,l)}function Bd(t){return t.toLowerCase()}class _n{constructor(l,r){this.attribute=r,this.property=l}}_n.prototype.attribute="";_n.prototype.booleanish=!1;_n.prototype.boolean=!1;_n.prototype.commaOrSpaceSeparated=!1;_n.prototype.commaSeparated=!1;_n.prototype.defined=!1;_n.prototype.mustUseProperty=!1;_n.prototype.number=!1;_n.prototype.overloadedBoolean=!1;_n.prototype.property="";_n.prototype.spaceSeparated=!1;_n.prototype.space=void 0;let iv=0;const Ze=va(),nn=va(),Ld=va(),be=va(),Rt=va(),si=va(),Xn=va();function va(){return 2**++iv}const $d=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ze,booleanish:nn,commaOrSpaceSeparated:Xn,commaSeparated:si,number:be,overloadedBoolean:Ld,spaceSeparated:Rt},Symbol.toStringTag,{value:"Module"})),Pf=Object.keys($d);class nh extends _n{constructor(l,r,i,c){let u=-1;if(super(l,r),y1(this,"space",c),typeof i=="number")for(;++u<Pf.length;){const f=Pf[u];y1(this,Pf[u],(i&$d[f])===$d[f])}}}nh.prototype.defined=!0;function y1(t,l,r){r&&(t[l]=r)}function fi(t){const l={},r={};for(const[i,c]of Object.entries(t.properties)){const u=new nh(i,t.transform(t.attributes||{},i),c,t.space);t.mustUseProperty&&t.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),l[i]=u,r[Bd(i)]=i,r[Bd(u.attribute)]=i}return new Bs(l,r,t.space)}const K0=fi({properties:{ariaActiveDescendant:null,ariaAtomic:nn,ariaAutoComplete:null,ariaBusy:nn,ariaChecked:nn,ariaColCount:be,ariaColIndex:be,ariaColSpan:be,ariaControls:Rt,ariaCurrent:null,ariaDescribedBy:Rt,ariaDetails:null,ariaDisabled:nn,ariaDropEffect:Rt,ariaErrorMessage:null,ariaExpanded:nn,ariaFlowTo:Rt,ariaGrabbed:nn,ariaHasPopup:null,ariaHidden:nn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Rt,ariaLevel:be,ariaLive:null,ariaModal:nn,ariaMultiLine:nn,ariaMultiSelectable:nn,ariaOrientation:null,ariaOwns:Rt,ariaPlaceholder:null,ariaPosInSet:be,ariaPressed:nn,ariaReadOnly:nn,ariaRelevant:null,ariaRequired:nn,ariaRoleDescription:Rt,ariaRowCount:be,ariaRowIndex:be,ariaRowSpan:be,ariaSelected:nn,ariaSetSize:be,ariaSort:null,ariaValueMax:be,ariaValueMin:be,ariaValueNow:be,ariaValueText:null,role:null},transform(t,l){return l==="role"?l:"aria-"+l.slice(4).toLowerCase()}});function Q0(t,l){return l in t?t[l]:l}function W0(t,l){return Q0(t,l.toLowerCase())}const sv=fi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:si,acceptCharset:Rt,accessKey:Rt,action:null,allow:null,allowFullScreen:Ze,allowPaymentRequest:Ze,allowUserMedia:Ze,alt:null,as:null,async:Ze,autoCapitalize:null,autoComplete:Rt,autoFocus:Ze,autoPlay:Ze,blocking:Rt,capture:null,charSet:null,checked:Ze,cite:null,className:Rt,cols:be,colSpan:null,content:null,contentEditable:nn,controls:Ze,controlsList:Rt,coords:be|si,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ze,defer:Ze,dir:null,dirName:null,disabled:Ze,download:Ld,draggable:nn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ze,formTarget:null,headers:Rt,height:be,hidden:Ld,high:be,href:null,hrefLang:null,htmlFor:Rt,httpEquiv:Rt,id:null,imageSizes:null,imageSrcSet:null,inert:Ze,inputMode:null,integrity:null,is:null,isMap:Ze,itemId:null,itemProp:Rt,itemRef:Rt,itemScope:Ze,itemType:Rt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ze,low:be,manifest:null,max:null,maxLength:be,media:null,method:null,min:null,minLength:be,multiple:Ze,muted:Ze,name:null,nonce:null,noModule:Ze,noValidate:Ze,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:Ze,optimum:be,pattern:null,ping:Rt,placeholder:null,playsInline:Ze,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ze,referrerPolicy:null,rel:Rt,required:Ze,reversed:Ze,rows:be,rowSpan:be,sandbox:Rt,scope:null,scoped:Ze,seamless:Ze,selected:Ze,shadowRootClonable:Ze,shadowRootDelegatesFocus:Ze,shadowRootMode:null,shape:null,size:be,sizes:null,slot:null,span:be,spellCheck:nn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:be,step:null,style:null,tabIndex:be,target:null,title:null,translate:null,type:null,typeMustMatch:Ze,useMap:null,value:nn,width:be,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Rt,axis:null,background:null,bgColor:null,border:be,borderColor:null,bottomMargin:be,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ze,declare:Ze,event:null,face:null,frame:null,frameBorder:null,hSpace:be,leftMargin:be,link:null,longDesc:null,lowSrc:null,marginHeight:be,marginWidth:be,noResize:Ze,noHref:Ze,noShade:Ze,noWrap:Ze,object:null,profile:null,prompt:null,rev:null,rightMargin:be,rules:null,scheme:null,scrolling:nn,standby:null,summary:null,text:null,topMargin:be,valueType:null,version:null,vAlign:null,vLink:null,vSpace:be,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ze,disableRemotePlayback:Ze,prefix:null,property:null,results:be,security:null,unselectable:null},space:"html",transform:W0}),ov=fi({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:Xn,accentHeight:be,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:be,amplitude:be,arabicForm:null,ascent:be,attributeName:null,attributeType:null,azimuth:be,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:be,by:null,calcMode:null,capHeight:be,className:Rt,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:be,diffuseConstant:be,direction:null,display:null,dur:null,divisor:be,dominantBaseline:null,download:Ze,dx:null,dy:null,edgeMode:null,editable:null,elevation:be,enableBackground:null,end:null,event:null,exponent:be,externalResourcesRequired:null,fill:null,fillOpacity:be,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:si,g2:si,glyphName:si,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:be,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:be,horizOriginX:be,horizOriginY:be,id:null,ideographic:be,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:be,k:be,k1:be,k2:be,k3:be,k4:be,kernelMatrix:Xn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:be,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:be,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:be,overlineThickness:be,paintOrder:null,panose1:null,path:null,pathLength:be,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Rt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:be,pointsAtY:be,pointsAtZ:be,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Xn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Xn,rev:Xn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Xn,requiredFeatures:Xn,requiredFonts:Xn,requiredFormats:Xn,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:be,specularExponent:be,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:be,strikethroughThickness:be,string:null,stroke:null,strokeDashArray:Xn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:be,strokeOpacity:be,strokeWidth:null,style:null,surfaceScale:be,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Xn,tabIndex:be,tableValues:null,target:null,targetX:be,targetY:be,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Xn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:be,underlineThickness:be,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:be,values:null,vAlphabetic:be,vMathematical:be,vectorEffect:null,vHanging:be,vIdeographic:be,version:null,vertAdvY:be,vertOriginX:be,vertOriginY:be,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:be,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Q0}),Z0=fi({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()}}),J0=fi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:W0}),P0=fi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,l){return"xml:"+l.slice(3).toLowerCase()}}),cv={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"},uv=/[A-Z]/g,g1=/-[a-z]/g,fv=/^data[-\w.:]+$/i;function dv(t,l){const r=Bd(l);let i=l,c=_n;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&fv.test(l)){if(l.charAt(4)==="-"){const u=l.slice(5).replace(g1,mv);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=l.slice(4);if(!g1.test(u)){let f=u.replace(uv,hv);f.charAt(0)!=="-"&&(f="-"+f),l="data"+f}}c=nh}return new c(i,l)}function hv(t){return"-"+t.toLowerCase()}function mv(t){return t.charAt(1).toUpperCase()}const xv=G0([K0,sv,Z0,J0,P0],"html"),lh=G0([K0,ov,Z0,J0,P0],"svg");function pv(t){return t.join(" ").trim()}var li={},ed,b1;function yv(){if(b1)return ed;b1=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,l=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,m=/^\s+|\s+$/g,x=`
51
+ `,d="/",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 A=1,M=1;function O(te){var V=te.match(l);V&&(A+=V.length);var Y=te.lastIndexOf(x);M=~Y?te.length-Y:M+te.length}function L(){var te={line:A,column:M};return function(V){return V.position=new F(te),ee(),V}}function F(te){this.start=te,this.end={line:A,column:M},this.source=E.source}F.prototype.content=C;function I(te){var V=new Error(E.source+":"+A+":"+M+": "+te);if(V.reason=te,V.filename=E.source,V.line=A,V.column=M,V.source=C,!E.silent)throw V}function $(te){var V=te.exec(C);if(V){var Y=V[0];return O(Y),C=C.slice(Y.length),V}}function ee(){$(r)}function z(te){var V;for(te=te||[];V=X();)V!==!1&&te.push(V);return te}function X(){var te=L();if(!(d!=C.charAt(0)||g!=C.charAt(1))){for(var V=2;y!=C.charAt(V)&&(g!=C.charAt(V)||d!=C.charAt(V+1));)++V;if(V+=2,y===C.charAt(V-1))return I("End of comment missing");var Y=C.slice(2,V-2);return M+=2,O(Y),C=C.slice(V),M+=2,te({type:b,comment:Y})}}function R(){var te=L(),V=$(i);if(V){if(X(),!$(c))return I("property missing ':'");var Y=$(u),Z=te({type:v,property:S(V[0].replace(t,y)),value:Y?S(Y[0].replace(t,y)):y});return $(f),Z}}function W(){var te=[];z(te);for(var V;V=R();)V!==!1&&(te.push(V),z(te));return te}return ee(),W()}function S(C){return C?C.replace(m,y):y}return ed=j,ed}var v1;function gv(){if(v1)return li;v1=1;var t=li&&li.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(li,"__esModule",{value:!0}),li.default=r;const l=t(yv());function r(i,c){let u=null;if(!i||typeof i!="string")return u;const f=(0,l.default)(i),m=typeof c=="function";return f.forEach(x=>{if(x.type!=="declaration")return;const{property:d,value:g}=x;m?c(d,g,x):g&&(u=u||{},u[d]=g)}),u}return li}var hs={},w1;function bv(){if(w1)return hs;w1=1,Object.defineProperty(hs,"__esModule",{value:!0}),hs.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,l=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,u=function(d){return!d||r.test(d)||t.test(d)},f=function(d,g){return g.toUpperCase()},m=function(d,g){return"".concat(g,"-")},x=function(d,g){return g===void 0&&(g={}),u(d)?d:(d=d.toLowerCase(),g.reactCompat?d=d.replace(c,m):d=d.replace(i,m),d.replace(l,f))};return hs.camelCase=x,hs}var ms,k1;function vv(){if(k1)return ms;k1=1;var t=ms&&ms.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},l=t(gv()),r=bv();function i(c,u){var f={};return!c||typeof c!="string"||(0,l.default)(c,function(m,x){m&&x&&(f[(0,r.camelCase)(m,u)]=x)}),f}return i.default=i,ms=i,ms}var wv=vv();const kv=X0(wv),ey=ty("end"),rh=ty("start");function ty(t){return l;function l(r){const i=r&&r.position&&r.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 Sv(t){const l=rh(t),r=ey(t);if(l&&r)return{start:l,end:r}}function Es(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?S1(t.position):"start"in t||"end"in t?S1(t):"line"in t||"column"in t?Hd(t):""}function Hd(t){return j1(t&&t.line)+":"+j1(t&&t.column)}function S1(t){return Hd(t&&t.start)+"-"+Hd(t&&t.end)}function j1(t){return t&&typeof t=="number"?t:1}class gn extends Error{constructor(l,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let c="",u={},f=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof l=="string"?c=l:!u.cause&&l&&(f=!0,c=l.message,u.cause=l),!u.ruleId&&!u.source&&typeof i=="string"){const x=i.indexOf(":");x===-1?u.ruleId=i:(u.source=i.slice(0,x),u.ruleId=i.slice(x+1))}if(!u.place&&u.ancestors&&u.ancestors){const x=u.ancestors[u.ancestors.length-1];x&&(u.place=x.position)}const m=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=m?m.column:void 0,this.fatal=void 0,this.file="",this.message=c,this.line=m?m.line:void 0,this.name=Es(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}}gn.prototype.file="";gn.prototype.name="";gn.prototype.reason="";gn.prototype.message="";gn.prototype.stack="";gn.prototype.column=void 0;gn.prototype.line=void 0;gn.prototype.ancestors=void 0;gn.prototype.cause=void 0;gn.prototype.fatal=void 0;gn.prototype.place=void 0;gn.prototype.ruleId=void 0;gn.prototype.source=void 0;const ah={}.hasOwnProperty,jv=new Map,Cv=/[A-Z]/g,Ev=new Set(["table","tbody","thead","tfoot","tr"]),Nv=new Set(["td","th"]),ny="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Av(t,l){if(!l||l.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=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=Ov(r,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=_v(r,l.jsx,l.jsxs)}const c={Fragment:l.Fragment,ancestors:[],components:l.components||{},create:i,elementAttributeNameCase:l.elementAttributeNameCase||"react",evaluater:l.createEvaluater?l.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:l.ignoreInvalidStyle||!1,passKeys:l.passKeys!==!1,passNode:l.passNode||!1,schema:l.space==="svg"?lh:xv,stylePropertyNameCase:l.stylePropertyNameCase||"dom",tableCellAlignToStyle:l.tableCellAlignToStyle!==!1},u=ly(c,t,void 0);return u&&typeof u!="string"?u:c.create(t,c.Fragment,{children:u||void 0},void 0)}function ly(t,l,r){if(l.type==="element")return Tv(t,l,r);if(l.type==="mdxFlowExpression"||l.type==="mdxTextExpression")return Dv(t,l);if(l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement")return Mv(t,l,r);if(l.type==="mdxjsEsm")return zv(t,l);if(l.type==="root")return Rv(t,l,r);if(l.type==="text")return Fv(t,l)}function Tv(t,l,r){const i=t.schema;let c=i;l.tagName.toLowerCase()==="svg"&&i.space==="html"&&(c=lh,t.schema=c),t.ancestors.push(l);const u=ay(t,l.tagName,!1),f=Bv(t,l);let m=sh(t,l);return Ev.has(l.tagName)&&(m=m.filter(function(x){return typeof x=="string"?!av(x):!0})),ry(t,f,u,l),ih(f,m),t.ancestors.pop(),t.schema=i,t.create(l,u,f,r)}function Dv(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)}zs(t,l.position)}function zv(t,l){if(l.data&&l.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(l.data.estree);zs(t,l.position)}function Mv(t,l,r){const i=t.schema;let c=i;l.name==="svg"&&i.space==="html"&&(c=lh,t.schema=c),t.ancestors.push(l);const u=l.name===null?t.Fragment:ay(t,l.name,!0),f=Lv(t,l),m=sh(t,l);return ry(t,f,u,l),ih(f,m),t.ancestors.pop(),t.schema=i,t.create(l,u,f,r)}function Rv(t,l,r){const i={};return ih(i,sh(t,l)),t.create(l,t.Fragment,i,r)}function Fv(t,l){return l.value}function ry(t,l,r,i){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(l.node=i)}function ih(t,l){if(l.length>0){const r=l.length>1?l:l[0];r&&(t.children=r)}}function _v(t,l,r){return i;function i(c,u,f,m){const d=Array.isArray(f.children)?r:l;return m?d(u,f,m):d(u,f)}}function Ov(t,l){return r;function r(i,c,u,f){const m=Array.isArray(u.children),x=rh(i);return l(c,u,f,m,{columnNumber:x?x.column-1:void 0,fileName:t,lineNumber:x?x.line:void 0},void 0)}}function Bv(t,l){const r={};let i,c;for(c in l.properties)if(c!=="children"&&ah.call(l.properties,c)){const u=$v(t,c,l.properties[c]);if(u){const[f,m]=u;t.tableCellAlignToStyle&&f==="align"&&typeof m=="string"&&Nv.has(l.tagName)?i=m:r[f]=m}}if(i){const u=r.style||(r.style={});u[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return r}function Lv(t,l){const r={};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(r,t.evaluater.evaluateExpression(m.argument))}else zs(t,l.position);else{const c=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 zs(t,l.position);else u=i.value===null?!0:i.value;r[c]=u}return r}function sh(t,l){const r=[];let i=-1;const c=t.passKeys?new Map:jv;for(;++i<l.children.length;){const u=l.children[i];let f;if(t.passKeys){const x=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(x){const d=c.get(x)||0;f=x+"-"+d,c.set(x,d+1)}}const m=ly(t,u,f);m!==void 0&&r.push(m)}return r}function $v(t,l,r){const i=dv(t.schema,l);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=i.commaSeparated?ev(r):pv(r)),i.property==="style"){let c=typeof r=="object"?r:Hv(t,String(r));return t.stylePropertyNameCase==="css"&&(c=Uv(c)),["style",c]}return[t.elementAttributeNameCase==="react"&&i.space?cv[i.property]||i.property:i.attribute,r]}}function Hv(t,l){try{return kv(l,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const i=r,c=new gn("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=t.filePath||void 0,c.url=ny+"#cannot-parse-style-attribute",c}}function ay(t,l,r){let i;if(!r)i={type:"Literal",value:l};else if(l.includes(".")){const c=l.split(".");let u=-1,f;for(;++u<c.length;){const m=x1(c[u])?{type:"Identifier",name:c[u]}:{type:"Literal",value:c[u]};f=f?{type:"MemberExpression",object:f,property:m,computed:!!(u&&m.type==="Literal"),optional:!1}:m}i=f}else i=x1(l)&&!/^[a-z]/.test(l)?{type:"Identifier",name:l}:{type:"Literal",value:l};if(i.type==="Literal"){const c=i.value;return ah.call(t.components,c)?t.components[c]:c}if(t.evaluater)return t.evaluater.evaluateExpression(i);zs(t)}function zs(t,l){const r=new gn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:l,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=t.filePath||void 0,r.url=ny+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Uv(t){const l={};let r;for(r in t)ah.call(t,r)&&(l[Iv(r)]=t[r]);return l}function Iv(t){let l=t.replace(Cv,Yv);return l.slice(0,3)==="ms-"&&(l="-"+l),l}function Yv(t){return"-"+t.toLowerCase()}const td={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"]},qv={};function oh(t,l){const r=qv,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,c=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return iy(t,i,c)}function iy(t,l,r){if(Xv(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(l&&"alt"in t&&t.alt)return t.alt;if("children"in t)return C1(t.children,l,r)}return Array.isArray(t)?C1(t,l,r):""}function C1(t,l,r){const i=[];let c=-1;for(;++c<t.length;)i[c]=iy(t[c],l,r);return i.join("")}function Xv(t){return!!(t&&typeof t=="object")}const E1=document.createElement("i");function ch(t){const l="&"+t+";";E1.innerHTML=l;const r=E1.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===l?!1:r}function Gn(t,l,r,i){const c=t.length;let u=0,f;if(l<0?l=-l>c?0:c+l:l=l>c?c:l,r=r>0?r:0,i.length<1e4)f=Array.from(i),f.unshift(l,r),t.splice(...f);else for(r&&t.splice(l,r);u<i.length;)f=i.slice(u,u+1e4),f.unshift(l,0),t.splice(...f),u+=1e4,l+=1e4}function al(t,l){return t.length>0?(Gn(t,t.length,0,l),t):l}const N1={}.hasOwnProperty;function sy(t){const l={};let r=-1;for(;++r<t.length;)Vv(l,t[r]);return l}function Vv(t,l){let r;for(r in l){const c=(N1.call(t,r)?t[r]:void 0)||(t[r]={}),u=l[r];let f;if(u)for(f in u){N1.call(c,f)||(c[f]=[]);const m=u[f];Gv(c[f],Array.isArray(m)?m:m?[m]:[])}}}function Gv(t,l){let r=-1;const i=[];for(;++r<l.length;)(l[r].add==="after"?t:i).push(l[r]);Gn(t,0,0,i)}function oy(t,l){const r=Number.parseInt(t,l);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function hl(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const kn=Ur(/[A-Za-z]/),yn=Ur(/[\dA-Za-z]/),Kv=Ur(/[#-'*+\--9=?A-Z^-~]/);function Cc(t){return t!==null&&(t<32||t===127)}const Ud=Ur(/\d/),Qv=Ur(/[\dA-Fa-f]/),Wv=Ur(/[!-/:-@[-`{-~]/);function Ie(t){return t!==null&&t<-2}function zt(t){return t!==null&&(t<0||t===32)}function at(t){return t===-2||t===-1||t===32}const Oc=Ur(new RegExp("\\p{P}|\\p{S}","u")),ga=Ur(/\s/);function Ur(t){return l;function l(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function di(t){const l=[];let r=-1,i=0,c=0;for(;++r<t.length;){const u=t.charCodeAt(r);let f="";if(u===37&&yn(t.charCodeAt(r+1))&&yn(t.charCodeAt(r+2)))c=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(r+1);u<56320&&m>56319&&m<57344?(f=String.fromCharCode(u,m),c=1):f="�"}else f=String.fromCharCode(u);f&&(l.push(t.slice(i,r),encodeURIComponent(f)),i=r+c+1,f=""),c&&(r+=c,c=0)}return l.join("")+t.slice(i)}function dt(t,l,r,i){const c=i?i-1:Number.POSITIVE_INFINITY;let u=0;return f;function f(x){return at(x)?(t.enter(r),m(x)):l(x)}function m(x){return at(x)&&u++<c?(t.consume(x),m):(t.exit(r),l(x))}}const Zv={tokenize:Jv};function Jv(t){const l=t.attempt(this.parser.constructs.contentInitial,i,c);let r;return l;function i(m){if(m===null){t.consume(m);return}return t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),dt(t,l,"linePrefix")}function c(m){return t.enter("paragraph"),u(m)}function u(m){const x=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=x),r=x,f(m)}function f(m){if(m===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(m);return}return Ie(m)?(t.consume(m),t.exit("chunkText"),u):(t.consume(m),f)}}const Pv={tokenize:ew},A1={tokenize:tw};function ew(t){const l=this,r=[];let i=0,c,u,f;return m;function m(M){if(i<r.length){const O=r[i];return l.containerState=O[1],t.attempt(O[0].continuation,x,d)(M)}return d(M)}function x(M){if(i++,l.containerState._closeFlow){l.containerState._closeFlow=void 0,c&&A();const O=l.events.length;let L=O,F;for(;L--;)if(l.events[L][0]==="exit"&&l.events[L][1].type==="chunkFlow"){F=l.events[L][1].end;break}E(i);let I=O;for(;I<l.events.length;)l.events[I][1].end={...F},I++;return Gn(l.events,L+1,0,l.events.slice(O)),l.events.length=I,d(M)}return m(M)}function d(M){if(i===r.length){if(!c)return b(M);if(c.currentConstruct&&c.currentConstruct.concrete)return j(M);l.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return l.containerState={},t.check(A1,g,y)(M)}function g(M){return c&&A(),E(i),b(M)}function y(M){return l.parser.lazy[l.now().line]=i!==r.length,f=l.now().offset,j(M)}function b(M){return l.containerState={},t.attempt(A1,v,j)(M)}function v(M){return i++,r.push([l.currentConstruct,l.containerState]),b(M)}function j(M){if(M===null){c&&A(),E(0),t.consume(M);return}return c=c||l.parser.flow(l.now()),t.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:u}),S(M)}function S(M){if(M===null){C(t.exit("chunkFlow"),!0),E(0),t.consume(M);return}return Ie(M)?(t.consume(M),C(t.exit("chunkFlow")),i=0,l.interrupt=void 0,m):(t.consume(M),S)}function C(M,O){const L=l.sliceStream(M);if(O&&L.push(null),M.previous=u,u&&(u.next=M),u=M,c.defineSkip(M.start),c.write(L),l.parser.lazy[M.start.line]){let F=c.events.length;for(;F--;)if(c.events[F][1].start.offset<f&&(!c.events[F][1].end||c.events[F][1].end.offset>f))return;const I=l.events.length;let $=I,ee,z;for(;$--;)if(l.events[$][0]==="exit"&&l.events[$][1].type==="chunkFlow"){if(ee){z=l.events[$][1].end;break}ee=!0}for(E(i),F=I;F<l.events.length;)l.events[F][1].end={...z},F++;Gn(l.events,$+1,0,l.events.slice(I)),l.events.length=F}}function E(M){let O=r.length;for(;O-- >M;){const L=r[O];l.containerState=L[1],L[0].exit.call(l,t)}r.length=M}function A(){c.write([null]),u=void 0,c=void 0,l.containerState._closeFlow=void 0}}function tw(t,l,r){return dt(t,t.attempt(this.parser.constructs.document,l,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function oi(t){if(t===null||zt(t)||ga(t))return 1;if(Oc(t))return 2}function Bc(t,l,r){const i=[];let c=-1;for(;++c<t.length;){const u=t[c].resolveAll;u&&!i.includes(u)&&(l=u(l,r),i.push(u))}return l}const Id={name:"attention",resolveAll:nw,tokenize:lw};function nw(t,l){let r=-1,i,c,u,f,m,x,d,g;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(i=r;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[r][1]).charCodeAt(0)){if((t[i][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[i][1].end.offset-t[i][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;x=t[i][1].end.offset-t[i][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;const y={...t[i][1].end},b={...t[r][1].start};T1(y,-x),T1(b,x),f={type:x>1?"strongSequence":"emphasisSequence",start:y,end:{...t[i][1].end}},m={type:x>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:b},u={type:x>1?"strongText":"emphasisText",start:{...t[i][1].end},end:{...t[r][1].start}},c={type:x>1?"strong":"emphasis",start:{...f.start},end:{...m.end}},t[i][1].end={...f.start},t[r][1].start={...m.end},d=[],t[i][1].end.offset-t[i][1].start.offset&&(d=al(d,[["enter",t[i][1],l],["exit",t[i][1],l]])),d=al(d,[["enter",c,l],["enter",f,l],["exit",f,l],["enter",u,l]]),d=al(d,Bc(l.parser.constructs.insideSpan.null,t.slice(i+1,r),l)),d=al(d,[["exit",u,l],["enter",m,l],["exit",m,l],["exit",c,l]]),t[r][1].end.offset-t[r][1].start.offset?(g=2,d=al(d,[["enter",t[r][1],l],["exit",t[r][1],l]])):g=0,Gn(t,i-1,r-i+3,d),r=i+d.length-g-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function lw(t,l){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,c=oi(i);let u;return f;function f(x){return u=x,t.enter("attentionSequence"),m(x)}function m(x){if(x===u)return t.consume(x),m;const d=t.exit("attentionSequence"),g=oi(x),y=!g||g===2&&c||r.includes(x),b=!c||c===2&&g||r.includes(i);return d._open=!!(u===42?y:y&&(c||!b)),d._close=!!(u===42?b:b&&(g||!y)),l(x)}}function T1(t,l){t.column+=l,t.offset+=l,t._bufferIndex+=l}const rw={name:"autolink",tokenize:aw};function aw(t,l,r){let i=0;return c;function c(v){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),u}function u(v){return kn(v)?(t.consume(v),f):v===64?r(v):d(v)}function f(v){return v===43||v===45||v===46||yn(v)?(i=1,m(v)):d(v)}function m(v){return v===58?(t.consume(v),i=0,x):(v===43||v===45||v===46||yn(v))&&i++<32?(t.consume(v),m):(i=0,d(v))}function x(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||Cc(v)?r(v):(t.consume(v),x)}function d(v){return v===64?(t.consume(v),g):Kv(v)?(t.consume(v),d):r(v)}function g(v){return yn(v)?y(v):r(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||yn(v))&&i++<63){const j=v===45?b:y;return t.consume(v),j}return r(v)}}const Ls={partial:!0,tokenize:iw};function iw(t,l,r){return i;function i(u){return at(u)?dt(t,c,"linePrefix")(u):c(u)}function c(u){return u===null||Ie(u)?l(u):r(u)}}const cy={continuation:{tokenize:ow},exit:cw,name:"blockQuote",tokenize:sw};function sw(t,l,r){const i=this;return c;function c(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 r(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 ow(t,l,r){const i=this;return c;function c(f){return at(f)?dt(t,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):u(f)}function u(f){return t.attempt(cy,l,r)(f)}}function cw(t){t.exit("blockQuote")}const uy={name:"characterEscape",tokenize:uw};function uw(t,l,r){return i;function i(u){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(u),t.exit("escapeMarker"),c}function c(u){return Wv(u)?(t.enter("characterEscapeValue"),t.consume(u),t.exit("characterEscapeValue"),t.exit("characterEscape"),l):r(u)}}const fy={name:"characterReference",tokenize:fw};function fw(t,l,r){const i=this;let c=0,u,f;return m;function m(y){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),x}function x(y){return y===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(y),t.exit("characterReferenceMarkerNumeric"),d):(t.enter("characterReferenceValue"),u=31,f=yn,g(y))}function d(y){return y===88||y===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(y),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),u=6,f=Qv,g):(t.enter("characterReferenceValue"),u=7,f=Ud,g(y))}function g(y){if(y===59&&c){const b=t.exit("characterReferenceValue");return f===yn&&!ch(i.sliceSerialize(b))?r(y):(t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),t.exit("characterReference"),l)}return f(y)&&c++<u?(t.consume(y),g):r(y)}}const D1={partial:!0,tokenize:hw},z1={concrete:!0,name:"codeFenced",tokenize:dw};function dw(t,l,r){const i=this,c={partial:!0,tokenize:L};let u=0,f=0,m;return x;function x(F){return d(F)}function d(F){const I=i.events[i.events.length-1];return u=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,m=F,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),g(F)}function g(F){return F===m?(f++,t.consume(F),g):f<3?r(F):(t.exit("codeFencedFenceSequence"),at(F)?dt(t,y,"whitespace")(F):y(F))}function y(F){return F===null||Ie(F)?(t.exit("codeFencedFence"),i.interrupt?l(F):t.check(D1,S,O)(F)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),b(F))}function b(F){return F===null||Ie(F)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),y(F)):at(F)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),dt(t,v,"whitespace")(F)):F===96&&F===m?r(F):(t.consume(F),b)}function v(F){return F===null||Ie(F)?y(F):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),j(F))}function j(F){return F===null||Ie(F)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),y(F)):F===96&&F===m?r(F):(t.consume(F),j)}function S(F){return t.attempt(c,O,C)(F)}function C(F){return t.enter("lineEnding"),t.consume(F),t.exit("lineEnding"),E}function E(F){return u>0&&at(F)?dt(t,A,"linePrefix",u+1)(F):A(F)}function A(F){return F===null||Ie(F)?t.check(D1,S,O)(F):(t.enter("codeFlowValue"),M(F))}function M(F){return F===null||Ie(F)?(t.exit("codeFlowValue"),A(F)):(t.consume(F),M)}function O(F){return t.exit("codeFenced"),l(F)}function L(F,I,$){let ee=0;return z;function z(V){return F.enter("lineEnding"),F.consume(V),F.exit("lineEnding"),X}function X(V){return F.enter("codeFencedFence"),at(V)?dt(F,R,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):R(V)}function R(V){return V===m?(F.enter("codeFencedFenceSequence"),W(V)):$(V)}function W(V){return V===m?(ee++,F.consume(V),W):ee>=f?(F.exit("codeFencedFenceSequence"),at(V)?dt(F,te,"whitespace")(V):te(V)):$(V)}function te(V){return V===null||Ie(V)?(F.exit("codeFencedFence"),I(V)):$(V)}}}function hw(t,l,r){const i=this;return c;function c(f){return f===null?r(f):(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u)}function u(f){return i.parser.lazy[i.now().line]?r(f):l(f)}}const nd={name:"codeIndented",tokenize:xw},mw={partial:!0,tokenize:pw};function xw(t,l,r){const i=this;return c;function c(d){return t.enter("codeIndented"),dt(t,u,"linePrefix",5)(d)}function u(d){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?f(d):r(d)}function f(d){return d===null?x(d):Ie(d)?t.attempt(mw,f,x)(d):(t.enter("codeFlowValue"),m(d))}function m(d){return d===null||Ie(d)?(t.exit("codeFlowValue"),f(d)):(t.consume(d),m)}function x(d){return t.exit("codeIndented"),l(d)}}function pw(t,l,r){const i=this;return c;function c(f){return i.parser.lazy[i.now().line]?r(f):Ie(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):dt(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):Ie(f)?c(f):r(f)}}const yw={name:"codeText",previous:bw,resolve:gw,tokenize:vw};function gw(t){let l=t.length-4,r=3,i,c;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[l][1].type==="lineEnding"||t[l][1].type==="space")){for(i=r;++i<l;)if(t[i][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[l][1].type="codeTextPadding",r+=2,l-=2;break}}for(i=r-1,l++;++i<=l;)c===void 0?i!==l&&t[i][1].type!=="lineEnding"&&(c=i):(i===l||t[i][1].type==="lineEnding")&&(t[c][1].type="codeTextData",i!==c+2&&(t[c][1].end=t[i-1][1].end,t.splice(c+2,i-c-2),l-=i-c-2,i=c+2),c=void 0);return t}function bw(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function vw(t,l,r){let i=0,c,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"),x(y))}function x(y){return y===null?r(y):y===32?(t.enter("space"),t.consume(y),t.exit("space"),x):y===96?(u=t.enter("codeTextSequence"),c=0,g(y)):Ie(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),x):(t.enter("codeTextData"),d(y))}function d(y){return y===null||y===32||y===96||Ie(y)?(t.exit("codeTextData"),x(y)):(t.consume(y),d)}function g(y){return y===96?(t.consume(y),c++,g):c===i?(t.exit("codeTextSequence"),t.exit("codeText"),l(y)):(u.type="codeTextData",d(y))}}class ww{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,r){const i=r??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,r,i){const c=r||0;this.setCursor(Math.trunc(l));const u=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return i&&xs(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),xs(this.left,l)}unshift(l){this.setCursor(0),this.right.push(l)}unshiftMany(l){this.setCursor(0),xs(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 r=this.left.splice(l,Number.POSITIVE_INFINITY);xs(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-l,Number.POSITIVE_INFINITY);xs(this.left,r.reverse())}}}function xs(t,l){let r=0;if(l.length<1e4)t.push(...l);else for(;r<l.length;)t.push(...l.slice(r,r+1e4)),r+=1e4}function dy(t){const l={};let r=-1,i,c,u,f,m,x,d;const g=new ww(t);for(;++r<g.length;){for(;r in l;)r=l[r];if(i=g.get(r),r&&i[1].type==="chunkFlow"&&g.get(r-1)[1].type==="listItemPrefix"&&(x=i[1]._tokenizer.events,u=0,u<x.length&&x[u][1].type==="lineEndingBlank"&&(u+=2),u<x.length&&x[u][1].type==="content"))for(;++u<x.length&&x[u][1].type!=="content";)x[u][1].type==="chunkText"&&(x[u][1]._isInFirstContentOfListItem=!0,u++);if(i[0]==="enter")i[1].contentType&&(Object.assign(l,kw(g,r)),r=l[r],d=!0);else if(i[1]._container){for(u=r,c=void 0;u--;)if(f=g.get(u),f[1].type==="lineEnding"||f[1].type==="lineEndingBlank")f[0]==="enter"&&(c&&(g.get(c)[1].type="lineEndingBlank"),f[1].type="lineEnding",c=u);else if(!(f[1].type==="linePrefix"||f[1].type==="listItemIndent"))break;c&&(i[1].end={...g.get(c)[1].start},m=g.slice(c,r),m.unshift(i),g.splice(c,r-c+1,m))}}return Gn(t,0,Number.POSITIVE_INFINITY,g.slice(0)),!d}function kw(t,l){const r=t.get(l)[1],i=t.get(l)[2];let c=l-1;const u=[];let f=r._tokenizer;f||(f=i.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(f._contentTypeTextTrailing=!0));const m=f.events,x=[],d={};let g,y,b=-1,v=r,j=0,S=0;const C=[S];for(;v;){for(;t.get(++c)[1]!==v;);u.push(c),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=r;++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&&(S=b+1,C.push(S),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]),A=u.pop();x.push([A,A+E.length-1]),t.splice(A,2,E)}for(x.reverse(),b=-1;++b<x.length;)d[j+x[b][0]]=j+x[b][1],j+=x[b][1]-x[b][0]-1;return d}const Sw={resolve:Cw,tokenize:Ew},jw={partial:!0,tokenize:Nw};function Cw(t){return dy(t),t}function Ew(t,l){let r;return i;function i(m){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),c(m)}function c(m){return m===null?u(m):Ie(m)?t.check(jw,f,u)(m):(t.consume(m),c)}function u(m){return t.exit("chunkContent"),t.exit("content"),l(m)}function f(m){return t.consume(m),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,c}}function Nw(t,l,r){const i=this;return c;function c(f){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),dt(t,u,"linePrefix")}function u(f){if(f===null||Ie(f))return r(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,r,l)(f)}}function hy(t,l,r,i,c,u,f,m,x){const d=x||Number.POSITIVE_INFINITY;let g=0;return y;function y(E){return E===60?(t.enter(i),t.enter(c),t.enter(u),t.consume(E),t.exit(u),b):E===null||E===32||E===41||Cc(E)?r(E):(t.enter(i),t.enter(f),t.enter(m),t.enter("chunkString",{contentType:"string"}),S(E))}function b(E){return E===62?(t.enter(u),t.consume(E),t.exit(u),t.exit(c),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||Ie(E)?r(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 S(E){return!g&&(E===null||E===41||zt(E))?(t.exit("chunkString"),t.exit(m),t.exit(f),t.exit(i),l(E)):g<d&&E===40?(t.consume(E),g++,S):E===41?(t.consume(E),g--,S):E===null||E===32||E===40||Cc(E)?r(E):(t.consume(E),E===92?C:S)}function C(E){return E===40||E===41||E===92?(t.consume(E),S):S(E)}}function my(t,l,r,i,c,u){const f=this;let m=0,x;return d;function d(v){return t.enter(i),t.enter(c),t.consume(v),t.exit(c),t.enter(u),g}function g(v){return m>999||v===null||v===91||v===93&&!x||v===94&&!m&&"_hiddenFootnoteSupport"in f.parser.constructs?r(v):v===93?(t.exit(u),t.enter(c),t.consume(v),t.exit(c),t.exit(i),l):Ie(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||Ie(v)||m++>999?(t.exit("chunkString"),g(v)):(t.consume(v),x||(x=!at(v)),v===92?b:y)}function b(v){return v===91||v===92||v===93?(t.consume(v),m++,y):y(v)}}function xy(t,l,r,i,c,u){let f;return m;function m(b){return b===34||b===39||b===40?(t.enter(i),t.enter(c),t.consume(b),t.exit(c),f=b===40?41:b,x):r(b)}function x(b){return b===f?(t.enter(c),t.consume(b),t.exit(c),t.exit(i),l):(t.enter(u),d(b))}function d(b){return b===f?(t.exit(u),x(f)):b===null?r(b):Ie(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),dt(t,d,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===f||b===null||Ie(b)?(t.exit("chunkString"),d(b)):(t.consume(b),b===92?y:g)}function y(b){return b===f||b===92?(t.consume(b),g):g(b)}}function Ns(t,l){let r;return i;function i(c){return Ie(c)?(t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),r=!0,i):at(c)?dt(t,i,r?"linePrefix":"lineSuffix")(c):l(c)}}const Aw={name:"definition",tokenize:Dw},Tw={partial:!0,tokenize:zw};function Dw(t,l,r){const i=this;let c;return u;function u(v){return t.enter("definition"),f(v)}function f(v){return my.call(i,t,m,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function m(v){return c=hl(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),x):r(v)}function x(v){return zt(v)?Ns(t,d)(v):d(v)}function d(v){return hy(t,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function g(v){return t.attempt(Tw,y,y)(v)}function y(v){return at(v)?dt(t,b,"whitespace")(v):b(v)}function b(v){return v===null||Ie(v)?(t.exit("definition"),i.parser.defined.push(c),l(v)):r(v)}}function zw(t,l,r){return i;function i(m){return zt(m)?Ns(t,c)(m):r(m)}function c(m){return xy(t,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(m)}function u(m){return at(m)?dt(t,f,"whitespace")(m):f(m)}function f(m){return m===null||Ie(m)?l(m):r(m)}}const Mw={name:"hardBreakEscape",tokenize:Rw};function Rw(t,l,r){return i;function i(u){return t.enter("hardBreakEscape"),t.consume(u),c}function c(u){return Ie(u)?(t.exit("hardBreakEscape"),l(u)):r(u)}}const Fw={name:"headingAtx",resolve:_w,tokenize:Ow};function _w(t,l){let r=t.length-2,i=3,c,u;return t[i][1].type==="whitespace"&&(i+=2),r-2>i&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(i===r-1||r-4>i&&t[r-2][1].type==="whitespace")&&(r-=i+1===r?2:4),r>i&&(c={type:"atxHeadingText",start:t[i][1].start,end:t[r][1].end},u={type:"chunkText",start:t[i][1].start,end:t[r][1].end,contentType:"text"},Gn(t,i,r-i+1,[["enter",c,l],["enter",u,l],["exit",u,l],["exit",c,l]])),t}function Ow(t,l,r){let i=0;return c;function c(g){return t.enter("atxHeading"),u(g)}function u(g){return t.enter("atxHeadingSequence"),f(g)}function f(g){return g===35&&i++<6?(t.consume(g),f):g===null||zt(g)?(t.exit("atxHeadingSequence"),m(g)):r(g)}function m(g){return g===35?(t.enter("atxHeadingSequence"),x(g)):g===null||Ie(g)?(t.exit("atxHeading"),l(g)):at(g)?dt(t,m,"whitespace")(g):(t.enter("atxHeadingText"),d(g))}function x(g){return g===35?(t.consume(g),x):(t.exit("atxHeadingSequence"),m(g))}function d(g){return g===null||g===35||zt(g)?(t.exit("atxHeadingText"),m(g)):(t.consume(g),d)}}const Bw=["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"],M1=["pre","script","style","textarea"],Lw={concrete:!0,name:"htmlFlow",resolveTo:Uw,tokenize:Iw},$w={partial:!0,tokenize:qw},Hw={partial:!0,tokenize:Yw};function Uw(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 Iw(t,l,r){const i=this;let c,u,f,m,x;return d;function d(T){return g(T)}function g(T){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(T),y}function y(T){return T===33?(t.consume(T),b):T===47?(t.consume(T),u=!0,S):T===63?(t.consume(T),c=3,i.interrupt?l:D):kn(T)?(t.consume(T),f=String.fromCharCode(T),C):r(T)}function b(T){return T===45?(t.consume(T),c=2,v):T===91?(t.consume(T),c=5,m=0,j):kn(T)?(t.consume(T),c=4,i.interrupt?l:D):r(T)}function v(T){return T===45?(t.consume(T),i.interrupt?l:D):r(T)}function j(T){const me="CDATA[";return T===me.charCodeAt(m++)?(t.consume(T),m===me.length?i.interrupt?l:R:j):r(T)}function S(T){return kn(T)?(t.consume(T),f=String.fromCharCode(T),C):r(T)}function C(T){if(T===null||T===47||T===62||zt(T)){const me=T===47,Se=f.toLowerCase();return!me&&!u&&M1.includes(Se)?(c=1,i.interrupt?l(T):R(T)):Bw.includes(f.toLowerCase())?(c=6,me?(t.consume(T),E):i.interrupt?l(T):R(T)):(c=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(T):u?A(T):M(T))}return T===45||yn(T)?(t.consume(T),f+=String.fromCharCode(T),C):r(T)}function E(T){return T===62?(t.consume(T),i.interrupt?l:R):r(T)}function A(T){return at(T)?(t.consume(T),A):z(T)}function M(T){return T===47?(t.consume(T),z):T===58||T===95||kn(T)?(t.consume(T),O):at(T)?(t.consume(T),M):z(T)}function O(T){return T===45||T===46||T===58||T===95||yn(T)?(t.consume(T),O):L(T)}function L(T){return T===61?(t.consume(T),F):at(T)?(t.consume(T),L):M(T)}function F(T){return T===null||T===60||T===61||T===62||T===96?r(T):T===34||T===39?(t.consume(T),x=T,I):at(T)?(t.consume(T),F):$(T)}function I(T){return T===x?(t.consume(T),x=null,ee):T===null||Ie(T)?r(T):(t.consume(T),I)}function $(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||zt(T)?L(T):(t.consume(T),$)}function ee(T){return T===47||T===62||at(T)?M(T):r(T)}function z(T){return T===62?(t.consume(T),X):r(T)}function X(T){return T===null||Ie(T)?R(T):at(T)?(t.consume(T),X):r(T)}function R(T){return T===45&&c===2?(t.consume(T),Y):T===60&&c===1?(t.consume(T),Z):T===62&&c===4?(t.consume(T),B):T===63&&c===3?(t.consume(T),D):T===93&&c===5?(t.consume(T),we):Ie(T)&&(c===6||c===7)?(t.exit("htmlFlowData"),t.check($w,Q,W)(T)):T===null||Ie(T)?(t.exit("htmlFlowData"),W(T)):(t.consume(T),R)}function W(T){return t.check(Hw,te,Q)(T)}function te(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),V}function V(T){return T===null||Ie(T)?W(T):(t.enter("htmlFlowData"),R(T))}function Y(T){return T===45?(t.consume(T),D):R(T)}function Z(T){return T===47?(t.consume(T),f="",ce):R(T)}function ce(T){if(T===62){const me=f.toLowerCase();return M1.includes(me)?(t.consume(T),B):R(T)}return kn(T)&&f.length<8?(t.consume(T),f+=String.fromCharCode(T),ce):R(T)}function we(T){return T===93?(t.consume(T),D):R(T)}function D(T){return T===62?(t.consume(T),B):T===45&&c===2?(t.consume(T),D):R(T)}function B(T){return T===null||Ie(T)?(t.exit("htmlFlowData"),Q(T)):(t.consume(T),B)}function Q(T){return t.exit("htmlFlow"),l(T)}}function Yw(t,l,r){const i=this;return c;function c(f){return Ie(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u):r(f)}function u(f){return i.parser.lazy[i.now().line]?r(f):l(f)}}function qw(t,l,r){return i;function i(c){return t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),t.attempt(Ls,l,r)}}const Xw={name:"htmlText",tokenize:Vw};function Vw(t,l,r){const i=this;let c,u,f;return m;function m(D){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(D),x}function x(D){return D===33?(t.consume(D),d):D===47?(t.consume(D),L):D===63?(t.consume(D),M):kn(D)?(t.consume(D),$):r(D)}function d(D){return D===45?(t.consume(D),g):D===91?(t.consume(D),u=0,j):kn(D)?(t.consume(D),A):r(D)}function g(D){return D===45?(t.consume(D),v):r(D)}function y(D){return D===null?r(D):D===45?(t.consume(D),b):Ie(D)?(f=y,Z(D)):(t.consume(D),y)}function b(D){return D===45?(t.consume(D),v):y(D)}function v(D){return D===62?Y(D):D===45?b(D):y(D)}function j(D){const B="CDATA[";return D===B.charCodeAt(u++)?(t.consume(D),u===B.length?S:j):r(D)}function S(D){return D===null?r(D):D===93?(t.consume(D),C):Ie(D)?(f=S,Z(D)):(t.consume(D),S)}function C(D){return D===93?(t.consume(D),E):S(D)}function E(D){return D===62?Y(D):D===93?(t.consume(D),E):S(D)}function A(D){return D===null||D===62?Y(D):Ie(D)?(f=A,Z(D)):(t.consume(D),A)}function M(D){return D===null?r(D):D===63?(t.consume(D),O):Ie(D)?(f=M,Z(D)):(t.consume(D),M)}function O(D){return D===62?Y(D):M(D)}function L(D){return kn(D)?(t.consume(D),F):r(D)}function F(D){return D===45||yn(D)?(t.consume(D),F):I(D)}function I(D){return Ie(D)?(f=I,Z(D)):at(D)?(t.consume(D),I):Y(D)}function $(D){return D===45||yn(D)?(t.consume(D),$):D===47||D===62||zt(D)?ee(D):r(D)}function ee(D){return D===47?(t.consume(D),Y):D===58||D===95||kn(D)?(t.consume(D),z):Ie(D)?(f=ee,Z(D)):at(D)?(t.consume(D),ee):Y(D)}function z(D){return D===45||D===46||D===58||D===95||yn(D)?(t.consume(D),z):X(D)}function X(D){return D===61?(t.consume(D),R):Ie(D)?(f=X,Z(D)):at(D)?(t.consume(D),X):ee(D)}function R(D){return D===null||D===60||D===61||D===62||D===96?r(D):D===34||D===39?(t.consume(D),c=D,W):Ie(D)?(f=R,Z(D)):at(D)?(t.consume(D),R):(t.consume(D),te)}function W(D){return D===c?(t.consume(D),c=void 0,V):D===null?r(D):Ie(D)?(f=W,Z(D)):(t.consume(D),W)}function te(D){return D===null||D===34||D===39||D===60||D===61||D===96?r(D):D===47||D===62||zt(D)?ee(D):(t.consume(D),te)}function V(D){return D===47||D===62||zt(D)?ee(D):r(D)}function Y(D){return D===62?(t.consume(D),t.exit("htmlTextData"),t.exit("htmlText"),l):r(D)}function Z(D){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),ce}function ce(D){return at(D)?dt(t,we,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):we(D)}function we(D){return t.enter("htmlTextData"),f(D)}}const uh={name:"labelEnd",resolveAll:Ww,resolveTo:Zw,tokenize:Jw},Gw={tokenize:Pw},Kw={tokenize:e5},Qw={tokenize:t5};function Ww(t){let l=-1;const r=[];for(;++l<t.length;){const i=t[l][1];if(r.push(t[l]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const c=i.type==="labelImage"?4:2;i.type="data",l+=c}}return t.length!==r.length&&Gn(t,0,t.length,r),t}function Zw(t,l){let r=t.length,i=0,c,u,f,m;for(;r--;)if(c=t[r][1],u){if(c.type==="link"||c.type==="labelLink"&&c._inactive)break;t[r][0]==="enter"&&c.type==="labelLink"&&(c._inactive=!0)}else if(f){if(t[r][0]==="enter"&&(c.type==="labelImage"||c.type==="labelLink")&&!c._balanced&&(u=r,c.type!=="labelLink")){i=2;break}}else c.type==="labelEnd"&&(f=r);const x={type:t[u][1].type==="labelLink"?"link":"image",start:{...t[u][1].start},end:{...t[t.length-1][1].end}},d={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",x,l],["enter",d,l]],m=al(m,t.slice(u+1,u+i+3)),m=al(m,[["enter",g,l]]),m=al(m,Bc(l.parser.constructs.insideSpan.null,t.slice(u+i+4,f-3),l)),m=al(m,[["exit",g,l],t[f-2],t[f-1],["exit",d,l]]),m=al(m,t.slice(f+1)),m=al(m,[["exit",x,l]]),Gn(t,u,t.length,m),t}function Jw(t,l,r){const i=this;let c=i.events.length,u,f;for(;c--;)if((i.events[c][1].type==="labelImage"||i.events[c][1].type==="labelLink")&&!i.events[c][1]._balanced){u=i.events[c][1];break}return m;function m(b){return u?u._inactive?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"),x):r(b)}function x(b){return b===40?t.attempt(Gw,g,f?g:y)(b):b===91?t.attempt(Kw,g,f?d:y)(b):f?g(b):y(b)}function d(b){return t.attempt(Qw,g,y)(b)}function g(b){return l(b)}function y(b){return u._balanced=!0,r(b)}}function Pw(t,l,r){return i;function i(y){return t.enter("resource"),t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),c}function c(y){return zt(y)?Ns(t,u)(y):u(y)}function u(y){return y===41?g(y):hy(t,f,m,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function f(y){return zt(y)?Ns(t,x)(y):g(y)}function m(y){return r(y)}function x(y){return y===34||y===39||y===40?xy(t,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function d(y){return zt(y)?Ns(t,g)(y):g(y)}function g(y){return y===41?(t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),t.exit("resource"),l):r(y)}}function e5(t,l,r){const i=this;return c;function c(m){return my.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):r(m)}function f(m){return r(m)}}function t5(t,l,r){return i;function i(u){return t.enter("reference"),t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),c}function c(u){return u===93?(t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),t.exit("reference"),l):r(u)}}const n5={name:"labelStartImage",resolveAll:uh.resolveAll,tokenize:l5};function l5(t,l,r){const i=this;return c;function c(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):r(m)}function f(m){return m===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(m):l(m)}}const r5={name:"labelStartLink",resolveAll:uh.resolveAll,tokenize:a5};function a5(t,l,r){const i=this;return c;function c(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?r(f):l(f)}}const ld={name:"lineEnding",tokenize:i5};function i5(t,l){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),dt(t,l,"linePrefix")}}const bc={name:"thematicBreak",tokenize:s5};function s5(t,l,r){let i=0,c;return u;function u(d){return t.enter("thematicBreak"),f(d)}function f(d){return c=d,m(d)}function m(d){return d===c?(t.enter("thematicBreakSequence"),x(d)):i>=3&&(d===null||Ie(d))?(t.exit("thematicBreak"),l(d)):r(d)}function x(d){return d===c?(t.consume(d),i++,x):(t.exit("thematicBreakSequence"),at(d)?dt(t,m,"whitespace")(d):m(d))}}const Fn={continuation:{tokenize:f5},exit:h5,name:"list",tokenize:u5},o5={partial:!0,tokenize:m5},c5={partial:!0,tokenize:d5};function u5(t,l,r){const i=this,c=i.events[i.events.length-1];let u=c&&c[1].type==="linePrefix"?c[2].sliceSerialize(c[1],!0).length:0,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:Ud(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(bc,r,d)(v):d(v);if(!i.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),x(v)}return r(v)}function x(v){return Ud(v)&&++f<10?(t.consume(v),x):(!i.interrupt||f<2)&&(i.containerState.marker?v===i.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),d(v)):r(v)}function d(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||v,t.check(Ls,i.interrupt?r:g,t.attempt(o5,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):r(v)}function b(v){return i.containerState.size=u+i.sliceSerialize(t.exit("listItemPrefix"),!0).length,l(v)}}function f5(t,l,r){const i=this;return i.containerState._closeFlow=void 0,t.check(Ls,c,u);function c(m){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,dt(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(c5,l,f)(m))}function f(m){return i.containerState._closeFlow=!0,i.interrupt=void 0,dt(t,t.attempt(Fn,l,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m)}}function d5(t,l,r){const i=this;return dt(t,c,"listItemIndent",i.containerState.size+1);function c(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):r(u)}}function h5(t){t.exit(this.containerState.type)}function m5(t,l,r){const i=this;return dt(t,c,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(u){const f=i.events[i.events.length-1];return!at(u)&&f&&f[1].type==="listItemPrefixWhitespace"?l(u):r(u)}}const R1={name:"setextUnderline",resolveTo:x5,tokenize:p5};function x5(t,l){let r=t.length,i,c,u;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){i=r;break}t[r][1].type==="paragraph"&&(c=r)}else t[r][1].type==="content"&&t.splice(r,1),!u&&t[r][1].type==="definition"&&(u=r);const f={type:"setextHeading",start:{...t[i][1].start},end:{...t[t.length-1][1].end}};return t[c][1].type="setextHeadingText",u?(t.splice(c,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 p5(t,l,r){const i=this;let c;return u;function u(d){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"),c=d,f(d)):r(d)}function f(d){return t.enter("setextHeadingLineSequence"),m(d)}function m(d){return d===c?(t.consume(d),m):(t.exit("setextHeadingLineSequence"),at(d)?dt(t,x,"lineSuffix")(d):x(d))}function x(d){return d===null||Ie(d)?(t.exit("setextHeadingLine"),l(d)):r(d)}}const y5={tokenize:g5};function g5(t){const l=this,r=t.attempt(Ls,i,t.attempt(this.parser.constructs.flowInitial,c,dt(t,t.attempt(this.parser.constructs.flow,c,t.attempt(Sw,c)),"linePrefix")));return r;function i(u){if(u===null){t.consume(u);return}return t.enter("lineEndingBlank"),t.consume(u),t.exit("lineEndingBlank"),l.currentConstruct=void 0,r}function c(u){if(u===null){t.consume(u);return}return t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),l.currentConstruct=void 0,r}}const b5={resolveAll:yy()},v5=py("string"),w5=py("text");function py(t){return{resolveAll:yy(t==="text"?k5:void 0),tokenize:l};function l(r){const i=this,c=this.parser.constructs[t],u=r.attempt(c,f,m);return f;function f(g){return d(g)?u(g):m(g)}function m(g){if(g===null){r.consume(g);return}return r.enter("data"),r.consume(g),x}function x(g){return d(g)?(r.exit("data"),u(g)):(r.consume(g),x)}function d(g){if(g===null)return!0;const y=c[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 yy(t){return l;function l(r,i){let c=-1,u;for(;++c<=r.length;)u===void 0?r[c]&&r[c][1].type==="data"&&(u=c,c++):(!r[c]||r[c][1].type!=="data")&&(c!==u+2&&(r[u][1].end=r[c-1][1].end,r.splice(u+2,c-u-2),c=u+2),u=void 0);return t?t(r,i):r}}function k5(t,l){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){const i=t[r-1][1],c=l.sliceStream(i);let u=c.length,f=-1,m=0,x;for(;u--;){const d=c[u];if(typeof d=="string"){for(f=d.length;d.charCodeAt(f-1)===32;)m++,f--;if(f)break;f=-1}else if(d===-2)x=!0,m++;else if(d!==-1){u++;break}}if(l._contentTypeTextTrailing&&r===t.length&&(m=0),m){const d={type:r===t.length||x||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={...d.start},i.start.offset===i.end.offset?Object.assign(i,d):(t.splice(r,0,["enter",d,l],["exit",d,l]),r+=2)}r++}return t}const S5={42:Fn,43:Fn,45:Fn,48:Fn,49:Fn,50:Fn,51:Fn,52:Fn,53:Fn,54:Fn,55:Fn,56:Fn,57:Fn,62:cy},j5={91:Aw},C5={[-2]:nd,[-1]:nd,32:nd},E5={35:Fw,42:bc,45:[R1,bc],60:Lw,61:R1,95:bc,96:z1,126:z1},N5={38:fy,92:uy},A5={[-5]:ld,[-4]:ld,[-3]:ld,33:n5,38:fy,42:Id,60:[rw,Xw],91:r5,92:[Mw,uy],93:uh,95:Id,96:yw},T5={null:[Id,b5]},D5={null:[42,95]},z5={null:[]},M5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:D5,contentInitial:j5,disable:z5,document:S5,flow:E5,flowInitial:C5,insideSpan:T5,string:N5,text:A5},Symbol.toStringTag,{value:"Module"}));function R5(t,l,r){let i={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const c={},u=[];let f=[],m=[];const x={attempt:I(L),check:I(F),consume:A,enter:M,exit:O,interrupt:I(F,{interrupt:!0})},d={code:null,containerState:{},defineSkip:S,events:[],now:j,parser:t,previous:null,sliceSerialize:b,sliceStream:v,write:y};let g=l.tokenize.call(d,x);return l.resolveAll&&u.push(l),d;function y(X){return f=al(f,X),C(),f[f.length-1]!==null?[]:($(l,0),d.events=Bc(u,d.events,d),d.events)}function b(X,R){return _5(v(X),R)}function v(X){return F5(f,X)}function j(){const{_bufferIndex:X,_index:R,line:W,column:te,offset:V}=i;return{_bufferIndex:X,_index:R,line:W,column:te,offset:V}}function S(X){c[X.line]=X.column,z()}function C(){let X;for(;i._index<f.length;){const R=f[i._index];if(typeof R=="string")for(X=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===X&&i._bufferIndex<R.length;)E(R.charCodeAt(i._bufferIndex));else E(R)}}function E(X){g=g(X)}function A(X){Ie(X)?(i.line++,i.column=1,i.offset+=X===-3?2:1,z()):X!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===f[i._index].length&&(i._bufferIndex=-1,i._index++)),d.previous=X}function M(X,R){const W=R||{};return W.type=X,W.start=j(),d.events.push(["enter",W,d]),m.push(W),W}function O(X){const R=m.pop();return R.end=j(),d.events.push(["exit",R,d]),R}function L(X,R){$(X,R.from)}function F(X,R){R.restore()}function I(X,R){return W;function W(te,V,Y){let Z,ce,we,D;return Array.isArray(te)?Q(te):"tokenize"in te?Q([te]):B(te);function B(Ee){return Be;function Be(He){const Ke=He!==null&&Ee[He],ke=He!==null&&Ee.null,yt=[...Array.isArray(Ke)?Ke:Ke?[Ke]:[],...Array.isArray(ke)?ke:ke?[ke]:[]];return Q(yt)(He)}}function Q(Ee){return Z=Ee,ce=0,Ee.length===0?Y:T(Ee[ce])}function T(Ee){return Be;function Be(He){return D=ee(),we=Ee,Ee.partial||(d.currentConstruct=Ee),Ee.name&&d.parser.constructs.disable.null.includes(Ee.name)?Se():Ee.tokenize.call(R?Object.assign(Object.create(d),R):d,x,me,Se)(He)}}function me(Ee){return X(we,D),V}function Se(Ee){return D.restore(),++ce<Z.length?T(Z[ce]):Y}}}function $(X,R){X.resolveAll&&!u.includes(X)&&u.push(X),X.resolve&&Gn(d.events,R,d.events.length-R,X.resolve(d.events.slice(R),d)),X.resolveTo&&(d.events=X.resolveTo(d.events,d))}function ee(){const X=j(),R=d.previous,W=d.currentConstruct,te=d.events.length,V=Array.from(m);return{from:te,restore:Y};function Y(){i=X,d.previous=R,d.currentConstruct=W,d.events.length=te,m=V,z()}}function z(){i.line in c&&i.column<2&&(i.column=c[i.line],i.offset+=c[i.line]-1)}}function F5(t,l){const r=l.start._index,i=l.start._bufferIndex,c=l.end._index,u=l.end._bufferIndex;let f;if(r===c)f=[t[r].slice(i,u)];else{if(f=t.slice(r,c),i>-1){const m=f[0];typeof m=="string"?f[0]=m.slice(i):f.shift()}u>0&&f.push(t[c].slice(0,u))}return f}function _5(t,l){let r=-1;const i=[];let c;for(;++r<t.length;){const u=t[r];let f;if(typeof u=="string")f=u;else switch(u){case-5:{f="\r";break}case-4:{f=`
52
52
  `;break}case-3:{f=`\r
53
- `;break}case-2:{f=l?" ":" ";break}case-1:{if(!l&&c)continue;f=" ";break}default:f=String.fromCharCode(u)}c=u===-2,i.push(f)}return i.join("")}function _5(t){const i={constructs:iy([z5,...(t||{}).extensions||[]]),content:c(Wv),defined:[],document:c(Jv),flow:c(p5),lazy:{},string:c(b5),text:c(v5)};return i;function c(u){return f;function f(m){return M5(i,u,m)}}}function O5(t){for(;!fy(t););return t}const F1=/[\0\t\n\r]/g;function B5(){let t=1,l="",r=!0,i;return c;function c(u,f,m){const p=[];let d,g,y,b,v;for(u=l+(typeof u=="string"?u.toString():new TextDecoder(f||void 0).decode(u)),y=0,l="",r&&(u.charCodeAt(0)===65279&&y++,r=void 0);y<u.length;){if(F1.lastIndex=y,d=F1.exec(u),b=d&&d.index!==void 0?d.index:u.length,v=u.charCodeAt(b),!d){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 L5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function $5(t){return t.replace(L5,H5)}function H5(t,l,r){if(l)return l;if(r.charCodeAt(0)===35){const c=r.charCodeAt(1),u=c===120||c===88;return sy(r.slice(u?2:1),u?16:10)}return ch(r)||t}const yy={}.hasOwnProperty;function U5(t,l,r){return l&&typeof l=="object"&&(r=l,l=void 0),I5(r)(O5(_5(r).document().write(B5()(t,l,!0))))}function I5(t){const l={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Me),autolinkProtocol:ne,autolinkEmail:ne,atxHeading:u(ve),blockQuote:u(ke),characterEscape:ne,characterReference:ne,codeFenced:u(yt),codeFencedFenceInfo:f,codeFencedFenceMeta:f,codeIndented:u(yt,f),codeText:u(de,f),codeTextData:ne,data:ne,codeFlowValue:ne,definition:u(G),definitionDestinationString:f,definitionLabelString:f,definitionTitleString:f,emphasis:u(re),hardBreakEscape:u(ze),hardBreakTrailing:u(ze),htmlFlow:u(Ne,f),htmlFlowData:ne,htmlText:u(Ne,f),htmlTextData:ne,image:u(Te),label:f,link:u(Me),listItem:u(tt),listItemValue:b,listOrdered:u(Oe,y),listUnordered:u(Oe),paragraph:u(Lt),reference:T,referenceString:f,resourceDestinationString:f,resourceTitleString:f,setextHeading:u(ve),strong:u(gt),thematicBreak:u(Zt)},exit:{atxHeading:p(),atxHeadingSequence:L,autolink:p(),autolinkEmail:Ke,autolinkProtocol:He,blockQuote:p(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:Se,characterReferenceMarkerNumeric:Se,characterReferenceValue:Ee,characterReference:Be,codeFenced:p(C),codeFencedFence:k,codeFencedFenceInfo:v,codeFencedFenceMeta:j,codeFlowValue:M,codeIndented:p(E),codeText:p(V),codeTextData:M,data:M,definition:p(),definitionDestinationString:O,definitionLabelString:A,definitionTitleString:R,emphasis:p(),hardBreakEscape:p(F),hardBreakTrailing:p(F),htmlFlow:p(W),htmlFlowData:M,htmlText:p(ee),htmlTextData:M,image:p(Z),label:we,labelText:ce,lineEnding:q,link:p(I),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:me,resourceDestinationString:z,resourceTitleString:B,resource:Q,setextHeading:p(X),setextHeadingLineSequence:U,setextHeadingText:D,strong:p(),thematicBreak:p()}};gy(l,(t||{}).mdastExtensions||[]);const r={};return i;function i(ae){let xe={type:"root",children:[]};const De={stack:[xe],tokenStack:[],config:l,enter:m,exit:d,buffer:f,resume:g,data:r},Ue=[];let ye=-1;for(;++ye<ae.length;)if(ae[ye][1].type==="listOrdered"||ae[ye][1].type==="listUnordered")if(ae[ye][0]==="enter")Ue.push(ye);else{const je=Ue.pop();ye=c(ae,je,ye)}for(ye=-1;++ye<ae.length;){const je=l[ae[ye][0]];yy.call(je,ae[ye][1].type)&&je[ae[ye][1].type].call(Object.assign({sliceSerialize:ae[ye][2].sliceSerialize},De),ae[ye][1])}if(De.tokenStack.length>0){const je=De.tokenStack[De.tokenStack.length-1];(je[1]||_1).call(De,void 0,je[0])}for(xe.position={start:Fr(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:Fr(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},ye=-1;++ye<l.transforms.length;)xe=l.transforms[ye](xe)||xe;return xe}function c(ae,xe,De){let Ue=xe-1,ye=-1,je=!1,jt,wt,Xe,ft;for(;++Ue<=De;){const fe=ae[Ue];switch(fe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{fe[0]==="enter"?ye++:ye--,ft=void 0;break}case"lineEndingBlank":{fe[0]==="enter"&&(jt&&!ft&&!ye&&!Xe&&(Xe=Ue),ft=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ft=void 0}if(!ye&&fe[0]==="enter"&&fe[1].type==="listItemPrefix"||ye===-1&&fe[0]==="exit"&&(fe[1].type==="listUnordered"||fe[1].type==="listOrdered")){if(jt){let Mt=Ue;for(wt=void 0;Mt--;){const nt=ae[Mt];if(nt[1].type==="lineEnding"||nt[1].type==="lineEndingBlank"){if(nt[0]==="exit")continue;wt&&(ae[wt][1].type="lineEndingBlank",je=!0),nt[1].type="lineEnding",wt=Mt}else if(!(nt[1].type==="linePrefix"||nt[1].type==="blockQuotePrefix"||nt[1].type==="blockQuotePrefixWhitespace"||nt[1].type==="blockQuoteMarker"||nt[1].type==="listItemIndent"))break}Xe&&(!wt||Xe<wt)&&(jt._spread=!0),jt.end=Object.assign({},wt?ae[wt][1].start:fe[1].end),ae.splice(wt||Ue,0,["exit",jt,fe[2]]),Ue++,De++}if(fe[1].type==="listItemPrefix"){const Mt={type:"listItem",_spread:!1,start:Object.assign({},fe[1].start),end:void 0};jt=Mt,ae.splice(Ue,0,["enter",Mt,fe[2]]),Ue++,De++,Xe=void 0,ft=!0}}}return ae[xe][1]._spread=je,De}function u(ae,xe){return De;function De(Ue){m.call(this,ae(Ue),Ue),xe&&xe.call(this,Ue)}}function f(){this.stack.push({type:"fragment",children:[]})}function m(ae,xe,De){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([xe,De||void 0]),ae.position={start:Fr(xe.start),end:void 0}}function p(ae){return xe;function xe(De){ae&&ae.call(this,De),d.call(this,De)}}function d(ae,xe){const De=this.stack.pop(),Ue=this.tokenStack.pop();if(Ue)Ue[0].type!==ae.type&&(xe?xe.call(this,ae,Ue[0]):(Ue[1]||_1).call(this,ae,Ue[0]));else throw new Error("Cannot close `"+ae.type+"` ("+Es({start:ae.start,end:ae.end})+"): it’s not open");De.position.end=Fr(ae.end)}function g(){return oh(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function b(ae){if(this.data.expectingFirstListItemValue){const xe=this.stack[this.stack.length-2];xe.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function v(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.lang=ae}function j(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.meta=ae}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ae.replace(/(\r?\n|\r)$/g,"")}function A(ae){const xe=this.resume(),De=this.stack[this.stack.length-1];De.label=xe,De.identifier=hl(this.sliceSerialize(ae)).toLowerCase()}function R(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.title=ae}function O(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.url=ae}function L(ae){const xe=this.stack[this.stack.length-1];if(!xe.depth){const De=this.sliceSerialize(ae).length;xe.depth=De}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function U(ae){const xe=this.stack[this.stack.length-1];xe.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function X(){this.data.setextHeadingSlurpLineEnding=void 0}function ne(ae){const De=this.stack[this.stack.length-1].children;let Ue=De[De.length-1];(!Ue||Ue.type!=="text")&&(Ue=ht(),Ue.position={start:Fr(ae.start),end:void 0},De.push(Ue)),this.stack.push(Ue)}function M(ae){const xe=this.stack.pop();xe.value+=this.sliceSerialize(ae),xe.position.end=Fr(ae.end)}function q(ae){const xe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const De=xe.children[xe.children.length-1];De.position.end=Fr(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&l.canContainEols.includes(xe.type)&&(ne.call(this,ae),M.call(this,ae))}function F(){this.data.atHardBreak=!0}function W(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ae}function ee(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ae}function V(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ae}function I(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=xe,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function Z(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=xe,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function ce(ae){const xe=this.sliceSerialize(ae),De=this.stack[this.stack.length-2];De.label=$5(xe),De.identifier=hl(xe).toLowerCase()}function we(){const ae=this.stack[this.stack.length-1],xe=this.resume(),De=this.stack[this.stack.length-1];if(this.data.inReference=!0,De.type==="link"){const Ue=ae.children;De.children=Ue}else De.alt=xe}function z(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.url=ae}function B(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.title=ae}function Q(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function me(ae){const xe=this.resume(),De=this.stack[this.stack.length-1];De.label=xe,De.identifier=hl(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function Se(ae){this.data.characterReferenceType=ae.type}function Ee(ae){const xe=this.sliceSerialize(ae),De=this.data.characterReferenceType;let Ue;De?(Ue=sy(xe,De==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ue=ch(xe);const ye=this.stack[this.stack.length-1];ye.value+=Ue}function Be(ae){const xe=this.stack.pop();xe.position.end=Fr(ae.end)}function He(ae){M.call(this,ae);const xe=this.stack[this.stack.length-1];xe.url=this.sliceSerialize(ae)}function Ke(ae){M.call(this,ae);const xe=this.stack[this.stack.length-1];xe.url="mailto:"+this.sliceSerialize(ae)}function ke(){return{type:"blockquote",children:[]}}function yt(){return{type:"code",lang:null,meta:null,value:""}}function de(){return{type:"inlineCode",value:""}}function G(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function re(){return{type:"emphasis",children:[]}}function ve(){return{type:"heading",depth:0,children:[]}}function ze(){return{type:"break"}}function Ne(){return{type:"html",value:""}}function Te(){return{type:"image",title:null,url:"",alt:null}}function Me(){return{type:"link",title:null,url:"",children:[]}}function Oe(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function tt(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function Lt(){return{type:"paragraph",children:[]}}function gt(){return{type:"strong",children:[]}}function ht(){return{type:"text",value:""}}function Zt(){return{type:"thematicBreak"}}}function Fr(t){return{line:t.line,column:t.column,offset:t.offset}}function gy(t,l){let r=-1;for(;++r<l.length;){const i=l[r];Array.isArray(i)?gy(t,i):Y5(t,i)}}function Y5(t,l){let r;for(r in l)if(yy.call(l,r))switch(r){case"canContainEols":{const i=l[r];i&&t[r].push(...i);break}case"transforms":{const i=l[r];i&&t[r].push(...i);break}case"enter":case"exit":{const i=l[r];i&&Object.assign(t[r],i);break}}}function _1(t,l){throw t?new Error("Cannot close `"+t.type+"` ("+Es({start:t.start,end:t.end})+"): a different token (`"+l.type+"`, "+Es({start:l.start,end:l.end})+") is open"):new Error("Cannot close document, a token (`"+l.type+"`, "+Es({start:l.start,end:l.end})+") is still open")}function q5(t){const l=this;l.parser=r;function r(i){return U5(i,{...l.data("settings"),...t,extensions:l.data("micromarkExtensions")||[],mdastExtensions:l.data("fromMarkdownExtensions")||[]})}}function X5(t,l){const r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(l),!0)};return t.patch(l,r),t.applyData(l,r)}function V5(t,l){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(l,r),[t.applyData(l,r),{type:"text",value:`
54
- `}]}function G5(t,l){const r=l.value?l.value+`
55
- `:"",i={},c=l.lang?l.lang.split(/\s+/):[];c.length>0&&(i.className=["language-"+c[0]]);let u={type:"element",tagName:"code",properties:i,children:[{type:"text",value:r}]};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 K5(t,l){const r={type:"element",tagName:"del",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function Q5(t,l){const r={type:"element",tagName:"em",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function W5(t,l){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",i=String(l.identifier).toUpperCase(),c=di(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:"#"+r+"fn-"+c,id:r+"fnref-"+c+(m>1?"-"+m:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(f)}]};t.patch(l,p);const d={type:"element",tagName:"sup",properties:{},children:[p]};return t.patch(l,d),t.applyData(l,d)}function Z5(t,l){const r={type:"element",tagName:"h"+l.depth,properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function J5(t,l){if(t.options.allowDangerousHtml){const r={type:"raw",value:l.value};return t.patch(l,r),t.applyData(l,r)}}function by(t,l){const r=l.referenceType;let i="]";if(r==="collapsed"?i+="[]":r==="full"&&(i+="["+(l.label||l.identifier)+"]"),l.type==="imageReference")return[{type:"text",value:"!["+l.alt+i}];const c=t.all(l),u=c[0];u&&u.type==="text"?u.value="["+u.value:c.unshift({type:"text",value:"["});const f=c[c.length-1];return f&&f.type==="text"?f.value+=i:c.push({type:"text",value:i}),c}function P5(t,l){const r=String(l.identifier).toUpperCase(),i=t.definitionById.get(r);if(!i)return by(t,l);const c={src:di(i.url||""),alt:l.alt};i.title!==null&&i.title!==void 0&&(c.title=i.title);const u={type:"element",tagName:"img",properties:c,children:[]};return t.patch(l,u),t.applyData(l,u)}function e3(t,l){const r={src:di(l.url)};l.alt!==null&&l.alt!==void 0&&(r.alt=l.alt),l.title!==null&&l.title!==void 0&&(r.title=l.title);const i={type:"element",tagName:"img",properties:r,children:[]};return t.patch(l,i),t.applyData(l,i)}function t3(t,l){const r={type:"text",value:l.value.replace(/\r?\n|\r/g," ")};t.patch(l,r);const i={type:"element",tagName:"code",properties:{},children:[r]};return t.patch(l,i),t.applyData(l,i)}function n3(t,l){const r=String(l.identifier).toUpperCase(),i=t.definitionById.get(r);if(!i)return by(t,l);const c={href:di(i.url||"")};i.title!==null&&i.title!==void 0&&(c.title=i.title);const u={type:"element",tagName:"a",properties:c,children:t.all(l)};return t.patch(l,u),t.applyData(l,u)}function l3(t,l){const r={href:di(l.url)};l.title!==null&&l.title!==void 0&&(r.title=l.title);const i={type:"element",tagName:"a",properties:r,children:t.all(l)};return t.patch(l,i),t.applyData(l,i)}function r3(t,l,r){const i=t.all(l),c=r?a3(r):vy(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];(c||m!==0||g.type!=="element"||g.tagName!=="p")&&f.push({type:"text",value:`
56
- `}),g.type==="element"&&g.tagName==="p"&&!c?f.push(...g.children):f.push(g)}const p=i[i.length-1];p&&(c||p.type!=="element"||p.tagName!=="p")&&f.push({type:"text",value:`
57
- `});const d={type:"element",tagName:"li",properties:u,children:f};return t.patch(l,d),t.applyData(l,d)}function a3(t){let l=!1;if(t.type==="list"){l=t.spread||!1;const r=t.children;let i=-1;for(;!l&&++i<r.length;)l=vy(r[i])}return l}function vy(t){const l=t.spread;return l??t.children.length>1}function i3(t,l){const r={},i=t.all(l);let c=-1;for(typeof l.start=="number"&&l.start!==1&&(r.start=l.start);++c<i.length;){const f=i[c];if(f.type==="element"&&f.tagName==="li"&&f.properties&&Array.isArray(f.properties.className)&&f.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const u={type:"element",tagName:l.ordered?"ol":"ul",properties:r,children:t.wrap(i,!0)};return t.patch(l,u),t.applyData(l,u)}function s3(t,l){const r={type:"element",tagName:"p",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function o3(t,l){const r={type:"root",children:t.wrap(t.all(l))};return t.patch(l,r),t.applyData(l,r)}function c3(t,l){const r={type:"element",tagName:"strong",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function u3(t,l){const r=t.all(l),i=r.shift(),c=[];if(i){const f={type:"element",tagName:"thead",properties:{},children:t.wrap([i],!0)};t.patch(l.children[0],f),c.push(f)}if(r.length>0){const f={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},m=rh(l.children[1]),p=P0(l.children[l.children.length-1]);m&&p&&(f.position={start:m,end:p}),c.push(f)}const u={type:"element",tagName:"table",properties:{},children:t.wrap(c,!0)};return t.patch(l,u),t.applyData(l,u)}function f3(t,l,r){const i=r?r.children:void 0,u=(i?i.indexOf(l):1)===0?"th":"td",f=r&&r.type==="table"?r.align:void 0,m=f?f.length:l.children.length;let p=-1;const d=[];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)),d.push(j)}const g={type:"element",tagName:"tr",properties:{},children:t.wrap(d,!0)};return t.patch(l,g),t.applyData(l,g)}function d3(t,l){const r={type:"element",tagName:"td",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}const O1=9,B1=32;function h3(t){const l=String(t),r=/\r?\n|\r/g;let i=r.exec(l),c=0;const u=[];for(;i;)u.push(L1(l.slice(c,i.index),c>0,!0),i[0]),c=i.index+i[0].length,i=r.exec(l);return u.push(L1(l.slice(c),c>0,!1)),u.join("")}function L1(t,l,r){let i=0,c=t.length;if(l){let u=t.codePointAt(i);for(;u===O1||u===B1;)i++,u=t.codePointAt(i)}if(r){let u=t.codePointAt(c-1);for(;u===O1||u===B1;)c--,u=t.codePointAt(c-1)}return c>i?t.slice(i,c):""}function m3(t,l){const r={type:"text",value:h3(String(l.value))};return t.patch(l,r),t.applyData(l,r)}function x3(t,l){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(l,r),t.applyData(l,r)}const p3={blockquote:X5,break:V5,code:G5,delete:K5,emphasis:Q5,footnoteReference:W5,heading:Z5,html:J5,imageReference:P5,image:e3,inlineCode:t3,linkReference:n3,link:l3,listItem:r3,list:i3,paragraph:s3,root:o3,strong:c3,table:u3,tableCell:d3,tableRow:f3,text:m3,thematicBreak:x3,toml:lc,yaml:lc,definition:lc,footnoteDefinition:lc};function lc(){}const wy=-1,Lc=0,As=1,Ec=2,fh=3,dh=4,hh=5,mh=6,ky=7,Sy=8,$1=typeof self=="object"?self:globalThis,y3=(t,l)=>{const r=(c,u)=>(t.set(u,c),c),i=c=>{if(t.has(c))return t.get(c);const[u,f]=l[c];switch(u){case Lc:case wy:return r(f,c);case As:{const m=r([],c);for(const p of f)m.push(i(p));return m}case Ec:{const m=r({},c);for(const[p,d]of f)m[i(p)]=i(d);return m}case fh:return r(new Date(f),c);case dh:{const{source:m,flags:p}=f;return r(new RegExp(m,p),c)}case hh:{const m=r(new Map,c);for(const[p,d]of f)m.set(i(p),i(d));return m}case mh:{const m=r(new Set,c);for(const p of f)m.add(i(p));return m}case ky:{const{name:m,message:p}=f;return r(new $1[m](p),c)}case Sy:return r(BigInt(f),c);case"BigInt":return r(Object(BigInt(f)),c);case"ArrayBuffer":return r(new Uint8Array(f).buffer,f);case"DataView":{const{buffer:m}=new Uint8Array(f);return r(new DataView(m),f)}}return r(new $1[u](f),c)};return i},H1=t=>y3(new Map,t)(0),ri="",{toString:g3}={},{keys:b3}=Object,ps=t=>{const l=typeof t;if(l!=="object"||!t)return[Lc,l];const r=g3.call(t).slice(8,-1);switch(r){case"Array":return[As,ri];case"Object":return[Ec,ri];case"Date":return[fh,ri];case"RegExp":return[dh,ri];case"Map":return[hh,ri];case"Set":return[mh,ri];case"DataView":return[As,r]}return r.includes("Array")?[As,r]:r.includes("Error")?[ky,r]:[Ec,r]},rc=([t,l])=>t===Lc&&(l==="function"||l==="symbol"),v3=(t,l,r,i)=>{const c=(f,m)=>{const p=i.push(f)-1;return r.set(m,p),p},u=f=>{if(r.has(f))return r.get(f);let[m,p]=ps(f);switch(m){case Lc:{let g=f;switch(p){case"bigint":m=Sy,g=f.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+p);g=null;break;case"undefined":return c([wy],f)}return c([m,g],f)}case As:{if(p){let b=f;return p==="DataView"?b=new Uint8Array(f.buffer):p==="ArrayBuffer"&&(b=new Uint8Array(f)),c([p,[...b]],f)}const g=[],y=c([m,g],f);for(const b of f)g.push(u(b));return y}case Ec:{if(p)switch(p){case"BigInt":return c([p,f.toString()],f);case"Boolean":case"Number":case"String":return c([p,f.valueOf()],f)}if(l&&"toJSON"in f)return u(f.toJSON());const g=[],y=c([m,g],f);for(const b of b3(f))(t||!rc(ps(f[b])))&&g.push([u(b),u(f[b])]);return y}case fh:return c([m,f.toISOString()],f);case dh:{const{source:g,flags:y}=f;return c([m,{source:g,flags:y}],f)}case hh:{const g=[],y=c([m,g],f);for(const[b,v]of f)(t||!(rc(ps(b))||rc(ps(v))))&&g.push([u(b),u(v)]);return y}case mh:{const g=[],y=c([m,g],f);for(const b of f)(t||!rc(ps(b)))&&g.push(u(b));return y}}const{message:d}=f;return c([m,{name:p,message:d}],f)};return u},U1=(t,{json:l,lossy:r}={})=>{const i=[];return v3(!(l||r),!!l,new Map,i)(t),i},Nc=typeof structuredClone=="function"?(t,l)=>l&&("json"in l||"lossy"in l)?H1(U1(t,l)):structuredClone(t):(t,l)=>H1(U1(t,l));function w3(t,l){const r=[{type:"text",value:"↩"}];return l>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(l)}]}),r}function k3(t,l){return"Back to reference "+(t+1)+(l>1?"-"+l:"")}function S3(t){const l=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||w3,i=t.options.footnoteBackLabel||k3,c=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 d=t.footnoteById.get(t.footnoteOrder[p]);if(!d)continue;const g=t.all(d),y=String(d.identifier).toUpperCase(),b=di(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 A=typeof r=="string"?r:r(p,v);typeof A=="string"&&(A={type:"text",value:A}),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(A)?A:[A]})}const C=g[g.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const A=C.children[C.children.length-1];A&&A.type==="text"?A.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(d,E),m.push(E)}if(m.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Nc(f),id:"footnote-label"},children:[{type:"text",value:c}]},{type:"text",value:`
53
+ `;break}case-2:{f=l?" ":" ";break}case-1:{if(!l&&c)continue;f=" ";break}default:f=String.fromCharCode(u)}c=u===-2,i.push(f)}return i.join("")}function O5(t){const i={constructs:sy([M5,...(t||{}).extensions||[]]),content:c(Zv),defined:[],document:c(Pv),flow:c(y5),lazy:{},string:c(v5),text:c(w5)};return i;function c(u){return f;function f(m){return R5(i,u,m)}}}function B5(t){for(;!dy(t););return t}const F1=/[\0\t\n\r]/g;function L5(){let t=1,l="",r=!0,i;return c;function c(u,f,m){const x=[];let d,g,y,b,v;for(u=l+(typeof u=="string"?u.toString():new TextDecoder(f||void 0).decode(u)),y=0,l="",r&&(u.charCodeAt(0)===65279&&y++,r=void 0);y<u.length;){if(F1.lastIndex=y,d=F1.exec(u),b=d&&d.index!==void 0?d.index:u.length,v=u.charCodeAt(b),!d){l=u.slice(y);break}if(v===10&&y===b&&i)x.push(-3),i=void 0;else switch(i&&(x.push(-5),i=void 0),y<b&&(x.push(u.slice(y,b)),t+=b-y),v){case 0:{x.push(65533),t++;break}case 9:{for(g=Math.ceil(t/4)*4,x.push(-2);t++<g;)x.push(-1);break}case 10:{x.push(-4),t=1;break}default:i=!0,t=1}y=b+1}return m&&(i&&x.push(-5),l&&x.push(l),x.push(null)),x}}const $5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function H5(t){return t.replace($5,U5)}function U5(t,l,r){if(l)return l;if(r.charCodeAt(0)===35){const c=r.charCodeAt(1),u=c===120||c===88;return oy(r.slice(u?2:1),u?16:10)}return ch(r)||t}const gy={}.hasOwnProperty;function I5(t,l,r){return l&&typeof l=="object"&&(r=l,l=void 0),Y5(r)(B5(O5(r).document().write(L5()(t,l,!0))))}function Y5(t){const l={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Me),autolinkProtocol:ee,autolinkEmail:ee,atxHeading:u(ve),blockQuote:u(ke),characterEscape:ee,characterReference:ee,codeFenced:u(yt),codeFencedFenceInfo:f,codeFencedFenceMeta:f,codeIndented:u(yt,f),codeText:u(de,f),codeTextData:ee,data:ee,codeFlowValue:ee,definition:u(G),definitionDestinationString:f,definitionLabelString:f,definitionTitleString:f,emphasis:u(re),hardBreakEscape:u(ze),hardBreakTrailing:u(ze),htmlFlow:u(Ne,f),htmlFlowData:ee,htmlText:u(Ne,f),htmlTextData:ee,image:u(Te),label:f,link:u(Me),listItem:u(tt),listItemValue:b,listOrdered:u(Oe,y),listUnordered:u(Oe),paragraph:u(Lt),reference:T,referenceString:f,resourceDestinationString:f,resourceTitleString:f,setextHeading:u(ve),strong:u(gt),thematicBreak:u(Zt)},exit:{atxHeading:x(),atxHeadingSequence:L,autolink:x(),autolinkEmail:Ke,autolinkProtocol:He,blockQuote:x(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:Se,characterReferenceMarkerNumeric:Se,characterReferenceValue:Ee,characterReference:Be,codeFenced:x(C),codeFencedFence:S,codeFencedFenceInfo:v,codeFencedFenceMeta:j,codeFlowValue:z,codeIndented:x(E),codeText:x(V),codeTextData:z,data:z,definition:x(),definitionDestinationString:O,definitionLabelString:A,definitionTitleString:M,emphasis:x(),hardBreakEscape:x(R),hardBreakTrailing:x(R),htmlFlow:x(W),htmlFlowData:z,htmlText:x(te),htmlTextData:z,image:x(Z),label:we,labelText:ce,lineEnding:X,link:x(Y),listItem:x(),listOrdered:x(),listUnordered:x(),paragraph:x(),referenceString:me,resourceDestinationString:D,resourceTitleString:B,resource:Q,setextHeading:x($),setextHeadingLineSequence:I,setextHeadingText:F,strong:x(),thematicBreak:x()}};by(l,(t||{}).mdastExtensions||[]);const r={};return i;function i(ae){let xe={type:"root",children:[]};const De={stack:[xe],tokenStack:[],config:l,enter:m,exit:d,buffer:f,resume:g,data:r},Ue=[];let ye=-1;for(;++ye<ae.length;)if(ae[ye][1].type==="listOrdered"||ae[ye][1].type==="listUnordered")if(ae[ye][0]==="enter")Ue.push(ye);else{const je=Ue.pop();ye=c(ae,je,ye)}for(ye=-1;++ye<ae.length;){const je=l[ae[ye][0]];gy.call(je,ae[ye][1].type)&&je[ae[ye][1].type].call(Object.assign({sliceSerialize:ae[ye][2].sliceSerialize},De),ae[ye][1])}if(De.tokenStack.length>0){const je=De.tokenStack[De.tokenStack.length-1];(je[1]||_1).call(De,void 0,je[0])}for(xe.position={start:Fr(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:Fr(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},ye=-1;++ye<l.transforms.length;)xe=l.transforms[ye](xe)||xe;return xe}function c(ae,xe,De){let Ue=xe-1,ye=-1,je=!1,jt,wt,Xe,ft;for(;++Ue<=De;){const fe=ae[Ue];switch(fe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{fe[0]==="enter"?ye++:ye--,ft=void 0;break}case"lineEndingBlank":{fe[0]==="enter"&&(jt&&!ft&&!ye&&!Xe&&(Xe=Ue),ft=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ft=void 0}if(!ye&&fe[0]==="enter"&&fe[1].type==="listItemPrefix"||ye===-1&&fe[0]==="exit"&&(fe[1].type==="listUnordered"||fe[1].type==="listOrdered")){if(jt){let Mt=Ue;for(wt=void 0;Mt--;){const it=ae[Mt];if(it[1].type==="lineEnding"||it[1].type==="lineEndingBlank"){if(it[0]==="exit")continue;wt&&(ae[wt][1].type="lineEndingBlank",je=!0),it[1].type="lineEnding",wt=Mt}else if(!(it[1].type==="linePrefix"||it[1].type==="blockQuotePrefix"||it[1].type==="blockQuotePrefixWhitespace"||it[1].type==="blockQuoteMarker"||it[1].type==="listItemIndent"))break}Xe&&(!wt||Xe<wt)&&(jt._spread=!0),jt.end=Object.assign({},wt?ae[wt][1].start:fe[1].end),ae.splice(wt||Ue,0,["exit",jt,fe[2]]),Ue++,De++}if(fe[1].type==="listItemPrefix"){const Mt={type:"listItem",_spread:!1,start:Object.assign({},fe[1].start),end:void 0};jt=Mt,ae.splice(Ue,0,["enter",Mt,fe[2]]),Ue++,De++,Xe=void 0,ft=!0}}}return ae[xe][1]._spread=je,De}function u(ae,xe){return De;function De(Ue){m.call(this,ae(Ue),Ue),xe&&xe.call(this,Ue)}}function f(){this.stack.push({type:"fragment",children:[]})}function m(ae,xe,De){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([xe,De||void 0]),ae.position={start:Fr(xe.start),end:void 0}}function x(ae){return xe;function xe(De){ae&&ae.call(this,De),d.call(this,De)}}function d(ae,xe){const De=this.stack.pop(),Ue=this.tokenStack.pop();if(Ue)Ue[0].type!==ae.type&&(xe?xe.call(this,ae,Ue[0]):(Ue[1]||_1).call(this,ae,Ue[0]));else throw new Error("Cannot close `"+ae.type+"` ("+Es({start:ae.start,end:ae.end})+"): it’s not open");De.position.end=Fr(ae.end)}function g(){return oh(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function b(ae){if(this.data.expectingFirstListItemValue){const xe=this.stack[this.stack.length-2];xe.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function v(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.lang=ae}function j(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.meta=ae}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ae.replace(/(\r?\n|\r)$/g,"")}function A(ae){const xe=this.resume(),De=this.stack[this.stack.length-1];De.label=xe,De.identifier=hl(this.sliceSerialize(ae)).toLowerCase()}function M(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.title=ae}function O(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.url=ae}function L(ae){const xe=this.stack[this.stack.length-1];if(!xe.depth){const De=this.sliceSerialize(ae).length;xe.depth=De}}function F(){this.data.setextHeadingSlurpLineEnding=!0}function I(ae){const xe=this.stack[this.stack.length-1];xe.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function ee(ae){const De=this.stack[this.stack.length-1].children;let Ue=De[De.length-1];(!Ue||Ue.type!=="text")&&(Ue=ht(),Ue.position={start:Fr(ae.start),end:void 0},De.push(Ue)),this.stack.push(Ue)}function z(ae){const xe=this.stack.pop();xe.value+=this.sliceSerialize(ae),xe.position.end=Fr(ae.end)}function X(ae){const xe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const De=xe.children[xe.children.length-1];De.position.end=Fr(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&l.canContainEols.includes(xe.type)&&(ee.call(this,ae),z.call(this,ae))}function R(){this.data.atHardBreak=!0}function W(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ae}function te(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ae}function V(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ae}function Y(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=xe,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function Z(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=xe,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function ce(ae){const xe=this.sliceSerialize(ae),De=this.stack[this.stack.length-2];De.label=H5(xe),De.identifier=hl(xe).toLowerCase()}function we(){const ae=this.stack[this.stack.length-1],xe=this.resume(),De=this.stack[this.stack.length-1];if(this.data.inReference=!0,De.type==="link"){const Ue=ae.children;De.children=Ue}else De.alt=xe}function D(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.url=ae}function B(){const ae=this.resume(),xe=this.stack[this.stack.length-1];xe.title=ae}function Q(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function me(ae){const xe=this.resume(),De=this.stack[this.stack.length-1];De.label=xe,De.identifier=hl(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function Se(ae){this.data.characterReferenceType=ae.type}function Ee(ae){const xe=this.sliceSerialize(ae),De=this.data.characterReferenceType;let Ue;De?(Ue=oy(xe,De==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ue=ch(xe);const ye=this.stack[this.stack.length-1];ye.value+=Ue}function Be(ae){const xe=this.stack.pop();xe.position.end=Fr(ae.end)}function He(ae){z.call(this,ae);const xe=this.stack[this.stack.length-1];xe.url=this.sliceSerialize(ae)}function Ke(ae){z.call(this,ae);const xe=this.stack[this.stack.length-1];xe.url="mailto:"+this.sliceSerialize(ae)}function ke(){return{type:"blockquote",children:[]}}function yt(){return{type:"code",lang:null,meta:null,value:""}}function de(){return{type:"inlineCode",value:""}}function G(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function re(){return{type:"emphasis",children:[]}}function ve(){return{type:"heading",depth:0,children:[]}}function ze(){return{type:"break"}}function Ne(){return{type:"html",value:""}}function Te(){return{type:"image",title:null,url:"",alt:null}}function Me(){return{type:"link",title:null,url:"",children:[]}}function Oe(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function tt(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function Lt(){return{type:"paragraph",children:[]}}function gt(){return{type:"strong",children:[]}}function ht(){return{type:"text",value:""}}function Zt(){return{type:"thematicBreak"}}}function Fr(t){return{line:t.line,column:t.column,offset:t.offset}}function by(t,l){let r=-1;for(;++r<l.length;){const i=l[r];Array.isArray(i)?by(t,i):q5(t,i)}}function q5(t,l){let r;for(r in l)if(gy.call(l,r))switch(r){case"canContainEols":{const i=l[r];i&&t[r].push(...i);break}case"transforms":{const i=l[r];i&&t[r].push(...i);break}case"enter":case"exit":{const i=l[r];i&&Object.assign(t[r],i);break}}}function _1(t,l){throw t?new Error("Cannot close `"+t.type+"` ("+Es({start:t.start,end:t.end})+"): a different token (`"+l.type+"`, "+Es({start:l.start,end:l.end})+") is open"):new Error("Cannot close document, a token (`"+l.type+"`, "+Es({start:l.start,end:l.end})+") is still open")}function X5(t){const l=this;l.parser=r;function r(i){return I5(i,{...l.data("settings"),...t,extensions:l.data("micromarkExtensions")||[],mdastExtensions:l.data("fromMarkdownExtensions")||[]})}}function V5(t,l){const r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(l),!0)};return t.patch(l,r),t.applyData(l,r)}function G5(t,l){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(l,r),[t.applyData(l,r),{type:"text",value:`
54
+ `}]}function K5(t,l){const r=l.value?l.value+`
55
+ `:"",i={},c=l.lang?l.lang.split(/\s+/):[];c.length>0&&(i.className=["language-"+c[0]]);let u={type:"element",tagName:"code",properties:i,children:[{type:"text",value:r}]};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 Q5(t,l){const r={type:"element",tagName:"del",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function W5(t,l){const r={type:"element",tagName:"em",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function Z5(t,l){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",i=String(l.identifier).toUpperCase(),c=di(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 x={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+c,id:r+"fnref-"+c+(m>1?"-"+m:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(f)}]};t.patch(l,x);const d={type:"element",tagName:"sup",properties:{},children:[x]};return t.patch(l,d),t.applyData(l,d)}function J5(t,l){const r={type:"element",tagName:"h"+l.depth,properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function P5(t,l){if(t.options.allowDangerousHtml){const r={type:"raw",value:l.value};return t.patch(l,r),t.applyData(l,r)}}function vy(t,l){const r=l.referenceType;let i="]";if(r==="collapsed"?i+="[]":r==="full"&&(i+="["+(l.label||l.identifier)+"]"),l.type==="imageReference")return[{type:"text",value:"!["+l.alt+i}];const c=t.all(l),u=c[0];u&&u.type==="text"?u.value="["+u.value:c.unshift({type:"text",value:"["});const f=c[c.length-1];return f&&f.type==="text"?f.value+=i:c.push({type:"text",value:i}),c}function e3(t,l){const r=String(l.identifier).toUpperCase(),i=t.definitionById.get(r);if(!i)return vy(t,l);const c={src:di(i.url||""),alt:l.alt};i.title!==null&&i.title!==void 0&&(c.title=i.title);const u={type:"element",tagName:"img",properties:c,children:[]};return t.patch(l,u),t.applyData(l,u)}function t3(t,l){const r={src:di(l.url)};l.alt!==null&&l.alt!==void 0&&(r.alt=l.alt),l.title!==null&&l.title!==void 0&&(r.title=l.title);const i={type:"element",tagName:"img",properties:r,children:[]};return t.patch(l,i),t.applyData(l,i)}function n3(t,l){const r={type:"text",value:l.value.replace(/\r?\n|\r/g," ")};t.patch(l,r);const i={type:"element",tagName:"code",properties:{},children:[r]};return t.patch(l,i),t.applyData(l,i)}function l3(t,l){const r=String(l.identifier).toUpperCase(),i=t.definitionById.get(r);if(!i)return vy(t,l);const c={href:di(i.url||"")};i.title!==null&&i.title!==void 0&&(c.title=i.title);const u={type:"element",tagName:"a",properties:c,children:t.all(l)};return t.patch(l,u),t.applyData(l,u)}function r3(t,l){const r={href:di(l.url)};l.title!==null&&l.title!==void 0&&(r.title=l.title);const i={type:"element",tagName:"a",properties:r,children:t.all(l)};return t.patch(l,i),t.applyData(l,i)}function a3(t,l,r){const i=t.all(l),c=r?i3(r):wy(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];(c||m!==0||g.type!=="element"||g.tagName!=="p")&&f.push({type:"text",value:`
56
+ `}),g.type==="element"&&g.tagName==="p"&&!c?f.push(...g.children):f.push(g)}const x=i[i.length-1];x&&(c||x.type!=="element"||x.tagName!=="p")&&f.push({type:"text",value:`
57
+ `});const d={type:"element",tagName:"li",properties:u,children:f};return t.patch(l,d),t.applyData(l,d)}function i3(t){let l=!1;if(t.type==="list"){l=t.spread||!1;const r=t.children;let i=-1;for(;!l&&++i<r.length;)l=wy(r[i])}return l}function wy(t){const l=t.spread;return l??t.children.length>1}function s3(t,l){const r={},i=t.all(l);let c=-1;for(typeof l.start=="number"&&l.start!==1&&(r.start=l.start);++c<i.length;){const f=i[c];if(f.type==="element"&&f.tagName==="li"&&f.properties&&Array.isArray(f.properties.className)&&f.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const u={type:"element",tagName:l.ordered?"ol":"ul",properties:r,children:t.wrap(i,!0)};return t.patch(l,u),t.applyData(l,u)}function o3(t,l){const r={type:"element",tagName:"p",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function c3(t,l){const r={type:"root",children:t.wrap(t.all(l))};return t.patch(l,r),t.applyData(l,r)}function u3(t,l){const r={type:"element",tagName:"strong",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function f3(t,l){const r=t.all(l),i=r.shift(),c=[];if(i){const f={type:"element",tagName:"thead",properties:{},children:t.wrap([i],!0)};t.patch(l.children[0],f),c.push(f)}if(r.length>0){const f={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},m=rh(l.children[1]),x=ey(l.children[l.children.length-1]);m&&x&&(f.position={start:m,end:x}),c.push(f)}const u={type:"element",tagName:"table",properties:{},children:t.wrap(c,!0)};return t.patch(l,u),t.applyData(l,u)}function d3(t,l,r){const i=r?r.children:void 0,u=(i?i.indexOf(l):1)===0?"th":"td",f=r&&r.type==="table"?r.align:void 0,m=f?f.length:l.children.length;let x=-1;const d=[];for(;++x<m;){const y=l.children[x],b={},v=f?f[x]: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)),d.push(j)}const g={type:"element",tagName:"tr",properties:{},children:t.wrap(d,!0)};return t.patch(l,g),t.applyData(l,g)}function h3(t,l){const r={type:"element",tagName:"td",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}const O1=9,B1=32;function m3(t){const l=String(t),r=/\r?\n|\r/g;let i=r.exec(l),c=0;const u=[];for(;i;)u.push(L1(l.slice(c,i.index),c>0,!0),i[0]),c=i.index+i[0].length,i=r.exec(l);return u.push(L1(l.slice(c),c>0,!1)),u.join("")}function L1(t,l,r){let i=0,c=t.length;if(l){let u=t.codePointAt(i);for(;u===O1||u===B1;)i++,u=t.codePointAt(i)}if(r){let u=t.codePointAt(c-1);for(;u===O1||u===B1;)c--,u=t.codePointAt(c-1)}return c>i?t.slice(i,c):""}function x3(t,l){const r={type:"text",value:m3(String(l.value))};return t.patch(l,r),t.applyData(l,r)}function p3(t,l){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(l,r),t.applyData(l,r)}const y3={blockquote:V5,break:G5,code:K5,delete:Q5,emphasis:W5,footnoteReference:Z5,heading:J5,html:P5,imageReference:e3,image:t3,inlineCode:n3,linkReference:l3,link:r3,listItem:a3,list:s3,paragraph:o3,root:c3,strong:u3,table:f3,tableCell:h3,tableRow:d3,text:x3,thematicBreak:p3,toml:lc,yaml:lc,definition:lc,footnoteDefinition:lc};function lc(){}const ky=-1,Lc=0,As=1,Ec=2,fh=3,dh=4,hh=5,mh=6,Sy=7,jy=8,$1=typeof self=="object"?self:globalThis,g3=(t,l)=>{const r=(c,u)=>(t.set(u,c),c),i=c=>{if(t.has(c))return t.get(c);const[u,f]=l[c];switch(u){case Lc:case ky:return r(f,c);case As:{const m=r([],c);for(const x of f)m.push(i(x));return m}case Ec:{const m=r({},c);for(const[x,d]of f)m[i(x)]=i(d);return m}case fh:return r(new Date(f),c);case dh:{const{source:m,flags:x}=f;return r(new RegExp(m,x),c)}case hh:{const m=r(new Map,c);for(const[x,d]of f)m.set(i(x),i(d));return m}case mh:{const m=r(new Set,c);for(const x of f)m.add(i(x));return m}case Sy:{const{name:m,message:x}=f;return r(new $1[m](x),c)}case jy:return r(BigInt(f),c);case"BigInt":return r(Object(BigInt(f)),c);case"ArrayBuffer":return r(new Uint8Array(f).buffer,f);case"DataView":{const{buffer:m}=new Uint8Array(f);return r(new DataView(m),f)}}return r(new $1[u](f),c)};return i},H1=t=>g3(new Map,t)(0),ri="",{toString:b3}={},{keys:v3}=Object,ps=t=>{const l=typeof t;if(l!=="object"||!t)return[Lc,l];const r=b3.call(t).slice(8,-1);switch(r){case"Array":return[As,ri];case"Object":return[Ec,ri];case"Date":return[fh,ri];case"RegExp":return[dh,ri];case"Map":return[hh,ri];case"Set":return[mh,ri];case"DataView":return[As,r]}return r.includes("Array")?[As,r]:r.includes("Error")?[Sy,r]:[Ec,r]},rc=([t,l])=>t===Lc&&(l==="function"||l==="symbol"),w3=(t,l,r,i)=>{const c=(f,m)=>{const x=i.push(f)-1;return r.set(m,x),x},u=f=>{if(r.has(f))return r.get(f);let[m,x]=ps(f);switch(m){case Lc:{let g=f;switch(x){case"bigint":m=jy,g=f.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+x);g=null;break;case"undefined":return c([ky],f)}return c([m,g],f)}case As:{if(x){let b=f;return x==="DataView"?b=new Uint8Array(f.buffer):x==="ArrayBuffer"&&(b=new Uint8Array(f)),c([x,[...b]],f)}const g=[],y=c([m,g],f);for(const b of f)g.push(u(b));return y}case Ec:{if(x)switch(x){case"BigInt":return c([x,f.toString()],f);case"Boolean":case"Number":case"String":return c([x,f.valueOf()],f)}if(l&&"toJSON"in f)return u(f.toJSON());const g=[],y=c([m,g],f);for(const b of v3(f))(t||!rc(ps(f[b])))&&g.push([u(b),u(f[b])]);return y}case fh:return c([m,f.toISOString()],f);case dh:{const{source:g,flags:y}=f;return c([m,{source:g,flags:y}],f)}case hh:{const g=[],y=c([m,g],f);for(const[b,v]of f)(t||!(rc(ps(b))||rc(ps(v))))&&g.push([u(b),u(v)]);return y}case mh:{const g=[],y=c([m,g],f);for(const b of f)(t||!rc(ps(b)))&&g.push(u(b));return y}}const{message:d}=f;return c([m,{name:x,message:d}],f)};return u},U1=(t,{json:l,lossy:r}={})=>{const i=[];return w3(!(l||r),!!l,new Map,i)(t),i},Nc=typeof structuredClone=="function"?(t,l)=>l&&("json"in l||"lossy"in l)?H1(U1(t,l)):structuredClone(t):(t,l)=>H1(U1(t,l));function k3(t,l){const r=[{type:"text",value:"↩"}];return l>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(l)}]}),r}function S3(t,l){return"Back to reference "+(t+1)+(l>1?"-"+l:"")}function j3(t){const l=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||k3,i=t.options.footnoteBackLabel||S3,c=t.options.footnoteLabel||"Footnotes",u=t.options.footnoteLabelTagName||"h2",f=t.options.footnoteLabelProperties||{className:["sr-only"]},m=[];let x=-1;for(;++x<t.footnoteOrder.length;){const d=t.footnoteById.get(t.footnoteOrder[x]);if(!d)continue;const g=t.all(d),y=String(d.identifier).toUpperCase(),b=di(y.toLowerCase());let v=0;const j=[],S=t.footnoteCounts.get(y);for(;S!==void 0&&++v<=S;){j.length>0&&j.push({type:"text",value:" "});let A=typeof r=="string"?r:r(x,v);typeof A=="string"&&(A={type:"text",value:A}),j.push({type:"element",tagName:"a",properties:{href:"#"+l+"fnref-"+b+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(x,v),className:["data-footnote-backref"]},children:Array.isArray(A)?A:[A]})}const C=g[g.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const A=C.children[C.children.length-1];A&&A.type==="text"?A.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(d,E),m.push(E)}if(m.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Nc(f),id:"footnote-label"},children:[{type:"text",value:c}]},{type:"text",value:`
58
58
  `},{type:"element",tagName:"ol",properties:{},children:t.wrap(m,!0)},{type:"text",value:`
59
- `}]}}const $c=(function(t){if(t==null)return N3;if(typeof t=="function")return Hc(t);if(typeof t=="object")return Array.isArray(t)?j3(t):C3(t);if(typeof t=="string")return E3(t);throw new Error("Expected function, string, or object as test")});function j3(t){const l=[];let r=-1;for(;++r<t.length;)l[r]=$c(t[r]);return Hc(i);function i(...c){let u=-1;for(;++u<l.length;)if(l[u].apply(this,c))return!0;return!1}}function C3(t){const l=t;return Hc(r);function r(i){const c=i;let u;for(u in t)if(c[u]!==l[u])return!1;return!0}}function E3(t){return Hc(l);function l(r){return r&&r.type===t}}function Hc(t){return l;function l(r,i,c){return!!(A3(r)&&t.call(this,r,typeof i=="number"?i:void 0,c||void 0))}}function N3(){return!0}function A3(t){return t!==null&&typeof t=="object"&&"type"in t}const jy=[],T3=!0,Yd=!1,D3="skip";function Cy(t,l,r,i){let c;typeof l=="function"&&typeof r!="function"?(i=r,r=l):c=l;const u=$c(c),f=i?-1:1;m(t,void 0,[])();function m(p,d,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=jy,j,k,C;if((!l||u(p,d,g[g.length-1]||void 0))&&(v=z3(r(p,g)),v[0]===Yd))return v;if("children"in p&&p.children){const E=p;if(E.children&&v[0]!==D3)for(k=(i?E.children.length:-1)+f,C=g.concat(E);k>-1&&k<E.children.length;){const A=E.children[k];if(j=m(A,k,C)(),j[0]===Yd)return j;k=typeof j[1]=="number"?j[1]:k+f}}return v}}}function z3(t){return Array.isArray(t)?t:typeof t=="number"?[T3,t]:t==null?jy:[t]}function xh(t,l,r,i){let c,u,f;typeof l=="function"&&typeof r!="function"?(u=void 0,f=l,c=r):(u=l,f=r,c=i),Cy(t,u,m,c);function m(p,d){const g=d[d.length-1],y=g?g.children.indexOf(p):void 0;return f(p,y,g)}}const qd={}.hasOwnProperty,M3={};function R3(t,l){const r=l||M3,i=new Map,c=new Map,u=new Map,f={...p3,...r.handlers},m={all:d,applyData:_3,definitionById:i,footnoteById:c,footnoteCounts:u,footnoteOrder:[],handlers:f,one:p,options:r,patch:F3,wrap:B3};return xh(t,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const y=g.type==="definition"?i:c,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(qd.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=Nc(C);return E.children=m.all(g),E}return Nc(g)}return(m.options.unknownHandler||O3)(m,g,y)}function d(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=I1(j.value)),!Array.isArray(j)&&j.type==="element")){const k=j.children[0];k&&k.type==="text"&&(k.value=I1(k.value))}Array.isArray(j)?y.push(...j):y.push(j)}}}return y}}function F3(t,l){t.position&&(l.position=kv(t))}function _3(t,l){let r=l;if(t&&t.data){const i=t.data.hName,c=t.data.hChildren,u=t.data.hProperties;if(typeof i=="string")if(r.type==="element")r.tagName=i;else{const f="children"in r?r.children:[r];r={type:"element",tagName:i,properties:{},children:f}}r.type==="element"&&u&&Object.assign(r.properties,Nc(u)),"children"in r&&r.children&&c!==null&&c!==void 0&&(r.children=c)}return r}function O3(t,l){const r=l.data||{},i="value"in l&&!(qd.call(r,"hProperties")||qd.call(r,"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 B3(t,l){const r=[];let i=-1;for(l&&r.push({type:"text",value:`
59
+ `}]}}const $c=(function(t){if(t==null)return A3;if(typeof t=="function")return Hc(t);if(typeof t=="object")return Array.isArray(t)?C3(t):E3(t);if(typeof t=="string")return N3(t);throw new Error("Expected function, string, or object as test")});function C3(t){const l=[];let r=-1;for(;++r<t.length;)l[r]=$c(t[r]);return Hc(i);function i(...c){let u=-1;for(;++u<l.length;)if(l[u].apply(this,c))return!0;return!1}}function E3(t){const l=t;return Hc(r);function r(i){const c=i;let u;for(u in t)if(c[u]!==l[u])return!1;return!0}}function N3(t){return Hc(l);function l(r){return r&&r.type===t}}function Hc(t){return l;function l(r,i,c){return!!(T3(r)&&t.call(this,r,typeof i=="number"?i:void 0,c||void 0))}}function A3(){return!0}function T3(t){return t!==null&&typeof t=="object"&&"type"in t}const Cy=[],D3=!0,Yd=!1,z3="skip";function Ey(t,l,r,i){let c;typeof l=="function"&&typeof r!="function"?(i=r,r=l):c=l;const u=$c(c),f=i?-1:1;m(t,void 0,[])();function m(x,d,g){const y=x&&typeof x=="object"?x:{};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 ("+(x.type+(v?"<"+v+">":""))+")"})}return b;function b(){let v=Cy,j,S,C;if((!l||u(x,d,g[g.length-1]||void 0))&&(v=M3(r(x,g)),v[0]===Yd))return v;if("children"in x&&x.children){const E=x;if(E.children&&v[0]!==z3)for(S=(i?E.children.length:-1)+f,C=g.concat(E);S>-1&&S<E.children.length;){const A=E.children[S];if(j=m(A,S,C)(),j[0]===Yd)return j;S=typeof j[1]=="number"?j[1]:S+f}}return v}}}function M3(t){return Array.isArray(t)?t:typeof t=="number"?[D3,t]:t==null?Cy:[t]}function xh(t,l,r,i){let c,u,f;typeof l=="function"&&typeof r!="function"?(u=void 0,f=l,c=r):(u=l,f=r,c=i),Ey(t,u,m,c);function m(x,d){const g=d[d.length-1],y=g?g.children.indexOf(x):void 0;return f(x,y,g)}}const qd={}.hasOwnProperty,R3={};function F3(t,l){const r=l||R3,i=new Map,c=new Map,u=new Map,f={...y3,...r.handlers},m={all:d,applyData:O3,definitionById:i,footnoteById:c,footnoteCounts:u,footnoteOrder:[],handlers:f,one:x,options:r,patch:_3,wrap:L3};return xh(t,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const y=g.type==="definition"?i:c,b=String(g.identifier).toUpperCase();y.has(b)||y.set(b,g)}}),m;function x(g,y){const b=g.type,v=m.handlers[b];if(qd.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:S,...C}=g,E=Nc(C);return E.children=m.all(g),E}return Nc(g)}return(m.options.unknownHandler||B3)(m,g,y)}function d(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=I1(j.value)),!Array.isArray(j)&&j.type==="element")){const S=j.children[0];S&&S.type==="text"&&(S.value=I1(S.value))}Array.isArray(j)?y.push(...j):y.push(j)}}}return y}}function _3(t,l){t.position&&(l.position=Sv(t))}function O3(t,l){let r=l;if(t&&t.data){const i=t.data.hName,c=t.data.hChildren,u=t.data.hProperties;if(typeof i=="string")if(r.type==="element")r.tagName=i;else{const f="children"in r?r.children:[r];r={type:"element",tagName:i,properties:{},children:f}}r.type==="element"&&u&&Object.assign(r.properties,Nc(u)),"children"in r&&r.children&&c!==null&&c!==void 0&&(r.children=c)}return r}function B3(t,l){const r=l.data||{},i="value"in l&&!(qd.call(r,"hProperties")||qd.call(r,"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 L3(t,l){const r=[];let i=-1;for(l&&r.push({type:"text",value:`
60
60
  `});++i<t.length;)i&&r.push({type:"text",value:`
61
61
  `}),r.push(t[i]);return l&&t.length>0&&r.push({type:"text",value:`
62
- `}),r}function I1(t){let l=0,r=t.charCodeAt(l);for(;r===9||r===32;)l++,r=t.charCodeAt(l);return t.slice(l)}function Y1(t,l){const r=R3(t,l),i=r.one(t,void 0),c=S3(r),u=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return c&&u.children.push({type:"text",value:`
63
- `},c),u}function L3(t,l){return t&&"run"in t?async function(r,i){const c=Y1(r,{file:i,...l});await t.run(c,i)}:function(r,i){return Y1(r,{file:i,...t||l})}}function q1(t){if(t)throw t}var rd,X1;function $3(){if(X1)return rd;X1=1;var t=Object.prototype.hasOwnProperty,l=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,c=function(d){return typeof Array.isArray=="function"?Array.isArray(d):l.call(d)==="[object Array]"},u=function(d){if(!d||l.call(d)!=="[object Object]")return!1;var g=t.call(d,"constructor"),y=d.constructor&&d.constructor.prototype&&t.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!g&&!y)return!1;var b;for(b in d);return typeof b>"u"||t.call(d,b)},f=function(d,g){r&&g.name==="__proto__"?r(d,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):d[g.name]=g.newValue},m=function(d,g){if(g==="__proto__")if(t.call(d,g)){if(i)return i(d,g).value}else return;return d[g]};return rd=function p(){var d,g,y,b,v,j,k=arguments[0],C=1,E=arguments.length,A=!1;for(typeof k=="boolean"&&(A=k,k=arguments[1]||{},C=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});C<E;++C)if(d=arguments[C],d!=null)for(g in d)y=m(k,g),b=m(d,g),k!==b&&(A&&b&&(u(b)||(v=c(b)))?(v?(v=!1,j=y&&c(y)?y:[]):j=y&&u(y)?y:{},f(k,{name:g,newValue:p(A,j,b)})):typeof b<"u"&&f(k,{name:g,newValue:b}));return k},rd}var H3=$3();const ad=q0(H3);function Xd(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 U3(){const t=[],l={run:r,use:i};return l;function r(...c){let u=-1;const f=c.pop();if(typeof f!="function")throw new TypeError("Expected function as last argument, not "+f);m(null,...c);function m(p,...d){const g=t[++u];let y=-1;if(p){f(p);return}for(;++y<c.length;)(d[y]===null||d[y]===void 0)&&(d[y]=c[y]);c=d,g?I3(g,m)(...d):f(null,...d)}}function i(c){if(typeof c!="function")throw new TypeError("Expected `middelware` to be a function, not "+c);return t.push(c),l}}function I3(t,l){let r;return i;function i(...f){const m=t.length>f.length;let p;m&&f.push(c);try{p=t.apply(this,f)}catch(d){const g=d;if(m&&r)throw g;return c(g)}m||(p&&p.then&&typeof p.then=="function"?p.then(u,c):p instanceof Error?c(p):u(p))}function c(f,...m){r||(r=!0,l(f,...m))}function u(f){c(null,f)}}const Sl={basename:Y3,dirname:q3,extname:X3,join:V3,sep:"/"};function Y3(t,l){if(l!==void 0&&typeof l!="string")throw new TypeError('"ext" argument must be a string');$s(t);let r=0,i=-1,c=t.length,u;if(l===void 0||l.length===0||l.length>t.length){for(;c--;)if(t.codePointAt(c)===47){if(u){r=c+1;break}}else i<0&&(u=!0,i=c+1);return i<0?"":t.slice(r,i)}if(l===t)return"";let f=-1,m=l.length-1;for(;c--;)if(t.codePointAt(c)===47){if(u){r=c+1;break}}else f<0&&(u=!0,f=c+1),m>-1&&(t.codePointAt(c)===l.codePointAt(m--)?m<0&&(i=c):(m=-1,i=f));return r===i?i=f:i<0&&(i=t.length),t.slice(r,i)}function q3(t){if($s(t),t.length===0)return".";let l=-1,r=t.length,i;for(;--r;)if(t.codePointAt(r)===47){if(i){l=r;break}}else i||(i=!0);return l<0?t.codePointAt(0)===47?"/":".":l===1&&t.codePointAt(0)===47?"//":t.slice(0,l)}function X3(t){$s(t);let l=t.length,r=-1,i=0,c=-1,u=0,f;for(;l--;){const m=t.codePointAt(l);if(m===47){if(f){i=l+1;break}continue}r<0&&(f=!0,r=l+1),m===46?c<0?c=l:u!==1&&(u=1):c>-1&&(u=-1)}return c<0||r<0||u===0||u===1&&c===r-1&&c===i+1?"":t.slice(c,r)}function V3(...t){let l=-1,r;for(;++l<t.length;)$s(t[l]),t[l]&&(r=r===void 0?t[l]:r+"/"+t[l]);return r===void 0?".":G3(r)}function G3(t){$s(t);const l=t.codePointAt(0)===47;let r=K3(t,!l);return r.length===0&&!l&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),l?"/"+r:r}function K3(t,l){let r="",i=0,c=-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(!(c===f-1||u===1))if(c!==f-1&&u===2){if(r.length<2||i!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(p=r.lastIndexOf("/"),p!==r.length-1){p<0?(r="",i=0):(r=r.slice(0,p),i=r.length-1-r.lastIndexOf("/")),c=f,u=0;continue}}else if(r.length>0){r="",i=0,c=f,u=0;continue}}l&&(r=r.length>0?r+"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(c+1,f):r=t.slice(c+1,f),i=f-c-1;c=f,u=0}else m===46&&u>-1?u++:u=-1}return r}function $s(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Q3={cwd:W3};function W3(){return"/"}function Vd(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function Z3(t){if(typeof t=="string")t=new URL(t);else if(!Vd(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 J3(t)}function J3(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 r=-1;for(;++r<l.length;)if(l.codePointAt(r)===37&&l.codePointAt(r+1)===50){const i=l.codePointAt(r+2);if(i===70||i===102){const c=new TypeError("File URL path must not include encoded / characters");throw c.code="ERR_INVALID_FILE_URL_PATH",c}}return decodeURIComponent(l)}const id=["history","path","basename","stem","extname","dirname"];class Ey{constructor(l){let r;l?Vd(l)?r={path:l}:typeof l=="string"||P3(l)?r={value:l}:r=l:r={},this.cwd="cwd"in r?"":Q3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<id.length;){const u=id[i];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let c;for(c in r)id.includes(c)||(this[c]=r[c])}get basename(){return typeof this.path=="string"?Sl.basename(this.path):void 0}set basename(l){od(l,"basename"),sd(l,"basename"),this.path=Sl.join(this.dirname||"",l)}get dirname(){return typeof this.path=="string"?Sl.dirname(this.path):void 0}set dirname(l){V1(this.basename,"dirname"),this.path=Sl.join(l||"",this.basename)}get extname(){return typeof this.path=="string"?Sl.extname(this.path):void 0}set extname(l){if(sd(l,"extname"),V1(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=Sl.join(this.dirname,this.stem+(l||""))}get path(){return this.history[this.history.length-1]}set path(l){Vd(l)&&(l=Z3(l)),od(l,"path"),this.path!==l&&this.history.push(l)}get stem(){return typeof this.path=="string"?Sl.basename(this.path,this.extname):void 0}set stem(l){od(l,"stem"),sd(l,"stem"),this.path=Sl.join(this.dirname||"",l+(this.extname||""))}fail(l,r,i){const c=this.message(l,r,i);throw c.fatal=!0,c}info(l,r,i){const c=this.message(l,r,i);return c.fatal=void 0,c}message(l,r,i){const c=new gn(l,r,i);return this.path&&(c.name=this.path+":"+c.name,c.file=this.path),c.fatal=!1,this.messages.push(c),c}toString(l){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(l||void 0).decode(this.value)}}function sd(t,l){if(t&&t.includes(Sl.sep))throw new Error("`"+l+"` cannot be a path: did not expect `"+Sl.sep+"`")}function od(t,l){if(!t)throw new Error("`"+l+"` cannot be empty")}function V1(t,l){if(!t)throw new Error("Setting `"+l+"` requires `path` to be set too")}function P3(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const ek=(function(t){const i=this.constructor.prototype,c=i[t],u=function(){return c.apply(u,arguments)};return Object.setPrototypeOf(u,i),u}),tk={}.hasOwnProperty;class ph extends ek{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=U3()}copy(){const l=new ph;let r=-1;for(;++r<this.attachers.length;){const i=this.attachers[r];l.use(...i)}return l.data(ad(!0,{},this.namespace)),l}data(l,r){return typeof l=="string"?arguments.length===2?(fd("data",this.frozen),this.namespace[l]=r,this):tk.call(this.namespace,l)&&this.namespace[l]||void 0:l?(fd("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[r,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const c=r.call(l,...i);typeof c=="function"&&this.transformers.use(c)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(l){this.freeze();const r=ac(l),i=this.parser||this.Parser;return cd("parse",i),i(String(r),r)}process(l,r){const i=this;return this.freeze(),cd("process",this.parser||this.Parser),ud("process",this.compiler||this.Compiler),r?c(void 0,r):new Promise(c);function c(u,f){const m=ac(l),p=i.parse(m);i.run(p,m,function(g,y,b){if(g||!y||!b)return d(g);const v=y,j=i.stringify(v,b);rk(j)?b.value=j:b.result=j,d(g,b)});function d(g,y){g||!y?f(g):u?u(y):r(void 0,y)}}}processSync(l){let r=!1,i;return this.freeze(),cd("processSync",this.parser||this.Parser),ud("processSync",this.compiler||this.Compiler),this.process(l,c),K1("processSync","process",r),i;function c(u,f){r=!0,q1(u),i=f}}run(l,r,i){G1(l),this.freeze();const c=this.transformers;return!i&&typeof r=="function"&&(i=r,r=void 0),i?u(void 0,i):new Promise(u);function u(f,m){const p=ac(r);c.run(l,p,d);function d(g,y,b){const v=y||l;g?m(g):f?f(v):i(void 0,v,b)}}}runSync(l,r){let i=!1,c;return this.run(l,r,u),K1("runSync","run",i),c;function u(f,m){q1(f),c=m,i=!0}}stringify(l,r){this.freeze();const i=ac(r),c=this.compiler||this.Compiler;return ud("stringify",c),G1(l),c(l,i)}use(l,...r){const i=this.attachers,c=this.namespace;if(fd("use",this.frozen),l!=null)if(typeof l=="function")p(l,r);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(d){if(typeof d=="function")p(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[g,...y]=d;p(g,y)}else f(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function f(d){if(!("plugins"in d)&&!("settings"in d))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(d.plugins),d.settings&&(c.settings=ad(!0,c.settings,d.settings))}function m(d){let g=-1;if(d!=null)if(Array.isArray(d))for(;++g<d.length;){const y=d[g];u(y)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function p(d,g){let y=-1,b=-1;for(;++y<i.length;)if(i[y][0]===d){b=y;break}if(b===-1)i.push([d,...g]);else if(g.length>0){let[v,...j]=g;const k=i[b][1];Xd(k)&&Xd(v)&&(v=ad(!0,k,v)),i[b]=[d,v,...j]}}}}const nk=new ph().freeze();function cd(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function ud(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function fd(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 G1(t){if(!Xd(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function K1(t,l,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+l+"` instead")}function ac(t){return lk(t)?t:new Ey(t)}function lk(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function rk(t){return typeof t=="string"||ak(t)}function ak(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const ik="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Q1=[],W1={allowDangerousHtml:!0},sk=/^(https?|ircs?|mailto|xmpp)$/i,ok=[{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 Ny(t){const l=ck(t),r=uk(t);return fk(l.runSync(l.parse(r),r),t)}function ck(t){const l=t.rehypePlugins||Q1,r=t.remarkPlugins||Q1,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...W1}:W1;return nk().use(q5).use(r).use(L3,i).use(l)}function uk(t){const l=t.children||"",r=new Ey;return typeof l=="string"&&(r.value=l),r}function fk(t,l){const r=l.allowedElements,i=l.allowElement,c=l.components,u=l.disallowedElements,f=l.skipHtml,m=l.unwrapDisallowed,p=l.urlTransform||dk;for(const g of ok)Object.hasOwn(l,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+ik+g.id,void 0);return xh(t,d),Nv(t,{Fragment:o.Fragment,components:c,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function d(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 td)if(Object.hasOwn(td,v)&&Object.hasOwn(g.properties,v)){const j=g.properties[v],k=td[v];(k===null||k.includes(g.tagName))&&(g.properties[v]=p(String(j||""),v,g))}}if(g.type==="element"){let v=r?!r.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 dk(t){const l=t.indexOf(":"),r=t.indexOf("?"),i=t.indexOf("#"),c=t.indexOf("/");return l===-1||c!==-1&&l>c||r!==-1&&l>r||i!==-1&&l>i||sk.test(t.slice(0,l))?t:""}function Z1(t,l){const r=String(t);if(typeof l!="string")throw new TypeError("Expected character");let i=0,c=r.indexOf(l);for(;c!==-1;)i++,c=r.indexOf(l,c+l.length);return i}function hk(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function mk(t,l,r){const c=$c((r||{}).ignore||[]),u=xk(l);let f=-1;for(;++f<u.length;)Cy(t,"text",m);function m(d,g){let y=-1,b;for(;++y<g.length;){const v=g[y],j=b?b.children:void 0;if(c(v,j?j.indexOf(v):void 0,b))return;b=v}if(b)return p(d,g)}function p(d,g){const y=g[g.length-1],b=u[f][0],v=u[f][1];let j=0;const C=y.children.indexOf(d);let E=!1,A=[];b.lastIndex=0;let R=b.exec(d.value);for(;R;){const O=R.index,L={index:R.index,input:R.input,stack:[...g,d]};let D=v(...R,L);if(typeof D=="string"&&(D=D.length>0?{type:"text",value:D}:void 0),D===!1?b.lastIndex=O+1:(j!==O&&A.push({type:"text",value:d.value.slice(j,O)}),Array.isArray(D)?A.push(...D):D&&A.push(D),j=O+R[0].length,E=!0),!b.global)break;R=b.exec(d.value)}return E?(j<d.value.length&&A.push({type:"text",value:d.value.slice(j)}),y.children.splice(C,1,...A)):A=[d],C+A.length}}function xk(t){const l=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!t[0]||Array.isArray(t[0])?t:[t];let i=-1;for(;++i<r.length;){const c=r[i];l.push([pk(c[0]),yk(c[1])])}return l}function pk(t){return typeof t=="string"?new RegExp(hk(t),"g"):t}function yk(t){return typeof t=="function"?t:function(){return t}}const dd="phrasing",hd=["autolink","link","image","label"];function gk(){return{transforms:[Ck],enter:{literalAutolink:vk,literalAutolinkEmail:md,literalAutolinkHttp:md,literalAutolinkWww:md},exit:{literalAutolink:jk,literalAutolinkEmail:Sk,literalAutolinkHttp:wk,literalAutolinkWww:kk}}}function bk(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:dd,notInConstruct:hd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:dd,notInConstruct:hd},{character:":",before:"[ps]",after:"\\/",inConstruct:dd,notInConstruct:hd}]}}function vk(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function md(t){this.config.enter.autolinkProtocol.call(this,t)}function wk(t){this.config.exit.autolinkProtocol.call(this,t)}function kk(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 Sk(t){this.config.exit.autolinkEmail.call(this,t)}function jk(t){this.exit(t)}function Ck(t){mk(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Ek],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Nk]],{ignore:["link","linkReference"]})}function Ek(t,l,r,i,c){let u="";if(!Ay(c)||(/^w/i.test(l)&&(r=l+r,l="",u="http://"),!Ak(r)))return!1;const f=Tk(r+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 Nk(t,l,r,i){return!Ay(i,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+l+"@"+r,children:[{type:"text",value:l+"@"+r}]}}function Ak(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 Tk(t){const l=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!l)return[t,void 0];t=t.slice(0,l.index);let r=l[0],i=r.indexOf(")");const c=Z1(t,"(");let u=Z1(t,")");for(;i!==-1&&c>u;)t+=r.slice(0,i+1),r=r.slice(i+1),i=r.indexOf(")"),u++;return[t,r]}function Ay(t,l){const r=t.input.charCodeAt(t.index-1);return(t.index===0||ga(r)||Oc(r))&&(!l||r!==47)}Ty.peek=Lk;function Dk(){this.buffer()}function zk(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function Mk(){this.buffer()}function Rk(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function Fk(t){const l=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=hl(this.sliceSerialize(t)).toLowerCase(),r.label=l}function _k(t){this.exit(t)}function Ok(t){const l=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=hl(this.sliceSerialize(t)).toLowerCase(),r.label=l}function Bk(t){this.exit(t)}function Lk(){return"["}function Ty(t,l,r,i){const c=r.createTracker(i);let u=c.move("[^");const f=r.enter("footnoteReference"),m=r.enter("reference");return u+=c.move(r.safe(r.associationId(t),{after:"]",before:u})),m(),f(),u+=c.move("]"),u}function $k(){return{enter:{gfmFootnoteCallString:Dk,gfmFootnoteCall:zk,gfmFootnoteDefinitionLabelString:Mk,gfmFootnoteDefinition:Rk},exit:{gfmFootnoteCallString:Fk,gfmFootnoteCall:_k,gfmFootnoteDefinitionLabelString:Ok,gfmFootnoteDefinition:Bk}}}function Hk(t){let l=!1;return t&&t.firstLineBlank&&(l=!0),{handlers:{footnoteDefinition:r,footnoteReference:Ty},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(i,c,u,f){const m=u.createTracker(f);let p=m.move("[^");const d=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?Dy:Uk))),d(),p}}function Uk(t,l,r){return l===0?t:Dy(t,l,r)}function Dy(t,l,r){return(r?"":" ")+t}const Ik=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];zy.peek=Gk;function Yk(){return{canContainEols:["delete"],enter:{strikethrough:Xk},exit:{strikethrough:Vk}}}function qk(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Ik}],handlers:{delete:zy}}}function Xk(t){this.enter({type:"delete",children:[]},t)}function Vk(t){this.exit(t)}function zy(t,l,r,i){const c=r.createTracker(i),u=r.enter("strikethrough");let f=c.move("~~");return f+=r.containerPhrasing(t,{...c.current(),before:f,after:"~"}),f+=c.move("~~"),u(),f}function Gk(){return"~"}function Kk(t){return t.length}function Qk(t,l){const r=l||{},i=(r.align||[]).concat(),c=r.stringLength||Kk,u=[],f=[],m=[],p=[];let d=0,g=-1;for(;++g<t.length;){const k=[],C=[];let E=-1;for(t[g].length>d&&(d=t[g].length);++E<t[g].length;){const A=Wk(t[g][E]);if(r.alignDelimiters!==!1){const R=c(A);C[E]=R,(p[E]===void 0||R>p[E])&&(p[E]=R)}k.push(A)}f[g]=k,m[g]=C}let y=-1;if(typeof i=="object"&&"length"in i)for(;++y<d;)u[y]=J1(i[y]);else{const k=J1(i);for(;++y<d;)u[y]=k}y=-1;const b=[],v=[];for(;++y<d;){const k=u[y];let C="",E="";k===99?(C=":",E=":"):k===108?C=":":k===114&&(E=":");let A=r.alignDelimiters===!1?1:Math.max(1,p[y]-C.length-E.length);const R=C+"-".repeat(A)+E;r.alignDelimiters!==!1&&(A=C.length+A+E.length,A>p[y]&&(p[y]=A),v[y]=A),b[y]=R}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<d;){const A=k[y]||"";let R="",O="";if(r.alignDelimiters!==!1){const L=p[y]-(C[y]||0),D=u[y];D===114?R=" ".repeat(L):D===99?L%2?(R=" ".repeat(L/2+.5),O=" ".repeat(L/2-.5)):(R=" ".repeat(L/2),O=R):O=" ".repeat(L)}r.delimiterStart!==!1&&!y&&E.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&A==="")&&(r.delimiterStart!==!1||y)&&E.push(" "),r.alignDelimiters!==!1&&E.push(R),E.push(A),r.alignDelimiters!==!1&&E.push(O),r.padding!==!1&&E.push(" "),(r.delimiterEnd!==!1||y!==d-1)&&E.push("|")}j.push(r.delimiterEnd===!1?E.join("").replace(/ +$/,""):E.join(""))}return j.join(`
65
- `)}function Wk(t){return t==null?"":String(t)}function J1(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 Zk(t,l,r,i){const c=r.enter("blockquote"),u=r.createTracker(i);u.move("> "),u.shift(2);const f=r.indentLines(r.containerFlow(t,u.current()),Jk);return c(),f}function Jk(t,l,r){return">"+(r?"":" ")+t}function Pk(t,l){return P1(t,l.inConstruct,!0)&&!P1(t,l.notInConstruct,!1)}function P1(t,l,r){if(typeof l=="string"&&(l=[l]),!l||l.length===0)return r;let i=-1;for(;++i<l.length;)if(t.includes(l[i]))return!0;return!1}function e0(t,l,r,i){let c=-1;for(;++c<r.unsafe.length;)if(r.unsafe[c].character===`
66
- `&&Pk(r.stack,r.unsafe[c]))return/[ \t]/.test(i.before)?"":" ";return`\\
67
- `}function e4(t,l){const r=String(t);let i=r.indexOf(l),c=i,u=0,f=0;if(typeof l!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===c?++u>f&&(f=u):u=1,c=i+l.length,i=r.indexOf(l,c);return f}function t4(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 n4(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 l4(t,l,r,i){const c=n4(r),u=t.value||"",f=c==="`"?"GraveAccent":"Tilde";if(t4(t,r)){const y=r.enter("codeIndented"),b=r.indentLines(u,r4);return y(),b}const m=r.createTracker(i),p=c.repeat(Math.max(e4(u,c)+1,3)),d=r.enter("codeFenced");let g=m.move(p);if(t.lang){const y=r.enter(`codeFencedLang${f}`);g+=m.move(r.safe(t.lang,{before:g,after:" ",encode:["`"],...m.current()})),y()}if(t.lang&&t.meta){const y=r.enter(`codeFencedMeta${f}`);g+=m.move(" "),g+=m.move(r.safe(t.meta,{before:g,after:`
62
+ `}),r}function I1(t){let l=0,r=t.charCodeAt(l);for(;r===9||r===32;)l++,r=t.charCodeAt(l);return t.slice(l)}function Y1(t,l){const r=F3(t,l),i=r.one(t,void 0),c=j3(r),u=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return c&&u.children.push({type:"text",value:`
63
+ `},c),u}function $3(t,l){return t&&"run"in t?async function(r,i){const c=Y1(r,{file:i,...l});await t.run(c,i)}:function(r,i){return Y1(r,{file:i,...t||l})}}function q1(t){if(t)throw t}var rd,X1;function H3(){if(X1)return rd;X1=1;var t=Object.prototype.hasOwnProperty,l=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,c=function(d){return typeof Array.isArray=="function"?Array.isArray(d):l.call(d)==="[object Array]"},u=function(d){if(!d||l.call(d)!=="[object Object]")return!1;var g=t.call(d,"constructor"),y=d.constructor&&d.constructor.prototype&&t.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!g&&!y)return!1;var b;for(b in d);return typeof b>"u"||t.call(d,b)},f=function(d,g){r&&g.name==="__proto__"?r(d,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):d[g.name]=g.newValue},m=function(d,g){if(g==="__proto__")if(t.call(d,g)){if(i)return i(d,g).value}else return;return d[g]};return rd=function x(){var d,g,y,b,v,j,S=arguments[0],C=1,E=arguments.length,A=!1;for(typeof S=="boolean"&&(A=S,S=arguments[1]||{},C=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});C<E;++C)if(d=arguments[C],d!=null)for(g in d)y=m(S,g),b=m(d,g),S!==b&&(A&&b&&(u(b)||(v=c(b)))?(v?(v=!1,j=y&&c(y)?y:[]):j=y&&u(y)?y:{},f(S,{name:g,newValue:x(A,j,b)})):typeof b<"u"&&f(S,{name:g,newValue:b}));return S},rd}var U3=H3();const ad=X0(U3);function Xd(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 I3(){const t=[],l={run:r,use:i};return l;function r(...c){let u=-1;const f=c.pop();if(typeof f!="function")throw new TypeError("Expected function as last argument, not "+f);m(null,...c);function m(x,...d){const g=t[++u];let y=-1;if(x){f(x);return}for(;++y<c.length;)(d[y]===null||d[y]===void 0)&&(d[y]=c[y]);c=d,g?Y3(g,m)(...d):f(null,...d)}}function i(c){if(typeof c!="function")throw new TypeError("Expected `middelware` to be a function, not "+c);return t.push(c),l}}function Y3(t,l){let r;return i;function i(...f){const m=t.length>f.length;let x;m&&f.push(c);try{x=t.apply(this,f)}catch(d){const g=d;if(m&&r)throw g;return c(g)}m||(x&&x.then&&typeof x.then=="function"?x.then(u,c):x instanceof Error?c(x):u(x))}function c(f,...m){r||(r=!0,l(f,...m))}function u(f){c(null,f)}}const Sl={basename:q3,dirname:X3,extname:V3,join:G3,sep:"/"};function q3(t,l){if(l!==void 0&&typeof l!="string")throw new TypeError('"ext" argument must be a string');$s(t);let r=0,i=-1,c=t.length,u;if(l===void 0||l.length===0||l.length>t.length){for(;c--;)if(t.codePointAt(c)===47){if(u){r=c+1;break}}else i<0&&(u=!0,i=c+1);return i<0?"":t.slice(r,i)}if(l===t)return"";let f=-1,m=l.length-1;for(;c--;)if(t.codePointAt(c)===47){if(u){r=c+1;break}}else f<0&&(u=!0,f=c+1),m>-1&&(t.codePointAt(c)===l.codePointAt(m--)?m<0&&(i=c):(m=-1,i=f));return r===i?i=f:i<0&&(i=t.length),t.slice(r,i)}function X3(t){if($s(t),t.length===0)return".";let l=-1,r=t.length,i;for(;--r;)if(t.codePointAt(r)===47){if(i){l=r;break}}else i||(i=!0);return l<0?t.codePointAt(0)===47?"/":".":l===1&&t.codePointAt(0)===47?"//":t.slice(0,l)}function V3(t){$s(t);let l=t.length,r=-1,i=0,c=-1,u=0,f;for(;l--;){const m=t.codePointAt(l);if(m===47){if(f){i=l+1;break}continue}r<0&&(f=!0,r=l+1),m===46?c<0?c=l:u!==1&&(u=1):c>-1&&(u=-1)}return c<0||r<0||u===0||u===1&&c===r-1&&c===i+1?"":t.slice(c,r)}function G3(...t){let l=-1,r;for(;++l<t.length;)$s(t[l]),t[l]&&(r=r===void 0?t[l]:r+"/"+t[l]);return r===void 0?".":K3(r)}function K3(t){$s(t);const l=t.codePointAt(0)===47;let r=Q3(t,!l);return r.length===0&&!l&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),l?"/"+r:r}function Q3(t,l){let r="",i=0,c=-1,u=0,f=-1,m,x;for(;++f<=t.length;){if(f<t.length)m=t.codePointAt(f);else{if(m===47)break;m=47}if(m===47){if(!(c===f-1||u===1))if(c!==f-1&&u===2){if(r.length<2||i!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(x=r.lastIndexOf("/"),x!==r.length-1){x<0?(r="",i=0):(r=r.slice(0,x),i=r.length-1-r.lastIndexOf("/")),c=f,u=0;continue}}else if(r.length>0){r="",i=0,c=f,u=0;continue}}l&&(r=r.length>0?r+"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(c+1,f):r=t.slice(c+1,f),i=f-c-1;c=f,u=0}else m===46&&u>-1?u++:u=-1}return r}function $s(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const W3={cwd:Z3};function Z3(){return"/"}function Vd(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function J3(t){if(typeof t=="string")t=new URL(t);else if(!Vd(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 P3(t)}function P3(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 r=-1;for(;++r<l.length;)if(l.codePointAt(r)===37&&l.codePointAt(r+1)===50){const i=l.codePointAt(r+2);if(i===70||i===102){const c=new TypeError("File URL path must not include encoded / characters");throw c.code="ERR_INVALID_FILE_URL_PATH",c}}return decodeURIComponent(l)}const id=["history","path","basename","stem","extname","dirname"];class Ny{constructor(l){let r;l?Vd(l)?r={path:l}:typeof l=="string"||ek(l)?r={value:l}:r=l:r={},this.cwd="cwd"in r?"":W3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<id.length;){const u=id[i];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let c;for(c in r)id.includes(c)||(this[c]=r[c])}get basename(){return typeof this.path=="string"?Sl.basename(this.path):void 0}set basename(l){od(l,"basename"),sd(l,"basename"),this.path=Sl.join(this.dirname||"",l)}get dirname(){return typeof this.path=="string"?Sl.dirname(this.path):void 0}set dirname(l){V1(this.basename,"dirname"),this.path=Sl.join(l||"",this.basename)}get extname(){return typeof this.path=="string"?Sl.extname(this.path):void 0}set extname(l){if(sd(l,"extname"),V1(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=Sl.join(this.dirname,this.stem+(l||""))}get path(){return this.history[this.history.length-1]}set path(l){Vd(l)&&(l=J3(l)),od(l,"path"),this.path!==l&&this.history.push(l)}get stem(){return typeof this.path=="string"?Sl.basename(this.path,this.extname):void 0}set stem(l){od(l,"stem"),sd(l,"stem"),this.path=Sl.join(this.dirname||"",l+(this.extname||""))}fail(l,r,i){const c=this.message(l,r,i);throw c.fatal=!0,c}info(l,r,i){const c=this.message(l,r,i);return c.fatal=void 0,c}message(l,r,i){const c=new gn(l,r,i);return this.path&&(c.name=this.path+":"+c.name,c.file=this.path),c.fatal=!1,this.messages.push(c),c}toString(l){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(l||void 0).decode(this.value)}}function sd(t,l){if(t&&t.includes(Sl.sep))throw new Error("`"+l+"` cannot be a path: did not expect `"+Sl.sep+"`")}function od(t,l){if(!t)throw new Error("`"+l+"` cannot be empty")}function V1(t,l){if(!t)throw new Error("Setting `"+l+"` requires `path` to be set too")}function ek(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const tk=(function(t){const i=this.constructor.prototype,c=i[t],u=function(){return c.apply(u,arguments)};return Object.setPrototypeOf(u,i),u}),nk={}.hasOwnProperty;class ph extends tk{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=I3()}copy(){const l=new ph;let r=-1;for(;++r<this.attachers.length;){const i=this.attachers[r];l.use(...i)}return l.data(ad(!0,{},this.namespace)),l}data(l,r){return typeof l=="string"?arguments.length===2?(fd("data",this.frozen),this.namespace[l]=r,this):nk.call(this.namespace,l)&&this.namespace[l]||void 0:l?(fd("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[r,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const c=r.call(l,...i);typeof c=="function"&&this.transformers.use(c)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(l){this.freeze();const r=ac(l),i=this.parser||this.Parser;return cd("parse",i),i(String(r),r)}process(l,r){const i=this;return this.freeze(),cd("process",this.parser||this.Parser),ud("process",this.compiler||this.Compiler),r?c(void 0,r):new Promise(c);function c(u,f){const m=ac(l),x=i.parse(m);i.run(x,m,function(g,y,b){if(g||!y||!b)return d(g);const v=y,j=i.stringify(v,b);ak(j)?b.value=j:b.result=j,d(g,b)});function d(g,y){g||!y?f(g):u?u(y):r(void 0,y)}}}processSync(l){let r=!1,i;return this.freeze(),cd("processSync",this.parser||this.Parser),ud("processSync",this.compiler||this.Compiler),this.process(l,c),K1("processSync","process",r),i;function c(u,f){r=!0,q1(u),i=f}}run(l,r,i){G1(l),this.freeze();const c=this.transformers;return!i&&typeof r=="function"&&(i=r,r=void 0),i?u(void 0,i):new Promise(u);function u(f,m){const x=ac(r);c.run(l,x,d);function d(g,y,b){const v=y||l;g?m(g):f?f(v):i(void 0,v,b)}}}runSync(l,r){let i=!1,c;return this.run(l,r,u),K1("runSync","run",i),c;function u(f,m){q1(f),c=m,i=!0}}stringify(l,r){this.freeze();const i=ac(r),c=this.compiler||this.Compiler;return ud("stringify",c),G1(l),c(l,i)}use(l,...r){const i=this.attachers,c=this.namespace;if(fd("use",this.frozen),l!=null)if(typeof l=="function")x(l,r);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(d){if(typeof d=="function")x(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[g,...y]=d;x(g,y)}else f(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function f(d){if(!("plugins"in d)&&!("settings"in d))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(d.plugins),d.settings&&(c.settings=ad(!0,c.settings,d.settings))}function m(d){let g=-1;if(d!=null)if(Array.isArray(d))for(;++g<d.length;){const y=d[g];u(y)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function x(d,g){let y=-1,b=-1;for(;++y<i.length;)if(i[y][0]===d){b=y;break}if(b===-1)i.push([d,...g]);else if(g.length>0){let[v,...j]=g;const S=i[b][1];Xd(S)&&Xd(v)&&(v=ad(!0,S,v)),i[b]=[d,v,...j]}}}}const lk=new ph().freeze();function cd(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function ud(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function fd(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 G1(t){if(!Xd(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function K1(t,l,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+l+"` instead")}function ac(t){return rk(t)?t:new Ny(t)}function rk(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function ak(t){return typeof t=="string"||ik(t)}function ik(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const sk="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Q1=[],W1={allowDangerousHtml:!0},ok=/^(https?|ircs?|mailto|xmpp)$/i,ck=[{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 Ay(t){const l=uk(t),r=fk(t);return dk(l.runSync(l.parse(r),r),t)}function uk(t){const l=t.rehypePlugins||Q1,r=t.remarkPlugins||Q1,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...W1}:W1;return lk().use(X5).use(r).use($3,i).use(l)}function fk(t){const l=t.children||"",r=new Ny;return typeof l=="string"&&(r.value=l),r}function dk(t,l){const r=l.allowedElements,i=l.allowElement,c=l.components,u=l.disallowedElements,f=l.skipHtml,m=l.unwrapDisallowed,x=l.urlTransform||hk;for(const g of ck)Object.hasOwn(l,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+sk+g.id,void 0);return xh(t,d),Av(t,{Fragment:o.Fragment,components:c,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function d(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 td)if(Object.hasOwn(td,v)&&Object.hasOwn(g.properties,v)){const j=g.properties[v],S=td[v];(S===null||S.includes(g.tagName))&&(g.properties[v]=x(String(j||""),v,g))}}if(g.type==="element"){let v=r?!r.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 hk(t){const l=t.indexOf(":"),r=t.indexOf("?"),i=t.indexOf("#"),c=t.indexOf("/");return l===-1||c!==-1&&l>c||r!==-1&&l>r||i!==-1&&l>i||ok.test(t.slice(0,l))?t:""}function Z1(t,l){const r=String(t);if(typeof l!="string")throw new TypeError("Expected character");let i=0,c=r.indexOf(l);for(;c!==-1;)i++,c=r.indexOf(l,c+l.length);return i}function mk(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function xk(t,l,r){const c=$c((r||{}).ignore||[]),u=pk(l);let f=-1;for(;++f<u.length;)Ey(t,"text",m);function m(d,g){let y=-1,b;for(;++y<g.length;){const v=g[y],j=b?b.children:void 0;if(c(v,j?j.indexOf(v):void 0,b))return;b=v}if(b)return x(d,g)}function x(d,g){const y=g[g.length-1],b=u[f][0],v=u[f][1];let j=0;const C=y.children.indexOf(d);let E=!1,A=[];b.lastIndex=0;let M=b.exec(d.value);for(;M;){const O=M.index,L={index:M.index,input:M.input,stack:[...g,d]};let F=v(...M,L);if(typeof F=="string"&&(F=F.length>0?{type:"text",value:F}:void 0),F===!1?b.lastIndex=O+1:(j!==O&&A.push({type:"text",value:d.value.slice(j,O)}),Array.isArray(F)?A.push(...F):F&&A.push(F),j=O+M[0].length,E=!0),!b.global)break;M=b.exec(d.value)}return E?(j<d.value.length&&A.push({type:"text",value:d.value.slice(j)}),y.children.splice(C,1,...A)):A=[d],C+A.length}}function pk(t){const l=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!t[0]||Array.isArray(t[0])?t:[t];let i=-1;for(;++i<r.length;){const c=r[i];l.push([yk(c[0]),gk(c[1])])}return l}function yk(t){return typeof t=="string"?new RegExp(mk(t),"g"):t}function gk(t){return typeof t=="function"?t:function(){return t}}const dd="phrasing",hd=["autolink","link","image","label"];function bk(){return{transforms:[Ek],enter:{literalAutolink:wk,literalAutolinkEmail:md,literalAutolinkHttp:md,literalAutolinkWww:md},exit:{literalAutolink:Ck,literalAutolinkEmail:jk,literalAutolinkHttp:kk,literalAutolinkWww:Sk}}}function vk(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:dd,notInConstruct:hd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:dd,notInConstruct:hd},{character:":",before:"[ps]",after:"\\/",inConstruct:dd,notInConstruct:hd}]}}function wk(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function md(t){this.config.enter.autolinkProtocol.call(this,t)}function kk(t){this.config.exit.autolinkProtocol.call(this,t)}function Sk(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 jk(t){this.config.exit.autolinkEmail.call(this,t)}function Ck(t){this.exit(t)}function Ek(t){xk(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Nk],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Ak]],{ignore:["link","linkReference"]})}function Nk(t,l,r,i,c){let u="";if(!Ty(c)||(/^w/i.test(l)&&(r=l+r,l="",u="http://"),!Tk(r)))return!1;const f=Dk(r+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 Ak(t,l,r,i){return!Ty(i,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+l+"@"+r,children:[{type:"text",value:l+"@"+r}]}}function Tk(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 Dk(t){const l=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!l)return[t,void 0];t=t.slice(0,l.index);let r=l[0],i=r.indexOf(")");const c=Z1(t,"(");let u=Z1(t,")");for(;i!==-1&&c>u;)t+=r.slice(0,i+1),r=r.slice(i+1),i=r.indexOf(")"),u++;return[t,r]}function Ty(t,l){const r=t.input.charCodeAt(t.index-1);return(t.index===0||ga(r)||Oc(r))&&(!l||r!==47)}Dy.peek=$k;function zk(){this.buffer()}function Mk(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function Rk(){this.buffer()}function Fk(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function _k(t){const l=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=hl(this.sliceSerialize(t)).toLowerCase(),r.label=l}function Ok(t){this.exit(t)}function Bk(t){const l=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=hl(this.sliceSerialize(t)).toLowerCase(),r.label=l}function Lk(t){this.exit(t)}function $k(){return"["}function Dy(t,l,r,i){const c=r.createTracker(i);let u=c.move("[^");const f=r.enter("footnoteReference"),m=r.enter("reference");return u+=c.move(r.safe(r.associationId(t),{after:"]",before:u})),m(),f(),u+=c.move("]"),u}function Hk(){return{enter:{gfmFootnoteCallString:zk,gfmFootnoteCall:Mk,gfmFootnoteDefinitionLabelString:Rk,gfmFootnoteDefinition:Fk},exit:{gfmFootnoteCallString:_k,gfmFootnoteCall:Ok,gfmFootnoteDefinitionLabelString:Bk,gfmFootnoteDefinition:Lk}}}function Uk(t){let l=!1;return t&&t.firstLineBlank&&(l=!0),{handlers:{footnoteDefinition:r,footnoteReference:Dy},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(i,c,u,f){const m=u.createTracker(f);let x=m.move("[^");const d=u.enter("footnoteDefinition"),g=u.enter("label");return x+=m.move(u.safe(u.associationId(i),{before:x,after:"]"})),g(),x+=m.move("]:"),i.children&&i.children.length>0&&(m.shift(4),x+=m.move((l?`
64
+ `:" ")+u.indentLines(u.containerFlow(i,m.current()),l?zy:Ik))),d(),x}}function Ik(t,l,r){return l===0?t:zy(t,l,r)}function zy(t,l,r){return(r?"":" ")+t}const Yk=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];My.peek=Kk;function qk(){return{canContainEols:["delete"],enter:{strikethrough:Vk},exit:{strikethrough:Gk}}}function Xk(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Yk}],handlers:{delete:My}}}function Vk(t){this.enter({type:"delete",children:[]},t)}function Gk(t){this.exit(t)}function My(t,l,r,i){const c=r.createTracker(i),u=r.enter("strikethrough");let f=c.move("~~");return f+=r.containerPhrasing(t,{...c.current(),before:f,after:"~"}),f+=c.move("~~"),u(),f}function Kk(){return"~"}function Qk(t){return t.length}function Wk(t,l){const r=l||{},i=(r.align||[]).concat(),c=r.stringLength||Qk,u=[],f=[],m=[],x=[];let d=0,g=-1;for(;++g<t.length;){const S=[],C=[];let E=-1;for(t[g].length>d&&(d=t[g].length);++E<t[g].length;){const A=Zk(t[g][E]);if(r.alignDelimiters!==!1){const M=c(A);C[E]=M,(x[E]===void 0||M>x[E])&&(x[E]=M)}S.push(A)}f[g]=S,m[g]=C}let y=-1;if(typeof i=="object"&&"length"in i)for(;++y<d;)u[y]=J1(i[y]);else{const S=J1(i);for(;++y<d;)u[y]=S}y=-1;const b=[],v=[];for(;++y<d;){const S=u[y];let C="",E="";S===99?(C=":",E=":"):S===108?C=":":S===114&&(E=":");let A=r.alignDelimiters===!1?1:Math.max(1,x[y]-C.length-E.length);const M=C+"-".repeat(A)+E;r.alignDelimiters!==!1&&(A=C.length+A+E.length,A>x[y]&&(x[y]=A),v[y]=A),b[y]=M}f.splice(1,0,b),m.splice(1,0,v),g=-1;const j=[];for(;++g<f.length;){const S=f[g],C=m[g];y=-1;const E=[];for(;++y<d;){const A=S[y]||"";let M="",O="";if(r.alignDelimiters!==!1){const L=x[y]-(C[y]||0),F=u[y];F===114?M=" ".repeat(L):F===99?L%2?(M=" ".repeat(L/2+.5),O=" ".repeat(L/2-.5)):(M=" ".repeat(L/2),O=M):O=" ".repeat(L)}r.delimiterStart!==!1&&!y&&E.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&A==="")&&(r.delimiterStart!==!1||y)&&E.push(" "),r.alignDelimiters!==!1&&E.push(M),E.push(A),r.alignDelimiters!==!1&&E.push(O),r.padding!==!1&&E.push(" "),(r.delimiterEnd!==!1||y!==d-1)&&E.push("|")}j.push(r.delimiterEnd===!1?E.join("").replace(/ +$/,""):E.join(""))}return j.join(`
65
+ `)}function Zk(t){return t==null?"":String(t)}function J1(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 Jk(t,l,r,i){const c=r.enter("blockquote"),u=r.createTracker(i);u.move("> "),u.shift(2);const f=r.indentLines(r.containerFlow(t,u.current()),Pk);return c(),f}function Pk(t,l,r){return">"+(r?"":" ")+t}function e4(t,l){return P1(t,l.inConstruct,!0)&&!P1(t,l.notInConstruct,!1)}function P1(t,l,r){if(typeof l=="string"&&(l=[l]),!l||l.length===0)return r;let i=-1;for(;++i<l.length;)if(t.includes(l[i]))return!0;return!1}function e0(t,l,r,i){let c=-1;for(;++c<r.unsafe.length;)if(r.unsafe[c].character===`
66
+ `&&e4(r.stack,r.unsafe[c]))return/[ \t]/.test(i.before)?"":" ";return`\\
67
+ `}function t4(t,l){const r=String(t);let i=r.indexOf(l),c=i,u=0,f=0;if(typeof l!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===c?++u>f&&(f=u):u=1,c=i+l.length,i=r.indexOf(l,c);return f}function n4(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 l4(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 r4(t,l,r,i){const c=l4(r),u=t.value||"",f=c==="`"?"GraveAccent":"Tilde";if(n4(t,r)){const y=r.enter("codeIndented"),b=r.indentLines(u,a4);return y(),b}const m=r.createTracker(i),x=c.repeat(Math.max(t4(u,c)+1,3)),d=r.enter("codeFenced");let g=m.move(x);if(t.lang){const y=r.enter(`codeFencedLang${f}`);g+=m.move(r.safe(t.lang,{before:g,after:" ",encode:["`"],...m.current()})),y()}if(t.lang&&t.meta){const y=r.enter(`codeFencedMeta${f}`);g+=m.move(" "),g+=m.move(r.safe(t.meta,{before:g,after:`
68
68
  `,encode:["`"],...m.current()})),y()}return g+=m.move(`
69
69
  `),u&&(g+=m.move(u+`
70
- `)),g+=m.move(p),d(),g}function r4(t,l,r){return(r?"":" ")+t}function yh(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 a4(t,l,r,i){const c=yh(r),u=c==='"'?"Quote":"Apostrophe",f=r.enter("definition");let m=r.enter("label");const p=r.createTracker(i);let d=p.move("[");return d+=p.move(r.safe(r.associationId(t),{before:d,after:"]",...p.current()})),d+=p.move("]: "),m(),!t.url||/[\0- \u007F]/.test(t.url)?(m=r.enter("destinationLiteral"),d+=p.move("<"),d+=p.move(r.safe(t.url,{before:d,after:">",...p.current()})),d+=p.move(">")):(m=r.enter("destinationRaw"),d+=p.move(r.safe(t.url,{before:d,after:t.title?" ":`
71
- `,...p.current()}))),m(),t.title&&(m=r.enter(`title${u}`),d+=p.move(" "+c),d+=p.move(r.safe(t.title,{before:d,after:c,...p.current()})),d+=p.move(c),m()),f(),d}function i4(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 Ms(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Ac(t,l,r){const i=oi(t),c=oi(l);return i===void 0?c===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}My.peek=s4;function My(t,l,r,i){const c=i4(r),u=r.enter("emphasis"),f=r.createTracker(i),m=f.move(c);let p=f.move(r.containerPhrasing(t,{after:c,before:m,...f.current()}));const d=p.charCodeAt(0),g=Ac(i.before.charCodeAt(i.before.length-1),d,c);g.inside&&(p=Ms(d)+p.slice(1));const y=p.charCodeAt(p.length-1),b=Ac(i.after.charCodeAt(0),y,c);b.inside&&(p=p.slice(0,-1)+Ms(y));const v=f.move(c);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},m+p+v}function s4(t,l,r){return r.options.emphasis||"*"}function o4(t,l){let r=!1;return xh(t,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return r=!0,Yd}),!!((!t.depth||t.depth<3)&&oh(t)&&(l.options.setext||r))}function c4(t,l,r,i){const c=Math.max(Math.min(6,t.depth||1),1),u=r.createTracker(i);if(o4(t,r)){const g=r.enter("headingSetext"),y=r.enter("phrasing"),b=r.containerPhrasing(t,{...u.current(),before:`
70
+ `)),g+=m.move(x),d(),g}function a4(t,l,r){return(r?"":" ")+t}function yh(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 i4(t,l,r,i){const c=yh(r),u=c==='"'?"Quote":"Apostrophe",f=r.enter("definition");let m=r.enter("label");const x=r.createTracker(i);let d=x.move("[");return d+=x.move(r.safe(r.associationId(t),{before:d,after:"]",...x.current()})),d+=x.move("]: "),m(),!t.url||/[\0- \u007F]/.test(t.url)?(m=r.enter("destinationLiteral"),d+=x.move("<"),d+=x.move(r.safe(t.url,{before:d,after:">",...x.current()})),d+=x.move(">")):(m=r.enter("destinationRaw"),d+=x.move(r.safe(t.url,{before:d,after:t.title?" ":`
71
+ `,...x.current()}))),m(),t.title&&(m=r.enter(`title${u}`),d+=x.move(" "+c),d+=x.move(r.safe(t.title,{before:d,after:c,...x.current()})),d+=x.move(c),m()),f(),d}function s4(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 Ms(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Ac(t,l,r){const i=oi(t),c=oi(l);return i===void 0?c===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Ry.peek=o4;function Ry(t,l,r,i){const c=s4(r),u=r.enter("emphasis"),f=r.createTracker(i),m=f.move(c);let x=f.move(r.containerPhrasing(t,{after:c,before:m,...f.current()}));const d=x.charCodeAt(0),g=Ac(i.before.charCodeAt(i.before.length-1),d,c);g.inside&&(x=Ms(d)+x.slice(1));const y=x.charCodeAt(x.length-1),b=Ac(i.after.charCodeAt(0),y,c);b.inside&&(x=x.slice(0,-1)+Ms(y));const v=f.move(c);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},m+x+v}function o4(t,l,r){return r.options.emphasis||"*"}function c4(t,l){let r=!1;return xh(t,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return r=!0,Yd}),!!((!t.depth||t.depth<3)&&oh(t)&&(l.options.setext||r))}function u4(t,l,r,i){const c=Math.max(Math.min(6,t.depth||1),1),u=r.createTracker(i);if(c4(t,r)){const g=r.enter("headingSetext"),y=r.enter("phrasing"),b=r.containerPhrasing(t,{...u.current(),before:`
72
72
  `,after:`
73
73
  `});return y(),g(),b+`
74
74
  `+(c===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
75
- `))+1))}const f="#".repeat(c),m=r.enter("headingAtx"),p=r.enter("phrasing");u.move(f+" ");let d=r.containerPhrasing(t,{before:"# ",after:`
76
- `,...u.current()});return/^[\t ]/.test(d)&&(d=Ms(d.charCodeAt(0))+d.slice(1)),d=d?f+" "+d:f,r.options.closeAtx&&(d+=" "+f),p(),m(),d}Ry.peek=u4;function Ry(t){return t.value||""}function u4(){return"<"}Fy.peek=f4;function Fy(t,l,r,i){const c=yh(r),u=c==='"'?"Quote":"Apostrophe",f=r.enter("image");let m=r.enter("label");const p=r.createTracker(i);let d=p.move("![");return d+=p.move(r.safe(t.alt,{before:d,after:"]",...p.current()})),d+=p.move("]("),m(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(m=r.enter("destinationLiteral"),d+=p.move("<"),d+=p.move(r.safe(t.url,{before:d,after:">",...p.current()})),d+=p.move(">")):(m=r.enter("destinationRaw"),d+=p.move(r.safe(t.url,{before:d,after:t.title?" ":")",...p.current()}))),m(),t.title&&(m=r.enter(`title${u}`),d+=p.move(" "+c),d+=p.move(r.safe(t.title,{before:d,after:c,...p.current()})),d+=p.move(c),m()),d+=p.move(")"),f(),d}function f4(){return"!"}_y.peek=d4;function _y(t,l,r,i){const c=t.referenceType,u=r.enter("imageReference");let f=r.enter("label");const m=r.createTracker(i);let p=m.move("![");const d=r.safe(t.alt,{before:p,after:"]",...m.current()});p+=m.move(d+"]["),f();const g=r.stack;r.stack=[],f=r.enter("reference");const y=r.safe(r.associationId(t),{before:p,after:"]",...m.current()});return f(),r.stack=g,u(),c==="full"||!d||d!==y?p+=m.move(y+"]"):c==="shortcut"?p=p.slice(0,-1):p+=m.move("]"),p}function d4(){return"!"}Oy.peek=h4;function Oy(t,l,r){let i=t.value||"",c="`",u=-1;for(;new RegExp("(^|[^`])"+c+"([^`]|$)").test(i);)c+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++u<r.unsafe.length;){const f=r.unsafe[u],m=r.compilePattern(f);let p;if(f.atBreak)for(;p=m.exec(i);){let d=p.index;i.charCodeAt(d)===10&&i.charCodeAt(d-1)===13&&d--,i=i.slice(0,d)+" "+i.slice(p.index+1)}}return c+i+c}function h4(){return"`"}function By(t,l){const r=oh(t);return!!(!l.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(r===t.url||"mailto:"+r===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}Ly.peek=m4;function Ly(t,l,r,i){const c=yh(r),u=c==='"'?"Quote":"Apostrophe",f=r.createTracker(i);let m,p;if(By(t,r)){const g=r.stack;r.stack=[],m=r.enter("autolink");let y=f.move("<");return y+=f.move(r.containerPhrasing(t,{before:y,after:">",...f.current()})),y+=f.move(">"),m(),r.stack=g,y}m=r.enter("link"),p=r.enter("label");let d=f.move("[");return d+=f.move(r.containerPhrasing(t,{before:d,after:"](",...f.current()})),d+=f.move("]("),p(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(p=r.enter("destinationLiteral"),d+=f.move("<"),d+=f.move(r.safe(t.url,{before:d,after:">",...f.current()})),d+=f.move(">")):(p=r.enter("destinationRaw"),d+=f.move(r.safe(t.url,{before:d,after:t.title?" ":")",...f.current()}))),p(),t.title&&(p=r.enter(`title${u}`),d+=f.move(" "+c),d+=f.move(r.safe(t.title,{before:d,after:c,...f.current()})),d+=f.move(c),p()),d+=f.move(")"),m(),d}function m4(t,l,r){return By(t,r)?"<":"["}$y.peek=x4;function $y(t,l,r,i){const c=t.referenceType,u=r.enter("linkReference");let f=r.enter("label");const m=r.createTracker(i);let p=m.move("[");const d=r.containerPhrasing(t,{before:p,after:"]",...m.current()});p+=m.move(d+"]["),f();const g=r.stack;r.stack=[],f=r.enter("reference");const y=r.safe(r.associationId(t),{before:p,after:"]",...m.current()});return f(),r.stack=g,u(),c==="full"||!d||d!==y?p+=m.move(y+"]"):c==="shortcut"?p=p.slice(0,-1):p+=m.move("]"),p}function x4(){return"["}function gh(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 p4(t){const l=gh(t),r=t.options.bulletOther;if(!r)return l==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===l)throw new Error("Expected `bullet` (`"+l+"`) and `bulletOther` (`"+r+"`) to be different");return r}function y4(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 Hy(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 g4(t,l,r,i){const c=r.enter("list"),u=r.bulletCurrent;let f=t.ordered?y4(r):gh(r);const m=t.ordered?f==="."?")":".":p4(r);let p=l&&r.bulletLastUsed?f===r.bulletLastUsed:!1;if(!t.ordered){const g=t.children?t.children[0]:void 0;if((f==="*"||f==="-")&&g&&(!g.children||!g.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(p=!0),Hy(r)===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),r.bulletCurrent=f;const d=r.containerFlow(t,i);return r.bulletLastUsed=f,r.bulletCurrent=u,c(),d}function b4(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 v4(t,l,r,i){const c=b4(r);let u=r.bulletCurrent||gh(r);l&&l.type==="list"&&l.ordered&&(u=(typeof l.start=="number"&&l.start>-1?l.start:1)+(r.options.incrementListMarker===!1?0:l.children.indexOf(t))+u);let f=u.length+1;(c==="tab"||c==="mixed"&&(l&&l.type==="list"&&l.spread||t.spread))&&(f=Math.ceil(f/4)*4);const m=r.createTracker(i);m.move(u+" ".repeat(f-u.length)),m.shift(f);const p=r.enter("listItem"),d=r.indentLines(r.containerFlow(t,m.current()),g);return p(),d;function g(y,b,v){return b?(v?"":" ".repeat(f))+y:(v?u:u+" ".repeat(f-u.length))+y}}function w4(t,l,r,i){const c=r.enter("paragraph"),u=r.enter("phrasing"),f=r.containerPhrasing(t,i);return u(),c(),f}const k4=$c(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function S4(t,l,r,i){return(t.children.some(function(f){return k4(f)})?r.containerPhrasing:r.containerFlow).call(r,t,i)}function j4(t){const l=t.options.strong||"*";if(l!=="*"&&l!=="_")throw new Error("Cannot serialize strong with `"+l+"` for `options.strong`, expected `*`, or `_`");return l}Uy.peek=C4;function Uy(t,l,r,i){const c=j4(r),u=r.enter("strong"),f=r.createTracker(i),m=f.move(c+c);let p=f.move(r.containerPhrasing(t,{after:c,before:m,...f.current()}));const d=p.charCodeAt(0),g=Ac(i.before.charCodeAt(i.before.length-1),d,c);g.inside&&(p=Ms(d)+p.slice(1));const y=p.charCodeAt(p.length-1),b=Ac(i.after.charCodeAt(0),y,c);b.inside&&(p=p.slice(0,-1)+Ms(y));const v=f.move(c+c);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},m+p+v}function C4(t,l,r){return r.options.strong||"*"}function E4(t,l,r,i){return r.safe(t.value,i)}function N4(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 A4(t,l,r){const i=(Hy(r)+(r.options.ruleSpaces?" ":"")).repeat(N4(r));return r.options.ruleSpaces?i.slice(0,-1):i}const Iy={blockquote:Zk,break:e0,code:l4,definition:a4,emphasis:My,hardBreak:e0,heading:c4,html:Ry,image:Fy,imageReference:_y,inlineCode:Oy,link:Ly,linkReference:$y,list:g4,listItem:v4,paragraph:w4,root:S4,strong:Uy,text:E4,thematicBreak:A4};function T4(){return{enter:{table:D4,tableData:t0,tableHeader:t0,tableRow:M4},exit:{codeText:R4,table:z4,tableData:xd,tableHeader:xd,tableRow:xd}}}function D4(t){const l=t._align;this.enter({type:"table",align:l.map(function(r){return r==="none"?null:r}),children:[]},t),this.data.inTable=!0}function z4(t){this.exit(t),this.data.inTable=void 0}function M4(t){this.enter({type:"tableRow",children:[]},t)}function xd(t){this.exit(t)}function t0(t){this.enter({type:"tableCell",children:[]},t)}function R4(t){let l=this.resume();this.data.inTable&&(l=l.replace(/\\([\\|])/g,F4));const r=this.stack[this.stack.length-1];r.type,r.value=l,this.exit(t)}function F4(t,l){return l==="|"?l:t}function _4(t){const l=t||{},r=l.tableCellPadding,i=l.tablePipeAlign,c=l.stringLength,u=r?" ":"|";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 d(g(v,k,C),v.align)}function m(v,j,k,C){const E=y(v,k,C),A=d([E]);return A.slice(0,A.indexOf(`
78
- `))}function p(v,j,k,C){const E=k.enter("tableCell"),A=k.enter("phrasing"),R=k.containerPhrasing(v,{...C,before:u,after:u});return A(),E(),R}function d(v,j){return Qk(v,{align:j,alignDelimiters:i,padding:r,stringLength:c})}function g(v,j,k){const C=v.children;let E=-1;const A=[],R=j.enter("table");for(;++E<C.length;)A[E]=y(C[E],j,k);return R(),A}function y(v,j,k){const C=v.children;let E=-1;const A=[],R=j.enter("tableRow");for(;++E<C.length;)A[E]=p(C[E],v,j,k);return R(),A}function b(v,j,k){let C=Iy.inlineCode(v,j,k);return k.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function O4(){return{exit:{taskListCheckValueChecked:n0,taskListCheckValueUnchecked:n0,paragraph:L4}}}function B4(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:$4}}}function n0(t){const l=this.stack[this.stack.length-2];l.type,l.checked=t.type==="taskListCheckValueChecked"}function L4(t){const l=this.stack[this.stack.length-2];if(l&&l.type==="listItem"&&typeof l.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const i=r.children[0];if(i&&i.type==="text"){const c=l.children;let u=-1,f;for(;++u<c.length;){const m=c[u];if(m.type==="paragraph"){f=m;break}}f===r&&(i.value=i.value.slice(1),i.value.length===0?r.children.shift():r.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,r.position.start=Object.assign({},i.position.start)))}}this.exit(t)}function $4(t,l,r,i){const c=t.children[0],u=typeof t.checked=="boolean"&&c&&c.type==="paragraph",f="["+(t.checked?"x":" ")+"] ",m=r.createTracker(i);u&&m.move(f);let p=Iy.listItem(t,l,r,{...i,...m.current()});return u&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),p;function d(g){return g+f}}function H4(){return[gk(),$k(),Yk(),T4(),O4()]}function U4(t){return{extensions:[bk(),Hk(t),qk(),_4(t),B4()]}}const I4={tokenize:K4,partial:!0},Yy={tokenize:Q4,partial:!0},qy={tokenize:W4,partial:!0},Xy={tokenize:Z4,partial:!0},Y4={tokenize:J4,partial:!0},Vy={name:"wwwAutolink",tokenize:V4,previous:Ky},Gy={name:"protocolAutolink",tokenize:G4,previous:Qy},nr={name:"emailAutolink",tokenize:X4,previous:Wy},Nl={};function q4(){return{text:Nl}}let fa=48;for(;fa<123;)Nl[fa]=nr,fa++,fa===58?fa=65:fa===91&&(fa=97);Nl[43]=nr;Nl[45]=nr;Nl[46]=nr;Nl[95]=nr;Nl[72]=[nr,Gy];Nl[104]=[nr,Gy];Nl[87]=[nr,Vy];Nl[119]=[nr,Vy];function X4(t,l,r){const i=this;let c,u;return f;function f(y){return!Gd(y)||!Wy.call(i,i.previous)||bh(i.events)?r(y):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),m(y))}function m(y){return Gd(y)?(t.consume(y),m):y===64?(t.consume(y),p):r(y)}function p(y){return y===46?t.check(Y4,g,d)(y):y===45||y===95||yn(y)?(u=!0,t.consume(y),p):g(y)}function d(y){return t.consume(y),c=!0,p}function g(y){return u&&c&&Sn(i.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),l(y)):r(y)}}function V4(t,l,r){const i=this;return c;function c(f){return f!==87&&f!==119||!Ky.call(i,i.previous)||bh(i.events)?r(f):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(I4,t.attempt(Yy,t.attempt(qy,u),r),r)(f))}function u(f){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),l(f)}}function G4(t,l,r){const i=this;let c="",u=!1;return f;function f(y){return(y===72||y===104)&&Qy.call(i,i.previous)&&!bh(i.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),c+=String.fromCodePoint(y),t.consume(y),m):r(y)}function m(y){if(Sn(y)&&c.length<5)return c+=String.fromCodePoint(y),t.consume(y),m;if(y===58){const b=c.toLowerCase();if(b==="http"||b==="https")return t.consume(y),p}return r(y)}function p(y){return y===47?(t.consume(y),u?d:(u=!0,p)):r(y)}function d(y){return y===null||Cc(y)||zt(y)||ga(y)||Oc(y)?r(y):t.attempt(Yy,t.attempt(qy,g),r)(y)}function g(y){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),l(y)}}function K4(t,l,r){let i=0;return c;function c(f){return(f===87||f===119)&&i<3?(i++,t.consume(f),c):f===46&&i===3?(t.consume(f),u):r(f)}function u(f){return f===null?r(f):l(f)}}function Q4(t,l,r){let i,c,u;return f;function f(d){return d===46||d===95?t.check(Xy,p,m)(d):d===null||zt(d)||ga(d)||d!==45&&Oc(d)?p(d):(u=!0,t.consume(d),f)}function m(d){return d===95?i=!0:(c=i,i=void 0),t.consume(d),f}function p(d){return c||i||!u?r(d):l(d)}}function W4(t,l){let r=0,i=0;return c;function c(f){return f===40?(r++,t.consume(f),c):f===41&&i<r?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(Xy,l,u)(f):f===null||zt(f)||ga(f)?l(f):(t.consume(f),c)}function u(f){return f===41&&i++,t.consume(f),c}}function Z4(t,l,r){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),c):m===60||m===null||zt(m)||ga(m)?l(m):r(m)}function c(m){return m===null||m===40||m===91||zt(m)||ga(m)?l(m):i(m)}function u(m){return Sn(m)?f(m):r(m)}function f(m){return m===59?(t.consume(m),i):Sn(m)?(t.consume(m),f):r(m)}}function J4(t,l,r){return i;function i(u){return t.consume(u),c}function c(u){return yn(u)?r(u):l(u)}}function Ky(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||zt(t)}function Qy(t){return!Sn(t)}function Wy(t){return!(t===47||Gd(t))}function Gd(t){return t===43||t===45||t===46||t===95||yn(t)}function bh(t){let l=t.length,r=!1;for(;l--;){const i=t[l][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){r=!0;break}if(i._gfmAutolinkLiteralWalkedInto){r=!1;break}}return t.length>0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const P4={tokenize:sS,partial:!0};function eS(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:rS,continuation:{tokenize:aS},exit:iS}},text:{91:{name:"gfmFootnoteCall",tokenize:lS},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:tS,resolveTo:nS}}}}function tS(t,l,r){const i=this;let c=i.events.length;const u=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let f;for(;c--;){const p=i.events[c][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 r(p);const d=hl(i.sliceSerialize({start:f.end,end:i.now()}));return d.codePointAt(0)!==94||!u.includes(d.slice(1))?r(p):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),l(p))}}function nS(t,l){let r=t.length;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};c.end.column++,c.end.offset++,c.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},c.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[r+1],t[r+2],["enter",i,l],t[r+3],t[r+4],["enter",c,l],["exit",c,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(r,t.length-r+1,...m),t}function lS(t,l,r){const i=this,c=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?r(y):(t.enter("gfmFootnoteCallMarker"),t.consume(y),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",d)}function d(y){if(u>999||y===93&&!f||y===null||y===91||zt(y))return r(y);if(y===93){t.exit("chunkString");const b=t.exit("gfmFootnoteCallString");return c.includes(hl(i.sliceSerialize(b)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),l):r(y)}return zt(y)||(f=!0),u++,t.consume(y),y===92?g:d}function g(y){return y===91||y===92||y===93?(t.consume(y),u++,d):d(y)}}function rS(t,l,r){const i=this,c=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"),d}function d(j){return j===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(j),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",g):r(j)}function g(j){if(f>999||j===93&&!m||j===null||j===91||zt(j))return r(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 zt(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"),c.includes(u)||c.push(u),dt(t,v,"gfmFootnoteDefinitionWhitespace")):r(j)}function v(j){return l(j)}}function aS(t,l,r){return t.check(Ls,l,t.attempt(P4,l,r))}function iS(t){t.exit("gfmFootnoteDefinition")}function sS(t,l,r){const i=this;return dt(t,c,"gfmFootnoteDefinitionIndent",5);function c(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):r(u)}}function oS(t){let r=(t||{}).singleTilde;const i={name:"strikethrough",tokenize:u,resolveAll:c};return r==null&&(r=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function c(f,m){let p=-1;for(;++p<f.length;)if(f[p][0]==="enter"&&f[p][1].type==="strikethroughSequenceTemporary"&&f[p][1]._close){let d=p;for(;d--;)if(f[d][0]==="exit"&&f[d][1].type==="strikethroughSequenceTemporary"&&f[d][1]._open&&f[p][1].end.offset-f[p][1].start.offset===f[d][1].end.offset-f[d][1].start.offset){f[p][1].type="strikethroughSequence",f[d][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},f[d][1].start),end:Object.assign({},f[p][1].end)},y={type:"strikethroughText",start:Object.assign({},f[d][1].end),end:Object.assign({},f[p][1].start)},b=[["enter",g,m],["enter",f[d][1],m],["exit",f[d][1],m],["enter",y,m]],v=m.parser.constructs.insideSpan.null;v&&Gn(b,b.length,0,Bc(v,f.slice(d+1,p),m)),Gn(b,b.length,0,[["exit",y,m],["enter",f[p][1],m],["exit",f[p][1],m],["exit",g,m]]),Gn(f,d-1,p-d+3,b),p=d+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 d=this.previous,g=this.events;let y=0;return b;function b(j){return d===126&&g[g.length-1][1].type!=="characterEscape"?p(j):(f.enter("strikethroughSequenceTemporary"),v(j))}function v(j){const k=oi(d);if(j===126)return y>1?p(j):(f.consume(j),y++,v);if(y<2&&!r)return p(j);const C=f.exit("strikethroughSequenceTemporary"),E=oi(j);return C._open=!E||E===2&&!!k,C._close=!k||k===2&&!!E,m(j)}}}class cS{constructor(){this.map=[]}add(l,r,i){uS(this,l,r,i)}consume(l){if(this.map.sort(function(u,f){return u[0]-f[0]}),this.map.length===0)return;let r=this.map.length;const i=[];for(;r>0;)r-=1,i.push(l.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),l.length=this.map[r][0];i.push(l.slice()),l.length=0;let c=i.pop();for(;c;){for(const u of c)l.push(u);c=i.pop()}this.map.length=0}}function uS(t,l,r,i){let c=0;if(!(r===0&&i.length===0)){for(;c<t.map.length;){if(t.map[c][0]===l){t.map[c][1]+=r,t.map[c][2].push(...i);return}c+=1}t.map.push([l,r,i])}}function fS(t,l){let r=!1;const i=[];for(;l<t.length;){const c=t[l];if(r){if(c[0]==="enter")c[1].type==="tableContent"&&i.push(t[l+1][1].type==="tableDelimiterMarker"?"left":"none");else if(c[1].type==="tableContent"){if(t[l-1][1].type==="tableDelimiterMarker"){const u=i.length-1;i[u]=i[u]==="left"?"center":"right"}}else if(c[1].type==="tableDelimiterRow")break}else c[0]==="enter"&&c[1].type==="tableDelimiterRow"&&(r=!0);l+=1}return i}function dS(){return{flow:{null:{name:"table",tokenize:hS,resolveAll:mS}}}}function hS(t,l,r){const i=this;let c=0,u=0,f;return m;function m(M){let q=i.events.length-1;for(;q>-1;){const ee=i.events[q][1].type;if(ee==="lineEnding"||ee==="linePrefix")q--;else break}const F=q>-1?i.events[q][1].type:null,W=F==="tableHead"||F==="tableRow"?D:p;return W===D&&i.parser.lazy[i.now().line]?r(M):W(M)}function p(M){return t.enter("tableHead"),t.enter("tableRow"),d(M)}function d(M){return M===124||(f=!0,u+=1),g(M)}function g(M){return M===null?r(M):Ie(M)?u>1?(u=0,i.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),v):r(M):it(M)?dt(t,g,"whitespace")(M):(u+=1,f&&(f=!1,c+=1),M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),f=!0,g):(t.enter("data"),y(M)))}function y(M){return M===null||M===124||zt(M)?(t.exit("data"),g(M)):(t.consume(M),M===92?b:y)}function b(M){return M===92||M===124?(t.consume(M),y):y(M)}function v(M){return i.interrupt=!1,i.parser.lazy[i.now().line]?r(M):(t.enter("tableDelimiterRow"),f=!1,it(M)?dt(t,j,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):j(M))}function j(M){return M===45||M===58?C(M):M===124?(f=!0,t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),k):L(M)}function k(M){return it(M)?dt(t,C,"whitespace")(M):C(M)}function C(M){return M===58?(u+=1,f=!0,t.enter("tableDelimiterMarker"),t.consume(M),t.exit("tableDelimiterMarker"),E):M===45?(u+=1,E(M)):M===null||Ie(M)?O(M):L(M)}function E(M){return M===45?(t.enter("tableDelimiterFiller"),A(M)):L(M)}function A(M){return M===45?(t.consume(M),A):M===58?(f=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(M),t.exit("tableDelimiterMarker"),R):(t.exit("tableDelimiterFiller"),R(M))}function R(M){return it(M)?dt(t,O,"whitespace")(M):O(M)}function O(M){return M===124?j(M):M===null||Ie(M)?!f||c!==u?L(M):(t.exit("tableDelimiterRow"),t.exit("tableHead"),l(M)):L(M)}function L(M){return r(M)}function D(M){return t.enter("tableRow"),U(M)}function U(M){return M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),U):M===null||Ie(M)?(t.exit("tableRow"),l(M)):it(M)?dt(t,U,"whitespace")(M):(t.enter("data"),X(M))}function X(M){return M===null||M===124||zt(M)?(t.exit("data"),U(M)):(t.consume(M),M===92?ne:X)}function ne(M){return M===92||M===124?(t.consume(M),X):X(M)}}function mS(t,l){let r=-1,i=!0,c=0,u=[0,0,0,0],f=[0,0,0,0],m=!1,p=0,d,g,y;const b=new cS;for(;++r<t.length;){const v=t[r],j=v[1];v[0]==="enter"?j.type==="tableHead"?(m=!1,p!==0&&(l0(b,l,p,d,g),g=void 0,p=0),d={type:"table",start:Object.assign({},j.start),end:Object.assign({},j.end)},b.add(r,0,[["enter",d,l]])):j.type==="tableRow"||j.type==="tableDelimiterRow"?(i=!0,y=void 0,u=[0,0,0,0],f=[0,r+1,0,0],m&&(m=!1,g={type:"tableBody",start:Object.assign({},j.start),end:Object.assign({},j.end)},b.add(r,0,[["enter",g,l]])),c=j.type==="tableDelimiterRow"?2:g?3:1):c&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")?(i=!1,f[2]===0&&(u[1]!==0&&(f[0]=f[1],y=ic(b,l,u,c,void 0,y),u=[0,0,0,0]),f[2]=r)):j.type==="tableCellDivider"&&(i?i=!1:(u[1]!==0&&(f[0]=f[1],y=ic(b,l,u,c,void 0,y)),u=f,f=[u[1],r,0,0])):j.type==="tableHead"?(m=!0,p=r):j.type==="tableRow"||j.type==="tableDelimiterRow"?(p=r,u[1]!==0?(f[0]=f[1],y=ic(b,l,u,c,r,y)):f[1]!==0&&(y=ic(b,l,f,c,r,y)),c=0):c&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")&&(f[3]=r)}for(p!==0&&l0(b,l,p,d,g),b.consume(l.events),r=-1;++r<l.events.length;){const v=l.events[r];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=fS(l.events,r))}return t}function ic(t,l,r,i,c,u){const f=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",m="tableContent";r[0]!==0&&(u.end=Object.assign({},ii(l.events,r[0])),t.add(r[0],0,[["exit",u,l]]));const p=ii(l.events,r[1]);if(u={type:f,start:Object.assign({},p),end:Object.assign({},p)},t.add(r[1],0,[["enter",u,l]]),r[2]!==0){const d=ii(l.events,r[2]),g=ii(l.events,r[3]),y={type:m,start:Object.assign({},d),end:Object.assign({},g)};if(t.add(r[2],0,[["enter",y,l]]),i!==2){const b=l.events[r[2]],v=l.events[r[3]];if(b[1].end=Object.assign({},v[1].end),b[1].type="chunkText",b[1].contentType="text",r[3]>r[2]+1){const j=r[2]+1,k=r[3]-r[2]-1;t.add(j,k,[])}}t.add(r[3]+1,0,[["exit",y,l]])}return c!==void 0&&(u.end=Object.assign({},ii(l.events,c)),t.add(c,0,[["exit",u,l]]),u=void 0),u}function l0(t,l,r,i,c){const u=[],f=ii(l.events,r);c&&(c.end=Object.assign({},f),u.push(["exit",c,l])),i.end=Object.assign({},f),u.push(["exit",i,l]),t.add(r+1,0,u)}function ii(t,l){const r=t[l],i=r[0]==="enter"?"start":"end";return r[1][i]}const xS={name:"tasklistCheck",tokenize:yS};function pS(){return{text:{91:xS}}}function yS(t,l,r){const i=this;return c;function c(p){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?r(p):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(p),t.exit("taskListCheckMarker"),u)}function u(p){return zt(p)?(t.enter("taskListCheckValueUnchecked"),t.consume(p),t.exit("taskListCheckValueUnchecked"),f):p===88||p===120?(t.enter("taskListCheckValueChecked"),t.consume(p),t.exit("taskListCheckValueChecked"),f):r(p)}function f(p){return p===93?(t.enter("taskListCheckMarker"),t.consume(p),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),m):r(p)}function m(p){return Ie(p)?l(p):it(p)?t.check({tokenize:gS},l,r)(p):r(p)}}function gS(t,l,r){return dt(t,i,"whitespace");function i(c){return c===null?r(c):l(c)}}function bS(t){return iy([q4(),eS(),oS(t),dS(),pS()])}const vS={};function Zy(t){const l=this,r=t||vS,i=l.data(),c=i.micromarkExtensions||(i.micromarkExtensions=[]),u=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),f=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);c.push(bS(r)),u.push(H4()),f.push(U4(r))}function Hs({content:t,className:l=""}){return o.jsx("div",{className:`office-markdown ${l}`,children:o.jsx(Ny,{remarkPlugins:[Zy],components:{code:wS,table:({children:r})=>o.jsx("div",{className:"overflow-x-auto my-2",children:o.jsx("table",{className:"office-table",children:r})})},children:t})})}function wS({className:t,children:l,...r}){const i=/language-(\w+)/.exec(t??"");return i||typeof l=="string"&&l.includes(`
79
- `)?o.jsx(kS,{language:i==null?void 0:i[1],children:l}):o.jsx("code",{className:"bg-gray-100 text-gray-700 px-1 py-0.5 rounded text-[0.9em] font-mono",...r,children:l})}function kS({children:t,language:l}){const[r,i]=S.useState(!1),c=String(t).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(c),i(!0),setTimeout(()=>i(!1),1500)};return o.jsxs("div",{className:"office-code-block group relative my-2",children:[l&&o.jsx("div",{className:"text-[10px] text-gray-400 px-3 pt-1.5",children:l}),o.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:r?"Copied!":"Copy"}),o.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:o.jsx("code",{children:c})})]})}const r0={$skin:"skinColor",$hair:"hairColor",$shirt:"shirtColor",$pants:"pantsColor",$shoes:"shoeColor"},SS=/^(darken|lighten)\((\$\w+),\s*(\d+)\)$/;function jS(t,l){const r=parseInt(t.replace("#",""),16),i=Math.max(0,(r>>16&255)-l),c=Math.max(0,(r>>8&255)-l),u=Math.max(0,(r&255)-l);return`#${(i<<16|c<<8|u).toString(16).padStart(6,"0")}`}function CS(t,l){const r=parseInt(t.replace("#",""),16),i=Math.min(255,(r>>16&255)+l),c=Math.min(255,(r>>8&255)+l),u=Math.min(255,(r&255)+l);return`#${(i<<16|c<<8|u).toString(16).padStart(6,"0")}`}function Jy(t,l){const r=r0[t];if(r&&l)return l[r];const i=SS.exec(t);if(i){const[,c,u,f]=i,m=r0[u],p=m&&l?l[m]:u,d=parseInt(f,10);return c==="darken"?jS(p,d):CS(p,d)}return t}function a0(t,l=12){return t.map(r=>({...r,x:l-r.x-r.w}))}function ES(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:a0(t.left.pixels)}:l==="left"&&t.right?{name:t.right.name,pixels:a0(t.right.pixels)}:t.down}function NS(t,l){return Kd(t,"hair",l,1)}function Kd(t,l,r,i){const c=t.layers.findIndex(f=>f.name===l),u=[...t.layers];if(c>=0)u[c]={...r,name:l};else{const f=i??u.length;u.splice(f,0,{...r,name:l})}return{...t,layers:u}}const vh=new Map,wh=new Map;function Py(t,l){vh.set(t,l)}function Uc(t,l){wh.set(t,l)}function Qd(t){return vh.get(t)}function AS(t){return wh.get(t)}function bN(){return Array.from(vh.keys())}function vN(){return Array.from(wh.keys())}function TS(t,l,r,i,c=2){t.clearRect(0,0,l.width*c,l.height*c);for(const u of l.layers)eg(t,u.pixels,c,r,i)}function Wd(t,l,r,i,c){for(const u of l){const f=Jy(u.c,c);u.a!==void 0&&u.a!==1&&(t.globalAlpha=u.a),t.fillStyle=f,t.fillRect(r+u.x,i+u.y,u.w,u.h),u.a!==void 0&&u.a!==1&&(t.globalAlpha=1)}}function DS(t,l){const r=l.scale;t.clearRect(0,0,l.canvasWidth,l.canvasHeight),eg(t,l.pixels,r,0)}function eg(t,l,r,i,c){for(const u of l){const f=Jy(u.c,c);u.a!==void 0&&u.a!==1&&(t.globalAlpha=u.a),t.fillStyle=f,t.fillRect(u.x*r,(u.y+i)*r,u.w*r,u.h*r),u.a!==void 0&&u.a!==1&&(t.globalAlpha=1)}}const Tc=new Map;function Ir(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Tc.set(t,{id:t,name:l,layer:{...c.down,name:"hair"},directions:{down:{...c.down,name:"hair"},up:c.up?{...c.up,name:"hair"}:void 0,left:c.left?{...c.left,name:"hair"}:void 0,right:c.right?{...c.right,name:"hair"}:void 0}})}else{const c=r;Tc.set(t,{id:t,name:l,layer:{...c,name:"hair"}})}}function zS(t){return Tc.get(t)}function tg(){return Array.from(Tc.values())}Ir("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}]}});Ir("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}]}});Ir("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}]}});Ir("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}]}});Ir("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"}]}});Ir("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}]}});Ir("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}]}});Ir("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 Dc=new Map;function Al(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Dc.set(t,{id:t,name:l,layer:{...c.down,name:"torso"},directions:{down:{...c.down,name:"torso"},up:c.up?{...c.up,name:"torso"}:void 0,left:c.left?{...c.left,name:"torso"}:void 0,right:c.right?{...c.right,name:"torso"}:void 0}})}else{const c=r;Dc.set(t,{id:t,name:l,layer:{...c,name:"torso"}})}}function MS(t){return Dc.get(t)}function ng(){return Array.from(Dc.values())}Al("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"}]}});Al("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"}]}});Al("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"}]}});Al("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)"}]}});Al("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)"}]}});Al("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"}]}});Al("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"}]}});Al("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"}]}});Al("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"}]}});Al("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 Rs=new Map;function vt(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Rs.set(t,{id:t,name:l,layer:{...c.down,name:"accessory"},directions:{down:{...c.down,name:"accessory"},up:c.up?{...c.up,name:"accessory"}:void 0,left:c.left?{...c.left,name:"accessory"}:void 0,right:c.right?{...c.right,name:"accessory"}:void 0}})}else{const c=r;Rs.set(t,{id:t,name:l,layer:{...c,name:"accessory"}})}}function RS(t){return Rs.get(t)}function FS(t,l){const r=Rs.get(t);if(!r)return;if(r.directions)return ES(r.directions,l);if(l==="down")return r.layer;const i=r.layer.pixels.filter(u=>u.y<2);if(i.length===0)return;const c=l==="right"?1:l==="left"?-1:0;return{name:r.layer.name,pixels:c?i.map(u=>({...u,x:u.x+c})):i}}function lg(){return Array.from(Rs.values())}vt("none","None",{name:"accessory",pixels:[]});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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"}]}});vt("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}]}});vt("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}]}});vt("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"}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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"}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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"}]}});vt("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"}]}});vt("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}]}});vt("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}]}});vt("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 _S={none:1,glasses:1,beret:1,cap:1,badge:1,blush:1,lapels:1,"round-glasses":2,headphones:2,scarf:3,tie:3,bowtie:3,sunglasses:4,bandana:4,eyepatch:4,crown:5,halo:5,horns:5,mask:5,"cat-ears":6,"bear-ears":6,"bunny-ears":6,"dog-nose":6,"fox-mask":6,"cat-face":7,"bear-face":7,"panda-face":7,"frog-face":8,"rabbit-face":8,"dog-face":8,"star-glasses":9};function rg(t){return _S[t]??1}function ag(t,l){return l>=rg(t)}vt("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 ys({r:t,g:l,b:r}){return`#${(t<<16|l<<8|r).toString(16).padStart(6,"0")}`}function vc(t,l){const r=t.r-l.r,i=t.g-l.g,c=t.b-l.b;return r*r+i*i+c*c}function OS(t,l){const r=[];r.push(t[Math.floor(Math.random()*t.length)]);for(let i=1;i<l;i++){const c=t.map(m=>{let p=1/0;for(const d of r)p=Math.min(p,vc(m,d));return p}),u=c.reduce((m,p)=>m+p,0);let f=Math.random()*u;for(let m=0;m<t.length;m++)if(f-=c[m],f<=0){r.push(t[m]);break}r.length<=i&&r.push(t[Math.floor(Math.random()*t.length)])}return r}function BS(t,l,r=20){if(t.length===0)return[];const i=OS(t,l);for(let u=0;u<r;u++){const f=Array.from({length:l},()=>[]);for(const p of t){let d=1/0,g=0;for(let y=0;y<l;y++){const b=vc(p,i[y]);b<d&&(d=b,g=y)}f[g].push(p)}let m=!0;for(let p=0;p<l;p++){if(f[p].length===0)continue;const d={r:0,g:0,b:0};for(const b of f[p])d.r+=b.r,d.g+=b.g,d.b+=b.b;const g=f[p].length,y={r:Math.round(d.r/g),g:Math.round(d.g/g),b:Math.round(d.b/g)};vc(y,i[p])>1&&(m=!1),i[p]=y}if(m)break}const c=new Array(l).fill(0);for(const u of t){let f=1/0,m=0;for(let p=0;p<l;p++){const d=vc(u,i[p]);d<f&&(f=d,m=p)}c[m]++}return i.map((u,f)=>({c:u,count:c[f]})).sort((u,f)=>f.count-u.count).map(u=>u.c)}function LS(t,l=1e4){const r=document.createElement("canvas"),i=t instanceof HTMLImageElement?t.naturalWidth:t.width,c=t instanceof HTMLImageElement?t.naturalHeight:t.height;r.width=i,r.height=c;const u=r.getContext("2d");u.drawImage(t,0,0);const f=u.getImageData(0,0,i,c).data,m=i*c,p=Math.max(1,Math.floor(m/l)),d=[];for(let g=0;g<m;g+=p){const y=g*4;f[y+3]<128||d.push({r:f[y],g:f[y+1],b:f[y+2]})}return d}function i0(t){return .299*t.r+.587*t.g+.114*t.b}function s0(t){const l=Math.max(t.r,t.g,t.b),r=Math.min(t.r,t.g,t.b);return l===0?0:(l-r)/l*255}function $S(t,l=8){const r=LS(t),i=BS(r,l);if(i.length<5)return{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121"};const c=[...i].sort((y,b)=>i0(b)-i0(y)),u=[...i].sort((y,b)=>s0(b)-s0(y)),f=c[0],m=c[c.length-1],p=u[0],d=c[c.length-2],g=c[c.length-1];return{skinColor:ys(f),hairColor:ys(m),shirtColor:ys(p),pantsColor:ys(d),shoeColor:ys(g)}}const HS=[{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}],US=[{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"}],IS=[{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"}],YS=[{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 qS(){return{width:12,height:22,layers:[{name:"lower",pixels:HS},{name:"torso",pixels:US},{name:"head",pixels:IS},{name:"hair",pixels:YS},{name:"accessory",pixels:[]}]}}const XS=["cto","cbo","pm","engineer","designer","qa","data-analyst","default"];for(const t of XS)Py(`mini:${t}`,qS());const VS=[{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"}],GS=[{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"}],KS=[{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 QS(){return{width:12,height:22,layers:[{name:"torso",pixels:VS},{name:"head",pixels:GS},{name:"hair",pixels:KS},{name:"accessory",pixels:[]}]}}Py("mini-seated:default",QS());const WS={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"}]},ZS={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"}]},JS={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"}]},PS={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"}]};Uc("meeting",WS);Uc("bulletin",ZS);Uc("decision",PS);Uc("knowledge",JS);const pd=16,yd=24,ej=60,tj={cbo:0,cto:8,pm:15,engineer:22,designer:5,qa:12};function ig(t,l){if(!t)return t;let r=t;if(l!=null&&l.hairStyle){const i=zS(l.hairStyle);i&&(r=NS(r,i.layer))}if(l!=null&&l.outfitStyle){const i=MS(l.outfitStyle);i&&(r=Kd(r,"torso",i.layer,1))}if(l!=null&&l.accessory&&l.accessory!=="none"){const i=RS(l.accessory);i&&(r=Kd(r,"accessory",i.layer))}return r}function Ic({roleId:t,className:l,appearance:r,scale:i}){const c=S.useRef(null),u=S.useRef(0),f=S.useRef(0),m=S.useRef(r);m.current=r;const p=i??4,d=pd*p,g=yd*p,y=S.useMemo(()=>{const b=Qd(`mini:${t}`)??Qd("mini:default");return ig(b,r)},[t,r==null?void 0:r.hairStyle,r==null?void 0:r.outfitStyle,r==null?void 0:r.accessory]);return S.useEffect(()=>{const b=c.current;if(!b)return;const v=b.getContext("2d");if(!v)return;const j=tj[t]??0,k=()=>{f.current++;const C=m.current;if(!C||!y){u.current=requestAnimationFrame(k);return}const A=(f.current+j)%ej<30?1:0;v.clearRect(0,0,pd,yd),v.save(),v.translate(2,1),TS(v,y,A,C,1),v.restore(),u.current=requestAnimationFrame(k)};return u.current=requestAnimationFrame(k),()=>cancelAnimationFrame(u.current)},[t,y]),o.jsx("canvas",{ref:c,width:pd,height:yd,className:l,style:{imageRendering:"pixelated",display:"block",width:d,height:g}})}const nj="https://api.tycono.ai",kh=nj;async function sc(t){const l=await fetch(`${kh}${t}`);if(!l.ok)throw new Error(`Cloud API error: ${l.status}`);return l.json()}async function oc(t,l){const r=await fetch(`${kh}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw new Error(`Cloud API error: ${r.status}`);return r.json()}const Ts={health:()=>sc("/api/health"),getCharacters:()=>sc("/api/store/characters"),getCharacter:t=>sc(`/api/store/characters/${t}`),getCharacterVersion:t=>sc(`/api/store/characters/${t}/version`),syncCheck:t=>oc("/api/sync/check",{roles:t}),syncPull:t=>oc("/api/sync/pull",{sourceId:t}),publishCharacter:t=>oc("/api/store/publish",t),deleteCharacter:t=>fetch(`${kh}/api/store/characters/${t}`,{method:"DELETE"}).then(l=>l.json()),uploadTelemetry:t=>oc("/api/telemetry",t)},lj={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"},gd={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},rj={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},aj=500,o0=360,c0=700,ij=t=>`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`;function sj({role:t,allRoles:l,recentActivity:r,onClose:i,onFireRole:c,terminalWidth:u=0,activeJobId:f,activeTask:m,isWorking:p,jobStartedAt:d,onStopJob:g,sessions:y,streamingSessionId:b,onCreateSessionSilent:v,onSendMessage:j,onFocusTerminal:k,onCustomize:C,onUpdateRole:E,appearance:A,relationships:R,roleLevel:O}){var De,Ue;const[L,D]=S.useState(aj),[U,X]=S.useState(!1),ne=S.useRef(0),M=S.useRef(0),[q,F]=S.useState(!1),[W,ee]=S.useState(!1),[V,I]=S.useState(!1),[Z,ce]=S.useState(!1),[we,z]=S.useState("talk"),[B,Q]=S.useState(!1),[T,me]=S.useState(""),[Se,Ee]=S.useState(!1),Be=S.useRef(null),{events:He,status:Ke}=X0(f??null),[ke,yt]=S.useState(0);S.useEffect(()=>{if(!p||!d){yt(0);return}const ye=new Date(d).getTime(),je=()=>yt(Math.floor((Date.now()-ye)/1e3));je();const jt=setInterval(je,1e3);return()=>clearInterval(jt)},[p,d]);const de=u>0,G=de?u:0,re=de?Math.max(o0,window.innerWidth-u-100):c0,ve=Math.min(L,re),ze=S.useCallback(ye=>{ye.preventDefault(),ne.current=ye.clientX,M.current=ve,X(!0);const je=wt=>{const Xe=ne.current-wt.clientX,ft=Math.min(c0,Math.max(o0,M.current+Xe));D(ft)},jt=()=>{X(!1),document.removeEventListener("mousemove",je),document.removeEventListener("mouseup",jt)};document.addEventListener("mousemove",je),document.addEventListener("mouseup",jt)},[ve]),Ne=S.useRef(null),Te=t?y.find(ye=>ye.roleId===t.id):null,Me=ye=>{if(!t)return;const je=p?"talk":we;Te?(j(Te.id,ye,je),k(t.id)):(Ne.current={content:ye,mode:je},v(t.id))};S.useEffect(()=>{if(Te&&Ne.current){const{content:ye,mode:je}=Ne.current;Ne.current=null,j(Te.id,ye,je),t&&k(t.id)}},[Te==null?void 0:Te.id]);const Oe=(()=>{if(!He.length)return null;const ye=[];let je=0,jt=0,wt=0;for(const Xe of He)if(Xe.type==="thinking")je++;else if(Xe.type==="text")jt++;else if(Xe.type==="tool:start"){const ft=String(Xe.data.name??"");ye.includes(ft)||ye.push(ft)}else Xe.type==="dispatch:start"&&wt++;return{tools:ye,thinkCount:je,textCount:jt,dispatchCount:wt,total:He.length}})(),tt=m||(()=>{if(!Te)return null;const ye=Te.messages;for(let je=ye.length-1;je>=0;je--)if(ye[je].from==="ceo")return ye[je].content;return null})(),Lt=(()=>{if(!Te)return null;const ye=Te.messages;for(let je=ye.length-1;je>=0;je--)if(ye[je].from==="role"&&ye[je].content)return ye[je].content;return null})();if(!t)return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:G},onClick:i}),o.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px]",style:{right:G,width:ve,background:"var(--terminal-bg)",borderLeftColor:"var(--pixel-border)"},children:o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading role..."})})]});const gt=gd[t.id]??"#666",ht=lj[t.id]??"👤",Zt=l.filter(ye=>ye.reportsTo===t.id),ae=Te&&b===Te.id,xe=t.name||rj[t.id]||t.id;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:G},onClick:i}),o.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)] ${U?"resizing":""}`,style:{borderLeftColor:gt,right:G,width:ve,background:"var(--terminal-bg)"},children:[o.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${U?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:ze}),o.jsxs("div",{className:"relative shrink-0 overflow-hidden",style:{background:`linear-gradient(135deg, ${gt}ee, ${gt}99)`},children:[o.jsx("div",{className:"absolute inset-0 opacity-[0.06]",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 8px, white 8px, white 9px)"}}),o.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-1.5 z-10",children:[C&&o.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:"🎨"}),o.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:"×"})]}),o.jsxs("div",{className:"relative flex items-end gap-4 px-4 pt-4 pb-3",children:[o.jsx("div",{className:"shrink-0 relative",style:{marginBottom:-2},children:o.jsx("div",{className:"rounded-lg p-1",style:{background:"rgba(0,0,0,0.2)"},children:o.jsx(Ic,{roleId:t.id,appearance:A,scale:8})})}),o.jsxs("div",{className:"flex-1 min-w-0 text-white pb-1",children:[o.jsxs("div",{className:"text-lg font-bold flex items-center gap-2",style:{fontFamily:"var(--pixel-font)"},children:[ht," ",t.id.toUpperCase(),p&&o.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"})]}),B?o.jsxs("form",{className:"flex items-center gap-1.5 mt-0.5",onSubmit:async ye=>{ye.preventDefault();const je=T.trim();if(!je||je===xe||!E){Q(!1);return}Ee(!0);try{await E(t.id,{name:je})}catch{}Ee(!1),Q(!1)},children:[o.jsx("input",{ref:Be,value:T,onChange:ye=>me(ye.target.value),onKeyDown:ye=>{ye.key==="Escape"&&Q(!1)},disabled:Se,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"}}),o.jsx("button",{type:"submit",disabled:Se,className:"text-white/80 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✓"}),o.jsx("button",{type:"button",onClick:()=>Q(!1),className:"text-white/60 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✕"})]}):o.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&&(me(xe),Q(!0))},title:E?"Click to edit name":void 0,children:[xe,E&&o.jsx("span",{className:"opacity-0 group-hover/name:opacity-60 text-[10px]",children:"✎"})]})]})]}),o.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:[o.jsxs("span",{children:["Lv.",O??1]}),o.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),o.jsxs("span",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:p?"var(--idle-amber)":"var(--active-green)"}}),p?"Working":"Idle"]}),o.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),o.jsx("span",{children:t.level}),t.reportsTo&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),o.jsxs("span",{className:"opacity-60",children:["→"," ",t.reportsTo]})]})]})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:[p&&o.jsxs("div",{className:"px-4 py-3 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"var(--idle-amber)"}}),o.jsxs("span",{className:"text-xs font-semibold",style:{color:"var(--idle-amber)"},children:["Working",ke>0?` · ${ij(ke)}`:""]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>k(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"}),f&&g&&o.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"})]})]}),tt&&o.jsx("div",{className:"text-xs truncate",style:{color:"var(--terminal-text-secondary)"},children:tt})]}),p&&f&&Oe&&o.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Activity"}),o.jsx("button",{onClick:()=>k(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"View details ↗"})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[Oe.thinkCount>0&&o.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:[o.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:"#a855f7"}}),"thinking ×",Oe.thinkCount]}),Oe.tools.map(ye=>o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa"},children:ye},ye)),Oe.dispatchCount>0&&o.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(249,115,22,0.15)",color:"#fb923c"},children:["dispatch ×",Oe.dispatchCount]}),Oe.textCount>0&&o.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(34,197,94,0.15)",color:"#4ade80"},children:["output ×",Oe.textCount]}),(Ke==="streaming"||Ke==="connecting")&&o.jsx("span",{className:"inline-block w-1.5 h-3 animate-pulse rounded-sm",style:{background:"var(--active-green)"}})]}),o.jsxs("div",{className:"text-[10px] mt-1",style:{color:"var(--terminal-text-muted)"},children:[Oe.total," events"]})]}),p&&Lt&&o.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Last Message"}),o.jsx("button",{onClick:()=>k(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"})]}),o.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:[Lt.slice(0,200),Lt.length>200&&"..."]})]}),p&&o.jsx("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:o.jsx(u0,{onSend:Me,disabled:!!ae,placeholder:"Ask something...",color:gt})}),!p&&o.jsxs("div",{className:"px-4 pt-4 pb-2",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-secondary)"},children:"Latest"}),o.jsx(cj,{icon:ht,roleId:t.id,roleName:xe,color:gt,text:r})]}),!p&&o.jsx("div",{className:"px-4 py-3",style:{borderBottom:"1px solid var(--terminal-border)"},children:o.jsxs("div",{className:"rounded-xl overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[Lt&&o.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:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Last response"}),o.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"View ↗"})]}),o.jsxs("div",{className:"text-xs leading-relaxed line-clamp-2 overflow-hidden",style:{color:"var(--terminal-text-secondary)"},children:[Lt.slice(0,150),Lt.length>150&&"..."]})]}),o.jsx("div",{className:"p-2",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("div",{className:"flex rounded-lg overflow-hidden shrink-0",style:{border:"1px solid var(--pixel-border)"},children:[o.jsx("button",{onClick:()=>z("talk"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:we==="talk"?"var(--accent)":"transparent",color:we==="talk"?"#fff":"var(--terminal-text-secondary)"},children:"Talk"}),o.jsx("button",{onClick:()=>z("do"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:we==="do"?"var(--idle-amber)":"transparent",color:we==="do"?"#fff":"var(--terminal-text-secondary)"},children:"Do"})]}),o.jsx(u0,{onSend:Me,disabled:!!ae,placeholder:we==="talk"?"Ask something...":"Give a directive...",color:gt})]})})]})}),o.jsxs("div",{className:"px-4 py-2 space-y-1",children:[o.jsxs(cc,{title:`Profile${t.persona?"":" (empty)"}`,open:q,onToggle:()=>F(ye=>!ye),children:[t.persona&&o.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}),o.jsxs("div",{className:"space-y-0 mt-2",children:[o.jsx(bd,{label:"Level",value:t.level}),o.jsx(bd,{label:"Reports to",value:t.reportsTo}),o.jsx(bd,{label:"Status",value:t.status})]}),Zt.length>0&&o.jsxs("div",{className:"mt-3",children:[o.jsx("div",{className:"text-[11px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Direct Reports"}),o.jsx("div",{className:"space-y-1",children:Zt.map(ye=>o.jsxs("div",{className:"flex items-center gap-2 p-1.5 rounded-lg",style:{background:"var(--hud-bg-alt)"},children:[o.jsx("div",{className:"w-6 h-6 rounded flex items-center justify-center text-white text-[10px] font-bold",style:{background:gd[ye.id]??"#666"},children:ye.id.slice(0,2).toUpperCase()}),o.jsx("div",{className:"text-xs",style:{color:"var(--terminal-text)"},children:ye.name})]},ye.id))})]})]}),t.authority&&o.jsxs(cc,{title:"Authority",open:W,onToggle:()=>ee(ye=>!ye),children:[((De=t.authority.autonomous)==null?void 0:De.length)>0&&o.jsxs("div",{className:"mb-2",children:[o.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--active-green)"},children:"Autonomous"}),t.authority.autonomous.map((ye,je)=>o.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",ye]},je))]}),((Ue=t.authority.needsApproval)==null?void 0:Ue.length)>0&&o.jsxs("div",{children:[o.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--idle-amber)"},children:"Needs Approval"}),t.authority.needsApproval.map((ye,je)=>o.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",ye]},je))]})]}),t&&R&&(()=>{const ye=R.filter(je=>je.roleA===t.id||je.roleB===t.id).filter(je=>je.familiarity>0).sort((je,jt)=>jt.familiarity-je.familiarity);return ye.length===0?null:o.jsx(cc,{title:`Relationships (${ye.length})`,open:V,onToggle:()=>I(je=>!je),children:o.jsx("div",{className:"space-y-1.5",children:ye.map((je,jt)=>{const wt=je.roleA===t.id?je.roleB:je.roleA,Xe=l.find(Mt=>Mt.id===wt),ft=je.familiarity>=80?"Best Partner":je.familiarity>=50?"Friend":je.familiarity>=20?"Colleague":"Acquaintance",fe=je.familiarity>=80?"#4CAF50":je.familiarity>=50?"#2196F3":je.familiarity>=20?"#FF9800":"#9E9E9E";return o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs w-20 truncate",style:{color:gd[wt]??"var(--terminal-text-secondary)"},children:(Xe==null?void 0:Xe.name)??wt}),o.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-white/10",children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${je.familiarity}%`,background:fe}})}),o.jsx("span",{className:"text-[10px] w-16 text-right",style:{color:"var(--terminal-text-muted)"},children:ft})]},jt)})})})})(),t.journal&&o.jsx(cc,{title:`Journal (${(t.journal.match(/### /g)??[]).length})`,open:Z,onToggle:()=>ce(ye=>!ye),children:o.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:[o.jsx(Hs,{content:t.journal.slice(0,3e3)}),t.journal.length>3e3&&o.jsx("div",{className:"italic mt-2",style:{color:"var(--terminal-text-muted)"},children:"... (truncated)"})]})})]}),o.jsx(oj,{role:t,appearance:A}),c&&o.jsx("div",{className:"px-4 pb-4 mt-auto shrink-0",children:o.jsx("button",{onClick:()=>{c(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 oj({role:t,appearance:l}){const[r,i]=S.useState("idle"),[c,u]=S.useState(""),[f,m]=S.useState(!1),p=async()=>{var d,g;if(!f){m(!0);return}i("publishing");try{let y=null;try{y=await Ce.exportSkills(t.id)}catch{}const b={roleId:t.id,persona:t.persona??"",authority:t.authority??{autonomous:[],needsApproval:[]},level:t.level,tagline:((d=(t.persona??"").split(/[.\n]/)[0])==null?void 0:d.trim().slice(0,80))||t.name,chatStyle:"Professional and focused",skills:y??[],resume:{summary:((g=t.persona)==null?void 0:g.split(`
80
- `)[0])??"",strengths:[],specialties:[],experience:""},author:{id:"tycono",name:"Tycono"},tags:[t.level,t.id],price:"free",installs:0,rating:0,featured:!1,randomActive:!0,randomPersonality:""};l&&(b.appearance=l);let v="1.0.0";try{const j=await Ts.getCharacterVersion(t.id);if(j!=null&&j.version){const k=j.version.split(".").map(Number);k[2]=(k[2]??0)+1,v=k.join(".")}}catch{}await Ts.publishCharacter({id:t.id,name:t.name||t.id,version:v,data:b}),i("done"),u(`Published v${v}`),m(!1)}catch(y){i("error"),u(y instanceof Error?y.message:"Failed"),m(!1)}};return o.jsx("div",{className:"px-4 pb-2 shrink-0",children:o.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:o.jsxs("div",{className:"px-3 py-2.5 flex items-center justify-between",style:{background:"var(--hud-bg-alt)"},children:[o.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Cloud Store"}),r==="done"?o.jsx("span",{className:"text-[10px] font-semibold",style:{color:"var(--active-green)"},children:c}):r==="error"?o.jsx("span",{className:"text-[10px] font-semibold",style:{color:"#ef4444"},children:c}):o.jsx("button",{onClick:p,disabled:r==="publishing",className:"text-[10px] px-2.5 py-1 rounded font-semibold cursor-pointer transition-colors disabled:opacity-50",style:{background:f?"rgba(59,130,246,0.3)":"rgba(59,130,246,0.15)",color:"#60a5fa",border:f?"1px solid rgba(59,130,246,0.5)":"1px solid transparent"},children:r==="publishing"?"Publishing...":f?"Confirm Publish?":"Publish to Store"})]})})})}function cj({icon:t,roleId:l,roleName:r,color:i,text:c}){const u=!!c;return o.jsx("div",{className:"relative",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsxs("div",{className:"shrink-0",children:[o.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}),o.jsx("div",{className:"text-[9px] font-bold text-center mt-0.5 uppercase tracking-wide",style:{color:i},children:l})]}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsxs("div",{className:"relative",children:[o.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`}}),o.jsxs("div",{className:"rounded-xl rounded-tl-sm p-4 border",style:{background:`${i}08`,borderColor:`${i}22`},children:[o.jsx("div",{className:"text-[10px] font-semibold mb-1.5 uppercase tracking-wider",style:{color:i},children:r}),u?o.jsx("div",{className:"text-sm leading-relaxed",style:{color:"var(--terminal-text)"},children:o.jsx(Hs,{content:c})}):o.jsx("div",{className:"text-sm italic",style:{color:"var(--terminal-text-muted)"},children:"No recent activity."})]})]})})]})})}function cc({title:t,open:l,onToggle:r,children:i}){return o.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:[o.jsxs("button",{onClick:r,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:[o.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:t}),o.jsx("span",{className:"text-[10px] transition-transform",style:{color:"var(--terminal-text-muted)",transform:l?"rotate(0deg)":"rotate(-90deg)"},children:"▼"})]}),l&&o.jsx("div",{className:"px-3 pb-3 pt-2",style:{borderTop:"1px solid var(--terminal-border)"},children:i})]})}function u0({onSend:t,disabled:l,placeholder:r,color:i}){const[c,u]=S.useState(""),f=()=>{const m=c.trim();!m||l||(t(m),u(""))};return o.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[o.jsx("input",{type:"text",value:c,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),f())},placeholder:l?"Waiting...":r,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)"}}),o.jsx("button",{onClick:f,disabled:l||!c.trim(),className:"w-7 h-7 rounded-lg flex items-center justify-center shrink-0 cursor-pointer text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",style:{background:l||!c.trim()?"#666":i},children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M22 2L11 13"}),o.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})}function bd({label:t,value:l}){return o.jsxs("div",{className:"flex justify-between py-1.5 text-xs",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:t}),o.jsx("span",{className:"font-semibold",style:{color:"var(--terminal-text)"},children:l})]})}function uj(t,l){var r,i=1;t==null&&(t=0),l==null&&(l=0);function c(){var u,f=r.length,m,p=0,d=0;for(u=0;u<f;++u)m=r[u],p+=m.x,d+=m.y;for(p=(p/f-t)*i,d=(d/f-l)*i,u=0;u<f;++u)m=r[u],m.x-=p,m.y-=d}return c.initialize=function(u){r=u},c.x=function(u){return arguments.length?(t=+u,c):t},c.y=function(u){return arguments.length?(l=+u,c):l},c.strength=function(u){return arguments.length?(i=+u,c):i},c}function fj(t){const l=+this._x.call(null,t),r=+this._y.call(null,t);return sg(this.cover(l,r),l,r,t)}function sg(t,l,r,i){if(isNaN(l)||isNaN(r))return t;var c,u=t._root,f={data:i},m=t._x0,p=t._y0,d=t._x1,g=t._y1,y,b,v,j,k,C,E,A;if(!u)return t._root=f,t;for(;u.length;)if((k=l>=(y=(m+d)/2))?m=y:d=y,(C=r>=(b=(p+g)/2))?p=b:g=b,c=u,!(u=u[E=C<<1|k]))return c[E]=f,t;if(v=+t._x.call(null,u.data),j=+t._y.call(null,u.data),l===v&&r===j)return f.next=u,c?c[E]=f:t._root=f,t;do c=c?c[E]=new Array(4):t._root=new Array(4),(k=l>=(y=(m+d)/2))?m=y:d=y,(C=r>=(b=(p+g)/2))?p=b:g=b;while((E=C<<1|k)===(A=(j>=b)<<1|v>=y));return c[A]=u,c[E]=f,t}function dj(t){var l,r,i=t.length,c,u,f=new Array(i),m=new Array(i),p=1/0,d=1/0,g=-1/0,y=-1/0;for(r=0;r<i;++r)isNaN(c=+this._x.call(null,l=t[r]))||isNaN(u=+this._y.call(null,l))||(f[r]=c,m[r]=u,c<p&&(p=c),c>g&&(g=c),u<d&&(d=u),u>y&&(y=u));if(p>g||d>y)return this;for(this.cover(p,d).cover(g,y),r=0;r<i;++r)sg(this,f[r],m[r],t[r]);return this}function hj(t,l){if(isNaN(t=+t)||isNaN(l=+l))return this;var r=this._x0,i=this._y0,c=this._x1,u=this._y1;if(isNaN(r))c=(r=Math.floor(t))+1,u=(i=Math.floor(l))+1;else{for(var f=c-r||1,m=this._root,p,d;r>t||t>=c||i>l||l>=u;)switch(d=(l<i)<<1|t<r,p=new Array(4),p[d]=m,m=p,f*=2,d){case 0:c=r+f,u=i+f;break;case 1:r=c-f,u=i+f;break;case 2:c=r+f,i=u-f;break;case 3:r=c-f,i=u-f;break}this._root&&this._root.length&&(this._root=m)}return this._x0=r,this._y0=i,this._x1=c,this._y1=u,this}function mj(){var t=[];return this.visit(function(l){if(!l.length)do t.push(l.data);while(l=l.next)}),t}function xj(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 jn(t,l,r,i,c){this.node=t,this.x0=l,this.y0=r,this.x1=i,this.y1=c}function pj(t,l,r){var i,c=this._x0,u=this._y0,f,m,p,d,g=this._x1,y=this._y1,b=[],v=this._root,j,k;for(v&&b.push(new jn(v,c,u,g,y)),r==null?r=1/0:(c=t-r,u=l-r,g=t+r,y=l+r,r*=r);j=b.pop();)if(!(!(v=j.node)||(f=j.x0)>g||(m=j.y0)>y||(p=j.x1)<c||(d=j.y1)<u))if(v.length){var C=(f+p)/2,E=(m+d)/2;b.push(new jn(v[3],C,E,p,d),new jn(v[2],f,E,C,d),new jn(v[1],C,m,p,E),new jn(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 A=t-+this._x.call(null,v.data),R=l-+this._y.call(null,v.data),O=A*A+R*R;if(O<r){var L=Math.sqrt(r=O);c=t-L,u=l-L,g=t+L,y=l+L,i=v.data}}return i}function yj(t){if(isNaN(g=+this._x.call(null,t))||isNaN(y=+this._y.call(null,t)))return this;var l,r=this._root,i,c,u,f=this._x0,m=this._y0,p=this._x1,d=this._y1,g,y,b,v,j,k,C,E;if(!r)return this;if(r.length)for(;;){if((j=g>=(b=(f+p)/2))?f=b:p=b,(k=y>=(v=(m+d)/2))?m=v:d=v,l=r,!(r=r[C=k<<1|j]))return this;if(!r.length)break;(l[C+1&3]||l[C+2&3]||l[C+3&3])&&(i=l,E=C)}for(;r.data!==t;)if(c=r,!(r=r.next))return this;return(u=r.next)&&delete r.next,c?(u?c.next=u:delete c.next,this):l?(u?l[C]=u:delete l[C],(r=l[0]||l[1]||l[2]||l[3])&&r===(l[3]||l[2]||l[1]||l[0])&&!r.length&&(i?i[E]=r:this._root=r),this):(this._root=u,this)}function gj(t){for(var l=0,r=t.length;l<r;++l)this.remove(t[l]);return this}function bj(){return this._root}function vj(){var t=0;return this.visit(function(l){if(!l.length)do++t;while(l=l.next)}),t}function wj(t){var l=[],r,i=this._root,c,u,f,m,p;for(i&&l.push(new jn(i,this._x0,this._y0,this._x1,this._y1));r=l.pop();)if(!t(i=r.node,u=r.x0,f=r.y0,m=r.x1,p=r.y1)&&i.length){var d=(u+m)/2,g=(f+p)/2;(c=i[3])&&l.push(new jn(c,d,g,m,p)),(c=i[2])&&l.push(new jn(c,u,g,d,p)),(c=i[1])&&l.push(new jn(c,d,f,m,g)),(c=i[0])&&l.push(new jn(c,u,f,d,g))}return this}function kj(t){var l=[],r=[],i;for(this._root&&l.push(new jn(this._root,this._x0,this._y0,this._x1,this._y1));i=l.pop();){var c=i.node;if(c.length){var u,f=i.x0,m=i.y0,p=i.x1,d=i.y1,g=(f+p)/2,y=(m+d)/2;(u=c[0])&&l.push(new jn(u,f,m,g,y)),(u=c[1])&&l.push(new jn(u,g,m,p,y)),(u=c[2])&&l.push(new jn(u,f,y,g,d)),(u=c[3])&&l.push(new jn(u,g,y,p,d))}r.push(i)}for(;i=r.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function Sj(t){return t[0]}function jj(t){return arguments.length?(this._x=t,this):this._x}function Cj(t){return t[1]}function Ej(t){return arguments.length?(this._y=t,this):this._y}function Sh(t,l,r){var i=new jh(l??Sj,r??Cj,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function jh(t,l,r,i,c,u){this._x=t,this._y=l,this._x0=r,this._y0=i,this._x1=c,this._y1=u,this._root=void 0}function f0(t){for(var l={data:t.data},r=l;t=t.next;)r=r.next={data:t.data};return l}var Cn=Sh.prototype=jh.prototype;Cn.copy=function(){var t=new jh(this._x,this._y,this._x0,this._y0,this._x1,this._y1),l=this._root,r,i;if(!l)return t;if(!l.length)return t._root=f0(l),t;for(r=[{source:l,target:t._root=new Array(4)}];l=r.pop();)for(var c=0;c<4;++c)(i=l.source[c])&&(i.length?r.push({source:i,target:l.target[c]=new Array(4)}):l.target[c]=f0(i));return t};Cn.add=fj;Cn.addAll=dj;Cn.cover=hj;Cn.data=mj;Cn.extent=xj;Cn.find=pj;Cn.remove=yj;Cn.removeAll=gj;Cn.root=bj;Cn.size=vj;Cn.visit=wj;Cn.visitAfter=kj;Cn.x=jj;Cn.y=Ej;function ya(t){return function(){return t}}function $r(t){return(t()-.5)*1e-6}function Nj(t){return t.x+t.vx}function Aj(t){return t.y+t.vy}function Tj(t){var l,r,i,c=1,u=1;typeof t!="function"&&(t=ya(t==null?1:+t));function f(){for(var d,g=l.length,y,b,v,j,k,C,E=0;E<u;++E)for(y=Sh(l,Nj,Aj).visitAfter(m),d=0;d<g;++d)b=l[d],k=r[b.index],C=k*k,v=b.x+b.vx,j=b.y+b.vy,y.visit(A);function A(R,O,L,D,U){var X=R.data,ne=R.r,M=k+ne;if(X){if(X.index>b.index){var q=v-X.x-X.vx,F=j-X.y-X.vy,W=q*q+F*F;W<M*M&&(q===0&&(q=$r(i),W+=q*q),F===0&&(F=$r(i),W+=F*F),W=(M-(W=Math.sqrt(W)))/W*c,b.vx+=(q*=W)*(M=(ne*=ne)/(C+ne)),b.vy+=(F*=W)*M,X.vx-=q*(M=1-M),X.vy-=F*M)}return}return O>v+M||D<v-M||L>j+M||U<j-M}}function m(d){if(d.data)return d.r=r[d.data.index];for(var g=d.r=0;g<4;++g)d[g]&&d[g].r>d.r&&(d.r=d[g].r)}function p(){if(l){var d,g=l.length,y;for(r=new Array(g),d=0;d<g;++d)y=l[d],r[y.index]=+t(y,d,l)}}return f.initialize=function(d,g){l=d,i=g,p()},f.iterations=function(d){return arguments.length?(u=+d,f):u},f.strength=function(d){return arguments.length?(c=+d,f):c},f.radius=function(d){return arguments.length?(t=typeof d=="function"?d:ya(+d),p(),f):t},f}function Dj(t){return t.index}function d0(t,l){var r=t.get(l);if(!r)throw new Error("node not found: "+l);return r}function zj(t){var l=Dj,r=y,i,c=ya(30),u,f,m,p,d,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,A=t.length;E<g;++E)for(var R=0,O,L,D,U,X,ne,M;R<A;++R)O=t[R],L=O.source,D=O.target,U=D.x+D.vx-L.x-L.vx||$r(d),X=D.y+D.vy-L.y-L.vy||$r(d),ne=Math.sqrt(U*U+X*X),ne=(ne-u[R])/ne*C*i[R],U*=ne,X*=ne,D.vx-=U*(M=p[R]),D.vy-=X*M,L.vx+=U*(M=1-M),L.vy+=X*M}function v(){if(f){var C,E=f.length,A=t.length,R=new Map(f.map((L,D)=>[l(L,D,f),L])),O;for(C=0,m=new Array(E);C<A;++C)O=t[C],O.index=C,typeof O.source!="object"&&(O.source=d0(R,O.source)),typeof O.target!="object"&&(O.target=d0(R,O.target)),m[O.source.index]=(m[O.source.index]||0)+1,m[O.target.index]=(m[O.target.index]||0)+1;for(C=0,p=new Array(A);C<A;++C)O=t[C],p[C]=m[O.source.index]/(m[O.source.index]+m[O.target.index]);i=new Array(A),j(),u=new Array(A),k()}}function j(){if(f)for(var C=0,E=t.length;C<E;++C)i[C]=+r(t[C],C,t)}function k(){if(f)for(var C=0,E=t.length;C<E;++C)u[C]=+c(t[C],C,t)}return b.initialize=function(C,E){f=C,d=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?(r=typeof C=="function"?C:ya(+C),j(),b):r},b.distance=function(C){return arguments.length?(c=typeof C=="function"?C:ya(+C),k(),b):c},b}var Mj={value:()=>{}};function og(){for(var t=0,l=arguments.length,r={},i;t<l;++t){if(!(i=arguments[t]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new wc(r)}function wc(t){this._=t}function Rj(t,l){return t.trim().split(/^|\s+/).map(function(r){var i="",c=r.indexOf(".");if(c>=0&&(i=r.slice(c+1),r=r.slice(0,c)),r&&!l.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}wc.prototype=og.prototype={constructor:wc,on:function(t,l){var r=this._,i=Rj(t+"",r),c,u=-1,f=i.length;if(arguments.length<2){for(;++u<f;)if((c=(t=i[u]).type)&&(c=Fj(r[c],t.name)))return c;return}if(l!=null&&typeof l!="function")throw new Error("invalid callback: "+l);for(;++u<f;)if(c=(t=i[u]).type)r[c]=h0(r[c],t.name,l);else if(l==null)for(c in r)r[c]=h0(r[c],t.name,null);return this},copy:function(){var t={},l=this._;for(var r in l)t[r]=l[r].slice();return new wc(t)},call:function(t,l){if((c=arguments.length-2)>0)for(var r=new Array(c),i=0,c,u;i<c;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(u=this._[t],i=0,c=u.length;i<c;++i)u[i].value.apply(l,r)},apply:function(t,l,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],c=0,u=i.length;c<u;++c)i[c].value.apply(l,r)}};function Fj(t,l){for(var r=0,i=t.length,c;r<i;++r)if((c=t[r]).name===l)return c.value}function h0(t,l,r){for(var i=0,c=t.length;i<c;++i)if(t[i].name===l){t[i]=Mj,t=t.slice(0,i).concat(t.slice(i+1));break}return r!=null&&t.push({name:l,value:r}),t}var ci=0,ks=0,gs=0,cg=1e3,zc,Ss,Mc=0,ba=0,Yc=0,Fs=typeof performance=="object"&&performance.now?performance:Date,ug=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function fg(){return ba||(ug(_j),ba=Fs.now()+Yc)}function _j(){ba=0}function Zd(){this._call=this._time=this._next=null}Zd.prototype=dg.prototype={constructor:Zd,restart:function(t,l,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?fg():+r)+(l==null?0:+l),!this._next&&Ss!==this&&(Ss?Ss._next=this:zc=this,Ss=this),this._call=t,this._time=r,Jd()},stop:function(){this._call&&(this._call=null,this._time=1/0,Jd())}};function dg(t,l,r){var i=new Zd;return i.restart(t,l,r),i}function Oj(){fg(),++ci;for(var t=zc,l;t;)(l=ba-t._time)>=0&&t._call.call(void 0,l),t=t._next;--ci}function m0(){ba=(Mc=Fs.now())+Yc,ci=ks=0;try{Oj()}finally{ci=0,Lj(),ba=0}}function Bj(){var t=Fs.now(),l=t-Mc;l>cg&&(Yc-=l,Mc=t)}function Lj(){for(var t,l=zc,r,i=1/0;l;)l._call?(i>l._time&&(i=l._time),t=l,l=l._next):(r=l._next,l._next=null,l=t?t._next=r:zc=r);Ss=t,Jd(i)}function Jd(t){if(!ci){ks&&(ks=clearTimeout(ks));var l=t-ba;l>24?(t<1/0&&(ks=setTimeout(m0,t-Fs.now()-Yc)),gs&&(gs=clearInterval(gs))):(gs||(Mc=Fs.now(),gs=setInterval(Bj,cg)),ci=1,ug(m0))}}const $j=1664525,Hj=1013904223,x0=4294967296;function Uj(){let t=1;return()=>(t=($j*t+Hj)%x0)/x0}function Ij(t){return t.x}function Yj(t){return t.y}var qj=10,Xj=Math.PI*(3-Math.sqrt(5));function Vj(t){var l,r=1,i=.001,c=1-Math.pow(i,1/300),u=0,f=.6,m=new Map,p=dg(y),d=og("tick","end"),g=Uj();t==null&&(t=[]);function y(){b(),d.call("tick",l),r<i&&(p.stop(),d.call("end",l))}function b(k){var C,E=t.length,A;k===void 0&&(k=1);for(var R=0;R<k;++R)for(r+=(u-r)*c,m.forEach(function(O){O(r)}),C=0;C<E;++C)A=t[C],A.fx==null?A.x+=A.vx*=f:(A.x=A.fx,A.vx=0),A.fy==null?A.y+=A.vy*=f:(A.y=A.fy,A.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 A=qj*Math.sqrt(.5+k),R=k*Xj;E.x=A*Math.cos(R),E.y=A*Math.sin(R)}(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?(r=+k,l):r},alphaMin:function(k){return arguments.length?(i=+k,l):i},alphaDecay:function(k){return arguments.length?(c=+k,l):+c},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 A=0,R=t.length,O,L,D,U,X;for(E==null?E=1/0:E*=E,A=0;A<R;++A)U=t[A],O=k-U.x,L=C-U.y,D=O*O+L*L,D<E&&(X=U,E=D);return X},on:function(k,C){return arguments.length>1?(d.on(k,C),l):d.on(k)}}}function Gj(){var t,l,r,i,c=ya(-30),u,f=1,m=1/0,p=.81;function d(v){var j,k=t.length,C=Sh(t,Ij,Yj).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]=+c(k,v,t)}}function y(v){var j=0,k,C,E=0,A,R,O;if(v.length){for(A=R=O=0;O<4;++O)(k=v[O])&&(C=Math.abs(k.value))&&(j+=k.value,E+=C,A+=C*k.x,R+=C*k.y);v.x=A/E,v.y=R/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,A=v.y-l.y,R=C-j,O=E*E+A*A;if(R*R/p<O)return O<m&&(E===0&&(E=$r(r),O+=E*E),A===0&&(A=$r(r),O+=A*A),O<f&&(O=Math.sqrt(f*O)),l.vx+=E*v.value*i/O,l.vy+=A*v.value*i/O),!0;if(v.length||O>=m)return;(v.data!==l||v.next)&&(E===0&&(E=$r(r),O+=E*E),A===0&&(A=$r(r),O+=A*A),O<f&&(O=Math.sqrt(f*O)));do v.data!==l&&(R=u[v.data.index]*i/O,l.vx+=E*R,l.vy+=A*R);while(v=v.next)}return d.initialize=function(v,j){t=v,r=j,g()},d.strength=function(v){return arguments.length?(c=typeof v=="function"?v:ya(+v),g(),d):c},d.distanceMin=function(v){return arguments.length?(f=v*v,d):Math.sqrt(f)},d.distanceMax=function(v){return arguments.length?(m=v*v,d):Math.sqrt(m)},d.theta=function(v){return arguments.length?(p=v*v,d):Math.sqrt(p)},d}const _s={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 Kj(t){return _s[t]??_s.general}function Qj({docs:t,onNodeClick:l,selectedDocId:r}){var q;const i=S.useRef(null),c=S.useRef(null),[u,f]=S.useState({width:600,height:400}),[m,p]=S.useState({nodes:[],links:[]}),[d,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),A=S.useRef({x:0,y:0,vx:0,vy:0}),R=S.useRef(null),O=S.useRef(null);S.useEffect(()=>{const F=i.current;if(!F)return;const W=new ResizeObserver(ee=>{const{width:V,height:I}=ee[0].contentRect;V>0&&I>0&&(f({width:V,height:I}),C(Z=>({...Z,w:V,h:I})))});return W.observe(F),()=>W.disconnect()},[]),S.useEffect(()=>{if(t.length===0)return;const F=new Set(t.map(ce=>ce.id)),W=t.map(ce=>({id:ce.id,title:ce.title,category:ce.category,akb_type:ce.akb_type})),ee=[];for(const ce of t)for(const we of ce.links){const z=we.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,"");F.has(z)&&z!==ce.id&&(ee.some(B=>B.source===ce.id&&B.target===z||B.source===z&&B.target===ce.id)||ee.push({source:ce.id,target:z,label:we.text}))}const{width:V,height:I}=u,Z=Vj(W).force("link",zj(ee).id(ce=>ce.id).distance(140)).force("charge",Gj().strength(-400)).force("center",uj(V/2,I/2)).force("collide",Tj(50));O.current=Z,Z.on("tick",()=>{for(const ce of W)ce.x=Math.max(60,Math.min(V-60,ce.x??V/2)),ce.y=Math.max(60,Math.min(I-60,ce.y??I/2));p({nodes:[...W],links:[...ee]})}),Z.alpha(1).restart();for(let ce=0;ce<150;ce++)Z.tick();return Z.stop(),p({nodes:[...W],links:[...ee]}),()=>{Z.stop()}},[t,u]);const L=F=>{if(typeof F=="string"){const W=m.nodes.find(ee=>ee.id===F);return{x:(W==null?void 0:W.x)??0,y:(W==null?void 0:W.y)??0}}return{x:F.x??0,y:F.y??0}},D=S.useCallback(F=>{F.preventDefault();const W=F.deltaY>0?1.1:.9;C(ee=>{const V=Math.max(200,Math.min(u.width*3,ee.w*W)),I=Math.max(150,Math.min(u.height*3,ee.h*W)),Z=(V-ee.w)/2,ce=(I-ee.h)/2;return{x:ee.x-Z,y:ee.y-ce,w:V,h:I}})},[u]),U=S.useCallback(F=>{F.button===0&&(E.current=!0,A.current={x:F.clientX,y:F.clientY,vx:k.x,vy:k.y})},[k]),X=S.useCallback(F=>{var W;if(R.current){const ee=c.current;if(!ee)return;const V=ee.getBoundingClientRect(),I=k.w/V.width,Z=k.h/V.height,ce=k.x+(F.clientX-V.left)*I,we=k.y+(F.clientY-V.top)*Z;R.current.fx=ce,R.current.fy=we,(W=O.current)==null||W.alpha(.3).restart();return}if(E.current){const ee=(F.clientX-A.current.x)*(k.w/u.width),V=(F.clientY-A.current.y)*(k.h/u.height);C(I=>({...I,x:A.current.vx-ee,y:A.current.vy-V}))}},[k,u]),ne=S.useCallback(()=>{E.current=!1,R.current&&(R.current.fx=null,R.current.fy=null,R.current=null)},[]),M=S.useCallback((F,W)=>{var ee;F.stopPropagation(),R.current=W,(ee=O.current)==null||ee.alpha(.3).restart()},[]);return o.jsxs("div",{ref:i,className:"relative flex-1 overflow-hidden",style:{background:"#1e1e2e"},children:[o.jsxs("svg",{ref:c,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:U,onMouseMove:X,onMouseUp:ne,onMouseLeave:ne,children:[o.jsx("defs",{children:o.jsx("pattern",{id:"grid",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:o.jsx("circle",{cx:"0",cy:"0",r:"0.5",fill:"rgba(255,255,255,0.06)"})})}),o.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((F,W)=>{const ee=L(F.source),V=L(F.target),I=y===W,Z=(ee.x+V.x)/2,ce=(ee.y+V.y)/2;return o.jsxs("g",{children:[o.jsx("line",{x1:ee.x,y1:ee.y,x2:V.x,y2:V.y,stroke:"transparent",strokeWidth:12,style:{cursor:"default"},onMouseEnter:()=>b(W),onMouseLeave:()=>b(null)}),o.jsx("line",{x1:ee.x,y1:ee.y,x2:V.x,y2:V.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&&F.label&&o.jsx("text",{x:Z,y:ce-6,textAnchor:"middle",fill:"#e2e8f0",fontSize:9,fontFamily:"monospace",style:{pointerEvents:"none"},children:o.jsx("tspan",{style:{filter:"drop-shadow(0 0 2px rgba(0,0,0,0.8))"},children:F.label.length>30?F.label.slice(0,28)+"..":F.label})})]},W)}),m.nodes.map(F=>{const W=_s[F.category]??_s.general,ee=F.akb_type==="hub",V=ee?24:16,I=(d==null?void 0:d.id)===F.id,Z=r===F.id,ce=I?1.2:Z?1.15:1;return o.jsxs("g",{transform:`translate(${F.x??0}, ${F.y??0}) scale(${ce})`,style:{cursor:"pointer",transition:"transform 0.15s ease"},onClick:we=>{we.stopPropagation();const z=t.find(B=>B.id===F.id);z&&l(z)},onMouseDown:we=>M(we,F),onMouseEnter:we=>{var B;g(F);const z=(B=i.current)==null?void 0:B.getBoundingClientRect();z&&j({x:we.clientX-z.left,y:we.clientY-z.top})},onMouseLeave:()=>g(null),children:[Z&&o.jsx("rect",{x:-V/2-4,y:-V/2-4,width:V+8,height:V+8,fill:"none",stroke:"#22c55e",strokeWidth:2,rx:ee?5:2,opacity:.6}),o.jsx("rect",{x:-V/2,y:-V/2,width:V,height:V,fill:W.border,rx:ee?4:2,opacity:I?1:.9}),o.jsx("rect",{x:-V/2+3,y:-V/2+3,width:Math.max(0,V-6),height:Math.max(0,V-6),fill:W.bg,rx:ee?3:1}),o.jsx("text",{y:V/2+14,textAnchor:"middle",fill:Z?"#e2e8f0":"#94a3b8",fontSize:11,fontFamily:"monospace",fontWeight:Z?"bold":"normal",style:{pointerEvents:"none"},children:F.title.length>24?F.title.slice(0,22)+"..":F.title})]},F.id)})]}),d&&!R.current&&o.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:[o.jsx("div",{className:"font-bold mb-1",children:d.title}),o.jsxs("div",{className:"text-[10px] opacity-60 mb-1",children:[d.akb_type.toUpperCase()," / ",d.category]}),((q=t.find(F=>F.id===d.id))==null?void 0:q.tldr)&&o.jsx("div",{className:"text-[10px] opacity-80 mb-1",children:t.find(F=>F.id===d.id).tldr}),o.jsx("div",{className:"text-[10px] text-green-400",children:"Click to open | Drag to move"})]}),t.length===0&&o.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 Wj({doc:t,allDocs:l,onOpen:r,onNavigateDoc:i}){const[c,u]=S.useState(!1),f=Kj(t.category),m=t.akb_type==="hub",p=new Set(l.map(d=>d.id));return o.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:[o.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>u(!c),children:[o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("span",{className:"shrink-0 text-sm",children:m?"🗂":t.format==="html"?"🌐":"📄"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[o.jsx("span",{className:"font-semibold text-xs truncate",style:{color:"var(--terminal-text)"},children:t.title}),o.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})]}),o.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:t.tags.slice(0,4).map(d=>o.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:d},d))})]}),o.jsx("span",{className:"text-xs shrink-0",style:{color:"var(--terminal-text-muted)"},children:c?"▲":"▼"})]}),!c&&t.tldr&&o.jsx("div",{className:"mt-1.5 text-[10px] line-clamp-2 ml-6",style:{color:"var(--terminal-text-secondary)"},children:t.tldr})]}),c&&o.jsxs("div",{className:"px-3 pb-3",style:{borderTop:"1px solid var(--terminal-border)"},children:[t.tldr&&o.jsx("div",{className:"mt-2 text-[11px] leading-relaxed italic",style:{color:"var(--terminal-text-secondary)"},children:t.tldr}),t.links.length>0&&o.jsxs("div",{className:"mt-2",children:[o.jsx("div",{className:"text-[9px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Cross-links"}),o.jsx("div",{className:"flex flex-wrap gap-1",children:t.links.slice(0,5).map((d,g)=>{const y=d.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,""),b=p.has(y);return o.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:["🔗"," ",d.text]},g)})})]}),o.jsxs("button",{className:"mt-2 text-[10px] font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},onClick:d=>{d.stopPropagation(),r(t)},children:["Open full ","→"]})]})]})}function Zj({docId:t,onBack:l,onDocUpdated:r,onDelete:i,onNavigateDoc:c,allDocs:u}){const[f,m]=S.useState(null),[p,d]=S.useState(!0),[g,y]=S.useState(!1),[b,v]=S.useState(""),[j,k]=S.useState(!1),C=new Set(u.map(L=>L.id)),E=S.useCallback(L=>{const D=L.split("#")[0];if(!D.match(/\.(md|html)$/))return null;const U=t.includes("/")?t.replace(/\/[^/]+$/,""):"";let X;if(D.startsWith("./"))X=U?`${U}/${D.slice(2)}`:D.slice(2);else if(D.startsWith("../")){const q=U.split("/").filter(Boolean);let F=D;for(;F.startsWith("../");)q.length>0&&q.pop(),F=F.slice(3);X=q.length>0?`${q.join("/")}/${F}`:F}else X=D;if(C.has(X))return X;const ne=X.split("/").pop()??"",M=u.find(q=>q.id===ne||q.id.endsWith("/"+ne));return M?M.id:null},[t,C,u]),A=S.useCallback(L=>{const U=L.target.closest("a");if(!U)return;const X=U.getAttribute("href");if(!X||X.startsWith("http://")||X.startsWith("https://")||!X.match(/\.(md|html)(#.*)?$/))return;L.preventDefault(),L.stopPropagation();const ne=E(X);ne&&c(ne)},[E,c]);S.useEffect(()=>{d(!0),Ce.getKnowledgeDoc(t).then(L=>{m(L),v(L.content)}).catch(console.error).finally(()=>d(!1))},[t]);const R=async()=>{if(f){k(!0);try{await Ce.updateKnowledgeDoc(t,b),m({...f,content:b}),y(!1),r()}catch(L){console.error("Save failed:",L)}finally{k(!1)}}},O=async()=>{if(confirm(`Delete "${f==null?void 0:f.title}"?`))try{await Ce.deleteKnowledgeDoc(t),i(t)}catch(L){console.error("Delete failed:",L)}};return p?o.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Loading..."}):f?o.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col",children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Back"]}),o.jsx("div",{className:"flex-1"}),g?o.jsxs(o.Fragment,{children:[o.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"}),o.jsx("button",{onClick:R,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"})]}):o.jsxs(o.Fragment,{children:[o.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"}),o.jsx("button",{onClick:O,className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold",style:{background:"rgba(239,68,68,0.15)",color:"#f87171",border:"1px solid rgba(239,68,68,0.3)"},children:"Delete"})]})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[o.jsx("h2",{className:"text-sm font-bold mb-1",style:{color:"var(--terminal-text)"},children:f.title}),f.tldr&&!g&&o.jsx("div",{className:"mb-3 text-xs italic",style:{color:"var(--terminal-text-secondary)"},children:f.tldr}),f.format==="html"?g?o.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:L=>v(L.target.value),spellCheck:!1}):o.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?o.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:L=>v(L.target.value),spellCheck:!1}):o.jsx("div",{className:"text-xs leading-relaxed",style:{color:"var(--terminal-text-secondary)"},onClick:A,children:o.jsx(Hs,{content:f.content})})]})]}):o.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Failed to load document"})}function Jj({onCreated:t,onCancel:l}){const[r,i]=S.useState(""),[c,u]=S.useState(""),[f,m]=S.useState(""),[p,d]=S.useState(!1),[g,y]=S.useState("");S.useEffect(()=>{if(!r){u("");return}const v=r.toLowerCase().replace(/[^a-z0-9가-힣\s-]/g,"").replace(/\s+/g,"-").slice(0,60);u(v)},[r]);const b=async()=>{if(!r.trim()||!c.trim()){y("Title and filename are required");return}d(!0),y("");try{const v=await Ce.createKnowledgeDoc({filename:c,title:r,category:f||void 0});t(v.id)}catch(v){y(v instanceof Error?v.message:"Failed to create")}finally{d(!1)}};return o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[o.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Cancel"]}),o.jsx("h2",{className:"text-sm font-bold",style:{color:"var(--terminal-text)"},children:"New Document"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"TITLE"}),o.jsx("input",{type:"text",value:r,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)"}})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"FILENAME"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("input",{type:"text",value:c,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)"}}),o.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:".md"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"CATEGORY (optional)"}),o.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&&o.jsx("div",{className:"text-[10px] px-3 py-1.5 rounded",style:{background:"rgba(239,68,68,0.15)",color:"#f87171"},children:g}),o.jsx("button",{onClick:b,disabled:p||!r.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 Pj=500,p0=360,y0=700;function Ch(t){const[l,r]=S.useState(Pj),[i,c]=S.useState(!1),u=S.useRef(0),f=S.useRef(0),m=t>0,p=m?t:0,d=m?Math.max(p0,window.innerWidth-t-100):y0,g=Math.min(l,d),y=S.useCallback(b=>{b.preventDefault(),u.current=b.clientX,f.current=g,c(!0);const v=k=>{const C=u.current-k.clientX,E=Math.min(y0,Math.max(p0,f.current+C));r(E)},j=()=>{c(!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 eC({docs:t,onClose:l,onRefresh:r,terminalWidth:i=0,initialDocId:c}){const[u,f]=S.useState("list"),[m,p]=S.useState("all"),[d,g]=S.useState(c??null),[y,b]=S.useState(""),[v,j]=S.useState(!1),[k,C]=S.useState(null),{panelRight:E,panelWidth:A,isResizing:R,handleResizeStart:O}=Ch(i),L=["all",...Array.from(new Set(t.map(q=>q.category))).sort()],D=t.filter(q=>{if(m!=="all"&&q.category!==m)return!1;if(y){const F=y.toLowerCase();return q.title.toLowerCase().includes(F)||(q.tldr??"").toLowerCase().includes(F)||q.tags.some(W=>W.toLowerCase().includes(F))}return!0}),U=q=>{j(!1),r(),g(q)},X=q=>{g(null),r()},ne=q=>{C(q.id)},M=k?t.find(q=>q.id===k):null;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:E},onClick:l}),o.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)] ${R?"resizing":""}`,style:{right:E,width:A,background:"var(--terminal-bg)",borderLeftColor:"#16a34a"},children:[o.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${R?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:O}),o.jsxs("div",{className:"p-5 text-white relative",style:{background:"#16a34a"},children:[o.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:"×"}),o.jsxs("div",{className:"text-lg font-bold",children:["📚"," Knowledge Base"]}),o.jsxs("div",{className:"text-xs opacity-80 mt-0.5",children:[t.length," documents"]})]}),o.jsxs("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx(g0,{label:"List",active:u==="list",onClick:()=>{f("list"),C(null)}}),o.jsx(g0,{label:"Graph",active:u==="graph",onClick:()=>f("graph")})]}),u==="list"&&!d&&!v&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx("input",{type:"text",value:y,onChange:q=>b(q.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)"}}),o.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"})]}),o.jsx("div",{className:"flex overflow-x-auto shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",scrollbarWidth:"none"},children:L.map(q=>o.jsx("button",{onClick:()=>p(q),className:"px-3 py-1.5 text-[10px] font-medium cursor-pointer whitespace-nowrap",style:{color:m===q?"#4ade80":"var(--terminal-text-muted)",borderBottom:m===q?"2px solid #4ade80":"2px solid transparent"},children:q==="all"?`All (${t.length})`:`${q} (${t.filter(F=>F.category===q).length})`},q))}),o.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:D.length===0?o.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(q=>o.jsx(Wj,{doc:q,allDocs:t,onOpen:F=>g(F.id),onNavigateDoc:F=>g(F)},q.id))})]}),u==="list"&&d&&!v&&o.jsx(Zj,{docId:d,onBack:()=>g(null),onDocUpdated:r,onDelete:X,onNavigateDoc:q=>g(q),allDocs:t}),u==="list"&&v&&o.jsx(Jj,{onCreated:U,onCancel:()=>j(!1)}),u==="graph"&&o.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[o.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[o.jsx(Qj,{docs:t,onNodeClick:ne,selectedDocId:k}),M&&o.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:[o.jsx("div",{className:"text-[10px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Selected"}),o.jsx("div",{className:"text-xs font-bold mb-1",style:{color:"var(--terminal-text)"},children:M.title}),o.jsx("div",{className:"w-2 h-2 rounded-full mb-2",style:{background:M.status==="active"?"#16a34a":M.status==="draft"?"#f59e0b":"#94a3b8"}}),M.tldr&&o.jsx("div",{className:"text-[10px] mb-2 leading-relaxed",style:{color:"var(--terminal-text-secondary)"},children:M.tldr}),M.links.length>0&&o.jsxs("div",{className:"mb-2",children:[o.jsx("div",{className:"text-[9px] font-bold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Links"}),M.links.slice(0,5).map((q,F)=>o.jsxs("div",{className:"text-[9px] mb-0.5 truncate",style:{color:"var(--terminal-text-secondary)"},children:["🔗"," ",q.text]},F))]}),o.jsx("button",{className:"w-full py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white",style:{background:"#16a34a"},onClick:()=>{f("list"),g(M.id),C(null)},children:"Open Document"})]})]}),o.jsx("div",{className:"shrink-0 p-2",style:{borderTop:"1px solid var(--terminal-border)"},children:o.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(_s).map(([q,F])=>o.jsxs("div",{className:"flex items-center gap-1 text-[9px]",children:[o.jsx("div",{className:"w-2 h-2",style:{background:F.border}}),o.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:q})]},q))})})]})]})]})}function g0({label:t,active:l,onClick:r}){return o.jsx("button",{onClick:r,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 tC({standups:t,waves:l,decisions:r,mode:i,onClose:c,terminalWidth:u=0}){const[f,m]=S.useState(i==="decisions"?"decisions":"standups"),{panelRight:p,panelWidth:d,isResizing:g,handleResizeStart:y}=Ch(u);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:p},onClick:c}),o.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:d,background:"var(--terminal-bg)",borderLeftColor:"var(--desk-wood)"},children:[o.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}),o.jsxs("div",{className:"p-5 bg-[var(--desk-wood)] text-white relative",children:[o.jsx("button",{onClick:c,className:"absolute top-3 right-3 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),o.jsx("div",{className:"text-lg font-bold",children:i==="bulletin"?"📌 Bulletin Board":"📜 Decision Log"})]}),o.jsx("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:i==="bulletin"?o.jsxs(o.Fragment,{children:[o.jsx(vd,{label:`Standups (${t.length})`,active:f==="standups",onClick:()=>m("standups")}),o.jsx(vd,{label:`Waves (${l.length})`,active:f==="waves",onClick:()=>m("waves")})]}):o.jsx(vd,{label:`Decisions (${r.length})`,active:f==="decisions",onClick:()=>m("decisions")})}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[f==="standups"&&t.map((b,v)=>o.jsx(wd,{title:`Standup ${b.date}`,content:b.content},v)),f==="waves"&&l.map((b,v)=>o.jsx(wd,{title:`Wave ${b.id}`,subtitle:b.timestamp,content:b.content},v)),f==="decisions"&&r.map((b,v)=>o.jsx(wd,{title:`#${b.id} ${b.title}`,subtitle:b.date,content:b.content},v))]})]})]})}function vd({label:t,active:l,onClick:r}){return o.jsx("button",{onClick:r,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 nC(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 wd({title:t,subtitle:l,content:r}){const[i,c]=S.useState(!1),u=r.length>100,f=nC(r).slice(0,160);return o.jsxs("div",{className:"mb-3 rounded-lg overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>c(!i),children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"font-medium text-sm",style:{color:"var(--terminal-text)"},children:t}),o.jsx("span",{className:"text-xs shrink-0 ml-2",style:{color:"var(--terminal-text-muted)"},children:i?"▲":"▼"})]}),l&&o.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--terminal-text-muted)"},children:l})]}),i&&o.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:o.jsx(Hs,{content:r})}),!i&&u&&o.jsx("div",{className:"px-3 pb-2 text-xs line-clamp-2 leading-relaxed",style:{color:"var(--terminal-text-muted)"},children:f})]})}function lC({projectId:t,onClose:l,terminalWidth:r=0}){const[i,c]=S.useState(null),{panelRight:u,panelWidth:f,isResizing:m,handleResizeStart:p}=Ch(r);if(S.useEffect(()=>{Ce.getProject(t).then(c).catch(console.error)},[t]),!i)return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),o.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:o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading project..."})})]});const d=i.tasks.filter(b=>b.status==="done").length,g=i.tasks.length,y=g>0?Math.round(d/g*100):0;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),o.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:[o.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}),o.jsxs("div",{className:"p-5 bg-[var(--meeting-blue)] text-white relative",children:[o.jsx("div",{className:"text-sm opacity-70",children:"Meeting Room"}),o.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:"×"}),o.jsx("div",{className:"text-xl font-bold mt-1",children:i.name}),o.jsxs("div",{className:"flex items-center gap-3 mt-3 text-sm",children:[o.jsxs("span",{children:["Tasks: ",g]}),o.jsxs("span",{children:["Done: ",d]}),o.jsxs("span",{children:["Progress: ",y,"%"]})]}),o.jsx("div",{className:"mt-2 h-1.5 bg-white/20 rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full bg-white rounded-full transition-all",style:{width:`${y}%`}})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[i.prd&&o.jsxs("div",{className:"mb-5",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"PRD"}),o.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:o.jsx(Hs,{content:i.prd})})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:["Tasks (",g,")"]}),o.jsx("div",{className:"space-y-2",children:i.tasks.map(b=>o.jsxs("div",{className:"rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium",style:{color:"var(--terminal-text)"},children:b.title}),o.jsx(rC,{status:b.status})]}),o.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-muted)"},children:b.role}),b.description&&o.jsx("div",{className:"text-xs mt-1.5 line-clamp-2",style:{color:"var(--terminal-text-secondary)"},children:b.description})]},b.id))})]})]})]})]})}function rC({status: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)"}},r=l[t]??l.todo;return o.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:r.bg,color:r.color},children:t})}const aC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function iC({roleId:t,roleName:l,mode:r="assign",onClose:i,onExecutionStart:c}){const[u,f]=S.useState(""),m=S.useRef(null);S.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const p=()=>{u.trim()&&(c(t,u.trim()),i())},d=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&p(),y.key==="Escape"&&i()},g=aC[t]??"#666";return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),o.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:[o.jsxs("div",{className:"p-5 text-white",style:{background:`linear-gradient(135deg, ${g}, ${g}cc)`},children:[o.jsx("div",{className:"text-lg font-bold",children:r==="ask"?"Ask":"Assign Task"}),o.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:r==="ask"?`to ${l}`:`to ${l} (${t})`})]}),o.jsxs("div",{className:"p-5",children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Task Description"}),o.jsx("textarea",{ref:m,value:u,onChange:y=>f(y.target.value),onKeyDown:d,placeholder:r==="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"}),o.jsx("div",{className:"text-[10px] text-white/30 mt-1",children:"Cmd+Enter to submit"})]}),o.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[o.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"}),o.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:r==="ask"?"Ask":"Assign"})]})]})]})}const b0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function hg({event:t,isThinkingCollapsed:l,onToggleThinking:r,onNavigateToJob:i,onOpenKnowledgeDoc:c,compact:u}){var m;const f=b0[t.roleId]??"#888";switch(t.type){case"text":return o.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 o.jsxs("div",{className:"group",children:[o.jsxs("button",{onClick:r,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-[10px] cursor-pointer flex items-center gap-1",children:[o.jsx("span",{children:l?"▶":"▼"}),o.jsx("span",{className:"italic",children:"thinking..."})]}),!l&&o.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??""),d=t.data.input,g=typeof(d==null?void 0:d.command)=="string"?d.command.slice(0,80):"",y=typeof(d==null?void 0:d.file_path)=="string"?String(d.file_path):typeof(d==null?void 0:d.path)=="string"?String(d.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&&c;return o.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[o.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?o.jsx("button",{onClick:()=>c(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}):o.jsxs(o.Fragment,{children:[g&&o.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:g}),b&&o.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??"",d=t.data.task??"",g=t.data.childJobId,y=b0[p]??"#888";return o.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:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{style:{color:y},className:"font-bold text-[11px]",children:["→"," ",p.toUpperCase()]}),o.jsx("span",{className:"text-[var(--terminal-text-secondary)] text-[10px] truncate flex-1",children:d.slice(0,u?60:100)}),g&&i&&o.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 o.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 o.jsx("div",{className:"border-t border-[var(--terminal-border)] my-2 relative",children:o.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 o.jsxs("div",{className:"text-red-400/80 text-[11px]",children:["⚠"," ",t.data.message]});case"job:start":return o.jsxs("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pb-1",children:[o.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,d=t.data.toolCalls??0;return o.jsx("div",{className:"mt-2 p-2 rounded-lg bg-green-900/20 border border-green-800/30",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-green-400"}),o.jsx("span",{className:"text-green-300 font-bold text-[11px]",children:"Complete"}),o.jsxs("span",{className:"text-[var(--terminal-text-muted)] text-[10px]",children:[p," turns · ",d," tools"]})]})})}case"job:error":return o.jsx("div",{className:"mt-2 p-2 rounded-lg bg-red-900/20 border border-red-800/30",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-red-400"}),o.jsx("span",{className:"text-red-300 font-bold text-[11px]",children:"Error"}),o.jsx("span",{className:"text-red-200/70 text-[10px]",children:t.data.message})]})});case"import:scan":case"import:process":case"import:created":return o.jsxs("div",{className:"text-cyan-300/70 text-[11px]",children:["[",t.type,"] ",JSON.stringify(t.data)]});default:return null}}function sC({jobId:t,title:l,color:r,variant:i,style:c,onClose:u,onMinimize:f,onDone:m,onNavigateToJob:p,onOpenKnowledgeDoc:d}){const{events:g,status:y,textOutput:b,childJobIds:v}=X0(t),[j,k]=S.useState(0),[C,E]=S.useState(new Set),A=S.useRef(null),R=S.useRef(Date.now()),O=S.useRef(!1);S.useEffect(()=>{const q=setInterval(()=>{k(Math.floor((Date.now()-R.current)/1e3))},1e3);return()=>clearInterval(q)},[]),S.useEffect(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[g]),S.useEffect(()=>{(y==="done"||y==="error")&&!O.current&&(O.current=!0,m==null||m())},[y,m]);const L=q=>{E(F=>{const W=new Set(F);return W.has(q)?W.delete(q):W.add(q),W})},D={idle:"Waiting",connecting:"Connecting...",streaming:"Working",done:"Complete",error:"Error"}[y],U={idle:"#888",connecting:"#888",streaming:r,done:"#2E7D32",error:"#C62828"}[y],X=q=>`${Math.floor(q/60)}:${String(q%60).padStart(2,"0")}`,ne=y==="done"||y==="error",M=o.jsxs("div",{className:i==="modal"?"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] h-[85vh] z-[61] bg-[var(--terminal-bg)] rounded-2xl shadow-2xl overflow-hidden flex flex-col":"bg-[var(--terminal-bg)] rounded-xl border border-[var(--terminal-border)] overflow-hidden flex flex-col max-h-[400px]",style:c,children:[o.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{background:U}}),o.jsx("div",{children:o.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:l})})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:X(j)}),o.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:`${U}22`,color:U},children:D}),f&&i==="modal"&&o.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&&o.jsx("button",{onClick:u,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),o.jsxs("div",{ref:A,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[g.length===0&&y==="connecting"&&o.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:"Connecting to activity stream..."}),g.map(q=>o.jsx(hg,{event:q,isThinkingCollapsed:C.has(q.seq),onToggleThinking:()=>L(q.seq),onNavigateToJob:p,onOpenKnowledgeDoc:d},q.seq)),y==="streaming"&&o.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),o.jsxs("div",{className:"px-5 py-3 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[o.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&&o.jsx("button",{onClick:u,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer",style:{background:r},children:"Close"})]})]});return i==="modal"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:ne?u:void 0}),M]}):M}const kd={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function oC({orgNodes:t,rootId:l}){const r=t[l];if(!r)return null;const c=r.children.map(m=>t[m]).filter(Boolean),u=[];for(const m of c)for(const p of m.children){const d=t[p];d&&u.push({node:d,parentId:m.id})}const f=c.length+u.length;return o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Propagation Preview"}),o.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-lg p-4",children:[o.jsx("div",{className:"flex justify-center mb-2",children:o.jsx("span",{className:"px-3 py-1 text-[10px] font-bold rounded border-2 border-white/20 bg-white/5 text-white/30 uppercase",children:"CEO"})}),c.length>0&&o.jsx("div",{className:"flex justify-center mb-1",children:o.jsx("div",{className:"w-px h-3 bg-white/15"})}),c.length>1&&o.jsx("div",{className:"flex justify-center mb-1",children:o.jsx("div",{className:"h-px bg-white/15",style:{width:`${Math.min(c.length*80,320)}px`}})}),o.jsx("div",{className:"flex justify-center gap-3 mb-2 flex-wrap",children:c.map(m=>o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("span",{className:"px-2.5 py-1 text-[10px] font-bold rounded border-2 uppercase",style:{borderColor:kd[m.id]??"#888",color:kd[m.id]??"#888",background:`${kd[m.id]??"#888"}22`},children:m.id}),o.jsx("span",{className:"text-[8px] text-white/30 mt-0.5",children:"direct"})]},m.id))}),u.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex justify-center mb-1",children:o.jsx("div",{className:"w-px h-2 bg-white/10"})}),o.jsx("div",{className:"flex justify-center gap-2 flex-wrap",children:u.map(({node:m})=>o.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))}),o.jsx("div",{className:"text-center text-[8px] text-white/30 mt-1",children:"via re-dispatch"})]})]}),o.jsxs("div",{className:"text-[10px] text-gray-400 mt-1.5",children:[f," role",f!==1?"s":""," will receive this wave"]})]})}function cC({cLevelRoles:t,orgNodes:l,rootId:r,onClose:i,onDispatch:c}){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||(c(u.trim()),i())},d=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&p(),y.key==="Escape"&&i()},g=r&&Object.keys(l).length>0;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),o.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:[o.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[o.jsx("div",{className:"text-lg font-bold",children:"CEO Wave"}),o.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:"Broadcast a directive to all C-Level reports"})]}),o.jsxs("div",{className:"p-5 space-y-4",children:[g&&o.jsx(oC,{orgNodes:l,rootId:r}),!g&&o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Dispatching to"}),o.jsx("div",{className:"flex gap-2 flex-wrap",children:t.length>0?t.map(y=>o.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)):o.jsx("span",{className:"text-xs text-gray-400 italic",children:"No C-Level roles found"})}),o.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Each C-Level receives the directive and delegates to their reports"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Directive"}),o.jsx("textarea",{ref:m,value:u,onChange:y=>f(y.target.value),onKeyDown:d,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"}),o.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Cmd+Enter to dispatch"})]})]}),o.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[o.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"}),o.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 uC(t,l,r){const[i,c]=S.useState(new Map),[u,f]=S.useState(null),m=S.useRef(new Map),p=S.useRef(i);p.current=i,S.useEffect(()=>{if(!r||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[r];j&&(b.set(r,{jobId:null,roleId:r,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")}c(b),t.length>0&&f(t[0].roleId)},[t,l,r]);const d=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 A=`/api/jobs/${b}/stream?from=0`;fetch(A,{signal:k.signal}).then(async R=>{if(!R.ok||!R.body){c(U=>{const X=new Map(U),ne=X.get(v);return ne&&X.set(v,{...ne,streamStatus:"error"}),X});return}c(U=>{const X=new Map(U),ne=X.get(v);return ne&&X.set(v,{...ne,streamStatus:"streaming",status:"running"}),X});const O=R.body.getReader(),L=new TextDecoder;let D="";for(;;){const{done:U,value:X}=await O.read();if(U)break;D+=L.decode(X,{stream:!0});const ne=D.split(`
81
- `);D=ne.pop()??"";let M="";for(const q of ne)if(q.startsWith("event: "))M=q.slice(7).trim();else if(q.startsWith("data: ")){try{const F=JSON.parse(q.slice(6));if(M==="activity"){const W=F;W.seq>C.lastSeq&&(C.lastSeq=W.seq),c(ee=>{const V=new Map(ee),I=V.get(v);if(!I||I.events.some(ce=>ce.seq===W.seq))return ee;const Z={...I,events:[...I.events,W]};if(W.type==="dispatch:start"&&W.data.childJobId){const ce=W.data.childJobId,we=W.data.targetRoleId??W.data.roleId;if(we){const z=V.get(we);z&&(V.set(we,{...z,jobId:ce,status:"running",streamStatus:"connecting"}),setTimeout(()=>d(ce,we),0))}}return W.type==="job:done"?(Z.status="done",Z.streamStatus="done"):W.type==="job:error"&&(Z.status="error",Z.streamStatus="error"),V.set(v,Z),V})}else if(M==="stream:end"){const W=F.reason;c(ee=>{const V=new Map(ee),I=V.get(v);if(!I)return ee;const Z=W==="error"?"error":"done";return V.set(v,{...I,status:I.status==="running"?Z:I.status,streamStatus:Z==="error"?"error":"done"}),V})}}catch{}M=""}}}).catch(R=>{R.name!=="AbortError"&&c(O=>{const L=new Map(O),D=L.get(v);return D&&L.set(v,{...D,streamStatus:"error"}),L})})},[]);S.useEffect(()=>{if(t.length!==0){for(const b of t)d(b.jobId,b.roleId);return()=>{for(const[,b]of m.current)b.controller.abort();m.current.clear()}}},[t,d]);const g=(()=>{let b=0,v=0,j=0;for(const[k,C]of i)k!==r&&(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&&c(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 v0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},xa=120,Pl=44,w0=80;function fC(t,l){if(!t.get(l))return{layout:[],width:300,height:200};const i=[],c=[],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);c.length<=y;)c.push([]);c[y].push(g),i.push({roleId:g,x:0,y:y*w0+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(...c.map(g=>g.length))*(xa+16),p=Math.max(m,280);for(const g of c){const y=g.length*(xa+16)-16,b=(p-y)/2;g.forEach((v,j)=>{const k=i.find(C=>C.roleId===v);k&&(k.x=b+j*(xa+16))})}const d=c.length*w0+40;return{layout:i,width:p,height:d}}function dC({nodes:t,rootId:l,selectedRoleId:r,onSelectNode:i}){const{layout:c,width:u,height:f}=fC(t,l),m=d=>{const g=c.find(y=>y.roleId===d);return g?{cx:g.x+xa/2,cy:g.y+Pl/2}:{cx:0,cy:0}},p=d=>{switch(d.status){case"running":return v0[d.roleId]??"#FBBF24";case"done":return"#2E7D32";case"error":return"#C62828";case"not-dispatched":return"#666";default:return"#888"}};return o.jsxs("svg",{viewBox:`0 0 ${u} ${f}`,width:"100%",height:"100%",className:"block",children:[o.jsx("defs",{children:o.jsxs("filter",{id:"glow",children:[o.jsx("feGaussianBlur",{stdDeviation:"2",result:"blur"}),o.jsxs("feMerge",{children:[o.jsx("feMergeNode",{in:"blur"}),o.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),c.filter(d=>d.parentId).map(d=>{const g=m(d.parentId),y=m(d.roleId),b=t.get(d.roleId),v=t.get(d.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=v0[d.roleId]??"#FBBF24",k="6 4",C="wave-edge-flow"),o.jsx("line",{x1:g.cx,y1:g.cy+Pl/2-4,x2:y.cx,y2:y.cy-Pl/2+4,stroke:j,strokeWidth:1.5,strokeDasharray:k,className:C},`${d.parentId}-${d.roleId}`)}),c.map(d=>{const g=t.get(d.roleId);if(!g)return null;const y=p(g),b=r===d.roleId,v=d.roleId===l,j=v?.4:g.status==="not-dispatched"?.35:1;return o.jsxs("g",{transform:`translate(${d.x}, ${d.y})`,style:{cursor:v?"default":"pointer",opacity:j},onClick:()=>!v&&i(d.roleId),children:[o.jsx("rect",{x:0,y:0,width:xa,height:Pl,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":""}),o.jsx("circle",{cx:14,cy:Pl/2,r:4,fill:y,filter:g.status==="running"?"url(#glow)":void 0,children:g.status==="running"&&o.jsx("animate",{attributeName:"opacity",values:"1;0.4;1",dur:"1.5s",repeatCount:"indefinite"})}),o.jsx("text",{x:26,y:Pl/2-4,fill:"var(--terminal-text, #fff)",fontSize:10,fontWeight:700,fontFamily:"var(--pixel-font)",children:g.roleId.toUpperCase()}),o.jsx("text",{x:26,y:Pl/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"&&o.jsx("text",{x:xa-18,y:Pl/2+4,fontSize:14,fill:"#2E7D32",children:"✓"}),g.status==="error"&&o.jsx("text",{x:xa-18,y:Pl/2+4,fontSize:14,fill:"#C62828",children:"✗"})]},d.roleId)})]})}const hC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function mC({directive:t,rootJobs:l,orgNodes:r,rootRoleId:i,onClose:c,onMinimize:u,onDone:f,onOpenKnowledgeDoc:m}){const{nodes:p,selectedRoleId:d,selectNode:g,progress:y,allDone:b}=uC(l,r,i),[v,j]=S.useState(0),[k,C]=S.useState(new Set),E=S.useRef(null),A=S.useRef(Date.now()),R=S.useRef(!1);S.useEffect(()=>{const X=setInterval(()=>{j(Math.floor((Date.now()-A.current)/1e3))},1e3);return()=>clearInterval(X)},[]),S.useEffect(()=>{E.current&&(E.current.scrollTop=E.current.scrollHeight)},[d,p]),S.useEffect(()=>{b&&!R.current&&(R.current=!0,f==null||f())},[b,f]);const O=X=>`${Math.floor(X/60)}:${String(X%60).padStart(2,"0")}`,L=d?p.get(d):null,D=d?hC[d]??"#888":"#888",U=X=>{C(ne=>{const M=new Set(ne);return M.has(X)?M.delete(X):M.add(X),M})};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:b?c:void 0}),o.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:[o.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.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"}}),o.jsx("div",{children:o.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:b?"WAVE COMPLETE":"WAVE COMMAND CENTER"})})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:O(v)}),o.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"]}),o.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&&o.jsx("button",{onClick:c,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),o.jsx("div",{className:"px-5 py-2 border-b border-[var(--terminal-border)] shrink-0",children:o.jsxs("span",{className:"text-[var(--terminal-text-secondary)] text-xs italic",children:["“",t,"”"]})}),o.jsxs("div",{className:"flex flex-1 min-h-0",children:[o.jsxs("div",{className:"w-[280px] shrink-0 border-r border-[var(--terminal-border)] flex flex-col",children:[o.jsx("div",{className:"px-3 py-2 border-b border-[var(--terminal-border)]",children:o.jsx("span",{className:"text-[10px] font-bold text-[var(--terminal-text-secondary)] uppercase tracking-wider",children:"Org Propagation"})}),o.jsx("div",{className:"flex-1 overflow-auto p-3",children:o.jsx(dC,{nodes:p,rootId:i,selectedRoleId:d,onSelectNode:g})}),o.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(X=>o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:X.color,animation:X.dot?"wave-pulse 1.5s ease-in-out infinite":void 0}}),o.jsx("span",{className:"text-[8px] text-[var(--terminal-text-muted)]",children:X.label})]},X.label))})]}),o.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[L&&o.jsxs("div",{className:"px-4 py-2 border-b border-[var(--terminal-border)] shrink-0 flex items-center gap-2",children:[o.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:D}}),o.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-xs",children:L.roleId.toUpperCase()}),o.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs",children:L.roleName}),o.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full font-semibold",style:{background:`${D}22`,color:D},children:L.status==="running"?"Working":L.status==="done"?"Complete":L.status==="error"?"Error":L.status==="waiting"?"Waiting":"Not dispatched"})]}),o.jsxs("div",{ref:E,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[L&&L.events.length===0&&o.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:L.status==="waiting"?"Waiting for dispatch...":L.status==="running"?"Connecting to activity stream...":L.status==="not-dispatched"?"This role was not dispatched in this wave.":""}),L==null?void 0:L.events.map(X=>o.jsx(hg,{event:X,isThinkingCollapsed:k.has(X.seq),onToggleThinking:()=>U(X.seq),onNavigateToJob:ne=>{for(const[,M]of p)if(M.jobId===ne){g(M.roleId);return}},onOpenKnowledgeDoc:m},X.seq)),(L==null?void 0:L.status)==="running"&&o.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),!L&&o.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"}),o.jsxs("div",{className:"px-4 py-2 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:L&&L.events.length>0&&`${L.events.length} events`}),b&&o.jsx("button",{onClick:c,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer",style:{background:"#2E7D32"},children:"Close"})]})]})]})]})]})}const xC={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 Eh(t){return xC[t]??{skinColor:"#B0BEC5",hairColor:"#78909C",shirtColor:"#607D8B",pantsColor:"#455A64",shoeColor:"#37474F"}}const mg=["#FDEBD0","#F5CBA7","#D4A07A","#C68642","#8D5524","#5C3A1E","#F3D1C7","#E8BEAC","#B07D62","#704214"],xg=["#1A0A00","#2C1810","#4E342E","#6D4C41","#8D6E63","#D4A574","#F5E6CA","#FFD700","#B71C1C","#AD1457","#4A148C","#1A237E","#004D40","#1A1A1A","#78909C","#E0E0E0"],pg=["#1565C0","#E65100","#2E7D32","#4A148C","#AD1457","#00695C","#D32F2F","#F57F17","#1B5E20","#283593","#4E342E","#37474F","#880E4F","#00838F","#6A1B9A","#FF6F00"],yg=["#37474F","#1A237E","#3E2723","#263238","#1B5E20","#455A64","#212121","#4E342E","#0D47A1","#311B92"],gg=["#212121","#1A1A1A","#37474F","#4E342E","#7B1FA2","#D32F2F","#1565C0","#F57F17","#2E7D32","#FFFFFF"],Hr={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 pC({color:t,selected:l,onClick:r}){return o.jsx("button",{onClick:r,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 bs({label:t,presets:l,value:r,onChange:i}){return o.jsxs("div",{className:"customize-row",children:[o.jsxs("div",{className:"customize-row-header",children:[o.jsx("span",{className:"customize-row-label",children:t}),o.jsx("div",{className:"customize-row-current",style:{background:r}})]}),o.jsx("div",{className:"customize-swatches",children:l.map(c=>o.jsx(pC,{color:c,selected:c===r,onClick:()=>i(c)},c))})]})}function Sd({label:t,items:l,value:r,onChange:i,lockInfo:c}){return o.jsxs("div",{className:"customize-row",children:[o.jsx("div",{className:"customize-row-header",children:o.jsx("span",{className:"customize-row-label",children:t})}),o.jsx("div",{className:"customize-swatches",style:{gap:4},children:l.map(u=>{const f=c?c.getLockLevel(u.id):1,m=u.id===r,p=c?f>c.roleLevel&&!m:!1,d=c?m&&f>c.roleLevel:!1;return o.jsxs("button",{onClick:()=>{p||i(u.id===r?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?d?"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&&o.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]}),d&&o.jsxs("span",{style:{position:"absolute",bottom:-8,left:"50%",transform:"translateX(-50%)",fontSize:7,color:"#F59E0B",whiteSpace:"nowrap"},children:["⚠"," Lv.",f]})]},u.id)})})]})}function jd({label:t,active:l,onClick:r}){return o.jsx("button",{onClick:r,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 _r(t){return t[Math.floor(Math.random()*t.length)]}function js(t){var c,u,f;const l=tg(),r=ng(),i=lg().filter(m=>!t||ag(m.id,t));return{skinColor:_r(mg),hairColor:_r(xg),shirtColor:_r(pg),pantsColor:_r(yg),shoeColor:_r(gg),hairStyle:(c=_r(l))==null?void 0:c.id,outfitStyle:(u=_r(r))==null?void 0:u.id,accessory:(f=_r(i))==null?void 0:f.id}}function bg({roleId:t,appearance:l,onChange:r,onRandomize:i,onReset:c,label:u,roleLevel:f}){const[m,p]=S.useState("look"),d=S.useCallback((C,E)=>{r({...l,[C]:E})},[l,r]),g=S.useRef(null),y=S.useCallback(C=>{var R;const E=(R=C.target.files)==null?void 0:R[0];if(!E)return;const A=new Image;A.onload=()=>{const O=$S(A);r({...O,hairStyle:l.hairStyle,outfitStyle:l.outfitStyle,accessory:l.accessory}),URL.revokeObjectURL(A.src)},A.src=URL.createObjectURL(E),C.target.value=""},[l.hairStyle,l.outfitStyle,l.accessory,r]),b=tg(),v=ng(),j=lg(),k=f!==void 0?j.filter(C=>ag(C.id,f)).length:j.length;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"customize-preview",children:[o.jsx("div",{className:"customize-preview-bg",children:o.jsx(Ic,{roleId:t,appearance:l,scale:12})}),u&&o.jsx("div",{className:"customize-preview-name",children:u}),o.jsxs("div",{className:"customize-preview-actions",children:[o.jsx("button",{className:"customize-btn customize-btn--random",onClick:i,children:"RANDOM"}),o.jsx("button",{className:"customize-btn customize-btn--reset",onClick:c,children:"RESET"}),o.jsx("button",{className:"customize-btn",onClick:()=>{var C;return(C=g.current)==null?void 0:C.click()},style:{fontSize:9,opacity:.7},children:"PHOTO"}),o.jsx("input",{ref:g,type:"file",accept:"image/*",onChange:y,style:{display:"none"}})]})]}),o.jsxs("div",{className:"customize-colors",children:[o.jsxs("div",{style:{display:"flex",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:[o.jsx(jd,{label:"LOOK",active:m==="look",onClick:()=>p("look")}),o.jsx(jd,{label:"OUTFIT",active:m==="outfit",onClick:()=>p("outfit")}),o.jsx(jd,{label:"ACCESSORY",active:m==="accessory",onClick:()=>p("accessory")})]}),m==="look"&&o.jsxs(o.Fragment,{children:[o.jsx(bs,{label:"SKIN",presets:mg,value:l.skinColor,onChange:C=>d("skinColor",C)}),o.jsx(bs,{label:"HAIR COLOR",presets:xg,value:l.hairColor,onChange:C=>d("hairColor",C)}),o.jsx(Sd,{label:"HAIR STYLE",items:b,value:l.hairStyle,onChange:C=>d("hairStyle",C)})]}),m==="outfit"&&o.jsxs(o.Fragment,{children:[o.jsx(Sd,{label:"STYLE",items:v,value:l.outfitStyle,onChange:C=>d("outfitStyle",C)}),o.jsx(bs,{label:"TOP",presets:pg,value:l.shirtColor,onChange:C=>d("shirtColor",C)}),o.jsx(bs,{label:"PANTS",presets:yg,value:l.pantsColor,onChange:C=>d("pantsColor",C)}),o.jsx(bs,{label:"SHOES",presets:gg,value:l.shoeColor,onChange:C=>d("shoeColor",C)})]}),m==="accessory"&&o.jsxs(o.Fragment,{children:[f!==void 0&&o.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:[o.jsxs("span",{children:["Lv.",f]}),o.jsxs("span",{children:[k,"/",j.length," unlocked"]})]}),o.jsx(Sd,{label:"ACCESSORY",items:j,value:l.accessory,onChange:C=>d("accessory",C),lockInfo:f!==void 0?{roleLevel:f,getLockLevel:rg}:void 0}),o.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 yC=[{value:"c-level",label:"C-Level"},{value:"team-lead",label:"Team Lead"},{value:"member",label:"Member"}];function vg(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,24)}function k0(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 vs=4;function gC(t,l,r){const i=t.trim();if(!i||i.startsWith("#"))return null;const c=i.split(",").map(y=>y.trim()),u=c[0];if(!u)return null;const f=vg(u),m=(c[1]||"member").toLowerCase(),p=m==="c-level"?"c-level":m==="team-lead"?"team-lead":"member",d=c[2]||"ceo";let g;return l.has(f)?g="ID already exists":r.has(f)&&(g="Duplicate ID in batch"),r.add(f),{name:u,id:f,level:p,reportsTo:d,error:g}}function bC({existingRoles:t,onClose:l,onHire:r}){const[i,c]=S.useState("single"),[u,f]=S.useState(1),[m,p]=S.useState(""),[d,g]=S.useState(""),[y,b]=S.useState(!1),[v,j]=S.useState("member"),[k,C]=S.useState("ceo"),[E,A]=S.useState(""),[R,O]=S.useState(js),[L,D]=S.useState(!1),[U,X]=S.useState(""),[ne,M]=S.useState([]),[q,F]=S.useState(new Set),[W,ee]=S.useState(""),[V,I]=S.useState("input"),[Z,ce]=S.useState({done:0,total:0}),we=S.useRef(null),z=S.useRef(null),B=S.useRef(null);S.useEffect(()=>{Ce.getSkills().then(G=>M(G.filter(re=>re.installed))).catch(()=>{})},[]),S.useEffect(()=>{var G,re,ve;i==="single"?(u===1&&((G=we.current)==null||G.focus()),u===2&&((re=z.current)==null||re.focus())):V==="input"&&((ve=B.current)==null||ve.focus())},[u,i,V]);const Q=S.useMemo(()=>new Set(t.map(G=>G.id)),[t]),T=S.useMemo(()=>{const G=W.split(`
82
- `),re=new Set;return G.map(ve=>gC(ve,Q,re)).filter(ve=>ve!==null)},[W,Q]),me=T.length>0&&T.every(G=>!G.error),Se=G=>{p(G),y||g(vg(G))},Ee=m.trim().length>0&&d.trim().length>0&&!t.some(G=>G.id===d),Be=E.trim().length>0,He=async()=>{D(!0),X("");const G=k0(v);try{await r({id:d,name:m.trim(),level:v,reportsTo:k,persona:E.trim(),...G,skills:q.size>0?[...q]:void 0},R),l()}catch(re){X(re instanceof Error?re.message:"Failed to create role"),D(!1)}},Ke=G=>G===1?Ee:G===2?Be:!0,ke=async()=>{D(!0),X(""),ce({done:0,total:T.length});try{for(let G=0;G<T.length;G++){const re=T[G],ve=k0(re.level),ze=js(),Ne=`${re.name}. A ${re.level} role reporting to ${re.reportsTo}.`;await r({id:re.id,name:re.name,level:re.level,reportsTo:re.reportsTo,persona:Ne,...ve},ze),ce({done:G+1,total:T.length})}l()}catch(G){X(G instanceof Error?G.message:"Failed to create roles"),D(!1)}},yt=G=>{G.key==="Escape"&&l(),G.key==="Enter"&&(G.metaKey||G.ctrlKey)&&(i==="single"?u<vs&&Ke(u)?f(u+1):u===vs&&He():V==="input"&&me?I("review"):V==="review"&&ke())},de=t.some(G=>G.id===d)&&d.length>0;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:l}),o.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:yt,children:[o.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #2E7D32, #43A047)"},children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"text-lg font-bold",children:"Hire New Role"}),o.jsxs("div",{className:"flex bg-black/20 rounded-lg p-0.5",children:[o.jsx("button",{onClick:()=>{c("single"),X("")},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"}),o.jsx("button",{onClick:()=>{c("bulk"),X("")},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"})]})]}),o.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:i==="single"?`Step ${u} of ${vs}`:V==="input"?"Enter roles, one per line":`Review ${T.length} roles`})]}),i==="single"&&o.jsx("div",{className:"flex gap-1 px-5 pt-4",children:Array.from({length:vs},(G,re)=>re+1).map(G=>o.jsx("div",{className:"flex-1 h-1 rounded-full transition-colors",style:{background:G<=u?"#2E7D32":"rgba(255,255,255,0.1)"}},G))}),o.jsx("div",{className:"p-5 min-h-[240px] overflow-y-auto flex-1",children:i==="single"?o.jsxs(o.Fragment,{children:[u===1&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role Name"}),o.jsx("input",{ref:we,value:m,onChange:G=>Se(G.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"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role ID (slug)"}),o.jsx("input",{value:d,onChange:G=>{g(G.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 ${de?"border-red-400":"border-white/10 focus:border-white/25"}`}),de&&o.jsx("div",{className:"text-xs text-red-500 mt-1",children:"ID already exists"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Level"}),o.jsx("div",{className:"flex gap-2",children:yC.map(G=>o.jsx("button",{onClick:()=>j(G.value),className:`flex-1 p-2 text-xs font-semibold rounded-lg border cursor-pointer transition-colors ${v===G.value?"border-green-600 bg-green-900/30 text-green-400":"border-white/10 text-white/50 hover:border-white/20"}`,children:G.label},G.value))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Reports To"}),o.jsxs("select",{value:k,onChange:G=>C(G.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:[o.jsx("option",{value:"ceo",className:"bg-[var(--wall)] text-white",children:"CEO"}),t.map(G=>o.jsxs("option",{value:G.id,className:"bg-[var(--wall)] text-white",children:[G.name," (",G.id,")"]},G.id))]})]})]}),u===2&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Persona"}),o.jsx("textarea",{ref:z,value:E,onChange:G=>A(G.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"}),o.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&&o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Skills"}),o.jsx("div",{className:"space-y-1.5 max-h-[120px] overflow-y-auto",children:ne.map(G=>o.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:[o.jsx("input",{type:"checkbox",checked:q.has(G.id),onChange:()=>F(re=>{const ve=new Set(re);return ve.has(G.id)?ve.delete(G.id):ve.add(G.id),ve}),className:"accent-green-600"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-xs font-semibold text-white/80",children:G.name}),o.jsx("div",{className:"text-[10px] text-white/40 truncate",children:G.description})]})]},G.id))})]})]}),u===3&&o.jsx("div",{className:"customize-body",style:{padding:0},children:o.jsx(bg,{roleId:"default",appearance:R,onChange:O,onRandomize:()=>O(js()),onReset:()=>O(js()),label:o.jsxs("span",{children:[d||"new-role"," — ",m||"New Role"]})})}),u===4&&o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Review"}),o.jsxs("div",{className:"bg-white/5 rounded-xl p-4 border border-white/10",children:[o.jsxs("div",{className:"flex gap-4",children:[o.jsx("div",{className:"flex-shrink-0 rounded-lg overflow-hidden",style:{background:"#0d1117",padding:8},children:o.jsx(Ic,{roleId:"default",appearance:R,scale:4})}),o.jsxs("div",{className:"flex-1 space-y-2.5",children:[o.jsx(ws,{label:"Name",value:m}),o.jsx(ws,{label:"ID",value:d,mono:!0}),o.jsx(ws,{label:"Level",value:v}),o.jsx(ws,{label:"Reports To",value:k}),q.size>0&&o.jsx(ws,{label:"Skills",value:[...q].join(", ")})]})]}),o.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[o.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Persona"}),o.jsx("div",{className:"text-xs text-white/60 leading-relaxed",children:E})]})]}),U&&o.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:U})]})]}):o.jsxs(o.Fragment,{children:[V==="input"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Roles (one per line)"}),o.jsx("textarea",{ref:B,value:W,onChange:G=>ee(G.target.value),placeholder:`Name, Level, ReportsTo
75
+ `))+1))}const f="#".repeat(c),m=r.enter("headingAtx"),x=r.enter("phrasing");u.move(f+" ");let d=r.containerPhrasing(t,{before:"# ",after:`
76
+ `,...u.current()});return/^[\t ]/.test(d)&&(d=Ms(d.charCodeAt(0))+d.slice(1)),d=d?f+" "+d:f,r.options.closeAtx&&(d+=" "+f),x(),m(),d}Fy.peek=f4;function Fy(t){return t.value||""}function f4(){return"<"}_y.peek=d4;function _y(t,l,r,i){const c=yh(r),u=c==='"'?"Quote":"Apostrophe",f=r.enter("image");let m=r.enter("label");const x=r.createTracker(i);let d=x.move("![");return d+=x.move(r.safe(t.alt,{before:d,after:"]",...x.current()})),d+=x.move("]("),m(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(m=r.enter("destinationLiteral"),d+=x.move("<"),d+=x.move(r.safe(t.url,{before:d,after:">",...x.current()})),d+=x.move(">")):(m=r.enter("destinationRaw"),d+=x.move(r.safe(t.url,{before:d,after:t.title?" ":")",...x.current()}))),m(),t.title&&(m=r.enter(`title${u}`),d+=x.move(" "+c),d+=x.move(r.safe(t.title,{before:d,after:c,...x.current()})),d+=x.move(c),m()),d+=x.move(")"),f(),d}function d4(){return"!"}Oy.peek=h4;function Oy(t,l,r,i){const c=t.referenceType,u=r.enter("imageReference");let f=r.enter("label");const m=r.createTracker(i);let x=m.move("![");const d=r.safe(t.alt,{before:x,after:"]",...m.current()});x+=m.move(d+"]["),f();const g=r.stack;r.stack=[],f=r.enter("reference");const y=r.safe(r.associationId(t),{before:x,after:"]",...m.current()});return f(),r.stack=g,u(),c==="full"||!d||d!==y?x+=m.move(y+"]"):c==="shortcut"?x=x.slice(0,-1):x+=m.move("]"),x}function h4(){return"!"}By.peek=m4;function By(t,l,r){let i=t.value||"",c="`",u=-1;for(;new RegExp("(^|[^`])"+c+"([^`]|$)").test(i);)c+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++u<r.unsafe.length;){const f=r.unsafe[u],m=r.compilePattern(f);let x;if(f.atBreak)for(;x=m.exec(i);){let d=x.index;i.charCodeAt(d)===10&&i.charCodeAt(d-1)===13&&d--,i=i.slice(0,d)+" "+i.slice(x.index+1)}}return c+i+c}function m4(){return"`"}function Ly(t,l){const r=oh(t);return!!(!l.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(r===t.url||"mailto:"+r===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}$y.peek=x4;function $y(t,l,r,i){const c=yh(r),u=c==='"'?"Quote":"Apostrophe",f=r.createTracker(i);let m,x;if(Ly(t,r)){const g=r.stack;r.stack=[],m=r.enter("autolink");let y=f.move("<");return y+=f.move(r.containerPhrasing(t,{before:y,after:">",...f.current()})),y+=f.move(">"),m(),r.stack=g,y}m=r.enter("link"),x=r.enter("label");let d=f.move("[");return d+=f.move(r.containerPhrasing(t,{before:d,after:"](",...f.current()})),d+=f.move("]("),x(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(x=r.enter("destinationLiteral"),d+=f.move("<"),d+=f.move(r.safe(t.url,{before:d,after:">",...f.current()})),d+=f.move(">")):(x=r.enter("destinationRaw"),d+=f.move(r.safe(t.url,{before:d,after:t.title?" ":")",...f.current()}))),x(),t.title&&(x=r.enter(`title${u}`),d+=f.move(" "+c),d+=f.move(r.safe(t.title,{before:d,after:c,...f.current()})),d+=f.move(c),x()),d+=f.move(")"),m(),d}function x4(t,l,r){return Ly(t,r)?"<":"["}Hy.peek=p4;function Hy(t,l,r,i){const c=t.referenceType,u=r.enter("linkReference");let f=r.enter("label");const m=r.createTracker(i);let x=m.move("[");const d=r.containerPhrasing(t,{before:x,after:"]",...m.current()});x+=m.move(d+"]["),f();const g=r.stack;r.stack=[],f=r.enter("reference");const y=r.safe(r.associationId(t),{before:x,after:"]",...m.current()});return f(),r.stack=g,u(),c==="full"||!d||d!==y?x+=m.move(y+"]"):c==="shortcut"?x=x.slice(0,-1):x+=m.move("]"),x}function p4(){return"["}function gh(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 y4(t){const l=gh(t),r=t.options.bulletOther;if(!r)return l==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===l)throw new Error("Expected `bullet` (`"+l+"`) and `bulletOther` (`"+r+"`) to be different");return r}function g4(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 Uy(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 b4(t,l,r,i){const c=r.enter("list"),u=r.bulletCurrent;let f=t.ordered?g4(r):gh(r);const m=t.ordered?f==="."?")":".":y4(r);let x=l&&r.bulletLastUsed?f===r.bulletLastUsed:!1;if(!t.ordered){const g=t.children?t.children[0]:void 0;if((f==="*"||f==="-")&&g&&(!g.children||!g.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(x=!0),Uy(r)===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"){x=!0;break}}}}x&&(f=m),r.bulletCurrent=f;const d=r.containerFlow(t,i);return r.bulletLastUsed=f,r.bulletCurrent=u,c(),d}function v4(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 w4(t,l,r,i){const c=v4(r);let u=r.bulletCurrent||gh(r);l&&l.type==="list"&&l.ordered&&(u=(typeof l.start=="number"&&l.start>-1?l.start:1)+(r.options.incrementListMarker===!1?0:l.children.indexOf(t))+u);let f=u.length+1;(c==="tab"||c==="mixed"&&(l&&l.type==="list"&&l.spread||t.spread))&&(f=Math.ceil(f/4)*4);const m=r.createTracker(i);m.move(u+" ".repeat(f-u.length)),m.shift(f);const x=r.enter("listItem"),d=r.indentLines(r.containerFlow(t,m.current()),g);return x(),d;function g(y,b,v){return b?(v?"":" ".repeat(f))+y:(v?u:u+" ".repeat(f-u.length))+y}}function k4(t,l,r,i){const c=r.enter("paragraph"),u=r.enter("phrasing"),f=r.containerPhrasing(t,i);return u(),c(),f}const S4=$c(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function j4(t,l,r,i){return(t.children.some(function(f){return S4(f)})?r.containerPhrasing:r.containerFlow).call(r,t,i)}function C4(t){const l=t.options.strong||"*";if(l!=="*"&&l!=="_")throw new Error("Cannot serialize strong with `"+l+"` for `options.strong`, expected `*`, or `_`");return l}Iy.peek=E4;function Iy(t,l,r,i){const c=C4(r),u=r.enter("strong"),f=r.createTracker(i),m=f.move(c+c);let x=f.move(r.containerPhrasing(t,{after:c,before:m,...f.current()}));const d=x.charCodeAt(0),g=Ac(i.before.charCodeAt(i.before.length-1),d,c);g.inside&&(x=Ms(d)+x.slice(1));const y=x.charCodeAt(x.length-1),b=Ac(i.after.charCodeAt(0),y,c);b.inside&&(x=x.slice(0,-1)+Ms(y));const v=f.move(c+c);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},m+x+v}function E4(t,l,r){return r.options.strong||"*"}function N4(t,l,r,i){return r.safe(t.value,i)}function A4(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 T4(t,l,r){const i=(Uy(r)+(r.options.ruleSpaces?" ":"")).repeat(A4(r));return r.options.ruleSpaces?i.slice(0,-1):i}const Yy={blockquote:Jk,break:e0,code:r4,definition:i4,emphasis:Ry,hardBreak:e0,heading:u4,html:Fy,image:_y,imageReference:Oy,inlineCode:By,link:$y,linkReference:Hy,list:b4,listItem:w4,paragraph:k4,root:j4,strong:Iy,text:N4,thematicBreak:T4};function D4(){return{enter:{table:z4,tableData:t0,tableHeader:t0,tableRow:R4},exit:{codeText:F4,table:M4,tableData:xd,tableHeader:xd,tableRow:xd}}}function z4(t){const l=t._align;this.enter({type:"table",align:l.map(function(r){return r==="none"?null:r}),children:[]},t),this.data.inTable=!0}function M4(t){this.exit(t),this.data.inTable=void 0}function R4(t){this.enter({type:"tableRow",children:[]},t)}function xd(t){this.exit(t)}function t0(t){this.enter({type:"tableCell",children:[]},t)}function F4(t){let l=this.resume();this.data.inTable&&(l=l.replace(/\\([\\|])/g,_4));const r=this.stack[this.stack.length-1];r.type,r.value=l,this.exit(t)}function _4(t,l){return l==="|"?l:t}function O4(t){const l=t||{},r=l.tableCellPadding,i=l.tablePipeAlign,c=l.stringLength,u=r?" ":"|";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:x,tableRow:m}};function f(v,j,S,C){return d(g(v,S,C),v.align)}function m(v,j,S,C){const E=y(v,S,C),A=d([E]);return A.slice(0,A.indexOf(`
78
+ `))}function x(v,j,S,C){const E=S.enter("tableCell"),A=S.enter("phrasing"),M=S.containerPhrasing(v,{...C,before:u,after:u});return A(),E(),M}function d(v,j){return Wk(v,{align:j,alignDelimiters:i,padding:r,stringLength:c})}function g(v,j,S){const C=v.children;let E=-1;const A=[],M=j.enter("table");for(;++E<C.length;)A[E]=y(C[E],j,S);return M(),A}function y(v,j,S){const C=v.children;let E=-1;const A=[],M=j.enter("tableRow");for(;++E<C.length;)A[E]=x(C[E],v,j,S);return M(),A}function b(v,j,S){let C=Yy.inlineCode(v,j,S);return S.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function B4(){return{exit:{taskListCheckValueChecked:n0,taskListCheckValueUnchecked:n0,paragraph:$4}}}function L4(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:H4}}}function n0(t){const l=this.stack[this.stack.length-2];l.type,l.checked=t.type==="taskListCheckValueChecked"}function $4(t){const l=this.stack[this.stack.length-2];if(l&&l.type==="listItem"&&typeof l.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const i=r.children[0];if(i&&i.type==="text"){const c=l.children;let u=-1,f;for(;++u<c.length;){const m=c[u];if(m.type==="paragraph"){f=m;break}}f===r&&(i.value=i.value.slice(1),i.value.length===0?r.children.shift():r.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,r.position.start=Object.assign({},i.position.start)))}}this.exit(t)}function H4(t,l,r,i){const c=t.children[0],u=typeof t.checked=="boolean"&&c&&c.type==="paragraph",f="["+(t.checked?"x":" ")+"] ",m=r.createTracker(i);u&&m.move(f);let x=Yy.listItem(t,l,r,{...i,...m.current()});return u&&(x=x.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),x;function d(g){return g+f}}function U4(){return[bk(),Hk(),qk(),D4(),B4()]}function I4(t){return{extensions:[vk(),Uk(t),Xk(),O4(t),L4()]}}const Y4={tokenize:Q4,partial:!0},qy={tokenize:W4,partial:!0},Xy={tokenize:Z4,partial:!0},Vy={tokenize:J4,partial:!0},q4={tokenize:P4,partial:!0},Gy={name:"wwwAutolink",tokenize:G4,previous:Qy},Ky={name:"protocolAutolink",tokenize:K4,previous:Wy},nr={name:"emailAutolink",tokenize:V4,previous:Zy},Nl={};function X4(){return{text:Nl}}let fa=48;for(;fa<123;)Nl[fa]=nr,fa++,fa===58?fa=65:fa===91&&(fa=97);Nl[43]=nr;Nl[45]=nr;Nl[46]=nr;Nl[95]=nr;Nl[72]=[nr,Ky];Nl[104]=[nr,Ky];Nl[87]=[nr,Gy];Nl[119]=[nr,Gy];function V4(t,l,r){const i=this;let c,u;return f;function f(y){return!Gd(y)||!Zy.call(i,i.previous)||bh(i.events)?r(y):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),m(y))}function m(y){return Gd(y)?(t.consume(y),m):y===64?(t.consume(y),x):r(y)}function x(y){return y===46?t.check(q4,g,d)(y):y===45||y===95||yn(y)?(u=!0,t.consume(y),x):g(y)}function d(y){return t.consume(y),c=!0,x}function g(y){return u&&c&&kn(i.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),l(y)):r(y)}}function G4(t,l,r){const i=this;return c;function c(f){return f!==87&&f!==119||!Qy.call(i,i.previous)||bh(i.events)?r(f):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Y4,t.attempt(qy,t.attempt(Xy,u),r),r)(f))}function u(f){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),l(f)}}function K4(t,l,r){const i=this;let c="",u=!1;return f;function f(y){return(y===72||y===104)&&Wy.call(i,i.previous)&&!bh(i.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),c+=String.fromCodePoint(y),t.consume(y),m):r(y)}function m(y){if(kn(y)&&c.length<5)return c+=String.fromCodePoint(y),t.consume(y),m;if(y===58){const b=c.toLowerCase();if(b==="http"||b==="https")return t.consume(y),x}return r(y)}function x(y){return y===47?(t.consume(y),u?d:(u=!0,x)):r(y)}function d(y){return y===null||Cc(y)||zt(y)||ga(y)||Oc(y)?r(y):t.attempt(qy,t.attempt(Xy,g),r)(y)}function g(y){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),l(y)}}function Q4(t,l,r){let i=0;return c;function c(f){return(f===87||f===119)&&i<3?(i++,t.consume(f),c):f===46&&i===3?(t.consume(f),u):r(f)}function u(f){return f===null?r(f):l(f)}}function W4(t,l,r){let i,c,u;return f;function f(d){return d===46||d===95?t.check(Vy,x,m)(d):d===null||zt(d)||ga(d)||d!==45&&Oc(d)?x(d):(u=!0,t.consume(d),f)}function m(d){return d===95?i=!0:(c=i,i=void 0),t.consume(d),f}function x(d){return c||i||!u?r(d):l(d)}}function Z4(t,l){let r=0,i=0;return c;function c(f){return f===40?(r++,t.consume(f),c):f===41&&i<r?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(Vy,l,u)(f):f===null||zt(f)||ga(f)?l(f):(t.consume(f),c)}function u(f){return f===41&&i++,t.consume(f),c}}function J4(t,l,r){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),c):m===60||m===null||zt(m)||ga(m)?l(m):r(m)}function c(m){return m===null||m===40||m===91||zt(m)||ga(m)?l(m):i(m)}function u(m){return kn(m)?f(m):r(m)}function f(m){return m===59?(t.consume(m),i):kn(m)?(t.consume(m),f):r(m)}}function P4(t,l,r){return i;function i(u){return t.consume(u),c}function c(u){return yn(u)?r(u):l(u)}}function Qy(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||zt(t)}function Wy(t){return!kn(t)}function Zy(t){return!(t===47||Gd(t))}function Gd(t){return t===43||t===45||t===46||t===95||yn(t)}function bh(t){let l=t.length,r=!1;for(;l--;){const i=t[l][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){r=!0;break}if(i._gfmAutolinkLiteralWalkedInto){r=!1;break}}return t.length>0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const eS={tokenize:oS,partial:!0};function tS(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:aS,continuation:{tokenize:iS},exit:sS}},text:{91:{name:"gfmFootnoteCall",tokenize:rS},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:nS,resolveTo:lS}}}}function nS(t,l,r){const i=this;let c=i.events.length;const u=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let f;for(;c--;){const x=i.events[c][1];if(x.type==="labelImage"){f=x;break}if(x.type==="gfmFootnoteCall"||x.type==="labelLink"||x.type==="label"||x.type==="image"||x.type==="link")break}return m;function m(x){if(!f||!f._balanced)return r(x);const d=hl(i.sliceSerialize({start:f.end,end:i.now()}));return d.codePointAt(0)!==94||!u.includes(d.slice(1))?r(x):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(x),t.exit("gfmFootnoteCallLabelMarker"),l(x))}}function lS(t,l){let r=t.length;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};c.end.column++,c.end.offset++,c.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},c.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[r+1],t[r+2],["enter",i,l],t[r+3],t[r+4],["enter",c,l],["exit",c,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(r,t.length-r+1,...m),t}function rS(t,l,r){const i=this,c=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"),x}function x(y){return y!==94?r(y):(t.enter("gfmFootnoteCallMarker"),t.consume(y),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",d)}function d(y){if(u>999||y===93&&!f||y===null||y===91||zt(y))return r(y);if(y===93){t.exit("chunkString");const b=t.exit("gfmFootnoteCallString");return c.includes(hl(i.sliceSerialize(b)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),l):r(y)}return zt(y)||(f=!0),u++,t.consume(y),y===92?g:d}function g(y){return y===91||y===92||y===93?(t.consume(y),u++,d):d(y)}}function aS(t,l,r){const i=this,c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u,f=0,m;return x;function x(j){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(j),t.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(j){return j===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(j),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",g):r(j)}function g(j){if(f>999||j===93&&!m||j===null||j===91||zt(j))return r(j);if(j===93){t.exit("chunkString");const S=t.exit("gfmFootnoteDefinitionLabelString");return u=hl(i.sliceSerialize(S)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(j),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),b}return zt(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"),c.includes(u)||c.push(u),dt(t,v,"gfmFootnoteDefinitionWhitespace")):r(j)}function v(j){return l(j)}}function iS(t,l,r){return t.check(Ls,l,t.attempt(eS,l,r))}function sS(t){t.exit("gfmFootnoteDefinition")}function oS(t,l,r){const i=this;return dt(t,c,"gfmFootnoteDefinitionIndent",5);function c(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):r(u)}}function cS(t){let r=(t||{}).singleTilde;const i={name:"strikethrough",tokenize:u,resolveAll:c};return r==null&&(r=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function c(f,m){let x=-1;for(;++x<f.length;)if(f[x][0]==="enter"&&f[x][1].type==="strikethroughSequenceTemporary"&&f[x][1]._close){let d=x;for(;d--;)if(f[d][0]==="exit"&&f[d][1].type==="strikethroughSequenceTemporary"&&f[d][1]._open&&f[x][1].end.offset-f[x][1].start.offset===f[d][1].end.offset-f[d][1].start.offset){f[x][1].type="strikethroughSequence",f[d][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},f[d][1].start),end:Object.assign({},f[x][1].end)},y={type:"strikethroughText",start:Object.assign({},f[d][1].end),end:Object.assign({},f[x][1].start)},b=[["enter",g,m],["enter",f[d][1],m],["exit",f[d][1],m],["enter",y,m]],v=m.parser.constructs.insideSpan.null;v&&Gn(b,b.length,0,Bc(v,f.slice(d+1,x),m)),Gn(b,b.length,0,[["exit",y,m],["enter",f[x][1],m],["exit",f[x][1],m],["exit",g,m]]),Gn(f,d-1,x-d+3,b),x=d+b.length-2;break}}for(x=-1;++x<f.length;)f[x][1].type==="strikethroughSequenceTemporary"&&(f[x][1].type="data");return f}function u(f,m,x){const d=this.previous,g=this.events;let y=0;return b;function b(j){return d===126&&g[g.length-1][1].type!=="characterEscape"?x(j):(f.enter("strikethroughSequenceTemporary"),v(j))}function v(j){const S=oi(d);if(j===126)return y>1?x(j):(f.consume(j),y++,v);if(y<2&&!r)return x(j);const C=f.exit("strikethroughSequenceTemporary"),E=oi(j);return C._open=!E||E===2&&!!S,C._close=!S||S===2&&!!E,m(j)}}}class uS{constructor(){this.map=[]}add(l,r,i){fS(this,l,r,i)}consume(l){if(this.map.sort(function(u,f){return u[0]-f[0]}),this.map.length===0)return;let r=this.map.length;const i=[];for(;r>0;)r-=1,i.push(l.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),l.length=this.map[r][0];i.push(l.slice()),l.length=0;let c=i.pop();for(;c;){for(const u of c)l.push(u);c=i.pop()}this.map.length=0}}function fS(t,l,r,i){let c=0;if(!(r===0&&i.length===0)){for(;c<t.map.length;){if(t.map[c][0]===l){t.map[c][1]+=r,t.map[c][2].push(...i);return}c+=1}t.map.push([l,r,i])}}function dS(t,l){let r=!1;const i=[];for(;l<t.length;){const c=t[l];if(r){if(c[0]==="enter")c[1].type==="tableContent"&&i.push(t[l+1][1].type==="tableDelimiterMarker"?"left":"none");else if(c[1].type==="tableContent"){if(t[l-1][1].type==="tableDelimiterMarker"){const u=i.length-1;i[u]=i[u]==="left"?"center":"right"}}else if(c[1].type==="tableDelimiterRow")break}else c[0]==="enter"&&c[1].type==="tableDelimiterRow"&&(r=!0);l+=1}return i}function hS(){return{flow:{null:{name:"table",tokenize:mS,resolveAll:xS}}}}function mS(t,l,r){const i=this;let c=0,u=0,f;return m;function m(z){let X=i.events.length-1;for(;X>-1;){const te=i.events[X][1].type;if(te==="lineEnding"||te==="linePrefix")X--;else break}const R=X>-1?i.events[X][1].type:null,W=R==="tableHead"||R==="tableRow"?F:x;return W===F&&i.parser.lazy[i.now().line]?r(z):W(z)}function x(z){return t.enter("tableHead"),t.enter("tableRow"),d(z)}function d(z){return z===124||(f=!0,u+=1),g(z)}function g(z){return z===null?r(z):Ie(z)?u>1?(u=0,i.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),v):r(z):at(z)?dt(t,g,"whitespace")(z):(u+=1,f&&(f=!1,c+=1),z===124?(t.enter("tableCellDivider"),t.consume(z),t.exit("tableCellDivider"),f=!0,g):(t.enter("data"),y(z)))}function y(z){return z===null||z===124||zt(z)?(t.exit("data"),g(z)):(t.consume(z),z===92?b:y)}function b(z){return z===92||z===124?(t.consume(z),y):y(z)}function v(z){return i.interrupt=!1,i.parser.lazy[i.now().line]?r(z):(t.enter("tableDelimiterRow"),f=!1,at(z)?dt(t,j,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):j(z))}function j(z){return z===45||z===58?C(z):z===124?(f=!0,t.enter("tableCellDivider"),t.consume(z),t.exit("tableCellDivider"),S):L(z)}function S(z){return at(z)?dt(t,C,"whitespace")(z):C(z)}function C(z){return z===58?(u+=1,f=!0,t.enter("tableDelimiterMarker"),t.consume(z),t.exit("tableDelimiterMarker"),E):z===45?(u+=1,E(z)):z===null||Ie(z)?O(z):L(z)}function E(z){return z===45?(t.enter("tableDelimiterFiller"),A(z)):L(z)}function A(z){return z===45?(t.consume(z),A):z===58?(f=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(z),t.exit("tableDelimiterMarker"),M):(t.exit("tableDelimiterFiller"),M(z))}function M(z){return at(z)?dt(t,O,"whitespace")(z):O(z)}function O(z){return z===124?j(z):z===null||Ie(z)?!f||c!==u?L(z):(t.exit("tableDelimiterRow"),t.exit("tableHead"),l(z)):L(z)}function L(z){return r(z)}function F(z){return t.enter("tableRow"),I(z)}function I(z){return z===124?(t.enter("tableCellDivider"),t.consume(z),t.exit("tableCellDivider"),I):z===null||Ie(z)?(t.exit("tableRow"),l(z)):at(z)?dt(t,I,"whitespace")(z):(t.enter("data"),$(z))}function $(z){return z===null||z===124||zt(z)?(t.exit("data"),I(z)):(t.consume(z),z===92?ee:$)}function ee(z){return z===92||z===124?(t.consume(z),$):$(z)}}function xS(t,l){let r=-1,i=!0,c=0,u=[0,0,0,0],f=[0,0,0,0],m=!1,x=0,d,g,y;const b=new uS;for(;++r<t.length;){const v=t[r],j=v[1];v[0]==="enter"?j.type==="tableHead"?(m=!1,x!==0&&(l0(b,l,x,d,g),g=void 0,x=0),d={type:"table",start:Object.assign({},j.start),end:Object.assign({},j.end)},b.add(r,0,[["enter",d,l]])):j.type==="tableRow"||j.type==="tableDelimiterRow"?(i=!0,y=void 0,u=[0,0,0,0],f=[0,r+1,0,0],m&&(m=!1,g={type:"tableBody",start:Object.assign({},j.start),end:Object.assign({},j.end)},b.add(r,0,[["enter",g,l]])),c=j.type==="tableDelimiterRow"?2:g?3:1):c&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")?(i=!1,f[2]===0&&(u[1]!==0&&(f[0]=f[1],y=ic(b,l,u,c,void 0,y),u=[0,0,0,0]),f[2]=r)):j.type==="tableCellDivider"&&(i?i=!1:(u[1]!==0&&(f[0]=f[1],y=ic(b,l,u,c,void 0,y)),u=f,f=[u[1],r,0,0])):j.type==="tableHead"?(m=!0,x=r):j.type==="tableRow"||j.type==="tableDelimiterRow"?(x=r,u[1]!==0?(f[0]=f[1],y=ic(b,l,u,c,r,y)):f[1]!==0&&(y=ic(b,l,f,c,r,y)),c=0):c&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")&&(f[3]=r)}for(x!==0&&l0(b,l,x,d,g),b.consume(l.events),r=-1;++r<l.events.length;){const v=l.events[r];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=dS(l.events,r))}return t}function ic(t,l,r,i,c,u){const f=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",m="tableContent";r[0]!==0&&(u.end=Object.assign({},ii(l.events,r[0])),t.add(r[0],0,[["exit",u,l]]));const x=ii(l.events,r[1]);if(u={type:f,start:Object.assign({},x),end:Object.assign({},x)},t.add(r[1],0,[["enter",u,l]]),r[2]!==0){const d=ii(l.events,r[2]),g=ii(l.events,r[3]),y={type:m,start:Object.assign({},d),end:Object.assign({},g)};if(t.add(r[2],0,[["enter",y,l]]),i!==2){const b=l.events[r[2]],v=l.events[r[3]];if(b[1].end=Object.assign({},v[1].end),b[1].type="chunkText",b[1].contentType="text",r[3]>r[2]+1){const j=r[2]+1,S=r[3]-r[2]-1;t.add(j,S,[])}}t.add(r[3]+1,0,[["exit",y,l]])}return c!==void 0&&(u.end=Object.assign({},ii(l.events,c)),t.add(c,0,[["exit",u,l]]),u=void 0),u}function l0(t,l,r,i,c){const u=[],f=ii(l.events,r);c&&(c.end=Object.assign({},f),u.push(["exit",c,l])),i.end=Object.assign({},f),u.push(["exit",i,l]),t.add(r+1,0,u)}function ii(t,l){const r=t[l],i=r[0]==="enter"?"start":"end";return r[1][i]}const pS={name:"tasklistCheck",tokenize:gS};function yS(){return{text:{91:pS}}}function gS(t,l,r){const i=this;return c;function c(x){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?r(x):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(x),t.exit("taskListCheckMarker"),u)}function u(x){return zt(x)?(t.enter("taskListCheckValueUnchecked"),t.consume(x),t.exit("taskListCheckValueUnchecked"),f):x===88||x===120?(t.enter("taskListCheckValueChecked"),t.consume(x),t.exit("taskListCheckValueChecked"),f):r(x)}function f(x){return x===93?(t.enter("taskListCheckMarker"),t.consume(x),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),m):r(x)}function m(x){return Ie(x)?l(x):at(x)?t.check({tokenize:bS},l,r)(x):r(x)}}function bS(t,l,r){return dt(t,i,"whitespace");function i(c){return c===null?r(c):l(c)}}function vS(t){return sy([X4(),tS(),cS(t),hS(),yS()])}const wS={};function Jy(t){const l=this,r=t||wS,i=l.data(),c=i.micromarkExtensions||(i.micromarkExtensions=[]),u=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),f=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);c.push(vS(r)),u.push(U4()),f.push(I4(r))}function Hs({content:t,className:l=""}){return o.jsx("div",{className:`office-markdown ${l}`,children:o.jsx(Ay,{remarkPlugins:[Jy],components:{code:kS,table:({children:r})=>o.jsx("div",{className:"overflow-x-auto my-2",children:o.jsx("table",{className:"office-table",children:r})})},children:t})})}function kS({className:t,children:l,...r}){const i=/language-(\w+)/.exec(t??"");return i||typeof l=="string"&&l.includes(`
79
+ `)?o.jsx(SS,{language:i==null?void 0:i[1],children:l}):o.jsx("code",{className:"bg-gray-100 text-gray-700 px-1 py-0.5 rounded text-[0.9em] font-mono",...r,children:l})}function SS({children:t,language:l}){const[r,i]=k.useState(!1),c=String(t).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(c),i(!0),setTimeout(()=>i(!1),1500)};return o.jsxs("div",{className:"office-code-block group relative my-2",children:[l&&o.jsx("div",{className:"text-[10px] text-gray-400 px-3 pt-1.5",children:l}),o.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:r?"Copied!":"Copy"}),o.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:o.jsx("code",{children:c})})]})}const r0={$skin:"skinColor",$hair:"hairColor",$shirt:"shirtColor",$pants:"pantsColor",$shoes:"shoeColor"},jS=/^(darken|lighten)\((\$\w+),\s*(\d+)\)$/;function CS(t,l){const r=parseInt(t.replace("#",""),16),i=Math.max(0,(r>>16&255)-l),c=Math.max(0,(r>>8&255)-l),u=Math.max(0,(r&255)-l);return`#${(i<<16|c<<8|u).toString(16).padStart(6,"0")}`}function ES(t,l){const r=parseInt(t.replace("#",""),16),i=Math.min(255,(r>>16&255)+l),c=Math.min(255,(r>>8&255)+l),u=Math.min(255,(r&255)+l);return`#${(i<<16|c<<8|u).toString(16).padStart(6,"0")}`}function Py(t,l){const r=r0[t];if(r&&l)return l[r];const i=jS.exec(t);if(i){const[,c,u,f]=i,m=r0[u],x=m&&l?l[m]:u,d=parseInt(f,10);return c==="darken"?CS(x,d):ES(x,d)}return t}function a0(t,l=12){return t.map(r=>({...r,x:l-r.x-r.w}))}function NS(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:a0(t.left.pixels)}:l==="left"&&t.right?{name:t.right.name,pixels:a0(t.right.pixels)}:t.down}function AS(t,l){return Kd(t,"hair",l,1)}function Kd(t,l,r,i){const c=t.layers.findIndex(f=>f.name===l),u=[...t.layers];if(c>=0)u[c]={...r,name:l};else{const f=i??u.length;u.splice(f,0,{...r,name:l})}return{...t,layers:u}}const vh=new Map,wh=new Map;function eg(t,l){vh.set(t,l)}function Uc(t,l){wh.set(t,l)}function Qd(t){return vh.get(t)}function TS(t){return wh.get(t)}function vN(){return Array.from(vh.keys())}function wN(){return Array.from(wh.keys())}function DS(t,l,r,i,c=2){t.clearRect(0,0,l.width*c,l.height*c);for(const u of l.layers)tg(t,u.pixels,c,r,i)}function Wd(t,l,r,i,c){for(const u of l){const f=Py(u.c,c);u.a!==void 0&&u.a!==1&&(t.globalAlpha=u.a),t.fillStyle=f,t.fillRect(r+u.x,i+u.y,u.w,u.h),u.a!==void 0&&u.a!==1&&(t.globalAlpha=1)}}function zS(t,l){const r=l.scale;t.clearRect(0,0,l.canvasWidth,l.canvasHeight),tg(t,l.pixels,r,0)}function tg(t,l,r,i,c){for(const u of l){const f=Py(u.c,c);u.a!==void 0&&u.a!==1&&(t.globalAlpha=u.a),t.fillStyle=f,t.fillRect(u.x*r,(u.y+i)*r,u.w*r,u.h*r),u.a!==void 0&&u.a!==1&&(t.globalAlpha=1)}}const Tc=new Map;function Ir(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Tc.set(t,{id:t,name:l,layer:{...c.down,name:"hair"},directions:{down:{...c.down,name:"hair"},up:c.up?{...c.up,name:"hair"}:void 0,left:c.left?{...c.left,name:"hair"}:void 0,right:c.right?{...c.right,name:"hair"}:void 0}})}else{const c=r;Tc.set(t,{id:t,name:l,layer:{...c,name:"hair"}})}}function MS(t){return Tc.get(t)}function ng(){return Array.from(Tc.values())}Ir("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}]}});Ir("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}]}});Ir("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}]}});Ir("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}]}});Ir("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"}]}});Ir("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}]}});Ir("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}]}});Ir("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 Dc=new Map;function Al(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Dc.set(t,{id:t,name:l,layer:{...c.down,name:"torso"},directions:{down:{...c.down,name:"torso"},up:c.up?{...c.up,name:"torso"}:void 0,left:c.left?{...c.left,name:"torso"}:void 0,right:c.right?{...c.right,name:"torso"}:void 0}})}else{const c=r;Dc.set(t,{id:t,name:l,layer:{...c,name:"torso"}})}}function RS(t){return Dc.get(t)}function lg(){return Array.from(Dc.values())}Al("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"}]}});Al("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"}]}});Al("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"}]}});Al("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)"}]}});Al("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)"}]}});Al("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"}]}});Al("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"}]}});Al("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"}]}});Al("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"}]}});Al("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 Rs=new Map;function vt(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Rs.set(t,{id:t,name:l,layer:{...c.down,name:"accessory"},directions:{down:{...c.down,name:"accessory"},up:c.up?{...c.up,name:"accessory"}:void 0,left:c.left?{...c.left,name:"accessory"}:void 0,right:c.right?{...c.right,name:"accessory"}:void 0}})}else{const c=r;Rs.set(t,{id:t,name:l,layer:{...c,name:"accessory"}})}}function FS(t){return Rs.get(t)}function _S(t,l){const r=Rs.get(t);if(!r)return;if(r.directions)return NS(r.directions,l);if(l==="down")return r.layer;const i=r.layer.pixels.filter(u=>u.y<2);if(i.length===0)return;const c=l==="right"?1:l==="left"?-1:0;return{name:r.layer.name,pixels:c?i.map(u=>({...u,x:u.x+c})):i}}function rg(){return Array.from(Rs.values())}vt("none","None",{name:"accessory",pixels:[]});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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"}]}});vt("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}]}});vt("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}]}});vt("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"}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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"}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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}]}});vt("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"}]}});vt("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"}]}});vt("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}]}});vt("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}]}});vt("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 OS={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 ag(t){return OS[t]??1}function ig(t,l){return l>=ag(t)}vt("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 ys({r:t,g:l,b:r}){return`#${(t<<16|l<<8|r).toString(16).padStart(6,"0")}`}function vc(t,l){const r=t.r-l.r,i=t.g-l.g,c=t.b-l.b;return r*r+i*i+c*c}function BS(t,l){const r=[];r.push(t[Math.floor(Math.random()*t.length)]);for(let i=1;i<l;i++){const c=t.map(m=>{let x=1/0;for(const d of r)x=Math.min(x,vc(m,d));return x}),u=c.reduce((m,x)=>m+x,0);let f=Math.random()*u;for(let m=0;m<t.length;m++)if(f-=c[m],f<=0){r.push(t[m]);break}r.length<=i&&r.push(t[Math.floor(Math.random()*t.length)])}return r}function LS(t,l,r=20){if(t.length===0)return[];const i=BS(t,l);for(let u=0;u<r;u++){const f=Array.from({length:l},()=>[]);for(const x of t){let d=1/0,g=0;for(let y=0;y<l;y++){const b=vc(x,i[y]);b<d&&(d=b,g=y)}f[g].push(x)}let m=!0;for(let x=0;x<l;x++){if(f[x].length===0)continue;const d={r:0,g:0,b:0};for(const b of f[x])d.r+=b.r,d.g+=b.g,d.b+=b.b;const g=f[x].length,y={r:Math.round(d.r/g),g:Math.round(d.g/g),b:Math.round(d.b/g)};vc(y,i[x])>1&&(m=!1),i[x]=y}if(m)break}const c=new Array(l).fill(0);for(const u of t){let f=1/0,m=0;for(let x=0;x<l;x++){const d=vc(u,i[x]);d<f&&(f=d,m=x)}c[m]++}return i.map((u,f)=>({c:u,count:c[f]})).sort((u,f)=>f.count-u.count).map(u=>u.c)}function $S(t,l=1e4){const r=document.createElement("canvas"),i=t instanceof HTMLImageElement?t.naturalWidth:t.width,c=t instanceof HTMLImageElement?t.naturalHeight:t.height;r.width=i,r.height=c;const u=r.getContext("2d");u.drawImage(t,0,0);const f=u.getImageData(0,0,i,c).data,m=i*c,x=Math.max(1,Math.floor(m/l)),d=[];for(let g=0;g<m;g+=x){const y=g*4;f[y+3]<128||d.push({r:f[y],g:f[y+1],b:f[y+2]})}return d}function i0(t){return .299*t.r+.587*t.g+.114*t.b}function s0(t){const l=Math.max(t.r,t.g,t.b),r=Math.min(t.r,t.g,t.b);return l===0?0:(l-r)/l*255}function HS(t,l=8){const r=$S(t),i=LS(r,l);if(i.length<5)return{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121"};const c=[...i].sort((y,b)=>i0(b)-i0(y)),u=[...i].sort((y,b)=>s0(b)-s0(y)),f=c[0],m=c[c.length-1],x=u[0],d=c[c.length-2],g=c[c.length-1];return{skinColor:ys(f),hairColor:ys(m),shirtColor:ys(x),pantsColor:ys(d),shoeColor:ys(g)}}const US=[{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}],IS=[{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"}],YS=[{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"}],qS=[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:10,y:1,w:2,h:3,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:2,y:2,w:8,h:1,c:"darken($hair, 20)",a:.2}];function XS(){return{width:12,height:22,layers:[{name:"lower",pixels:US},{name:"torso",pixels:IS},{name:"head",pixels:YS},{name:"hair",pixels:qS},{name:"accessory",pixels:[]}]}}const VS=["cto","cbo","pm","engineer","designer","qa","data-analyst","default"];for(const t of VS)eg(`mini:${t}`,XS());const GS=[{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"}],KS=[{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"}],QS=[{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 WS(){return{width:12,height:22,layers:[{name:"torso",pixels:GS},{name:"head",pixels:KS},{name:"hair",pixels:QS},{name:"accessory",pixels:[]}]}}eg("mini-seated:default",WS());const ZS={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"}]},JS={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"}]},PS={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"}]},ej={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"}]};Uc("meeting",ZS);Uc("bulletin",JS);Uc("decision",ej);Uc("knowledge",PS);const pd=16,yd=24,tj=60,nj={cbo:0,cto:8,pm:15,engineer:22,designer:5,qa:12};function sg(t,l){if(!t)return t;let r=t;if(l!=null&&l.hairStyle){const i=MS(l.hairStyle);i&&(r=AS(r,i.layer))}if(l!=null&&l.outfitStyle){const i=RS(l.outfitStyle);i&&(r=Kd(r,"torso",i.layer,1))}if(l!=null&&l.accessory&&l.accessory!=="none"){const i=FS(l.accessory);i&&(r=Kd(r,"accessory",i.layer))}return r}function Ic({roleId:t,className:l,appearance:r,scale:i}){const c=k.useRef(null),u=k.useRef(0),f=k.useRef(0),m=k.useRef(r);m.current=r;const x=i??4,d=pd*x,g=yd*x,y=k.useMemo(()=>{const b=Qd(`mini:${t}`)??Qd("mini:default");return sg(b,r)},[t,r==null?void 0:r.hairStyle,r==null?void 0:r.outfitStyle,r==null?void 0:r.accessory]);return k.useEffect(()=>{const b=c.current;if(!b)return;const v=b.getContext("2d");if(!v)return;const j=nj[t]??0,S=()=>{f.current++;const C=m.current;if(!C||!y){u.current=requestAnimationFrame(S);return}const A=(f.current+j)%tj<30?1:0;v.clearRect(0,0,pd,yd),v.save(),v.translate(2,1),DS(v,y,A,C,1),v.restore(),u.current=requestAnimationFrame(S)};return u.current=requestAnimationFrame(S),()=>cancelAnimationFrame(u.current)},[t,y]),o.jsx("canvas",{ref:c,width:pd,height:yd,className:l,style:{imageRendering:"pixelated",display:"block",width:d,height:g}})}const lj="https://api.tycono.ai",kh=lj;async function sc(t){const l=await fetch(`${kh}${t}`);if(!l.ok)throw new Error(`Cloud API error: ${l.status}`);return l.json()}async function oc(t,l){const r=await fetch(`${kh}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw new Error(`Cloud API error: ${r.status}`);return r.json()}const Ts={health:()=>sc("/api/health"),getCharacters:()=>sc("/api/store/characters"),getCharacter:t=>sc(`/api/store/characters/${t}`),getCharacterVersion:t=>sc(`/api/store/characters/${t}/version`),syncCheck:t=>oc("/api/sync/check",{roles:t}),syncPull:t=>oc("/api/sync/pull",{sourceId:t}),publishCharacter:t=>oc("/api/store/publish",t),deleteCharacter:t=>fetch(`${kh}/api/store/characters/${t}`,{method:"DELETE"}).then(l=>l.json()),uploadTelemetry:t=>oc("/api/telemetry",t)},rj={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"},gd={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},aj={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},ij=500,o0=360,c0=700,sj=t=>`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`;function oj({role:t,allRoles:l,recentActivity:r,onClose:i,onFireRole:c,terminalWidth:u=0,activeJobId:f,activeTask:m,isWorking:x,jobStartedAt:d,onStopJob:g,sessions:y,streamingSessionId:b,onCreateSessionSilent:v,onSendMessage:j,onFocusTerminal:S,onCustomize:C,onUpdateRole:E,appearance:A,relationships:M,roleLevel:O}){var De,Ue;const[L,F]=k.useState(ij),[I,$]=k.useState(!1),ee=k.useRef(0),z=k.useRef(0),[X,R]=k.useState(!1),[W,te]=k.useState(!1),[V,Y]=k.useState(!1),[Z,ce]=k.useState(!1),[we,D]=k.useState("talk"),[B,Q]=k.useState(!1),[T,me]=k.useState(""),[Se,Ee]=k.useState(!1),Be=k.useRef(null),{events:He,status:Ke}=V0(f??null),[ke,yt]=k.useState(0);k.useEffect(()=>{if(!x||!d){yt(0);return}const ye=new Date(d).getTime(),je=()=>yt(Math.floor((Date.now()-ye)/1e3));je();const jt=setInterval(je,1e3);return()=>clearInterval(jt)},[x,d]);const de=u>0,G=de?u:0,re=de?Math.max(o0,window.innerWidth-u-100):c0,ve=Math.min(L,re),ze=k.useCallback(ye=>{ye.preventDefault(),ee.current=ye.clientX,z.current=ve,$(!0);const je=wt=>{const Xe=ee.current-wt.clientX,ft=Math.min(c0,Math.max(o0,z.current+Xe));F(ft)},jt=()=>{$(!1),document.removeEventListener("mousemove",je),document.removeEventListener("mouseup",jt)};document.addEventListener("mousemove",je),document.addEventListener("mouseup",jt)},[ve]),Ne=k.useRef(null),Te=t?y.find(ye=>ye.roleId===t.id):null,Me=ye=>{if(!t)return;const je=x?"talk":we;Te?(j(Te.id,ye,je),S(t.id)):(Ne.current={content:ye,mode:je},v(t.id))};k.useEffect(()=>{if(Te&&Ne.current){const{content:ye,mode:je}=Ne.current;Ne.current=null,j(Te.id,ye,je),t&&S(t.id)}},[Te==null?void 0:Te.id]);const Oe=(()=>{if(!He.length)return null;const ye=[];let je=0,jt=0,wt=0;for(const Xe of He)if(Xe.type==="thinking")je++;else if(Xe.type==="text")jt++;else if(Xe.type==="tool:start"){const ft=String(Xe.data.name??"");ye.includes(ft)||ye.push(ft)}else Xe.type==="dispatch:start"&&wt++;return{tools:ye,thinkCount:je,textCount:jt,dispatchCount:wt,total:He.length}})(),tt=m||(()=>{if(!Te)return null;const ye=Te.messages;for(let je=ye.length-1;je>=0;je--)if(ye[je].from==="ceo")return ye[je].content;return null})(),Lt=(()=>{if(!Te)return null;const ye=Te.messages;for(let je=ye.length-1;je>=0;je--)if(ye[je].from==="role"&&ye[je].content)return ye[je].content;return null})();if(!t)return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:G},onClick:i}),o.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px]",style:{right:G,width:ve,background:"var(--terminal-bg)",borderLeftColor:"var(--pixel-border)"},children:o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading role..."})})]});const gt=gd[t.id]??"#666",ht=rj[t.id]??"👤",Zt=l.filter(ye=>ye.reportsTo===t.id),ae=Te&&b===Te.id,xe=t.name||aj[t.id]||t.id;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:G},onClick:i}),o.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)] ${I?"resizing":""}`,style:{borderLeftColor:gt,right:G,width:ve,background:"var(--terminal-bg)"},children:[o.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${I?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:ze}),o.jsxs("div",{className:"relative shrink-0 overflow-hidden",style:{background:`linear-gradient(135deg, ${gt}ee, ${gt}99)`},children:[o.jsx("div",{className:"absolute inset-0 opacity-[0.06]",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 8px, white 8px, white 9px)"}}),o.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-1.5 z-10",children:[C&&o.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:"🎨"}),o.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:"×"})]}),o.jsxs("div",{className:"relative flex items-end gap-4 px-4 pt-4 pb-3",children:[o.jsx("div",{className:"shrink-0 relative",style:{marginBottom:-2},children:o.jsx("div",{className:"rounded-lg p-1",style:{background:"rgba(0,0,0,0.2)"},children:o.jsx(Ic,{roleId:t.id,appearance:A,scale:8})})}),o.jsxs("div",{className:"flex-1 min-w-0 text-white pb-1",children:[o.jsxs("div",{className:"text-lg font-bold flex items-center gap-2",style:{fontFamily:"var(--pixel-font)"},children:[ht," ",t.id.toUpperCase(),x&&o.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"})]}),B?o.jsxs("form",{className:"flex items-center gap-1.5 mt-0.5",onSubmit:async ye=>{ye.preventDefault();const je=T.trim();if(!je||je===xe||!E){Q(!1);return}Ee(!0);try{await E(t.id,{name:je})}catch{}Ee(!1),Q(!1)},children:[o.jsx("input",{ref:Be,value:T,onChange:ye=>me(ye.target.value),onKeyDown:ye=>{ye.key==="Escape"&&Q(!1)},disabled:Se,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"}}),o.jsx("button",{type:"submit",disabled:Se,className:"text-white/80 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✓"}),o.jsx("button",{type:"button",onClick:()=>Q(!1),className:"text-white/60 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✕"})]}):o.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&&(me(xe),Q(!0))},title:E?"Click to edit name":void 0,children:[xe,E&&o.jsx("span",{className:"opacity-0 group-hover/name:opacity-60 text-[10px]",children:"✎"})]})]})]}),o.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:[o.jsxs("span",{children:["Lv.",O??1]}),o.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),o.jsxs("span",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:x?"var(--idle-amber)":"var(--active-green)"}}),x?"Working":"Idle"]}),o.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),o.jsx("span",{children:t.level}),t.reportsTo&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),o.jsxs("span",{className:"opacity-60",children:["→"," ",t.reportsTo]})]})]})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:[x&&o.jsxs("div",{className:"px-4 py-3 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"var(--idle-amber)"}}),o.jsxs("span",{className:"text-xs font-semibold",style:{color:"var(--idle-amber)"},children:["Working",ke>0?` · ${sj(ke)}`:""]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>S(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"}),f&&g&&o.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"})]})]}),tt&&o.jsx("div",{className:"text-xs truncate",style:{color:"var(--terminal-text-secondary)"},children:tt})]}),x&&f&&Oe&&o.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Activity"}),o.jsx("button",{onClick:()=>S(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"View details ↗"})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[Oe.thinkCount>0&&o.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:[o.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:"#a855f7"}}),"thinking ×",Oe.thinkCount]}),Oe.tools.map(ye=>o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa"},children:ye},ye)),Oe.dispatchCount>0&&o.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(249,115,22,0.15)",color:"#fb923c"},children:["dispatch ×",Oe.dispatchCount]}),Oe.textCount>0&&o.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(34,197,94,0.15)",color:"#4ade80"},children:["output ×",Oe.textCount]}),(Ke==="streaming"||Ke==="connecting")&&o.jsx("span",{className:"inline-block w-1.5 h-3 animate-pulse rounded-sm",style:{background:"var(--active-green)"}})]}),o.jsxs("div",{className:"text-[10px] mt-1",style:{color:"var(--terminal-text-muted)"},children:[Oe.total," events"]})]}),x&&Lt&&o.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Last Message"}),o.jsx("button",{onClick:()=>S(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"})]}),o.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:[Lt.slice(0,200),Lt.length>200&&"..."]})]}),x&&o.jsx("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:o.jsx(u0,{onSend:Me,disabled:!!ae,placeholder:"Ask something...",color:gt})}),!x&&o.jsxs("div",{className:"px-4 pt-4 pb-2",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-secondary)"},children:"Latest"}),o.jsx(uj,{icon:ht,roleId:t.id,roleName:xe,color:gt,text:r})]}),!x&&o.jsx("div",{className:"px-4 py-3",style:{borderBottom:"1px solid var(--terminal-border)"},children:o.jsxs("div",{className:"rounded-xl overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[Lt&&o.jsxs("div",{className:"px-3 pt-2.5 pb-2 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--terminal-border)"},onClick:()=>S(t.id),children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Last response"}),o.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"View ↗"})]}),o.jsxs("div",{className:"text-xs leading-relaxed line-clamp-2 overflow-hidden",style:{color:"var(--terminal-text-secondary)"},children:[Lt.slice(0,150),Lt.length>150&&"..."]})]}),o.jsx("div",{className:"p-2",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("div",{className:"flex rounded-lg overflow-hidden shrink-0",style:{border:"1px solid var(--pixel-border)"},children:[o.jsx("button",{onClick:()=>D("talk"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:we==="talk"?"var(--accent)":"transparent",color:we==="talk"?"#fff":"var(--terminal-text-secondary)"},children:"Talk"}),o.jsx("button",{onClick:()=>D("do"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:we==="do"?"var(--idle-amber)":"transparent",color:we==="do"?"#fff":"var(--terminal-text-secondary)"},children:"Do"})]}),o.jsx(u0,{onSend:Me,disabled:!!ae,placeholder:we==="talk"?"Ask something...":"Give a directive...",color:gt})]})})]})}),o.jsxs("div",{className:"px-4 py-2 space-y-1",children:[o.jsxs(cc,{title:`Profile${t.persona?"":" (empty)"}`,open:X,onToggle:()=>R(ye=>!ye),children:[t.persona&&o.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}),o.jsxs("div",{className:"space-y-0 mt-2",children:[o.jsx(bd,{label:"Level",value:t.level}),o.jsx(bd,{label:"Reports to",value:t.reportsTo}),o.jsx(bd,{label:"Status",value:t.status})]}),Zt.length>0&&o.jsxs("div",{className:"mt-3",children:[o.jsx("div",{className:"text-[11px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Direct Reports"}),o.jsx("div",{className:"space-y-1",children:Zt.map(ye=>o.jsxs("div",{className:"flex items-center gap-2 p-1.5 rounded-lg",style:{background:"var(--hud-bg-alt)"},children:[o.jsx("div",{className:"w-6 h-6 rounded flex items-center justify-center text-white text-[10px] font-bold",style:{background:gd[ye.id]??"#666"},children:ye.id.slice(0,2).toUpperCase()}),o.jsx("div",{className:"text-xs",style:{color:"var(--terminal-text)"},children:ye.name})]},ye.id))})]})]}),t.authority&&o.jsxs(cc,{title:"Authority",open:W,onToggle:()=>te(ye=>!ye),children:[((De=t.authority.autonomous)==null?void 0:De.length)>0&&o.jsxs("div",{className:"mb-2",children:[o.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--active-green)"},children:"Autonomous"}),t.authority.autonomous.map((ye,je)=>o.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",ye]},je))]}),((Ue=t.authority.needsApproval)==null?void 0:Ue.length)>0&&o.jsxs("div",{children:[o.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--idle-amber)"},children:"Needs Approval"}),t.authority.needsApproval.map((ye,je)=>o.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",ye]},je))]})]}),t&&M&&(()=>{const ye=M.filter(je=>je.roleA===t.id||je.roleB===t.id).filter(je=>je.familiarity>0).sort((je,jt)=>jt.familiarity-je.familiarity);return ye.length===0?null:o.jsx(cc,{title:`Relationships (${ye.length})`,open:V,onToggle:()=>Y(je=>!je),children:o.jsx("div",{className:"space-y-1.5",children:ye.map((je,jt)=>{const wt=je.roleA===t.id?je.roleB:je.roleA,Xe=l.find(Mt=>Mt.id===wt),ft=je.familiarity>=80?"Best Partner":je.familiarity>=50?"Friend":je.familiarity>=20?"Colleague":"Acquaintance",fe=je.familiarity>=80?"#4CAF50":je.familiarity>=50?"#2196F3":je.familiarity>=20?"#FF9800":"#9E9E9E";return o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs w-20 truncate",style:{color:gd[wt]??"var(--terminal-text-secondary)"},children:(Xe==null?void 0:Xe.name)??wt}),o.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-white/10",children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${je.familiarity}%`,background:fe}})}),o.jsx("span",{className:"text-[10px] w-16 text-right",style:{color:"var(--terminal-text-muted)"},children:ft})]},jt)})})})})(),t.journal&&o.jsx(cc,{title:`Journal (${(t.journal.match(/### /g)??[]).length})`,open:Z,onToggle:()=>ce(ye=>!ye),children:o.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:[o.jsx(Hs,{content:t.journal.slice(0,3e3)}),t.journal.length>3e3&&o.jsx("div",{className:"italic mt-2",style:{color:"var(--terminal-text-muted)"},children:"... (truncated)"})]})})]}),o.jsx(cj,{role:t,appearance:A}),c&&o.jsx("div",{className:"px-4 pb-4 mt-auto shrink-0",children:o.jsx("button",{onClick:()=>{c(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 cj({role:t,appearance:l}){const[r,i]=k.useState("idle"),[c,u]=k.useState(""),[f,m]=k.useState(!1),x=async()=>{var d,g;if(!f){m(!0);return}i("publishing");try{let y=null;try{y=await Ce.exportSkills(t.id)}catch{}const b={roleId:t.id,persona:t.persona??"",authority:t.authority??{autonomous:[],needsApproval:[]},level:t.level,tagline:((d=(t.persona??"").split(/[.\n]/)[0])==null?void 0:d.trim().slice(0,80))||t.name,chatStyle:"Professional and focused",skills:y??[],resume:{summary:((g=t.persona)==null?void 0:g.split(`
80
+ `)[0])??"",strengths:[],specialties:[],experience:""},author:{id:"tycono",name:"Tycono"},tags:[t.level,t.id],price:"free",installs:0,rating:0,featured:!1,randomActive:!0,randomPersonality:""};l&&(b.appearance=l);let v="1.0.0";try{const j=await Ts.getCharacterVersion(t.id);if(j!=null&&j.version){const S=j.version.split(".").map(Number);S[2]=(S[2]??0)+1,v=S.join(".")}}catch{}await Ts.publishCharacter({id:t.id,name:t.name||t.id,version:v,data:b}),i("done"),u(`Published v${v}`),m(!1)}catch(y){i("error"),u(y instanceof Error?y.message:"Failed"),m(!1)}};return o.jsx("div",{className:"px-4 pb-2 shrink-0",children:o.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:o.jsxs("div",{className:"px-3 py-2.5 flex items-center justify-between",style:{background:"var(--hud-bg-alt)"},children:[o.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Cloud Store"}),r==="done"?o.jsx("span",{className:"text-[10px] font-semibold",style:{color:"var(--active-green)"},children:c}):r==="error"?o.jsx("span",{className:"text-[10px] font-semibold",style:{color:"#ef4444"},children:c}):o.jsx("button",{onClick:x,disabled:r==="publishing",className:"text-[10px] px-2.5 py-1 rounded font-semibold cursor-pointer transition-colors disabled:opacity-50",style:{background:f?"rgba(59,130,246,0.3)":"rgba(59,130,246,0.15)",color:"#60a5fa",border:f?"1px solid rgba(59,130,246,0.5)":"1px solid transparent"},children:r==="publishing"?"Publishing...":f?"Confirm Publish?":"Publish to Store"})]})})})}function uj({icon:t,roleId:l,roleName:r,color:i,text:c}){const u=!!c;return o.jsx("div",{className:"relative",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsxs("div",{className:"shrink-0",children:[o.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}),o.jsx("div",{className:"text-[9px] font-bold text-center mt-0.5 uppercase tracking-wide",style:{color:i},children:l})]}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsxs("div",{className:"relative",children:[o.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`}}),o.jsxs("div",{className:"rounded-xl rounded-tl-sm p-4 border",style:{background:`${i}08`,borderColor:`${i}22`},children:[o.jsx("div",{className:"text-[10px] font-semibold mb-1.5 uppercase tracking-wider",style:{color:i},children:r}),u?o.jsx("div",{className:"text-sm leading-relaxed",style:{color:"var(--terminal-text)"},children:o.jsx(Hs,{content:c})}):o.jsx("div",{className:"text-sm italic",style:{color:"var(--terminal-text-muted)"},children:"No recent activity."})]})]})})]})})}function cc({title:t,open:l,onToggle:r,children:i}){return o.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:[o.jsxs("button",{onClick:r,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:[o.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:t}),o.jsx("span",{className:"text-[10px] transition-transform",style:{color:"var(--terminal-text-muted)",transform:l?"rotate(0deg)":"rotate(-90deg)"},children:"▼"})]}),l&&o.jsx("div",{className:"px-3 pb-3 pt-2",style:{borderTop:"1px solid var(--terminal-border)"},children:i})]})}function u0({onSend:t,disabled:l,placeholder:r,color:i}){const[c,u]=k.useState(""),f=()=>{const m=c.trim();!m||l||(t(m),u(""))};return o.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[o.jsx("input",{type:"text",value:c,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),f())},placeholder:l?"Waiting...":r,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)"}}),o.jsx("button",{onClick:f,disabled:l||!c.trim(),className:"w-7 h-7 rounded-lg flex items-center justify-center shrink-0 cursor-pointer text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",style:{background:l||!c.trim()?"#666":i},children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M22 2L11 13"}),o.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})}function bd({label:t,value:l}){return o.jsxs("div",{className:"flex justify-between py-1.5 text-xs",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:t}),o.jsx("span",{className:"font-semibold",style:{color:"var(--terminal-text)"},children:l})]})}function fj(t,l){var r,i=1;t==null&&(t=0),l==null&&(l=0);function c(){var u,f=r.length,m,x=0,d=0;for(u=0;u<f;++u)m=r[u],x+=m.x,d+=m.y;for(x=(x/f-t)*i,d=(d/f-l)*i,u=0;u<f;++u)m=r[u],m.x-=x,m.y-=d}return c.initialize=function(u){r=u},c.x=function(u){return arguments.length?(t=+u,c):t},c.y=function(u){return arguments.length?(l=+u,c):l},c.strength=function(u){return arguments.length?(i=+u,c):i},c}function dj(t){const l=+this._x.call(null,t),r=+this._y.call(null,t);return og(this.cover(l,r),l,r,t)}function og(t,l,r,i){if(isNaN(l)||isNaN(r))return t;var c,u=t._root,f={data:i},m=t._x0,x=t._y0,d=t._x1,g=t._y1,y,b,v,j,S,C,E,A;if(!u)return t._root=f,t;for(;u.length;)if((S=l>=(y=(m+d)/2))?m=y:d=y,(C=r>=(b=(x+g)/2))?x=b:g=b,c=u,!(u=u[E=C<<1|S]))return c[E]=f,t;if(v=+t._x.call(null,u.data),j=+t._y.call(null,u.data),l===v&&r===j)return f.next=u,c?c[E]=f:t._root=f,t;do c=c?c[E]=new Array(4):t._root=new Array(4),(S=l>=(y=(m+d)/2))?m=y:d=y,(C=r>=(b=(x+g)/2))?x=b:g=b;while((E=C<<1|S)===(A=(j>=b)<<1|v>=y));return c[A]=u,c[E]=f,t}function hj(t){var l,r,i=t.length,c,u,f=new Array(i),m=new Array(i),x=1/0,d=1/0,g=-1/0,y=-1/0;for(r=0;r<i;++r)isNaN(c=+this._x.call(null,l=t[r]))||isNaN(u=+this._y.call(null,l))||(f[r]=c,m[r]=u,c<x&&(x=c),c>g&&(g=c),u<d&&(d=u),u>y&&(y=u));if(x>g||d>y)return this;for(this.cover(x,d).cover(g,y),r=0;r<i;++r)og(this,f[r],m[r],t[r]);return this}function mj(t,l){if(isNaN(t=+t)||isNaN(l=+l))return this;var r=this._x0,i=this._y0,c=this._x1,u=this._y1;if(isNaN(r))c=(r=Math.floor(t))+1,u=(i=Math.floor(l))+1;else{for(var f=c-r||1,m=this._root,x,d;r>t||t>=c||i>l||l>=u;)switch(d=(l<i)<<1|t<r,x=new Array(4),x[d]=m,m=x,f*=2,d){case 0:c=r+f,u=i+f;break;case 1:r=c-f,u=i+f;break;case 2:c=r+f,i=u-f;break;case 3:r=c-f,i=u-f;break}this._root&&this._root.length&&(this._root=m)}return this._x0=r,this._y0=i,this._x1=c,this._y1=u,this}function xj(){var t=[];return this.visit(function(l){if(!l.length)do t.push(l.data);while(l=l.next)}),t}function pj(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 Sn(t,l,r,i,c){this.node=t,this.x0=l,this.y0=r,this.x1=i,this.y1=c}function yj(t,l,r){var i,c=this._x0,u=this._y0,f,m,x,d,g=this._x1,y=this._y1,b=[],v=this._root,j,S;for(v&&b.push(new Sn(v,c,u,g,y)),r==null?r=1/0:(c=t-r,u=l-r,g=t+r,y=l+r,r*=r);j=b.pop();)if(!(!(v=j.node)||(f=j.x0)>g||(m=j.y0)>y||(x=j.x1)<c||(d=j.y1)<u))if(v.length){var C=(f+x)/2,E=(m+d)/2;b.push(new Sn(v[3],C,E,x,d),new Sn(v[2],f,E,C,d),new Sn(v[1],C,m,x,E),new Sn(v[0],f,m,C,E)),(S=(l>=E)<<1|t>=C)&&(j=b[b.length-1],b[b.length-1]=b[b.length-1-S],b[b.length-1-S]=j)}else{var A=t-+this._x.call(null,v.data),M=l-+this._y.call(null,v.data),O=A*A+M*M;if(O<r){var L=Math.sqrt(r=O);c=t-L,u=l-L,g=t+L,y=l+L,i=v.data}}return i}function gj(t){if(isNaN(g=+this._x.call(null,t))||isNaN(y=+this._y.call(null,t)))return this;var l,r=this._root,i,c,u,f=this._x0,m=this._y0,x=this._x1,d=this._y1,g,y,b,v,j,S,C,E;if(!r)return this;if(r.length)for(;;){if((j=g>=(b=(f+x)/2))?f=b:x=b,(S=y>=(v=(m+d)/2))?m=v:d=v,l=r,!(r=r[C=S<<1|j]))return this;if(!r.length)break;(l[C+1&3]||l[C+2&3]||l[C+3&3])&&(i=l,E=C)}for(;r.data!==t;)if(c=r,!(r=r.next))return this;return(u=r.next)&&delete r.next,c?(u?c.next=u:delete c.next,this):l?(u?l[C]=u:delete l[C],(r=l[0]||l[1]||l[2]||l[3])&&r===(l[3]||l[2]||l[1]||l[0])&&!r.length&&(i?i[E]=r:this._root=r),this):(this._root=u,this)}function bj(t){for(var l=0,r=t.length;l<r;++l)this.remove(t[l]);return this}function vj(){return this._root}function wj(){var t=0;return this.visit(function(l){if(!l.length)do++t;while(l=l.next)}),t}function kj(t){var l=[],r,i=this._root,c,u,f,m,x;for(i&&l.push(new Sn(i,this._x0,this._y0,this._x1,this._y1));r=l.pop();)if(!t(i=r.node,u=r.x0,f=r.y0,m=r.x1,x=r.y1)&&i.length){var d=(u+m)/2,g=(f+x)/2;(c=i[3])&&l.push(new Sn(c,d,g,m,x)),(c=i[2])&&l.push(new Sn(c,u,g,d,x)),(c=i[1])&&l.push(new Sn(c,d,f,m,g)),(c=i[0])&&l.push(new Sn(c,u,f,d,g))}return this}function Sj(t){var l=[],r=[],i;for(this._root&&l.push(new Sn(this._root,this._x0,this._y0,this._x1,this._y1));i=l.pop();){var c=i.node;if(c.length){var u,f=i.x0,m=i.y0,x=i.x1,d=i.y1,g=(f+x)/2,y=(m+d)/2;(u=c[0])&&l.push(new Sn(u,f,m,g,y)),(u=c[1])&&l.push(new Sn(u,g,m,x,y)),(u=c[2])&&l.push(new Sn(u,f,y,g,d)),(u=c[3])&&l.push(new Sn(u,g,y,x,d))}r.push(i)}for(;i=r.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function jj(t){return t[0]}function Cj(t){return arguments.length?(this._x=t,this):this._x}function Ej(t){return t[1]}function Nj(t){return arguments.length?(this._y=t,this):this._y}function Sh(t,l,r){var i=new jh(l??jj,r??Ej,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function jh(t,l,r,i,c,u){this._x=t,this._y=l,this._x0=r,this._y0=i,this._x1=c,this._y1=u,this._root=void 0}function f0(t){for(var l={data:t.data},r=l;t=t.next;)r=r.next={data:t.data};return l}var jn=Sh.prototype=jh.prototype;jn.copy=function(){var t=new jh(this._x,this._y,this._x0,this._y0,this._x1,this._y1),l=this._root,r,i;if(!l)return t;if(!l.length)return t._root=f0(l),t;for(r=[{source:l,target:t._root=new Array(4)}];l=r.pop();)for(var c=0;c<4;++c)(i=l.source[c])&&(i.length?r.push({source:i,target:l.target[c]=new Array(4)}):l.target[c]=f0(i));return t};jn.add=dj;jn.addAll=hj;jn.cover=mj;jn.data=xj;jn.extent=pj;jn.find=yj;jn.remove=gj;jn.removeAll=bj;jn.root=vj;jn.size=wj;jn.visit=kj;jn.visitAfter=Sj;jn.x=Cj;jn.y=Nj;function ya(t){return function(){return t}}function $r(t){return(t()-.5)*1e-6}function Aj(t){return t.x+t.vx}function Tj(t){return t.y+t.vy}function Dj(t){var l,r,i,c=1,u=1;typeof t!="function"&&(t=ya(t==null?1:+t));function f(){for(var d,g=l.length,y,b,v,j,S,C,E=0;E<u;++E)for(y=Sh(l,Aj,Tj).visitAfter(m),d=0;d<g;++d)b=l[d],S=r[b.index],C=S*S,v=b.x+b.vx,j=b.y+b.vy,y.visit(A);function A(M,O,L,F,I){var $=M.data,ee=M.r,z=S+ee;if($){if($.index>b.index){var X=v-$.x-$.vx,R=j-$.y-$.vy,W=X*X+R*R;W<z*z&&(X===0&&(X=$r(i),W+=X*X),R===0&&(R=$r(i),W+=R*R),W=(z-(W=Math.sqrt(W)))/W*c,b.vx+=(X*=W)*(z=(ee*=ee)/(C+ee)),b.vy+=(R*=W)*z,$.vx-=X*(z=1-z),$.vy-=R*z)}return}return O>v+z||F<v-z||L>j+z||I<j-z}}function m(d){if(d.data)return d.r=r[d.data.index];for(var g=d.r=0;g<4;++g)d[g]&&d[g].r>d.r&&(d.r=d[g].r)}function x(){if(l){var d,g=l.length,y;for(r=new Array(g),d=0;d<g;++d)y=l[d],r[y.index]=+t(y,d,l)}}return f.initialize=function(d,g){l=d,i=g,x()},f.iterations=function(d){return arguments.length?(u=+d,f):u},f.strength=function(d){return arguments.length?(c=+d,f):c},f.radius=function(d){return arguments.length?(t=typeof d=="function"?d:ya(+d),x(),f):t},f}function zj(t){return t.index}function d0(t,l){var r=t.get(l);if(!r)throw new Error("node not found: "+l);return r}function Mj(t){var l=zj,r=y,i,c=ya(30),u,f,m,x,d,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,A=t.length;E<g;++E)for(var M=0,O,L,F,I,$,ee,z;M<A;++M)O=t[M],L=O.source,F=O.target,I=F.x+F.vx-L.x-L.vx||$r(d),$=F.y+F.vy-L.y-L.vy||$r(d),ee=Math.sqrt(I*I+$*$),ee=(ee-u[M])/ee*C*i[M],I*=ee,$*=ee,F.vx-=I*(z=x[M]),F.vy-=$*z,L.vx+=I*(z=1-z),L.vy+=$*z}function v(){if(f){var C,E=f.length,A=t.length,M=new Map(f.map((L,F)=>[l(L,F,f),L])),O;for(C=0,m=new Array(E);C<A;++C)O=t[C],O.index=C,typeof O.source!="object"&&(O.source=d0(M,O.source)),typeof O.target!="object"&&(O.target=d0(M,O.target)),m[O.source.index]=(m[O.source.index]||0)+1,m[O.target.index]=(m[O.target.index]||0)+1;for(C=0,x=new Array(A);C<A;++C)O=t[C],x[C]=m[O.source.index]/(m[O.source.index]+m[O.target.index]);i=new Array(A),j(),u=new Array(A),S()}}function j(){if(f)for(var C=0,E=t.length;C<E;++C)i[C]=+r(t[C],C,t)}function S(){if(f)for(var C=0,E=t.length;C<E;++C)u[C]=+c(t[C],C,t)}return b.initialize=function(C,E){f=C,d=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?(r=typeof C=="function"?C:ya(+C),j(),b):r},b.distance=function(C){return arguments.length?(c=typeof C=="function"?C:ya(+C),S(),b):c},b}var Rj={value:()=>{}};function cg(){for(var t=0,l=arguments.length,r={},i;t<l;++t){if(!(i=arguments[t]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new wc(r)}function wc(t){this._=t}function Fj(t,l){return t.trim().split(/^|\s+/).map(function(r){var i="",c=r.indexOf(".");if(c>=0&&(i=r.slice(c+1),r=r.slice(0,c)),r&&!l.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}wc.prototype=cg.prototype={constructor:wc,on:function(t,l){var r=this._,i=Fj(t+"",r),c,u=-1,f=i.length;if(arguments.length<2){for(;++u<f;)if((c=(t=i[u]).type)&&(c=_j(r[c],t.name)))return c;return}if(l!=null&&typeof l!="function")throw new Error("invalid callback: "+l);for(;++u<f;)if(c=(t=i[u]).type)r[c]=h0(r[c],t.name,l);else if(l==null)for(c in r)r[c]=h0(r[c],t.name,null);return this},copy:function(){var t={},l=this._;for(var r in l)t[r]=l[r].slice();return new wc(t)},call:function(t,l){if((c=arguments.length-2)>0)for(var r=new Array(c),i=0,c,u;i<c;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(u=this._[t],i=0,c=u.length;i<c;++i)u[i].value.apply(l,r)},apply:function(t,l,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],c=0,u=i.length;c<u;++c)i[c].value.apply(l,r)}};function _j(t,l){for(var r=0,i=t.length,c;r<i;++r)if((c=t[r]).name===l)return c.value}function h0(t,l,r){for(var i=0,c=t.length;i<c;++i)if(t[i].name===l){t[i]=Rj,t=t.slice(0,i).concat(t.slice(i+1));break}return r!=null&&t.push({name:l,value:r}),t}var ci=0,ks=0,gs=0,ug=1e3,zc,Ss,Mc=0,ba=0,Yc=0,Fs=typeof performance=="object"&&performance.now?performance:Date,fg=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function dg(){return ba||(fg(Oj),ba=Fs.now()+Yc)}function Oj(){ba=0}function Zd(){this._call=this._time=this._next=null}Zd.prototype=hg.prototype={constructor:Zd,restart:function(t,l,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?dg():+r)+(l==null?0:+l),!this._next&&Ss!==this&&(Ss?Ss._next=this:zc=this,Ss=this),this._call=t,this._time=r,Jd()},stop:function(){this._call&&(this._call=null,this._time=1/0,Jd())}};function hg(t,l,r){var i=new Zd;return i.restart(t,l,r),i}function Bj(){dg(),++ci;for(var t=zc,l;t;)(l=ba-t._time)>=0&&t._call.call(void 0,l),t=t._next;--ci}function m0(){ba=(Mc=Fs.now())+Yc,ci=ks=0;try{Bj()}finally{ci=0,$j(),ba=0}}function Lj(){var t=Fs.now(),l=t-Mc;l>ug&&(Yc-=l,Mc=t)}function $j(){for(var t,l=zc,r,i=1/0;l;)l._call?(i>l._time&&(i=l._time),t=l,l=l._next):(r=l._next,l._next=null,l=t?t._next=r:zc=r);Ss=t,Jd(i)}function Jd(t){if(!ci){ks&&(ks=clearTimeout(ks));var l=t-ba;l>24?(t<1/0&&(ks=setTimeout(m0,t-Fs.now()-Yc)),gs&&(gs=clearInterval(gs))):(gs||(Mc=Fs.now(),gs=setInterval(Lj,ug)),ci=1,fg(m0))}}const Hj=1664525,Uj=1013904223,x0=4294967296;function Ij(){let t=1;return()=>(t=(Hj*t+Uj)%x0)/x0}function Yj(t){return t.x}function qj(t){return t.y}var Xj=10,Vj=Math.PI*(3-Math.sqrt(5));function Gj(t){var l,r=1,i=.001,c=1-Math.pow(i,1/300),u=0,f=.6,m=new Map,x=hg(y),d=cg("tick","end"),g=Ij();t==null&&(t=[]);function y(){b(),d.call("tick",l),r<i&&(x.stop(),d.call("end",l))}function b(S){var C,E=t.length,A;S===void 0&&(S=1);for(var M=0;M<S;++M)for(r+=(u-r)*c,m.forEach(function(O){O(r)}),C=0;C<E;++C)A=t[C],A.fx==null?A.x+=A.vx*=f:(A.x=A.fx,A.vx=0),A.fy==null?A.y+=A.vy*=f:(A.y=A.fy,A.vy=0);return l}function v(){for(var S=0,C=t.length,E;S<C;++S){if(E=t[S],E.index=S,E.fx!=null&&(E.x=E.fx),E.fy!=null&&(E.y=E.fy),isNaN(E.x)||isNaN(E.y)){var A=Xj*Math.sqrt(.5+S),M=S*Vj;E.x=A*Math.cos(M),E.y=A*Math.sin(M)}(isNaN(E.vx)||isNaN(E.vy))&&(E.vx=E.vy=0)}}function j(S){return S.initialize&&S.initialize(t,g),S}return v(),l={tick:b,restart:function(){return x.restart(y),l},stop:function(){return x.stop(),l},nodes:function(S){return arguments.length?(t=S,v(),m.forEach(j),l):t},alpha:function(S){return arguments.length?(r=+S,l):r},alphaMin:function(S){return arguments.length?(i=+S,l):i},alphaDecay:function(S){return arguments.length?(c=+S,l):+c},alphaTarget:function(S){return arguments.length?(u=+S,l):u},velocityDecay:function(S){return arguments.length?(f=1-S,l):1-f},randomSource:function(S){return arguments.length?(g=S,m.forEach(j),l):g},force:function(S,C){return arguments.length>1?(C==null?m.delete(S):m.set(S,j(C)),l):m.get(S)},find:function(S,C,E){var A=0,M=t.length,O,L,F,I,$;for(E==null?E=1/0:E*=E,A=0;A<M;++A)I=t[A],O=S-I.x,L=C-I.y,F=O*O+L*L,F<E&&($=I,E=F);return $},on:function(S,C){return arguments.length>1?(d.on(S,C),l):d.on(S)}}}function Kj(){var t,l,r,i,c=ya(-30),u,f=1,m=1/0,x=.81;function d(v){var j,S=t.length,C=Sh(t,Yj,qj).visitAfter(y);for(i=v,j=0;j<S;++j)l=t[j],C.visit(b)}function g(){if(t){var v,j=t.length,S;for(u=new Array(j),v=0;v<j;++v)S=t[v],u[S.index]=+c(S,v,t)}}function y(v){var j=0,S,C,E=0,A,M,O;if(v.length){for(A=M=O=0;O<4;++O)(S=v[O])&&(C=Math.abs(S.value))&&(j+=S.value,E+=C,A+=C*S.x,M+=C*S.y);v.x=A/E,v.y=M/E}else{S=v,S.x=S.data.x,S.y=S.data.y;do j+=u[S.data.index];while(S=S.next)}v.value=j}function b(v,j,S,C){if(!v.value)return!0;var E=v.x-l.x,A=v.y-l.y,M=C-j,O=E*E+A*A;if(M*M/x<O)return O<m&&(E===0&&(E=$r(r),O+=E*E),A===0&&(A=$r(r),O+=A*A),O<f&&(O=Math.sqrt(f*O)),l.vx+=E*v.value*i/O,l.vy+=A*v.value*i/O),!0;if(v.length||O>=m)return;(v.data!==l||v.next)&&(E===0&&(E=$r(r),O+=E*E),A===0&&(A=$r(r),O+=A*A),O<f&&(O=Math.sqrt(f*O)));do v.data!==l&&(M=u[v.data.index]*i/O,l.vx+=E*M,l.vy+=A*M);while(v=v.next)}return d.initialize=function(v,j){t=v,r=j,g()},d.strength=function(v){return arguments.length?(c=typeof v=="function"?v:ya(+v),g(),d):c},d.distanceMin=function(v){return arguments.length?(f=v*v,d):Math.sqrt(f)},d.distanceMax=function(v){return arguments.length?(m=v*v,d):Math.sqrt(m)},d.theta=function(v){return arguments.length?(x=v*v,d):Math.sqrt(x)},d}const _s={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 Qj(t){return _s[t]??_s.general}function Wj({docs:t,onNodeClick:l,selectedDocId:r}){var X;const i=k.useRef(null),c=k.useRef(null),[u,f]=k.useState({width:600,height:400}),[m,x]=k.useState({nodes:[],links:[]}),[d,g]=k.useState(null),[y,b]=k.useState(null),[v,j]=k.useState({x:0,y:0}),[S,C]=k.useState({x:0,y:0,w:600,h:400}),E=k.useRef(!1),A=k.useRef({x:0,y:0,vx:0,vy:0}),M=k.useRef(null),O=k.useRef(null);k.useEffect(()=>{const R=i.current;if(!R)return;const W=new ResizeObserver(te=>{const{width:V,height:Y}=te[0].contentRect;V>0&&Y>0&&(f({width:V,height:Y}),C(Z=>({...Z,w:V,h:Y})))});return W.observe(R),()=>W.disconnect()},[]),k.useEffect(()=>{if(t.length===0)return;const R=new Set(t.map(ce=>ce.id)),W=t.map(ce=>({id:ce.id,title:ce.title,category:ce.category,akb_type:ce.akb_type})),te=[];for(const ce of t)for(const we of ce.links){const D=we.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,"");R.has(D)&&D!==ce.id&&(te.some(B=>B.source===ce.id&&B.target===D||B.source===D&&B.target===ce.id)||te.push({source:ce.id,target:D,label:we.text}))}const{width:V,height:Y}=u,Z=Gj(W).force("link",Mj(te).id(ce=>ce.id).distance(140)).force("charge",Kj().strength(-400)).force("center",fj(V/2,Y/2)).force("collide",Dj(50));O.current=Z,Z.on("tick",()=>{for(const ce of W)ce.x=Math.max(60,Math.min(V-60,ce.x??V/2)),ce.y=Math.max(60,Math.min(Y-60,ce.y??Y/2));x({nodes:[...W],links:[...te]})}),Z.alpha(1).restart();for(let ce=0;ce<150;ce++)Z.tick();return Z.stop(),x({nodes:[...W],links:[...te]}),()=>{Z.stop()}},[t,u]);const L=R=>{if(typeof R=="string"){const W=m.nodes.find(te=>te.id===R);return{x:(W==null?void 0:W.x)??0,y:(W==null?void 0:W.y)??0}}return{x:R.x??0,y:R.y??0}},F=k.useCallback(R=>{R.preventDefault();const W=R.deltaY>0?1.1:.9;C(te=>{const V=Math.max(200,Math.min(u.width*3,te.w*W)),Y=Math.max(150,Math.min(u.height*3,te.h*W)),Z=(V-te.w)/2,ce=(Y-te.h)/2;return{x:te.x-Z,y:te.y-ce,w:V,h:Y}})},[u]),I=k.useCallback(R=>{R.button===0&&(E.current=!0,A.current={x:R.clientX,y:R.clientY,vx:S.x,vy:S.y})},[S]),$=k.useCallback(R=>{var W;if(M.current){const te=c.current;if(!te)return;const V=te.getBoundingClientRect(),Y=S.w/V.width,Z=S.h/V.height,ce=S.x+(R.clientX-V.left)*Y,we=S.y+(R.clientY-V.top)*Z;M.current.fx=ce,M.current.fy=we,(W=O.current)==null||W.alpha(.3).restart();return}if(E.current){const te=(R.clientX-A.current.x)*(S.w/u.width),V=(R.clientY-A.current.y)*(S.h/u.height);C(Y=>({...Y,x:A.current.vx-te,y:A.current.vy-V}))}},[S,u]),ee=k.useCallback(()=>{E.current=!1,M.current&&(M.current.fx=null,M.current.fy=null,M.current=null)},[]),z=k.useCallback((R,W)=>{var te;R.stopPropagation(),M.current=W,(te=O.current)==null||te.alpha(.3).restart()},[]);return o.jsxs("div",{ref:i,className:"relative flex-1 overflow-hidden",style:{background:"#1e1e2e"},children:[o.jsxs("svg",{ref:c,width:u.width,height:u.height,viewBox:`${S.x} ${S.y} ${S.w} ${S.h}`,style:{display:"block",cursor:E.current?"grabbing":"grab"},onWheel:F,onMouseDown:I,onMouseMove:$,onMouseUp:ee,onMouseLeave:ee,children:[o.jsx("defs",{children:o.jsx("pattern",{id:"grid",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:o.jsx("circle",{cx:"0",cy:"0",r:"0.5",fill:"rgba(255,255,255,0.06)"})})}),o.jsx("rect",{x:S.x-100,y:S.y-100,width:S.w+200,height:S.h+200,fill:"url(#grid)",pointerEvents:"none"}),m.links.map((R,W)=>{const te=L(R.source),V=L(R.target),Y=y===W,Z=(te.x+V.x)/2,ce=(te.y+V.y)/2;return o.jsxs("g",{children:[o.jsx("line",{x1:te.x,y1:te.y,x2:V.x,y2:V.y,stroke:"transparent",strokeWidth:12,style:{cursor:"default"},onMouseEnter:()=>b(W),onMouseLeave:()=>b(null)}),o.jsx("line",{x1:te.x,y1:te.y,x2:V.x,y2:V.y,stroke:Y?"rgba(148,163,184,0.7)":"rgba(148,163,184,0.3)",strokeWidth:Y?2:1.5,strokeDasharray:"4 3",pointerEvents:"none"}),Y&&R.label&&o.jsx("text",{x:Z,y:ce-6,textAnchor:"middle",fill:"#e2e8f0",fontSize:9,fontFamily:"monospace",style:{pointerEvents:"none"},children:o.jsx("tspan",{style:{filter:"drop-shadow(0 0 2px rgba(0,0,0,0.8))"},children:R.label.length>30?R.label.slice(0,28)+"..":R.label})})]},W)}),m.nodes.map(R=>{const W=_s[R.category]??_s.general,te=R.akb_type==="hub",V=te?24:16,Y=(d==null?void 0:d.id)===R.id,Z=r===R.id,ce=Y?1.2:Z?1.15:1;return o.jsxs("g",{transform:`translate(${R.x??0}, ${R.y??0}) scale(${ce})`,style:{cursor:"pointer",transition:"transform 0.15s ease"},onClick:we=>{we.stopPropagation();const D=t.find(B=>B.id===R.id);D&&l(D)},onMouseDown:we=>z(we,R),onMouseEnter:we=>{var B;g(R);const D=(B=i.current)==null?void 0:B.getBoundingClientRect();D&&j({x:we.clientX-D.left,y:we.clientY-D.top})},onMouseLeave:()=>g(null),children:[Z&&o.jsx("rect",{x:-V/2-4,y:-V/2-4,width:V+8,height:V+8,fill:"none",stroke:"#22c55e",strokeWidth:2,rx:te?5:2,opacity:.6}),o.jsx("rect",{x:-V/2,y:-V/2,width:V,height:V,fill:W.border,rx:te?4:2,opacity:Y?1:.9}),o.jsx("rect",{x:-V/2+3,y:-V/2+3,width:Math.max(0,V-6),height:Math.max(0,V-6),fill:W.bg,rx:te?3:1}),o.jsx("text",{y:V/2+14,textAnchor:"middle",fill:Z?"#e2e8f0":"#94a3b8",fontSize:11,fontFamily:"monospace",fontWeight:Z?"bold":"normal",style:{pointerEvents:"none"},children:R.title.length>24?R.title.slice(0,22)+"..":R.title})]},R.id)})]}),d&&!M.current&&o.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:[o.jsx("div",{className:"font-bold mb-1",children:d.title}),o.jsxs("div",{className:"text-[10px] opacity-60 mb-1",children:[d.akb_type.toUpperCase()," / ",d.category]}),((X=t.find(R=>R.id===d.id))==null?void 0:X.tldr)&&o.jsx("div",{className:"text-[10px] opacity-80 mb-1",children:t.find(R=>R.id===d.id).tldr}),o.jsx("div",{className:"text-[10px] text-green-400",children:"Click to open | Drag to move"})]}),t.length===0&&o.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 Zj({doc:t,allDocs:l,onOpen:r,onNavigateDoc:i}){const[c,u]=k.useState(!1),f=Qj(t.category),m=t.akb_type==="hub",x=new Set(l.map(d=>d.id));return o.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:[o.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>u(!c),children:[o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("span",{className:"shrink-0 text-sm",children:m?"🗂":t.format==="html"?"🌐":"📄"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[o.jsx("span",{className:"font-semibold text-xs truncate",style:{color:"var(--terminal-text)"},children:t.title}),o.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})]}),o.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:t.tags.slice(0,4).map(d=>o.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:d},d))})]}),o.jsx("span",{className:"text-xs shrink-0",style:{color:"var(--terminal-text-muted)"},children:c?"▲":"▼"})]}),!c&&t.tldr&&o.jsx("div",{className:"mt-1.5 text-[10px] line-clamp-2 ml-6",style:{color:"var(--terminal-text-secondary)"},children:t.tldr})]}),c&&o.jsxs("div",{className:"px-3 pb-3",style:{borderTop:"1px solid var(--terminal-border)"},children:[t.tldr&&o.jsx("div",{className:"mt-2 text-[11px] leading-relaxed italic",style:{color:"var(--terminal-text-secondary)"},children:t.tldr}),t.links.length>0&&o.jsxs("div",{className:"mt-2",children:[o.jsx("div",{className:"text-[9px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Cross-links"}),o.jsx("div",{className:"flex flex-wrap gap-1",children:t.links.slice(0,5).map((d,g)=>{const y=d.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,""),b=x.has(y);return o.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:["🔗"," ",d.text]},g)})})]}),o.jsxs("button",{className:"mt-2 text-[10px] font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},onClick:d=>{d.stopPropagation(),r(t)},children:["Open full ","→"]})]})]})}function Jj({docId:t,onBack:l,onDocUpdated:r,onDelete:i,onNavigateDoc:c,allDocs:u}){const[f,m]=k.useState(null),[x,d]=k.useState(!0),[g,y]=k.useState(!1),[b,v]=k.useState(""),[j,S]=k.useState(!1),C=new Set(u.map(L=>L.id)),E=k.useCallback(L=>{const F=L.split("#")[0];if(!F.match(/\.(md|html)$/))return null;const I=t.includes("/")?t.replace(/\/[^/]+$/,""):"";let $;if(F.startsWith("./"))$=I?`${I}/${F.slice(2)}`:F.slice(2);else if(F.startsWith("../")){const X=I.split("/").filter(Boolean);let R=F;for(;R.startsWith("../");)X.length>0&&X.pop(),R=R.slice(3);$=X.length>0?`${X.join("/")}/${R}`:R}else $=F;if(C.has($))return $;const ee=$.split("/").pop()??"",z=u.find(X=>X.id===ee||X.id.endsWith("/"+ee));return z?z.id:null},[t,C,u]),A=k.useCallback(L=>{const I=L.target.closest("a");if(!I)return;const $=I.getAttribute("href");if(!$||$.startsWith("http://")||$.startsWith("https://")||!$.match(/\.(md|html)(#.*)?$/))return;L.preventDefault(),L.stopPropagation();const ee=E($);ee&&c(ee)},[E,c]);k.useEffect(()=>{d(!0),Ce.getKnowledgeDoc(t).then(L=>{m(L),v(L.content)}).catch(console.error).finally(()=>d(!1))},[t]);const M=async()=>{if(f){S(!0);try{await Ce.updateKnowledgeDoc(t,b),m({...f,content:b}),y(!1),r()}catch(L){console.error("Save failed:",L)}finally{S(!1)}}},O=async()=>{if(confirm(`Delete "${f==null?void 0:f.title}"?`))try{await Ce.deleteKnowledgeDoc(t),i(t)}catch(L){console.error("Delete failed:",L)}};return x?o.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Loading..."}):f?o.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col",children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Back"]}),o.jsx("div",{className:"flex-1"}),g?o.jsxs(o.Fragment,{children:[o.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"}),o.jsx("button",{onClick:M,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"})]}):o.jsxs(o.Fragment,{children:[o.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"}),o.jsx("button",{onClick:O,className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold",style:{background:"rgba(239,68,68,0.15)",color:"#f87171",border:"1px solid rgba(239,68,68,0.3)"},children:"Delete"})]})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[o.jsx("h2",{className:"text-sm font-bold mb-1",style:{color:"var(--terminal-text)"},children:f.title}),f.tldr&&!g&&o.jsx("div",{className:"mb-3 text-xs italic",style:{color:"var(--terminal-text-secondary)"},children:f.tldr}),f.format==="html"?g?o.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:L=>v(L.target.value),spellCheck:!1}):o.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?o.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:L=>v(L.target.value),spellCheck:!1}):o.jsx("div",{className:"text-xs leading-relaxed",style:{color:"var(--terminal-text-secondary)"},onClick:A,children:o.jsx(Hs,{content:f.content})})]})]}):o.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Failed to load document"})}function Pj({onCreated:t,onCancel:l}){const[r,i]=k.useState(""),[c,u]=k.useState(""),[f,m]=k.useState(""),[x,d]=k.useState(!1),[g,y]=k.useState("");k.useEffect(()=>{if(!r){u("");return}const v=r.toLowerCase().replace(/[^a-z0-9가-힣\s-]/g,"").replace(/\s+/g,"-").slice(0,60);u(v)},[r]);const b=async()=>{if(!r.trim()||!c.trim()){y("Title and filename are required");return}d(!0),y("");try{const v=await Ce.createKnowledgeDoc({filename:c,title:r,category:f||void 0});t(v.id)}catch(v){y(v instanceof Error?v.message:"Failed to create")}finally{d(!1)}};return o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[o.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Cancel"]}),o.jsx("h2",{className:"text-sm font-bold",style:{color:"var(--terminal-text)"},children:"New Document"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"TITLE"}),o.jsx("input",{type:"text",value:r,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)"}})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"FILENAME"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("input",{type:"text",value:c,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)"}}),o.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:".md"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"CATEGORY (optional)"}),o.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&&o.jsx("div",{className:"text-[10px] px-3 py-1.5 rounded",style:{background:"rgba(239,68,68,0.15)",color:"#f87171"},children:g}),o.jsx("button",{onClick:b,disabled:x||!r.trim(),className:"w-full py-2 text-xs font-semibold rounded cursor-pointer text-white",style:{background:x?"#86efac":"#16a34a"},children:x?"Creating...":"Create Document"})]})]})}const eC=500,p0=360,y0=700;function Ch(t){const[l,r]=k.useState(eC),[i,c]=k.useState(!1),u=k.useRef(0),f=k.useRef(0),m=t>0,x=m?t:0,d=m?Math.max(p0,window.innerWidth-t-100):y0,g=Math.min(l,d),y=k.useCallback(b=>{b.preventDefault(),u.current=b.clientX,f.current=g,c(!0);const v=S=>{const C=u.current-S.clientX,E=Math.min(y0,Math.max(p0,f.current+C));r(E)},j=()=>{c(!1),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",j)};document.addEventListener("mousemove",v),document.addEventListener("mouseup",j)},[g]);return{panelRight:x,panelWidth:g,isResizing:i,handleResizeStart:y}}function tC({docs:t,onClose:l,onRefresh:r,terminalWidth:i=0,initialDocId:c}){const[u,f]=k.useState("list"),[m,x]=k.useState("all"),[d,g]=k.useState(c??null),[y,b]=k.useState(""),[v,j]=k.useState(!1),[S,C]=k.useState(null),{panelRight:E,panelWidth:A,isResizing:M,handleResizeStart:O}=Ch(i),L=["all",...Array.from(new Set(t.map(X=>X.category))).sort()],F=t.filter(X=>{if(m!=="all"&&X.category!==m)return!1;if(y){const R=y.toLowerCase();return X.title.toLowerCase().includes(R)||(X.tldr??"").toLowerCase().includes(R)||X.tags.some(W=>W.toLowerCase().includes(R))}return!0}),I=X=>{j(!1),r(),g(X)},$=X=>{g(null),r()},ee=X=>{C(X.id)},z=S?t.find(X=>X.id===S):null;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:E},onClick:l}),o.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)] ${M?"resizing":""}`,style:{right:E,width:A,background:"var(--terminal-bg)",borderLeftColor:"#16a34a"},children:[o.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:O}),o.jsxs("div",{className:"p-5 text-white relative",style:{background:"#16a34a"},children:[o.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:"×"}),o.jsxs("div",{className:"text-lg font-bold",children:["📚"," Knowledge Base"]}),o.jsxs("div",{className:"text-xs opacity-80 mt-0.5",children:[t.length," documents"]})]}),o.jsxs("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx(g0,{label:"List",active:u==="list",onClick:()=>{f("list"),C(null)}}),o.jsx(g0,{label:"Graph",active:u==="graph",onClick:()=>f("graph")})]}),u==="list"&&!d&&!v&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx("input",{type:"text",value:y,onChange:X=>b(X.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)"}}),o.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"})]}),o.jsx("div",{className:"flex overflow-x-auto shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",scrollbarWidth:"none"},children:L.map(X=>o.jsx("button",{onClick:()=>x(X),className:"px-3 py-1.5 text-[10px] font-medium cursor-pointer whitespace-nowrap",style:{color:m===X?"#4ade80":"var(--terminal-text-muted)",borderBottom:m===X?"2px solid #4ade80":"2px solid transparent"},children:X==="all"?`All (${t.length})`:`${X} (${t.filter(R=>R.category===X).length})`},X))}),o.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:F.length===0?o.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"}):F.map(X=>o.jsx(Zj,{doc:X,allDocs:t,onOpen:R=>g(R.id),onNavigateDoc:R=>g(R)},X.id))})]}),u==="list"&&d&&!v&&o.jsx(Jj,{docId:d,onBack:()=>g(null),onDocUpdated:r,onDelete:$,onNavigateDoc:X=>g(X),allDocs:t}),u==="list"&&v&&o.jsx(Pj,{onCreated:I,onCancel:()=>j(!1)}),u==="graph"&&o.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[o.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[o.jsx(Wj,{docs:t,onNodeClick:ee,selectedDocId:S}),z&&o.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:[o.jsx("div",{className:"text-[10px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Selected"}),o.jsx("div",{className:"text-xs font-bold mb-1",style:{color:"var(--terminal-text)"},children:z.title}),o.jsx("div",{className:"w-2 h-2 rounded-full mb-2",style:{background:z.status==="active"?"#16a34a":z.status==="draft"?"#f59e0b":"#94a3b8"}}),z.tldr&&o.jsx("div",{className:"text-[10px] mb-2 leading-relaxed",style:{color:"var(--terminal-text-secondary)"},children:z.tldr}),z.links.length>0&&o.jsxs("div",{className:"mb-2",children:[o.jsx("div",{className:"text-[9px] font-bold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Links"}),z.links.slice(0,5).map((X,R)=>o.jsxs("div",{className:"text-[9px] mb-0.5 truncate",style:{color:"var(--terminal-text-secondary)"},children:["🔗"," ",X.text]},R))]}),o.jsx("button",{className:"w-full py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white",style:{background:"#16a34a"},onClick:()=>{f("list"),g(z.id),C(null)},children:"Open Document"})]})]}),o.jsx("div",{className:"shrink-0 p-2",style:{borderTop:"1px solid var(--terminal-border)"},children:o.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(_s).map(([X,R])=>o.jsxs("div",{className:"flex items-center gap-1 text-[9px]",children:[o.jsx("div",{className:"w-2 h-2",style:{background:R.border}}),o.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:X})]},X))})})]})]})]})}function g0({label:t,active:l,onClick:r}){return o.jsx("button",{onClick:r,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 nC({standups:t,waves:l,decisions:r,mode:i,onClose:c,terminalWidth:u=0}){const[f,m]=k.useState(i==="decisions"?"decisions":"standups"),{panelRight:x,panelWidth:d,isResizing:g,handleResizeStart:y}=Ch(u);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:x},onClick:c}),o.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:x,width:d,background:"var(--terminal-bg)",borderLeftColor:"var(--desk-wood)"},children:[o.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}),o.jsxs("div",{className:"p-5 bg-[var(--desk-wood)] text-white relative",children:[o.jsx("button",{onClick:c,className:"absolute top-3 right-3 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),o.jsx("div",{className:"text-lg font-bold",children:i==="bulletin"?"📌 Bulletin Board":"📜 Decision Log"})]}),o.jsx("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:i==="bulletin"?o.jsxs(o.Fragment,{children:[o.jsx(vd,{label:`Standups (${t.length})`,active:f==="standups",onClick:()=>m("standups")}),o.jsx(vd,{label:`Waves (${l.length})`,active:f==="waves",onClick:()=>m("waves")})]}):o.jsx(vd,{label:`Decisions (${r.length})`,active:f==="decisions",onClick:()=>m("decisions")})}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[f==="standups"&&t.map((b,v)=>o.jsx(wd,{title:`Standup ${b.date}`,content:b.content},v)),f==="waves"&&l.map((b,v)=>o.jsx(wd,{title:`Wave ${b.id}`,subtitle:b.timestamp,content:b.content},v)),f==="decisions"&&r.map((b,v)=>o.jsx(wd,{title:`#${b.id} ${b.title}`,subtitle:b.date,content:b.content},v))]})]})]})}function vd({label:t,active:l,onClick:r}){return o.jsx("button",{onClick:r,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 lC(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 wd({title:t,subtitle:l,content:r}){const[i,c]=k.useState(!1),u=r.length>100,f=lC(r).slice(0,160);return o.jsxs("div",{className:"mb-3 rounded-lg overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>c(!i),children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"font-medium text-sm",style:{color:"var(--terminal-text)"},children:t}),o.jsx("span",{className:"text-xs shrink-0 ml-2",style:{color:"var(--terminal-text-muted)"},children:i?"▲":"▼"})]}),l&&o.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--terminal-text-muted)"},children:l})]}),i&&o.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:o.jsx(Hs,{content:r})}),!i&&u&&o.jsx("div",{className:"px-3 pb-2 text-xs line-clamp-2 leading-relaxed",style:{color:"var(--terminal-text-muted)"},children:f})]})}function rC({projectId:t,onClose:l,terminalWidth:r=0}){const[i,c]=k.useState(null),{panelRight:u,panelWidth:f,isResizing:m,handleResizeStart:x}=Ch(r);if(k.useEffect(()=>{Ce.getProject(t).then(c).catch(console.error)},[t]),!i)return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),o.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:o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading project..."})})]});const d=i.tasks.filter(b=>b.status==="done").length,g=i.tasks.length,y=g>0?Math.round(d/g*100):0;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),o.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:[o.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${m?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:x}),o.jsxs("div",{className:"p-5 bg-[var(--meeting-blue)] text-white relative",children:[o.jsx("div",{className:"text-sm opacity-70",children:"Meeting Room"}),o.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:"×"}),o.jsx("div",{className:"text-xl font-bold mt-1",children:i.name}),o.jsxs("div",{className:"flex items-center gap-3 mt-3 text-sm",children:[o.jsxs("span",{children:["Tasks: ",g]}),o.jsxs("span",{children:["Done: ",d]}),o.jsxs("span",{children:["Progress: ",y,"%"]})]}),o.jsx("div",{className:"mt-2 h-1.5 bg-white/20 rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full bg-white rounded-full transition-all",style:{width:`${y}%`}})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[i.prd&&o.jsxs("div",{className:"mb-5",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"PRD"}),o.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:o.jsx(Hs,{content:i.prd})})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:["Tasks (",g,")"]}),o.jsx("div",{className:"space-y-2",children:i.tasks.map(b=>o.jsxs("div",{className:"rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium",style:{color:"var(--terminal-text)"},children:b.title}),o.jsx(aC,{status:b.status})]}),o.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-muted)"},children:b.role}),b.description&&o.jsx("div",{className:"text-xs mt-1.5 line-clamp-2",style:{color:"var(--terminal-text-secondary)"},children:b.description})]},b.id))})]})]})]})]})}function aC({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)"}},r=l[t]??l.todo;return o.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:r.bg,color:r.color},children:t})}const iC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function sC({roleId:t,roleName:l,mode:r="assign",onClose:i,onExecutionStart:c}){const[u,f]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const x=()=>{u.trim()&&(c(t,u.trim()),i())},d=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&x(),y.key==="Escape"&&i()},g=iC[t]??"#666";return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),o.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:[o.jsxs("div",{className:"p-5 text-white",style:{background:`linear-gradient(135deg, ${g}, ${g}cc)`},children:[o.jsx("div",{className:"text-lg font-bold",children:r==="ask"?"Ask":"Assign Task"}),o.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:r==="ask"?`to ${l}`:`to ${l} (${t})`})]}),o.jsxs("div",{className:"p-5",children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Task Description"}),o.jsx("textarea",{ref:m,value:u,onChange:y=>f(y.target.value),onKeyDown:d,placeholder:r==="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"}),o.jsx("div",{className:"text-[10px] text-white/30 mt-1",children:"Cmd+Enter to submit"})]}),o.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[o.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"}),o.jsx("button",{onClick:x,disabled:!u.trim(),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:g},children:r==="ask"?"Ask":"Assign"})]})]})]})}const b0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function mg({event:t,isThinkingCollapsed:l,onToggleThinking:r,onNavigateToJob:i,onOpenKnowledgeDoc:c,compact:u}){var m;const f=b0[t.roleId]??"#888";switch(t.type){case"text":return o.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 x=t.data.text??"";return o.jsxs("div",{className:"group",children:[o.jsxs("button",{onClick:r,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-[10px] cursor-pointer flex items-center gap-1",children:[o.jsx("span",{children:l?"▶":"▼"}),o.jsx("span",{className:"italic",children:"thinking..."})]}),!l&&o.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:[x.slice(0,u?200:500),x.length>(u?200:500)?"...":""]})]})}case"tool:start":{const x=String(t.data.name??""),d=t.data.input,g=typeof(d==null?void 0:d.command)=="string"?d.command.slice(0,80):"",y=typeof(d==null?void 0:d.file_path)=="string"?String(d.file_path):typeof(d==null?void 0:d.path)=="string"?String(d.path):"",b=y?y.split("/").pop()??"":"",v=/^(write_file|Write|edit_file|Edit)$/i.test(x),j=(m=y.match(/(?:^|\/)knowledge\/(.+\.md)$/))==null?void 0:m[1],S=v&&j&&c;return o.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[o.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${S?"text-green-400/80 bg-green-400/10":"text-blue-400/80 bg-blue-400/10"}`,children:S?v&&x.toLowerCase().includes("edit")?"Edit":"Write":x}),S?o.jsx("button",{onClick:()=>c(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}):o.jsxs(o.Fragment,{children:[g&&o.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:g}),b&&o.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:b})]})]})}case"dispatch:start":{const x=t.data.targetRoleId??t.data.roleId??"",d=t.data.task??"",g=t.data.childJobId,y=b0[x]??"#888";return o.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:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{style:{color:y},className:"font-bold text-[11px]",children:["→"," ",x.toUpperCase()]}),o.jsx("span",{className:"text-[var(--terminal-text-secondary)] text-[10px] truncate flex-1",children:d.slice(0,u?60:100)}),g&&i&&o.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 o.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 o.jsx("div",{className:"border-t border-[var(--terminal-border)] my-2 relative",children:o.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 o.jsxs("div",{className:"text-red-400/80 text-[11px]",children:["⚠"," ",t.data.message]});case"job:start":return o.jsxs("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pb-1",children:[o.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 x=t.data.turns??0,d=t.data.toolCalls??0;return o.jsx("div",{className:"mt-2 p-2 rounded-lg bg-green-900/20 border border-green-800/30",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-green-400"}),o.jsx("span",{className:"text-green-300 font-bold text-[11px]",children:"Complete"}),o.jsxs("span",{className:"text-[var(--terminal-text-muted)] text-[10px]",children:[x," turns · ",d," tools"]})]})})}case"job:error":return o.jsx("div",{className:"mt-2 p-2 rounded-lg bg-red-900/20 border border-red-800/30",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-red-400"}),o.jsx("span",{className:"text-red-300 font-bold text-[11px]",children:"Error"}),o.jsx("span",{className:"text-red-200/70 text-[10px]",children:t.data.message})]})});case"import:scan":case"import:process":case"import:created":return o.jsxs("div",{className:"text-cyan-300/70 text-[11px]",children:["[",t.type,"] ",JSON.stringify(t.data)]});default:return null}}function oC({jobId:t,title:l,color:r,variant:i,style:c,onClose:u,onMinimize:f,onDone:m,onNavigateToJob:x,onOpenKnowledgeDoc:d}){const{events:g,status:y,textOutput:b,childJobIds:v}=V0(t),[j,S]=k.useState(0),[C,E]=k.useState(new Set),A=k.useRef(null),M=k.useRef(Date.now()),O=k.useRef(!1);k.useEffect(()=>{const X=setInterval(()=>{S(Math.floor((Date.now()-M.current)/1e3))},1e3);return()=>clearInterval(X)},[]),k.useEffect(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[g]),k.useEffect(()=>{(y==="done"||y==="error")&&!O.current&&(O.current=!0,m==null||m())},[y,m]);const L=X=>{E(R=>{const W=new Set(R);return W.has(X)?W.delete(X):W.add(X),W})},F={idle:"Waiting",connecting:"Connecting...",streaming:"Working",done:"Complete",error:"Error"}[y],I={idle:"#888",connecting:"#888",streaming:r,done:"#2E7D32",error:"#C62828"}[y],$=X=>`${Math.floor(X/60)}:${String(X%60).padStart(2,"0")}`,ee=y==="done"||y==="error",z=o.jsxs("div",{className:i==="modal"?"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] h-[85vh] z-[61] bg-[var(--terminal-bg)] rounded-2xl shadow-2xl overflow-hidden flex flex-col":"bg-[var(--terminal-bg)] rounded-xl border border-[var(--terminal-border)] overflow-hidden flex flex-col max-h-[400px]",style:c,children:[o.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{background:I}}),o.jsx("div",{children:o.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:l})})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:$(j)}),o.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:`${I}22`,color:I},children:F}),f&&i==="modal"&&o.jsx("button",{onClick:f,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),ee&&o.jsx("button",{onClick:u,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),o.jsxs("div",{ref:A,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[g.length===0&&y==="connecting"&&o.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:"Connecting to activity stream..."}),g.map(X=>o.jsx(mg,{event:X,isThinkingCollapsed:C.has(X.seq),onToggleThinking:()=>L(X.seq),onNavigateToJob:x,onOpenKnowledgeDoc:d},X.seq)),y==="streaming"&&o.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),o.jsxs("div",{className:"px-5 py-3 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[o.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`]}),ee&&o.jsx("button",{onClick:u,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer",style:{background:r},children:"Close"})]})]});return i==="modal"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:ee?u:void 0}),z]}):z}const kd={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function cC({orgNodes:t,rootId:l}){const r=t[l];if(!r)return null;const c=r.children.map(m=>t[m]).filter(Boolean),u=[];for(const m of c)for(const x of m.children){const d=t[x];d&&u.push({node:d,parentId:m.id})}const f=c.length+u.length;return o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Propagation Preview"}),o.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-lg p-4",children:[o.jsx("div",{className:"flex justify-center mb-2",children:o.jsx("span",{className:"px-3 py-1 text-[10px] font-bold rounded border-2 border-white/20 bg-white/5 text-white/30 uppercase",children:"CEO"})}),c.length>0&&o.jsx("div",{className:"flex justify-center mb-1",children:o.jsx("div",{className:"w-px h-3 bg-white/15"})}),c.length>1&&o.jsx("div",{className:"flex justify-center mb-1",children:o.jsx("div",{className:"h-px bg-white/15",style:{width:`${Math.min(c.length*80,320)}px`}})}),o.jsx("div",{className:"flex justify-center gap-3 mb-2 flex-wrap",children:c.map(m=>o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("span",{className:"px-2.5 py-1 text-[10px] font-bold rounded border-2 uppercase",style:{borderColor:kd[m.id]??"#888",color:kd[m.id]??"#888",background:`${kd[m.id]??"#888"}22`},children:m.id}),o.jsx("span",{className:"text-[8px] text-white/30 mt-0.5",children:"direct"})]},m.id))}),u.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex justify-center mb-1",children:o.jsx("div",{className:"w-px h-2 bg-white/10"})}),o.jsx("div",{className:"flex justify-center gap-2 flex-wrap",children:u.map(({node:m})=>o.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))}),o.jsx("div",{className:"text-center text-[8px] text-white/30 mt-1",children:"via re-dispatch"})]})]}),o.jsxs("div",{className:"text-[10px] text-gray-400 mt-1.5",children:[f," role",f!==1?"s":""," will receive this wave"]})]})}function uC({cLevelRoles:t,orgNodes:l,rootId:r,onClose:i,onDispatch:c}){const[u,f]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const x=()=>{!u.trim()||t.length===0||(c(u.trim()),i())},d=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&x(),y.key==="Escape"&&i()},g=r&&Object.keys(l).length>0;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),o.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:[o.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[o.jsx("div",{className:"text-lg font-bold",children:"CEO Wave"}),o.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:"Broadcast a directive to all C-Level reports"})]}),o.jsxs("div",{className:"p-5 space-y-4",children:[g&&o.jsx(cC,{orgNodes:l,rootId:r}),!g&&o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Dispatching to"}),o.jsx("div",{className:"flex gap-2 flex-wrap",children:t.length>0?t.map(y=>o.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)):o.jsx("span",{className:"text-xs text-gray-400 italic",children:"No C-Level roles found"})}),o.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Each C-Level receives the directive and delegates to their reports"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Directive"}),o.jsx("textarea",{ref:m,value:u,onChange:y=>f(y.target.value),onKeyDown:d,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"}),o.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Cmd+Enter to dispatch"})]})]}),o.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[o.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"}),o.jsxs("button",{onClick:x,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 fC(t,l,r){const[i,c]=k.useState(new Map),[u,f]=k.useState(null),m=k.useRef(new Map),x=k.useRef(i);x.current=i,k.useEffect(()=>{if(!r||Object.keys(l).length===0)return;const b=new Map,v=S=>{const C=l[S];C&&(b.set(S,{jobId:null,roleId:S,roleName:C.name,children:C.children,status:"waiting",events:[],streamStatus:"idle"}),C.children.forEach(v))},j=l[r];j&&(b.set(r,{jobId:null,roleId:r,roleName:"CEO",children:j.children,status:"not-dispatched",events:[],streamStatus:"idle"}),j.children.forEach(v));for(const S of t){const C=b.get(S.roleId);C&&(C.jobId=S.jobId,C.status="running",C.streamStatus="connecting")}c(b),t.length>0&&f(t[0].roleId)},[t,l,r]);const d=k.useCallback((b,v)=>{const j=m.current.get(b);j&&j.controller.abort();const S=new AbortController,C={controller:S,lastSeq:-1};m.current.set(b,C);const A=`/api/jobs/${b}/stream?from=0`;fetch(A,{signal:S.signal}).then(async M=>{if(!M.ok||!M.body){c(I=>{const $=new Map(I),ee=$.get(v);return ee&&$.set(v,{...ee,streamStatus:"error"}),$});return}c(I=>{const $=new Map(I),ee=$.get(v);return ee&&$.set(v,{...ee,streamStatus:"streaming",status:"running"}),$});const O=M.body.getReader(),L=new TextDecoder;let F="";for(;;){const{done:I,value:$}=await O.read();if(I)break;F+=L.decode($,{stream:!0});const ee=F.split(`
81
+ `);F=ee.pop()??"";let z="";for(const X of ee)if(X.startsWith("event: "))z=X.slice(7).trim();else if(X.startsWith("data: ")){try{const R=JSON.parse(X.slice(6));if(z==="activity"){const W=R;W.seq>C.lastSeq&&(C.lastSeq=W.seq),c(te=>{const V=new Map(te),Y=V.get(v);if(!Y||Y.events.some(ce=>ce.seq===W.seq))return te;const Z={...Y,events:[...Y.events,W]};if(W.type==="dispatch:start"&&W.data.childJobId){const ce=W.data.childJobId,we=W.data.targetRoleId??W.data.roleId;if(we){const D=V.get(we);D&&(V.set(we,{...D,jobId:ce,status:"running",streamStatus:"connecting"}),setTimeout(()=>d(ce,we),0))}}return W.type==="job:done"?(Z.status="done",Z.streamStatus="done"):W.type==="job:error"&&(Z.status="error",Z.streamStatus="error"),V.set(v,Z),V})}else if(z==="stream:end"){const W=R.reason;c(te=>{const V=new Map(te),Y=V.get(v);if(!Y)return te;const Z=W==="error"?"error":"done";return V.set(v,{...Y,status:Y.status==="running"?Z:Y.status,streamStatus:Z==="error"?"error":"done"}),V})}}catch{}z=""}}}).catch(M=>{M.name!=="AbortError"&&c(O=>{const L=new Map(O),F=L.get(v);return F&&L.set(v,{...F,streamStatus:"error"}),L})})},[]);k.useEffect(()=>{if(t.length!==0){for(const b of t)d(b.jobId,b.roleId);return()=>{for(const[,b]of m.current)b.controller.abort();m.current.clear()}}},[t,d]);const g=(()=>{let b=0,v=0,j=0;for(const[S,C]of i)S!==r&&(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 k.useEffect(()=>{y&&c(b=>{const v=new Map(b);let j=!1;for(const[S,C]of v)C.status==="waiting"&&(v.set(S,{...C,status:"not-dispatched"}),j=!0);return j?v:b})},[y]),{nodes:i,selectedRoleId:u,selectNode:f,progress:g,allDone:y}}const v0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},xa=120,Pl=44,w0=80;function dC(t,l){if(!t.get(l))return{layout:[],width:300,height:200};const i=[],c=[],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);c.length<=y;)c.push([]);c[y].push(g),i.push({roleId:g,x:0,y:y*w0+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(...c.map(g=>g.length))*(xa+16),x=Math.max(m,280);for(const g of c){const y=g.length*(xa+16)-16,b=(x-y)/2;g.forEach((v,j)=>{const S=i.find(C=>C.roleId===v);S&&(S.x=b+j*(xa+16))})}const d=c.length*w0+40;return{layout:i,width:x,height:d}}function hC({nodes:t,rootId:l,selectedRoleId:r,onSelectNode:i}){const{layout:c,width:u,height:f}=dC(t,l),m=d=>{const g=c.find(y=>y.roleId===d);return g?{cx:g.x+xa/2,cy:g.y+Pl/2}:{cx:0,cy:0}},x=d=>{switch(d.status){case"running":return v0[d.roleId]??"#FBBF24";case"done":return"#2E7D32";case"error":return"#C62828";case"not-dispatched":return"#666";default:return"#888"}};return o.jsxs("svg",{viewBox:`0 0 ${u} ${f}`,width:"100%",height:"100%",className:"block",children:[o.jsx("defs",{children:o.jsxs("filter",{id:"glow",children:[o.jsx("feGaussianBlur",{stdDeviation:"2",result:"blur"}),o.jsxs("feMerge",{children:[o.jsx("feMergeNode",{in:"blur"}),o.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),c.filter(d=>d.parentId).map(d=>{const g=m(d.parentId),y=m(d.roleId),b=t.get(d.roleId),v=t.get(d.parentId);let j="rgba(180,200,240,0.15)",S="4 4",C="";return(b==null?void 0:b.status)==="done"||(v==null?void 0:v.status)==="done"?(j="#2E7D3266",S=""):(b==null?void 0:b.status)==="running"&&(j=v0[d.roleId]??"#FBBF24",S="6 4",C="wave-edge-flow"),o.jsx("line",{x1:g.cx,y1:g.cy+Pl/2-4,x2:y.cx,y2:y.cy-Pl/2+4,stroke:j,strokeWidth:1.5,strokeDasharray:S,className:C},`${d.parentId}-${d.roleId}`)}),c.map(d=>{const g=t.get(d.roleId);if(!g)return null;const y=x(g),b=r===d.roleId,v=d.roleId===l,j=v?.4:g.status==="not-dispatched"?.35:1;return o.jsxs("g",{transform:`translate(${d.x}, ${d.y})`,style:{cursor:v?"default":"pointer",opacity:j},onClick:()=>!v&&i(d.roleId),children:[o.jsx("rect",{x:0,y:0,width:xa,height:Pl,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":""}),o.jsx("circle",{cx:14,cy:Pl/2,r:4,fill:y,filter:g.status==="running"?"url(#glow)":void 0,children:g.status==="running"&&o.jsx("animate",{attributeName:"opacity",values:"1;0.4;1",dur:"1.5s",repeatCount:"indefinite"})}),o.jsx("text",{x:26,y:Pl/2-4,fill:"var(--terminal-text, #fff)",fontSize:10,fontWeight:700,fontFamily:"var(--pixel-font)",children:g.roleId.toUpperCase()}),o.jsx("text",{x:26,y:Pl/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"&&o.jsx("text",{x:xa-18,y:Pl/2+4,fontSize:14,fill:"#2E7D32",children:"✓"}),g.status==="error"&&o.jsx("text",{x:xa-18,y:Pl/2+4,fontSize:14,fill:"#C62828",children:"✗"})]},d.roleId)})]})}const mC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function xC({directive:t,rootJobs:l,orgNodes:r,rootRoleId:i,onClose:c,onMinimize:u,onDone:f,onOpenKnowledgeDoc:m}){const{nodes:x,selectedRoleId:d,selectNode:g,progress:y,allDone:b}=fC(l,r,i),[v,j]=k.useState(0),[S,C]=k.useState(new Set),E=k.useRef(null),A=k.useRef(Date.now()),M=k.useRef(!1);k.useEffect(()=>{const $=setInterval(()=>{j(Math.floor((Date.now()-A.current)/1e3))},1e3);return()=>clearInterval($)},[]),k.useEffect(()=>{E.current&&(E.current.scrollTop=E.current.scrollHeight)},[d,x]),k.useEffect(()=>{b&&!M.current&&(M.current=!0,f==null||f())},[b,f]);const O=$=>`${Math.floor($/60)}:${String($%60).padStart(2,"0")}`,L=d?x.get(d):null,F=d?mC[d]??"#888":"#888",I=$=>{C(ee=>{const z=new Set(ee);return z.has($)?z.delete($):z.add($),z})};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:b?c:void 0}),o.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:[o.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.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"}}),o.jsx("div",{children:o.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:b?"WAVE COMPLETE":"WAVE COMMAND CENTER"})})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:O(v)}),o.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"]}),o.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&&o.jsx("button",{onClick:c,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),o.jsx("div",{className:"px-5 py-2 border-b border-[var(--terminal-border)] shrink-0",children:o.jsxs("span",{className:"text-[var(--terminal-text-secondary)] text-xs italic",children:["“",t,"”"]})}),o.jsxs("div",{className:"flex flex-1 min-h-0",children:[o.jsxs("div",{className:"w-[280px] shrink-0 border-r border-[var(--terminal-border)] flex flex-col",children:[o.jsx("div",{className:"px-3 py-2 border-b border-[var(--terminal-border)]",children:o.jsx("span",{className:"text-[10px] font-bold text-[var(--terminal-text-secondary)] uppercase tracking-wider",children:"Org Propagation"})}),o.jsx("div",{className:"flex-1 overflow-auto p-3",children:o.jsx(hC,{nodes:x,rootId:i,selectedRoleId:d,onSelectNode:g})}),o.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($=>o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:$.color,animation:$.dot?"wave-pulse 1.5s ease-in-out infinite":void 0}}),o.jsx("span",{className:"text-[8px] text-[var(--terminal-text-muted)]",children:$.label})]},$.label))})]}),o.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[L&&o.jsxs("div",{className:"px-4 py-2 border-b border-[var(--terminal-border)] shrink-0 flex items-center gap-2",children:[o.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:F}}),o.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-xs",children:L.roleId.toUpperCase()}),o.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs",children:L.roleName}),o.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full font-semibold",style:{background:`${F}22`,color:F},children:L.status==="running"?"Working":L.status==="done"?"Complete":L.status==="error"?"Error":L.status==="waiting"?"Waiting":"Not dispatched"})]}),o.jsxs("div",{ref:E,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[L&&L.events.length===0&&o.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:L.status==="waiting"?"Waiting for dispatch...":L.status==="running"?"Connecting to activity stream...":L.status==="not-dispatched"?"This role was not dispatched in this wave.":""}),L==null?void 0:L.events.map($=>o.jsx(mg,{event:$,isThinkingCollapsed:S.has($.seq),onToggleThinking:()=>I($.seq),onNavigateToJob:ee=>{for(const[,z]of x)if(z.jobId===ee){g(z.roleId);return}},onOpenKnowledgeDoc:m},$.seq)),(L==null?void 0:L.status)==="running"&&o.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),!L&&o.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"}),o.jsxs("div",{className:"px-4 py-2 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:L&&L.events.length>0&&`${L.events.length} events`}),b&&o.jsx("button",{onClick:c,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer",style:{background:"#2E7D32"},children:"Close"})]})]})]})]})]})}const pC={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 Eh(t){return pC[t]??{skinColor:"#B0BEC5",hairColor:"#78909C",shirtColor:"#607D8B",pantsColor:"#455A64",shoeColor:"#37474F"}}const xg=["#FDEBD0","#F5CBA7","#D4A07A","#C68642","#8D5524","#5C3A1E","#F3D1C7","#E8BEAC","#B07D62","#704214"],pg=["#1A0A00","#2C1810","#4E342E","#6D4C41","#8D6E63","#D4A574","#F5E6CA","#FFD700","#B71C1C","#AD1457","#4A148C","#1A237E","#004D40","#1A1A1A","#78909C","#E0E0E0"],yg=["#1565C0","#E65100","#2E7D32","#4A148C","#AD1457","#00695C","#D32F2F","#F57F17","#1B5E20","#283593","#4E342E","#37474F","#880E4F","#00838F","#6A1B9A","#FF6F00"],gg=["#37474F","#1A237E","#3E2723","#263238","#1B5E20","#455A64","#212121","#4E342E","#0D47A1","#311B92"],bg=["#212121","#1A1A1A","#37474F","#4E342E","#7B1FA2","#D32F2F","#1565C0","#F57F17","#2E7D32","#FFFFFF"],Hr={default:{name:"MIDNIGHT",icon:"🌃",vars:{"--floor-light":"#0d1117","--floor-dark":"#0a0e14","--hud-bg":"#0d1117","--hud-bg-alt":"#161b22","--pixel-border":"#30363d","--terminal-bg":"#0d1117","--terminal-border":"#21262d","--terminal-border-hover":"#388bfd","--terminal-text":"#e6edf3","--terminal-text-secondary":"#8b949e","--terminal-text-muted":"#484f58","--accent":"#388bfd","--active-green":"#3fb950","--idle-amber":"#d29922"}},light:{name:"DAYLIGHT",icon:"☀️",vars:{"--floor-light":"#f6f8fa","--floor-dark":"#eaeef2","--hud-bg":"#24292f","--hud-bg-alt":"#32383f","--pixel-border":"#d0d7de","--terminal-bg":"#ffffff","--terminal-border":"#d0d7de","--terminal-border-hover":"#0969da","--terminal-text":"#1f2328","--terminal-text-secondary":"#656d76","--terminal-text-muted":"#8c959f","--accent":"#0969da","--active-green":"#1a7f37","--idle-amber":"#9a6700"}},retro:{name:"RETRO",icon:"🎮",vars:{"--floor-light":"#1a1410","--floor-dark":"#140f0a","--hud-bg":"#1a1410","--hud-bg-alt":"#2a2018","--pixel-border":"#5c4a32","--terminal-bg":"#1a1410","--terminal-border":"#3a2e20","--terminal-border-hover":"#d4a44e","--terminal-text":"#e8d5b0","--terminal-text-secondary":"#a08860","--terminal-text-muted":"#6b5840","--accent":"#d4a44e","--active-green":"#8bba4a","--idle-amber":"#e8a030"}},cyberpunk:{name:"NEON",icon:"🌌",vars:{"--floor-light":"#0a0014","--floor-dark":"#06000e","--hud-bg":"#0a0014","--hud-bg-alt":"#14002a","--pixel-border":"#4a1a80","--terminal-bg":"#0a0014","--terminal-border":"#2a0a50","--terminal-border-hover":"#e040fb","--terminal-text":"#e0d0ff","--terminal-text-secondary":"#9070c0","--terminal-text-muted":"#5a3a80","--accent":"#e040fb","--active-green":"#00ff88","--idle-amber":"#ffab00"}},forest:{name:"FOREST",icon:"🌲",vars:{"--floor-light":"#0a1410","--floor-dark":"#060e0a","--hud-bg":"#0a1410","--hud-bg-alt":"#142a1e","--pixel-border":"#2a5a3a","--terminal-bg":"#0a1410","--terminal-border":"#1a3a26","--terminal-border-hover":"#4ade80","--terminal-text":"#d0f0d8","--terminal-text-secondary":"#70a880","--terminal-text-muted":"#3a6848","--accent":"#4ade80","--active-green":"#86efac","--idle-amber":"#fcd34d"}},ocean:{name:"OCEAN",icon:"🌊",vars:{"--floor-light":"#0a1420","--floor-dark":"#060e18","--hud-bg":"#0a1420","--hud-bg-alt":"#142a40","--pixel-border":"#1e4a6a","--terminal-bg":"#0a1420","--terminal-border":"#163050","--terminal-border-hover":"#38bdf8","--terminal-text":"#d0e8f8","--terminal-text-secondary":"#6090b0","--terminal-text-muted":"#305070","--accent":"#38bdf8","--active-green":"#34d399","--idle-amber":"#fbbf24"}}};function yC({color:t,selected:l,onClick:r}){return o.jsx("button",{onClick:r,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 bs({label:t,presets:l,value:r,onChange:i}){return o.jsxs("div",{className:"customize-row",children:[o.jsxs("div",{className:"customize-row-header",children:[o.jsx("span",{className:"customize-row-label",children:t}),o.jsx("div",{className:"customize-row-current",style:{background:r}})]}),o.jsx("div",{className:"customize-swatches",children:l.map(c=>o.jsx(yC,{color:c,selected:c===r,onClick:()=>i(c)},c))})]})}function Sd({label:t,items:l,value:r,onChange:i,lockInfo:c}){return o.jsxs("div",{className:"customize-row",children:[o.jsx("div",{className:"customize-row-header",children:o.jsx("span",{className:"customize-row-label",children:t})}),o.jsx("div",{className:"customize-swatches",style:{gap:4},children:l.map(u=>{const f=c?c.getLockLevel(u.id):1,m=u.id===r,x=c?f>c.roleLevel&&!m:!1,d=c?m&&f>c.roleLevel:!1;return o.jsxs("button",{onClick:()=>{x||i(u.id===r?void 0:u.id)},className:"customize-swatch",style:{width:"auto",height:"auto",padding:x?"2px 6px 10px 6px":"2px 6px",fontSize:9,fontFamily:"var(--font-pixel, monospace)",background:m?"rgba(255,255,255,0.15)":x?"rgba(255,255,255,0.02)":"rgba(255,255,255,0.04)",outline:m?d?"2px solid #F59E0B":"2px solid #fff":"2px solid transparent",color:x?"rgba(255,255,255,0.25)":m?"#fff":"rgba(255,255,255,0.5)",borderRadius:4,cursor:x?"not-allowed":"pointer",opacity:x?.35:1,position:"relative"},children:[u.name,x&&o.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]}),d&&o.jsxs("span",{style:{position:"absolute",bottom:-8,left:"50%",transform:"translateX(-50%)",fontSize:7,color:"#F59E0B",whiteSpace:"nowrap"},children:["⚠"," Lv.",f]})]},u.id)})})]})}function jd({label:t,active:l,onClick:r}){return o.jsx("button",{onClick:r,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 _r(t){return t[Math.floor(Math.random()*t.length)]}function js(t){var c,u,f;const l=ng(),r=lg(),i=rg().filter(m=>!t||ig(m.id,t));return{skinColor:_r(xg),hairColor:_r(pg),shirtColor:_r(yg),pantsColor:_r(gg),shoeColor:_r(bg),hairStyle:(c=_r(l))==null?void 0:c.id,outfitStyle:(u=_r(r))==null?void 0:u.id,accessory:(f=_r(i))==null?void 0:f.id}}function vg({roleId:t,appearance:l,onChange:r,onRandomize:i,onReset:c,label:u,roleLevel:f}){const[m,x]=k.useState("look"),d=k.useCallback((C,E)=>{r({...l,[C]:E})},[l,r]),g=k.useRef(null),y=k.useCallback(C=>{var M;const E=(M=C.target.files)==null?void 0:M[0];if(!E)return;const A=new Image;A.onload=()=>{const O=HS(A);r({...O,hairStyle:l.hairStyle,outfitStyle:l.outfitStyle,accessory:l.accessory}),URL.revokeObjectURL(A.src)},A.src=URL.createObjectURL(E),C.target.value=""},[l.hairStyle,l.outfitStyle,l.accessory,r]),b=ng(),v=lg(),j=rg(),S=f!==void 0?j.filter(C=>ig(C.id,f)).length:j.length;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"customize-preview",children:[o.jsx("div",{className:"customize-preview-bg",children:o.jsx(Ic,{roleId:t,appearance:l,scale:12})}),u&&o.jsx("div",{className:"customize-preview-name",children:u}),o.jsxs("div",{className:"customize-preview-actions",children:[o.jsx("button",{className:"customize-btn customize-btn--random",onClick:i,children:"RANDOM"}),o.jsx("button",{className:"customize-btn customize-btn--reset",onClick:c,children:"RESET"}),o.jsx("button",{className:"customize-btn",onClick:()=>{var C;return(C=g.current)==null?void 0:C.click()},style:{fontSize:9,opacity:.7},children:"PHOTO"}),o.jsx("input",{ref:g,type:"file",accept:"image/*",onChange:y,style:{display:"none"}})]})]}),o.jsxs("div",{className:"customize-colors",children:[o.jsxs("div",{style:{display:"flex",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:[o.jsx(jd,{label:"LOOK",active:m==="look",onClick:()=>x("look")}),o.jsx(jd,{label:"OUTFIT",active:m==="outfit",onClick:()=>x("outfit")}),o.jsx(jd,{label:"ACCESSORY",active:m==="accessory",onClick:()=>x("accessory")})]}),m==="look"&&o.jsxs(o.Fragment,{children:[o.jsx(bs,{label:"SKIN",presets:xg,value:l.skinColor,onChange:C=>d("skinColor",C)}),o.jsx(bs,{label:"HAIR COLOR",presets:pg,value:l.hairColor,onChange:C=>d("hairColor",C)}),o.jsx(Sd,{label:"HAIR STYLE",items:b,value:l.hairStyle,onChange:C=>d("hairStyle",C)})]}),m==="outfit"&&o.jsxs(o.Fragment,{children:[o.jsx(Sd,{label:"STYLE",items:v,value:l.outfitStyle,onChange:C=>d("outfitStyle",C)}),o.jsx(bs,{label:"TOP",presets:yg,value:l.shirtColor,onChange:C=>d("shirtColor",C)}),o.jsx(bs,{label:"PANTS",presets:gg,value:l.pantsColor,onChange:C=>d("pantsColor",C)}),o.jsx(bs,{label:"SHOES",presets:bg,value:l.shoeColor,onChange:C=>d("shoeColor",C)})]}),m==="accessory"&&o.jsxs(o.Fragment,{children:[f!==void 0&&o.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:[o.jsxs("span",{children:["Lv.",f]}),o.jsxs("span",{children:[S,"/",j.length," unlocked"]})]}),o.jsx(Sd,{label:"ACCESSORY",items:j,value:l.accessory,onChange:C=>d("accessory",C),lockInfo:f!==void 0?{roleLevel:f,getLockLevel:ag}:void 0}),o.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 gC=[{value:"c-level",label:"C-Level"},{value:"team-lead",label:"Team Lead"},{value:"member",label:"Member"}];function wg(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,24)}function k0(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 vs=4;function bC(t,l,r){const i=t.trim();if(!i||i.startsWith("#"))return null;const c=i.split(",").map(y=>y.trim()),u=c[0];if(!u)return null;const f=wg(u),m=(c[1]||"member").toLowerCase(),x=m==="c-level"?"c-level":m==="team-lead"?"team-lead":"member",d=c[2]||"ceo";let g;return l.has(f)?g="ID already exists":r.has(f)&&(g="Duplicate ID in batch"),r.add(f),{name:u,id:f,level:x,reportsTo:d,error:g}}function vC({existingRoles:t,onClose:l,onHire:r}){const[i,c]=k.useState("single"),[u,f]=k.useState(1),[m,x]=k.useState(""),[d,g]=k.useState(""),[y,b]=k.useState(!1),[v,j]=k.useState("member"),[S,C]=k.useState("ceo"),[E,A]=k.useState(""),[M,O]=k.useState(js),[L,F]=k.useState(!1),[I,$]=k.useState(""),[ee,z]=k.useState([]),[X,R]=k.useState(new Set),[W,te]=k.useState(""),[V,Y]=k.useState("input"),[Z,ce]=k.useState({done:0,total:0}),we=k.useRef(null),D=k.useRef(null),B=k.useRef(null);k.useEffect(()=>{Ce.getSkills().then(G=>z(G.filter(re=>re.installed))).catch(()=>{})},[]),k.useEffect(()=>{var G,re,ve;i==="single"?(u===1&&((G=we.current)==null||G.focus()),u===2&&((re=D.current)==null||re.focus())):V==="input"&&((ve=B.current)==null||ve.focus())},[u,i,V]);const Q=k.useMemo(()=>new Set(t.map(G=>G.id)),[t]),T=k.useMemo(()=>{const G=W.split(`
82
+ `),re=new Set;return G.map(ve=>bC(ve,Q,re)).filter(ve=>ve!==null)},[W,Q]),me=T.length>0&&T.every(G=>!G.error),Se=G=>{x(G),y||g(wg(G))},Ee=m.trim().length>0&&d.trim().length>0&&!t.some(G=>G.id===d),Be=E.trim().length>0,He=async()=>{F(!0),$("");const G=k0(v);try{await r({id:d,name:m.trim(),level:v,reportsTo:S,persona:E.trim(),...G,skills:X.size>0?[...X]:void 0},M),l()}catch(re){$(re instanceof Error?re.message:"Failed to create role"),F(!1)}},Ke=G=>G===1?Ee:G===2?Be:!0,ke=async()=>{F(!0),$(""),ce({done:0,total:T.length});try{for(let G=0;G<T.length;G++){const re=T[G],ve=k0(re.level),ze=js(),Ne=`${re.name}. A ${re.level} role reporting to ${re.reportsTo}.`;await r({id:re.id,name:re.name,level:re.level,reportsTo:re.reportsTo,persona:Ne,...ve},ze),ce({done:G+1,total:T.length})}l()}catch(G){$(G instanceof Error?G.message:"Failed to create roles"),F(!1)}},yt=G=>{G.key==="Escape"&&l(),G.key==="Enter"&&(G.metaKey||G.ctrlKey)&&(i==="single"?u<vs&&Ke(u)?f(u+1):u===vs&&He():V==="input"&&me?Y("review"):V==="review"&&ke())},de=t.some(G=>G.id===d)&&d.length>0;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:l}),o.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:yt,children:[o.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #2E7D32, #43A047)"},children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"text-lg font-bold",children:"Hire New Role"}),o.jsxs("div",{className:"flex bg-black/20 rounded-lg p-0.5",children:[o.jsx("button",{onClick:()=>{c("single"),$("")},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"}),o.jsx("button",{onClick:()=>{c("bulk"),$("")},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"})]})]}),o.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:i==="single"?`Step ${u} of ${vs}`:V==="input"?"Enter roles, one per line":`Review ${T.length} roles`})]}),i==="single"&&o.jsx("div",{className:"flex gap-1 px-5 pt-4",children:Array.from({length:vs},(G,re)=>re+1).map(G=>o.jsx("div",{className:"flex-1 h-1 rounded-full transition-colors",style:{background:G<=u?"#2E7D32":"rgba(255,255,255,0.1)"}},G))}),o.jsx("div",{className:"p-5 min-h-[240px] overflow-y-auto flex-1",children:i==="single"?o.jsxs(o.Fragment,{children:[u===1&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role Name"}),o.jsx("input",{ref:we,value:m,onChange:G=>Se(G.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"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role ID (slug)"}),o.jsx("input",{value:d,onChange:G=>{g(G.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 ${de?"border-red-400":"border-white/10 focus:border-white/25"}`}),de&&o.jsx("div",{className:"text-xs text-red-500 mt-1",children:"ID already exists"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Level"}),o.jsx("div",{className:"flex gap-2",children:gC.map(G=>o.jsx("button",{onClick:()=>j(G.value),className:`flex-1 p-2 text-xs font-semibold rounded-lg border cursor-pointer transition-colors ${v===G.value?"border-green-600 bg-green-900/30 text-green-400":"border-white/10 text-white/50 hover:border-white/20"}`,children:G.label},G.value))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Reports To"}),o.jsxs("select",{value:S,onChange:G=>C(G.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:[o.jsx("option",{value:"ceo",className:"bg-[var(--wall)] text-white",children:"CEO"}),t.map(G=>o.jsxs("option",{value:G.id,className:"bg-[var(--wall)] text-white",children:[G.name," (",G.id,")"]},G.id))]})]})]}),u===2&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Persona"}),o.jsx("textarea",{ref:D,value:E,onChange:G=>A(G.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"}),o.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"This defines how the AI agent will behave in this role"})]}),ee.length>0&&o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Skills"}),o.jsx("div",{className:"space-y-1.5 max-h-[120px] overflow-y-auto",children:ee.map(G=>o.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:[o.jsx("input",{type:"checkbox",checked:X.has(G.id),onChange:()=>R(re=>{const ve=new Set(re);return ve.has(G.id)?ve.delete(G.id):ve.add(G.id),ve}),className:"accent-green-600"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-xs font-semibold text-white/80",children:G.name}),o.jsx("div",{className:"text-[10px] text-white/40 truncate",children:G.description})]})]},G.id))})]})]}),u===3&&o.jsx("div",{className:"customize-body",style:{padding:0},children:o.jsx(vg,{roleId:"default",appearance:M,onChange:O,onRandomize:()=>O(js()),onReset:()=>O(js()),label:o.jsxs("span",{children:[d||"new-role"," — ",m||"New Role"]})})}),u===4&&o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Review"}),o.jsxs("div",{className:"bg-white/5 rounded-xl p-4 border border-white/10",children:[o.jsxs("div",{className:"flex gap-4",children:[o.jsx("div",{className:"flex-shrink-0 rounded-lg overflow-hidden",style:{background:"#0d1117",padding:8},children:o.jsx(Ic,{roleId:"default",appearance:M,scale:4})}),o.jsxs("div",{className:"flex-1 space-y-2.5",children:[o.jsx(ws,{label:"Name",value:m}),o.jsx(ws,{label:"ID",value:d,mono:!0}),o.jsx(ws,{label:"Level",value:v}),o.jsx(ws,{label:"Reports To",value:S}),X.size>0&&o.jsx(ws,{label:"Skills",value:[...X].join(", ")})]})]}),o.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[o.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Persona"}),o.jsx("div",{className:"text-xs text-white/60 leading-relaxed",children:E})]})]}),I&&o.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:I})]})]}):o.jsxs(o.Fragment,{children:[V==="input"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Roles (one per line)"}),o.jsx("textarea",{ref:B,value:W,onChange:G=>te(G.target.value),placeholder:`Name, Level, ReportsTo
83
83
  e.g.
84
84
  Data Analyst
85
85
  DevOps Engineer, member, cto
86
- VP Marketing, c-level, ceo`,className:"w-full h-40 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors font-mono"}),o.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."})]}),T.length>0&&o.jsxs("div",{children:[o.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Preview (",T.length," role",T.length!==1?"s":"",")"]}),o.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden",children:o.jsxs("table",{className:"w-full text-xs",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"border-b border-white/10",children:[o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),o.jsx("tbody",{children:T.map((G,re)=>o.jsxs("tr",{className:`border-b border-white/5 ${G.error?"bg-red-900/10":""}`,children:[o.jsx("td",{className:"p-2 text-white/80",children:G.name}),o.jsx("td",{className:"p-2 text-white/60 font-mono",children:G.id}),o.jsx("td",{className:"p-2 text-white/60",children:G.level}),o.jsx("td",{className:"p-2 text-white/60",children:G.reportsTo}),G.error&&o.jsx("td",{className:"p-2 text-red-400 text-[10px]",children:G.error})]},re))})]})})]})]}),V==="review"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Confirm Bulk Hire — ",T.length," roles"]}),o.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden max-h-[300px] overflow-y-auto",children:o.jsxs("table",{className:"w-full text-xs",children:[o.jsx("thead",{className:"sticky top-0 bg-[var(--wall)]",children:o.jsxs("tr",{className:"border-b border-white/10",children:[o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"#"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),o.jsx("tbody",{children:T.map((G,re)=>o.jsxs("tr",{className:"border-b border-white/5",children:[o.jsx("td",{className:"p-2 text-white/30",children:re+1}),o.jsx("td",{className:"p-2 text-white/80",children:G.name}),o.jsx("td",{className:"p-2 text-white/60 font-mono",children:G.id}),o.jsx("td",{className:"p-2 text-white/60",children:G.level}),o.jsx("td",{className:"p-2 text-white/60",children:G.reportsTo})]},re))})]})}),L&&Z.total>0&&o.jsxs("div",{children:[o.jsxs("div",{className:"flex justify-between text-[10px] text-white/40 mb-1",children:[o.jsx("span",{children:"Hiring..."}),o.jsxs("span",{children:[Z.done,"/",Z.total]})]}),o.jsx("div",{className:"h-1.5 bg-white/10 rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Z.done/Z.total*100}%`,background:"#2E7D32"}})})]}),o.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."}),U&&o.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:U})]})]})}),o.jsxs("div",{className:"flex justify-between px-5 pb-5",children:[o.jsxs("div",{children:[i==="single"&&u>1&&o.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"&&V==="review"&&o.jsx("button",{onClick:()=>I("input"),disabled:L,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"})]}),o.jsxs("div",{className:"flex gap-3",children:[o.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<vs?o.jsx("button",{onClick:()=>f(u+1),disabled:!Ke(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"}):o.jsx("button",{onClick:He,disabled:L,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:L?"Hiring...":"HIRE"}):V==="input"?o.jsxs("button",{onClick:()=>I("review"),disabled:!me,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 (",T.length,")"]}):o.jsx("button",{onClick:ke,disabled:L,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:L?`Hiring ${Z.done}/${Z.total}...`:`HIRE ALL (${T.length})`})]})]})]})]})}function ws({label:t,value:l,mono:r}){return o.jsxs("div",{className:"flex justify-between text-sm",children:[o.jsx("span",{className:"text-white/40",children:t}),o.jsx("span",{className:`font-semibold text-white/80 ${r?"font-mono":""}`,children:l})]})}function vC({roleId:t,roleName:l,onClose:r,onConfirm:i}){const[c,u]=S.useState(!1),f=async()=>{u(!0);try{await i(t)}finally{u(!1)}};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),o.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:[o.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[o.jsx("div",{className:"text-lg font-bold",children:"Fire Role"}),o.jsxs("div",{className:"text-sm opacity-80 mt-0.5",children:["Remove ",l," (",t,")"]})]}),o.jsxs("div",{className:"p-5",children:[o.jsxs("div",{className:"p-4 rounded-lg border-2 border-red-300 bg-red-50 mb-4",children:[o.jsx("div",{className:"text-sm font-bold text-red-800 mb-1",children:"Warning"}),o.jsxs("div",{className:"text-xs text-red-700 leading-relaxed",children:["This will permanently delete the role directory including",o.jsx("strong",{children:" role.yaml"}),", ",o.jsx("strong",{children:"profile.md"}),", ",o.jsx("strong",{children:"SKILL.md"}),", and all journal entries. This action cannot be undone."]})]}),o.jsxs("div",{className:"text-sm text-gray-600",children:["Are you sure you want to fire ",o.jsx("strong",{children:l}),"?"]})]}),o.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[o.jsx("button",{onClick:r,className:"px-4 py-2 text-sm rounded-lg border border-gray-300 hover:bg-gray-50 cursor-pointer",children:"Cancel"}),o.jsx("button",{onClick:f,disabled:c,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#B71C1C"},children:c?"Removing...":"Confirm Fire"})]})]})]})}const wC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function kC({roleId:t,title:l,roleColor:r,active:i,onClick:c,onClose:u,"data-session-id":f}){return o.jsxs("button",{onClick:c,"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 ${r}`}:void 0,children:[o.jsx("span",{className:"text-xs",children:wC[t]??"👤"}),o.jsx("span",{className:"truncate",children:l}),o.jsx("span",{onClick:u,className:"ml-auto text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none",children:"×"})]})}function SC({content:t,streaming:l}){let r=t;return l&&(t.match(/```/g)??[]).length%2!==0&&(r+="\n```"),o.jsx("div",{className:"terminal-markdown",children:o.jsx(Ny,{remarkPlugins:[Zy],components:{code:jC,table:({children:i})=>o.jsx("div",{className:"overflow-x-auto my-2",children:o.jsx("table",{className:"terminal-table",children:i})})},children:r})})}function jC({className:t,children:l,...r}){const i=/language-(\w+)/.exec(t??"");return i||typeof l=="string"&&l.includes(`
87
- `)?o.jsx(CC,{language:i==null?void 0:i[1],children:l}):o.jsx("code",{className:"terminal-inline-code",...r,children:l})}function CC({children:t,language:l}){const[r,i]=S.useState(!1),c=String(t).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(c),i(!0),setTimeout(()=>i(!1),1500)};return o.jsxs("div",{className:"terminal-code-block group relative my-2",children:[l&&o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] px-3 pt-1.5",children:l}),o.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:r?"Copied!":"Copy"}),o.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:o.jsx("code",{children:c})})]})}const EC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function Cd(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 NC(t){const l=[];let r="";for(const i of t)if(i.type==="thinking")i.text&&(r=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:Cd(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 c=l.length>0?l[l.length-1]:null;(c==null?void 0:c.type)==="dispatch:progress"&&c.roleId===i.roleId?i.progressType==="tool"?(c.toolName=i.toolName,c.toolSummary=Cd(i.toolName??"",i.toolInput),c.progressType="tool"):i.progressType==="thinking"?(c.text=i.text,c.progressType="thinking"):i.progressType==="text"?(c.text=i.text,c.progressType="text"):(i.progressType==="done"||i.progressType==="error")&&(c.progressType=i.progressType):l.push({type:"dispatch:progress",roleId:i.roleId,progressType:i.progressType,text:i.text,toolName:i.toolName,toolSummary:i.toolName?Cd(i.toolName,i.toolInput):void 0})}if(r){const i=l.filter(c=>c.type==="thinking");i.length>0&&(i[i.length-1].text=r)}return l}function AC({event:t,isStreaming:l}){var c,u,f;const[r,i]=S.useState(!1);switch(t.type){case"thinking":return o.jsxs("div",{className:"stream-event-thinking",children:[o.jsxs("div",{className:"stream-event-thinking-header",onClick:()=>i(!r),children:[o.jsx("span",{className:"stream-event-thinking-icon"}),o.jsxs("span",{className:"stream-event-thinking-label",children:["thinking",l?"...":""]}),t.text&&!l&&o.jsx("span",{className:"stream-event-thinking-toggle",children:r?"▾":"▸"})]}),(l||r)&&t.text&&o.jsx("div",{className:"stream-event-thinking-content",children:t.text.slice(-500)})]});case"tool":return o.jsxs("div",{className:"stream-event-tool",children:[o.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&o.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary}),t.toolInput&&o.jsx("span",{className:"stream-event-tool-toggle",onClick:()=>i(!r),children:r?"▾":"▸"}),r&&t.toolInput&&o.jsx("div",{className:"stream-event-tool-detail",children:JSON.stringify(t.toolInput,null,1).slice(0,300)})]});case"dispatch":return o.jsxs("div",{className:"stream-event-dispatch",children:[o.jsxs("span",{className:"stream-event-dispatch-badge",children:["→"," ",(c=t.roleId)==null?void 0:c.toUpperCase()]}),o.jsx("span",{className:"stream-event-dispatch-task",children:(u=t.task)==null?void 0:u.slice(0,80)})]});case"dispatch:progress":return o.jsxs("div",{className:"stream-event-dispatch-progress",children:[o.jsx("span",{className:"stream-event-dispatch-progress-role",children:(f=t.roleId)==null?void 0:f.toUpperCase()}),t.progressType==="thinking"&&o.jsxs("span",{className:"stream-event-dispatch-progress-status",children:["thinking",l?"...":""]}),t.progressType==="tool"&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&o.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary})]}),t.progressType==="text"&&t.text&&o.jsx("span",{className:"stream-event-dispatch-progress-status",children:"responding..."}),t.progressType==="done"&&o.jsx("span",{className:"stream-event-dispatch-progress-done",children:"done"}),t.progressType==="error"&&o.jsx("span",{className:"stream-event-dispatch-progress-error",children:"error"})]});default:return null}}function TC({events:t,isStreaming:l}){const[r,i]=S.useState(!1);if(t.length===0)return null;const c=NC(t);if(c.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),d=[];if(u>0&&d.push("thinking"),f.length>0){const b=[...new Set(f.map(v=>v.toolName))];b.length<=3?d.push(b.join(", ")):d.push(`${f.length} tool calls`)}m.length>0&&d.push(`${m.length} dispatch`),p>1&&d.push(`${p} turns`);const g=d.join(" · "),y=!r;return o.jsxs("div",{className:"stream-activity-log",children:[o.jsxs("div",{className:"stream-activity-header",onClick:()=>i(!r),children:[l&&o.jsx("span",{className:"stream-activity-pulse"}),o.jsxs("span",{className:"stream-activity-summary",children:[r?"▸":"▾"," ",g,l?"...":""]})]}),y&&o.jsx("div",{className:"stream-activity-events",children:c.map((b,v)=>o.jsx(AC,{event:b,isStreaming:l&&v===c.length-1},v))})]})}function DC({message:t,roleId:l,roleColor:r}){var d;const i=t.from==="ceo",c=t.type==="system",u=t.status==="streaming";if(c)return o.jsx("div",{className:"flex justify-center my-2",children:o.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 o.jsx("div",{className:"flex justify-end mb-3",children:o.jsxs("div",{className:"max-w-[85%]",children:[o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] text-right mb-1",children:"CEO"}),o.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"&&o.jsx("span",{className:"text-amber-400 text-[10px] font-bold mr-1.5",children:"DO"}),t.content]})]})});const f=(((d=t.streamEvents)==null?void 0:d.length)??0)>0,m=!!t.thinking,p=m&&!t.content&&u&&!f;return o.jsxs("div",{className:"flex gap-2.5 mb-3",children:[o.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center text-sm shrink-0 mt-5",style:{background:`${r}33`},children:EC[l]??"👤"}),o.jsxs("div",{className:"max-w-[85%] min-w-0",children:[o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] mb-1",children:l.toUpperCase()}),f&&o.jsx(TC,{events:t.streamEvents,isStreaming:u}),m&&!f&&o.jsxs("details",{open:p,className:"mb-1",children:[o.jsxs("summary",{className:"text-[10px] text-purple-400/70 cursor-pointer select-none flex items-center gap-1",children:[p&&o.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-purple-400 animate-pulse"}),"thinking",p?"...":` (${t.thinking.length} chars)`]}),o.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)})]}),o.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 ${r}`,background:"var(--terminal-surface)"},children:[t.content?o.jsx(SC,{content:t.content,streaming:u}):u&&!m?o.jsx("span",{className:"inline-block w-2 h-4 bg-[var(--terminal-text-secondary)] animate-pulse"}):u&&m?o.jsx("span",{className:"text-[11px] text-purple-400/50 italic",children:"analyzing..."}):null,u&&t.content&&o.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"&&o.jsx("div",{className:"text-[10px] text-red-400 mt-1",children:"Error occurred"})]})]})}function zC({messages:t,roleId:l,roleColor:r}){var c;const i=S.useRef(null);return S.useEffect(()=>{var u;(u=i.current)==null||u.scrollIntoView({behavior:"smooth"})},[t,(c=t[t.length-1])==null?void 0:c.content]),t.length===0?o.jsxs("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:["Start a conversation with ",l.toUpperCase()]}):o.jsxs("div",{className:"flex-1 overflow-y-auto p-4 terminal-scrollbar",children:[t.map(u=>o.jsx(DC,{message:u,roleId:l,roleColor:r},u.id)),o.jsx("div",{ref:i})]})}function MC({mode:t,onModeChange:l,onSend:r,disabled:i,disabledReason:c}){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||(r(g),f(""))},d=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),p())};return o.jsxs("div",{className:"border-t border-[var(--terminal-border)] p-3 shrink-0",children:[c&&o.jsx("div",{className:"text-[10px] text-amber-400/70 mb-2 text-center",children:c}),o.jsxs("div",{className:"flex items-end gap-2",children:[o.jsxs("div",{className:"flex rounded-lg overflow-hidden border border-[var(--terminal-border)] shrink-0",children:[o.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"}),o.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"})]}),o.jsx("textarea",{ref:m,value:u,onChange:g=>f(g.target.value),onKeyDown:d,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"}),o.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:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M22 2L11 13"}),o.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})]})}const RC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},wg={cto:"CTO",cbo:"CBO",pm:"PM",engineer:"Engineer",designer:"Designer",qa:"QA","data-analyst":"Data Analyst"};function S0(t){return new Date(t).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit"})}function FC({msg:t}){const l=RC[t.roleId]??"#888",r=wg[t.roleId]??t.roleId;if(t.type==="dispatch"){const i=t.text.includes("WAVE"),c=t.text.includes("completed")||t.text.includes("완료"),u=i?"📡":c?"✓":"→",f=c?"text-green-400/70":"text-[var(--terminal-text-muted)]";return o.jsxs("div",{className:"flex items-start gap-2 px-3 py-1 hover:bg-white/[0.02]",children:[o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:S0(t.ts)}),o.jsx("span",{className:"text-[10px] shrink-0 mt-0.5",children:u}),o.jsx("span",{className:`text-[11px] ${f}`,children:t.text})]})}return o.jsxs("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-white/[0.02]",children:[o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:S0(t.ts)}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-[11px] font-semibold mr-1.5",style:{color:l},children:r}),o.jsx("span",{className:"text-xs text-[var(--terminal-text-secondary)]",children:t.text})]})]})}function _C({channel:t,allRoles:l,onUpdateMembers:r,onUpdateTopic:i}){const c=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=c.current)==null||j.scrollIntoView({behavior:"smooth"}))},[t.messages.length]);const[f,m]=S.useState(!1),[p,d]=S.useState(!1),[g,y]=S.useState("");return o.jsxs("div",{ref:u,className:"flex-1 overflow-y-auto terminal-scrollbar py-2",children:[o.jsxs("div",{className:"px-3 py-2 mb-2 border-b border-[var(--terminal-border)] flex items-center gap-2",children:[o.jsx("span",{className:"text-sm font-semibold text-[var(--terminal-text)]",children:t.name}),t.members.length>0&&o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.members.map(b=>wg[b]??b).join(", ")}),t.members.length===0&&o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.isDefault?"system logs":"no members"}),!t.isDefault&&l&&r&&o.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&&o.jsx("div",{className:"px-3 pb-2 mb-1",children:p?o.jsx("input",{autoFocus:!0,value:g,onChange:b=>y(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(i(t.id,g.trim()),d(!1)),b.key==="Escape"&&d(!1)},onBlur:()=>{i(t.id,g.trim()),d(!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"}):o.jsx("button",{onClick:()=>{y(t.topic??""),d(!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&&r&&o.jsx("div",{className:"px-3 pb-2 mb-2 border-b border-[var(--terminal-border)]",children:o.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(b=>{const v=t.members.includes(b.id);return o.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];r(t.id,j)},children:[v?"✓ ":"",b.name]},b.id)})})}),t.messages.length===0&&o.jsx("div",{className:"flex-1 flex flex-col items-center justify-center text-[var(--terminal-text-muted)] text-xs gap-1 py-8",children:o.jsx("span",{children:t.isDefault?"No dispatch events yet":"No messages yet — invite roles to start chatting"})}),t.messages.map(b=>o.jsx(FC,{msg:b},b.id)),o.jsx("div",{ref:c})]})}const Ed={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},OC=400,BC=800;function LC({sessions:t,activeSessionId:l,roles:r,streamingSessionId:i,width:c,onWidthChange:u,onSwitchSession:f,onCloseSession:m,onCreateSession:p,onClearEmpty:d,onCloseAll:g,onSendMessage:y,onModeChange:b,onCloseTerminal:v,chatChannels:j,activeChatChannelId:k,onSwitchChatChannel:C,onCreateChatChannel:E,onDeleteChatChannel:A,onUpdateChatMembers:R,onUpdateChatTopic:O,unreadChannels:L}){const[D,U]=S.useState(!1),[X,ne]=S.useState(!1),[M,q]=S.useState(!1),[F,W]=S.useState(""),ee=k!=null,V=j==null?void 0:j.find(ke=>ke.id===k),[I,Z]=S.useState(!1),[ce,we]=S.useState(!1),[z,B]=S.useState(!1),Q=S.useRef(0),T=S.useRef(0),me=S.useRef(null),Se=t.find(ke=>ke.id===l),Ee=i===l,Be=t.filter(ke=>ke.messages.length===0).length,He=S.useCallback(()=>{const ke=me.current;ke&&(we(ke.scrollLeft>0),B(ke.scrollLeft+ke.clientWidth<ke.scrollWidth-1))},[]);S.useEffect(()=>{if(!l||!me.current)return;const ke=me.current.querySelector(`[data-session-id="${l}"]`);ke&&ke.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),He()},[l,t.length,He]),S.useEffect(()=>{const ke=me.current;if(!ke)return;He(),ke.addEventListener("scroll",He);const yt=new ResizeObserver(He);return yt.observe(ke),()=>{ke.removeEventListener("scroll",He),yt.disconnect()}},[He]);const Ke=S.useCallback(ke=>{ke.preventDefault(),Q.current=ke.clientX,T.current=c,Z(!0);const yt=G=>{const re=Q.current-G.clientX,ve=Math.min(BC,Math.max(OC,T.current+re));u==null||u(ve)},de=()=>{Z(!1),document.removeEventListener("mousemove",yt),document.removeEventListener("mouseup",de)};document.addEventListener("mousemove",yt),document.addEventListener("mouseup",de)},[c,u]);return o.jsxs("div",{className:"shrink-0 bg-[var(--terminal-bg)] border-l border-[var(--terminal-border)] flex flex-col h-full relative",style:{width:c},children:[u&&o.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:Ke}),o.jsxs("div",{className:"flex items-center bg-[var(--terminal-bg-deeper)] border-b border-[var(--terminal-border)] shrink-0",children:[o.jsxs("div",{className:"relative flex-1 min-w-0",children:[ce&&o.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"}),o.jsxs("div",{ref:me,className:"flex items-center overflow-x-auto terminal-tab-scroll gap-px px-1 py-1",children:[j==null?void 0:j.map(ke=>o.jsxs("button",{onClick:()=>{C==null||C(ke.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===ke.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===ke.id?{borderTop:"2px solid #4CAF50"}:void 0,children:[o.jsx("span",{className:"text-[10px]",children:"💬"}),o.jsx("span",{className:"truncate",children:ke.name}),(L==null?void 0:L.has(ke.id))&&k!==ke.id&&o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 shrink-0"}),!ke.isDefault&&o.jsx("span",{onClick:yt=>{yt.stopPropagation(),A==null||A(ke.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:"×"})]},ke.id)),j&&j.length>0&&t.length>0&&o.jsx("div",{className:"w-px h-4 bg-[var(--terminal-border)] shrink-0 mx-1"}),t.map(ke=>o.jsx(kC,{roleId:ke.roleId,title:ke.title,roleColor:Ed[ke.roleId]??"#666",active:!ee&&ke.id===l,onClick:()=>{C==null||C(null),f(ke.id)},onClose:yt=>{yt.stopPropagation(),m(ke.id)},"data-session-id":ke.id},ke.id))]}),z&&o.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"})]}),o.jsxs("div",{className:"relative shrink-0",children:[o.jsx("button",{onClick:()=>{U(!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&&o.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&&o.jsxs(o.Fragment,{children:[M?o.jsxs("div",{className:"px-3 py-2 flex items-center gap-1",children:[o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:"#"}),o.jsx("input",{autoFocus:!0,value:F,onChange:ke=>W(ke.target.value),onKeyDown:ke=>{ke.key==="Enter"&&F.trim()&&(E(F.trim(),[]),W(""),q(!1),U(!1)),ke.key==="Escape"&&(q(!1),W(""))},placeholder:"channel name",className:"flex-1 bg-transparent text-xs text-[var(--terminal-text)] outline-none border-b border-[var(--terminal-border)]"})]}):o.jsxs("button",{onClick:()=>q(!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:[o.jsx("span",{className:"text-[10px]",children:"💬"}),"New Channel"]}),o.jsx("div",{className:"border-b border-[var(--terminal-border)] my-1"})]}),r.map(ke=>o.jsxs("button",{onClick:()=>{p(ke.id),C==null||C(null),U(!1)},className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:Ed[ke.id]??"#666"}}),ke.id.toUpperCase()," — ",ke.name]},ke.id))]})]}),o.jsxs("div",{className:"relative shrink-0",children:[o.jsx("button",{onClick:()=>{ne(!X),U(!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:"···"}),X&&o.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:[o.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":""]}),Be>0&&d&&o.jsxs("button",{onClick:()=>{d(),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 (",Be,")"]}),t.length>0&&g&&o.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&&o.jsx("div",{className:"px-3 py-2 text-xs text-[var(--terminal-text-muted)]",children:"No sessions"})]})]}),o.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:"×"})]}),ee&&V?o.jsx(_C,{channel:V,allRoles:r,onUpdateMembers:R,onUpdateTopic:O}):Se?o.jsxs(o.Fragment,{children:[o.jsx(zC,{messages:Se.messages,roleId:Se.roleId,roleColor:Ed[Se.roleId]??"#666"}),o.jsx(MC,{mode:Se.mode,onModeChange:ke=>b(Se.id,ke),onSend:ke=>y(Se.id,ke,Se.mode),disabled:Ee,disabledReason:Ee?`${Se.roleId.toUpperCase()} is responding...`:void 0})]}):o.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 $C(){const t=S.useRef(null),l=S.useCallback(()=>{var i;(i=t.current)==null||i.abort(),t.current=null},[]);return{sendMessage:S.useCallback((i,c,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:c,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 d=p.body.getReader(),g=new TextDecoder;let y="";for(;;){const{done:E,value:A}=await d.read();if(E)break;y+=g.decode(A,{stream:!0});const R=y.split(`
88
- `);y=R.pop()??"";let O="";for(let L=0;L<R.length;L++){const D=R[L];if(D.startsWith("event: ")){O=D.slice(7).trim();continue}if(D.startsWith("data: ")){let U;try{U=JSON.parse(D.slice(6))}catch{O="";continue}switch(O){case"thinking":U.text&&((b=f.onThinking)==null||b.call(f,U.text));break;case"output":U.text&&f.onText(U.text);break;case"tool":(v=f.onToolUse)==null||v.call(f,U.name,U.input);break;case"dispatch":(j=f.onDispatch)==null||j.call(f,U.roleId,U.task);break;case"dispatch:progress":(k=f.onDispatchProgress)==null||k.call(f,U.roleId,U.type,U);break;case"turn":(C=f.onTurn)==null||C.call(f,U.turn);break;case"done":f.onDone(U);break;case"error":f.onError(U.message??"Unknown error");break;default:U.text&&f.onText(U.text);break}O=""}}}}).catch(p=>{p.name!=="AbortError"&&f.onError(p.message)}),{abort:l}},[l]),abort:l}}const Nh="tycono-appearances",Rc="tycono-theme";(()=>{try{for(const[t,l]of[["the-company-appearances",Nh],["the-company-theme",Rc]]){const r=localStorage.getItem(t);r&&!localStorage.getItem(l)&&(localStorage.setItem(l,r),localStorage.removeItem(t))}}catch{}})();function j0(){try{const t=localStorage.getItem(Nh);return t?JSON.parse(t):{}}catch{return{}}}function Nd(t){localStorage.setItem(Nh,JSON.stringify(t))}function C0(){try{const t=localStorage.getItem(Rc);if(t&&t in Hr)return t}catch{}return"default"}function HC(t){var i;const l=(i=Hr[t])==null?void 0:i.vars;if(!l)return;const r=document.documentElement;for(const[c,u]of Object.entries(l))r.style.setProperty(c,u)}const Ad={mode:"auto",intervalSec:18,dailyBudgetUsd:1},Pd="tycono-speech-settings",Td="tycono-language";function UC(){try{const t=localStorage.getItem(Pd);return t?{...Ad,...JSON.parse(t)}:Ad}catch{return Ad}}function IC(){const[t,l]=S.useState(j0),[r,i]=S.useState(C0),[c,u]=S.useState(UC),[f,m]=S.useState(()=>{try{return localStorage.getItem(Td)??"auto"}catch{return"auto"}}),p=S.useRef(!1);S.useEffect(()=>{p.current||(p.current=!0,Ce.getPreferences().then(k=>{const C=Object.keys(k.appearances??{}).length>0||k.theme!=="default";if(k.speech&&(u(E=>({...E,...k.speech})),localStorage.setItem(Pd,JSON.stringify(k.speech))),k.language&&(m(k.language),localStorage.setItem(Td,k.language)),C){const E=k.appearances;l(E),Nd(E),k.theme&&k.theme in Hr&&(i(k.theme),localStorage.setItem(Rc,k.theme))}else{const E=j0(),A=C0();(Object.keys(E).length>0||A!=="default")&&Ce.updatePreferences({appearances:E,theme:A}).catch(()=>{})}}).catch(()=>{}))},[]),S.useEffect(()=>{HC(r)},[r]);const d=S.useCallback(k=>t[k]??Eh(k),[t]),g=S.useCallback((k,C)=>{l(E=>{const A={...E,[k]:C};return Nd(A),Ce.updatePreferences({appearances:A}).catch(()=>{}),A})},[]),y=S.useCallback(k=>{l(C=>{const E={...C};return delete E[k],Nd(E),Ce.updatePreferences({appearances:E}).catch(()=>{}),E})},[]),b=S.useCallback(k=>{i(k),localStorage.setItem(Rc,k),Ce.updatePreferences({theme:k}).catch(()=>{})},[]),v=S.useCallback(k=>{u(C=>{const E={...C,...k};return localStorage.setItem(Pd,JSON.stringify(E)),Ce.updatePreferences({speech:E}).catch(()=>{}),E})},[]),j=S.useCallback(k=>{m(k),localStorage.setItem(Td,k),Ce.updatePreferences({language:k}).catch(()=>{})},[]);return{appearances:t,getAppearance:d,setAppearance:g,resetAppearance:y,theme:r,setTheme:b,speechSettings:c,setSpeechSettings:v,language:f,setLanguage:j}}const YC=3e4;function qC(){var j;const[t,l]=S.useState(null),[r,i]=S.useState("synced"),[c,u]=S.useState([]),f=S.useRef(null),m=S.useCallback(async()=>{try{const k=await Ce.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,YC),()=>{f.current&&clearInterval(f.current)}),[m]);const p=S.useCallback(async k=>{i("saving");try{const C=await Ce.save(k);return await m(),C}catch(C){throw i("error"),C}},[m]),d=S.useCallback(async()=>{try{const k=await Ce.getSaveHistory(20);u(k)}catch{}},[]),g=S.useCallback(async k=>{i("saving");try{await Ce.restoreSave(k),await m()}catch(C){throw i("error"),C}},[m]),y=S.useCallback(async()=>{try{await Ce.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:r,dirtyCount:b,lastSaved:v,status:t,save:p,history:c,loadHistory:d,restore:g,refresh:m,initGit:y}}const E0={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."]},N0={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."]},XC=[{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."}]}],VC=18e3,A0=6e3,GC=2500,KC=30*6e4,kg="tycono:relationships";function QC(){try{const t=localStorage.getItem(kg);return t?JSON.parse(t):[]}catch{return[]}}function WC(t){localStorage.setItem(kg,JSON.stringify(t))}function uc(t,l,r){const[i,c]=l<r?[l,r]:[r,l];let u=t.find(f=>f.roleA===i&&f.roleB===c);return u||(u={roleA:i,roleB:c,dispatches:0,wavesTogether:0,conversations:0,familiarity:0,lastInteraction:new Date().toISOString()},t.push(u)),u}function fc(t){return Math.min(100,t.dispatches*5+t.wavesTogether*10+t.conversations*2)}function dc(t){return t[Math.floor(Math.random()*t.length)]}function ZC(t,l,r){const i=r.find(m=>m.id===t),c=r.find(m=>m.id===l);if(!i||!c)return null;const u=i.level==="c-level",f=c.level==="c-level";return u&&f?"c-level":i.reportsTo===l||c.reportsTo===t?"superior-subordinate":(i.reportsTo===c.reportsTo,"peer")}function JC(t,l){return t.relation==="any"?!0:t.relation===l}function PC({roles:t,roleStatuses:l,activeExecs:r,getStandupSpeech:i}){const[c,u]=S.useState(new Map),[f,m]=S.useState(QC),p=S.useRef({}),d=S.useRef(null),g=S.useRef(t),y=S.useRef(l),b=S.useRef(r),v=S.useRef(i),j=S.useRef(f);g.current=t,y.current=l,b.current=r,v.current=i,j.current=f,S.useEffect(()=>{const O=Date.now();for(const[L,D]of Object.entries(l))D==="working"&&(p.current[L]=O)},[l]),S.useEffect(()=>{WC(f)},[f]);const k=S.useCallback(O=>{const L=y.current[O],D=b.current.find(q=>q.roleId===O);if(L==="working"&&(D!=null&&D.task))return null;const U=v.current(O);if(U&&Math.random()<.3)return{text:U,type:"work",ts:Date.now()};const X=Date.now(),ne=p.current[O]??0;if(X-ne>KC&&Math.random()<.5){const q=N0[O]??N0.engineer;return{text:dc(q),type:"guilt",ts:X}}const M=E0[O]??E0.engineer;return{text:dc(M),type:"personality",ts:X}},[]),C=S.useCallback(O=>{if(d.current)return!1;const L=O.filter(Z=>y.current[Z.id]!=="working");if(L.length<2)return!1;const D=[...L].sort(()=>Math.random()-.5),U=D[0],X=D[1],ne=ZC(U.id,X.id,O);if(!ne)return!1;const M=uc(j.current,U.id,X.id),q=fc(M),F=XC.filter(Z=>JC(Z,ne)&&q>=Z.minFamiliarity);if(F.length===0)return!1;const W=dc(F);let ee=U.id,V=X.id;W.relation==="superior-subordinate"&&(X.reportsTo===U.id||U.level==="c-level"?(ee=U.id,V=X.id):(ee=X.id,V=U.id)),d.current={templateId:W.id,roleA:ee,roleB:V,turnIdx:0,timer:null};const I=Z=>{if(!d.current||Z>=W.turns.length){d.current=null,m(B=>{const Q=[...B],T=uc(Q,ee,V);return T.conversations++,T.familiarity=fc(T),T.lastInteraction=new Date().toISOString(),Q}),setTimeout(()=>{u(B=>{const Q=new Map(B);return Q.delete(ee),Q.delete(V),Q})},A0);return}const ce=W.turns[Z],we=ce.speaker==="A"?ee:V,z=ce.speaker==="A"?V:ee;u(B=>{const Q=new Map(B);if(Q.set(we,{text:ce.text,type:"social",partnerId:z,ts:Date.now()}),Z>0){const T=W.turns[Z-1].speaker==="A"?ee:V;T!==we&&Q.delete(T)}return Q}),d.current.turnIdx=Z,d.current.timer=setTimeout(()=>I(Z+1),GC)};return I(0),!0},[]);S.useEffect(()=>{const O=setInterval(()=>{const L=g.current;if(L.length===0||d.current||Math.random()<.35&&C(L))return;const D=L.filter(ne=>y.current[ne.id]!=="working");if(D.length===0)return;const U=dc(D),X=k(U.id);X&&(u(ne=>{const M=new Map(ne);return M.set(U.id,X),M}),setTimeout(()=>{u(ne=>{const M=new Map(ne),q=M.get(U.id);return q&&q.ts===X.ts&&M.delete(U.id),M})},A0))},VC);return()=>{var L;clearInterval(O),(L=d.current)!=null&&L.timer&&clearTimeout(d.current.timer)}},[k,C]);const E=S.useCallback(O=>{const L=c.get(O);return(L==null?void 0:L.text)??""},[c]),A=S.useCallback((O,L)=>{m(D=>{const U=[...D],X=uc(U,O,L);return X.dispatches++,X.familiarity=fc(X),X.lastInteraction=new Date().toISOString(),U})},[]),R=S.useCallback(O=>{O.length<2||m(L=>{const D=[...L];for(let U=0;U<O.length;U++)for(let X=U+1;X<O.length;X++){const ne=uc(D,O[U],O[X]);ne.wavesTogether++,ne.familiarity=fc(ne),ne.lastInteraction=new Date().toISOString()}return D})},[]);return{speeches:c,getSpeech:E,relationships:f,notifyDispatch:A,notifyWave:R}}const Sg="tycono:office-chat";let eE=0;function tE(){return`chat-${Date.now()}-${++eE}`}function Dd(){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 nE(){try{const t=localStorage.getItem(Sg);if(t){const l=JSON.parse(t);if(l.find(i=>i.id==="office")&&!l.find(i=>i.id==="general")){const i=l.filter(c=>c.id!=="office");return[...Dd(),...i]}const r=Dd();for(const i of r)l.find(c=>c.id===i.id)||l.unshift(i);return l}}catch{}return Dd()}function lE(t){const l=t.map(r=>({...r,messages:r.messages.slice(-200)}));localStorage.setItem(Sg,JSON.stringify(l))}function rE(){const[t,l]=S.useState(nE),[r,i]=S.useState(null),[c,u]=S.useState(new Set);S.useEffect(()=>{lE(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:tE()};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 A=new Set(E);for(const R of C){const O=k.find(L=>L.id===R.id);O&&R.messages.length>O.messages.length&&A.add(R.id)}return A}),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(A=>[...A,E]),i(C)},[]),d=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:r,setActiveChannelId:f,pushMessage:m,createChannel:p,deleteChannel:d,updateMembers:g,updateTopic:y,unreadChannels:c,syncDefaultMembers:b}}const aE=45e3,iE=3e3,sE=3,oE=20;function cE({roles:t,roleStatuses:l,activeExecs:r,channels:i,relationships:c,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)??aE/1e3)*1e3,b=S.useRef(t),v=S.useRef(l),j=S.useRef(r),k=S.useRef(i),C=S.useRef(c),E=S.useRef(u),A=S.useRef(0),R=S.useRef(!1);b.current=t,v.current=l,j.current=r,k.current=i,C.current=c,E.current=u;const O=S.useCallback(async(D,U)=>{if(R.current)return!1;R.current=!0;try{if(!b.current.find(V=>V.id===D))return!1;const ne=U.messages.slice(-oE).map(V=>({roleId:V.roleId,text:V.text,ts:V.ts})),M=b.current.filter(V=>U.members.includes(V.id)),q=C.current.filter(V=>V.roleA===D||V.roleB===D).map(V=>({partnerId:V.roleA===D?V.roleB:V.roleA,familiarity:V.familiarity})),F=j.current.find(V=>V.roleId===D),W=F?{currentTask:F.task,taskProgress:null}:{currentTask:null,taskProgress:null},ee=await Ce.chatInChannel({channelId:U.name.replace("#",""),channelTopic:U.topic,roleId:D,history:ne,members:M.map(V=>({id:V.id,name:V.name,level:V.level})),relationships:q,workContext:W});return ee.message?(E.current({ts:Date.now(),roleId:D,text:ee.message,type:"chat",channelId:U.id}),!0):!1}catch{return!1}finally{R.current=!1}},[]),L=S.useCallback(async(D,U)=>{if(A.current>=sE){A.current=0;return}const X=D.members.filter(M=>M!==U&&v.current[M]!=="working");if(X.length===0){A.current=0;return}const ne=X[Math.floor(Math.random()*X.length)];if(Math.random()>.6){A.current=0;return}setTimeout(async()=>{A.current++;const M=k.current.find(F=>F.id===D.id);if(!M)return;await O(ne,M)?L(M,ne):A.current=0},iE+Math.random()*2e3)},[O]);S.useEffect(()=>{if(!g)return;const D=setInterval(async()=>{const U=b.current;if(U.length===0||R.current)return;const X=U.filter(W=>v.current[W.id]!=="working");if(X.length===0)return;const ne=X[Math.floor(Math.random()*X.length)],M=k.current.filter(W=>W.members.length===0?!0:W.members.includes(ne.id));if(M.length===0)return;const q=M[Math.floor(Math.random()*M.length)];A.current=0,await O(ne.id,q)&&L(q,ne.id)},y);return()=>clearInterval(D)},[g,y,O,L])}function hc({type:t,className:l}){const r=S.useRef(null),i=AS(t);return S.useEffect(()=>{const c=r.current;if(!c||!i)return;const u=c.getContext("2d");u&&DS(u,i)},[t,i]),i?o.jsx("canvas",{ref:r,width:i.canvasWidth,height:i.canvasHeight,className:l,style:{imageRendering:"pixelated",display:"block"}}):null}const jg=[[1,8],[3,5],[8,1],[5,3]],uE=[[1,4],[2,3],[4,1],[3,2]];function mc(t){const l=t===1||t===3?-1:0,r=jg[t],i=t<2?[0,1]:[1,0],c=l;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:r[0],y:13,w:3,h:4,c:"$pants"},{x:r[1],y:13,w:3,h:4,c:"$pants"},{x:r[0]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:r[1]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:r[0],y:16,w:3,h:2,c:"$shoes"},{x:r[1],y:16,w:3,h:2,c:"$shoes"},{x:r[0],y:16,w:3,h:1,c:"lighten($shoes, 25)",a:.4},{x:r[1],y:16,w:3,h:1,c:"lighten($shoes, 25)",a:.4},{x:1,y:c+8,w:10,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.35},{x:1,y:c+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:10,y:c+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:-1,y:c+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:c+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:-1,y:c+12,w:2,h:1,c:"$skin"},{x:11,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:1,y:c+0,w:10,h:7,c:"$skin"},{x:3,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:c+3,w:1,h:1,c:"#FFF",a:.4},{x:7,y:c+3,w:1,h:1,c:"#FFF",a:.4},{x:5,y:c+6,w:2,h:1,c:"darken($skin, 25)",a:.35},{x:0,y:c+3,w:1,h:1,c:"$skin"},{x:11,y:c+3,w:1,h:1,c:"$skin"},{x:1,y:c+0,w:10,h:3,c:"$hair"},{x:0,y:c+1,w:2,h:3,c:"$hair"},{x:10,y:c+1,w:2,h:3,c:"$hair"},{x:2,y:c+0,w:8,h:1,c:"lighten($hair, 25)",a:.3}]}function xc(t){const l=t===1||t===3?-1:0,r=jg[t],i=t<2?[0,1]:[1,0],c=l;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:r[0],y:13,w:3,h:4,c:"$pants"},{x:r[1],y:13,w:3,h:4,c:"$pants"},{x:r[0],y:16,w:3,h:2,c:"$shoes"},{x:r[1],y:16,w:3,h:2,c:"$shoes"},{x:1,y:c+8,w:10,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:5,y:c+10,w:2,h:3,c:"darken($shirt, 30)",a:.12},{x:-1,y:c+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:c+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:1,y:c+0,w:10,h:7,c:"$skin"},{x:1,y:c+0,w:10,h:6,c:"$hair"},{x:0,y:c+1,w:2,h:5,c:"$hair"},{x:10,y:c+1,w:2,h:5,c:"$hair"},{x:2,y:c+0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:0,y:c+4,w:1,h:1,c:"$skin",a:.6},{x:11,y:c+4,w:1,h:1,c:"$skin",a:.6}]}function Or(t,l){const r=t===1||t===3?-1:0,i=uE[t],c=r,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:c+8,w:8,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:8,y:c+9+u,w:3,h:4-u,c:"$shirt"},{x:9,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:2,y:c+0,w:8,h:7,c:"$skin"},{x:7,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:c+3,w:1,h:1,c:"#FFF",a:.3},{x:9,y:c+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:c+0,w:8,h:3,c:"$hair"},{x:1,y:c+1,w:2,h:4,c:"$hair"},{x:9,y:c+1,w:2,h:3,c:"$hair"},{x:3,y:c+0,w:6,h:1,c:"lighten($hair, 25)",a:.25}]:[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:i[0],y:13,w:3,h:4,c:"$pants"},{x:i[1],y:13,w:3,h:4,c:"$pants"},{x:i[0],y:16,w:3,h:2,c:"$shoes"},{x:i[1],y:16,w:3,h:2,c:"$shoes"},{x:2,y:c+8,w:8,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:0,y:c+9+u,w:3,h:4-u,c:"$shirt"},{x:-1,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:2,y:c+0,w:8,h:7,c:"$skin"},{x:3,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:c+3,w:1,h:1,c:"#FFF",a:.3},{x:1,y:c+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:c+0,w:8,h:3,c:"$hair"},{x:1,y:c+1,w:2,h:3,c:"$hair"},{x:9,y:c+1,w:2,h:4,c:"$hair"},{x:3,y:c+0,w:6,h:1,c:"lighten($hair, 25)",a:.25}]}const T0={down:[mc(0),mc(1),mc(2),mc(3)],up:[xc(0),xc(1),xc(2),xc(3)],right:[Or(0,!0),Or(1,!0),Or(2,!0),Or(3,!0)],left:[Or(0,!1),Or(1,!1),Or(2,!1),Or(3,!1)]},qe=4,At=28,sn=2,ct=4,Pe=4,tr=[{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 Ah(t,l,r){const u=t.fy+Math.max(10,Math.floor(t.fh*.18)),f=Math.min(l,r),m=Math.ceil(l/f),p=[],d=f*28,g=t.fx+Math.max(8,Math.floor((t.fw-d)/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 fE(t){const i=tr[0],c={id:"main",wx:qe+Pe,wy:qe,ww:160-2*(qe+Pe),wh:At,fx:qe+Pe,fy:qe+At+sn,fw:160-2*(qe+Pe),fh:120-qe-At-sn-qe,...i},u=Ah(c,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*(qe+Pe))/2),offsetY:10}],m=[{id:"s-plant-l",type:"plant",room:"main",zone:"floor",offsetX:4,offsetY:4},{id:"s-plant-r",type:"plant",room:"main",zone:"floor",anchorX:"right",offsetX:-8,offsetY:4}];return{preset:"S",canvasW:160,canvasH:120,rooms:{main:c},desks:u,doors:{},adjacency:{main:[]},corridorY:{main:c.fy+c.fh-12},waypoints:{main:[{x:c.fx+10,y:c.fy+c.fh-14},{x:c.fx+c.fw/2,y:c.fy+c.fh-14},{x:c.fx+c.fw-10,y:c.fy+c.fh-14}]},wallDecorations:f,furniture:m}}function dE(t){const c={id:"exec",wx:qe+Pe,wy:qe,ww:144-qe-Pe-ct/2,wh:At,fx:qe+Pe,fy:qe+At+sn,fw:144-qe-Pe-ct/2,fh:66,...tr[0]},u={id:"work",wx:144+ct/2+Pe,wy:qe,ww:144-ct/2-Pe-qe,wh:At,fx:144+ct/2+Pe,fy:qe+At+sn,fw:144-ct/2-Pe-qe,fh:66,...tr[1]},f={id:"meet",wx:qe+Pe,wy:qe+At+sn+66+ct,ww:144-qe-Pe-ct/2,wh:At,fx:qe+Pe,fy:qe+At+sn+66+ct+At+sn,fw:144-qe-Pe-ct/2,fh:70,...tr[2]},m={id:"comm",wx:144+ct/2+Pe,wy:qe+At+sn+66+ct,ww:144-ct/2-Pe-qe,wh:At,fx:144+ct/2+Pe,fy:qe+At+sn+66+ct+At+sn,fw:144-ct/2-Pe-qe,fh:70,...tr[3]},p={exec:c,work:u,meet:f,comm:m},d=[];let g=t;const y=[[c,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,U]of[...y,...b])U>0&&d.push(...Ah(D,U,3));const j=qe+At+sn+66,k=144-ct/2,C={exec_work:{id:"exec_work",type:"v",doorY:qe+At+sn+20+12,xA:k-2,xB:u.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:qe+At+sn+66+ct+At+sn+20+12,xA:k-2,xB:m.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:qe+Pe+40+14,yA:j-2,yB:f.fy+2},work_comm:{id:"work_comm",type:"h",doorX:144+ct/2+Pe+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"}]},A={exec:c.fy+52,work:u.fy+48,meet:f.fy+56,comm:m.fy+42},R={exec:[{x:c.fx+6,y:c.fy+52},{x:c.fx+60,y:c.fy+54},{x:c.fx+112,y:c.fy+50},{x:c.fx+50,y:c.fy+52}],work:[{x:u.fx+14,y:u.fy+48},{x:u.fx+44,y:u.fy+48},{x:u.fx+70,y:u.fy+48},{x:u.fx+100,y:u.fy+48}],meet:[{x:f.fx+60,y:f.fy+56},{x:f.fx+30,y:f.fy+54},{x:f.fx+110,y:f.fy+50},{x:f.fx+80,y:f.fy+56}],comm:[{x:m.fx+96,y:m.fy+8},{x:m.fx+60,y:m.fy+42},{x:m.fx+40,y:m.fy+42},{x:m.fx+20,y:m.fy+42}]},O=[{id:"exec-window-1",type:"window",room:"exec",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"exec-picture-1",type:"picture",room:"exec",zone:"wall",offsetX:34,offsetY:8,pictureColor:"#1565C0",facility:{id:"theme",label:"THEME",icon:"🎨",color:"#42A5F5",hitW:12,hitH:10}},{id:"exec-picture-2",type:"picture",room:"exec",zone:"wall",offsetX:48,offsetY:8,pictureColor:"#E65100"},{id:"exec-clock",type:"clock",room:"exec",zone:"wall",offsetX:64,offsetY:10,facility:{id:"settings",label:"SETTINGS",icon:"⚙",color:"#78909C",hitW:10,hitH:10}},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:14,facility:{id:"stats",label:"STATS",icon:"📊",color:"#7E57C2",hitW:16,hitH:8}},{id:"exec-window-2",type:"window",room:"exec",zone:"wall",offsetX:104,offsetY:6,windowW:16,windowH:14},{id:"work-whiteboard",type:"whiteboard",room:"work",zone:"wall",offsetX:6,offsetY:4},{id:"work-window-1",type:"window",room:"work",zone:"wall",offsetX:50,offsetY:6,windowW:16,windowH:14},{id:"work-window-2",type:"window",room:"work",zone:"wall",offsetX:92,offsetY:6,windowW:16,windowH:14},{id:"meet-bulletin",type:"bulletin-board",room:"meet",zone:"wall",offsetX:6,offsetY:4,facility:{id:"bulletin",label:"BULLETIN",icon:"📋",color:"#F59E0B",hitW:22,hitH:16}},{id:"meet-picture",type:"picture",room:"meet",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#10B981"},{id:"meet-window",type:"window",room:"meet",zone:"wall",offsetX:80,offsetY:6,windowW:16,windowH:14},{id:"meet-shelf",type:"shelf",room:"meet",zone:"wall",offsetX:102,offsetY:18},{id:"comm-screen",type:"screen",room:"comm",zone:"wall",offsetX:6,offsetY:6,facility:{id:"decisions",label:"DECISIONS",icon:"📜",color:"#EF4444",hitW:16,hitH:12}},{id:"comm-picture",type:"picture",room:"comm",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#d4956a"},{id:"comm-window",type:"window",room:"comm",zone:"wall",offsetX:76,offsetY:6,windowW:16,windowH:14},{id:"comm-clock",type:"clock",room:"comm",zone:"wall",offsetX:98,offsetY:10},{id:"comm-shelf",type:"shelf",room:"comm",zone:"wall",offsetX:108,offsetY:18}],L=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(c.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"M",canvasW:288,canvasH:208,rooms:p,desks:d,doors:C,adjacency:E,corridorY:A,waypoints:R,wallDecorations:O,furniture:L}}function hE(t){const f={id:"exec",wx:qe+Pe,wy:qe,ww:180-qe-Pe-ct/2,wh:At,fx:qe+Pe,fy:qe+At+sn,fw:180-qe-Pe-ct/2,fh:82,...tr[0]},m={id:"work",wx:180+ct/2+Pe,wy:qe,ww:180-ct/2-Pe-qe,wh:At,fx:180+ct/2+Pe,fy:qe+At+sn,fw:180-ct/2-Pe-qe,fh:82,...tr[1]},p=qe+At+sn+82,d={id:"meet",wx:qe+Pe,wy:p+ct,ww:180-qe-Pe-ct/2,wh:At,fx:qe+Pe,fy:p+ct+At+sn,fw:180-qe-Pe-ct/2,fh:86,...tr[2]},g={id:"comm",wx:180+ct/2+Pe,wy:p+ct,ww:180-ct/2-Pe-qe,wh:At,fx:180+ct/2+Pe,fy:p+ct+At+sn,fw:180-ct/2-Pe-qe,fh:86,...tr[3]},y={exec:f,work:m,meet:d,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=[[d,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[X,ne]of[...j,...k])ne>0&&b.push(...Ah(X,ne,4));const E=180-ct/2,A={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:d.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:d.fy+2},work_comm:{id:"work_comm",type:"h",doorX:m.fx+54,yA:p-2,yB:g.fy+2}},R={exec:[{room:"work",door:"exec_work",side:"A"},{room:"meet",door:"exec_meet",side:"A"}],work:[{room:"exec",door:"exec_work",side:"B"},{room:"comm",door:"work_comm",side:"A"}],meet:[{room:"exec",door:"exec_meet",side:"B"},{room:"comm",door:"meet_comm",side:"A"}],comm:[{room:"work",door:"work_comm",side:"B"},{room:"meet",door:"meet_comm",side:"B"}]},O={exec:f.fy+82-12,work:m.fy+82-12,meet:d.fy+86-12,comm:g.fy+86-12},L={exec:[{x:f.fx+10,y:O.exec},{x:f.fx+f.fw/2,y:O.exec},{x:f.fx+f.fw-10,y:O.exec}],work:[{x:m.fx+10,y:O.work},{x:m.fx+m.fw/2,y:O.work},{x:m.fx+m.fw-10,y:O.work}],meet:[{x:d.fx+10,y:O.meet},{x:d.fx+d.fw/2,y:O.meet},{x:d.fx+d.fw-10,y:O.meet}],comm:[{x:g.fx+10,y:O.comm},{x:g.fx+g.fw/2,y:O.comm},{x:g.fx+g.fw-10,y:O.comm}]},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",facility:{id:"theme",label:"THEME",icon:"🎨",color:"#42A5F5",hitW:12,hitH:10}},{id:"exec-picture-2",type:"picture",room:"exec",zone:"wall",offsetX:48,offsetY:8,pictureColor:"#E65100"},{id:"exec-clock",type:"clock",room:"exec",zone:"wall",offsetX:64,offsetY:10,facility:{id:"settings",label:"SETTINGS",icon:"⚙",color:"#78909C",hitW:10,hitH:10}},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:14,facility:{id:"stats",label:"STATS",icon:"📊",color:"#7E57C2",hitW:16,hitH:8}},{id:"exec-window-2",type:"window",room:"exec",zone:"wall",offsetX:104,offsetY:6,windowW:16,windowH:14},{id:"work-whiteboard",type:"whiteboard",room:"work",zone:"wall",offsetX:6,offsetY:4},{id:"work-window-1",type:"window",room:"work",zone:"wall",offsetX:50,offsetY:6,windowW:16,windowH:14},{id:"work-window-2",type:"window",room:"work",zone:"wall",offsetX:92,offsetY:6,windowW:16,windowH:14},{id:"meet-bulletin",type:"bulletin-board",room:"meet",zone:"wall",offsetX:6,offsetY:4,facility:{id:"bulletin",label:"BULLETIN",icon:"📋",color:"#F59E0B",hitW:22,hitH:16}},{id:"meet-picture",type:"picture",room:"meet",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#10B981"},{id:"meet-window",type:"window",room:"meet",zone:"wall",offsetX:80,offsetY:6,windowW:16,windowH:14},{id:"meet-shelf",type:"shelf",room:"meet",zone:"wall",offsetX:102,offsetY:18},{id:"comm-screen",type:"screen",room:"comm",zone:"wall",offsetX:6,offsetY:6,facility:{id:"decisions",label:"DECISIONS",icon:"📜",color:"#EF4444",hitW:16,hitH:12}},{id:"comm-picture",type:"picture",room:"comm",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#d4956a"},{id:"comm-window",type:"window",room:"comm",zone:"wall",offsetX:76,offsetY:6,windowW:16,windowH:14},{id:"comm-clock",type:"clock",room:"comm",zone:"wall",offsetX:98,offsetY:10},{id:"comm-shelf",type:"shelf",room:"comm",zone:"wall",offsetX:108,offsetY:18}],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(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:A,adjacency:R,corridorY:O,waypoints:L,wallDecorations:D,furniture:U}}const mE=2;function Cg(t,l){return l?l==="L"&&t<=12-mE?"M":l==="M"&&t>12?"L":l:t<=12?"M":"L"}function Eg(t,l){switch(l??Cg(t)){case"S":return fE(t);case"M":return dE(t);case"L":return hE(t)}}function D0(t,l){if(!l||Object.keys(l).length===0)return t;const r=i=>i.map(c=>{const u=l[c.id];return u?{...c,offsetX:u.offsetX,offsetY:u.offsetY}:c});return{...t,wallDecorations:r(t.wallDecorations),furniture:r(t.furniture)}}function z0(t,l){if(l)for(const[r,i]of Object.entries(l))t[r]&&(t[r]={...t[r],dx:i.dx,dy:i.dy})}function zd(t,l){if(!l||l.length===0)return t;const r=new Set(l);return{...t,wallDecorations:t.wallDecorations.filter(i=>!r.has(i.id)),furniture:t.furniture.filter(i=>!r.has(i.id))}}function M0(t,l){if(!l||l.length===0)return t;const r=[],i=[];for(const c of l)c.zone==="wall"?r.push(c):i.push(c);return{...t,wallDecorations:[...t.wallDecorations,...r],furniture:[...t.furniture,...i]}}let Cs;function xE(t){Cs=t}function $(t,l,r,i,c,u){t=Math.round(t),l=Math.round(l),!(u!==void 0&&u<.01)&&(u!==void 0&&u!==1&&(Cs.globalAlpha=u),Cs.fillStyle=c,Cs.fillRect(t,l,r,i),u!==void 0&&u!==1&&(Cs.globalAlpha=1))}function et(t,l,r,i){$(t,l,1,1,r,i)}let kc=1;function hi(t){kc=t}function Cl(){return kc=kc*16807%2147483647,(kc&65535)/65535}function Ng(t){const l=parseInt(t.slice(1,3),16)/255,r=parseInt(t.slice(3,5),16)/255,i=parseInt(t.slice(5,7),16)/255,c=Math.max(l,r,i),u=Math.min(l,r,i);let f=0,m=0;const p=(c+u)/2;if(c!==u){const d=c-u;m=p>.5?d/(2-c-u):d/(c+u),c===l?f=((r-i)/d+(r<i?6:0))/6:c===r?f=((i-l)/d+2)/6:f=((l-r)/d+4)/6}return[f*360,m*100,p*100]}function Ag(t,l,r){t=(t%360+360)%360,l=Math.max(0,Math.min(100,l))/100,r=Math.max(0,Math.min(100,r))/100;const i=l*Math.min(r,1-r),c=f=>{const m=(f+t/30)%12;return r-i*Math.max(-1,Math.min(m-3,9-m,1))},u=f=>Math.round(f*255).toString(16).padStart(2,"0");return"#"+u(c(0))+u(c(8))+u(c(4))}function El(t,l=1){const[r,i,c]=Ng(t);return Ag(r+15*l,Math.min(100,i+8),c-12*l)}function Yt(t,l=1){const[r,i,c]=Ng(t);return Ag(r-10*l,i-3,c+10*l)}const an={hi:"#D4AA5C",base:"#B08040",sh:"#7A5038",deep:"#4E3028"},jl={hi:"#8A6848",base:"#604832",sh:"#3A2E24",deep:"#2A1E18"},wl={hi:"#5A6A80",base:"#485868",sh:"#364858",deep:"#283848"},Yr="#100A06";function pE(t,l,r=14,i=12){$(t,l,r,i,"#4A3828"),$(t+1,l+1,r-2,i-2,"#5A4838"),$(t+2,l+2,r-4,i-4,"#4A7098"),$(t+2,l+2,r-4,Math.floor((i-4)/2),"#6A90B8",.35);const c=Math.floor(r/2);$(t+c,l+1,1,i-2,"#4A3828"),$(t+1,l+Math.floor(i/2),r-2,1,"#4A3828",.5),et(t+3,l+3,"#8AB8E8",.35),et(t+c+2,l+3,"#8AB8E8",.25),$(t-1,l+i,r+2,2,"#5A4838"),$(t-1,l+i,r+2,1,Yt("#5A4838",.5),.35)}function yE(t,l,r){$(t,l,10,8,"#3A2818"),$(t+1,l+1,8,6,r),$(t+2,l+2,4,3,Yt(r,1.2),.3),et(t+3,l+2,Yt(r,2),.25)}function gE(t,l){$(t,l,7,7,"#3A2818"),$(t+1,l+1,5,5,"#F0EDE5"),et(t+3,l+1,"#AAA"),et(t+3,l+5,"#AAA"),et(t+1,l+3,"#AAA"),et(t+5,l+3,"#AAA"),et(t+3,l+3,"#222"),$(t+3,l+1,1,2,"#333"),et(t+4,l+3,"#D32F2F")}function bE(t,l){$(t,l,26,16,"#586878"),$(t+1,l+1,24,13,"#ECEFF1"),$(t+1,l+1,24,1,"#F5F5F5",.4),$(t+3,l+3,14,1,"#1565C0",.6),$(t+3,l+5,18,1,"#333",.2),$(t+3,l+7,12,1,"#D32F2F",.35),$(t+3,l+9,16,1,"#333",.15),$(t+1,l+14,24,2,"#708898"),$(t+3,l+14,3,1,"#D32F2F"),$(t+7,l+14,3,1,"#1565C0"),$(t+11,l+14,3,1,"#2E7D32")}function vE(t,l){$(t,l,22,16,"#6A5030"),$(t+1,l+1,20,14,"#C4A66A"),hi(88);for(let r=0;r<14;r++)for(let i=0;i<20;i++)Cl()>.5&&et(t+1+i,l+1+r,Cl()>.5?"#B89858":"#D4B87A",.18);$(t+2,l+2,5,4,"#FFF176"),$(t+8,l+2,5,4,"#90CAF9"),$(t+14,l+3,5,4,"#CE93D8"),$(t+3,l+8,7,4,"#C8E6C9"),$(t+11,l+8,8,4,"#F8BBD0"),et(t+4,l+2,"#E53935"),et(t+10,l+2,"#1E88E5"),et(t+16,l+3,"#FF9800")}function wE(t,l){$(t,l,20,3,"#5A4030"),$(t,l,20,1,Yt("#5A4030",.5),.35),$(t,l+2,20,1,El("#5A4030",.5),.3),$(t+2,l-4,3,4,"#E53935"),$(t+2,l-4,3,1,Yt("#E53935",1),.3),$(t+6,l-3,2,3,"#1E88E5"),$(t+9,l-5,4,5,"#43A047"),$(t+14,l-3,3,3,"#FFD54F"),et(t+15,l-3,"#FFF176",.4)}function kE(t,l){$(t,l,16,12,"#1E1E28"),$(t+1,l+1,14,9,"#0C1420"),$(t+2,l+2,12,1,"#EF4444",.6),et(t+2,l+4,"#4CAF50"),$(t+4,l+4,7,1,"#8b949e",.4),et(t+2,l+6,"#FF9800"),$(t+4,l+6,5,1,"#8b949e",.3),et(t+2,l+8,"#42A5F5"),$(t+4,l+8,8,1,"#8b949e",.25),$(t+7,l+10,2,2,"#1E1E28"),$(t+5,l+11,6,1,"#586878")}function SE(t,l,r){$(t+2,l+20,22,2,Yr,.15),$(t,l,22,20,jl.deep),$(t+1,l+1,20,18,jl.base),$(t,l,22,1,jl.hi,.35),$(t,l,1,20,jl.hi,.2);for(const u of[6,12])$(t+1,l+u,20,2,jl.sh),$(t+1,l+u,20,1,jl.hi,.2);const i=["#E53935","#1E88E5","#43A047","#8E24AA","#FB8C00","#00897B","#5C6BC0"];let c=t+2;for(let u=0;u<5;u++){const f=2+u%2;$(c,l+1,f,5,i[u]),$(c,l+1,f,1,Yt(i[u],1),.35),c+=f+1}c=t+2;for(let u=0;u<4;u++)$(c,l+7,4,5,i[u+3]),$(c,l+7,4,1,Yt(i[u+3],1),.25),c+=5;$(t+2,l+14,4,4,"#FFD54F"),$(t+8,l+14,7,4,"#90CAF9"),r&&$(t,l-1,22,1,r,.7)}function jE(t,l){$(t+2,l+11,6,2,Yr,.1),$(t+2,l+8,6,4,"#8B5E3C"),$(t+1,l+7,8,2,El("#A06E48",.3)),$(t+2,l+7,6,1,Yt("#A06E48",.5),.4),$(t+1,l+3,3,4,"#2E7D32"),$(t+5,l+2,3,4,"#2E7D32"),$(t+2,l+1,4,4,"#43A047"),$(t+3,l+0,3,3,"#66BB6A"),et(t+4,l,"#81C784"),et(t+3,l+1,"#A5D6A7",.4)}function CE(t,l){ha(t+4,l-4,"down"),ha(t+16,l-4,"down"),ha(t+28,l-4,"down"),$(t+3,l+24,34,3,Yr,.15),$(t,l+2,36,18,an.deep),$(t+1,l+3,34,16,an.base),$(t+1,l+3,34,1,an.hi,.35);for(let r=0;r<14;r+=3)$(t+1,l+4+r,34,1,El(an.base,.2),.08);$(t,l+20,36,4,an.deep),$(t+1,l+21,34,2,an.sh),$(t+6,l+7,10,6,"#1A1A24"),$(t+7,l+8,8,4,"#0C1420"),$(t+8,l+9,4,1,"#2A6898",.4),$(t+20,l+8,6,4,"#F0F0F0"),$(t+15,l+7,3,3,"#ECEFF1"),et(t+16,l+8,"#795548"),ha(t+4,l+24,"up"),ha(t+16,l+24,"up"),ha(t+28,l+24,"up")}function EE(t,l){$(t+2,l+16,36,3,Yr,.15),$(t,l,36,5,"#5D4037"),$(t+1,l+1,34,3,"#6D4C41"),$(t+1,l+1,34,1,Yt("#6D4C41",.5),.3),$(t,l+5,36,8,"#5D4037"),$(t+2,l+6,15,6,"#6D4C41"),$(t+3,l+6,13,1,Yt("#6D4C41",.5),.35),$(t+19,l+6,15,6,"#6D4C41"),$(t+20,l+6,13,1,Yt("#6D4C41",.5),.35),$(t+17,l+6,2,6,"#5D4037"),$(t,l+13,36,3,El("#5D4037",1)),$(t-2,l+2,3,12,"#5D4037"),$(t+35,l+2,3,12,"#5D4037"),$(t+4,l+7,6,4,"#FF8A65"),$(t+5,l+7,4,1,Yt("#FF8A65",1),.35)}function NE(t,l){$(t+2,l+10,22,2,Yr,.12),$(t,l,22,8,jl.deep),$(t+1,l+1,20,6,jl.base),$(t+1,l+1,20,1,jl.hi,.3),$(t,l+8,22,2,jl.sh),$(t+3,l+2,6,4,"#F0F0F0"),$(t+13,l+3,3,3,"#ECEFF1"),et(t+14,l+4,"#795548")}function AE(t,l){$(t+1,l+14,10,2,Yr,.12),$(t,l,10,14,"#546E7A"),$(t,l,10,1,Yt("#546E7A",1),.35),$(t+1,l+1,8,3,"#78909C"),$(t+1,l+5,8,4,"#37474F"),et(t+2,l+6,"#EF5350"),et(t+4,l+6,"#66BB6A"),$(t+2,l+11,4,2,"#ECEFF1")}function TE(t,l){$(t+2,l+16,26,3,Yr,.18),$(t,l,26,10,an.deep),$(t+1,l+1,24,8,an.base),$(t+1,l+2,24,1,an.hi,.2),$(t+1,l+4,24,1,El(an.base,.2),.1),$(t+1,l+6,24,1,an.hi,.15),$(t+1,l+1,24,1,an.hi,.4),$(t+1,l+1,1,8,an.hi,.2),$(t,l+10,26,5,an.deep),$(t+1,l+11,24,3,an.sh),$(t+1,l+10,24,1,El(an.base,1.5),.4),$(t+1,l+14,24,1,an.base,.15),$(t+2,l+12,10,1,an.deep,.4),$(t+14,l+12,10,1,an.deep,.4),et(t+7,l+11,"#C8D0D8",.6),et(t+19,l+11,"#C8D0D8",.6),$(t+6,l-5,14,7,"#1E1E28"),$(t+7,l-4,12,5,"#0C1420"),$(t+8,l-3,5,1,"#2A6898",.6),$(t+8,l-2,8,1,"#1A3858",.4),$(t+8,l-1,3,1,"#2A6898",.35),et(t+7,l-4,"#4A98D8",.25),et(t+12,l+1,"#4CAF50",.4),$(t+12,l+2,2,3,"#586878"),$(t+10,l+4,6,1,"#8898A8"),$(t+6,l+4,12,4,"#222228"),$(t+6,l+4,12,1,"#333338",.4);for(let r=0;r<5;r++)et(t+7+r*2,l+5,"#444",.6),et(t+7+r*2,l+6,"#3A3A3E",.4);$(t+20,l+5,3,4,"#333338"),$(t+20,l+5,3,1,"#444448"),$(t+1,l+3,4,4,"#F0EDE8"),$(t+1,l+3,4,1,"#F8F6F2"),et(t+2,l+5,"#6D4C41")}function ha(t,l,r){$(t+1,l+9,10,2,Yr,.1),et(t+5,l+9,"#1E1E22"),et(t+1,l+10,"#1A1A1E"),et(t+9,l+10,"#1A1A1E"),et(t+3,l+11,"#1A1A1E"),et(t+7,l+11,"#1A1A1E"),$(t+1,l+2,8,6,wl.base),$(t+2,l+3,6,4,wl.hi,.35),$(t+2,l+3,6,1,Yt(wl.hi,.5),.25),$(t+1,l+7,8,1,wl.deep),r==="up"?($(t,l+7,10,3,wl.deep),$(t+1,l+8,8,1,wl.sh)):($(t,l-1,10,3,wl.deep),$(t+1,l,8,1,wl.sh)),$(t,l+3,1,4,wl.sh),$(t+9,l+3,1,4,wl.sh)}const Tg={bookshelf:(t,l,r)=>SE(t,l,r.accent),plant:(t,l)=>jE(t,l),"meeting-table":(t,l)=>CE(t,l),sofa:(t,l)=>EE(t,l),"coffee-table":(t,l)=>NE(t,l),"coffee-machine":(t,l)=>AE(t,l),window:(t,l,r)=>pE(t,l,r.windowW??16,r.windowH??14),picture:(t,l,r)=>yE(t,l,r.pictureColor??"#1565C0"),clock:(t,l)=>gE(t,l),whiteboard:(t,l)=>bE(t,l),"bulletin-board":(t,l)=>vE(t,l),shelf:(t,l)=>wE(t,l),screen:(t,l)=>kE(t,l)};function ui(t,l){const r=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:r+t.offsetX,y:i+t.offsetY}}function DE(t){for(const l of t.wallDecorations){const r=t.rooms[l.room];if(!r)continue;const{x:i,y:c}=ui(l,r),u=Tg[l.type];u&&u(i,c,l)}}function zE(t,l,r){for(const i of t.furniture){const c=t.rooms[i.room];if(!c||i.condition==="no-desks"&&r.has(i.room))continue;const{x:u,y:f}=ui(i,c),m=Tg[i.type];m&&l.push({y:f,draw:()=>m(u,f,i)})}}function Br(t){const l=[],r=[...t.wallDecorations,...t.furniture];for(const i of r){if(!i.facility)continue;const c=t.rooms[i.room];if(!c)continue;const{x:u,y:f}=ui(i,c);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 ME={bookshelf:{w:22,h:20},plant:{w:10,h:12},"meeting-table":{w:36,h:28},sofa:{w:38,h:16},"coffee-table":{w:22,h:10},"coffee-machine":{w:10,h:14},window:{w:16,h:14},picture:{w:10,h:8},clock:{w:7,h:7},whiteboard:{w:26,h:16},"bulletin-board":{w:22,h:16},shelf:{w:20,h:8},screen:{w:16,h:12}};function eh(t){return ME[t]??{w:16,h:16}}function Md(t,l,r,i){for(let c=t.furniture.length-1;c>=0;c--){const u=t.furniture[c],f=t.rooms[u.room];if(!f||u.condition==="no-desks"&&i.has(u.room))continue;const{x:m,y:p}=ui(u,f),d=eh(u.type);if(l>=m&&l<=m+d.w&&r>=p&&r<=p+d.h)return u.id}for(let c=t.wallDecorations.length-1;c>=0;c--){const u=t.wallDecorations[c],f=t.rooms[u.room];if(!f)continue;const{x:m,y:p}=ui(u,f),d=eh(u.type);if(l>=m&&l<=m+d.w&&r>=p&&r<=p+d.h)return u.id}return null}function R0(t,l,r,i,c){const f=[...l.wallDecorations,...l.furniture].find(y=>y.id===r);if(!f||f.condition==="no-desks"&&c.has(f.room))return;const m=l.rooms[f.room];if(!m)return;const{x:p,y:d}=ui(f,m),g=eh(f.type);t.save(),t.fillStyle=i,t.globalAlpha=.2,t.fillRect(p-1,d-1,g.w+2,g.h+2),t.globalAlpha=.9,t.strokeStyle=i,t.lineWidth=1,t.strokeRect(p-.5,d-.5,g.w+1,g.h+1),t.restore()}function F0(t,l,r,i){t.save(),t.fillStyle=i,t.globalAlpha=.2,t.fillRect(l-1,r-1,28,42),t.globalAlpha=.9,t.strokeStyle=i,t.lineWidth=1,t.strokeRect(l-.5,r-.5,27,41),t.restore()}function _0(t,l,r){for(const[i,c]of Object.entries(t))if(l>=c.dx&&l<=c.dx+26&&r>=c.dy&&r<=c.dy+40)return i;return null}const RE=[{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:"🖥️"}],pc=16,FE=4,da=4,Sc=2,pt=4,Lr=4;let _e=Eg(7);const Fc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};let fl=Br(_e);function Dg(t){return{x:t.dx,y:t.dy,w:t.pw,h:t.ph}}function zg(t){return{cx:t.dx+t.pw/2,botY:t.dy+t.ph}}let Gt={};function _E(t){const l={};for(let r=0;r<t.length&&r<_e.desks.length;r++)l[t[r]]=_e.desks[r];return l}let Bt,pa=null,ma=null,er=!1,dl=null,Vn=null,pn=null,rn=null,ai=null,kl=null;function OE(t,l){const{wx:r,wy:i,ww:c,wh:u,wallColor:f,baseboardColor:m}=t,p=El(f,.5),d=Yt(f,.5),g=[];if(l){const y=l.x-r,b=l.w;y>0&&g.push({sx:r,sw:y}),y+b<c&&g.push({sx:l.x+b,sw:c-y-b})}else g.push({sx:r,sw:c});for(const y of g){$(y.sx,i,y.sw,u,f);for(let b=0;b<u;b+=4)$(y.sx,i+b,y.sw,1,d,.08),$(y.sx,i+b+2,y.sw,1,p,.05);hi(Math.round(y.sx*7+i*13));for(let b=0;b<y.sw;b+=3)Cl()>.4&&$(y.sx+b,i,1,u,d,.04);$(y.sx,i,y.sw,2,d,.3),$(y.sx,i,y.sw,1,Yt(f,1),.2),$(y.sx,i+u-2,y.sw,2,p,.3),$(y.sx,i+u,y.sw,Sc,m),$(y.sx,i+u,y.sw,1,Yt(m,.5),.4)}l&&($(l.x-1,i,1,u+Sc,"#4A3828"),$(l.x+l.w,i,1,u+Sc,"#4A3828"),$(l.x,i,l.w,1,"#0A0808",.12)),$(t.fx,t.fy,t.fw,3,"#0A0808",.12),$(t.fx,t.fy+3,t.fw,2,"#0A0808",.06)}function BE(t){const l="#504038",r=El(l,.5),i=Yt(l,.5),c=t.wx-Lr,u=t.wy,f=t.wh+Sc+t.fh;$(c,u,Lr,f,l),$(c,u,1,f,i,.3),$(c+Lr-1,u,1,f,r,.4);for(let p=0;p<f;p+=6)$(c+1,u+p,Lr-2,1,i,.06);const m=t.wx+t.ww;$(m,u,Lr,f,l),$(m,u,1,f,i,.2),$(m+Lr-1,u,1,f,r,.3)}function Rd(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#B08040",f="#C89848",m="#8A6030",p="#6A4820";$(l,r,i,c,u),hi(42);for(let d=0;d<c;d+=5){const g=Math.floor(d/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=Cl()>.5?f:u;$(v,r+d,j,4,k,.25),$(v,r+d,j,1,f,.3),$(v,r+d+4,j,1,p,.35),b>=l&&b<l+i&&$(b,r+d,1,4,p,.2),$(v,r+d+2,j,1,m,.1)}}$(l,r,i,2,"#0A0808",.08),$(l,r,2,c,"#0A0808",.06)}function O0(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#1C2A38",f="#101820";hi(99),$(l,r,i,c,u);for(let m=0;m<c;m+=pc)for(let p=0;p<i;p+=pc){const d=Math.min(pc,i-p),g=Math.min(pc,c-m);Cl()>.5&&$(l+p,r+m,d,g,Yt(u,.2),.15),$(l+p+2,r+m+2,d-4,g-4,Yt(u,.3),.08),$(l+p,r+m,d,1,f,.5),$(l+p,r+m,1,g,f,.5),$(l+p+1,r+m+1,1,g-1,Yt(u,.4),.1),Cl()>.85&&et(l+p+4+Math.floor(Cl()*8),r+m+4+Math.floor(Cl()*8),"#3A6A9A",.08)}}function LE(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#387848",f="#4A9058",m="#285E38";$(l,r,i,c,u),hi(77);for(let d=0;d<c;d+=2)for(let g=0;g<i;g+=2)Cl()>.5&&et(l+g,r+d,f,.1),Cl()>.8&&et(l+g+1,r+d+1,m,.12);const p=5;$(l+p,r+p,i-p*2,1,f,.45),$(l+p,r+c-p-1,i-p*2,1,m,.45),$(l+p,r+p,1,c-p*2,f,.35),$(l+i-p-1,r+p,1,c-p*2,m,.35)}function $E(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#D8C490",f="#B09060",m="#907848";hi(55);for(let p=0;p<c;p+=8)for(let d=0;d<i;d+=8){const g=Math.min(8,i-d),y=Math.min(8,c-p),b=(d/8+p/8)%2===0?f:u;$(l+d,r+p,g,y,b),$(l+d+1,r+p+1,g-2,1,Yt(b,.4),.2),$(l+d+1,r+p+1,1,y-2,Yt(b,.4),.15),$(l+d+g-2,r+p+2,1,y-3,El(b,.4),.15),$(l+d+2,r+p+y-2,g-3,1,El(b,.4),.15),$(l+d,r+p,g,1,m,.3),$(l+d,r+p,1,y,m,.3)}}function HE(){const{canvasW:t,canvasH:l,rooms:r,doors:i}=_e,c="#2A1E14",u="#3A2E24";if($(0,0,t,da,c),$(0,l-da,t,da,c),$(0,0,da,l,c),$(t-da,0,da,l,c),$(0,0,t,1,u,.3),$(0,0,1,l,u,.2),!r.exec||!r.work||!r.meet||!r.comm)return;const f=r.exec,m=r.meet,p=t/2,d=p-pt/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,A=((v==null?void 0:v.doorX)??da+Lr+54)-C/2,R=((j==null?void 0:j.doorX)??p+pt/2+Lr+54)-C/2,O=((b==null?void 0:b.doorY)??m.fy+20)-k/2;$(0,g,A,pt,c),$(A+C,g,d-A-C,pt,c),$(d+pt,g,R-d-pt,pt,c),$(R+C,g,t-R-C,pt,c),$(0,g,A,1,u,.3),$(A+C,g,d-A-C,1,u,.3),$(d+pt,g,R-d-pt,1,u,.3),$(R+C,g,t-R-C,1,u,.3),$(d,0,pt,E,c),$(d,E+k,pt,g-E-k,c),$(d,g+pt,pt,O-g-pt,c),$(d,O+k,pt,l-O-k,c),$(d,0,1,E,u,.2),$(d,E+k,1,g-E-k,u,.2),$(d,g+pt,1,O-g-pt,u,.2),$(d,O+k,1,l-O-k,u,.2),$(d,E,pt,k,"#C4A070"),$(d+pt/2,E,pt/2,k,"#3A4858"),$(d,O,pt,k,"#7AA880"),$(d+pt/2,O,pt/2,k,"#C8B890");const L="#4A3828";$(d,E-1,pt,1,L),$(d,E+k,pt,1,L),$(A-1,g,1,pt,L),$(A+C,g,1,pt,L),$(R-1,g,1,pt,L),$(R+C,g,1,pt,L),$(d,O-1,pt,1,L),$(d,O+k,pt,1,L)}const B0=new Map;function UE(t){const l=`${t.hairStyle??""}|${t.outfitStyle??""}|${t.accessory??""}`;let r=B0.get(l);if(!r){const i=Qd("mini-seated:default"),c=ig(i,t);r=c?c.layers.flatMap(u=>u.pixels):[],B0.set(l,r)}return r}function IE(t,l,r){Wd(Bt,UE(r),t,l,r)}function YE(t,l,r,i,c){ha(t+8,l+20,"up"),c||IE(t+8,l+0+i,r),TE(t,l+14)}function qE(t,l,r,i,c){const u=i in T0?i:"down",f=c%4,m=T0[u][f];Wd(Bt,m,t,l,r);const p=f===1||f===3?-1:0;if(r.accessory&&r.accessory!=="none"){const d=FS(r.accessory,u);d&&d.pixels.length>0&&Wd(Bt,d.pixels,t,l+p,r)}Bt.globalAlpha=1}function XE(t){const l={};let r=0;for(const i of t){const c=Gt[i];c&&(l[i]={state:"sitting",homeX:c.dx+8,homeY:c.dy+34,homeRoom:c.room,x:c.dx+8,y:c.dy+34,path:[],room:c.room,dir:"down",walkFrame:0,walkTimer:0,bobY:0,bobOff:r*17,stateTimer:600+Math.floor(Math.random()*900)},r++)}return l}function Ds(t,l,r,i,c){const u=_e.corridorY[c]??l,f=[];return l<u-4&&f.push({x:t,y:u}),Math.abs(t-r)>4&&f.push({x:r,y:u}),f.push({x:r,y:i}),f}function Fd(t,l,r,i){const c=_e.adjacency[r];if(!c)return[];const u=c.find(g=>g.room===i);if(!u)return[];const f=_e.doors[u.door];if(!f)return[];const m=[],p=_e.corridorY[r]??l,d=_e.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:d})}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:d})}return m}function Mg(t,l){const r=_e.adjacency[t.room];if(!r)return[];if(!r.find(c=>c.room===l)){for(const c of r){const u=_e.adjacency[c.room];if(u!=null&&u.find(f=>f.room===l)){const f=Fd(t.x,t.y,t.room,c.room),m=f[f.length-1],p=Fd((m==null?void 0:m.x)??t.x,(m==null?void 0:m.y)??t.y,c.room,l);return[...f,...p]}}return[]}return Fd(t.x,t.y,t.room,l)}function VE(t){if(t.room!==t.homeRoom){const l=Mg({...t},t.homeRoom),r=l[l.length-1],i=Ds((r==null?void 0:r.x)??t.x,(r==null?void 0:r.y)??t.y,t.homeX,t.homeY,t.homeRoom);return[...l,...i]}return Ds(t.x,t.y,t.homeX,t.homeY,t.room)}function GE(t,l){for(const[,r]of Object.entries(t))if(r.stateTimer--,r.state==="sitting"){if(r.bobY=(l+r.bobOff)%60<30?1:0,r.stateTimer<=0){r.state="walking",r.x=r.homeX,r.y=r.homeY,r.room=r.homeRoom;const i=Object.keys(_e.rooms);if(Math.random()<.25&&i.length>1){const c=i.filter(p=>p!==r.room),u=c[Math.floor(Math.random()*c.length)],f=Mg(r,u),m=_e.waypoints[u];if(m&&m.length>0){const p=m[Math.floor(Math.random()*m.length)],d=f[f.length-1]??{x:r.x,y:r.y},g=Ds(d.x,d.y,p.x,p.y,u);r.path=[...f,...g]}else r.path=f;r.walkTimer=0}else{const c=_e.waypoints[r.room];if(c&&c.length>0){const u=c[Math.floor(Math.random()*c.length)];r.path=Ds(r.x,r.y,u.x,u.y,r.room)}r.walkTimer=0}}}else if(r.state==="walking"||r.state==="returning"){if(r.path.length===0){r.state==="returning"?(r.state="sitting",r.room=r.homeRoom,r.stateTimer=800+Math.floor(Math.random()*1200)):(r.state="idle",r.dir="down",r.stateTimer=180+Math.floor(Math.random()*360));continue}const i=r.path[0],c=i.x-r.x,u=i.y-r.y,f=Math.sqrt(c*c+u*u);if(f<1.5){r.x=i.x,r.y=i.y,r.path.shift();for(const[m,p]of Object.entries(_e.rooms))if(r.x>=p.fx&&r.x<=p.fx+p.fw&&r.y>=p.fy&&r.y<=p.fy+p.fh){r.room=m;break}}else r.x+=c/f*.2,r.y+=u/f*.2,Math.abs(c)>Math.abs(u)?r.dir=c>0?"right":"left":r.dir=u>0?"down":"up",r.walkTimer++,r.walkFrame=Math.floor(r.walkTimer/12)%4}else if(r.state==="idle"&&r.stateTimer<=0)if(Math.random()<.3){r.state="walking";const i=_e.waypoints[r.room];if(i&&i.length>0){const c=i[Math.floor(Math.random()*i.length)];r.path=Ds(r.x,r.y,c.x,c.y,r.room)}r.walkTimer=0}else r.state="returning",r.path=VE(r),r.walkTimer=0}function KE(t,l,r){const{canvasW:i,canvasH:c,rooms:u}=_e;Bt.clearRect(0,0,i,c),$(0,0,i,c,"#2A1E14");const f={wood:Rd,dark:O0,carpet:LE,tile:$E};for(const y of Object.values(u))(f[y.floorType]??Rd)(y);const m=Object.keys(u);if(m.length>=4){const y=u.exec,b=u.meet,{doors:v}=_e;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,A=b.fy;Rd({fx:k,fy:E,fw:28,fh:A-E}),O0({fx:C,fy:E,fw:28,fh:A-E})}}const p={};if(m.length>=4){const{doors:y}=_e,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))OE(y,p[y.id]),BE(y);HE(),DE(_e);const d=[],g=new Set(Object.values(Gt).map(y=>y.room));zE(_e,d,g);for(const[y,b]of Object.entries(Gt)){const v=t[y];if(!v)continue;const j=v.state==="sitting",k=l(y),C=r[y]==="working";d.push({y:b.dy+14,draw:()=>{if(YE(b.dx,b.dy,k,j?v.bobY:0,!j),j&&C){const E=Fc[y]??"#388bfd";$(b.dx+7,b.dy+14-4,12,5,E,.15),et(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);d.push({y:b.y+14,draw:()=>qE(Math.round(b.x),Math.round(b.y),v,b.dir,b.walkFrame)})}d.sort((y,b)=>y.y-b.y);for(const y of d)y.draw();for(const y of fl){const b=ma===y.id,v=zg(y);if(Bt.save(),Bt.globalAlpha=b?.9:.5,Bt.fillStyle=y.color,Bt.fillRect(v.cx-1,v.botY-2,3,3),b){const j=Dg(y);Bt.globalAlpha=.3,Bt.strokeStyle=y.color,Bt.lineWidth=1,Bt.strokeRect(j.x-1,j.y-1,j.w+2,j.h+2)}Bt.restore()}if(er){const y=new Set(Object.values(Gt).map(b=>b.room));if(dl&&dl!==Vn)if(dl.startsWith("desk:")){const b=dl.slice(5),v=Gt[b];v&&F0(Bt,v.dx,v.dy,"#FBBF24")}else R0(Bt,_e,dl,"#FBBF24",y);if(Vn)if(Vn.startsWith("desk:")){const b=Vn.slice(5),v=Gt[b];v&&F0(Bt,v.dx,v.dy,"#3B82F6")}else R0(Bt,_e,Vn,"#3B82F6",y)}if(pa){const y=Gt[pa],b=t[pa];y&&b&&(Bt.save(),Bt.globalAlpha=.25,Bt.fillStyle=Fc[pa]??"#fff",b.state==="sitting"?Bt.fillRect(y.dx-1,y.dy+6,28,30):Bt.fillRect(Math.round(b.x)-1,Math.round(b.y)-1,14,24),Bt.restore())}}function QE({roles:t,projects:l,roleStatuses:r,activeExecs:i,onRoleClick:c,onProjectClick:u,onBulletinClick:f,onDecisionsClick:m,onKnowledgeClick:p,onSettingsClick:d,onThemeClick:g,onStatsClick:y,getRoleSpeech:b,getAppearance:v,onHireClick:j}){const k=S.useRef(null),C=S.useRef(null),E=S.useRef(null),A=S.useRef({}),R=S.useRef(0),O=S.useRef(FE),[L,D]=S.useState(!1),[U,X]=S.useState(null),[ne,M]=S.useState(null),q=S.useRef({}),F=S.useRef({}),W=S.useRef([]),ee=S.useRef([]);S.useEffect(()=>{er=L},[L]),S.useEffect(()=>{ai=U,kl=ne},[U,ne]),S.useEffect(()=>{Ce.getPreferences().then(de=>{const G=de.furnitureOverrides;G&&Object.keys(G).length>0&&(q.current=G,_e=D0(_e,G));const re=de.deskOverrides;if(re&&Object.keys(re).length>0){F.current=re,z0(Gt,re);for(const[Ne,Te]of Object.entries(Gt)){const Me=A.current[Ne];Me&&(Me.homeX=Te.dx+8,Me.homeY=Te.dy+34)}}const ve=de.removedFurniture;ve&&ve.length>0&&(W.current=ve,_e=zd(_e,ve));const ze=de.addedFurniture;ze&&ze.length>0&&(ee.current=ze,_e=M0(_e,ze)),fl=Br(_e)}).catch(()=>{})},[]);const V=S.useRef({roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v});V.current={roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v};const I=S.useMemo(()=>t.map(de=>de.id),[t]),Z=S.useRef(_e);S.useEffect(()=>{const de=I.length,G=Cg(de,Z.current.preset);let re=Eg(de,G);W.current.length>0&&(re=zd(re,W.current)),ee.current.length>0&&(re=M0(re,ee.current)),Object.keys(q.current).length>0&&(re=D0(re,q.current)),_e=re,Z.current=re,Gt=_E(I),Object.keys(F.current).length>0&&z0(Gt,F.current),fl=Br(re),A.current=XE(I);const ve=k.current;ve&&(ve.width=re.canvasW,ve.height=re.canvasH),we()},[I]);const ce=S.useCallback(de=>{var G,re;return((re=(G=V.current).getAppearance)==null?void 0:re.call(G,de))??Eh(de)},[]),we=S.useCallback(()=>{const de=C.current,G=k.current;if(!de||!G)return;const re=de.parentElement;if(!re)return;const ve=re.clientWidth,ze=re.clientHeight;if(ve===0||ze===0)return;const{canvasW:Ne,canvasH:Te}=_e;let Me=Math.floor(Math.min(ve/Ne,ze/Te));Me=Math.max(2,Math.min(Me,5)),O.current=Me,G.style.width=Ne*Me+"px",G.style.height=Te*Me+"px",de.style.width=Ne*Me+"px",de.style.height=Te*Me+"px"},[]);S.useEffect(()=>{var Te;const de=k.current;if(!de)return;const G=de.getContext("2d");if(!G)return;Bt=G,xE(G),we();const re=new ResizeObserver(()=>we()),ve=(Te=C.current)==null?void 0:Te.parentElement;ve&&re.observe(ve);let ze;const Ne=()=>{R.current++,GE(A.current,R.current),KE(A.current,ce,V.current.roleStatuses),z(),ze=requestAnimationFrame(Ne)};return ze=requestAnimationFrame(Ne),()=>{cancelAnimationFrame(ze),re.disconnect()}},[ce,we]),S.useEffect(()=>{const de=E.current;if(!de)return;de.innerHTML="";for(const re of I){const ve=Fc[re]??"#8b949e",ze=document.createElement("div");ze.className="td-nametag",ze.dataset.role=re;const Ne=document.createElement("span");Ne.className="td-dot",Ne.style.background=ve,ze.appendChild(Ne),ze.appendChild(document.createTextNode(re.toUpperCase())),de.appendChild(ze);const Te=document.createElement("div");Te.className="td-bubble",Te.dataset.role=re,Te.dataset.type="bubble",de.appendChild(Te)}const G={meeting:()=>{const re=l[0];re?u(re.id):f()},bulletin:f,decisions:m,knowledge:p,settings:d,theme:g,stats:y};for(const re of fl){const ve=document.createElement("div");ve.className="td-facility-label",ve.dataset.facility=re.id,ve.textContent=`${re.icon} ${re.label}`,ve.style.borderColor=`${re.color}44`;const ze=G[re.id];ze&&ve.addEventListener("click",ze),ve.addEventListener("mouseenter",()=>{ma=re.id}),ve.addEventListener("mouseleave",()=>{ma=null}),de.appendChild(ve)}},[I,l,u,f,m,p,d,g,y]);const z=S.useCallback(()=>{var Te;const de=E.current;if(!de)return;const G=O.current,re=A.current,{getRoleSpeech:ve,roleStatuses:ze,activeExecs:Ne}=V.current;for(const Me of Object.keys(re)){const Oe=re[Me],tt=Gt[Me];if(!tt)continue;let Lt,gt,ht;Oe.state==="sitting"?(Lt=tt.dx+13,ht=tt.dy+2,gt=tt.dy+37):(Lt=Math.round(Oe.x)+6,ht=Math.round(Oe.y)-2,gt=Math.round(Oe.y)+18);const Zt=Lt/_e.canvasW*100,ae=de.querySelector(`.td-nametag[data-role="${Me}"]`);if(ae){ae.style.left=Zt+"%",ae.style.top=gt*G+2+"px";const De=ae.querySelector(".td-dot");if(De){const Ue=ze[Me]==="working";De.style.background=Ue?"#FBBF24":Fc[Me]??"#8b949e",Ue?De.style.animation="td-pulse 1s ease-in-out infinite":De.style.animation=""}}const xe=de.querySelector(`.td-bubble[data-role="${Me}"]`);if(xe){const De=ze[Me]==="working",Ue=(Te=Ne.find(jt=>jt.roleId===Me))==null?void 0:Te.task,ye=ve(Me),je=De&&Ue?Ue.slice(0,60):ye?ye.slice(0,60):"";je&&Oe.state==="sitting"?(xe.style.display="",xe.style.left=Zt+"%",xe.style.top=(ht-10)*G+"px",xe.textContent=je):xe.style.display="none"}}for(const Me of fl){const Oe=de.querySelector(`.td-facility-label[data-facility="${Me.id}"]`);if(Oe){const tt=zg(Me);Oe.style.left=tt.cx/_e.canvasW*100+"%",Oe.style.top=tt.botY*G-4+"px",Oe.classList.toggle("td-facility-label--hover",ma===Me.id)}}},[]),B=S.useCallback(de=>{const G=k.current;if(!G)return null;const re=G.getBoundingClientRect(),ve=O.current,ze=(de.clientX-re.left)/ve,Ne=(de.clientY-re.top)/ve,Te=A.current;for(const[Me,Oe]of Object.entries(Gt)){if(!Te[Me])continue;const tt=Te[Me];if(tt.state==="sitting"){if(ze>=Oe.dx&&ze<=Oe.dx+26&&Ne>=Oe.dy&&Ne<=Oe.dy+40)return{type:"role",id:Me}}else if(ze>=tt.x-2&&ze<=tt.x+14&&Ne>=tt.y-2&&Ne<=tt.y+20)return{type:"role",id:Me}}for(const Me of fl){const Oe=Dg(Me);if(ze>=Oe.x&&ze<=Oe.x+Oe.w&&Ne>=Oe.y&&Ne<=Oe.y+Oe.h)return{type:"facility",id:Me.id}}return null},[]),Q=S.useCallback(de=>{const G=k.current;if(!G)return{mx:0,my:0};const re=G.getBoundingClientRect(),ve=O.current;return{mx:(de.clientX-re.left)/ve,my:(de.clientY-re.top)/ve}},[]),T=S.useCallback(de=>{Ce.updatePreferences(de).catch(()=>{})},[]),me=S.useCallback(de=>{const G=[...W.current,de];W.current=G,_e=zd(_e,[de]),fl=Br(_e),Vn=null,dl=null,T({removedFurniture:G})},[T]),Se=S.useCallback((de,G)=>{if(!ai||!kl)return;let re=null;for(const[Oe,tt]of Object.entries(_e.rooms)){const Lt=kl==="wall"?tt.wx:tt.fx,gt=kl==="wall"?tt.wy:tt.fy,ht=kl==="wall"?tt.ww:tt.fw,Zt=kl==="wall"?tt.wh:tt.fh;if(de>=Lt&&de<=Lt+ht&&G>=gt&&G<=gt+Zt){re=Oe;break}}if(!re)return;const ve=_e.rooms[re],ze=kl==="wall"?ve.wx:ve.fx,Ne=kl==="wall"?ve.wy:ve.fy,Te={id:`user-${ai}-${Date.now()}`,type:ai,room:re,zone:kl,offsetX:Math.round(de-ze),offsetY:Math.round(G-Ne)},Me=[...ee.current,Te];ee.current=Me,kl==="wall"?_e.wallDecorations.push(Te):_e.furniture.push(Te),fl=Br(_e),T({addedFurniture:Me}),X(null),M(null)},[T]),Ee=S.useCallback(de=>{const G=k.current;if(er&&pn){const{mx:ve,my:ze}=Q(de),Te=[..._e.furniture,..._e.wallDecorations].find(tt=>tt.id===pn.defId);if(!Te)return;const Me=ve-pn.startMx,Oe=ze-pn.startMy;Te.offsetX=Math.round(pn.origOffX+Me),Te.offsetY=Math.round(pn.origOffY+Oe),fl=Br(_e),G&&(G.style.cursor="grabbing");return}if(er&&rn){const{mx:ve,my:ze}=Q(de),Ne=Gt[rn.roleId];if(!Ne)return;Ne.dx=Math.round(rn.origDx+(ve-rn.startMx)),Ne.dy=Math.round(rn.origDy+(ze-rn.startMy));const Te=A.current[rn.roleId];Te&&(Te.homeX=Ne.dx+8,Te.homeY=Ne.dy+34),G&&(G.style.cursor="grabbing");return}if(er){const{mx:ve,my:ze}=Q(de);if(ai){G&&(G.style.cursor="crosshair");return}const Ne=new Set(Object.values(Gt).map(Me=>Me.room)),Te=Md(_e,ve,ze,Ne);if(Te)dl=Te;else{const Me=_0(Gt,ve,ze);dl=Me?`desk:${Me}`:null}pa=null,ma=null,G&&(G.style.cursor=dl?"grab":"default");return}const re=B(de);pa=(re==null?void 0:re.type)==="role"?re.id:null,ma=(re==null?void 0:re.type)==="facility"?re.id:null,dl=null,G&&(G.style.cursor=re?"pointer":"default")},[B,Q]),Be=S.useCallback(de=>{if(!er)return;const{mx:G,my:re}=Q(de);if(ai){Se(G,re),de.preventDefault();return}const ve=new Set(Object.values(Gt).map(Te=>Te.room)),ze=Md(_e,G,re,ve);if(ze){const Me=[..._e.furniture,..._e.wallDecorations].find(Oe=>Oe.id===ze);Me&&(Vn=ze,pn={defId:ze,startMx:G,startMy:re,origOffX:Me.offsetX,origOffY:Me.offsetY},de.preventDefault());return}const Ne=_0(Gt,G,re);if(Ne){const Te=Gt[Ne];Vn=`desk:${Ne}`,rn={roleId:Ne,startMx:G,startMy:re,origDx:Te.dx,origDy:Te.dy},de.preventDefault();return}Vn=null},[Q,Se]),He=S.useCallback(de=>{if(pn){const re=[..._e.furniture,..._e.wallDecorations].find(ve=>ve.id===pn.defId);if(re){const ve={...q.current,[re.id]:{offsetX:re.offsetX,offsetY:re.offsetY}};q.current=ve,T({furnitureOverrides:ve}),fl=Br(_e)}pn=null,k.current&&(k.current.style.cursor="grab");return}if(rn){const G=Gt[rn.roleId];if(G){const re={...F.current,[rn.roleId]:{dx:G.dx,dy:G.dy}};F.current=re,T({deskOverrides:re})}rn=null,k.current&&(k.current.style.cursor="grab")}},[T]),Ke=S.useCallback(de=>{if(!er)return;de.preventDefault();const{mx:G,my:re}=Q(de),ve=new Set(Object.values(Gt).map(Ne=>Ne.room)),ze=Md(_e,G,re,ve);ze&&me(ze)},[Q,me]);S.useEffect(()=>{const de=G=>{!er||!Vn||(G.key==="Delete"||G.key==="Backspace")&&(Vn.startsWith("desk:")||me(Vn))};return window.addEventListener("keydown",de),()=>window.removeEventListener("keydown",de)},[me]);const ke=S.useCallback(()=>{if(pn){const G=[..._e.furniture,..._e.wallDecorations].find(re=>re.id===pn.defId);G&&(G.offsetX=pn.origOffX,G.offsetY=pn.origOffY,fl=Br(_e)),pn=null}if(rn){const de=Gt[rn.roleId];de&&(de.dx=rn.origDx,de.dy=rn.origDy);const G=A.current[rn.roleId];G&&(G.homeX=de.dx+8,G.homeY=de.dy+34),rn=null}pa=null,ma=null,dl=null,k.current&&(k.current.style.cursor="default")},[]),yt=S.useCallback(de=>{if(er)return;const G=B(de);if(G){if(G.type==="role"){c(G.id);return}switch(G.id){case"meeting":{const re=l[0];re?u(re.id):f();break}case"bulletin":f();break;case"decisions":m();break;case"knowledge":p();break;case"settings":d==null||d();break;case"theme":g==null||g();break;case"stats":y==null||y();break}}},[B,c,u,f,m,p,d,g,y]);return o.jsxs("div",{className:`td-scene${L?" td-scene--editing":""}`,children:[o.jsxs("div",{ref:C,className:"td-wrap",children:[o.jsx("canvas",{ref:k,width:_e.canvasW,height:_e.canvasH,className:"td-canvas",onClick:yt,onMouseDown:Be,onMouseUp:He,onMouseMove:Ee,onMouseLeave:ke,onContextMenu:Ke}),o.jsx("div",{ref:E,className:"td-overlay"})]}),L&&o.jsxs("div",{className:"td-edit-banner",children:[o.jsx("span",{className:"td-edit-banner__icon",children:"✎"})," EDIT MODE — Click DONE when finished"]}),o.jsxs("button",{className:`td-edit-btn${L?" td-edit-btn--active":""}`,onClick:()=>{D(de=>{const G=!de;return G||(X(null),M(null)),G}),Vn=null,pn=null,rn=null},title:L?"Exit Edit Mode":"Edit Furniture Layout",children:[o.jsx("span",{className:"td-edit-btn__icon",children:L?"✓":"✎"}),o.jsx("span",{className:"td-edit-btn__label",children:L?"DONE":"EDIT"})]}),L&&o.jsx("div",{className:"td-palette",children:RE.map(de=>o.jsx("button",{className:`td-palette__item${U===de.type?" td-palette__item--active":""}`,onClick:()=>{U===de.type?(X(null),M(null)):(X(de.type),M(de.zone))},title:de.label,children:o.jsx("span",{children:de.icon})},de.type))}),j&&o.jsxs("button",{className:"td-hire-btn",onClick:j,title:"Hire New Role",children:[o.jsx("span",{className:"td-hire-btn__icon",children:"+"}),o.jsx("span",{className:"td-hire-btn__label",children:"HIRE"})]})]})}function WE({role:t,appearance:l,onSave:r,onReset:i,onClose:c,theme:u,onThemeChange:f,onUpdateName:m,initialTab:p,characterOnly:d,speechSettings:g,onSpeechSettingsChange:y,language:b,onLanguageChange:v,roleLevel:j}){var q;const[k,C]=S.useState(p??"character"),[E,A]=S.useState({...l}),[R,O]=S.useState(t.name),[L,D]=S.useState(!1),U=S.useCallback(()=>A(js(j)),[j]),X=S.useCallback(()=>{const F=Eh(t.id);A({...F}),i()},[t.id,i]),ne=S.useCallback(async()=>{r(E);const F=R.trim();if(m&&F&&F!==t.name){D(!0);try{await m(t.id,F)}catch{}D(!1)}c()},[E,r,c,R,t.name,t.id,m]),M=o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[o.jsxs("span",{children:[t.id.toUpperCase()," –"]}),m?o.jsx("input",{value:R,onChange:F=>O(F.target.value),disabled:L,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}}):o.jsx("span",{children:t.name})]});return o.jsx("div",{className:"customize-overlay",onClick:c,children:o.jsxs("div",{className:"customize-modal",onClick:F=>F.stopPropagation(),children:[o.jsxs("div",{className:"customize-header",children:[o.jsxs("div",{className:"customize-tabs",children:[o.jsx("button",{className:`customize-tab ${k==="character"?"active":""}`,onClick:()=>C("character"),children:"CHARACTER"}),!d&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:`customize-tab ${k==="office"?"active":""}`,onClick:()=>C("office"),children:"OFFICE THEME"}),o.jsx("button",{className:`customize-tab ${k==="settings"?"active":""}`,onClick:()=>C("settings"),children:"SETTINGS"})]})]}),o.jsx("button",{className:"customize-close",onClick:c,children:"X"})]}),k==="character"?o.jsx("div",{className:"customize-body",children:o.jsx(bg,{roleId:t.id,appearance:E,onChange:A,onRandomize:U,onReset:X,label:M,roleLevel:j})}):k==="office"?o.jsx("div",{className:"customize-body",children:o.jsx("div",{className:"customize-themes",children:Object.entries(Hr).map(([F,W])=>o.jsxs("button",{className:`customize-theme-card ${u===F?"active":""}`,onClick:()=>f(F),children:[o.jsxs("div",{className:"customize-theme-preview",style:{background:W.vars["--floor-light"],borderColor:W.vars["--pixel-border"]},children:[o.jsx("div",{style:{background:W.vars["--hud-bg"],height:8,borderBottom:`2px solid ${W.vars["--pixel-border"]}`}}),o.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1 p-1",children:[o.jsx("div",{style:{width:10,height:14,background:W.vars["--accent"],borderRadius:1}}),o.jsx("div",{style:{width:10,height:14,background:W.vars["--active-green"],borderRadius:1}}),o.jsx("div",{style:{width:10,height:14,background:W.vars["--idle-amber"],borderRadius:1}})]}),o.jsx("div",{style:{background:W.vars["--hud-bg"],height:6,borderTop:`2px solid ${W.vars["--pixel-border"]}`}})]}),o.jsxs("div",{className:"customize-theme-name",children:[W.icon," ",W.name]})]},F))})}):o.jsx("div",{className:"customize-body",children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,padding:"8px 0"},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),o.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(F=>o.jsxs("button",{onClick:()=>y==null?void 0:y({mode:F}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(g==null?void 0:g.mode)===F?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(g==null?void 0:g.mode)===F?"rgba(255,255,255,0.08)":"transparent",color:(g==null?void 0:g.mode)===F?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[o.jsx("div",{style:{fontWeight:600,marginBottom:2},children:F==="template"?"TEMPLATE":F==="llm"?"AI":"AUTO"}),o.jsx("div",{style:{fontSize:9,opacity:.7},children:F==="template"?"Static pool ($0)":F==="llm"?"LLM generated":"Detect engine"})]},F))}),o.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(g==null?void 0:g.intervalSec)??18,"s"]}),o.jsx("input",{type:"range",min:5,max:120,step:5,value:(g==null?void 0:g.intervalSec)??18,onChange:F=>y==null?void 0:y({intervalSec:Number(F.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[o.jsx("span",{children:"5s (frequent)"}),o.jsx("span",{children:"120s (rare)"})]})]}),(g==null?void 0:g.mode)!=="template"&&o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((q=g==null?void 0:g.dailyBudgetUsd)==null?void 0:q.toFixed(2))??"1.00"]}),o.jsx("input",{type:"range",min:0,max:5,step:.25,value:(g==null?void 0:g.dailyBudgetUsd)??1,onChange:F=>y==null?void 0:y({dailyBudgetUsd:Number(F.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[o.jsx("span",{children:"$0 (unlimited)"}),o.jsx("span",{children:"$5.00/day"})]})]}),o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),o.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:F,label:W})=>o.jsx("button",{onClick:()=>v==null?void 0:v(F),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(b??"auto")===F?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(b??"auto")===F?"rgba(255,255,255,0.08)":"transparent",color:(b??"auto")===F?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:W},F))}),o.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]})]})}),k==="character"&&o.jsxs("div",{className:"customize-footer",children:[o.jsx("button",{className:"customize-btn customize-btn--cancel",onClick:c,children:"CANCEL"}),o.jsx("button",{className:"customize-btn customize-btn--save",onClick:ne,children:"SAVE"})]})]})})}function L0(t){const l=Date.now()-new Date(t).getTime(),r=Math.floor(l/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function ZE({status:t,history:l,onClose:r,onSave:i,onLoadHistory:c,onRestore:u,saving:f}){const[m,p]=S.useState("save"),[d,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"&&c()},[m,c]),S.useEffect(()=>{var D;(D=E.current)==null||D.focus()},[]);const A=[...((t==null?void 0:t.modified)??[]).map(D=>({status:"M",file:D})),...((t==null?void 0:t.untracked)??[]).map(D=>({status:"A",file:D}))],R=async()=>{b(null),C(null);try{const D=await i(d||void 0);C(D),g("")}catch(D){b(D instanceof Error?D.message:"Save failed")}},O=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(U){b(U instanceof Error?U.message:"Restore failed"),j(!1)}}};S.useEffect(()=>{const D=U=>{U.key==="Escape"&&r()};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[r]);const L=D=>{D.key==="Enter"&&(D.metaKey||D.ctrlKey)&&R()};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),o.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:L,children:[o.jsxs("div",{className:"px-5 py-3 flex items-center justify-between shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"text-lg font-black tracking-tight",children:"SAVE GAME"}),o.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:(t==null?void 0:t.branch)??""})]}),o.jsx("button",{onClick:r,className:"text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] cursor-pointer text-lg",children:"×"})]}),o.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["save","history"].map(D=>o.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))}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[m==="save"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"text-[11px]",style:{color:"var(--terminal-text-secondary)"},children:A.length>0?o.jsxs("span",{style:{color:"var(--idle-amber)"},children:["* ",A.length," unsaved change",A.length>1?"s":""]}):o.jsx("span",{style:{color:"var(--active-green)"},children:"All changes saved"})}),A.length>0&&o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Changed Files"}),o.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:A.map(({status:D,file:U})=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx("span",{style:{color:D==="A"?"var(--active-green)":"var(--idle-amber)",width:"14px"},children:D}),o.jsx("span",{style:{color:"var(--terminal-text-secondary)"},children:U})]},U))})]}),A.length>0&&o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Save Message"}),o.jsx("input",{ref:E,type:"text",value:d,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)"}})]}),A.length>0&&o.jsx("div",{className:"flex gap-3",children:o.jsx("button",{onClick:R,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"})}),A.length>0&&t&&!t.hasRemote&&o.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"Local save only — add a git remote to enable push"}),k&&o.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&&o.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)&&o.jsxs("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:["Last save: ",t.lastCommit.message," (",L0(t.lastCommit.date),")"]})]}),m==="history"&&o.jsxs(o.Fragment,{children:[l.length===0&&o.jsx("div",{className:"text-[11px] text-center py-8",style:{color:"var(--terminal-text-muted)"},children:"No save history"}),o.jsx("div",{className:"space-y-1",children:l.map(D=>o.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:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--accent)"},children:D.shortSha}),o.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--terminal-text)"},children:D.message})]}),o.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:L0(D.date)})]}),o.jsx("button",{onClick:()=>O(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))})]})]})]})]})}function JE({onClose:t}){const[l,r]=S.useState(null),[i,c]=S.useState(!0),[u,f]=S.useState(null);return S.useEffect(()=>{Ce.getCompanyStats().then(r).catch(m=>f(m.message)).finally(()=>c(!1))},[]),i?o.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading stats..."}):u||!l?o.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u||"Failed to load stats",o.jsx("button",{onClick:t,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]}):o.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:20},children:[o.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Company Stats"}),o.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:20},children:[o.jsx(yc,{label:"Roles",value:String(l.company.roleCount)}),o.jsx(yc,{label:"Avg Level",value:`Lv.${l.company.avgLevel}`}),o.jsx(yc,{label:"Total Tokens",value:l.company.formattedTokens}),o.jsx(yc,{label:"Total Cost",value:`$${l.company.totalCostUsd.toFixed(2)}`})]}),o.jsx("h4",{style:{margin:"0 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Role Leaderboard"}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[l.roles.map((m,p)=>o.jsx(PE,{role:m,rank:p+1},m.roleId)),l.roles.length===0&&o.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"8px 0"},children:"No role activity yet. Assign tasks to start leveling up!"})]}),Object.keys(l.byModel).length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h4",{style:{margin:"20px 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Model Usage"}),o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:Object.entries(l.byModel).map(([m,p])=>o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"6px 10px",background:"rgba(255,255,255,0.03)",borderRadius:6,fontSize:12},children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.7)"},children:eN(m)}),o.jsxs("span",{style:{color:"rgba(255,255,255,0.5)"},children:["$",p.costUsd.toFixed(2)]})]},m))})]})]})}function yc({label:t,value:l}){return o.jsxs("div",{style:{padding:"12px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[o.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.45)",marginBottom:4},children:t}),o.jsx("div",{style:{fontSize:18,fontWeight:600},children:l})]})}function PE({role:t,rank:l}){const r=["🥇","🥈","🥉"],i=l<=3?r[l-1]:`#${l}`;return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:8},children:[o.jsx("span",{style:{fontSize:14,width:28,textAlign:"center",flexShrink:0},children:i}),o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:4},children:[o.jsx("span",{style:{fontSize:13,fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),o.jsxs("span",{style:{fontSize:12,color:$0(t.level),fontWeight:600,flexShrink:0,marginLeft:8},children:["Lv.",t.level]})]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[o.jsx("div",{style:{flex:1,height:4,background:"rgba(255,255,255,0.08)",borderRadius:2,overflow:"hidden"},children:o.jsx("div",{style:{width:`${t.progress*100}%`,height:"100%",background:$0(t.level),borderRadius:2,transition:"width 0.3s ease"}})}),o.jsx("span",{style:{fontSize:10,color:"rgba(255,255,255,0.4)",flexShrink:0},children:t.formattedTokens})]})]})]})}function $0(t){return t>=9?"#FFD700":t>=7?"#C0A0FF":t>=5?"#4FC3F7":t>=3?"#81C784":"rgba(255,255,255,0.4)"}function eN(t){return t.includes("opus")?"Opus":t.includes("sonnet")?"Sonnet":t.includes("haiku")?"Haiku":t.split("-").slice(0,2).join(" ")}function tN({onClose:t,onSyncComplete:l}){const[r,i]=S.useState([]),[c,u]=S.useState([]),[f,m]=S.useState(!0),[p,d]=S.useState(null),[g,y]=S.useState(new Set),[b,v]=S.useState(null),[j,k]=S.useState(null),C=S.useCallback(async()=>{m(!0),v(null);try{const{roles:A}=await Ce.getSyncRoles();i(A);const R=A.filter(L=>L.source.sync!=="off");if(R.length===0){u([]),k(null);return}let O=!1;try{const L=await Ts.syncCheck(R.map(U=>({roleId:U.roleId,sourceId:U.source.id,currentVersion:U.source.upstream_version??U.source.forked_at??"0.0.0"})));O=!0,k(!0);const D=[];for(const U of L.updates){if(!U.hasUpdate)continue;const X=R.find(W=>W.roleId===U.roleId);if(!X)continue;const{character:ne}=await Ts.syncPull(U.sourceId),M=[];X.persona.trim()!==ne.persona.trim()&&M.push({field:"persona",local:X.persona.slice(0,120)+(X.persona.length>120?"...":""),upstream:ne.persona.slice(0,120)+(ne.persona.length>120?"...":"")});const q=JSON.stringify(X.authority),F=JSON.stringify(ne.authority);q!==F&&M.push({field:"authority",local:`${X.authority.autonomous.length} autonomous, ${X.authority.needsApproval.length} approval`,upstream:`${ne.authority.autonomous.length} autonomous, ${ne.authority.needsApproval.length} approval`}),M.length>0&&D.push({roleId:U.roleId,roleName:X.name,sourceId:U.sourceId,currentVersion:U.currentVersion,latestVersion:U.latestVersion,fields:M})}u(D)}catch{k(!1),u([])}}catch(A){v(A instanceof Error?A.message:"Failed to check for updates")}finally{m(!1)}},[]);S.useEffect(()=>{C()},[C]);const E=async A=>{d(A.roleId);try{const{character:R,version:O}=await Ts.syncPull(A.sourceId);await Ce.applySyncUpdate({roleId:A.roleId,changes:{persona:R.persona,authority:R.authority},upstreamVersion:O}),y(L=>new Set(L).add(A.roleId)),l==null||l()}catch(R){v(R instanceof Error?R.message:"Failed to apply update")}finally{d(null)}};return o.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[o.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Role Sync"}),o.jsxs("div",{style:{display:"flex",gap:8},children:[o.jsx("button",{onClick:C,disabled:f,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:f?"wait":"pointer"},children:f?"Checking...":"Refresh"}),o.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),j===!1&&o.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,180,0,0.1)",borderRadius:6,color:"#FFB74D",fontSize:12,marginBottom:12},children:"Cloud API unreachable. Sync requires connection to api.tycono.ai."}),b&&o.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:b}),o.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Tracked roles: "}),o.jsx("span",{style:{fontWeight:500},children:r.length}),o.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Updates available: "}),o.jsx("span",{style:{fontWeight:500,color:c.length>0?"#4FC3F7":"rgba(255,255,255,0.7)"},children:c.filter(A=>!g.has(A.roleId)).length}),j===!0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),o.jsx("span",{style:{fontSize:11,color:"#81C784"},children:"Cloud connected"})]})]}),c.length===0&&!f&&o.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:r.length===0?"No roles with source tracking. Hire from the Store to enable sync.":"All roles are up to date!"}),c.map(A=>o.jsxs("div",{style:{marginBottom:12,padding:14,background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:14,fontWeight:500},children:A.roleName}),o.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.4)"},children:[A.sourceId," · v",A.currentVersion," → v",A.latestVersion]})]}),g.has(A.roleId)?o.jsx("span",{style:{fontSize:12,color:"#81C784"},children:"Applied ✓"}):o.jsx("button",{onClick:()=>E(A),disabled:p===A.roleId,style:{background:"#1565C0",border:"none",color:"white",borderRadius:6,padding:"5px 12px",fontSize:12,cursor:p===A.roleId?"wait":"pointer",opacity:p===A.roleId?.6:1},children:p===A.roleId?"Applying...":"Apply Update"})]}),A.fields.map(R=>o.jsxs("div",{style:{marginBottom:6,fontSize:12},children:[o.jsx("div",{style:{color:"rgba(255,255,255,0.5)",marginBottom:2,textTransform:"uppercase",fontSize:10,letterSpacing:.5},children:R.field}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},children:[o.jsxs("div",{style:{padding:"4px 8px",background:"rgba(255,100,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[o.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"LOCAL"}),o.jsx("br",{}),R.local]}),o.jsxs("div",{style:{padding:"4px 8px",background:"rgba(100,255,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[o.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"UPSTREAM"}),o.jsx("br",{}),R.upstream]})]})]},R.field))]},A.roleId)),r.length>0&&o.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Roles hired from the Store are tracked automatically. Set ",o.jsx("code",{style:{background:"rgba(255,255,255,0.06)",padding:"1px 4px",borderRadius:3},children:"sync: off"})," in role.yaml to stop tracking."]})]})}function nN({onClose:t}){const[l,r]=S.useState(null),[i,c]=S.useState(!0),[u,f]=S.useState(null),[m,p]=S.useState(null),d=S.useCallback(async()=>{c(!0),f(null);try{const A=await Ce.getGitStatus();r(A)}catch(A){f(A instanceof Error?A.message:"Failed to load git status")}finally{c(!1)}},[]);S.useEffect(()=>{d()},[d]);const g=async A=>{p(A.path);try{await Ce.deleteWorktree(A.path),await d()}catch(R){f(R instanceof Error?R.message:"Failed to remove worktree")}finally{p(null)}},y=async A=>{p(A);try{await Ce.deleteBranch(A),await d()}catch(R){f(R instanceof Error?R.message:"Failed to delete branch")}finally{p(null)}};if(i&&!l)return o.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading git status..."});if(u&&!l)return o.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u,o.jsx("button",{onClick:t,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]});if(!l)return null;const b=l.worktrees.filter(A=>A.status==="active"),v=l.worktrees.filter(A=>A.status==="pending-merge"),j=l.worktrees.filter(A=>A.status==="stale");function k(A){const R=A.split("/");if(R.length>1){const O=R[R.length-1],L=["cto","cbo","pm","engineer","designer","qa","data-analyst"];for(const D of L)if(O.toLowerCase().includes(D))return D}return null}function C(A,R=40){return A.length<=R?A:"..."+A.slice(A.length-R+3)}function E(A){const R=Date.now()-new Date(A).getTime(),O=Math.floor(R/6e4);if(O<1)return"just now";if(O<60)return`${O}m ago`;const L=Math.floor(O/60);return L<24?`${L}h ago`:`${Math.floor(L/24)}d ago`}return o.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[o.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"GIT STATUS"}),o.jsxs("div",{style:{display:"flex",gap:8},children:[o.jsx("button",{onClick:d,disabled:i,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:i?"wait":"pointer"},children:i?"Checking...":"Refresh"}),o.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),u&&o.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:u}),o.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o.jsxs("div",{children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Branch: "}),o.jsx("span",{style:{fontWeight:500},children:l.currentBranch})]}),o.jsx("div",{children:l.unsavedCount>0&&o.jsxs("span",{style:{color:"#FFB74D",fontSize:12},children:[l.unsavedCount," unsaved"]})})]}),l.lastCommit&&o.jsxs("div",{style:{marginTop:6,fontSize:11,color:"rgba(255,255,255,0.4)"},children:["Last commit: ",l.lastCommit.message.slice(0,60),l.lastCommit.message.length>60?"...":""," · ",E(l.lastCommit.date)]})]}),b.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gc,{label:"Active Worktrees",count:b.length}),b.map(A=>o.jsx(_d,{wt:A,roleFromBranch:A.roleId||k(A.branch),truncatePath:C,timeAgo:E,removing:m===A.path,onRemove:()=>g(A),statusColor:"#4FC3F7",statusIcon:"📂"},A.path))]}),v.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gc,{label:"Pending Merge",count:v.length}),v.map(A=>o.jsx(_d,{wt:A,roleFromBranch:A.roleId||k(A.branch),truncatePath:C,timeAgo:E,removing:m===A.path,onRemove:()=>g(A),statusColor:"#FFB74D",statusIcon:"⚠️"},A.path))]}),j.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gc,{label:"Stale",count:j.length}),j.map(A=>o.jsx(_d,{wt:A,roleFromBranch:A.roleId||k(A.branch),truncatePath:C,timeAgo:E,removing:m===A.path,onRemove:()=>g(A),statusColor:"#ff6b6b",statusIcon:"🔴"},A.path))]}),l.staleBranches.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gc,{label:"Unmerged Branches",count:l.staleBranches.length}),l.staleBranches.map(A=>o.jsxs("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o.jsxs("div",{style:{fontSize:13},children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.5)",marginRight:6},children:"⚠️"}),o.jsx("span",{style:{fontWeight:500},children:A})]}),o.jsx("button",{onClick:()=>y(A),disabled:m===A,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:"#ff6b6b",borderRadius:4,padding:"3px 8px",fontSize:10,cursor:m===A?"wait":"pointer",opacity:m===A?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5},children:m===A?"...":"DELETE"})]},A))]}),b.length===0&&v.length===0&&j.length===0&&l.staleBranches.length===0&&o.jsxs("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:["✓"," All clean. No active worktrees or stale branches."]}),l.lastMerge&&o.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Last merge: ",o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:l.lastMerge.branch})," · ",l.lastMerge.roleId," · ",E(l.lastMerge.mergedAt)]})]})}function gc({label:t,count:l}){return o.jsxs("h4",{style:{margin:"16px 0 8px",fontSize:11,fontWeight:600,color:"rgba(255,255,255,0.5)",textTransform:"uppercase",letterSpacing:1},children:[t," (",l,")"]})}function _d({wt:t,roleFromBranch:l,truncatePath:r,timeAgo:i,removing:c,onRemove:u,statusColor:f,statusIcon:m}){return o.jsx("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsxs("div",{style:{fontSize:13,fontWeight:500,marginBottom:2},children:[o.jsx("span",{style:{marginRight:6},children:m}),t.branch,l&&o.jsx("span",{style:{marginLeft:8,fontSize:10,padding:"1px 6px",background:"rgba(255,255,255,0.08)",borderRadius:3,color:"rgba(255,255,255,0.6)",textTransform:"uppercase"},children:l})]}),t.task&&o.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.5)",marginBottom:2},children:['"',t.task.slice(0,50),t.task.length>50?"...":"",'"']}),o.jsxs("div",{style:{fontSize:10,color:"rgba(255,255,255,0.35)"},children:[r(t.path)," · ",t.filesChanged," file",t.filesChanged!==1?"s":""," changed"," · ",i(t.createdAt)]}),t.conflictFiles&&t.conflictFiles.length>0&&o.jsxs("div",{style:{fontSize:10,color:"#ff6b6b",marginTop:4},children:["⛔"," CONFLICT: ",t.conflictFiles.join(", ")]})]}),o.jsx("button",{onClick:u,disabled:c,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:f,borderRadius:4,padding:"3px 8px",fontSize:10,cursor:c?"wait":"pointer",opacity:c?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5,flexShrink:0,marginLeft:8},children:c?"...":"REMOVE"})]})})}function lN({onClose:t,speechSettings:l,onSpeechSettingsChange:r,language:i,onLanguageChange:c,onOpenSync:u,onOpenGitStatus:f,onOpenStats:m}){var p;return o.jsx("div",{className:"customize-overlay",onClick:t,children:o.jsxs("div",{className:"customize-modal",onClick:d=>d.stopPropagation(),style:{maxWidth:480},children:[o.jsxs("div",{className:"customize-header",children:[o.jsx("div",{style:{fontSize:12,fontWeight:700,letterSpacing:1,color:"var(--terminal-text)"},children:"SETTINGS"}),o.jsx("button",{className:"customize-close",onClick:t,children:"X"})]}),o.jsx("div",{className:"customize-body",style:{padding:"12px 20px 20px"},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),o.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(d=>o.jsxs("button",{onClick:()=>r==null?void 0:r({mode:d}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(l==null?void 0:l.mode)===d?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(l==null?void 0:l.mode)===d?"rgba(255,255,255,0.08)":"transparent",color:(l==null?void 0:l.mode)===d?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[o.jsx("div",{style:{fontWeight:600,marginBottom:2},children:d==="template"?"TEMPLATE":d==="llm"?"AI":"AUTO"}),o.jsx("div",{style:{fontSize:9,opacity:.7},children:d==="template"?"Static pool ($0)":d==="llm"?"LLM generated":"Detect engine"})]},d))}),o.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(l==null?void 0:l.intervalSec)??18,"s"]}),o.jsx("input",{type:"range",min:5,max:120,step:5,value:(l==null?void 0:l.intervalSec)??18,onChange:d=>r==null?void 0:r({intervalSec:Number(d.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[o.jsx("span",{children:"5s (frequent)"}),o.jsx("span",{children:"120s (rare)"})]})]}),(l==null?void 0:l.mode)!=="template"&&o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((p=l==null?void 0:l.dailyBudgetUsd)==null?void 0:p.toFixed(2))??"1.00"]}),o.jsx("input",{type:"range",min:0,max:5,step:.25,value:(l==null?void 0:l.dailyBudgetUsd)??1,onChange:d=>r==null?void 0:r({dailyBudgetUsd:Number(d.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[o.jsx("span",{children:"$0 (unlimited)"}),o.jsx("span",{children:"$5.00/day"})]})]}),o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),o.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:d,label:g})=>o.jsx("button",{onClick:()=>c==null?void 0:c(d),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(i??"auto")===d?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(i??"auto")===d?"rgba(255,255,255,0.08)":"transparent",color:(i??"auto")===d?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:g},d))}),o.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]}),o.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.08)",paddingTop:16,display:"flex",gap:8},children:[u&&o.jsx("button",{onClick:()=>{t(),u()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"🔄 ROLE SYNC"}),f&&o.jsx("button",{onClick:()=>{t(),f()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📂 GIT STATUS"}),m&&o.jsx("button",{onClick:()=>{t(),m()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📊 COMPANY STATS"})]})]})})]})})}function rN({theme:t,onThemeChange:l,onClose:r}){const i=S.useRef(null);return S.useEffect(()=>{const c=u=>{i.current&&!i.current.contains(u.target)&&r()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]),o.jsx("div",{ref:i,className:"theme-dropup",children:Object.entries(Hr).map(([c,u])=>o.jsxs("button",{className:`theme-dropup__item${t===c?" theme-dropup__item--active":""}`,onClick:()=>{l(c),r()},title:u.name,children:[o.jsxs("span",{className:"theme-dropup__swatch",style:{background:u.vars["--hud-bg"],borderColor:u.vars["--pixel-border"]},children:[o.jsx("span",{style:{background:u.vars["--accent"],width:5,height:5,borderRadius:1}}),o.jsx("span",{style:{background:u.vars["--active-green"],width:5,height:5,borderRadius:1}}),o.jsx("span",{style:{background:u.vars["--idle-amber"],width:5,height:5,borderRadius:1}})]}),o.jsx("span",{className:"theme-dropup__name",children:u.icon})]},c))})}const _c=[0,1e4,5e4,15e4,4e5,1e6,25e5,5e6,1e7,25e6];function Rg(t){let l=1;for(let r=_c.length-1;r>=0;r--)if(t>=_c[r]){l=r+1;break}return Math.min(l,10)}function aN(t){const l=Rg(t);if(l>=10)return 1;const r=_c[l-1],i=_c[l];return Math.min(1,(t-r)/(i-r))}function H0(t){const l={};for(const[r,i]of Object.entries(t)){const c=i.inputTokens+i.outputTokens;l[r]={level:Rg(c),totalTokens:c,progress:aN(c)}}return l}const iN=[{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 U0(t){return iN.filter(l=>l.check(t))}const sN={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍","data-analyst":"📊"},jc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},oN={cto:"아키텍처",cbo:"시장 분석",pm:"PRD 작성",engineer:"코딩",designer:"시안 제작",qa:"품질 검증"};function cN(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 uN({importJob:t,onImportDone:l}){var ji,Na,Ci;const[r,i]=S.useState([]),[c,u]=S.useState([]),[f,m]=S.useState([]),[p,d]=S.useState([]),[g,y]=S.useState([]),[b,v]=S.useState([]),[j,k]=S.useState("TYCONO"),[C,E]=S.useState(!0),[A,R]=S.useState(null),[O,L]=S.useState({type:"none"}),[D,U]=S.useState(null),[X,ne]=S.useState(null),[M,q]=S.useState([]),[F,W]=S.useState(!1),[ee,V]=S.useState([]),[I,Z]=S.useState(0),[ce,we]=S.useState(!1),[z,B]=S.useState({}),[Q,T]=S.useState("ceo"),[me,Se]=S.useState(null),[Ee,Be]=S.useState(!1),[He,Ke]=S.useState({}),ke=S.useRef({}),[yt,de]=S.useState(!1),[G,re]=S.useState(null),[ve,ze]=S.useState({}),[Ne,Te]=S.useState([]),[Me,Oe]=S.useState([]),[tt,Lt]=S.useState(void 0),[gt,ht]=S.useState(!1);S.useEffect(()=>{Ce.getStatus().then(_=>{Lt(_.engine),ht(!!_.hasApiKey)}).catch(()=>{})},[]);const{getAppearance:Zt,setAppearance:ae,resetAppearance:xe,theme:De,setTheme:Ue,speechSettings:ye,setSpeechSettings:je,language:jt,setLanguage:wt}=IC(),[Xe,ft]=S.useState(null),[fe,Mt]=S.useState("character"),nt=qC(),[mi,lr]=S.useState(!1),[wa,Tl]=S.useState(!1),[Dl,rr]=S.useState(!1),[qr,ka]=S.useState(!1),[Us,Xr]=S.useState(!1),[ar,xi]=S.useState(!1),[bn,Is]=S.useState(null);S.useEffect(()=>{const _=se=>{(se.metaKey||se.ctrlKey)&&se.key==="s"&&(se.preventDefault(),nt.dirtyCount>0&&lr(!0))};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[nt.dirtyCount]),S.useEffect(()=>{let _=!1;const se=async()=>{try{const pe=await Ce.getGitStatus();_||Is(pe)}catch{}};se();const he=setInterval(se,1e4);return()=>{_=!0,clearInterval(he)}},[]);const[zl,Vr]=S.useState(null),[ml,Ml]=S.useState(null),[Rl,il]=S.useState([]),[$t,cn]=S.useState(!1),Fl=S.useRef(!1),Gr=S.useRef(null);let Ys=S.useRef(0);const qs=S.useRef(new Set),xl=(_,se,he)=>{const pe={id:Ys.current++,type:_,text:se,detail:he};il(ge=>[...ge,pe])};S.useEffect(()=>{var _;$t&&((_=Gr.current)==null||_.scrollIntoView({behavior:"smooth"}))},[Rl,$t]),S.useEffect(()=>{t&&(Fl.current||(Fl.current=!0,Ml("Scanning knowledge sources..."),il([{id:0,type:"scan",text:"Starting knowledge import..."}]),Ys.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 _=>{var ge;const se=(ge=_.body)==null?void 0:ge.getReader();if(!se)return;const he=new TextDecoder;let pe="";for(;;){const{done:Re,value:Le}=await se.read();if(Re)break;pe+=he.decode(Le,{stream:!0});const Je=pe.split(`
89
- `);pe=Je.pop()||"";let lt="";for(const Ve of Je)if(Ve.startsWith("event: "))lt=Ve.slice(7).trim();else if(Ve.startsWith("data: ")&&lt){try{const It=JSON.parse(Ve.slice(6));switch(lt){case"scanning":Ml(`Scanning: ${It.path} (${It.fileCount} files)`),xl("scan",`Found ${It.fileCount} files`,It.path);break;case"processing":Vr({index:It.index,total:It.total}),Ml(`Importing knowledge... (${It.index}/${It.total})`),xl("process",`Processing: ${It.file}`,`${It.index} / ${It.total}`);break;case"created":xl("created",It.title,It.summary);break;case"skipped":xl("process",`Skipped: ${It.file}`,It.reason);break;case"done":Ml(null),Vr(null),xl("done",`Import complete! ${It.created} created, ${It.skipped} skipped.`),qt(`Knowledge import complete! ${It.created} documents imported.`,"#2E7D32"),l==null||l();break;case"error":Ml(null),Vr(null),xl("error",It.message),qt(`Import failed: ${It.message}`,"#B71C1C"),l==null||l();break}}catch{}lt=""}}}).catch(_=>{Ml(null),xl("error",_.message),qt(`Import error: ${_.message}`,"#B71C1C"),l==null||l()})))},[t]);const[_l,Sa]=S.useState("iso"),[Ol,ir]=S.useState(typeof window<"u"?window.innerWidth:1200);S.useEffect(()=>{const _=()=>ir(window.innerWidth);return window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)},[]);const Bl=Ol<1024,[un,Ft]=S.useState(!1),[sr,Xs]=S.useState(560),[En,Kt]=S.useState([]),[ja,Kn]=S.useState(null),[or,pi]=S.useState(null),{sendMessage:Ca}=$C();S.useEffect(()=>{Promise.all([Ce.getCompany().then(_=>{k(_.name),i(_.roles)}),Ce.getProjects().then(u),Ce.getStandups().then(m),Ce.getWaves().then(d),Ce.getDecisions().then(y),Ce.getKnowledge().then(v).catch(()=>{}),Ce.getOrgTree().then(_=>{B(_.nodes),T(_.root)}).catch(()=>{}),Ce.getCostSummary().then(_=>Vs(H0(_.byRole))).catch(()=>{})]).catch(_=>R(`Failed to load: ${_.message}`)).finally(()=>E(!1))},[]),S.useEffect(()=>{Ce.deleteEmptySessions().catch(()=>{}),Ce.getSessions().then(_=>{if(_.length>0){const se=_.map(pe=>({...pe,messages:[]}));Kt(se);const he=se.find(pe=>pe.status==="active")??se[0];Kn(he.id),Ft(!0)}}).catch(_=>{console.error("Failed to load sessions",_)})},[]),S.useEffect(()=>{const _=()=>{fetch("/api/exec/status").then(he=>he.json()).then(he=>{ze(he.statuses??{}),Te(he.activeExecutions??[])}).catch(()=>{})};_();const se=setInterval(_,3e3);return()=>clearInterval(se)},[]);const pl=S.useMemo(()=>{const _={...ve};if(or){const se=En.find(he=>he.id===or);se&&(_[se.roleId]="working")}return _},[ve,or,En]);S.useEffect(()=>{O.type==="role"?Ce.getRole(O.roleId).then(U).catch(console.error):U(null)},[O]);const vn=()=>L({type:"none"}),Nn=async(_,se)=>{const he=r.find(ge=>ge.id===_),pe=(X==null?void 0:X.mode)==="ask";ne(null);try{const{jobId:ge}=await Ce.startJob({type:"assign",roleId:_,task:se,readOnly:pe}),Re=jc[_]??"#666",Le=`${_.toUpperCase()} · ${(he==null?void 0:he.name)??_}`;we(!1),q([{jobId:ge,title:Le,color:Re}]),Ut.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO → ${(he==null?void 0:he.name)??_}] ${pe?"Ask":"Assign"}: ${se}`,type:"dispatch",targetRoleId:_})}catch(ge){qt(`Failed to start job: ${ge instanceof Error?ge.message:"unknown"}`,"#C62828")}},qt=(_,se)=>{const he=Date.now();Oe(pe=>[...pe,{id:he,message:_,color:se}]),setTimeout(()=>Oe(pe=>pe.filter(ge=>ge.id!==he)),4e3)},Vs=_=>{var he,pe;const se=ke.current;for(const[ge,Re]of Object.entries(_)){const Le=((he=se[ge])==null?void 0:he.level)??0;if(Le>0&&Re.level>Le){const Je=((pe=r.find(lt=>lt.id===ge))==null?void 0:pe.name)??ge.toUpperCase();qt(`${Je} leveled up to Lv.${Re.level}!`,"#7C3AED")}}ke.current=_,Ke(_)};S.useEffect(()=>{const _={roles:Object.entries(He).map(([pe,ge])=>({id:pe,level:ge.level,totalTokens:ge.totalTokens})),totalTokens:Object.values(He).reduce((pe,ge)=>pe+ge.totalTokens,0),roleCount:r.length},se=U0(_),he=qs.current;for(const pe of se)he.has(pe.id)||he.size>0&&qt(`${pe.icon} Badge earned: ${pe.name}!`,"#D4A017");qs.current=new Set(se.map(pe=>pe.id))},[He,r.length]);const yi=()=>{var se;const _=M[M.length-1];_&&(qt(`${_.title} completed`,_.color),Ut.pushMessage({ts:Date.now(),roleId:((se=_.title.split(" · ")[0])==null?void 0:se.toLowerCase())??"unknown",text:`[${_.title}] Job completed`,type:"dispatch"})),Ce.getStandups().then(m).catch(console.error),Ce.getCompany().then(he=>i(he.roles)).catch(console.error),Ce.getCostSummary().then(he=>Vs(H0(he.byRole))).catch(()=>{})},Gs=async _=>{W(!1);try{const se=await Ce.startJob({type:"wave",directive:_}),he=se.jobIds??(se.jobId?[se.jobId]:[]),pe=r.filter(Re=>Re.level==="c-level"),ge=he.map((Re,Le)=>{var Je,lt;return{jobId:Re,roleId:((Je=pe[Le])==null?void 0:Je.id)??`role-${Le}`,roleName:((lt=pe[Le])==null?void 0:lt.name)??`C-Level ${Le+1}`}});Ut.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO WAVE] "${_}" → ${ge.map(Re=>Re.roleName).join(", ")}`,type:"dispatch"}),Object.keys(z).length>0?(Se({directive:_,rootJobs:ge}),Be(!1)):(V(ge),Z(0),we(!1),ge.length>0&&q([{jobId:ge[0].jobId,title:`CEO WAVE · ${ge[0].roleId.toUpperCase()}`,color:"#B71C1C"}]))}catch(se){qt(`Failed to start wave: ${se instanceof Error?se.message:"unknown"}`,"#C62828")}},Kr=()=>{Ce.getWaves().then(d).catch(console.error),Ce.getStandups().then(m).catch(console.error)},gi=()=>{Ce.getCompany().then(_=>i(_.roles)).catch(console.error)},An=async(_,se)=>{await Ce.createRole(_),ae(_.id,se),gi(),qt(`${_.name} hired!`,"#2E7D32")},bi=async _=>{await Ce.deleteRole(_),gi(),re(null),qt(`${_.toUpperCase()} removed`,"#B71C1C")},vi=async(_,se)=>{await Ce.updateRole(_,se),gi(),O.type==="role"&&O.roleId===_&&Ce.getRole(_).then(U).catch(console.error),se.name&&qt(`${_.toUpperCase()} renamed to "${se.name}"`,"#1565C0")},wi=_=>{Ft(!0)},cr=async _=>{try{const se=await Ce.createSession(_,"talk");Kt(he=>[se,...he]),Kn(se.id),Ft(!0)}catch(se){console.error("Failed to create session",se),qt(`Failed to create session: ${se instanceof Error?se.message:"API unreachable"}`,"#B71C1C")}},Ks=async _=>{try{const se=await Ce.createSession(_,"talk");Kt(he=>[se,...he]),Kn(se.id)}catch(se){console.error("Failed to create session",se),qt(`Failed to create session: ${se instanceof Error?se.message:"API unreachable"}`,"#B71C1C")}},Qs=async _=>{const se=Ne.find(ge=>ge.roleId===_),he=(se==null?void 0:se.jobId)??(se==null?void 0:se.id);if(he&&pl[_]==="working"){const ge=r.find(Je=>Je.id===_),Re=jc[_]??"#666",Le=`${_.toUpperCase()} · ${(ge==null?void 0:ge.name)??_}`;q([{jobId:he,title:Le,color:Re}]),we(!1);return}const pe=En.find(ge=>ge.roleId===_);if(pe)Kn(pe.id),Ut.setActiveChannelId(null);else try{const ge=await Ce.createSession(_,"talk");Kt(Re=>[ge,...Re]),Kn(ge.id),Ut.setActiveChannelId(null)}catch(ge){console.error("Failed to create session",ge)}Ft(!0)},ur=async _=>{try{await Ce.deleteSession(_),Kt(se=>{var pe;const he=se.filter(ge=>ge.id!==_);return ja===_&&Kn(((pe=he[0])==null?void 0:pe.id)??null),he})}catch(se){console.error("Failed to delete session",se),qt(`Failed to close session: ${se instanceof Error?se.message:"API error"}`,"#B71C1C")}},qc=async()=>{try{const{ids:_}=await Ce.deleteEmptySessions();if(_.length===0)return;Kt(se=>{var pe;const he=se.filter(ge=>!_.includes(ge.id));return ja&&_.includes(ja)&&Kn(((pe=he[0])==null?void 0:pe.id)??null),he}),qt(`Cleared ${_.length} empty session${_.length!==1?"s":""}`,"#2E7D32")}catch(_){qt(`Failed to clear empty sessions: ${_ instanceof Error?_.message:"API error"}`,"#B71C1C")}},Ws=async()=>{if(!confirm("Close all sessions? This cannot be undone."))return;const _=En.map(se=>se.id);try{await Ce.deleteSessions(_),Kt([]),Kn(null),qt("All sessions closed","#2E7D32")}catch(se){qt(`Failed to close sessions: ${se instanceof Error?se.message:"API error"}`,"#B71C1C")}},sl=(_,se)=>{Kt(he=>he.map(pe=>{if(pe.id!==_)return pe;const ge=[...pe.messages],Re=ge[ge.length-1];if(Re&&Re.from==="role"&&Re.status==="streaming"){const Le=[...Re.streamEvents??[],se];ge[ge.length-1]={...Re,streamEvents:Le}}return{...pe,messages:ge}}))},Ea=(_,se,he)=>{const pe={id:`msg-${Date.now()}-ceo`,from:"ceo",content:se,type:he==="do"?"directive":"conversation",status:"done",timestamp:new Date().toISOString()},ge={id:`msg-${Date.now()+1}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:new Date().toISOString(),streamEvents:[]};Kt(Re=>Re.map(Le=>Le.id===_?{...Le,messages:[...Le.messages,pe,ge],updatedAt:new Date().toISOString()}:Le)),pi(_),Ca(_,se,he,{onThinking:Re=>{Kt(Le=>Le.map(Je=>{if(Je.id!==_)return Je;const lt=[...Je.messages],Ve=lt[lt.length-1];return Ve&&Ve.from==="role"&&Ve.status==="streaming"&&(lt[lt.length-1]={...Ve,thinking:(Ve.thinking??"")+Re}),{...Je,messages:lt}})),sl(_,{type:"thinking",timestamp:Date.now(),text:Re})},onText:Re=>{Kt(Le=>Le.map(Je=>{if(Je.id!==_)return Je;const lt=[...Je.messages],Ve=lt[lt.length-1];return Ve&&Ve.from==="role"&&Ve.status==="streaming"&&(lt[lt.length-1]={...Ve,content:Ve.content+Re}),{...Je,messages:lt}}))},onToolUse:(Re,Le)=>{sl(_,{type:"tool",timestamp:Date.now(),toolName:Re,toolInput:Le})},onDispatch:(Re,Le)=>{sl(_,{type:"dispatch",timestamp:Date.now(),roleId:Re,task:Le})},onDispatchProgress:(Re,Le,Je)=>{var lt;Le==="tool"?sl(_,{type:"dispatch:progress",timestamp:Date.now(),roleId:Re,progressType:"tool",toolName:Je.name,toolInput:Je.input}):Le==="thinking"?sl(_,{type:"dispatch:progress",timestamp:Date.now(),roleId:Re,progressType:"thinking",text:Je.text}):Le==="text"?sl(_,{type:"dispatch:progress",timestamp:Date.now(),roleId:Re,progressType:"text",text:(lt=Je.text)==null?void 0:lt.slice(-200)}):(Le==="done"||Le==="error")&&sl(_,{type:"dispatch:progress",timestamp:Date.now(),roleId:Re,progressType:Le})},onTurn:Re=>{sl(_,{type:"turn",timestamp:Date.now(),turn:Re})},onDone:()=>{Kt(Re=>Re.map(Le=>{if(Le.id!==_)return Le;const Je=Le.messages.map(Ve=>Ve.status==="streaming"?{...Ve,status:"done"}:Ve),lt=Le.messages.length<=2?se.slice(0,40).replace(/\n/g," "):Le.title;return{...Le,messages:Je,title:lt}})),pi(null)},onError:Re=>{Kt(Le=>Le.map(Je=>{if(Je.id!==_)return Je;const lt=Je.messages.map(Ve=>Ve.status==="streaming"?{...Ve,status:"error",content:Ve.content||Re}:Ve);return{...Je,messages:lt}})),pi(null)}})},Xc=(_,se)=>{Kt(he=>he.map(pe=>pe.id===_?{...pe,mode:se}:pe)),Ce.updateSession(_,{mode:se}).catch(console.error)},Vc=new Date().toISOString().slice(0,10),Bn=c[0],Qn={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},ki=_=>{const se=Qn[_];if(!se)return"";for(const he of f){const pe=he.content,ge=pe.indexOf(`## ${se}`);if(ge===-1)continue;const Re=pe.indexOf(`
86
+ VP Marketing, c-level, ceo`,className:"w-full h-40 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors font-mono"}),o.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."})]}),T.length>0&&o.jsxs("div",{children:[o.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Preview (",T.length," role",T.length!==1?"s":"",")"]}),o.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden",children:o.jsxs("table",{className:"w-full text-xs",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"border-b border-white/10",children:[o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),o.jsx("tbody",{children:T.map((G,re)=>o.jsxs("tr",{className:`border-b border-white/5 ${G.error?"bg-red-900/10":""}`,children:[o.jsx("td",{className:"p-2 text-white/80",children:G.name}),o.jsx("td",{className:"p-2 text-white/60 font-mono",children:G.id}),o.jsx("td",{className:"p-2 text-white/60",children:G.level}),o.jsx("td",{className:"p-2 text-white/60",children:G.reportsTo}),G.error&&o.jsx("td",{className:"p-2 text-red-400 text-[10px]",children:G.error})]},re))})]})})]})]}),V==="review"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Confirm Bulk Hire — ",T.length," roles"]}),o.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden max-h-[300px] overflow-y-auto",children:o.jsxs("table",{className:"w-full text-xs",children:[o.jsx("thead",{className:"sticky top-0 bg-[var(--wall)]",children:o.jsxs("tr",{className:"border-b border-white/10",children:[o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"#"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),o.jsx("tbody",{children:T.map((G,re)=>o.jsxs("tr",{className:"border-b border-white/5",children:[o.jsx("td",{className:"p-2 text-white/30",children:re+1}),o.jsx("td",{className:"p-2 text-white/80",children:G.name}),o.jsx("td",{className:"p-2 text-white/60 font-mono",children:G.id}),o.jsx("td",{className:"p-2 text-white/60",children:G.level}),o.jsx("td",{className:"p-2 text-white/60",children:G.reportsTo})]},re))})]})}),L&&Z.total>0&&o.jsxs("div",{children:[o.jsxs("div",{className:"flex justify-between text-[10px] text-white/40 mb-1",children:[o.jsx("span",{children:"Hiring..."}),o.jsxs("span",{children:[Z.done,"/",Z.total]})]}),o.jsx("div",{className:"h-1.5 bg-white/10 rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Z.done/Z.total*100}%`,background:"#2E7D32"}})})]}),o.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."}),I&&o.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:I})]})]})}),o.jsxs("div",{className:"flex justify-between px-5 pb-5",children:[o.jsxs("div",{children:[i==="single"&&u>1&&o.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"&&V==="review"&&o.jsx("button",{onClick:()=>Y("input"),disabled:L,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"})]}),o.jsxs("div",{className:"flex gap-3",children:[o.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<vs?o.jsx("button",{onClick:()=>f(u+1),disabled:!Ke(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"}):o.jsx("button",{onClick:He,disabled:L,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:L?"Hiring...":"HIRE"}):V==="input"?o.jsxs("button",{onClick:()=>Y("review"),disabled:!me,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 (",T.length,")"]}):o.jsx("button",{onClick:ke,disabled:L,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:L?`Hiring ${Z.done}/${Z.total}...`:`HIRE ALL (${T.length})`})]})]})]})]})}function ws({label:t,value:l,mono:r}){return o.jsxs("div",{className:"flex justify-between text-sm",children:[o.jsx("span",{className:"text-white/40",children:t}),o.jsx("span",{className:`font-semibold text-white/80 ${r?"font-mono":""}`,children:l})]})}function wC({roleId:t,roleName:l,onClose:r,onConfirm:i}){const[c,u]=k.useState(!1),f=async()=>{u(!0);try{await i(t)}finally{u(!1)}};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),o.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:[o.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[o.jsx("div",{className:"text-lg font-bold",children:"Fire Role"}),o.jsxs("div",{className:"text-sm opacity-80 mt-0.5",children:["Remove ",l," (",t,")"]})]}),o.jsxs("div",{className:"p-5",children:[o.jsxs("div",{className:"p-4 rounded-lg border-2 border-red-300 bg-red-50 mb-4",children:[o.jsx("div",{className:"text-sm font-bold text-red-800 mb-1",children:"Warning"}),o.jsxs("div",{className:"text-xs text-red-700 leading-relaxed",children:["This will permanently delete the role directory including",o.jsx("strong",{children:" role.yaml"}),", ",o.jsx("strong",{children:"profile.md"}),", ",o.jsx("strong",{children:"SKILL.md"}),", and all journal entries. This action cannot be undone."]})]}),o.jsxs("div",{className:"text-sm text-gray-600",children:["Are you sure you want to fire ",o.jsx("strong",{children:l}),"?"]})]}),o.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[o.jsx("button",{onClick:r,className:"px-4 py-2 text-sm rounded-lg border border-gray-300 hover:bg-gray-50 cursor-pointer",children:"Cancel"}),o.jsx("button",{onClick:f,disabled:c,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#B71C1C"},children:c?"Removing...":"Confirm Fire"})]})]})]})}const kC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function SC({roleId:t,title:l,roleColor:r,active:i,onClick:c,onClose:u,"data-session-id":f}){return o.jsxs("button",{onClick:c,"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 ${r}`}:void 0,children:[o.jsx("span",{className:"text-xs",children:kC[t]??"👤"}),o.jsx("span",{className:"truncate",children:l}),o.jsx("span",{onClick:u,className:"ml-auto text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none",children:"×"})]})}function jC({content:t,streaming:l}){let r=t;return l&&(t.match(/```/g)??[]).length%2!==0&&(r+="\n```"),o.jsx("div",{className:"terminal-markdown",children:o.jsx(Ay,{remarkPlugins:[Jy],components:{code:CC,table:({children:i})=>o.jsx("div",{className:"overflow-x-auto my-2",children:o.jsx("table",{className:"terminal-table",children:i})})},children:r})})}function CC({className:t,children:l,...r}){const i=/language-(\w+)/.exec(t??"");return i||typeof l=="string"&&l.includes(`
87
+ `)?o.jsx(EC,{language:i==null?void 0:i[1],children:l}):o.jsx("code",{className:"terminal-inline-code",...r,children:l})}function EC({children:t,language:l}){const[r,i]=k.useState(!1),c=String(t).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(c),i(!0),setTimeout(()=>i(!1),1500)};return o.jsxs("div",{className:"terminal-code-block group relative my-2",children:[l&&o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] px-3 pt-1.5",children:l}),o.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:r?"Copied!":"Copy"}),o.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:o.jsx("code",{children:c})})]})}const NC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function Cd(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 AC(t){const l=[];let r="";for(const i of t)if(i.type==="thinking")i.text&&(r=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:Cd(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 c=l.length>0?l[l.length-1]:null;(c==null?void 0:c.type)==="dispatch:progress"&&c.roleId===i.roleId?i.progressType==="tool"?(c.toolName=i.toolName,c.toolSummary=Cd(i.toolName??"",i.toolInput),c.progressType="tool"):i.progressType==="thinking"?(c.text=i.text,c.progressType="thinking"):i.progressType==="text"?(c.text=i.text,c.progressType="text"):(i.progressType==="done"||i.progressType==="error")&&(c.progressType=i.progressType):l.push({type:"dispatch:progress",roleId:i.roleId,progressType:i.progressType,text:i.text,toolName:i.toolName,toolSummary:i.toolName?Cd(i.toolName,i.toolInput):void 0})}if(r){const i=l.filter(c=>c.type==="thinking");i.length>0&&(i[i.length-1].text=r)}return l}function TC({event:t,isStreaming:l}){var c,u,f;const[r,i]=k.useState(!1);switch(t.type){case"thinking":return o.jsxs("div",{className:"stream-event-thinking",children:[o.jsxs("div",{className:"stream-event-thinking-header",onClick:()=>i(!r),children:[o.jsx("span",{className:"stream-event-thinking-icon"}),o.jsxs("span",{className:"stream-event-thinking-label",children:["thinking",l?"...":""]}),t.text&&!l&&o.jsx("span",{className:"stream-event-thinking-toggle",children:r?"▾":"▸"})]}),(l||r)&&t.text&&o.jsx("div",{className:"stream-event-thinking-content",children:t.text.slice(-500)})]});case"tool":return o.jsxs("div",{className:"stream-event-tool",children:[o.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&o.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary}),t.toolInput&&o.jsx("span",{className:"stream-event-tool-toggle",onClick:()=>i(!r),children:r?"▾":"▸"}),r&&t.toolInput&&o.jsx("div",{className:"stream-event-tool-detail",children:JSON.stringify(t.toolInput,null,1).slice(0,300)})]});case"dispatch":return o.jsxs("div",{className:"stream-event-dispatch",children:[o.jsxs("span",{className:"stream-event-dispatch-badge",children:["→"," ",(c=t.roleId)==null?void 0:c.toUpperCase()]}),o.jsx("span",{className:"stream-event-dispatch-task",children:(u=t.task)==null?void 0:u.slice(0,80)})]});case"dispatch:progress":return o.jsxs("div",{className:"stream-event-dispatch-progress",children:[o.jsx("span",{className:"stream-event-dispatch-progress-role",children:(f=t.roleId)==null?void 0:f.toUpperCase()}),t.progressType==="thinking"&&o.jsxs("span",{className:"stream-event-dispatch-progress-status",children:["thinking",l?"...":""]}),t.progressType==="tool"&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&o.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary})]}),t.progressType==="text"&&t.text&&o.jsx("span",{className:"stream-event-dispatch-progress-status",children:"responding..."}),t.progressType==="done"&&o.jsx("span",{className:"stream-event-dispatch-progress-done",children:"done"}),t.progressType==="error"&&o.jsx("span",{className:"stream-event-dispatch-progress-error",children:"error"})]});default:return null}}function DC({events:t,isStreaming:l}){const[r,i]=k.useState(!1);if(t.length===0)return null;const c=AC(t);if(c.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"),x=t.filter(b=>b.type==="turn").reduce((b,v)=>Math.max(b,v.turn??0),0),d=[];if(u>0&&d.push("thinking"),f.length>0){const b=[...new Set(f.map(v=>v.toolName))];b.length<=3?d.push(b.join(", ")):d.push(`${f.length} tool calls`)}m.length>0&&d.push(`${m.length} dispatch`),x>1&&d.push(`${x} turns`);const g=d.join(" · "),y=!r;return o.jsxs("div",{className:"stream-activity-log",children:[o.jsxs("div",{className:"stream-activity-header",onClick:()=>i(!r),children:[l&&o.jsx("span",{className:"stream-activity-pulse"}),o.jsxs("span",{className:"stream-activity-summary",children:[r?"▸":"▾"," ",g,l?"...":""]})]}),y&&o.jsx("div",{className:"stream-activity-events",children:c.map((b,v)=>o.jsx(TC,{event:b,isStreaming:l&&v===c.length-1},v))})]})}function zC({message:t,roleId:l,roleColor:r}){var d;const i=t.from==="ceo",c=t.type==="system",u=t.status==="streaming";if(c)return o.jsx("div",{className:"flex justify-center my-2",children:o.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 o.jsx("div",{className:"flex justify-end mb-3",children:o.jsxs("div",{className:"max-w-[85%]",children:[o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] text-right mb-1",children:"CEO"}),o.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"&&o.jsx("span",{className:"text-amber-400 text-[10px] font-bold mr-1.5",children:"DO"}),t.content]})]})});const f=(((d=t.streamEvents)==null?void 0:d.length)??0)>0,m=!!t.thinking,x=m&&!t.content&&u&&!f;return o.jsxs("div",{className:"flex gap-2.5 mb-3",children:[o.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center text-sm shrink-0 mt-5",style:{background:`${r}33`},children:NC[l]??"👤"}),o.jsxs("div",{className:"max-w-[85%] min-w-0",children:[o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] mb-1",children:l.toUpperCase()}),f&&o.jsx(DC,{events:t.streamEvents,isStreaming:u}),m&&!f&&o.jsxs("details",{open:x,className:"mb-1",children:[o.jsxs("summary",{className:"text-[10px] text-purple-400/70 cursor-pointer select-none flex items-center gap-1",children:[x&&o.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-purple-400 animate-pulse"}),"thinking",x?"...":` (${t.thinking.length} chars)`]}),o.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)})]}),o.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 ${r}`,background:"var(--terminal-surface)"},children:[t.content?o.jsx(jC,{content:t.content,streaming:u}):u&&!m?o.jsx("span",{className:"inline-block w-2 h-4 bg-[var(--terminal-text-secondary)] animate-pulse"}):u&&m?o.jsx("span",{className:"text-[11px] text-purple-400/50 italic",children:"analyzing..."}):null,u&&t.content&&o.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"&&o.jsx("div",{className:"text-[10px] text-red-400 mt-1",children:"Error occurred"})]})]})}function MC({messages:t,roleId:l,roleColor:r}){var c;const i=k.useRef(null);return k.useEffect(()=>{var u;(u=i.current)==null||u.scrollIntoView({behavior:"smooth"})},[t,(c=t[t.length-1])==null?void 0:c.content]),t.length===0?o.jsxs("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:["Start a conversation with ",l.toUpperCase()]}):o.jsxs("div",{className:"flex-1 overflow-y-auto p-4 terminal-scrollbar",children:[t.map(u=>o.jsx(zC,{message:u,roleId:l,roleColor:r},u.id)),o.jsx("div",{ref:i})]})}function RC({mode:t,onModeChange:l,onSend:r,disabled:i,disabledReason:c}){const[u,f]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{const g=m.current;g&&(g.style.height="0",g.style.height=Math.min(g.scrollHeight,120)+"px")},[u]);const x=()=>{const g=u.trim();!g||i||(r(g),f(""))},d=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),x())};return o.jsxs("div",{className:"border-t border-[var(--terminal-border)] p-3 shrink-0",children:[c&&o.jsx("div",{className:"text-[10px] text-amber-400/70 mb-2 text-center",children:c}),o.jsxs("div",{className:"flex items-end gap-2",children:[o.jsxs("div",{className:"flex rounded-lg overflow-hidden border border-[var(--terminal-border)] shrink-0",children:[o.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"}),o.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"})]}),o.jsx("textarea",{ref:m,value:u,onChange:g=>f(g.target.value),onKeyDown:d,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"}),o.jsx("button",{onClick:x,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:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M22 2L11 13"}),o.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})]})}const FC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},kg={cto:"CTO",cbo:"CBO",pm:"PM",engineer:"Engineer",designer:"Designer",qa:"QA","data-analyst":"Data Analyst"};function S0(t){return new Date(t).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit"})}function _C({msg:t}){const l=FC[t.roleId]??"#888",r=kg[t.roleId]??t.roleId;if(t.type==="dispatch"){const i=t.text.includes("WAVE"),c=t.text.includes("completed")||t.text.includes("완료"),u=i?"📡":c?"✓":"→",f=c?"text-green-400/70":"text-[var(--terminal-text-muted)]";return o.jsxs("div",{className:"flex items-start gap-2 px-3 py-1 hover:bg-white/[0.02]",children:[o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:S0(t.ts)}),o.jsx("span",{className:"text-[10px] shrink-0 mt-0.5",children:u}),o.jsx("span",{className:`text-[11px] ${f}`,children:t.text})]})}return o.jsxs("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-white/[0.02]",children:[o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:S0(t.ts)}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-[11px] font-semibold mr-1.5",style:{color:l},children:r}),o.jsx("span",{className:"text-xs text-[var(--terminal-text-secondary)]",children:t.text})]})]})}function OC({channel:t,allRoles:l,onUpdateMembers:r,onUpdateTopic:i}){const c=k.useRef(null),u=k.useRef(null);k.useEffect(()=>{var j;const b=u.current;if(!b)return;b.scrollHeight-b.scrollTop-b.clientHeight<80&&((j=c.current)==null||j.scrollIntoView({behavior:"smooth"}))},[t.messages.length]);const[f,m]=k.useState(!1),[x,d]=k.useState(!1),[g,y]=k.useState("");return o.jsxs("div",{ref:u,className:"flex-1 overflow-y-auto terminal-scrollbar py-2",children:[o.jsxs("div",{className:"px-3 py-2 mb-2 border-b border-[var(--terminal-border)] flex items-center gap-2",children:[o.jsx("span",{className:"text-sm font-semibold text-[var(--terminal-text)]",children:t.name}),t.members.length>0&&o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.members.map(b=>kg[b]??b).join(", ")}),t.members.length===0&&o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.isDefault?"system logs":"no members"}),!t.isDefault&&l&&r&&o.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&&o.jsx("div",{className:"px-3 pb-2 mb-1",children:x?o.jsx("input",{autoFocus:!0,value:g,onChange:b=>y(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(i(t.id,g.trim()),d(!1)),b.key==="Escape"&&d(!1)},onBlur:()=>{i(t.id,g.trim()),d(!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"}):o.jsx("button",{onClick:()=>{y(t.topic??""),d(!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&&r&&o.jsx("div",{className:"px-3 pb-2 mb-2 border-b border-[var(--terminal-border)]",children:o.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(b=>{const v=t.members.includes(b.id);return o.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(S=>S!==b.id):[...t.members,b.id];r(t.id,j)},children:[v?"✓ ":"",b.name]},b.id)})})}),t.messages.length===0&&o.jsx("div",{className:"flex-1 flex flex-col items-center justify-center text-[var(--terminal-text-muted)] text-xs gap-1 py-8",children:o.jsx("span",{children:t.isDefault?"No dispatch events yet":"No messages yet — invite roles to start chatting"})}),t.messages.map(b=>o.jsx(_C,{msg:b},b.id)),o.jsx("div",{ref:c})]})}const Ed={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},BC=400,LC=800;function $C({sessions:t,activeSessionId:l,roles:r,streamingSessionId:i,width:c,onWidthChange:u,onSwitchSession:f,onCloseSession:m,onCreateSession:x,onClearEmpty:d,onCloseAll:g,onSendMessage:y,onModeChange:b,onCloseTerminal:v,chatChannels:j,activeChatChannelId:S,onSwitchChatChannel:C,onCreateChatChannel:E,onDeleteChatChannel:A,onUpdateChatMembers:M,onUpdateChatTopic:O,unreadChannels:L}){const[F,I]=k.useState(!1),[$,ee]=k.useState(!1),[z,X]=k.useState(!1),[R,W]=k.useState(""),te=S!=null,V=j==null?void 0:j.find(ke=>ke.id===S),[Y,Z]=k.useState(!1),[ce,we]=k.useState(!1),[D,B]=k.useState(!1),Q=k.useRef(0),T=k.useRef(0),me=k.useRef(null),Se=t.find(ke=>ke.id===l),Ee=i===l,Be=t.filter(ke=>ke.messages.length===0).length,He=k.useCallback(()=>{const ke=me.current;ke&&(we(ke.scrollLeft>0),B(ke.scrollLeft+ke.clientWidth<ke.scrollWidth-1))},[]);k.useEffect(()=>{if(!l||!me.current)return;const ke=me.current.querySelector(`[data-session-id="${l}"]`);ke&&ke.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),He()},[l,t.length,He]),k.useEffect(()=>{const ke=me.current;if(!ke)return;He(),ke.addEventListener("scroll",He);const yt=new ResizeObserver(He);return yt.observe(ke),()=>{ke.removeEventListener("scroll",He),yt.disconnect()}},[He]);const Ke=k.useCallback(ke=>{ke.preventDefault(),Q.current=ke.clientX,T.current=c,Z(!0);const yt=G=>{const re=Q.current-G.clientX,ve=Math.min(LC,Math.max(BC,T.current+re));u==null||u(ve)},de=()=>{Z(!1),document.removeEventListener("mousemove",yt),document.removeEventListener("mouseup",de)};document.addEventListener("mousemove",yt),document.addEventListener("mouseup",de)},[c,u]);return o.jsxs("div",{className:"shrink-0 bg-[var(--terminal-bg)] border-l border-[var(--terminal-border)] flex flex-col h-full relative",style:{width:c},children:[u&&o.jsx("div",{className:`terminal-resize-handle absolute top-0 left-0 w-1 h-full cursor-col-resize z-10 transition-colors ${Y?"bg-[var(--terminal-border-hover)]":"bg-transparent"}`,onMouseDown:Ke}),o.jsxs("div",{className:"flex items-center bg-[var(--terminal-bg-deeper)] border-b border-[var(--terminal-border)] shrink-0",children:[o.jsxs("div",{className:"relative flex-1 min-w-0",children:[ce&&o.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"}),o.jsxs("div",{ref:me,className:"flex items-center overflow-x-auto terminal-tab-scroll gap-px px-1 py-1",children:[j==null?void 0:j.map(ke=>o.jsxs("button",{onClick:()=>{C==null||C(ke.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 ${S===ke.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:S===ke.id?{borderTop:"2px solid #4CAF50"}:void 0,children:[o.jsx("span",{className:"text-[10px]",children:"💬"}),o.jsx("span",{className:"truncate",children:ke.name}),(L==null?void 0:L.has(ke.id))&&S!==ke.id&&o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 shrink-0"}),!ke.isDefault&&o.jsx("span",{onClick:yt=>{yt.stopPropagation(),A==null||A(ke.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:"×"})]},ke.id)),j&&j.length>0&&t.length>0&&o.jsx("div",{className:"w-px h-4 bg-[var(--terminal-border)] shrink-0 mx-1"}),t.map(ke=>o.jsx(SC,{roleId:ke.roleId,title:ke.title,roleColor:Ed[ke.roleId]??"#666",active:!te&&ke.id===l,onClick:()=>{C==null||C(null),f(ke.id)},onClose:yt=>{yt.stopPropagation(),m(ke.id)},"data-session-id":ke.id},ke.id))]}),D&&o.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"})]}),o.jsxs("div",{className:"relative shrink-0",children:[o.jsx("button",{onClick:()=>{I(!F),ee(!1)},className:"w-7 h-7 flex items-center justify-center text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-lg cursor-pointer",children:"+"}),F&&o.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&&o.jsxs(o.Fragment,{children:[z?o.jsxs("div",{className:"px-3 py-2 flex items-center gap-1",children:[o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:"#"}),o.jsx("input",{autoFocus:!0,value:R,onChange:ke=>W(ke.target.value),onKeyDown:ke=>{ke.key==="Enter"&&R.trim()&&(E(R.trim(),[]),W(""),X(!1),I(!1)),ke.key==="Escape"&&(X(!1),W(""))},placeholder:"channel name",className:"flex-1 bg-transparent text-xs text-[var(--terminal-text)] outline-none border-b border-[var(--terminal-border)]"})]}):o.jsxs("button",{onClick:()=>X(!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:[o.jsx("span",{className:"text-[10px]",children:"💬"}),"New Channel"]}),o.jsx("div",{className:"border-b border-[var(--terminal-border)] my-1"})]}),r.map(ke=>o.jsxs("button",{onClick:()=>{x(ke.id),C==null||C(null),I(!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:[o.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:Ed[ke.id]??"#666"}}),ke.id.toUpperCase()," — ",ke.name]},ke.id))]})]}),o.jsxs("div",{className:"relative shrink-0",children:[o.jsx("button",{onClick:()=>{ee(!$),I(!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:"···"}),$&&o.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:[o.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":""]}),Be>0&&d&&o.jsxs("button",{onClick:()=>{d(),ee(!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 (",Be,")"]}),t.length>0&&g&&o.jsx("button",{onClick:()=>{g(),ee(!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&&o.jsx("div",{className:"px-3 py-2 text-xs text-[var(--terminal-text-muted)]",children:"No sessions"})]})]}),o.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:"×"})]}),te&&V?o.jsx(OC,{channel:V,allRoles:r,onUpdateMembers:M,onUpdateTopic:O}):Se?o.jsxs(o.Fragment,{children:[o.jsx(MC,{messages:Se.messages,roleId:Se.roleId,roleColor:Ed[Se.roleId]??"#666"}),o.jsx(RC,{mode:Se.mode,onModeChange:ke=>b(Se.id,ke),onSend:ke=>y(Se.id,ke,Se.mode),disabled:Ee,disabledReason:Ee?`${Se.roleId.toUpperCase()} is responding...`:void 0})]}):o.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 HC(){const t=k.useRef(null),l=k.useCallback(()=>{var i;(i=t.current)==null||i.abort(),t.current=null},[]);return{sendMessage:k.useCallback((i,c,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:c,mode:u}),signal:m.signal}).then(async x=>{var b,v,j,S,C;if(!x.ok||!x.body){f.onError("Failed to connect");return}const d=x.body.getReader(),g=new TextDecoder;let y="";for(;;){const{done:E,value:A}=await d.read();if(E)break;y+=g.decode(A,{stream:!0});const M=y.split(`
88
+ `);y=M.pop()??"";let O="";for(let L=0;L<M.length;L++){const F=M[L];if(F.startsWith("event: ")){O=F.slice(7).trim();continue}if(F.startsWith("data: ")){let I;try{I=JSON.parse(F.slice(6))}catch{O="";continue}switch(O){case"thinking":I.text&&((b=f.onThinking)==null||b.call(f,I.text));break;case"output":I.text&&f.onText(I.text);break;case"tool":(v=f.onToolUse)==null||v.call(f,I.name,I.input);break;case"dispatch":(j=f.onDispatch)==null||j.call(f,I.roleId,I.task);break;case"dispatch:progress":(S=f.onDispatchProgress)==null||S.call(f,I.roleId,I.type,I);break;case"turn":(C=f.onTurn)==null||C.call(f,I.turn);break;case"done":f.onDone(I);break;case"error":f.onError(I.message??"Unknown error");break;default:I.text&&f.onText(I.text);break}O=""}}}}).catch(x=>{x.name!=="AbortError"&&f.onError(x.message)}),{abort:l}},[l]),abort:l}}const Nh="tycono-appearances",Rc="tycono-theme";(()=>{try{for(const[t,l]of[["the-company-appearances",Nh],["the-company-theme",Rc]]){const r=localStorage.getItem(t);r&&!localStorage.getItem(l)&&(localStorage.setItem(l,r),localStorage.removeItem(t))}}catch{}})();function j0(){try{const t=localStorage.getItem(Nh);return t?JSON.parse(t):{}}catch{return{}}}function Nd(t){localStorage.setItem(Nh,JSON.stringify(t))}function C0(){try{const t=localStorage.getItem(Rc);if(t&&t in Hr)return t}catch{}return"default"}function UC(t){var i;const l=(i=Hr[t])==null?void 0:i.vars;if(!l)return;const r=document.documentElement;for(const[c,u]of Object.entries(l))r.style.setProperty(c,u)}const Ad={mode:"auto",intervalSec:18,dailyBudgetUsd:1},Pd="tycono-speech-settings",Td="tycono-language";function IC(){try{const t=localStorage.getItem(Pd);return t?{...Ad,...JSON.parse(t)}:Ad}catch{return Ad}}function YC(){const[t,l]=k.useState(j0),[r,i]=k.useState(C0),[c,u]=k.useState(IC),[f,m]=k.useState(()=>{try{return localStorage.getItem(Td)??"auto"}catch{return"auto"}}),x=k.useRef(!1);k.useEffect(()=>{x.current||(x.current=!0,Ce.getPreferences().then(S=>{const C=Object.keys(S.appearances??{}).length>0||S.theme!=="default";if(S.speech&&(u(E=>({...E,...S.speech})),localStorage.setItem(Pd,JSON.stringify(S.speech))),S.language&&(m(S.language),localStorage.setItem(Td,S.language)),C){const E=S.appearances;l(E),Nd(E),S.theme&&S.theme in Hr&&(i(S.theme),localStorage.setItem(Rc,S.theme))}else{const E=j0(),A=C0();(Object.keys(E).length>0||A!=="default")&&Ce.updatePreferences({appearances:E,theme:A}).catch(()=>{})}}).catch(()=>{}))},[]),k.useEffect(()=>{UC(r)},[r]);const d=k.useCallback(S=>t[S]??Eh(S),[t]),g=k.useCallback((S,C)=>{l(E=>{const A={...E,[S]:C};return Nd(A),Ce.updatePreferences({appearances:A}).catch(()=>{}),A})},[]),y=k.useCallback(S=>{l(C=>{const E={...C};return delete E[S],Nd(E),Ce.updatePreferences({appearances:E}).catch(()=>{}),E})},[]),b=k.useCallback(S=>{i(S),localStorage.setItem(Rc,S),Ce.updatePreferences({theme:S}).catch(()=>{})},[]),v=k.useCallback(S=>{u(C=>{const E={...C,...S};return localStorage.setItem(Pd,JSON.stringify(E)),Ce.updatePreferences({speech:E}).catch(()=>{}),E})},[]),j=k.useCallback(S=>{m(S),localStorage.setItem(Td,S),Ce.updatePreferences({language:S}).catch(()=>{})},[]);return{appearances:t,getAppearance:d,setAppearance:g,resetAppearance:y,theme:r,setTheme:b,speechSettings:c,setSpeechSettings:v,language:f,setLanguage:j}}const qC=3e4;function XC(){var j;const[t,l]=k.useState(null),[r,i]=k.useState("synced"),[c,u]=k.useState([]),f=k.useRef(null),m=k.useCallback(async()=>{try{const S=await Ce.getSaveStatus();l(S),S.noGit?i("no-git"):i(C=>C==="saving"?C:S.dirty?"dirty":"synced")}catch{i("error")}},[]);k.useEffect(()=>(m(),f.current=setInterval(m,qC),()=>{f.current&&clearInterval(f.current)}),[m]);const x=k.useCallback(async S=>{i("saving");try{const C=await Ce.save(S);return await m(),C}catch(C){throw i("error"),C}},[m]),d=k.useCallback(async()=>{try{const S=await Ce.getSaveHistory(20);u(S)}catch{}},[]),g=k.useCallback(async S=>{i("saving");try{await Ce.restoreSave(S),await m()}catch(C){throw i("error"),C}},[m]),y=k.useCallback(async()=>{try{await Ce.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:r,dirtyCount:b,lastSaved:v,status:t,save:x,history:c,loadHistory:d,restore:g,refresh:m,initGit:y}}const E0={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."]},N0={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."]},VC=[{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."}]}],GC=18e3,A0=6e3,KC=2500,QC=30*6e4,Sg="tycono:relationships";function WC(){try{const t=localStorage.getItem(Sg);return t?JSON.parse(t):[]}catch{return[]}}function ZC(t){localStorage.setItem(Sg,JSON.stringify(t))}function uc(t,l,r){const[i,c]=l<r?[l,r]:[r,l];let u=t.find(f=>f.roleA===i&&f.roleB===c);return u||(u={roleA:i,roleB:c,dispatches:0,wavesTogether:0,conversations:0,familiarity:0,lastInteraction:new Date().toISOString()},t.push(u)),u}function fc(t){return Math.min(100,t.dispatches*5+t.wavesTogether*10+t.conversations*2)}function dc(t){return t[Math.floor(Math.random()*t.length)]}function JC(t,l,r){const i=r.find(m=>m.id===t),c=r.find(m=>m.id===l);if(!i||!c)return null;const u=i.level==="c-level",f=c.level==="c-level";return u&&f?"c-level":i.reportsTo===l||c.reportsTo===t?"superior-subordinate":(i.reportsTo===c.reportsTo,"peer")}function PC(t,l){return t.relation==="any"?!0:t.relation===l}function eE({roles:t,roleStatuses:l,activeExecs:r,getStandupSpeech:i}){const[c,u]=k.useState(new Map),[f,m]=k.useState(WC),x=k.useRef({}),d=k.useRef(null),g=k.useRef(t),y=k.useRef(l),b=k.useRef(r),v=k.useRef(i),j=k.useRef(f);g.current=t,y.current=l,b.current=r,v.current=i,j.current=f,k.useEffect(()=>{const O=Date.now();for(const[L,F]of Object.entries(l))F==="working"&&(x.current[L]=O)},[l]),k.useEffect(()=>{ZC(f)},[f]);const S=k.useCallback(O=>{const L=y.current[O],F=b.current.find(X=>X.roleId===O);if(L==="working"&&(F!=null&&F.task))return null;const I=v.current(O);if(I&&Math.random()<.3)return{text:I,type:"work",ts:Date.now()};const $=Date.now(),ee=x.current[O]??0;if($-ee>QC&&Math.random()<.5){const X=N0[O]??N0.engineer;return{text:dc(X),type:"guilt",ts:$}}const z=E0[O]??E0.engineer;return{text:dc(z),type:"personality",ts:$}},[]),C=k.useCallback(O=>{if(d.current)return!1;const L=O.filter(Z=>y.current[Z.id]!=="working");if(L.length<2)return!1;const F=[...L].sort(()=>Math.random()-.5),I=F[0],$=F[1],ee=JC(I.id,$.id,O);if(!ee)return!1;const z=uc(j.current,I.id,$.id),X=fc(z),R=VC.filter(Z=>PC(Z,ee)&&X>=Z.minFamiliarity);if(R.length===0)return!1;const W=dc(R);let te=I.id,V=$.id;W.relation==="superior-subordinate"&&($.reportsTo===I.id||I.level==="c-level"?(te=I.id,V=$.id):(te=$.id,V=I.id)),d.current={templateId:W.id,roleA:te,roleB:V,turnIdx:0,timer:null};const Y=Z=>{if(!d.current||Z>=W.turns.length){d.current=null,m(B=>{const Q=[...B],T=uc(Q,te,V);return T.conversations++,T.familiarity=fc(T),T.lastInteraction=new Date().toISOString(),Q}),setTimeout(()=>{u(B=>{const Q=new Map(B);return Q.delete(te),Q.delete(V),Q})},A0);return}const ce=W.turns[Z],we=ce.speaker==="A"?te:V,D=ce.speaker==="A"?V:te;u(B=>{const Q=new Map(B);if(Q.set(we,{text:ce.text,type:"social",partnerId:D,ts:Date.now()}),Z>0){const T=W.turns[Z-1].speaker==="A"?te:V;T!==we&&Q.delete(T)}return Q}),d.current.turnIdx=Z,d.current.timer=setTimeout(()=>Y(Z+1),KC)};return Y(0),!0},[]);k.useEffect(()=>{const O=setInterval(()=>{const L=g.current;if(L.length===0||d.current||Math.random()<.35&&C(L))return;const F=L.filter(ee=>y.current[ee.id]!=="working");if(F.length===0)return;const I=dc(F),$=S(I.id);$&&(u(ee=>{const z=new Map(ee);return z.set(I.id,$),z}),setTimeout(()=>{u(ee=>{const z=new Map(ee),X=z.get(I.id);return X&&X.ts===$.ts&&z.delete(I.id),z})},A0))},GC);return()=>{var L;clearInterval(O),(L=d.current)!=null&&L.timer&&clearTimeout(d.current.timer)}},[S,C]);const E=k.useCallback(O=>{const L=c.get(O);return(L==null?void 0:L.text)??""},[c]),A=k.useCallback((O,L)=>{m(F=>{const I=[...F],$=uc(I,O,L);return $.dispatches++,$.familiarity=fc($),$.lastInteraction=new Date().toISOString(),I})},[]),M=k.useCallback(O=>{O.length<2||m(L=>{const F=[...L];for(let I=0;I<O.length;I++)for(let $=I+1;$<O.length;$++){const ee=uc(F,O[I],O[$]);ee.wavesTogether++,ee.familiarity=fc(ee),ee.lastInteraction=new Date().toISOString()}return F})},[]);return{speeches:c,getSpeech:E,relationships:f,notifyDispatch:A,notifyWave:M}}const jg="tycono:office-chat";let tE=0;function nE(){return`chat-${Date.now()}-${++tE}`}function Dd(){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 lE(){try{const t=localStorage.getItem(jg);if(t){const l=JSON.parse(t);if(l.find(i=>i.id==="office")&&!l.find(i=>i.id==="general")){const i=l.filter(c=>c.id!=="office");return[...Dd(),...i]}const r=Dd();for(const i of r)l.find(c=>c.id===i.id)||l.unshift(i);return l}}catch{}return Dd()}function rE(t){const l=t.map(r=>({...r,messages:r.messages.slice(-200)}));localStorage.setItem(jg,JSON.stringify(l))}function aE(){const[t,l]=k.useState(lE),[r,i]=k.useState(null),[c,u]=k.useState(new Set);k.useEffect(()=>{rE(t)},[t]);const f=k.useCallback(v=>{i(v),v&&u(j=>{const S=new Set(j);return S.delete(v),S})},[]),m=k.useCallback(v=>{const j={...v,id:nE()};l(S=>{const C=S.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 A=new Set(E);for(const M of C){const O=S.find(L=>L.id===M.id);O&&M.messages.length>O.messages.length&&A.add(M.id)}return A}),C})},[]),x=k.useCallback((v,j,S)=>{const C=`ch-${Date.now()}`,E={id:C,name:v.startsWith("#")?v:`#${v}`,members:j,isDefault:!1,messages:[],topic:S};l(A=>[...A,E]),i(C)},[]),d=k.useCallback(v=>{l(j=>j.filter(S=>S.id!==v||S.isDefault)),i(j=>j===v?"general":j)},[]),g=k.useCallback((v,j)=>{l(S=>S.map(C=>C.id===v&&!C.isDefault?{...C,members:j}:C))},[]),y=k.useCallback((v,j)=>{l(S=>S.map(C=>C.id===v&&!C.isDefault?{...C,topic:j||void 0}:C))},[]),b=k.useCallback(v=>{l(j=>j.map(S=>{if(S.id==="watercooler"){const C=v.filter(E=>E.level!=="c-level").map(E=>E.id);if(S.members.length!==C.length||!C.every(E=>S.members.includes(E)))return{...S,members:C}}return S}))},[]);return{channels:t,activeChannelId:r,setActiveChannelId:f,pushMessage:m,createChannel:x,deleteChannel:d,updateMembers:g,updateTopic:y,unreadChannels:c,syncDefaultMembers:b}}const iE=45e3,sE=3e3,oE=3,cE=20;function uE({roles:t,roleStatuses:l,activeExecs:r,channels:i,relationships:c,pushMessage:u,speechSettings:f,engineType:m,hasApiKey:x}){const g=((f==null?void 0:f.mode)==="auto"?m==="claude-cli"||m==="local"?"llm":"template":(f==null?void 0:f.mode)??"template")==="llm"&&(x!==!1||m==="claude-cli"),y=((f==null?void 0:f.intervalSec)??iE/1e3)*1e3,b=k.useRef(t),v=k.useRef(l),j=k.useRef(r),S=k.useRef(i),C=k.useRef(c),E=k.useRef(u),A=k.useRef(0),M=k.useRef(!1);b.current=t,v.current=l,j.current=r,S.current=i,C.current=c,E.current=u;const O=k.useCallback(async(F,I)=>{if(M.current)return!1;M.current=!0;try{if(!b.current.find(V=>V.id===F))return!1;const ee=I.messages.slice(-cE).map(V=>({roleId:V.roleId,text:V.text,ts:V.ts})),z=b.current.filter(V=>I.members.includes(V.id)),X=C.current.filter(V=>V.roleA===F||V.roleB===F).map(V=>({partnerId:V.roleA===F?V.roleB:V.roleA,familiarity:V.familiarity})),R=j.current.find(V=>V.roleId===F),W=R?{currentTask:R.task,taskProgress:null}:{currentTask:null,taskProgress:null},te=await Ce.chatInChannel({channelId:I.name.replace("#",""),channelTopic:I.topic,roleId:F,history:ee,members:z.map(V=>({id:V.id,name:V.name,level:V.level})),relationships:X,workContext:W});return te.message?(E.current({ts:Date.now(),roleId:F,text:te.message,type:"chat",channelId:I.id}),!0):!1}catch{return!1}finally{M.current=!1}},[]),L=k.useCallback(async(F,I)=>{if(A.current>=oE){A.current=0;return}const $=F.members.filter(z=>z!==I&&v.current[z]!=="working");if($.length===0){A.current=0;return}const ee=$[Math.floor(Math.random()*$.length)];if(Math.random()>.6){A.current=0;return}setTimeout(async()=>{A.current++;const z=S.current.find(R=>R.id===F.id);if(!z)return;await O(ee,z)?L(z,ee):A.current=0},sE+Math.random()*2e3)},[O]);k.useEffect(()=>{if(!g)return;const F=setInterval(async()=>{const I=b.current;if(I.length===0||M.current)return;const $=I.filter(W=>v.current[W.id]!=="working");if($.length===0)return;const ee=$[Math.floor(Math.random()*$.length)],z=S.current.filter(W=>W.members.length===0?!0:W.members.includes(ee.id));if(z.length===0)return;const X=z[Math.floor(Math.random()*z.length)];A.current=0,await O(ee.id,X)&&L(X,ee.id)},y);return()=>clearInterval(F)},[g,y,O,L])}function hc({type:t,className:l}){const r=k.useRef(null),i=TS(t);return k.useEffect(()=>{const c=r.current;if(!c||!i)return;const u=c.getContext("2d");u&&zS(u,i)},[t,i]),i?o.jsx("canvas",{ref:r,width:i.canvasWidth,height:i.canvasHeight,className:l,style:{imageRendering:"pixelated",display:"block"}}):null}const Cg=[[1,8],[3,5],[8,1],[5,3]],fE=[[1,4],[2,3],[4,1],[3,2]];function mc(t){const l=t===1||t===3?-1:0,r=Cg[t],i=t<2?[0,1]:[1,0],c=l;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:r[0],y:13,w:3,h:4,c:"$pants"},{x:r[1],y:13,w:3,h:4,c:"$pants"},{x:r[0]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:r[1]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:r[0],y:16,w:3,h:2,c:"$shoes"},{x:r[1],y:16,w:3,h:2,c:"$shoes"},{x:r[0],y:16,w:3,h:1,c:"lighten($shoes, 25)",a:.4},{x:r[1],y:16,w:3,h:1,c:"lighten($shoes, 25)",a:.4},{x:1,y:c+8,w:10,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.35},{x:1,y:c+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:10,y:c+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:-1,y:c+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:c+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:-1,y:c+12,w:2,h:1,c:"$skin"},{x:11,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:1,y:c+0,w:10,h:7,c:"$skin"},{x:3,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:c+3,w:1,h:1,c:"#FFF",a:.4},{x:7,y:c+3,w:1,h:1,c:"#FFF",a:.4},{x:5,y:c+6,w:2,h:1,c:"darken($skin, 25)",a:.35},{x:0,y:c+3,w:1,h:1,c:"$skin"},{x:11,y:c+3,w:1,h:1,c:"$skin"},{x:1,y:c+0,w:10,h:3,c:"$hair"},{x:0,y:c+1,w:2,h:3,c:"$hair"},{x:10,y:c+1,w:2,h:3,c:"$hair"},{x:2,y:c+0,w:8,h:1,c:"lighten($hair, 25)",a:.3}]}function xc(t){const l=t===1||t===3?-1:0,r=Cg[t],i=t<2?[0,1]:[1,0],c=l;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:r[0],y:13,w:3,h:4,c:"$pants"},{x:r[1],y:13,w:3,h:4,c:"$pants"},{x:r[0],y:16,w:3,h:2,c:"$shoes"},{x:r[1],y:16,w:3,h:2,c:"$shoes"},{x:1,y:c+8,w:10,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:5,y:c+10,w:2,h:3,c:"darken($shirt, 30)",a:.12},{x:-1,y:c+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:c+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:1,y:c+0,w:10,h:7,c:"$skin"},{x:1,y:c+0,w:10,h:6,c:"$hair"},{x:0,y:c+1,w:2,h:5,c:"$hair"},{x:10,y:c+1,w:2,h:5,c:"$hair"},{x:2,y:c+0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:0,y:c+4,w:1,h:1,c:"$skin",a:.6},{x:11,y:c+4,w:1,h:1,c:"$skin",a:.6}]}function Or(t,l){const r=t===1||t===3?-1:0,i=fE[t],c=r,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:c+8,w:8,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:8,y:c+9+u,w:3,h:4-u,c:"$shirt"},{x:9,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:2,y:c+0,w:8,h:7,c:"$skin"},{x:7,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:c+3,w:1,h:1,c:"#FFF",a:.3},{x:9,y:c+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:c+0,w:8,h:3,c:"$hair"},{x:1,y:c+1,w:2,h:4,c:"$hair"},{x:9,y:c+1,w:2,h:3,c:"$hair"},{x:3,y:c+0,w:6,h:1,c:"lighten($hair, 25)",a:.25}]:[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:i[0],y:13,w:3,h:4,c:"$pants"},{x:i[1],y:13,w:3,h:4,c:"$pants"},{x:i[0],y:16,w:3,h:2,c:"$shoes"},{x:i[1],y:16,w:3,h:2,c:"$shoes"},{x:2,y:c+8,w:8,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:0,y:c+9+u,w:3,h:4-u,c:"$shirt"},{x:-1,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:2,y:c+0,w:8,h:7,c:"$skin"},{x:3,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:c+3,w:1,h:1,c:"#FFF",a:.3},{x:1,y:c+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:c+0,w:8,h:3,c:"$hair"},{x:1,y:c+1,w:2,h:3,c:"$hair"},{x:9,y:c+1,w:2,h:4,c:"$hair"},{x:3,y:c+0,w:6,h:1,c:"lighten($hair, 25)",a:.25}]}const T0={down:[mc(0),mc(1),mc(2),mc(3)],up:[xc(0),xc(1),xc(2),xc(3)],right:[Or(0,!0),Or(1,!0),Or(2,!0),Or(3,!0)],left:[Or(0,!1),Or(1,!1),Or(2,!1),Or(3,!1)]},qe=4,At=28,sn=2,ct=4,Pe=4,tr=[{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 Ah(t,l,r){const u=t.fy+Math.max(10,Math.floor(t.fh*.18)),f=Math.min(l,r),m=Math.ceil(l/f),x=[],d=f*28,g=t.fx+Math.max(8,Math.floor((t.fw-d)/2));for(let y=0;y<m&&x.length<l;y++){const b=Math.min(f,l-y*f);for(let v=0;v<b;v++)x.push({dx:g+v*28,dy:u+y*28,room:t.id})}return x}function dE(t){const i=tr[0],c={id:"main",wx:qe+Pe,wy:qe,ww:160-2*(qe+Pe),wh:At,fx:qe+Pe,fy:qe+At+sn,fw:160-2*(qe+Pe),fh:120-qe-At-sn-qe,...i},u=Ah(c,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*(qe+Pe))/2),offsetY:10}],m=[{id:"s-plant-l",type:"plant",room:"main",zone:"floor",offsetX:4,offsetY:4},{id:"s-plant-r",type:"plant",room:"main",zone:"floor",anchorX:"right",offsetX:-8,offsetY:4}];return{preset:"S",canvasW:160,canvasH:120,rooms:{main:c},desks:u,doors:{},adjacency:{main:[]},corridorY:{main:c.fy+c.fh-12},waypoints:{main:[{x:c.fx+10,y:c.fy+c.fh-14},{x:c.fx+c.fw/2,y:c.fy+c.fh-14},{x:c.fx+c.fw-10,y:c.fy+c.fh-14}]},wallDecorations:f,furniture:m}}function hE(t){const c={id:"exec",wx:qe+Pe,wy:qe,ww:144-qe-Pe-ct/2,wh:At,fx:qe+Pe,fy:qe+At+sn,fw:144-qe-Pe-ct/2,fh:66,...tr[0]},u={id:"work",wx:144+ct/2+Pe,wy:qe,ww:144-ct/2-Pe-qe,wh:At,fx:144+ct/2+Pe,fy:qe+At+sn,fw:144-ct/2-Pe-qe,fh:66,...tr[1]},f={id:"meet",wx:qe+Pe,wy:qe+At+sn+66+ct,ww:144-qe-Pe-ct/2,wh:At,fx:qe+Pe,fy:qe+At+sn+66+ct+At+sn,fw:144-qe-Pe-ct/2,fh:70,...tr[2]},m={id:"comm",wx:144+ct/2+Pe,wy:qe+At+sn+66+ct,ww:144-ct/2-Pe-qe,wh:At,fx:144+ct/2+Pe,fy:qe+At+sn+66+ct+At+sn,fw:144-ct/2-Pe-qe,fh:70,...tr[3]},x={exec:c,work:u,meet:f,comm:m},d=[];let g=t;const y=[[c,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[F,I]of[...y,...b])I>0&&d.push(...Ah(F,I,3));const j=qe+At+sn+66,S=144-ct/2,C={exec_work:{id:"exec_work",type:"v",doorY:qe+At+sn+20+12,xA:S-2,xB:u.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:qe+At+sn+66+ct+At+sn+20+12,xA:S-2,xB:m.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:qe+Pe+40+14,yA:j-2,yB:f.fy+2},work_comm:{id:"work_comm",type:"h",doorX:144+ct/2+Pe+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"}]},A={exec:c.fy+52,work:u.fy+48,meet:f.fy+56,comm:m.fy+42},M={exec:[{x:c.fx+6,y:c.fy+52},{x:c.fx+60,y:c.fy+54},{x:c.fx+112,y:c.fy+50},{x:c.fx+50,y:c.fy+52}],work:[{x:u.fx+14,y:u.fy+48},{x:u.fx+44,y:u.fy+48},{x:u.fx+70,y:u.fy+48},{x:u.fx+100,y:u.fy+48}],meet:[{x:f.fx+60,y:f.fy+56},{x:f.fx+30,y:f.fy+54},{x:f.fx+110,y:f.fy+50},{x:f.fx+80,y:f.fy+56}],comm:[{x:m.fx+96,y:m.fy+8},{x:m.fx+60,y:m.fy+42},{x:m.fx+40,y:m.fy+42},{x:m.fx+20,y:m.fy+42}]},O=[{id:"exec-window-1",type:"window",room:"exec",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"exec-picture-1",type:"picture",room:"exec",zone:"wall",offsetX:34,offsetY:8,pictureColor:"#1565C0",facility:{id:"theme",label:"THEME",icon:"🎨",color:"#42A5F5",hitW:12,hitH:10}},{id:"exec-picture-2",type:"picture",room:"exec",zone:"wall",offsetX:48,offsetY:8,pictureColor:"#E65100"},{id:"exec-clock",type:"clock",room:"exec",zone:"wall",offsetX:64,offsetY:10,facility:{id:"settings",label:"SETTINGS",icon:"⚙",color:"#78909C",hitW:10,hitH:10}},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:14,facility:{id:"stats",label:"STATS",icon:"📊",color:"#7E57C2",hitW:16,hitH:8}},{id:"exec-window-2",type:"window",room:"exec",zone:"wall",offsetX:104,offsetY:6,windowW:16,windowH:14},{id:"work-whiteboard",type:"whiteboard",room:"work",zone:"wall",offsetX:6,offsetY:4},{id:"work-window-1",type:"window",room:"work",zone:"wall",offsetX:50,offsetY:6,windowW:16,windowH:14},{id:"work-window-2",type:"window",room:"work",zone:"wall",offsetX:92,offsetY:6,windowW:16,windowH:14},{id:"meet-bulletin",type:"bulletin-board",room:"meet",zone:"wall",offsetX:6,offsetY:4,facility:{id:"bulletin",label:"BULLETIN",icon:"📋",color:"#F59E0B",hitW:22,hitH:16}},{id:"meet-picture",type:"picture",room:"meet",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#10B981"},{id:"meet-window",type:"window",room:"meet",zone:"wall",offsetX:80,offsetY:6,windowW:16,windowH:14},{id:"meet-shelf",type:"shelf",room:"meet",zone:"wall",offsetX:102,offsetY:18},{id:"comm-screen",type:"screen",room:"comm",zone:"wall",offsetX:6,offsetY:6,facility:{id:"decisions",label:"DECISIONS",icon:"📜",color:"#EF4444",hitW:16,hitH:12}},{id:"comm-picture",type:"picture",room:"comm",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#d4956a"},{id:"comm-window",type:"window",room:"comm",zone:"wall",offsetX:76,offsetY:6,windowW:16,windowH:14},{id:"comm-clock",type:"clock",room:"comm",zone:"wall",offsetX:98,offsetY:10},{id:"comm-shelf",type:"shelf",room:"comm",zone:"wall",offsetX:108,offsetY:18}],L=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(c.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"M",canvasW:288,canvasH:208,rooms:x,desks:d,doors:C,adjacency:E,corridorY:A,waypoints:M,wallDecorations:O,furniture:L}}function mE(t){const f={id:"exec",wx:qe+Pe,wy:qe,ww:180-qe-Pe-ct/2,wh:At,fx:qe+Pe,fy:qe+At+sn,fw:180-qe-Pe-ct/2,fh:82,...tr[0]},m={id:"work",wx:180+ct/2+Pe,wy:qe,ww:180-ct/2-Pe-qe,wh:At,fx:180+ct/2+Pe,fy:qe+At+sn,fw:180-ct/2-Pe-qe,fh:82,...tr[1]},x=qe+At+sn+82,d={id:"meet",wx:qe+Pe,wy:x+ct,ww:180-qe-Pe-ct/2,wh:At,fx:qe+Pe,fy:x+ct+At+sn,fw:180-qe-Pe-ct/2,fh:86,...tr[2]},g={id:"comm",wx:180+ct/2+Pe,wy:x+ct,ww:180-ct/2-Pe-qe,wh:At,fx:180+ct/2+Pe,fy:x+ct+At+sn,fw:180-ct/2-Pe-qe,fh:86,...tr[3]},y={exec:f,work:m,meet:d,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 S=[[d,0],[g,0]];let C=v-j[0][1]-j[1][1];C>0&&(S[0][1]=Math.min(3,C),C-=S[0][1]),C>0&&(S[1][1]=Math.min(3,C));for(const[$,ee]of[...j,...S])ee>0&&b.push(...Ah($,ee,4));const E=180-ct/2,A={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:d.fy+86/2,xA:E-2,xB:g.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:f.fx+54,yA:x-2,yB:d.fy+2},work_comm:{id:"work_comm",type:"h",doorX:m.fx+54,yA:x-2,yB:g.fy+2}},M={exec:[{room:"work",door:"exec_work",side:"A"},{room:"meet",door:"exec_meet",side:"A"}],work:[{room:"exec",door:"exec_work",side:"B"},{room:"comm",door:"work_comm",side:"A"}],meet:[{room:"exec",door:"exec_meet",side:"B"},{room:"comm",door:"meet_comm",side:"A"}],comm:[{room:"work",door:"work_comm",side:"B"},{room:"meet",door:"meet_comm",side:"B"}]},O={exec:f.fy+82-12,work:m.fy+82-12,meet:d.fy+86-12,comm:g.fy+86-12},L={exec:[{x:f.fx+10,y:O.exec},{x:f.fx+f.fw/2,y:O.exec},{x:f.fx+f.fw-10,y:O.exec}],work:[{x:m.fx+10,y:O.work},{x:m.fx+m.fw/2,y:O.work},{x:m.fx+m.fw-10,y:O.work}],meet:[{x:d.fx+10,y:O.meet},{x:d.fx+d.fw/2,y:O.meet},{x:d.fx+d.fw-10,y:O.meet}],comm:[{x:g.fx+10,y:O.comm},{x:g.fx+g.fw/2,y:O.comm},{x:g.fx+g.fw-10,y:O.comm}]},F=[{id:"exec-window-1",type:"window",room:"exec",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"exec-picture-1",type:"picture",room:"exec",zone:"wall",offsetX:34,offsetY:8,pictureColor:"#1565C0",facility:{id:"theme",label:"THEME",icon:"🎨",color:"#42A5F5",hitW:12,hitH:10}},{id:"exec-picture-2",type:"picture",room:"exec",zone:"wall",offsetX:48,offsetY:8,pictureColor:"#E65100"},{id:"exec-clock",type:"clock",room:"exec",zone:"wall",offsetX:64,offsetY:10,facility:{id:"settings",label:"SETTINGS",icon:"⚙",color:"#78909C",hitW:10,hitH:10}},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:14,facility:{id:"stats",label:"STATS",icon:"📊",color:"#7E57C2",hitW:16,hitH:8}},{id:"exec-window-2",type:"window",room:"exec",zone:"wall",offsetX:104,offsetY:6,windowW:16,windowH:14},{id:"work-whiteboard",type:"whiteboard",room:"work",zone:"wall",offsetX:6,offsetY:4},{id:"work-window-1",type:"window",room:"work",zone:"wall",offsetX:50,offsetY:6,windowW:16,windowH:14},{id:"work-window-2",type:"window",room:"work",zone:"wall",offsetX:92,offsetY:6,windowW:16,windowH:14},{id:"meet-bulletin",type:"bulletin-board",room:"meet",zone:"wall",offsetX:6,offsetY:4,facility:{id:"bulletin",label:"BULLETIN",icon:"📋",color:"#F59E0B",hitW:22,hitH:16}},{id:"meet-picture",type:"picture",room:"meet",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#10B981"},{id:"meet-window",type:"window",room:"meet",zone:"wall",offsetX:80,offsetY:6,windowW:16,windowH:14},{id:"meet-shelf",type:"shelf",room:"meet",zone:"wall",offsetX:102,offsetY:18},{id:"comm-screen",type:"screen",room:"comm",zone:"wall",offsetX:6,offsetY:6,facility:{id:"decisions",label:"DECISIONS",icon:"📜",color:"#EF4444",hitW:16,hitH:12}},{id:"comm-picture",type:"picture",room:"comm",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#d4956a"},{id:"comm-window",type:"window",room:"comm",zone:"wall",offsetX:76,offsetY:6,windowW:16,windowH:14},{id:"comm-clock",type:"clock",room:"comm",zone:"wall",offsetX:98,offsetY:10},{id:"comm-shelf",type:"shelf",room:"comm",zone:"wall",offsetX:108,offsetY:18}],I=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(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:A,adjacency:M,corridorY:O,waypoints:L,wallDecorations:F,furniture:I}}const xE=2;function Eg(t,l){return l?l==="L"&&t<=12-xE?"M":l==="M"&&t>12?"L":l:t<=12?"M":"L"}function Ng(t,l){switch(l??Eg(t)){case"S":return dE(t);case"M":return hE(t);case"L":return mE(t)}}function D0(t,l){if(!l||Object.keys(l).length===0)return t;const r=i=>i.map(c=>{const u=l[c.id];return u?{...c,offsetX:u.offsetX,offsetY:u.offsetY}:c});return{...t,wallDecorations:r(t.wallDecorations),furniture:r(t.furniture)}}function z0(t,l){if(l)for(const[r,i]of Object.entries(l))t[r]&&(t[r]={...t[r],dx:i.dx,dy:i.dy})}function zd(t,l){if(!l||l.length===0)return t;const r=new Set(l);return{...t,wallDecorations:t.wallDecorations.filter(i=>!r.has(i.id)),furniture:t.furniture.filter(i=>!r.has(i.id))}}function M0(t,l){if(!l||l.length===0)return t;const r=[],i=[];for(const c of l)c.zone==="wall"?r.push(c):i.push(c);return{...t,wallDecorations:[...t.wallDecorations,...r],furniture:[...t.furniture,...i]}}let Cs;function pE(t){Cs=t}function H(t,l,r,i,c,u){t=Math.round(t),l=Math.round(l),!(u!==void 0&&u<.01)&&(u!==void 0&&u!==1&&(Cs.globalAlpha=u),Cs.fillStyle=c,Cs.fillRect(t,l,r,i),u!==void 0&&u!==1&&(Cs.globalAlpha=1))}function et(t,l,r,i){H(t,l,1,1,r,i)}let kc=1;function hi(t){kc=t}function Cl(){return kc=kc*16807%2147483647,(kc&65535)/65535}function Ag(t){const l=parseInt(t.slice(1,3),16)/255,r=parseInt(t.slice(3,5),16)/255,i=parseInt(t.slice(5,7),16)/255,c=Math.max(l,r,i),u=Math.min(l,r,i);let f=0,m=0;const x=(c+u)/2;if(c!==u){const d=c-u;m=x>.5?d/(2-c-u):d/(c+u),c===l?f=((r-i)/d+(r<i?6:0))/6:c===r?f=((i-l)/d+2)/6:f=((l-r)/d+4)/6}return[f*360,m*100,x*100]}function Tg(t,l,r){t=(t%360+360)%360,l=Math.max(0,Math.min(100,l))/100,r=Math.max(0,Math.min(100,r))/100;const i=l*Math.min(r,1-r),c=f=>{const m=(f+t/30)%12;return r-i*Math.max(-1,Math.min(m-3,9-m,1))},u=f=>Math.round(f*255).toString(16).padStart(2,"0");return"#"+u(c(0))+u(c(8))+u(c(4))}function El(t,l=1){const[r,i,c]=Ag(t);return Tg(r+15*l,Math.min(100,i+8),c-12*l)}function Yt(t,l=1){const[r,i,c]=Ag(t);return Tg(r-10*l,i-3,c+10*l)}const an={hi:"#D4AA5C",base:"#B08040",sh:"#7A5038",deep:"#4E3028"},jl={hi:"#8A6848",base:"#604832",sh:"#3A2E24",deep:"#2A1E18"},wl={hi:"#5A6A80",base:"#485868",sh:"#364858",deep:"#283848"},Yr="#100A06";function yE(t,l,r=14,i=12){H(t,l,r,i,"#4A3828"),H(t+1,l+1,r-2,i-2,"#5A4838"),H(t+2,l+2,r-4,i-4,"#4A7098"),H(t+2,l+2,r-4,Math.floor((i-4)/2),"#6A90B8",.35);const c=Math.floor(r/2);H(t+c,l+1,1,i-2,"#4A3828"),H(t+1,l+Math.floor(i/2),r-2,1,"#4A3828",.5),et(t+3,l+3,"#8AB8E8",.35),et(t+c+2,l+3,"#8AB8E8",.25),H(t-1,l+i,r+2,2,"#5A4838"),H(t-1,l+i,r+2,1,Yt("#5A4838",.5),.35)}function gE(t,l,r){H(t,l,10,8,"#3A2818"),H(t+1,l+1,8,6,r),H(t+2,l+2,4,3,Yt(r,1.2),.3),et(t+3,l+2,Yt(r,2),.25)}function bE(t,l){H(t,l,7,7,"#3A2818"),H(t+1,l+1,5,5,"#F0EDE5"),et(t+3,l+1,"#AAA"),et(t+3,l+5,"#AAA"),et(t+1,l+3,"#AAA"),et(t+5,l+3,"#AAA"),et(t+3,l+3,"#222"),H(t+3,l+1,1,2,"#333"),et(t+4,l+3,"#D32F2F")}function vE(t,l){H(t,l,26,16,"#586878"),H(t+1,l+1,24,13,"#ECEFF1"),H(t+1,l+1,24,1,"#F5F5F5",.4),H(t+3,l+3,14,1,"#1565C0",.6),H(t+3,l+5,18,1,"#333",.2),H(t+3,l+7,12,1,"#D32F2F",.35),H(t+3,l+9,16,1,"#333",.15),H(t+1,l+14,24,2,"#708898"),H(t+3,l+14,3,1,"#D32F2F"),H(t+7,l+14,3,1,"#1565C0"),H(t+11,l+14,3,1,"#2E7D32")}function wE(t,l){H(t,l,22,16,"#6A5030"),H(t+1,l+1,20,14,"#C4A66A"),hi(88);for(let r=0;r<14;r++)for(let i=0;i<20;i++)Cl()>.5&&et(t+1+i,l+1+r,Cl()>.5?"#B89858":"#D4B87A",.18);H(t+2,l+2,5,4,"#FFF176"),H(t+8,l+2,5,4,"#90CAF9"),H(t+14,l+3,5,4,"#CE93D8"),H(t+3,l+8,7,4,"#C8E6C9"),H(t+11,l+8,8,4,"#F8BBD0"),et(t+4,l+2,"#E53935"),et(t+10,l+2,"#1E88E5"),et(t+16,l+3,"#FF9800")}function kE(t,l){H(t,l,20,3,"#5A4030"),H(t,l,20,1,Yt("#5A4030",.5),.35),H(t,l+2,20,1,El("#5A4030",.5),.3),H(t+2,l-4,3,4,"#E53935"),H(t+2,l-4,3,1,Yt("#E53935",1),.3),H(t+6,l-3,2,3,"#1E88E5"),H(t+9,l-5,4,5,"#43A047"),H(t+14,l-3,3,3,"#FFD54F"),et(t+15,l-3,"#FFF176",.4)}function SE(t,l){H(t,l,16,12,"#1E1E28"),H(t+1,l+1,14,9,"#0C1420"),H(t+2,l+2,12,1,"#EF4444",.6),et(t+2,l+4,"#4CAF50"),H(t+4,l+4,7,1,"#8b949e",.4),et(t+2,l+6,"#FF9800"),H(t+4,l+6,5,1,"#8b949e",.3),et(t+2,l+8,"#42A5F5"),H(t+4,l+8,8,1,"#8b949e",.25),H(t+7,l+10,2,2,"#1E1E28"),H(t+5,l+11,6,1,"#586878")}function jE(t,l,r){H(t+2,l+20,22,2,Yr,.15),H(t,l,22,20,jl.deep),H(t+1,l+1,20,18,jl.base),H(t,l,22,1,jl.hi,.35),H(t,l,1,20,jl.hi,.2);for(const u of[6,12])H(t+1,l+u,20,2,jl.sh),H(t+1,l+u,20,1,jl.hi,.2);const i=["#E53935","#1E88E5","#43A047","#8E24AA","#FB8C00","#00897B","#5C6BC0"];let c=t+2;for(let u=0;u<5;u++){const f=2+u%2;H(c,l+1,f,5,i[u]),H(c,l+1,f,1,Yt(i[u],1),.35),c+=f+1}c=t+2;for(let u=0;u<4;u++)H(c,l+7,4,5,i[u+3]),H(c,l+7,4,1,Yt(i[u+3],1),.25),c+=5;H(t+2,l+14,4,4,"#FFD54F"),H(t+8,l+14,7,4,"#90CAF9"),r&&H(t,l-1,22,1,r,.7)}function CE(t,l){H(t+2,l+11,6,2,Yr,.1),H(t+2,l+8,6,4,"#8B5E3C"),H(t+1,l+7,8,2,El("#A06E48",.3)),H(t+2,l+7,6,1,Yt("#A06E48",.5),.4),H(t+1,l+3,3,4,"#2E7D32"),H(t+5,l+2,3,4,"#2E7D32"),H(t+2,l+1,4,4,"#43A047"),H(t+3,l+0,3,3,"#66BB6A"),et(t+4,l,"#81C784"),et(t+3,l+1,"#A5D6A7",.4)}function EE(t,l){ha(t+4,l-4,"down"),ha(t+16,l-4,"down"),ha(t+28,l-4,"down"),H(t+3,l+24,34,3,Yr,.15),H(t,l+2,36,18,an.deep),H(t+1,l+3,34,16,an.base),H(t+1,l+3,34,1,an.hi,.35);for(let r=0;r<14;r+=3)H(t+1,l+4+r,34,1,El(an.base,.2),.08);H(t,l+20,36,4,an.deep),H(t+1,l+21,34,2,an.sh),H(t+6,l+7,10,6,"#1A1A24"),H(t+7,l+8,8,4,"#0C1420"),H(t+8,l+9,4,1,"#2A6898",.4),H(t+20,l+8,6,4,"#F0F0F0"),H(t+15,l+7,3,3,"#ECEFF1"),et(t+16,l+8,"#795548"),ha(t+4,l+24,"up"),ha(t+16,l+24,"up"),ha(t+28,l+24,"up")}function NE(t,l){H(t+2,l+16,36,3,Yr,.15),H(t,l,36,5,"#5D4037"),H(t+1,l+1,34,3,"#6D4C41"),H(t+1,l+1,34,1,Yt("#6D4C41",.5),.3),H(t,l+5,36,8,"#5D4037"),H(t+2,l+6,15,6,"#6D4C41"),H(t+3,l+6,13,1,Yt("#6D4C41",.5),.35),H(t+19,l+6,15,6,"#6D4C41"),H(t+20,l+6,13,1,Yt("#6D4C41",.5),.35),H(t+17,l+6,2,6,"#5D4037"),H(t,l+13,36,3,El("#5D4037",1)),H(t-2,l+2,3,12,"#5D4037"),H(t+35,l+2,3,12,"#5D4037"),H(t+4,l+7,6,4,"#FF8A65"),H(t+5,l+7,4,1,Yt("#FF8A65",1),.35)}function AE(t,l){H(t+2,l+10,22,2,Yr,.12),H(t,l,22,8,jl.deep),H(t+1,l+1,20,6,jl.base),H(t+1,l+1,20,1,jl.hi,.3),H(t,l+8,22,2,jl.sh),H(t+3,l+2,6,4,"#F0F0F0"),H(t+13,l+3,3,3,"#ECEFF1"),et(t+14,l+4,"#795548")}function TE(t,l){H(t+1,l+14,10,2,Yr,.12),H(t,l,10,14,"#546E7A"),H(t,l,10,1,Yt("#546E7A",1),.35),H(t+1,l+1,8,3,"#78909C"),H(t+1,l+5,8,4,"#37474F"),et(t+2,l+6,"#EF5350"),et(t+4,l+6,"#66BB6A"),H(t+2,l+11,4,2,"#ECEFF1")}function DE(t,l){H(t+2,l+16,26,3,Yr,.18),H(t,l,26,10,an.deep),H(t+1,l+1,24,8,an.base),H(t+1,l+2,24,1,an.hi,.2),H(t+1,l+4,24,1,El(an.base,.2),.1),H(t+1,l+6,24,1,an.hi,.15),H(t+1,l+1,24,1,an.hi,.4),H(t+1,l+1,1,8,an.hi,.2),H(t,l+10,26,5,an.deep),H(t+1,l+11,24,3,an.sh),H(t+1,l+10,24,1,El(an.base,1.5),.4),H(t+1,l+14,24,1,an.base,.15),H(t+2,l+12,10,1,an.deep,.4),H(t+14,l+12,10,1,an.deep,.4),et(t+7,l+11,"#C8D0D8",.6),et(t+19,l+11,"#C8D0D8",.6),H(t+6,l-5,14,7,"#1E1E28"),H(t+7,l-4,12,5,"#0C1420"),H(t+8,l-3,5,1,"#2A6898",.6),H(t+8,l-2,8,1,"#1A3858",.4),H(t+8,l-1,3,1,"#2A6898",.35),et(t+7,l-4,"#4A98D8",.25),et(t+12,l+1,"#4CAF50",.4),H(t+12,l+2,2,3,"#586878"),H(t+10,l+4,6,1,"#8898A8"),H(t+6,l+4,12,4,"#222228"),H(t+6,l+4,12,1,"#333338",.4);for(let r=0;r<5;r++)et(t+7+r*2,l+5,"#444",.6),et(t+7+r*2,l+6,"#3A3A3E",.4);H(t+20,l+5,3,4,"#333338"),H(t+20,l+5,3,1,"#444448"),H(t+1,l+3,4,4,"#F0EDE8"),H(t+1,l+3,4,1,"#F8F6F2"),et(t+2,l+5,"#6D4C41")}function ha(t,l,r){H(t+1,l+9,10,2,Yr,.1),et(t+5,l+9,"#1E1E22"),et(t+1,l+10,"#1A1A1E"),et(t+9,l+10,"#1A1A1E"),et(t+3,l+11,"#1A1A1E"),et(t+7,l+11,"#1A1A1E"),H(t+1,l+2,8,6,wl.base),H(t+2,l+3,6,4,wl.hi,.35),H(t+2,l+3,6,1,Yt(wl.hi,.5),.25),H(t+1,l+7,8,1,wl.deep),r==="up"?(H(t,l+7,10,3,wl.deep),H(t+1,l+8,8,1,wl.sh)):(H(t,l-1,10,3,wl.deep),H(t+1,l,8,1,wl.sh)),H(t,l+3,1,4,wl.sh),H(t+9,l+3,1,4,wl.sh)}const Dg={bookshelf:(t,l,r)=>jE(t,l,r.accent),plant:(t,l)=>CE(t,l),"meeting-table":(t,l)=>EE(t,l),sofa:(t,l)=>NE(t,l),"coffee-table":(t,l)=>AE(t,l),"coffee-machine":(t,l)=>TE(t,l),window:(t,l,r)=>yE(t,l,r.windowW??16,r.windowH??14),picture:(t,l,r)=>gE(t,l,r.pictureColor??"#1565C0"),clock:(t,l)=>bE(t,l),whiteboard:(t,l)=>vE(t,l),"bulletin-board":(t,l)=>wE(t,l),shelf:(t,l)=>kE(t,l),screen:(t,l)=>SE(t,l)};function ui(t,l){const r=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:r+t.offsetX,y:i+t.offsetY}}function zE(t){for(const l of t.wallDecorations){const r=t.rooms[l.room];if(!r)continue;const{x:i,y:c}=ui(l,r),u=Dg[l.type];u&&u(i,c,l)}}function ME(t,l,r){for(const i of t.furniture){const c=t.rooms[i.room];if(!c||i.condition==="no-desks"&&r.has(i.room))continue;const{x:u,y:f}=ui(i,c),m=Dg[i.type];m&&l.push({y:f,draw:()=>m(u,f,i)})}}function Br(t){const l=[],r=[...t.wallDecorations,...t.furniture];for(const i of r){if(!i.facility)continue;const c=t.rooms[i.room];if(!c)continue;const{x:u,y:f}=ui(i,c);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 RE={bookshelf:{w:22,h:20},plant:{w:10,h:12},"meeting-table":{w:36,h:28},sofa:{w:38,h:16},"coffee-table":{w:22,h:10},"coffee-machine":{w:10,h:14},window:{w:16,h:14},picture:{w:10,h:8},clock:{w:7,h:7},whiteboard:{w:26,h:16},"bulletin-board":{w:22,h:16},shelf:{w:20,h:8},screen:{w:16,h:12}};function eh(t){return RE[t]??{w:16,h:16}}function Md(t,l,r,i){for(let c=t.furniture.length-1;c>=0;c--){const u=t.furniture[c],f=t.rooms[u.room];if(!f||u.condition==="no-desks"&&i.has(u.room))continue;const{x:m,y:x}=ui(u,f),d=eh(u.type);if(l>=m&&l<=m+d.w&&r>=x&&r<=x+d.h)return u.id}for(let c=t.wallDecorations.length-1;c>=0;c--){const u=t.wallDecorations[c],f=t.rooms[u.room];if(!f)continue;const{x:m,y:x}=ui(u,f),d=eh(u.type);if(l>=m&&l<=m+d.w&&r>=x&&r<=x+d.h)return u.id}return null}function R0(t,l,r,i,c){const f=[...l.wallDecorations,...l.furniture].find(y=>y.id===r);if(!f||f.condition==="no-desks"&&c.has(f.room))return;const m=l.rooms[f.room];if(!m)return;const{x,y:d}=ui(f,m),g=eh(f.type);t.save(),t.fillStyle=i,t.globalAlpha=.2,t.fillRect(x-1,d-1,g.w+2,g.h+2),t.globalAlpha=.9,t.strokeStyle=i,t.lineWidth=1,t.strokeRect(x-.5,d-.5,g.w+1,g.h+1),t.restore()}function F0(t,l,r,i){t.save(),t.fillStyle=i,t.globalAlpha=.2,t.fillRect(l-1,r-1,28,42),t.globalAlpha=.9,t.strokeStyle=i,t.lineWidth=1,t.strokeRect(l-.5,r-.5,27,41),t.restore()}function _0(t,l,r){for(const[i,c]of Object.entries(t))if(l>=c.dx&&l<=c.dx+26&&r>=c.dy&&r<=c.dy+40)return i;return null}const FE=[{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:"🖥️"}],pc=16,_E=4,da=4,Sc=2,pt=4,Lr=4;let _e=Ng(7);const Fc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};let fl=Br(_e);function zg(t){return{x:t.dx,y:t.dy,w:t.pw,h:t.ph}}function Mg(t){return{cx:t.dx+t.pw/2,botY:t.dy+t.ph}}let Gt={};function OE(t){const l={};for(let r=0;r<t.length&&r<_e.desks.length;r++)l[t[r]]=_e.desks[r];return l}let Bt,pa=null,ma=null,er=!1,dl=null,Vn=null,pn=null,rn=null,ai=null,kl=null;function BE(t,l){const{wx:r,wy:i,ww:c,wh:u,wallColor:f,baseboardColor:m}=t,x=El(f,.5),d=Yt(f,.5),g=[];if(l){const y=l.x-r,b=l.w;y>0&&g.push({sx:r,sw:y}),y+b<c&&g.push({sx:l.x+b,sw:c-y-b})}else g.push({sx:r,sw:c});for(const y of g){H(y.sx,i,y.sw,u,f);for(let b=0;b<u;b+=4)H(y.sx,i+b,y.sw,1,d,.08),H(y.sx,i+b+2,y.sw,1,x,.05);hi(Math.round(y.sx*7+i*13));for(let b=0;b<y.sw;b+=3)Cl()>.4&&H(y.sx+b,i,1,u,d,.04);H(y.sx,i,y.sw,2,d,.3),H(y.sx,i,y.sw,1,Yt(f,1),.2),H(y.sx,i+u-2,y.sw,2,x,.3),H(y.sx,i+u,y.sw,Sc,m),H(y.sx,i+u,y.sw,1,Yt(m,.5),.4)}l&&(H(l.x-1,i,1,u+Sc,"#4A3828"),H(l.x+l.w,i,1,u+Sc,"#4A3828"),H(l.x,i,l.w,1,"#0A0808",.12)),H(t.fx,t.fy,t.fw,3,"#0A0808",.12),H(t.fx,t.fy+3,t.fw,2,"#0A0808",.06)}function LE(t){const l="#504038",r=El(l,.5),i=Yt(l,.5),c=t.wx-Lr,u=t.wy,f=t.wh+Sc+t.fh;H(c,u,Lr,f,l),H(c,u,1,f,i,.3),H(c+Lr-1,u,1,f,r,.4);for(let x=0;x<f;x+=6)H(c+1,u+x,Lr-2,1,i,.06);const m=t.wx+t.ww;H(m,u,Lr,f,l),H(m,u,1,f,i,.2),H(m+Lr-1,u,1,f,r,.3)}function Rd(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#B08040",f="#C89848",m="#8A6030",x="#6A4820";H(l,r,i,c,u),hi(42);for(let d=0;d<c;d+=5){const g=Math.floor(d/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 S=Cl()>.5?f:u;H(v,r+d,j,4,S,.25),H(v,r+d,j,1,f,.3),H(v,r+d+4,j,1,x,.35),b>=l&&b<l+i&&H(b,r+d,1,4,x,.2),H(v,r+d+2,j,1,m,.1)}}H(l,r,i,2,"#0A0808",.08),H(l,r,2,c,"#0A0808",.06)}function O0(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#1C2A38",f="#101820";hi(99),H(l,r,i,c,u);for(let m=0;m<c;m+=pc)for(let x=0;x<i;x+=pc){const d=Math.min(pc,i-x),g=Math.min(pc,c-m);Cl()>.5&&H(l+x,r+m,d,g,Yt(u,.2),.15),H(l+x+2,r+m+2,d-4,g-4,Yt(u,.3),.08),H(l+x,r+m,d,1,f,.5),H(l+x,r+m,1,g,f,.5),H(l+x+1,r+m+1,1,g-1,Yt(u,.4),.1),Cl()>.85&&et(l+x+4+Math.floor(Cl()*8),r+m+4+Math.floor(Cl()*8),"#3A6A9A",.08)}}function $E(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#387848",f="#4A9058",m="#285E38";H(l,r,i,c,u),hi(77);for(let d=0;d<c;d+=2)for(let g=0;g<i;g+=2)Cl()>.5&&et(l+g,r+d,f,.1),Cl()>.8&&et(l+g+1,r+d+1,m,.12);const x=5;H(l+x,r+x,i-x*2,1,f,.45),H(l+x,r+c-x-1,i-x*2,1,m,.45),H(l+x,r+x,1,c-x*2,f,.35),H(l+i-x-1,r+x,1,c-x*2,m,.35)}function HE(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#D8C490",f="#B09060",m="#907848";hi(55);for(let x=0;x<c;x+=8)for(let d=0;d<i;d+=8){const g=Math.min(8,i-d),y=Math.min(8,c-x),b=(d/8+x/8)%2===0?f:u;H(l+d,r+x,g,y,b),H(l+d+1,r+x+1,g-2,1,Yt(b,.4),.2),H(l+d+1,r+x+1,1,y-2,Yt(b,.4),.15),H(l+d+g-2,r+x+2,1,y-3,El(b,.4),.15),H(l+d+2,r+x+y-2,g-3,1,El(b,.4),.15),H(l+d,r+x,g,1,m,.3),H(l+d,r+x,1,y,m,.3)}}function UE(){const{canvasW:t,canvasH:l,rooms:r,doors:i}=_e,c="#2A1E14",u="#3A2E24";if(H(0,0,t,da,c),H(0,l-da,t,da,c),H(0,0,da,l,c),H(t-da,0,da,l,c),H(0,0,t,1,u,.3),H(0,0,1,l,u,.2),!r.exec||!r.work||!r.meet||!r.comm)return;const f=r.exec,m=r.meet,x=t/2,d=x-pt/2,g=f.fy+f.fh,y=i.exec_work,b=i.meet_comm,v=i.exec_meet,j=i.work_comm,S=24,C=28,E=((y==null?void 0:y.doorY)??f.fy+20)-S/2,A=((v==null?void 0:v.doorX)??da+Lr+54)-C/2,M=((j==null?void 0:j.doorX)??x+pt/2+Lr+54)-C/2,O=((b==null?void 0:b.doorY)??m.fy+20)-S/2;H(0,g,A,pt,c),H(A+C,g,d-A-C,pt,c),H(d+pt,g,M-d-pt,pt,c),H(M+C,g,t-M-C,pt,c),H(0,g,A,1,u,.3),H(A+C,g,d-A-C,1,u,.3),H(d+pt,g,M-d-pt,1,u,.3),H(M+C,g,t-M-C,1,u,.3),H(d,0,pt,E,c),H(d,E+S,pt,g-E-S,c),H(d,g+pt,pt,O-g-pt,c),H(d,O+S,pt,l-O-S,c),H(d,0,1,E,u,.2),H(d,E+S,1,g-E-S,u,.2),H(d,g+pt,1,O-g-pt,u,.2),H(d,O+S,1,l-O-S,u,.2),H(d,E,pt,S,"#C4A070"),H(d+pt/2,E,pt/2,S,"#3A4858"),H(d,O,pt,S,"#7AA880"),H(d+pt/2,O,pt/2,S,"#C8B890");const L="#4A3828";H(d,E-1,pt,1,L),H(d,E+S,pt,1,L),H(A-1,g,1,pt,L),H(A+C,g,1,pt,L),H(M-1,g,1,pt,L),H(M+C,g,1,pt,L),H(d,O-1,pt,1,L),H(d,O+S,pt,1,L)}const B0=new Map;function IE(t){const l=`${t.hairStyle??""}|${t.outfitStyle??""}|${t.accessory??""}`;let r=B0.get(l);if(!r){const i=Qd("mini-seated:default"),c=sg(i,t);r=c?c.layers.flatMap(u=>u.pixels):[],B0.set(l,r)}return r}function YE(t,l,r){Wd(Bt,IE(r),t,l,r)}function qE(t,l,r,i,c){ha(t+8,l+20,"up"),c||YE(t+8,l+0+i,r),DE(t,l+14)}function XE(t,l,r,i,c){const u=i in T0?i:"down",f=c%4,m=T0[u][f];Wd(Bt,m,t,l,r);const x=f===1||f===3?-1:0;if(r.accessory&&r.accessory!=="none"){const d=_S(r.accessory,u);d&&d.pixels.length>0&&Wd(Bt,d.pixels,t,l+x,r)}Bt.globalAlpha=1}function VE(t){const l={};let r=0;for(const i of t){const c=Gt[i];c&&(l[i]={state:"sitting",homeX:c.dx+8,homeY:c.dy+34,homeRoom:c.room,x:c.dx+8,y:c.dy+34,path:[],room:c.room,dir:"down",walkFrame:0,walkTimer:0,bobY:0,bobOff:r*17,stateTimer:600+Math.floor(Math.random()*900)},r++)}return l}function Ds(t,l,r,i,c){const u=_e.corridorY[c]??l,f=[];return l<u-4&&f.push({x:t,y:u}),Math.abs(t-r)>4&&f.push({x:r,y:u}),f.push({x:r,y:i}),f}function Fd(t,l,r,i){const c=_e.adjacency[r];if(!c)return[];const u=c.find(g=>g.room===i);if(!u)return[];const f=_e.doors[u.door];if(!f)return[];const m=[],x=_e.corridorY[r]??l,d=_e.corridorY[i]??l;if(Math.abs(l-x)>4&&m.push({x:t,y:x}),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:x}),m.push({x:g,y:f.doorY}),m.push({x:y,y:f.doorY}),m.push({x:y,y:d})}else{const g=u.side==="A"?f.yA:f.yB,y=u.side==="A"?f.yB:f.yA;m.push({x:f.doorX,y:x}),m.push({x:f.doorX,y:g}),m.push({x:f.doorX,y}),m.push({x:f.doorX,y:d})}return m}function Rg(t,l){const r=_e.adjacency[t.room];if(!r)return[];if(!r.find(c=>c.room===l)){for(const c of r){const u=_e.adjacency[c.room];if(u!=null&&u.find(f=>f.room===l)){const f=Fd(t.x,t.y,t.room,c.room),m=f[f.length-1],x=Fd((m==null?void 0:m.x)??t.x,(m==null?void 0:m.y)??t.y,c.room,l);return[...f,...x]}}return[]}return Fd(t.x,t.y,t.room,l)}function GE(t){if(t.room!==t.homeRoom){const l=Rg({...t},t.homeRoom),r=l[l.length-1],i=Ds((r==null?void 0:r.x)??t.x,(r==null?void 0:r.y)??t.y,t.homeX,t.homeY,t.homeRoom);return[...l,...i]}return Ds(t.x,t.y,t.homeX,t.homeY,t.room)}function KE(t,l){for(const[,r]of Object.entries(t))if(r.stateTimer--,r.state==="sitting"){if(r.bobY=(l+r.bobOff)%60<30?1:0,r.stateTimer<=0){r.state="walking",r.x=r.homeX,r.y=r.homeY,r.room=r.homeRoom;const i=Object.keys(_e.rooms);if(Math.random()<.25&&i.length>1){const c=i.filter(x=>x!==r.room),u=c[Math.floor(Math.random()*c.length)],f=Rg(r,u),m=_e.waypoints[u];if(m&&m.length>0){const x=m[Math.floor(Math.random()*m.length)],d=f[f.length-1]??{x:r.x,y:r.y},g=Ds(d.x,d.y,x.x,x.y,u);r.path=[...f,...g]}else r.path=f;r.walkTimer=0}else{const c=_e.waypoints[r.room];if(c&&c.length>0){const u=c[Math.floor(Math.random()*c.length)];r.path=Ds(r.x,r.y,u.x,u.y,r.room)}r.walkTimer=0}}}else if(r.state==="walking"||r.state==="returning"){if(r.path.length===0){r.state==="returning"?(r.state="sitting",r.room=r.homeRoom,r.stateTimer=800+Math.floor(Math.random()*1200)):(r.state="idle",r.dir="down",r.stateTimer=180+Math.floor(Math.random()*360));continue}const i=r.path[0],c=i.x-r.x,u=i.y-r.y,f=Math.sqrt(c*c+u*u);if(f<1.5){r.x=i.x,r.y=i.y,r.path.shift();for(const[m,x]of Object.entries(_e.rooms))if(r.x>=x.fx&&r.x<=x.fx+x.fw&&r.y>=x.fy&&r.y<=x.fy+x.fh){r.room=m;break}}else r.x+=c/f*.2,r.y+=u/f*.2,Math.abs(c)>Math.abs(u)?r.dir=c>0?"right":"left":r.dir=u>0?"down":"up",r.walkTimer++,r.walkFrame=Math.floor(r.walkTimer/12)%4}else if(r.state==="idle"&&r.stateTimer<=0)if(Math.random()<.3){r.state="walking";const i=_e.waypoints[r.room];if(i&&i.length>0){const c=i[Math.floor(Math.random()*i.length)];r.path=Ds(r.x,r.y,c.x,c.y,r.room)}r.walkTimer=0}else r.state="returning",r.path=GE(r),r.walkTimer=0}function QE(t,l,r){const{canvasW:i,canvasH:c,rooms:u}=_e;Bt.clearRect(0,0,i,c),H(0,0,i,c,"#2A1E14");const f={wood:Rd,dark:O0,carpet:$E,tile:HE};for(const y of Object.values(u))(f[y.floorType]??Rd)(y);const m=Object.keys(u);if(m.length>=4){const y=u.exec,b=u.meet,{doors:v}=_e;if(y&&b&&v.exec_meet&&v.work_comm){const S=(v.exec_meet.doorX??0)-14,C=(v.work_comm.doorX??0)-28/2,E=y.fy+y.fh,A=b.fy;Rd({fx:S,fy:E,fw:28,fh:A-E}),O0({fx:C,fy:E,fw:28,fh:A-E})}}const x={};if(m.length>=4){const{doors:y}=_e,b=28,v=y.exec_meet,j=y.work_comm;v!=null&&v.doorX&&(x.meet={x:v.doorX-b/2,w:b}),j!=null&&j.doorX&&(x.comm={x:j.doorX-b/2,w:b})}for(const y of Object.values(u))BE(y,x[y.id]),LE(y);UE(),zE(_e);const d=[],g=new Set(Object.values(Gt).map(y=>y.room));ME(_e,d,g);for(const[y,b]of Object.entries(Gt)){const v=t[y];if(!v)continue;const j=v.state==="sitting",S=l(y),C=r[y]==="working";d.push({y:b.dy+14,draw:()=>{if(qE(b.dx,b.dy,S,j?v.bobY:0,!j),j&&C){const E=Fc[y]??"#388bfd";H(b.dx+7,b.dy+14-4,12,5,E,.15),et(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);d.push({y:b.y+14,draw:()=>XE(Math.round(b.x),Math.round(b.y),v,b.dir,b.walkFrame)})}d.sort((y,b)=>y.y-b.y);for(const y of d)y.draw();for(const y of fl){const b=ma===y.id,v=Mg(y);if(Bt.save(),Bt.globalAlpha=b?.9:.5,Bt.fillStyle=y.color,Bt.fillRect(v.cx-1,v.botY-2,3,3),b){const j=zg(y);Bt.globalAlpha=.3,Bt.strokeStyle=y.color,Bt.lineWidth=1,Bt.strokeRect(j.x-1,j.y-1,j.w+2,j.h+2)}Bt.restore()}if(er){const y=new Set(Object.values(Gt).map(b=>b.room));if(dl&&dl!==Vn)if(dl.startsWith("desk:")){const b=dl.slice(5),v=Gt[b];v&&F0(Bt,v.dx,v.dy,"#FBBF24")}else R0(Bt,_e,dl,"#FBBF24",y);if(Vn)if(Vn.startsWith("desk:")){const b=Vn.slice(5),v=Gt[b];v&&F0(Bt,v.dx,v.dy,"#3B82F6")}else R0(Bt,_e,Vn,"#3B82F6",y)}if(pa){const y=Gt[pa],b=t[pa];y&&b&&(Bt.save(),Bt.globalAlpha=.25,Bt.fillStyle=Fc[pa]??"#fff",b.state==="sitting"?Bt.fillRect(y.dx-1,y.dy+6,28,30):Bt.fillRect(Math.round(b.x)-1,Math.round(b.y)-1,14,24),Bt.restore())}}function WE({roles:t,projects:l,roleStatuses:r,activeExecs:i,onRoleClick:c,onProjectClick:u,onBulletinClick:f,onDecisionsClick:m,onKnowledgeClick:x,onSettingsClick:d,onThemeClick:g,onStatsClick:y,getRoleSpeech:b,getAppearance:v,onHireClick:j}){const S=k.useRef(null),C=k.useRef(null),E=k.useRef(null),A=k.useRef({}),M=k.useRef(0),O=k.useRef(_E),[L,F]=k.useState(!1),[I,$]=k.useState(null),[ee,z]=k.useState(null),X=k.useRef({}),R=k.useRef({}),W=k.useRef([]),te=k.useRef([]);k.useEffect(()=>{er=L},[L]),k.useEffect(()=>{ai=I,kl=ee},[I,ee]),k.useEffect(()=>{Ce.getPreferences().then(de=>{const G=de.furnitureOverrides;G&&Object.keys(G).length>0&&(X.current=G,_e=D0(_e,G));const re=de.deskOverrides;if(re&&Object.keys(re).length>0){R.current=re,z0(Gt,re);for(const[Ne,Te]of Object.entries(Gt)){const Me=A.current[Ne];Me&&(Me.homeX=Te.dx+8,Me.homeY=Te.dy+34)}}const ve=de.removedFurniture;ve&&ve.length>0&&(W.current=ve,_e=zd(_e,ve));const ze=de.addedFurniture;ze&&ze.length>0&&(te.current=ze,_e=M0(_e,ze)),fl=Br(_e)}).catch(()=>{})},[]);const V=k.useRef({roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v});V.current={roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v};const Y=k.useMemo(()=>t.map(de=>de.id),[t]),Z=k.useRef(_e);k.useEffect(()=>{const de=Y.length,G=Eg(de,Z.current.preset);let re=Ng(de,G);W.current.length>0&&(re=zd(re,W.current)),te.current.length>0&&(re=M0(re,te.current)),Object.keys(X.current).length>0&&(re=D0(re,X.current)),_e=re,Z.current=re,Gt=OE(Y),Object.keys(R.current).length>0&&z0(Gt,R.current),fl=Br(re),A.current=VE(Y);const ve=S.current;ve&&(ve.width=re.canvasW,ve.height=re.canvasH),we()},[Y]);const ce=k.useCallback(de=>{var G,re;return((re=(G=V.current).getAppearance)==null?void 0:re.call(G,de))??Eh(de)},[]),we=k.useCallback(()=>{const de=C.current,G=S.current;if(!de||!G)return;const re=de.parentElement;if(!re)return;const ve=re.clientWidth,ze=re.clientHeight;if(ve===0||ze===0)return;const{canvasW:Ne,canvasH:Te}=_e;let Me=Math.floor(Math.min(ve/Ne,ze/Te));Me=Math.max(2,Math.min(Me,5)),O.current=Me,G.style.width=Ne*Me+"px",G.style.height=Te*Me+"px",de.style.width=Ne*Me+"px",de.style.height=Te*Me+"px"},[]);k.useEffect(()=>{var Te;const de=S.current;if(!de)return;const G=de.getContext("2d");if(!G)return;Bt=G,pE(G),we();const re=new ResizeObserver(()=>we()),ve=(Te=C.current)==null?void 0:Te.parentElement;ve&&re.observe(ve);let ze;const Ne=()=>{M.current++,KE(A.current,M.current),QE(A.current,ce,V.current.roleStatuses),D(),ze=requestAnimationFrame(Ne)};return ze=requestAnimationFrame(Ne),()=>{cancelAnimationFrame(ze),re.disconnect()}},[ce,we]),k.useEffect(()=>{const de=E.current;if(!de)return;de.innerHTML="";for(const re of Y){const ve=Fc[re]??"#8b949e",ze=document.createElement("div");ze.className="td-nametag",ze.dataset.role=re;const Ne=document.createElement("span");Ne.className="td-dot",Ne.style.background=ve,ze.appendChild(Ne),ze.appendChild(document.createTextNode(re.toUpperCase())),de.appendChild(ze);const Te=document.createElement("div");Te.className="td-bubble",Te.dataset.role=re,Te.dataset.type="bubble",de.appendChild(Te)}const G={meeting:()=>{const re=l[0];re?u(re.id):f()},bulletin:f,decisions:m,knowledge:x,settings:d,theme:g,stats:y};for(const re of fl){const ve=document.createElement("div");ve.className="td-facility-label",ve.dataset.facility=re.id,ve.textContent=`${re.icon} ${re.label}`,ve.style.borderColor=`${re.color}44`;const ze=G[re.id];ze&&ve.addEventListener("click",ze),ve.addEventListener("mouseenter",()=>{ma=re.id}),ve.addEventListener("mouseleave",()=>{ma=null}),de.appendChild(ve)}},[Y,l,u,f,m,x,d,g,y]);const D=k.useCallback(()=>{var Te;const de=E.current;if(!de)return;const G=O.current,re=A.current,{getRoleSpeech:ve,roleStatuses:ze,activeExecs:Ne}=V.current;for(const Me of Object.keys(re)){const Oe=re[Me],tt=Gt[Me];if(!tt)continue;let Lt,gt,ht;Oe.state==="sitting"?(Lt=tt.dx+13,ht=tt.dy+2,gt=tt.dy+37):(Lt=Math.round(Oe.x)+6,ht=Math.round(Oe.y)-2,gt=Math.round(Oe.y)+18);const Zt=Lt/_e.canvasW*100,ae=de.querySelector(`.td-nametag[data-role="${Me}"]`);if(ae){ae.style.left=Zt+"%",ae.style.top=gt*G+2+"px";const De=ae.querySelector(".td-dot");if(De){const Ue=ze[Me]==="working";De.style.background=Ue?"#FBBF24":Fc[Me]??"#8b949e",Ue?De.style.animation="td-pulse 1s ease-in-out infinite":De.style.animation=""}}const xe=de.querySelector(`.td-bubble[data-role="${Me}"]`);if(xe){const De=ze[Me]==="working",Ue=(Te=Ne.find(jt=>jt.roleId===Me))==null?void 0:Te.task,ye=ve(Me),je=De&&Ue?Ue.slice(0,60):ye?ye.slice(0,60):"";je&&Oe.state==="sitting"?(xe.style.display="",xe.style.left=Zt+"%",xe.style.top=(ht-10)*G+"px",xe.textContent=je):xe.style.display="none"}}for(const Me of fl){const Oe=de.querySelector(`.td-facility-label[data-facility="${Me.id}"]`);if(Oe){const tt=Mg(Me);Oe.style.left=tt.cx/_e.canvasW*100+"%",Oe.style.top=tt.botY*G-4+"px",Oe.classList.toggle("td-facility-label--hover",ma===Me.id)}}},[]),B=k.useCallback(de=>{const G=S.current;if(!G)return null;const re=G.getBoundingClientRect(),ve=O.current,ze=(de.clientX-re.left)/ve,Ne=(de.clientY-re.top)/ve,Te=A.current;for(const[Me,Oe]of Object.entries(Gt)){if(!Te[Me])continue;const tt=Te[Me];if(tt.state==="sitting"){if(ze>=Oe.dx&&ze<=Oe.dx+26&&Ne>=Oe.dy&&Ne<=Oe.dy+40)return{type:"role",id:Me}}else if(ze>=tt.x-2&&ze<=tt.x+14&&Ne>=tt.y-2&&Ne<=tt.y+20)return{type:"role",id:Me}}for(const Me of fl){const Oe=zg(Me);if(ze>=Oe.x&&ze<=Oe.x+Oe.w&&Ne>=Oe.y&&Ne<=Oe.y+Oe.h)return{type:"facility",id:Me.id}}return null},[]),Q=k.useCallback(de=>{const G=S.current;if(!G)return{mx:0,my:0};const re=G.getBoundingClientRect(),ve=O.current;return{mx:(de.clientX-re.left)/ve,my:(de.clientY-re.top)/ve}},[]),T=k.useCallback(de=>{Ce.updatePreferences(de).catch(()=>{})},[]),me=k.useCallback(de=>{const G=[...W.current,de];W.current=G,_e=zd(_e,[de]),fl=Br(_e),Vn=null,dl=null,T({removedFurniture:G})},[T]),Se=k.useCallback((de,G)=>{if(!ai||!kl)return;let re=null;for(const[Oe,tt]of Object.entries(_e.rooms)){const Lt=kl==="wall"?tt.wx:tt.fx,gt=kl==="wall"?tt.wy:tt.fy,ht=kl==="wall"?tt.ww:tt.fw,Zt=kl==="wall"?tt.wh:tt.fh;if(de>=Lt&&de<=Lt+ht&&G>=gt&&G<=gt+Zt){re=Oe;break}}if(!re)return;const ve=_e.rooms[re],ze=kl==="wall"?ve.wx:ve.fx,Ne=kl==="wall"?ve.wy:ve.fy,Te={id:`user-${ai}-${Date.now()}`,type:ai,room:re,zone:kl,offsetX:Math.round(de-ze),offsetY:Math.round(G-Ne)},Me=[...te.current,Te];te.current=Me,kl==="wall"?_e.wallDecorations.push(Te):_e.furniture.push(Te),fl=Br(_e),T({addedFurniture:Me}),$(null),z(null)},[T]),Ee=k.useCallback(de=>{const G=S.current;if(er&&pn){const{mx:ve,my:ze}=Q(de),Te=[..._e.furniture,..._e.wallDecorations].find(tt=>tt.id===pn.defId);if(!Te)return;const Me=ve-pn.startMx,Oe=ze-pn.startMy;Te.offsetX=Math.round(pn.origOffX+Me),Te.offsetY=Math.round(pn.origOffY+Oe),fl=Br(_e),G&&(G.style.cursor="grabbing");return}if(er&&rn){const{mx:ve,my:ze}=Q(de),Ne=Gt[rn.roleId];if(!Ne)return;Ne.dx=Math.round(rn.origDx+(ve-rn.startMx)),Ne.dy=Math.round(rn.origDy+(ze-rn.startMy));const Te=A.current[rn.roleId];Te&&(Te.homeX=Ne.dx+8,Te.homeY=Ne.dy+34),G&&(G.style.cursor="grabbing");return}if(er){const{mx:ve,my:ze}=Q(de);if(ai){G&&(G.style.cursor="crosshair");return}const Ne=new Set(Object.values(Gt).map(Me=>Me.room)),Te=Md(_e,ve,ze,Ne);if(Te)dl=Te;else{const Me=_0(Gt,ve,ze);dl=Me?`desk:${Me}`:null}pa=null,ma=null,G&&(G.style.cursor=dl?"grab":"default");return}const re=B(de);pa=(re==null?void 0:re.type)==="role"?re.id:null,ma=(re==null?void 0:re.type)==="facility"?re.id:null,dl=null,G&&(G.style.cursor=re?"pointer":"default")},[B,Q]),Be=k.useCallback(de=>{if(!er)return;const{mx:G,my:re}=Q(de);if(ai){Se(G,re),de.preventDefault();return}const ve=new Set(Object.values(Gt).map(Te=>Te.room)),ze=Md(_e,G,re,ve);if(ze){const Me=[..._e.furniture,..._e.wallDecorations].find(Oe=>Oe.id===ze);Me&&(Vn=ze,pn={defId:ze,startMx:G,startMy:re,origOffX:Me.offsetX,origOffY:Me.offsetY},de.preventDefault());return}const Ne=_0(Gt,G,re);if(Ne){const Te=Gt[Ne];Vn=`desk:${Ne}`,rn={roleId:Ne,startMx:G,startMy:re,origDx:Te.dx,origDy:Te.dy},de.preventDefault();return}Vn=null},[Q,Se]),He=k.useCallback(de=>{if(pn){const re=[..._e.furniture,..._e.wallDecorations].find(ve=>ve.id===pn.defId);if(re){const ve={...X.current,[re.id]:{offsetX:re.offsetX,offsetY:re.offsetY}};X.current=ve,T({furnitureOverrides:ve}),fl=Br(_e)}pn=null,S.current&&(S.current.style.cursor="grab");return}if(rn){const G=Gt[rn.roleId];if(G){const re={...R.current,[rn.roleId]:{dx:G.dx,dy:G.dy}};R.current=re,T({deskOverrides:re})}rn=null,S.current&&(S.current.style.cursor="grab")}},[T]),Ke=k.useCallback(de=>{if(!er)return;de.preventDefault();const{mx:G,my:re}=Q(de),ve=new Set(Object.values(Gt).map(Ne=>Ne.room)),ze=Md(_e,G,re,ve);ze&&me(ze)},[Q,me]);k.useEffect(()=>{const de=G=>{!er||!Vn||(G.key==="Delete"||G.key==="Backspace")&&(Vn.startsWith("desk:")||me(Vn))};return window.addEventListener("keydown",de),()=>window.removeEventListener("keydown",de)},[me]);const ke=k.useCallback(()=>{if(pn){const G=[..._e.furniture,..._e.wallDecorations].find(re=>re.id===pn.defId);G&&(G.offsetX=pn.origOffX,G.offsetY=pn.origOffY,fl=Br(_e)),pn=null}if(rn){const de=Gt[rn.roleId];de&&(de.dx=rn.origDx,de.dy=rn.origDy);const G=A.current[rn.roleId];G&&(G.homeX=de.dx+8,G.homeY=de.dy+34),rn=null}pa=null,ma=null,dl=null,S.current&&(S.current.style.cursor="default")},[]),yt=k.useCallback(de=>{if(er)return;const G=B(de);if(G){if(G.type==="role"){c(G.id);return}switch(G.id){case"meeting":{const re=l[0];re?u(re.id):f();break}case"bulletin":f();break;case"decisions":m();break;case"knowledge":x();break;case"settings":d==null||d();break;case"theme":g==null||g();break;case"stats":y==null||y();break}}},[B,c,u,f,m,x,d,g,y]);return o.jsxs("div",{className:`td-scene${L?" td-scene--editing":""}`,children:[o.jsxs("div",{ref:C,className:"td-wrap",children:[o.jsx("canvas",{ref:S,width:_e.canvasW,height:_e.canvasH,className:"td-canvas",onClick:yt,onMouseDown:Be,onMouseUp:He,onMouseMove:Ee,onMouseLeave:ke,onContextMenu:Ke}),o.jsx("div",{ref:E,className:"td-overlay"})]}),L&&o.jsxs("div",{className:"td-edit-banner",children:[o.jsx("span",{className:"td-edit-banner__icon",children:"✎"})," EDIT MODE — Click DONE when finished"]}),o.jsxs("button",{className:`td-edit-btn${L?" td-edit-btn--active":""}`,onClick:()=>{F(de=>{const G=!de;return G||($(null),z(null)),G}),Vn=null,pn=null,rn=null},title:L?"Exit Edit Mode":"Edit Furniture Layout",children:[o.jsx("span",{className:"td-edit-btn__icon",children:L?"✓":"✎"}),o.jsx("span",{className:"td-edit-btn__label",children:L?"DONE":"EDIT"})]}),L&&o.jsx("div",{className:"td-palette",children:FE.map(de=>o.jsx("button",{className:`td-palette__item${I===de.type?" td-palette__item--active":""}`,onClick:()=>{I===de.type?($(null),z(null)):($(de.type),z(de.zone))},title:de.label,children:o.jsx("span",{children:de.icon})},de.type))}),j&&o.jsxs("button",{className:"td-hire-btn",onClick:j,title:"Hire New Role",children:[o.jsx("span",{className:"td-hire-btn__icon",children:"+"}),o.jsx("span",{className:"td-hire-btn__label",children:"HIRE"})]})]})}function ZE({role:t,appearance:l,onSave:r,onReset:i,onClose:c,theme:u,onThemeChange:f,onUpdateName:m,initialTab:x,characterOnly:d,speechSettings:g,onSpeechSettingsChange:y,language:b,onLanguageChange:v,roleLevel:j}){var X;const[S,C]=k.useState(x??"character"),[E,A]=k.useState({...l}),[M,O]=k.useState(t.name),[L,F]=k.useState(!1),I=k.useCallback(()=>A(js(j)),[j]),$=k.useCallback(()=>{const R=Eh(t.id);A({...R}),i()},[t.id,i]),ee=k.useCallback(async()=>{r(E);const R=M.trim();if(m&&R&&R!==t.name){F(!0);try{await m(t.id,R)}catch{}F(!1)}c()},[E,r,c,M,t.name,t.id,m]),z=o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[o.jsxs("span",{children:[t.id.toUpperCase()," –"]}),m?o.jsx("input",{value:M,onChange:R=>O(R.target.value),disabled:L,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}}):o.jsx("span",{children:t.name})]});return o.jsx("div",{className:"customize-overlay",onClick:c,children:o.jsxs("div",{className:"customize-modal",onClick:R=>R.stopPropagation(),children:[o.jsxs("div",{className:"customize-header",children:[o.jsxs("div",{className:"customize-tabs",children:[o.jsx("button",{className:`customize-tab ${S==="character"?"active":""}`,onClick:()=>C("character"),children:"CHARACTER"}),!d&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:`customize-tab ${S==="office"?"active":""}`,onClick:()=>C("office"),children:"OFFICE THEME"}),o.jsx("button",{className:`customize-tab ${S==="settings"?"active":""}`,onClick:()=>C("settings"),children:"SETTINGS"})]})]}),o.jsx("button",{className:"customize-close",onClick:c,children:"X"})]}),S==="character"?o.jsx("div",{className:"customize-body",children:o.jsx(vg,{roleId:t.id,appearance:E,onChange:A,onRandomize:I,onReset:$,label:z,roleLevel:j})}):S==="office"?o.jsx("div",{className:"customize-body",children:o.jsx("div",{className:"customize-themes",children:Object.entries(Hr).map(([R,W])=>o.jsxs("button",{className:`customize-theme-card ${u===R?"active":""}`,onClick:()=>f(R),children:[o.jsxs("div",{className:"customize-theme-preview",style:{background:W.vars["--floor-light"],borderColor:W.vars["--pixel-border"]},children:[o.jsx("div",{style:{background:W.vars["--hud-bg"],height:8,borderBottom:`2px solid ${W.vars["--pixel-border"]}`}}),o.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1 p-1",children:[o.jsx("div",{style:{width:10,height:14,background:W.vars["--accent"],borderRadius:1}}),o.jsx("div",{style:{width:10,height:14,background:W.vars["--active-green"],borderRadius:1}}),o.jsx("div",{style:{width:10,height:14,background:W.vars["--idle-amber"],borderRadius:1}})]}),o.jsx("div",{style:{background:W.vars["--hud-bg"],height:6,borderTop:`2px solid ${W.vars["--pixel-border"]}`}})]}),o.jsxs("div",{className:"customize-theme-name",children:[W.icon," ",W.name]})]},R))})}):o.jsx("div",{className:"customize-body",children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,padding:"8px 0"},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),o.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(R=>o.jsxs("button",{onClick:()=>y==null?void 0:y({mode:R}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(g==null?void 0:g.mode)===R?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(g==null?void 0:g.mode)===R?"rgba(255,255,255,0.08)":"transparent",color:(g==null?void 0:g.mode)===R?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[o.jsx("div",{style:{fontWeight:600,marginBottom:2},children:R==="template"?"TEMPLATE":R==="llm"?"AI":"AUTO"}),o.jsx("div",{style:{fontSize:9,opacity:.7},children:R==="template"?"Static pool ($0)":R==="llm"?"LLM generated":"Detect engine"})]},R))}),o.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(g==null?void 0:g.intervalSec)??18,"s"]}),o.jsx("input",{type:"range",min:5,max:120,step:5,value:(g==null?void 0:g.intervalSec)??18,onChange:R=>y==null?void 0:y({intervalSec:Number(R.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[o.jsx("span",{children:"5s (frequent)"}),o.jsx("span",{children:"120s (rare)"})]})]}),(g==null?void 0:g.mode)!=="template"&&o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((X=g==null?void 0:g.dailyBudgetUsd)==null?void 0:X.toFixed(2))??"1.00"]}),o.jsx("input",{type:"range",min:0,max:5,step:.25,value:(g==null?void 0:g.dailyBudgetUsd)??1,onChange:R=>y==null?void 0:y({dailyBudgetUsd:Number(R.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[o.jsx("span",{children:"$0 (unlimited)"}),o.jsx("span",{children:"$5.00/day"})]})]}),o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),o.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:R,label:W})=>o.jsx("button",{onClick:()=>v==null?void 0:v(R),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(b??"auto")===R?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(b??"auto")===R?"rgba(255,255,255,0.08)":"transparent",color:(b??"auto")===R?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:W},R))}),o.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]})]})}),S==="character"&&o.jsxs("div",{className:"customize-footer",children:[o.jsx("button",{className:"customize-btn customize-btn--cancel",onClick:c,children:"CANCEL"}),o.jsx("button",{className:"customize-btn customize-btn--save",onClick:ee,children:"SAVE"})]})]})})}function L0(t){if(t.length===0)return"";const l={};for(const{file:m}of t){const x=m.split("/"),d=x[0]==="."?x[1]??"root":x[0];(l[d]??(l[d]=[])).push(m)}const r={roles:"roles",projects:"projects",operations:"operations",knowledge:"knowledge",architecture:"architecture",company:"company",".tycono":"config",".claude":"skills"},i=[];for(const[m,x]of Object.entries(l)){const d=r[m]??m;if(x.length===1){const g=x[0].split("/").pop()??x[0];i.push(`${d}/${g}`)}else i.push(`${d} (${x.length} files)`)}const c=t.some(m=>m.status==="A"),u=t.some(m=>m.status==="M");return`${c&&!u?"add":"update"}: ${i.join(", ")}`}function $0(t){const l=Date.now()-new Date(t).getTime(),r=Math.floor(l/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function JE({status:t,history:l,onClose:r,onSave:i,onLoadHistory:c,onRestore:u,saving:f}){const[m,x]=k.useState("save"),[d,g]=k.useState(""),[y,b]=k.useState(null),[v,j]=k.useState(!1),[S,C]=k.useState(null),E=k.useRef(null);k.useEffect(()=>{m==="history"&&c()},[m,c]),k.useEffect(()=>{var $;($=E.current)==null||$.focus()},[]);const A=[...((t==null?void 0:t.modified)??[]).map($=>({status:"M",file:$})),...((t==null?void 0:t.untracked)??[]).map($=>({status:"A",file:$}))],M=k.useRef(!1);k.useEffect(()=>{!M.current&&A.length>0&&!d&&(g(L0(A)),M.current=!0)},[A.length]);const O=k.useCallback(()=>{g(L0(A))},[A]),L=async()=>{b(null),C(null);try{const $=await i(d||void 0);C($),g("")}catch($){b($ instanceof Error?$.message:"Save failed")}},F=async $=>{if(confirm(`Restore from commit ${$.slice(0,7)}? This creates a new commit with those files.`)){j(!0);try{await u($),j(!1)}catch(ee){b(ee instanceof Error?ee.message:"Restore failed"),j(!1)}}};k.useEffect(()=>{const $=ee=>{ee.key==="Escape"&&r()};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[r]);const I=$=>{$.key==="Enter"&&($.metaKey||$.ctrlKey)&&L()};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),o.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:I,children:[o.jsxs("div",{className:"px-5 py-3 flex items-center justify-between shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"text-lg font-black tracking-tight",children:"SAVE GAME"}),o.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:(t==null?void 0:t.branch)??""})]}),o.jsx("button",{onClick:r,className:"text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] cursor-pointer text-lg",children:"×"})]}),o.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["save","history"].map($=>o.jsx("button",{onClick:()=>x($),className:"flex-1 py-2 text-[11px] font-bold uppercase tracking-wider cursor-pointer",style:{background:m===$?"var(--hud-bg-alt)":"transparent",color:m===$?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:m===$?"2px solid var(--accent)":"2px solid transparent"},children:$==="save"?"SAVE":"HISTORY"},$))}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[m==="save"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"text-[11px]",style:{color:"var(--terminal-text-secondary)"},children:A.length>0?o.jsxs("span",{style:{color:"var(--idle-amber)"},children:["* ",A.length," unsaved change",A.length>1?"s":""]}):o.jsx("span",{style:{color:"var(--active-green)"},children:"All changes saved"})}),A.length>0&&o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Changed Files"}),o.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:A.map(({status:$,file:ee})=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx("span",{style:{color:$==="A"?"var(--active-green)":"var(--idle-amber)",width:"14px"},children:$}),o.jsx("span",{style:{color:"var(--terminal-text-secondary)"},children:ee})]},ee))})]}),A.length>0&&o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Save Message"}),o.jsxs("button",{onClick:O,className:"text-[9px] px-1.5 py-0.5 cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--accent)",fontFamily:"var(--pixel-font)"},title:"Auto-generate message from changes",children:["✨"," AUTO"]})]}),o.jsx("input",{ref:E,type:"text",value:d,onChange:$=>g($.target.value),placeholder:"Auto-generated — edit if needed",className:"w-full px-3 py-2 text-[12px] outline-none",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"}})]}),A.length>0&&o.jsx("div",{className:"flex gap-3",children:o.jsx("button",{onClick:L,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"})}),A.length>0&&t&&!t.hasRemote&&o.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"Local save only — add a git remote to enable push"}),S&&o.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! ",S.filesChanged," file",S.filesChanged>1?"s":""," committed",S.pushed?" & pushed":"",S.pushError?` (push error: ${S.pushError})`:""]}),y&&o.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)&&o.jsxs("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:["Last save: ",t.lastCommit.message," (",$0(t.lastCommit.date),")"]})]}),m==="history"&&o.jsxs(o.Fragment,{children:[l.length===0&&o.jsx("div",{className:"text-[11px] text-center py-8",style:{color:"var(--terminal-text-muted)"},children:"No save history"}),o.jsx("div",{className:"space-y-1",children:l.map($=>o.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:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--accent)"},children:$.shortSha}),o.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--terminal-text)"},children:$.message})]}),o.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:$0($.date)})]}),o.jsx("button",{onClick:()=>F($.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"})]},$.sha))})]})]})]})]})}function PE({onClose:t}){const[l,r]=k.useState(null),[i,c]=k.useState(!0),[u,f]=k.useState(null);return k.useEffect(()=>{Ce.getCompanyStats().then(r).catch(m=>f(m.message)).finally(()=>c(!1))},[]),i?o.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading stats..."}):u||!l?o.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u||"Failed to load stats",o.jsx("button",{onClick:t,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]}):o.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:20},children:[o.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Company Stats"}),o.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:20},children:[o.jsx(yc,{label:"Roles",value:String(l.company.roleCount)}),o.jsx(yc,{label:"Avg Level",value:`Lv.${l.company.avgLevel}`}),o.jsx(yc,{label:"Total Tokens",value:l.company.formattedTokens}),o.jsx(yc,{label:"Total Cost",value:`$${l.company.totalCostUsd.toFixed(2)}`})]}),o.jsx("h4",{style:{margin:"0 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Role Leaderboard"}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[l.roles.map((m,x)=>o.jsx(eN,{role:m,rank:x+1},m.roleId)),l.roles.length===0&&o.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"8px 0"},children:"No role activity yet. Assign tasks to start leveling up!"})]}),Object.keys(l.byModel).length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h4",{style:{margin:"20px 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Model Usage"}),o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:Object.entries(l.byModel).map(([m,x])=>o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"6px 10px",background:"rgba(255,255,255,0.03)",borderRadius:6,fontSize:12},children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.7)"},children:tN(m)}),o.jsxs("span",{style:{color:"rgba(255,255,255,0.5)"},children:["$",x.costUsd.toFixed(2)]})]},m))})]})]})}function yc({label:t,value:l}){return o.jsxs("div",{style:{padding:"12px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[o.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.45)",marginBottom:4},children:t}),o.jsx("div",{style:{fontSize:18,fontWeight:600},children:l})]})}function eN({role:t,rank:l}){const r=["🥇","🥈","🥉"],i=l<=3?r[l-1]:`#${l}`;return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:8},children:[o.jsx("span",{style:{fontSize:14,width:28,textAlign:"center",flexShrink:0},children:i}),o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:4},children:[o.jsx("span",{style:{fontSize:13,fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),o.jsxs("span",{style:{fontSize:12,color:H0(t.level),fontWeight:600,flexShrink:0,marginLeft:8},children:["Lv.",t.level]})]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[o.jsx("div",{style:{flex:1,height:4,background:"rgba(255,255,255,0.08)",borderRadius:2,overflow:"hidden"},children:o.jsx("div",{style:{width:`${t.progress*100}%`,height:"100%",background:H0(t.level),borderRadius:2,transition:"width 0.3s ease"}})}),o.jsx("span",{style:{fontSize:10,color:"rgba(255,255,255,0.4)",flexShrink:0},children:t.formattedTokens})]})]})]})}function H0(t){return t>=9?"#FFD700":t>=7?"#C0A0FF":t>=5?"#4FC3F7":t>=3?"#81C784":"rgba(255,255,255,0.4)"}function tN(t){return t.includes("opus")?"Opus":t.includes("sonnet")?"Sonnet":t.includes("haiku")?"Haiku":t.split("-").slice(0,2).join(" ")}function nN({onClose:t,onSyncComplete:l}){const[r,i]=k.useState([]),[c,u]=k.useState([]),[f,m]=k.useState(!0),[x,d]=k.useState(null),[g,y]=k.useState(new Set),[b,v]=k.useState(null),[j,S]=k.useState(null),C=k.useCallback(async()=>{m(!0),v(null);try{const{roles:A}=await Ce.getSyncRoles();i(A);const M=A.filter(L=>L.source.sync!=="off");if(M.length===0){u([]),S(null);return}let O=!1;try{const L=await Ts.syncCheck(M.map(I=>({roleId:I.roleId,sourceId:I.source.id,currentVersion:I.source.upstream_version??I.source.forked_at??"0.0.0"})));O=!0,S(!0);const F=[];for(const I of L.updates){if(!I.hasUpdate)continue;const $=M.find(W=>W.roleId===I.roleId);if(!$)continue;const{character:ee}=await Ts.syncPull(I.sourceId),z=[];$.persona.trim()!==ee.persona.trim()&&z.push({field:"persona",local:$.persona.slice(0,120)+($.persona.length>120?"...":""),upstream:ee.persona.slice(0,120)+(ee.persona.length>120?"...":"")});const X=JSON.stringify($.authority),R=JSON.stringify(ee.authority);X!==R&&z.push({field:"authority",local:`${$.authority.autonomous.length} autonomous, ${$.authority.needsApproval.length} approval`,upstream:`${ee.authority.autonomous.length} autonomous, ${ee.authority.needsApproval.length} approval`}),z.length>0&&F.push({roleId:I.roleId,roleName:$.name,sourceId:I.sourceId,currentVersion:I.currentVersion,latestVersion:I.latestVersion,fields:z})}u(F)}catch{S(!1),u([])}}catch(A){v(A instanceof Error?A.message:"Failed to check for updates")}finally{m(!1)}},[]);k.useEffect(()=>{C()},[C]);const E=async A=>{d(A.roleId);try{const{character:M,version:O}=await Ts.syncPull(A.sourceId);await Ce.applySyncUpdate({roleId:A.roleId,changes:{persona:M.persona,authority:M.authority},upstreamVersion:O}),y(L=>new Set(L).add(A.roleId)),l==null||l()}catch(M){v(M instanceof Error?M.message:"Failed to apply update")}finally{d(null)}};return o.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[o.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Role Sync"}),o.jsxs("div",{style:{display:"flex",gap:8},children:[o.jsx("button",{onClick:C,disabled:f,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:f?"wait":"pointer"},children:f?"Checking...":"Refresh"}),o.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),j===!1&&o.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,180,0,0.1)",borderRadius:6,color:"#FFB74D",fontSize:12,marginBottom:12},children:"Cloud API unreachable. Sync requires connection to api.tycono.ai."}),b&&o.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:b}),o.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Tracked roles: "}),o.jsx("span",{style:{fontWeight:500},children:r.length}),o.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Updates available: "}),o.jsx("span",{style:{fontWeight:500,color:c.length>0?"#4FC3F7":"rgba(255,255,255,0.7)"},children:c.filter(A=>!g.has(A.roleId)).length}),j===!0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),o.jsx("span",{style:{fontSize:11,color:"#81C784"},children:"Cloud connected"})]})]}),c.length===0&&!f&&o.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:r.length===0?"No roles with source tracking. Hire from the Store to enable sync.":"All roles are up to date!"}),c.map(A=>o.jsxs("div",{style:{marginBottom:12,padding:14,background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:14,fontWeight:500},children:A.roleName}),o.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.4)"},children:[A.sourceId," · v",A.currentVersion," → v",A.latestVersion]})]}),g.has(A.roleId)?o.jsx("span",{style:{fontSize:12,color:"#81C784"},children:"Applied ✓"}):o.jsx("button",{onClick:()=>E(A),disabled:x===A.roleId,style:{background:"#1565C0",border:"none",color:"white",borderRadius:6,padding:"5px 12px",fontSize:12,cursor:x===A.roleId?"wait":"pointer",opacity:x===A.roleId?.6:1},children:x===A.roleId?"Applying...":"Apply Update"})]}),A.fields.map(M=>o.jsxs("div",{style:{marginBottom:6,fontSize:12},children:[o.jsx("div",{style:{color:"rgba(255,255,255,0.5)",marginBottom:2,textTransform:"uppercase",fontSize:10,letterSpacing:.5},children:M.field}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},children:[o.jsxs("div",{style:{padding:"4px 8px",background:"rgba(255,100,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[o.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"LOCAL"}),o.jsx("br",{}),M.local]}),o.jsxs("div",{style:{padding:"4px 8px",background:"rgba(100,255,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[o.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"UPSTREAM"}),o.jsx("br",{}),M.upstream]})]})]},M.field))]},A.roleId)),r.length>0&&o.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Roles hired from the Store are tracked automatically. Set ",o.jsx("code",{style:{background:"rgba(255,255,255,0.06)",padding:"1px 4px",borderRadius:3},children:"sync: off"})," in role.yaml to stop tracking."]})]})}function lN({onClose:t}){const[l,r]=k.useState(null),[i,c]=k.useState(!0),[u,f]=k.useState(null),[m,x]=k.useState(null),d=k.useCallback(async()=>{c(!0),f(null);try{const A=await Ce.getGitStatus();r(A)}catch(A){f(A instanceof Error?A.message:"Failed to load git status")}finally{c(!1)}},[]);k.useEffect(()=>{d()},[d]);const g=async A=>{x(A.path);try{await Ce.deleteWorktree(A.path),await d()}catch(M){f(M instanceof Error?M.message:"Failed to remove worktree")}finally{x(null)}},y=async A=>{x(A);try{await Ce.deleteBranch(A),await d()}catch(M){f(M instanceof Error?M.message:"Failed to delete branch")}finally{x(null)}};if(i&&!l)return o.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading git status..."});if(u&&!l)return o.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u,o.jsx("button",{onClick:t,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]});if(!l)return null;const b=l.worktrees.filter(A=>A.status==="active"),v=l.worktrees.filter(A=>A.status==="pending-merge"),j=l.worktrees.filter(A=>A.status==="stale");function S(A){const M=A.split("/");if(M.length>1){const O=M[M.length-1],L=["cto","cbo","pm","engineer","designer","qa","data-analyst"];for(const F of L)if(O.toLowerCase().includes(F))return F}return null}function C(A,M=40){return A.length<=M?A:"..."+A.slice(A.length-M+3)}function E(A){const M=Date.now()-new Date(A).getTime(),O=Math.floor(M/6e4);if(O<1)return"just now";if(O<60)return`${O}m ago`;const L=Math.floor(O/60);return L<24?`${L}h ago`:`${Math.floor(L/24)}d ago`}return o.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[o.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"GIT STATUS"}),o.jsxs("div",{style:{display:"flex",gap:8},children:[o.jsx("button",{onClick:d,disabled:i,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:i?"wait":"pointer"},children:i?"Checking...":"Refresh"}),o.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),u&&o.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:u}),o.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o.jsxs("div",{children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Branch: "}),o.jsx("span",{style:{fontWeight:500},children:l.currentBranch})]}),o.jsx("div",{children:l.unsavedCount>0&&o.jsxs("span",{style:{color:"#FFB74D",fontSize:12},children:[l.unsavedCount," unsaved"]})})]}),l.lastCommit&&o.jsxs("div",{style:{marginTop:6,fontSize:11,color:"rgba(255,255,255,0.4)"},children:["Last commit: ",l.lastCommit.message.slice(0,60),l.lastCommit.message.length>60?"...":""," · ",E(l.lastCommit.date)]})]}),b.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gc,{label:"Active Worktrees",count:b.length}),b.map(A=>o.jsx(_d,{wt:A,roleFromBranch:A.roleId||S(A.branch),truncatePath:C,timeAgo:E,removing:m===A.path,onRemove:()=>g(A),statusColor:"#4FC3F7",statusIcon:"📂"},A.path))]}),v.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gc,{label:"Pending Merge",count:v.length}),v.map(A=>o.jsx(_d,{wt:A,roleFromBranch:A.roleId||S(A.branch),truncatePath:C,timeAgo:E,removing:m===A.path,onRemove:()=>g(A),statusColor:"#FFB74D",statusIcon:"⚠️"},A.path))]}),j.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gc,{label:"Stale",count:j.length}),j.map(A=>o.jsx(_d,{wt:A,roleFromBranch:A.roleId||S(A.branch),truncatePath:C,timeAgo:E,removing:m===A.path,onRemove:()=>g(A),statusColor:"#ff6b6b",statusIcon:"🔴"},A.path))]}),l.staleBranches.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gc,{label:"Unmerged Branches",count:l.staleBranches.length}),l.staleBranches.map(A=>o.jsxs("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o.jsxs("div",{style:{fontSize:13},children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.5)",marginRight:6},children:"⚠️"}),o.jsx("span",{style:{fontWeight:500},children:A})]}),o.jsx("button",{onClick:()=>y(A),disabled:m===A,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:"#ff6b6b",borderRadius:4,padding:"3px 8px",fontSize:10,cursor:m===A?"wait":"pointer",opacity:m===A?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5},children:m===A?"...":"DELETE"})]},A))]}),b.length===0&&v.length===0&&j.length===0&&l.staleBranches.length===0&&o.jsxs("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:["✓"," All clean. No active worktrees or stale branches."]}),l.lastMerge&&o.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Last merge: ",o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:l.lastMerge.branch})," · ",l.lastMerge.roleId," · ",E(l.lastMerge.mergedAt)]})]})}function gc({label:t,count:l}){return o.jsxs("h4",{style:{margin:"16px 0 8px",fontSize:11,fontWeight:600,color:"rgba(255,255,255,0.5)",textTransform:"uppercase",letterSpacing:1},children:[t," (",l,")"]})}function _d({wt:t,roleFromBranch:l,truncatePath:r,timeAgo:i,removing:c,onRemove:u,statusColor:f,statusIcon:m}){return o.jsx("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsxs("div",{style:{fontSize:13,fontWeight:500,marginBottom:2},children:[o.jsx("span",{style:{marginRight:6},children:m}),t.branch,l&&o.jsx("span",{style:{marginLeft:8,fontSize:10,padding:"1px 6px",background:"rgba(255,255,255,0.08)",borderRadius:3,color:"rgba(255,255,255,0.6)",textTransform:"uppercase"},children:l})]}),t.task&&o.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.5)",marginBottom:2},children:['"',t.task.slice(0,50),t.task.length>50?"...":"",'"']}),o.jsxs("div",{style:{fontSize:10,color:"rgba(255,255,255,0.35)"},children:[r(t.path)," · ",t.filesChanged," file",t.filesChanged!==1?"s":""," changed"," · ",i(t.createdAt)]}),t.conflictFiles&&t.conflictFiles.length>0&&o.jsxs("div",{style:{fontSize:10,color:"#ff6b6b",marginTop:4},children:["⛔"," CONFLICT: ",t.conflictFiles.join(", ")]})]}),o.jsx("button",{onClick:u,disabled:c,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:f,borderRadius:4,padding:"3px 8px",fontSize:10,cursor:c?"wait":"pointer",opacity:c?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5,flexShrink:0,marginLeft:8},children:c?"...":"REMOVE"})]})})}function rN({onClose:t,speechSettings:l,onSpeechSettingsChange:r,language:i,onLanguageChange:c,onOpenSync:u,onOpenGitStatus:f,onOpenStats:m}){var x;return o.jsx("div",{className:"customize-overlay",onClick:t,children:o.jsxs("div",{className:"customize-modal",onClick:d=>d.stopPropagation(),style:{maxWidth:480},children:[o.jsxs("div",{className:"customize-header",children:[o.jsx("div",{style:{fontSize:12,fontWeight:700,letterSpacing:1,color:"var(--terminal-text)"},children:"SETTINGS"}),o.jsx("button",{className:"customize-close",onClick:t,children:"X"})]}),o.jsx("div",{className:"customize-body",style:{padding:"12px 20px 20px"},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),o.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(d=>o.jsxs("button",{onClick:()=>r==null?void 0:r({mode:d}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(l==null?void 0:l.mode)===d?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(l==null?void 0:l.mode)===d?"rgba(255,255,255,0.08)":"transparent",color:(l==null?void 0:l.mode)===d?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[o.jsx("div",{style:{fontWeight:600,marginBottom:2},children:d==="template"?"TEMPLATE":d==="llm"?"AI":"AUTO"}),o.jsx("div",{style:{fontSize:9,opacity:.7},children:d==="template"?"Static pool ($0)":d==="llm"?"LLM generated":"Detect engine"})]},d))}),o.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(l==null?void 0:l.intervalSec)??18,"s"]}),o.jsx("input",{type:"range",min:5,max:120,step:5,value:(l==null?void 0:l.intervalSec)??18,onChange:d=>r==null?void 0:r({intervalSec:Number(d.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[o.jsx("span",{children:"5s (frequent)"}),o.jsx("span",{children:"120s (rare)"})]})]}),(l==null?void 0:l.mode)!=="template"&&o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((x=l==null?void 0:l.dailyBudgetUsd)==null?void 0:x.toFixed(2))??"1.00"]}),o.jsx("input",{type:"range",min:0,max:5,step:.25,value:(l==null?void 0:l.dailyBudgetUsd)??1,onChange:d=>r==null?void 0:r({dailyBudgetUsd:Number(d.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[o.jsx("span",{children:"$0 (unlimited)"}),o.jsx("span",{children:"$5.00/day"})]})]}),o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),o.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:d,label:g})=>o.jsx("button",{onClick:()=>c==null?void 0:c(d),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(i??"auto")===d?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(i??"auto")===d?"rgba(255,255,255,0.08)":"transparent",color:(i??"auto")===d?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:g},d))}),o.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]}),o.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.08)",paddingTop:16,display:"flex",gap:8},children:[u&&o.jsx("button",{onClick:()=>{t(),u()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"🔄 ROLE SYNC"}),f&&o.jsx("button",{onClick:()=>{t(),f()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📂 GIT STATUS"}),m&&o.jsx("button",{onClick:()=>{t(),m()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📊 COMPANY STATS"})]})]})})]})})}function aN({theme:t,onThemeChange:l,onClose:r}){const i=k.useRef(null);return k.useEffect(()=>{const c=u=>{i.current&&!i.current.contains(u.target)&&r()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]),o.jsx("div",{ref:i,className:"theme-dropup",children:Object.entries(Hr).map(([c,u])=>o.jsxs("button",{className:`theme-dropup__item${t===c?" theme-dropup__item--active":""}`,onClick:()=>{l(c),r()},title:u.name,children:[o.jsxs("span",{className:"theme-dropup__swatch",style:{background:u.vars["--hud-bg"],borderColor:u.vars["--pixel-border"]},children:[o.jsx("span",{style:{background:u.vars["--accent"],width:5,height:5,borderRadius:1}}),o.jsx("span",{style:{background:u.vars["--active-green"],width:5,height:5,borderRadius:1}}),o.jsx("span",{style:{background:u.vars["--idle-amber"],width:5,height:5,borderRadius:1}})]}),o.jsx("span",{className:"theme-dropup__name",children:u.icon})]},c))})}const _c=[0,1e4,5e4,15e4,4e5,1e6,25e5,5e6,1e7,25e6];function Fg(t){let l=1;for(let r=_c.length-1;r>=0;r--)if(t>=_c[r]){l=r+1;break}return Math.min(l,10)}function iN(t){const l=Fg(t);if(l>=10)return 1;const r=_c[l-1],i=_c[l];return Math.min(1,(t-r)/(i-r))}function U0(t){const l={};for(const[r,i]of Object.entries(t)){const c=i.inputTokens+i.outputTokens;l[r]={level:Fg(c),totalTokens:c,progress:iN(c)}}return l}const sN=[{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 I0(t){return sN.filter(l=>l.check(t))}const oN={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍","data-analyst":"📊"},jc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},cN={cto:"아키텍처",cbo:"시장 분석",pm:"PRD 작성",engineer:"코딩",designer:"시안 제작",qa:"품질 검증"};function uN(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 fN({importJob:t,onImportDone:l}){var ji,Na,Ci;const[r,i]=k.useState([]),[c,u]=k.useState([]),[f,m]=k.useState([]),[x,d]=k.useState([]),[g,y]=k.useState([]),[b,v]=k.useState([]),[j,S]=k.useState("TYCONO"),[C,E]=k.useState(!0),[A,M]=k.useState(null),[O,L]=k.useState({type:"none"}),[F,I]=k.useState(null),[$,ee]=k.useState(null),[z,X]=k.useState([]),[R,W]=k.useState(!1),[te,V]=k.useState([]),[Y,Z]=k.useState(0),[ce,we]=k.useState(!1),[D,B]=k.useState({}),[Q,T]=k.useState("ceo"),[me,Se]=k.useState(null),[Ee,Be]=k.useState(!1),[He,Ke]=k.useState({}),ke=k.useRef({}),[yt,de]=k.useState(!1),[G,re]=k.useState(null),[ve,ze]=k.useState({}),[Ne,Te]=k.useState([]),[Me,Oe]=k.useState([]),[tt,Lt]=k.useState(void 0),[gt,ht]=k.useState(!1);k.useEffect(()=>{Ce.getStatus().then(_=>{Lt(_.engine),ht(!!_.hasApiKey)}).catch(()=>{})},[]);const{getAppearance:Zt,setAppearance:ae,resetAppearance:xe,theme:De,setTheme:Ue,speechSettings:ye,setSpeechSettings:je,language:jt,setLanguage:wt}=YC(),[Xe,ft]=k.useState(null),[fe,Mt]=k.useState("character"),it=XC(),[mi,lr]=k.useState(!1),[wa,Tl]=k.useState(!1),[Dl,rr]=k.useState(!1),[qr,ka]=k.useState(!1),[Us,Xr]=k.useState(!1),[ar,xi]=k.useState(!1),[On,Is]=k.useState(null);k.useEffect(()=>{const _=se=>{(se.metaKey||se.ctrlKey)&&se.key==="s"&&(se.preventDefault(),it.dirtyCount>0&&lr(!0))};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[it.dirtyCount]),k.useEffect(()=>{let _=!1;const se=async()=>{try{const pe=await Ce.getGitStatus();_||Is(pe)}catch{}};se();const he=setInterval(se,1e4);return()=>{_=!0,clearInterval(he)}},[]);const[zl,Vr]=k.useState(null),[ml,Ml]=k.useState(null),[Rl,il]=k.useState([]),[$t,cn]=k.useState(!1),Fl=k.useRef(!1),Gr=k.useRef(null);let Ys=k.useRef(0);const qs=k.useRef(new Set),xl=(_,se,he)=>{const pe={id:Ys.current++,type:_,text:se,detail:he};il(ge=>[...ge,pe])};k.useEffect(()=>{var _;$t&&((_=Gr.current)==null||_.scrollIntoView({behavior:"smooth"}))},[Rl,$t]),k.useEffect(()=>{t&&(Fl.current||(Fl.current=!0,Ml("Scanning knowledge sources..."),il([{id:0,type:"scan",text:"Starting knowledge import..."}]),Ys.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 _=>{var ge;const se=(ge=_.body)==null?void 0:ge.getReader();if(!se)return;const he=new TextDecoder;let pe="";for(;;){const{done:Re,value:Le}=await se.read();if(Re)break;pe+=he.decode(Le,{stream:!0});const Je=pe.split(`
89
+ `);pe=Je.pop()||"";let nt="";for(const Ve of Je)if(Ve.startsWith("event: "))nt=Ve.slice(7).trim();else if(Ve.startsWith("data: ")&&nt){try{const It=JSON.parse(Ve.slice(6));switch(nt){case"scanning":Ml(`Scanning: ${It.path} (${It.fileCount} files)`),xl("scan",`Found ${It.fileCount} files`,It.path);break;case"processing":Vr({index:It.index,total:It.total}),Ml(`Importing knowledge... (${It.index}/${It.total})`),xl("process",`Processing: ${It.file}`,`${It.index} / ${It.total}`);break;case"created":xl("created",It.title,It.summary);break;case"skipped":xl("process",`Skipped: ${It.file}`,It.reason);break;case"done":Ml(null),Vr(null),xl("done",`Import complete! ${It.created} created, ${It.skipped} skipped.`),qt(`Knowledge import complete! ${It.created} documents imported.`,"#2E7D32"),l==null||l();break;case"error":Ml(null),Vr(null),xl("error",It.message),qt(`Import failed: ${It.message}`,"#B71C1C"),l==null||l();break}}catch{}nt=""}}}).catch(_=>{Ml(null),xl("error",_.message),qt(`Import error: ${_.message}`,"#B71C1C"),l==null||l()})))},[t]);const[_l,Sa]=k.useState("iso"),[Ol,ir]=k.useState(typeof window<"u"?window.innerWidth:1200);k.useEffect(()=>{const _=()=>ir(window.innerWidth);return window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)},[]);const Bl=Ol<1024,[un,Ft]=k.useState(!1),[sr,Xs]=k.useState(560),[Cn,Kt]=k.useState([]),[ja,Kn]=k.useState(null),[or,pi]=k.useState(null),{sendMessage:Ca}=HC();k.useEffect(()=>{Promise.all([Ce.getCompany().then(_=>{S(_.name),i(_.roles)}),Ce.getProjects().then(u),Ce.getStandups().then(m),Ce.getWaves().then(d),Ce.getDecisions().then(y),Ce.getKnowledge().then(v).catch(()=>{}),Ce.getOrgTree().then(_=>{B(_.nodes),T(_.root)}).catch(()=>{}),Ce.getCostSummary().then(_=>Vs(U0(_.byRole))).catch(()=>{})]).catch(_=>M(`Failed to load: ${_.message}`)).finally(()=>E(!1))},[]),k.useEffect(()=>{Ce.deleteEmptySessions().catch(()=>{}),Ce.getSessions().then(_=>{if(_.length>0){const se=_.map(pe=>({...pe,messages:[]}));Kt(se);const he=se.find(pe=>pe.status==="active")??se[0];Kn(he.id),Ft(!0)}}).catch(_=>{console.error("Failed to load sessions",_)})},[]),k.useEffect(()=>{const _=()=>{fetch("/api/exec/status").then(he=>he.json()).then(he=>{ze(he.statuses??{}),Te(he.activeExecutions??[])}).catch(()=>{})};_();const se=setInterval(_,3e3);return()=>clearInterval(se)},[]);const pl=k.useMemo(()=>{const _={...ve};if(or){const se=Cn.find(he=>he.id===or);se&&(_[se.roleId]="working")}return _},[ve,or,Cn]);k.useEffect(()=>{O.type==="role"?Ce.getRole(O.roleId).then(I).catch(console.error):I(null)},[O]);const bn=()=>L({type:"none"}),En=async(_,se)=>{const he=r.find(ge=>ge.id===_),pe=($==null?void 0:$.mode)==="ask";ee(null);try{const{jobId:ge}=await Ce.startJob({type:"assign",roleId:_,task:se,readOnly:pe}),Re=jc[_]??"#666",Le=`${_.toUpperCase()} · ${(he==null?void 0:he.name)??_}`;we(!1),X([{jobId:ge,title:Le,color:Re}]),Ut.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO → ${(he==null?void 0:he.name)??_}] ${pe?"Ask":"Assign"}: ${se}`,type:"dispatch",targetRoleId:_})}catch(ge){qt(`Failed to start job: ${ge instanceof Error?ge.message:"unknown"}`,"#C62828")}},qt=(_,se)=>{const he=Date.now();Oe(pe=>[...pe,{id:he,message:_,color:se}]),setTimeout(()=>Oe(pe=>pe.filter(ge=>ge.id!==he)),4e3)},Vs=_=>{var he,pe;const se=ke.current;for(const[ge,Re]of Object.entries(_)){const Le=((he=se[ge])==null?void 0:he.level)??0;if(Le>0&&Re.level>Le){const Je=((pe=r.find(nt=>nt.id===ge))==null?void 0:pe.name)??ge.toUpperCase();qt(`${Je} leveled up to Lv.${Re.level}!`,"#7C3AED")}}ke.current=_,Ke(_)};k.useEffect(()=>{const _={roles:Object.entries(He).map(([pe,ge])=>({id:pe,level:ge.level,totalTokens:ge.totalTokens})),totalTokens:Object.values(He).reduce((pe,ge)=>pe+ge.totalTokens,0),roleCount:r.length},se=I0(_),he=qs.current;for(const pe of se)he.has(pe.id)||he.size>0&&qt(`${pe.icon} Badge earned: ${pe.name}!`,"#D4A017");qs.current=new Set(se.map(pe=>pe.id))},[He,r.length]);const yi=()=>{var se;const _=z[z.length-1];_&&(qt(`${_.title} completed`,_.color),Ut.pushMessage({ts:Date.now(),roleId:((se=_.title.split(" · ")[0])==null?void 0:se.toLowerCase())??"unknown",text:`[${_.title}] Job completed`,type:"dispatch"})),Ce.getStandups().then(m).catch(console.error),Ce.getCompany().then(he=>i(he.roles)).catch(console.error),Ce.getCostSummary().then(he=>Vs(U0(he.byRole))).catch(()=>{})},Gs=async _=>{W(!1);try{const se=await Ce.startJob({type:"wave",directive:_}),he=se.jobIds??(se.jobId?[se.jobId]:[]),pe=r.filter(Re=>Re.level==="c-level"),ge=he.map((Re,Le)=>{var Je,nt;return{jobId:Re,roleId:((Je=pe[Le])==null?void 0:Je.id)??`role-${Le}`,roleName:((nt=pe[Le])==null?void 0:nt.name)??`C-Level ${Le+1}`}});Ut.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO WAVE] "${_}" → ${ge.map(Re=>Re.roleName).join(", ")}`,type:"dispatch"}),Object.keys(D).length>0?(Se({directive:_,rootJobs:ge}),Be(!1)):(V(ge),Z(0),we(!1),ge.length>0&&X([{jobId:ge[0].jobId,title:`CEO WAVE · ${ge[0].roleId.toUpperCase()}`,color:"#B71C1C"}]))}catch(se){qt(`Failed to start wave: ${se instanceof Error?se.message:"unknown"}`,"#C62828")}},Kr=()=>{Ce.getWaves().then(d).catch(console.error),Ce.getStandups().then(m).catch(console.error)},gi=()=>{Ce.getCompany().then(_=>i(_.roles)).catch(console.error)},Nn=async(_,se)=>{await Ce.createRole(_),ae(_.id,se),gi(),qt(`${_.name} hired!`,"#2E7D32")},bi=async _=>{await Ce.deleteRole(_),gi(),re(null),qt(`${_.toUpperCase()} removed`,"#B71C1C")},vi=async(_,se)=>{await Ce.updateRole(_,se),gi(),O.type==="role"&&O.roleId===_&&Ce.getRole(_).then(I).catch(console.error),se.name&&qt(`${_.toUpperCase()} renamed to "${se.name}"`,"#1565C0")},wi=_=>{Ft(!0)},cr=async _=>{try{const se=await Ce.createSession(_,"talk");Kt(he=>[se,...he]),Kn(se.id),Ft(!0)}catch(se){console.error("Failed to create session",se),qt(`Failed to create session: ${se instanceof Error?se.message:"API unreachable"}`,"#B71C1C")}},Ks=async _=>{try{const se=await Ce.createSession(_,"talk");Kt(he=>[se,...he]),Kn(se.id)}catch(se){console.error("Failed to create session",se),qt(`Failed to create session: ${se instanceof Error?se.message:"API unreachable"}`,"#B71C1C")}},Qs=async _=>{const se=Ne.find(ge=>ge.roleId===_),he=(se==null?void 0:se.jobId)??(se==null?void 0:se.id);if(he&&pl[_]==="working"){const ge=r.find(Je=>Je.id===_),Re=jc[_]??"#666",Le=`${_.toUpperCase()} · ${(ge==null?void 0:ge.name)??_}`;X([{jobId:he,title:Le,color:Re}]),we(!1);return}const pe=Cn.find(ge=>ge.roleId===_);if(pe)Kn(pe.id),Ut.setActiveChannelId(null);else try{const ge=await Ce.createSession(_,"talk");Kt(Re=>[ge,...Re]),Kn(ge.id),Ut.setActiveChannelId(null)}catch(ge){console.error("Failed to create session",ge)}Ft(!0)},ur=async _=>{try{await Ce.deleteSession(_),Kt(se=>{var pe;const he=se.filter(ge=>ge.id!==_);return ja===_&&Kn(((pe=he[0])==null?void 0:pe.id)??null),he})}catch(se){console.error("Failed to delete session",se),qt(`Failed to close session: ${se instanceof Error?se.message:"API error"}`,"#B71C1C")}},qc=async()=>{try{const{ids:_}=await Ce.deleteEmptySessions();if(_.length===0)return;Kt(se=>{var pe;const he=se.filter(ge=>!_.includes(ge.id));return ja&&_.includes(ja)&&Kn(((pe=he[0])==null?void 0:pe.id)??null),he}),qt(`Cleared ${_.length} empty session${_.length!==1?"s":""}`,"#2E7D32")}catch(_){qt(`Failed to clear empty sessions: ${_ instanceof Error?_.message:"API error"}`,"#B71C1C")}},Ws=async()=>{if(!confirm("Close all sessions? This cannot be undone."))return;const _=Cn.map(se=>se.id);try{await Ce.deleteSessions(_),Kt([]),Kn(null),qt("All sessions closed","#2E7D32")}catch(se){qt(`Failed to close sessions: ${se instanceof Error?se.message:"API error"}`,"#B71C1C")}},sl=(_,se)=>{Kt(he=>he.map(pe=>{if(pe.id!==_)return pe;const ge=[...pe.messages],Re=ge[ge.length-1];if(Re&&Re.from==="role"&&Re.status==="streaming"){const Le=[...Re.streamEvents??[],se];ge[ge.length-1]={...Re,streamEvents:Le}}return{...pe,messages:ge}}))},Ea=(_,se,he)=>{const pe={id:`msg-${Date.now()}-ceo`,from:"ceo",content:se,type:he==="do"?"directive":"conversation",status:"done",timestamp:new Date().toISOString()},ge={id:`msg-${Date.now()+1}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:new Date().toISOString(),streamEvents:[]};Kt(Re=>Re.map(Le=>Le.id===_?{...Le,messages:[...Le.messages,pe,ge],updatedAt:new Date().toISOString()}:Le)),pi(_),Ca(_,se,he,{onThinking:Re=>{Kt(Le=>Le.map(Je=>{if(Je.id!==_)return Je;const nt=[...Je.messages],Ve=nt[nt.length-1];return Ve&&Ve.from==="role"&&Ve.status==="streaming"&&(nt[nt.length-1]={...Ve,thinking:(Ve.thinking??"")+Re}),{...Je,messages:nt}})),sl(_,{type:"thinking",timestamp:Date.now(),text:Re})},onText:Re=>{Kt(Le=>Le.map(Je=>{if(Je.id!==_)return Je;const nt=[...Je.messages],Ve=nt[nt.length-1];return Ve&&Ve.from==="role"&&Ve.status==="streaming"&&(nt[nt.length-1]={...Ve,content:Ve.content+Re}),{...Je,messages:nt}}))},onToolUse:(Re,Le)=>{sl(_,{type:"tool",timestamp:Date.now(),toolName:Re,toolInput:Le})},onDispatch:(Re,Le)=>{sl(_,{type:"dispatch",timestamp:Date.now(),roleId:Re,task:Le})},onDispatchProgress:(Re,Le,Je)=>{var nt;Le==="tool"?sl(_,{type:"dispatch:progress",timestamp:Date.now(),roleId:Re,progressType:"tool",toolName:Je.name,toolInput:Je.input}):Le==="thinking"?sl(_,{type:"dispatch:progress",timestamp:Date.now(),roleId:Re,progressType:"thinking",text:Je.text}):Le==="text"?sl(_,{type:"dispatch:progress",timestamp:Date.now(),roleId:Re,progressType:"text",text:(nt=Je.text)==null?void 0:nt.slice(-200)}):(Le==="done"||Le==="error")&&sl(_,{type:"dispatch:progress",timestamp:Date.now(),roleId:Re,progressType:Le})},onTurn:Re=>{sl(_,{type:"turn",timestamp:Date.now(),turn:Re})},onDone:()=>{Kt(Re=>Re.map(Le=>{if(Le.id!==_)return Le;const Je=Le.messages.map(Ve=>Ve.status==="streaming"?{...Ve,status:"done"}:Ve),nt=Le.messages.length<=2?se.slice(0,40).replace(/\n/g," "):Le.title;return{...Le,messages:Je,title:nt}})),pi(null)},onError:Re=>{Kt(Le=>Le.map(Je=>{if(Je.id!==_)return Je;const nt=Je.messages.map(Ve=>Ve.status==="streaming"?{...Ve,status:"error",content:Ve.content||Re}:Ve);return{...Je,messages:nt}})),pi(null)}})},Xc=(_,se)=>{Kt(he=>he.map(pe=>pe.id===_?{...pe,mode:se}:pe)),Ce.updateSession(_,{mode:se}).catch(console.error)},Vc=new Date().toISOString().slice(0,10),Bn=c[0],Qn={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},ki=_=>{const se=Qn[_];if(!se)return"";for(const he of f){const pe=he.content,ge=pe.indexOf(`## ${se}`);if(ge===-1)continue;const Re=pe.indexOf(`
90
90
  ## `,ge+10),Je=(Re===-1?pe.slice(ge):pe.slice(ge,Re)).split(`
91
- `).filter(lt=>lt.trim().length>0);for(const lt of Je){const Ve=lt.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""},Si=_=>{const se=Qn[_];if(!se)return"";for(const he of f){const pe=he.content,ge=pe.indexOf(`## ${se}`);if(ge===-1)continue;const Re=pe.indexOf(`
92
- ## `,ge+10),Je=(Re===-1?pe.slice(ge):pe.slice(ge,Re)).replace(/^## .+\n/,"").trim();if(Je)return Je.slice(0,1500)}return""},Ut=rE();S.useEffect(()=>{r.length>0&&Ut.syncDefaultMembers(r)},[r]);const Wn=PC({roles:r,roleStatuses:ve,activeExecs:Ne,getStandupSpeech:ki});return cE({roles:r,roleStatuses:ve,activeExecs:Ne,channels:Ut.channels,relationships:Wn.relationships,pushMessage:Ut.pushMessage,speechSettings:ye,engineType:tt,hasApiKey:gt}),C?o.jsxs("div",{className:"h-screen flex flex-col bg-[var(--floor-light)]",style:{fontFamily:"var(--pixel-font)"},children:[(ml||Rl.length>0)&&o.jsxs("div",{className:"shrink-0 z-[44]",children:[o.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:()=>cn(_=>!_),children:[ml?o.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):o.jsx("span",{className:"shrink-0",children:"✅"}),o.jsx("span",{className:"flex-1",children:ml||"Knowledge import finished"}),zl&&o.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${zl.index/zl.total*100}%`,background:"#fff"}})}),o.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:$t?"▲":"▼"})]}),$t&&o.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:[Rl.map(_=>o.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[_.type==="scan"&&"🔍",_.type==="process"&&"⚙️",_.type==="created"&&"✅",_.type==="done"&&"🎉",_.type==="error"&&"❌"]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{style:{color:_.type==="error"?"#EF4444":_.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:_.text}),_.detail&&o.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:_.detail})]})]},_.id)),o.jsx("div",{ref:Gr})]})]}),o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-4xl mb-3",children:"🏢"}),o.jsx("div",{className:"text-gray-600 font-semibold text-xs",children:"LOADING OFFICE..."})]})})]}):A?o.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:o.jsxs("div",{className:"text-center max-w-md",style:{fontFamily:"var(--pixel-font)"},children:[o.jsx("div",{className:"text-4xl mb-3",children:"⚠️"}),o.jsx("div",{className:"text-gray-800 font-semibold mb-2 text-xs",children:"CONNECTION ERROR"}),o.jsx("div",{className:"text-gray-500 text-xs mb-4",children:A}),o.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"})]})}):o.jsxs("div",{className:"flex flex-col",style:{height:"100dvh",fontFamily:"var(--pixel-font)"},children:[o.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:[o.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:["🏢"," ",o.jsx("span",{style:{color:"var(--terminal-text)"},children:j})]}),o.jsxs("div",{className:"flex gap-4 text-[var(--terminal-text-secondary)] text-[11px] items-center",children:[(()=>{const _=Object.values(He).reduce((Re,Le)=>Re+Le.totalTokens,0),se=_>=1e6?`${(_/1e6).toFixed(1)}M`:_>=1e3?`${Math.round(_/1e3)}K`:String(_),he=Math.min(100,Math.round(_/25e4*100)),pe=Ne.length,ge=r.length>0?Math.round(pe/r.length*100):0;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["💰",o.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:o.jsx("div",{className:"h-full",style:{width:`${he}%`,background:"linear-gradient(90deg,#22c55e,#34D399)"}})}),o.jsx("strong",{className:"text-[var(--active-green)]",children:se})]}),o.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["⚡",o.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:o.jsx("div",{className:"h-full",style:{width:`${ge}%`,background:"linear-gradient(90deg,#3b82f6,#60A5FA)"}})}),o.jsx("strong",{className:"text-[var(--terminal-text)]",children:ge})]})]})})(),o.jsxs("span",{className:"hidden sm:inline",children:["Roles: ",o.jsx("strong",{className:"text-[var(--terminal-text)]",children:r.length})]}),o.jsxs("span",{className:"hidden sm:inline",children:["Projects: ",o.jsx("strong",{className:"text-[var(--terminal-text)]",children:c.length})]}),Ne.length>0&&o.jsxs("span",{className:"text-amber-400",children:["Working: ",o.jsx("strong",{children:Ne.length})]}),(()=>{const _={roles:Object.entries(He).map(([he,pe])=>({id:he,level:pe.level,totalTokens:pe.totalTokens})),totalTokens:Object.values(He).reduce((he,pe)=>he+pe.totalTokens,0),roleCount:r.length},se=U0(_);return se.length>0?o.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:se.map(he=>o.jsx("span",{title:`${he.name}: ${he.description}`,style:{fontSize:12,cursor:"default"},children:he.icon},he.id))}):null})(),o.jsxs("button",{onClick:()=>{nt.state==="no-git"?nt.initGit():lr(!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:nt.state==="no-git"?"Click to initialize git repository":nt.state==="dirty"?`${nt.dirtyCount} unsaved changes`:"All saved",children:[o.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:nt.state==="no-git"?"var(--terminal-text-muted)":nt.state==="saving"||nt.state==="dirty"?"var(--idle-amber)":nt.state==="error"?"#EF5350":"var(--active-green)",animation:nt.state==="saving"?"pulse 1s infinite":void 0}}),o.jsx("span",{children:Vc})]})]})]}),(ml||Rl.length>0)&&o.jsxs("div",{className:"shrink-0 z-[44]",children:[o.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:()=>cn(_=>!_),children:[ml?o.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):o.jsx("span",{className:"shrink-0",children:"✅"}),o.jsx("span",{className:"flex-1",children:ml||"Knowledge import finished"}),zl&&o.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${zl.index/zl.total*100}%`,background:"#fff"}})}),o.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:$t?"▲":"▼"})]}),$t&&o.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:[Rl.map(_=>o.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[_.type==="scan"&&"🔍",_.type==="process"&&"⚙️",_.type==="created"&&"✅",_.type==="done"&&"🎉",_.type==="error"&&"❌"]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{style:{color:_.type==="error"?"#EF4444":_.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:_.text}),_.detail&&o.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:_.detail})]})]},_.id)),o.jsx("div",{ref:Gr}),Rl.length===0&&o.jsx("div",{className:"px-5 py-4 text-center",style:{color:"var(--terminal-text-muted)"},children:"Waiting for events..."})]})]}),o.jsxs("div",{className:"flex-1 overflow-hidden flex relative",children:[o.jsx("div",{className:"flex-1 overflow-y-auto relative floor-grid",style:{background:"var(--floor-light)"},children:_l==="iso"?o.jsx(QE,{roles:r,projects:c,waves:p,standups:f,decisions:g,roleStatuses:pl,activeExecs:Ne,onRoleClick:_=>L({type:"role",roleId:_}),onProjectClick:_=>L({type:"project",projectId:_}),onBulletinClick:()=>L({type:"bulletin"}),onDecisionsClick:()=>L({type:"decisions"}),onKnowledgeClick:()=>L({type:"knowledge"}),onSettingsClick:()=>Xr(!0),onThemeClick:()=>xi(_=>!_),onStatsClick:()=>Tl(!0),knowledgeDocsCount:b.length,getRoleSpeech:Wn.getSpeech,getAppearance:Zt,onHireClick:()=>de(!0)}):o.jsxs("div",{className:`${un?"max-w-full":"max-w-[1100px]"} mx-auto h-full p-4 flex flex-col gap-3 relative z-[1]`,children:[(()=>{const _=r.filter(he=>he.level==="c-level"),se=r.filter(he=>he.level!=="c-level");return o.jsxs(o.Fragment,{children:[_.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"pixel-section-label",children:"LEADERSHIP"}),o.jsx("div",{className:`grid gap-2 ${_.length===1?"grid-cols-1":"grid-cols-2"}`,children:_.map(he=>{var pe,ge;return o.jsx(I0,{role:he,speech:Wn.getSpeech(he.id),onClick:()=>L({type:"role",roleId:he.id}),liveStatus:pl[he.id],activeTask:(pe=Ne.find(Re=>Re.roleId===he.id))==null?void 0:pe.task,featured:!0,appearance:Zt(he.id),xpLevel:(ge=He[he.id])==null?void 0:ge.level},he.id)})})]}),o.jsx("div",{className:"pixel-section-label",children:"TEAM"}),o.jsxs("div",{className:`grid gap-2 ${un?"grid-cols-3":"grid-cols-4"}`,children:[se.map(he=>{var pe,ge;return o.jsx(I0,{role:he,speech:Wn.getSpeech(he.id),onClick:()=>L({type:"role",roleId:he.id}),liveStatus:pl[he.id],activeTask:(pe=Ne.find(Re=>Re.roleId===he.id))==null?void 0:pe.task,appearance:Zt(he.id),xpLevel:(ge=He[he.id])==null?void 0:ge.level},he.id)}),o.jsx("div",{className:"pixel-card pixel-card--hire",onClick:()=>de(!0),children:o.jsxs("div",{className:"pixel-card--hire-inner",children:[o.jsx("span",{className:"pixel-card--hire-icon",children:"+"}),o.jsx("span",{className:"pixel-card--hire-label",children:"HIRE NEW ROLE"})]})})]})]})})(),o.jsx("div",{className:"pixel-section-label mt-1",children:"OFFICE"}),o.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[o.jsxs("div",{className:"facility-card-compact",onClick:Bn?()=>L({type:"project",projectId:Bn.id}):void 0,style:Bn?void 0:{borderStyle:"dashed",opacity:.5},children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#3B82F6"},children:["🏢"," MEETING ROOM"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(hc,{type:"meeting"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"Projects, PRDs, and task boards"}),Bn?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"fcc-title",children:['"',Bn.name,'"']}),o.jsxs("div",{className:"fcc-meta",children:["Status: ",o.jsx("strong",{style:{color:"var(--active-green)"},children:Bn.status})]})]}):o.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No active projects"})]})]}),o.jsxs("div",{className:"facility-card-compact",onClick:()=>L({type:"bulletin"}),children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#64748b"},children:["📋"," BULLETIN"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(hc,{type:"bulletin"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"Waves and daily standups"}),p.slice(0,1).map(_=>o.jsxs("div",{className:"fcc-item",children:["Wave ",_.id]},_.id)),f.slice(0,1).map(_=>o.jsxs("div",{className:"fcc-item",children:["Standup ",_.date]},_.date)),p.length===0&&f.length===0&&o.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No entries yet"})]})]}),o.jsxs("div",{className:"facility-card-compact",onClick:()=>L({type:"decisions"}),children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#EF4444"},children:["📜"," DECISIONS"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(hc,{type:"decision"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"CEO strategic decision log"}),o.jsxs("div",{className:"fcc-title",children:[g.length," decisions"]}),g.slice(0,2).map(_=>o.jsxs("div",{className:"fcc-item",children:["#",_.id," ",_.title]},_.id))]})]}),o.jsxs("div",{className:"facility-card-compact",onClick:()=>L({type:"knowledge"}),children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#0D9488"},children:["📚"," KNOWLEDGE"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(hc,{type:"knowledge"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"Research, analysis, and references"}),o.jsxs("div",{className:"fcc-title",children:[b.length," docs"]}),b.slice(0,2).map(_=>o.jsx("div",{className:"fcc-item",children:_.title},_.id))]})]})]})]})}),un&&o.jsx("div",{className:Bl?"absolute inset-0 z-50":"contents",children:o.jsx(LC,{sessions:En,activeSessionId:ja,roles:r,streamingSessionId:or,width:Bl?Ol:sr,onWidthChange:Bl?void 0:Xs,onSwitchSession:Kn,onCloseSession:ur,onCreateSession:cr,onClearEmpty:qc,onCloseAll:Ws,onSendMessage:Ea,onModeChange:Xc,onCloseTerminal:()=>Ft(!1),chatChannels:Ut.channels,activeChatChannelId:Ut.activeChannelId,onSwitchChatChannel:Ut.setActiveChannelId,onCreateChatChannel:Ut.createChannel,onDeleteChatChannel:Ut.deleteChannel,onUpdateChatMembers:Ut.updateMembers,onUpdateChatTopic:Ut.updateTopic,unreadChannels:Ut.unreadChannels})})]}),o.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:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>Sa("card"),className:`view-toggle-btn ${_l==="card"?"active":""}`,children:"CARD"}),o.jsx("button",{onClick:()=>Sa("iso"),className:`view-toggle-btn ${_l==="iso"?"active":""}`,children:"OFFICE"}),o.jsx("span",{className:"mx-1",children:"|"}),o.jsxs("div",{style:{position:"relative"},children:[o.jsxs("button",{className:`theme-btn${ar?" active":""}`,onClick:()=>xi(_=>!_),title:"Office Theme",children:[((ji=Hr[De])==null?void 0:ji.icon)??"","▾"]}),ar&&o.jsx(rN,{theme:De,onThemeChange:Ue,onClose:()=>xi(!1)})]}),o.jsx("button",{className:"theme-btn",onClick:()=>Xr(!0),title:"Settings",children:"⚙"}),o.jsx("span",{className:"mx-1",children:"|"}),o.jsx("button",{onClick:()=>ka(!0),title:"Git Status",style:{background:"none",border:"none",cursor:"pointer",fontSize:10,fontFamily:"var(--pixel-font)",color:bn?bn.worktrees.some(_=>_.status==="stale")?"#ff6b6b":bn.worktrees.some(_=>_.status==="pending-merge")?"#FFB74D":bn.worktrees.length>0?"#4FC3F7":"#81C784":"var(--terminal-text-muted)"},children:bn?bn.worktrees.length===0&&bn.staleBranches.length===0?"✓ clean":`📂 ${bn.worktrees.length} worktree${bn.worktrees.length!==1?"s":""}${bn.staleBranches.length>0?` · ⚠ ${bn.staleBranches.length} branch${bn.staleBranches.length!==1?"es":""}`:""}`:"GIT"}),o.jsx("span",{className:"mx-1",children:"|"}),o.jsx("span",{style:{color:nt.state==="dirty"?"var(--idle-amber)":"var(--terminal-text-muted)"},children:nt.state==="no-git"?"No git":nt.state==="saving"?"Saving...":nt.state==="dirty"?`${nt.dirtyCount} unsaved`:nt.lastSaved?`Saved ${(()=>{const _=Math.floor((Date.now()-new Date(nt.lastSaved).getTime())/6e4);return _<1?"just now":_<60?`${_}m ago`:`${Math.floor(_/60)}h ago`})()}`:"Saved"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[me&&Ee&&o.jsx("button",{onClick:()=>Be(!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"}),M.length>0&&ce&&o.jsxs("button",{onClick:()=>we(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:M[M.length-1].color,border:`2px solid ${M[M.length-1].color}88`,fontFamily:"var(--pixel-font)",borderRadius:4},children:[M[M.length-1].title.slice(0,20),M[M.length-1].title.length>20?"..":""]}),o.jsxs("button",{onClick:()=>W(!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"]}),o.jsx("button",{onClick:()=>un?Ft(!1):wi(),className:"px-3 py-1 font-black cursor-pointer",style:{background:un?"var(--terminal-bg)":"var(--hud-bg-alt)",color:"var(--terminal-text)",border:`2px solid ${un?"var(--terminal-border-hover)":"var(--pixel-border)"}`,fontFamily:"var(--pixel-font)"},children:"TERMINAL"})]}),o.jsxs("span",{children:["Expand: +",Math.max(0,10-r.length)," desks available"]})]}),O.type==="role"&&D&&(()=>{var se;const _=Ne.find(he=>he.roleId===D.id);return o.jsx(sj,{role:D,allRoles:r,recentActivity:Si(D.id),onClose:vn,onFireRole:(he,pe)=>{re({roleId:he,roleName:pe}),vn()},terminalWidth:un?sr:0,activeJobId:_==null?void 0:_.id,activeTask:_==null?void 0:_.task,isWorking:pl[D.id]==="working",jobStartedAt:_==null?void 0:_.startedAt,onStopJob:he=>Ce.abortJob(he),sessions:En,streamingSessionId:or,onCreateSessionSilent:Ks,onSendMessage:Ea,onFocusTerminal:Qs,onCustomize:he=>{const pe=r.find(ge=>ge.id===he);pe&&(Mt("character"),ft(pe))},onUpdateRole:vi,appearance:Zt(D.id),relationships:Wn.relationships,roleLevel:(se=He[D.id])==null?void 0:se.level})})(),O.type==="project"&&Bn&&o.jsx(lC,{projectId:Bn.id,onClose:vn,terminalWidth:un?sr:0}),(O.type==="bulletin"||O.type==="decisions")&&o.jsx(tC,{standups:f,waves:p,decisions:g,mode:O.type==="bulletin"?"bulletin":"decisions",onClose:vn,terminalWidth:un?sr:0}),O.type==="knowledge"&&o.jsx(eC,{docs:b,onClose:vn,onRefresh:()=>Ce.getKnowledge().then(v).catch(()=>{}),terminalWidth:un?sr:0,initialDocId:O.docId}),X&&o.jsx(iC,{roleId:X.roleId,roleName:X.roleName,mode:X.mode,onClose:()=>ne(null),onExecutionStart:Nn}),me&&!Ee&&o.jsx(mC,{directive:me.directive,rootJobs:me.rootJobs,orgNodes:z,rootRoleId:Q,onClose:()=>{Se(null),Be(!1)},onMinimize:()=>Be(!0),onDone:()=>{Kr(),qt("Wave complete","#2E7D32")},onOpenKnowledgeDoc:_=>{Se(null),Be(!1),L({type:"knowledge",docId:_}),Ce.getKnowledge().then(v).catch(()=>{})}}),M.length>0&&!ce&&(()=>{var he;const _=M[M.length-1],se=ee.length>1;return o.jsxs(o.Fragment,{children:[se&&M.length===1&&o.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:ee.map((pe,ge)=>o.jsx("button",{onClick:()=>{Z(ge),q([{jobId:pe.jobId,title:`CEO WAVE · ${pe.roleId.toUpperCase()}`,color:"#B71C1C"}])},className:"px-3 py-1.5 text-xs font-bold rounded-t-lg cursor-pointer transition-colors",style:{background:I===ge?"#B71C1C":"var(--terminal-bg)",color:I===ge?"#fff":"var(--terminal-text-secondary)",border:`1px solid ${I===ge?"#B71C1C":"var(--terminal-border)"}`,borderBottom:"none"},children:pe.roleId.toUpperCase()},pe.jobId))}),o.jsx(sC,{jobId:_.jobId,title:M.length>1?_.title:se?`CEO WAVE · ${((he=ee[I])==null?void 0:he.roleName)??""}`:_.title,color:_.color,variant:"modal",style:se&&M.length===1?{marginTop:28}:void 0,onClose:()=>{q([]),V([]),Z(0),we(!1)},onMinimize:()=>we(!0),onDone:()=>{yi(),Kr()},onNavigateToJob:pe=>{Ce.getJob(pe).then(ge=>{const Re=jc[ge.roleId]??"#888";q(Le=>[...Le,{jobId:pe,title:`${ge.roleId.toUpperCase()} · ${ge.task.slice(0,40)}`,color:Re}])}).catch(console.error)},onOpenKnowledgeDoc:pe=>{q([]),V([]),Z(0),we(!1),L({type:"knowledge",docId:pe}),Ce.getKnowledge().then(v).catch(()=>{})}},_.jobId)]})})(),M.length>1&&o.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[62] pointer-events-none",children:o.jsx("div",{className:"pointer-events-auto",children:o.jsxs("button",{onClick:()=>q(_=>_.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 ",(Na=M[M.length-2])==null?void 0:Na.title]})})}),F&&o.jsx(cC,{cLevelRoles:r.filter(_=>_.level==="c-level"),orgNodes:z,rootId:Q,onClose:()=>W(!1),onDispatch:Gs}),yt&&o.jsx(bC,{existingRoles:r,onClose:()=>de(!1),onHire:An}),G&&o.jsx(vC,{roleId:G.roleId,roleName:G.roleName,onClose:()=>re(null),onConfirm:bi}),Xe&&o.jsx(WE,{role:Xe,appearance:Zt(Xe.id),onSave:_=>ae(Xe.id,_),onReset:()=>xe(Xe.id),onClose:()=>{ft(null),Mt("character")},theme:De,onThemeChange:Ue,onUpdateName:async(_,se)=>{await vi(_,{name:se})},initialTab:"character",characterOnly:!0,speechSettings:ye,onSpeechSettingsChange:je,language:jt,onLanguageChange:wt,roleLevel:(Ci=He[Xe.id])==null?void 0:Ci.level}),mi&&o.jsx(ZE,{status:nt.status,history:nt.history,onClose:()=>lr(!1),onSave:async _=>await nt.save(_),onLoadHistory:nt.loadHistory,onRestore:nt.restore,saving:nt.state==="saving"}),wa&&o.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>Tl(!1),children:o.jsx("div",{style:{width:420,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8},onClick:_=>_.stopPropagation(),children:o.jsx(JE,{onClose:()=>Tl(!1)})})}),Dl&&o.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>rr(!1),children:o.jsx("div",{style:{width:480,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8,overflowY:"auto"},onClick:_=>_.stopPropagation(),children:o.jsx(tN,{onClose:()=>rr(!1),onSyncComplete:()=>{}})})}),Us&&o.jsx(lN,{onClose:()=>Xr(!1),speechSettings:ye,onSpeechSettingsChange:je,language:jt,onLanguageChange:wt,onOpenSync:()=>rr(!0),onOpenGitStatus:()=>ka(!0),onOpenStats:()=>Tl(!0)}),qr&&o.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>ka(!1),children:o.jsx("div",{style:{width:520,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8,overflowY:"auto"},onClick:_=>_.stopPropagation(),children:o.jsx(nN,{onClose:()=>ka(!1)})})}),o.jsx("div",{className:"fixed top-16 right-4 z-[70] flex flex-col gap-2",children:Me.map(_=>o.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:_.color,border:"2px solid rgba(0,0,0,0.3)",fontFamily:"var(--pixel-font)"},children:[o.jsx("div",{className:"w-2 h-2 bg-white/60"}),_.message]},_.id))})]})}function I0({role:t,speech:l,onClick:r,liveStatus:i,activeTask:c,featured:u,appearance:f,xpLevel:m}){const p=jc[t.id]??cN(t.id),d=m??1,g=oN[t.id]??t.name,y=i==="working",b=y&&c?c:l||g;return o.jsxs("div",{className:`pixel-card ${y?"working":""} ${u?"pixel-card--featured":""}`,onClick:r,children:[o.jsxs("div",{className:"pixel-card-hdr",style:{background:p},children:[o.jsxs("span",{children:[t.id.toUpperCase()," ","·"," ",t.name.toUpperCase()]}),o.jsxs("span",{className:"lvl",children:["Lv.",d]})]}),o.jsxs("div",{className:"pixel-card-body",children:[o.jsx("div",{className:"pixel-desk"}),o.jsx(Ic,{roleId:t.id,appearance:f}),o.jsx("div",{className:"pixel-status-dot",style:{background:y?"var(--idle-amber)":"var(--active-green)"}})]}),o.jsxs("div",{className:"pixel-card-task",children:[o.jsx("span",{className:"pixel-card-task-icon",children:y?"🛠️":sN[t.id]??"👤"}),o.jsx("span",{className:"pixel-card-task-text",children:b||g})]})]})}function Od({onSelect:t,onClose:l}){const[r,i]=S.useState(null),[c,u]=S.useState(!0),f=S.useCallback(async m=>{u(!0);try{const p=await Ce.browse(m);i(p)}catch{}finally{u(!1)}},[]);return S.useEffect(()=>{f()},[f]),c&&!r?o.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..."}):r?o.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:[o.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:[o.jsx("span",{style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},className:"truncate flex-1",children:r.current}),o.jsx("button",{onClick:()=>t(r.current),className:"px-2 py-1 rounded text-[10px] font-medium shrink-0",style:{background:"var(--active-green)",color:"#fff"},children:"Select"}),o.jsx("button",{onClick:l,className:"opacity-50 hover:opacity-100 shrink-0",style:{color:"var(--terminal-text)"},children:"✕"})]}),r.parent&&o.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(r.parent),children:[o.jsx("span",{children:"⬆️"}),o.jsx("span",{children:".."})]}),r.dirs.map(m=>o.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:[o.jsx("span",{children:"📁"}),o.jsx("span",{children:m.name})]},m.path)),r.dirs.length===0&&o.jsx("div",{className:"px-3 py-3 text-center",style:{color:"var(--terminal-text-muted)"},children:"No subdirectories"})]}):null}const fN={engine:"AI Engine",company:"Company Info",project:"Project",knowledge:"Knowledge",team:"Team Template",create:"Create"};function Y0(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 dN({onComplete:t}){const[l,r]=S.useState(0),[i,c]=S.useState(null),[u,f]=S.useState("none"),[m,p]=S.useState(""),[d,g]=S.useState(!0),[y,b]=S.useState(""),[v,j]=S.useState(""),[k,C]=S.useState("auto"),E=S.useRef(null),[A,R]=S.useState("fresh"),[O,L]=S.useState(""),[D,U]=S.useState(null),[X,ne]=S.useState(!1),[M,q]=S.useState(!1),[F,W]=S.useState("skip"),[ee,V]=S.useState([]),[I,Z]=S.useState(""),[ce,we]=S.useState(!1),[z,B]=S.useState(""),[Q,T]=S.useState(null),[me,Se]=S.useState(!1),[Ee,Be]=S.useState(!1),[He,Ke]=S.useState([]),[ke,yt]=S.useState("startup"),[de,G]=S.useState(!1),[re,ve]=S.useState(!1),[ze,Ne]=S.useState(null),[Te,Me]=S.useState([]),[Oe,tt]=S.useState(!1),Lt=S.useMemo(()=>Y0(F),[F]),gt=Lt[l]??"engine";S.useEffect(()=>{Ce.detectEngine().then(fe=>{c(fe),f(fe.recommended),g(!1)}).catch(()=>g(!1)),Ce.getTeams().then(Ke).catch(()=>{})},[]),S.useEffect(()=>{var fe;gt==="company"&&((fe=E.current)==null||fe.focus())},[gt]);const ht=()=>{switch(gt){case"engine":return u!=="none"||m.length>10;case"company":return y.trim().length>0;case"project":return A==="fresh"||A==="existing"&&D===!0;case"knowledge":return F==="existing-akb"?Q===!0:F==="import"?ee.length>0:!0;case"team":return!0;case"create":return!re;default:return!1}},Zt=()=>{l<Lt.length-1&&ht()&&r(l+1),gt==="create"&&!de&&!Oe&&(F==="existing-akb"?je():ye())},ae=()=>{l>0&&r(l-1)};S.useEffect(()=>{const fe=Y0(F);l>=fe.length&&r(fe.length-1)},[F,l]);const xe=async()=>{if(O.trim()){ne(!0);try{const fe=await Ce.validatePath(O.trim());U(fe.valid)}catch{U(!1)}finally{ne(!1)}}},De=async()=>{if(z.trim()){Se(!0);try{const fe=await Ce.validatePath(z.trim());T(fe.valid&&fe.hasClaudeMd===!0)}catch{T(!1)}finally{Se(!1)}}},Ue=()=>{const fe=I.trim();fe&&!ee.includes(fe)&&(V([...ee,fe]),Z(""))},ye=async()=>{G(!0),Ne(null);try{const fe={companyName:y.trim(),description:v.trim()||"An AI-powered organization",team:ke,existingProjectPath:A==="existing"?O.trim():void 0,knowledgePaths:F==="import"&&ee.length>0?ee:void 0,language:k!=="auto"?k:void 0};(u==="direct-api"||m)&&(fe.apiKey=m||void 0);const Mt=await Ce.scaffold(fe);Me(Mt.created),ve(!0)}catch(fe){Ne(fe instanceof Error?fe.message:"Scaffold failed")}finally{G(!1)}},je=async()=>{tt(!0),Ne(null);try{const fe=await Ce.connectAkb(z.trim());fe.ok?(ve(!0),Me([`Connected to: ${fe.companyRoot}`])):Ne(fe.error||"Failed to connect")}catch(fe){Ne(fe instanceof Error?fe.message:"Connect failed")}finally{tt(!1)}},jt=()=>{F==="import"&&ee.length>0?t({paths:ee,companyRoot:""}):t()},wt=fe=>{fe.key==="Enter"&&ht()&&(fe.preventDefault(),Zt())},Xe=`w-full px-3 py-2 rounded text-sm outline-none transition-colors
91
+ `).filter(nt=>nt.trim().length>0);for(const nt of Je){const Ve=nt.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""},Si=_=>{const se=Qn[_];if(!se)return"";for(const he of f){const pe=he.content,ge=pe.indexOf(`## ${se}`);if(ge===-1)continue;const Re=pe.indexOf(`
92
+ ## `,ge+10),Je=(Re===-1?pe.slice(ge):pe.slice(ge,Re)).replace(/^## .+\n/,"").trim();if(Je)return Je.slice(0,1500)}return""},Ut=aE();k.useEffect(()=>{r.length>0&&Ut.syncDefaultMembers(r)},[r]);const Wn=eE({roles:r,roleStatuses:ve,activeExecs:Ne,getStandupSpeech:ki});return uE({roles:r,roleStatuses:ve,activeExecs:Ne,channels:Ut.channels,relationships:Wn.relationships,pushMessage:Ut.pushMessage,speechSettings:ye,engineType:tt,hasApiKey:gt}),C?o.jsxs("div",{className:"h-screen flex flex-col bg-[var(--floor-light)]",style:{fontFamily:"var(--pixel-font)"},children:[(ml||Rl.length>0)&&o.jsxs("div",{className:"shrink-0 z-[44]",children:[o.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:()=>cn(_=>!_),children:[ml?o.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):o.jsx("span",{className:"shrink-0",children:"✅"}),o.jsx("span",{className:"flex-1",children:ml||"Knowledge import finished"}),zl&&o.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${zl.index/zl.total*100}%`,background:"#fff"}})}),o.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:$t?"▲":"▼"})]}),$t&&o.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:[Rl.map(_=>o.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[_.type==="scan"&&"🔍",_.type==="process"&&"⚙️",_.type==="created"&&"✅",_.type==="done"&&"🎉",_.type==="error"&&"❌"]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{style:{color:_.type==="error"?"#EF4444":_.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:_.text}),_.detail&&o.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:_.detail})]})]},_.id)),o.jsx("div",{ref:Gr})]})]}),o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-4xl mb-3",children:"🏢"}),o.jsx("div",{className:"text-gray-600 font-semibold text-xs",children:"LOADING OFFICE..."})]})})]}):A?o.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:o.jsxs("div",{className:"text-center max-w-md",style:{fontFamily:"var(--pixel-font)"},children:[o.jsx("div",{className:"text-4xl mb-3",children:"⚠️"}),o.jsx("div",{className:"text-gray-800 font-semibold mb-2 text-xs",children:"CONNECTION ERROR"}),o.jsx("div",{className:"text-gray-500 text-xs mb-4",children:A}),o.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"})]})}):o.jsxs("div",{className:"flex flex-col",style:{height:"100dvh",fontFamily:"var(--pixel-font)"},children:[o.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:[o.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:["🏢"," ",o.jsx("span",{style:{color:"var(--terminal-text)"},children:j})]}),o.jsxs("div",{className:"flex gap-4 text-[var(--terminal-text-secondary)] text-[11px] items-center",children:[(()=>{const _=Object.values(He).reduce((Re,Le)=>Re+Le.totalTokens,0),se=_>=1e6?`${(_/1e6).toFixed(1)}M`:_>=1e3?`${Math.round(_/1e3)}K`:String(_),he=Math.min(100,Math.round(_/25e4*100)),pe=Ne.length,ge=r.length>0?Math.round(pe/r.length*100):0;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["💰",o.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:o.jsx("div",{className:"h-full",style:{width:`${he}%`,background:"linear-gradient(90deg,#22c55e,#34D399)"}})}),o.jsx("strong",{className:"text-[var(--active-green)]",children:se})]}),o.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["⚡",o.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:o.jsx("div",{className:"h-full",style:{width:`${ge}%`,background:"linear-gradient(90deg,#3b82f6,#60A5FA)"}})}),o.jsx("strong",{className:"text-[var(--terminal-text)]",children:ge})]})]})})(),o.jsxs("span",{className:"hidden sm:inline",children:["Roles: ",o.jsx("strong",{className:"text-[var(--terminal-text)]",children:r.length})]}),o.jsxs("span",{className:"hidden sm:inline",children:["Projects: ",o.jsx("strong",{className:"text-[var(--terminal-text)]",children:c.length})]}),Ne.length>0&&o.jsxs("span",{className:"text-amber-400",children:["Working: ",o.jsx("strong",{children:Ne.length})]}),(()=>{const _={roles:Object.entries(He).map(([he,pe])=>({id:he,level:pe.level,totalTokens:pe.totalTokens})),totalTokens:Object.values(He).reduce((he,pe)=>he+pe.totalTokens,0),roleCount:r.length},se=I0(_);return se.length>0?o.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:se.map(he=>o.jsx("span",{title:`${he.name}: ${he.description}`,style:{fontSize:12,cursor:"default"},children:he.icon},he.id))}):null})(),o.jsx("span",{className:"px-1.5 py-0.5",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--pixel-border)"},children:Vc})]})]}),(ml||Rl.length>0)&&o.jsxs("div",{className:"shrink-0 z-[44]",children:[o.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:()=>cn(_=>!_),children:[ml?o.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):o.jsx("span",{className:"shrink-0",children:"✅"}),o.jsx("span",{className:"flex-1",children:ml||"Knowledge import finished"}),zl&&o.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${zl.index/zl.total*100}%`,background:"#fff"}})}),o.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:$t?"▲":"▼"})]}),$t&&o.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:[Rl.map(_=>o.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[_.type==="scan"&&"🔍",_.type==="process"&&"⚙️",_.type==="created"&&"✅",_.type==="done"&&"🎉",_.type==="error"&&"❌"]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{style:{color:_.type==="error"?"#EF4444":_.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:_.text}),_.detail&&o.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:_.detail})]})]},_.id)),o.jsx("div",{ref:Gr}),Rl.length===0&&o.jsx("div",{className:"px-5 py-4 text-center",style:{color:"var(--terminal-text-muted)"},children:"Waiting for events..."})]})]}),o.jsxs("div",{className:"flex-1 overflow-hidden flex relative",children:[o.jsx("div",{className:"flex-1 overflow-y-auto relative floor-grid",style:{background:"var(--floor-light)"},children:_l==="iso"?o.jsx(WE,{roles:r,projects:c,waves:x,standups:f,decisions:g,roleStatuses:pl,activeExecs:Ne,onRoleClick:_=>L({type:"role",roleId:_}),onProjectClick:_=>L({type:"project",projectId:_}),onBulletinClick:()=>L({type:"bulletin"}),onDecisionsClick:()=>L({type:"decisions"}),onKnowledgeClick:()=>L({type:"knowledge"}),onSettingsClick:()=>Xr(!0),onThemeClick:()=>xi(_=>!_),onStatsClick:()=>Tl(!0),knowledgeDocsCount:b.length,getRoleSpeech:Wn.getSpeech,getAppearance:Zt,onHireClick:()=>de(!0)}):o.jsxs("div",{className:`${un?"max-w-full":"max-w-[1100px]"} mx-auto h-full p-4 flex flex-col gap-3 relative z-[1]`,children:[(()=>{const _=r.filter(he=>he.level==="c-level"),se=r.filter(he=>he.level!=="c-level");return o.jsxs(o.Fragment,{children:[_.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"pixel-section-label",children:"LEADERSHIP"}),o.jsx("div",{className:`grid gap-2 ${_.length===1?"grid-cols-1":"grid-cols-2"}`,children:_.map(he=>{var pe,ge;return o.jsx(Y0,{role:he,speech:Wn.getSpeech(he.id),onClick:()=>L({type:"role",roleId:he.id}),liveStatus:pl[he.id],activeTask:(pe=Ne.find(Re=>Re.roleId===he.id))==null?void 0:pe.task,featured:!0,appearance:Zt(he.id),xpLevel:(ge=He[he.id])==null?void 0:ge.level},he.id)})})]}),o.jsx("div",{className:"pixel-section-label",children:"TEAM"}),o.jsxs("div",{className:`grid gap-2 ${un?"grid-cols-3":"grid-cols-4"}`,children:[se.map(he=>{var pe,ge;return o.jsx(Y0,{role:he,speech:Wn.getSpeech(he.id),onClick:()=>L({type:"role",roleId:he.id}),liveStatus:pl[he.id],activeTask:(pe=Ne.find(Re=>Re.roleId===he.id))==null?void 0:pe.task,appearance:Zt(he.id),xpLevel:(ge=He[he.id])==null?void 0:ge.level},he.id)}),o.jsx("div",{className:"pixel-card pixel-card--hire",onClick:()=>de(!0),children:o.jsxs("div",{className:"pixel-card--hire-inner",children:[o.jsx("span",{className:"pixel-card--hire-icon",children:"+"}),o.jsx("span",{className:"pixel-card--hire-label",children:"HIRE NEW ROLE"})]})})]})]})})(),o.jsx("div",{className:"pixel-section-label mt-1",children:"OFFICE"}),o.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[o.jsxs("div",{className:"facility-card-compact",onClick:Bn?()=>L({type:"project",projectId:Bn.id}):void 0,style:Bn?void 0:{borderStyle:"dashed",opacity:.5},children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#3B82F6"},children:["🏢"," MEETING ROOM"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(hc,{type:"meeting"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"Projects, PRDs, and task boards"}),Bn?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"fcc-title",children:['"',Bn.name,'"']}),o.jsxs("div",{className:"fcc-meta",children:["Status: ",o.jsx("strong",{style:{color:"var(--active-green)"},children:Bn.status})]})]}):o.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No active projects"})]})]}),o.jsxs("div",{className:"facility-card-compact",onClick:()=>L({type:"bulletin"}),children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#64748b"},children:["📋"," BULLETIN"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(hc,{type:"bulletin"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"Waves and daily standups"}),x.slice(0,1).map(_=>o.jsxs("div",{className:"fcc-item",children:["Wave ",_.id]},_.id)),f.slice(0,1).map(_=>o.jsxs("div",{className:"fcc-item",children:["Standup ",_.date]},_.date)),x.length===0&&f.length===0&&o.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No entries yet"})]})]}),o.jsxs("div",{className:"facility-card-compact",onClick:()=>L({type:"decisions"}),children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#EF4444"},children:["📜"," DECISIONS"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(hc,{type:"decision"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"CEO strategic decision log"}),o.jsxs("div",{className:"fcc-title",children:[g.length," decisions"]}),g.slice(0,2).map(_=>o.jsxs("div",{className:"fcc-item",children:["#",_.id," ",_.title]},_.id))]})]}),o.jsxs("div",{className:"facility-card-compact",onClick:()=>L({type:"knowledge"}),children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#0D9488"},children:["📚"," KNOWLEDGE"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(hc,{type:"knowledge"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"Research, analysis, and references"}),o.jsxs("div",{className:"fcc-title",children:[b.length," docs"]}),b.slice(0,2).map(_=>o.jsx("div",{className:"fcc-item",children:_.title},_.id))]})]})]})]})}),un&&o.jsx("div",{className:Bl?"absolute inset-0 z-50":"contents",children:o.jsx($C,{sessions:Cn,activeSessionId:ja,roles:r,streamingSessionId:or,width:Bl?Ol:sr,onWidthChange:Bl?void 0:Xs,onSwitchSession:Kn,onCloseSession:ur,onCreateSession:cr,onClearEmpty:qc,onCloseAll:Ws,onSendMessage:Ea,onModeChange:Xc,onCloseTerminal:()=>Ft(!1),chatChannels:Ut.channels,activeChatChannelId:Ut.activeChannelId,onSwitchChatChannel:Ut.setActiveChannelId,onCreateChatChannel:Ut.createChannel,onDeleteChatChannel:Ut.deleteChannel,onUpdateChatMembers:Ut.updateMembers,onUpdateChatTopic:Ut.updateTopic,unreadChannels:Ut.unreadChannels})})]}),o.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:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>Sa("card"),className:`view-toggle-btn ${_l==="card"?"active":""}`,children:"CARD"}),o.jsx("button",{onClick:()=>Sa("iso"),className:`view-toggle-btn ${_l==="iso"?"active":""}`,children:"OFFICE"}),o.jsx("span",{className:"mx-1",children:"|"}),o.jsxs("div",{style:{position:"relative"},children:[o.jsxs("button",{className:`theme-btn${ar?" active":""}`,onClick:()=>xi(_=>!_),title:"Office Theme",children:[((ji=Hr[De])==null?void 0:ji.icon)??"","▾"]}),ar&&o.jsx(aN,{theme:De,onThemeChange:Ue,onClose:()=>xi(!1)})]}),o.jsx("button",{className:"theme-btn",onClick:()=>Xr(!0),title:"Settings",children:"⚙"}),o.jsx("span",{className:"mx-1",children:"|"}),o.jsxs("button",{onClick:()=>{it.state==="no-git"?it.initGit():it.state==="dirty"?lr(!0):ka(!0)},title:it.state==="dirty"?`${it.dirtyCount} unsaved — click to save`:"Git Status",style:{background:"none",border:"none",cursor:"pointer",fontSize:10,fontFamily:"var(--pixel-font)",color:"var(--terminal-text-muted)",display:"flex",alignItems:"center",gap:4},children:[o.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:it.state==="no-git"?"var(--terminal-text-muted)":it.state==="saving"||it.state==="dirty"?"var(--idle-amber)":it.state==="error"?"#EF5350":"var(--active-green)",animation:it.state==="saving"?"pulse 1s infinite":void 0}}),o.jsx("span",{style:{color:it.state==="dirty"?"var(--idle-amber)":"var(--terminal-text-muted)"},children:it.state==="no-git"?"No git":it.state==="saving"?"Saving...":it.state==="dirty"?`${it.dirtyCount} unsaved`:"Saved"}),On&&(On.worktrees.length>0||On.staleBranches.length>0)&&o.jsxs("span",{style:{color:On.worktrees.some(_=>_.status==="stale")?"#ff6b6b":On.worktrees.some(_=>_.status==="pending-merge")?"#FFB74D":"#4FC3F7"},children:["·"," ","📂"," ",On.worktrees.length," worktree",On.worktrees.length!==1?"s":"",On.staleBranches.length>0&&` · ⚠ ${On.staleBranches.length} branch${On.staleBranches.length!==1?"es":""}`]})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[me&&Ee&&o.jsx("button",{onClick:()=>Be(!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"}),z.length>0&&ce&&o.jsxs("button",{onClick:()=>we(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:z[z.length-1].color,border:`2px solid ${z[z.length-1].color}88`,fontFamily:"var(--pixel-font)",borderRadius:4},children:[z[z.length-1].title.slice(0,20),z[z.length-1].title.length>20?"..":""]}),o.jsxs("button",{onClick:()=>W(!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"]}),o.jsx("button",{onClick:()=>un?Ft(!1):wi(),className:"px-3 py-1 font-black cursor-pointer",style:{background:un?"var(--terminal-bg)":"var(--hud-bg-alt)",color:"var(--terminal-text)",border:`2px solid ${un?"var(--terminal-border-hover)":"var(--pixel-border)"}`,fontFamily:"var(--pixel-font)"},children:"TERMINAL"})]})]}),O.type==="role"&&F&&(()=>{var se;const _=Ne.find(he=>he.roleId===F.id);return o.jsx(oj,{role:F,allRoles:r,recentActivity:Si(F.id),onClose:bn,onFireRole:(he,pe)=>{re({roleId:he,roleName:pe}),bn()},terminalWidth:un?sr:0,activeJobId:_==null?void 0:_.id,activeTask:_==null?void 0:_.task,isWorking:pl[F.id]==="working",jobStartedAt:_==null?void 0:_.startedAt,onStopJob:he=>Ce.abortJob(he),sessions:Cn,streamingSessionId:or,onCreateSessionSilent:Ks,onSendMessage:Ea,onFocusTerminal:Qs,onCustomize:he=>{const pe=r.find(ge=>ge.id===he);pe&&(Mt("character"),ft(pe))},onUpdateRole:vi,appearance:Zt(F.id),relationships:Wn.relationships,roleLevel:(se=He[F.id])==null?void 0:se.level})})(),O.type==="project"&&Bn&&o.jsx(rC,{projectId:Bn.id,onClose:bn,terminalWidth:un?sr:0}),(O.type==="bulletin"||O.type==="decisions")&&o.jsx(nC,{standups:f,waves:x,decisions:g,mode:O.type==="bulletin"?"bulletin":"decisions",onClose:bn,terminalWidth:un?sr:0}),O.type==="knowledge"&&o.jsx(tC,{docs:b,onClose:bn,onRefresh:()=>Ce.getKnowledge().then(v).catch(()=>{}),terminalWidth:un?sr:0,initialDocId:O.docId}),$&&o.jsx(sC,{roleId:$.roleId,roleName:$.roleName,mode:$.mode,onClose:()=>ee(null),onExecutionStart:En}),me&&!Ee&&o.jsx(xC,{directive:me.directive,rootJobs:me.rootJobs,orgNodes:D,rootRoleId:Q,onClose:()=>{Se(null),Be(!1)},onMinimize:()=>Be(!0),onDone:()=>{Kr(),qt("Wave complete","#2E7D32")},onOpenKnowledgeDoc:_=>{Se(null),Be(!1),L({type:"knowledge",docId:_}),Ce.getKnowledge().then(v).catch(()=>{})}}),z.length>0&&!ce&&(()=>{var he;const _=z[z.length-1],se=te.length>1;return o.jsxs(o.Fragment,{children:[se&&z.length===1&&o.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:te.map((pe,ge)=>o.jsx("button",{onClick:()=>{Z(ge),X([{jobId:pe.jobId,title:`CEO WAVE · ${pe.roleId.toUpperCase()}`,color:"#B71C1C"}])},className:"px-3 py-1.5 text-xs font-bold rounded-t-lg cursor-pointer transition-colors",style:{background:Y===ge?"#B71C1C":"var(--terminal-bg)",color:Y===ge?"#fff":"var(--terminal-text-secondary)",border:`1px solid ${Y===ge?"#B71C1C":"var(--terminal-border)"}`,borderBottom:"none"},children:pe.roleId.toUpperCase()},pe.jobId))}),o.jsx(oC,{jobId:_.jobId,title:z.length>1?_.title:se?`CEO WAVE · ${((he=te[Y])==null?void 0:he.roleName)??""}`:_.title,color:_.color,variant:"modal",style:se&&z.length===1?{marginTop:28}:void 0,onClose:()=>{X([]),V([]),Z(0),we(!1)},onMinimize:()=>we(!0),onDone:()=>{yi(),Kr()},onNavigateToJob:pe=>{Ce.getJob(pe).then(ge=>{const Re=jc[ge.roleId]??"#888";X(Le=>[...Le,{jobId:pe,title:`${ge.roleId.toUpperCase()} · ${ge.task.slice(0,40)}`,color:Re}])}).catch(console.error)},onOpenKnowledgeDoc:pe=>{X([]),V([]),Z(0),we(!1),L({type:"knowledge",docId:pe}),Ce.getKnowledge().then(v).catch(()=>{})}},_.jobId)]})})(),z.length>1&&o.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[62] pointer-events-none",children:o.jsx("div",{className:"pointer-events-auto",children:o.jsxs("button",{onClick:()=>X(_=>_.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 ",(Na=z[z.length-2])==null?void 0:Na.title]})})}),R&&o.jsx(uC,{cLevelRoles:r.filter(_=>_.level==="c-level"),orgNodes:D,rootId:Q,onClose:()=>W(!1),onDispatch:Gs}),yt&&o.jsx(vC,{existingRoles:r,onClose:()=>de(!1),onHire:Nn}),G&&o.jsx(wC,{roleId:G.roleId,roleName:G.roleName,onClose:()=>re(null),onConfirm:bi}),Xe&&o.jsx(ZE,{role:Xe,appearance:Zt(Xe.id),onSave:_=>ae(Xe.id,_),onReset:()=>xe(Xe.id),onClose:()=>{ft(null),Mt("character")},theme:De,onThemeChange:Ue,onUpdateName:async(_,se)=>{await vi(_,{name:se})},initialTab:"character",characterOnly:!0,speechSettings:ye,onSpeechSettingsChange:je,language:jt,onLanguageChange:wt,roleLevel:(Ci=He[Xe.id])==null?void 0:Ci.level}),mi&&o.jsx(JE,{status:it.status,history:it.history,onClose:()=>lr(!1),onSave:async _=>await it.save(_),onLoadHistory:it.loadHistory,onRestore:it.restore,saving:it.state==="saving"}),wa&&o.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>Tl(!1),children:o.jsx("div",{style:{width:420,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8},onClick:_=>_.stopPropagation(),children:o.jsx(PE,{onClose:()=>Tl(!1)})})}),Dl&&o.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>rr(!1),children:o.jsx("div",{style:{width:480,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8,overflowY:"auto"},onClick:_=>_.stopPropagation(),children:o.jsx(nN,{onClose:()=>rr(!1),onSyncComplete:()=>{}})})}),Us&&o.jsx(rN,{onClose:()=>Xr(!1),speechSettings:ye,onSpeechSettingsChange:je,language:jt,onLanguageChange:wt,onOpenSync:()=>rr(!0),onOpenGitStatus:()=>ka(!0),onOpenStats:()=>Tl(!0)}),qr&&o.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>ka(!1),children:o.jsx("div",{style:{width:520,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8,overflowY:"auto"},onClick:_=>_.stopPropagation(),children:o.jsx(lN,{onClose:()=>ka(!1)})})}),o.jsx("div",{className:"fixed top-16 right-4 z-[70] flex flex-col gap-2",children:Me.map(_=>o.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:_.color,border:"2px solid rgba(0,0,0,0.3)",fontFamily:"var(--pixel-font)"},children:[o.jsx("div",{className:"w-2 h-2 bg-white/60"}),_.message]},_.id))})]})}function Y0({role:t,speech:l,onClick:r,liveStatus:i,activeTask:c,featured:u,appearance:f,xpLevel:m}){const x=jc[t.id]??uN(t.id),d=m??1,g=cN[t.id]??t.name,y=i==="working",b=y&&c?c:l||g;return o.jsxs("div",{className:`pixel-card ${y?"working":""} ${u?"pixel-card--featured":""}`,onClick:r,children:[o.jsxs("div",{className:"pixel-card-hdr",style:{background:x},children:[o.jsxs("span",{children:[t.id.toUpperCase()," ","·"," ",t.name.toUpperCase()]}),o.jsxs("span",{className:"lvl",children:["Lv.",d]})]}),o.jsxs("div",{className:"pixel-card-body",children:[o.jsx("div",{className:"pixel-desk"}),o.jsx(Ic,{roleId:t.id,appearance:f}),o.jsx("div",{className:"pixel-status-dot",style:{background:y?"var(--idle-amber)":"var(--active-green)"}})]}),o.jsxs("div",{className:"pixel-card-task",children:[o.jsx("span",{className:"pixel-card-task-icon",children:y?"🛠️":oN[t.id]??"👤"}),o.jsx("span",{className:"pixel-card-task-text",children:b||g})]})]})}function Od({onSelect:t,onClose:l}){const[r,i]=k.useState(null),[c,u]=k.useState(!0),f=k.useCallback(async m=>{u(!0);try{const x=await Ce.browse(m);i(x)}catch{}finally{u(!1)}},[]);return k.useEffect(()=>{f()},[f]),c&&!r?o.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..."}):r?o.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:[o.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:[o.jsx("span",{style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},className:"truncate flex-1",children:r.current}),o.jsx("button",{onClick:()=>t(r.current),className:"px-2 py-1 rounded text-[10px] font-medium shrink-0",style:{background:"var(--active-green)",color:"#fff"},children:"Select"}),o.jsx("button",{onClick:l,className:"opacity-50 hover:opacity-100 shrink-0",style:{color:"var(--terminal-text)"},children:"✕"})]}),r.parent&&o.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(r.parent),children:[o.jsx("span",{children:"⬆️"}),o.jsx("span",{children:".."})]}),r.dirs.map(m=>o.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:[o.jsx("span",{children:"📁"}),o.jsx("span",{children:m.name})]},m.path)),r.dirs.length===0&&o.jsx("div",{className:"px-3 py-3 text-center",style:{color:"var(--terminal-text-muted)"},children:"No subdirectories"})]}):null}const dN={engine:"AI Engine",company:"Company Info",project:"Project",knowledge:"Knowledge",team:"Team Template",create:"Create"};function q0(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 hN({onComplete:t}){const[l,r]=k.useState(0),[i,c]=k.useState(null),[u,f]=k.useState("none"),[m,x]=k.useState(""),[d,g]=k.useState(!0),[y,b]=k.useState(""),[v,j]=k.useState(""),[S,C]=k.useState("auto"),E=k.useRef(null),[A,M]=k.useState("fresh"),[O,L]=k.useState(""),[F,I]=k.useState(null),[$,ee]=k.useState(!1),[z,X]=k.useState(!1),[R,W]=k.useState("skip"),[te,V]=k.useState([]),[Y,Z]=k.useState(""),[ce,we]=k.useState(!1),[D,B]=k.useState(""),[Q,T]=k.useState(null),[me,Se]=k.useState(!1),[Ee,Be]=k.useState(!1),[He,Ke]=k.useState([]),[ke,yt]=k.useState("startup"),[de,G]=k.useState(!1),[re,ve]=k.useState(!1),[ze,Ne]=k.useState(null),[Te,Me]=k.useState([]),[Oe,tt]=k.useState(!1),Lt=k.useMemo(()=>q0(R),[R]),gt=Lt[l]??"engine";k.useEffect(()=>{Ce.detectEngine().then(fe=>{c(fe),f(fe.recommended),g(!1)}).catch(()=>g(!1)),Ce.getTeams().then(Ke).catch(()=>{})},[]),k.useEffect(()=>{var fe;gt==="company"&&((fe=E.current)==null||fe.focus())},[gt]);const ht=()=>{switch(gt){case"engine":return u!=="none"||m.length>10;case"company":return y.trim().length>0;case"project":return A==="fresh"||A==="existing"&&F===!0;case"knowledge":return R==="existing-akb"?Q===!0:R==="import"?te.length>0:!0;case"team":return!0;case"create":return!re;default:return!1}},Zt=()=>{l<Lt.length-1&&ht()&&r(l+1),gt==="create"&&!de&&!Oe&&(R==="existing-akb"?je():ye())},ae=()=>{l>0&&r(l-1)};k.useEffect(()=>{const fe=q0(R);l>=fe.length&&r(fe.length-1)},[R,l]);const xe=async()=>{if(O.trim()){ee(!0);try{const fe=await Ce.validatePath(O.trim());I(fe.valid)}catch{I(!1)}finally{ee(!1)}}},De=async()=>{if(D.trim()){Se(!0);try{const fe=await Ce.validatePath(D.trim());T(fe.valid&&fe.hasClaudeMd===!0)}catch{T(!1)}finally{Se(!1)}}},Ue=()=>{const fe=Y.trim();fe&&!te.includes(fe)&&(V([...te,fe]),Z(""))},ye=async()=>{G(!0),Ne(null);try{const fe={companyName:y.trim(),description:v.trim()||"An AI-powered organization",team:ke,existingProjectPath:A==="existing"?O.trim():void 0,knowledgePaths:R==="import"&&te.length>0?te:void 0,language:S!=="auto"?S:void 0};(u==="direct-api"||m)&&(fe.apiKey=m||void 0);const Mt=await Ce.scaffold(fe);Me(Mt.created),ve(!0)}catch(fe){Ne(fe instanceof Error?fe.message:"Scaffold failed")}finally{G(!1)}},je=async()=>{tt(!0),Ne(null);try{const fe=await Ce.connectAkb(D.trim());fe.ok?(ve(!0),Me([`Connected to: ${fe.companyRoot}`])):Ne(fe.error||"Failed to connect")}catch(fe){Ne(fe instanceof Error?fe.message:"Connect failed")}finally{tt(!1)}},jt=()=>{R==="import"&&te.length>0?t({paths:te,companyRoot:""}):t()},wt=fe=>{fe.key==="Enter"&&ht()&&(fe.preventDefault(),Zt())},Xe=`w-full px-3 py-2 rounded text-sm outline-none transition-colors
93
93
  bg-[var(--terminal-bg)] text-[var(--terminal-text)]
94
94
  border border-[var(--terminal-border)]
95
95
  focus:border-[var(--terminal-border-hover)]
96
- placeholder:text-[var(--terminal-text-muted)]`,ft=fe=>`p-4 rounded-lg border-2 cursor-pointer transition-all text-[var(--terminal-text)] ${fe?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--terminal-border)] bg-[var(--hud-bg-alt)] hover:border-[var(--accent)]/50"}`;return o.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},onKeyDown:wt,children:o.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:[o.jsxs("div",{className:"px-6 py-5",style:{background:"var(--terminal-bg)",borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx("div",{className:"text-lg font-bold",style:{color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"},children:"tycono"}),o.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-secondary)"},children:"Build an AI company. Watch them work."}),o.jsx("div",{className:"flex gap-1.5 mt-4",children:Lt.map((fe,Mt)=>o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"h-1 rounded-full transition-colors",style:{background:Mt<=l?"var(--accent)":"var(--terminal-surface-light)"}}),o.jsx("div",{className:"text-[9px] mt-1 truncate",style:{color:Mt===l?"var(--terminal-text)":"var(--terminal-text-muted)"},children:fN[fe]})]},fe))})]}),o.jsxs("div",{className:"px-6 py-5 min-h-[280px]",children:[gt==="engine"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"AI Engine Setup"}),d?o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:"Detecting AI engine..."}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:ft(u==="claude-cli"),onClick:()=>(i==null?void 0:i.claudeCli)&&f("claude-cli"),style:{opacity:i!=null&&i.claudeCli?1:.4},children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-lg",children:i!=null&&i.claudeCli?"✅":"❌"}),o.jsxs("div",{children:[o.jsx("div",{className:"font-medium text-sm",children:"Claude Code CLI"}),o.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"})]})]})}),o.jsxs("div",{className:ft(u==="direct-api"),onClick:()=>f("direct-api"),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-lg",children:i!=null&&i.apiKey?"✅":"🔑"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"font-medium text-sm",children:"Anthropic API Key (BYOK)"}),o.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)&&o.jsx("input",{type:"password",className:`${Xe} mt-3`,placeholder:"sk-ant-...",value:m,onChange:fe=>p(fe.target.value),autoFocus:!0})]})]})]}),gt==="company"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Company Info"}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Company Name *"}),o.jsx("input",{ref:E,className:Xe,placeholder:"e.g. Acme Corp",value:y,onChange:fe=>b(fe.target.value)})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Description"}),o.jsx("textarea",{className:`${Xe} resize-none`,rows:3,placeholder:"What does your AI company do?",value:v,onChange:fe=>j(fe.target.value)})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"AI Response Language"}),o.jsxs("select",{className:Xe,value:k,onChange:fe=>C(fe.target.value),children:[o.jsx("option",{value:"auto",children:"Auto"}),o.jsx("option",{value:"en",children:"English"}),o.jsx("option",{value:"ko",children:"한국어"}),o.jsx("option",{value:"ja",children:"日本語"})]})]})]}),gt==="project"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Project Setup"}),o.jsxs("div",{className:ft(A==="fresh"),onClick:()=>{R("fresh"),U(null)},children:[o.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Create a new AI company from scratch with clean directory structure."})]}),o.jsxs("div",{className:ft(A==="existing"),onClick:()=>R("existing"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["📂"," Connect Existing Project"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Add AI company structure to an existing codebase or knowledge base."}),A==="existing"&&o.jsxs("div",{className:"mt-3",onClick:fe=>fe.stopPropagation(),children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{className:`${Xe} flex-1`,placeholder:"/path/to/your/project",value:O,onChange:fe=>{L(fe.target.value),U(null)},autoFocus:!0}),o.jsx("button",{onClick:()=>q(!M),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:"📁"}),o.jsx("button",{onClick:xe,disabled:X||!O.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:X||!O.trim()?.5:1},children:X?"...":"Verify"})]}),D===!0&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Path verified: ",O]}),D===!1&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," Invalid path"]}),M&&o.jsx(Od,{onSelect:fe=>{L(fe),U(!0),q(!1)},onClose:()=>q(!1)})]})]})]}),gt==="knowledge"&&o.jsxs("div",{className:"space-y-3",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Knowledge Strategy"}),o.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"How should AI handle your knowledge base?"}),o.jsxs("div",{className:ft(F==="skip"),onClick:()=>W("skip"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Empty knowledge base. Add documents later from the office."})]}),o.jsxs("div",{className:ft(F==="import"),onClick:()=>W("import"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["📚"," Import & Build"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Select folders with documents — AI reads, summarizes, and organizes them."}),F==="import"&&o.jsxs("div",{className:"mt-3 space-y-2",onClick:fe=>fe.stopPropagation(),children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{className:`${Xe} flex-1`,placeholder:"/path/to/docs",value:I,onChange:fe=>Z(fe.target.value),onKeyDown:fe=>{fe.key==="Enter"&&(fe.preventDefault(),Ue())},autoFocus:!0}),o.jsx("button",{onClick:()=>we(!ce),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:"📁"}),o.jsx("button",{onClick:Ue,disabled:!I.trim(),className:"px-3 py-2 rounded text-xs font-medium",style:{background:"var(--accent)",color:"#fff",opacity:I.trim()?1:.5},children:"Add"})]}),ce&&o.jsx(Od,{onSelect:fe=>{ee.includes(fe)||V([...ee,fe]),we(!1)},onClose:()=>we(!1)}),ee.length>0&&o.jsx("div",{className:"space-y-1",children:ee.map((fe,Mt)=>o.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:[o.jsx("span",{className:"flex-1 truncate",style:{fontFamily:"var(--pixel-font)"},children:fe}),o.jsx("button",{onClick:()=>V(ee.filter((nt,mi)=>mi!==Mt)),className:"opacity-50 hover:opacity-100",children:"✕"})]},Mt))}),ee.length===0&&o.jsx("div",{className:"text-[10px] text-center py-2",style:{color:"var(--terminal-text-muted)"},children:"Add at least one folder to import."})]})]}),o.jsxs("div",{className:ft(F==="existing-akb"),onClick:()=>W("existing-akb"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["🔗"," Connect Existing AKB"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Connect a directory that already has CLAUDE.md and AKB structure."}),F==="existing-akb"&&o.jsxs("div",{className:"mt-3",onClick:fe=>fe.stopPropagation(),children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{className:`${Xe} flex-1`,placeholder:"/path/to/your/akb",value:z,onChange:fe=>{B(fe.target.value),T(null)},autoFocus:!0}),o.jsx("button",{onClick:()=>Be(!Ee),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:"📁"}),o.jsx("button",{onClick:De,disabled:me||!z.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:me||!z.trim()?.5:1},children:me?"...":"Verify"})]}),Q===!0&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Valid AKB found: ",z]}),Q===!1&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," No valid AKB (CLAUDE.md required)"]}),Ee&&o.jsx(Od,{onSelect:fe=>{B(fe),T(null),Be(!1)},onClose:()=>Be(!1)})]})]})]}),gt==="team"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Team Template"}),o.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"Choose a starting team. You can add or remove roles later."}),He.map(fe=>o.jsxs("div",{className:ft(ke===fe.id),onClick:()=>yt(fe.id),children:[o.jsx("div",{className:"font-medium text-sm capitalize",children:fe.id}),o.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:fe.roles.map(Mt=>o.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:Mt.name},Mt.id))})]},fe.id)),o.jsxs("div",{className:ft(ke==="custom"),onClick:()=>yt("custom"),children:[o.jsx("div",{className:"font-medium text-sm",children:"Custom"}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Start with no pre-built roles. Hire them from the office."})]})]}),gt==="create"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:re?F==="existing-akb"?"AKB Connected!":"Company Created!":"Review & Create"}),!re&&!de&&!Oe&&o.jsxs(o.Fragment,{children:[o.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:F==="existing-akb"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Mode:"})," Connect Existing AKB"]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Path:"})," ",z]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Company:"})," ",y]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Project:"})," ",A==="fresh"?"Start Fresh":`Existing (${O})`]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Knowledge:"})," ",F==="skip"?"Fresh (empty)":`Import ${ee.length} source(s)`]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Team:"})," ",ke]}),F==="import"&&ee.length>0&&o.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--idle-amber)"},children:"Knowledge import will run in the background after entering the office."})]})}),ze&&o.jsx("div",{className:"text-xs p-3 rounded",style:{background:"rgba(220,38,38,0.15)",color:"#f87171"},children:ze})]}),(de||Oe)&&o.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[o.jsx("div",{className:"w-8 h-8 border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:Oe?"Connecting to AKB...":"Scaffolding your company..."})]}),re&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"text-center py-4 text-4xl",children:"🏢"}),o.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:Te.map((fe,Mt)=>o.jsxs("div",{className:"py-0.5",children:[o.jsx("span",{style:{color:"var(--active-green)"},children:"✓"})," ",fe]},Mt))}),F==="import"&&ee.length>0&&o.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."})]})]})]}),o.jsxs("div",{className:"px-6 py-4 flex justify-between items-center",style:{borderTop:"1px solid var(--terminal-border)"},children:[o.jsx("div",{children:l>0&&!re&&o.jsx("button",{onClick:ae,className:"px-4 py-2 rounded text-sm transition-colors",style:{color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Back"})}),o.jsxs("div",{className:"text-xs",style:{color:"var(--terminal-text-muted)"},children:[l+1," / ",Lt.length]}),o.jsx("div",{children:re?o.jsx("button",{onClick:jt,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:"var(--active-green)",color:"#fff"},children:"Enter Office"}):o.jsx("button",{onClick:Zt,disabled:!ht()||de||Oe,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:ht()?"var(--accent)":"var(--terminal-border)",color:"#fff",opacity:ht()&&!de&&!Oe?1:.5},children:gt==="create"?de||Oe?Oe?"Connecting...":"Creating...":F==="existing-akb"?"Connect AKB":"Create Company":"Next"})})]})]})})}function hN(){const[t,l]=S.useState(null),[r,i]=S.useState(!0),[c,u]=S.useState(null),f=S.useCallback(async()=>{i(!0),u(null);try{const m=await Ce.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:r,error:c,refetch:f}}const mN=S.lazy(()=>Zb(()=>import("./preview-app-Bi90FWsr.js"),[]));function Fg(){return o.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"w-10 h-10 mx-auto border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),o.jsx("div",{className:"mt-4 text-sm",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Loading..."})]})})}function xN(){var t;try{const l=localStorage.getItem("tycono-theme")||localStorage.getItem("the-company-theme"),r=l&&l in Hr?l:"default",i=(t=Hr[r])==null?void 0:t.vars;if(!i)return;const c=document.documentElement;for(const[u,f]of Object.entries(i))c.style.setProperty(u,f)}catch{}}function pN(){const{initialized:t,loading:l,refetch:r}=hN(),[i,c]=S.useState(null);S.useEffect(()=>{xN()},[]);const u=f=>{f&&c(f),r()};return l?o.jsx(Fg,{}):t?o.jsx(uN,{importJob:i,onImportDone:()=>c(null)}):o.jsx(dN,{onComplete:u})}function yN(){const t=new URLSearchParams(window.location.search).has("sprite-preview");return o.jsx(Jb,{children:t?o.jsx(S.Suspense,{fallback:o.jsx(Fg,{}),children:o.jsx(mN,{})}):o.jsx(pN,{})})}Kb.createRoot(document.getElementById("root")).render(o.jsx(S.StrictMode,{children:o.jsx(yN,{})}));export{xg as H,yg as P,gg as S,vN as a,pg as b,mg as c,Qd as d,TS as e,AS as f,bN as g,DS as h,o as j,S as r};
96
+ placeholder:text-[var(--terminal-text-muted)]`,ft=fe=>`p-4 rounded-lg border-2 cursor-pointer transition-all text-[var(--terminal-text)] ${fe?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--terminal-border)] bg-[var(--hud-bg-alt)] hover:border-[var(--accent)]/50"}`;return o.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},onKeyDown:wt,children:o.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:[o.jsxs("div",{className:"px-6 py-5",style:{background:"var(--terminal-bg)",borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx("div",{className:"text-lg font-bold",style:{color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"},children:"tycono"}),o.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-secondary)"},children:"Build an AI company. Watch them work."}),o.jsx("div",{className:"flex gap-1.5 mt-4",children:Lt.map((fe,Mt)=>o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"h-1 rounded-full transition-colors",style:{background:Mt<=l?"var(--accent)":"var(--terminal-surface-light)"}}),o.jsx("div",{className:"text-[9px] mt-1 truncate",style:{color:Mt===l?"var(--terminal-text)":"var(--terminal-text-muted)"},children:dN[fe]})]},fe))})]}),o.jsxs("div",{className:"px-6 py-5 min-h-[280px]",children:[gt==="engine"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"AI Engine Setup"}),d?o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:"Detecting AI engine..."}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:ft(u==="claude-cli"),onClick:()=>(i==null?void 0:i.claudeCli)&&f("claude-cli"),style:{opacity:i!=null&&i.claudeCli?1:.4},children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-lg",children:i!=null&&i.claudeCli?"✅":"❌"}),o.jsxs("div",{children:[o.jsx("div",{className:"font-medium text-sm",children:"Claude Code CLI"}),o.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"})]})]})}),o.jsxs("div",{className:ft(u==="direct-api"),onClick:()=>f("direct-api"),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-lg",children:i!=null&&i.apiKey?"✅":"🔑"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"font-medium text-sm",children:"Anthropic API Key (BYOK)"}),o.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)&&o.jsx("input",{type:"password",className:`${Xe} mt-3`,placeholder:"sk-ant-...",value:m,onChange:fe=>x(fe.target.value),autoFocus:!0})]})]})]}),gt==="company"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Company Info"}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Company Name *"}),o.jsx("input",{ref:E,className:Xe,placeholder:"e.g. Acme Corp",value:y,onChange:fe=>b(fe.target.value)})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Description"}),o.jsx("textarea",{className:`${Xe} resize-none`,rows:3,placeholder:"What does your AI company do?",value:v,onChange:fe=>j(fe.target.value)})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"AI Response Language"}),o.jsxs("select",{className:Xe,value:S,onChange:fe=>C(fe.target.value),children:[o.jsx("option",{value:"auto",children:"Auto"}),o.jsx("option",{value:"en",children:"English"}),o.jsx("option",{value:"ko",children:"한국어"}),o.jsx("option",{value:"ja",children:"日本語"})]})]})]}),gt==="project"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Project Setup"}),o.jsxs("div",{className:ft(A==="fresh"),onClick:()=>{M("fresh"),I(null)},children:[o.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Create a new AI company from scratch with clean directory structure."})]}),o.jsxs("div",{className:ft(A==="existing"),onClick:()=>M("existing"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["📂"," Connect Existing Project"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Add AI company structure to an existing codebase or knowledge base."}),A==="existing"&&o.jsxs("div",{className:"mt-3",onClick:fe=>fe.stopPropagation(),children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{className:`${Xe} flex-1`,placeholder:"/path/to/your/project",value:O,onChange:fe=>{L(fe.target.value),I(null)},autoFocus:!0}),o.jsx("button",{onClick:()=>X(!z),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:"📁"}),o.jsx("button",{onClick:xe,disabled:$||!O.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:$||!O.trim()?.5:1},children:$?"...":"Verify"})]}),F===!0&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Path verified: ",O]}),F===!1&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," Invalid path"]}),z&&o.jsx(Od,{onSelect:fe=>{L(fe),I(!0),X(!1)},onClose:()=>X(!1)})]})]})]}),gt==="knowledge"&&o.jsxs("div",{className:"space-y-3",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Knowledge Strategy"}),o.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"How should AI handle your knowledge base?"}),o.jsxs("div",{className:ft(R==="skip"),onClick:()=>W("skip"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Empty knowledge base. Add documents later from the office."})]}),o.jsxs("div",{className:ft(R==="import"),onClick:()=>W("import"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["📚"," Import & Build"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Select folders with documents — AI reads, summarizes, and organizes them."}),R==="import"&&o.jsxs("div",{className:"mt-3 space-y-2",onClick:fe=>fe.stopPropagation(),children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{className:`${Xe} flex-1`,placeholder:"/path/to/docs",value:Y,onChange:fe=>Z(fe.target.value),onKeyDown:fe=>{fe.key==="Enter"&&(fe.preventDefault(),Ue())},autoFocus:!0}),o.jsx("button",{onClick:()=>we(!ce),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:"📁"}),o.jsx("button",{onClick:Ue,disabled:!Y.trim(),className:"px-3 py-2 rounded text-xs font-medium",style:{background:"var(--accent)",color:"#fff",opacity:Y.trim()?1:.5},children:"Add"})]}),ce&&o.jsx(Od,{onSelect:fe=>{te.includes(fe)||V([...te,fe]),we(!1)},onClose:()=>we(!1)}),te.length>0&&o.jsx("div",{className:"space-y-1",children:te.map((fe,Mt)=>o.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:[o.jsx("span",{className:"flex-1 truncate",style:{fontFamily:"var(--pixel-font)"},children:fe}),o.jsx("button",{onClick:()=>V(te.filter((it,mi)=>mi!==Mt)),className:"opacity-50 hover:opacity-100",children:"✕"})]},Mt))}),te.length===0&&o.jsx("div",{className:"text-[10px] text-center py-2",style:{color:"var(--terminal-text-muted)"},children:"Add at least one folder to import."})]})]}),o.jsxs("div",{className:ft(R==="existing-akb"),onClick:()=>W("existing-akb"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["🔗"," Connect Existing AKB"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Connect a directory that already has CLAUDE.md and AKB structure."}),R==="existing-akb"&&o.jsxs("div",{className:"mt-3",onClick:fe=>fe.stopPropagation(),children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{className:`${Xe} flex-1`,placeholder:"/path/to/your/akb",value:D,onChange:fe=>{B(fe.target.value),T(null)},autoFocus:!0}),o.jsx("button",{onClick:()=>Be(!Ee),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:"📁"}),o.jsx("button",{onClick:De,disabled:me||!D.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:me||!D.trim()?.5:1},children:me?"...":"Verify"})]}),Q===!0&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Valid AKB found: ",D]}),Q===!1&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," No valid AKB (CLAUDE.md required)"]}),Ee&&o.jsx(Od,{onSelect:fe=>{B(fe),T(null),Be(!1)},onClose:()=>Be(!1)})]})]})]}),gt==="team"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Team Template"}),o.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"Choose a starting team. You can add or remove roles later."}),He.map(fe=>o.jsxs("div",{className:ft(ke===fe.id),onClick:()=>yt(fe.id),children:[o.jsx("div",{className:"font-medium text-sm capitalize",children:fe.id}),o.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:fe.roles.map(Mt=>o.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:Mt.name},Mt.id))})]},fe.id)),o.jsxs("div",{className:ft(ke==="custom"),onClick:()=>yt("custom"),children:[o.jsx("div",{className:"font-medium text-sm",children:"Custom"}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Start with no pre-built roles. Hire them from the office."})]})]}),gt==="create"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:re?R==="existing-akb"?"AKB Connected!":"Company Created!":"Review & Create"}),!re&&!de&&!Oe&&o.jsxs(o.Fragment,{children:[o.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:R==="existing-akb"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Mode:"})," Connect Existing AKB"]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Path:"})," ",D]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Company:"})," ",y]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Project:"})," ",A==="fresh"?"Start Fresh":`Existing (${O})`]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Knowledge:"})," ",R==="skip"?"Fresh (empty)":`Import ${te.length} source(s)`]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Team:"})," ",ke]}),R==="import"&&te.length>0&&o.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--idle-amber)"},children:"Knowledge import will run in the background after entering the office."})]})}),ze&&o.jsx("div",{className:"text-xs p-3 rounded",style:{background:"rgba(220,38,38,0.15)",color:"#f87171"},children:ze})]}),(de||Oe)&&o.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[o.jsx("div",{className:"w-8 h-8 border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:Oe?"Connecting to AKB...":"Scaffolding your company..."})]}),re&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"text-center py-4 text-4xl",children:"🏢"}),o.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:Te.map((fe,Mt)=>o.jsxs("div",{className:"py-0.5",children:[o.jsx("span",{style:{color:"var(--active-green)"},children:"✓"})," ",fe]},Mt))}),R==="import"&&te.length>0&&o.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."})]})]})]}),o.jsxs("div",{className:"px-6 py-4 flex justify-between items-center",style:{borderTop:"1px solid var(--terminal-border)"},children:[o.jsx("div",{children:l>0&&!re&&o.jsx("button",{onClick:ae,className:"px-4 py-2 rounded text-sm transition-colors",style:{color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Back"})}),o.jsxs("div",{className:"text-xs",style:{color:"var(--terminal-text-muted)"},children:[l+1," / ",Lt.length]}),o.jsx("div",{children:re?o.jsx("button",{onClick:jt,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:"var(--active-green)",color:"#fff"},children:"Enter Office"}):o.jsx("button",{onClick:Zt,disabled:!ht()||de||Oe,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:ht()?"var(--accent)":"var(--terminal-border)",color:"#fff",opacity:ht()&&!de&&!Oe?1:.5},children:gt==="create"?de||Oe?Oe?"Connecting...":"Creating...":R==="existing-akb"?"Connect AKB":"Create Company":"Next"})})]})]})})}function mN(){const[t,l]=k.useState(null),[r,i]=k.useState(!0),[c,u]=k.useState(null),f=k.useCallback(async()=>{i(!0),u(null);try{const m=await Ce.getStatus();l(m)}catch(m){u(m instanceof Error?m.message:"Failed to fetch status")}finally{i(!1)}},[]);return k.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:r,error:c,refetch:f}}const xN=k.lazy(()=>Jb(()=>import("./preview-app-CLBsMBhE.js"),[]));function _g(){return o.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"w-10 h-10 mx-auto border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),o.jsx("div",{className:"mt-4 text-sm",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Loading..."})]})})}function pN(){var t;try{const l=localStorage.getItem("tycono-theme")||localStorage.getItem("the-company-theme"),r=l&&l in Hr?l:"default",i=(t=Hr[r])==null?void 0:t.vars;if(!i)return;const c=document.documentElement;for(const[u,f]of Object.entries(i))c.style.setProperty(u,f)}catch{}}function yN(){const{initialized:t,loading:l,refetch:r}=mN(),[i,c]=k.useState(null);k.useEffect(()=>{pN()},[]);const u=f=>{f&&c(f),r()};return l?o.jsx(_g,{}):t?o.jsx(fN,{importJob:i,onImportDone:()=>c(null)}):o.jsx(hN,{onComplete:u})}function gN(){const t=new URLSearchParams(window.location.search).has("sprite-preview");return o.jsx(Pb,{children:t?o.jsx(k.Suspense,{fallback:o.jsx(_g,{}),children:o.jsx(xN,{})}):o.jsx(yN,{})})}Qb.createRoot(document.getElementById("root")).render(o.jsx(k.StrictMode,{children:o.jsx(gN,{})}));export{pg as H,gg as P,bg as S,wN as a,yg as b,xg as c,Qd as d,DS as e,TS as f,vN as g,zS as h,o as j,k as r};