tycono 0.1.54 → 0.1.55
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.
|
@@ -14,7 +14,7 @@ var L2=Object.defineProperty;var H2=(e,l,r)=>l in e?L2(e,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 x1;function Y2(){if(x1)return et;x1=1;var e=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"),d=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function v(M){return M===null||typeof M!="object"?null:(M=b&&M[b]||M["@@iterator"],typeof M=="function"?M:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,C={};function E(M,K,D){this.props=M,this.context=K,this.refs=C,this.updater=D||S}E.prototype.isReactComponent={},E.prototype.setState=function(M,K){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,K,"setState")},E.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function N(){}N.prototype=E.prototype;function z(M,K,D){this.props=M,this.context=K,this.refs=C,this.updater=D||S}var O=z.prototype=new N;O.constructor=z,j(O,E.prototype),O.isPureReactComponent=!0;var I=Array.isArray;function _(){}var q={H:null,A:null,T:null,S:null},W=Object.prototype.hasOwnProperty;function Y(M,K,D){var de=D.ref;return{$$typeof:e,type:M,key:K,ref:de!==void 0?de:null,props:D}}function T(M,K){return Y(M.type,K,M.props)}function $(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function B(M){var K={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(D){return K[D]})}var G=/\/+/g;function ne(M,K){return typeof M=="object"&&M!==null&&M.key!=null?B(""+M.key):K.toString(36)}function V(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(_,_):(M.status="pending",M.then(function(K){M.status==="pending"&&(M.status="fulfilled",M.value=K)},function(K){M.status==="pending"&&(M.status="rejected",M.reason=K)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function U(M,K,D,de,Se){var ve=typeof M;(ve==="undefined"||ve==="boolean")&&(M=null);var Fe=!1;if(M===null)Fe=!0;else switch(ve){case"bigint":case"string":case"number":Fe=!0;break;case"object":switch(M.$$typeof){case e:case l:Fe=!0;break;case g:return Fe=M._init,U(Fe(M._payload),K,D,de,Se)}}if(Fe)return Se=Se(M),Fe=de===""?"."+ne(M,0):de,I(Se)?(D="",Fe!=null&&(D=Fe.replace(G,"$&/")+"/"),U(Se,K,D,"",function(fe){return fe})):Se!=null&&($(Se)&&(Se=T(Se,D+(Se.key==null||M&&M.key===Se.key?"":(""+Se.key).replace(G,"$&/")+"/")+Fe)),K.push(Se)),1;Fe=0;var Me=de===""?".":de+":";if(I(M))for(var $e=0;$e<M.length;$e++)de=M[$e],ve=Me+ne(de,$e),Fe+=U(de,K,D,ve,Se);else if($e=v(M),typeof $e=="function")for(M=$e.call(M),$e=0;!(de=M.next()).done;)de=de.value,ve=Me+ne(de,$e++),Fe+=U(de,K,D,ve,Se);else if(ve==="object"){if(typeof M.then=="function")return U(V(M),K,D,de,Se);throw K=String(M),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return Fe}function
|
|
17
|
+
*/var x1;function Y2(){if(x1)return et;x1=1;var e=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"),d=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function v(M){return M===null||typeof M!="object"?null:(M=b&&M[b]||M["@@iterator"],typeof M=="function"?M:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,C={};function E(M,K,D){this.props=M,this.context=K,this.refs=C,this.updater=D||S}E.prototype.isReactComponent={},E.prototype.setState=function(M,K){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,K,"setState")},E.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function N(){}N.prototype=E.prototype;function z(M,K,D){this.props=M,this.context=K,this.refs=C,this.updater=D||S}var O=z.prototype=new N;O.constructor=z,j(O,E.prototype),O.isPureReactComponent=!0;var I=Array.isArray;function _(){}var q={H:null,A:null,T:null,S:null},W=Object.prototype.hasOwnProperty;function Y(M,K,D){var de=D.ref;return{$$typeof:e,type:M,key:K,ref:de!==void 0?de:null,props:D}}function T(M,K){return Y(M.type,K,M.props)}function $(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function B(M){var K={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(D){return K[D]})}var G=/\/+/g;function ne(M,K){return typeof M=="object"&&M!==null&&M.key!=null?B(""+M.key):K.toString(36)}function V(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(_,_):(M.status="pending",M.then(function(K){M.status==="pending"&&(M.status="fulfilled",M.value=K)},function(K){M.status==="pending"&&(M.status="rejected",M.reason=K)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function U(M,K,D,de,Se){var ve=typeof M;(ve==="undefined"||ve==="boolean")&&(M=null);var Fe=!1;if(M===null)Fe=!0;else switch(ve){case"bigint":case"string":case"number":Fe=!0;break;case"object":switch(M.$$typeof){case e:case l:Fe=!0;break;case g:return Fe=M._init,U(Fe(M._payload),K,D,de,Se)}}if(Fe)return Se=Se(M),Fe=de===""?"."+ne(M,0):de,I(Se)?(D="",Fe!=null&&(D=Fe.replace(G,"$&/")+"/"),U(Se,K,D,"",function(fe){return fe})):Se!=null&&($(Se)&&(Se=T(Se,D+(Se.key==null||M&&M.key===Se.key?"":(""+Se.key).replace(G,"$&/")+"/")+Fe)),K.push(Se)),1;Fe=0;var Me=de===""?".":de+":";if(I(M))for(var $e=0;$e<M.length;$e++)de=M[$e],ve=Me+ne(de,$e),Fe+=U(de,K,D,ve,Se);else if($e=v(M),typeof $e=="function")for(M=$e.call(M),$e=0;!(de=M.next()).done;)de=de.value,ve=Me+ne(de,$e++),Fe+=U(de,K,D,ve,Se);else if(ve==="object"){if(typeof M.then=="function")return U(V(M),K,D,de,Se);throw K=String(M),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return Fe}function J(M,K,D){if(M==null)return M;var de=[],Se=0;return U(M,de,"","",function(ve){return K.call(D,ve,Se++)}),de}function ie(M){if(M._status===-1){var K=M._result;K=K(),K.then(function(D){(M._status===0||M._status===-1)&&(M._status=1,M._result=D)},function(D){(M._status===0||M._status===-1)&&(M._status=2,M._result=D)}),M._status===-1&&(M._status=0,M._result=K)}if(M._status===1)return M._result.default;throw M._result}var je=typeof reportError=="function"?reportError:function(M){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof M=="object"&&M!==null&&typeof M.message=="string"?String(M.message):String(M),error:M});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",M);return}console.error(M)},R={map:J,forEach:function(M,K,D){J(M,function(){K.apply(this,arguments)},D)},count:function(M){var K=0;return J(M,function(){K++}),K},toArray:function(M){return J(M,function(K){return K})||[]},only:function(M){if(!$(M))throw Error("React.Children.only expected to receive a single React element child.");return M}};return et.Activity=y,et.Children=R,et.Component=E,et.Fragment=r,et.Profiler=c,et.PureComponent=z,et.StrictMode=i,et.Suspense=x,et.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=q,et.__COMPILER_RUNTIME={__proto__:null,c:function(M){return q.H.useMemoCache(M)}},et.cache=function(M){return function(){return M.apply(null,arguments)}},et.cacheSignal=function(){return null},et.cloneElement=function(M,K,D){if(M==null)throw Error("The argument must be a React element, but you passed "+M+".");var de=j({},M.props),Se=M.key;if(K!=null)for(ve in K.key!==void 0&&(Se=""+K.key),K)!W.call(K,ve)||ve==="key"||ve==="__self"||ve==="__source"||ve==="ref"&&K.ref===void 0||(de[ve]=K[ve]);var ve=arguments.length-2;if(ve===1)de.children=D;else if(1<ve){for(var Fe=Array(ve),Me=0;Me<ve;Me++)Fe[Me]=arguments[Me+2];de.children=Fe}return Y(M.type,Se,de)},et.createContext=function(M){return M={$$typeof:d,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null},M.Provider=M,M.Consumer={$$typeof:u,_context:M},M},et.createElement=function(M,K,D){var de,Se={},ve=null;if(K!=null)for(de in K.key!==void 0&&(ve=""+K.key),K)W.call(K,de)&&de!=="key"&&de!=="__self"&&de!=="__source"&&(Se[de]=K[de]);var Fe=arguments.length-2;if(Fe===1)Se.children=D;else if(1<Fe){for(var Me=Array(Fe),$e=0;$e<Fe;$e++)Me[$e]=arguments[$e+2];Se.children=Me}if(M&&M.defaultProps)for(de in Fe=M.defaultProps,Fe)Se[de]===void 0&&(Se[de]=Fe[de]);return Y(M,ve,Se)},et.createRef=function(){return{current:null}},et.forwardRef=function(M){return{$$typeof:m,render:M}},et.isValidElement=$,et.lazy=function(M){return{$$typeof:g,_payload:{_status:-1,_result:M},_init:ie}},et.memo=function(M,K){return{$$typeof:f,type:M,compare:K===void 0?null:K}},et.startTransition=function(M){var K=q.T,D={};q.T=D;try{var de=M(),Se=q.S;Se!==null&&Se(D,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then(_,je)}catch(ve){je(ve)}finally{K!==null&&D.types!==null&&(K.types=D.types),q.T=K}},et.unstable_useCacheRefresh=function(){return q.H.useCacheRefresh()},et.use=function(M){return q.H.use(M)},et.useActionState=function(M,K,D){return q.H.useActionState(M,K,D)},et.useCallback=function(M,K){return q.H.useCallback(M,K)},et.useContext=function(M){return q.H.useContext(M)},et.useDebugValue=function(){},et.useDeferredValue=function(M,K){return q.H.useDeferredValue(M,K)},et.useEffect=function(M,K){return q.H.useEffect(M,K)},et.useEffectEvent=function(M){return q.H.useEffectEvent(M)},et.useId=function(){return q.H.useId()},et.useImperativeHandle=function(M,K,D){return q.H.useImperativeHandle(M,K,D)},et.useInsertionEffect=function(M,K){return q.H.useInsertionEffect(M,K)},et.useLayoutEffect=function(M,K){return q.H.useLayoutEffect(M,K)},et.useMemo=function(M,K){return q.H.useMemo(M,K)},et.useOptimistic=function(M,K){return q.H.useOptimistic(M,K)},et.useReducer=function(M,K,D){return q.H.useReducer(M,K,D)},et.useRef=function(M){return q.H.useRef(M)},et.useState=function(M){return q.H.useState(M)},et.useSyncExternalStore=function(M,K,D){return q.H.useSyncExternalStore(M,K,D)},et.useTransition=function(){return q.H.useTransition()},et.version="19.2.4",et}var p1;function uh(){return p1||(p1=1,Jd.exports=Y2()),Jd.exports}var k=uh(),Pd={exports:{}},Ds={},ef={exports:{}},tf={};/**
|
|
18
18
|
* @license React
|
|
19
19
|
* scheduler.production.js
|
|
20
20
|
*
|
|
@@ -22,7 +22,7 @@ var L2=Object.defineProperty;var H2=(e,l,r)=>l in e?L2(e,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 y1;function q2(){return y1||(y1=1,(function(e){function l(U,
|
|
25
|
+
*/var y1;function q2(){return y1||(y1=1,(function(e){function l(U,J){var ie=U.length;U.push(J);e:for(;0<ie;){var je=ie-1>>>1,R=U[je];if(0<c(R,J))U[je]=J,U[ie]=R,ie=je;else break e}}function r(U){return U.length===0?null:U[0]}function i(U){if(U.length===0)return null;var J=U[0],ie=U.pop();if(ie!==J){U[0]=ie;e:for(var je=0,R=U.length,M=R>>>1;je<M;){var K=2*(je+1)-1,D=U[K],de=K+1,Se=U[de];if(0>c(D,ie))de<R&&0>c(Se,D)?(U[je]=Se,U[de]=ie,je=de):(U[je]=D,U[K]=ie,je=K);else if(de<R&&0>c(Se,ie))U[je]=Se,U[de]=ie,je=de;else break e}}return J}function c(U,J){var ie=U.sortIndex-J.sortIndex;return ie!==0?ie:U.id-J.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var d=Date,m=d.now();e.unstable_now=function(){return d.now()-m}}var x=[],f=[],g=1,y=null,b=3,v=!1,S=!1,j=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,z=typeof setImmediate<"u"?setImmediate:null;function O(U){for(var J=r(f);J!==null;){if(J.callback===null)i(f);else if(J.startTime<=U)i(f),J.sortIndex=J.expirationTime,l(x,J);else break;J=r(f)}}function I(U){if(j=!1,O(U),!S)if(r(x)!==null)S=!0,_||(_=!0,B());else{var J=r(f);J!==null&&V(I,J.startTime-U)}}var _=!1,q=-1,W=5,Y=-1;function T(){return C?!0:!(e.unstable_now()-Y<W)}function $(){if(C=!1,_){var U=e.unstable_now();Y=U;var J=!0;try{e:{S=!1,j&&(j=!1,N(q),q=-1),v=!0;var ie=b;try{t:{for(O(U),y=r(x);y!==null&&!(y.expirationTime>U&&T());){var je=y.callback;if(typeof je=="function"){y.callback=null,b=y.priorityLevel;var R=je(y.expirationTime<=U);if(U=e.unstable_now(),typeof R=="function"){y.callback=R,O(U),J=!0;break t}y===r(x)&&i(x),O(U)}else i(x);y=r(x)}if(y!==null)J=!0;else{var M=r(f);M!==null&&V(I,M.startTime-U),J=!1}}break e}finally{y=null,b=ie,v=!1}J=void 0}}finally{J?B():_=!1}}}var B;if(typeof z=="function")B=function(){z($)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,ne=G.port2;G.port1.onmessage=$,B=function(){ne.postMessage(null)}}else B=function(){E($,0)};function V(U,J){q=E(function(){U(e.unstable_now())},J)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(U){U.callback=null},e.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<U?Math.floor(1e3/U):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(U){switch(b){case 1:case 2:case 3:var J=3;break;default:J=b}var ie=b;b=J;try{return U()}finally{b=ie}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(U,J){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var ie=b;b=U;try{return J()}finally{b=ie}},e.unstable_scheduleCallback=function(U,J,ie){var je=e.unstable_now();switch(typeof ie=="object"&&ie!==null?(ie=ie.delay,ie=typeof ie=="number"&&0<ie?je+ie:je):ie=je,U){case 1:var R=-1;break;case 2:R=250;break;case 5:R=1073741823;break;case 4:R=1e4;break;default:R=5e3}return R=ie+R,U={id:g++,callback:J,priorityLevel:U,startTime:ie,expirationTime:R,sortIndex:-1},ie>je?(U.sortIndex=ie,l(f,U),r(x)===null&&U===r(f)&&(j?(N(q),q=-1):j=!0,V(I,ie-je))):(U.sortIndex=R,l(x,U),S||v||(S=!0,_||(_=!0,B()))),U},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(U){var J=b;return function(){var ie=b;b=J;try{return U.apply(this,arguments)}finally{b=ie}}}})(tf)),tf}var g1;function X2(){return g1||(g1=1,ef.exports=q2()),ef.exports}var nf={exports:{}},Nn={};/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.js
|
|
28
28
|
*
|
|
@@ -38,19 +38,19 @@ var L2=Object.defineProperty;var H2=(e,l,r)=>l in e?L2(e,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 w1;function K2(){if(w1)return Ds;w1=1;var e=X2(),l=uh(),r=G2();function i(t){var n="https://react.dev/errors/"+t;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 #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var n=t,a=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(a=n.return),t=n.return;while(t)}return n.tag===3?a:null}function d(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function m(t){if(t.tag===31){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function x(t){if(u(t)!==t)throw Error(i(188))}function f(t){var n=t.alternate;if(!n){if(n=u(t),n===null)throw Error(i(188));return n!==t?null:t}for(var a=t,o=n;;){var h=a.return;if(h===null)break;var p=h.alternate;if(p===null){if(o=h.return,o!==null){a=o;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===a)return x(h),t;if(p===o)return x(h),n;p=p.sibling}throw Error(i(188))}if(a.return!==o.return)a=h,o=p;else{for(var w=!1,A=h.child;A;){if(A===a){w=!0,a=h,o=p;break}if(A===o){w=!0,o=h,a=p;break}A=A.sibling}if(!w){for(A=p.child;A;){if(A===a){w=!0,a=p,o=h;break}if(A===o){w=!0,o=p,a=h;break}A=A.sibling}if(!w)throw Error(i(189))}}if(a.alternate!==o)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?t:n}function g(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=g(t),n!==null)return n;t=t.sibling}return null}var y=Object.assign,b=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),z=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),T=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function B(t){return t===null||typeof t!="object"?null:(t=$&&t[$]||t["@@iterator"],typeof t=="function"?t:null)}var G=Symbol.for("react.client.reference");function ne(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===G?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case j:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case I:return"Suspense";case _:return"SuspenseList";case Y:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case S:return"Portal";case z:return t.displayName||"Context";case N:return(t._context.displayName||"Context")+".Consumer";case O:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case q:return n=t.displayName||null,n!==null?n:ne(t.type)||"Memo";case W:n=t._payload,t=t._init;try{return ne(t(n))}catch{}}return null}var V=Array.isArray,U=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
|
|
41
|
+
*/var w1;function K2(){if(w1)return Ds;w1=1;var e=X2(),l=uh(),r=G2();function i(t){var n="https://react.dev/errors/"+t;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 #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var n=t,a=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(a=n.return),t=n.return;while(t)}return n.tag===3?a:null}function d(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function m(t){if(t.tag===31){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function x(t){if(u(t)!==t)throw Error(i(188))}function f(t){var n=t.alternate;if(!n){if(n=u(t),n===null)throw Error(i(188));return n!==t?null:t}for(var a=t,o=n;;){var h=a.return;if(h===null)break;var p=h.alternate;if(p===null){if(o=h.return,o!==null){a=o;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===a)return x(h),t;if(p===o)return x(h),n;p=p.sibling}throw Error(i(188))}if(a.return!==o.return)a=h,o=p;else{for(var w=!1,A=h.child;A;){if(A===a){w=!0,a=h,o=p;break}if(A===o){w=!0,o=h,a=p;break}A=A.sibling}if(!w){for(A=p.child;A;){if(A===a){w=!0,a=p,o=h;break}if(A===o){w=!0,o=p,a=h;break}A=A.sibling}if(!w)throw Error(i(189))}}if(a.alternate!==o)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?t:n}function g(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=g(t),n!==null)return n;t=t.sibling}return null}var y=Object.assign,b=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),z=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),T=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function B(t){return t===null||typeof t!="object"?null:(t=$&&t[$]||t["@@iterator"],typeof t=="function"?t:null)}var G=Symbol.for("react.client.reference");function ne(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===G?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case j:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case I:return"Suspense";case _:return"SuspenseList";case Y:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case S:return"Portal";case z:return t.displayName||"Context";case N:return(t._context.displayName||"Context")+".Consumer";case O:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case q:return n=t.displayName||null,n!==null?n:ne(t.type)||"Memo";case W:n=t._payload,t=t._init;try{return ne(t(n))}catch{}}return null}var V=Array.isArray,U=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},je=[],R=-1;function M(t){return{current:t}}function K(t){0>R||(t.current=je[R],je[R]=null,R--)}function D(t,n){R++,je[R]=t.current,t.current=n}var de=M(null),Se=M(null),ve=M(null),Fe=M(null);function Me(t,n){switch(D(ve,n),D(Se,t),D(de,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?_p(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=_p(n),t=Op(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}K(de),D(de,t)}function $e(){K(de),K(Se),K(ve)}function fe(t){t.memoizedState!==null&&D(Fe,t);var n=de.current,a=Op(n,t.type);n!==a&&(D(Se,t),D(de,a))}function tt(t){Se.current===t&&(K(de),K(Se)),Fe.current===t&&(K(Fe),Ss._currentValue=ie)}var mt,he;function ye(t){if(mt===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);mt=n&&n[1]||"",he=-1<a.stack.indexOf(`
|
|
42
42
|
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
43
|
`+mt+t+he}var ge=!1;function Le(t,n){if(!t||ge)return"";ge=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={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(re){var te=re}Reflect.construct(t,[],ue)}else{try{ue.call()}catch(re){te=re}t.call(ue.prototype)}}else{try{throw Error()}catch(re){te=re}(ue=t())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(re){if(re&&te&&typeof re.stack=="string")return[re.stack,te.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=o.DetermineComponentFrameRoot(),w=p[0],A=p[1];if(w&&A){var H=w.split(`
|
|
44
44
|
`),ee=A.split(`
|
|
45
45
|
`);for(h=o=0;o<H.length&&!H[o].includes("DetermineComponentFrameRoot");)o++;for(;h<ee.length&&!ee[h].includes("DetermineComponentFrameRoot");)h++;if(o===H.length||h===ee.length)for(o=H.length-1,h=ee.length-1;1<=o&&0<=h&&H[o]!==ee[h];)h--;for(;1<=o&&0<=h;o--,h--)if(H[o]!==ee[h]){if(o!==1||h!==1)do if(o--,h--,0>h||H[o]!==ee[h]){var oe=`
|
|
46
46
|
`+H[o].replace(" at new "," at ");return t.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",t.displayName)),oe}while(1<=o&&0<=h);break}}}finally{ge=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?ye(a):""}function Ee(t,n){switch(t.tag){case 26:case 27:case 5:return ye(t.type);case 16:return ye("Lazy");case 13:return t.child!==n&&n!==null?ye("Suspense Fallback"):ye("Suspense");case 19:return ye("SuspenseList");case 0:case 15:return Le(t.type,!1);case 11:return Le(t.type.render,!1);case 1:return Le(t.type,!0);case 31:return ye("Activity");default:return""}}function ze(t){try{var n="",a=null;do n+=Ee(t,a),a=t,t=t.return;while(t);return n}catch(o){return`
|
|
47
47
|
Error generating stack: `+o.message+`
|
|
48
|
-
`+o.stack}}var Te=Object.prototype.hasOwnProperty,Ne=e.unstable_scheduleCallback,Ie=e.unstable_cancelCallback,Ge=e.unstable_shouldYield,Dt=e.unstable_requestPaint,ct=e.unstable_now,Ot=e.unstable_getCurrentPriorityLevel,se=e.unstable_ImmediatePriority,be=e.unstable_UserBlockingPriority,Re=e.unstable_NormalPriority,_e=e.unstable_LowPriority,xe=e.unstable_IdlePriority,De=e.log,vt=e.unstable_setDisableYieldValue,Pe=null,nt=null;function At(t){if(typeof De=="function"&&vt(t),nt&&typeof nt.setStrictMode=="function")try{nt.setStrictMode(Pe,t)}catch{}}var ut=Math.clz32?Math.clz32:Ml,tn=Math.log,yn=Math.LN2;function Ml(t){return t>>>=0,t===0?32:31-(tn(t)/yn|0)|0}var kt=256,Rl=262144,$n=4194304;function J(t){var n=t&42;if(n!==0)return n;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Oe(t,n,a){var o=t.pendingLanes;if(o===0)return 0;var h=0,p=t.suspendedLanes,w=t.pingedLanes;t=t.warmLanes;var A=o&134217727;return A!==0?(o=A&~p,o!==0?h=J(o):(w&=A,w!==0?h=J(w):a||(a=A&~t,a!==0&&(h=J(a))))):(A=o&~p,A!==0?h=J(A):w!==0?h=J(w):a||(a=o&~t,a!==0&&(h=J(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 rt(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function pe(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function gt(){var t=$n;return $n<<=1,($n&62914560)===0&&($n=4194304),t}function dn(t){for(var n=[],a=0;31>a;a++)n.push(t);return n}function nn(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function br(t,n,a,o,h,p){var w=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var A=t.entanglements,H=t.expirationTimes,ee=t.hiddenUpdates;for(a=w&~a;0<a;){var oe=31-ut(a),ue=1<<oe;A[oe]=0,H[oe]=-1;var te=ee[oe];if(te!==null)for(ee[oe]=null,oe=0;oe<te.length;oe++){var re=te[oe];re!==null&&(re.lane&=-536870913)}a&=~ue}o!==0&&Ri(t,o,0),p!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=p&~(w&~n))}function Ri(t,n,a){t.pendingLanes|=n,t.suspendedLanes&=~n;var o=31-ut(n);t.entangledLanes|=n,t.entanglements[o]=t.entanglements[o]|1073741824|a&261930}function Ha(t,n){var a=t.entangledLanes|=n;for(t=t.entanglements;a;){var o=31-ut(a),h=1<<o;h&n|t[o]&n&&(t[o]|=n),a&=~h}}function Gn(t,n){var a=n&-n;return a=(a&42)!==0?1:Fi(a),(a&(t.suspendedLanes|n))!==0?0:a}function Fi(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Fl(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Ia(){var t=Z.p;return t!==0?t:(t=window.event,t===void 0?32:a1(t.type))}function Ql(t,n){var a=Z.p;try{return Z.p=t,n()}finally{Z.p=a}}var zn=Math.random().toString(36).slice(2),Vt="__reactFiber$"+zn,vn="__reactProps$"+zn,Kn="__reactContainer$"+zn,Ua="__reactEvents$"+zn,lo="__reactListeners$"+zn,_i="__reactHandles$"+zn,Oi="__reactResources$"+zn,vr="__reactMarker$"+zn;function vl(t){delete t[Vt],delete t[vn],delete t[Ua],delete t[lo],delete t[_i]}function _l(t){var n=t[Vt];if(n)return n;for(var a=t.parentNode;a;){if(n=a[Kn]||a[Vt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(t=Yp(t);t!==null;){if(a=t[Vt])return a;t=Yp(t)}return n}t=a,a=t.parentNode}return null}function Zl(t){if(t=t[Vt]||t[Kn]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function wr(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(i(33))}function kr(t){var n=t[Oi];return n||(n=t[Oi]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Zt(t){t[vr]=!0}var Wn=new Set,wl={};function Qn(t,n){jr(t,n),jr(t+"Capture",n)}function jr(t,n){for(wl[t]=n,t=0;t<n.length;t++)Wn.add(n[t])}var kl=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]*$"),It={},Ol={};function Mn(t){return Te.call(Ol,t)?!0:Te.call(It,t)?!1:kl.test(t)?Ol[t]=!0:(It[t]=!0,!1)}function Bl(t,n,a){if(Mn(n))if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var o=n.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+a)}}function Sr(t,n,a){if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttribute(n,""+a)}}function jl(t,n,a,o){if(o===null)t.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(n,a,""+o)}}function gn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Cr(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function fa(t,n,a){var o=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,p=o.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return h.call(this)},set:function(w){a=""+w,p.call(this,w)}}),Object.defineProperty(t,n,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function Bi(t){if(!t._valueTracker){var n=Cr(t)?"checked":"value";t._valueTracker=fa(t,n,""+t[n])}}function Ut(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var a=n.getValue(),o="";return t&&(o=Cr(t)?t.checked?"true":"false":t.value),t=o,t!==a?(n.setValue(t),!0):!1}function Er(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Jc=/[\n"\\]/g;function Ln(t){return t.replace(Jc,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function $i(t,n,a,o,h,p,w,A){t.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?t.type=w:t.removeAttribute("type"),n!=null?w==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+gn(n)):t.value!==""+gn(n)&&(t.value=""+gn(n)):w!=="submit"&&w!=="reset"||t.removeAttribute("value"),n!=null?ha(t,w,gn(n)):a!=null?ha(t,w,gn(a)):o!=null&&t.removeAttribute("value"),h==null&&p!=null&&(t.defaultChecked=!!p),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?t.name=""+gn(A):t.removeAttribute("name")}function Ya(t,n,a,o,h,p,w,A){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(t.type=p),n!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||n!=null)){Bi(t);return}a=a!=null?""+gn(a):"",n=n!=null?""+gn(n):a,A||n===t.value||(t.value=n),t.defaultValue=n}o=o??h,o=typeof o!="function"&&typeof o!="symbol"&&!!o,t.checked=A?t.checked:!!o,t.defaultChecked=!!o,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(t.name=w),Bi(t)}function ha(t,n,a){n==="number"&&Er(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function Nr(t,n,a,o){if(t=t.options,n){n={};for(var h=0;h<a.length;h++)n["$"+a[h]]=!0;for(a=0;a<t.length;a++)h=n.hasOwnProperty("$"+t[a].value),t[a].selected!==h&&(t[a].selected=h),h&&o&&(t[a].defaultSelected=!0)}else{for(a=""+gn(a),n=null,h=0;h<t.length;h++){if(t[h].value===a){t[h].selected=!0,o&&(t[h].defaultSelected=!0);return}n!==null||t[h].disabled||(n=t[h])}n!==null&&(n.selected=!0)}}function ro(t,n,a){if(n!=null&&(n=""+gn(n),n!==t.value&&(t.value=n),a==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=a!=null?""+gn(a):""}function Li(t,n,a,o){if(n==null){if(o!=null){if(a!=null)throw Error(i(92));if(V(o)){if(1<o.length)throw Error(i(93));o=o[0]}a=o}a==null&&(a=""),n=a}a=gn(n),t.defaultValue=a,o=t.textContent,o===a&&o!==""&&o!==null&&(t.value=o),Bi(t)}function Ar(t,n){if(n){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=n;return}}t.textContent=n}var Pc=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 ao(t,n,a){var o=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":o?t.setProperty(n,a):typeof a!="number"||a===0||Pc.has(n)?n==="float"?t.cssFloat=a:t[n]=(""+a).trim():t[n]=a+"px"}function io(t,n,a){if(n!=null&&typeof n!="object")throw Error(i(62));if(t=t.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||n!=null&&n.hasOwnProperty(o)||(o.indexOf("--")===0?t.setProperty(o,""):o==="float"?t.cssFloat="":t[o]="");for(var h in n)o=n[h],n.hasOwnProperty(h)&&a[h]!==o&&ao(t,h,o)}else for(var p in n)n.hasOwnProperty(p)&&ao(t,p,n[p])}function Hi(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var eu=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"]]),tu=/^[\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 Zn(t){return tu.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Jn(){}var Ii=null;function Ui(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Rn=null,Jl=null;function so(t){var n=Zl(t);if(n&&(t=n.stateNode)){var a=t[vn]||null;e:switch(t=n.stateNode,n.type){case"input":if($i(t,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Ln(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var o=a[n];if(o!==t&&o.form===t.form){var h=o[vn]||null;if(!h)throw Error(i(90));$i(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(n=0;n<a.length;n++)o=a[n],o.form===t.form&&Ut(o)}break e;case"textarea":ro(t,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Nr(t,!!a.multiple,n,!1)}}}var Yi=!1;function fn(t,n,a){if(Yi)return t(n,a);Yi=!0;try{var o=t(n);return o}finally{if(Yi=!1,(Rn!==null||Jl!==null)&&(Xo(),Rn&&(n=Rn,t=Jl,Jl=Rn=null,so(n),t)))for(n=0;n<t.length;n++)so(t[n])}}function Sl(t,n){var a=t.stateNode;if(a===null)return null;var o=a[vn]||null;if(o===null)return null;a=o[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(t=t.type,o=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!o;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(i(231,n,typeof a));return a}var cl=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qa=!1;if(cl)try{var Dr={};Object.defineProperty(Dr,"passive",{get:function(){qa=!0}}),window.addEventListener("test",Dr,Dr),window.removeEventListener("test",Dr,Dr)}catch{qa=!1}var F=null,le=null,ae=null;function me(){if(ae)return ae;var t,n=le,a=n.length,o,h="value"in F?F.value:F.textContent,p=h.length;for(t=0;t<a&&n[t]===h[t];t++);var w=a-t;for(o=1;o<=w&&n[a-o]===h[p-o];o++);return ae=h.slice(t,1<o?1-o:void 0)}function we(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function Je(){return!0}function qe(){return!1}function Ae(t){function n(a,o,h,p,w){this._reactName=a,this._targetInst=h,this.type=o,this.nativeEvent=p,this.target=w,this.currentTarget=null;for(var A in t)t.hasOwnProperty(A)&&(a=t[A],this[A]=a?a(p):p[A]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Je:qe,this.isPropagationStopped=qe,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=Je)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Je)},persist:function(){},isPersistent:Je}),n}var Ke={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},We=Ae(Ke),Xe=y({},Ke,{view:0,detail:0}),oo=Ae(Xe),Tr,zr,ma,Gt=y({},Xe,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nu,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ma&&(ma&&t.type==="mousemove"?(Tr=t.screenX-ma.screenX,zr=t.screenY-ma.screenY):zr=Tr=0,ma=t),Tr)},movementY:function(t){return"movementY"in t?t.movementY:zr}}),Pl=Ae(Gt),Cl=y({},Gt,{dataTransfer:0}),wn=Ae(Cl),qi=y({},Xe,{relatedTarget:0}),Wt=Ae(qi),Ig=y({},Ke,{animationName:0,elapsedTime:0,pseudoElement:0}),Ug=Ae(Ig),Yg=y({},Ke,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),qg=Ae(Yg),Xg=y({},Ke,{data:0}),Lh=Ae(Xg),Vg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Gg={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"},Kg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Wg(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=Kg[t])?!!n[t]:!1}function nu(){return Wg}var Qg=y({},Xe,{key:function(t){if(t.key){var n=Vg[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=we(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Gg[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nu,charCode:function(t){return t.type==="keypress"?we(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?we(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Zg=Ae(Qg),Jg=y({},Gt,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Hh=Ae(Jg),Pg=y({},Xe,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nu}),eb=Ae(Pg),tb=y({},Ke,{propertyName:0,elapsedTime:0,pseudoElement:0}),nb=Ae(tb),lb=y({},Gt,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),rb=Ae(lb),ab=y({},Ke,{newState:0,oldState:0}),ib=Ae(ab),sb=[9,13,27,32],lu=cl&&"CompositionEvent"in window,Xi=null;cl&&"documentMode"in document&&(Xi=document.documentMode);var ob=cl&&"TextEvent"in window&&!Xi,Ih=cl&&(!lu||Xi&&8<Xi&&11>=Xi),Uh=" ",Yh=!1;function qh(t,n){switch(t){case"keyup":return sb.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xh(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Xa=!1;function cb(t,n){switch(t){case"compositionend":return Xh(n);case"keypress":return n.which!==32?null:(Yh=!0,Uh);case"textInput":return t=n.data,t===Uh&&Yh?null:t;default:return null}}function ub(t,n){if(Xa)return t==="compositionend"||!lu&&qh(t,n)?(t=me(),ae=le=F=null,Xa=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Ih&&n.locale!=="ko"?null:n.data;default:return null}}var db={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 Vh(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!db[t.type]:n==="textarea"}function Gh(t,n,a,o){Rn?Jl?Jl.push(o):Jl=[o]:Rn=o,n=Jo(n,"onChange"),0<n.length&&(a=new We("onChange","change",null,a,o),t.push({event:a,listeners:n}))}var Vi=null,Gi=null;function fb(t){Dp(t,0)}function co(t){var n=wr(t);if(Ut(n))return t}function Kh(t,n){if(t==="change")return n}var Wh=!1;if(cl){var ru;if(cl){var au="oninput"in document;if(!au){var Qh=document.createElement("div");Qh.setAttribute("oninput","return;"),au=typeof Qh.oninput=="function"}ru=au}else ru=!1;Wh=ru&&(!document.documentMode||9<document.documentMode)}function Zh(){Vi&&(Vi.detachEvent("onpropertychange",Jh),Gi=Vi=null)}function Jh(t){if(t.propertyName==="value"&&co(Gi)){var n=[];Gh(n,Gi,t,Ui(t)),fn(fb,n)}}function hb(t,n,a){t==="focusin"?(Zh(),Vi=n,Gi=a,Vi.attachEvent("onpropertychange",Jh)):t==="focusout"&&Zh()}function mb(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return co(Gi)}function xb(t,n){if(t==="click")return co(n)}function pb(t,n){if(t==="input"||t==="change")return co(n)}function yb(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var Pn=typeof Object.is=="function"?Object.is:yb;function Ki(t,n){if(Pn(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var a=Object.keys(t),o=Object.keys(n);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var h=a[o];if(!Te.call(n,h)||!Pn(t[h],n[h]))return!1}return!0}function Ph(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function em(t,n){var a=Ph(t);t=0;for(var o;a;){if(a.nodeType===3){if(o=t+a.textContent.length,t<=n&&o>=n)return{node:a,offset:n-t};t=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Ph(a)}}function tm(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?tm(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function nm(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=Er(t.document);n instanceof t.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)t=n.contentWindow;else break;n=Er(t.document)}return n}function iu(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var gb=cl&&"documentMode"in document&&11>=document.documentMode,Va=null,su=null,Wi=null,ou=!1;function lm(t,n,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;ou||Va==null||Va!==Er(o)||(o=Va,"selectionStart"in o&&iu(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Wi&&Ki(Wi,o)||(Wi=o,o=Jo(su,"onSelect"),0<o.length&&(n=new We("onSelect","select",null,n,a),t.push({event:n,listeners:o}),n.target=Va)))}function xa(t,n){var a={};return a[t.toLowerCase()]=n.toLowerCase(),a["Webkit"+t]="webkit"+n,a["Moz"+t]="moz"+n,a}var Ga={animationend:xa("Animation","AnimationEnd"),animationiteration:xa("Animation","AnimationIteration"),animationstart:xa("Animation","AnimationStart"),transitionrun:xa("Transition","TransitionRun"),transitionstart:xa("Transition","TransitionStart"),transitioncancel:xa("Transition","TransitionCancel"),transitionend:xa("Transition","TransitionEnd")},cu={},rm={};cl&&(rm=document.createElement("div").style,"AnimationEvent"in window||(delete Ga.animationend.animation,delete Ga.animationiteration.animation,delete Ga.animationstart.animation),"TransitionEvent"in window||delete Ga.transitionend.transition);function pa(t){if(cu[t])return cu[t];if(!Ga[t])return t;var n=Ga[t],a;for(a in n)if(n.hasOwnProperty(a)&&a in rm)return cu[t]=n[a];return t}var am=pa("animationend"),im=pa("animationiteration"),sm=pa("animationstart"),bb=pa("transitionrun"),vb=pa("transitionstart"),wb=pa("transitioncancel"),om=pa("transitionend"),cm=new Map,uu="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(" ");uu.push("scrollEnd");function El(t,n){cm.set(t,n),Qn(n,[t])}var uo=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},ul=[],Ka=0,du=0;function fo(){for(var t=Ka,n=du=Ka=0;n<t;){var a=ul[n];ul[n++]=null;var o=ul[n];ul[n++]=null;var h=ul[n];ul[n++]=null;var p=ul[n];if(ul[n++]=null,o!==null&&h!==null){var w=o.pending;w===null?h.next=h:(h.next=w.next,w.next=h),o.pending=h}p!==0&&um(a,h,p)}}function ho(t,n,a,o){ul[Ka++]=t,ul[Ka++]=n,ul[Ka++]=a,ul[Ka++]=o,du|=o,t.lanes|=o,t=t.alternate,t!==null&&(t.lanes|=o)}function fu(t,n,a,o){return ho(t,n,a,o),mo(t)}function ya(t,n){return ho(t,null,null,n),mo(t)}function um(t,n,a){t.lanes|=a;var o=t.alternate;o!==null&&(o.lanes|=a);for(var h=!1,p=t.return;p!==null;)p.childLanes|=a,o=p.alternate,o!==null&&(o.childLanes|=a),p.tag===22&&(t=p.stateNode,t===null||t._visibility&1||(h=!0)),t=p,p=p.return;return t.tag===3?(p=t.stateNode,h&&n!==null&&(h=31-ut(a),t=p.hiddenUpdates,o=t[h],o===null?t[h]=[n]:o.push(n),n.lane=a|536870912),p):null}function mo(t){if(50<ys)throw ys=0,wd=null,Error(i(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var Wa={};function kb(t,n,a,o){this.tag=t,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=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function el(t,n,a,o){return new kb(t,n,a,o)}function hu(t){return t=t.prototype,!(!t||!t.isReactComponent)}function er(t,n){var a=t.alternate;return a===null?(a=el(t.tag,n,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=n,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&65011712,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,n=t.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a.refCleanup=t.refCleanup,a}function dm(t,n){t.flags&=65011714;var a=t.alternate;return a===null?(t.childLanes=0,t.lanes=n,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=a.childLanes,t.lanes=a.lanes,t.child=a.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=a.memoizedProps,t.memoizedState=a.memoizedState,t.updateQueue=a.updateQueue,t.type=a.type,n=a.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function xo(t,n,a,o,h,p){var w=0;if(o=t,typeof t=="function")hu(t)&&(w=1);else if(typeof t=="string")w=N2(t,a,de.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case Y:return t=el(31,a,n,h),t.elementType=Y,t.lanes=p,t;case j:return ga(a.children,h,p,n);case C:w=8,h|=24;break;case E:return t=el(12,a,n,h|2),t.elementType=E,t.lanes=p,t;case I:return t=el(13,a,n,h),t.elementType=I,t.lanes=p,t;case _:return t=el(19,a,n,h),t.elementType=_,t.lanes=p,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case z:w=10;break e;case N:w=9;break e;case O:w=11;break e;case q:w=14;break e;case W:w=16,o=null;break e}w=29,a=Error(i(130,t===null?"null":typeof t,"")),o=null}return n=el(w,a,n,h),n.elementType=t,n.type=o,n.lanes=p,n}function ga(t,n,a,o){return t=el(7,t,o,n),t.lanes=a,t}function mu(t,n,a){return t=el(6,t,null,n),t.lanes=a,t}function fm(t){var n=el(18,null,null,0);return n.stateNode=t,n}function xu(t,n,a){return n=el(4,t.children!==null?t.children:[],t.key,n),n.lanes=a,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var hm=new WeakMap;function dl(t,n){if(typeof t=="object"&&t!==null){var a=hm.get(t);return a!==void 0?a:(n={value:t,source:n,stack:ze(n)},hm.set(t,n),n)}return{value:t,source:n,stack:ze(n)}}var Qa=[],Za=0,po=null,Qi=0,fl=[],hl=0,Mr=null,$l=1,Ll="";function tr(t,n){Qa[Za++]=Qi,Qa[Za++]=po,po=t,Qi=n}function mm(t,n,a){fl[hl++]=$l,fl[hl++]=Ll,fl[hl++]=Mr,Mr=t;var o=$l;t=Ll;var h=32-ut(o)-1;o&=~(1<<h),a+=1;var p=32-ut(n)+h;if(30<p){var w=h-h%5;p=(o&(1<<w)-1).toString(32),o>>=w,h-=w,$l=1<<32-ut(n)+h|a<<h|o,Ll=p+t}else $l=1<<p|a<<h|o,Ll=t}function pu(t){t.return!==null&&(tr(t,1),mm(t,1,0))}function yu(t){for(;t===po;)po=Qa[--Za],Qa[Za]=null,Qi=Qa[--Za],Qa[Za]=null;for(;t===Mr;)Mr=fl[--hl],fl[hl]=null,Ll=fl[--hl],fl[hl]=null,$l=fl[--hl],fl[hl]=null}function xm(t,n){fl[hl++]=$l,fl[hl++]=Ll,fl[hl++]=Mr,$l=n.id,Ll=n.overflow,Mr=t}var kn=null,Yt=null,bt=!1,Rr=null,ml=!1,gu=Error(i(519));function Fr(t){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Zi(dl(n,t)),gu}function pm(t){var n=t.stateNode,a=t.type,o=t.memoizedProps;switch(n[Vt]=t,n[vn]=o,a){case"dialog":ft("cancel",n),ft("close",n);break;case"iframe":case"object":case"embed":ft("load",n);break;case"video":case"audio":for(a=0;a<bs.length;a++)ft(bs[a],n);break;case"source":ft("error",n);break;case"img":case"image":case"link":ft("error",n),ft("load",n);break;case"details":ft("toggle",n);break;case"input":ft("invalid",n),Ya(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":ft("invalid",n);break;case"textarea":ft("invalid",n),Li(n,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||o.suppressHydrationWarning===!0||Rp(n.textContent,a)?(o.popover!=null&&(ft("beforetoggle",n),ft("toggle",n)),o.onScroll!=null&&ft("scroll",n),o.onScrollEnd!=null&&ft("scrollend",n),o.onClick!=null&&(n.onclick=Jn),n=!0):n=!1,n||Fr(t,!0)}function ym(t){for(kn=t.return;kn;)switch(kn.tag){case 5:case 31:case 13:ml=!1;return;case 27:case 3:ml=!0;return;default:kn=kn.return}}function Ja(t){if(t!==kn)return!1;if(!bt)return ym(t),bt=!0,!1;var n=t.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||Od(t.type,t.memoizedProps)),a=!a),a&&Yt&&Fr(t),ym(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));Yt=Up(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));Yt=Up(t)}else n===27?(n=Yt,Kr(t.type)?(t=Id,Id=null,Yt=t):Yt=n):Yt=kn?pl(t.stateNode.nextSibling):null;return!0}function ba(){Yt=kn=null,bt=!1}function bu(){var t=Rr;return t!==null&&(Yn===null?Yn=t:Yn.push.apply(Yn,t),Rr=null),t}function Zi(t){Rr===null?Rr=[t]:Rr.push(t)}var vu=M(null),va=null,nr=null;function _r(t,n,a){D(vu,n._currentValue),n._currentValue=a}function lr(t){t._currentValue=vu.current,K(vu)}function wu(t,n,a){for(;t!==null;){var o=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),t===a)break;t=t.return}}function ku(t,n,a,o){var h=t.child;for(h!==null&&(h.return=t);h!==null;){var p=h.dependencies;if(p!==null){var w=h.child;p=p.firstContext;e:for(;p!==null;){var A=p;p=h;for(var H=0;H<n.length;H++)if(A.context===n[H]){p.lanes|=a,A=p.alternate,A!==null&&(A.lanes|=a),wu(p.return,a,t),o||(w=null);break e}p=A.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),wu(w,a,t),w=null}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===t){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}}function Pa(t,n,a,o){t=null;for(var h=n,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var w=h.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var A=h.type;Pn(h.pendingProps.value,w.value)||(t!==null?t.push(A):t=[A])}}else if(h===Fe.current){if(w=h.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(Ss):t=[Ss])}h=h.return}t!==null&&ku(n,t,a,o),n.flags|=262144}function yo(t){for(t=t.firstContext;t!==null;){if(!Pn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function wa(t){va=t,nr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function jn(t){return gm(va,t)}function go(t,n){return va===null&&wa(t),gm(t,n)}function gm(t,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},nr===null){if(t===null)throw Error(i(308));nr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else nr=nr.next=n;return a}var jb=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(a,o){t.push(o)}};this.abort=function(){n.aborted=!0,t.forEach(function(a){return a()})}},Sb=e.unstable_scheduleCallback,Cb=e.unstable_NormalPriority,an={$$typeof:z,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ju(){return{controller:new jb,data:new Map,refCount:0}}function Ji(t){t.refCount--,t.refCount===0&&Sb(Cb,function(){t.controller.abort()})}var Pi=null,Su=0,ei=0,ti=null;function Eb(t,n){if(Pi===null){var a=Pi=[];Su=0,ei=Nd(),ti={status:"pending",value:void 0,then:function(o){a.push(o)}}}return Su++,n.then(bm,bm),n}function bm(){if(--Su===0&&Pi!==null){ti!==null&&(ti.status="fulfilled");var t=Pi;Pi=null,ei=0,ti=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function Nb(t,n){var a=[],o={status:"pending",value:null,reason:null,then:function(h){a.push(h)}};return t.then(function(){o.status="fulfilled",o.value=n;for(var h=0;h<a.length;h++)(0,a[h])(n)},function(h){for(o.status="rejected",o.reason=h,h=0;h<a.length;h++)(0,a[h])(void 0)}),o}var vm=U.S;U.S=function(t,n){lp=ct(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Eb(t,n),vm!==null&&vm(t,n)};var ka=M(null);function Cu(){var t=ka.current;return t!==null?t:Bt.pooledCache}function bo(t,n){n===null?D(ka,ka.current):D(ka,n.pool)}function wm(){var t=Cu();return t===null?null:{parent:an._currentValue,pool:t}}var ni=Error(i(460)),Eu=Error(i(474)),vo=Error(i(542)),wo={then:function(){}};function km(t){return t=t.status,t==="fulfilled"||t==="rejected"}function jm(t,n,a){switch(a=t[a],a===void 0?t.push(n):a!==n&&(n.then(Jn,Jn),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,Cm(t),t;default:if(typeof n.status=="string")n.then(Jn,Jn);else{if(t=Bt,t!==null&&100<t.shellSuspendCounter)throw Error(i(482));t=n,t.status="pending",t.then(function(o){if(n.status==="pending"){var h=n;h.status="fulfilled",h.value=o}},function(o){if(n.status==="pending"){var h=n;h.status="rejected",h.reason=o}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,Cm(t),t}throw Sa=n,ni}}function ja(t){try{var n=t._init;return n(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Sa=a,ni):a}}var Sa=null;function Sm(){if(Sa===null)throw Error(i(459));var t=Sa;return Sa=null,t}function Cm(t){if(t===ni||t===vo)throw Error(i(483))}var li=null,es=0;function ko(t){var n=es;return es+=1,li===null&&(li=[]),jm(li,t,n)}function ts(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function jo(t,n){throw n.$$typeof===b?Error(i(525)):(t=Object.prototype.toString.call(n),Error(i(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function Em(t){function n(Q,X){if(t){var P=Q.deletions;P===null?(Q.deletions=[X],Q.flags|=16):P.push(X)}}function a(Q,X){if(!t)return null;for(;X!==null;)n(Q,X),X=X.sibling;return null}function o(Q){for(var X=new Map;Q!==null;)Q.key!==null?X.set(Q.key,Q):X.set(Q.index,Q),Q=Q.sibling;return X}function h(Q,X){return Q=er(Q,X),Q.index=0,Q.sibling=null,Q}function p(Q,X,P){return Q.index=P,t?(P=Q.alternate,P!==null?(P=P.index,P<X?(Q.flags|=67108866,X):P):(Q.flags|=67108866,X)):(Q.flags|=1048576,X)}function w(Q){return t&&Q.alternate===null&&(Q.flags|=67108866),Q}function A(Q,X,P,ce){return X===null||X.tag!==6?(X=mu(P,Q.mode,ce),X.return=Q,X):(X=h(X,P),X.return=Q,X)}function H(Q,X,P,ce){var Ye=P.type;return Ye===j?oe(Q,X,P.props.children,ce,P.key):X!==null&&(X.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===W&&ja(Ye)===X.type)?(X=h(X,P.props),ts(X,P),X.return=Q,X):(X=xo(P.type,P.key,P.props,null,Q.mode,ce),ts(X,P),X.return=Q,X)}function ee(Q,X,P,ce){return X===null||X.tag!==4||X.stateNode.containerInfo!==P.containerInfo||X.stateNode.implementation!==P.implementation?(X=xu(P,Q.mode,ce),X.return=Q,X):(X=h(X,P.children||[]),X.return=Q,X)}function oe(Q,X,P,ce,Ye){return X===null||X.tag!==7?(X=ga(P,Q.mode,ce,Ye),X.return=Q,X):(X=h(X,P),X.return=Q,X)}function ue(Q,X,P){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return X=mu(""+X,Q.mode,P),X.return=Q,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case v:return P=xo(X.type,X.key,X.props,null,Q.mode,P),ts(P,X),P.return=Q,P;case S:return X=xu(X,Q.mode,P),X.return=Q,X;case W:return X=ja(X),ue(Q,X,P)}if(V(X)||B(X))return X=ga(X,Q.mode,P,null),X.return=Q,X;if(typeof X.then=="function")return ue(Q,ko(X),P);if(X.$$typeof===z)return ue(Q,go(Q,X),P);jo(Q,X)}return null}function te(Q,X,P,ce){var Ye=X!==null?X.key:null;if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return Ye!==null?null:A(Q,X,""+P,ce);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case v:return P.key===Ye?H(Q,X,P,ce):null;case S:return P.key===Ye?ee(Q,X,P,ce):null;case W:return P=ja(P),te(Q,X,P,ce)}if(V(P)||B(P))return Ye!==null?null:oe(Q,X,P,ce,null);if(typeof P.then=="function")return te(Q,X,ko(P),ce);if(P.$$typeof===z)return te(Q,X,go(Q,P),ce);jo(Q,P)}return null}function re(Q,X,P,ce,Ye){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return Q=Q.get(P)||null,A(X,Q,""+ce,Ye);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case v:return Q=Q.get(ce.key===null?P:ce.key)||null,H(X,Q,ce,Ye);case S:return Q=Q.get(ce.key===null?P:ce.key)||null,ee(X,Q,ce,Ye);case W:return ce=ja(ce),re(Q,X,P,ce,Ye)}if(V(ce)||B(ce))return Q=Q.get(P)||null,oe(X,Q,ce,Ye,null);if(typeof ce.then=="function")return re(Q,X,P,ko(ce),Ye);if(ce.$$typeof===z)return re(Q,X,P,go(X,ce),Ye);jo(X,ce)}return null}function Be(Q,X,P,ce){for(var Ye=null,jt=null,He=X,at=X=0,pt=null;He!==null&&at<P.length;at++){He.index>at?(pt=He,He=null):pt=He.sibling;var St=te(Q,He,P[at],ce);if(St===null){He===null&&(He=pt);break}t&&He&&St.alternate===null&&n(Q,He),X=p(St,X,at),jt===null?Ye=St:jt.sibling=St,jt=St,He=pt}if(at===P.length)return a(Q,He),bt&&tr(Q,at),Ye;if(He===null){for(;at<P.length;at++)He=ue(Q,P[at],ce),He!==null&&(X=p(He,X,at),jt===null?Ye=He:jt.sibling=He,jt=He);return bt&&tr(Q,at),Ye}for(He=o(He);at<P.length;at++)pt=re(He,Q,at,P[at],ce),pt!==null&&(t&&pt.alternate!==null&&He.delete(pt.key===null?at:pt.key),X=p(pt,X,at),jt===null?Ye=pt:jt.sibling=pt,jt=pt);return t&&He.forEach(function(Pr){return n(Q,Pr)}),bt&&tr(Q,at),Ye}function Qe(Q,X,P,ce){if(P==null)throw Error(i(151));for(var Ye=null,jt=null,He=X,at=X=0,pt=null,St=P.next();He!==null&&!St.done;at++,St=P.next()){He.index>at?(pt=He,He=null):pt=He.sibling;var Pr=te(Q,He,St.value,ce);if(Pr===null){He===null&&(He=pt);break}t&&He&&Pr.alternate===null&&n(Q,He),X=p(Pr,X,at),jt===null?Ye=Pr:jt.sibling=Pr,jt=Pr,He=pt}if(St.done)return a(Q,He),bt&&tr(Q,at),Ye;if(He===null){for(;!St.done;at++,St=P.next())St=ue(Q,St.value,ce),St!==null&&(X=p(St,X,at),jt===null?Ye=St:jt.sibling=St,jt=St);return bt&&tr(Q,at),Ye}for(He=o(He);!St.done;at++,St=P.next())St=re(He,Q,at,St.value,ce),St!==null&&(t&&St.alternate!==null&&He.delete(St.key===null?at:St.key),X=p(St,X,at),jt===null?Ye=St:jt.sibling=St,jt=St);return t&&He.forEach(function($2){return n(Q,$2)}),bt&&tr(Q,at),Ye}function Ft(Q,X,P,ce){if(typeof P=="object"&&P!==null&&P.type===j&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case v:e:{for(var Ye=P.key;X!==null;){if(X.key===Ye){if(Ye=P.type,Ye===j){if(X.tag===7){a(Q,X.sibling),ce=h(X,P.props.children),ce.return=Q,Q=ce;break e}}else if(X.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===W&&ja(Ye)===X.type){a(Q,X.sibling),ce=h(X,P.props),ts(ce,P),ce.return=Q,Q=ce;break e}a(Q,X);break}else n(Q,X);X=X.sibling}P.type===j?(ce=ga(P.props.children,Q.mode,ce,P.key),ce.return=Q,Q=ce):(ce=xo(P.type,P.key,P.props,null,Q.mode,ce),ts(ce,P),ce.return=Q,Q=ce)}return w(Q);case S:e:{for(Ye=P.key;X!==null;){if(X.key===Ye)if(X.tag===4&&X.stateNode.containerInfo===P.containerInfo&&X.stateNode.implementation===P.implementation){a(Q,X.sibling),ce=h(X,P.children||[]),ce.return=Q,Q=ce;break e}else{a(Q,X);break}else n(Q,X);X=X.sibling}ce=xu(P,Q.mode,ce),ce.return=Q,Q=ce}return w(Q);case W:return P=ja(P),Ft(Q,X,P,ce)}if(V(P))return Be(Q,X,P,ce);if(B(P)){if(Ye=B(P),typeof Ye!="function")throw Error(i(150));return P=Ye.call(P),Qe(Q,X,P,ce)}if(typeof P.then=="function")return Ft(Q,X,ko(P),ce);if(P.$$typeof===z)return Ft(Q,X,go(Q,P),ce);jo(Q,P)}return typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint"?(P=""+P,X!==null&&X.tag===6?(a(Q,X.sibling),ce=h(X,P),ce.return=Q,Q=ce):(a(Q,X),ce=mu(P,Q.mode,ce),ce.return=Q,Q=ce),w(Q)):a(Q,X)}return function(Q,X,P,ce){try{es=0;var Ye=Ft(Q,X,P,ce);return li=null,Ye}catch(He){if(He===ni||He===vo)throw He;var jt=el(29,He,null,Q.mode);return jt.lanes=ce,jt.return=Q,jt}finally{}}}var Ca=Em(!0),Nm=Em(!1),Or=!1;function Nu(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Au(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Br(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function $r(t,n,a){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(Et&2)!==0){var h=o.pending;return h===null?n.next=n:(n.next=h.next,h.next=n),o.pending=n,n=mo(t),um(t,null,a),n}return ho(t,o,n,a),mo(t)}function ns(t,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var o=n.lanes;o&=t.pendingLanes,a|=o,n.lanes=a,Ha(t,a)}}function Du(t,n){var a=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,a===o)){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:o.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=n:t.next=n,a.lastBaseUpdate=n}var Tu=!1;function ls(){if(Tu){var t=ti;if(t!==null)throw t}}function rs(t,n,a,o){Tu=!1;var h=t.updateQueue;Or=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,A=h.shared.pending;if(A!==null){h.shared.pending=null;var H=A,ee=H.next;H.next=null,w===null?p=ee:w.next=ee,w=H;var oe=t.alternate;oe!==null&&(oe=oe.updateQueue,A=oe.lastBaseUpdate,A!==w&&(A===null?oe.firstBaseUpdate=ee:A.next=ee,oe.lastBaseUpdate=H))}if(p!==null){var ue=h.baseState;w=0,oe=ee=H=null,A=p;do{var te=A.lane&-536870913,re=te!==A.lane;if(re?(xt&te)===te:(o&te)===te){te!==0&&te===ei&&(Tu=!0),oe!==null&&(oe=oe.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var Be=t,Qe=A;te=n;var Ft=a;switch(Qe.tag){case 1:if(Be=Qe.payload,typeof Be=="function"){ue=Be.call(Ft,ue,te);break e}ue=Be;break e;case 3:Be.flags=Be.flags&-65537|128;case 0:if(Be=Qe.payload,te=typeof Be=="function"?Be.call(Ft,ue,te):Be,te==null)break e;ue=y({},ue,te);break e;case 2:Or=!0}}te=A.callback,te!==null&&(t.flags|=64,re&&(t.flags|=8192),re=h.callbacks,re===null?h.callbacks=[te]:re.push(te))}else re={lane:te,tag:A.tag,payload:A.payload,callback:A.callback,next:null},oe===null?(ee=oe=re,H=ue):oe=oe.next=re,w|=te;if(A=A.next,A===null){if(A=h.shared.pending,A===null)break;re=A,A=re.next,re.next=null,h.lastBaseUpdate=re,h.shared.pending=null}}while(!0);oe===null&&(H=ue),h.baseState=H,h.firstBaseUpdate=ee,h.lastBaseUpdate=oe,p===null&&(h.shared.lanes=0),Yr|=w,t.lanes=w,t.memoizedState=ue}}function Am(t,n){if(typeof t!="function")throw Error(i(191,t));t.call(n)}function Dm(t,n){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)Am(a[t],n)}var ri=M(null),So=M(0);function Tm(t,n){t=fr,D(So,t),D(ri,n),fr=t|n.baseLanes}function zu(){D(So,fr),D(ri,ri.current)}function Mu(){fr=So.current,K(ri),K(So)}var tl=M(null),xl=null;function Lr(t){var n=t.alternate;D(ln,ln.current&1),D(tl,t),xl===null&&(n===null||ri.current!==null||n.memoizedState!==null)&&(xl=t)}function Ru(t){D(ln,ln.current),D(tl,t),xl===null&&(xl=t)}function zm(t){t.tag===22?(D(ln,ln.current),D(tl,t),xl===null&&(xl=t)):Hr()}function Hr(){D(ln,ln.current),D(tl,tl.current)}function nl(t){K(tl),xl===t&&(xl=null),K(ln)}var ln=M(0);function Co(t){for(var n=t;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Ld(a)||Hd(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===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var rr=0,lt=null,Mt=null,sn=null,Eo=!1,ai=!1,Ea=!1,No=0,as=0,ii=null,Ab=0;function Jt(){throw Error(i(321))}function Fu(t,n){if(n===null)return!1;for(var a=0;a<n.length&&a<t.length;a++)if(!Pn(t[a],n[a]))return!1;return!0}function _u(t,n,a,o,h,p){return rr=p,lt=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,U.H=t===null||t.memoizedState===null?mx:Qu,Ea=!1,p=a(o,h),Ea=!1,ai&&(p=Rm(n,a,o,h)),Mm(t),p}function Mm(t){U.H=os;var n=Mt!==null&&Mt.next!==null;if(rr=0,sn=Mt=lt=null,Eo=!1,as=0,ii=null,n)throw Error(i(300));t===null||on||(t=t.dependencies,t!==null&&yo(t)&&(on=!0))}function Rm(t,n,a,o){lt=t;var h=0;do{if(ai&&(ii=null),as=0,ai=!1,25<=h)throw Error(i(301));if(h+=1,sn=Mt=null,t.updateQueue!=null){var p=t.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}U.H=xx,p=n(a,o)}while(ai);return p}function Db(){var t=U.H,n=t.useState()[0];return n=typeof n.then=="function"?is(n):n,t=t.useState()[0],(Mt!==null?Mt.memoizedState:null)!==t&&(lt.flags|=1024),n}function Ou(){var t=No!==0;return No=0,t}function Bu(t,n,a){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~a}function $u(t){if(Eo){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}Eo=!1}rr=0,sn=Mt=lt=null,ai=!1,as=No=0,ii=null}function Fn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return sn===null?lt.memoizedState=sn=t:sn=sn.next=t,sn}function rn(){if(Mt===null){var t=lt.alternate;t=t!==null?t.memoizedState:null}else t=Mt.next;var n=sn===null?lt.memoizedState:sn.next;if(n!==null)sn=n,Mt=t;else{if(t===null)throw lt.alternate===null?Error(i(467)):Error(i(310));Mt=t,t={memoizedState:Mt.memoizedState,baseState:Mt.baseState,baseQueue:Mt.baseQueue,queue:Mt.queue,next:null},sn===null?lt.memoizedState=sn=t:sn=sn.next=t}return sn}function Ao(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function is(t){var n=as;return as+=1,ii===null&&(ii=[]),t=jm(ii,t,n),n=lt,(sn===null?n.memoizedState:sn.next)===null&&(n=n.alternate,U.H=n===null||n.memoizedState===null?mx:Qu),t}function Do(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return is(t);if(t.$$typeof===z)return jn(t)}throw Error(i(438,String(t)))}function Lu(t){var n=null,a=lt.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var o=lt.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(n={data:o.data.map(function(h){return h.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Ao(),lt.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(t),o=0;o<t;o++)a[o]=T;return n.index++,a}function ar(t,n){return typeof n=="function"?n(t):n}function To(t){var n=rn();return Hu(n,Mt,t)}function Hu(t,n,a){var o=t.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=a;var h=t.baseQueue,p=o.pending;if(p!==null){if(h!==null){var w=h.next;h.next=p.next,p.next=w}n.baseQueue=h=p,o.pending=null}if(p=t.baseState,h===null)t.memoizedState=p;else{n=h.next;var A=w=null,H=null,ee=n,oe=!1;do{var ue=ee.lane&-536870913;if(ue!==ee.lane?(xt&ue)===ue:(rr&ue)===ue){var te=ee.revertLane;if(te===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),ue===ei&&(oe=!0);else if((rr&te)===te){ee=ee.next,te===ei&&(oe=!0);continue}else ue={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(A=H=ue,w=p):H=H.next=ue,lt.lanes|=te,Yr|=te;ue=ee.action,Ea&&a(p,ue),p=ee.hasEagerState?ee.eagerState:a(p,ue)}else te={lane:ue,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(A=H=te,w=p):H=H.next=te,lt.lanes|=ue,Yr|=ue;ee=ee.next}while(ee!==null&&ee!==n);if(H===null?w=p:H.next=A,!Pn(p,t.memoizedState)&&(on=!0,oe&&(a=ti,a!==null)))throw a;t.memoizedState=p,t.baseState=w,t.baseQueue=H,o.lastRenderedState=p}return h===null&&(o.lanes=0),[t.memoizedState,o.dispatch]}function Iu(t){var n=rn(),a=n.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=t;var o=a.dispatch,h=a.pending,p=n.memoizedState;if(h!==null){a.pending=null;var w=h=h.next;do p=t(p,w.action),w=w.next;while(w!==h);Pn(p,n.memoizedState)||(on=!0),n.memoizedState=p,n.baseQueue===null&&(n.baseState=p),a.lastRenderedState=p}return[p,o]}function Fm(t,n,a){var o=lt,h=rn(),p=bt;if(p){if(a===void 0)throw Error(i(407));a=a()}else a=n();var w=!Pn((Mt||h).memoizedState,a);if(w&&(h.memoizedState=a,on=!0),h=h.queue,qu(Bm.bind(null,o,h,t),[t]),h.getSnapshot!==n||w||sn!==null&&sn.memoizedState.tag&1){if(o.flags|=2048,si(9,{destroy:void 0},Om.bind(null,o,h,a,n),null),Bt===null)throw Error(i(349));p||(rr&127)!==0||_m(o,n,a)}return a}function _m(t,n,a){t.flags|=16384,t={getSnapshot:n,value:a},n=lt.updateQueue,n===null?(n=Ao(),lt.updateQueue=n,n.stores=[t]):(a=n.stores,a===null?n.stores=[t]:a.push(t))}function Om(t,n,a,o){n.value=a,n.getSnapshot=o,$m(n)&&Lm(t)}function Bm(t,n,a){return a(function(){$m(n)&&Lm(t)})}function $m(t){var n=t.getSnapshot;t=t.value;try{var a=n();return!Pn(t,a)}catch{return!0}}function Lm(t){var n=ya(t,2);n!==null&&qn(n,t,2)}function Uu(t){var n=Fn();if(typeof t=="function"){var a=t;if(t=a(),Ea){At(!0);try{a()}finally{At(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ar,lastRenderedState:t},n}function Hm(t,n,a,o){return t.baseState=a,Hu(t,Mt,typeof o=="function"?o:ar)}function Tb(t,n,a,o,h){if(Ro(t))throw Error(i(485));if(t=n.action,t!==null){var p={payload:h,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){p.listeners.push(w)}};U.T!==null?a(!0):p.isTransition=!1,o(p),a=n.pending,a===null?(p.next=n.pending=p,Im(n,p)):(p.next=a.next,n.pending=a.next=p)}}function Im(t,n){var a=n.action,o=n.payload,h=t.state;if(n.isTransition){var p=U.T,w={};U.T=w;try{var A=a(h,o),H=U.S;H!==null&&H(w,A),Um(t,n,A)}catch(ee){Yu(t,n,ee)}finally{p!==null&&w.types!==null&&(p.types=w.types),U.T=p}}else try{p=a(h,o),Um(t,n,p)}catch(ee){Yu(t,n,ee)}}function Um(t,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){Ym(t,n,o)},function(o){return Yu(t,n,o)}):Ym(t,n,a)}function Ym(t,n,a){n.status="fulfilled",n.value=a,qm(n),t.state=a,n=t.pending,n!==null&&(a=n.next,a===n?t.pending=null:(a=a.next,n.next=a,Im(t,a)))}function Yu(t,n,a){var o=t.pending;if(t.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=a,qm(n),n=n.next;while(n!==o)}t.action=null}function qm(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function Xm(t,n){return n}function Vm(t,n){if(bt){var a=Bt.formState;if(a!==null){e:{var o=lt;if(bt){if(Yt){t:{for(var h=Yt,p=ml;h.nodeType!==8;){if(!p){h=null;break t}if(h=pl(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Yt=pl(h.nextSibling),o=h.data==="F!";break e}}Fr(o)}o=!1}o&&(n=a[0])}}return a=Fn(),a.memoizedState=a.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xm,lastRenderedState:n},a.queue=o,a=dx.bind(null,lt,o),o.dispatch=a,o=Uu(!1),p=Wu.bind(null,lt,!1,o.queue),o=Fn(),h={state:n,dispatch:null,action:t,pending:null},o.queue=h,a=Tb.bind(null,lt,h,p,a),h.dispatch=a,o.memoizedState=t,[n,a,!1]}function Gm(t){var n=rn();return Km(n,Mt,t)}function Km(t,n,a){if(n=Hu(t,n,Xm)[0],t=To(ar)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=is(n)}catch(w){throw w===ni?vo:w}else o=n;n=rn();var h=n.queue,p=h.dispatch;return a!==n.memoizedState&&(lt.flags|=2048,si(9,{destroy:void 0},zb.bind(null,h,a),null)),[o,p,t]}function zb(t,n){t.action=n}function Wm(t){var n=rn(),a=Mt;if(a!==null)return Km(n,a,t);rn(),n=n.memoizedState,a=rn();var o=a.queue.dispatch;return a.memoizedState=t,[n,o,!1]}function si(t,n,a,o){return t={tag:t,create:a,deps:o,inst:n,next:null},n=lt.updateQueue,n===null&&(n=Ao(),lt.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=t.next=t:(o=a.next,a.next=t,t.next=o,n.lastEffect=t),t}function Qm(){return rn().memoizedState}function zo(t,n,a,o){var h=Fn();lt.flags|=t,h.memoizedState=si(1|n,{destroy:void 0},a,o===void 0?null:o)}function Mo(t,n,a,o){var h=rn();o=o===void 0?null:o;var p=h.memoizedState.inst;Mt!==null&&o!==null&&Fu(o,Mt.memoizedState.deps)?h.memoizedState=si(n,p,a,o):(lt.flags|=t,h.memoizedState=si(1|n,p,a,o))}function Zm(t,n){zo(8390656,8,t,n)}function qu(t,n){Mo(2048,8,t,n)}function Mb(t){lt.flags|=4;var n=lt.updateQueue;if(n===null)n=Ao(),lt.updateQueue=n,n.events=[t];else{var a=n.events;a===null?n.events=[t]:a.push(t)}}function Jm(t){var n=rn().memoizedState;return Mb({ref:n,nextImpl:t}),function(){if((Et&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function Pm(t,n){return Mo(4,2,t,n)}function ex(t,n){return Mo(4,4,t,n)}function tx(t,n){if(typeof n=="function"){t=t();var a=n(t);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function nx(t,n,a){a=a!=null?a.concat([t]):null,Mo(4,4,tx.bind(null,n,t),a)}function Xu(){}function lx(t,n){var a=rn();n=n===void 0?null:n;var o=a.memoizedState;return n!==null&&Fu(n,o[1])?o[0]:(a.memoizedState=[t,n],t)}function rx(t,n){var a=rn();n=n===void 0?null:n;var o=a.memoizedState;if(n!==null&&Fu(n,o[1]))return o[0];if(o=t(),Ea){At(!0);try{t()}finally{At(!1)}}return a.memoizedState=[o,n],o}function Vu(t,n,a){return a===void 0||(rr&1073741824)!==0&&(xt&261930)===0?t.memoizedState=n:(t.memoizedState=a,t=ap(),lt.lanes|=t,Yr|=t,a)}function ax(t,n,a,o){return Pn(a,n)?a:ri.current!==null?(t=Vu(t,a,o),Pn(t,n)||(on=!0),t):(rr&42)===0||(rr&1073741824)!==0&&(xt&261930)===0?(on=!0,t.memoizedState=a):(t=ap(),lt.lanes|=t,Yr|=t,n)}function ix(t,n,a,o,h){var p=Z.p;Z.p=p!==0&&8>p?p:8;var w=U.T,A={};U.T=A,Wu(t,!1,n,a);try{var H=h(),ee=U.S;if(ee!==null&&ee(A,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var oe=Nb(H,o);ss(t,n,oe,al(t))}else ss(t,n,o,al(t))}catch(ue){ss(t,n,{then:function(){},status:"rejected",reason:ue},al())}finally{Z.p=p,w!==null&&A.types!==null&&(w.types=A.types),U.T=w}}function Rb(){}function Gu(t,n,a,o){if(t.tag!==5)throw Error(i(476));var h=sx(t).queue;ix(t,h,n,ie,a===null?Rb:function(){return ox(t),a(o)})}function sx(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ar,lastRenderedState:ie},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ar,lastRenderedState:a},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function ox(t){var n=sx(t);n.next===null&&(n=t.alternate.memoizedState),ss(t,n.next.queue,{},al())}function Ku(){return jn(Ss)}function cx(){return rn().memoizedState}function ux(){return rn().memoizedState}function Fb(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var a=al();t=Br(a);var o=$r(n,t,a);o!==null&&(qn(o,n,a),ns(o,n,a)),n={cache:ju()},t.payload=n;return}n=n.return}}function _b(t,n,a){var o=al();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Ro(t)?fx(n,a):(a=fu(t,n,a,o),a!==null&&(qn(a,t,o),hx(a,n,o)))}function dx(t,n,a){var o=al();ss(t,n,a,o)}function ss(t,n,a,o){var h={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Ro(t))fx(n,h);else{var p=t.alternate;if(t.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var w=n.lastRenderedState,A=p(w,a);if(h.hasEagerState=!0,h.eagerState=A,Pn(A,w))return ho(t,n,h,0),Bt===null&&fo(),!1}catch{}finally{}if(a=fu(t,n,h,o),a!==null)return qn(a,t,o),hx(a,n,o),!0}return!1}function Wu(t,n,a,o){if(o={lane:2,revertLane:Nd(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Ro(t)){if(n)throw Error(i(479))}else n=fu(t,a,o,2),n!==null&&qn(n,t,2)}function Ro(t){var n=t.alternate;return t===lt||n!==null&&n===lt}function fx(t,n){ai=Eo=!0;var a=t.pending;a===null?n.next=n:(n.next=a.next,a.next=n),t.pending=n}function hx(t,n,a){if((a&4194048)!==0){var o=n.lanes;o&=t.pendingLanes,a|=o,n.lanes=a,Ha(t,a)}}var os={readContext:jn,use:Do,useCallback:Jt,useContext:Jt,useEffect:Jt,useImperativeHandle:Jt,useLayoutEffect:Jt,useInsertionEffect:Jt,useMemo:Jt,useReducer:Jt,useRef:Jt,useState:Jt,useDebugValue:Jt,useDeferredValue:Jt,useTransition:Jt,useSyncExternalStore:Jt,useId:Jt,useHostTransitionStatus:Jt,useFormState:Jt,useActionState:Jt,useOptimistic:Jt,useMemoCache:Jt,useCacheRefresh:Jt};os.useEffectEvent=Jt;var mx={readContext:jn,use:Do,useCallback:function(t,n){return Fn().memoizedState=[t,n===void 0?null:n],t},useContext:jn,useEffect:Zm,useImperativeHandle:function(t,n,a){a=a!=null?a.concat([t]):null,zo(4194308,4,tx.bind(null,n,t),a)},useLayoutEffect:function(t,n){return zo(4194308,4,t,n)},useInsertionEffect:function(t,n){zo(4,2,t,n)},useMemo:function(t,n){var a=Fn();n=n===void 0?null:n;var o=t();if(Ea){At(!0);try{t()}finally{At(!1)}}return a.memoizedState=[o,n],o},useReducer:function(t,n,a){var o=Fn();if(a!==void 0){var h=a(n);if(Ea){At(!0);try{a(n)}finally{At(!1)}}}else h=n;return o.memoizedState=o.baseState=h,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:h},o.queue=t,t=t.dispatch=_b.bind(null,lt,t),[o.memoizedState,t]},useRef:function(t){var n=Fn();return t={current:t},n.memoizedState=t},useState:function(t){t=Uu(t);var n=t.queue,a=dx.bind(null,lt,n);return n.dispatch=a,[t.memoizedState,a]},useDebugValue:Xu,useDeferredValue:function(t,n){var a=Fn();return Vu(a,t,n)},useTransition:function(){var t=Uu(!1);return t=ix.bind(null,lt,t.queue,!0,!1),Fn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,a){var o=lt,h=Fn();if(bt){if(a===void 0)throw Error(i(407));a=a()}else{if(a=n(),Bt===null)throw Error(i(349));(xt&127)!==0||_m(o,n,a)}h.memoizedState=a;var p={value:a,getSnapshot:n};return h.queue=p,Zm(Bm.bind(null,o,p,t),[t]),o.flags|=2048,si(9,{destroy:void 0},Om.bind(null,o,p,a,n),null),a},useId:function(){var t=Fn(),n=Bt.identifierPrefix;if(bt){var a=Ll,o=$l;a=(o&~(1<<32-ut(o)-1)).toString(32)+a,n="_"+n+"R_"+a,a=No++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Ab++,n="_"+n+"r_"+a.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:Ku,useFormState:Vm,useActionState:Vm,useOptimistic:function(t){var n=Fn();n.memoizedState=n.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Wu.bind(null,lt,!0,a),a.dispatch=n,[t,n]},useMemoCache:Lu,useCacheRefresh:function(){return Fn().memoizedState=Fb.bind(null,lt)},useEffectEvent:function(t){var n=Fn(),a={impl:t};return n.memoizedState=a,function(){if((Et&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Qu={readContext:jn,use:Do,useCallback:lx,useContext:jn,useEffect:qu,useImperativeHandle:nx,useInsertionEffect:Pm,useLayoutEffect:ex,useMemo:rx,useReducer:To,useRef:Qm,useState:function(){return To(ar)},useDebugValue:Xu,useDeferredValue:function(t,n){var a=rn();return ax(a,Mt.memoizedState,t,n)},useTransition:function(){var t=To(ar)[0],n=rn().memoizedState;return[typeof t=="boolean"?t:is(t),n]},useSyncExternalStore:Fm,useId:cx,useHostTransitionStatus:Ku,useFormState:Gm,useActionState:Gm,useOptimistic:function(t,n){var a=rn();return Hm(a,Mt,t,n)},useMemoCache:Lu,useCacheRefresh:ux};Qu.useEffectEvent=Jm;var xx={readContext:jn,use:Do,useCallback:lx,useContext:jn,useEffect:qu,useImperativeHandle:nx,useInsertionEffect:Pm,useLayoutEffect:ex,useMemo:rx,useReducer:Iu,useRef:Qm,useState:function(){return Iu(ar)},useDebugValue:Xu,useDeferredValue:function(t,n){var a=rn();return Mt===null?Vu(a,t,n):ax(a,Mt.memoizedState,t,n)},useTransition:function(){var t=Iu(ar)[0],n=rn().memoizedState;return[typeof t=="boolean"?t:is(t),n]},useSyncExternalStore:Fm,useId:cx,useHostTransitionStatus:Ku,useFormState:Wm,useActionState:Wm,useOptimistic:function(t,n){var a=rn();return Mt!==null?Hm(a,Mt,t,n):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:Lu,useCacheRefresh:ux};xx.useEffectEvent=Jm;function Zu(t,n,a,o){n=t.memoizedState,a=a(o,n),a=a==null?n:y({},n,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var Ju={enqueueSetState:function(t,n,a){t=t._reactInternals;var o=al(),h=Br(o);h.payload=n,a!=null&&(h.callback=a),n=$r(t,h,o),n!==null&&(qn(n,t,o),ns(n,t,o))},enqueueReplaceState:function(t,n,a){t=t._reactInternals;var o=al(),h=Br(o);h.tag=1,h.payload=n,a!=null&&(h.callback=a),n=$r(t,h,o),n!==null&&(qn(n,t,o),ns(n,t,o))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var a=al(),o=Br(a);o.tag=2,n!=null&&(o.callback=n),n=$r(t,o,a),n!==null&&(qn(n,t,a),ns(n,t,a))}};function px(t,n,a,o,h,p,w){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(o,p,w):n.prototype&&n.prototype.isPureReactComponent?!Ki(a,o)||!Ki(h,p):!0}function yx(t,n,a,o){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,o),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,o),n.state!==t&&Ju.enqueueReplaceState(n,n.state,null)}function Na(t,n){var a=n;if("ref"in n){a={};for(var o in n)o!=="ref"&&(a[o]=n[o])}if(t=t.defaultProps){a===n&&(a=y({},a));for(var h in t)a[h]===void 0&&(a[h]=t[h])}return a}function gx(t){uo(t)}function bx(t){console.error(t)}function vx(t){uo(t)}function Fo(t,n){try{var a=t.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function wx(t,n,a){try{var o=t.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Pu(t,n,a){return a=Br(a),a.tag=3,a.payload={element:null},a.callback=function(){Fo(t,n)},a}function kx(t){return t=Br(t),t.tag=3,t}function jx(t,n,a,o){var h=a.type.getDerivedStateFromError;if(typeof h=="function"){var p=o.value;t.payload=function(){return h(p)},t.callback=function(){wx(n,a,o)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(t.callback=function(){wx(n,a,o),typeof h!="function"&&(qr===null?qr=new Set([this]):qr.add(this));var A=o.stack;this.componentDidCatch(o.value,{componentStack:A!==null?A:""})})}function Ob(t,n,a,o,h){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(n=a.alternate,n!==null&&Pa(n,a,h,!0),a=tl.current,a!==null){switch(a.tag){case 31:case 13:return xl===null?Vo():a.alternate===null&&Pt===0&&(Pt=3),a.flags&=-257,a.flags|=65536,a.lanes=h,o===wo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([o]):n.add(o),Sd(t,o,h)),!1;case 22:return a.flags|=65536,o===wo?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([o]):a.add(o)),Sd(t,o,h)),!1}throw Error(i(435,a.tag))}return Sd(t,o,h),Vo(),!1}if(bt)return n=tl.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=h,o!==gu&&(t=Error(i(422),{cause:o}),Zi(dl(t,a)))):(o!==gu&&(n=Error(i(423),{cause:o}),Zi(dl(n,a))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,o=dl(o,a),h=Pu(t.stateNode,o,h),Du(t,h),Pt!==4&&(Pt=2)),!1;var p=Error(i(520),{cause:o});if(p=dl(p,a),ps===null?ps=[p]:ps.push(p),Pt!==4&&(Pt=2),n===null)return!0;o=dl(o,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,t=h&-h,a.lanes|=t,t=Pu(a.stateNode,o,t),Du(a,t),!1;case 1:if(n=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(qr===null||!qr.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=kx(h),jx(h,t,a,o),Du(a,h),!1}a=a.return}while(a!==null);return!1}var ed=Error(i(461)),on=!1;function Sn(t,n,a,o){n.child=t===null?Nm(n,null,a,o):Ca(n,t.child,a,o)}function Sx(t,n,a,o,h){a=a.render;var p=n.ref;if("ref"in o){var w={};for(var A in o)A!=="ref"&&(w[A]=o[A])}else w=o;return wa(n),o=_u(t,n,a,w,p,h),A=Ou(),t!==null&&!on?(Bu(t,n,h),ir(t,n,h)):(bt&&A&&pu(n),n.flags|=1,Sn(t,n,o,h),n.child)}function Cx(t,n,a,o,h){if(t===null){var p=a.type;return typeof p=="function"&&!hu(p)&&p.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=p,Ex(t,n,p,o,h)):(t=xo(a.type,null,o,n,n.mode,h),t.ref=n.ref,t.return=n,n.child=t)}if(p=t.child,!od(t,h)){var w=p.memoizedProps;if(a=a.compare,a=a!==null?a:Ki,a(w,o)&&t.ref===n.ref)return ir(t,n,h)}return n.flags|=1,t=er(p,o),t.ref=n.ref,t.return=n,n.child=t}function Ex(t,n,a,o,h){if(t!==null){var p=t.memoizedProps;if(Ki(p,o)&&t.ref===n.ref)if(on=!1,n.pendingProps=o=p,od(t,h))(t.flags&131072)!==0&&(on=!0);else return n.lanes=t.lanes,ir(t,n,h)}return td(t,n,a,o,h)}function Nx(t,n,a,o){var h=o.children,p=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((n.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,t!==null){for(o=n.child=t.child,h=0;o!==null;)h=h|o.lanes|o.childLanes,o=o.sibling;o=h&~p}else o=0,n.child=null;return Ax(t,n,p,a,o)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&bo(n,p!==null?p.cachePool:null),p!==null?Tm(n,p):zu(),zm(n);else return o=n.lanes=536870912,Ax(t,n,p!==null?p.baseLanes|a:a,a,o)}else p!==null?(bo(n,p.cachePool),Tm(n,p),Hr(),n.memoizedState=null):(t!==null&&bo(n,null),zu(),Hr());return Sn(t,n,h,a),n.child}function cs(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Ax(t,n,a,o,h){var p=Cu();return p=p===null?null:{parent:an._currentValue,pool:p},n.memoizedState={baseLanes:a,cachePool:p},t!==null&&bo(n,null),zu(),zm(n),t!==null&&Pa(t,n,o,!0),n.childLanes=h,null}function _o(t,n){return n=Bo({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function Dx(t,n,a){return Ca(n,t.child,null,a),t=_o(n,n.pendingProps),t.flags|=2,nl(n),n.memoizedState=null,t}function Bb(t,n,a){var o=n.pendingProps,h=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(bt){if(o.mode==="hidden")return t=_o(n,o),n.lanes=536870912,cs(null,t);if(Ru(n),(t=Yt)?(t=Ip(t,ml),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Mr!==null?{id:$l,overflow:Ll}:null,retryLane:536870912,hydrationErrors:null},a=fm(t),a.return=n,n.child=a,kn=n,Yt=null)):t=null,t===null)throw Fr(n);return n.lanes=536870912,null}return _o(n,o)}var p=t.memoizedState;if(p!==null){var w=p.dehydrated;if(Ru(n),h)if(n.flags&256)n.flags&=-257,n=Dx(t,n,a);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(i(558));else if(on||Pa(t,n,a,!1),h=(a&t.childLanes)!==0,on||h){if(o=Bt,o!==null&&(w=Gn(o,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,ya(t,w),qn(o,t,w),ed;Vo(),n=Dx(t,n,a)}else t=p.treeContext,Yt=pl(w.nextSibling),kn=n,bt=!0,Rr=null,ml=!1,t!==null&&xm(n,t),n=_o(n,o),n.flags|=4096;return n}return t=er(t.child,{mode:o.mode,children:o.children}),t.ref=n.ref,n.child=t,t.return=n,t}function Oo(t,n){var a=n.ref;if(a===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(t===null||t.ref!==a)&&(n.flags|=4194816)}}function td(t,n,a,o,h){return wa(n),a=_u(t,n,a,o,void 0,h),o=Ou(),t!==null&&!on?(Bu(t,n,h),ir(t,n,h)):(bt&&o&&pu(n),n.flags|=1,Sn(t,n,a,h),n.child)}function Tx(t,n,a,o,h,p){return wa(n),n.updateQueue=null,a=Rm(n,o,a,h),Mm(t),o=Ou(),t!==null&&!on?(Bu(t,n,p),ir(t,n,p)):(bt&&o&&pu(n),n.flags|=1,Sn(t,n,a,p),n.child)}function zx(t,n,a,o,h){if(wa(n),n.stateNode===null){var p=Wa,w=a.contextType;typeof w=="object"&&w!==null&&(p=jn(w)),p=new a(o,p),n.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Ju,n.stateNode=p,p._reactInternals=n,p=n.stateNode,p.props=o,p.state=n.memoizedState,p.refs={},Nu(n),w=a.contextType,p.context=typeof w=="object"&&w!==null?jn(w):Wa,p.state=n.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(Zu(n,a,w,o),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&&Ju.enqueueReplaceState(p,p.state,null),rs(n,o,p,h),ls(),p.state=n.memoizedState),typeof p.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(t===null){p=n.stateNode;var A=n.memoizedProps,H=Na(a,A);p.props=H;var ee=p.context,oe=a.contextType;w=Wa,typeof oe=="object"&&oe!==null&&(w=jn(oe));var ue=a.getDerivedStateFromProps;oe=typeof ue=="function"||typeof p.getSnapshotBeforeUpdate=="function",A=n.pendingProps!==A,oe||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(A||ee!==w)&&yx(n,p,o,w),Or=!1;var te=n.memoizedState;p.state=te,rs(n,o,p,h),ls(),ee=n.memoizedState,A||te!==ee||Or?(typeof ue=="function"&&(Zu(n,a,ue,o),ee=n.memoizedState),(H=Or||px(n,a,H,o,te,ee,w))?(oe||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(n.flags|=4194308)):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=ee),p.props=o,p.state=ee,p.context=w,o=H):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{p=n.stateNode,Au(t,n),w=n.memoizedProps,oe=Na(a,w),p.props=oe,ue=n.pendingProps,te=p.context,ee=a.contextType,H=Wa,typeof ee=="object"&&ee!==null&&(H=jn(ee)),A=a.getDerivedStateFromProps,(ee=typeof A=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==ue||te!==H)&&yx(n,p,o,H),Or=!1,te=n.memoizedState,p.state=te,rs(n,o,p,h),ls();var re=n.memoizedState;w!==ue||te!==re||Or||t!==null&&t.dependencies!==null&&yo(t.dependencies)?(typeof A=="function"&&(Zu(n,a,A,o),re=n.memoizedState),(oe=Or||px(n,a,oe,o,te,re,H)||t!==null&&t.dependencies!==null&&yo(t.dependencies))?(ee||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,re,H),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,re,H)),typeof p.componentDidUpdate=="function"&&(n.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===t.memoizedProps&&te===t.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&te===t.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=re),p.props=o,p.state=re,p.context=H,o=oe):(typeof p.componentDidUpdate!="function"||w===t.memoizedProps&&te===t.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&te===t.memoizedState||(n.flags|=1024),o=!1)}return p=o,Oo(t,n),o=(n.flags&128)!==0,p||o?(p=n.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:p.render(),n.flags|=1,t!==null&&o?(n.child=Ca(n,t.child,null,h),n.child=Ca(n,null,a,h)):Sn(t,n,a,h),n.memoizedState=p.state,t=n.child):t=ir(t,n,h),t}function Mx(t,n,a,o){return ba(),n.flags|=256,Sn(t,n,a,o),n.child}var nd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ld(t){return{baseLanes:t,cachePool:wm()}}function rd(t,n,a){return t=t!==null?t.childLanes&~a:0,n&&(t|=rl),t}function Rx(t,n,a){var o=n.pendingProps,h=!1,p=(n.flags&128)!==0,w;if((w=p)||(w=t!==null&&t.memoizedState===null?!1:(ln.current&2)!==0),w&&(h=!0,n.flags&=-129),w=(n.flags&32)!==0,n.flags&=-33,t===null){if(bt){if(h?Lr(n):Hr(),(t=Yt)?(t=Ip(t,ml),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Mr!==null?{id:$l,overflow:Ll}:null,retryLane:536870912,hydrationErrors:null},a=fm(t),a.return=n,n.child=a,kn=n,Yt=null)):t=null,t===null)throw Fr(n);return Hd(t)?n.lanes=32:n.lanes=536870912,null}var A=o.children;return o=o.fallback,h?(Hr(),h=n.mode,A=Bo({mode:"hidden",children:A},h),o=ga(o,h,a,null),A.return=n,o.return=n,A.sibling=o,n.child=A,o=n.child,o.memoizedState=ld(a),o.childLanes=rd(t,w,a),n.memoizedState=nd,cs(null,o)):(Lr(n),ad(n,A))}var H=t.memoizedState;if(H!==null&&(A=H.dehydrated,A!==null)){if(p)n.flags&256?(Lr(n),n.flags&=-257,n=id(t,n,a)):n.memoizedState!==null?(Hr(),n.child=t.child,n.flags|=128,n=null):(Hr(),A=o.fallback,h=n.mode,o=Bo({mode:"visible",children:o.children},h),A=ga(A,h,a,null),A.flags|=2,o.return=n,A.return=n,o.sibling=A,n.child=o,Ca(n,t.child,null,a),o=n.child,o.memoizedState=ld(a),o.childLanes=rd(t,w,a),n.memoizedState=nd,n=cs(null,o));else if(Lr(n),Hd(A)){if(w=A.nextSibling&&A.nextSibling.dataset,w)var ee=w.dgst;w=ee,o=Error(i(419)),o.stack="",o.digest=w,Zi({value:o,source:null,stack:null}),n=id(t,n,a)}else if(on||Pa(t,n,a,!1),w=(a&t.childLanes)!==0,on||w){if(w=Bt,w!==null&&(o=Gn(w,a),o!==0&&o!==H.retryLane))throw H.retryLane=o,ya(t,o),qn(w,t,o),ed;Ld(A)||Vo(),n=id(t,n,a)}else Ld(A)?(n.flags|=192,n.child=t.child,n=null):(t=H.treeContext,Yt=pl(A.nextSibling),kn=n,bt=!0,Rr=null,ml=!1,t!==null&&xm(n,t),n=ad(n,o.children),n.flags|=4096);return n}return h?(Hr(),A=o.fallback,h=n.mode,H=t.child,ee=H.sibling,o=er(H,{mode:"hidden",children:o.children}),o.subtreeFlags=H.subtreeFlags&65011712,ee!==null?A=er(ee,A):(A=ga(A,h,a,null),A.flags|=2),A.return=n,o.return=n,o.sibling=A,n.child=o,cs(null,o),o=n.child,A=t.child.memoizedState,A===null?A=ld(a):(h=A.cachePool,h!==null?(H=an._currentValue,h=h.parent!==H?{parent:H,pool:H}:h):h=wm(),A={baseLanes:A.baseLanes|a,cachePool:h}),o.memoizedState=A,o.childLanes=rd(t,w,a),n.memoizedState=nd,cs(t.child,o)):(Lr(n),a=t.child,t=a.sibling,a=er(a,{mode:"visible",children:o.children}),a.return=n,a.sibling=null,t!==null&&(w=n.deletions,w===null?(n.deletions=[t],n.flags|=16):w.push(t)),n.child=a,n.memoizedState=null,a)}function ad(t,n){return n=Bo({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function Bo(t,n){return t=el(22,t,null,n),t.lanes=0,t}function id(t,n,a){return Ca(n,t.child,null,a),t=ad(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function Fx(t,n,a){t.lanes|=n;var o=t.alternate;o!==null&&(o.lanes|=n),wu(t.return,n,a)}function sd(t,n,a,o,h,p){var w=t.memoizedState;w===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:h,treeForkCount:p}:(w.isBackwards=n,w.rendering=null,w.renderingStartTime=0,w.last=o,w.tail=a,w.tailMode=h,w.treeForkCount=p)}function _x(t,n,a){var o=n.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var w=ln.current,A=(w&2)!==0;if(A?(w=w&1|2,n.flags|=128):w&=1,D(ln,w),Sn(t,n,o,a),o=bt?Qi:0,!A&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Fx(t,a,n);else if(t.tag===19)Fx(t,a,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(h){case"forwards":for(a=n.child,h=null;a!==null;)t=a.alternate,t!==null&&Co(t)===null&&(h=a),a=a.sibling;a=h,a===null?(h=n.child,n.child=null):(h=a.sibling,a.sibling=null),sd(n,!1,h,a,p,o);break;case"backwards":case"unstable_legacy-backwards":for(a=null,h=n.child,n.child=null;h!==null;){if(t=h.alternate,t!==null&&Co(t)===null){n.child=h;break}t=h.sibling,h.sibling=a,a=h,h=t}sd(n,!0,a,null,p,o);break;case"together":sd(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function ir(t,n,a){if(t!==null&&(n.dependencies=t.dependencies),Yr|=n.lanes,(a&n.childLanes)===0)if(t!==null){if(Pa(t,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(i(153));if(n.child!==null){for(t=n.child,a=er(t,t.pendingProps),n.child=a,a.return=n;t.sibling!==null;)t=t.sibling,a=a.sibling=er(t,t.pendingProps),a.return=n;a.sibling=null}return n.child}function od(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&yo(t)))}function $b(t,n,a){switch(n.tag){case 3:Me(n,n.stateNode.containerInfo),_r(n,an,t.memoizedState.cache),ba();break;case 27:case 5:fe(n);break;case 4:Me(n,n.stateNode.containerInfo);break;case 10:_r(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Ru(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(Lr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Rx(t,n,a):(Lr(n),t=ir(t,n,a),t!==null?t.sibling:null);Lr(n);break;case 19:var h=(t.flags&128)!==0;if(o=(a&n.childLanes)!==0,o||(Pa(t,n,a,!1),o=(a&n.childLanes)!==0),h){if(o)return _x(t,n,a);n.flags|=128}if(h=n.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),D(ln,ln.current),o)break;return null;case 22:return n.lanes=0,Nx(t,n,a,n.pendingProps);case 24:_r(n,an,t.memoizedState.cache)}return ir(t,n,a)}function Ox(t,n,a){if(t!==null)if(t.memoizedProps!==n.pendingProps)on=!0;else{if(!od(t,a)&&(n.flags&128)===0)return on=!1,$b(t,n,a);on=(t.flags&131072)!==0}else on=!1,bt&&(n.flags&1048576)!==0&&mm(n,Qi,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(t=ja(n.elementType),n.type=t,typeof t=="function")hu(t)?(o=Na(t,o),n.tag=1,n=zx(null,n,t,o,a)):(n.tag=0,n=td(null,n,t,o,a));else{if(t!=null){var h=t.$$typeof;if(h===O){n.tag=11,n=Sx(null,n,t,o,a);break e}else if(h===q){n.tag=14,n=Cx(null,n,t,o,a);break e}}throw n=ne(t)||t,Error(i(306,n,""))}}return n;case 0:return td(t,n,n.type,n.pendingProps,a);case 1:return o=n.type,h=Na(o,n.pendingProps),zx(t,n,o,h,a);case 3:e:{if(Me(n,n.stateNode.containerInfo),t===null)throw Error(i(387));o=n.pendingProps;var p=n.memoizedState;h=p.element,Au(t,n),rs(n,o,null,a);var w=n.memoizedState;if(o=w.cache,_r(n,an,o),o!==p.cache&&ku(n,[an],a,!0),ls(),o=w.element,p.isDehydrated)if(p={element:o,isDehydrated:!1,cache:w.cache},n.updateQueue.baseState=p,n.memoizedState=p,n.flags&256){n=Mx(t,n,o,a);break e}else if(o!==h){h=dl(Error(i(424)),n),Zi(h),n=Mx(t,n,o,a);break e}else{switch(t=n.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(Yt=pl(t.firstChild),kn=n,bt=!0,Rr=null,ml=!0,a=Nm(n,null,o,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ba(),o===h){n=ir(t,n,a);break e}Sn(t,n,o,a)}n=n.child}return n;case 26:return Oo(t,n),t===null?(a=Gp(n.type,null,n.pendingProps,null))?n.memoizedState=a:bt||(a=n.type,t=n.pendingProps,o=Po(ve.current).createElement(a),o[Vt]=n,o[vn]=t,Cn(o,a,t),Zt(o),n.stateNode=o):n.memoizedState=Gp(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return fe(n),t===null&&bt&&(o=n.stateNode=qp(n.type,n.pendingProps,ve.current),kn=n,ml=!0,h=Yt,Kr(n.type)?(Id=h,Yt=pl(o.firstChild)):Yt=h),Sn(t,n,n.pendingProps.children,a),Oo(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&bt&&((h=o=Yt)&&(o=m2(o,n.type,n.pendingProps,ml),o!==null?(n.stateNode=o,kn=n,Yt=pl(o.firstChild),ml=!1,h=!0):h=!1),h||Fr(n)),fe(n),h=n.type,p=n.pendingProps,w=t!==null?t.memoizedProps:null,o=p.children,Od(h,p)?o=null:w!==null&&Od(h,w)&&(n.flags|=32),n.memoizedState!==null&&(h=_u(t,n,Db,null,null,a),Ss._currentValue=h),Oo(t,n),Sn(t,n,o,a),n.child;case 6:return t===null&&bt&&((t=a=Yt)&&(a=x2(a,n.pendingProps,ml),a!==null?(n.stateNode=a,kn=n,Yt=null,t=!0):t=!1),t||Fr(n)),null;case 13:return Rx(t,n,a);case 4:return Me(n,n.stateNode.containerInfo),o=n.pendingProps,t===null?n.child=Ca(n,null,o,a):Sn(t,n,o,a),n.child;case 11:return Sx(t,n,n.type,n.pendingProps,a);case 7:return Sn(t,n,n.pendingProps,a),n.child;case 8:return Sn(t,n,n.pendingProps.children,a),n.child;case 12:return Sn(t,n,n.pendingProps.children,a),n.child;case 10:return o=n.pendingProps,_r(n,n.type,o.value),Sn(t,n,o.children,a),n.child;case 9:return h=n.type._context,o=n.pendingProps.children,wa(n),h=jn(h),o=o(h),n.flags|=1,Sn(t,n,o,a),n.child;case 14:return Cx(t,n,n.type,n.pendingProps,a);case 15:return Ex(t,n,n.type,n.pendingProps,a);case 19:return _x(t,n,a);case 31:return Bb(t,n,a);case 22:return Nx(t,n,a,n.pendingProps);case 24:return wa(n),o=jn(an),t===null?(h=Cu(),h===null&&(h=Bt,p=ju(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),n.memoizedState={parent:o,cache:h},Nu(n),_r(n,an,h)):((t.lanes&a)!==0&&(Au(t,n),rs(n,null,null,a),ls()),h=t.memoizedState,p=n.memoizedState,h.parent!==o?(h={parent:o,cache:o},n.memoizedState=h,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=h),_r(n,an,o)):(o=p.cache,_r(n,an,o),o!==h.cache&&ku(n,[an],a,!0))),Sn(t,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function sr(t){t.flags|=4}function cd(t,n,a,o,h){if((n=(t.mode&32)!==0)&&(n=!1),n){if(t.flags|=16777216,(h&335544128)===h)if(t.stateNode.complete)t.flags|=8192;else if(cp())t.flags|=8192;else throw Sa=wo,Eu}else t.flags&=-16777217}function Bx(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Jp(n))if(cp())t.flags|=8192;else throw Sa=wo,Eu}function $o(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?gt():536870912,t.lanes|=n,di|=n)}function us(t,n){if(!bt)switch(t.tailMode){case"hidden":n=t.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:o.sibling=null}}function qt(t){var n=t.alternate!==null&&t.alternate.child===t.child,a=0,o=0;if(n)for(var h=t.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags&65011712,o|=h.flags&65011712,h.return=t,h=h.sibling;else for(h=t.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags,o|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=o,t.childLanes=a,n}function Lb(t,n,a){var o=n.pendingProps;switch(yu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qt(n),null;case 1:return qt(n),null;case 3:return a=n.stateNode,o=null,t!==null&&(o=t.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),lr(an),$e(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(Ja(n)?sr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,bu())),qt(n),null;case 26:var h=n.type,p=n.memoizedState;return t===null?(sr(n),p!==null?(qt(n),Bx(n,p)):(qt(n),cd(n,h,null,o,a))):p?p!==t.memoizedState?(sr(n),qt(n),Bx(n,p)):(qt(n),n.flags&=-16777217):(t=t.memoizedProps,t!==o&&sr(n),qt(n),cd(n,h,t,o,a)),null;case 27:if(tt(n),a=ve.current,h=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==o&&sr(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return qt(n),null}t=de.current,Ja(n)?pm(n):(t=qp(h,o,a),n.stateNode=t,sr(n))}return qt(n),null;case 5:if(tt(n),h=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==o&&sr(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return qt(n),null}if(p=de.current,Ja(n))pm(n);else{var w=Po(ve.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 o.is=="string"?w.createElement("select",{is:o.is}):w.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?w.createElement(h,{is:o.is}):w.createElement(h)}}p[Vt]=n,p[vn]=o;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(Cn(p,h,o),h){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&sr(n)}}return qt(n),cd(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,a),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==o&&sr(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(i(166));if(t=ve.current,Ja(n)){if(t=n.stateNode,a=n.memoizedProps,o=null,h=kn,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}t[Vt]=n,t=!!(t.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||Rp(t.nodeValue,a)),t||Fr(n,!0)}else t=Po(t).createTextNode(o),t[Vt]=n,n.stateNode=t}return qt(n),null;case 31:if(a=n.memoizedState,t===null||t.memoizedState!==null){if(o=Ja(n),a!==null){if(t===null){if(!o)throw Error(i(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(557));t[Vt]=n}else ba(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;qt(n),t=!1}else a=bu(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return n.flags&256?(nl(n),n):(nl(n),null);if((n.flags&128)!==0)throw Error(i(558))}return qt(n),null;case 13:if(o=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=Ja(n),o!==null&&o.dehydrated!==null){if(t===null){if(!h)throw Error(i(318));if(h=n.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(317));h[Vt]=n}else ba(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;qt(n),h=!1}else h=bu(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return n.flags&256?(nl(n),n):(nl(n),null)}return nl(n),(n.flags&128)!==0?(n.lanes=a,n):(a=o!==null,t=t!==null&&t.memoizedState!==null,a&&(o=n.child,h=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(h=o.alternate.memoizedState.cachePool.pool),p=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),p!==h&&(o.flags|=2048)),a!==t&&a&&(n.child.flags|=8192),$o(n,n.updateQueue),qt(n),null);case 4:return $e(),t===null&&zd(n.stateNode.containerInfo),qt(n),null;case 10:return lr(n.type),qt(n),null;case 19:if(K(ln),o=n.memoizedState,o===null)return qt(n),null;if(h=(n.flags&128)!==0,p=o.rendering,p===null)if(h)us(o,!1);else{if(Pt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(p=Co(t),p!==null){for(n.flags|=128,us(o,!1),t=p.updateQueue,n.updateQueue=t,$o(n,t),n.subtreeFlags=0,t=a,a=n.child;a!==null;)dm(a,t),a=a.sibling;return D(ln,ln.current&1|2),bt&&tr(n,o.treeForkCount),n.child}t=t.sibling}o.tail!==null&&ct()>Yo&&(n.flags|=128,h=!0,us(o,!1),n.lanes=4194304)}else{if(!h)if(t=Co(p),t!==null){if(n.flags|=128,h=!0,t=t.updateQueue,n.updateQueue=t,$o(n,t),us(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!bt)return qt(n),null}else 2*ct()-o.renderingStartTime>Yo&&a!==536870912&&(n.flags|=128,h=!0,us(o,!1),n.lanes=4194304);o.isBackwards?(p.sibling=n.child,n.child=p):(t=o.last,t!==null?t.sibling=p:n.child=p,o.last=p)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=ct(),t.sibling=null,a=ln.current,D(ln,h?a&1|2:a&1),bt&&tr(n,o.treeForkCount),t):(qt(n),null);case 22:case 23:return nl(n),Mu(),o=n.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(a&536870912)!==0&&(n.flags&128)===0&&(qt(n),n.subtreeFlags&6&&(n.flags|=8192)):qt(n),a=n.updateQueue,a!==null&&$o(n,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==a&&(n.flags|=2048),t!==null&&K(ka),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),lr(an),qt(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function Hb(t,n){switch(yu(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return lr(an),$e(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return tt(n),null;case 31:if(n.memoizedState!==null){if(nl(n),n.alternate===null)throw Error(i(340));ba()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(nl(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(i(340));ba()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return K(ln),null;case 4:return $e(),null;case 10:return lr(n.type),null;case 22:case 23:return nl(n),Mu(),t!==null&&K(ka),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return lr(an),null;case 25:return null;default:return null}}function $x(t,n){switch(yu(n),n.tag){case 3:lr(an),$e();break;case 26:case 27:case 5:tt(n);break;case 4:$e();break;case 31:n.memoizedState!==null&&nl(n);break;case 13:nl(n);break;case 19:K(ln);break;case 10:lr(n.type);break;case 22:case 23:nl(n),Mu(),t!==null&&K(ka);break;case 24:lr(an)}}function ds(t,n){try{var a=n.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var h=o.next;a=h;do{if((a.tag&t)===t){o=void 0;var p=a.create,w=a.inst;o=p(),w.destroy=o}a=a.next}while(a!==h)}}catch(A){zt(n,n.return,A)}}function Ir(t,n,a){try{var o=n.updateQueue,h=o!==null?o.lastEffect:null;if(h!==null){var p=h.next;o=p;do{if((o.tag&t)===t){var w=o.inst,A=w.destroy;if(A!==void 0){w.destroy=void 0,h=n;var H=a,ee=A;try{ee()}catch(oe){zt(h,H,oe)}}}o=o.next}while(o!==p)}}catch(oe){zt(n,n.return,oe)}}function Lx(t){var n=t.updateQueue;if(n!==null){var a=t.stateNode;try{Dm(n,a)}catch(o){zt(t,t.return,o)}}}function Hx(t,n,a){a.props=Na(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(o){zt(t,n,o)}}function fs(t,n){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:o=t.stateNode;break;default:o=t.stateNode}typeof a=="function"?t.refCleanup=a(o):a.current=o}}catch(h){zt(t,n,h)}}function Hl(t,n){var a=t.ref,o=t.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(h){zt(t,n,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(h){zt(t,n,h)}else a.current=null}function Ix(t){var n=t.type,a=t.memoizedProps,o=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(h){zt(t,t.return,h)}}function ud(t,n,a){try{var o=t.stateNode;o2(o,t.type,a,n),o[vn]=n}catch(h){zt(t,t.return,h)}}function Ux(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Kr(t.type)||t.tag===4}function dd(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Ux(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Kr(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function fd(t,n,a){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(t),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=Jn));else if(o!==4&&(o===27&&Kr(t.type)&&(a=t.stateNode,n=null),t=t.child,t!==null))for(fd(t,n,a),t=t.sibling;t!==null;)fd(t,n,a),t=t.sibling}function Lo(t,n,a){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?a.insertBefore(t,n):a.appendChild(t);else if(o!==4&&(o===27&&Kr(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Lo(t,n,a),t=t.sibling;t!==null;)Lo(t,n,a),t=t.sibling}function Yx(t){var n=t.stateNode,a=t.memoizedProps;try{for(var o=t.type,h=n.attributes;h.length;)n.removeAttributeNode(h[0]);Cn(n,o,a),n[Vt]=t,n[vn]=a}catch(p){zt(t,t.return,p)}}var or=!1,cn=!1,hd=!1,qx=typeof WeakSet=="function"?WeakSet:Set,bn=null;function Ib(t,n){if(t=t.containerInfo,Fd=ic,t=nm(t),iu(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var o=a.getSelection&&a.getSelection();if(o&&o.rangeCount!==0){a=o.anchorNode;var h=o.anchorOffset,p=o.focusNode;o=o.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var w=0,A=-1,H=-1,ee=0,oe=0,ue=t,te=null;t:for(;;){for(var re;ue!==a||h!==0&&ue.nodeType!==3||(A=w+h),ue!==p||o!==0&&ue.nodeType!==3||(H=w+o),ue.nodeType===3&&(w+=ue.nodeValue.length),(re=ue.firstChild)!==null;)te=ue,ue=re;for(;;){if(ue===t)break t;if(te===a&&++ee===h&&(A=w),te===p&&++oe===o&&(H=w),(re=ue.nextSibling)!==null)break;ue=te,te=ue.parentNode}ue=re}a=A===-1||H===-1?null:{start:A,end:H}}else a=null}a=a||{start:0,end:0}}else a=null;for(_d={focusedElem:t,selectionRange:a},ic=!1,bn=n;bn!==null;)if(n=bn,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,bn=t;else for(;bn!==null;){switch(n=bn,p=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a<t.length;a++)h=t[a],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&p!==null){t=void 0,a=n,h=p.memoizedProps,p=p.memoizedState,o=a.stateNode;try{var Be=Na(a.type,h);t=o.getSnapshotBeforeUpdate(Be,p),o.__reactInternalSnapshotBeforeUpdate=t}catch(Qe){zt(a,a.return,Qe)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,a=t.nodeType,a===9)$d(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":$d(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(i(163))}if(t=n.sibling,t!==null){t.return=n.return,bn=t;break}bn=n.return}}function Xx(t,n,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:ur(t,a),o&4&&ds(5,a);break;case 1:if(ur(t,a),o&4)if(t=a.stateNode,n===null)try{t.componentDidMount()}catch(w){zt(a,a.return,w)}else{var h=Na(a.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(h,n,t.__reactInternalSnapshotBeforeUpdate)}catch(w){zt(a,a.return,w)}}o&64&&Lx(a),o&512&&fs(a,a.return);break;case 3:if(ur(t,a),o&64&&(t=a.updateQueue,t!==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{Dm(t,n)}catch(w){zt(a,a.return,w)}}break;case 27:n===null&&o&4&&Yx(a);case 26:case 5:ur(t,a),n===null&&o&4&&Ix(a),o&512&&fs(a,a.return);break;case 12:ur(t,a);break;case 31:ur(t,a),o&4&&Kx(t,a);break;case 13:ur(t,a),o&4&&Wx(t,a),o&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=Qb.bind(null,a),p2(t,a))));break;case 22:if(o=a.memoizedState!==null||or,!o){n=n!==null&&n.memoizedState!==null||cn,h=or;var p=cn;or=o,(cn=n)&&!p?dr(t,a,(a.subtreeFlags&8772)!==0):ur(t,a),or=h,cn=p}break;case 30:break;default:ur(t,a)}}function Vx(t){var n=t.alternate;n!==null&&(t.alternate=null,Vx(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&vl(n)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Kt=null,Hn=!1;function cr(t,n,a){for(a=a.child;a!==null;)Gx(t,n,a),a=a.sibling}function Gx(t,n,a){if(nt&&typeof nt.onCommitFiberUnmount=="function")try{nt.onCommitFiberUnmount(Pe,a)}catch{}switch(a.tag){case 26:cn||Hl(a,n),cr(t,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:cn||Hl(a,n);var o=Kt,h=Hn;Kr(a.type)&&(Kt=a.stateNode,Hn=!1),cr(t,n,a),ws(a.stateNode),Kt=o,Hn=h;break;case 5:cn||Hl(a,n);case 6:if(o=Kt,h=Hn,Kt=null,cr(t,n,a),Kt=o,Hn=h,Kt!==null)if(Hn)try{(Kt.nodeType===9?Kt.body:Kt.nodeName==="HTML"?Kt.ownerDocument.body:Kt).removeChild(a.stateNode)}catch(p){zt(a,n,p)}else try{Kt.removeChild(a.stateNode)}catch(p){zt(a,n,p)}break;case 18:Kt!==null&&(Hn?(t=Kt,Lp(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),bi(t)):Lp(Kt,a.stateNode));break;case 4:o=Kt,h=Hn,Kt=a.stateNode.containerInfo,Hn=!0,cr(t,n,a),Kt=o,Hn=h;break;case 0:case 11:case 14:case 15:Ir(2,a,n),cn||Ir(4,a,n),cr(t,n,a);break;case 1:cn||(Hl(a,n),o=a.stateNode,typeof o.componentWillUnmount=="function"&&Hx(a,n,o)),cr(t,n,a);break;case 21:cr(t,n,a);break;case 22:cn=(o=cn)||a.memoizedState!==null,cr(t,n,a),cn=o;break;default:cr(t,n,a)}}function Kx(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{bi(t)}catch(a){zt(n,n.return,a)}}}function Wx(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{bi(t)}catch(a){zt(n,n.return,a)}}function Ub(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new qx),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new qx),n;default:throw Error(i(435,t.tag))}}function Ho(t,n){var a=Ub(t);n.forEach(function(o){if(!a.has(o)){a.add(o);var h=Zb.bind(null,t,o);o.then(h,h)}})}function In(t,n){var a=n.deletions;if(a!==null)for(var o=0;o<a.length;o++){var h=a[o],p=t,w=n,A=w;e:for(;A!==null;){switch(A.tag){case 27:if(Kr(A.type)){Kt=A.stateNode,Hn=!1;break e}break;case 5:Kt=A.stateNode,Hn=!1;break e;case 3:case 4:Kt=A.stateNode.containerInfo,Hn=!0;break e}A=A.return}if(Kt===null)throw Error(i(160));Gx(p,w,h),Kt=null,Hn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Qx(n,t),n=n.sibling}var Nl=null;function Qx(t,n){var a=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:In(n,t),Un(t),o&4&&(Ir(3,t,t.return),ds(3,t),Ir(5,t,t.return));break;case 1:In(n,t),Un(t),o&512&&(cn||a===null||Hl(a,a.return)),o&64&&or&&(t=t.updateQueue,t!==null&&(o=t.callbacks,o!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?o:a.concat(o))));break;case 26:var h=Nl;if(In(n,t),Un(t),o&512&&(cn||a===null||Hl(a,a.return)),o&4){var p=a!==null?a.memoizedState:null;if(o=t.memoizedState,a===null)if(o===null)if(t.stateNode===null){e:{o=t.type,a=t.memoizedProps,h=h.ownerDocument||h;t:switch(o){case"title":p=h.getElementsByTagName("title")[0],(!p||p[vr]||p[Vt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),Cn(p,o,a),p[Vt]=t,Zt(p),o=p;break e;case"link":var w=Qp("link","href",h).get(o+(a.href||""));if(w){for(var A=0;A<w.length;A++)if(p=w[A],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(A,1);break t}}p=h.createElement(o),Cn(p,o,a),h.head.appendChild(p);break;case"meta":if(w=Qp("meta","content",h).get(o+(a.content||""))){for(A=0;A<w.length;A++)if(p=w[A],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(A,1);break t}}p=h.createElement(o),Cn(p,o,a),h.head.appendChild(p);break;default:throw Error(i(468,o))}p[Vt]=t,Zt(p),o=p}t.stateNode=o}else Zp(h,t.type,t.stateNode);else t.stateNode=Wp(h,o,t.memoizedProps);else p!==o?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,o===null?Zp(h,t.type,t.stateNode):Wp(h,o,t.memoizedProps)):o===null&&t.stateNode!==null&&ud(t,t.memoizedProps,a.memoizedProps)}break;case 27:In(n,t),Un(t),o&512&&(cn||a===null||Hl(a,a.return)),a!==null&&o&4&&ud(t,t.memoizedProps,a.memoizedProps);break;case 5:if(In(n,t),Un(t),o&512&&(cn||a===null||Hl(a,a.return)),t.flags&32){h=t.stateNode;try{Ar(h,"")}catch(Be){zt(t,t.return,Be)}}o&4&&t.stateNode!=null&&(h=t.memoizedProps,ud(t,h,a!==null?a.memoizedProps:h)),o&1024&&(hd=!0);break;case 6:if(In(n,t),Un(t),o&4){if(t.stateNode===null)throw Error(i(162));o=t.memoizedProps,a=t.stateNode;try{a.nodeValue=o}catch(Be){zt(t,t.return,Be)}}break;case 3:if(nc=null,h=Nl,Nl=ec(n.containerInfo),In(n,t),Nl=h,Un(t),o&4&&a!==null&&a.memoizedState.isDehydrated)try{bi(n.containerInfo)}catch(Be){zt(t,t.return,Be)}hd&&(hd=!1,Zx(t));break;case 4:o=Nl,Nl=ec(t.stateNode.containerInfo),In(n,t),Un(t),Nl=o;break;case 12:In(n,t),Un(t);break;case 31:In(n,t),Un(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Ho(t,o)));break;case 13:In(n,t),Un(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Uo=ct()),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Ho(t,o)));break;case 22:h=t.memoizedState!==null;var H=a!==null&&a.memoizedState!==null,ee=or,oe=cn;if(or=ee||h,cn=oe||H,In(n,t),cn=oe,or=ee,Un(t),o&8192)e:for(n=t.stateNode,n._visibility=h?n._visibility&-2:n._visibility|1,h&&(a===null||H||or||cn||Aa(t)),a=null,n=t;;){if(n.tag===5||n.tag===26){if(a===null){H=a=n;try{if(p=H.stateNode,h)w=p.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{A=H.stateNode;var ue=H.memoizedProps.style,te=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;A.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(Be){zt(H,H.return,Be)}}}else if(n.tag===6){if(a===null){H=n;try{H.stateNode.nodeValue=h?"":H.memoizedProps}catch(Be){zt(H,H.return,Be)}}}else if(n.tag===18){if(a===null){H=n;try{var re=H.stateNode;h?Hp(re,!0):Hp(H.stateNode,!1)}catch(Be){zt(H,H.return,Be)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===t)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break e;for(;n.sibling===null;){if(n.return===null||n.return===t)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}o&4&&(o=t.updateQueue,o!==null&&(a=o.retryQueue,a!==null&&(o.retryQueue=null,Ho(t,a))));break;case 19:In(n,t),Un(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Ho(t,o)));break;case 30:break;case 21:break;default:In(n,t),Un(t)}}function Un(t){var n=t.flags;if(n&2){try{for(var a,o=t.return;o!==null;){if(Ux(o)){a=o;break}o=o.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var h=a.stateNode,p=dd(t);Lo(t,p,h);break;case 5:var w=a.stateNode;a.flags&32&&(Ar(w,""),a.flags&=-33);var A=dd(t);Lo(t,A,w);break;case 3:case 4:var H=a.stateNode.containerInfo,ee=dd(t);fd(t,ee,H);break;default:throw Error(i(161))}}catch(oe){zt(t,t.return,oe)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function Zx(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;Zx(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function ur(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Xx(t,n.alternate,n),n=n.sibling}function Aa(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Ir(4,n,n.return),Aa(n);break;case 1:Hl(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Hx(n,n.return,a),Aa(n);break;case 27:ws(n.stateNode);case 26:case 5:Hl(n,n.return),Aa(n);break;case 22:n.memoizedState===null&&Aa(n);break;case 30:Aa(n);break;default:Aa(n)}t=t.sibling}}function dr(t,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var o=n.alternate,h=t,p=n,w=p.flags;switch(p.tag){case 0:case 11:case 15:dr(h,p,a),ds(4,p);break;case 1:if(dr(h,p,a),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(ee){zt(o,o.return,ee)}if(o=p,h=o.updateQueue,h!==null){var A=o.stateNode;try{var H=h.shared.hiddenCallbacks;if(H!==null)for(h.shared.hiddenCallbacks=null,h=0;h<H.length;h++)Am(H[h],A)}catch(ee){zt(o,o.return,ee)}}a&&w&64&&Lx(p),fs(p,p.return);break;case 27:Yx(p);case 26:case 5:dr(h,p,a),a&&o===null&&w&4&&Ix(p),fs(p,p.return);break;case 12:dr(h,p,a);break;case 31:dr(h,p,a),a&&w&4&&Kx(h,p);break;case 13:dr(h,p,a),a&&w&4&&Wx(h,p);break;case 22:p.memoizedState===null&&dr(h,p,a),fs(p,p.return);break;case 30:break;default:dr(h,p,a)}n=n.sibling}}function md(t,n){var a=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),t=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),t!==a&&(t!=null&&t.refCount++,a!=null&&Ji(a))}function xd(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Ji(t))}function Al(t,n,a,o){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Jx(t,n,a,o),n=n.sibling}function Jx(t,n,a,o){var h=n.flags;switch(n.tag){case 0:case 11:case 15:Al(t,n,a,o),h&2048&&ds(9,n);break;case 1:Al(t,n,a,o);break;case 3:Al(t,n,a,o),h&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Ji(t)));break;case 12:if(h&2048){Al(t,n,a,o),t=n.stateNode;try{var p=n.memoizedProps,w=p.id,A=p.onPostCommit;typeof A=="function"&&A(w,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(H){zt(n,n.return,H)}}else Al(t,n,a,o);break;case 31:Al(t,n,a,o);break;case 13:Al(t,n,a,o);break;case 23:break;case 22:p=n.stateNode,w=n.alternate,n.memoizedState!==null?p._visibility&2?Al(t,n,a,o):hs(t,n):p._visibility&2?Al(t,n,a,o):(p._visibility|=2,oi(t,n,a,o,(n.subtreeFlags&10256)!==0||!1)),h&2048&&md(w,n);break;case 24:Al(t,n,a,o),h&2048&&xd(n.alternate,n);break;default:Al(t,n,a,o)}}function oi(t,n,a,o,h){for(h=h&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var p=t,w=n,A=a,H=o,ee=w.flags;switch(w.tag){case 0:case 11:case 15:oi(p,w,A,H,h),ds(8,w);break;case 23:break;case 22:var oe=w.stateNode;w.memoizedState!==null?oe._visibility&2?oi(p,w,A,H,h):hs(p,w):(oe._visibility|=2,oi(p,w,A,H,h)),h&&ee&2048&&md(w.alternate,w);break;case 24:oi(p,w,A,H,h),h&&ee&2048&&xd(w.alternate,w);break;default:oi(p,w,A,H,h)}n=n.sibling}}function hs(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=t,o=n,h=o.flags;switch(o.tag){case 22:hs(a,o),h&2048&&md(o.alternate,o);break;case 24:hs(a,o),h&2048&&xd(o.alternate,o);break;default:hs(a,o)}n=n.sibling}}var ms=8192;function ci(t,n,a){if(t.subtreeFlags&ms)for(t=t.child;t!==null;)Px(t,n,a),t=t.sibling}function Px(t,n,a){switch(t.tag){case 26:ci(t,n,a),t.flags&ms&&t.memoizedState!==null&&A2(a,Nl,t.memoizedState,t.memoizedProps);break;case 5:ci(t,n,a);break;case 3:case 4:var o=Nl;Nl=ec(t.stateNode.containerInfo),ci(t,n,a),Nl=o;break;case 22:t.memoizedState===null&&(o=t.alternate,o!==null&&o.memoizedState!==null?(o=ms,ms=16777216,ci(t,n,a),ms=o):ci(t,n,a));break;default:ci(t,n,a)}}function ep(t){var n=t.alternate;if(n!==null&&(t=n.child,t!==null)){n.child=null;do n=t.sibling,t.sibling=null,t=n;while(t!==null)}}function xs(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];bn=o,np(o,t)}ep(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)tp(t),t=t.sibling}function tp(t){switch(t.tag){case 0:case 11:case 15:xs(t),t.flags&2048&&Ir(9,t,t.return);break;case 3:xs(t);break;case 12:xs(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,Io(t)):xs(t);break;default:xs(t)}}function Io(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];bn=o,np(o,t)}ep(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Ir(8,n,n.return),Io(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Io(n));break;default:Io(n)}t=t.sibling}}function np(t,n){for(;bn!==null;){var a=bn;switch(a.tag){case 0:case 11:case 15:Ir(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var o=a.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:Ji(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,bn=o;else e:for(a=t;bn!==null;){o=bn;var h=o.sibling,p=o.return;if(Vx(o),o===a){bn=null;break e}if(h!==null){h.return=p,bn=h;break e}bn=p}}}var Yb={getCacheForType:function(t){var n=jn(an),a=n.data.get(t);return a===void 0&&(a=t(),n.data.set(t,a)),a},cacheSignal:function(){return jn(an).controller.signal}},qb=typeof WeakMap=="function"?WeakMap:Map,Et=0,Bt=null,dt=null,xt=0,Tt=0,ll=null,Ur=!1,ui=!1,pd=!1,fr=0,Pt=0,Yr=0,Da=0,yd=0,rl=0,di=0,ps=null,Yn=null,gd=!1,Uo=0,lp=0,Yo=1/0,qo=null,qr=null,hn=0,Xr=null,fi=null,hr=0,bd=0,vd=null,rp=null,ys=0,wd=null;function al(){return(Et&2)!==0&&xt!==0?xt&-xt:U.T!==null?Nd():Ia()}function ap(){if(rl===0)if((xt&536870912)===0||bt){var t=Rl;Rl<<=1,(Rl&3932160)===0&&(Rl=262144),rl=t}else rl=536870912;return t=tl.current,t!==null&&(t.flags|=32),rl}function qn(t,n,a){(t===Bt&&(Tt===2||Tt===9)||t.cancelPendingCommit!==null)&&(hi(t,0),Vr(t,xt,rl,!1)),nn(t,a),((Et&2)===0||t!==Bt)&&(t===Bt&&((Et&2)===0&&(Da|=a),Pt===4&&Vr(t,xt,rl,!1)),Il(t))}function ip(t,n,a){if((Et&6)!==0)throw Error(i(327));var o=!a&&(n&127)===0&&(n&t.expiredLanes)===0||rt(t,n),h=o?Gb(t,n):jd(t,n,!0),p=o;do{if(h===0){ui&&!o&&Vr(t,n,0,!1);break}else{if(a=t.current.alternate,p&&!Xb(a)){h=jd(t,n,!1),p=!1;continue}if(h===2){if(p=n,t.errorRecoveryDisabledLanes&p)var w=0;else w=t.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){n=w;e:{var A=t;h=ps;var H=A.current.memoizedState.isDehydrated;if(H&&(hi(A,w).flags|=256),w=jd(A,w,!1),w!==2){if(pd&&!H){A.errorRecoveryDisabledLanes|=p,Da|=p,h=4;break e}p=Yn,Yn=h,p!==null&&(Yn===null?Yn=p:Yn.push.apply(Yn,p))}h=w}if(p=!1,h!==2)continue}}if(h===1){hi(t,0),Vr(t,n,0,!0);break}e:{switch(o=t,p=h,p){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:Vr(o,n,rl,!Ur);break e;case 2:Yn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(h=Uo+300-ct(),10<h)){if(Vr(o,n,rl,!Ur),Oe(o,0,!0)!==0)break e;hr=n,o.timeoutHandle=Bp(sp.bind(null,o,a,Yn,qo,gd,n,rl,Da,di,Ur,p,"Throttled",-0,0),h);break e}sp(o,a,Yn,qo,gd,n,rl,Da,di,Ur,p,null,-0,0)}}break}while(!0);Il(t)}function sp(t,n,a,o,h,p,w,A,H,ee,oe,ue,te,re){if(t.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:Jn},Px(n,p,ue);var Be=(p&62914560)===p?Uo-ct():(p&4194048)===p?lp-ct():0;if(Be=D2(ue,Be),Be!==null){hr=p,t.cancelPendingCommit=Be(xp.bind(null,t,n,p,a,o,h,w,A,H,oe,ue,null,te,re)),Vr(t,p,w,!ee);return}}xp(t,n,p,a,o,h,w,A,H)}function Xb(t){for(var n=t;;){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 o=0;o<a.length;o++){var h=a[o],p=h.getSnapshot;h=h.value;try{if(!Pn(p(),h))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Vr(t,n,a,o){n&=~yd,n&=~Da,t.suspendedLanes|=n,t.pingedLanes&=~n,o&&(t.warmLanes|=n),o=t.expirationTimes;for(var h=n;0<h;){var p=31-ut(h),w=1<<p;o[p]=-1,h&=~w}a!==0&&Ri(t,a,n)}function Xo(){return(Et&6)===0?(gs(0),!1):!0}function kd(){if(dt!==null){if(Tt===0)var t=dt.return;else t=dt,nr=va=null,$u(t),li=null,es=0,t=dt;for(;t!==null;)$x(t.alternate,t),t=t.return;dt=null}}function hi(t,n){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,d2(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),hr=0,kd(),Bt=t,dt=a=er(t.current,null),xt=n,Tt=0,ll=null,Ur=!1,ui=rt(t,n),pd=!1,di=rl=yd=Da=Yr=Pt=0,Yn=ps=null,gd=!1,(n&8)!==0&&(n|=n&32);var o=t.entangledLanes;if(o!==0)for(t=t.entanglements,o&=n;0<o;){var h=31-ut(o),p=1<<h;n|=t[h],o&=~p}return fr=n,fo(),a}function op(t,n){lt=null,U.H=os,n===ni||n===vo?(n=Sm(),Tt=3):n===Eu?(n=Sm(),Tt=4):Tt=n===ed?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,ll=n,dt===null&&(Pt=1,Fo(t,dl(n,t.current)))}function cp(){var t=tl.current;return t===null?!0:(xt&4194048)===xt?xl===null:(xt&62914560)===xt||(xt&536870912)!==0?t===xl:!1}function up(){var t=U.H;return U.H=os,t===null?os:t}function dp(){var t=U.A;return U.A=Yb,t}function Vo(){Pt=4,Ur||(xt&4194048)!==xt&&tl.current!==null||(ui=!0),(Yr&134217727)===0&&(Da&134217727)===0||Bt===null||Vr(Bt,xt,rl,!1)}function jd(t,n,a){var o=Et;Et|=2;var h=up(),p=dp();(Bt!==t||xt!==n)&&(qo=null,hi(t,n)),n=!1;var w=Pt;e:do try{if(Tt!==0&&dt!==null){var A=dt,H=ll;switch(Tt){case 8:kd(),w=6;break e;case 3:case 2:case 9:case 6:tl.current===null&&(n=!0);var ee=Tt;if(Tt=0,ll=null,mi(t,A,H,ee),a&&ui){w=0;break e}break;default:ee=Tt,Tt=0,ll=null,mi(t,A,H,ee)}}Vb(),w=Pt;break}catch(oe){op(t,oe)}while(!0);return n&&t.shellSuspendCounter++,nr=va=null,Et=o,U.H=h,U.A=p,dt===null&&(Bt=null,xt=0,fo()),w}function Vb(){for(;dt!==null;)fp(dt)}function Gb(t,n){var a=Et;Et|=2;var o=up(),h=dp();Bt!==t||xt!==n?(qo=null,Yo=ct()+500,hi(t,n)):ui=rt(t,n);e:do try{if(Tt!==0&&dt!==null){n=dt;var p=ll;t:switch(Tt){case 1:Tt=0,ll=null,mi(t,n,p,1);break;case 2:case 9:if(km(p)){Tt=0,ll=null,hp(n);break}n=function(){Tt!==2&&Tt!==9||Bt!==t||(Tt=7),Il(t)},p.then(n,n);break e;case 3:Tt=7;break e;case 4:Tt=5;break e;case 7:km(p)?(Tt=0,ll=null,hp(n)):(Tt=0,ll=null,mi(t,n,p,7));break;case 5:var w=null;switch(dt.tag){case 26:w=dt.memoizedState;case 5:case 27:var A=dt;if(w?Jp(w):A.stateNode.complete){Tt=0,ll=null;var H=A.sibling;if(H!==null)dt=H;else{var ee=A.return;ee!==null?(dt=ee,Go(ee)):dt=null}break t}}Tt=0,ll=null,mi(t,n,p,5);break;case 6:Tt=0,ll=null,mi(t,n,p,6);break;case 8:kd(),Pt=6;break e;default:throw Error(i(462))}}Kb();break}catch(oe){op(t,oe)}while(!0);return nr=va=null,U.H=o,U.A=h,Et=a,dt!==null?0:(Bt=null,xt=0,fo(),Pt)}function Kb(){for(;dt!==null&&!Ge();)fp(dt)}function fp(t){var n=Ox(t.alternate,t,fr);t.memoizedProps=t.pendingProps,n===null?Go(t):dt=n}function hp(t){var n=t,a=n.alternate;switch(n.tag){case 15:case 0:n=Tx(a,n,n.pendingProps,n.type,void 0,xt);break;case 11:n=Tx(a,n,n.pendingProps,n.type.render,n.ref,xt);break;case 5:$u(n);default:$x(a,n),n=dt=dm(n,fr),n=Ox(a,n,fr)}t.memoizedProps=t.pendingProps,n===null?Go(t):dt=n}function mi(t,n,a,o){nr=va=null,$u(n),li=null,es=0;var h=n.return;try{if(Ob(t,h,n,a,xt)){Pt=1,Fo(t,dl(a,t.current)),dt=null;return}}catch(p){if(h!==null)throw dt=h,p;Pt=1,Fo(t,dl(a,t.current)),dt=null;return}n.flags&32768?(bt||o===1?t=!0:ui||(xt&536870912)!==0?t=!1:(Ur=t=!0,(o===2||o===9||o===3||o===6)&&(o=tl.current,o!==null&&o.tag===13&&(o.flags|=16384))),mp(n,t)):Go(n)}function Go(t){var n=t;do{if((n.flags&32768)!==0){mp(n,Ur);return}t=n.return;var a=Lb(n.alternate,n,fr);if(a!==null){dt=a;return}if(n=n.sibling,n!==null){dt=n;return}dt=n=t}while(n!==null);Pt===0&&(Pt=5)}function mp(t,n){do{var a=Hb(t.alternate,t);if(a!==null){a.flags&=32767,dt=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(t=t.sibling,t!==null)){dt=t;return}dt=t=a}while(t!==null);Pt=6,dt=null}function xp(t,n,a,o,h,p,w,A,H){t.cancelPendingCommit=null;do Ko();while(hn!==0);if((Et&6)!==0)throw Error(i(327));if(n!==null){if(n===t.current)throw Error(i(177));if(p=n.lanes|n.childLanes,p|=du,br(t,a,p,w,A,H),t===Bt&&(dt=Bt=null,xt=0),fi=n,Xr=t,hr=a,bd=p,vd=h,rp=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,Jb(Re,function(){return vp(),null})):(t.callbackNode=null,t.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=U.T,U.T=null,h=Z.p,Z.p=2,w=Et,Et|=4;try{Ib(t,n,a)}finally{Et=w,Z.p=h,U.T=o}}hn=1,pp(),yp(),gp()}}function pp(){if(hn===1){hn=0;var t=Xr,n=fi,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=U.T,U.T=null;var o=Z.p;Z.p=2;var h=Et;Et|=4;try{Qx(n,t);var p=_d,w=nm(t.containerInfo),A=p.focusedElem,H=p.selectionRange;if(w!==A&&A&&A.ownerDocument&&tm(A.ownerDocument.documentElement,A)){if(H!==null&&iu(A)){var ee=H.start,oe=H.end;if(oe===void 0&&(oe=ee),"selectionStart"in A)A.selectionStart=ee,A.selectionEnd=Math.min(oe,A.value.length);else{var ue=A.ownerDocument||document,te=ue&&ue.defaultView||window;if(te.getSelection){var re=te.getSelection(),Be=A.textContent.length,Qe=Math.min(H.start,Be),Ft=H.end===void 0?Qe:Math.min(H.end,Be);!re.extend&&Qe>Ft&&(w=Ft,Ft=Qe,Qe=w);var Q=em(A,Qe),X=em(A,Ft);if(Q&&X&&(re.rangeCount!==1||re.anchorNode!==Q.node||re.anchorOffset!==Q.offset||re.focusNode!==X.node||re.focusOffset!==X.offset)){var P=ue.createRange();P.setStart(Q.node,Q.offset),re.removeAllRanges(),Qe>Ft?(re.addRange(P),re.extend(X.node,X.offset)):(P.setEnd(X.node,X.offset),re.addRange(P))}}}}for(ue=[],re=A;re=re.parentNode;)re.nodeType===1&&ue.push({element:re,left:re.scrollLeft,top:re.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<ue.length;A++){var ce=ue[A];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}ic=!!Fd,_d=Fd=null}finally{Et=h,Z.p=o,U.T=a}}t.current=n,hn=2}}function yp(){if(hn===2){hn=0;var t=Xr,n=fi,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=U.T,U.T=null;var o=Z.p;Z.p=2;var h=Et;Et|=4;try{Xx(t,n.alternate,n)}finally{Et=h,Z.p=o,U.T=a}}hn=3}}function gp(){if(hn===4||hn===3){hn=0,Dt();var t=Xr,n=fi,a=hr,o=rp;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?hn=5:(hn=0,fi=Xr=null,bp(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(qr=null),Fl(a),n=n.stateNode,nt&&typeof nt.onCommitFiberRoot=="function")try{nt.onCommitFiberRoot(Pe,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=U.T,h=Z.p,Z.p=2,U.T=null;try{for(var p=t.onRecoverableError,w=0;w<o.length;w++){var A=o[w];p(A.value,{componentStack:A.stack})}}finally{U.T=n,Z.p=h}}(hr&3)!==0&&Ko(),Il(t),h=t.pendingLanes,(a&261930)!==0&&(h&42)!==0?t===wd?ys++:(ys=0,wd=t):ys=0,gs(0)}}function bp(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,Ji(n)))}function Ko(){return pp(),yp(),gp(),vp()}function vp(){if(hn!==5)return!1;var t=Xr,n=bd;bd=0;var a=Fl(hr),o=U.T,h=Z.p;try{Z.p=32>a?32:a,U.T=null,a=vd,vd=null;var p=Xr,w=hr;if(hn=0,fi=Xr=null,hr=0,(Et&6)!==0)throw Error(i(331));var A=Et;if(Et|=4,tp(p.current),Jx(p,p.current,w,a),Et=A,gs(0,!1),nt&&typeof nt.onPostCommitFiberRoot=="function")try{nt.onPostCommitFiberRoot(Pe,p)}catch{}return!0}finally{Z.p=h,U.T=o,bp(t,n)}}function wp(t,n,a){n=dl(a,n),n=Pu(t.stateNode,n,2),t=$r(t,n,2),t!==null&&(nn(t,2),Il(t))}function zt(t,n,a){if(t.tag===3)wp(t,t,a);else for(;n!==null;){if(n.tag===3){wp(n,t,a);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(qr===null||!qr.has(o))){t=dl(a,t),a=kx(2),o=$r(n,a,2),o!==null&&(jx(a,o,n,t),nn(o,2),Il(o));break}}n=n.return}}function Sd(t,n,a){var o=t.pingCache;if(o===null){o=t.pingCache=new qb;var h=new Set;o.set(n,h)}else h=o.get(n),h===void 0&&(h=new Set,o.set(n,h));h.has(a)||(pd=!0,h.add(a),t=Wb.bind(null,t,n,a),n.then(t,t))}function Wb(t,n,a){var o=t.pingCache;o!==null&&o.delete(n),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,Bt===t&&(xt&a)===a&&(Pt===4||Pt===3&&(xt&62914560)===xt&&300>ct()-Uo?(Et&2)===0&&hi(t,0):yd|=a,di===xt&&(di=0)),Il(t)}function kp(t,n){n===0&&(n=gt()),t=ya(t,n),t!==null&&(nn(t,n),Il(t))}function Qb(t){var n=t.memoizedState,a=0;n!==null&&(a=n.retryLane),kp(t,a)}function Zb(t,n){var a=0;switch(t.tag){case 31:case 13:var o=t.stateNode,h=t.memoizedState;h!==null&&(a=h.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(i(314))}o!==null&&o.delete(n),kp(t,a)}function Jb(t,n){return Ne(t,n)}var Wo=null,xi=null,Cd=!1,Qo=!1,Ed=!1,Gr=0;function Il(t){t!==xi&&t.next===null&&(xi===null?Wo=xi=t:xi=xi.next=t),Qo=!0,Cd||(Cd=!0,e2())}function gs(t,n){if(!Ed&&Qo){Ed=!0;do for(var a=!1,o=Wo;o!==null;){if(t!==0){var h=o.pendingLanes;if(h===0)var p=0;else{var w=o.suspendedLanes,A=o.pingedLanes;p=(1<<31-ut(42|t)+1)-1,p&=h&~(w&~A),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,Ep(o,p))}else p=xt,p=Oe(o,o===Bt?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||rt(o,p)||(a=!0,Ep(o,p));o=o.next}while(a);Ed=!1}}function Pb(){jp()}function jp(){Qo=Cd=!1;var t=0;Gr!==0&&u2()&&(t=Gr);for(var n=ct(),a=null,o=Wo;o!==null;){var h=o.next,p=Sp(o,n);p===0?(o.next=null,a===null?Wo=h:a.next=h,h===null&&(xi=a)):(a=o,(t!==0||(p&3)!==0)&&(Qo=!0)),o=h}hn!==0&&hn!==5||gs(t),Gr!==0&&(Gr=0)}function Sp(t,n){for(var a=t.suspendedLanes,o=t.pingedLanes,h=t.expirationTimes,p=t.pendingLanes&-62914561;0<p;){var w=31-ut(p),A=1<<w,H=h[w];H===-1?((A&a)===0||(A&o)!==0)&&(h[w]=pe(A,n)):H<=n&&(t.expiredLanes|=A),p&=~A}if(n=Bt,a=xt,a=Oe(t,t===n?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o=t.callbackNode,a===0||t===n&&(Tt===2||Tt===9)||t.cancelPendingCommit!==null)return o!==null&&o!==null&&Ie(o),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||rt(t,a)){if(n=a&-a,n===t.callbackPriority)return n;switch(o!==null&&Ie(o),Fl(a)){case 2:case 8:a=be;break;case 32:a=Re;break;case 268435456:a=xe;break;default:a=Re}return o=Cp.bind(null,t),a=Ne(a,o),t.callbackPriority=n,t.callbackNode=a,n}return o!==null&&o!==null&&Ie(o),t.callbackPriority=2,t.callbackNode=null,2}function Cp(t,n){if(hn!==0&&hn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(Ko()&&t.callbackNode!==a)return null;var o=xt;return o=Oe(t,t===Bt?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o===0?null:(ip(t,o,n),Sp(t,ct()),t.callbackNode!=null&&t.callbackNode===a?Cp.bind(null,t):null)}function Ep(t,n){if(Ko())return null;ip(t,n,!0)}function e2(){f2(function(){(Et&6)!==0?Ne(se,Pb):jp()})}function Nd(){if(Gr===0){var t=ei;t===0&&(t=kt,kt<<=1,(kt&261888)===0&&(kt=256)),Gr=t}return Gr}function Np(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Zn(""+t)}function Ap(t,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,t.id&&a.setAttribute("form",t.id),n.parentNode.insertBefore(a,n),t=new FormData(t),a.parentNode.removeChild(a),t}function t2(t,n,a,o,h){if(n==="submit"&&a&&a.stateNode===h){var p=Np((h[vn]||null).action),w=o.submitter;w&&(n=(n=w[vn]||null)?Np(n.formAction):w.getAttribute("formAction"),n!==null&&(p=n,w=null));var A=new We("action","action",null,o,h);t.push({event:A,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Gr!==0){var H=w?Ap(h,w):new FormData(h);Gu(a,{pending:!0,data:H,method:h.method,action:p},null,H)}}else typeof p=="function"&&(A.preventDefault(),H=w?Ap(h,w):new FormData(h),Gu(a,{pending:!0,data:H,method:h.method,action:p},p,H))},currentTarget:h}]})}}for(var Ad=0;Ad<uu.length;Ad++){var Dd=uu[Ad],n2=Dd.toLowerCase(),l2=Dd[0].toUpperCase()+Dd.slice(1);El(n2,"on"+l2)}El(am,"onAnimationEnd"),El(im,"onAnimationIteration"),El(sm,"onAnimationStart"),El("dblclick","onDoubleClick"),El("focusin","onFocus"),El("focusout","onBlur"),El(bb,"onTransitionRun"),El(vb,"onTransitionStart"),El(wb,"onTransitionCancel"),El(om,"onTransitionEnd"),jr("onMouseEnter",["mouseout","mouseover"]),jr("onMouseLeave",["mouseout","mouseover"]),jr("onPointerEnter",["pointerout","pointerover"]),jr("onPointerLeave",["pointerout","pointerover"]),Qn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Qn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Qn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Qn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Qn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Qn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bs="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(" "),r2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(bs));function Dp(t,n){n=(n&4)!==0;for(var a=0;a<t.length;a++){var o=t[a],h=o.event;o=o.listeners;e:{var p=void 0;if(n)for(var w=o.length-1;0<=w;w--){var A=o[w],H=A.instance,ee=A.currentTarget;if(A=A.listener,H!==p&&h.isPropagationStopped())break e;p=A,h.currentTarget=ee;try{p(h)}catch(oe){uo(oe)}h.currentTarget=null,p=H}else for(w=0;w<o.length;w++){if(A=o[w],H=A.instance,ee=A.currentTarget,A=A.listener,H!==p&&h.isPropagationStopped())break e;p=A,h.currentTarget=ee;try{p(h)}catch(oe){uo(oe)}h.currentTarget=null,p=H}}}}function ft(t,n){var a=n[Ua];a===void 0&&(a=n[Ua]=new Set);var o=t+"__bubble";a.has(o)||(Tp(n,t,2,!1),a.add(o))}function Td(t,n,a){var o=0;n&&(o|=4),Tp(a,t,o,n)}var Zo="_reactListening"+Math.random().toString(36).slice(2);function zd(t){if(!t[Zo]){t[Zo]=!0,Wn.forEach(function(a){a!=="selectionchange"&&(r2.has(a)||Td(a,!1,t),Td(a,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[Zo]||(n[Zo]=!0,Td("selectionchange",!1,n))}}function Tp(t,n,a,o){switch(a1(n)){case 2:var h=M2;break;case 8:h=R2;break;default:h=Vd}a=h.bind(null,n,a,t),h=void 0,!qa||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(h=!0),o?h!==void 0?t.addEventListener(n,a,{capture:!0,passive:h}):t.addEventListener(n,a,!0):h!==void 0?t.addEventListener(n,a,{passive:h}):t.addEventListener(n,a,!1)}function Md(t,n,a,o,h){var p=o;if((n&1)===0&&(n&2)===0&&o!==null)e:for(;;){if(o===null)return;var w=o.tag;if(w===3||w===4){var A=o.stateNode.containerInfo;if(A===h)break;if(w===4)for(w=o.return;w!==null;){var H=w.tag;if((H===3||H===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;A!==null;){if(w=_l(A),w===null)return;if(H=w.tag,H===5||H===6||H===26||H===27){o=p=w;continue e}A=A.parentNode}}o=o.return}fn(function(){var ee=p,oe=Ui(a),ue=[];e:{var te=cm.get(t);if(te!==void 0){var re=We,Be=t;switch(t){case"keypress":if(we(a)===0)break e;case"keydown":case"keyup":re=Zg;break;case"focusin":Be="focus",re=Wt;break;case"focusout":Be="blur",re=Wt;break;case"beforeblur":case"afterblur":re=Wt;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":re=Pl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":re=wn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":re=eb;break;case am:case im:case sm:re=Ug;break;case om:re=nb;break;case"scroll":case"scrollend":re=oo;break;case"wheel":re=rb;break;case"copy":case"cut":case"paste":re=qg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":re=Hh;break;case"toggle":case"beforetoggle":re=ib}var Qe=(n&4)!==0,Ft=!Qe&&(t==="scroll"||t==="scrollend"),Q=Qe?te!==null?te+"Capture":null:te;Qe=[];for(var X=ee,P;X!==null;){var ce=X;if(P=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||P===null||Q===null||(ce=Sl(X,Q),ce!=null&&Qe.push(vs(X,ce,P))),Ft)break;X=X.return}0<Qe.length&&(te=new re(te,Be,null,a,oe),ue.push({event:te,listeners:Qe}))}}if((n&7)===0){e:{if(te=t==="mouseover"||t==="pointerover",re=t==="mouseout"||t==="pointerout",te&&a!==Ii&&(Be=a.relatedTarget||a.fromElement)&&(_l(Be)||Be[Kn]))break e;if((re||te)&&(te=oe.window===oe?oe:(te=oe.ownerDocument)?te.defaultView||te.parentWindow:window,re?(Be=a.relatedTarget||a.toElement,re=ee,Be=Be?_l(Be):null,Be!==null&&(Ft=u(Be),Qe=Be.tag,Be!==Ft||Qe!==5&&Qe!==27&&Qe!==6)&&(Be=null)):(re=null,Be=ee),re!==Be)){if(Qe=Pl,ce="onMouseLeave",Q="onMouseEnter",X="mouse",(t==="pointerout"||t==="pointerover")&&(Qe=Hh,ce="onPointerLeave",Q="onPointerEnter",X="pointer"),Ft=re==null?te:wr(re),P=Be==null?te:wr(Be),te=new Qe(ce,X+"leave",re,a,oe),te.target=Ft,te.relatedTarget=P,ce=null,_l(oe)===ee&&(Qe=new Qe(Q,X+"enter",Be,a,oe),Qe.target=P,Qe.relatedTarget=Ft,ce=Qe),Ft=ce,re&&Be)t:{for(Qe=a2,Q=re,X=Be,P=0,ce=Q;ce;ce=Qe(ce))P++;ce=0;for(var Ye=X;Ye;Ye=Qe(Ye))ce++;for(;0<P-ce;)Q=Qe(Q),P--;for(;0<ce-P;)X=Qe(X),ce--;for(;P--;){if(Q===X||X!==null&&Q===X.alternate){Qe=Q;break t}Q=Qe(Q),X=Qe(X)}Qe=null}else Qe=null;re!==null&&zp(ue,te,re,Qe,!1),Be!==null&&Ft!==null&&zp(ue,Ft,Be,Qe,!0)}}e:{if(te=ee?wr(ee):window,re=te.nodeName&&te.nodeName.toLowerCase(),re==="select"||re==="input"&&te.type==="file")var jt=Kh;else if(Vh(te))if(Wh)jt=pb;else{jt=mb;var He=hb}else re=te.nodeName,!re||re.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?ee&&Hi(ee.elementType)&&(jt=Kh):jt=xb;if(jt&&(jt=jt(t,ee))){Gh(ue,jt,a,oe);break e}He&&He(t,te,ee),t==="focusout"&&ee&&te.type==="number"&&ee.memoizedProps.value!=null&&ha(te,"number",te.value)}switch(He=ee?wr(ee):window,t){case"focusin":(Vh(He)||He.contentEditable==="true")&&(Va=He,su=ee,Wi=null);break;case"focusout":Wi=su=Va=null;break;case"mousedown":ou=!0;break;case"contextmenu":case"mouseup":case"dragend":ou=!1,lm(ue,a,oe);break;case"selectionchange":if(gb)break;case"keydown":case"keyup":lm(ue,a,oe)}var at;if(lu)e:{switch(t){case"compositionstart":var pt="onCompositionStart";break e;case"compositionend":pt="onCompositionEnd";break e;case"compositionupdate":pt="onCompositionUpdate";break e}pt=void 0}else Xa?qh(t,a)&&(pt="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(pt="onCompositionStart");pt&&(Ih&&a.locale!=="ko"&&(Xa||pt!=="onCompositionStart"?pt==="onCompositionEnd"&&Xa&&(at=me()):(F=oe,le="value"in F?F.value:F.textContent,Xa=!0)),He=Jo(ee,pt),0<He.length&&(pt=new Lh(pt,t,null,a,oe),ue.push({event:pt,listeners:He}),at?pt.data=at:(at=Xh(a),at!==null&&(pt.data=at)))),(at=ob?cb(t,a):ub(t,a))&&(pt=Jo(ee,"onBeforeInput"),0<pt.length&&(He=new Lh("onBeforeInput","beforeinput",null,a,oe),ue.push({event:He,listeners:pt}),He.data=at)),t2(ue,t,ee,a,oe)}Dp(ue,n)})}function vs(t,n,a){return{instance:t,listener:n,currentTarget:a}}function Jo(t,n){for(var a=n+"Capture",o=[];t!==null;){var h=t,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=Sl(t,a),h!=null&&o.unshift(vs(t,h,p)),h=Sl(t,n),h!=null&&o.push(vs(t,h,p))),t.tag===3)return o;t=t.return}return[]}function a2(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function zp(t,n,a,o,h){for(var p=n._reactName,w=[];a!==null&&a!==o;){var A=a,H=A.alternate,ee=A.stateNode;if(A=A.tag,H!==null&&H===o)break;A!==5&&A!==26&&A!==27||ee===null||(H=ee,h?(ee=Sl(a,p),ee!=null&&w.unshift(vs(a,ee,H))):h||(ee=Sl(a,p),ee!=null&&w.push(vs(a,ee,H)))),a=a.return}w.length!==0&&t.push({event:n,listeners:w})}var i2=/\r\n?/g,s2=/\u0000|\uFFFD/g;function Mp(t){return(typeof t=="string"?t:""+t).replace(i2,`
|
|
49
|
-
`).replace(s2,"")}function Rp(t,n){return n=Mp(n),Mp(t)===n}function Rt(t,n,a,o,h,p){switch(a){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||Ar(t,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&Ar(t,""+o);break;case"className":Sr(t,"class",o);break;case"tabIndex":Sr(t,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Sr(t,a,o);break;case"style":io(t,o,p);break;case"data":if(n!=="object"){Sr(t,"data",o);break}case"src":case"href":if(o===""&&(n!=="a"||a!=="href")){t.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(a);break}o=Zn(""+o),t.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="function"){t.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"&&Rt(t,n,"name",h.name,h,null),Rt(t,n,"formEncType",h.formEncType,h,null),Rt(t,n,"formMethod",h.formMethod,h,null),Rt(t,n,"formTarget",h.formTarget,h,null)):(Rt(t,n,"encType",h.encType,h,null),Rt(t,n,"method",h.method,h,null),Rt(t,n,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(a);break}o=Zn(""+o),t.setAttribute(a,o);break;case"onClick":o!=null&&(t.onclick=Jn);break;case"onScroll":o!=null&&ft("scroll",t);break;case"onScrollEnd":o!=null&&ft("scrollend",t);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(i(61));if(a=o.__html,a!=null){if(h.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"multiple":t.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":t.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){t.removeAttribute("xlink:href");break}a=Zn(""+o),t.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":o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(a,""+o):t.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":o&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":o===!0?t.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(a,o):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?t.setAttribute(a,o):t.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?t.removeAttribute(a):t.setAttribute(a,o);break;case"popover":ft("beforetoggle",t),ft("toggle",t),Bl(t,"popover",o);break;case"xlinkActuate":jl(t,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":jl(t,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":jl(t,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":jl(t,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":jl(t,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":jl(t,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":jl(t,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":jl(t,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":jl(t,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Bl(t,"is",o);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=eu.get(a)||a,Bl(t,a,o))}}function Rd(t,n,a,o,h,p){switch(a){case"style":io(t,o,p);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(i(61));if(a=o.__html,a!=null){if(h.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"children":typeof o=="string"?Ar(t,o):(typeof o=="number"||typeof o=="bigint")&&Ar(t,""+o);break;case"onScroll":o!=null&&ft("scroll",t);break;case"onScrollEnd":o!=null&&ft("scrollend",t);break;case"onClick":o!=null&&(t.onclick=Jn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!wl.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=t[vn]||null,p=p!=null?p[a]:null,typeof p=="function"&&t.removeEventListener(n,p,h),typeof o=="function")){typeof p!="function"&&p!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(n,o,h);break e}a in t?t[a]=o:o===!0?t.setAttribute(a,""):Bl(t,a,o)}}}function Cn(t,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ft("error",t),ft("load",t);var o=!1,h=!1,p;for(p in a)if(a.hasOwnProperty(p)){var w=a[p];if(w!=null)switch(p){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Rt(t,n,p,w,a,null)}}h&&Rt(t,n,"srcSet",a.srcSet,a,null),o&&Rt(t,n,"src",a.src,a,null);return;case"input":ft("invalid",t);var A=p=w=h=null,H=null,ee=null;for(o in a)if(a.hasOwnProperty(o)){var oe=a[o];if(oe!=null)switch(o){case"name":h=oe;break;case"type":w=oe;break;case"checked":H=oe;break;case"defaultChecked":ee=oe;break;case"value":p=oe;break;case"defaultValue":A=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(i(137,n));break;default:Rt(t,n,o,oe,a,null)}}Ya(t,p,A,H,ee,w,h,!1);return;case"select":ft("invalid",t),o=w=p=null;for(h in a)if(a.hasOwnProperty(h)&&(A=a[h],A!=null))switch(h){case"value":p=A;break;case"defaultValue":w=A;break;case"multiple":o=A;default:Rt(t,n,h,A,a,null)}n=p,a=w,t.multiple=!!o,n!=null?Nr(t,!!o,n,!1):a!=null&&Nr(t,!!o,a,!0);return;case"textarea":ft("invalid",t),p=h=o=null;for(w in a)if(a.hasOwnProperty(w)&&(A=a[w],A!=null))switch(w){case"value":o=A;break;case"defaultValue":h=A;break;case"children":p=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(i(91));break;default:Rt(t,n,w,A,a,null)}Li(t,o,h,p);return;case"option":for(H in a)if(a.hasOwnProperty(H)&&(o=a[H],o!=null))switch(H){case"selected":t.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Rt(t,n,H,o,a,null)}return;case"dialog":ft("beforetoggle",t),ft("toggle",t),ft("cancel",t),ft("close",t);break;case"iframe":case"object":ft("load",t);break;case"video":case"audio":for(o=0;o<bs.length;o++)ft(bs[o],t);break;case"image":ft("error",t),ft("load",t);break;case"details":ft("toggle",t);break;case"embed":case"source":case"link":ft("error",t),ft("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in a)if(a.hasOwnProperty(ee)&&(o=a[ee],o!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Rt(t,n,ee,o,a,null)}return;default:if(Hi(n)){for(oe in a)a.hasOwnProperty(oe)&&(o=a[oe],o!==void 0&&Rd(t,n,oe,o,a,void 0));return}}for(A in a)a.hasOwnProperty(A)&&(o=a[A],o!=null&&Rt(t,n,A,o,a,null))}function o2(t,n,a,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,w=null,A=null,H=null,ee=null,oe=null;for(re in a){var ue=a[re];if(a.hasOwnProperty(re)&&ue!=null)switch(re){case"checked":break;case"value":break;case"defaultValue":H=ue;default:o.hasOwnProperty(re)||Rt(t,n,re,null,o,ue)}}for(var te in o){var re=o[te];if(ue=a[te],o.hasOwnProperty(te)&&(re!=null||ue!=null))switch(te){case"type":p=re;break;case"name":h=re;break;case"checked":ee=re;break;case"defaultChecked":oe=re;break;case"value":w=re;break;case"defaultValue":A=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(i(137,n));break;default:re!==ue&&Rt(t,n,te,re,o,ue)}}$i(t,w,A,H,ee,oe,p,h);return;case"select":re=w=A=te=null;for(p in a)if(H=a[p],a.hasOwnProperty(p)&&H!=null)switch(p){case"value":break;case"multiple":re=H;default:o.hasOwnProperty(p)||Rt(t,n,p,null,o,H)}for(h in o)if(p=o[h],H=a[h],o.hasOwnProperty(h)&&(p!=null||H!=null))switch(h){case"value":te=p;break;case"defaultValue":A=p;break;case"multiple":w=p;default:p!==H&&Rt(t,n,h,p,o,H)}n=A,a=w,o=re,te!=null?Nr(t,!!a,te,!1):!!o!=!!a&&(n!=null?Nr(t,!!a,n,!0):Nr(t,!!a,a?[]:"",!1));return;case"textarea":re=te=null;for(A in a)if(h=a[A],a.hasOwnProperty(A)&&h!=null&&!o.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:Rt(t,n,A,null,o,h)}for(w in o)if(h=o[w],p=a[w],o.hasOwnProperty(w)&&(h!=null||p!=null))switch(w){case"value":te=h;break;case"defaultValue":re=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(i(91));break;default:h!==p&&Rt(t,n,w,h,o,p)}ro(t,te,re);return;case"option":for(var Be in a)if(te=a[Be],a.hasOwnProperty(Be)&&te!=null&&!o.hasOwnProperty(Be))switch(Be){case"selected":t.selected=!1;break;default:Rt(t,n,Be,null,o,te)}for(H in o)if(te=o[H],re=a[H],o.hasOwnProperty(H)&&te!==re&&(te!=null||re!=null))switch(H){case"selected":t.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:Rt(t,n,H,te,o,re)}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 Qe in a)te=a[Qe],a.hasOwnProperty(Qe)&&te!=null&&!o.hasOwnProperty(Qe)&&Rt(t,n,Qe,null,o,te);for(ee in o)if(te=o[ee],re=a[ee],o.hasOwnProperty(ee)&&te!==re&&(te!=null||re!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(i(137,n));break;default:Rt(t,n,ee,te,o,re)}return;default:if(Hi(n)){for(var Ft in a)te=a[Ft],a.hasOwnProperty(Ft)&&te!==void 0&&!o.hasOwnProperty(Ft)&&Rd(t,n,Ft,void 0,o,te);for(oe in o)te=o[oe],re=a[oe],!o.hasOwnProperty(oe)||te===re||te===void 0&&re===void 0||Rd(t,n,oe,te,o,re);return}}for(var Q in a)te=a[Q],a.hasOwnProperty(Q)&&te!=null&&!o.hasOwnProperty(Q)&&Rt(t,n,Q,null,o,te);for(ue in o)te=o[ue],re=a[ue],!o.hasOwnProperty(ue)||te===re||te==null&&re==null||Rt(t,n,ue,te,o,re)}function Fp(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function c2(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var h=a[o],p=h.transferSize,w=h.initiatorType,A=h.duration;if(p&&A&&Fp(w)){for(w=0,A=h.responseEnd,o+=1;o<a.length;o++){var H=a[o],ee=H.startTime;if(ee>A)break;var oe=H.transferSize,ue=H.initiatorType;oe&&Fp(ue)&&(H=H.responseEnd,w+=oe*(H<A?1:(A-ee)/(H-ee)))}if(--o,n+=8*(p+w)/(h.duration/1e3),t++,10<t)break}}if(0<t)return n/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Fd=null,_d=null;function Po(t){return t.nodeType===9?t:t.ownerDocument}function _p(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Op(t,n){if(t===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&n==="foreignObject"?0:t}function Od(t,n){return t==="textarea"||t==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Bd=null;function u2(){var t=window.event;return t&&t.type==="popstate"?t===Bd?!1:(Bd=t,!0):(Bd=null,!1)}var Bp=typeof setTimeout=="function"?setTimeout:void 0,d2=typeof clearTimeout=="function"?clearTimeout:void 0,$p=typeof Promise=="function"?Promise:void 0,f2=typeof queueMicrotask=="function"?queueMicrotask:typeof $p<"u"?function(t){return $p.resolve(null).then(t).catch(h2)}:Bp;function h2(t){setTimeout(function(){throw t})}function Kr(t){return t==="head"}function Lp(t,n){var a=n,o=0;do{var h=a.nextSibling;if(t.removeChild(a),h&&h.nodeType===8)if(a=h.data,a==="/$"||a==="/&"){if(o===0){t.removeChild(h),bi(n);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")ws(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,ws(a);for(var p=a.firstChild;p;){var w=p.nextSibling,A=p.nodeName;p[vr]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=w}}else a==="body"&&ws(t.ownerDocument.body);a=h}while(a);bi(n)}function Hp(t,n){var a=t;t=0;do{var o=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||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=o}while(a)}function $d(t){var n=t.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":$d(a),vl(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function m2(t,n,a,o){for(;t.nodeType===1;){var h=a;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!o&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(o){if(!t[vr])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(p=t.getAttribute("rel"),p==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(p!==h.rel||t.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||t.getAttribute("title")!==(h.title==null?null:h.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(p=t.getAttribute("src"),(p!==(h.src==null?null:h.src)||t.getAttribute("type")!==(h.type==null?null:h.type)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&t.getAttribute("name")===p)return t}else return t;if(t=pl(t.nextSibling),t===null)break}return null}function x2(t,n,a){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=pl(t.nextSibling),t===null))return null;return t}function Ip(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=pl(t.nextSibling),t===null))return null;return t}function Ld(t){return t.data==="$?"||t.data==="$~"}function Hd(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function p2(t,n){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||a.readyState!=="loading")n();else{var o=function(){n(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),t._reactRetry=o}}function pl(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return t}var Id=null;function Up(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(n===0)return pl(t.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}t=t.nextSibling}return null}function Yp(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return t;n--}else a!=="/$"&&a!=="/&"||n++}t=t.previousSibling}return null}function qp(t,n,a){switch(n=Po(a),t){case"html":if(t=n.documentElement,!t)throw Error(i(452));return t;case"head":if(t=n.head,!t)throw Error(i(453));return t;case"body":if(t=n.body,!t)throw Error(i(454));return t;default:throw Error(i(451))}}function ws(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);vl(t)}var yl=new Map,Xp=new Set;function ec(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var mr=Z.d;Z.d={f:y2,r:g2,D:b2,C:v2,L:w2,m:k2,X:S2,S:j2,M:C2};function y2(){var t=mr.f(),n=Xo();return t||n}function g2(t){var n=Zl(t);n!==null&&n.tag===5&&n.type==="form"?ox(n):mr.r(t)}var pi=typeof document>"u"?null:document;function Vp(t,n,a){var o=pi;if(o&&typeof n=="string"&&n){var h=Ln(n);h='link[rel="'+t+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),Xp.has(h)||(Xp.add(h),t={rel:t,crossOrigin:a,href:n},o.querySelector(h)===null&&(n=o.createElement("link"),Cn(n,"link",t),Zt(n),o.head.appendChild(n)))}}function b2(t){mr.D(t),Vp("dns-prefetch",t,null)}function v2(t,n){mr.C(t,n),Vp("preconnect",t,n)}function w2(t,n,a){mr.L(t,n,a);var o=pi;if(o&&t&&n){var h='link[rel="preload"][as="'+Ln(n)+'"]';n==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+Ln(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+Ln(a.imageSizes)+'"]')):h+='[href="'+Ln(t)+'"]';var p=h;switch(n){case"style":p=yi(t);break;case"script":p=gi(t)}yl.has(p)||(t=y({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:t,as:n},a),yl.set(p,t),o.querySelector(h)!==null||n==="style"&&o.querySelector(ks(p))||n==="script"&&o.querySelector(js(p))||(n=o.createElement("link"),Cn(n,"link",t),Zt(n),o.head.appendChild(n)))}}function k2(t,n){mr.m(t,n);var a=pi;if(a&&t){var o=n&&typeof n.as=="string"?n.as:"script",h='link[rel="modulepreload"][as="'+Ln(o)+'"][href="'+Ln(t)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=gi(t)}if(!yl.has(p)&&(t=y({rel:"modulepreload",href:t},n),yl.set(p,t),a.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(js(p)))return}o=a.createElement("link"),Cn(o,"link",t),Zt(o),a.head.appendChild(o)}}}function j2(t,n,a){mr.S(t,n,a);var o=pi;if(o&&t){var h=kr(o).hoistableStyles,p=yi(t);n=n||"default";var w=h.get(p);if(!w){var A={loading:0,preload:null};if(w=o.querySelector(ks(p)))A.loading=5;else{t=y({rel:"stylesheet",href:t,"data-precedence":n},a),(a=yl.get(p))&&Ud(t,a);var H=w=o.createElement("link");Zt(H),Cn(H,"link",t),H._p=new Promise(function(ee,oe){H.onload=ee,H.onerror=oe}),H.addEventListener("load",function(){A.loading|=1}),H.addEventListener("error",function(){A.loading|=2}),A.loading|=4,tc(w,n,o)}w={type:"stylesheet",instance:w,count:1,state:A},h.set(p,w)}}}function S2(t,n){mr.X(t,n);var a=pi;if(a&&t){var o=kr(a).hoistableScripts,h=gi(t),p=o.get(h);p||(p=a.querySelector(js(h)),p||(t=y({src:t,async:!0},n),(n=yl.get(h))&&Yd(t,n),p=a.createElement("script"),Zt(p),Cn(p,"link",t),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function C2(t,n){mr.M(t,n);var a=pi;if(a&&t){var o=kr(a).hoistableScripts,h=gi(t),p=o.get(h);p||(p=a.querySelector(js(h)),p||(t=y({src:t,async:!0,type:"module"},n),(n=yl.get(h))&&Yd(t,n),p=a.createElement("script"),Zt(p),Cn(p,"link",t),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Gp(t,n,a,o){var h=(h=ve.current)?ec(h):null;if(!h)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=yi(a.href),a=kr(h).hoistableStyles,o=a.get(n),o||(o={type:"style",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=yi(a.href);var p=kr(h).hoistableStyles,w=p.get(t);if(w||(h=h.ownerDocument||h,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(t,w),(p=h.querySelector(ks(t)))&&!p._p&&(w.instance=p,w.state.loading=5),yl.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},yl.set(t,a),p||E2(h,t,a,w.state))),n&&o===null)throw Error(i(528,""));return w}if(n&&o!==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=gi(a),a=kr(h).hoistableScripts,o=a.get(n),o||(o={type:"script",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,t))}}function yi(t){return'href="'+Ln(t)+'"'}function ks(t){return'link[rel="stylesheet"]['+t+"]"}function Kp(t){return y({},t,{"data-precedence":t.precedence,precedence:null})}function E2(t,n,a,o){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=t.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),Cn(n,"link",a),Zt(n),t.head.appendChild(n))}function gi(t){return'[src="'+Ln(t)+'"]'}function js(t){return"script[async]"+t}function Wp(t,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var o=t.querySelector('style[data-href~="'+Ln(a.href)+'"]');if(o)return n.instance=o,Zt(o),o;var h=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),Zt(o),Cn(o,"style",h),tc(o,a.precedence,t),n.instance=o;case"stylesheet":h=yi(a.href);var p=t.querySelector(ks(h));if(p)return n.state.loading|=4,n.instance=p,Zt(p),p;o=Kp(a),(h=yl.get(h))&&Ud(o,h),p=(t.ownerDocument||t).createElement("link"),Zt(p);var w=p;return w._p=new Promise(function(A,H){w.onload=A,w.onerror=H}),Cn(p,"link",o),n.state.loading|=4,tc(p,a.precedence,t),n.instance=p;case"script":return p=gi(a.src),(h=t.querySelector(js(p)))?(n.instance=h,Zt(h),h):(o=a,(h=yl.get(p))&&(o=y({},a),Yd(o,h)),t=t.ownerDocument||t,h=t.createElement("script"),Zt(h),Cn(h,"link",o),t.head.appendChild(h),n.instance=h);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,tc(o,a.precedence,t));return n.instance}function tc(t,n,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=o.length?o[o.length-1]:null,p=h,w=0;w<o.length;w++){var A=o[w];if(A.dataset.precedence===n)p=A;else if(p!==h)break}p?p.parentNode.insertBefore(t,p.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(t,n.firstChild))}function Ud(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function Yd(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var nc=null;function Qp(t,n,a){if(nc===null){var o=new Map,h=nc=new Map;h.set(a,o)}else h=nc,o=h.get(a),o||(o=new Map,h.set(a,o));if(o.has(t))return o;for(o.set(t,null),a=a.getElementsByTagName(t),h=0;h<a.length;h++){var p=a[h];if(!(p[vr]||p[Vt]||t==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var w=p.getAttribute(n)||"";w=t+w;var A=o.get(w);A?A.push(p):o.set(w,[p])}}return o}function Zp(t,n,a){t=t.ownerDocument||t,t.head.insertBefore(a,n==="title"?t.querySelector("head > title"):null)}function N2(t,n,a){if(a===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return t=n.disabled,typeof n.precedence=="string"&&t==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Jp(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function A2(t,n,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var h=yi(o.href),p=n.querySelector(ks(h));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=lc.bind(t),n.then(t,t)),a.state.loading|=4,a.instance=p,Zt(p);return}p=n.ownerDocument||n,o=Kp(o),(h=yl.get(h))&&Ud(o,h),p=p.createElement("link"),Zt(p);var w=p;w._p=new Promise(function(A,H){w.onload=A,w.onerror=H}),Cn(p,"link",o),a.instance=p}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=lc.bind(t),n.addEventListener("load",a),n.addEventListener("error",a))}}var qd=0;function D2(t,n){return t.stylesheets&&t.count===0&&ac(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var o=setTimeout(function(){if(t.stylesheets&&ac(t,t.stylesheets),t.unsuspend){var p=t.unsuspend;t.unsuspend=null,p()}},6e4+n);0<t.imgBytes&&qd===0&&(qd=62500*c2());var h=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&ac(t,t.stylesheets),t.unsuspend)){var p=t.unsuspend;t.unsuspend=null,p()}},(t.imgBytes>qd?50:800)+n);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function lc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ac(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var rc=null;function ac(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,rc=new Map,n.forEach(T2,t),rc=null,lc.call(t))}function T2(t,n){if(!(n.state.loading&4)){var a=rc.get(t);if(a)var o=a.get(null);else{a=new Map,rc.set(t,a);for(var h=t.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),o=w)}o&&a.set(null,o)}h=n.instance,w=h.getAttribute("data-precedence"),p=a.get(w)||o,p===o&&a.set(null,h),a.set(w,h),this.count++,o=lc.bind(this),h.addEventListener("load",o),h.addEventListener("error",o),p?p.parentNode.insertBefore(h,p.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(h,t.firstChild)),n.state.loading|=4}}var Ss={$$typeof:z,Provider:null,Consumer:null,_currentValue:ie,_currentValue2:ie,_threadCount:0};function z2(t,n,a,o,h,p,w,A,H){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=dn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dn(0),this.hiddenUpdates=dn(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function Pp(t,n,a,o,h,p,w,A,H,ee,oe,ue){return t=new z2(t,n,a,w,H,ee,oe,ue,A),n=1,p===!0&&(n|=24),p=el(3,null,null,n),t.current=p,p.stateNode=t,n=ju(),n.refCount++,t.pooledCache=n,n.refCount++,p.memoizedState={element:o,isDehydrated:a,cache:n},Nu(p),t}function e1(t){return t?(t=Wa,t):Wa}function t1(t,n,a,o,h,p){h=e1(h),o.context===null?o.context=h:o.pendingContext=h,o=Br(n),o.payload={element:a},p=p===void 0?null:p,p!==null&&(o.callback=p),a=$r(t,o,n),a!==null&&(qn(a,t,n),ns(a,t,n))}function n1(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<n?a:n}}function Xd(t,n){n1(t,n),(t=t.alternate)&&n1(t,n)}function l1(t){if(t.tag===13||t.tag===31){var n=ya(t,67108864);n!==null&&qn(n,t,67108864),Xd(t,67108864)}}function r1(t){if(t.tag===13||t.tag===31){var n=al();n=Fi(n);var a=ya(t,n);a!==null&&qn(a,t,n),Xd(t,n)}}var ic=!0;function M2(t,n,a,o){var h=U.T;U.T=null;var p=Z.p;try{Z.p=2,Vd(t,n,a,o)}finally{Z.p=p,U.T=h}}function R2(t,n,a,o){var h=U.T;U.T=null;var p=Z.p;try{Z.p=8,Vd(t,n,a,o)}finally{Z.p=p,U.T=h}}function Vd(t,n,a,o){if(ic){var h=Gd(o);if(h===null)Md(t,n,o,sc,a),i1(t,o);else if(_2(h,t,n,a,o))o.stopPropagation();else if(i1(t,o),n&4&&-1<F2.indexOf(t)){for(;h!==null;){var p=Zl(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=J(p.pendingLanes);if(w!==0){var A=p;for(A.pendingLanes|=2,A.entangledLanes|=2;w;){var H=1<<31-ut(w);A.entanglements[1]|=H,w&=~H}Il(p),(Et&6)===0&&(Yo=ct()+500,gs(0))}}break;case 31:case 13:A=ya(p,2),A!==null&&qn(A,p,2),Xo(),Xd(p,2)}if(p=Gd(o),p===null&&Md(t,n,o,sc,a),p===h)break;h=p}h!==null&&o.stopPropagation()}else Md(t,n,o,null,a)}}function Gd(t){return t=Ui(t),Kd(t)}var sc=null;function Kd(t){if(sc=null,t=_l(t),t!==null){var n=u(t);if(n===null)t=null;else{var a=n.tag;if(a===13){if(t=d(n),t!==null)return t;t=null}else if(a===31){if(t=m(n),t!==null)return t;t=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null)}}return sc=t,null}function a1(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ot()){case se:return 2;case be:return 8;case Re:case _e:return 32;case xe:return 268435456;default:return 32}default:return 32}}var Wd=!1,Wr=null,Qr=null,Zr=null,Cs=new Map,Es=new Map,Jr=[],F2="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 i1(t,n){switch(t){case"focusin":case"focusout":Wr=null;break;case"dragenter":case"dragleave":Qr=null;break;case"mouseover":case"mouseout":Zr=null;break;case"pointerover":case"pointerout":Cs.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Es.delete(n.pointerId)}}function Ns(t,n,a,o,h,p){return t===null||t.nativeEvent!==p?(t={blockedOn:n,domEventName:a,eventSystemFlags:o,nativeEvent:p,targetContainers:[h]},n!==null&&(n=Zl(n),n!==null&&l1(n)),t):(t.eventSystemFlags|=o,n=t.targetContainers,h!==null&&n.indexOf(h)===-1&&n.push(h),t)}function _2(t,n,a,o,h){switch(n){case"focusin":return Wr=Ns(Wr,t,n,a,o,h),!0;case"dragenter":return Qr=Ns(Qr,t,n,a,o,h),!0;case"mouseover":return Zr=Ns(Zr,t,n,a,o,h),!0;case"pointerover":var p=h.pointerId;return Cs.set(p,Ns(Cs.get(p)||null,t,n,a,o,h)),!0;case"gotpointercapture":return p=h.pointerId,Es.set(p,Ns(Es.get(p)||null,t,n,a,o,h)),!0}return!1}function s1(t){var n=_l(t.target);if(n!==null){var a=u(n);if(a!==null){if(n=a.tag,n===13){if(n=d(a),n!==null){t.blockedOn=n,Ql(t.priority,function(){r1(a)});return}}else if(n===31){if(n=m(a),n!==null){t.blockedOn=n,Ql(t.priority,function(){r1(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function oc(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var a=Gd(t.nativeEvent);if(a===null){a=t.nativeEvent;var o=new a.constructor(a.type,a);Ii=o,a.target.dispatchEvent(o),Ii=null}else return n=Zl(a),n!==null&&l1(n),t.blockedOn=a,!1;n.shift()}return!0}function o1(t,n,a){oc(t)&&a.delete(n)}function O2(){Wd=!1,Wr!==null&&oc(Wr)&&(Wr=null),Qr!==null&&oc(Qr)&&(Qr=null),Zr!==null&&oc(Zr)&&(Zr=null),Cs.forEach(o1),Es.forEach(o1)}function cc(t,n){t.blockedOn===n&&(t.blockedOn=null,Wd||(Wd=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,O2)))}var uc=null;function c1(t){uc!==t&&(uc=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){uc===t&&(uc=null);for(var n=0;n<t.length;n+=3){var a=t[n],o=t[n+1],h=t[n+2];if(typeof o!="function"){if(Kd(o||a)===null)continue;break}var p=Zl(a);p!==null&&(t.splice(n,3),n-=3,Gu(p,{pending:!0,data:h,method:a.method,action:o},o,h))}}))}function bi(t){function n(H){return cc(H,t)}Wr!==null&&cc(Wr,t),Qr!==null&&cc(Qr,t),Zr!==null&&cc(Zr,t),Cs.forEach(n),Es.forEach(n);for(var a=0;a<Jr.length;a++){var o=Jr[a];o.blockedOn===t&&(o.blockedOn=null)}for(;0<Jr.length&&(a=Jr[0],a.blockedOn===null);)s1(a),a.blockedOn===null&&Jr.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var h=a[o],p=a[o+1],w=h[vn]||null;if(typeof p=="function")w||c1(a);else if(w){var A=null;if(p&&p.hasAttribute("formAction")){if(h=p,w=p[vn]||null)A=w.formAction;else if(Kd(h)!==null)continue}else A=w.action;typeof A=="function"?a[o+1]=A:(a.splice(o,3),o-=3),c1(a)}}}function u1(){function t(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),o||setTimeout(a,20)}function a(){if(!o&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,h=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),h!==null&&(h(),h=null)}}}function Qd(t){this._internalRoot=t}dc.prototype.render=Qd.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(i(409));var a=n.current,o=al();t1(a,o,t,n,null,null)},dc.prototype.unmount=Qd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;t1(t.current,2,null,t,null,null),Xo(),n[Kn]=null}};function dc(t){this._internalRoot=t}dc.prototype.unstable_scheduleHydration=function(t){if(t){var n=Ia();t={blockedOn:null,target:t,priority:n};for(var a=0;a<Jr.length&&n!==0&&n<Jr[a].priority;a++);Jr.splice(a,0,t),a===0&&s1(t)}};var d1=l.version;if(d1!=="19.2.4")throw Error(i(527,d1,"19.2.4"));Z.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(i(188)):(t=Object.keys(t).join(","),Error(i(268,t)));return t=f(n),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var B2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:U,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var fc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fc.isDisabled&&fc.supportsFiber)try{Pe=fc.inject(B2),nt=fc}catch{}}return Ds.createRoot=function(t,n){if(!c(t))throw Error(i(299));var a=!1,o="",h=gx,p=bx,w=vx;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(h=n.onUncaughtError),n.onCaughtError!==void 0&&(p=n.onCaughtError),n.onRecoverableError!==void 0&&(w=n.onRecoverableError)),n=Pp(t,1,!1,null,null,a,o,null,h,p,w,u1),t[Kn]=n.current,zd(t),new Qd(n)},Ds.hydrateRoot=function(t,n,a){if(!c(t))throw Error(i(299));var o=!1,h="",p=gx,w=bx,A=vx,H=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!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&&(A=a.onRecoverableError),a.formState!==void 0&&(H=a.formState)),n=Pp(t,1,!0,n,a??null,o,h,H,p,w,A,u1),n.context=e1(null),a=n.current,o=al(),o=Fi(o),h=Br(o),h.callback=null,$r(a,h,o),a=o,n.current.lanes=a,nn(n,a),Il(n),t[Kn]=n.current,zd(t),new dc(n)},Ds.version="19.2.4",Ds}var k1;function W2(){if(k1)return Pd.exports;k1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(l){console.error(l)}}return e(),Pd.exports=K2(),Pd.exports}var Q2=W2();const Z2="modulepreload",J2=function(e){return"/"+e},j1={},P2=function(l,r,i){let c=Promise.resolve();if(r&&r.length>0){let d=function(f){return Promise.all(f.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=d(r.map(f=>{if(f=J2(f),f in j1)return;j1[f]=!0;const g=f.endsWith(".css"),y=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${y}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":Z2,g||(b.as="script"),b.crossOrigin="",b.href=f,x&&b.setAttribute("nonce",x),document.head.appendChild(b),g)return new Promise((v,S)=>{b.addEventListener("load",v),b.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${f}`)))})}))}function u(d){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=d,window.dispatchEvent(m),!m.defaultPrevented)throw d}return c.then(d=>{for(const m of d||[])m.status==="rejected"&&u(m.reason);return l().catch(u)})};class ev extends k.Component{constructor(){super(...arguments);f1(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(r){return{hasError:!0,error:r}}render(){var r;return this.state.hasError?s.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:s.jsxs("div",{className:"text-center max-w-md",children:[s.jsx("div",{className:"text-4xl mb-3",children:"🚨"}),s.jsx("div",{className:"text-gray-800 font-semibold mb-2",children:"Something went wrong"}),s.jsx("div",{className:"text-gray-500 text-sm mb-4",children:((r=this.state.error)==null?void 0:r.message)??"An unexpected error occurred."}),s.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-gray-800 text-white rounded-lg text-sm hover:bg-gray-700",children:"Reload"})]})}):this.props.children}}const Js="/api";async function $t(e){const l=await fetch(`${Js}${e}`);if(!l.ok)throw new Error(`API error: ${l.status}`);return l.json()}async function En(e,l){const r=await fetch(`${Js}${e}`,{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 lf(e,l){const r=await fetch(`${Js}${e}`,{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 ea(e,l){const r={method:"DELETE"};l!==void 0&&(r.headers={"Content-Type":"application/json"},r.body=JSON.stringify(l));const i=await fetch(`${Js}${e}`,r);if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()}const Ce={getCompany:()=>$t("/company"),getRoles:()=>$t("/roles"),getRole:e=>$t(`/roles/${e}`),getProjects:()=>$t("/projects"),getProject:e=>$t(`/projects/${e}`),getStandups:()=>$t("/operations/standups"),getWaves:()=>$t("/operations/waves"),getDecisions:()=>$t("/operations/decisions"),getOrgTree:()=>$t("/engine/org"),getSkills:()=>$t("/skills"),exportSkills:e=>$t(`/skills/export/${e}`),getSkillRegistry:()=>$t("/skills/registry"),installRegistrySkill:(e,l)=>En("/skills/registry/install",{skillId:e,url:l}),createRole:e=>En("/engine/roles",e),updateRole:(e,l)=>lf(`/engine/roles/${e}`,l),deleteRole:e=>ea(`/engine/roles/${e}`),getSessions:()=>$t("/sessions"),getSession:e=>$t(`/sessions/${e}`),createSession:(e,l="talk")=>En("/sessions",{roleId:e,mode:l}),deleteSession:e=>ea(`/sessions/${e}`),deleteSessions:e=>ea("/sessions",{ids:e}),deleteEmptySessions:()=>ea("/sessions?empty=true"),updateSession:(e,l)=>lf(`/sessions/${e}`,l),startJob:e=>En("/jobs",e),getJob:e=>$t(`/jobs/${e}`),listJobs:e=>{const l=new URLSearchParams;e!=null&&e.status&&l.set("status",e.status),e!=null&&e.roleId&&l.set("roleId",e.roleId);const r=l.toString();return $t(`/jobs${r?"?"+r:""}`)},abortJob:e=>ea(`/jobs/${e}`),replyToJob:(e,l)=>En(`/jobs/${e}/reply`,{message:l}),saveWave:e=>En("/waves/save",e),getStatus:()=>$t("/status"),detectEngine:()=>En("/setup/detect-engine",{}),validatePath:e=>En("/setup/validate-path",{path:e}),scaffold:e=>En("/setup/scaffold",e),getTeams:()=>$t("/setup/teams"),browse:e=>En("/setup/browse",{path:e}),connectAkb:e=>En("/setup/connect-akb",{path:e}),getKnowledge:()=>$t("/knowledge"),getKnowledgeDoc:e=>{const l=e.split("/").map(encodeURIComponent).join("/");return $t(`/knowledge/${l}`)},createKnowledgeDoc:e=>En("/knowledge",e),updateKnowledgeDoc:(e,l)=>{const r=e.split("/").map(encodeURIComponent).join("/");return fetch(`${Js}/knowledge/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:l})}).then(i=>{if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()})},deleteKnowledgeDoc:e=>{const l=e.split("/").map(encodeURIComponent).join("/");return ea(`/knowledge/${l}`)},getPreferences:()=>$t("/preferences"),updatePreferences:e=>lf("/preferences",e),chatInChannel:e=>En("/speech/chat",e),getSaveStatus:()=>$t("/save/status"),save:e=>En("/save",{message:e}),getSaveHistory:(e=20)=>$t(`/save/history?limit=${e}`),restoreSave:(e,l)=>En("/save/restore",{sha:e,paths:l}),initGit:()=>En("/save/init",{}),getCostSummary:()=>$t("/cost/summary"),getSyncRoles:()=>$t("/sync/roles"),applySyncUpdate:e=>En("/sync/apply",e),getCompanyStats:()=>$t("/sync/stats"),getGitStatus:()=>$t("/git/status"),deleteWorktree:e=>ea(`/git/worktrees/${encodeURIComponent(e)}`),deleteBranch:e=>ea(`/git/branches/${encodeURIComponent(e)}`)};function P0(e){const[l,r]=k.useState([]),[i,c]=k.useState("idle"),[u,d]=k.useState(""),[m,x]=k.useState([]),f=k.useRef(-1),g=k.useRef(null),y=k.useRef(0),b=k.useCallback(()=>{var E;if(!e)return;(E=g.current)==null||E.abort();const S=new AbortController;g.current=S,c("connecting");const j=f.current+1,C=`/api/jobs/${e}/stream?from=${j}`;fetch(C,{signal:S.signal}).then(async N=>{if(!N.ok||!N.body){c("error");return}c("streaming");const z=N.body.getReader(),O=new TextDecoder;let I="";for(;;){const{done:_,value:q}=await z.read();if(_)break;I+=O.decode(q,{stream:!0});const W=I.split(`
|
|
48
|
+
`+o.stack}}var Te=Object.prototype.hasOwnProperty,Ne=e.unstable_scheduleCallback,Ie=e.unstable_cancelCallback,Ge=e.unstable_shouldYield,Dt=e.unstable_requestPaint,ct=e.unstable_now,Ot=e.unstable_getCurrentPriorityLevel,se=e.unstable_ImmediatePriority,be=e.unstable_UserBlockingPriority,Re=e.unstable_NormalPriority,_e=e.unstable_LowPriority,xe=e.unstable_IdlePriority,De=e.log,vt=e.unstable_setDisableYieldValue,Pe=null,nt=null;function At(t){if(typeof De=="function"&&vt(t),nt&&typeof nt.setStrictMode=="function")try{nt.setStrictMode(Pe,t)}catch{}}var ut=Math.clz32?Math.clz32:Ml,tn=Math.log,yn=Math.LN2;function Ml(t){return t>>>=0,t===0?32:31-(tn(t)/yn|0)|0}var kt=256,Rl=262144,$n=4194304;function Z(t){var n=t&42;if(n!==0)return n;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Oe(t,n,a){var o=t.pendingLanes;if(o===0)return 0;var h=0,p=t.suspendedLanes,w=t.pingedLanes;t=t.warmLanes;var A=o&134217727;return A!==0?(o=A&~p,o!==0?h=Z(o):(w&=A,w!==0?h=Z(w):a||(a=A&~t,a!==0&&(h=Z(a))))):(A=o&~p,A!==0?h=Z(A):w!==0?h=Z(w):a||(a=o&~t,a!==0&&(h=Z(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 rt(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function pe(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function gt(){var t=$n;return $n<<=1,($n&62914560)===0&&($n=4194304),t}function dn(t){for(var n=[],a=0;31>a;a++)n.push(t);return n}function nn(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function br(t,n,a,o,h,p){var w=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var A=t.entanglements,H=t.expirationTimes,ee=t.hiddenUpdates;for(a=w&~a;0<a;){var oe=31-ut(a),ue=1<<oe;A[oe]=0,H[oe]=-1;var te=ee[oe];if(te!==null)for(ee[oe]=null,oe=0;oe<te.length;oe++){var re=te[oe];re!==null&&(re.lane&=-536870913)}a&=~ue}o!==0&&Ri(t,o,0),p!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=p&~(w&~n))}function Ri(t,n,a){t.pendingLanes|=n,t.suspendedLanes&=~n;var o=31-ut(n);t.entangledLanes|=n,t.entanglements[o]=t.entanglements[o]|1073741824|a&261930}function Ha(t,n){var a=t.entangledLanes|=n;for(t=t.entanglements;a;){var o=31-ut(a),h=1<<o;h&n|t[o]&n&&(t[o]|=n),a&=~h}}function Gn(t,n){var a=n&-n;return a=(a&42)!==0?1:Fi(a),(a&(t.suspendedLanes|n))!==0?0:a}function Fi(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Fl(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Ia(){var t=J.p;return t!==0?t:(t=window.event,t===void 0?32:a1(t.type))}function Ql(t,n){var a=J.p;try{return J.p=t,n()}finally{J.p=a}}var zn=Math.random().toString(36).slice(2),Vt="__reactFiber$"+zn,vn="__reactProps$"+zn,Kn="__reactContainer$"+zn,Ua="__reactEvents$"+zn,lo="__reactListeners$"+zn,_i="__reactHandles$"+zn,Oi="__reactResources$"+zn,vr="__reactMarker$"+zn;function vl(t){delete t[Vt],delete t[vn],delete t[Ua],delete t[lo],delete t[_i]}function _l(t){var n=t[Vt];if(n)return n;for(var a=t.parentNode;a;){if(n=a[Kn]||a[Vt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(t=Yp(t);t!==null;){if(a=t[Vt])return a;t=Yp(t)}return n}t=a,a=t.parentNode}return null}function Zl(t){if(t=t[Vt]||t[Kn]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function wr(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(i(33))}function kr(t){var n=t[Oi];return n||(n=t[Oi]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Zt(t){t[vr]=!0}var Wn=new Set,wl={};function Qn(t,n){jr(t,n),jr(t+"Capture",n)}function jr(t,n){for(wl[t]=n,t=0;t<n.length;t++)Wn.add(n[t])}var kl=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]*$"),It={},Ol={};function Mn(t){return Te.call(Ol,t)?!0:Te.call(It,t)?!1:kl.test(t)?Ol[t]=!0:(It[t]=!0,!1)}function Bl(t,n,a){if(Mn(n))if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var o=n.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+a)}}function Sr(t,n,a){if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttribute(n,""+a)}}function jl(t,n,a,o){if(o===null)t.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(n,a,""+o)}}function gn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Cr(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function fa(t,n,a){var o=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,p=o.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return h.call(this)},set:function(w){a=""+w,p.call(this,w)}}),Object.defineProperty(t,n,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function Bi(t){if(!t._valueTracker){var n=Cr(t)?"checked":"value";t._valueTracker=fa(t,n,""+t[n])}}function Ut(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var a=n.getValue(),o="";return t&&(o=Cr(t)?t.checked?"true":"false":t.value),t=o,t!==a?(n.setValue(t),!0):!1}function Er(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Jc=/[\n"\\]/g;function Ln(t){return t.replace(Jc,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function $i(t,n,a,o,h,p,w,A){t.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?t.type=w:t.removeAttribute("type"),n!=null?w==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+gn(n)):t.value!==""+gn(n)&&(t.value=""+gn(n)):w!=="submit"&&w!=="reset"||t.removeAttribute("value"),n!=null?ha(t,w,gn(n)):a!=null?ha(t,w,gn(a)):o!=null&&t.removeAttribute("value"),h==null&&p!=null&&(t.defaultChecked=!!p),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?t.name=""+gn(A):t.removeAttribute("name")}function Ya(t,n,a,o,h,p,w,A){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(t.type=p),n!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||n!=null)){Bi(t);return}a=a!=null?""+gn(a):"",n=n!=null?""+gn(n):a,A||n===t.value||(t.value=n),t.defaultValue=n}o=o??h,o=typeof o!="function"&&typeof o!="symbol"&&!!o,t.checked=A?t.checked:!!o,t.defaultChecked=!!o,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(t.name=w),Bi(t)}function ha(t,n,a){n==="number"&&Er(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function Nr(t,n,a,o){if(t=t.options,n){n={};for(var h=0;h<a.length;h++)n["$"+a[h]]=!0;for(a=0;a<t.length;a++)h=n.hasOwnProperty("$"+t[a].value),t[a].selected!==h&&(t[a].selected=h),h&&o&&(t[a].defaultSelected=!0)}else{for(a=""+gn(a),n=null,h=0;h<t.length;h++){if(t[h].value===a){t[h].selected=!0,o&&(t[h].defaultSelected=!0);return}n!==null||t[h].disabled||(n=t[h])}n!==null&&(n.selected=!0)}}function ro(t,n,a){if(n!=null&&(n=""+gn(n),n!==t.value&&(t.value=n),a==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=a!=null?""+gn(a):""}function Li(t,n,a,o){if(n==null){if(o!=null){if(a!=null)throw Error(i(92));if(V(o)){if(1<o.length)throw Error(i(93));o=o[0]}a=o}a==null&&(a=""),n=a}a=gn(n),t.defaultValue=a,o=t.textContent,o===a&&o!==""&&o!==null&&(t.value=o),Bi(t)}function Ar(t,n){if(n){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=n;return}}t.textContent=n}var Pc=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 ao(t,n,a){var o=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":o?t.setProperty(n,a):typeof a!="number"||a===0||Pc.has(n)?n==="float"?t.cssFloat=a:t[n]=(""+a).trim():t[n]=a+"px"}function io(t,n,a){if(n!=null&&typeof n!="object")throw Error(i(62));if(t=t.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||n!=null&&n.hasOwnProperty(o)||(o.indexOf("--")===0?t.setProperty(o,""):o==="float"?t.cssFloat="":t[o]="");for(var h in n)o=n[h],n.hasOwnProperty(h)&&a[h]!==o&&ao(t,h,o)}else for(var p in n)n.hasOwnProperty(p)&&ao(t,p,n[p])}function Hi(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var eu=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"]]),tu=/^[\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 Zn(t){return tu.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Jn(){}var Ii=null;function Ui(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Rn=null,Jl=null;function so(t){var n=Zl(t);if(n&&(t=n.stateNode)){var a=t[vn]||null;e:switch(t=n.stateNode,n.type){case"input":if($i(t,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Ln(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var o=a[n];if(o!==t&&o.form===t.form){var h=o[vn]||null;if(!h)throw Error(i(90));$i(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(n=0;n<a.length;n++)o=a[n],o.form===t.form&&Ut(o)}break e;case"textarea":ro(t,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Nr(t,!!a.multiple,n,!1)}}}var Yi=!1;function fn(t,n,a){if(Yi)return t(n,a);Yi=!0;try{var o=t(n);return o}finally{if(Yi=!1,(Rn!==null||Jl!==null)&&(Xo(),Rn&&(n=Rn,t=Jl,Jl=Rn=null,so(n),t)))for(n=0;n<t.length;n++)so(t[n])}}function Sl(t,n){var a=t.stateNode;if(a===null)return null;var o=a[vn]||null;if(o===null)return null;a=o[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(t=t.type,o=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!o;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(i(231,n,typeof a));return a}var cl=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qa=!1;if(cl)try{var Dr={};Object.defineProperty(Dr,"passive",{get:function(){qa=!0}}),window.addEventListener("test",Dr,Dr),window.removeEventListener("test",Dr,Dr)}catch{qa=!1}var F=null,le=null,ae=null;function me(){if(ae)return ae;var t,n=le,a=n.length,o,h="value"in F?F.value:F.textContent,p=h.length;for(t=0;t<a&&n[t]===h[t];t++);var w=a-t;for(o=1;o<=w&&n[a-o]===h[p-o];o++);return ae=h.slice(t,1<o?1-o:void 0)}function we(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function Je(){return!0}function qe(){return!1}function Ae(t){function n(a,o,h,p,w){this._reactName=a,this._targetInst=h,this.type=o,this.nativeEvent=p,this.target=w,this.currentTarget=null;for(var A in t)t.hasOwnProperty(A)&&(a=t[A],this[A]=a?a(p):p[A]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Je:qe,this.isPropagationStopped=qe,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=Je)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Je)},persist:function(){},isPersistent:Je}),n}var Ke={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},We=Ae(Ke),Xe=y({},Ke,{view:0,detail:0}),oo=Ae(Xe),Tr,zr,ma,Gt=y({},Xe,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nu,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ma&&(ma&&t.type==="mousemove"?(Tr=t.screenX-ma.screenX,zr=t.screenY-ma.screenY):zr=Tr=0,ma=t),Tr)},movementY:function(t){return"movementY"in t?t.movementY:zr}}),Pl=Ae(Gt),Cl=y({},Gt,{dataTransfer:0}),wn=Ae(Cl),qi=y({},Xe,{relatedTarget:0}),Wt=Ae(qi),Ig=y({},Ke,{animationName:0,elapsedTime:0,pseudoElement:0}),Ug=Ae(Ig),Yg=y({},Ke,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),qg=Ae(Yg),Xg=y({},Ke,{data:0}),Lh=Ae(Xg),Vg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Gg={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"},Kg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Wg(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=Kg[t])?!!n[t]:!1}function nu(){return Wg}var Qg=y({},Xe,{key:function(t){if(t.key){var n=Vg[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=we(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Gg[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nu,charCode:function(t){return t.type==="keypress"?we(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?we(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Zg=Ae(Qg),Jg=y({},Gt,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Hh=Ae(Jg),Pg=y({},Xe,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nu}),eb=Ae(Pg),tb=y({},Ke,{propertyName:0,elapsedTime:0,pseudoElement:0}),nb=Ae(tb),lb=y({},Gt,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),rb=Ae(lb),ab=y({},Ke,{newState:0,oldState:0}),ib=Ae(ab),sb=[9,13,27,32],lu=cl&&"CompositionEvent"in window,Xi=null;cl&&"documentMode"in document&&(Xi=document.documentMode);var ob=cl&&"TextEvent"in window&&!Xi,Ih=cl&&(!lu||Xi&&8<Xi&&11>=Xi),Uh=" ",Yh=!1;function qh(t,n){switch(t){case"keyup":return sb.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xh(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Xa=!1;function cb(t,n){switch(t){case"compositionend":return Xh(n);case"keypress":return n.which!==32?null:(Yh=!0,Uh);case"textInput":return t=n.data,t===Uh&&Yh?null:t;default:return null}}function ub(t,n){if(Xa)return t==="compositionend"||!lu&&qh(t,n)?(t=me(),ae=le=F=null,Xa=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Ih&&n.locale!=="ko"?null:n.data;default:return null}}var db={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 Vh(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!db[t.type]:n==="textarea"}function Gh(t,n,a,o){Rn?Jl?Jl.push(o):Jl=[o]:Rn=o,n=Jo(n,"onChange"),0<n.length&&(a=new We("onChange","change",null,a,o),t.push({event:a,listeners:n}))}var Vi=null,Gi=null;function fb(t){Dp(t,0)}function co(t){var n=wr(t);if(Ut(n))return t}function Kh(t,n){if(t==="change")return n}var Wh=!1;if(cl){var ru;if(cl){var au="oninput"in document;if(!au){var Qh=document.createElement("div");Qh.setAttribute("oninput","return;"),au=typeof Qh.oninput=="function"}ru=au}else ru=!1;Wh=ru&&(!document.documentMode||9<document.documentMode)}function Zh(){Vi&&(Vi.detachEvent("onpropertychange",Jh),Gi=Vi=null)}function Jh(t){if(t.propertyName==="value"&&co(Gi)){var n=[];Gh(n,Gi,t,Ui(t)),fn(fb,n)}}function hb(t,n,a){t==="focusin"?(Zh(),Vi=n,Gi=a,Vi.attachEvent("onpropertychange",Jh)):t==="focusout"&&Zh()}function mb(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return co(Gi)}function xb(t,n){if(t==="click")return co(n)}function pb(t,n){if(t==="input"||t==="change")return co(n)}function yb(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var Pn=typeof Object.is=="function"?Object.is:yb;function Ki(t,n){if(Pn(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var a=Object.keys(t),o=Object.keys(n);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var h=a[o];if(!Te.call(n,h)||!Pn(t[h],n[h]))return!1}return!0}function Ph(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function em(t,n){var a=Ph(t);t=0;for(var o;a;){if(a.nodeType===3){if(o=t+a.textContent.length,t<=n&&o>=n)return{node:a,offset:n-t};t=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Ph(a)}}function tm(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?tm(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function nm(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=Er(t.document);n instanceof t.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)t=n.contentWindow;else break;n=Er(t.document)}return n}function iu(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var gb=cl&&"documentMode"in document&&11>=document.documentMode,Va=null,su=null,Wi=null,ou=!1;function lm(t,n,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;ou||Va==null||Va!==Er(o)||(o=Va,"selectionStart"in o&&iu(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Wi&&Ki(Wi,o)||(Wi=o,o=Jo(su,"onSelect"),0<o.length&&(n=new We("onSelect","select",null,n,a),t.push({event:n,listeners:o}),n.target=Va)))}function xa(t,n){var a={};return a[t.toLowerCase()]=n.toLowerCase(),a["Webkit"+t]="webkit"+n,a["Moz"+t]="moz"+n,a}var Ga={animationend:xa("Animation","AnimationEnd"),animationiteration:xa("Animation","AnimationIteration"),animationstart:xa("Animation","AnimationStart"),transitionrun:xa("Transition","TransitionRun"),transitionstart:xa("Transition","TransitionStart"),transitioncancel:xa("Transition","TransitionCancel"),transitionend:xa("Transition","TransitionEnd")},cu={},rm={};cl&&(rm=document.createElement("div").style,"AnimationEvent"in window||(delete Ga.animationend.animation,delete Ga.animationiteration.animation,delete Ga.animationstart.animation),"TransitionEvent"in window||delete Ga.transitionend.transition);function pa(t){if(cu[t])return cu[t];if(!Ga[t])return t;var n=Ga[t],a;for(a in n)if(n.hasOwnProperty(a)&&a in rm)return cu[t]=n[a];return t}var am=pa("animationend"),im=pa("animationiteration"),sm=pa("animationstart"),bb=pa("transitionrun"),vb=pa("transitionstart"),wb=pa("transitioncancel"),om=pa("transitionend"),cm=new Map,uu="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(" ");uu.push("scrollEnd");function El(t,n){cm.set(t,n),Qn(n,[t])}var uo=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},ul=[],Ka=0,du=0;function fo(){for(var t=Ka,n=du=Ka=0;n<t;){var a=ul[n];ul[n++]=null;var o=ul[n];ul[n++]=null;var h=ul[n];ul[n++]=null;var p=ul[n];if(ul[n++]=null,o!==null&&h!==null){var w=o.pending;w===null?h.next=h:(h.next=w.next,w.next=h),o.pending=h}p!==0&&um(a,h,p)}}function ho(t,n,a,o){ul[Ka++]=t,ul[Ka++]=n,ul[Ka++]=a,ul[Ka++]=o,du|=o,t.lanes|=o,t=t.alternate,t!==null&&(t.lanes|=o)}function fu(t,n,a,o){return ho(t,n,a,o),mo(t)}function ya(t,n){return ho(t,null,null,n),mo(t)}function um(t,n,a){t.lanes|=a;var o=t.alternate;o!==null&&(o.lanes|=a);for(var h=!1,p=t.return;p!==null;)p.childLanes|=a,o=p.alternate,o!==null&&(o.childLanes|=a),p.tag===22&&(t=p.stateNode,t===null||t._visibility&1||(h=!0)),t=p,p=p.return;return t.tag===3?(p=t.stateNode,h&&n!==null&&(h=31-ut(a),t=p.hiddenUpdates,o=t[h],o===null?t[h]=[n]:o.push(n),n.lane=a|536870912),p):null}function mo(t){if(50<ys)throw ys=0,wd=null,Error(i(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var Wa={};function kb(t,n,a,o){this.tag=t,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=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function el(t,n,a,o){return new kb(t,n,a,o)}function hu(t){return t=t.prototype,!(!t||!t.isReactComponent)}function er(t,n){var a=t.alternate;return a===null?(a=el(t.tag,n,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=n,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&65011712,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,n=t.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a.refCleanup=t.refCleanup,a}function dm(t,n){t.flags&=65011714;var a=t.alternate;return a===null?(t.childLanes=0,t.lanes=n,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=a.childLanes,t.lanes=a.lanes,t.child=a.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=a.memoizedProps,t.memoizedState=a.memoizedState,t.updateQueue=a.updateQueue,t.type=a.type,n=a.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function xo(t,n,a,o,h,p){var w=0;if(o=t,typeof t=="function")hu(t)&&(w=1);else if(typeof t=="string")w=N2(t,a,de.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case Y:return t=el(31,a,n,h),t.elementType=Y,t.lanes=p,t;case j:return ga(a.children,h,p,n);case C:w=8,h|=24;break;case E:return t=el(12,a,n,h|2),t.elementType=E,t.lanes=p,t;case I:return t=el(13,a,n,h),t.elementType=I,t.lanes=p,t;case _:return t=el(19,a,n,h),t.elementType=_,t.lanes=p,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case z:w=10;break e;case N:w=9;break e;case O:w=11;break e;case q:w=14;break e;case W:w=16,o=null;break e}w=29,a=Error(i(130,t===null?"null":typeof t,"")),o=null}return n=el(w,a,n,h),n.elementType=t,n.type=o,n.lanes=p,n}function ga(t,n,a,o){return t=el(7,t,o,n),t.lanes=a,t}function mu(t,n,a){return t=el(6,t,null,n),t.lanes=a,t}function fm(t){var n=el(18,null,null,0);return n.stateNode=t,n}function xu(t,n,a){return n=el(4,t.children!==null?t.children:[],t.key,n),n.lanes=a,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var hm=new WeakMap;function dl(t,n){if(typeof t=="object"&&t!==null){var a=hm.get(t);return a!==void 0?a:(n={value:t,source:n,stack:ze(n)},hm.set(t,n),n)}return{value:t,source:n,stack:ze(n)}}var Qa=[],Za=0,po=null,Qi=0,fl=[],hl=0,Mr=null,$l=1,Ll="";function tr(t,n){Qa[Za++]=Qi,Qa[Za++]=po,po=t,Qi=n}function mm(t,n,a){fl[hl++]=$l,fl[hl++]=Ll,fl[hl++]=Mr,Mr=t;var o=$l;t=Ll;var h=32-ut(o)-1;o&=~(1<<h),a+=1;var p=32-ut(n)+h;if(30<p){var w=h-h%5;p=(o&(1<<w)-1).toString(32),o>>=w,h-=w,$l=1<<32-ut(n)+h|a<<h|o,Ll=p+t}else $l=1<<p|a<<h|o,Ll=t}function pu(t){t.return!==null&&(tr(t,1),mm(t,1,0))}function yu(t){for(;t===po;)po=Qa[--Za],Qa[Za]=null,Qi=Qa[--Za],Qa[Za]=null;for(;t===Mr;)Mr=fl[--hl],fl[hl]=null,Ll=fl[--hl],fl[hl]=null,$l=fl[--hl],fl[hl]=null}function xm(t,n){fl[hl++]=$l,fl[hl++]=Ll,fl[hl++]=Mr,$l=n.id,Ll=n.overflow,Mr=t}var kn=null,Yt=null,bt=!1,Rr=null,ml=!1,gu=Error(i(519));function Fr(t){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Zi(dl(n,t)),gu}function pm(t){var n=t.stateNode,a=t.type,o=t.memoizedProps;switch(n[Vt]=t,n[vn]=o,a){case"dialog":ft("cancel",n),ft("close",n);break;case"iframe":case"object":case"embed":ft("load",n);break;case"video":case"audio":for(a=0;a<bs.length;a++)ft(bs[a],n);break;case"source":ft("error",n);break;case"img":case"image":case"link":ft("error",n),ft("load",n);break;case"details":ft("toggle",n);break;case"input":ft("invalid",n),Ya(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":ft("invalid",n);break;case"textarea":ft("invalid",n),Li(n,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||o.suppressHydrationWarning===!0||Rp(n.textContent,a)?(o.popover!=null&&(ft("beforetoggle",n),ft("toggle",n)),o.onScroll!=null&&ft("scroll",n),o.onScrollEnd!=null&&ft("scrollend",n),o.onClick!=null&&(n.onclick=Jn),n=!0):n=!1,n||Fr(t,!0)}function ym(t){for(kn=t.return;kn;)switch(kn.tag){case 5:case 31:case 13:ml=!1;return;case 27:case 3:ml=!0;return;default:kn=kn.return}}function Ja(t){if(t!==kn)return!1;if(!bt)return ym(t),bt=!0,!1;var n=t.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||Od(t.type,t.memoizedProps)),a=!a),a&&Yt&&Fr(t),ym(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));Yt=Up(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));Yt=Up(t)}else n===27?(n=Yt,Kr(t.type)?(t=Id,Id=null,Yt=t):Yt=n):Yt=kn?pl(t.stateNode.nextSibling):null;return!0}function ba(){Yt=kn=null,bt=!1}function bu(){var t=Rr;return t!==null&&(Yn===null?Yn=t:Yn.push.apply(Yn,t),Rr=null),t}function Zi(t){Rr===null?Rr=[t]:Rr.push(t)}var vu=M(null),va=null,nr=null;function _r(t,n,a){D(vu,n._currentValue),n._currentValue=a}function lr(t){t._currentValue=vu.current,K(vu)}function wu(t,n,a){for(;t!==null;){var o=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),t===a)break;t=t.return}}function ku(t,n,a,o){var h=t.child;for(h!==null&&(h.return=t);h!==null;){var p=h.dependencies;if(p!==null){var w=h.child;p=p.firstContext;e:for(;p!==null;){var A=p;p=h;for(var H=0;H<n.length;H++)if(A.context===n[H]){p.lanes|=a,A=p.alternate,A!==null&&(A.lanes|=a),wu(p.return,a,t),o||(w=null);break e}p=A.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),wu(w,a,t),w=null}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===t){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}}function Pa(t,n,a,o){t=null;for(var h=n,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var w=h.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var A=h.type;Pn(h.pendingProps.value,w.value)||(t!==null?t.push(A):t=[A])}}else if(h===Fe.current){if(w=h.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(Ss):t=[Ss])}h=h.return}t!==null&&ku(n,t,a,o),n.flags|=262144}function yo(t){for(t=t.firstContext;t!==null;){if(!Pn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function wa(t){va=t,nr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function jn(t){return gm(va,t)}function go(t,n){return va===null&&wa(t),gm(t,n)}function gm(t,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},nr===null){if(t===null)throw Error(i(308));nr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else nr=nr.next=n;return a}var jb=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(a,o){t.push(o)}};this.abort=function(){n.aborted=!0,t.forEach(function(a){return a()})}},Sb=e.unstable_scheduleCallback,Cb=e.unstable_NormalPriority,an={$$typeof:z,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ju(){return{controller:new jb,data:new Map,refCount:0}}function Ji(t){t.refCount--,t.refCount===0&&Sb(Cb,function(){t.controller.abort()})}var Pi=null,Su=0,ei=0,ti=null;function Eb(t,n){if(Pi===null){var a=Pi=[];Su=0,ei=Nd(),ti={status:"pending",value:void 0,then:function(o){a.push(o)}}}return Su++,n.then(bm,bm),n}function bm(){if(--Su===0&&Pi!==null){ti!==null&&(ti.status="fulfilled");var t=Pi;Pi=null,ei=0,ti=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function Nb(t,n){var a=[],o={status:"pending",value:null,reason:null,then:function(h){a.push(h)}};return t.then(function(){o.status="fulfilled",o.value=n;for(var h=0;h<a.length;h++)(0,a[h])(n)},function(h){for(o.status="rejected",o.reason=h,h=0;h<a.length;h++)(0,a[h])(void 0)}),o}var vm=U.S;U.S=function(t,n){lp=ct(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Eb(t,n),vm!==null&&vm(t,n)};var ka=M(null);function Cu(){var t=ka.current;return t!==null?t:Bt.pooledCache}function bo(t,n){n===null?D(ka,ka.current):D(ka,n.pool)}function wm(){var t=Cu();return t===null?null:{parent:an._currentValue,pool:t}}var ni=Error(i(460)),Eu=Error(i(474)),vo=Error(i(542)),wo={then:function(){}};function km(t){return t=t.status,t==="fulfilled"||t==="rejected"}function jm(t,n,a){switch(a=t[a],a===void 0?t.push(n):a!==n&&(n.then(Jn,Jn),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,Cm(t),t;default:if(typeof n.status=="string")n.then(Jn,Jn);else{if(t=Bt,t!==null&&100<t.shellSuspendCounter)throw Error(i(482));t=n,t.status="pending",t.then(function(o){if(n.status==="pending"){var h=n;h.status="fulfilled",h.value=o}},function(o){if(n.status==="pending"){var h=n;h.status="rejected",h.reason=o}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,Cm(t),t}throw Sa=n,ni}}function ja(t){try{var n=t._init;return n(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Sa=a,ni):a}}var Sa=null;function Sm(){if(Sa===null)throw Error(i(459));var t=Sa;return Sa=null,t}function Cm(t){if(t===ni||t===vo)throw Error(i(483))}var li=null,es=0;function ko(t){var n=es;return es+=1,li===null&&(li=[]),jm(li,t,n)}function ts(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function jo(t,n){throw n.$$typeof===b?Error(i(525)):(t=Object.prototype.toString.call(n),Error(i(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function Em(t){function n(Q,X){if(t){var P=Q.deletions;P===null?(Q.deletions=[X],Q.flags|=16):P.push(X)}}function a(Q,X){if(!t)return null;for(;X!==null;)n(Q,X),X=X.sibling;return null}function o(Q){for(var X=new Map;Q!==null;)Q.key!==null?X.set(Q.key,Q):X.set(Q.index,Q),Q=Q.sibling;return X}function h(Q,X){return Q=er(Q,X),Q.index=0,Q.sibling=null,Q}function p(Q,X,P){return Q.index=P,t?(P=Q.alternate,P!==null?(P=P.index,P<X?(Q.flags|=67108866,X):P):(Q.flags|=67108866,X)):(Q.flags|=1048576,X)}function w(Q){return t&&Q.alternate===null&&(Q.flags|=67108866),Q}function A(Q,X,P,ce){return X===null||X.tag!==6?(X=mu(P,Q.mode,ce),X.return=Q,X):(X=h(X,P),X.return=Q,X)}function H(Q,X,P,ce){var Ye=P.type;return Ye===j?oe(Q,X,P.props.children,ce,P.key):X!==null&&(X.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===W&&ja(Ye)===X.type)?(X=h(X,P.props),ts(X,P),X.return=Q,X):(X=xo(P.type,P.key,P.props,null,Q.mode,ce),ts(X,P),X.return=Q,X)}function ee(Q,X,P,ce){return X===null||X.tag!==4||X.stateNode.containerInfo!==P.containerInfo||X.stateNode.implementation!==P.implementation?(X=xu(P,Q.mode,ce),X.return=Q,X):(X=h(X,P.children||[]),X.return=Q,X)}function oe(Q,X,P,ce,Ye){return X===null||X.tag!==7?(X=ga(P,Q.mode,ce,Ye),X.return=Q,X):(X=h(X,P),X.return=Q,X)}function ue(Q,X,P){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return X=mu(""+X,Q.mode,P),X.return=Q,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case v:return P=xo(X.type,X.key,X.props,null,Q.mode,P),ts(P,X),P.return=Q,P;case S:return X=xu(X,Q.mode,P),X.return=Q,X;case W:return X=ja(X),ue(Q,X,P)}if(V(X)||B(X))return X=ga(X,Q.mode,P,null),X.return=Q,X;if(typeof X.then=="function")return ue(Q,ko(X),P);if(X.$$typeof===z)return ue(Q,go(Q,X),P);jo(Q,X)}return null}function te(Q,X,P,ce){var Ye=X!==null?X.key:null;if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return Ye!==null?null:A(Q,X,""+P,ce);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case v:return P.key===Ye?H(Q,X,P,ce):null;case S:return P.key===Ye?ee(Q,X,P,ce):null;case W:return P=ja(P),te(Q,X,P,ce)}if(V(P)||B(P))return Ye!==null?null:oe(Q,X,P,ce,null);if(typeof P.then=="function")return te(Q,X,ko(P),ce);if(P.$$typeof===z)return te(Q,X,go(Q,P),ce);jo(Q,P)}return null}function re(Q,X,P,ce,Ye){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return Q=Q.get(P)||null,A(X,Q,""+ce,Ye);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case v:return Q=Q.get(ce.key===null?P:ce.key)||null,H(X,Q,ce,Ye);case S:return Q=Q.get(ce.key===null?P:ce.key)||null,ee(X,Q,ce,Ye);case W:return ce=ja(ce),re(Q,X,P,ce,Ye)}if(V(ce)||B(ce))return Q=Q.get(P)||null,oe(X,Q,ce,Ye,null);if(typeof ce.then=="function")return re(Q,X,P,ko(ce),Ye);if(ce.$$typeof===z)return re(Q,X,P,go(X,ce),Ye);jo(X,ce)}return null}function Be(Q,X,P,ce){for(var Ye=null,jt=null,He=X,at=X=0,pt=null;He!==null&&at<P.length;at++){He.index>at?(pt=He,He=null):pt=He.sibling;var St=te(Q,He,P[at],ce);if(St===null){He===null&&(He=pt);break}t&&He&&St.alternate===null&&n(Q,He),X=p(St,X,at),jt===null?Ye=St:jt.sibling=St,jt=St,He=pt}if(at===P.length)return a(Q,He),bt&&tr(Q,at),Ye;if(He===null){for(;at<P.length;at++)He=ue(Q,P[at],ce),He!==null&&(X=p(He,X,at),jt===null?Ye=He:jt.sibling=He,jt=He);return bt&&tr(Q,at),Ye}for(He=o(He);at<P.length;at++)pt=re(He,Q,at,P[at],ce),pt!==null&&(t&&pt.alternate!==null&&He.delete(pt.key===null?at:pt.key),X=p(pt,X,at),jt===null?Ye=pt:jt.sibling=pt,jt=pt);return t&&He.forEach(function(Pr){return n(Q,Pr)}),bt&&tr(Q,at),Ye}function Qe(Q,X,P,ce){if(P==null)throw Error(i(151));for(var Ye=null,jt=null,He=X,at=X=0,pt=null,St=P.next();He!==null&&!St.done;at++,St=P.next()){He.index>at?(pt=He,He=null):pt=He.sibling;var Pr=te(Q,He,St.value,ce);if(Pr===null){He===null&&(He=pt);break}t&&He&&Pr.alternate===null&&n(Q,He),X=p(Pr,X,at),jt===null?Ye=Pr:jt.sibling=Pr,jt=Pr,He=pt}if(St.done)return a(Q,He),bt&&tr(Q,at),Ye;if(He===null){for(;!St.done;at++,St=P.next())St=ue(Q,St.value,ce),St!==null&&(X=p(St,X,at),jt===null?Ye=St:jt.sibling=St,jt=St);return bt&&tr(Q,at),Ye}for(He=o(He);!St.done;at++,St=P.next())St=re(He,Q,at,St.value,ce),St!==null&&(t&&St.alternate!==null&&He.delete(St.key===null?at:St.key),X=p(St,X,at),jt===null?Ye=St:jt.sibling=St,jt=St);return t&&He.forEach(function($2){return n(Q,$2)}),bt&&tr(Q,at),Ye}function Ft(Q,X,P,ce){if(typeof P=="object"&&P!==null&&P.type===j&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case v:e:{for(var Ye=P.key;X!==null;){if(X.key===Ye){if(Ye=P.type,Ye===j){if(X.tag===7){a(Q,X.sibling),ce=h(X,P.props.children),ce.return=Q,Q=ce;break e}}else if(X.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===W&&ja(Ye)===X.type){a(Q,X.sibling),ce=h(X,P.props),ts(ce,P),ce.return=Q,Q=ce;break e}a(Q,X);break}else n(Q,X);X=X.sibling}P.type===j?(ce=ga(P.props.children,Q.mode,ce,P.key),ce.return=Q,Q=ce):(ce=xo(P.type,P.key,P.props,null,Q.mode,ce),ts(ce,P),ce.return=Q,Q=ce)}return w(Q);case S:e:{for(Ye=P.key;X!==null;){if(X.key===Ye)if(X.tag===4&&X.stateNode.containerInfo===P.containerInfo&&X.stateNode.implementation===P.implementation){a(Q,X.sibling),ce=h(X,P.children||[]),ce.return=Q,Q=ce;break e}else{a(Q,X);break}else n(Q,X);X=X.sibling}ce=xu(P,Q.mode,ce),ce.return=Q,Q=ce}return w(Q);case W:return P=ja(P),Ft(Q,X,P,ce)}if(V(P))return Be(Q,X,P,ce);if(B(P)){if(Ye=B(P),typeof Ye!="function")throw Error(i(150));return P=Ye.call(P),Qe(Q,X,P,ce)}if(typeof P.then=="function")return Ft(Q,X,ko(P),ce);if(P.$$typeof===z)return Ft(Q,X,go(Q,P),ce);jo(Q,P)}return typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint"?(P=""+P,X!==null&&X.tag===6?(a(Q,X.sibling),ce=h(X,P),ce.return=Q,Q=ce):(a(Q,X),ce=mu(P,Q.mode,ce),ce.return=Q,Q=ce),w(Q)):a(Q,X)}return function(Q,X,P,ce){try{es=0;var Ye=Ft(Q,X,P,ce);return li=null,Ye}catch(He){if(He===ni||He===vo)throw He;var jt=el(29,He,null,Q.mode);return jt.lanes=ce,jt.return=Q,jt}finally{}}}var Ca=Em(!0),Nm=Em(!1),Or=!1;function Nu(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Au(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Br(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function $r(t,n,a){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(Et&2)!==0){var h=o.pending;return h===null?n.next=n:(n.next=h.next,h.next=n),o.pending=n,n=mo(t),um(t,null,a),n}return ho(t,o,n,a),mo(t)}function ns(t,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var o=n.lanes;o&=t.pendingLanes,a|=o,n.lanes=a,Ha(t,a)}}function Du(t,n){var a=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,a===o)){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:o.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=n:t.next=n,a.lastBaseUpdate=n}var Tu=!1;function ls(){if(Tu){var t=ti;if(t!==null)throw t}}function rs(t,n,a,o){Tu=!1;var h=t.updateQueue;Or=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,A=h.shared.pending;if(A!==null){h.shared.pending=null;var H=A,ee=H.next;H.next=null,w===null?p=ee:w.next=ee,w=H;var oe=t.alternate;oe!==null&&(oe=oe.updateQueue,A=oe.lastBaseUpdate,A!==w&&(A===null?oe.firstBaseUpdate=ee:A.next=ee,oe.lastBaseUpdate=H))}if(p!==null){var ue=h.baseState;w=0,oe=ee=H=null,A=p;do{var te=A.lane&-536870913,re=te!==A.lane;if(re?(xt&te)===te:(o&te)===te){te!==0&&te===ei&&(Tu=!0),oe!==null&&(oe=oe.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var Be=t,Qe=A;te=n;var Ft=a;switch(Qe.tag){case 1:if(Be=Qe.payload,typeof Be=="function"){ue=Be.call(Ft,ue,te);break e}ue=Be;break e;case 3:Be.flags=Be.flags&-65537|128;case 0:if(Be=Qe.payload,te=typeof Be=="function"?Be.call(Ft,ue,te):Be,te==null)break e;ue=y({},ue,te);break e;case 2:Or=!0}}te=A.callback,te!==null&&(t.flags|=64,re&&(t.flags|=8192),re=h.callbacks,re===null?h.callbacks=[te]:re.push(te))}else re={lane:te,tag:A.tag,payload:A.payload,callback:A.callback,next:null},oe===null?(ee=oe=re,H=ue):oe=oe.next=re,w|=te;if(A=A.next,A===null){if(A=h.shared.pending,A===null)break;re=A,A=re.next,re.next=null,h.lastBaseUpdate=re,h.shared.pending=null}}while(!0);oe===null&&(H=ue),h.baseState=H,h.firstBaseUpdate=ee,h.lastBaseUpdate=oe,p===null&&(h.shared.lanes=0),Yr|=w,t.lanes=w,t.memoizedState=ue}}function Am(t,n){if(typeof t!="function")throw Error(i(191,t));t.call(n)}function Dm(t,n){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)Am(a[t],n)}var ri=M(null),So=M(0);function Tm(t,n){t=fr,D(So,t),D(ri,n),fr=t|n.baseLanes}function zu(){D(So,fr),D(ri,ri.current)}function Mu(){fr=So.current,K(ri),K(So)}var tl=M(null),xl=null;function Lr(t){var n=t.alternate;D(ln,ln.current&1),D(tl,t),xl===null&&(n===null||ri.current!==null||n.memoizedState!==null)&&(xl=t)}function Ru(t){D(ln,ln.current),D(tl,t),xl===null&&(xl=t)}function zm(t){t.tag===22?(D(ln,ln.current),D(tl,t),xl===null&&(xl=t)):Hr()}function Hr(){D(ln,ln.current),D(tl,tl.current)}function nl(t){K(tl),xl===t&&(xl=null),K(ln)}var ln=M(0);function Co(t){for(var n=t;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Ld(a)||Hd(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===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var rr=0,lt=null,Mt=null,sn=null,Eo=!1,ai=!1,Ea=!1,No=0,as=0,ii=null,Ab=0;function Jt(){throw Error(i(321))}function Fu(t,n){if(n===null)return!1;for(var a=0;a<n.length&&a<t.length;a++)if(!Pn(t[a],n[a]))return!1;return!0}function _u(t,n,a,o,h,p){return rr=p,lt=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,U.H=t===null||t.memoizedState===null?mx:Qu,Ea=!1,p=a(o,h),Ea=!1,ai&&(p=Rm(n,a,o,h)),Mm(t),p}function Mm(t){U.H=os;var n=Mt!==null&&Mt.next!==null;if(rr=0,sn=Mt=lt=null,Eo=!1,as=0,ii=null,n)throw Error(i(300));t===null||on||(t=t.dependencies,t!==null&&yo(t)&&(on=!0))}function Rm(t,n,a,o){lt=t;var h=0;do{if(ai&&(ii=null),as=0,ai=!1,25<=h)throw Error(i(301));if(h+=1,sn=Mt=null,t.updateQueue!=null){var p=t.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}U.H=xx,p=n(a,o)}while(ai);return p}function Db(){var t=U.H,n=t.useState()[0];return n=typeof n.then=="function"?is(n):n,t=t.useState()[0],(Mt!==null?Mt.memoizedState:null)!==t&&(lt.flags|=1024),n}function Ou(){var t=No!==0;return No=0,t}function Bu(t,n,a){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~a}function $u(t){if(Eo){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}Eo=!1}rr=0,sn=Mt=lt=null,ai=!1,as=No=0,ii=null}function Fn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return sn===null?lt.memoizedState=sn=t:sn=sn.next=t,sn}function rn(){if(Mt===null){var t=lt.alternate;t=t!==null?t.memoizedState:null}else t=Mt.next;var n=sn===null?lt.memoizedState:sn.next;if(n!==null)sn=n,Mt=t;else{if(t===null)throw lt.alternate===null?Error(i(467)):Error(i(310));Mt=t,t={memoizedState:Mt.memoizedState,baseState:Mt.baseState,baseQueue:Mt.baseQueue,queue:Mt.queue,next:null},sn===null?lt.memoizedState=sn=t:sn=sn.next=t}return sn}function Ao(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function is(t){var n=as;return as+=1,ii===null&&(ii=[]),t=jm(ii,t,n),n=lt,(sn===null?n.memoizedState:sn.next)===null&&(n=n.alternate,U.H=n===null||n.memoizedState===null?mx:Qu),t}function Do(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return is(t);if(t.$$typeof===z)return jn(t)}throw Error(i(438,String(t)))}function Lu(t){var n=null,a=lt.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var o=lt.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(n={data:o.data.map(function(h){return h.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Ao(),lt.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(t),o=0;o<t;o++)a[o]=T;return n.index++,a}function ar(t,n){return typeof n=="function"?n(t):n}function To(t){var n=rn();return Hu(n,Mt,t)}function Hu(t,n,a){var o=t.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=a;var h=t.baseQueue,p=o.pending;if(p!==null){if(h!==null){var w=h.next;h.next=p.next,p.next=w}n.baseQueue=h=p,o.pending=null}if(p=t.baseState,h===null)t.memoizedState=p;else{n=h.next;var A=w=null,H=null,ee=n,oe=!1;do{var ue=ee.lane&-536870913;if(ue!==ee.lane?(xt&ue)===ue:(rr&ue)===ue){var te=ee.revertLane;if(te===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),ue===ei&&(oe=!0);else if((rr&te)===te){ee=ee.next,te===ei&&(oe=!0);continue}else ue={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(A=H=ue,w=p):H=H.next=ue,lt.lanes|=te,Yr|=te;ue=ee.action,Ea&&a(p,ue),p=ee.hasEagerState?ee.eagerState:a(p,ue)}else te={lane:ue,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(A=H=te,w=p):H=H.next=te,lt.lanes|=ue,Yr|=ue;ee=ee.next}while(ee!==null&&ee!==n);if(H===null?w=p:H.next=A,!Pn(p,t.memoizedState)&&(on=!0,oe&&(a=ti,a!==null)))throw a;t.memoizedState=p,t.baseState=w,t.baseQueue=H,o.lastRenderedState=p}return h===null&&(o.lanes=0),[t.memoizedState,o.dispatch]}function Iu(t){var n=rn(),a=n.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=t;var o=a.dispatch,h=a.pending,p=n.memoizedState;if(h!==null){a.pending=null;var w=h=h.next;do p=t(p,w.action),w=w.next;while(w!==h);Pn(p,n.memoizedState)||(on=!0),n.memoizedState=p,n.baseQueue===null&&(n.baseState=p),a.lastRenderedState=p}return[p,o]}function Fm(t,n,a){var o=lt,h=rn(),p=bt;if(p){if(a===void 0)throw Error(i(407));a=a()}else a=n();var w=!Pn((Mt||h).memoizedState,a);if(w&&(h.memoizedState=a,on=!0),h=h.queue,qu(Bm.bind(null,o,h,t),[t]),h.getSnapshot!==n||w||sn!==null&&sn.memoizedState.tag&1){if(o.flags|=2048,si(9,{destroy:void 0},Om.bind(null,o,h,a,n),null),Bt===null)throw Error(i(349));p||(rr&127)!==0||_m(o,n,a)}return a}function _m(t,n,a){t.flags|=16384,t={getSnapshot:n,value:a},n=lt.updateQueue,n===null?(n=Ao(),lt.updateQueue=n,n.stores=[t]):(a=n.stores,a===null?n.stores=[t]:a.push(t))}function Om(t,n,a,o){n.value=a,n.getSnapshot=o,$m(n)&&Lm(t)}function Bm(t,n,a){return a(function(){$m(n)&&Lm(t)})}function $m(t){var n=t.getSnapshot;t=t.value;try{var a=n();return!Pn(t,a)}catch{return!0}}function Lm(t){var n=ya(t,2);n!==null&&qn(n,t,2)}function Uu(t){var n=Fn();if(typeof t=="function"){var a=t;if(t=a(),Ea){At(!0);try{a()}finally{At(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ar,lastRenderedState:t},n}function Hm(t,n,a,o){return t.baseState=a,Hu(t,Mt,typeof o=="function"?o:ar)}function Tb(t,n,a,o,h){if(Ro(t))throw Error(i(485));if(t=n.action,t!==null){var p={payload:h,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){p.listeners.push(w)}};U.T!==null?a(!0):p.isTransition=!1,o(p),a=n.pending,a===null?(p.next=n.pending=p,Im(n,p)):(p.next=a.next,n.pending=a.next=p)}}function Im(t,n){var a=n.action,o=n.payload,h=t.state;if(n.isTransition){var p=U.T,w={};U.T=w;try{var A=a(h,o),H=U.S;H!==null&&H(w,A),Um(t,n,A)}catch(ee){Yu(t,n,ee)}finally{p!==null&&w.types!==null&&(p.types=w.types),U.T=p}}else try{p=a(h,o),Um(t,n,p)}catch(ee){Yu(t,n,ee)}}function Um(t,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){Ym(t,n,o)},function(o){return Yu(t,n,o)}):Ym(t,n,a)}function Ym(t,n,a){n.status="fulfilled",n.value=a,qm(n),t.state=a,n=t.pending,n!==null&&(a=n.next,a===n?t.pending=null:(a=a.next,n.next=a,Im(t,a)))}function Yu(t,n,a){var o=t.pending;if(t.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=a,qm(n),n=n.next;while(n!==o)}t.action=null}function qm(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function Xm(t,n){return n}function Vm(t,n){if(bt){var a=Bt.formState;if(a!==null){e:{var o=lt;if(bt){if(Yt){t:{for(var h=Yt,p=ml;h.nodeType!==8;){if(!p){h=null;break t}if(h=pl(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Yt=pl(h.nextSibling),o=h.data==="F!";break e}}Fr(o)}o=!1}o&&(n=a[0])}}return a=Fn(),a.memoizedState=a.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xm,lastRenderedState:n},a.queue=o,a=dx.bind(null,lt,o),o.dispatch=a,o=Uu(!1),p=Wu.bind(null,lt,!1,o.queue),o=Fn(),h={state:n,dispatch:null,action:t,pending:null},o.queue=h,a=Tb.bind(null,lt,h,p,a),h.dispatch=a,o.memoizedState=t,[n,a,!1]}function Gm(t){var n=rn();return Km(n,Mt,t)}function Km(t,n,a){if(n=Hu(t,n,Xm)[0],t=To(ar)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=is(n)}catch(w){throw w===ni?vo:w}else o=n;n=rn();var h=n.queue,p=h.dispatch;return a!==n.memoizedState&&(lt.flags|=2048,si(9,{destroy:void 0},zb.bind(null,h,a),null)),[o,p,t]}function zb(t,n){t.action=n}function Wm(t){var n=rn(),a=Mt;if(a!==null)return Km(n,a,t);rn(),n=n.memoizedState,a=rn();var o=a.queue.dispatch;return a.memoizedState=t,[n,o,!1]}function si(t,n,a,o){return t={tag:t,create:a,deps:o,inst:n,next:null},n=lt.updateQueue,n===null&&(n=Ao(),lt.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=t.next=t:(o=a.next,a.next=t,t.next=o,n.lastEffect=t),t}function Qm(){return rn().memoizedState}function zo(t,n,a,o){var h=Fn();lt.flags|=t,h.memoizedState=si(1|n,{destroy:void 0},a,o===void 0?null:o)}function Mo(t,n,a,o){var h=rn();o=o===void 0?null:o;var p=h.memoizedState.inst;Mt!==null&&o!==null&&Fu(o,Mt.memoizedState.deps)?h.memoizedState=si(n,p,a,o):(lt.flags|=t,h.memoizedState=si(1|n,p,a,o))}function Zm(t,n){zo(8390656,8,t,n)}function qu(t,n){Mo(2048,8,t,n)}function Mb(t){lt.flags|=4;var n=lt.updateQueue;if(n===null)n=Ao(),lt.updateQueue=n,n.events=[t];else{var a=n.events;a===null?n.events=[t]:a.push(t)}}function Jm(t){var n=rn().memoizedState;return Mb({ref:n,nextImpl:t}),function(){if((Et&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function Pm(t,n){return Mo(4,2,t,n)}function ex(t,n){return Mo(4,4,t,n)}function tx(t,n){if(typeof n=="function"){t=t();var a=n(t);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function nx(t,n,a){a=a!=null?a.concat([t]):null,Mo(4,4,tx.bind(null,n,t),a)}function Xu(){}function lx(t,n){var a=rn();n=n===void 0?null:n;var o=a.memoizedState;return n!==null&&Fu(n,o[1])?o[0]:(a.memoizedState=[t,n],t)}function rx(t,n){var a=rn();n=n===void 0?null:n;var o=a.memoizedState;if(n!==null&&Fu(n,o[1]))return o[0];if(o=t(),Ea){At(!0);try{t()}finally{At(!1)}}return a.memoizedState=[o,n],o}function Vu(t,n,a){return a===void 0||(rr&1073741824)!==0&&(xt&261930)===0?t.memoizedState=n:(t.memoizedState=a,t=ap(),lt.lanes|=t,Yr|=t,a)}function ax(t,n,a,o){return Pn(a,n)?a:ri.current!==null?(t=Vu(t,a,o),Pn(t,n)||(on=!0),t):(rr&42)===0||(rr&1073741824)!==0&&(xt&261930)===0?(on=!0,t.memoizedState=a):(t=ap(),lt.lanes|=t,Yr|=t,n)}function ix(t,n,a,o,h){var p=J.p;J.p=p!==0&&8>p?p:8;var w=U.T,A={};U.T=A,Wu(t,!1,n,a);try{var H=h(),ee=U.S;if(ee!==null&&ee(A,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var oe=Nb(H,o);ss(t,n,oe,al(t))}else ss(t,n,o,al(t))}catch(ue){ss(t,n,{then:function(){},status:"rejected",reason:ue},al())}finally{J.p=p,w!==null&&A.types!==null&&(w.types=A.types),U.T=w}}function Rb(){}function Gu(t,n,a,o){if(t.tag!==5)throw Error(i(476));var h=sx(t).queue;ix(t,h,n,ie,a===null?Rb:function(){return ox(t),a(o)})}function sx(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ar,lastRenderedState:ie},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ar,lastRenderedState:a},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function ox(t){var n=sx(t);n.next===null&&(n=t.alternate.memoizedState),ss(t,n.next.queue,{},al())}function Ku(){return jn(Ss)}function cx(){return rn().memoizedState}function ux(){return rn().memoizedState}function Fb(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var a=al();t=Br(a);var o=$r(n,t,a);o!==null&&(qn(o,n,a),ns(o,n,a)),n={cache:ju()},t.payload=n;return}n=n.return}}function _b(t,n,a){var o=al();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Ro(t)?fx(n,a):(a=fu(t,n,a,o),a!==null&&(qn(a,t,o),hx(a,n,o)))}function dx(t,n,a){var o=al();ss(t,n,a,o)}function ss(t,n,a,o){var h={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Ro(t))fx(n,h);else{var p=t.alternate;if(t.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var w=n.lastRenderedState,A=p(w,a);if(h.hasEagerState=!0,h.eagerState=A,Pn(A,w))return ho(t,n,h,0),Bt===null&&fo(),!1}catch{}finally{}if(a=fu(t,n,h,o),a!==null)return qn(a,t,o),hx(a,n,o),!0}return!1}function Wu(t,n,a,o){if(o={lane:2,revertLane:Nd(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Ro(t)){if(n)throw Error(i(479))}else n=fu(t,a,o,2),n!==null&&qn(n,t,2)}function Ro(t){var n=t.alternate;return t===lt||n!==null&&n===lt}function fx(t,n){ai=Eo=!0;var a=t.pending;a===null?n.next=n:(n.next=a.next,a.next=n),t.pending=n}function hx(t,n,a){if((a&4194048)!==0){var o=n.lanes;o&=t.pendingLanes,a|=o,n.lanes=a,Ha(t,a)}}var os={readContext:jn,use:Do,useCallback:Jt,useContext:Jt,useEffect:Jt,useImperativeHandle:Jt,useLayoutEffect:Jt,useInsertionEffect:Jt,useMemo:Jt,useReducer:Jt,useRef:Jt,useState:Jt,useDebugValue:Jt,useDeferredValue:Jt,useTransition:Jt,useSyncExternalStore:Jt,useId:Jt,useHostTransitionStatus:Jt,useFormState:Jt,useActionState:Jt,useOptimistic:Jt,useMemoCache:Jt,useCacheRefresh:Jt};os.useEffectEvent=Jt;var mx={readContext:jn,use:Do,useCallback:function(t,n){return Fn().memoizedState=[t,n===void 0?null:n],t},useContext:jn,useEffect:Zm,useImperativeHandle:function(t,n,a){a=a!=null?a.concat([t]):null,zo(4194308,4,tx.bind(null,n,t),a)},useLayoutEffect:function(t,n){return zo(4194308,4,t,n)},useInsertionEffect:function(t,n){zo(4,2,t,n)},useMemo:function(t,n){var a=Fn();n=n===void 0?null:n;var o=t();if(Ea){At(!0);try{t()}finally{At(!1)}}return a.memoizedState=[o,n],o},useReducer:function(t,n,a){var o=Fn();if(a!==void 0){var h=a(n);if(Ea){At(!0);try{a(n)}finally{At(!1)}}}else h=n;return o.memoizedState=o.baseState=h,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:h},o.queue=t,t=t.dispatch=_b.bind(null,lt,t),[o.memoizedState,t]},useRef:function(t){var n=Fn();return t={current:t},n.memoizedState=t},useState:function(t){t=Uu(t);var n=t.queue,a=dx.bind(null,lt,n);return n.dispatch=a,[t.memoizedState,a]},useDebugValue:Xu,useDeferredValue:function(t,n){var a=Fn();return Vu(a,t,n)},useTransition:function(){var t=Uu(!1);return t=ix.bind(null,lt,t.queue,!0,!1),Fn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,a){var o=lt,h=Fn();if(bt){if(a===void 0)throw Error(i(407));a=a()}else{if(a=n(),Bt===null)throw Error(i(349));(xt&127)!==0||_m(o,n,a)}h.memoizedState=a;var p={value:a,getSnapshot:n};return h.queue=p,Zm(Bm.bind(null,o,p,t),[t]),o.flags|=2048,si(9,{destroy:void 0},Om.bind(null,o,p,a,n),null),a},useId:function(){var t=Fn(),n=Bt.identifierPrefix;if(bt){var a=Ll,o=$l;a=(o&~(1<<32-ut(o)-1)).toString(32)+a,n="_"+n+"R_"+a,a=No++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Ab++,n="_"+n+"r_"+a.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:Ku,useFormState:Vm,useActionState:Vm,useOptimistic:function(t){var n=Fn();n.memoizedState=n.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Wu.bind(null,lt,!0,a),a.dispatch=n,[t,n]},useMemoCache:Lu,useCacheRefresh:function(){return Fn().memoizedState=Fb.bind(null,lt)},useEffectEvent:function(t){var n=Fn(),a={impl:t};return n.memoizedState=a,function(){if((Et&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},Qu={readContext:jn,use:Do,useCallback:lx,useContext:jn,useEffect:qu,useImperativeHandle:nx,useInsertionEffect:Pm,useLayoutEffect:ex,useMemo:rx,useReducer:To,useRef:Qm,useState:function(){return To(ar)},useDebugValue:Xu,useDeferredValue:function(t,n){var a=rn();return ax(a,Mt.memoizedState,t,n)},useTransition:function(){var t=To(ar)[0],n=rn().memoizedState;return[typeof t=="boolean"?t:is(t),n]},useSyncExternalStore:Fm,useId:cx,useHostTransitionStatus:Ku,useFormState:Gm,useActionState:Gm,useOptimistic:function(t,n){var a=rn();return Hm(a,Mt,t,n)},useMemoCache:Lu,useCacheRefresh:ux};Qu.useEffectEvent=Jm;var xx={readContext:jn,use:Do,useCallback:lx,useContext:jn,useEffect:qu,useImperativeHandle:nx,useInsertionEffect:Pm,useLayoutEffect:ex,useMemo:rx,useReducer:Iu,useRef:Qm,useState:function(){return Iu(ar)},useDebugValue:Xu,useDeferredValue:function(t,n){var a=rn();return Mt===null?Vu(a,t,n):ax(a,Mt.memoizedState,t,n)},useTransition:function(){var t=Iu(ar)[0],n=rn().memoizedState;return[typeof t=="boolean"?t:is(t),n]},useSyncExternalStore:Fm,useId:cx,useHostTransitionStatus:Ku,useFormState:Wm,useActionState:Wm,useOptimistic:function(t,n){var a=rn();return Mt!==null?Hm(a,Mt,t,n):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:Lu,useCacheRefresh:ux};xx.useEffectEvent=Jm;function Zu(t,n,a,o){n=t.memoizedState,a=a(o,n),a=a==null?n:y({},n,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var Ju={enqueueSetState:function(t,n,a){t=t._reactInternals;var o=al(),h=Br(o);h.payload=n,a!=null&&(h.callback=a),n=$r(t,h,o),n!==null&&(qn(n,t,o),ns(n,t,o))},enqueueReplaceState:function(t,n,a){t=t._reactInternals;var o=al(),h=Br(o);h.tag=1,h.payload=n,a!=null&&(h.callback=a),n=$r(t,h,o),n!==null&&(qn(n,t,o),ns(n,t,o))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var a=al(),o=Br(a);o.tag=2,n!=null&&(o.callback=n),n=$r(t,o,a),n!==null&&(qn(n,t,a),ns(n,t,a))}};function px(t,n,a,o,h,p,w){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(o,p,w):n.prototype&&n.prototype.isPureReactComponent?!Ki(a,o)||!Ki(h,p):!0}function yx(t,n,a,o){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,o),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,o),n.state!==t&&Ju.enqueueReplaceState(n,n.state,null)}function Na(t,n){var a=n;if("ref"in n){a={};for(var o in n)o!=="ref"&&(a[o]=n[o])}if(t=t.defaultProps){a===n&&(a=y({},a));for(var h in t)a[h]===void 0&&(a[h]=t[h])}return a}function gx(t){uo(t)}function bx(t){console.error(t)}function vx(t){uo(t)}function Fo(t,n){try{var a=t.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function wx(t,n,a){try{var o=t.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Pu(t,n,a){return a=Br(a),a.tag=3,a.payload={element:null},a.callback=function(){Fo(t,n)},a}function kx(t){return t=Br(t),t.tag=3,t}function jx(t,n,a,o){var h=a.type.getDerivedStateFromError;if(typeof h=="function"){var p=o.value;t.payload=function(){return h(p)},t.callback=function(){wx(n,a,o)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(t.callback=function(){wx(n,a,o),typeof h!="function"&&(qr===null?qr=new Set([this]):qr.add(this));var A=o.stack;this.componentDidCatch(o.value,{componentStack:A!==null?A:""})})}function Ob(t,n,a,o,h){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(n=a.alternate,n!==null&&Pa(n,a,h,!0),a=tl.current,a!==null){switch(a.tag){case 31:case 13:return xl===null?Vo():a.alternate===null&&Pt===0&&(Pt=3),a.flags&=-257,a.flags|=65536,a.lanes=h,o===wo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([o]):n.add(o),Sd(t,o,h)),!1;case 22:return a.flags|=65536,o===wo?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([o]):a.add(o)),Sd(t,o,h)),!1}throw Error(i(435,a.tag))}return Sd(t,o,h),Vo(),!1}if(bt)return n=tl.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=h,o!==gu&&(t=Error(i(422),{cause:o}),Zi(dl(t,a)))):(o!==gu&&(n=Error(i(423),{cause:o}),Zi(dl(n,a))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,o=dl(o,a),h=Pu(t.stateNode,o,h),Du(t,h),Pt!==4&&(Pt=2)),!1;var p=Error(i(520),{cause:o});if(p=dl(p,a),ps===null?ps=[p]:ps.push(p),Pt!==4&&(Pt=2),n===null)return!0;o=dl(o,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,t=h&-h,a.lanes|=t,t=Pu(a.stateNode,o,t),Du(a,t),!1;case 1:if(n=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(qr===null||!qr.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=kx(h),jx(h,t,a,o),Du(a,h),!1}a=a.return}while(a!==null);return!1}var ed=Error(i(461)),on=!1;function Sn(t,n,a,o){n.child=t===null?Nm(n,null,a,o):Ca(n,t.child,a,o)}function Sx(t,n,a,o,h){a=a.render;var p=n.ref;if("ref"in o){var w={};for(var A in o)A!=="ref"&&(w[A]=o[A])}else w=o;return wa(n),o=_u(t,n,a,w,p,h),A=Ou(),t!==null&&!on?(Bu(t,n,h),ir(t,n,h)):(bt&&A&&pu(n),n.flags|=1,Sn(t,n,o,h),n.child)}function Cx(t,n,a,o,h){if(t===null){var p=a.type;return typeof p=="function"&&!hu(p)&&p.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=p,Ex(t,n,p,o,h)):(t=xo(a.type,null,o,n,n.mode,h),t.ref=n.ref,t.return=n,n.child=t)}if(p=t.child,!od(t,h)){var w=p.memoizedProps;if(a=a.compare,a=a!==null?a:Ki,a(w,o)&&t.ref===n.ref)return ir(t,n,h)}return n.flags|=1,t=er(p,o),t.ref=n.ref,t.return=n,n.child=t}function Ex(t,n,a,o,h){if(t!==null){var p=t.memoizedProps;if(Ki(p,o)&&t.ref===n.ref)if(on=!1,n.pendingProps=o=p,od(t,h))(t.flags&131072)!==0&&(on=!0);else return n.lanes=t.lanes,ir(t,n,h)}return td(t,n,a,o,h)}function Nx(t,n,a,o){var h=o.children,p=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((n.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,t!==null){for(o=n.child=t.child,h=0;o!==null;)h=h|o.lanes|o.childLanes,o=o.sibling;o=h&~p}else o=0,n.child=null;return Ax(t,n,p,a,o)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&bo(n,p!==null?p.cachePool:null),p!==null?Tm(n,p):zu(),zm(n);else return o=n.lanes=536870912,Ax(t,n,p!==null?p.baseLanes|a:a,a,o)}else p!==null?(bo(n,p.cachePool),Tm(n,p),Hr(),n.memoizedState=null):(t!==null&&bo(n,null),zu(),Hr());return Sn(t,n,h,a),n.child}function cs(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Ax(t,n,a,o,h){var p=Cu();return p=p===null?null:{parent:an._currentValue,pool:p},n.memoizedState={baseLanes:a,cachePool:p},t!==null&&bo(n,null),zu(),zm(n),t!==null&&Pa(t,n,o,!0),n.childLanes=h,null}function _o(t,n){return n=Bo({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function Dx(t,n,a){return Ca(n,t.child,null,a),t=_o(n,n.pendingProps),t.flags|=2,nl(n),n.memoizedState=null,t}function Bb(t,n,a){var o=n.pendingProps,h=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(bt){if(o.mode==="hidden")return t=_o(n,o),n.lanes=536870912,cs(null,t);if(Ru(n),(t=Yt)?(t=Ip(t,ml),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Mr!==null?{id:$l,overflow:Ll}:null,retryLane:536870912,hydrationErrors:null},a=fm(t),a.return=n,n.child=a,kn=n,Yt=null)):t=null,t===null)throw Fr(n);return n.lanes=536870912,null}return _o(n,o)}var p=t.memoizedState;if(p!==null){var w=p.dehydrated;if(Ru(n),h)if(n.flags&256)n.flags&=-257,n=Dx(t,n,a);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(i(558));else if(on||Pa(t,n,a,!1),h=(a&t.childLanes)!==0,on||h){if(o=Bt,o!==null&&(w=Gn(o,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,ya(t,w),qn(o,t,w),ed;Vo(),n=Dx(t,n,a)}else t=p.treeContext,Yt=pl(w.nextSibling),kn=n,bt=!0,Rr=null,ml=!1,t!==null&&xm(n,t),n=_o(n,o),n.flags|=4096;return n}return t=er(t.child,{mode:o.mode,children:o.children}),t.ref=n.ref,n.child=t,t.return=n,t}function Oo(t,n){var a=n.ref;if(a===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(t===null||t.ref!==a)&&(n.flags|=4194816)}}function td(t,n,a,o,h){return wa(n),a=_u(t,n,a,o,void 0,h),o=Ou(),t!==null&&!on?(Bu(t,n,h),ir(t,n,h)):(bt&&o&&pu(n),n.flags|=1,Sn(t,n,a,h),n.child)}function Tx(t,n,a,o,h,p){return wa(n),n.updateQueue=null,a=Rm(n,o,a,h),Mm(t),o=Ou(),t!==null&&!on?(Bu(t,n,p),ir(t,n,p)):(bt&&o&&pu(n),n.flags|=1,Sn(t,n,a,p),n.child)}function zx(t,n,a,o,h){if(wa(n),n.stateNode===null){var p=Wa,w=a.contextType;typeof w=="object"&&w!==null&&(p=jn(w)),p=new a(o,p),n.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Ju,n.stateNode=p,p._reactInternals=n,p=n.stateNode,p.props=o,p.state=n.memoizedState,p.refs={},Nu(n),w=a.contextType,p.context=typeof w=="object"&&w!==null?jn(w):Wa,p.state=n.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(Zu(n,a,w,o),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&&Ju.enqueueReplaceState(p,p.state,null),rs(n,o,p,h),ls(),p.state=n.memoizedState),typeof p.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(t===null){p=n.stateNode;var A=n.memoizedProps,H=Na(a,A);p.props=H;var ee=p.context,oe=a.contextType;w=Wa,typeof oe=="object"&&oe!==null&&(w=jn(oe));var ue=a.getDerivedStateFromProps;oe=typeof ue=="function"||typeof p.getSnapshotBeforeUpdate=="function",A=n.pendingProps!==A,oe||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(A||ee!==w)&&yx(n,p,o,w),Or=!1;var te=n.memoizedState;p.state=te,rs(n,o,p,h),ls(),ee=n.memoizedState,A||te!==ee||Or?(typeof ue=="function"&&(Zu(n,a,ue,o),ee=n.memoizedState),(H=Or||px(n,a,H,o,te,ee,w))?(oe||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(n.flags|=4194308)):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=ee),p.props=o,p.state=ee,p.context=w,o=H):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{p=n.stateNode,Au(t,n),w=n.memoizedProps,oe=Na(a,w),p.props=oe,ue=n.pendingProps,te=p.context,ee=a.contextType,H=Wa,typeof ee=="object"&&ee!==null&&(H=jn(ee)),A=a.getDerivedStateFromProps,(ee=typeof A=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==ue||te!==H)&&yx(n,p,o,H),Or=!1,te=n.memoizedState,p.state=te,rs(n,o,p,h),ls();var re=n.memoizedState;w!==ue||te!==re||Or||t!==null&&t.dependencies!==null&&yo(t.dependencies)?(typeof A=="function"&&(Zu(n,a,A,o),re=n.memoizedState),(oe=Or||px(n,a,oe,o,te,re,H)||t!==null&&t.dependencies!==null&&yo(t.dependencies))?(ee||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,re,H),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,re,H)),typeof p.componentDidUpdate=="function"&&(n.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===t.memoizedProps&&te===t.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&te===t.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=re),p.props=o,p.state=re,p.context=H,o=oe):(typeof p.componentDidUpdate!="function"||w===t.memoizedProps&&te===t.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&te===t.memoizedState||(n.flags|=1024),o=!1)}return p=o,Oo(t,n),o=(n.flags&128)!==0,p||o?(p=n.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:p.render(),n.flags|=1,t!==null&&o?(n.child=Ca(n,t.child,null,h),n.child=Ca(n,null,a,h)):Sn(t,n,a,h),n.memoizedState=p.state,t=n.child):t=ir(t,n,h),t}function Mx(t,n,a,o){return ba(),n.flags|=256,Sn(t,n,a,o),n.child}var nd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ld(t){return{baseLanes:t,cachePool:wm()}}function rd(t,n,a){return t=t!==null?t.childLanes&~a:0,n&&(t|=rl),t}function Rx(t,n,a){var o=n.pendingProps,h=!1,p=(n.flags&128)!==0,w;if((w=p)||(w=t!==null&&t.memoizedState===null?!1:(ln.current&2)!==0),w&&(h=!0,n.flags&=-129),w=(n.flags&32)!==0,n.flags&=-33,t===null){if(bt){if(h?Lr(n):Hr(),(t=Yt)?(t=Ip(t,ml),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Mr!==null?{id:$l,overflow:Ll}:null,retryLane:536870912,hydrationErrors:null},a=fm(t),a.return=n,n.child=a,kn=n,Yt=null)):t=null,t===null)throw Fr(n);return Hd(t)?n.lanes=32:n.lanes=536870912,null}var A=o.children;return o=o.fallback,h?(Hr(),h=n.mode,A=Bo({mode:"hidden",children:A},h),o=ga(o,h,a,null),A.return=n,o.return=n,A.sibling=o,n.child=A,o=n.child,o.memoizedState=ld(a),o.childLanes=rd(t,w,a),n.memoizedState=nd,cs(null,o)):(Lr(n),ad(n,A))}var H=t.memoizedState;if(H!==null&&(A=H.dehydrated,A!==null)){if(p)n.flags&256?(Lr(n),n.flags&=-257,n=id(t,n,a)):n.memoizedState!==null?(Hr(),n.child=t.child,n.flags|=128,n=null):(Hr(),A=o.fallback,h=n.mode,o=Bo({mode:"visible",children:o.children},h),A=ga(A,h,a,null),A.flags|=2,o.return=n,A.return=n,o.sibling=A,n.child=o,Ca(n,t.child,null,a),o=n.child,o.memoizedState=ld(a),o.childLanes=rd(t,w,a),n.memoizedState=nd,n=cs(null,o));else if(Lr(n),Hd(A)){if(w=A.nextSibling&&A.nextSibling.dataset,w)var ee=w.dgst;w=ee,o=Error(i(419)),o.stack="",o.digest=w,Zi({value:o,source:null,stack:null}),n=id(t,n,a)}else if(on||Pa(t,n,a,!1),w=(a&t.childLanes)!==0,on||w){if(w=Bt,w!==null&&(o=Gn(w,a),o!==0&&o!==H.retryLane))throw H.retryLane=o,ya(t,o),qn(w,t,o),ed;Ld(A)||Vo(),n=id(t,n,a)}else Ld(A)?(n.flags|=192,n.child=t.child,n=null):(t=H.treeContext,Yt=pl(A.nextSibling),kn=n,bt=!0,Rr=null,ml=!1,t!==null&&xm(n,t),n=ad(n,o.children),n.flags|=4096);return n}return h?(Hr(),A=o.fallback,h=n.mode,H=t.child,ee=H.sibling,o=er(H,{mode:"hidden",children:o.children}),o.subtreeFlags=H.subtreeFlags&65011712,ee!==null?A=er(ee,A):(A=ga(A,h,a,null),A.flags|=2),A.return=n,o.return=n,o.sibling=A,n.child=o,cs(null,o),o=n.child,A=t.child.memoizedState,A===null?A=ld(a):(h=A.cachePool,h!==null?(H=an._currentValue,h=h.parent!==H?{parent:H,pool:H}:h):h=wm(),A={baseLanes:A.baseLanes|a,cachePool:h}),o.memoizedState=A,o.childLanes=rd(t,w,a),n.memoizedState=nd,cs(t.child,o)):(Lr(n),a=t.child,t=a.sibling,a=er(a,{mode:"visible",children:o.children}),a.return=n,a.sibling=null,t!==null&&(w=n.deletions,w===null?(n.deletions=[t],n.flags|=16):w.push(t)),n.child=a,n.memoizedState=null,a)}function ad(t,n){return n=Bo({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function Bo(t,n){return t=el(22,t,null,n),t.lanes=0,t}function id(t,n,a){return Ca(n,t.child,null,a),t=ad(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function Fx(t,n,a){t.lanes|=n;var o=t.alternate;o!==null&&(o.lanes|=n),wu(t.return,n,a)}function sd(t,n,a,o,h,p){var w=t.memoizedState;w===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:h,treeForkCount:p}:(w.isBackwards=n,w.rendering=null,w.renderingStartTime=0,w.last=o,w.tail=a,w.tailMode=h,w.treeForkCount=p)}function _x(t,n,a){var o=n.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var w=ln.current,A=(w&2)!==0;if(A?(w=w&1|2,n.flags|=128):w&=1,D(ln,w),Sn(t,n,o,a),o=bt?Qi:0,!A&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Fx(t,a,n);else if(t.tag===19)Fx(t,a,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(h){case"forwards":for(a=n.child,h=null;a!==null;)t=a.alternate,t!==null&&Co(t)===null&&(h=a),a=a.sibling;a=h,a===null?(h=n.child,n.child=null):(h=a.sibling,a.sibling=null),sd(n,!1,h,a,p,o);break;case"backwards":case"unstable_legacy-backwards":for(a=null,h=n.child,n.child=null;h!==null;){if(t=h.alternate,t!==null&&Co(t)===null){n.child=h;break}t=h.sibling,h.sibling=a,a=h,h=t}sd(n,!0,a,null,p,o);break;case"together":sd(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function ir(t,n,a){if(t!==null&&(n.dependencies=t.dependencies),Yr|=n.lanes,(a&n.childLanes)===0)if(t!==null){if(Pa(t,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(i(153));if(n.child!==null){for(t=n.child,a=er(t,t.pendingProps),n.child=a,a.return=n;t.sibling!==null;)t=t.sibling,a=a.sibling=er(t,t.pendingProps),a.return=n;a.sibling=null}return n.child}function od(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&yo(t)))}function $b(t,n,a){switch(n.tag){case 3:Me(n,n.stateNode.containerInfo),_r(n,an,t.memoizedState.cache),ba();break;case 27:case 5:fe(n);break;case 4:Me(n,n.stateNode.containerInfo);break;case 10:_r(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Ru(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(Lr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Rx(t,n,a):(Lr(n),t=ir(t,n,a),t!==null?t.sibling:null);Lr(n);break;case 19:var h=(t.flags&128)!==0;if(o=(a&n.childLanes)!==0,o||(Pa(t,n,a,!1),o=(a&n.childLanes)!==0),h){if(o)return _x(t,n,a);n.flags|=128}if(h=n.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),D(ln,ln.current),o)break;return null;case 22:return n.lanes=0,Nx(t,n,a,n.pendingProps);case 24:_r(n,an,t.memoizedState.cache)}return ir(t,n,a)}function Ox(t,n,a){if(t!==null)if(t.memoizedProps!==n.pendingProps)on=!0;else{if(!od(t,a)&&(n.flags&128)===0)return on=!1,$b(t,n,a);on=(t.flags&131072)!==0}else on=!1,bt&&(n.flags&1048576)!==0&&mm(n,Qi,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(t=ja(n.elementType),n.type=t,typeof t=="function")hu(t)?(o=Na(t,o),n.tag=1,n=zx(null,n,t,o,a)):(n.tag=0,n=td(null,n,t,o,a));else{if(t!=null){var h=t.$$typeof;if(h===O){n.tag=11,n=Sx(null,n,t,o,a);break e}else if(h===q){n.tag=14,n=Cx(null,n,t,o,a);break e}}throw n=ne(t)||t,Error(i(306,n,""))}}return n;case 0:return td(t,n,n.type,n.pendingProps,a);case 1:return o=n.type,h=Na(o,n.pendingProps),zx(t,n,o,h,a);case 3:e:{if(Me(n,n.stateNode.containerInfo),t===null)throw Error(i(387));o=n.pendingProps;var p=n.memoizedState;h=p.element,Au(t,n),rs(n,o,null,a);var w=n.memoizedState;if(o=w.cache,_r(n,an,o),o!==p.cache&&ku(n,[an],a,!0),ls(),o=w.element,p.isDehydrated)if(p={element:o,isDehydrated:!1,cache:w.cache},n.updateQueue.baseState=p,n.memoizedState=p,n.flags&256){n=Mx(t,n,o,a);break e}else if(o!==h){h=dl(Error(i(424)),n),Zi(h),n=Mx(t,n,o,a);break e}else{switch(t=n.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(Yt=pl(t.firstChild),kn=n,bt=!0,Rr=null,ml=!0,a=Nm(n,null,o,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ba(),o===h){n=ir(t,n,a);break e}Sn(t,n,o,a)}n=n.child}return n;case 26:return Oo(t,n),t===null?(a=Gp(n.type,null,n.pendingProps,null))?n.memoizedState=a:bt||(a=n.type,t=n.pendingProps,o=Po(ve.current).createElement(a),o[Vt]=n,o[vn]=t,Cn(o,a,t),Zt(o),n.stateNode=o):n.memoizedState=Gp(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return fe(n),t===null&&bt&&(o=n.stateNode=qp(n.type,n.pendingProps,ve.current),kn=n,ml=!0,h=Yt,Kr(n.type)?(Id=h,Yt=pl(o.firstChild)):Yt=h),Sn(t,n,n.pendingProps.children,a),Oo(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&bt&&((h=o=Yt)&&(o=m2(o,n.type,n.pendingProps,ml),o!==null?(n.stateNode=o,kn=n,Yt=pl(o.firstChild),ml=!1,h=!0):h=!1),h||Fr(n)),fe(n),h=n.type,p=n.pendingProps,w=t!==null?t.memoizedProps:null,o=p.children,Od(h,p)?o=null:w!==null&&Od(h,w)&&(n.flags|=32),n.memoizedState!==null&&(h=_u(t,n,Db,null,null,a),Ss._currentValue=h),Oo(t,n),Sn(t,n,o,a),n.child;case 6:return t===null&&bt&&((t=a=Yt)&&(a=x2(a,n.pendingProps,ml),a!==null?(n.stateNode=a,kn=n,Yt=null,t=!0):t=!1),t||Fr(n)),null;case 13:return Rx(t,n,a);case 4:return Me(n,n.stateNode.containerInfo),o=n.pendingProps,t===null?n.child=Ca(n,null,o,a):Sn(t,n,o,a),n.child;case 11:return Sx(t,n,n.type,n.pendingProps,a);case 7:return Sn(t,n,n.pendingProps,a),n.child;case 8:return Sn(t,n,n.pendingProps.children,a),n.child;case 12:return Sn(t,n,n.pendingProps.children,a),n.child;case 10:return o=n.pendingProps,_r(n,n.type,o.value),Sn(t,n,o.children,a),n.child;case 9:return h=n.type._context,o=n.pendingProps.children,wa(n),h=jn(h),o=o(h),n.flags|=1,Sn(t,n,o,a),n.child;case 14:return Cx(t,n,n.type,n.pendingProps,a);case 15:return Ex(t,n,n.type,n.pendingProps,a);case 19:return _x(t,n,a);case 31:return Bb(t,n,a);case 22:return Nx(t,n,a,n.pendingProps);case 24:return wa(n),o=jn(an),t===null?(h=Cu(),h===null&&(h=Bt,p=ju(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),n.memoizedState={parent:o,cache:h},Nu(n),_r(n,an,h)):((t.lanes&a)!==0&&(Au(t,n),rs(n,null,null,a),ls()),h=t.memoizedState,p=n.memoizedState,h.parent!==o?(h={parent:o,cache:o},n.memoizedState=h,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=h),_r(n,an,o)):(o=p.cache,_r(n,an,o),o!==h.cache&&ku(n,[an],a,!0))),Sn(t,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function sr(t){t.flags|=4}function cd(t,n,a,o,h){if((n=(t.mode&32)!==0)&&(n=!1),n){if(t.flags|=16777216,(h&335544128)===h)if(t.stateNode.complete)t.flags|=8192;else if(cp())t.flags|=8192;else throw Sa=wo,Eu}else t.flags&=-16777217}function Bx(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Jp(n))if(cp())t.flags|=8192;else throw Sa=wo,Eu}function $o(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?gt():536870912,t.lanes|=n,di|=n)}function us(t,n){if(!bt)switch(t.tailMode){case"hidden":n=t.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:o.sibling=null}}function qt(t){var n=t.alternate!==null&&t.alternate.child===t.child,a=0,o=0;if(n)for(var h=t.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags&65011712,o|=h.flags&65011712,h.return=t,h=h.sibling;else for(h=t.child;h!==null;)a|=h.lanes|h.childLanes,o|=h.subtreeFlags,o|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=o,t.childLanes=a,n}function Lb(t,n,a){var o=n.pendingProps;switch(yu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qt(n),null;case 1:return qt(n),null;case 3:return a=n.stateNode,o=null,t!==null&&(o=t.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),lr(an),$e(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(Ja(n)?sr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,bu())),qt(n),null;case 26:var h=n.type,p=n.memoizedState;return t===null?(sr(n),p!==null?(qt(n),Bx(n,p)):(qt(n),cd(n,h,null,o,a))):p?p!==t.memoizedState?(sr(n),qt(n),Bx(n,p)):(qt(n),n.flags&=-16777217):(t=t.memoizedProps,t!==o&&sr(n),qt(n),cd(n,h,t,o,a)),null;case 27:if(tt(n),a=ve.current,h=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==o&&sr(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return qt(n),null}t=de.current,Ja(n)?pm(n):(t=qp(h,o,a),n.stateNode=t,sr(n))}return qt(n),null;case 5:if(tt(n),h=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==o&&sr(n);else{if(!o){if(n.stateNode===null)throw Error(i(166));return qt(n),null}if(p=de.current,Ja(n))pm(n);else{var w=Po(ve.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 o.is=="string"?w.createElement("select",{is:o.is}):w.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?w.createElement(h,{is:o.is}):w.createElement(h)}}p[Vt]=n,p[vn]=o;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(Cn(p,h,o),h){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&sr(n)}}return qt(n),cd(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,a),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==o&&sr(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(i(166));if(t=ve.current,Ja(n)){if(t=n.stateNode,a=n.memoizedProps,o=null,h=kn,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}t[Vt]=n,t=!!(t.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||Rp(t.nodeValue,a)),t||Fr(n,!0)}else t=Po(t).createTextNode(o),t[Vt]=n,n.stateNode=t}return qt(n),null;case 31:if(a=n.memoizedState,t===null||t.memoizedState!==null){if(o=Ja(n),a!==null){if(t===null){if(!o)throw Error(i(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(557));t[Vt]=n}else ba(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;qt(n),t=!1}else a=bu(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return n.flags&256?(nl(n),n):(nl(n),null);if((n.flags&128)!==0)throw Error(i(558))}return qt(n),null;case 13:if(o=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=Ja(n),o!==null&&o.dehydrated!==null){if(t===null){if(!h)throw Error(i(318));if(h=n.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(317));h[Vt]=n}else ba(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;qt(n),h=!1}else h=bu(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return n.flags&256?(nl(n),n):(nl(n),null)}return nl(n),(n.flags&128)!==0?(n.lanes=a,n):(a=o!==null,t=t!==null&&t.memoizedState!==null,a&&(o=n.child,h=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(h=o.alternate.memoizedState.cachePool.pool),p=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),p!==h&&(o.flags|=2048)),a!==t&&a&&(n.child.flags|=8192),$o(n,n.updateQueue),qt(n),null);case 4:return $e(),t===null&&zd(n.stateNode.containerInfo),qt(n),null;case 10:return lr(n.type),qt(n),null;case 19:if(K(ln),o=n.memoizedState,o===null)return qt(n),null;if(h=(n.flags&128)!==0,p=o.rendering,p===null)if(h)us(o,!1);else{if(Pt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(p=Co(t),p!==null){for(n.flags|=128,us(o,!1),t=p.updateQueue,n.updateQueue=t,$o(n,t),n.subtreeFlags=0,t=a,a=n.child;a!==null;)dm(a,t),a=a.sibling;return D(ln,ln.current&1|2),bt&&tr(n,o.treeForkCount),n.child}t=t.sibling}o.tail!==null&&ct()>Yo&&(n.flags|=128,h=!0,us(o,!1),n.lanes=4194304)}else{if(!h)if(t=Co(p),t!==null){if(n.flags|=128,h=!0,t=t.updateQueue,n.updateQueue=t,$o(n,t),us(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!bt)return qt(n),null}else 2*ct()-o.renderingStartTime>Yo&&a!==536870912&&(n.flags|=128,h=!0,us(o,!1),n.lanes=4194304);o.isBackwards?(p.sibling=n.child,n.child=p):(t=o.last,t!==null?t.sibling=p:n.child=p,o.last=p)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=ct(),t.sibling=null,a=ln.current,D(ln,h?a&1|2:a&1),bt&&tr(n,o.treeForkCount),t):(qt(n),null);case 22:case 23:return nl(n),Mu(),o=n.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(a&536870912)!==0&&(n.flags&128)===0&&(qt(n),n.subtreeFlags&6&&(n.flags|=8192)):qt(n),a=n.updateQueue,a!==null&&$o(n,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==a&&(n.flags|=2048),t!==null&&K(ka),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),lr(an),qt(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function Hb(t,n){switch(yu(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return lr(an),$e(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return tt(n),null;case 31:if(n.memoizedState!==null){if(nl(n),n.alternate===null)throw Error(i(340));ba()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(nl(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(i(340));ba()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return K(ln),null;case 4:return $e(),null;case 10:return lr(n.type),null;case 22:case 23:return nl(n),Mu(),t!==null&&K(ka),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return lr(an),null;case 25:return null;default:return null}}function $x(t,n){switch(yu(n),n.tag){case 3:lr(an),$e();break;case 26:case 27:case 5:tt(n);break;case 4:$e();break;case 31:n.memoizedState!==null&&nl(n);break;case 13:nl(n);break;case 19:K(ln);break;case 10:lr(n.type);break;case 22:case 23:nl(n),Mu(),t!==null&&K(ka);break;case 24:lr(an)}}function ds(t,n){try{var a=n.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var h=o.next;a=h;do{if((a.tag&t)===t){o=void 0;var p=a.create,w=a.inst;o=p(),w.destroy=o}a=a.next}while(a!==h)}}catch(A){zt(n,n.return,A)}}function Ir(t,n,a){try{var o=n.updateQueue,h=o!==null?o.lastEffect:null;if(h!==null){var p=h.next;o=p;do{if((o.tag&t)===t){var w=o.inst,A=w.destroy;if(A!==void 0){w.destroy=void 0,h=n;var H=a,ee=A;try{ee()}catch(oe){zt(h,H,oe)}}}o=o.next}while(o!==p)}}catch(oe){zt(n,n.return,oe)}}function Lx(t){var n=t.updateQueue;if(n!==null){var a=t.stateNode;try{Dm(n,a)}catch(o){zt(t,t.return,o)}}}function Hx(t,n,a){a.props=Na(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(o){zt(t,n,o)}}function fs(t,n){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:o=t.stateNode;break;default:o=t.stateNode}typeof a=="function"?t.refCleanup=a(o):a.current=o}}catch(h){zt(t,n,h)}}function Hl(t,n){var a=t.ref,o=t.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(h){zt(t,n,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(h){zt(t,n,h)}else a.current=null}function Ix(t){var n=t.type,a=t.memoizedProps,o=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(h){zt(t,t.return,h)}}function ud(t,n,a){try{var o=t.stateNode;o2(o,t.type,a,n),o[vn]=n}catch(h){zt(t,t.return,h)}}function Ux(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Kr(t.type)||t.tag===4}function dd(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Ux(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Kr(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function fd(t,n,a){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(t),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=Jn));else if(o!==4&&(o===27&&Kr(t.type)&&(a=t.stateNode,n=null),t=t.child,t!==null))for(fd(t,n,a),t=t.sibling;t!==null;)fd(t,n,a),t=t.sibling}function Lo(t,n,a){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?a.insertBefore(t,n):a.appendChild(t);else if(o!==4&&(o===27&&Kr(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Lo(t,n,a),t=t.sibling;t!==null;)Lo(t,n,a),t=t.sibling}function Yx(t){var n=t.stateNode,a=t.memoizedProps;try{for(var o=t.type,h=n.attributes;h.length;)n.removeAttributeNode(h[0]);Cn(n,o,a),n[Vt]=t,n[vn]=a}catch(p){zt(t,t.return,p)}}var or=!1,cn=!1,hd=!1,qx=typeof WeakSet=="function"?WeakSet:Set,bn=null;function Ib(t,n){if(t=t.containerInfo,Fd=ic,t=nm(t),iu(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var o=a.getSelection&&a.getSelection();if(o&&o.rangeCount!==0){a=o.anchorNode;var h=o.anchorOffset,p=o.focusNode;o=o.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var w=0,A=-1,H=-1,ee=0,oe=0,ue=t,te=null;t:for(;;){for(var re;ue!==a||h!==0&&ue.nodeType!==3||(A=w+h),ue!==p||o!==0&&ue.nodeType!==3||(H=w+o),ue.nodeType===3&&(w+=ue.nodeValue.length),(re=ue.firstChild)!==null;)te=ue,ue=re;for(;;){if(ue===t)break t;if(te===a&&++ee===h&&(A=w),te===p&&++oe===o&&(H=w),(re=ue.nextSibling)!==null)break;ue=te,te=ue.parentNode}ue=re}a=A===-1||H===-1?null:{start:A,end:H}}else a=null}a=a||{start:0,end:0}}else a=null;for(_d={focusedElem:t,selectionRange:a},ic=!1,bn=n;bn!==null;)if(n=bn,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,bn=t;else for(;bn!==null;){switch(n=bn,p=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a<t.length;a++)h=t[a],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&p!==null){t=void 0,a=n,h=p.memoizedProps,p=p.memoizedState,o=a.stateNode;try{var Be=Na(a.type,h);t=o.getSnapshotBeforeUpdate(Be,p),o.__reactInternalSnapshotBeforeUpdate=t}catch(Qe){zt(a,a.return,Qe)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,a=t.nodeType,a===9)$d(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":$d(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(i(163))}if(t=n.sibling,t!==null){t.return=n.return,bn=t;break}bn=n.return}}function Xx(t,n,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:ur(t,a),o&4&&ds(5,a);break;case 1:if(ur(t,a),o&4)if(t=a.stateNode,n===null)try{t.componentDidMount()}catch(w){zt(a,a.return,w)}else{var h=Na(a.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(h,n,t.__reactInternalSnapshotBeforeUpdate)}catch(w){zt(a,a.return,w)}}o&64&&Lx(a),o&512&&fs(a,a.return);break;case 3:if(ur(t,a),o&64&&(t=a.updateQueue,t!==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{Dm(t,n)}catch(w){zt(a,a.return,w)}}break;case 27:n===null&&o&4&&Yx(a);case 26:case 5:ur(t,a),n===null&&o&4&&Ix(a),o&512&&fs(a,a.return);break;case 12:ur(t,a);break;case 31:ur(t,a),o&4&&Kx(t,a);break;case 13:ur(t,a),o&4&&Wx(t,a),o&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=Qb.bind(null,a),p2(t,a))));break;case 22:if(o=a.memoizedState!==null||or,!o){n=n!==null&&n.memoizedState!==null||cn,h=or;var p=cn;or=o,(cn=n)&&!p?dr(t,a,(a.subtreeFlags&8772)!==0):ur(t,a),or=h,cn=p}break;case 30:break;default:ur(t,a)}}function Vx(t){var n=t.alternate;n!==null&&(t.alternate=null,Vx(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&vl(n)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Kt=null,Hn=!1;function cr(t,n,a){for(a=a.child;a!==null;)Gx(t,n,a),a=a.sibling}function Gx(t,n,a){if(nt&&typeof nt.onCommitFiberUnmount=="function")try{nt.onCommitFiberUnmount(Pe,a)}catch{}switch(a.tag){case 26:cn||Hl(a,n),cr(t,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:cn||Hl(a,n);var o=Kt,h=Hn;Kr(a.type)&&(Kt=a.stateNode,Hn=!1),cr(t,n,a),ws(a.stateNode),Kt=o,Hn=h;break;case 5:cn||Hl(a,n);case 6:if(o=Kt,h=Hn,Kt=null,cr(t,n,a),Kt=o,Hn=h,Kt!==null)if(Hn)try{(Kt.nodeType===9?Kt.body:Kt.nodeName==="HTML"?Kt.ownerDocument.body:Kt).removeChild(a.stateNode)}catch(p){zt(a,n,p)}else try{Kt.removeChild(a.stateNode)}catch(p){zt(a,n,p)}break;case 18:Kt!==null&&(Hn?(t=Kt,Lp(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),bi(t)):Lp(Kt,a.stateNode));break;case 4:o=Kt,h=Hn,Kt=a.stateNode.containerInfo,Hn=!0,cr(t,n,a),Kt=o,Hn=h;break;case 0:case 11:case 14:case 15:Ir(2,a,n),cn||Ir(4,a,n),cr(t,n,a);break;case 1:cn||(Hl(a,n),o=a.stateNode,typeof o.componentWillUnmount=="function"&&Hx(a,n,o)),cr(t,n,a);break;case 21:cr(t,n,a);break;case 22:cn=(o=cn)||a.memoizedState!==null,cr(t,n,a),cn=o;break;default:cr(t,n,a)}}function Kx(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{bi(t)}catch(a){zt(n,n.return,a)}}}function Wx(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{bi(t)}catch(a){zt(n,n.return,a)}}function Ub(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new qx),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new qx),n;default:throw Error(i(435,t.tag))}}function Ho(t,n){var a=Ub(t);n.forEach(function(o){if(!a.has(o)){a.add(o);var h=Zb.bind(null,t,o);o.then(h,h)}})}function In(t,n){var a=n.deletions;if(a!==null)for(var o=0;o<a.length;o++){var h=a[o],p=t,w=n,A=w;e:for(;A!==null;){switch(A.tag){case 27:if(Kr(A.type)){Kt=A.stateNode,Hn=!1;break e}break;case 5:Kt=A.stateNode,Hn=!1;break e;case 3:case 4:Kt=A.stateNode.containerInfo,Hn=!0;break e}A=A.return}if(Kt===null)throw Error(i(160));Gx(p,w,h),Kt=null,Hn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Qx(n,t),n=n.sibling}var Nl=null;function Qx(t,n){var a=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:In(n,t),Un(t),o&4&&(Ir(3,t,t.return),ds(3,t),Ir(5,t,t.return));break;case 1:In(n,t),Un(t),o&512&&(cn||a===null||Hl(a,a.return)),o&64&&or&&(t=t.updateQueue,t!==null&&(o=t.callbacks,o!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?o:a.concat(o))));break;case 26:var h=Nl;if(In(n,t),Un(t),o&512&&(cn||a===null||Hl(a,a.return)),o&4){var p=a!==null?a.memoizedState:null;if(o=t.memoizedState,a===null)if(o===null)if(t.stateNode===null){e:{o=t.type,a=t.memoizedProps,h=h.ownerDocument||h;t:switch(o){case"title":p=h.getElementsByTagName("title")[0],(!p||p[vr]||p[Vt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),Cn(p,o,a),p[Vt]=t,Zt(p),o=p;break e;case"link":var w=Qp("link","href",h).get(o+(a.href||""));if(w){for(var A=0;A<w.length;A++)if(p=w[A],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(A,1);break t}}p=h.createElement(o),Cn(p,o,a),h.head.appendChild(p);break;case"meta":if(w=Qp("meta","content",h).get(o+(a.content||""))){for(A=0;A<w.length;A++)if(p=w[A],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(A,1);break t}}p=h.createElement(o),Cn(p,o,a),h.head.appendChild(p);break;default:throw Error(i(468,o))}p[Vt]=t,Zt(p),o=p}t.stateNode=o}else Zp(h,t.type,t.stateNode);else t.stateNode=Wp(h,o,t.memoizedProps);else p!==o?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,o===null?Zp(h,t.type,t.stateNode):Wp(h,o,t.memoizedProps)):o===null&&t.stateNode!==null&&ud(t,t.memoizedProps,a.memoizedProps)}break;case 27:In(n,t),Un(t),o&512&&(cn||a===null||Hl(a,a.return)),a!==null&&o&4&&ud(t,t.memoizedProps,a.memoizedProps);break;case 5:if(In(n,t),Un(t),o&512&&(cn||a===null||Hl(a,a.return)),t.flags&32){h=t.stateNode;try{Ar(h,"")}catch(Be){zt(t,t.return,Be)}}o&4&&t.stateNode!=null&&(h=t.memoizedProps,ud(t,h,a!==null?a.memoizedProps:h)),o&1024&&(hd=!0);break;case 6:if(In(n,t),Un(t),o&4){if(t.stateNode===null)throw Error(i(162));o=t.memoizedProps,a=t.stateNode;try{a.nodeValue=o}catch(Be){zt(t,t.return,Be)}}break;case 3:if(nc=null,h=Nl,Nl=ec(n.containerInfo),In(n,t),Nl=h,Un(t),o&4&&a!==null&&a.memoizedState.isDehydrated)try{bi(n.containerInfo)}catch(Be){zt(t,t.return,Be)}hd&&(hd=!1,Zx(t));break;case 4:o=Nl,Nl=ec(t.stateNode.containerInfo),In(n,t),Un(t),Nl=o;break;case 12:In(n,t),Un(t);break;case 31:In(n,t),Un(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Ho(t,o)));break;case 13:In(n,t),Un(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Uo=ct()),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Ho(t,o)));break;case 22:h=t.memoizedState!==null;var H=a!==null&&a.memoizedState!==null,ee=or,oe=cn;if(or=ee||h,cn=oe||H,In(n,t),cn=oe,or=ee,Un(t),o&8192)e:for(n=t.stateNode,n._visibility=h?n._visibility&-2:n._visibility|1,h&&(a===null||H||or||cn||Aa(t)),a=null,n=t;;){if(n.tag===5||n.tag===26){if(a===null){H=a=n;try{if(p=H.stateNode,h)w=p.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{A=H.stateNode;var ue=H.memoizedProps.style,te=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;A.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(Be){zt(H,H.return,Be)}}}else if(n.tag===6){if(a===null){H=n;try{H.stateNode.nodeValue=h?"":H.memoizedProps}catch(Be){zt(H,H.return,Be)}}}else if(n.tag===18){if(a===null){H=n;try{var re=H.stateNode;h?Hp(re,!0):Hp(H.stateNode,!1)}catch(Be){zt(H,H.return,Be)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===t)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break e;for(;n.sibling===null;){if(n.return===null||n.return===t)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}o&4&&(o=t.updateQueue,o!==null&&(a=o.retryQueue,a!==null&&(o.retryQueue=null,Ho(t,a))));break;case 19:In(n,t),Un(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Ho(t,o)));break;case 30:break;case 21:break;default:In(n,t),Un(t)}}function Un(t){var n=t.flags;if(n&2){try{for(var a,o=t.return;o!==null;){if(Ux(o)){a=o;break}o=o.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var h=a.stateNode,p=dd(t);Lo(t,p,h);break;case 5:var w=a.stateNode;a.flags&32&&(Ar(w,""),a.flags&=-33);var A=dd(t);Lo(t,A,w);break;case 3:case 4:var H=a.stateNode.containerInfo,ee=dd(t);fd(t,ee,H);break;default:throw Error(i(161))}}catch(oe){zt(t,t.return,oe)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function Zx(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;Zx(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function ur(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Xx(t,n.alternate,n),n=n.sibling}function Aa(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Ir(4,n,n.return),Aa(n);break;case 1:Hl(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Hx(n,n.return,a),Aa(n);break;case 27:ws(n.stateNode);case 26:case 5:Hl(n,n.return),Aa(n);break;case 22:n.memoizedState===null&&Aa(n);break;case 30:Aa(n);break;default:Aa(n)}t=t.sibling}}function dr(t,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var o=n.alternate,h=t,p=n,w=p.flags;switch(p.tag){case 0:case 11:case 15:dr(h,p,a),ds(4,p);break;case 1:if(dr(h,p,a),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(ee){zt(o,o.return,ee)}if(o=p,h=o.updateQueue,h!==null){var A=o.stateNode;try{var H=h.shared.hiddenCallbacks;if(H!==null)for(h.shared.hiddenCallbacks=null,h=0;h<H.length;h++)Am(H[h],A)}catch(ee){zt(o,o.return,ee)}}a&&w&64&&Lx(p),fs(p,p.return);break;case 27:Yx(p);case 26:case 5:dr(h,p,a),a&&o===null&&w&4&&Ix(p),fs(p,p.return);break;case 12:dr(h,p,a);break;case 31:dr(h,p,a),a&&w&4&&Kx(h,p);break;case 13:dr(h,p,a),a&&w&4&&Wx(h,p);break;case 22:p.memoizedState===null&&dr(h,p,a),fs(p,p.return);break;case 30:break;default:dr(h,p,a)}n=n.sibling}}function md(t,n){var a=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),t=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),t!==a&&(t!=null&&t.refCount++,a!=null&&Ji(a))}function xd(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Ji(t))}function Al(t,n,a,o){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Jx(t,n,a,o),n=n.sibling}function Jx(t,n,a,o){var h=n.flags;switch(n.tag){case 0:case 11:case 15:Al(t,n,a,o),h&2048&&ds(9,n);break;case 1:Al(t,n,a,o);break;case 3:Al(t,n,a,o),h&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Ji(t)));break;case 12:if(h&2048){Al(t,n,a,o),t=n.stateNode;try{var p=n.memoizedProps,w=p.id,A=p.onPostCommit;typeof A=="function"&&A(w,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(H){zt(n,n.return,H)}}else Al(t,n,a,o);break;case 31:Al(t,n,a,o);break;case 13:Al(t,n,a,o);break;case 23:break;case 22:p=n.stateNode,w=n.alternate,n.memoizedState!==null?p._visibility&2?Al(t,n,a,o):hs(t,n):p._visibility&2?Al(t,n,a,o):(p._visibility|=2,oi(t,n,a,o,(n.subtreeFlags&10256)!==0||!1)),h&2048&&md(w,n);break;case 24:Al(t,n,a,o),h&2048&&xd(n.alternate,n);break;default:Al(t,n,a,o)}}function oi(t,n,a,o,h){for(h=h&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var p=t,w=n,A=a,H=o,ee=w.flags;switch(w.tag){case 0:case 11:case 15:oi(p,w,A,H,h),ds(8,w);break;case 23:break;case 22:var oe=w.stateNode;w.memoizedState!==null?oe._visibility&2?oi(p,w,A,H,h):hs(p,w):(oe._visibility|=2,oi(p,w,A,H,h)),h&&ee&2048&&md(w.alternate,w);break;case 24:oi(p,w,A,H,h),h&&ee&2048&&xd(w.alternate,w);break;default:oi(p,w,A,H,h)}n=n.sibling}}function hs(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=t,o=n,h=o.flags;switch(o.tag){case 22:hs(a,o),h&2048&&md(o.alternate,o);break;case 24:hs(a,o),h&2048&&xd(o.alternate,o);break;default:hs(a,o)}n=n.sibling}}var ms=8192;function ci(t,n,a){if(t.subtreeFlags&ms)for(t=t.child;t!==null;)Px(t,n,a),t=t.sibling}function Px(t,n,a){switch(t.tag){case 26:ci(t,n,a),t.flags&ms&&t.memoizedState!==null&&A2(a,Nl,t.memoizedState,t.memoizedProps);break;case 5:ci(t,n,a);break;case 3:case 4:var o=Nl;Nl=ec(t.stateNode.containerInfo),ci(t,n,a),Nl=o;break;case 22:t.memoizedState===null&&(o=t.alternate,o!==null&&o.memoizedState!==null?(o=ms,ms=16777216,ci(t,n,a),ms=o):ci(t,n,a));break;default:ci(t,n,a)}}function ep(t){var n=t.alternate;if(n!==null&&(t=n.child,t!==null)){n.child=null;do n=t.sibling,t.sibling=null,t=n;while(t!==null)}}function xs(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];bn=o,np(o,t)}ep(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)tp(t),t=t.sibling}function tp(t){switch(t.tag){case 0:case 11:case 15:xs(t),t.flags&2048&&Ir(9,t,t.return);break;case 3:xs(t);break;case 12:xs(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,Io(t)):xs(t);break;default:xs(t)}}function Io(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var o=n[a];bn=o,np(o,t)}ep(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Ir(8,n,n.return),Io(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Io(n));break;default:Io(n)}t=t.sibling}}function np(t,n){for(;bn!==null;){var a=bn;switch(a.tag){case 0:case 11:case 15:Ir(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var o=a.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:Ji(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,bn=o;else e:for(a=t;bn!==null;){o=bn;var h=o.sibling,p=o.return;if(Vx(o),o===a){bn=null;break e}if(h!==null){h.return=p,bn=h;break e}bn=p}}}var Yb={getCacheForType:function(t){var n=jn(an),a=n.data.get(t);return a===void 0&&(a=t(),n.data.set(t,a)),a},cacheSignal:function(){return jn(an).controller.signal}},qb=typeof WeakMap=="function"?WeakMap:Map,Et=0,Bt=null,dt=null,xt=0,Tt=0,ll=null,Ur=!1,ui=!1,pd=!1,fr=0,Pt=0,Yr=0,Da=0,yd=0,rl=0,di=0,ps=null,Yn=null,gd=!1,Uo=0,lp=0,Yo=1/0,qo=null,qr=null,hn=0,Xr=null,fi=null,hr=0,bd=0,vd=null,rp=null,ys=0,wd=null;function al(){return(Et&2)!==0&&xt!==0?xt&-xt:U.T!==null?Nd():Ia()}function ap(){if(rl===0)if((xt&536870912)===0||bt){var t=Rl;Rl<<=1,(Rl&3932160)===0&&(Rl=262144),rl=t}else rl=536870912;return t=tl.current,t!==null&&(t.flags|=32),rl}function qn(t,n,a){(t===Bt&&(Tt===2||Tt===9)||t.cancelPendingCommit!==null)&&(hi(t,0),Vr(t,xt,rl,!1)),nn(t,a),((Et&2)===0||t!==Bt)&&(t===Bt&&((Et&2)===0&&(Da|=a),Pt===4&&Vr(t,xt,rl,!1)),Il(t))}function ip(t,n,a){if((Et&6)!==0)throw Error(i(327));var o=!a&&(n&127)===0&&(n&t.expiredLanes)===0||rt(t,n),h=o?Gb(t,n):jd(t,n,!0),p=o;do{if(h===0){ui&&!o&&Vr(t,n,0,!1);break}else{if(a=t.current.alternate,p&&!Xb(a)){h=jd(t,n,!1),p=!1;continue}if(h===2){if(p=n,t.errorRecoveryDisabledLanes&p)var w=0;else w=t.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){n=w;e:{var A=t;h=ps;var H=A.current.memoizedState.isDehydrated;if(H&&(hi(A,w).flags|=256),w=jd(A,w,!1),w!==2){if(pd&&!H){A.errorRecoveryDisabledLanes|=p,Da|=p,h=4;break e}p=Yn,Yn=h,p!==null&&(Yn===null?Yn=p:Yn.push.apply(Yn,p))}h=w}if(p=!1,h!==2)continue}}if(h===1){hi(t,0),Vr(t,n,0,!0);break}e:{switch(o=t,p=h,p){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:Vr(o,n,rl,!Ur);break e;case 2:Yn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(h=Uo+300-ct(),10<h)){if(Vr(o,n,rl,!Ur),Oe(o,0,!0)!==0)break e;hr=n,o.timeoutHandle=Bp(sp.bind(null,o,a,Yn,qo,gd,n,rl,Da,di,Ur,p,"Throttled",-0,0),h);break e}sp(o,a,Yn,qo,gd,n,rl,Da,di,Ur,p,null,-0,0)}}break}while(!0);Il(t)}function sp(t,n,a,o,h,p,w,A,H,ee,oe,ue,te,re){if(t.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:Jn},Px(n,p,ue);var Be=(p&62914560)===p?Uo-ct():(p&4194048)===p?lp-ct():0;if(Be=D2(ue,Be),Be!==null){hr=p,t.cancelPendingCommit=Be(xp.bind(null,t,n,p,a,o,h,w,A,H,oe,ue,null,te,re)),Vr(t,p,w,!ee);return}}xp(t,n,p,a,o,h,w,A,H)}function Xb(t){for(var n=t;;){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 o=0;o<a.length;o++){var h=a[o],p=h.getSnapshot;h=h.value;try{if(!Pn(p(),h))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Vr(t,n,a,o){n&=~yd,n&=~Da,t.suspendedLanes|=n,t.pingedLanes&=~n,o&&(t.warmLanes|=n),o=t.expirationTimes;for(var h=n;0<h;){var p=31-ut(h),w=1<<p;o[p]=-1,h&=~w}a!==0&&Ri(t,a,n)}function Xo(){return(Et&6)===0?(gs(0),!1):!0}function kd(){if(dt!==null){if(Tt===0)var t=dt.return;else t=dt,nr=va=null,$u(t),li=null,es=0,t=dt;for(;t!==null;)$x(t.alternate,t),t=t.return;dt=null}}function hi(t,n){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,d2(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),hr=0,kd(),Bt=t,dt=a=er(t.current,null),xt=n,Tt=0,ll=null,Ur=!1,ui=rt(t,n),pd=!1,di=rl=yd=Da=Yr=Pt=0,Yn=ps=null,gd=!1,(n&8)!==0&&(n|=n&32);var o=t.entangledLanes;if(o!==0)for(t=t.entanglements,o&=n;0<o;){var h=31-ut(o),p=1<<h;n|=t[h],o&=~p}return fr=n,fo(),a}function op(t,n){lt=null,U.H=os,n===ni||n===vo?(n=Sm(),Tt=3):n===Eu?(n=Sm(),Tt=4):Tt=n===ed?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,ll=n,dt===null&&(Pt=1,Fo(t,dl(n,t.current)))}function cp(){var t=tl.current;return t===null?!0:(xt&4194048)===xt?xl===null:(xt&62914560)===xt||(xt&536870912)!==0?t===xl:!1}function up(){var t=U.H;return U.H=os,t===null?os:t}function dp(){var t=U.A;return U.A=Yb,t}function Vo(){Pt=4,Ur||(xt&4194048)!==xt&&tl.current!==null||(ui=!0),(Yr&134217727)===0&&(Da&134217727)===0||Bt===null||Vr(Bt,xt,rl,!1)}function jd(t,n,a){var o=Et;Et|=2;var h=up(),p=dp();(Bt!==t||xt!==n)&&(qo=null,hi(t,n)),n=!1;var w=Pt;e:do try{if(Tt!==0&&dt!==null){var A=dt,H=ll;switch(Tt){case 8:kd(),w=6;break e;case 3:case 2:case 9:case 6:tl.current===null&&(n=!0);var ee=Tt;if(Tt=0,ll=null,mi(t,A,H,ee),a&&ui){w=0;break e}break;default:ee=Tt,Tt=0,ll=null,mi(t,A,H,ee)}}Vb(),w=Pt;break}catch(oe){op(t,oe)}while(!0);return n&&t.shellSuspendCounter++,nr=va=null,Et=o,U.H=h,U.A=p,dt===null&&(Bt=null,xt=0,fo()),w}function Vb(){for(;dt!==null;)fp(dt)}function Gb(t,n){var a=Et;Et|=2;var o=up(),h=dp();Bt!==t||xt!==n?(qo=null,Yo=ct()+500,hi(t,n)):ui=rt(t,n);e:do try{if(Tt!==0&&dt!==null){n=dt;var p=ll;t:switch(Tt){case 1:Tt=0,ll=null,mi(t,n,p,1);break;case 2:case 9:if(km(p)){Tt=0,ll=null,hp(n);break}n=function(){Tt!==2&&Tt!==9||Bt!==t||(Tt=7),Il(t)},p.then(n,n);break e;case 3:Tt=7;break e;case 4:Tt=5;break e;case 7:km(p)?(Tt=0,ll=null,hp(n)):(Tt=0,ll=null,mi(t,n,p,7));break;case 5:var w=null;switch(dt.tag){case 26:w=dt.memoizedState;case 5:case 27:var A=dt;if(w?Jp(w):A.stateNode.complete){Tt=0,ll=null;var H=A.sibling;if(H!==null)dt=H;else{var ee=A.return;ee!==null?(dt=ee,Go(ee)):dt=null}break t}}Tt=0,ll=null,mi(t,n,p,5);break;case 6:Tt=0,ll=null,mi(t,n,p,6);break;case 8:kd(),Pt=6;break e;default:throw Error(i(462))}}Kb();break}catch(oe){op(t,oe)}while(!0);return nr=va=null,U.H=o,U.A=h,Et=a,dt!==null?0:(Bt=null,xt=0,fo(),Pt)}function Kb(){for(;dt!==null&&!Ge();)fp(dt)}function fp(t){var n=Ox(t.alternate,t,fr);t.memoizedProps=t.pendingProps,n===null?Go(t):dt=n}function hp(t){var n=t,a=n.alternate;switch(n.tag){case 15:case 0:n=Tx(a,n,n.pendingProps,n.type,void 0,xt);break;case 11:n=Tx(a,n,n.pendingProps,n.type.render,n.ref,xt);break;case 5:$u(n);default:$x(a,n),n=dt=dm(n,fr),n=Ox(a,n,fr)}t.memoizedProps=t.pendingProps,n===null?Go(t):dt=n}function mi(t,n,a,o){nr=va=null,$u(n),li=null,es=0;var h=n.return;try{if(Ob(t,h,n,a,xt)){Pt=1,Fo(t,dl(a,t.current)),dt=null;return}}catch(p){if(h!==null)throw dt=h,p;Pt=1,Fo(t,dl(a,t.current)),dt=null;return}n.flags&32768?(bt||o===1?t=!0:ui||(xt&536870912)!==0?t=!1:(Ur=t=!0,(o===2||o===9||o===3||o===6)&&(o=tl.current,o!==null&&o.tag===13&&(o.flags|=16384))),mp(n,t)):Go(n)}function Go(t){var n=t;do{if((n.flags&32768)!==0){mp(n,Ur);return}t=n.return;var a=Lb(n.alternate,n,fr);if(a!==null){dt=a;return}if(n=n.sibling,n!==null){dt=n;return}dt=n=t}while(n!==null);Pt===0&&(Pt=5)}function mp(t,n){do{var a=Hb(t.alternate,t);if(a!==null){a.flags&=32767,dt=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(t=t.sibling,t!==null)){dt=t;return}dt=t=a}while(t!==null);Pt=6,dt=null}function xp(t,n,a,o,h,p,w,A,H){t.cancelPendingCommit=null;do Ko();while(hn!==0);if((Et&6)!==0)throw Error(i(327));if(n!==null){if(n===t.current)throw Error(i(177));if(p=n.lanes|n.childLanes,p|=du,br(t,a,p,w,A,H),t===Bt&&(dt=Bt=null,xt=0),fi=n,Xr=t,hr=a,bd=p,vd=h,rp=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,Jb(Re,function(){return vp(),null})):(t.callbackNode=null,t.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=U.T,U.T=null,h=J.p,J.p=2,w=Et,Et|=4;try{Ib(t,n,a)}finally{Et=w,J.p=h,U.T=o}}hn=1,pp(),yp(),gp()}}function pp(){if(hn===1){hn=0;var t=Xr,n=fi,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=U.T,U.T=null;var o=J.p;J.p=2;var h=Et;Et|=4;try{Qx(n,t);var p=_d,w=nm(t.containerInfo),A=p.focusedElem,H=p.selectionRange;if(w!==A&&A&&A.ownerDocument&&tm(A.ownerDocument.documentElement,A)){if(H!==null&&iu(A)){var ee=H.start,oe=H.end;if(oe===void 0&&(oe=ee),"selectionStart"in A)A.selectionStart=ee,A.selectionEnd=Math.min(oe,A.value.length);else{var ue=A.ownerDocument||document,te=ue&&ue.defaultView||window;if(te.getSelection){var re=te.getSelection(),Be=A.textContent.length,Qe=Math.min(H.start,Be),Ft=H.end===void 0?Qe:Math.min(H.end,Be);!re.extend&&Qe>Ft&&(w=Ft,Ft=Qe,Qe=w);var Q=em(A,Qe),X=em(A,Ft);if(Q&&X&&(re.rangeCount!==1||re.anchorNode!==Q.node||re.anchorOffset!==Q.offset||re.focusNode!==X.node||re.focusOffset!==X.offset)){var P=ue.createRange();P.setStart(Q.node,Q.offset),re.removeAllRanges(),Qe>Ft?(re.addRange(P),re.extend(X.node,X.offset)):(P.setEnd(X.node,X.offset),re.addRange(P))}}}}for(ue=[],re=A;re=re.parentNode;)re.nodeType===1&&ue.push({element:re,left:re.scrollLeft,top:re.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<ue.length;A++){var ce=ue[A];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}ic=!!Fd,_d=Fd=null}finally{Et=h,J.p=o,U.T=a}}t.current=n,hn=2}}function yp(){if(hn===2){hn=0;var t=Xr,n=fi,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=U.T,U.T=null;var o=J.p;J.p=2;var h=Et;Et|=4;try{Xx(t,n.alternate,n)}finally{Et=h,J.p=o,U.T=a}}hn=3}}function gp(){if(hn===4||hn===3){hn=0,Dt();var t=Xr,n=fi,a=hr,o=rp;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?hn=5:(hn=0,fi=Xr=null,bp(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(qr=null),Fl(a),n=n.stateNode,nt&&typeof nt.onCommitFiberRoot=="function")try{nt.onCommitFiberRoot(Pe,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=U.T,h=J.p,J.p=2,U.T=null;try{for(var p=t.onRecoverableError,w=0;w<o.length;w++){var A=o[w];p(A.value,{componentStack:A.stack})}}finally{U.T=n,J.p=h}}(hr&3)!==0&&Ko(),Il(t),h=t.pendingLanes,(a&261930)!==0&&(h&42)!==0?t===wd?ys++:(ys=0,wd=t):ys=0,gs(0)}}function bp(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,Ji(n)))}function Ko(){return pp(),yp(),gp(),vp()}function vp(){if(hn!==5)return!1;var t=Xr,n=bd;bd=0;var a=Fl(hr),o=U.T,h=J.p;try{J.p=32>a?32:a,U.T=null,a=vd,vd=null;var p=Xr,w=hr;if(hn=0,fi=Xr=null,hr=0,(Et&6)!==0)throw Error(i(331));var A=Et;if(Et|=4,tp(p.current),Jx(p,p.current,w,a),Et=A,gs(0,!1),nt&&typeof nt.onPostCommitFiberRoot=="function")try{nt.onPostCommitFiberRoot(Pe,p)}catch{}return!0}finally{J.p=h,U.T=o,bp(t,n)}}function wp(t,n,a){n=dl(a,n),n=Pu(t.stateNode,n,2),t=$r(t,n,2),t!==null&&(nn(t,2),Il(t))}function zt(t,n,a){if(t.tag===3)wp(t,t,a);else for(;n!==null;){if(n.tag===3){wp(n,t,a);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(qr===null||!qr.has(o))){t=dl(a,t),a=kx(2),o=$r(n,a,2),o!==null&&(jx(a,o,n,t),nn(o,2),Il(o));break}}n=n.return}}function Sd(t,n,a){var o=t.pingCache;if(o===null){o=t.pingCache=new qb;var h=new Set;o.set(n,h)}else h=o.get(n),h===void 0&&(h=new Set,o.set(n,h));h.has(a)||(pd=!0,h.add(a),t=Wb.bind(null,t,n,a),n.then(t,t))}function Wb(t,n,a){var o=t.pingCache;o!==null&&o.delete(n),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,Bt===t&&(xt&a)===a&&(Pt===4||Pt===3&&(xt&62914560)===xt&&300>ct()-Uo?(Et&2)===0&&hi(t,0):yd|=a,di===xt&&(di=0)),Il(t)}function kp(t,n){n===0&&(n=gt()),t=ya(t,n),t!==null&&(nn(t,n),Il(t))}function Qb(t){var n=t.memoizedState,a=0;n!==null&&(a=n.retryLane),kp(t,a)}function Zb(t,n){var a=0;switch(t.tag){case 31:case 13:var o=t.stateNode,h=t.memoizedState;h!==null&&(a=h.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(i(314))}o!==null&&o.delete(n),kp(t,a)}function Jb(t,n){return Ne(t,n)}var Wo=null,xi=null,Cd=!1,Qo=!1,Ed=!1,Gr=0;function Il(t){t!==xi&&t.next===null&&(xi===null?Wo=xi=t:xi=xi.next=t),Qo=!0,Cd||(Cd=!0,e2())}function gs(t,n){if(!Ed&&Qo){Ed=!0;do for(var a=!1,o=Wo;o!==null;){if(t!==0){var h=o.pendingLanes;if(h===0)var p=0;else{var w=o.suspendedLanes,A=o.pingedLanes;p=(1<<31-ut(42|t)+1)-1,p&=h&~(w&~A),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,Ep(o,p))}else p=xt,p=Oe(o,o===Bt?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||rt(o,p)||(a=!0,Ep(o,p));o=o.next}while(a);Ed=!1}}function Pb(){jp()}function jp(){Qo=Cd=!1;var t=0;Gr!==0&&u2()&&(t=Gr);for(var n=ct(),a=null,o=Wo;o!==null;){var h=o.next,p=Sp(o,n);p===0?(o.next=null,a===null?Wo=h:a.next=h,h===null&&(xi=a)):(a=o,(t!==0||(p&3)!==0)&&(Qo=!0)),o=h}hn!==0&&hn!==5||gs(t),Gr!==0&&(Gr=0)}function Sp(t,n){for(var a=t.suspendedLanes,o=t.pingedLanes,h=t.expirationTimes,p=t.pendingLanes&-62914561;0<p;){var w=31-ut(p),A=1<<w,H=h[w];H===-1?((A&a)===0||(A&o)!==0)&&(h[w]=pe(A,n)):H<=n&&(t.expiredLanes|=A),p&=~A}if(n=Bt,a=xt,a=Oe(t,t===n?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o=t.callbackNode,a===0||t===n&&(Tt===2||Tt===9)||t.cancelPendingCommit!==null)return o!==null&&o!==null&&Ie(o),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||rt(t,a)){if(n=a&-a,n===t.callbackPriority)return n;switch(o!==null&&Ie(o),Fl(a)){case 2:case 8:a=be;break;case 32:a=Re;break;case 268435456:a=xe;break;default:a=Re}return o=Cp.bind(null,t),a=Ne(a,o),t.callbackPriority=n,t.callbackNode=a,n}return o!==null&&o!==null&&Ie(o),t.callbackPriority=2,t.callbackNode=null,2}function Cp(t,n){if(hn!==0&&hn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(Ko()&&t.callbackNode!==a)return null;var o=xt;return o=Oe(t,t===Bt?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o===0?null:(ip(t,o,n),Sp(t,ct()),t.callbackNode!=null&&t.callbackNode===a?Cp.bind(null,t):null)}function Ep(t,n){if(Ko())return null;ip(t,n,!0)}function e2(){f2(function(){(Et&6)!==0?Ne(se,Pb):jp()})}function Nd(){if(Gr===0){var t=ei;t===0&&(t=kt,kt<<=1,(kt&261888)===0&&(kt=256)),Gr=t}return Gr}function Np(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Zn(""+t)}function Ap(t,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,t.id&&a.setAttribute("form",t.id),n.parentNode.insertBefore(a,n),t=new FormData(t),a.parentNode.removeChild(a),t}function t2(t,n,a,o,h){if(n==="submit"&&a&&a.stateNode===h){var p=Np((h[vn]||null).action),w=o.submitter;w&&(n=(n=w[vn]||null)?Np(n.formAction):w.getAttribute("formAction"),n!==null&&(p=n,w=null));var A=new We("action","action",null,o,h);t.push({event:A,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Gr!==0){var H=w?Ap(h,w):new FormData(h);Gu(a,{pending:!0,data:H,method:h.method,action:p},null,H)}}else typeof p=="function"&&(A.preventDefault(),H=w?Ap(h,w):new FormData(h),Gu(a,{pending:!0,data:H,method:h.method,action:p},p,H))},currentTarget:h}]})}}for(var Ad=0;Ad<uu.length;Ad++){var Dd=uu[Ad],n2=Dd.toLowerCase(),l2=Dd[0].toUpperCase()+Dd.slice(1);El(n2,"on"+l2)}El(am,"onAnimationEnd"),El(im,"onAnimationIteration"),El(sm,"onAnimationStart"),El("dblclick","onDoubleClick"),El("focusin","onFocus"),El("focusout","onBlur"),El(bb,"onTransitionRun"),El(vb,"onTransitionStart"),El(wb,"onTransitionCancel"),El(om,"onTransitionEnd"),jr("onMouseEnter",["mouseout","mouseover"]),jr("onMouseLeave",["mouseout","mouseover"]),jr("onPointerEnter",["pointerout","pointerover"]),jr("onPointerLeave",["pointerout","pointerover"]),Qn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Qn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Qn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Qn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Qn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Qn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bs="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(" "),r2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(bs));function Dp(t,n){n=(n&4)!==0;for(var a=0;a<t.length;a++){var o=t[a],h=o.event;o=o.listeners;e:{var p=void 0;if(n)for(var w=o.length-1;0<=w;w--){var A=o[w],H=A.instance,ee=A.currentTarget;if(A=A.listener,H!==p&&h.isPropagationStopped())break e;p=A,h.currentTarget=ee;try{p(h)}catch(oe){uo(oe)}h.currentTarget=null,p=H}else for(w=0;w<o.length;w++){if(A=o[w],H=A.instance,ee=A.currentTarget,A=A.listener,H!==p&&h.isPropagationStopped())break e;p=A,h.currentTarget=ee;try{p(h)}catch(oe){uo(oe)}h.currentTarget=null,p=H}}}}function ft(t,n){var a=n[Ua];a===void 0&&(a=n[Ua]=new Set);var o=t+"__bubble";a.has(o)||(Tp(n,t,2,!1),a.add(o))}function Td(t,n,a){var o=0;n&&(o|=4),Tp(a,t,o,n)}var Zo="_reactListening"+Math.random().toString(36).slice(2);function zd(t){if(!t[Zo]){t[Zo]=!0,Wn.forEach(function(a){a!=="selectionchange"&&(r2.has(a)||Td(a,!1,t),Td(a,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[Zo]||(n[Zo]=!0,Td("selectionchange",!1,n))}}function Tp(t,n,a,o){switch(a1(n)){case 2:var h=M2;break;case 8:h=R2;break;default:h=Vd}a=h.bind(null,n,a,t),h=void 0,!qa||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(h=!0),o?h!==void 0?t.addEventListener(n,a,{capture:!0,passive:h}):t.addEventListener(n,a,!0):h!==void 0?t.addEventListener(n,a,{passive:h}):t.addEventListener(n,a,!1)}function Md(t,n,a,o,h){var p=o;if((n&1)===0&&(n&2)===0&&o!==null)e:for(;;){if(o===null)return;var w=o.tag;if(w===3||w===4){var A=o.stateNode.containerInfo;if(A===h)break;if(w===4)for(w=o.return;w!==null;){var H=w.tag;if((H===3||H===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;A!==null;){if(w=_l(A),w===null)return;if(H=w.tag,H===5||H===6||H===26||H===27){o=p=w;continue e}A=A.parentNode}}o=o.return}fn(function(){var ee=p,oe=Ui(a),ue=[];e:{var te=cm.get(t);if(te!==void 0){var re=We,Be=t;switch(t){case"keypress":if(we(a)===0)break e;case"keydown":case"keyup":re=Zg;break;case"focusin":Be="focus",re=Wt;break;case"focusout":Be="blur",re=Wt;break;case"beforeblur":case"afterblur":re=Wt;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":re=Pl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":re=wn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":re=eb;break;case am:case im:case sm:re=Ug;break;case om:re=nb;break;case"scroll":case"scrollend":re=oo;break;case"wheel":re=rb;break;case"copy":case"cut":case"paste":re=qg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":re=Hh;break;case"toggle":case"beforetoggle":re=ib}var Qe=(n&4)!==0,Ft=!Qe&&(t==="scroll"||t==="scrollend"),Q=Qe?te!==null?te+"Capture":null:te;Qe=[];for(var X=ee,P;X!==null;){var ce=X;if(P=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||P===null||Q===null||(ce=Sl(X,Q),ce!=null&&Qe.push(vs(X,ce,P))),Ft)break;X=X.return}0<Qe.length&&(te=new re(te,Be,null,a,oe),ue.push({event:te,listeners:Qe}))}}if((n&7)===0){e:{if(te=t==="mouseover"||t==="pointerover",re=t==="mouseout"||t==="pointerout",te&&a!==Ii&&(Be=a.relatedTarget||a.fromElement)&&(_l(Be)||Be[Kn]))break e;if((re||te)&&(te=oe.window===oe?oe:(te=oe.ownerDocument)?te.defaultView||te.parentWindow:window,re?(Be=a.relatedTarget||a.toElement,re=ee,Be=Be?_l(Be):null,Be!==null&&(Ft=u(Be),Qe=Be.tag,Be!==Ft||Qe!==5&&Qe!==27&&Qe!==6)&&(Be=null)):(re=null,Be=ee),re!==Be)){if(Qe=Pl,ce="onMouseLeave",Q="onMouseEnter",X="mouse",(t==="pointerout"||t==="pointerover")&&(Qe=Hh,ce="onPointerLeave",Q="onPointerEnter",X="pointer"),Ft=re==null?te:wr(re),P=Be==null?te:wr(Be),te=new Qe(ce,X+"leave",re,a,oe),te.target=Ft,te.relatedTarget=P,ce=null,_l(oe)===ee&&(Qe=new Qe(Q,X+"enter",Be,a,oe),Qe.target=P,Qe.relatedTarget=Ft,ce=Qe),Ft=ce,re&&Be)t:{for(Qe=a2,Q=re,X=Be,P=0,ce=Q;ce;ce=Qe(ce))P++;ce=0;for(var Ye=X;Ye;Ye=Qe(Ye))ce++;for(;0<P-ce;)Q=Qe(Q),P--;for(;0<ce-P;)X=Qe(X),ce--;for(;P--;){if(Q===X||X!==null&&Q===X.alternate){Qe=Q;break t}Q=Qe(Q),X=Qe(X)}Qe=null}else Qe=null;re!==null&&zp(ue,te,re,Qe,!1),Be!==null&&Ft!==null&&zp(ue,Ft,Be,Qe,!0)}}e:{if(te=ee?wr(ee):window,re=te.nodeName&&te.nodeName.toLowerCase(),re==="select"||re==="input"&&te.type==="file")var jt=Kh;else if(Vh(te))if(Wh)jt=pb;else{jt=mb;var He=hb}else re=te.nodeName,!re||re.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?ee&&Hi(ee.elementType)&&(jt=Kh):jt=xb;if(jt&&(jt=jt(t,ee))){Gh(ue,jt,a,oe);break e}He&&He(t,te,ee),t==="focusout"&&ee&&te.type==="number"&&ee.memoizedProps.value!=null&&ha(te,"number",te.value)}switch(He=ee?wr(ee):window,t){case"focusin":(Vh(He)||He.contentEditable==="true")&&(Va=He,su=ee,Wi=null);break;case"focusout":Wi=su=Va=null;break;case"mousedown":ou=!0;break;case"contextmenu":case"mouseup":case"dragend":ou=!1,lm(ue,a,oe);break;case"selectionchange":if(gb)break;case"keydown":case"keyup":lm(ue,a,oe)}var at;if(lu)e:{switch(t){case"compositionstart":var pt="onCompositionStart";break e;case"compositionend":pt="onCompositionEnd";break e;case"compositionupdate":pt="onCompositionUpdate";break e}pt=void 0}else Xa?qh(t,a)&&(pt="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(pt="onCompositionStart");pt&&(Ih&&a.locale!=="ko"&&(Xa||pt!=="onCompositionStart"?pt==="onCompositionEnd"&&Xa&&(at=me()):(F=oe,le="value"in F?F.value:F.textContent,Xa=!0)),He=Jo(ee,pt),0<He.length&&(pt=new Lh(pt,t,null,a,oe),ue.push({event:pt,listeners:He}),at?pt.data=at:(at=Xh(a),at!==null&&(pt.data=at)))),(at=ob?cb(t,a):ub(t,a))&&(pt=Jo(ee,"onBeforeInput"),0<pt.length&&(He=new Lh("onBeforeInput","beforeinput",null,a,oe),ue.push({event:He,listeners:pt}),He.data=at)),t2(ue,t,ee,a,oe)}Dp(ue,n)})}function vs(t,n,a){return{instance:t,listener:n,currentTarget:a}}function Jo(t,n){for(var a=n+"Capture",o=[];t!==null;){var h=t,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=Sl(t,a),h!=null&&o.unshift(vs(t,h,p)),h=Sl(t,n),h!=null&&o.push(vs(t,h,p))),t.tag===3)return o;t=t.return}return[]}function a2(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function zp(t,n,a,o,h){for(var p=n._reactName,w=[];a!==null&&a!==o;){var A=a,H=A.alternate,ee=A.stateNode;if(A=A.tag,H!==null&&H===o)break;A!==5&&A!==26&&A!==27||ee===null||(H=ee,h?(ee=Sl(a,p),ee!=null&&w.unshift(vs(a,ee,H))):h||(ee=Sl(a,p),ee!=null&&w.push(vs(a,ee,H)))),a=a.return}w.length!==0&&t.push({event:n,listeners:w})}var i2=/\r\n?/g,s2=/\u0000|\uFFFD/g;function Mp(t){return(typeof t=="string"?t:""+t).replace(i2,`
|
|
49
|
+
`).replace(s2,"")}function Rp(t,n){return n=Mp(n),Mp(t)===n}function Rt(t,n,a,o,h,p){switch(a){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||Ar(t,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&Ar(t,""+o);break;case"className":Sr(t,"class",o);break;case"tabIndex":Sr(t,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Sr(t,a,o);break;case"style":io(t,o,p);break;case"data":if(n!=="object"){Sr(t,"data",o);break}case"src":case"href":if(o===""&&(n!=="a"||a!=="href")){t.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(a);break}o=Zn(""+o),t.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="function"){t.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"&&Rt(t,n,"name",h.name,h,null),Rt(t,n,"formEncType",h.formEncType,h,null),Rt(t,n,"formMethod",h.formMethod,h,null),Rt(t,n,"formTarget",h.formTarget,h,null)):(Rt(t,n,"encType",h.encType,h,null),Rt(t,n,"method",h.method,h,null),Rt(t,n,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(a);break}o=Zn(""+o),t.setAttribute(a,o);break;case"onClick":o!=null&&(t.onclick=Jn);break;case"onScroll":o!=null&&ft("scroll",t);break;case"onScrollEnd":o!=null&&ft("scrollend",t);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(i(61));if(a=o.__html,a!=null){if(h.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"multiple":t.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":t.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){t.removeAttribute("xlink:href");break}a=Zn(""+o),t.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":o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(a,""+o):t.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":o&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":o===!0?t.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(a,o):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?t.setAttribute(a,o):t.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?t.removeAttribute(a):t.setAttribute(a,o);break;case"popover":ft("beforetoggle",t),ft("toggle",t),Bl(t,"popover",o);break;case"xlinkActuate":jl(t,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":jl(t,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":jl(t,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":jl(t,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":jl(t,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":jl(t,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":jl(t,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":jl(t,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":jl(t,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Bl(t,"is",o);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=eu.get(a)||a,Bl(t,a,o))}}function Rd(t,n,a,o,h,p){switch(a){case"style":io(t,o,p);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(i(61));if(a=o.__html,a!=null){if(h.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"children":typeof o=="string"?Ar(t,o):(typeof o=="number"||typeof o=="bigint")&&Ar(t,""+o);break;case"onScroll":o!=null&&ft("scroll",t);break;case"onScrollEnd":o!=null&&ft("scrollend",t);break;case"onClick":o!=null&&(t.onclick=Jn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!wl.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=t[vn]||null,p=p!=null?p[a]:null,typeof p=="function"&&t.removeEventListener(n,p,h),typeof o=="function")){typeof p!="function"&&p!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(n,o,h);break e}a in t?t[a]=o:o===!0?t.setAttribute(a,""):Bl(t,a,o)}}}function Cn(t,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ft("error",t),ft("load",t);var o=!1,h=!1,p;for(p in a)if(a.hasOwnProperty(p)){var w=a[p];if(w!=null)switch(p){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Rt(t,n,p,w,a,null)}}h&&Rt(t,n,"srcSet",a.srcSet,a,null),o&&Rt(t,n,"src",a.src,a,null);return;case"input":ft("invalid",t);var A=p=w=h=null,H=null,ee=null;for(o in a)if(a.hasOwnProperty(o)){var oe=a[o];if(oe!=null)switch(o){case"name":h=oe;break;case"type":w=oe;break;case"checked":H=oe;break;case"defaultChecked":ee=oe;break;case"value":p=oe;break;case"defaultValue":A=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(i(137,n));break;default:Rt(t,n,o,oe,a,null)}}Ya(t,p,A,H,ee,w,h,!1);return;case"select":ft("invalid",t),o=w=p=null;for(h in a)if(a.hasOwnProperty(h)&&(A=a[h],A!=null))switch(h){case"value":p=A;break;case"defaultValue":w=A;break;case"multiple":o=A;default:Rt(t,n,h,A,a,null)}n=p,a=w,t.multiple=!!o,n!=null?Nr(t,!!o,n,!1):a!=null&&Nr(t,!!o,a,!0);return;case"textarea":ft("invalid",t),p=h=o=null;for(w in a)if(a.hasOwnProperty(w)&&(A=a[w],A!=null))switch(w){case"value":o=A;break;case"defaultValue":h=A;break;case"children":p=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(i(91));break;default:Rt(t,n,w,A,a,null)}Li(t,o,h,p);return;case"option":for(H in a)if(a.hasOwnProperty(H)&&(o=a[H],o!=null))switch(H){case"selected":t.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Rt(t,n,H,o,a,null)}return;case"dialog":ft("beforetoggle",t),ft("toggle",t),ft("cancel",t),ft("close",t);break;case"iframe":case"object":ft("load",t);break;case"video":case"audio":for(o=0;o<bs.length;o++)ft(bs[o],t);break;case"image":ft("error",t),ft("load",t);break;case"details":ft("toggle",t);break;case"embed":case"source":case"link":ft("error",t),ft("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in a)if(a.hasOwnProperty(ee)&&(o=a[ee],o!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Rt(t,n,ee,o,a,null)}return;default:if(Hi(n)){for(oe in a)a.hasOwnProperty(oe)&&(o=a[oe],o!==void 0&&Rd(t,n,oe,o,a,void 0));return}}for(A in a)a.hasOwnProperty(A)&&(o=a[A],o!=null&&Rt(t,n,A,o,a,null))}function o2(t,n,a,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,w=null,A=null,H=null,ee=null,oe=null;for(re in a){var ue=a[re];if(a.hasOwnProperty(re)&&ue!=null)switch(re){case"checked":break;case"value":break;case"defaultValue":H=ue;default:o.hasOwnProperty(re)||Rt(t,n,re,null,o,ue)}}for(var te in o){var re=o[te];if(ue=a[te],o.hasOwnProperty(te)&&(re!=null||ue!=null))switch(te){case"type":p=re;break;case"name":h=re;break;case"checked":ee=re;break;case"defaultChecked":oe=re;break;case"value":w=re;break;case"defaultValue":A=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(i(137,n));break;default:re!==ue&&Rt(t,n,te,re,o,ue)}}$i(t,w,A,H,ee,oe,p,h);return;case"select":re=w=A=te=null;for(p in a)if(H=a[p],a.hasOwnProperty(p)&&H!=null)switch(p){case"value":break;case"multiple":re=H;default:o.hasOwnProperty(p)||Rt(t,n,p,null,o,H)}for(h in o)if(p=o[h],H=a[h],o.hasOwnProperty(h)&&(p!=null||H!=null))switch(h){case"value":te=p;break;case"defaultValue":A=p;break;case"multiple":w=p;default:p!==H&&Rt(t,n,h,p,o,H)}n=A,a=w,o=re,te!=null?Nr(t,!!a,te,!1):!!o!=!!a&&(n!=null?Nr(t,!!a,n,!0):Nr(t,!!a,a?[]:"",!1));return;case"textarea":re=te=null;for(A in a)if(h=a[A],a.hasOwnProperty(A)&&h!=null&&!o.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:Rt(t,n,A,null,o,h)}for(w in o)if(h=o[w],p=a[w],o.hasOwnProperty(w)&&(h!=null||p!=null))switch(w){case"value":te=h;break;case"defaultValue":re=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(i(91));break;default:h!==p&&Rt(t,n,w,h,o,p)}ro(t,te,re);return;case"option":for(var Be in a)if(te=a[Be],a.hasOwnProperty(Be)&&te!=null&&!o.hasOwnProperty(Be))switch(Be){case"selected":t.selected=!1;break;default:Rt(t,n,Be,null,o,te)}for(H in o)if(te=o[H],re=a[H],o.hasOwnProperty(H)&&te!==re&&(te!=null||re!=null))switch(H){case"selected":t.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:Rt(t,n,H,te,o,re)}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 Qe in a)te=a[Qe],a.hasOwnProperty(Qe)&&te!=null&&!o.hasOwnProperty(Qe)&&Rt(t,n,Qe,null,o,te);for(ee in o)if(te=o[ee],re=a[ee],o.hasOwnProperty(ee)&&te!==re&&(te!=null||re!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(i(137,n));break;default:Rt(t,n,ee,te,o,re)}return;default:if(Hi(n)){for(var Ft in a)te=a[Ft],a.hasOwnProperty(Ft)&&te!==void 0&&!o.hasOwnProperty(Ft)&&Rd(t,n,Ft,void 0,o,te);for(oe in o)te=o[oe],re=a[oe],!o.hasOwnProperty(oe)||te===re||te===void 0&&re===void 0||Rd(t,n,oe,te,o,re);return}}for(var Q in a)te=a[Q],a.hasOwnProperty(Q)&&te!=null&&!o.hasOwnProperty(Q)&&Rt(t,n,Q,null,o,te);for(ue in o)te=o[ue],re=a[ue],!o.hasOwnProperty(ue)||te===re||te==null&&re==null||Rt(t,n,ue,te,o,re)}function Fp(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function c2(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var h=a[o],p=h.transferSize,w=h.initiatorType,A=h.duration;if(p&&A&&Fp(w)){for(w=0,A=h.responseEnd,o+=1;o<a.length;o++){var H=a[o],ee=H.startTime;if(ee>A)break;var oe=H.transferSize,ue=H.initiatorType;oe&&Fp(ue)&&(H=H.responseEnd,w+=oe*(H<A?1:(A-ee)/(H-ee)))}if(--o,n+=8*(p+w)/(h.duration/1e3),t++,10<t)break}}if(0<t)return n/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Fd=null,_d=null;function Po(t){return t.nodeType===9?t:t.ownerDocument}function _p(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Op(t,n){if(t===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&n==="foreignObject"?0:t}function Od(t,n){return t==="textarea"||t==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Bd=null;function u2(){var t=window.event;return t&&t.type==="popstate"?t===Bd?!1:(Bd=t,!0):(Bd=null,!1)}var Bp=typeof setTimeout=="function"?setTimeout:void 0,d2=typeof clearTimeout=="function"?clearTimeout:void 0,$p=typeof Promise=="function"?Promise:void 0,f2=typeof queueMicrotask=="function"?queueMicrotask:typeof $p<"u"?function(t){return $p.resolve(null).then(t).catch(h2)}:Bp;function h2(t){setTimeout(function(){throw t})}function Kr(t){return t==="head"}function Lp(t,n){var a=n,o=0;do{var h=a.nextSibling;if(t.removeChild(a),h&&h.nodeType===8)if(a=h.data,a==="/$"||a==="/&"){if(o===0){t.removeChild(h),bi(n);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")ws(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,ws(a);for(var p=a.firstChild;p;){var w=p.nextSibling,A=p.nodeName;p[vr]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=w}}else a==="body"&&ws(t.ownerDocument.body);a=h}while(a);bi(n)}function Hp(t,n){var a=t;t=0;do{var o=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||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=o}while(a)}function $d(t){var n=t.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":$d(a),vl(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function m2(t,n,a,o){for(;t.nodeType===1;){var h=a;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!o&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(o){if(!t[vr])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(p=t.getAttribute("rel"),p==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(p!==h.rel||t.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||t.getAttribute("title")!==(h.title==null?null:h.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(p=t.getAttribute("src"),(p!==(h.src==null?null:h.src)||t.getAttribute("type")!==(h.type==null?null:h.type)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&t.getAttribute("name")===p)return t}else return t;if(t=pl(t.nextSibling),t===null)break}return null}function x2(t,n,a){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=pl(t.nextSibling),t===null))return null;return t}function Ip(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=pl(t.nextSibling),t===null))return null;return t}function Ld(t){return t.data==="$?"||t.data==="$~"}function Hd(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function p2(t,n){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||a.readyState!=="loading")n();else{var o=function(){n(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),t._reactRetry=o}}function pl(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return t}var Id=null;function Up(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(n===0)return pl(t.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}t=t.nextSibling}return null}function Yp(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return t;n--}else a!=="/$"&&a!=="/&"||n++}t=t.previousSibling}return null}function qp(t,n,a){switch(n=Po(a),t){case"html":if(t=n.documentElement,!t)throw Error(i(452));return t;case"head":if(t=n.head,!t)throw Error(i(453));return t;case"body":if(t=n.body,!t)throw Error(i(454));return t;default:throw Error(i(451))}}function ws(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);vl(t)}var yl=new Map,Xp=new Set;function ec(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var mr=J.d;J.d={f:y2,r:g2,D:b2,C:v2,L:w2,m:k2,X:S2,S:j2,M:C2};function y2(){var t=mr.f(),n=Xo();return t||n}function g2(t){var n=Zl(t);n!==null&&n.tag===5&&n.type==="form"?ox(n):mr.r(t)}var pi=typeof document>"u"?null:document;function Vp(t,n,a){var o=pi;if(o&&typeof n=="string"&&n){var h=Ln(n);h='link[rel="'+t+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),Xp.has(h)||(Xp.add(h),t={rel:t,crossOrigin:a,href:n},o.querySelector(h)===null&&(n=o.createElement("link"),Cn(n,"link",t),Zt(n),o.head.appendChild(n)))}}function b2(t){mr.D(t),Vp("dns-prefetch",t,null)}function v2(t,n){mr.C(t,n),Vp("preconnect",t,n)}function w2(t,n,a){mr.L(t,n,a);var o=pi;if(o&&t&&n){var h='link[rel="preload"][as="'+Ln(n)+'"]';n==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+Ln(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+Ln(a.imageSizes)+'"]')):h+='[href="'+Ln(t)+'"]';var p=h;switch(n){case"style":p=yi(t);break;case"script":p=gi(t)}yl.has(p)||(t=y({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:t,as:n},a),yl.set(p,t),o.querySelector(h)!==null||n==="style"&&o.querySelector(ks(p))||n==="script"&&o.querySelector(js(p))||(n=o.createElement("link"),Cn(n,"link",t),Zt(n),o.head.appendChild(n)))}}function k2(t,n){mr.m(t,n);var a=pi;if(a&&t){var o=n&&typeof n.as=="string"?n.as:"script",h='link[rel="modulepreload"][as="'+Ln(o)+'"][href="'+Ln(t)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=gi(t)}if(!yl.has(p)&&(t=y({rel:"modulepreload",href:t},n),yl.set(p,t),a.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(js(p)))return}o=a.createElement("link"),Cn(o,"link",t),Zt(o),a.head.appendChild(o)}}}function j2(t,n,a){mr.S(t,n,a);var o=pi;if(o&&t){var h=kr(o).hoistableStyles,p=yi(t);n=n||"default";var w=h.get(p);if(!w){var A={loading:0,preload:null};if(w=o.querySelector(ks(p)))A.loading=5;else{t=y({rel:"stylesheet",href:t,"data-precedence":n},a),(a=yl.get(p))&&Ud(t,a);var H=w=o.createElement("link");Zt(H),Cn(H,"link",t),H._p=new Promise(function(ee,oe){H.onload=ee,H.onerror=oe}),H.addEventListener("load",function(){A.loading|=1}),H.addEventListener("error",function(){A.loading|=2}),A.loading|=4,tc(w,n,o)}w={type:"stylesheet",instance:w,count:1,state:A},h.set(p,w)}}}function S2(t,n){mr.X(t,n);var a=pi;if(a&&t){var o=kr(a).hoistableScripts,h=gi(t),p=o.get(h);p||(p=a.querySelector(js(h)),p||(t=y({src:t,async:!0},n),(n=yl.get(h))&&Yd(t,n),p=a.createElement("script"),Zt(p),Cn(p,"link",t),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function C2(t,n){mr.M(t,n);var a=pi;if(a&&t){var o=kr(a).hoistableScripts,h=gi(t),p=o.get(h);p||(p=a.querySelector(js(h)),p||(t=y({src:t,async:!0,type:"module"},n),(n=yl.get(h))&&Yd(t,n),p=a.createElement("script"),Zt(p),Cn(p,"link",t),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Gp(t,n,a,o){var h=(h=ve.current)?ec(h):null;if(!h)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=yi(a.href),a=kr(h).hoistableStyles,o=a.get(n),o||(o={type:"style",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=yi(a.href);var p=kr(h).hoistableStyles,w=p.get(t);if(w||(h=h.ownerDocument||h,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(t,w),(p=h.querySelector(ks(t)))&&!p._p&&(w.instance=p,w.state.loading=5),yl.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},yl.set(t,a),p||E2(h,t,a,w.state))),n&&o===null)throw Error(i(528,""));return w}if(n&&o!==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=gi(a),a=kr(h).hoistableScripts,o=a.get(n),o||(o={type:"script",instance:null,count:0,state:null},a.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,t))}}function yi(t){return'href="'+Ln(t)+'"'}function ks(t){return'link[rel="stylesheet"]['+t+"]"}function Kp(t){return y({},t,{"data-precedence":t.precedence,precedence:null})}function E2(t,n,a,o){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=t.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),Cn(n,"link",a),Zt(n),t.head.appendChild(n))}function gi(t){return'[src="'+Ln(t)+'"]'}function js(t){return"script[async]"+t}function Wp(t,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var o=t.querySelector('style[data-href~="'+Ln(a.href)+'"]');if(o)return n.instance=o,Zt(o),o;var h=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),Zt(o),Cn(o,"style",h),tc(o,a.precedence,t),n.instance=o;case"stylesheet":h=yi(a.href);var p=t.querySelector(ks(h));if(p)return n.state.loading|=4,n.instance=p,Zt(p),p;o=Kp(a),(h=yl.get(h))&&Ud(o,h),p=(t.ownerDocument||t).createElement("link"),Zt(p);var w=p;return w._p=new Promise(function(A,H){w.onload=A,w.onerror=H}),Cn(p,"link",o),n.state.loading|=4,tc(p,a.precedence,t),n.instance=p;case"script":return p=gi(a.src),(h=t.querySelector(js(p)))?(n.instance=h,Zt(h),h):(o=a,(h=yl.get(p))&&(o=y({},a),Yd(o,h)),t=t.ownerDocument||t,h=t.createElement("script"),Zt(h),Cn(h,"link",o),t.head.appendChild(h),n.instance=h);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,tc(o,a.precedence,t));return n.instance}function tc(t,n,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=o.length?o[o.length-1]:null,p=h,w=0;w<o.length;w++){var A=o[w];if(A.dataset.precedence===n)p=A;else if(p!==h)break}p?p.parentNode.insertBefore(t,p.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(t,n.firstChild))}function Ud(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function Yd(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var nc=null;function Qp(t,n,a){if(nc===null){var o=new Map,h=nc=new Map;h.set(a,o)}else h=nc,o=h.get(a),o||(o=new Map,h.set(a,o));if(o.has(t))return o;for(o.set(t,null),a=a.getElementsByTagName(t),h=0;h<a.length;h++){var p=a[h];if(!(p[vr]||p[Vt]||t==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var w=p.getAttribute(n)||"";w=t+w;var A=o.get(w);A?A.push(p):o.set(w,[p])}}return o}function Zp(t,n,a){t=t.ownerDocument||t,t.head.insertBefore(a,n==="title"?t.querySelector("head > title"):null)}function N2(t,n,a){if(a===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return t=n.disabled,typeof n.precedence=="string"&&t==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Jp(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function A2(t,n,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var h=yi(o.href),p=n.querySelector(ks(h));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=lc.bind(t),n.then(t,t)),a.state.loading|=4,a.instance=p,Zt(p);return}p=n.ownerDocument||n,o=Kp(o),(h=yl.get(h))&&Ud(o,h),p=p.createElement("link"),Zt(p);var w=p;w._p=new Promise(function(A,H){w.onload=A,w.onerror=H}),Cn(p,"link",o),a.instance=p}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=lc.bind(t),n.addEventListener("load",a),n.addEventListener("error",a))}}var qd=0;function D2(t,n){return t.stylesheets&&t.count===0&&ac(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var o=setTimeout(function(){if(t.stylesheets&&ac(t,t.stylesheets),t.unsuspend){var p=t.unsuspend;t.unsuspend=null,p()}},6e4+n);0<t.imgBytes&&qd===0&&(qd=62500*c2());var h=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&ac(t,t.stylesheets),t.unsuspend)){var p=t.unsuspend;t.unsuspend=null,p()}},(t.imgBytes>qd?50:800)+n);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function lc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ac(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var rc=null;function ac(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,rc=new Map,n.forEach(T2,t),rc=null,lc.call(t))}function T2(t,n){if(!(n.state.loading&4)){var a=rc.get(t);if(a)var o=a.get(null);else{a=new Map,rc.set(t,a);for(var h=t.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),o=w)}o&&a.set(null,o)}h=n.instance,w=h.getAttribute("data-precedence"),p=a.get(w)||o,p===o&&a.set(null,h),a.set(w,h),this.count++,o=lc.bind(this),h.addEventListener("load",o),h.addEventListener("error",o),p?p.parentNode.insertBefore(h,p.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(h,t.firstChild)),n.state.loading|=4}}var Ss={$$typeof:z,Provider:null,Consumer:null,_currentValue:ie,_currentValue2:ie,_threadCount:0};function z2(t,n,a,o,h,p,w,A,H){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=dn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dn(0),this.hiddenUpdates=dn(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function Pp(t,n,a,o,h,p,w,A,H,ee,oe,ue){return t=new z2(t,n,a,w,H,ee,oe,ue,A),n=1,p===!0&&(n|=24),p=el(3,null,null,n),t.current=p,p.stateNode=t,n=ju(),n.refCount++,t.pooledCache=n,n.refCount++,p.memoizedState={element:o,isDehydrated:a,cache:n},Nu(p),t}function e1(t){return t?(t=Wa,t):Wa}function t1(t,n,a,o,h,p){h=e1(h),o.context===null?o.context=h:o.pendingContext=h,o=Br(n),o.payload={element:a},p=p===void 0?null:p,p!==null&&(o.callback=p),a=$r(t,o,n),a!==null&&(qn(a,t,n),ns(a,t,n))}function n1(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<n?a:n}}function Xd(t,n){n1(t,n),(t=t.alternate)&&n1(t,n)}function l1(t){if(t.tag===13||t.tag===31){var n=ya(t,67108864);n!==null&&qn(n,t,67108864),Xd(t,67108864)}}function r1(t){if(t.tag===13||t.tag===31){var n=al();n=Fi(n);var a=ya(t,n);a!==null&&qn(a,t,n),Xd(t,n)}}var ic=!0;function M2(t,n,a,o){var h=U.T;U.T=null;var p=J.p;try{J.p=2,Vd(t,n,a,o)}finally{J.p=p,U.T=h}}function R2(t,n,a,o){var h=U.T;U.T=null;var p=J.p;try{J.p=8,Vd(t,n,a,o)}finally{J.p=p,U.T=h}}function Vd(t,n,a,o){if(ic){var h=Gd(o);if(h===null)Md(t,n,o,sc,a),i1(t,o);else if(_2(h,t,n,a,o))o.stopPropagation();else if(i1(t,o),n&4&&-1<F2.indexOf(t)){for(;h!==null;){var p=Zl(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=Z(p.pendingLanes);if(w!==0){var A=p;for(A.pendingLanes|=2,A.entangledLanes|=2;w;){var H=1<<31-ut(w);A.entanglements[1]|=H,w&=~H}Il(p),(Et&6)===0&&(Yo=ct()+500,gs(0))}}break;case 31:case 13:A=ya(p,2),A!==null&&qn(A,p,2),Xo(),Xd(p,2)}if(p=Gd(o),p===null&&Md(t,n,o,sc,a),p===h)break;h=p}h!==null&&o.stopPropagation()}else Md(t,n,o,null,a)}}function Gd(t){return t=Ui(t),Kd(t)}var sc=null;function Kd(t){if(sc=null,t=_l(t),t!==null){var n=u(t);if(n===null)t=null;else{var a=n.tag;if(a===13){if(t=d(n),t!==null)return t;t=null}else if(a===31){if(t=m(n),t!==null)return t;t=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null)}}return sc=t,null}function a1(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ot()){case se:return 2;case be:return 8;case Re:case _e:return 32;case xe:return 268435456;default:return 32}default:return 32}}var Wd=!1,Wr=null,Qr=null,Zr=null,Cs=new Map,Es=new Map,Jr=[],F2="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 i1(t,n){switch(t){case"focusin":case"focusout":Wr=null;break;case"dragenter":case"dragleave":Qr=null;break;case"mouseover":case"mouseout":Zr=null;break;case"pointerover":case"pointerout":Cs.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Es.delete(n.pointerId)}}function Ns(t,n,a,o,h,p){return t===null||t.nativeEvent!==p?(t={blockedOn:n,domEventName:a,eventSystemFlags:o,nativeEvent:p,targetContainers:[h]},n!==null&&(n=Zl(n),n!==null&&l1(n)),t):(t.eventSystemFlags|=o,n=t.targetContainers,h!==null&&n.indexOf(h)===-1&&n.push(h),t)}function _2(t,n,a,o,h){switch(n){case"focusin":return Wr=Ns(Wr,t,n,a,o,h),!0;case"dragenter":return Qr=Ns(Qr,t,n,a,o,h),!0;case"mouseover":return Zr=Ns(Zr,t,n,a,o,h),!0;case"pointerover":var p=h.pointerId;return Cs.set(p,Ns(Cs.get(p)||null,t,n,a,o,h)),!0;case"gotpointercapture":return p=h.pointerId,Es.set(p,Ns(Es.get(p)||null,t,n,a,o,h)),!0}return!1}function s1(t){var n=_l(t.target);if(n!==null){var a=u(n);if(a!==null){if(n=a.tag,n===13){if(n=d(a),n!==null){t.blockedOn=n,Ql(t.priority,function(){r1(a)});return}}else if(n===31){if(n=m(a),n!==null){t.blockedOn=n,Ql(t.priority,function(){r1(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function oc(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var a=Gd(t.nativeEvent);if(a===null){a=t.nativeEvent;var o=new a.constructor(a.type,a);Ii=o,a.target.dispatchEvent(o),Ii=null}else return n=Zl(a),n!==null&&l1(n),t.blockedOn=a,!1;n.shift()}return!0}function o1(t,n,a){oc(t)&&a.delete(n)}function O2(){Wd=!1,Wr!==null&&oc(Wr)&&(Wr=null),Qr!==null&&oc(Qr)&&(Qr=null),Zr!==null&&oc(Zr)&&(Zr=null),Cs.forEach(o1),Es.forEach(o1)}function cc(t,n){t.blockedOn===n&&(t.blockedOn=null,Wd||(Wd=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,O2)))}var uc=null;function c1(t){uc!==t&&(uc=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){uc===t&&(uc=null);for(var n=0;n<t.length;n+=3){var a=t[n],o=t[n+1],h=t[n+2];if(typeof o!="function"){if(Kd(o||a)===null)continue;break}var p=Zl(a);p!==null&&(t.splice(n,3),n-=3,Gu(p,{pending:!0,data:h,method:a.method,action:o},o,h))}}))}function bi(t){function n(H){return cc(H,t)}Wr!==null&&cc(Wr,t),Qr!==null&&cc(Qr,t),Zr!==null&&cc(Zr,t),Cs.forEach(n),Es.forEach(n);for(var a=0;a<Jr.length;a++){var o=Jr[a];o.blockedOn===t&&(o.blockedOn=null)}for(;0<Jr.length&&(a=Jr[0],a.blockedOn===null);)s1(a),a.blockedOn===null&&Jr.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var h=a[o],p=a[o+1],w=h[vn]||null;if(typeof p=="function")w||c1(a);else if(w){var A=null;if(p&&p.hasAttribute("formAction")){if(h=p,w=p[vn]||null)A=w.formAction;else if(Kd(h)!==null)continue}else A=w.action;typeof A=="function"?a[o+1]=A:(a.splice(o,3),o-=3),c1(a)}}}function u1(){function t(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),o||setTimeout(a,20)}function a(){if(!o&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,h=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),h!==null&&(h(),h=null)}}}function Qd(t){this._internalRoot=t}dc.prototype.render=Qd.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(i(409));var a=n.current,o=al();t1(a,o,t,n,null,null)},dc.prototype.unmount=Qd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;t1(t.current,2,null,t,null,null),Xo(),n[Kn]=null}};function dc(t){this._internalRoot=t}dc.prototype.unstable_scheduleHydration=function(t){if(t){var n=Ia();t={blockedOn:null,target:t,priority:n};for(var a=0;a<Jr.length&&n!==0&&n<Jr[a].priority;a++);Jr.splice(a,0,t),a===0&&s1(t)}};var d1=l.version;if(d1!=="19.2.4")throw Error(i(527,d1,"19.2.4"));J.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(i(188)):(t=Object.keys(t).join(","),Error(i(268,t)));return t=f(n),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var B2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:U,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var fc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fc.isDisabled&&fc.supportsFiber)try{Pe=fc.inject(B2),nt=fc}catch{}}return Ds.createRoot=function(t,n){if(!c(t))throw Error(i(299));var a=!1,o="",h=gx,p=bx,w=vx;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(h=n.onUncaughtError),n.onCaughtError!==void 0&&(p=n.onCaughtError),n.onRecoverableError!==void 0&&(w=n.onRecoverableError)),n=Pp(t,1,!1,null,null,a,o,null,h,p,w,u1),t[Kn]=n.current,zd(t),new Qd(n)},Ds.hydrateRoot=function(t,n,a){if(!c(t))throw Error(i(299));var o=!1,h="",p=gx,w=bx,A=vx,H=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!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&&(A=a.onRecoverableError),a.formState!==void 0&&(H=a.formState)),n=Pp(t,1,!0,n,a??null,o,h,H,p,w,A,u1),n.context=e1(null),a=n.current,o=al(),o=Fi(o),h=Br(o),h.callback=null,$r(a,h,o),a=o,n.current.lanes=a,nn(n,a),Il(n),t[Kn]=n.current,zd(t),new dc(n)},Ds.version="19.2.4",Ds}var k1;function W2(){if(k1)return Pd.exports;k1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(l){console.error(l)}}return e(),Pd.exports=K2(),Pd.exports}var Q2=W2();const Z2="modulepreload",J2=function(e){return"/"+e},j1={},P2=function(l,r,i){let c=Promise.resolve();if(r&&r.length>0){let d=function(f){return Promise.all(f.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=d(r.map(f=>{if(f=J2(f),f in j1)return;j1[f]=!0;const g=f.endsWith(".css"),y=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${y}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":Z2,g||(b.as="script"),b.crossOrigin="",b.href=f,x&&b.setAttribute("nonce",x),document.head.appendChild(b),g)return new Promise((v,S)=>{b.addEventListener("load",v),b.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${f}`)))})}))}function u(d){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=d,window.dispatchEvent(m),!m.defaultPrevented)throw d}return c.then(d=>{for(const m of d||[])m.status==="rejected"&&u(m.reason);return l().catch(u)})};class ev extends k.Component{constructor(){super(...arguments);f1(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(r){return{hasError:!0,error:r}}render(){var r;return this.state.hasError?s.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:s.jsxs("div",{className:"text-center max-w-md",children:[s.jsx("div",{className:"text-4xl mb-3",children:"🚨"}),s.jsx("div",{className:"text-gray-800 font-semibold mb-2",children:"Something went wrong"}),s.jsx("div",{className:"text-gray-500 text-sm mb-4",children:((r=this.state.error)==null?void 0:r.message)??"An unexpected error occurred."}),s.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-gray-800 text-white rounded-lg text-sm hover:bg-gray-700",children:"Reload"})]})}):this.props.children}}const Js="/api";async function $t(e){const l=await fetch(`${Js}${e}`);if(!l.ok)throw new Error(`API error: ${l.status}`);return l.json()}async function En(e,l){const r=await fetch(`${Js}${e}`,{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 lf(e,l){const r=await fetch(`${Js}${e}`,{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 ea(e,l){const r={method:"DELETE"};l!==void 0&&(r.headers={"Content-Type":"application/json"},r.body=JSON.stringify(l));const i=await fetch(`${Js}${e}`,r);if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()}const Ce={getCompany:()=>$t("/company"),getRoles:()=>$t("/roles"),getRole:e=>$t(`/roles/${e}`),getProjects:()=>$t("/projects"),getProject:e=>$t(`/projects/${e}`),getStandups:()=>$t("/operations/standups"),getWaves:()=>$t("/operations/waves"),getDecisions:()=>$t("/operations/decisions"),getOrgTree:()=>$t("/engine/org"),getSkills:()=>$t("/skills"),exportSkills:e=>$t(`/skills/export/${e}`),getSkillRegistry:()=>$t("/skills/registry"),installRegistrySkill:(e,l)=>En("/skills/registry/install",{skillId:e,url:l}),createRole:e=>En("/engine/roles",e),updateRole:(e,l)=>lf(`/engine/roles/${e}`,l),deleteRole:e=>ea(`/engine/roles/${e}`),getSessions:()=>$t("/sessions"),getSession:e=>$t(`/sessions/${e}`),createSession:(e,l="talk")=>En("/sessions",{roleId:e,mode:l}),deleteSession:e=>ea(`/sessions/${e}`),deleteSessions:e=>ea("/sessions",{ids:e}),deleteEmptySessions:()=>ea("/sessions?empty=true"),updateSession:(e,l)=>lf(`/sessions/${e}`,l),startJob:e=>En("/jobs",e),getJob:e=>$t(`/jobs/${e}`),listJobs:e=>{const l=new URLSearchParams;e!=null&&e.status&&l.set("status",e.status),e!=null&&e.roleId&&l.set("roleId",e.roleId);const r=l.toString();return $t(`/jobs${r?"?"+r:""}`)},abortJob:e=>ea(`/jobs/${e}`),replyToJob:(e,l)=>En(`/jobs/${e}/reply`,{message:l}),saveWave:e=>En("/waves/save",e),getStatus:()=>$t("/status"),detectEngine:()=>En("/setup/detect-engine",{}),validatePath:e=>En("/setup/validate-path",{path:e}),scaffold:e=>En("/setup/scaffold",e),getTeams:()=>$t("/setup/teams"),browse:e=>En("/setup/browse",{path:e}),connectAkb:e=>En("/setup/connect-akb",{path:e}),getKnowledge:()=>$t("/knowledge"),getKnowledgeDoc:e=>{const l=e.split("/").map(encodeURIComponent).join("/");return $t(`/knowledge/${l}`)},createKnowledgeDoc:e=>En("/knowledge",e),updateKnowledgeDoc:(e,l)=>{const r=e.split("/").map(encodeURIComponent).join("/");return fetch(`${Js}/knowledge/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:l})}).then(i=>{if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()})},deleteKnowledgeDoc:e=>{const l=e.split("/").map(encodeURIComponent).join("/");return ea(`/knowledge/${l}`)},getPreferences:()=>$t("/preferences"),updatePreferences:e=>lf("/preferences",e),chatInChannel:e=>En("/speech/chat",e),getSaveStatus:()=>$t("/save/status"),save:e=>En("/save",{message:e}),getSaveHistory:(e=20)=>$t(`/save/history?limit=${e}`),restoreSave:(e,l)=>En("/save/restore",{sha:e,paths:l}),initGit:()=>En("/save/init",{}),getCostSummary:()=>$t("/cost/summary"),getSyncRoles:()=>$t("/sync/roles"),applySyncUpdate:e=>En("/sync/apply",e),getCompanyStats:()=>$t("/sync/stats"),getGitStatus:()=>$t("/git/status"),deleteWorktree:e=>ea(`/git/worktrees/${encodeURIComponent(e)}`),deleteBranch:e=>ea(`/git/branches/${encodeURIComponent(e)}`)};function P0(e){const[l,r]=k.useState([]),[i,c]=k.useState("idle"),[u,d]=k.useState(""),[m,x]=k.useState([]),f=k.useRef(-1),g=k.useRef(null),y=k.useRef(0),b=k.useCallback(()=>{var E;if(!e)return;(E=g.current)==null||E.abort();const S=new AbortController;g.current=S,c("connecting");const j=f.current+1,C=`/api/jobs/${e}/stream?from=${j}`;fetch(C,{signal:S.signal}).then(async N=>{if(!N.ok||!N.body){c("error");return}c("streaming");const z=N.body.getReader(),O=new TextDecoder;let I="";for(;;){const{done:_,value:q}=await z.read();if(_)break;I+=O.decode(q,{stream:!0});const W=I.split(`
|
|
50
50
|
`);I=W.pop()??"";let Y="";for(const T of W)if(T.startsWith("event: "))Y=T.slice(7).trim();else if(T.startsWith("data: ")){try{const $=JSON.parse(T.slice(6));if(Y==="activity"){const B=$;B.seq>f.current&&(f.current=B.seq),r(G=>G.some(ne=>ne.seq===B.seq)?G:[...G,B]),B.type==="text"&&d(G=>G+(B.data.text??"")),B.type==="dispatch:start"&&B.data.childJobId&&x(G=>[...G,B.data.childJobId]),B.type==="job:done"?c("done"):B.type==="job:error"&&c("error")}else if(Y==="stream:end"){const B=$.reason;c(B==="done"?"done":B==="error"?"error":"done")}}catch{}Y=""}}i==="streaming"&&c("done")}).catch(N=>{N.name!=="AbortError"&&(c("error"),y.current<3&&(y.current++,setTimeout(b,1e3*y.current)))})},[e]),v=k.useCallback(()=>{y.current=0,b()},[b]);return k.useEffect(()=>{if(!e){r([]),c("idle"),d(""),x([]),f.current=-1;return}return r([]),d(""),x([]),f.current=-1,y.current=0,b(),()=>{var S;(S=g.current)==null||S.abort()}},[e,b]),{events:l,status:i,textOutput:u,childJobIds:m,reconnect:v}}function tv(e,l){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const nv=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lv=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,rv={};function S1(e,l){return(rv.jsx?lv:nv).test(e)}const av=/[ \t\n\f\r]/g;function iv(e){return typeof e=="object"?e.type==="text"?C1(e.value):!1:C1(e)}function C1(e){return e.replace(av,"")===""}class Ps{constructor(l,r,i){this.normal=r,this.property=l,i&&(this.space=i)}}Ps.prototype.normal={};Ps.prototype.property={};Ps.prototype.space=void 0;function ey(e,l){const r={},i={};for(const c of e)Object.assign(r,c.property),Object.assign(i,c.normal);return new Ps(r,i,l)}function qf(e){return e.toLowerCase()}class Vn{constructor(l,r){this.attribute=r,this.property=l}}Vn.prototype.attribute="";Vn.prototype.booleanish=!1;Vn.prototype.boolean=!1;Vn.prototype.commaOrSpaceSeparated=!1;Vn.prototype.commaSeparated=!1;Vn.prototype.defined=!1;Vn.prototype.mustUseProperty=!1;Vn.prototype.number=!1;Vn.prototype.overloadedBoolean=!1;Vn.prototype.property="";Vn.prototype.spaceSeparated=!1;Vn.prototype.space=void 0;let sv=0;const it=La(),un=La(),Xf=La(),ke=La(),Ht=La(),Ei=La(),il=La();function La(){return 2**++sv}const Vf=Object.freeze(Object.defineProperty({__proto__:null,boolean:it,booleanish:un,commaOrSpaceSeparated:il,commaSeparated:Ei,number:ke,overloadedBoolean:Xf,spaceSeparated:Ht},Symbol.toStringTag,{value:"Module"})),rf=Object.keys(Vf);class dh extends Vn{constructor(l,r,i,c){let u=-1;if(super(l,r),E1(this,"space",c),typeof i=="number")for(;++u<rf.length;){const d=rf[u];E1(this,rf[u],(i&Vf[d])===Vf[d])}}}dh.prototype.defined=!0;function E1(e,l,r){r&&(e[l]=r)}function Ti(e){const l={},r={};for(const[i,c]of Object.entries(e.properties)){const u=new dh(i,e.transform(e.attributes||{},i),c,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),l[i]=u,r[qf(i)]=i,r[qf(u.attribute)]=i}return new Ps(l,r,e.space)}const ty=Ti({properties:{ariaActiveDescendant:null,ariaAtomic:un,ariaAutoComplete:null,ariaBusy:un,ariaChecked:un,ariaColCount:ke,ariaColIndex:ke,ariaColSpan:ke,ariaControls:Ht,ariaCurrent:null,ariaDescribedBy:Ht,ariaDetails:null,ariaDisabled:un,ariaDropEffect:Ht,ariaErrorMessage:null,ariaExpanded:un,ariaFlowTo:Ht,ariaGrabbed:un,ariaHasPopup:null,ariaHidden:un,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ht,ariaLevel:ke,ariaLive:null,ariaModal:un,ariaMultiLine:un,ariaMultiSelectable:un,ariaOrientation:null,ariaOwns:Ht,ariaPlaceholder:null,ariaPosInSet:ke,ariaPressed:un,ariaReadOnly:un,ariaRelevant:null,ariaRequired:un,ariaRoleDescription:Ht,ariaRowCount:ke,ariaRowIndex:ke,ariaRowSpan:ke,ariaSelected:un,ariaSetSize:ke,ariaSort:null,ariaValueMax:ke,ariaValueMin:ke,ariaValueNow:ke,ariaValueText:null,role:null},transform(e,l){return l==="role"?l:"aria-"+l.slice(4).toLowerCase()}});function ny(e,l){return l in e?e[l]:l}function ly(e,l){return ny(e,l.toLowerCase())}const ov=Ti({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ei,acceptCharset:Ht,accessKey:Ht,action:null,allow:null,allowFullScreen:it,allowPaymentRequest:it,allowUserMedia:it,alt:null,as:null,async:it,autoCapitalize:null,autoComplete:Ht,autoFocus:it,autoPlay:it,blocking:Ht,capture:null,charSet:null,checked:it,cite:null,className:Ht,cols:ke,colSpan:null,content:null,contentEditable:un,controls:it,controlsList:Ht,coords:ke|Ei,crossOrigin:null,data:null,dateTime:null,decoding:null,default:it,defer:it,dir:null,dirName:null,disabled:it,download:Xf,draggable:un,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:it,formTarget:null,headers:Ht,height:ke,hidden:Xf,high:ke,href:null,hrefLang:null,htmlFor:Ht,httpEquiv:Ht,id:null,imageSizes:null,imageSrcSet:null,inert:it,inputMode:null,integrity:null,is:null,isMap:it,itemId:null,itemProp:Ht,itemRef:Ht,itemScope:it,itemType:Ht,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:it,low:ke,manifest:null,max:null,maxLength:ke,media:null,method:null,min:null,minLength:ke,multiple:it,muted:it,name:null,nonce:null,noModule:it,noValidate:it,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:it,optimum:ke,pattern:null,ping:Ht,placeholder:null,playsInline:it,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:it,referrerPolicy:null,rel:Ht,required:it,reversed:it,rows:ke,rowSpan:ke,sandbox:Ht,scope:null,scoped:it,seamless:it,selected:it,shadowRootClonable:it,shadowRootDelegatesFocus:it,shadowRootMode:null,shape:null,size:ke,sizes:null,slot:null,span:ke,spellCheck:un,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ke,step:null,style:null,tabIndex:ke,target:null,title:null,translate:null,type:null,typeMustMatch:it,useMap:null,value:un,width:ke,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ht,axis:null,background:null,bgColor:null,border:ke,borderColor:null,bottomMargin:ke,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:it,declare:it,event:null,face:null,frame:null,frameBorder:null,hSpace:ke,leftMargin:ke,link:null,longDesc:null,lowSrc:null,marginHeight:ke,marginWidth:ke,noResize:it,noHref:it,noShade:it,noWrap:it,object:null,profile:null,prompt:null,rev:null,rightMargin:ke,rules:null,scheme:null,scrolling:un,standby:null,summary:null,text:null,topMargin:ke,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ke,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:it,disableRemotePlayback:it,prefix:null,property:null,results:ke,security:null,unselectable:null},space:"html",transform:ly}),cv=Ti({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:il,accentHeight:ke,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ke,amplitude:ke,arabicForm:null,ascent:ke,attributeName:null,attributeType:null,azimuth:ke,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ke,by:null,calcMode:null,capHeight:ke,className:Ht,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:ke,diffuseConstant:ke,direction:null,display:null,dur:null,divisor:ke,dominantBaseline:null,download:it,dx:null,dy:null,edgeMode:null,editable:null,elevation:ke,enableBackground:null,end:null,event:null,exponent:ke,externalResourcesRequired:null,fill:null,fillOpacity:ke,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:Ei,g2:Ei,glyphName:Ei,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ke,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ke,horizOriginX:ke,horizOriginY:ke,id:null,ideographic:ke,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ke,k:ke,k1:ke,k2:ke,k3:ke,k4:ke,kernelMatrix:il,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ke,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:ke,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:ke,overlineThickness:ke,paintOrder:null,panose1:null,path:null,pathLength:ke,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ht,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ke,pointsAtY:ke,pointsAtZ:ke,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:il,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:il,rev:il,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:il,requiredFeatures:il,requiredFonts:il,requiredFormats:il,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:ke,specularExponent:ke,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ke,strikethroughThickness:ke,string:null,stroke:null,strokeDashArray:il,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ke,strokeOpacity:ke,strokeWidth:null,style:null,surfaceScale:ke,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:il,tabIndex:ke,tableValues:null,target:null,targetX:ke,targetY:ke,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:il,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ke,underlineThickness:ke,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ke,values:null,vAlphabetic:ke,vMathematical:ke,vectorEffect:null,vHanging:ke,vIdeographic:ke,version:null,vertAdvY:ke,vertOriginX:ke,vertOriginY:ke,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ke,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ny}),ry=Ti({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,l){return"xlink:"+l.slice(5).toLowerCase()}}),ay=Ti({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ly}),iy=Ti({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,l){return"xml:"+l.slice(3).toLowerCase()}}),uv={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"},dv=/[A-Z]/g,N1=/-[a-z]/g,fv=/^data[-\w.:]+$/i;function hv(e,l){const r=qf(l);let i=l,c=Vn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&fv.test(l)){if(l.charAt(4)==="-"){const u=l.slice(5).replace(N1,xv);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=l.slice(4);if(!N1.test(u)){let d=u.replace(dv,mv);d.charAt(0)!=="-"&&(d="-"+d),l="data"+d}}c=dh}return new c(i,l)}function mv(e){return"-"+e.toLowerCase()}function xv(e){return e.charAt(1).toUpperCase()}const pv=ey([ty,ov,ry,ay,iy],"html"),fh=ey([ty,cv,ry,ay,iy],"svg");function yv(e){return e.join(" ").trim()}var vi={},af,A1;function gv(){if(A1)return af;A1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,l=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,m=/^\s+|\s+$/g,x=`
|
|
51
|
-
`,f="/",g="*",y="",b="comment",v="declaration";function S(C,E){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];E=E||{};var N=1,z=1;function O(ne){var V=ne.match(l);V&&(N+=V.length);var U=ne.lastIndexOf(x);z=~U?ne.length-U:z+ne.length}function I(){var ne={line:N,column:z};return function(V){return V.position=new _(ne),Y(),V}}function _(ne){this.start=ne,this.end={line:N,column:z},this.source=E.source}_.prototype.content=C;function q(ne){var V=new Error(E.source+":"+N+":"+z+": "+ne);if(V.reason=ne,V.filename=E.source,V.line=N,V.column=z,V.source=C,!E.silent)throw V}function W(ne){var V=ne.exec(C);if(V){var U=V[0];return O(U),C=C.slice(U.length),V}}function Y(){W(r)}function T(ne){var V;for(ne=ne||[];V=$();)V!==!1&&ne.push(V);return ne}function $(){var ne=I();if(!(f!=C.charAt(0)||g!=C.charAt(1))){for(var V=2;y!=C.charAt(V)&&(g!=C.charAt(V)||f!=C.charAt(V+1));)++V;if(V+=2,y===C.charAt(V-1))return q("End of comment missing");var U=C.slice(2,V-2);return z+=2,O(U),C=C.slice(V),z+=2,ne({type:b,comment:U})}}function B(){var ne=I(),V=W(i);if(V){if($(),!W(c))return q("property missing ':'");var U=W(u),Z=ne({type:v,property:j(V[0].replace(e,y)),value:U?j(U[0].replace(e,y)):y});return W(d),Z}}function G(){var ne=[];T(ne);for(var V;V=B();)V!==!1&&(ne.push(V),T(ne));return ne}return Y(),G()}function j(C){return C?C.replace(m,y):y}return af=S,af}var D1;function bv(){if(D1)return vi;D1=1;var e=vi&&vi.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(vi,"__esModule",{value:!0}),vi.default=r;const l=e(gv());function r(i,c){let u=null;if(!i||typeof i!="string")return u;const d=(0,l.default)(i),m=typeof c=="function";return d.forEach(x=>{if(x.type!=="declaration")return;const{property:f,value:g}=x;m?c(f,g,x):g&&(u=u||{},u[f]=g)}),u}return vi}var Ts={},T1;function vv(){if(T1)return Ts;T1=1,Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,l=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,u=function(f){return!f||r.test(f)||e.test(f)},d=function(f,g){return g.toUpperCase()},m=function(f,g){return"".concat(g,"-")},x=function(f,g){return g===void 0&&(g={}),u(f)?f:(f=f.toLowerCase(),g.reactCompat?f=f.replace(c,m):f=f.replace(i,m),f.replace(l,d))};return Ts.camelCase=x,Ts}var zs,z1;function wv(){if(z1)return zs;z1=1;var e=zs&&zs.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},l=e(bv()),r=vv();function i(c,u){var d={};return!c||typeof c!="string"||(0,l.default)(c,function(m,x){m&&x&&(d[(0,r.camelCase)(m,u)]=x)}),d}return i.default=i,zs=i,zs}var kv=wv();const jv=J0(kv),sy=oy("end"),hh=oy("start");function oy(e){return l;function l(r){const i=r&&r.position&&r.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function Sv(e){const l=hh(e),r=sy(e);if(l&&r)return{start:l,end:r}}function Us(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?M1(e.position):"start"in e||"end"in e?M1(e):"line"in e||"column"in e?Gf(e):""}function Gf(e){return R1(e&&e.line)+":"+R1(e&&e.column)}function M1(e){return Gf(e&&e.start)+"-"+Gf(e&&e.end)}function R1(e){return e&&typeof e=="number"?e:1}class Tn extends Error{constructor(l,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let c="",u={},d=!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&&(d=!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=Us(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=d&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Tn.prototype.file="";Tn.prototype.name="";Tn.prototype.reason="";Tn.prototype.message="";Tn.prototype.stack="";Tn.prototype.column=void 0;Tn.prototype.line=void 0;Tn.prototype.ancestors=void 0;Tn.prototype.cause=void 0;Tn.prototype.fatal=void 0;Tn.prototype.place=void 0;Tn.prototype.ruleId=void 0;Tn.prototype.source=void 0;const mh={}.hasOwnProperty,Cv=new Map,Ev=/[A-Z]/g,Nv=new Set(["table","tbody","thead","tfoot","tr"]),Av=new Set(["td","th"]),cy="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Dv(e,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=Bv(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=Ov(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"?fh:pv,stylePropertyNameCase:l.stylePropertyNameCase||"dom",tableCellAlignToStyle:l.tableCellAlignToStyle!==!1},u=uy(c,e,void 0);return u&&typeof u!="string"?u:c.create(e,c.Fragment,{children:u||void 0},void 0)}function uy(e,l,r){if(l.type==="element")return Tv(e,l,r);if(l.type==="mdxFlowExpression"||l.type==="mdxTextExpression")return zv(e,l);if(l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement")return Rv(e,l,r);if(l.type==="mdxjsEsm")return Mv(e,l);if(l.type==="root")return Fv(e,l,r);if(l.type==="text")return _v(e,l)}function Tv(e,l,r){const i=e.schema;let c=i;l.tagName.toLowerCase()==="svg"&&i.space==="html"&&(c=fh,e.schema=c),e.ancestors.push(l);const u=fy(e,l.tagName,!1),d=$v(e,l);let m=ph(e,l);return Nv.has(l.tagName)&&(m=m.filter(function(x){return typeof x=="string"?!iv(x):!0})),dy(e,d,u,l),xh(d,m),e.ancestors.pop(),e.schema=i,e.create(l,u,d,r)}function zv(e,l){if(l.data&&l.data.estree&&e.evaluater){const i=l.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}Vs(e,l.position)}function Mv(e,l){if(l.data&&l.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(l.data.estree);Vs(e,l.position)}function Rv(e,l,r){const i=e.schema;let c=i;l.name==="svg"&&i.space==="html"&&(c=fh,e.schema=c),e.ancestors.push(l);const u=l.name===null?e.Fragment:fy(e,l.name,!0),d=Lv(e,l),m=ph(e,l);return dy(e,d,u,l),xh(d,m),e.ancestors.pop(),e.schema=i,e.create(l,u,d,r)}function Fv(e,l,r){const i={};return xh(i,ph(e,l)),e.create(l,e.Fragment,i,r)}function _v(e,l){return l.value}function dy(e,l,r,i){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(l.node=i)}function xh(e,l){if(l.length>0){const r=l.length>1?l:l[0];r&&(e.children=r)}}function Ov(e,l,r){return i;function i(c,u,d,m){const f=Array.isArray(d.children)?r:l;return m?f(u,d,m):f(u,d)}}function Bv(e,l){return r;function r(i,c,u,d){const m=Array.isArray(u.children),x=hh(i);return l(c,u,d,m,{columnNumber:x?x.column-1:void 0,fileName:e,lineNumber:x?x.line:void 0},void 0)}}function $v(e,l){const r={};let i,c;for(c in l.properties)if(c!=="children"&&mh.call(l.properties,c)){const u=Hv(e,c,l.properties[c]);if(u){const[d,m]=u;e.tableCellAlignToStyle&&d==="align"&&typeof m=="string"&&Av.has(l.tagName)?i=m:r[d]=m}}if(i){const u=r.style||(r.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return r}function Lv(e,l){const r={};for(const i of l.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const u=i.data.estree.body[0];u.type;const d=u.expression;d.type;const m=d.properties[0];m.type,Object.assign(r,e.evaluater.evaluateExpression(m.argument))}else Vs(e,l.position);else{const c=i.name;let u;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const m=i.value.data.estree.body[0];m.type,u=e.evaluater.evaluateExpression(m.expression)}else Vs(e,l.position);else u=i.value===null?!0:i.value;r[c]=u}return r}function ph(e,l){const r=[];let i=-1;const c=e.passKeys?new Map:Cv;for(;++i<l.children.length;){const u=l.children[i];let d;if(e.passKeys){const x=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(x){const f=c.get(x)||0;d=x+"-"+f,c.set(x,f+1)}}const m=uy(e,u,d);m!==void 0&&r.push(m)}return r}function Hv(e,l,r){const i=hv(e.schema,l);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=i.commaSeparated?tv(r):yv(r)),i.property==="style"){let c=typeof r=="object"?r:Iv(e,String(r));return e.stylePropertyNameCase==="css"&&(c=Uv(c)),["style",c]}return[e.elementAttributeNameCase==="react"&&i.space?uv[i.property]||i.property:i.attribute,r]}}function Iv(e,l){try{return jv(l,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const i=r,c=new Tn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=e.filePath||void 0,c.url=cy+"#cannot-parse-style-attribute",c}}function fy(e,l,r){let i;if(!r)i={type:"Literal",value:l};else if(l.includes(".")){const c=l.split(".");let u=-1,d;for(;++u<c.length;){const m=S1(c[u])?{type:"Identifier",name:c[u]}:{type:"Literal",value:c[u]};d=d?{type:"MemberExpression",object:d,property:m,computed:!!(u&&m.type==="Literal"),optional:!1}:m}i=d}else i=S1(l)&&!/^[a-z]/.test(l)?{type:"Identifier",name:l}:{type:"Literal",value:l};if(i.type==="Literal"){const c=i.value;return mh.call(e.components,c)?e.components[c]:c}if(e.evaluater)return e.evaluater.evaluateExpression(i);Vs(e)}function Vs(e,l){const r=new Tn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:l,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=cy+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Uv(e){const l={};let r;for(r in e)mh.call(e,r)&&(l[Yv(r)]=e[r]);return l}function Yv(e){let l=e.replace(Ev,qv);return l.slice(0,3)==="ms-"&&(l="-"+l),l}function qv(e){return"-"+e.toLowerCase()}const sf={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"]},Xv={};function yh(e,l){const r=Xv,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,c=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return hy(e,i,c)}function hy(e,l,r){if(Vv(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(l&&"alt"in e&&e.alt)return e.alt;if("children"in e)return F1(e.children,l,r)}return Array.isArray(e)?F1(e,l,r):""}function F1(e,l,r){const i=[];let c=-1;for(;++c<e.length;)i[c]=hy(e[c],l,r);return i.join("")}function Vv(e){return!!(e&&typeof e=="object")}const _1=document.createElement("i");function gh(e){const l="&"+e+";";_1.innerHTML=l;const r=_1.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===l?!1:r}function ol(e,l,r,i){const c=e.length;let u=0,d;if(l<0?l=-l>c?0:c+l:l=l>c?c:l,r=r>0?r:0,i.length<1e4)d=Array.from(i),d.unshift(l,r),e.splice(...d);else for(r&&e.splice(l,r);u<i.length;)d=i.slice(u,u+1e4),d.unshift(l,0),e.splice(...d),u+=1e4,l+=1e4}function gl(e,l){return e.length>0?(ol(e,e.length,0,l),e):l}const O1={}.hasOwnProperty;function my(e){const l={};let r=-1;for(;++r<e.length;)Gv(l,e[r]);return l}function Gv(e,l){let r;for(r in l){const c=(O1.call(e,r)?e[r]:void 0)||(e[r]={}),u=l[r];let d;if(u)for(d in u){O1.call(c,d)||(c[d]=[]);const m=u[d];Kv(c[d],Array.isArray(m)?m:m?[m]:[])}}}function Kv(e,l){let r=-1;const i=[];for(;++r<l.length;)(l[r].add==="after"?e:i).push(l[r]);ol(e,0,0,i)}function xy(e,l){const r=Number.parseInt(e,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 zl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const _n=ca(/[A-Za-z]/),Dn=ca(/[\dA-Za-z]/),Wv=ca(/[#-'*+\--9=?A-Z^-~]/);function _c(e){return e!==null&&(e<32||e===127)}const Kf=ca(/\d/),Qv=ca(/[\dA-Fa-f]/),Zv=ca(/[!-/:-@[-`{-~]/);function Ve(e){return e!==null&&e<-2}function Lt(e){return e!==null&&(e<0||e===32)}function ht(e){return e===-2||e===-1||e===32}const Xc=ca(new RegExp("\\p{P}|\\p{S}","u")),Ba=ca(/\s/);function ca(e){return l;function l(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function zi(e){const l=[];let r=-1,i=0,c=0;for(;++r<e.length;){const u=e.charCodeAt(r);let d="";if(u===37&&Dn(e.charCodeAt(r+1))&&Dn(e.charCodeAt(r+2)))c=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(d=String.fromCharCode(u));else if(u>55295&&u<57344){const m=e.charCodeAt(r+1);u<56320&&m>56319&&m<57344?(d=String.fromCharCode(u,m),c=1):d="�"}else d=String.fromCharCode(u);d&&(l.push(e.slice(i,r),encodeURIComponent(d)),i=r+c+1,d=""),c&&(r+=c,c=0)}return l.join("")+e.slice(i)}function wt(e,l,r,i){const c=i?i-1:Number.POSITIVE_INFINITY;let u=0;return d;function d(x){return ht(x)?(e.enter(r),m(x)):l(x)}function m(x){return ht(x)&&u++<c?(e.consume(x),m):(e.exit(r),l(x))}}const Jv={tokenize:Pv};function Pv(e){const l=e.attempt(this.parser.constructs.contentInitial,i,c);let r;return l;function i(m){if(m===null){e.consume(m);return}return e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),wt(e,l,"linePrefix")}function c(m){return e.enter("paragraph"),u(m)}function u(m){const x=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=x),r=x,d(m)}function d(m){if(m===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(m);return}return Ve(m)?(e.consume(m),e.exit("chunkText"),u):(e.consume(m),d)}}const ew={tokenize:tw},B1={tokenize:nw};function tw(e){const l=this,r=[];let i=0,c,u,d;return m;function m(z){if(i<r.length){const O=r[i];return l.containerState=O[1],e.attempt(O[0].continuation,x,f)(z)}return f(z)}function x(z){if(i++,l.containerState._closeFlow){l.containerState._closeFlow=void 0,c&&N();const O=l.events.length;let I=O,_;for(;I--;)if(l.events[I][0]==="exit"&&l.events[I][1].type==="chunkFlow"){_=l.events[I][1].end;break}E(i);let q=O;for(;q<l.events.length;)l.events[q][1].end={..._},q++;return ol(l.events,I+1,0,l.events.slice(O)),l.events.length=q,f(z)}return m(z)}function f(z){if(i===r.length){if(!c)return b(z);if(c.currentConstruct&&c.currentConstruct.concrete)return S(z);l.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return l.containerState={},e.check(B1,g,y)(z)}function g(z){return c&&N(),E(i),b(z)}function y(z){return l.parser.lazy[l.now().line]=i!==r.length,d=l.now().offset,S(z)}function b(z){return l.containerState={},e.attempt(B1,v,S)(z)}function v(z){return i++,r.push([l.currentConstruct,l.containerState]),b(z)}function S(z){if(z===null){c&&N(),E(0),e.consume(z);return}return c=c||l.parser.flow(l.now()),e.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:u}),j(z)}function j(z){if(z===null){C(e.exit("chunkFlow"),!0),E(0),e.consume(z);return}return Ve(z)?(e.consume(z),C(e.exit("chunkFlow")),i=0,l.interrupt=void 0,m):(e.consume(z),j)}function C(z,O){const I=l.sliceStream(z);if(O&&I.push(null),z.previous=u,u&&(u.next=z),u=z,c.defineSkip(z.start),c.write(I),l.parser.lazy[z.start.line]){let _=c.events.length;for(;_--;)if(c.events[_][1].start.offset<d&&(!c.events[_][1].end||c.events[_][1].end.offset>d))return;const q=l.events.length;let W=q,Y,T;for(;W--;)if(l.events[W][0]==="exit"&&l.events[W][1].type==="chunkFlow"){if(Y){T=l.events[W][1].end;break}Y=!0}for(E(i),_=q;_<l.events.length;)l.events[_][1].end={...T},_++;ol(l.events,W+1,0,l.events.slice(q)),l.events.length=_}}function E(z){let O=r.length;for(;O-- >z;){const I=r[O];l.containerState=I[1],I[0].exit.call(l,e)}r.length=z}function N(){c.write([null]),u=void 0,c=void 0,l.containerState._closeFlow=void 0}}function nw(e,l,r){return wt(e,e.attempt(this.parser.constructs.document,l,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ni(e){if(e===null||Lt(e)||Ba(e))return 1;if(Xc(e))return 2}function Vc(e,l,r){const i=[];let c=-1;for(;++c<e.length;){const u=e[c].resolveAll;u&&!i.includes(u)&&(l=u(l,r),i.push(u))}return l}const Wf={name:"attention",resolveAll:lw,tokenize:rw};function lw(e,l){let r=-1,i,c,u,d,m,x,f,g;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(i=r;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&l.sliceSerialize(e[i][1]).charCodeAt(0)===l.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[i][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;x=e[i][1].end.offset-e[i][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const y={...e[i][1].end},b={...e[r][1].start};$1(y,-x),$1(b,x),d={type:x>1?"strongSequence":"emphasisSequence",start:y,end:{...e[i][1].end}},m={type:x>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:b},u={type:x>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[r][1].start}},c={type:x>1?"strong":"emphasis",start:{...d.start},end:{...m.end}},e[i][1].end={...d.start},e[r][1].start={...m.end},f=[],e[i][1].end.offset-e[i][1].start.offset&&(f=gl(f,[["enter",e[i][1],l],["exit",e[i][1],l]])),f=gl(f,[["enter",c,l],["enter",d,l],["exit",d,l],["enter",u,l]]),f=gl(f,Vc(l.parser.constructs.insideSpan.null,e.slice(i+1,r),l)),f=gl(f,[["exit",u,l],["enter",m,l],["exit",m,l],["exit",c,l]]),e[r][1].end.offset-e[r][1].start.offset?(g=2,f=gl(f,[["enter",e[r][1],l],["exit",e[r][1],l]])):g=0,ol(e,i-1,r-i+3,f),r=i+f.length-g-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function rw(e,l){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,c=Ni(i);let u;return d;function d(x){return u=x,e.enter("attentionSequence"),m(x)}function m(x){if(x===u)return e.consume(x),m;const f=e.exit("attentionSequence"),g=Ni(x),y=!g||g===2&&c||r.includes(x),b=!c||c===2&&g||r.includes(i);return f._open=!!(u===42?y:y&&(c||!b)),f._close=!!(u===42?b:b&&(g||!y)),l(x)}}function $1(e,l){e.column+=l,e.offset+=l,e._bufferIndex+=l}const aw={name:"autolink",tokenize:iw};function iw(e,l,r){let i=0;return c;function c(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(v){return _n(v)?(e.consume(v),d):v===64?r(v):f(v)}function d(v){return v===43||v===45||v===46||Dn(v)?(i=1,m(v)):f(v)}function m(v){return v===58?(e.consume(v),i=0,x):(v===43||v===45||v===46||Dn(v))&&i++<32?(e.consume(v),m):(i=0,f(v))}function x(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),l):v===null||v===32||v===60||_c(v)?r(v):(e.consume(v),x)}function f(v){return v===64?(e.consume(v),g):Wv(v)?(e.consume(v),f):r(v)}function g(v){return Dn(v)?y(v):r(v)}function y(v){return v===46?(e.consume(v),i=0,g):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),l):b(v)}function b(v){if((v===45||Dn(v))&&i++<63){const S=v===45?b:y;return e.consume(v),S}return r(v)}}const eo={partial:!0,tokenize:sw};function sw(e,l,r){return i;function i(u){return ht(u)?wt(e,c,"linePrefix")(u):c(u)}function c(u){return u===null||Ve(u)?l(u):r(u)}}const py={continuation:{tokenize:cw},exit:uw,name:"blockQuote",tokenize:ow};function ow(e,l,r){const i=this;return c;function c(d){if(d===62){const m=i.containerState;return m.open||(e.enter("blockQuote",{_container:!0}),m.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),u}return r(d)}function u(d){return ht(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),l):(e.exit("blockQuotePrefix"),l(d))}}function cw(e,l,r){const i=this;return c;function c(d){return ht(d)?wt(e,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):u(d)}function u(d){return e.attempt(py,l,r)(d)}}function uw(e){e.exit("blockQuote")}const yy={name:"characterEscape",tokenize:dw};function dw(e,l,r){return i;function i(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),c}function c(u){return Zv(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),l):r(u)}}const gy={name:"characterReference",tokenize:fw};function fw(e,l,r){const i=this;let c=0,u,d;return m;function m(y){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),x}function x(y){return y===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(y),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),u=31,d=Dn,g(y))}function f(y){return y===88||y===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(y),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,d=Qv,g):(e.enter("characterReferenceValue"),u=7,d=Kf,g(y))}function g(y){if(y===59&&c){const b=e.exit("characterReferenceValue");return d===Dn&&!gh(i.sliceSerialize(b))?r(y):(e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),e.exit("characterReference"),l)}return d(y)&&c++<u?(e.consume(y),g):r(y)}}const L1={partial:!0,tokenize:mw},H1={concrete:!0,name:"codeFenced",tokenize:hw};function hw(e,l,r){const i=this,c={partial:!0,tokenize:I};let u=0,d=0,m;return x;function x(_){return f(_)}function f(_){const q=i.events[i.events.length-1];return u=q&&q[1].type==="linePrefix"?q[2].sliceSerialize(q[1],!0).length:0,m=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(_)}function g(_){return _===m?(d++,e.consume(_),g):d<3?r(_):(e.exit("codeFencedFenceSequence"),ht(_)?wt(e,y,"whitespace")(_):y(_))}function y(_){return _===null||Ve(_)?(e.exit("codeFencedFence"),i.interrupt?l(_):e.check(L1,j,O)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(_))}function b(_){return _===null||Ve(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),y(_)):ht(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),wt(e,v,"whitespace")(_)):_===96&&_===m?r(_):(e.consume(_),b)}function v(_){return _===null||Ve(_)?y(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(_))}function S(_){return _===null||Ve(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),y(_)):_===96&&_===m?r(_):(e.consume(_),S)}function j(_){return e.attempt(c,O,C)(_)}function C(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),E}function E(_){return u>0&&ht(_)?wt(e,N,"linePrefix",u+1)(_):N(_)}function N(_){return _===null||Ve(_)?e.check(L1,j,O)(_):(e.enter("codeFlowValue"),z(_))}function z(_){return _===null||Ve(_)?(e.exit("codeFlowValue"),N(_)):(e.consume(_),z)}function O(_){return e.exit("codeFenced"),l(_)}function I(_,q,W){let Y=0;return T;function T(V){return _.enter("lineEnding"),_.consume(V),_.exit("lineEnding"),$}function $(V){return _.enter("codeFencedFence"),ht(V)?wt(_,B,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):B(V)}function B(V){return V===m?(_.enter("codeFencedFenceSequence"),G(V)):W(V)}function G(V){return V===m?(Y++,_.consume(V),G):Y>=d?(_.exit("codeFencedFenceSequence"),ht(V)?wt(_,ne,"whitespace")(V):ne(V)):W(V)}function ne(V){return V===null||Ve(V)?(_.exit("codeFencedFence"),q(V)):W(V)}}}function mw(e,l,r){const i=this;return c;function c(d){return d===null?r(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u)}function u(d){return i.parser.lazy[i.now().line]?r(d):l(d)}}const of={name:"codeIndented",tokenize:pw},xw={partial:!0,tokenize:yw};function pw(e,l,r){const i=this;return c;function c(f){return e.enter("codeIndented"),wt(e,u,"linePrefix",5)(f)}function u(f){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?d(f):r(f)}function d(f){return f===null?x(f):Ve(f)?e.attempt(xw,d,x)(f):(e.enter("codeFlowValue"),m(f))}function m(f){return f===null||Ve(f)?(e.exit("codeFlowValue"),d(f)):(e.consume(f),m)}function x(f){return e.exit("codeIndented"),l(f)}}function yw(e,l,r){const i=this;return c;function c(d){return i.parser.lazy[i.now().line]?r(d):Ve(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):wt(e,u,"linePrefix",5)(d)}function u(d){const m=i.events[i.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(d):Ve(d)?c(d):r(d)}}const gw={name:"codeText",previous:vw,resolve:bw,tokenize:ww};function bw(e){let l=e.length-4,r=3,i,c;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[l][1].type==="lineEnding"||e[l][1].type==="space")){for(i=r;++i<l;)if(e[i][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[l][1].type="codeTextPadding",r+=2,l-=2;break}}for(i=r-1,l++;++i<=l;)c===void 0?i!==l&&e[i][1].type!=="lineEnding"&&(c=i):(i===l||e[i][1].type==="lineEnding")&&(e[c][1].type="codeTextData",i!==c+2&&(e[c][1].end=e[i-1][1].end,e.splice(c+2,i-c-2),l-=i-c-2,i=c+2),c=void 0);return e}function vw(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function ww(e,l,r){let i=0,c,u;return d;function d(y){return e.enter("codeText"),e.enter("codeTextSequence"),m(y)}function m(y){return y===96?(e.consume(y),i++,m):(e.exit("codeTextSequence"),x(y))}function x(y){return y===null?r(y):y===32?(e.enter("space"),e.consume(y),e.exit("space"),x):y===96?(u=e.enter("codeTextSequence"),c=0,g(y)):Ve(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),x):(e.enter("codeTextData"),f(y))}function f(y){return y===null||y===32||y===96||Ve(y)?(e.exit("codeTextData"),x(y)):(e.consume(y),f)}function g(y){return y===96?(e.consume(y),c++,g):c===i?(e.exit("codeTextSequence"),e.exit("codeText"),l(y)):(u.type="codeTextData",f(y))}}class kw{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&&Ms(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),Ms(this.left,l)}unshift(l){this.setCursor(0),this.right.push(l)}unshiftMany(l){this.setCursor(0),Ms(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);Ms(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-l,Number.POSITIVE_INFINITY);Ms(this.left,r.reverse())}}}function Ms(e,l){let r=0;if(l.length<1e4)e.push(...l);else for(;r<l.length;)e.push(...l.slice(r,r+1e4)),r+=1e4}function by(e){const l={};let r=-1,i,c,u,d,m,x,f;const g=new kw(e);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,jw(g,r)),r=l[r],f=!0);else if(i[1]._container){for(u=r,c=void 0;u--;)if(d=g.get(u),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(c&&(g.get(c)[1].type="lineEndingBlank"),d[1].type="lineEnding",c=u);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;c&&(i[1].end={...g.get(c)[1].start},m=g.slice(c,r),m.unshift(i),g.splice(c,r-c+1,m))}}return ol(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!f}function jw(e,l){const r=e.get(l)[1],i=e.get(l)[2];let c=l-1;const u=[];let d=r._tokenizer;d||(d=i.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const m=d.events,x=[],f={};let g,y,b=-1,v=r,S=0,j=0;const C=[j];for(;v;){for(;e.get(++c)[1]!==v;);u.push(c),v._tokenizer||(g=i.sliceStream(v),v.next||g.push(null),y&&d.defineSkip(v.start),v._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(g),v._isInFirstContentOfListItem&&(d._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&&(j=b+1,C.push(j),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(d.events=[],v?(v._tokenizer=void 0,v.previous=void 0):C.pop(),b=C.length;b--;){const E=m.slice(C[b],C[b+1]),N=u.pop();x.push([N,N+E.length-1]),e.splice(N,2,E)}for(x.reverse(),b=-1;++b<x.length;)f[S+x[b][0]]=S+x[b][1],S+=x[b][1]-x[b][0]-1;return f}const Sw={resolve:Ew,tokenize:Nw},Cw={partial:!0,tokenize:Aw};function Ew(e){return by(e),e}function Nw(e,l){let r;return i;function i(m){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),c(m)}function c(m){return m===null?u(m):Ve(m)?e.check(Cw,d,u)(m):(e.consume(m),c)}function u(m){return e.exit("chunkContent"),e.exit("content"),l(m)}function d(m){return e.consume(m),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,c}}function Aw(e,l,r){const i=this;return c;function c(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),wt(e,u,"linePrefix")}function u(d){if(d===null||Ve(d))return r(d);const m=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(d):e.interrupt(i.parser.constructs.flow,r,l)(d)}}function vy(e,l,r,i,c,u,d,m,x){const f=x||Number.POSITIVE_INFINITY;let g=0;return y;function y(E){return E===60?(e.enter(i),e.enter(c),e.enter(u),e.consume(E),e.exit(u),b):E===null||E===32||E===41||_c(E)?r(E):(e.enter(i),e.enter(d),e.enter(m),e.enter("chunkString",{contentType:"string"}),j(E))}function b(E){return E===62?(e.enter(u),e.consume(E),e.exit(u),e.exit(c),e.exit(i),l):(e.enter(m),e.enter("chunkString",{contentType:"string"}),v(E))}function v(E){return E===62?(e.exit("chunkString"),e.exit(m),b(E)):E===null||E===60||Ve(E)?r(E):(e.consume(E),E===92?S:v)}function S(E){return E===60||E===62||E===92?(e.consume(E),v):v(E)}function j(E){return!g&&(E===null||E===41||Lt(E))?(e.exit("chunkString"),e.exit(m),e.exit(d),e.exit(i),l(E)):g<f&&E===40?(e.consume(E),g++,j):E===41?(e.consume(E),g--,j):E===null||E===32||E===40||_c(E)?r(E):(e.consume(E),E===92?C:j)}function C(E){return E===40||E===41||E===92?(e.consume(E),j):j(E)}}function wy(e,l,r,i,c,u){const d=this;let m=0,x;return f;function f(v){return e.enter(i),e.enter(c),e.consume(v),e.exit(c),e.enter(u),g}function g(v){return m>999||v===null||v===91||v===93&&!x||v===94&&!m&&"_hiddenFootnoteSupport"in d.parser.constructs?r(v):v===93?(e.exit(u),e.enter(c),e.consume(v),e.exit(c),e.exit(i),l):Ve(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),y(v))}function y(v){return v===null||v===91||v===93||Ve(v)||m++>999?(e.exit("chunkString"),g(v)):(e.consume(v),x||(x=!ht(v)),v===92?b:y)}function b(v){return v===91||v===92||v===93?(e.consume(v),m++,y):y(v)}}function ky(e,l,r,i,c,u){let d;return m;function m(b){return b===34||b===39||b===40?(e.enter(i),e.enter(c),e.consume(b),e.exit(c),d=b===40?41:b,x):r(b)}function x(b){return b===d?(e.enter(c),e.consume(b),e.exit(c),e.exit(i),l):(e.enter(u),f(b))}function f(b){return b===d?(e.exit(u),x(d)):b===null?r(b):Ve(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),wt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===d||b===null||Ve(b)?(e.exit("chunkString"),f(b)):(e.consume(b),b===92?y:g)}function y(b){return b===d||b===92?(e.consume(b),g):g(b)}}function Ys(e,l){let r;return i;function i(c){return Ve(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),r=!0,i):ht(c)?wt(e,i,r?"linePrefix":"lineSuffix")(c):l(c)}}const Dw={name:"definition",tokenize:zw},Tw={partial:!0,tokenize:Mw};function zw(e,l,r){const i=this;let c;return u;function u(v){return e.enter("definition"),d(v)}function d(v){return wy.call(i,e,m,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function m(v){return c=zl(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),x):r(v)}function x(v){return Lt(v)?Ys(e,f)(v):f(v)}function f(v){return vy(e,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function g(v){return e.attempt(Tw,y,y)(v)}function y(v){return ht(v)?wt(e,b,"whitespace")(v):b(v)}function b(v){return v===null||Ve(v)?(e.exit("definition"),i.parser.defined.push(c),l(v)):r(v)}}function Mw(e,l,r){return i;function i(m){return Lt(m)?Ys(e,c)(m):r(m)}function c(m){return ky(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(m)}function u(m){return ht(m)?wt(e,d,"whitespace")(m):d(m)}function d(m){return m===null||Ve(m)?l(m):r(m)}}const Rw={name:"hardBreakEscape",tokenize:Fw};function Fw(e,l,r){return i;function i(u){return e.enter("hardBreakEscape"),e.consume(u),c}function c(u){return Ve(u)?(e.exit("hardBreakEscape"),l(u)):r(u)}}const _w={name:"headingAtx",resolve:Ow,tokenize:Bw};function Ow(e,l){let r=e.length-2,i=3,c,u;return e[i][1].type==="whitespace"&&(i+=2),r-2>i&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(i===r-1||r-4>i&&e[r-2][1].type==="whitespace")&&(r-=i+1===r?2:4),r>i&&(c={type:"atxHeadingText",start:e[i][1].start,end:e[r][1].end},u={type:"chunkText",start:e[i][1].start,end:e[r][1].end,contentType:"text"},ol(e,i,r-i+1,[["enter",c,l],["enter",u,l],["exit",u,l],["exit",c,l]])),e}function Bw(e,l,r){let i=0;return c;function c(g){return e.enter("atxHeading"),u(g)}function u(g){return e.enter("atxHeadingSequence"),d(g)}function d(g){return g===35&&i++<6?(e.consume(g),d):g===null||Lt(g)?(e.exit("atxHeadingSequence"),m(g)):r(g)}function m(g){return g===35?(e.enter("atxHeadingSequence"),x(g)):g===null||Ve(g)?(e.exit("atxHeading"),l(g)):ht(g)?wt(e,m,"whitespace")(g):(e.enter("atxHeadingText"),f(g))}function x(g){return g===35?(e.consume(g),x):(e.exit("atxHeadingSequence"),m(g))}function f(g){return g===null||g===35||Lt(g)?(e.exit("atxHeadingText"),m(g)):(e.consume(g),f)}}const $w=["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"],I1=["pre","script","style","textarea"],Lw={concrete:!0,name:"htmlFlow",resolveTo:Uw,tokenize:Yw},Hw={partial:!0,tokenize:Xw},Iw={partial:!0,tokenize:qw};function Uw(e){let l=e.length;for(;l--&&!(e[l][0]==="enter"&&e[l][1].type==="htmlFlow"););return l>1&&e[l-2][1].type==="linePrefix"&&(e[l][1].start=e[l-2][1].start,e[l+1][1].start=e[l-2][1].start,e.splice(l-2,2)),e}function Yw(e,l,r){const i=this;let c,u,d,m,x;return f;function f(D){return g(D)}function g(D){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(D),y}function y(D){return D===33?(e.consume(D),b):D===47?(e.consume(D),u=!0,j):D===63?(e.consume(D),c=3,i.interrupt?l:R):_n(D)?(e.consume(D),d=String.fromCharCode(D),C):r(D)}function b(D){return D===45?(e.consume(D),c=2,v):D===91?(e.consume(D),c=5,m=0,S):_n(D)?(e.consume(D),c=4,i.interrupt?l:R):r(D)}function v(D){return D===45?(e.consume(D),i.interrupt?l:R):r(D)}function S(D){const de="CDATA[";return D===de.charCodeAt(m++)?(e.consume(D),m===de.length?i.interrupt?l:B:S):r(D)}function j(D){return _n(D)?(e.consume(D),d=String.fromCharCode(D),C):r(D)}function C(D){if(D===null||D===47||D===62||Lt(D)){const de=D===47,Se=d.toLowerCase();return!de&&!u&&I1.includes(Se)?(c=1,i.interrupt?l(D):B(D)):$w.includes(d.toLowerCase())?(c=6,de?(e.consume(D),E):i.interrupt?l(D):B(D)):(c=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(D):u?N(D):z(D))}return D===45||Dn(D)?(e.consume(D),d+=String.fromCharCode(D),C):r(D)}function E(D){return D===62?(e.consume(D),i.interrupt?l:B):r(D)}function N(D){return ht(D)?(e.consume(D),N):T(D)}function z(D){return D===47?(e.consume(D),T):D===58||D===95||_n(D)?(e.consume(D),O):ht(D)?(e.consume(D),z):T(D)}function O(D){return D===45||D===46||D===58||D===95||Dn(D)?(e.consume(D),O):I(D)}function I(D){return D===61?(e.consume(D),_):ht(D)?(e.consume(D),I):z(D)}function _(D){return D===null||D===60||D===61||D===62||D===96?r(D):D===34||D===39?(e.consume(D),x=D,q):ht(D)?(e.consume(D),_):W(D)}function q(D){return D===x?(e.consume(D),x=null,Y):D===null||Ve(D)?r(D):(e.consume(D),q)}function W(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||Lt(D)?I(D):(e.consume(D),W)}function Y(D){return D===47||D===62||ht(D)?z(D):r(D)}function T(D){return D===62?(e.consume(D),$):r(D)}function $(D){return D===null||Ve(D)?B(D):ht(D)?(e.consume(D),$):r(D)}function B(D){return D===45&&c===2?(e.consume(D),U):D===60&&c===1?(e.consume(D),Z):D===62&&c===4?(e.consume(D),M):D===63&&c===3?(e.consume(D),R):D===93&&c===5?(e.consume(D),je):Ve(D)&&(c===6||c===7)?(e.exit("htmlFlowData"),e.check(Hw,K,G)(D)):D===null||Ve(D)?(e.exit("htmlFlowData"),G(D)):(e.consume(D),B)}function G(D){return e.check(Iw,ne,K)(D)}function ne(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),V}function V(D){return D===null||Ve(D)?G(D):(e.enter("htmlFlowData"),B(D))}function U(D){return D===45?(e.consume(D),R):B(D)}function Z(D){return D===47?(e.consume(D),d="",ie):B(D)}function ie(D){if(D===62){const de=d.toLowerCase();return I1.includes(de)?(e.consume(D),M):B(D)}return _n(D)&&d.length<8?(e.consume(D),d+=String.fromCharCode(D),ie):B(D)}function je(D){return D===93?(e.consume(D),R):B(D)}function R(D){return D===62?(e.consume(D),M):D===45&&c===2?(e.consume(D),R):B(D)}function M(D){return D===null||Ve(D)?(e.exit("htmlFlowData"),K(D)):(e.consume(D),M)}function K(D){return e.exit("htmlFlow"),l(D)}}function qw(e,l,r){const i=this;return c;function c(d){return Ve(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):r(d)}function u(d){return i.parser.lazy[i.now().line]?r(d):l(d)}}function Xw(e,l,r){return i;function i(c){return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),e.attempt(eo,l,r)}}const Vw={name:"htmlText",tokenize:Gw};function Gw(e,l,r){const i=this;let c,u,d;return m;function m(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),x}function x(R){return R===33?(e.consume(R),f):R===47?(e.consume(R),I):R===63?(e.consume(R),z):_n(R)?(e.consume(R),W):r(R)}function f(R){return R===45?(e.consume(R),g):R===91?(e.consume(R),u=0,S):_n(R)?(e.consume(R),N):r(R)}function g(R){return R===45?(e.consume(R),v):r(R)}function y(R){return R===null?r(R):R===45?(e.consume(R),b):Ve(R)?(d=y,Z(R)):(e.consume(R),y)}function b(R){return R===45?(e.consume(R),v):y(R)}function v(R){return R===62?U(R):R===45?b(R):y(R)}function S(R){const M="CDATA[";return R===M.charCodeAt(u++)?(e.consume(R),u===M.length?j:S):r(R)}function j(R){return R===null?r(R):R===93?(e.consume(R),C):Ve(R)?(d=j,Z(R)):(e.consume(R),j)}function C(R){return R===93?(e.consume(R),E):j(R)}function E(R){return R===62?U(R):R===93?(e.consume(R),E):j(R)}function N(R){return R===null||R===62?U(R):Ve(R)?(d=N,Z(R)):(e.consume(R),N)}function z(R){return R===null?r(R):R===63?(e.consume(R),O):Ve(R)?(d=z,Z(R)):(e.consume(R),z)}function O(R){return R===62?U(R):z(R)}function I(R){return _n(R)?(e.consume(R),_):r(R)}function _(R){return R===45||Dn(R)?(e.consume(R),_):q(R)}function q(R){return Ve(R)?(d=q,Z(R)):ht(R)?(e.consume(R),q):U(R)}function W(R){return R===45||Dn(R)?(e.consume(R),W):R===47||R===62||Lt(R)?Y(R):r(R)}function Y(R){return R===47?(e.consume(R),U):R===58||R===95||_n(R)?(e.consume(R),T):Ve(R)?(d=Y,Z(R)):ht(R)?(e.consume(R),Y):U(R)}function T(R){return R===45||R===46||R===58||R===95||Dn(R)?(e.consume(R),T):$(R)}function $(R){return R===61?(e.consume(R),B):Ve(R)?(d=$,Z(R)):ht(R)?(e.consume(R),$):Y(R)}function B(R){return R===null||R===60||R===61||R===62||R===96?r(R):R===34||R===39?(e.consume(R),c=R,G):Ve(R)?(d=B,Z(R)):ht(R)?(e.consume(R),B):(e.consume(R),ne)}function G(R){return R===c?(e.consume(R),c=void 0,V):R===null?r(R):Ve(R)?(d=G,Z(R)):(e.consume(R),G)}function ne(R){return R===null||R===34||R===39||R===60||R===61||R===96?r(R):R===47||R===62||Lt(R)?Y(R):(e.consume(R),ne)}function V(R){return R===47||R===62||Lt(R)?Y(R):r(R)}function U(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),l):r(R)}function Z(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),ie}function ie(R){return ht(R)?wt(e,je,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):je(R)}function je(R){return e.enter("htmlTextData"),d(R)}}const bh={name:"labelEnd",resolveAll:Zw,resolveTo:Jw,tokenize:Pw},Kw={tokenize:e5},Ww={tokenize:t5},Qw={tokenize:n5};function Zw(e){let l=-1;const r=[];for(;++l<e.length;){const i=e[l][1];if(r.push(e[l]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const c=i.type==="labelImage"?4:2;i.type="data",l+=c}}return e.length!==r.length&&ol(e,0,e.length,r),e}function Jw(e,l){let r=e.length,i=0,c,u,d,m;for(;r--;)if(c=e[r][1],u){if(c.type==="link"||c.type==="labelLink"&&c._inactive)break;e[r][0]==="enter"&&c.type==="labelLink"&&(c._inactive=!0)}else if(d){if(e[r][0]==="enter"&&(c.type==="labelImage"||c.type==="labelLink")&&!c._balanced&&(u=r,c.type!=="labelLink")){i=2;break}}else c.type==="labelEnd"&&(d=r);const x={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[u][1].start},end:{...e[d][1].end}},g={type:"labelText",start:{...e[u+i+2][1].end},end:{...e[d-2][1].start}};return m=[["enter",x,l],["enter",f,l]],m=gl(m,e.slice(u+1,u+i+3)),m=gl(m,[["enter",g,l]]),m=gl(m,Vc(l.parser.constructs.insideSpan.null,e.slice(u+i+4,d-3),l)),m=gl(m,[["exit",g,l],e[d-2],e[d-1],["exit",f,l]]),m=gl(m,e.slice(d+1)),m=gl(m,[["exit",x,l]]),ol(e,u,e.length,m),e}function Pw(e,l,r){const i=this;let c=i.events.length,u,d;for(;c--;)if((i.events[c][1].type==="labelImage"||i.events[c][1].type==="labelLink")&&!i.events[c][1]._balanced){u=i.events[c][1];break}return m;function m(b){return u?u._inactive?y(b):(d=i.parser.defined.includes(zl(i.sliceSerialize({start:u.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),x):r(b)}function x(b){return b===40?e.attempt(Kw,g,d?g:y)(b):b===91?e.attempt(Ww,g,d?f:y)(b):d?g(b):y(b)}function f(b){return e.attempt(Qw,g,y)(b)}function g(b){return l(b)}function y(b){return u._balanced=!0,r(b)}}function e5(e,l,r){return i;function i(y){return e.enter("resource"),e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),c}function c(y){return Lt(y)?Ys(e,u)(y):u(y)}function u(y){return y===41?g(y):vy(e,d,m,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function d(y){return Lt(y)?Ys(e,x)(y):g(y)}function m(y){return r(y)}function x(y){return y===34||y===39||y===40?ky(e,f,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function f(y){return Lt(y)?Ys(e,g)(y):g(y)}function g(y){return y===41?(e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),e.exit("resource"),l):r(y)}}function t5(e,l,r){const i=this;return c;function c(m){return wy.call(i,e,u,d,"reference","referenceMarker","referenceString")(m)}function u(m){return i.parser.defined.includes(zl(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?l(m):r(m)}function d(m){return r(m)}}function n5(e,l,r){return i;function i(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),c}function c(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),l):r(u)}}const l5={name:"labelStartImage",resolveAll:bh.resolveAll,tokenize:r5};function r5(e,l,r){const i=this;return c;function c(m){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(m),e.exit("labelImageMarker"),u}function u(m){return m===91?(e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelImage"),d):r(m)}function d(m){return m===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(m):l(m)}}const a5={name:"labelStartLink",resolveAll:bh.resolveAll,tokenize:i5};function i5(e,l,r){const i=this;return c;function c(d){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelLink"),u}function u(d){return d===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(d):l(d)}}const cf={name:"lineEnding",tokenize:s5};function s5(e,l){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),wt(e,l,"linePrefix")}}const Dc={name:"thematicBreak",tokenize:o5};function o5(e,l,r){let i=0,c;return u;function u(f){return e.enter("thematicBreak"),d(f)}function d(f){return c=f,m(f)}function m(f){return f===c?(e.enter("thematicBreakSequence"),x(f)):i>=3&&(f===null||Ve(f))?(e.exit("thematicBreak"),l(f)):r(f)}function x(f){return f===c?(e.consume(f),i++,x):(e.exit("thematicBreakSequence"),ht(f)?wt(e,m,"whitespace")(f):m(f))}}const Xn={continuation:{tokenize:f5},exit:m5,name:"list",tokenize:d5},c5={partial:!0,tokenize:x5},u5={partial:!0,tokenize:h5};function d5(e,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,d=0;return m;function m(v){const S=i.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!i.containerState.marker||v===i.containerState.marker:Kf(v)){if(i.containerState.type||(i.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Dc,r,f)(v):f(v);if(!i.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),x(v)}return r(v)}function x(v){return Kf(v)&&++d<10?(e.consume(v),x):(!i.interrupt||d<2)&&(i.containerState.marker?v===i.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),f(v)):r(v)}function f(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||v,e.check(eo,i.interrupt?r:g,e.attempt(c5,b,y))}function g(v){return i.containerState.initialBlankLine=!0,u++,b(v)}function y(v){return ht(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),b):r(v)}function b(v){return i.containerState.size=u+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,l(v)}}function f5(e,l,r){const i=this;return i.containerState._closeFlow=void 0,e.check(eo,c,u);function c(m){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,wt(e,l,"listItemIndent",i.containerState.size+1)(m)}function u(m){return i.containerState.furtherBlankLines||!ht(m)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,d(m)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(u5,l,d)(m))}function d(m){return i.containerState._closeFlow=!0,i.interrupt=void 0,wt(e,e.attempt(Xn,l,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m)}}function h5(e,l,r){const i=this;return wt(e,c,"listItemIndent",i.containerState.size+1);function c(u){const d=i.events[i.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===i.containerState.size?l(u):r(u)}}function m5(e){e.exit(this.containerState.type)}function x5(e,l,r){const i=this;return wt(e,c,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(u){const d=i.events[i.events.length-1];return!ht(u)&&d&&d[1].type==="listItemPrefixWhitespace"?l(u):r(u)}}const U1={name:"setextUnderline",resolveTo:p5,tokenize:y5};function p5(e,l){let r=e.length,i,c,u;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){i=r;break}e[r][1].type==="paragraph"&&(c=r)}else e[r][1].type==="content"&&e.splice(r,1),!u&&e[r][1].type==="definition"&&(u=r);const d={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[c][1].type="setextHeadingText",u?(e.splice(c,0,["enter",d,l]),e.splice(u+1,0,["exit",e[i][1],l]),e[i][1].end={...e[u][1].end}):e[i][1]=d,e.push(["exit",d,l]),e}function y5(e,l,r){const i=this;let c;return u;function u(f){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)?(e.enter("setextHeadingLine"),c=f,d(f)):r(f)}function d(f){return e.enter("setextHeadingLineSequence"),m(f)}function m(f){return f===c?(e.consume(f),m):(e.exit("setextHeadingLineSequence"),ht(f)?wt(e,x,"lineSuffix")(f):x(f))}function x(f){return f===null||Ve(f)?(e.exit("setextHeadingLine"),l(f)):r(f)}}const g5={tokenize:b5};function b5(e){const l=this,r=e.attempt(eo,i,e.attempt(this.parser.constructs.flowInitial,c,wt(e,e.attempt(this.parser.constructs.flow,c,e.attempt(Sw,c)),"linePrefix")));return r;function i(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),l.currentConstruct=void 0,r}function c(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l.currentConstruct=void 0,r}}const v5={resolveAll:Sy()},w5=jy("string"),k5=jy("text");function jy(e){return{resolveAll:Sy(e==="text"?j5:void 0),tokenize:l};function l(r){const i=this,c=this.parser.constructs[e],u=r.attempt(c,d,m);return d;function d(g){return f(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 f(g)?(r.exit("data"),u(g)):(r.consume(g),x)}function f(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 Sy(e){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 e?e(r,i):r}}function j5(e,l){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const i=e[r-1][1],c=l.sliceStream(i);let u=c.length,d=-1,m=0,x;for(;u--;){const f=c[u];if(typeof f=="string"){for(d=f.length;f.charCodeAt(d-1)===32;)m++,d--;if(d)break;d=-1}else if(f===-2)x=!0,m++;else if(f!==-1){u++;break}}if(l._contentTypeTextTrailing&&r===e.length&&(m=0),m){const f={type:r===e.length||x||m<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?d:i.start._bufferIndex+d,_index:i.start._index+u,line:i.end.line,column:i.end.column-m,offset:i.end.offset-m},end:{...i.end}};i.end={...f.start},i.start.offset===i.end.offset?Object.assign(i,f):(e.splice(r,0,["enter",f,l],["exit",f,l]),r+=2)}r++}return e}const S5={42:Xn,43:Xn,45:Xn,48:Xn,49:Xn,50:Xn,51:Xn,52:Xn,53:Xn,54:Xn,55:Xn,56:Xn,57:Xn,62:py},C5={91:Dw},E5={[-2]:of,[-1]:of,32:of},N5={35:_w,42:Dc,45:[U1,Dc],60:Lw,61:U1,95:Dc,96:H1,126:H1},A5={38:gy,92:yy},D5={[-5]:cf,[-4]:cf,[-3]:cf,33:l5,38:gy,42:Wf,60:[aw,Vw],91:a5,92:[Rw,yy],93:bh,95:Wf,96:gw},T5={null:[Wf,v5]},z5={null:[42,95]},M5={null:[]},R5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:z5,contentInitial:C5,disable:M5,document:S5,flow:N5,flowInitial:E5,insideSpan:T5,string:A5,text:D5},Symbol.toStringTag,{value:"Module"}));function F5(e,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 d=[],m=[];const x={attempt:q(I),check:q(_),consume:N,enter:z,exit:O,interrupt:q(_,{interrupt:!0})},f={code:null,containerState:{},defineSkip:j,events:[],now:S,parser:e,previous:null,sliceSerialize:b,sliceStream:v,write:y};let g=l.tokenize.call(f,x);return l.resolveAll&&u.push(l),f;function y($){return d=gl(d,$),C(),d[d.length-1]!==null?[]:(W(l,0),f.events=Vc(u,f.events,f),f.events)}function b($,B){return O5(v($),B)}function v($){return _5(d,$)}function S(){const{_bufferIndex:$,_index:B,line:G,column:ne,offset:V}=i;return{_bufferIndex:$,_index:B,line:G,column:ne,offset:V}}function j($){c[$.line]=$.column,T()}function C(){let $;for(;i._index<d.length;){const B=d[i._index];if(typeof B=="string")for($=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===$&&i._bufferIndex<B.length;)E(B.charCodeAt(i._bufferIndex));else E(B)}}function E($){g=g($)}function N($){Ve($)?(i.line++,i.column=1,i.offset+=$===-3?2:1,T()):$!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===d[i._index].length&&(i._bufferIndex=-1,i._index++)),f.previous=$}function z($,B){const G=B||{};return G.type=$,G.start=S(),f.events.push(["enter",G,f]),m.push(G),G}function O($){const B=m.pop();return B.end=S(),f.events.push(["exit",B,f]),B}function I($,B){W($,B.from)}function _($,B){B.restore()}function q($,B){return G;function G(ne,V,U){let Z,ie,je,R;return Array.isArray(ne)?K(ne):"tokenize"in ne?K([ne]):M(ne);function M(ve){return Fe;function Fe(Me){const $e=Me!==null&&ve[Me],fe=Me!==null&&ve.null,tt=[...Array.isArray($e)?$e:$e?[$e]:[],...Array.isArray(fe)?fe:fe?[fe]:[]];return K(tt)(Me)}}function K(ve){return Z=ve,ie=0,ve.length===0?U:D(ve[ie])}function D(ve){return Fe;function Fe(Me){return R=Y(),je=ve,ve.partial||(f.currentConstruct=ve),ve.name&&f.parser.constructs.disable.null.includes(ve.name)?Se():ve.tokenize.call(B?Object.assign(Object.create(f),B):f,x,de,Se)(Me)}}function de(ve){return $(je,R),V}function Se(ve){return R.restore(),++ie<Z.length?D(Z[ie]):U}}}function W($,B){$.resolveAll&&!u.includes($)&&u.push($),$.resolve&&ol(f.events,B,f.events.length-B,$.resolve(f.events.slice(B),f)),$.resolveTo&&(f.events=$.resolveTo(f.events,f))}function Y(){const $=S(),B=f.previous,G=f.currentConstruct,ne=f.events.length,V=Array.from(m);return{from:ne,restore:U};function U(){i=$,f.previous=B,f.currentConstruct=G,f.events.length=ne,m=V,T()}}function T(){i.line in c&&i.column<2&&(i.column=c[i.line],i.offset+=c[i.line]-1)}}function _5(e,l){const r=l.start._index,i=l.start._bufferIndex,c=l.end._index,u=l.end._bufferIndex;let d;if(r===c)d=[e[r].slice(i,u)];else{if(d=e.slice(r,c),i>-1){const m=d[0];typeof m=="string"?d[0]=m.slice(i):d.shift()}u>0&&d.push(e[c].slice(0,u))}return d}function O5(e,l){let r=-1;const i=[];let c;for(;++r<e.length;){const u=e[r];let d;if(typeof u=="string")d=u;else switch(u){case-5:{d="\r";break}case-4:{d=`
|
|
51
|
+
`,f="/",g="*",y="",b="comment",v="declaration";function S(C,E){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];E=E||{};var N=1,z=1;function O(ne){var V=ne.match(l);V&&(N+=V.length);var U=ne.lastIndexOf(x);z=~U?ne.length-U:z+ne.length}function I(){var ne={line:N,column:z};return function(V){return V.position=new _(ne),Y(),V}}function _(ne){this.start=ne,this.end={line:N,column:z},this.source=E.source}_.prototype.content=C;function q(ne){var V=new Error(E.source+":"+N+":"+z+": "+ne);if(V.reason=ne,V.filename=E.source,V.line=N,V.column=z,V.source=C,!E.silent)throw V}function W(ne){var V=ne.exec(C);if(V){var U=V[0];return O(U),C=C.slice(U.length),V}}function Y(){W(r)}function T(ne){var V;for(ne=ne||[];V=$();)V!==!1&&ne.push(V);return ne}function $(){var ne=I();if(!(f!=C.charAt(0)||g!=C.charAt(1))){for(var V=2;y!=C.charAt(V)&&(g!=C.charAt(V)||f!=C.charAt(V+1));)++V;if(V+=2,y===C.charAt(V-1))return q("End of comment missing");var U=C.slice(2,V-2);return z+=2,O(U),C=C.slice(V),z+=2,ne({type:b,comment:U})}}function B(){var ne=I(),V=W(i);if(V){if($(),!W(c))return q("property missing ':'");var U=W(u),J=ne({type:v,property:j(V[0].replace(e,y)),value:U?j(U[0].replace(e,y)):y});return W(d),J}}function G(){var ne=[];T(ne);for(var V;V=B();)V!==!1&&(ne.push(V),T(ne));return ne}return Y(),G()}function j(C){return C?C.replace(m,y):y}return af=S,af}var D1;function bv(){if(D1)return vi;D1=1;var e=vi&&vi.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(vi,"__esModule",{value:!0}),vi.default=r;const l=e(gv());function r(i,c){let u=null;if(!i||typeof i!="string")return u;const d=(0,l.default)(i),m=typeof c=="function";return d.forEach(x=>{if(x.type!=="declaration")return;const{property:f,value:g}=x;m?c(f,g,x):g&&(u=u||{},u[f]=g)}),u}return vi}var Ts={},T1;function vv(){if(T1)return Ts;T1=1,Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,l=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,u=function(f){return!f||r.test(f)||e.test(f)},d=function(f,g){return g.toUpperCase()},m=function(f,g){return"".concat(g,"-")},x=function(f,g){return g===void 0&&(g={}),u(f)?f:(f=f.toLowerCase(),g.reactCompat?f=f.replace(c,m):f=f.replace(i,m),f.replace(l,d))};return Ts.camelCase=x,Ts}var zs,z1;function wv(){if(z1)return zs;z1=1;var e=zs&&zs.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},l=e(bv()),r=vv();function i(c,u){var d={};return!c||typeof c!="string"||(0,l.default)(c,function(m,x){m&&x&&(d[(0,r.camelCase)(m,u)]=x)}),d}return i.default=i,zs=i,zs}var kv=wv();const jv=J0(kv),sy=oy("end"),hh=oy("start");function oy(e){return l;function l(r){const i=r&&r.position&&r.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function Sv(e){const l=hh(e),r=sy(e);if(l&&r)return{start:l,end:r}}function Us(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?M1(e.position):"start"in e||"end"in e?M1(e):"line"in e||"column"in e?Gf(e):""}function Gf(e){return R1(e&&e.line)+":"+R1(e&&e.column)}function M1(e){return Gf(e&&e.start)+"-"+Gf(e&&e.end)}function R1(e){return e&&typeof e=="number"?e:1}class Tn extends Error{constructor(l,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let c="",u={},d=!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&&(d=!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=Us(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=d&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Tn.prototype.file="";Tn.prototype.name="";Tn.prototype.reason="";Tn.prototype.message="";Tn.prototype.stack="";Tn.prototype.column=void 0;Tn.prototype.line=void 0;Tn.prototype.ancestors=void 0;Tn.prototype.cause=void 0;Tn.prototype.fatal=void 0;Tn.prototype.place=void 0;Tn.prototype.ruleId=void 0;Tn.prototype.source=void 0;const mh={}.hasOwnProperty,Cv=new Map,Ev=/[A-Z]/g,Nv=new Set(["table","tbody","thead","tfoot","tr"]),Av=new Set(["td","th"]),cy="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Dv(e,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=Bv(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=Ov(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"?fh:pv,stylePropertyNameCase:l.stylePropertyNameCase||"dom",tableCellAlignToStyle:l.tableCellAlignToStyle!==!1},u=uy(c,e,void 0);return u&&typeof u!="string"?u:c.create(e,c.Fragment,{children:u||void 0},void 0)}function uy(e,l,r){if(l.type==="element")return Tv(e,l,r);if(l.type==="mdxFlowExpression"||l.type==="mdxTextExpression")return zv(e,l);if(l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement")return Rv(e,l,r);if(l.type==="mdxjsEsm")return Mv(e,l);if(l.type==="root")return Fv(e,l,r);if(l.type==="text")return _v(e,l)}function Tv(e,l,r){const i=e.schema;let c=i;l.tagName.toLowerCase()==="svg"&&i.space==="html"&&(c=fh,e.schema=c),e.ancestors.push(l);const u=fy(e,l.tagName,!1),d=$v(e,l);let m=ph(e,l);return Nv.has(l.tagName)&&(m=m.filter(function(x){return typeof x=="string"?!iv(x):!0})),dy(e,d,u,l),xh(d,m),e.ancestors.pop(),e.schema=i,e.create(l,u,d,r)}function zv(e,l){if(l.data&&l.data.estree&&e.evaluater){const i=l.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}Vs(e,l.position)}function Mv(e,l){if(l.data&&l.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(l.data.estree);Vs(e,l.position)}function Rv(e,l,r){const i=e.schema;let c=i;l.name==="svg"&&i.space==="html"&&(c=fh,e.schema=c),e.ancestors.push(l);const u=l.name===null?e.Fragment:fy(e,l.name,!0),d=Lv(e,l),m=ph(e,l);return dy(e,d,u,l),xh(d,m),e.ancestors.pop(),e.schema=i,e.create(l,u,d,r)}function Fv(e,l,r){const i={};return xh(i,ph(e,l)),e.create(l,e.Fragment,i,r)}function _v(e,l){return l.value}function dy(e,l,r,i){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(l.node=i)}function xh(e,l){if(l.length>0){const r=l.length>1?l:l[0];r&&(e.children=r)}}function Ov(e,l,r){return i;function i(c,u,d,m){const f=Array.isArray(d.children)?r:l;return m?f(u,d,m):f(u,d)}}function Bv(e,l){return r;function r(i,c,u,d){const m=Array.isArray(u.children),x=hh(i);return l(c,u,d,m,{columnNumber:x?x.column-1:void 0,fileName:e,lineNumber:x?x.line:void 0},void 0)}}function $v(e,l){const r={};let i,c;for(c in l.properties)if(c!=="children"&&mh.call(l.properties,c)){const u=Hv(e,c,l.properties[c]);if(u){const[d,m]=u;e.tableCellAlignToStyle&&d==="align"&&typeof m=="string"&&Av.has(l.tagName)?i=m:r[d]=m}}if(i){const u=r.style||(r.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return r}function Lv(e,l){const r={};for(const i of l.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const u=i.data.estree.body[0];u.type;const d=u.expression;d.type;const m=d.properties[0];m.type,Object.assign(r,e.evaluater.evaluateExpression(m.argument))}else Vs(e,l.position);else{const c=i.name;let u;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const m=i.value.data.estree.body[0];m.type,u=e.evaluater.evaluateExpression(m.expression)}else Vs(e,l.position);else u=i.value===null?!0:i.value;r[c]=u}return r}function ph(e,l){const r=[];let i=-1;const c=e.passKeys?new Map:Cv;for(;++i<l.children.length;){const u=l.children[i];let d;if(e.passKeys){const x=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(x){const f=c.get(x)||0;d=x+"-"+f,c.set(x,f+1)}}const m=uy(e,u,d);m!==void 0&&r.push(m)}return r}function Hv(e,l,r){const i=hv(e.schema,l);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=i.commaSeparated?tv(r):yv(r)),i.property==="style"){let c=typeof r=="object"?r:Iv(e,String(r));return e.stylePropertyNameCase==="css"&&(c=Uv(c)),["style",c]}return[e.elementAttributeNameCase==="react"&&i.space?uv[i.property]||i.property:i.attribute,r]}}function Iv(e,l){try{return jv(l,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const i=r,c=new Tn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=e.filePath||void 0,c.url=cy+"#cannot-parse-style-attribute",c}}function fy(e,l,r){let i;if(!r)i={type:"Literal",value:l};else if(l.includes(".")){const c=l.split(".");let u=-1,d;for(;++u<c.length;){const m=S1(c[u])?{type:"Identifier",name:c[u]}:{type:"Literal",value:c[u]};d=d?{type:"MemberExpression",object:d,property:m,computed:!!(u&&m.type==="Literal"),optional:!1}:m}i=d}else i=S1(l)&&!/^[a-z]/.test(l)?{type:"Identifier",name:l}:{type:"Literal",value:l};if(i.type==="Literal"){const c=i.value;return mh.call(e.components,c)?e.components[c]:c}if(e.evaluater)return e.evaluater.evaluateExpression(i);Vs(e)}function Vs(e,l){const r=new Tn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:l,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=cy+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Uv(e){const l={};let r;for(r in e)mh.call(e,r)&&(l[Yv(r)]=e[r]);return l}function Yv(e){let l=e.replace(Ev,qv);return l.slice(0,3)==="ms-"&&(l="-"+l),l}function qv(e){return"-"+e.toLowerCase()}const sf={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"]},Xv={};function yh(e,l){const r=Xv,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,c=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return hy(e,i,c)}function hy(e,l,r){if(Vv(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(l&&"alt"in e&&e.alt)return e.alt;if("children"in e)return F1(e.children,l,r)}return Array.isArray(e)?F1(e,l,r):""}function F1(e,l,r){const i=[];let c=-1;for(;++c<e.length;)i[c]=hy(e[c],l,r);return i.join("")}function Vv(e){return!!(e&&typeof e=="object")}const _1=document.createElement("i");function gh(e){const l="&"+e+";";_1.innerHTML=l;const r=_1.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===l?!1:r}function ol(e,l,r,i){const c=e.length;let u=0,d;if(l<0?l=-l>c?0:c+l:l=l>c?c:l,r=r>0?r:0,i.length<1e4)d=Array.from(i),d.unshift(l,r),e.splice(...d);else for(r&&e.splice(l,r);u<i.length;)d=i.slice(u,u+1e4),d.unshift(l,0),e.splice(...d),u+=1e4,l+=1e4}function gl(e,l){return e.length>0?(ol(e,e.length,0,l),e):l}const O1={}.hasOwnProperty;function my(e){const l={};let r=-1;for(;++r<e.length;)Gv(l,e[r]);return l}function Gv(e,l){let r;for(r in l){const c=(O1.call(e,r)?e[r]:void 0)||(e[r]={}),u=l[r];let d;if(u)for(d in u){O1.call(c,d)||(c[d]=[]);const m=u[d];Kv(c[d],Array.isArray(m)?m:m?[m]:[])}}}function Kv(e,l){let r=-1;const i=[];for(;++r<l.length;)(l[r].add==="after"?e:i).push(l[r]);ol(e,0,0,i)}function xy(e,l){const r=Number.parseInt(e,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 zl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const _n=ca(/[A-Za-z]/),Dn=ca(/[\dA-Za-z]/),Wv=ca(/[#-'*+\--9=?A-Z^-~]/);function _c(e){return e!==null&&(e<32||e===127)}const Kf=ca(/\d/),Qv=ca(/[\dA-Fa-f]/),Zv=ca(/[!-/:-@[-`{-~]/);function Ve(e){return e!==null&&e<-2}function Lt(e){return e!==null&&(e<0||e===32)}function ht(e){return e===-2||e===-1||e===32}const Xc=ca(new RegExp("\\p{P}|\\p{S}","u")),Ba=ca(/\s/);function ca(e){return l;function l(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function zi(e){const l=[];let r=-1,i=0,c=0;for(;++r<e.length;){const u=e.charCodeAt(r);let d="";if(u===37&&Dn(e.charCodeAt(r+1))&&Dn(e.charCodeAt(r+2)))c=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(d=String.fromCharCode(u));else if(u>55295&&u<57344){const m=e.charCodeAt(r+1);u<56320&&m>56319&&m<57344?(d=String.fromCharCode(u,m),c=1):d="�"}else d=String.fromCharCode(u);d&&(l.push(e.slice(i,r),encodeURIComponent(d)),i=r+c+1,d=""),c&&(r+=c,c=0)}return l.join("")+e.slice(i)}function wt(e,l,r,i){const c=i?i-1:Number.POSITIVE_INFINITY;let u=0;return d;function d(x){return ht(x)?(e.enter(r),m(x)):l(x)}function m(x){return ht(x)&&u++<c?(e.consume(x),m):(e.exit(r),l(x))}}const Jv={tokenize:Pv};function Pv(e){const l=e.attempt(this.parser.constructs.contentInitial,i,c);let r;return l;function i(m){if(m===null){e.consume(m);return}return e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),wt(e,l,"linePrefix")}function c(m){return e.enter("paragraph"),u(m)}function u(m){const x=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=x),r=x,d(m)}function d(m){if(m===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(m);return}return Ve(m)?(e.consume(m),e.exit("chunkText"),u):(e.consume(m),d)}}const ew={tokenize:tw},B1={tokenize:nw};function tw(e){const l=this,r=[];let i=0,c,u,d;return m;function m(z){if(i<r.length){const O=r[i];return l.containerState=O[1],e.attempt(O[0].continuation,x,f)(z)}return f(z)}function x(z){if(i++,l.containerState._closeFlow){l.containerState._closeFlow=void 0,c&&N();const O=l.events.length;let I=O,_;for(;I--;)if(l.events[I][0]==="exit"&&l.events[I][1].type==="chunkFlow"){_=l.events[I][1].end;break}E(i);let q=O;for(;q<l.events.length;)l.events[q][1].end={..._},q++;return ol(l.events,I+1,0,l.events.slice(O)),l.events.length=q,f(z)}return m(z)}function f(z){if(i===r.length){if(!c)return b(z);if(c.currentConstruct&&c.currentConstruct.concrete)return S(z);l.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return l.containerState={},e.check(B1,g,y)(z)}function g(z){return c&&N(),E(i),b(z)}function y(z){return l.parser.lazy[l.now().line]=i!==r.length,d=l.now().offset,S(z)}function b(z){return l.containerState={},e.attempt(B1,v,S)(z)}function v(z){return i++,r.push([l.currentConstruct,l.containerState]),b(z)}function S(z){if(z===null){c&&N(),E(0),e.consume(z);return}return c=c||l.parser.flow(l.now()),e.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:u}),j(z)}function j(z){if(z===null){C(e.exit("chunkFlow"),!0),E(0),e.consume(z);return}return Ve(z)?(e.consume(z),C(e.exit("chunkFlow")),i=0,l.interrupt=void 0,m):(e.consume(z),j)}function C(z,O){const I=l.sliceStream(z);if(O&&I.push(null),z.previous=u,u&&(u.next=z),u=z,c.defineSkip(z.start),c.write(I),l.parser.lazy[z.start.line]){let _=c.events.length;for(;_--;)if(c.events[_][1].start.offset<d&&(!c.events[_][1].end||c.events[_][1].end.offset>d))return;const q=l.events.length;let W=q,Y,T;for(;W--;)if(l.events[W][0]==="exit"&&l.events[W][1].type==="chunkFlow"){if(Y){T=l.events[W][1].end;break}Y=!0}for(E(i),_=q;_<l.events.length;)l.events[_][1].end={...T},_++;ol(l.events,W+1,0,l.events.slice(q)),l.events.length=_}}function E(z){let O=r.length;for(;O-- >z;){const I=r[O];l.containerState=I[1],I[0].exit.call(l,e)}r.length=z}function N(){c.write([null]),u=void 0,c=void 0,l.containerState._closeFlow=void 0}}function nw(e,l,r){return wt(e,e.attempt(this.parser.constructs.document,l,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ni(e){if(e===null||Lt(e)||Ba(e))return 1;if(Xc(e))return 2}function Vc(e,l,r){const i=[];let c=-1;for(;++c<e.length;){const u=e[c].resolveAll;u&&!i.includes(u)&&(l=u(l,r),i.push(u))}return l}const Wf={name:"attention",resolveAll:lw,tokenize:rw};function lw(e,l){let r=-1,i,c,u,d,m,x,f,g;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(i=r;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&l.sliceSerialize(e[i][1]).charCodeAt(0)===l.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[i][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;x=e[i][1].end.offset-e[i][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const y={...e[i][1].end},b={...e[r][1].start};$1(y,-x),$1(b,x),d={type:x>1?"strongSequence":"emphasisSequence",start:y,end:{...e[i][1].end}},m={type:x>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:b},u={type:x>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[r][1].start}},c={type:x>1?"strong":"emphasis",start:{...d.start},end:{...m.end}},e[i][1].end={...d.start},e[r][1].start={...m.end},f=[],e[i][1].end.offset-e[i][1].start.offset&&(f=gl(f,[["enter",e[i][1],l],["exit",e[i][1],l]])),f=gl(f,[["enter",c,l],["enter",d,l],["exit",d,l],["enter",u,l]]),f=gl(f,Vc(l.parser.constructs.insideSpan.null,e.slice(i+1,r),l)),f=gl(f,[["exit",u,l],["enter",m,l],["exit",m,l],["exit",c,l]]),e[r][1].end.offset-e[r][1].start.offset?(g=2,f=gl(f,[["enter",e[r][1],l],["exit",e[r][1],l]])):g=0,ol(e,i-1,r-i+3,f),r=i+f.length-g-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function rw(e,l){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,c=Ni(i);let u;return d;function d(x){return u=x,e.enter("attentionSequence"),m(x)}function m(x){if(x===u)return e.consume(x),m;const f=e.exit("attentionSequence"),g=Ni(x),y=!g||g===2&&c||r.includes(x),b=!c||c===2&&g||r.includes(i);return f._open=!!(u===42?y:y&&(c||!b)),f._close=!!(u===42?b:b&&(g||!y)),l(x)}}function $1(e,l){e.column+=l,e.offset+=l,e._bufferIndex+=l}const aw={name:"autolink",tokenize:iw};function iw(e,l,r){let i=0;return c;function c(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(v){return _n(v)?(e.consume(v),d):v===64?r(v):f(v)}function d(v){return v===43||v===45||v===46||Dn(v)?(i=1,m(v)):f(v)}function m(v){return v===58?(e.consume(v),i=0,x):(v===43||v===45||v===46||Dn(v))&&i++<32?(e.consume(v),m):(i=0,f(v))}function x(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),l):v===null||v===32||v===60||_c(v)?r(v):(e.consume(v),x)}function f(v){return v===64?(e.consume(v),g):Wv(v)?(e.consume(v),f):r(v)}function g(v){return Dn(v)?y(v):r(v)}function y(v){return v===46?(e.consume(v),i=0,g):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),l):b(v)}function b(v){if((v===45||Dn(v))&&i++<63){const S=v===45?b:y;return e.consume(v),S}return r(v)}}const eo={partial:!0,tokenize:sw};function sw(e,l,r){return i;function i(u){return ht(u)?wt(e,c,"linePrefix")(u):c(u)}function c(u){return u===null||Ve(u)?l(u):r(u)}}const py={continuation:{tokenize:cw},exit:uw,name:"blockQuote",tokenize:ow};function ow(e,l,r){const i=this;return c;function c(d){if(d===62){const m=i.containerState;return m.open||(e.enter("blockQuote",{_container:!0}),m.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),u}return r(d)}function u(d){return ht(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),l):(e.exit("blockQuotePrefix"),l(d))}}function cw(e,l,r){const i=this;return c;function c(d){return ht(d)?wt(e,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):u(d)}function u(d){return e.attempt(py,l,r)(d)}}function uw(e){e.exit("blockQuote")}const yy={name:"characterEscape",tokenize:dw};function dw(e,l,r){return i;function i(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),c}function c(u){return Zv(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),l):r(u)}}const gy={name:"characterReference",tokenize:fw};function fw(e,l,r){const i=this;let c=0,u,d;return m;function m(y){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),x}function x(y){return y===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(y),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),u=31,d=Dn,g(y))}function f(y){return y===88||y===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(y),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,d=Qv,g):(e.enter("characterReferenceValue"),u=7,d=Kf,g(y))}function g(y){if(y===59&&c){const b=e.exit("characterReferenceValue");return d===Dn&&!gh(i.sliceSerialize(b))?r(y):(e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),e.exit("characterReference"),l)}return d(y)&&c++<u?(e.consume(y),g):r(y)}}const L1={partial:!0,tokenize:mw},H1={concrete:!0,name:"codeFenced",tokenize:hw};function hw(e,l,r){const i=this,c={partial:!0,tokenize:I};let u=0,d=0,m;return x;function x(_){return f(_)}function f(_){const q=i.events[i.events.length-1];return u=q&&q[1].type==="linePrefix"?q[2].sliceSerialize(q[1],!0).length:0,m=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(_)}function g(_){return _===m?(d++,e.consume(_),g):d<3?r(_):(e.exit("codeFencedFenceSequence"),ht(_)?wt(e,y,"whitespace")(_):y(_))}function y(_){return _===null||Ve(_)?(e.exit("codeFencedFence"),i.interrupt?l(_):e.check(L1,j,O)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(_))}function b(_){return _===null||Ve(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),y(_)):ht(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),wt(e,v,"whitespace")(_)):_===96&&_===m?r(_):(e.consume(_),b)}function v(_){return _===null||Ve(_)?y(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(_))}function S(_){return _===null||Ve(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),y(_)):_===96&&_===m?r(_):(e.consume(_),S)}function j(_){return e.attempt(c,O,C)(_)}function C(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),E}function E(_){return u>0&&ht(_)?wt(e,N,"linePrefix",u+1)(_):N(_)}function N(_){return _===null||Ve(_)?e.check(L1,j,O)(_):(e.enter("codeFlowValue"),z(_))}function z(_){return _===null||Ve(_)?(e.exit("codeFlowValue"),N(_)):(e.consume(_),z)}function O(_){return e.exit("codeFenced"),l(_)}function I(_,q,W){let Y=0;return T;function T(V){return _.enter("lineEnding"),_.consume(V),_.exit("lineEnding"),$}function $(V){return _.enter("codeFencedFence"),ht(V)?wt(_,B,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):B(V)}function B(V){return V===m?(_.enter("codeFencedFenceSequence"),G(V)):W(V)}function G(V){return V===m?(Y++,_.consume(V),G):Y>=d?(_.exit("codeFencedFenceSequence"),ht(V)?wt(_,ne,"whitespace")(V):ne(V)):W(V)}function ne(V){return V===null||Ve(V)?(_.exit("codeFencedFence"),q(V)):W(V)}}}function mw(e,l,r){const i=this;return c;function c(d){return d===null?r(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u)}function u(d){return i.parser.lazy[i.now().line]?r(d):l(d)}}const of={name:"codeIndented",tokenize:pw},xw={partial:!0,tokenize:yw};function pw(e,l,r){const i=this;return c;function c(f){return e.enter("codeIndented"),wt(e,u,"linePrefix",5)(f)}function u(f){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?d(f):r(f)}function d(f){return f===null?x(f):Ve(f)?e.attempt(xw,d,x)(f):(e.enter("codeFlowValue"),m(f))}function m(f){return f===null||Ve(f)?(e.exit("codeFlowValue"),d(f)):(e.consume(f),m)}function x(f){return e.exit("codeIndented"),l(f)}}function yw(e,l,r){const i=this;return c;function c(d){return i.parser.lazy[i.now().line]?r(d):Ve(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):wt(e,u,"linePrefix",5)(d)}function u(d){const m=i.events[i.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(d):Ve(d)?c(d):r(d)}}const gw={name:"codeText",previous:vw,resolve:bw,tokenize:ww};function bw(e){let l=e.length-4,r=3,i,c;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[l][1].type==="lineEnding"||e[l][1].type==="space")){for(i=r;++i<l;)if(e[i][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[l][1].type="codeTextPadding",r+=2,l-=2;break}}for(i=r-1,l++;++i<=l;)c===void 0?i!==l&&e[i][1].type!=="lineEnding"&&(c=i):(i===l||e[i][1].type==="lineEnding")&&(e[c][1].type="codeTextData",i!==c+2&&(e[c][1].end=e[i-1][1].end,e.splice(c+2,i-c-2),l-=i-c-2,i=c+2),c=void 0);return e}function vw(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function ww(e,l,r){let i=0,c,u;return d;function d(y){return e.enter("codeText"),e.enter("codeTextSequence"),m(y)}function m(y){return y===96?(e.consume(y),i++,m):(e.exit("codeTextSequence"),x(y))}function x(y){return y===null?r(y):y===32?(e.enter("space"),e.consume(y),e.exit("space"),x):y===96?(u=e.enter("codeTextSequence"),c=0,g(y)):Ve(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),x):(e.enter("codeTextData"),f(y))}function f(y){return y===null||y===32||y===96||Ve(y)?(e.exit("codeTextData"),x(y)):(e.consume(y),f)}function g(y){return y===96?(e.consume(y),c++,g):c===i?(e.exit("codeTextSequence"),e.exit("codeText"),l(y)):(u.type="codeTextData",f(y))}}class kw{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&&Ms(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),Ms(this.left,l)}unshift(l){this.setCursor(0),this.right.push(l)}unshiftMany(l){this.setCursor(0),Ms(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);Ms(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-l,Number.POSITIVE_INFINITY);Ms(this.left,r.reverse())}}}function Ms(e,l){let r=0;if(l.length<1e4)e.push(...l);else for(;r<l.length;)e.push(...l.slice(r,r+1e4)),r+=1e4}function by(e){const l={};let r=-1,i,c,u,d,m,x,f;const g=new kw(e);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,jw(g,r)),r=l[r],f=!0);else if(i[1]._container){for(u=r,c=void 0;u--;)if(d=g.get(u),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(c&&(g.get(c)[1].type="lineEndingBlank"),d[1].type="lineEnding",c=u);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;c&&(i[1].end={...g.get(c)[1].start},m=g.slice(c,r),m.unshift(i),g.splice(c,r-c+1,m))}}return ol(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!f}function jw(e,l){const r=e.get(l)[1],i=e.get(l)[2];let c=l-1;const u=[];let d=r._tokenizer;d||(d=i.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const m=d.events,x=[],f={};let g,y,b=-1,v=r,S=0,j=0;const C=[j];for(;v;){for(;e.get(++c)[1]!==v;);u.push(c),v._tokenizer||(g=i.sliceStream(v),v.next||g.push(null),y&&d.defineSkip(v.start),v._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(g),v._isInFirstContentOfListItem&&(d._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&&(j=b+1,C.push(j),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(d.events=[],v?(v._tokenizer=void 0,v.previous=void 0):C.pop(),b=C.length;b--;){const E=m.slice(C[b],C[b+1]),N=u.pop();x.push([N,N+E.length-1]),e.splice(N,2,E)}for(x.reverse(),b=-1;++b<x.length;)f[S+x[b][0]]=S+x[b][1],S+=x[b][1]-x[b][0]-1;return f}const Sw={resolve:Ew,tokenize:Nw},Cw={partial:!0,tokenize:Aw};function Ew(e){return by(e),e}function Nw(e,l){let r;return i;function i(m){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),c(m)}function c(m){return m===null?u(m):Ve(m)?e.check(Cw,d,u)(m):(e.consume(m),c)}function u(m){return e.exit("chunkContent"),e.exit("content"),l(m)}function d(m){return e.consume(m),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,c}}function Aw(e,l,r){const i=this;return c;function c(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),wt(e,u,"linePrefix")}function u(d){if(d===null||Ve(d))return r(d);const m=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(d):e.interrupt(i.parser.constructs.flow,r,l)(d)}}function vy(e,l,r,i,c,u,d,m,x){const f=x||Number.POSITIVE_INFINITY;let g=0;return y;function y(E){return E===60?(e.enter(i),e.enter(c),e.enter(u),e.consume(E),e.exit(u),b):E===null||E===32||E===41||_c(E)?r(E):(e.enter(i),e.enter(d),e.enter(m),e.enter("chunkString",{contentType:"string"}),j(E))}function b(E){return E===62?(e.enter(u),e.consume(E),e.exit(u),e.exit(c),e.exit(i),l):(e.enter(m),e.enter("chunkString",{contentType:"string"}),v(E))}function v(E){return E===62?(e.exit("chunkString"),e.exit(m),b(E)):E===null||E===60||Ve(E)?r(E):(e.consume(E),E===92?S:v)}function S(E){return E===60||E===62||E===92?(e.consume(E),v):v(E)}function j(E){return!g&&(E===null||E===41||Lt(E))?(e.exit("chunkString"),e.exit(m),e.exit(d),e.exit(i),l(E)):g<f&&E===40?(e.consume(E),g++,j):E===41?(e.consume(E),g--,j):E===null||E===32||E===40||_c(E)?r(E):(e.consume(E),E===92?C:j)}function C(E){return E===40||E===41||E===92?(e.consume(E),j):j(E)}}function wy(e,l,r,i,c,u){const d=this;let m=0,x;return f;function f(v){return e.enter(i),e.enter(c),e.consume(v),e.exit(c),e.enter(u),g}function g(v){return m>999||v===null||v===91||v===93&&!x||v===94&&!m&&"_hiddenFootnoteSupport"in d.parser.constructs?r(v):v===93?(e.exit(u),e.enter(c),e.consume(v),e.exit(c),e.exit(i),l):Ve(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),y(v))}function y(v){return v===null||v===91||v===93||Ve(v)||m++>999?(e.exit("chunkString"),g(v)):(e.consume(v),x||(x=!ht(v)),v===92?b:y)}function b(v){return v===91||v===92||v===93?(e.consume(v),m++,y):y(v)}}function ky(e,l,r,i,c,u){let d;return m;function m(b){return b===34||b===39||b===40?(e.enter(i),e.enter(c),e.consume(b),e.exit(c),d=b===40?41:b,x):r(b)}function x(b){return b===d?(e.enter(c),e.consume(b),e.exit(c),e.exit(i),l):(e.enter(u),f(b))}function f(b){return b===d?(e.exit(u),x(d)):b===null?r(b):Ve(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),wt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===d||b===null||Ve(b)?(e.exit("chunkString"),f(b)):(e.consume(b),b===92?y:g)}function y(b){return b===d||b===92?(e.consume(b),g):g(b)}}function Ys(e,l){let r;return i;function i(c){return Ve(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),r=!0,i):ht(c)?wt(e,i,r?"linePrefix":"lineSuffix")(c):l(c)}}const Dw={name:"definition",tokenize:zw},Tw={partial:!0,tokenize:Mw};function zw(e,l,r){const i=this;let c;return u;function u(v){return e.enter("definition"),d(v)}function d(v){return wy.call(i,e,m,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function m(v){return c=zl(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),x):r(v)}function x(v){return Lt(v)?Ys(e,f)(v):f(v)}function f(v){return vy(e,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function g(v){return e.attempt(Tw,y,y)(v)}function y(v){return ht(v)?wt(e,b,"whitespace")(v):b(v)}function b(v){return v===null||Ve(v)?(e.exit("definition"),i.parser.defined.push(c),l(v)):r(v)}}function Mw(e,l,r){return i;function i(m){return Lt(m)?Ys(e,c)(m):r(m)}function c(m){return ky(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(m)}function u(m){return ht(m)?wt(e,d,"whitespace")(m):d(m)}function d(m){return m===null||Ve(m)?l(m):r(m)}}const Rw={name:"hardBreakEscape",tokenize:Fw};function Fw(e,l,r){return i;function i(u){return e.enter("hardBreakEscape"),e.consume(u),c}function c(u){return Ve(u)?(e.exit("hardBreakEscape"),l(u)):r(u)}}const _w={name:"headingAtx",resolve:Ow,tokenize:Bw};function Ow(e,l){let r=e.length-2,i=3,c,u;return e[i][1].type==="whitespace"&&(i+=2),r-2>i&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(i===r-1||r-4>i&&e[r-2][1].type==="whitespace")&&(r-=i+1===r?2:4),r>i&&(c={type:"atxHeadingText",start:e[i][1].start,end:e[r][1].end},u={type:"chunkText",start:e[i][1].start,end:e[r][1].end,contentType:"text"},ol(e,i,r-i+1,[["enter",c,l],["enter",u,l],["exit",u,l],["exit",c,l]])),e}function Bw(e,l,r){let i=0;return c;function c(g){return e.enter("atxHeading"),u(g)}function u(g){return e.enter("atxHeadingSequence"),d(g)}function d(g){return g===35&&i++<6?(e.consume(g),d):g===null||Lt(g)?(e.exit("atxHeadingSequence"),m(g)):r(g)}function m(g){return g===35?(e.enter("atxHeadingSequence"),x(g)):g===null||Ve(g)?(e.exit("atxHeading"),l(g)):ht(g)?wt(e,m,"whitespace")(g):(e.enter("atxHeadingText"),f(g))}function x(g){return g===35?(e.consume(g),x):(e.exit("atxHeadingSequence"),m(g))}function f(g){return g===null||g===35||Lt(g)?(e.exit("atxHeadingText"),m(g)):(e.consume(g),f)}}const $w=["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"],I1=["pre","script","style","textarea"],Lw={concrete:!0,name:"htmlFlow",resolveTo:Uw,tokenize:Yw},Hw={partial:!0,tokenize:Xw},Iw={partial:!0,tokenize:qw};function Uw(e){let l=e.length;for(;l--&&!(e[l][0]==="enter"&&e[l][1].type==="htmlFlow"););return l>1&&e[l-2][1].type==="linePrefix"&&(e[l][1].start=e[l-2][1].start,e[l+1][1].start=e[l-2][1].start,e.splice(l-2,2)),e}function Yw(e,l,r){const i=this;let c,u,d,m,x;return f;function f(D){return g(D)}function g(D){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(D),y}function y(D){return D===33?(e.consume(D),b):D===47?(e.consume(D),u=!0,j):D===63?(e.consume(D),c=3,i.interrupt?l:R):_n(D)?(e.consume(D),d=String.fromCharCode(D),C):r(D)}function b(D){return D===45?(e.consume(D),c=2,v):D===91?(e.consume(D),c=5,m=0,S):_n(D)?(e.consume(D),c=4,i.interrupt?l:R):r(D)}function v(D){return D===45?(e.consume(D),i.interrupt?l:R):r(D)}function S(D){const de="CDATA[";return D===de.charCodeAt(m++)?(e.consume(D),m===de.length?i.interrupt?l:B:S):r(D)}function j(D){return _n(D)?(e.consume(D),d=String.fromCharCode(D),C):r(D)}function C(D){if(D===null||D===47||D===62||Lt(D)){const de=D===47,Se=d.toLowerCase();return!de&&!u&&I1.includes(Se)?(c=1,i.interrupt?l(D):B(D)):$w.includes(d.toLowerCase())?(c=6,de?(e.consume(D),E):i.interrupt?l(D):B(D)):(c=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(D):u?N(D):z(D))}return D===45||Dn(D)?(e.consume(D),d+=String.fromCharCode(D),C):r(D)}function E(D){return D===62?(e.consume(D),i.interrupt?l:B):r(D)}function N(D){return ht(D)?(e.consume(D),N):T(D)}function z(D){return D===47?(e.consume(D),T):D===58||D===95||_n(D)?(e.consume(D),O):ht(D)?(e.consume(D),z):T(D)}function O(D){return D===45||D===46||D===58||D===95||Dn(D)?(e.consume(D),O):I(D)}function I(D){return D===61?(e.consume(D),_):ht(D)?(e.consume(D),I):z(D)}function _(D){return D===null||D===60||D===61||D===62||D===96?r(D):D===34||D===39?(e.consume(D),x=D,q):ht(D)?(e.consume(D),_):W(D)}function q(D){return D===x?(e.consume(D),x=null,Y):D===null||Ve(D)?r(D):(e.consume(D),q)}function W(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||Lt(D)?I(D):(e.consume(D),W)}function Y(D){return D===47||D===62||ht(D)?z(D):r(D)}function T(D){return D===62?(e.consume(D),$):r(D)}function $(D){return D===null||Ve(D)?B(D):ht(D)?(e.consume(D),$):r(D)}function B(D){return D===45&&c===2?(e.consume(D),U):D===60&&c===1?(e.consume(D),J):D===62&&c===4?(e.consume(D),M):D===63&&c===3?(e.consume(D),R):D===93&&c===5?(e.consume(D),je):Ve(D)&&(c===6||c===7)?(e.exit("htmlFlowData"),e.check(Hw,K,G)(D)):D===null||Ve(D)?(e.exit("htmlFlowData"),G(D)):(e.consume(D),B)}function G(D){return e.check(Iw,ne,K)(D)}function ne(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),V}function V(D){return D===null||Ve(D)?G(D):(e.enter("htmlFlowData"),B(D))}function U(D){return D===45?(e.consume(D),R):B(D)}function J(D){return D===47?(e.consume(D),d="",ie):B(D)}function ie(D){if(D===62){const de=d.toLowerCase();return I1.includes(de)?(e.consume(D),M):B(D)}return _n(D)&&d.length<8?(e.consume(D),d+=String.fromCharCode(D),ie):B(D)}function je(D){return D===93?(e.consume(D),R):B(D)}function R(D){return D===62?(e.consume(D),M):D===45&&c===2?(e.consume(D),R):B(D)}function M(D){return D===null||Ve(D)?(e.exit("htmlFlowData"),K(D)):(e.consume(D),M)}function K(D){return e.exit("htmlFlow"),l(D)}}function qw(e,l,r){const i=this;return c;function c(d){return Ve(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):r(d)}function u(d){return i.parser.lazy[i.now().line]?r(d):l(d)}}function Xw(e,l,r){return i;function i(c){return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),e.attempt(eo,l,r)}}const Vw={name:"htmlText",tokenize:Gw};function Gw(e,l,r){const i=this;let c,u,d;return m;function m(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),x}function x(R){return R===33?(e.consume(R),f):R===47?(e.consume(R),I):R===63?(e.consume(R),z):_n(R)?(e.consume(R),W):r(R)}function f(R){return R===45?(e.consume(R),g):R===91?(e.consume(R),u=0,S):_n(R)?(e.consume(R),N):r(R)}function g(R){return R===45?(e.consume(R),v):r(R)}function y(R){return R===null?r(R):R===45?(e.consume(R),b):Ve(R)?(d=y,J(R)):(e.consume(R),y)}function b(R){return R===45?(e.consume(R),v):y(R)}function v(R){return R===62?U(R):R===45?b(R):y(R)}function S(R){const M="CDATA[";return R===M.charCodeAt(u++)?(e.consume(R),u===M.length?j:S):r(R)}function j(R){return R===null?r(R):R===93?(e.consume(R),C):Ve(R)?(d=j,J(R)):(e.consume(R),j)}function C(R){return R===93?(e.consume(R),E):j(R)}function E(R){return R===62?U(R):R===93?(e.consume(R),E):j(R)}function N(R){return R===null||R===62?U(R):Ve(R)?(d=N,J(R)):(e.consume(R),N)}function z(R){return R===null?r(R):R===63?(e.consume(R),O):Ve(R)?(d=z,J(R)):(e.consume(R),z)}function O(R){return R===62?U(R):z(R)}function I(R){return _n(R)?(e.consume(R),_):r(R)}function _(R){return R===45||Dn(R)?(e.consume(R),_):q(R)}function q(R){return Ve(R)?(d=q,J(R)):ht(R)?(e.consume(R),q):U(R)}function W(R){return R===45||Dn(R)?(e.consume(R),W):R===47||R===62||Lt(R)?Y(R):r(R)}function Y(R){return R===47?(e.consume(R),U):R===58||R===95||_n(R)?(e.consume(R),T):Ve(R)?(d=Y,J(R)):ht(R)?(e.consume(R),Y):U(R)}function T(R){return R===45||R===46||R===58||R===95||Dn(R)?(e.consume(R),T):$(R)}function $(R){return R===61?(e.consume(R),B):Ve(R)?(d=$,J(R)):ht(R)?(e.consume(R),$):Y(R)}function B(R){return R===null||R===60||R===61||R===62||R===96?r(R):R===34||R===39?(e.consume(R),c=R,G):Ve(R)?(d=B,J(R)):ht(R)?(e.consume(R),B):(e.consume(R),ne)}function G(R){return R===c?(e.consume(R),c=void 0,V):R===null?r(R):Ve(R)?(d=G,J(R)):(e.consume(R),G)}function ne(R){return R===null||R===34||R===39||R===60||R===61||R===96?r(R):R===47||R===62||Lt(R)?Y(R):(e.consume(R),ne)}function V(R){return R===47||R===62||Lt(R)?Y(R):r(R)}function U(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),l):r(R)}function J(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),ie}function ie(R){return ht(R)?wt(e,je,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):je(R)}function je(R){return e.enter("htmlTextData"),d(R)}}const bh={name:"labelEnd",resolveAll:Zw,resolveTo:Jw,tokenize:Pw},Kw={tokenize:e5},Ww={tokenize:t5},Qw={tokenize:n5};function Zw(e){let l=-1;const r=[];for(;++l<e.length;){const i=e[l][1];if(r.push(e[l]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const c=i.type==="labelImage"?4:2;i.type="data",l+=c}}return e.length!==r.length&&ol(e,0,e.length,r),e}function Jw(e,l){let r=e.length,i=0,c,u,d,m;for(;r--;)if(c=e[r][1],u){if(c.type==="link"||c.type==="labelLink"&&c._inactive)break;e[r][0]==="enter"&&c.type==="labelLink"&&(c._inactive=!0)}else if(d){if(e[r][0]==="enter"&&(c.type==="labelImage"||c.type==="labelLink")&&!c._balanced&&(u=r,c.type!=="labelLink")){i=2;break}}else c.type==="labelEnd"&&(d=r);const x={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[u][1].start},end:{...e[d][1].end}},g={type:"labelText",start:{...e[u+i+2][1].end},end:{...e[d-2][1].start}};return m=[["enter",x,l],["enter",f,l]],m=gl(m,e.slice(u+1,u+i+3)),m=gl(m,[["enter",g,l]]),m=gl(m,Vc(l.parser.constructs.insideSpan.null,e.slice(u+i+4,d-3),l)),m=gl(m,[["exit",g,l],e[d-2],e[d-1],["exit",f,l]]),m=gl(m,e.slice(d+1)),m=gl(m,[["exit",x,l]]),ol(e,u,e.length,m),e}function Pw(e,l,r){const i=this;let c=i.events.length,u,d;for(;c--;)if((i.events[c][1].type==="labelImage"||i.events[c][1].type==="labelLink")&&!i.events[c][1]._balanced){u=i.events[c][1];break}return m;function m(b){return u?u._inactive?y(b):(d=i.parser.defined.includes(zl(i.sliceSerialize({start:u.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),x):r(b)}function x(b){return b===40?e.attempt(Kw,g,d?g:y)(b):b===91?e.attempt(Ww,g,d?f:y)(b):d?g(b):y(b)}function f(b){return e.attempt(Qw,g,y)(b)}function g(b){return l(b)}function y(b){return u._balanced=!0,r(b)}}function e5(e,l,r){return i;function i(y){return e.enter("resource"),e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),c}function c(y){return Lt(y)?Ys(e,u)(y):u(y)}function u(y){return y===41?g(y):vy(e,d,m,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function d(y){return Lt(y)?Ys(e,x)(y):g(y)}function m(y){return r(y)}function x(y){return y===34||y===39||y===40?ky(e,f,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function f(y){return Lt(y)?Ys(e,g)(y):g(y)}function g(y){return y===41?(e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),e.exit("resource"),l):r(y)}}function t5(e,l,r){const i=this;return c;function c(m){return wy.call(i,e,u,d,"reference","referenceMarker","referenceString")(m)}function u(m){return i.parser.defined.includes(zl(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?l(m):r(m)}function d(m){return r(m)}}function n5(e,l,r){return i;function i(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),c}function c(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),l):r(u)}}const l5={name:"labelStartImage",resolveAll:bh.resolveAll,tokenize:r5};function r5(e,l,r){const i=this;return c;function c(m){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(m),e.exit("labelImageMarker"),u}function u(m){return m===91?(e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelImage"),d):r(m)}function d(m){return m===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(m):l(m)}}const a5={name:"labelStartLink",resolveAll:bh.resolveAll,tokenize:i5};function i5(e,l,r){const i=this;return c;function c(d){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelLink"),u}function u(d){return d===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(d):l(d)}}const cf={name:"lineEnding",tokenize:s5};function s5(e,l){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),wt(e,l,"linePrefix")}}const Dc={name:"thematicBreak",tokenize:o5};function o5(e,l,r){let i=0,c;return u;function u(f){return e.enter("thematicBreak"),d(f)}function d(f){return c=f,m(f)}function m(f){return f===c?(e.enter("thematicBreakSequence"),x(f)):i>=3&&(f===null||Ve(f))?(e.exit("thematicBreak"),l(f)):r(f)}function x(f){return f===c?(e.consume(f),i++,x):(e.exit("thematicBreakSequence"),ht(f)?wt(e,m,"whitespace")(f):m(f))}}const Xn={continuation:{tokenize:f5},exit:m5,name:"list",tokenize:d5},c5={partial:!0,tokenize:x5},u5={partial:!0,tokenize:h5};function d5(e,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,d=0;return m;function m(v){const S=i.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!i.containerState.marker||v===i.containerState.marker:Kf(v)){if(i.containerState.type||(i.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Dc,r,f)(v):f(v);if(!i.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),x(v)}return r(v)}function x(v){return Kf(v)&&++d<10?(e.consume(v),x):(!i.interrupt||d<2)&&(i.containerState.marker?v===i.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),f(v)):r(v)}function f(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||v,e.check(eo,i.interrupt?r:g,e.attempt(c5,b,y))}function g(v){return i.containerState.initialBlankLine=!0,u++,b(v)}function y(v){return ht(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),b):r(v)}function b(v){return i.containerState.size=u+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,l(v)}}function f5(e,l,r){const i=this;return i.containerState._closeFlow=void 0,e.check(eo,c,u);function c(m){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,wt(e,l,"listItemIndent",i.containerState.size+1)(m)}function u(m){return i.containerState.furtherBlankLines||!ht(m)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,d(m)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(u5,l,d)(m))}function d(m){return i.containerState._closeFlow=!0,i.interrupt=void 0,wt(e,e.attempt(Xn,l,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m)}}function h5(e,l,r){const i=this;return wt(e,c,"listItemIndent",i.containerState.size+1);function c(u){const d=i.events[i.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===i.containerState.size?l(u):r(u)}}function m5(e){e.exit(this.containerState.type)}function x5(e,l,r){const i=this;return wt(e,c,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(u){const d=i.events[i.events.length-1];return!ht(u)&&d&&d[1].type==="listItemPrefixWhitespace"?l(u):r(u)}}const U1={name:"setextUnderline",resolveTo:p5,tokenize:y5};function p5(e,l){let r=e.length,i,c,u;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){i=r;break}e[r][1].type==="paragraph"&&(c=r)}else e[r][1].type==="content"&&e.splice(r,1),!u&&e[r][1].type==="definition"&&(u=r);const d={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[c][1].type="setextHeadingText",u?(e.splice(c,0,["enter",d,l]),e.splice(u+1,0,["exit",e[i][1],l]),e[i][1].end={...e[u][1].end}):e[i][1]=d,e.push(["exit",d,l]),e}function y5(e,l,r){const i=this;let c;return u;function u(f){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)?(e.enter("setextHeadingLine"),c=f,d(f)):r(f)}function d(f){return e.enter("setextHeadingLineSequence"),m(f)}function m(f){return f===c?(e.consume(f),m):(e.exit("setextHeadingLineSequence"),ht(f)?wt(e,x,"lineSuffix")(f):x(f))}function x(f){return f===null||Ve(f)?(e.exit("setextHeadingLine"),l(f)):r(f)}}const g5={tokenize:b5};function b5(e){const l=this,r=e.attempt(eo,i,e.attempt(this.parser.constructs.flowInitial,c,wt(e,e.attempt(this.parser.constructs.flow,c,e.attempt(Sw,c)),"linePrefix")));return r;function i(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),l.currentConstruct=void 0,r}function c(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l.currentConstruct=void 0,r}}const v5={resolveAll:Sy()},w5=jy("string"),k5=jy("text");function jy(e){return{resolveAll:Sy(e==="text"?j5:void 0),tokenize:l};function l(r){const i=this,c=this.parser.constructs[e],u=r.attempt(c,d,m);return d;function d(g){return f(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 f(g)?(r.exit("data"),u(g)):(r.consume(g),x)}function f(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 Sy(e){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 e?e(r,i):r}}function j5(e,l){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const i=e[r-1][1],c=l.sliceStream(i);let u=c.length,d=-1,m=0,x;for(;u--;){const f=c[u];if(typeof f=="string"){for(d=f.length;f.charCodeAt(d-1)===32;)m++,d--;if(d)break;d=-1}else if(f===-2)x=!0,m++;else if(f!==-1){u++;break}}if(l._contentTypeTextTrailing&&r===e.length&&(m=0),m){const f={type:r===e.length||x||m<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?d:i.start._bufferIndex+d,_index:i.start._index+u,line:i.end.line,column:i.end.column-m,offset:i.end.offset-m},end:{...i.end}};i.end={...f.start},i.start.offset===i.end.offset?Object.assign(i,f):(e.splice(r,0,["enter",f,l],["exit",f,l]),r+=2)}r++}return e}const S5={42:Xn,43:Xn,45:Xn,48:Xn,49:Xn,50:Xn,51:Xn,52:Xn,53:Xn,54:Xn,55:Xn,56:Xn,57:Xn,62:py},C5={91:Dw},E5={[-2]:of,[-1]:of,32:of},N5={35:_w,42:Dc,45:[U1,Dc],60:Lw,61:U1,95:Dc,96:H1,126:H1},A5={38:gy,92:yy},D5={[-5]:cf,[-4]:cf,[-3]:cf,33:l5,38:gy,42:Wf,60:[aw,Vw],91:a5,92:[Rw,yy],93:bh,95:Wf,96:gw},T5={null:[Wf,v5]},z5={null:[42,95]},M5={null:[]},R5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:z5,contentInitial:C5,disable:M5,document:S5,flow:N5,flowInitial:E5,insideSpan:T5,string:A5,text:D5},Symbol.toStringTag,{value:"Module"}));function F5(e,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 d=[],m=[];const x={attempt:q(I),check:q(_),consume:N,enter:z,exit:O,interrupt:q(_,{interrupt:!0})},f={code:null,containerState:{},defineSkip:j,events:[],now:S,parser:e,previous:null,sliceSerialize:b,sliceStream:v,write:y};let g=l.tokenize.call(f,x);return l.resolveAll&&u.push(l),f;function y($){return d=gl(d,$),C(),d[d.length-1]!==null?[]:(W(l,0),f.events=Vc(u,f.events,f),f.events)}function b($,B){return O5(v($),B)}function v($){return _5(d,$)}function S(){const{_bufferIndex:$,_index:B,line:G,column:ne,offset:V}=i;return{_bufferIndex:$,_index:B,line:G,column:ne,offset:V}}function j($){c[$.line]=$.column,T()}function C(){let $;for(;i._index<d.length;){const B=d[i._index];if(typeof B=="string")for($=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===$&&i._bufferIndex<B.length;)E(B.charCodeAt(i._bufferIndex));else E(B)}}function E($){g=g($)}function N($){Ve($)?(i.line++,i.column=1,i.offset+=$===-3?2:1,T()):$!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===d[i._index].length&&(i._bufferIndex=-1,i._index++)),f.previous=$}function z($,B){const G=B||{};return G.type=$,G.start=S(),f.events.push(["enter",G,f]),m.push(G),G}function O($){const B=m.pop();return B.end=S(),f.events.push(["exit",B,f]),B}function I($,B){W($,B.from)}function _($,B){B.restore()}function q($,B){return G;function G(ne,V,U){let J,ie,je,R;return Array.isArray(ne)?K(ne):"tokenize"in ne?K([ne]):M(ne);function M(ve){return Fe;function Fe(Me){const $e=Me!==null&&ve[Me],fe=Me!==null&&ve.null,tt=[...Array.isArray($e)?$e:$e?[$e]:[],...Array.isArray(fe)?fe:fe?[fe]:[]];return K(tt)(Me)}}function K(ve){return J=ve,ie=0,ve.length===0?U:D(ve[ie])}function D(ve){return Fe;function Fe(Me){return R=Y(),je=ve,ve.partial||(f.currentConstruct=ve),ve.name&&f.parser.constructs.disable.null.includes(ve.name)?Se():ve.tokenize.call(B?Object.assign(Object.create(f),B):f,x,de,Se)(Me)}}function de(ve){return $(je,R),V}function Se(ve){return R.restore(),++ie<J.length?D(J[ie]):U}}}function W($,B){$.resolveAll&&!u.includes($)&&u.push($),$.resolve&&ol(f.events,B,f.events.length-B,$.resolve(f.events.slice(B),f)),$.resolveTo&&(f.events=$.resolveTo(f.events,f))}function Y(){const $=S(),B=f.previous,G=f.currentConstruct,ne=f.events.length,V=Array.from(m);return{from:ne,restore:U};function U(){i=$,f.previous=B,f.currentConstruct=G,f.events.length=ne,m=V,T()}}function T(){i.line in c&&i.column<2&&(i.column=c[i.line],i.offset+=c[i.line]-1)}}function _5(e,l){const r=l.start._index,i=l.start._bufferIndex,c=l.end._index,u=l.end._bufferIndex;let d;if(r===c)d=[e[r].slice(i,u)];else{if(d=e.slice(r,c),i>-1){const m=d[0];typeof m=="string"?d[0]=m.slice(i):d.shift()}u>0&&d.push(e[c].slice(0,u))}return d}function O5(e,l){let r=-1;const i=[];let c;for(;++r<e.length;){const u=e[r];let d;if(typeof u=="string")d=u;else switch(u){case-5:{d="\r";break}case-4:{d=`
|
|
52
52
|
`;break}case-3:{d=`\r
|
|
53
|
-
`;break}case-2:{d=l?" ":" ";break}case-1:{if(!l&&c)continue;d=" ";break}default:d=String.fromCharCode(u)}c=u===-2,i.push(d)}return i.join("")}function B5(e){const i={constructs:my([R5,...(e||{}).extensions||[]]),content:c(Jv),defined:[],document:c(ew),flow:c(g5),lazy:{},string:c(w5),text:c(k5)};return i;function c(u){return d;function d(m){return F5(i,u,m)}}}function $5(e){for(;!by(e););return e}const Y1=/[\0\t\n\r]/g;function L5(){let e=1,l="",r=!0,i;return c;function c(u,d,m){const x=[];let f,g,y,b,v;for(u=l+(typeof u=="string"?u.toString():new TextDecoder(d||void 0).decode(u)),y=0,l="",r&&(u.charCodeAt(0)===65279&&y++,r=void 0);y<u.length;){if(Y1.lastIndex=y,f=Y1.exec(u),b=f&&f.index!==void 0?f.index:u.length,v=u.charCodeAt(b),!f){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)),e+=b-y),v){case 0:{x.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,x.push(-2);e++<g;)x.push(-1);break}case 10:{x.push(-4),e=1;break}default:i=!0,e=1}y=b+1}return m&&(i&&x.push(-5),l&&x.push(l),x.push(null)),x}}const H5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function I5(e){return e.replace(H5,U5)}function U5(e,l,r){if(l)return l;if(r.charCodeAt(0)===35){const c=r.charCodeAt(1),u=c===120||c===88;return xy(r.slice(u?2:1),u?16:10)}return gh(r)||e}const Cy={}.hasOwnProperty;function Y5(e,l,r){return l&&typeof l=="object"&&(r=l,l=void 0),q5(r)($5(B5(r).document().write(L5()(e,l,!0))))}function q5(e){const l={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Te),autolinkProtocol:Y,autolinkEmail:Y,atxHeading:u(ge),blockQuote:u(fe),characterEscape:Y,characterReference:Y,codeFenced:u(tt),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:u(tt,d),codeText:u(mt,d),codeTextData:Y,data:Y,codeFlowValue:Y,definition:u(he),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:u(ye),hardBreakEscape:u(Le),hardBreakTrailing:u(Le),htmlFlow:u(Ee,d),htmlFlowData:Y,htmlText:u(Ee,d),htmlTextData:Y,image:u(ze),label:d,link:u(Te),listItem:u(Ie),listItemValue:b,listOrdered:u(Ne,y),listUnordered:u(Ne),paragraph:u(Ge),reference:D,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:u(ge),strong:u(Dt),thematicBreak:u(Ot)},exit:{atxHeading:x(),atxHeadingSequence:I,autolink:x(),autolinkEmail:$e,autolinkProtocol:Me,blockQuote:x(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:Se,characterReferenceMarkerNumeric:Se,characterReferenceValue:ve,characterReference:Fe,codeFenced:x(C),codeFencedFence:j,codeFencedFenceInfo:v,codeFencedFenceMeta:S,codeFlowValue:T,codeIndented:x(E),codeText:x(V),codeTextData:T,data:T,definition:x(),definitionDestinationString:O,definitionLabelString:N,definitionTitleString:z,emphasis:x(),hardBreakEscape:x(B),hardBreakTrailing:x(B),htmlFlow:x(G),htmlFlowData:T,htmlText:x(ne),htmlTextData:T,image:x(Z),label:je,labelText:ie,lineEnding:$,link:x(U),listItem:x(),listOrdered:x(),listUnordered:x(),paragraph:x(),referenceString:de,resourceDestinationString:R,resourceTitleString:M,resource:K,setextHeading:x(W),setextHeadingLineSequence:q,setextHeadingText:_,strong:x(),thematicBreak:x()}};Ey(l,(e||{}).mdastExtensions||[]);const r={};return i;function i(se){let be={type:"root",children:[]};const Re={stack:[be],tokenStack:[],config:l,enter:m,exit:f,buffer:d,resume:g,data:r},_e=[];let xe=-1;for(;++xe<se.length;)if(se[xe][1].type==="listOrdered"||se[xe][1].type==="listUnordered")if(se[xe][0]==="enter")_e.push(xe);else{const De=_e.pop();xe=c(se,De,xe)}for(xe=-1;++xe<se.length;){const De=l[se[xe][0]];Cy.call(De,se[xe][1].type)&&De[se[xe][1].type].call(Object.assign({sliceSerialize:se[xe][2].sliceSerialize},Re),se[xe][1])}if(Re.tokenStack.length>0){const De=Re.tokenStack[Re.tokenStack.length-1];(De[1]||q1).call(Re,void 0,De[0])}for(be.position={start:ta(se.length>0?se[0][1].start:{line:1,column:1,offset:0}),end:ta(se.length>0?se[se.length-2][1].end:{line:1,column:1,offset:0})},xe=-1;++xe<l.transforms.length;)be=l.transforms[xe](be)||be;return be}function c(se,be,Re){let _e=be-1,xe=-1,De=!1,vt,Pe,nt,At;for(;++_e<=Re;){const ut=se[_e];switch(ut[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ut[0]==="enter"?xe++:xe--,At=void 0;break}case"lineEndingBlank":{ut[0]==="enter"&&(vt&&!At&&!xe&&!nt&&(nt=_e),At=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:At=void 0}if(!xe&&ut[0]==="enter"&&ut[1].type==="listItemPrefix"||xe===-1&&ut[0]==="exit"&&(ut[1].type==="listUnordered"||ut[1].type==="listOrdered")){if(vt){let tn=_e;for(Pe=void 0;tn--;){const yn=se[tn];if(yn[1].type==="lineEnding"||yn[1].type==="lineEndingBlank"){if(yn[0]==="exit")continue;Pe&&(se[Pe][1].type="lineEndingBlank",De=!0),yn[1].type="lineEnding",Pe=tn}else if(!(yn[1].type==="linePrefix"||yn[1].type==="blockQuotePrefix"||yn[1].type==="blockQuotePrefixWhitespace"||yn[1].type==="blockQuoteMarker"||yn[1].type==="listItemIndent"))break}nt&&(!Pe||nt<Pe)&&(vt._spread=!0),vt.end=Object.assign({},Pe?se[Pe][1].start:ut[1].end),se.splice(Pe||_e,0,["exit",vt,ut[2]]),_e++,Re++}if(ut[1].type==="listItemPrefix"){const tn={type:"listItem",_spread:!1,start:Object.assign({},ut[1].start),end:void 0};vt=tn,se.splice(_e,0,["enter",tn,ut[2]]),_e++,Re++,nt=void 0,At=!0}}}return se[be][1]._spread=De,Re}function u(se,be){return Re;function Re(_e){m.call(this,se(_e),_e),be&&be.call(this,_e)}}function d(){this.stack.push({type:"fragment",children:[]})}function m(se,be,Re){this.stack[this.stack.length-1].children.push(se),this.stack.push(se),this.tokenStack.push([be,Re||void 0]),se.position={start:ta(be.start),end:void 0}}function x(se){return be;function be(Re){se&&se.call(this,Re),f.call(this,Re)}}function f(se,be){const Re=this.stack.pop(),_e=this.tokenStack.pop();if(_e)_e[0].type!==se.type&&(be?be.call(this,se,_e[0]):(_e[1]||q1).call(this,se,_e[0]));else throw new Error("Cannot close `"+se.type+"` ("+Us({start:se.start,end:se.end})+"): it’s not open");Re.position.end=ta(se.end)}function g(){return yh(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function b(se){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(se),10),this.data.expectingFirstListItemValue=void 0}}function v(){const se=this.resume(),be=this.stack[this.stack.length-1];be.lang=se}function S(){const se=this.resume(),be=this.stack[this.stack.length-1];be.meta=se}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const se=this.resume(),be=this.stack[this.stack.length-1];be.value=se.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const se=this.resume(),be=this.stack[this.stack.length-1];be.value=se.replace(/(\r?\n|\r)$/g,"")}function N(se){const be=this.resume(),Re=this.stack[this.stack.length-1];Re.label=be,Re.identifier=zl(this.sliceSerialize(se)).toLowerCase()}function z(){const se=this.resume(),be=this.stack[this.stack.length-1];be.title=se}function O(){const se=this.resume(),be=this.stack[this.stack.length-1];be.url=se}function I(se){const be=this.stack[this.stack.length-1];if(!be.depth){const Re=this.sliceSerialize(se).length;be.depth=Re}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function q(se){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(se).codePointAt(0)===61?1:2}function W(){this.data.setextHeadingSlurpLineEnding=void 0}function Y(se){const Re=this.stack[this.stack.length-1].children;let _e=Re[Re.length-1];(!_e||_e.type!=="text")&&(_e=ct(),_e.position={start:ta(se.start),end:void 0},Re.push(_e)),this.stack.push(_e)}function T(se){const be=this.stack.pop();be.value+=this.sliceSerialize(se),be.position.end=ta(se.end)}function $(se){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Re=be.children[be.children.length-1];Re.position.end=ta(se.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&l.canContainEols.includes(be.type)&&(Y.call(this,se),T.call(this,se))}function B(){this.data.atHardBreak=!0}function G(){const se=this.resume(),be=this.stack[this.stack.length-1];be.value=se}function ne(){const se=this.resume(),be=this.stack[this.stack.length-1];be.value=se}function V(){const se=this.resume(),be=this.stack[this.stack.length-1];be.value=se}function U(){const se=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";se.type+="Reference",se.referenceType=be,delete se.url,delete se.title}else delete se.identifier,delete se.label;this.data.referenceType=void 0}function Z(){const se=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";se.type+="Reference",se.referenceType=be,delete se.url,delete se.title}else delete se.identifier,delete se.label;this.data.referenceType=void 0}function ie(se){const be=this.sliceSerialize(se),Re=this.stack[this.stack.length-2];Re.label=I5(be),Re.identifier=zl(be).toLowerCase()}function je(){const se=this.stack[this.stack.length-1],be=this.resume(),Re=this.stack[this.stack.length-1];if(this.data.inReference=!0,Re.type==="link"){const _e=se.children;Re.children=_e}else Re.alt=be}function R(){const se=this.resume(),be=this.stack[this.stack.length-1];be.url=se}function M(){const se=this.resume(),be=this.stack[this.stack.length-1];be.title=se}function K(){this.data.inReference=void 0}function D(){this.data.referenceType="collapsed"}function de(se){const be=this.resume(),Re=this.stack[this.stack.length-1];Re.label=be,Re.identifier=zl(this.sliceSerialize(se)).toLowerCase(),this.data.referenceType="full"}function Se(se){this.data.characterReferenceType=se.type}function ve(se){const be=this.sliceSerialize(se),Re=this.data.characterReferenceType;let _e;Re?(_e=xy(be,Re==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):_e=gh(be);const xe=this.stack[this.stack.length-1];xe.value+=_e}function Fe(se){const be=this.stack.pop();be.position.end=ta(se.end)}function Me(se){T.call(this,se);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(se)}function $e(se){T.call(this,se);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(se)}function fe(){return{type:"blockquote",children:[]}}function tt(){return{type:"code",lang:null,meta:null,value:""}}function mt(){return{type:"inlineCode",value:""}}function he(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ye(){return{type:"emphasis",children:[]}}function ge(){return{type:"heading",depth:0,children:[]}}function Le(){return{type:"break"}}function Ee(){return{type:"html",value:""}}function ze(){return{type:"image",title:null,url:"",alt:null}}function Te(){return{type:"link",title:null,url:"",children:[]}}function Ne(se){return{type:"list",ordered:se.type==="listOrdered",start:null,spread:se._spread,children:[]}}function Ie(se){return{type:"listItem",spread:se._spread,checked:null,children:[]}}function Ge(){return{type:"paragraph",children:[]}}function Dt(){return{type:"strong",children:[]}}function ct(){return{type:"text",value:""}}function Ot(){return{type:"thematicBreak"}}}function ta(e){return{line:e.line,column:e.column,offset:e.offset}}function Ey(e,l){let r=-1;for(;++r<l.length;){const i=l[r];Array.isArray(i)?Ey(e,i):X5(e,i)}}function X5(e,l){let r;for(r in l)if(Cy.call(l,r))switch(r){case"canContainEols":{const i=l[r];i&&e[r].push(...i);break}case"transforms":{const i=l[r];i&&e[r].push(...i);break}case"enter":case"exit":{const i=l[r];i&&Object.assign(e[r],i);break}}}function q1(e,l){throw e?new Error("Cannot close `"+e.type+"` ("+Us({start:e.start,end:e.end})+"): a different token (`"+l.type+"`, "+Us({start:l.start,end:l.end})+") is open"):new Error("Cannot close document, a token (`"+l.type+"`, "+Us({start:l.start,end:l.end})+") is still open")}function V5(e){const l=this;l.parser=r;function r(i){return Y5(i,{...l.data("settings"),...e,extensions:l.data("micromarkExtensions")||[],mdastExtensions:l.data("fromMarkdownExtensions")||[]})}}function G5(e,l){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(l),!0)};return e.patch(l,r),e.applyData(l,r)}function K5(e,l){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(l,r),[e.applyData(l,r),{type:"text",value:`
|
|
53
|
+
`;break}case-2:{d=l?" ":" ";break}case-1:{if(!l&&c)continue;d=" ";break}default:d=String.fromCharCode(u)}c=u===-2,i.push(d)}return i.join("")}function B5(e){const i={constructs:my([R5,...(e||{}).extensions||[]]),content:c(Jv),defined:[],document:c(ew),flow:c(g5),lazy:{},string:c(w5),text:c(k5)};return i;function c(u){return d;function d(m){return F5(i,u,m)}}}function $5(e){for(;!by(e););return e}const Y1=/[\0\t\n\r]/g;function L5(){let e=1,l="",r=!0,i;return c;function c(u,d,m){const x=[];let f,g,y,b,v;for(u=l+(typeof u=="string"?u.toString():new TextDecoder(d||void 0).decode(u)),y=0,l="",r&&(u.charCodeAt(0)===65279&&y++,r=void 0);y<u.length;){if(Y1.lastIndex=y,f=Y1.exec(u),b=f&&f.index!==void 0?f.index:u.length,v=u.charCodeAt(b),!f){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)),e+=b-y),v){case 0:{x.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,x.push(-2);e++<g;)x.push(-1);break}case 10:{x.push(-4),e=1;break}default:i=!0,e=1}y=b+1}return m&&(i&&x.push(-5),l&&x.push(l),x.push(null)),x}}const H5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function I5(e){return e.replace(H5,U5)}function U5(e,l,r){if(l)return l;if(r.charCodeAt(0)===35){const c=r.charCodeAt(1),u=c===120||c===88;return xy(r.slice(u?2:1),u?16:10)}return gh(r)||e}const Cy={}.hasOwnProperty;function Y5(e,l,r){return l&&typeof l=="object"&&(r=l,l=void 0),q5(r)($5(B5(r).document().write(L5()(e,l,!0))))}function q5(e){const l={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Te),autolinkProtocol:Y,autolinkEmail:Y,atxHeading:u(ge),blockQuote:u(fe),characterEscape:Y,characterReference:Y,codeFenced:u(tt),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:u(tt,d),codeText:u(mt,d),codeTextData:Y,data:Y,codeFlowValue:Y,definition:u(he),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:u(ye),hardBreakEscape:u(Le),hardBreakTrailing:u(Le),htmlFlow:u(Ee,d),htmlFlowData:Y,htmlText:u(Ee,d),htmlTextData:Y,image:u(ze),label:d,link:u(Te),listItem:u(Ie),listItemValue:b,listOrdered:u(Ne,y),listUnordered:u(Ne),paragraph:u(Ge),reference:D,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:u(ge),strong:u(Dt),thematicBreak:u(Ot)},exit:{atxHeading:x(),atxHeadingSequence:I,autolink:x(),autolinkEmail:$e,autolinkProtocol:Me,blockQuote:x(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:Se,characterReferenceMarkerNumeric:Se,characterReferenceValue:ve,characterReference:Fe,codeFenced:x(C),codeFencedFence:j,codeFencedFenceInfo:v,codeFencedFenceMeta:S,codeFlowValue:T,codeIndented:x(E),codeText:x(V),codeTextData:T,data:T,definition:x(),definitionDestinationString:O,definitionLabelString:N,definitionTitleString:z,emphasis:x(),hardBreakEscape:x(B),hardBreakTrailing:x(B),htmlFlow:x(G),htmlFlowData:T,htmlText:x(ne),htmlTextData:T,image:x(J),label:je,labelText:ie,lineEnding:$,link:x(U),listItem:x(),listOrdered:x(),listUnordered:x(),paragraph:x(),referenceString:de,resourceDestinationString:R,resourceTitleString:M,resource:K,setextHeading:x(W),setextHeadingLineSequence:q,setextHeadingText:_,strong:x(),thematicBreak:x()}};Ey(l,(e||{}).mdastExtensions||[]);const r={};return i;function i(se){let be={type:"root",children:[]};const Re={stack:[be],tokenStack:[],config:l,enter:m,exit:f,buffer:d,resume:g,data:r},_e=[];let xe=-1;for(;++xe<se.length;)if(se[xe][1].type==="listOrdered"||se[xe][1].type==="listUnordered")if(se[xe][0]==="enter")_e.push(xe);else{const De=_e.pop();xe=c(se,De,xe)}for(xe=-1;++xe<se.length;){const De=l[se[xe][0]];Cy.call(De,se[xe][1].type)&&De[se[xe][1].type].call(Object.assign({sliceSerialize:se[xe][2].sliceSerialize},Re),se[xe][1])}if(Re.tokenStack.length>0){const De=Re.tokenStack[Re.tokenStack.length-1];(De[1]||q1).call(Re,void 0,De[0])}for(be.position={start:ta(se.length>0?se[0][1].start:{line:1,column:1,offset:0}),end:ta(se.length>0?se[se.length-2][1].end:{line:1,column:1,offset:0})},xe=-1;++xe<l.transforms.length;)be=l.transforms[xe](be)||be;return be}function c(se,be,Re){let _e=be-1,xe=-1,De=!1,vt,Pe,nt,At;for(;++_e<=Re;){const ut=se[_e];switch(ut[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ut[0]==="enter"?xe++:xe--,At=void 0;break}case"lineEndingBlank":{ut[0]==="enter"&&(vt&&!At&&!xe&&!nt&&(nt=_e),At=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:At=void 0}if(!xe&&ut[0]==="enter"&&ut[1].type==="listItemPrefix"||xe===-1&&ut[0]==="exit"&&(ut[1].type==="listUnordered"||ut[1].type==="listOrdered")){if(vt){let tn=_e;for(Pe=void 0;tn--;){const yn=se[tn];if(yn[1].type==="lineEnding"||yn[1].type==="lineEndingBlank"){if(yn[0]==="exit")continue;Pe&&(se[Pe][1].type="lineEndingBlank",De=!0),yn[1].type="lineEnding",Pe=tn}else if(!(yn[1].type==="linePrefix"||yn[1].type==="blockQuotePrefix"||yn[1].type==="blockQuotePrefixWhitespace"||yn[1].type==="blockQuoteMarker"||yn[1].type==="listItemIndent"))break}nt&&(!Pe||nt<Pe)&&(vt._spread=!0),vt.end=Object.assign({},Pe?se[Pe][1].start:ut[1].end),se.splice(Pe||_e,0,["exit",vt,ut[2]]),_e++,Re++}if(ut[1].type==="listItemPrefix"){const tn={type:"listItem",_spread:!1,start:Object.assign({},ut[1].start),end:void 0};vt=tn,se.splice(_e,0,["enter",tn,ut[2]]),_e++,Re++,nt=void 0,At=!0}}}return se[be][1]._spread=De,Re}function u(se,be){return Re;function Re(_e){m.call(this,se(_e),_e),be&&be.call(this,_e)}}function d(){this.stack.push({type:"fragment",children:[]})}function m(se,be,Re){this.stack[this.stack.length-1].children.push(se),this.stack.push(se),this.tokenStack.push([be,Re||void 0]),se.position={start:ta(be.start),end:void 0}}function x(se){return be;function be(Re){se&&se.call(this,Re),f.call(this,Re)}}function f(se,be){const Re=this.stack.pop(),_e=this.tokenStack.pop();if(_e)_e[0].type!==se.type&&(be?be.call(this,se,_e[0]):(_e[1]||q1).call(this,se,_e[0]));else throw new Error("Cannot close `"+se.type+"` ("+Us({start:se.start,end:se.end})+"): it’s not open");Re.position.end=ta(se.end)}function g(){return yh(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function b(se){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(se),10),this.data.expectingFirstListItemValue=void 0}}function v(){const se=this.resume(),be=this.stack[this.stack.length-1];be.lang=se}function S(){const se=this.resume(),be=this.stack[this.stack.length-1];be.meta=se}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const se=this.resume(),be=this.stack[this.stack.length-1];be.value=se.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const se=this.resume(),be=this.stack[this.stack.length-1];be.value=se.replace(/(\r?\n|\r)$/g,"")}function N(se){const be=this.resume(),Re=this.stack[this.stack.length-1];Re.label=be,Re.identifier=zl(this.sliceSerialize(se)).toLowerCase()}function z(){const se=this.resume(),be=this.stack[this.stack.length-1];be.title=se}function O(){const se=this.resume(),be=this.stack[this.stack.length-1];be.url=se}function I(se){const be=this.stack[this.stack.length-1];if(!be.depth){const Re=this.sliceSerialize(se).length;be.depth=Re}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function q(se){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(se).codePointAt(0)===61?1:2}function W(){this.data.setextHeadingSlurpLineEnding=void 0}function Y(se){const Re=this.stack[this.stack.length-1].children;let _e=Re[Re.length-1];(!_e||_e.type!=="text")&&(_e=ct(),_e.position={start:ta(se.start),end:void 0},Re.push(_e)),this.stack.push(_e)}function T(se){const be=this.stack.pop();be.value+=this.sliceSerialize(se),be.position.end=ta(se.end)}function $(se){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Re=be.children[be.children.length-1];Re.position.end=ta(se.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&l.canContainEols.includes(be.type)&&(Y.call(this,se),T.call(this,se))}function B(){this.data.atHardBreak=!0}function G(){const se=this.resume(),be=this.stack[this.stack.length-1];be.value=se}function ne(){const se=this.resume(),be=this.stack[this.stack.length-1];be.value=se}function V(){const se=this.resume(),be=this.stack[this.stack.length-1];be.value=se}function U(){const se=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";se.type+="Reference",se.referenceType=be,delete se.url,delete se.title}else delete se.identifier,delete se.label;this.data.referenceType=void 0}function J(){const se=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";se.type+="Reference",se.referenceType=be,delete se.url,delete se.title}else delete se.identifier,delete se.label;this.data.referenceType=void 0}function ie(se){const be=this.sliceSerialize(se),Re=this.stack[this.stack.length-2];Re.label=I5(be),Re.identifier=zl(be).toLowerCase()}function je(){const se=this.stack[this.stack.length-1],be=this.resume(),Re=this.stack[this.stack.length-1];if(this.data.inReference=!0,Re.type==="link"){const _e=se.children;Re.children=_e}else Re.alt=be}function R(){const se=this.resume(),be=this.stack[this.stack.length-1];be.url=se}function M(){const se=this.resume(),be=this.stack[this.stack.length-1];be.title=se}function K(){this.data.inReference=void 0}function D(){this.data.referenceType="collapsed"}function de(se){const be=this.resume(),Re=this.stack[this.stack.length-1];Re.label=be,Re.identifier=zl(this.sliceSerialize(se)).toLowerCase(),this.data.referenceType="full"}function Se(se){this.data.characterReferenceType=se.type}function ve(se){const be=this.sliceSerialize(se),Re=this.data.characterReferenceType;let _e;Re?(_e=xy(be,Re==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):_e=gh(be);const xe=this.stack[this.stack.length-1];xe.value+=_e}function Fe(se){const be=this.stack.pop();be.position.end=ta(se.end)}function Me(se){T.call(this,se);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(se)}function $e(se){T.call(this,se);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(se)}function fe(){return{type:"blockquote",children:[]}}function tt(){return{type:"code",lang:null,meta:null,value:""}}function mt(){return{type:"inlineCode",value:""}}function he(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ye(){return{type:"emphasis",children:[]}}function ge(){return{type:"heading",depth:0,children:[]}}function Le(){return{type:"break"}}function Ee(){return{type:"html",value:""}}function ze(){return{type:"image",title:null,url:"",alt:null}}function Te(){return{type:"link",title:null,url:"",children:[]}}function Ne(se){return{type:"list",ordered:se.type==="listOrdered",start:null,spread:se._spread,children:[]}}function Ie(se){return{type:"listItem",spread:se._spread,checked:null,children:[]}}function Ge(){return{type:"paragraph",children:[]}}function Dt(){return{type:"strong",children:[]}}function ct(){return{type:"text",value:""}}function Ot(){return{type:"thematicBreak"}}}function ta(e){return{line:e.line,column:e.column,offset:e.offset}}function Ey(e,l){let r=-1;for(;++r<l.length;){const i=l[r];Array.isArray(i)?Ey(e,i):X5(e,i)}}function X5(e,l){let r;for(r in l)if(Cy.call(l,r))switch(r){case"canContainEols":{const i=l[r];i&&e[r].push(...i);break}case"transforms":{const i=l[r];i&&e[r].push(...i);break}case"enter":case"exit":{const i=l[r];i&&Object.assign(e[r],i);break}}}function q1(e,l){throw e?new Error("Cannot close `"+e.type+"` ("+Us({start:e.start,end:e.end})+"): a different token (`"+l.type+"`, "+Us({start:l.start,end:l.end})+") is open"):new Error("Cannot close document, a token (`"+l.type+"`, "+Us({start:l.start,end:l.end})+") is still open")}function V5(e){const l=this;l.parser=r;function r(i){return Y5(i,{...l.data("settings"),...e,extensions:l.data("micromarkExtensions")||[],mdastExtensions:l.data("fromMarkdownExtensions")||[]})}}function G5(e,l){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(l),!0)};return e.patch(l,r),e.applyData(l,r)}function K5(e,l){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(l,r),[e.applyData(l,r),{type:"text",value:`
|
|
54
54
|
`}]}function W5(e,l){const r=l.value?l.value+`
|
|
55
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}),e.patch(l,u),u=e.applyData(l,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(l,u),u}function Q5(e,l){const r={type:"element",tagName:"del",properties:{},children:e.all(l)};return e.patch(l,r),e.applyData(l,r)}function Z5(e,l){const r={type:"element",tagName:"em",properties:{},children:e.all(l)};return e.patch(l,r),e.applyData(l,r)}function J5(e,l){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(l.identifier).toUpperCase(),c=zi(i.toLowerCase()),u=e.footnoteOrder.indexOf(i);let d,m=e.footnoteCounts.get(i);m===void 0?(m=0,e.footnoteOrder.push(i),d=e.footnoteOrder.length):d=u+1,m+=1,e.footnoteCounts.set(i,m);const x={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+c,id:r+"fnref-"+c+(m>1?"-"+m:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};e.patch(l,x);const f={type:"element",tagName:"sup",properties:{},children:[x]};return e.patch(l,f),e.applyData(l,f)}function P5(e,l){const r={type:"element",tagName:"h"+l.depth,properties:{},children:e.all(l)};return e.patch(l,r),e.applyData(l,r)}function ek(e,l){if(e.options.allowDangerousHtml){const r={type:"raw",value:l.value};return e.patch(l,r),e.applyData(l,r)}}function Ny(e,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=e.all(l),u=c[0];u&&u.type==="text"?u.value="["+u.value:c.unshift({type:"text",value:"["});const d=c[c.length-1];return d&&d.type==="text"?d.value+=i:c.push({type:"text",value:i}),c}function tk(e,l){const r=String(l.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return Ny(e,l);const c={src:zi(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 e.patch(l,u),e.applyData(l,u)}function nk(e,l){const r={src:zi(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 e.patch(l,i),e.applyData(l,i)}function lk(e,l){const r={type:"text",value:l.value.replace(/\r?\n|\r/g," ")};e.patch(l,r);const i={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(l,i),e.applyData(l,i)}function rk(e,l){const r=String(l.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return Ny(e,l);const c={href:zi(i.url||"")};i.title!==null&&i.title!==void 0&&(c.title=i.title);const u={type:"element",tagName:"a",properties:c,children:e.all(l)};return e.patch(l,u),e.applyData(l,u)}function ak(e,l){const r={href:zi(l.url)};l.title!==null&&l.title!==void 0&&(r.title=l.title);const i={type:"element",tagName:"a",properties:r,children:e.all(l)};return e.patch(l,i),e.applyData(l,i)}function ik(e,l,r){const i=e.all(l),c=r?sk(r):Ay(l),u={},d=[];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")&&d.push({type:"text",value:`
|
|
56
56
|
`}),g.type==="element"&&g.tagName==="p"&&!c?d.push(...g.children):d.push(g)}const x=i[i.length-1];x&&(c||x.type!=="element"||x.tagName!=="p")&&d.push({type:"text",value:`
|
|
@@ -76,26 +76,26 @@ Error generating stack: `+o.message+`
|
|
|
76
76
|
`,...u.current()});return/^[\t ]/.test(f)&&(f=Gs(f.charCodeAt(0))+f.slice(1)),f=f?d+" "+f:d,r.options.closeAtx&&(f+=" "+d),x(),m(),f}Hy.peek=f4;function Hy(e){return e.value||""}function f4(){return"<"}Iy.peek=h4;function Iy(e,l,r,i){const c=Nh(r),u=c==='"'?"Quote":"Apostrophe",d=r.enter("image");let m=r.enter("label");const x=r.createTracker(i);let f=x.move("![");return f+=x.move(r.safe(e.alt,{before:f,after:"]",...x.current()})),f+=x.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=r.enter("destinationLiteral"),f+=x.move("<"),f+=x.move(r.safe(e.url,{before:f,after:">",...x.current()})),f+=x.move(">")):(m=r.enter("destinationRaw"),f+=x.move(r.safe(e.url,{before:f,after:e.title?" ":")",...x.current()}))),m(),e.title&&(m=r.enter(`title${u}`),f+=x.move(" "+c),f+=x.move(r.safe(e.title,{before:f,after:c,...x.current()})),f+=x.move(c),m()),f+=x.move(")"),d(),f}function h4(){return"!"}Uy.peek=m4;function Uy(e,l,r,i){const c=e.referenceType,u=r.enter("imageReference");let d=r.enter("label");const m=r.createTracker(i);let x=m.move("![");const f=r.safe(e.alt,{before:x,after:"]",...m.current()});x+=m.move(f+"]["),d();const g=r.stack;r.stack=[],d=r.enter("reference");const y=r.safe(r.associationId(e),{before:x,after:"]",...m.current()});return d(),r.stack=g,u(),c==="full"||!f||f!==y?x+=m.move(y+"]"):c==="shortcut"?x=x.slice(0,-1):x+=m.move("]"),x}function m4(){return"!"}Yy.peek=x4;function Yy(e,l,r){let i=e.value||"",c="`",u=-1;for(;new RegExp("(^|[^`])"+c+"([^`]|$)").test(i);)c+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++u<r.unsafe.length;){const d=r.unsafe[u],m=r.compilePattern(d);let x;if(d.atBreak)for(;x=m.exec(i);){let f=x.index;i.charCodeAt(f)===10&&i.charCodeAt(f-1)===13&&f--,i=i.slice(0,f)+" "+i.slice(x.index+1)}}return c+i+c}function x4(){return"`"}function qy(e,l){const r=yh(e);return!!(!l.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Xy.peek=p4;function Xy(e,l,r,i){const c=Nh(r),u=c==='"'?"Quote":"Apostrophe",d=r.createTracker(i);let m,x;if(qy(e,r)){const g=r.stack;r.stack=[],m=r.enter("autolink");let y=d.move("<");return y+=d.move(r.containerPhrasing(e,{before:y,after:">",...d.current()})),y+=d.move(">"),m(),r.stack=g,y}m=r.enter("link"),x=r.enter("label");let f=d.move("[");return f+=d.move(r.containerPhrasing(e,{before:f,after:"](",...d.current()})),f+=d.move("]("),x(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(x=r.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(r.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(x=r.enter("destinationRaw"),f+=d.move(r.safe(e.url,{before:f,after:e.title?" ":")",...d.current()}))),x(),e.title&&(x=r.enter(`title${u}`),f+=d.move(" "+c),f+=d.move(r.safe(e.title,{before:f,after:c,...d.current()})),f+=d.move(c),x()),f+=d.move(")"),m(),f}function p4(e,l,r){return qy(e,r)?"<":"["}Vy.peek=y4;function Vy(e,l,r,i){const c=e.referenceType,u=r.enter("linkReference");let d=r.enter("label");const m=r.createTracker(i);let x=m.move("[");const f=r.containerPhrasing(e,{before:x,after:"]",...m.current()});x+=m.move(f+"]["),d();const g=r.stack;r.stack=[],d=r.enter("reference");const y=r.safe(r.associationId(e),{before:x,after:"]",...m.current()});return d(),r.stack=g,u(),c==="full"||!f||f!==y?x+=m.move(y+"]"):c==="shortcut"?x=x.slice(0,-1):x+=m.move("]"),x}function y4(){return"["}function Ah(e){const l=e.options.bullet||"*";if(l!=="*"&&l!=="+"&&l!=="-")throw new Error("Cannot serialize items with `"+l+"` for `options.bullet`, expected `*`, `+`, or `-`");return l}function g4(e){const l=Ah(e),r=e.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 b4(e){const l=e.options.bulletOrdered||".";if(l!=="."&&l!==")")throw new Error("Cannot serialize items with `"+l+"` for `options.bulletOrdered`, expected `.` or `)`");return l}function Gy(e){const l=e.options.rule||"*";if(l!=="*"&&l!=="-"&&l!=="_")throw new Error("Cannot serialize rules with `"+l+"` for `options.rule`, expected `*`, `-`, or `_`");return l}function v4(e,l,r,i){const c=r.enter("list"),u=r.bulletCurrent;let d=e.ordered?b4(r):Ah(r);const m=e.ordered?d==="."?")":".":g4(r);let x=l&&r.bulletLastUsed?d===r.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((d==="*"||d==="-")&&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),Gy(r)===d&&g){let y=-1;for(;++y<e.children.length;){const b=e.children[y];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){x=!0;break}}}}x&&(d=m),r.bulletCurrent=d;const f=r.containerFlow(e,i);return r.bulletLastUsed=d,r.bulletCurrent=u,c(),f}function w4(e){const l=e.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 k4(e,l,r,i){const c=w4(r);let u=r.bulletCurrent||Ah(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(e))+u);let d=u.length+1;(c==="tab"||c==="mixed"&&(l&&l.type==="list"&&l.spread||e.spread))&&(d=Math.ceil(d/4)*4);const m=r.createTracker(i);m.move(u+" ".repeat(d-u.length)),m.shift(d);const x=r.enter("listItem"),f=r.indentLines(r.containerFlow(e,m.current()),g);return x(),f;function g(y,b,v){return b?(v?"":" ".repeat(d))+y:(v?u:u+" ".repeat(d-u.length))+y}}function j4(e,l,r,i){const c=r.enter("paragraph"),u=r.enter("phrasing"),d=r.containerPhrasing(e,i);return u(),c(),d}const S4=Kc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function C4(e,l,r,i){return(e.children.some(function(d){return S4(d)})?r.containerPhrasing:r.containerFlow).call(r,e,i)}function E4(e){const l=e.options.strong||"*";if(l!=="*"&&l!=="_")throw new Error("Cannot serialize strong with `"+l+"` for `options.strong`, expected `*`, or `_`");return l}Ky.peek=N4;function Ky(e,l,r,i){const c=E4(r),u=r.enter("strong"),d=r.createTracker(i),m=d.move(c+c);let x=d.move(r.containerPhrasing(e,{after:c,before:m,...d.current()}));const f=x.charCodeAt(0),g=$c(i.before.charCodeAt(i.before.length-1),f,c);g.inside&&(x=Gs(f)+x.slice(1));const y=x.charCodeAt(x.length-1),b=$c(i.after.charCodeAt(0),y,c);b.inside&&(x=x.slice(0,-1)+Gs(y));const v=d.move(c+c);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},m+x+v}function N4(e,l,r){return r.options.strong||"*"}function A4(e,l,r,i){return r.safe(e.value,i)}function D4(e){const l=e.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(e,l,r){const i=(Gy(r)+(r.options.ruleSpaces?" ":"")).repeat(D4(r));return r.options.ruleSpaces?i.slice(0,-1):i}const Wy={blockquote:P3,break:c0,code:a4,definition:s4,emphasis:Ly,hardBreak:c0,heading:d4,html:Hy,image:Iy,imageReference:Uy,inlineCode:Yy,link:Xy,linkReference:Vy,list:v4,listItem:k4,paragraph:j4,root:C4,strong:Ky,text:A4,thematicBreak:T4};function z4(){return{enter:{table:M4,tableData:u0,tableHeader:u0,tableRow:F4},exit:{codeText:_4,table:R4,tableData:wf,tableHeader:wf,tableRow:wf}}}function M4(e){const l=e._align;this.enter({type:"table",align:l.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function R4(e){this.exit(e),this.data.inTable=void 0}function F4(e){this.enter({type:"tableRow",children:[]},e)}function wf(e){this.exit(e)}function u0(e){this.enter({type:"tableCell",children:[]},e)}function _4(e){let l=this.resume();this.data.inTable&&(l=l.replace(/\\([\\|])/g,O4));const r=this.stack[this.stack.length-1];r.type,r.value=l,this.exit(e)}function O4(e,l){return l==="|"?l:e}function B4(e){const l=e||{},r=l.tableCellPadding,i=l.tablePipeAlign,c=l.stringLength,u=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
77
77
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:d,tableCell:x,tableRow:m}};function d(v,S,j,C){return f(g(v,j,C),v.align)}function m(v,S,j,C){const E=y(v,j,C),N=f([E]);return N.slice(0,N.indexOf(`
|
|
78
78
|
`))}function x(v,S,j,C){const E=j.enter("tableCell"),N=j.enter("phrasing"),z=j.containerPhrasing(v,{...C,before:u,after:u});return N(),E(),z}function f(v,S){return Z3(v,{align:S,alignDelimiters:i,padding:r,stringLength:c})}function g(v,S,j){const C=v.children;let E=-1;const N=[],z=S.enter("table");for(;++E<C.length;)N[E]=y(C[E],S,j);return z(),N}function y(v,S,j){const C=v.children;let E=-1;const N=[],z=S.enter("tableRow");for(;++E<C.length;)N[E]=x(C[E],v,S,j);return z(),N}function b(v,S,j){let C=Wy.inlineCode(v,S,j);return j.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function $4(){return{exit:{taskListCheckValueChecked:d0,taskListCheckValueUnchecked:d0,paragraph:H4}}}function L4(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:I4}}}function d0(e){const l=this.stack[this.stack.length-2];l.type,l.checked=e.type==="taskListCheckValueChecked"}function H4(e){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,d;for(;++u<c.length;){const m=c[u];if(m.type==="paragraph"){d=m;break}}d===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(e)}function I4(e,l,r,i){const c=e.children[0],u=typeof e.checked=="boolean"&&c&&c.type==="paragraph",d="["+(e.checked?"x":" ")+"] ",m=r.createTracker(i);u&&m.move(d);let x=Wy.listItem(e,l,r,{...i,...m.current()});return u&&(x=x.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),x;function f(g){return g+d}}function U4(){return[v3(),I3(),X3(),z4(),$4()]}function Y4(e){return{extensions:[w3(),U3(e),V3(),B4(e),L4()]}}const q4={tokenize:Q4,partial:!0},Qy={tokenize:Z4,partial:!0},Zy={tokenize:J4,partial:!0},Jy={tokenize:P4,partial:!0},X4={tokenize:ej,partial:!0},Py={name:"wwwAutolink",tokenize:K4,previous:tg},eg={name:"protocolAutolink",tokenize:W4,previous:ng},gr={name:"emailAutolink",tokenize:G4,previous:lg},Kl={};function V4(){return{text:Kl}}let Ta=48;for(;Ta<123;)Kl[Ta]=gr,Ta++,Ta===58?Ta=65:Ta===91&&(Ta=97);Kl[43]=gr;Kl[45]=gr;Kl[46]=gr;Kl[95]=gr;Kl[72]=[gr,eg];Kl[104]=[gr,eg];Kl[87]=[gr,Py];Kl[119]=[gr,Py];function G4(e,l,r){const i=this;let c,u;return d;function d(y){return!eh(y)||!lg.call(i,i.previous)||Dh(i.events)?r(y):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),m(y))}function m(y){return eh(y)?(e.consume(y),m):y===64?(e.consume(y),x):r(y)}function x(y){return y===46?e.check(X4,g,f)(y):y===45||y===95||Dn(y)?(u=!0,e.consume(y),x):g(y)}function f(y){return e.consume(y),c=!0,x}function g(y){return u&&c&&_n(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),l(y)):r(y)}}function K4(e,l,r){const i=this;return c;function c(d){return d!==87&&d!==119||!tg.call(i,i.previous)||Dh(i.events)?r(d):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(q4,e.attempt(Qy,e.attempt(Zy,u),r),r)(d))}function u(d){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),l(d)}}function W4(e,l,r){const i=this;let c="",u=!1;return d;function d(y){return(y===72||y===104)&&ng.call(i,i.previous)&&!Dh(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),c+=String.fromCodePoint(y),e.consume(y),m):r(y)}function m(y){if(_n(y)&&c.length<5)return c+=String.fromCodePoint(y),e.consume(y),m;if(y===58){const b=c.toLowerCase();if(b==="http"||b==="https")return e.consume(y),x}return r(y)}function x(y){return y===47?(e.consume(y),u?f:(u=!0,x)):r(y)}function f(y){return y===null||_c(y)||Lt(y)||Ba(y)||Xc(y)?r(y):e.attempt(Qy,e.attempt(Zy,g),r)(y)}function g(y){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),l(y)}}function Q4(e,l,r){let i=0;return c;function c(d){return(d===87||d===119)&&i<3?(i++,e.consume(d),c):d===46&&i===3?(e.consume(d),u):r(d)}function u(d){return d===null?r(d):l(d)}}function Z4(e,l,r){let i,c,u;return d;function d(f){return f===46||f===95?e.check(Jy,x,m)(f):f===null||Lt(f)||Ba(f)||f!==45&&Xc(f)?x(f):(u=!0,e.consume(f),d)}function m(f){return f===95?i=!0:(c=i,i=void 0),e.consume(f),d}function x(f){return c||i||!u?r(f):l(f)}}function J4(e,l){let r=0,i=0;return c;function c(d){return d===40?(r++,e.consume(d),c):d===41&&i<r?u(d):d===33||d===34||d===38||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===60||d===63||d===93||d===95||d===126?e.check(Jy,l,u)(d):d===null||Lt(d)||Ba(d)?l(d):(e.consume(d),c)}function u(d){return d===41&&i++,e.consume(d),c}}function P4(e,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?(e.consume(m),i):m===38?(e.consume(m),u):m===93?(e.consume(m),c):m===60||m===null||Lt(m)||Ba(m)?l(m):r(m)}function c(m){return m===null||m===40||m===91||Lt(m)||Ba(m)?l(m):i(m)}function u(m){return _n(m)?d(m):r(m)}function d(m){return m===59?(e.consume(m),i):_n(m)?(e.consume(m),d):r(m)}}function ej(e,l,r){return i;function i(u){return e.consume(u),c}function c(u){return Dn(u)?r(u):l(u)}}function tg(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Lt(e)}function ng(e){return!_n(e)}function lg(e){return!(e===47||eh(e))}function eh(e){return e===43||e===45||e===46||e===95||Dn(e)}function Dh(e){let l=e.length,r=!1;for(;l--;){const i=e[l][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){r=!0;break}if(i._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const tj={tokenize:cj,partial:!0};function nj(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:ij,continuation:{tokenize:sj},exit:oj}},text:{91:{name:"gfmFootnoteCall",tokenize:aj},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:lj,resolveTo:rj}}}}function lj(e,l,r){const i=this;let c=i.events.length;const u=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let d;for(;c--;){const x=i.events[c][1];if(x.type==="labelImage"){d=x;break}if(x.type==="gfmFootnoteCall"||x.type==="labelLink"||x.type==="label"||x.type==="image"||x.type==="link")break}return m;function m(x){if(!d||!d._balanced)return r(x);const f=zl(i.sliceSerialize({start:d.end,end:i.now()}));return f.codePointAt(0)!==94||!u.includes(f.slice(1))?r(x):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),l(x))}}function rj(e,l){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[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({},e[e.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},m=[e[r+1],e[r+2],["enter",i,l],e[r+3],e[r+4],["enter",c,l],["exit",c,l],["enter",u,l],["enter",d,l],["exit",d,l],["exit",u,l],e[e.length-2],e[e.length-1],["exit",i,l]];return e.splice(r,e.length-r+1,...m),e}function aj(e,l,r){const i=this,c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u=0,d;return m;function m(y){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),x}function x(y){return y!==94?r(y):(e.enter("gfmFootnoteCallMarker"),e.consume(y),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(y){if(u>999||y===93&&!d||y===null||y===91||Lt(y))return r(y);if(y===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return c.includes(zl(i.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),l):r(y)}return Lt(y)||(d=!0),u++,e.consume(y),y===92?g:f}function g(y){return y===91||y===92||y===93?(e.consume(y),u++,f):f(y)}}function ij(e,l,r){const i=this,c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u,d=0,m;return x;function x(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):r(S)}function g(S){if(d>999||S===93&&!m||S===null||S===91||Lt(S))return r(S);if(S===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return u=zl(i.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return Lt(S)||(m=!0),d++,e.consume(S),S===92?y:g}function y(S){return S===91||S===92||S===93?(e.consume(S),d++,g):g(S)}function b(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),c.includes(u)||c.push(u),wt(e,v,"gfmFootnoteDefinitionWhitespace")):r(S)}function v(S){return l(S)}}function sj(e,l,r){return e.check(eo,l,e.attempt(tj,l,r))}function oj(e){e.exit("gfmFootnoteDefinition")}function cj(e,l,r){const i=this;return wt(e,c,"gfmFootnoteDefinitionIndent",5);function c(u){const d=i.events[i.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?l(u):r(u)}}function uj(e){let r=(e||{}).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(d,m){let x=-1;for(;++x<d.length;)if(d[x][0]==="enter"&&d[x][1].type==="strikethroughSequenceTemporary"&&d[x][1]._close){let f=x;for(;f--;)if(d[f][0]==="exit"&&d[f][1].type==="strikethroughSequenceTemporary"&&d[f][1]._open&&d[x][1].end.offset-d[x][1].start.offset===d[f][1].end.offset-d[f][1].start.offset){d[x][1].type="strikethroughSequence",d[f][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},d[f][1].start),end:Object.assign({},d[x][1].end)},y={type:"strikethroughText",start:Object.assign({},d[f][1].end),end:Object.assign({},d[x][1].start)},b=[["enter",g,m],["enter",d[f][1],m],["exit",d[f][1],m],["enter",y,m]],v=m.parser.constructs.insideSpan.null;v&&ol(b,b.length,0,Vc(v,d.slice(f+1,x),m)),ol(b,b.length,0,[["exit",y,m],["enter",d[x][1],m],["exit",d[x][1],m],["exit",g,m]]),ol(d,f-1,x-f+3,b),x=f+b.length-2;break}}for(x=-1;++x<d.length;)d[x][1].type==="strikethroughSequenceTemporary"&&(d[x][1].type="data");return d}function u(d,m,x){const f=this.previous,g=this.events;let y=0;return b;function b(S){return f===126&&g[g.length-1][1].type!=="characterEscape"?x(S):(d.enter("strikethroughSequenceTemporary"),v(S))}function v(S){const j=Ni(f);if(S===126)return y>1?x(S):(d.consume(S),y++,v);if(y<2&&!r)return x(S);const C=d.exit("strikethroughSequenceTemporary"),E=Ni(S);return C._open=!E||E===2&&!!j,C._close=!j||j===2&&!!E,m(S)}}}class dj{constructor(){this.map=[]}add(l,r,i){fj(this,l,r,i)}consume(l){if(this.map.sort(function(u,d){return u[0]-d[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 fj(e,l,r,i){let c=0;if(!(r===0&&i.length===0)){for(;c<e.map.length;){if(e.map[c][0]===l){e.map[c][1]+=r,e.map[c][2].push(...i);return}c+=1}e.map.push([l,r,i])}}function hj(e,l){let r=!1;const i=[];for(;l<e.length;){const c=e[l];if(r){if(c[0]==="enter")c[1].type==="tableContent"&&i.push(e[l+1][1].type==="tableDelimiterMarker"?"left":"none");else if(c[1].type==="tableContent"){if(e[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 mj(){return{flow:{null:{name:"table",tokenize:xj,resolveAll:pj}}}}function xj(e,l,r){const i=this;let c=0,u=0,d;return m;function m(T){let $=i.events.length-1;for(;$>-1;){const ne=i.events[$][1].type;if(ne==="lineEnding"||ne==="linePrefix")$--;else break}const B=$>-1?i.events[$][1].type:null,G=B==="tableHead"||B==="tableRow"?_:x;return G===_&&i.parser.lazy[i.now().line]?r(T):G(T)}function x(T){return e.enter("tableHead"),e.enter("tableRow"),f(T)}function f(T){return T===124||(d=!0,u+=1),g(T)}function g(T){return T===null?r(T):Ve(T)?u>1?(u=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),v):r(T):ht(T)?wt(e,g,"whitespace")(T):(u+=1,d&&(d=!1,c+=1),T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),d=!0,g):(e.enter("data"),y(T)))}function y(T){return T===null||T===124||Lt(T)?(e.exit("data"),g(T)):(e.consume(T),T===92?b:y)}function b(T){return T===92||T===124?(e.consume(T),y):y(T)}function v(T){return i.interrupt=!1,i.parser.lazy[i.now().line]?r(T):(e.enter("tableDelimiterRow"),d=!1,ht(T)?wt(e,S,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):S(T))}function S(T){return T===45||T===58?C(T):T===124?(d=!0,e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),j):I(T)}function j(T){return ht(T)?wt(e,C,"whitespace")(T):C(T)}function C(T){return T===58?(u+=1,d=!0,e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),E):T===45?(u+=1,E(T)):T===null||Ve(T)?O(T):I(T)}function E(T){return T===45?(e.enter("tableDelimiterFiller"),N(T)):I(T)}function N(T){return T===45?(e.consume(T),N):T===58?(d=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),z):(e.exit("tableDelimiterFiller"),z(T))}function z(T){return ht(T)?wt(e,O,"whitespace")(T):O(T)}function O(T){return T===124?S(T):T===null||Ve(T)?!d||c!==u?I(T):(e.exit("tableDelimiterRow"),e.exit("tableHead"),l(T)):I(T)}function I(T){return r(T)}function _(T){return e.enter("tableRow"),q(T)}function q(T){return T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),q):T===null||Ve(T)?(e.exit("tableRow"),l(T)):ht(T)?wt(e,q,"whitespace")(T):(e.enter("data"),W(T))}function W(T){return T===null||T===124||Lt(T)?(e.exit("data"),q(T)):(e.consume(T),T===92?Y:W)}function Y(T){return T===92||T===124?(e.consume(T),W):W(T)}}function pj(e,l){let r=-1,i=!0,c=0,u=[0,0,0,0],d=[0,0,0,0],m=!1,x=0,f,g,y;const b=new dj;for(;++r<e.length;){const v=e[r],S=v[1];v[0]==="enter"?S.type==="tableHead"?(m=!1,x!==0&&(f0(b,l,x,f,g),g=void 0,x=0),f={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},b.add(r,0,[["enter",f,l]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(i=!0,y=void 0,u=[0,0,0,0],d=[0,r+1,0,0],m&&(m=!1,g={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},b.add(r,0,[["enter",g,l]])),c=S.type==="tableDelimiterRow"?2:g?3:1):c&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(i=!1,d[2]===0&&(u[1]!==0&&(d[0]=d[1],y=pc(b,l,u,c,void 0,y),u=[0,0,0,0]),d[2]=r)):S.type==="tableCellDivider"&&(i?i=!1:(u[1]!==0&&(d[0]=d[1],y=pc(b,l,u,c,void 0,y)),u=d,d=[u[1],r,0,0])):S.type==="tableHead"?(m=!0,x=r):S.type==="tableRow"||S.type==="tableDelimiterRow"?(x=r,u[1]!==0?(d[0]=d[1],y=pc(b,l,u,c,r,y)):d[1]!==0&&(y=pc(b,l,d,c,r,y)),c=0):c&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(d[3]=r)}for(x!==0&&f0(b,l,x,f,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=hj(l.events,r))}return e}function pc(e,l,r,i,c,u){const d=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",m="tableContent";r[0]!==0&&(u.end=Object.assign({},Si(l.events,r[0])),e.add(r[0],0,[["exit",u,l]]));const x=Si(l.events,r[1]);if(u={type:d,start:Object.assign({},x),end:Object.assign({},x)},e.add(r[1],0,[["enter",u,l]]),r[2]!==0){const f=Si(l.events,r[2]),g=Si(l.events,r[3]),y={type:m,start:Object.assign({},f),end:Object.assign({},g)};if(e.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 S=r[2]+1,j=r[3]-r[2]-1;e.add(S,j,[])}}e.add(r[3]+1,0,[["exit",y,l]])}return c!==void 0&&(u.end=Object.assign({},Si(l.events,c)),e.add(c,0,[["exit",u,l]]),u=void 0),u}function f0(e,l,r,i,c){const u=[],d=Si(l.events,r);c&&(c.end=Object.assign({},d),u.push(["exit",c,l])),i.end=Object.assign({},d),u.push(["exit",i,l]),e.add(r+1,0,u)}function Si(e,l){const r=e[l],i=r[0]==="enter"?"start":"end";return r[1][i]}const yj={name:"tasklistCheck",tokenize:bj};function gj(){return{text:{91:yj}}}function bj(e,l,r){const i=this;return c;function c(x){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?r(x):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(x),e.exit("taskListCheckMarker"),u)}function u(x){return Lt(x)?(e.enter("taskListCheckValueUnchecked"),e.consume(x),e.exit("taskListCheckValueUnchecked"),d):x===88||x===120?(e.enter("taskListCheckValueChecked"),e.consume(x),e.exit("taskListCheckValueChecked"),d):r(x)}function d(x){return x===93?(e.enter("taskListCheckMarker"),e.consume(x),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),m):r(x)}function m(x){return Ve(x)?l(x):ht(x)?e.check({tokenize:vj},l,r)(x):r(x)}}function vj(e,l,r){return wt(e,i,"whitespace");function i(c){return c===null?r(c):l(c)}}function wj(e){return my([V4(),nj(),uj(e),mj(),gj()])}const kj={};function Th(e){const l=this,r=e||kj,i=l.data(),c=i.micromarkExtensions||(i.micromarkExtensions=[]),u=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),d=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);c.push(wj(r)),u.push(U4()),d.push(Y4(r))}function no({content:e,className:l=""}){return s.jsx("div",{className:`office-markdown ${l}`,children:s.jsx(Eh,{remarkPlugins:[Th],components:{code:jj,table:({children:r})=>s.jsx("div",{className:"overflow-x-auto my-2",children:s.jsx("table",{className:"office-table",children:r})})},children:e})})}function jj({className:e,children:l,...r}){const i=/language-(\w+)/.exec(e??"");return i||typeof l=="string"&&l.includes(`
|
|
79
|
-
`)?s.jsx(Sj,{language:i==null?void 0:i[1],children:l}):s.jsx("code",{className:"bg-gray-100 text-gray-700 px-1 py-0.5 rounded text-[0.9em] font-mono",...r,children:l})}function Sj({children:e,language:l}){const[r,i]=k.useState(!1),c=String(e).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(c),i(!0),setTimeout(()=>i(!1),1500)};return s.jsxs("div",{className:"office-code-block group relative my-2",children:[l&&s.jsx("div",{className:"text-[10px] text-gray-400 px-3 pt-1.5",children:l}),s.jsx("button",{onClick:u,className:"absolute top-1.5 right-2 text-[10px] text-gray-400 hover:text-gray-600 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:r?"Copied!":"Copy"}),s.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:s.jsx("code",{children:c})})]})}const h0={$skin:"skinColor",$hair:"hairColor",$shirt:"shirtColor",$pants:"pantsColor",$shoes:"shoeColor"},Cj=/^(darken|lighten)\((\$\w+),\s*(\d+)\)$/;function Ej(e,l){const r=parseInt(e.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 Nj(e,l){const r=parseInt(e.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 rg(e,l){const r=h0[e];if(r&&l)return l[r];const i=Cj.exec(e);if(i){const[,c,u,d]=i,m=h0[u],x=m&&l?l[m]:u,f=parseInt(d,10);return c==="darken"?Ej(x,f):Nj(x,f)}return e}function m0(e,l=12){return e.map(r=>({...r,x:l-r.x-r.w}))}function Aj(e,l){return l==="down"?e.down:l==="up"&&e.up?e.up:l==="left"&&e.left?e.left:l==="right"&&e.right?e.right:l==="right"&&e.left?{name:e.left.name,pixels:m0(e.left.pixels)}:l==="left"&&e.right?{name:e.right.name,pixels:m0(e.right.pixels)}:e.down}function Dj(e,l){return th(e,"hair",l,1)}function th(e,l,r,i){const c=e.layers.findIndex(d=>d.name===l),u=[...e.layers];if(c>=0)u[c]={...r,name:l};else{const d=i??u.length;u.splice(d,0,{...r,name:l})}return{...e,layers:u}}const zh=new Map,Mh=new Map;function ag(e,l){zh.set(e,l)}function Qc(e,l){Mh.set(e,l)}function nh(e){return zh.get(e)}function Tj(e){return Mh.get(e)}function NN(){return Array.from(zh.keys())}function AN(){return Array.from(Mh.keys())}function zj(e,l,r,i,c=2){e.clearRect(0,0,l.width*c,l.height*c);for(const u of l.layers)ig(e,u.pixels,c,r,i)}function lh(e,l,r,i,c){for(const u of l){const d=rg(u.c,c);u.a!==void 0&&u.a!==1&&(e.globalAlpha=u.a),e.fillStyle=d,e.fillRect(r+u.x,i+u.y,u.w,u.h),u.a!==void 0&&u.a!==1&&(e.globalAlpha=1)}}function Mj(e,l){const r=l.scale;e.clearRect(0,0,l.canvasWidth,l.canvasHeight),ig(e,l.pixels,r,0)}function ig(e,l,r,i,c){for(const u of l){const d=rg(u.c,c);u.a!==void 0&&u.a!==1&&(e.globalAlpha=u.a),e.fillStyle=d,e.fillRect(u.x*r,(u.y+i)*r,u.w*r,u.h*r),u.a!==void 0&&u.a!==1&&(e.globalAlpha=1)}}const Lc=new Map;function ua(e,l,r){if("down"in r&&!("pixels"in r)){const c=r;Lc.set(e,{id:e,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;Lc.set(e,{id:e,name:l,layer:{...c,name:"hair"}})}}function Rj(e){return Lc.get(e)}function sg(){return Array.from(Lc.values())}ua("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}]}});ua("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}]}});ua("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}]}});ua("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}]}});ua("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"}]}});ua("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}]}});ua("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}]}});ua("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 Hc=new Map;function Wl(e,l,r){if("down"in r&&!("pixels"in r)){const c=r;Hc.set(e,{id:e,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;Hc.set(e,{id:e,name:l,layer:{...c,name:"torso"}})}}function Fj(e){return Hc.get(e)}function og(){return Array.from(Hc.values())}Wl("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"}]}});Wl("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"}]}});Wl("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"}]}});Wl("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)"}]}});Wl("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)"}]}});Wl("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"}]}});Wl("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"}]}});Wl("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"}]}});Wl("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"}]}});Wl("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 Ks=new Map;function Nt(e,l,r){if("down"in r&&!("pixels"in r)){const c=r;Ks.set(e,{id:e,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;Ks.set(e,{id:e,name:l,layer:{...c,name:"accessory"}})}}function _j(e){return Ks.get(e)}function Oj(e,l){const r=Ks.get(e);if(!r)return;if(r.directions)return Aj(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 cg(){return Array.from(Ks.values())}Nt("none","None",{name:"accessory",pixels:[]});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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"}]}});Nt("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}]}});Nt("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}]}});Nt("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"}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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"}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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"}]}});Nt("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"}]}});Nt("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}]}});Nt("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}]}});Nt("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 Bj={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 ug(e){return Bj[e]??1}function dg(e,l){return l>=ug(e)}Nt("star-glasses","Star Glasses",{down:{name:"accessory",pixels:[{x:1,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:2,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:2,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:7,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:8,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:8,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:5,y:4,w:2,h:1,c:"#FF4081",a:.4}]},up:{name:"accessory",pixels:[{x:0,y:3,w:2,h:1,c:"#FF4081",a:.3},{x:10,y:3,w:2,h:1,c:"#FF4081",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:2,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:2,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:5,y:4,w:6,h:1,c:"#FF4081",a:.3}]}});function Fs({r:e,g:l,b:r}){return`#${(e<<16|l<<8|r).toString(16).padStart(6,"0")}`}function Tc(e,l){const r=e.r-l.r,i=e.g-l.g,c=e.b-l.b;return r*r+i*i+c*c}function $j(e,l){const r=[];r.push(e[Math.floor(Math.random()*e.length)]);for(let i=1;i<l;i++){const c=e.map(m=>{let x=1/0;for(const f of r)x=Math.min(x,Tc(m,f));return x}),u=c.reduce((m,x)=>m+x,0);let d=Math.random()*u;for(let m=0;m<e.length;m++)if(d-=c[m],d<=0){r.push(e[m]);break}r.length<=i&&r.push(e[Math.floor(Math.random()*e.length)])}return r}function Lj(e,l,r=20){if(e.length===0)return[];const i=$j(e,l);for(let u=0;u<r;u++){const d=Array.from({length:l},()=>[]);for(const x of e){let f=1/0,g=0;for(let y=0;y<l;y++){const b=Tc(x,i[y]);b<f&&(f=b,g=y)}d[g].push(x)}let m=!0;for(let x=0;x<l;x++){if(d[x].length===0)continue;const f={r:0,g:0,b:0};for(const b of d[x])f.r+=b.r,f.g+=b.g,f.b+=b.b;const g=d[x].length,y={r:Math.round(f.r/g),g:Math.round(f.g/g),b:Math.round(f.b/g)};Tc(y,i[x])>1&&(m=!1),i[x]=y}if(m)break}const c=new Array(l).fill(0);for(const u of e){let d=1/0,m=0;for(let x=0;x<l;x++){const f=Tc(u,i[x]);f<d&&(d=f,m=x)}c[m]++}return i.map((u,d)=>({c:u,count:c[d]})).sort((u,d)=>d.count-u.count).map(u=>u.c)}function Hj(e,l=1e4){const r=document.createElement("canvas"),i=e instanceof HTMLImageElement?e.naturalWidth:e.width,c=e instanceof HTMLImageElement?e.naturalHeight:e.height;r.width=i,r.height=c;const u=r.getContext("2d");u.drawImage(e,0,0);const d=u.getImageData(0,0,i,c).data,m=i*c,x=Math.max(1,Math.floor(m/l)),f=[];for(let g=0;g<m;g+=x){const y=g*4;d[y+3]<128||f.push({r:d[y],g:d[y+1],b:d[y+2]})}return f}function x0(e){return .299*e.r+.587*e.g+.114*e.b}function p0(e){const l=Math.max(e.r,e.g,e.b),r=Math.min(e.r,e.g,e.b);return l===0?0:(l-r)/l*255}function Ij(e,l=8){const r=Hj(e),i=Lj(r,l);if(i.length<5)return{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121"};const c=[...i].sort((y,b)=>x0(b)-x0(y)),u=[...i].sort((y,b)=>p0(b)-p0(y)),d=c[0],m=c[c.length-1],x=u[0],f=c[c.length-2],g=c[c.length-1];return{skinColor:Fs(d),hairColor:Fs(m),shirtColor:Fs(x),pantsColor:Fs(f),shoeColor:Fs(g)}}const Uj=[{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}],Yj=[{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"}],qj=[{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"}],Xj=[{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 Vj(){return{width:12,height:22,layers:[{name:"lower",pixels:Uj},{name:"torso",pixels:Yj},{name:"head",pixels:qj},{name:"hair",pixels:Xj},{name:"accessory",pixels:[]}]}}const Gj=["cto","cbo","pm","engineer","designer","qa","data-analyst","default"];for(const e of Gj)ag(`mini:${e}`,Vj());const Kj=[{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"}],Wj=[{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"}],Qj=[{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 Zj(){return{width:12,height:22,layers:[{name:"torso",pixels:Kj},{name:"head",pixels:Wj},{name:"hair",pixels:Qj},{name:"accessory",pixels:[]}]}}ag("mini-seated:default",Zj());const Jj={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"}]},Pj={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"}]},eS={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"}]},tS={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"}]};Qc("meeting",Jj);Qc("bulletin",Pj);Qc("decision",tS);Qc("knowledge",eS);const kf=16,jf=24,nS=60,lS={cbo:0,cto:8,pm:15,engineer:22,designer:5,qa:12};function fg(e,l){if(!e)return e;let r=e;if(l!=null&&l.hairStyle){const i=Rj(l.hairStyle);i&&(r=Dj(r,i.layer))}if(l!=null&&l.outfitStyle){const i=Fj(l.outfitStyle);i&&(r=th(r,"torso",i.layer,1))}if(l!=null&&l.accessory&&l.accessory!=="none"){const i=_j(l.accessory);i&&(r=th(r,"accessory",i.layer))}return r}function Ws({roleId:e,className:l,appearance:r,scale:i}){const c=k.useRef(null),u=k.useRef(0),d=k.useRef(0),m=k.useRef(r);m.current=r;const x=i??4,f=kf*x,g=jf*x,y=k.useMemo(()=>{const b=nh(`mini:${e}`)??nh("mini:default");return fg(b,r)},[e,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 S=lS[e]??0,j=()=>{d.current++;const C=m.current;if(!C||!y){u.current=requestAnimationFrame(j);return}const N=(d.current+S)%nS<30?1:0;v.clearRect(0,0,kf,jf),v.save(),v.translate(2,1),zj(v,y,N,C,1),v.restore(),u.current=requestAnimationFrame(j)};return u.current=requestAnimationFrame(j),()=>cancelAnimationFrame(u.current)},[e,y]),s.jsx("canvas",{ref:c,width:kf,height:jf,className:l,style:{imageRendering:"pixelated",display:"block",width:f,height:g}})}const rS="https://api.tycono.ai",Rh=rS;async function yc(e){const l=await fetch(`${Rh}${e}`);if(!l.ok)throw new Error(`Cloud API error: ${l.status}`);return l.json()}async function ki(e,l){const r=await fetch(`${Rh}${e}`,{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 bl={health:()=>yc("/api/health"),getCharacters:e=>{const l=new URLSearchParams;e!=null&&e.sort&&l.set("sort",e.sort),e!=null&&e.instanceId&&l.set("instance_id",e.instanceId);const r=l.toString();return yc(`/api/store/characters${r?`?${r}`:""}`)},getCharacter:e=>yc(`/api/store/characters/${e}`),getCharacterVersion:e=>yc(`/api/store/characters/${e}/version`),voteCharacter:(e,l,r)=>ki(`/api/store/characters/${e}/vote`,{instanceId:l,vote:r}),trackInstall:e=>ki(`/api/store/characters/${e}/install`,{}),syncCheck:e=>ki("/api/sync/check",{roles:e}),syncPull:e=>ki("/api/sync/pull",{sourceId:e}),publishCharacter:e=>ki("/api/store/publish",e),deleteCharacter:(e,l)=>{const r=l?`?publisher_id=${encodeURIComponent(l)}`:"";return fetch(`${Rh}/api/store/characters/${e}${r}`,{method:"DELETE"}).then(i=>i.json())},uploadTelemetry:e=>ki("/api/telemetry",e)},aS={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"},Sf={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},iS={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},sS=500,y0=360,g0=700,oS=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`;function cS({role:e,allRoles:l,recentActivity:r,onClose:i,onFireRole:c,terminalWidth:u=0,activeJobId:d,activeTask:m,isWorking:x,jobStartedAt:f,onStopJob:g,sessions:y,streamingSessionId:b,onCreateSessionSilent:v,onSendMessage:S,onFocusTerminal:j,onCustomize:C,onUpdateRole:E,appearance:N,relationships:z,roleLevel:O}){var Re,_e;const[I,_]=k.useState(sS),[q,W]=k.useState(!1),Y=k.useRef(0),T=k.useRef(0),[$,B]=k.useState(!1),[G,ne]=k.useState(!1),[V,U]=k.useState(!1),[Z,ie]=k.useState(!1),[je,R]=k.useState("talk"),[M,K]=k.useState(!1),[D,de]=k.useState(""),[Se,ve]=k.useState(!1),Fe=k.useRef(null),{events:Me,status:$e}=P0(d??null),[fe,tt]=k.useState(0);k.useEffect(()=>{if(!x||!f){tt(0);return}const xe=new Date(f).getTime(),De=()=>tt(Math.floor((Date.now()-xe)/1e3));De();const vt=setInterval(De,1e3);return()=>clearInterval(vt)},[x,f]);const mt=u>0,he=mt?u:0,ye=mt?Math.max(y0,window.innerWidth-u-100):g0,ge=Math.min(I,ye),Le=k.useCallback(xe=>{xe.preventDefault(),Y.current=xe.clientX,T.current=ge,W(!0);const De=Pe=>{const nt=Y.current-Pe.clientX,At=Math.min(g0,Math.max(y0,T.current+nt));_(At)},vt=()=>{W(!1),document.removeEventListener("mousemove",De),document.removeEventListener("mouseup",vt)};document.addEventListener("mousemove",De),document.addEventListener("mouseup",vt)},[ge]),Ee=k.useRef(null),ze=e?y.find(xe=>xe.roleId===e.id):null,Te=xe=>{if(!e)return;const De=x?"talk":je;ze?(S(ze.id,xe,De),j(e.id)):(Ee.current={content:xe,mode:De},v(e.id))};k.useEffect(()=>{if(ze&&Ee.current){const{content:xe,mode:De}=Ee.current;Ee.current=null,S(ze.id,xe,De),e&&j(e.id)}},[ze==null?void 0:ze.id]);const Ne=(()=>{if(!Me.length)return null;const xe=[];let De=0,vt=0,Pe=0;for(const nt of Me)if(nt.type==="thinking")De++;else if(nt.type==="text")vt++;else if(nt.type==="tool:start"){const At=String(nt.data.name??"");xe.includes(At)||xe.push(At)}else nt.type==="dispatch:start"&&Pe++;return{tools:xe,thinkCount:De,textCount:vt,dispatchCount:Pe,total:Me.length}})(),Ie=m||(()=>{if(!ze)return null;const xe=ze.messages;for(let De=xe.length-1;De>=0;De--)if(xe[De].from==="ceo")return xe[De].content;return null})(),Ge=(()=>{if(!ze)return null;const xe=ze.messages;for(let De=xe.length-1;De>=0;De--)if(xe[De].from==="role"&&xe[De].content)return xe[De].content;return null})();if(!e)return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:he},onClick:i}),s.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px]",style:{right:he,width:ge,background:"var(--terminal-bg)",borderLeftColor:"var(--pixel-border)"},children:s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading role..."})})]});const Dt=Sf[e.id]??"#666",ct=aS[e.id]??"👤",Ot=l.filter(xe=>xe.reportsTo===e.id),se=ze&&b===ze.id,be=e.name||iS[e.id]||e.id;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:he},onClick:i}),s.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${q?"resizing":""}`,style:{borderLeftColor:Dt,right:he,width:ge,background:"var(--terminal-bg)"},children:[s.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${q?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:Le}),s.jsxs("div",{className:"relative shrink-0 overflow-hidden",style:{background:`linear-gradient(135deg, ${Dt}ee, ${Dt}99)`},children:[s.jsx("div",{className:"absolute inset-0 opacity-[0.06]",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 8px, white 8px, white 9px)"}}),s.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-1.5 z-10",children:[C&&s.jsx("button",{onClick:()=>C(e.id),className:"w-7 h-7 rounded-full bg-black/20 text-white flex items-center justify-center text-sm hover:bg-black/30 cursor-pointer backdrop-blur-sm",title:"Customize",children:"🎨"}),s.jsx("button",{onClick:i,className:"w-7 h-7 rounded-full bg-black/20 text-white flex items-center justify-center text-lg hover:bg-black/30 cursor-pointer backdrop-blur-sm",children:"×"})]}),s.jsxs("div",{className:"relative flex items-end gap-4 px-4 pt-4 pb-3",children:[s.jsx("div",{className:"shrink-0 relative",style:{marginBottom:-2},children:s.jsx("div",{className:"rounded-lg p-1",style:{background:"rgba(0,0,0,0.2)"},children:s.jsx(Ws,{roleId:e.id,appearance:N,scale:8})})}),s.jsxs("div",{className:"flex-1 min-w-0 text-white pb-1",children:[s.jsxs("div",{className:"text-lg font-bold flex items-center gap-2",style:{fontFamily:"var(--pixel-font)"},children:[ct," ",e.id.toUpperCase(),x&&s.jsx("span",{className:"text-[9px] font-semibold px-2 py-0.5 rounded-full animate-pulse",style:{background:"rgba(251,191,36,0.25)",color:"#fde68a"},children:"WORKING"})]}),M?s.jsxs("form",{className:"flex items-center gap-1.5 mt-0.5",onSubmit:async xe=>{xe.preventDefault();const De=D.trim();if(!De||De===be||!E){K(!1);return}ve(!0);try{await E(e.id,{name:De})}catch{}ve(!1),K(!1)},children:[s.jsx("input",{ref:Fe,value:D,onChange:xe=>de(xe.target.value),onKeyDown:xe=>{xe.key==="Escape"&&K(!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"}}),s.jsx("button",{type:"submit",disabled:Se,className:"text-white/80 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✓"}),s.jsx("button",{type:"button",onClick:()=>K(!1),className:"text-white/60 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✕"})]}):s.jsxs("div",{className:"text-xs opacity-75 mt-0.5 group/name flex items-center gap-1 cursor-pointer hover:opacity-100 transition-opacity",onClick:()=>{E&&(de(be),K(!0))},title:E?"Click to edit name":void 0,children:[be,E&&s.jsx("span",{className:"opacity-0 group-hover/name:opacity-60 text-[10px]",children:"✎"})]})]})]}),s.jsxs("div",{className:"relative flex items-center gap-3 px-4 py-2 text-[10px] font-bold text-white/80",style:{background:"rgba(0,0,0,0.2)",fontFamily:"var(--pixel-font)"},children:[s.jsxs("span",{children:["Lv.",O??1]}),s.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:x?"var(--idle-amber)":"var(--active-green)"}}),x?"Working":"Idle"]}),s.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),s.jsx("span",{children:e.level}),e.reportsTo&&s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),s.jsxs("span",{className:"opacity-60",children:["→"," ",e.reportsTo]})]})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:[x&&s.jsxs("div",{className:"px-4 py-3 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"var(--idle-amber)"}}),s.jsxs("span",{className:"text-xs font-semibold",style:{color:"var(--idle-amber)"},children:["Working",fe>0?` · ${oS(fe)}`:""]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>j(e.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"}),d&&g&&s.jsx("button",{onClick:()=>g(d),className:"text-[10px] px-2 py-0.5 rounded cursor-pointer font-semibold transition-colors",style:{background:"rgba(239,68,68,0.15)",color:"#ef4444"},children:"Stop"})]})]}),Ie&&s.jsx("div",{className:"text-xs truncate",style:{color:"var(--terminal-text-secondary)"},children:Ie})]}),x&&d&&Ne&&s.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Activity"}),s.jsx("button",{onClick:()=>j(e.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"View details ↗"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[Ne.thinkCount>0&&s.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(168,85,247,0.15)",color:"#c084fc"},children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:"#a855f7"}}),"thinking ×",Ne.thinkCount]}),Ne.tools.map(xe=>s.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa"},children:xe},xe)),Ne.dispatchCount>0&&s.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(249,115,22,0.15)",color:"#fb923c"},children:["dispatch ×",Ne.dispatchCount]}),Ne.textCount>0&&s.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(34,197,94,0.15)",color:"#4ade80"},children:["output ×",Ne.textCount]}),($e==="streaming"||$e==="connecting")&&s.jsx("span",{className:"inline-block w-1.5 h-3 animate-pulse rounded-sm",style:{background:"var(--active-green)"}})]}),s.jsxs("div",{className:"text-[10px] mt-1",style:{color:"var(--terminal-text-muted)"},children:[Ne.total," events"]})]}),x&&Ge&&s.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Last Message"}),s.jsx("button",{onClick:()=>j(e.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"})]}),s.jsxs("div",{className:"rounded-lg p-2.5 text-xs leading-relaxed line-clamp-3 overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:[Ge.slice(0,200),Ge.length>200&&"..."]})]}),x&&s.jsx("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:s.jsx(b0,{onSend:Te,disabled:!!se,placeholder:"Ask something...",color:Dt})}),!x&&s.jsxs("div",{className:"px-4 pt-4 pb-2",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-secondary)"},children:"Latest"}),s.jsx(dS,{icon:ct,roleId:e.id,roleName:be,color:Dt,text:r})]}),!x&&s.jsx("div",{className:"px-4 py-3",style:{borderBottom:"1px solid var(--terminal-border)"},children:s.jsxs("div",{className:"rounded-xl overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[Ge&&s.jsxs("div",{className:"px-3 pt-2.5 pb-2 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--terminal-border)"},onClick:()=>j(e.id),children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Last response"}),s.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"View ↗"})]}),s.jsxs("div",{className:"text-xs leading-relaxed line-clamp-2 overflow-hidden",style:{color:"var(--terminal-text-secondary)"},children:[Ge.slice(0,150),Ge.length>150&&"..."]})]}),s.jsx("div",{className:"p-2",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex rounded-lg overflow-hidden shrink-0",style:{border:"1px solid var(--pixel-border)"},children:[s.jsx("button",{onClick:()=>R("talk"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:je==="talk"?"var(--accent)":"transparent",color:je==="talk"?"#fff":"var(--terminal-text-secondary)"},children:"Talk"}),s.jsx("button",{onClick:()=>R("do"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:je==="do"?"var(--idle-amber)":"transparent",color:je==="do"?"#fff":"var(--terminal-text-secondary)"},children:"Do"})]}),s.jsx(b0,{onSend:Te,disabled:!!se,placeholder:je==="talk"?"Ask something...":"Give a directive...",color:Dt})]})})]})}),s.jsxs("div",{className:"px-4 py-2 space-y-1",children:[s.jsxs(gc,{title:`Profile${e.persona?"":" (empty)"}`,open:$,onToggle:()=>B(xe=>!xe),children:[e.persona&&s.jsx("div",{className:"text-xs leading-relaxed rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:e.persona}),s.jsxs("div",{className:"space-y-0 mt-2",children:[s.jsx(Cf,{label:"Level",value:e.level}),s.jsx(Cf,{label:"Reports to",value:e.reportsTo}),s.jsx(Cf,{label:"Status",value:e.status})]}),Ot.length>0&&s.jsxs("div",{className:"mt-3",children:[s.jsx("div",{className:"text-[11px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Direct Reports"}),s.jsx("div",{className:"space-y-1",children:Ot.map(xe=>s.jsxs("div",{className:"flex items-center gap-2 p-1.5 rounded-lg",style:{background:"var(--hud-bg-alt)"},children:[s.jsx("div",{className:"w-6 h-6 rounded flex items-center justify-center text-white text-[10px] font-bold",style:{background:Sf[xe.id]??"#666"},children:xe.id.slice(0,2).toUpperCase()}),s.jsx("div",{className:"text-xs",style:{color:"var(--terminal-text)"},children:xe.name})]},xe.id))})]})]}),e.authority&&s.jsxs(gc,{title:"Authority",open:G,onToggle:()=>ne(xe=>!xe),children:[((Re=e.authority.autonomous)==null?void 0:Re.length)>0&&s.jsxs("div",{className:"mb-2",children:[s.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--active-green)"},children:"Autonomous"}),e.authority.autonomous.map((xe,De)=>s.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",xe]},De))]}),((_e=e.authority.needsApproval)==null?void 0:_e.length)>0&&s.jsxs("div",{children:[s.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--idle-amber)"},children:"Needs Approval"}),e.authority.needsApproval.map((xe,De)=>s.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",xe]},De))]})]}),e&&z&&(()=>{const xe=z.filter(De=>De.roleA===e.id||De.roleB===e.id).filter(De=>De.familiarity>0).sort((De,vt)=>vt.familiarity-De.familiarity);return xe.length===0?null:s.jsx(gc,{title:`Relationships (${xe.length})`,open:V,onToggle:()=>U(De=>!De),children:s.jsx("div",{className:"space-y-1.5",children:xe.map((De,vt)=>{const Pe=De.roleA===e.id?De.roleB:De.roleA,nt=l.find(tn=>tn.id===Pe),At=De.familiarity>=80?"Best Partner":De.familiarity>=50?"Friend":De.familiarity>=20?"Colleague":"Acquaintance",ut=De.familiarity>=80?"#4CAF50":De.familiarity>=50?"#2196F3":De.familiarity>=20?"#FF9800":"#9E9E9E";return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs w-20 truncate",style:{color:Sf[Pe]??"var(--terminal-text-secondary)"},children:(nt==null?void 0:nt.name)??Pe}),s.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-white/10",children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${De.familiarity}%`,background:ut}})}),s.jsx("span",{className:"text-[10px] w-16 text-right",style:{color:"var(--terminal-text-muted)"},children:At})]},vt)})})})})(),e.journal&&s.jsx(gc,{title:`Journal (${(e.journal.match(/### /g)??[]).length})`,open:Z,onToggle:()=>ie(xe=>!xe),children:s.jsxs("div",{className:"text-xs leading-relaxed rounded-lg p-3 max-h-[300px] overflow-y-auto",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:[s.jsx(no,{content:e.journal.slice(0,3e3)}),e.journal.length>3e3&&s.jsx("div",{className:"italic mt-2",style:{color:"var(--terminal-text-muted)"},children:"... (truncated)"})]})})]}),s.jsx(uS,{role:e,appearance:N}),c&&s.jsx("div",{className:"px-4 pb-4 mt-auto shrink-0",children:s.jsx("button",{onClick:()=>{c(e.id,e.name),i()},className:"w-full p-2 text-center text-xs font-medium border-2 border-dashed rounded-lg cursor-pointer transition-colors",style:{borderColor:"rgba(239,68,68,0.3)",color:"rgba(239,68,68,0.5)"},children:"Fire Role"})})]})]})]})}function uS({role:e,appearance:l}){const[r,i]=k.useState("idle"),[c,u]=k.useState(""),[d,m]=k.useState(!1),[x,f]=k.useState(null),[g,y]=k.useState(!1),[b,v]=k.useState(!1),[S,j]=k.useState(null);k.useEffect(()=>{bl.getCharacterVersion(e.id).then(N=>f((N==null?void 0:N.version)??null)).catch(()=>f(null)),Ce.getPreferences().then(N=>j(N.instanceId??null)).catch(()=>{})},[e.id]);const C=async()=>{var N,z;if(!d){m(!0);return}i("publishing");try{let O=null;try{O=await Ce.exportSkills(e.id)}catch{}const I={roleId:e.id,persona:e.persona??"",authority:e.authority??{autonomous:[],needsApproval:[]},level:e.level,tagline:((N=(e.persona??"").split(/[.\n]/)[0])==null?void 0:N.trim().slice(0,80))||e.name,chatStyle:"Professional and focused",skills:O??[],resume:{summary:((z=e.persona)==null?void 0:z.split(`
|
|
80
|
-
`)[0])??"",strengths:[],specialties:[],experience:""},author:{id:"tycono",name:"Tycono"},tags:[e.level,e.id],price:"free",installs:0,rating:0,featured:!1,randomActive:!0,randomPersonality:""};l&&(I.appearance=l);let _="1.0.0";try{const q=await bl.getCharacterVersion(e.id);if(q!=null&&q.version){const W=q.version.split(".").map(Number);W[2]=(W[2]??0)+1,_=W.join(".")}}catch{}await bl.publishCharacter({id:e.id,name:e.name||e.id,version:_,data:I,publisherId:S??void 0}),i("done"),u(`Published v${_}`),f(_),m(!1)}catch(O){i("error"),u(O instanceof Error?O.message:"Failed"),m(!1)}},E=async()=>{v(!0);try{await bl.deleteCharacter(e.id,S??void 0),f(null),i("idle"),u(""),y(!1)}catch{u("Delete failed")}v(!1)};return s.jsx("div",{className:"px-4 pb-2 shrink-0",children:s.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:s.jsxs("div",{className:"px-3 py-2.5 flex items-center justify-between gap-2",style:{background:"var(--hud-bg-alt)"},children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider shrink-0",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Cloud Store"}),x&&s.jsxs("span",{className:"text-[9px] px-1.5 py-0.5 rounded shrink-0",style:{background:"rgba(34,197,94,0.1)",color:"rgba(34,197,94,0.6)",border:"1px solid rgba(34,197,94,0.2)"},children:["v",x]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[r==="done"?s.jsx("span",{className:"text-[10px] font-semibold",style:{color:"var(--active-green)"},children:c}):r==="error"?s.jsx("span",{className:"text-[10px] font-semibold",style:{color:"#ef4444"},children:c}):s.jsx("button",{onClick:C,disabled:r==="publishing",className:"text-[10px] px-2.5 py-1 rounded font-semibold cursor-pointer transition-colors disabled:opacity-50",style:{background:d?"rgba(59,130,246,0.3)":"rgba(59,130,246,0.15)",color:"#60a5fa",border:d?"1px solid rgba(59,130,246,0.5)":"1px solid transparent"},children:r==="publishing"?"Publishing...":d?"Confirm?":x?"Update":"Publish"}),x&&!g&&s.jsx("button",{onClick:()=>y(!0),className:"text-[10px] px-1.5 py-1 rounded cursor-pointer transition-colors",style:{color:"rgba(239,68,68,0.4)"},title:"Remove from store",children:"✕"}),g&&s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:E,disabled:b,className:"text-[10px] px-2 py-1 rounded font-semibold cursor-pointer disabled:opacity-50",style:{background:"rgba(239,68,68,0.2)",color:"#ef4444",border:"1px solid rgba(239,68,68,0.3)"},children:b?"...":"Delete"}),s.jsx("button",{onClick:()=>y(!1),className:"text-[10px] px-1.5 py-1 rounded cursor-pointer",style:{color:"var(--terminal-text-muted)"},children:"No"})]})]})]})})})}function dS({icon:e,roleId:l,roleName:r,color:i,text:c}){const u=!!c;return s.jsx("div",{className:"relative",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsxs("div",{className:"shrink-0",children:[s.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center text-xl shadow-sm",style:{background:`${i}18`,border:`2px solid ${i}44`},children:e}),s.jsx("div",{className:"text-[9px] font-bold text-center mt-0.5 uppercase tracking-wide",style:{color:i},children:l})]}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute top-3 -left-2 w-0 h-0",style:{borderTop:"6px solid transparent",borderBottom:"6px solid transparent",borderRight:`8px solid ${i}12`}}),s.jsxs("div",{className:"rounded-xl rounded-tl-sm p-4 border",style:{background:`${i}08`,borderColor:`${i}22`},children:[s.jsx("div",{className:"text-[10px] font-semibold mb-1.5 uppercase tracking-wider",style:{color:i},children:r}),u?s.jsx("div",{className:"text-sm leading-relaxed",style:{color:"var(--terminal-text)"},children:s.jsx(no,{content:c})}):s.jsx("div",{className:"text-sm italic",style:{color:"var(--terminal-text-muted)"},children:"No recent activity."})]})]})})]})})}function gc({title:e,open:l,onToggle:r,children:i}){return s.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:[s.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:[s.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:e}),s.jsx("span",{className:"text-[10px] transition-transform",style:{color:"var(--terminal-text-muted)",transform:l?"rotate(0deg)":"rotate(-90deg)"},children:"▼"})]}),l&&s.jsx("div",{className:"px-3 pb-3 pt-2",style:{borderTop:"1px solid var(--terminal-border)"},children:i})]})}function b0({onSend:e,disabled:l,placeholder:r,color:i}){const[c,u]=k.useState(""),d=()=>{const m=c.trim();!m||l||(e(m),u(""))};return s.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[s.jsx("input",{type:"text",value:c,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),d())},placeholder: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)"}}),s.jsx("button",{onClick:d,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:s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M22 2L11 13"}),s.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})}function Cf({label:e,value:l}){return s.jsxs("div",{className:"flex justify-between py-1.5 text-xs",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:e}),s.jsx("span",{className:"font-semibold",style:{color:"var(--terminal-text)"},children:l})]})}function fS(e,l){var r,i=1;e==null&&(e=0),l==null&&(l=0);function c(){var u,d=r.length,m,x=0,f=0;for(u=0;u<d;++u)m=r[u],x+=m.x,f+=m.y;for(x=(x/d-e)*i,f=(f/d-l)*i,u=0;u<d;++u)m=r[u],m.x-=x,m.y-=f}return c.initialize=function(u){r=u},c.x=function(u){return arguments.length?(e=+u,c):e},c.y=function(u){return arguments.length?(l=+u,c):l},c.strength=function(u){return arguments.length?(i=+u,c):i},c}function hS(e){const l=+this._x.call(null,e),r=+this._y.call(null,e);return hg(this.cover(l,r),l,r,e)}function hg(e,l,r,i){if(isNaN(l)||isNaN(r))return e;var c,u=e._root,d={data:i},m=e._x0,x=e._y0,f=e._x1,g=e._y1,y,b,v,S,j,C,E,N;if(!u)return e._root=d,e;for(;u.length;)if((j=l>=(y=(m+f)/2))?m=y:f=y,(C=r>=(b=(x+g)/2))?x=b:g=b,c=u,!(u=u[E=C<<1|j]))return c[E]=d,e;if(v=+e._x.call(null,u.data),S=+e._y.call(null,u.data),l===v&&r===S)return d.next=u,c?c[E]=d:e._root=d,e;do c=c?c[E]=new Array(4):e._root=new Array(4),(j=l>=(y=(m+f)/2))?m=y:f=y,(C=r>=(b=(x+g)/2))?x=b:g=b;while((E=C<<1|j)===(N=(S>=b)<<1|v>=y));return c[N]=u,c[E]=d,e}function mS(e){var l,r,i=e.length,c,u,d=new Array(i),m=new Array(i),x=1/0,f=1/0,g=-1/0,y=-1/0;for(r=0;r<i;++r)isNaN(c=+this._x.call(null,l=e[r]))||isNaN(u=+this._y.call(null,l))||(d[r]=c,m[r]=u,c<x&&(x=c),c>g&&(g=c),u<f&&(f=u),u>y&&(y=u));if(x>g||f>y)return this;for(this.cover(x,f).cover(g,y),r=0;r<i;++r)hg(this,d[r],m[r],e[r]);return this}function xS(e,l){if(isNaN(e=+e)||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(e))+1,u=(i=Math.floor(l))+1;else{for(var d=c-r||1,m=this._root,x,f;r>e||e>=c||i>l||l>=u;)switch(f=(l<i)<<1|e<r,x=new Array(4),x[f]=m,m=x,d*=2,f){case 0:c=r+d,u=i+d;break;case 1:r=c-d,u=i+d;break;case 2:c=r+d,i=u-d;break;case 3:r=c-d,i=u-d;break}this._root&&this._root.length&&(this._root=m)}return this._x0=r,this._y0=i,this._x1=c,this._y1=u,this}function pS(){var e=[];return this.visit(function(l){if(!l.length)do e.push(l.data);while(l=l.next)}),e}function yS(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function On(e,l,r,i,c){this.node=e,this.x0=l,this.y0=r,this.x1=i,this.y1=c}function gS(e,l,r){var i,c=this._x0,u=this._y0,d,m,x,f,g=this._x1,y=this._y1,b=[],v=this._root,S,j;for(v&&b.push(new On(v,c,u,g,y)),r==null?r=1/0:(c=e-r,u=l-r,g=e+r,y=l+r,r*=r);S=b.pop();)if(!(!(v=S.node)||(d=S.x0)>g||(m=S.y0)>y||(x=S.x1)<c||(f=S.y1)<u))if(v.length){var C=(d+x)/2,E=(m+f)/2;b.push(new On(v[3],C,E,x,f),new On(v[2],d,E,C,f),new On(v[1],C,m,x,E),new On(v[0],d,m,C,E)),(j=(l>=E)<<1|e>=C)&&(S=b[b.length-1],b[b.length-1]=b[b.length-1-j],b[b.length-1-j]=S)}else{var N=e-+this._x.call(null,v.data),z=l-+this._y.call(null,v.data),O=N*N+z*z;if(O<r){var I=Math.sqrt(r=O);c=e-I,u=l-I,g=e+I,y=l+I,i=v.data}}return i}function bS(e){if(isNaN(g=+this._x.call(null,e))||isNaN(y=+this._y.call(null,e)))return this;var l,r=this._root,i,c,u,d=this._x0,m=this._y0,x=this._x1,f=this._y1,g,y,b,v,S,j,C,E;if(!r)return this;if(r.length)for(;;){if((S=g>=(b=(d+x)/2))?d=b:x=b,(j=y>=(v=(m+f)/2))?m=v:f=v,l=r,!(r=r[C=j<<1|S]))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!==e;)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 vS(e){for(var l=0,r=e.length;l<r;++l)this.remove(e[l]);return this}function wS(){return this._root}function kS(){var e=0;return this.visit(function(l){if(!l.length)do++e;while(l=l.next)}),e}function jS(e){var l=[],r,i=this._root,c,u,d,m,x;for(i&&l.push(new On(i,this._x0,this._y0,this._x1,this._y1));r=l.pop();)if(!e(i=r.node,u=r.x0,d=r.y0,m=r.x1,x=r.y1)&&i.length){var f=(u+m)/2,g=(d+x)/2;(c=i[3])&&l.push(new On(c,f,g,m,x)),(c=i[2])&&l.push(new On(c,u,g,f,x)),(c=i[1])&&l.push(new On(c,f,d,m,g)),(c=i[0])&&l.push(new On(c,u,d,f,g))}return this}function SS(e){var l=[],r=[],i;for(this._root&&l.push(new On(this._root,this._x0,this._y0,this._x1,this._y1));i=l.pop();){var c=i.node;if(c.length){var u,d=i.x0,m=i.y0,x=i.x1,f=i.y1,g=(d+x)/2,y=(m+f)/2;(u=c[0])&&l.push(new On(u,d,m,g,y)),(u=c[1])&&l.push(new On(u,g,m,x,y)),(u=c[2])&&l.push(new On(u,d,y,g,f)),(u=c[3])&&l.push(new On(u,g,y,x,f))}r.push(i)}for(;i=r.pop();)e(i.node,i.x0,i.y0,i.x1,i.y1);return this}function CS(e){return e[0]}function ES(e){return arguments.length?(this._x=e,this):this._x}function NS(e){return e[1]}function AS(e){return arguments.length?(this._y=e,this):this._y}function Fh(e,l,r){var i=new _h(l??CS,r??NS,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function _h(e,l,r,i,c,u){this._x=e,this._y=l,this._x0=r,this._y0=i,this._x1=c,this._y1=u,this._root=void 0}function v0(e){for(var l={data:e.data},r=l;e=e.next;)r=r.next={data:e.data};return l}var Bn=Fh.prototype=_h.prototype;Bn.copy=function(){var e=new _h(this._x,this._y,this._x0,this._y0,this._x1,this._y1),l=this._root,r,i;if(!l)return e;if(!l.length)return e._root=v0(l),e;for(r=[{source:l,target:e._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]=v0(i));return e};Bn.add=hS;Bn.addAll=mS;Bn.cover=xS;Bn.data=pS;Bn.extent=yS;Bn.find=gS;Bn.remove=bS;Bn.removeAll=vS;Bn.root=wS;Bn.size=kS;Bn.visit=jS;Bn.visitAfter=SS;Bn.x=ES;Bn.y=AS;function Oa(e){return function(){return e}}function sa(e){return(e()-.5)*1e-6}function DS(e){return e.x+e.vx}function TS(e){return e.y+e.vy}function zS(e){var l,r,i,c=1,u=1;typeof e!="function"&&(e=Oa(e==null?1:+e));function d(){for(var f,g=l.length,y,b,v,S,j,C,E=0;E<u;++E)for(y=Fh(l,DS,TS).visitAfter(m),f=0;f<g;++f)b=l[f],j=r[b.index],C=j*j,v=b.x+b.vx,S=b.y+b.vy,y.visit(N);function N(z,O,I,_,q){var W=z.data,Y=z.r,T=j+Y;if(W){if(W.index>b.index){var $=v-W.x-W.vx,B=S-W.y-W.vy,G=$*$+B*B;G<T*T&&($===0&&($=sa(i),G+=$*$),B===0&&(B=sa(i),G+=B*B),G=(T-(G=Math.sqrt(G)))/G*c,b.vx+=($*=G)*(T=(Y*=Y)/(C+Y)),b.vy+=(B*=G)*T,W.vx-=$*(T=1-T),W.vy-=B*T)}return}return O>v+T||_<v-T||I>S+T||q<S-T}}function m(f){if(f.data)return f.r=r[f.data.index];for(var g=f.r=0;g<4;++g)f[g]&&f[g].r>f.r&&(f.r=f[g].r)}function x(){if(l){var f,g=l.length,y;for(r=new Array(g),f=0;f<g;++f)y=l[f],r[y.index]=+e(y,f,l)}}return d.initialize=function(f,g){l=f,i=g,x()},d.iterations=function(f){return arguments.length?(u=+f,d):u},d.strength=function(f){return arguments.length?(c=+f,d):c},d.radius=function(f){return arguments.length?(e=typeof f=="function"?f:Oa(+f),x(),d):e},d}function MS(e){return e.index}function w0(e,l){var r=e.get(l);if(!r)throw new Error("node not found: "+l);return r}function RS(e){var l=MS,r=y,i,c=Oa(30),u,d,m,x,f,g=1;e==null&&(e=[]);function y(C){return 1/Math.min(m[C.source.index],m[C.target.index])}function b(C){for(var E=0,N=e.length;E<g;++E)for(var z=0,O,I,_,q,W,Y,T;z<N;++z)O=e[z],I=O.source,_=O.target,q=_.x+_.vx-I.x-I.vx||sa(f),W=_.y+_.vy-I.y-I.vy||sa(f),Y=Math.sqrt(q*q+W*W),Y=(Y-u[z])/Y*C*i[z],q*=Y,W*=Y,_.vx-=q*(T=x[z]),_.vy-=W*T,I.vx+=q*(T=1-T),I.vy+=W*T}function v(){if(d){var C,E=d.length,N=e.length,z=new Map(d.map((I,_)=>[l(I,_,d),I])),O;for(C=0,m=new Array(E);C<N;++C)O=e[C],O.index=C,typeof O.source!="object"&&(O.source=w0(z,O.source)),typeof O.target!="object"&&(O.target=w0(z,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(N);C<N;++C)O=e[C],x[C]=m[O.source.index]/(m[O.source.index]+m[O.target.index]);i=new Array(N),S(),u=new Array(N),j()}}function S(){if(d)for(var C=0,E=e.length;C<E;++C)i[C]=+r(e[C],C,e)}function j(){if(d)for(var C=0,E=e.length;C<E;++C)u[C]=+c(e[C],C,e)}return b.initialize=function(C,E){d=C,f=E,v()},b.links=function(C){return arguments.length?(e=C,v(),b):e},b.id=function(C){return arguments.length?(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:Oa(+C),S(),b):r},b.distance=function(C){return arguments.length?(c=typeof C=="function"?C:Oa(+C),j(),b):c},b}var FS={value:()=>{}};function mg(){for(var e=0,l=arguments.length,r={},i;e<l;++e){if(!(i=arguments[e]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new zc(r)}function zc(e){this._=e}function _S(e,l){return e.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}})}zc.prototype=mg.prototype={constructor:zc,on:function(e,l){var r=this._,i=_S(e+"",r),c,u=-1,d=i.length;if(arguments.length<2){for(;++u<d;)if((c=(e=i[u]).type)&&(c=OS(r[c],e.name)))return c;return}if(l!=null&&typeof l!="function")throw new Error("invalid callback: "+l);for(;++u<d;)if(c=(e=i[u]).type)r[c]=k0(r[c],e.name,l);else if(l==null)for(c in r)r[c]=k0(r[c],e.name,null);return this},copy:function(){var e={},l=this._;for(var r in l)e[r]=l[r].slice();return new zc(e)},call:function(e,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(e))throw new Error("unknown type: "+e);for(u=this._[e],i=0,c=u.length;i<c;++i)u[i].value.apply(l,r)},apply:function(e,l,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],c=0,u=i.length;c<u;++c)i[c].value.apply(l,r)}};function OS(e,l){for(var r=0,i=e.length,c;r<i;++r)if((c=e[r]).name===l)return c.value}function k0(e,l,r){for(var i=0,c=e.length;i<c;++i)if(e[i].name===l){e[i]=FS,e=e.slice(0,i).concat(e.slice(i+1));break}return r!=null&&e.push({name:l,value:r}),e}var Ai=0,Ls=0,_s=0,xg=1e3,Ic,Hs,Uc=0,$a=0,Zc=0,Qs=typeof performance=="object"&&performance.now?performance:Date,pg=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function yg(){return $a||(pg(BS),$a=Qs.now()+Zc)}function BS(){$a=0}function rh(){this._call=this._time=this._next=null}rh.prototype=gg.prototype={constructor:rh,restart:function(e,l,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?yg():+r)+(l==null?0:+l),!this._next&&Hs!==this&&(Hs?Hs._next=this:Ic=this,Hs=this),this._call=e,this._time=r,ah()},stop:function(){this._call&&(this._call=null,this._time=1/0,ah())}};function gg(e,l,r){var i=new rh;return i.restart(e,l,r),i}function $S(){yg(),++Ai;for(var e=Ic,l;e;)(l=$a-e._time)>=0&&e._call.call(void 0,l),e=e._next;--Ai}function j0(){$a=(Uc=Qs.now())+Zc,Ai=Ls=0;try{$S()}finally{Ai=0,HS(),$a=0}}function LS(){var e=Qs.now(),l=e-Uc;l>xg&&(Zc-=l,Uc=e)}function HS(){for(var e,l=Ic,r,i=1/0;l;)l._call?(i>l._time&&(i=l._time),e=l,l=l._next):(r=l._next,l._next=null,l=e?e._next=r:Ic=r);Hs=e,ah(i)}function ah(e){if(!Ai){Ls&&(Ls=clearTimeout(Ls));var l=e-$a;l>24?(e<1/0&&(Ls=setTimeout(j0,e-Qs.now()-Zc)),_s&&(_s=clearInterval(_s))):(_s||(Uc=Qs.now(),_s=setInterval(LS,xg)),Ai=1,pg(j0))}}const IS=1664525,US=1013904223,S0=4294967296;function YS(){let e=1;return()=>(e=(IS*e+US)%S0)/S0}function qS(e){return e.x}function XS(e){return e.y}var VS=10,GS=Math.PI*(3-Math.sqrt(5));function KS(e){var l,r=1,i=.001,c=1-Math.pow(i,1/300),u=0,d=.6,m=new Map,x=gg(y),f=mg("tick","end"),g=YS();e==null&&(e=[]);function y(){b(),f.call("tick",l),r<i&&(x.stop(),f.call("end",l))}function b(j){var C,E=e.length,N;j===void 0&&(j=1);for(var z=0;z<j;++z)for(r+=(u-r)*c,m.forEach(function(O){O(r)}),C=0;C<E;++C)N=e[C],N.fx==null?N.x+=N.vx*=d:(N.x=N.fx,N.vx=0),N.fy==null?N.y+=N.vy*=d:(N.y=N.fy,N.vy=0);return l}function v(){for(var j=0,C=e.length,E;j<C;++j){if(E=e[j],E.index=j,E.fx!=null&&(E.x=E.fx),E.fy!=null&&(E.y=E.fy),isNaN(E.x)||isNaN(E.y)){var N=VS*Math.sqrt(.5+j),z=j*GS;E.x=N*Math.cos(z),E.y=N*Math.sin(z)}(isNaN(E.vx)||isNaN(E.vy))&&(E.vx=E.vy=0)}}function S(j){return j.initialize&&j.initialize(e,g),j}return v(),l={tick:b,restart:function(){return x.restart(y),l},stop:function(){return x.stop(),l},nodes:function(j){return arguments.length?(e=j,v(),m.forEach(S),l):e},alpha:function(j){return arguments.length?(r=+j,l):r},alphaMin:function(j){return arguments.length?(i=+j,l):i},alphaDecay:function(j){return arguments.length?(c=+j,l):+c},alphaTarget:function(j){return arguments.length?(u=+j,l):u},velocityDecay:function(j){return arguments.length?(d=1-j,l):1-d},randomSource:function(j){return arguments.length?(g=j,m.forEach(S),l):g},force:function(j,C){return arguments.length>1?(C==null?m.delete(j):m.set(j,S(C)),l):m.get(j)},find:function(j,C,E){var N=0,z=e.length,O,I,_,q,W;for(E==null?E=1/0:E*=E,N=0;N<z;++N)q=e[N],O=j-q.x,I=C-q.y,_=O*O+I*I,_<E&&(W=q,E=_);return W},on:function(j,C){return arguments.length>1?(f.on(j,C),l):f.on(j)}}}function WS(){var e,l,r,i,c=Oa(-30),u,d=1,m=1/0,x=.81;function f(v){var S,j=e.length,C=Fh(e,qS,XS).visitAfter(y);for(i=v,S=0;S<j;++S)l=e[S],C.visit(b)}function g(){if(e){var v,S=e.length,j;for(u=new Array(S),v=0;v<S;++v)j=e[v],u[j.index]=+c(j,v,e)}}function y(v){var S=0,j,C,E=0,N,z,O;if(v.length){for(N=z=O=0;O<4;++O)(j=v[O])&&(C=Math.abs(j.value))&&(S+=j.value,E+=C,N+=C*j.x,z+=C*j.y);v.x=N/E,v.y=z/E}else{j=v,j.x=j.data.x,j.y=j.data.y;do S+=u[j.data.index];while(j=j.next)}v.value=S}function b(v,S,j,C){if(!v.value)return!0;var E=v.x-l.x,N=v.y-l.y,z=C-S,O=E*E+N*N;if(z*z/x<O)return O<m&&(E===0&&(E=sa(r),O+=E*E),N===0&&(N=sa(r),O+=N*N),O<d&&(O=Math.sqrt(d*O)),l.vx+=E*v.value*i/O,l.vy+=N*v.value*i/O),!0;if(v.length||O>=m)return;(v.data!==l||v.next)&&(E===0&&(E=sa(r),O+=E*E),N===0&&(N=sa(r),O+=N*N),O<d&&(O=Math.sqrt(d*O)));do v.data!==l&&(z=u[v.data.index]*i/O,l.vx+=E*z,l.vy+=N*z);while(v=v.next)}return f.initialize=function(v,S){e=v,r=S,g()},f.strength=function(v){return arguments.length?(c=typeof v=="function"?v:Oa(+v),g(),f):c},f.distanceMin=function(v){return arguments.length?(d=v*v,f):Math.sqrt(d)},f.distanceMax=function(v){return arguments.length?(m=v*v,f):Math.sqrt(m)},f.theta=function(v){return arguments.length?(x=v*v,f):Math.sqrt(x)},f}const Zs={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 QS(e){return Zs[e]??Zs.general}function ZS({docs:e,onNodeClick:l,selectedDocId:r}){var $;const i=k.useRef(null),c=k.useRef(null),[u,d]=k.useState({width:600,height:400}),[m,x]=k.useState({nodes:[],links:[]}),[f,g]=k.useState(null),[y,b]=k.useState(null),[v,S]=k.useState({x:0,y:0}),[j,C]=k.useState({x:0,y:0,w:600,h:400}),E=k.useRef(!1),N=k.useRef({x:0,y:0,vx:0,vy:0}),z=k.useRef(null),O=k.useRef(null);k.useEffect(()=>{const B=i.current;if(!B)return;const G=new ResizeObserver(ne=>{const{width:V,height:U}=ne[0].contentRect;V>0&&U>0&&(d({width:V,height:U}),C(Z=>({...Z,w:V,h:U})))});return G.observe(B),()=>G.disconnect()},[]),k.useEffect(()=>{if(e.length===0)return;const B=new Set(e.map(ve=>ve.id)),G=e.map(ve=>({id:ve.id,title:ve.title,category:ve.category,akb_type:ve.akb_type})),ne=(ve,Fe)=>{if(!Fe.startsWith(".")&&!Fe.startsWith("/"))return Fe;const Me=ve.split("/");Me.pop();const $e=Fe.split("/");for(const fe of $e)fe===".."?Me.pop():fe!=="."&&fe!==""&&Me.push(fe);return Me.join("/")},V=[];for(const ve of e)for(const Fe of ve.links){const Me=ne(ve.id,Fe.href);B.has(Me)&&Me!==ve.id&&(V.some($e=>$e.source===ve.id&&$e.target===Me||$e.source===Me&&$e.target===ve.id)||V.push({source:ve.id,target:Me,label:Fe.text}))}const{width:U,height:Z}=u,ie=G.length,je=ie>100?-600:ie>50?-500:-400,R=ie>100?180:ie>50?160:140,M=ie>100?60:50,K=Math.max(U,ie*12),D=Math.max(Z,ie*10),de=KS(G).force("link",RS(V).id(ve=>ve.id).distance(R)).force("charge",WS().strength(je)).force("center",fS(K/2,D/2)).force("collide",zS(M));O.current=de,de.on("tick",()=>{x({nodes:[...G],links:[...V]})}),de.alpha(1).restart();const Se=ie>100?300:150;for(let ve=0;ve<Se;ve++)de.tick();if(de.stop(),x({nodes:[...G],links:[...V]}),G.length>0){let ve=1/0,Fe=1/0,Me=-1/0,$e=-1/0;for(const tt of G){const mt=tt.x??0,he=tt.y??0;mt<ve&&(ve=mt),he<Fe&&(Fe=he),mt>Me&&(Me=mt),he>$e&&($e=he)}const fe=100;C({x:ve-fe,y:Fe-fe,w:Math.max(U,Me-ve+fe*2),h:Math.max(Z,$e-Fe+fe*2)})}return()=>{de.stop()}},[e,u]);const I=B=>{if(typeof B=="string"){const G=m.nodes.find(ne=>ne.id===B);return{x:(G==null?void 0:G.x)??0,y:(G==null?void 0:G.y)??0}}return{x:B.x??0,y:B.y??0}},_=k.useCallback(B=>{B.preventDefault();const G=B.deltaY>0?1.1:.9;C(ne=>{const V=Math.max(200,Math.min(u.width*3,ne.w*G)),U=Math.max(150,Math.min(u.height*3,ne.h*G)),Z=(V-ne.w)/2,ie=(U-ne.h)/2;return{x:ne.x-Z,y:ne.y-ie,w:V,h:U}})},[u]),q=k.useCallback(B=>{B.button===0&&(E.current=!0,N.current={x:B.clientX,y:B.clientY,vx:j.x,vy:j.y})},[j]),W=k.useCallback(B=>{var G;if(z.current){const ne=c.current;if(!ne)return;const V=ne.getBoundingClientRect(),U=j.w/V.width,Z=j.h/V.height,ie=j.x+(B.clientX-V.left)*U,je=j.y+(B.clientY-V.top)*Z;z.current.fx=ie,z.current.fy=je,(G=O.current)==null||G.alpha(.3).restart();return}if(E.current){const ne=(B.clientX-N.current.x)*(j.w/u.width),V=(B.clientY-N.current.y)*(j.h/u.height);C(U=>({...U,x:N.current.vx-ne,y:N.current.vy-V}))}},[j,u]),Y=k.useCallback(()=>{E.current=!1,z.current&&(z.current.fx=null,z.current.fy=null,z.current=null)},[]),T=k.useCallback((B,G)=>{var ne;B.stopPropagation(),z.current=G,(ne=O.current)==null||ne.alpha(.3).restart()},[]);return s.jsxs("div",{ref:i,className:"relative flex-1 overflow-hidden",style:{background:"#1e1e2e"},children:[s.jsxs("svg",{ref:c,width:u.width,height:u.height,viewBox:`${j.x} ${j.y} ${j.w} ${j.h}`,style:{display:"block",cursor:E.current?"grabbing":"grab"},onWheel:_,onMouseDown:q,onMouseMove:W,onMouseUp:Y,onMouseLeave:Y,children:[s.jsx("defs",{children:s.jsx("pattern",{id:"grid",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:s.jsx("circle",{cx:"0",cy:"0",r:"0.5",fill:"rgba(255,255,255,0.06)"})})}),s.jsx("rect",{x:j.x-100,y:j.y-100,width:j.w+200,height:j.h+200,fill:"url(#grid)",pointerEvents:"none"}),m.links.map((B,G)=>{const ne=I(B.source),V=I(B.target),U=y===G,Z=(ne.x+V.x)/2,ie=(ne.y+V.y)/2;return s.jsxs("g",{children:[s.jsx("line",{x1:ne.x,y1:ne.y,x2:V.x,y2:V.y,stroke:"transparent",strokeWidth:12,style:{cursor:"default"},onMouseEnter:()=>b(G),onMouseLeave:()=>b(null)}),s.jsx("line",{x1:ne.x,y1:ne.y,x2:V.x,y2:V.y,stroke:U?"rgba(148,163,184,0.7)":"rgba(148,163,184,0.3)",strokeWidth:U?2:1.5,strokeDasharray:"4 3",pointerEvents:"none"}),U&&B.label&&s.jsx("text",{x:Z,y:ie-6,textAnchor:"middle",fill:"#e2e8f0",fontSize:9,fontFamily:"monospace",style:{pointerEvents:"none"},children:s.jsx("tspan",{style:{filter:"drop-shadow(0 0 2px rgba(0,0,0,0.8))"},children:B.label.length>30?B.label.slice(0,28)+"..":B.label})})]},G)}),m.nodes.map(B=>{const G=Zs[B.category]??Zs.general,ne=B.akb_type==="hub",V=ne?24:16,U=(f==null?void 0:f.id)===B.id,Z=r===B.id,ie=U?1.2:Z?1.15:1;return s.jsxs("g",{transform:`translate(${B.x??0}, ${B.y??0}) scale(${ie})`,style:{cursor:"pointer",transition:"transform 0.15s ease"},onClick:je=>{je.stopPropagation();const R=e.find(M=>M.id===B.id);R&&l(R)},onMouseDown:je=>T(je,B),onMouseEnter:je=>{var M;g(B);const R=(M=i.current)==null?void 0:M.getBoundingClientRect();R&&S({x:je.clientX-R.left,y:je.clientY-R.top})},onMouseLeave:()=>g(null),children:[Z&&s.jsx("rect",{x:-V/2-4,y:-V/2-4,width:V+8,height:V+8,fill:"none",stroke:"#22c55e",strokeWidth:2,rx:ne?5:2,opacity:.6}),s.jsx("rect",{x:-V/2,y:-V/2,width:V,height:V,fill:G.border,rx:ne?4:2,opacity:U?1:.9}),s.jsx("rect",{x:-V/2+3,y:-V/2+3,width:Math.max(0,V-6),height:Math.max(0,V-6),fill:G.bg,rx:ne?3:1}),s.jsx("text",{y:V/2+14,textAnchor:"middle",fill:Z?"#e2e8f0":"#94a3b8",fontSize:11,fontFamily:"monospace",fontWeight:Z?"bold":"normal",style:{pointerEvents:"none"},children:B.title.length>24?B.title.slice(0,22)+"..":B.title})]},B.id)})]}),f&&!z.current&&s.jsxs("div",{className:"absolute z-10 pointer-events-none p-2.5 rounded text-xs max-w-[240px]",style:{left:Math.min(v.x+16,u.width-250),top:Math.max(v.y-30,8),background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",boxShadow:"0 4px 12px rgba(0,0,0,0.4)"},children:[s.jsx("div",{className:"font-bold mb-1",children:f.title}),s.jsxs("div",{className:"text-[10px] opacity-60 mb-1",children:[f.akb_type.toUpperCase()," / ",f.category]}),(($=e.find(B=>B.id===f.id))==null?void 0:$.tldr)&&s.jsx("div",{className:"text-[10px] opacity-80 mb-1",children:e.find(B=>B.id===f.id).tldr}),s.jsx("div",{className:"text-[10px] text-green-400",children:"Click to open | Drag to move"})]}),e.length===0&&s.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"No knowledge documents found"})]})}function JS({doc:e,allDocs:l,onOpen:r,onNavigateDoc:i}){const[c,u]=k.useState(!1),d=QS(e.category),m=e.akb_type==="hub",x=new Set(l.map(f=>f.id));return s.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:[s.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>u(!c),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:"shrink-0 text-sm",children:m?"🗂":e.format==="html"?"🌐":"📄"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[s.jsx("span",{className:"font-semibold text-xs truncate",style:{color:"var(--terminal-text)"},children:e.title}),s.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:e.status==="active"?"#16a34a":e.status==="draft"?"#f59e0b":"#94a3b8"},title:e.status})]}),s.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:e.tags.slice(0,4).map(f=>s.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium",style:{background:d.bg,color:d.text,border:`1px solid ${d.border}`},children:f},f))})]}),s.jsx("span",{className:"text-xs shrink-0",style:{color:"var(--terminal-text-muted)"},children:c?"▲":"▼"})]}),!c&&e.tldr&&s.jsx("div",{className:"mt-1.5 text-[10px] line-clamp-2 ml-6",style:{color:"var(--terminal-text-secondary)"},children:e.tldr})]}),c&&s.jsxs("div",{className:"px-3 pb-3",style:{borderTop:"1px solid var(--terminal-border)"},children:[e.tldr&&s.jsx("div",{className:"mt-2 text-[11px] leading-relaxed italic",style:{color:"var(--terminal-text-secondary)"},children:e.tldr}),e.links.length>0&&s.jsxs("div",{className:"mt-2",children:[s.jsx("div",{className:"text-[9px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Cross-links"}),s.jsx("div",{className:"flex flex-wrap gap-1",children:e.links.slice(0,5).map((f,g)=>{const y=f.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,""),b=x.has(y);return s.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:["🔗"," ",f.text]},g)})})]}),s.jsxs("button",{className:"mt-2 text-[10px] font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},onClick:f=>{f.stopPropagation(),r(e)},children:["Open full ","→"]})]})]})}function PS({docId:e,onBack:l,onDocUpdated:r,onDelete:i,onNavigateDoc:c,allDocs:u}){const[d,m]=k.useState(null),[x,f]=k.useState(!0),[g,y]=k.useState(!1),[b,v]=k.useState(""),[S,j]=k.useState(!1),C=new Set(u.map(I=>I.id)),E=k.useCallback(I=>{const _=I.split("#")[0];if(!_.match(/\.(md|html)$/))return null;const q=e.includes("/")?e.replace(/\/[^/]+$/,""):"";let W;if(_.startsWith("./"))W=q?`${q}/${_.slice(2)}`:_.slice(2);else if(_.startsWith("../")){const $=q.split("/").filter(Boolean);let B=_;for(;B.startsWith("../");)$.length>0&&$.pop(),B=B.slice(3);W=$.length>0?`${$.join("/")}/${B}`:B}else W=_;if(C.has(W))return W;const Y=W.split("/").pop()??"",T=u.find($=>$.id===Y||$.id.endsWith("/"+Y));return T?T.id:null},[e,C,u]),N=k.useCallback(I=>{const q=I.target.closest("a");if(!q)return;const W=q.getAttribute("href");if(!W||W.startsWith("http://")||W.startsWith("https://")||!W.match(/\.(md|html)(#.*)?$/))return;I.preventDefault(),I.stopPropagation();const Y=E(W);Y&&c(Y)},[E,c]);k.useEffect(()=>{f(!0),Ce.getKnowledgeDoc(e).then(I=>{m(I),v(I.content)}).catch(console.error).finally(()=>f(!1))},[e]);const z=async()=>{if(d){j(!0);try{await Ce.updateKnowledgeDoc(e,b),m({...d,content:b}),y(!1),r()}catch(I){console.error("Save failed:",I)}finally{j(!1)}}},O=async()=>{if(confirm(`Delete "${d==null?void 0:d.title}"?`))try{await Ce.deleteKnowledgeDoc(e),i(e)}catch(I){console.error("Delete failed:",I)}};return x?s.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Loading..."}):d?s.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col",children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Back"]}),s.jsx("div",{className:"flex-1"}),g?s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>{y(!1),v(d.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"}),s.jsx("button",{onClick:z,disabled:S,className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold text-white",style:{background:S?"#86efac":"#16a34a"},children:S?"Saving...":"Save"})]}):s.jsxs(s.Fragment,{children:[s.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"}),s.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"})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[s.jsx("h2",{className:"text-sm font-bold mb-1",style:{color:"var(--terminal-text)"},children:d.title}),d.tldr&&!g&&s.jsx("div",{className:"mb-3 text-xs italic",style:{color:"var(--terminal-text-secondary)"},children:d.tldr}),d.format==="html"?g?s.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:I=>v(I.target.value),spellCheck:!1}):s.jsx("iframe",{srcDoc:d.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:d.title}):g?s.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:I=>v(I.target.value),spellCheck:!1}):s.jsx("div",{className:"text-xs leading-relaxed",style:{color:"var(--terminal-text-secondary)"},onClick:N,children:s.jsx(no,{content:d.content})})]})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Failed to load document"})}function eC({onCreated:e,onCancel:l}){const[r,i]=k.useState(""),[c,u]=k.useState(""),[d,m]=k.useState(""),[x,f]=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}f(!0),y("");try{const v=await Ce.createKnowledgeDoc({filename:c,title:r,category:d||void 0});e(v.id)}catch(v){y(v instanceof Error?v.message:"Failed to create")}finally{f(!1)}};return s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[s.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Cancel"]}),s.jsx("h2",{className:"text-sm font-bold",style:{color:"var(--terminal-text)"},children:"New Document"})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"TITLE"}),s.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)"}})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"FILENAME"}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.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)"}}),s.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:".md"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"CATEGORY (optional)"}),s.jsx("input",{type:"text",value:d,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&&s.jsx("div",{className:"text-[10px] px-3 py-1.5 rounded",style:{background:"rgba(239,68,68,0.15)",color:"#f87171"},children:g}),s.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 tC=500,C0=360,E0=700;function Oh(e){const[l,r]=k.useState(tC),[i,c]=k.useState(!1),u=k.useRef(0),d=k.useRef(0),m=e>0,x=m?e:0,f=m?Math.max(C0,window.innerWidth-e-100):E0,g=Math.min(l,f),y=k.useCallback(b=>{b.preventDefault(),u.current=b.clientX,d.current=g,c(!0);const v=j=>{const C=u.current-j.clientX,E=Math.min(E0,Math.max(C0,d.current+C));r(E)},S=()=>{c(!1),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",S)};document.addEventListener("mousemove",v),document.addEventListener("mouseup",S)},[g]);return{panelRight:x,panelWidth:g,isResizing:i,handleResizeStart:y}}function nC({docs:e,onClose:l,onRefresh:r,terminalWidth:i=0,initialDocId:c}){const[u,d]=k.useState("list"),[m,x]=k.useState("all"),[f,g]=k.useState(c??null),[y,b]=k.useState(""),[v,S]=k.useState(!1),[j,C]=k.useState(null),{panelRight:E,panelWidth:N,isResizing:z,handleResizeStart:O}=Oh(i),I=["all",...Array.from(new Set(e.map($=>$.category))).sort()],_=e.filter($=>{if(m!=="all"&&$.category!==m)return!1;if(y){const B=y.toLowerCase();return $.title.toLowerCase().includes(B)||($.tldr??"").toLowerCase().includes(B)||$.tags.some(G=>G.toLowerCase().includes(B))}return!0}),q=$=>{S(!1),r(),g($)},W=$=>{g(null),r()},Y=$=>{C($.id)},T=j?e.find($=>$.id===j):null;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:E},onClick:l}),s.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${z?"resizing":""}`,style:{right:E,width:N,background:"var(--terminal-bg)",borderLeftColor:"#16a34a"},children:[s.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${z?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:O}),s.jsxs("div",{className:"p-5 text-white relative",style:{background:"#16a34a"},children:[s.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:"×"}),s.jsxs("div",{className:"text-lg font-bold",children:["📚"," Knowledge Base"]}),s.jsxs("div",{className:"text-xs opacity-80 mt-0.5",children:[e.length," documents"]})]}),s.jsxs("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx(N0,{label:"List",active:u==="list",onClick:()=>{d("list"),C(null)}}),s.jsx(N0,{label:"Graph",active:u==="graph",onClick:()=>d("graph")})]}),u==="list"&&!f&&!v&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx("input",{type:"text",value:y,onChange:$=>b($.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)"}}),s.jsx("button",{onClick:()=>S(!0),className:"px-2.5 py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white shrink-0",style:{background:"#16a34a"},children:"+ New"})]}),s.jsx("div",{className:"flex overflow-x-auto shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",scrollbarWidth:"none"},children:I.map($=>s.jsx("button",{onClick:()=>x($),className:"px-3 py-1.5 text-[10px] font-medium cursor-pointer whitespace-nowrap",style:{color:m===$?"#4ade80":"var(--terminal-text-muted)",borderBottom:m===$?"2px solid #4ade80":"2px solid transparent"},children:$==="all"?`All (${e.length})`:`${$} (${e.filter(B=>B.category===$).length})`},$))}),s.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:_.length===0?s.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"}):_.map($=>s.jsx(JS,{doc:$,allDocs:e,onOpen:B=>g(B.id),onNavigateDoc:B=>g(B)},$.id))})]}),u==="list"&&f&&!v&&s.jsx(PS,{docId:f,onBack:()=>g(null),onDocUpdated:r,onDelete:W,onNavigateDoc:$=>g($),allDocs:e}),u==="list"&&v&&s.jsx(eC,{onCreated:q,onCancel:()=>S(!1)}),u==="graph"&&s.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[s.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[s.jsx(ZS,{docs:e,onNodeClick:Y,selectedDocId:j}),T&&s.jsxs("div",{className:"shrink-0 overflow-y-auto p-3",style:{width:200,background:"var(--hud-bg-alt)",borderLeft:"1px solid var(--terminal-border)"},children:[s.jsx("div",{className:"text-[10px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Selected"}),s.jsx("div",{className:"text-xs font-bold mb-1",style:{color:"var(--terminal-text)"},children:T.title}),s.jsx("div",{className:"w-2 h-2 rounded-full mb-2",style:{background:T.status==="active"?"#16a34a":T.status==="draft"?"#f59e0b":"#94a3b8"}}),T.tldr&&s.jsx("div",{className:"text-[10px] mb-2 leading-relaxed",style:{color:"var(--terminal-text-secondary)"},children:T.tldr}),T.links.length>0&&s.jsxs("div",{className:"mb-2",children:[s.jsx("div",{className:"text-[9px] font-bold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Links"}),T.links.slice(0,5).map(($,B)=>s.jsxs("div",{className:"text-[9px] mb-0.5 truncate",style:{color:"var(--terminal-text-secondary)"},children:["🔗"," ",$.text]},B))]}),s.jsx("button",{className:"w-full py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white",style:{background:"#16a34a"},onClick:()=>{d("list"),g(T.id),C(null)},children:"Open Document"})]})]}),s.jsx("div",{className:"shrink-0 p-2",style:{borderTop:"1px solid var(--terminal-border)"},children:s.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(Zs).map(([$,B])=>s.jsxs("div",{className:"flex items-center gap-1 text-[9px]",children:[s.jsx("div",{className:"w-2 h-2",style:{background:B.border}}),s.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:$})]},$))})})]})]})]})}function N0({label:e,active:l,onClick:r}){return s.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:e})}function lC({standups:e,waves:l,decisions:r,mode:i,onClose:c,terminalWidth:u=0}){const[d,m]=k.useState(i==="decisions"?"decisions":"standups"),{panelRight:x,panelWidth:f,isResizing:g,handleResizeStart:y}=Oh(u);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:x},onClick:c}),s.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${g?"resizing":""}`,style:{right:x,width:f,background:"var(--terminal-bg)",borderLeftColor:"var(--desk-wood)"},children:[s.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${g?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:y}),s.jsxs("div",{className:"p-5 bg-[var(--desk-wood)] text-white relative",children:[s.jsx("button",{onClick:c,className:"absolute top-3 right-3 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),s.jsx("div",{className:"text-lg font-bold",children:i==="bulletin"?"📌 Bulletin Board":"📜 Decision Log"})]}),s.jsx("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:i==="bulletin"?s.jsxs(s.Fragment,{children:[s.jsx(Ef,{label:`Standups (${e.length})`,active:d==="standups",onClick:()=>m("standups")}),s.jsx(Ef,{label:`Waves (${l.length})`,active:d==="waves",onClick:()=>m("waves")})]}):s.jsx(Ef,{label:`Decisions (${r.length})`,active:d==="decisions",onClick:()=>m("decisions")})}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[d==="standups"&&e.map((b,v)=>s.jsx(Nf,{title:`Standup ${b.date}`,content:b.content},v)),d==="waves"&&l.map((b,v)=>s.jsx(Nf,{title:`Wave ${b.id}`,subtitle:b.timestamp,content:b.content},v)),d==="decisions"&&r.map((b,v)=>s.jsx(Nf,{title:`#${b.id} ${b.title}`,subtitle:b.date,content:b.content},v))]})]})]})}function Ef({label:e,active:l,onClick:r}){return s.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:e})}function rC(e){return e.replace(/^#{1,6}\s+/gm,"").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/```[\s\S]*?```/g,"").replace(/^\s*[-*+]\s+/gm,"• ").replace(/^\s*\d+\.\s+/gm,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/^>\s+/gm,"").replace(/^---+$/gm,"").replace(/\|[^|]*\|/g,"").replace(/\n{2,}/g," · ").replace(/\n/g," ").trim()}function Nf({title:e,subtitle:l,content:r}){const[i,c]=k.useState(!1),u=r.length>100,d=rC(r).slice(0,160);return s.jsxs("div",{className:"mb-3 rounded-lg overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>c(!i),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"font-medium text-sm",style:{color:"var(--terminal-text)"},children:e}),s.jsx("span",{className:"text-xs shrink-0 ml-2",style:{color:"var(--terminal-text-muted)"},children:i?"▲":"▼"})]}),l&&s.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--terminal-text-muted)"},children:l})]}),i&&s.jsx("div",{className:"px-3 pb-3 text-xs leading-relaxed pt-2",style:{borderTop:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:s.jsx(no,{content:r})}),!i&&u&&s.jsx("div",{className:"px-3 pb-2 text-xs line-clamp-2 leading-relaxed",style:{color:"var(--terminal-text-muted)"},children:d})]})}function aC({projectId:e,onClose:l,terminalWidth:r=0}){const[i,c]=k.useState(null),{panelRight:u,panelWidth:d,isResizing:m,handleResizeStart:x}=Oh(r);if(k.useEffect(()=>{Ce.getProject(e).then(c).catch(console.error)},[e]),!i)return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),s.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px] border-[var(--meeting-blue)]",style:{right:u,width:d,background:"var(--terminal-bg)"},children:s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading project..."})})]});const f=i.tasks.filter(b=>b.status==="done").length,g=i.tasks.length,y=g>0?Math.round(f/g*100):0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),s.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] border-[var(--meeting-blue)] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${m?"resizing":""}`,style:{right:u,width:d,background:"var(--terminal-bg)"},children:[s.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${m?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:x}),s.jsxs("div",{className:"p-5 bg-[var(--meeting-blue)] text-white relative",children:[s.jsx("div",{className:"text-sm opacity-70",children:"Meeting Room"}),s.jsx("button",{onClick: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:"×"}),s.jsx("div",{className:"text-xl font-bold mt-1",children:i.name}),s.jsxs("div",{className:"flex items-center gap-3 mt-3 text-sm",children:[s.jsxs("span",{children:["Tasks: ",g]}),s.jsxs("span",{children:["Done: ",f]}),s.jsxs("span",{children:["Progress: ",y,"%"]})]}),s.jsx("div",{className:"mt-2 h-1.5 bg-white/20 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-white rounded-full transition-all",style:{width:`${y}%`}})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[i.prd&&s.jsxs("div",{className:"mb-5",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"PRD"}),s.jsx("div",{className:"rounded-lg p-4 text-xs leading-relaxed max-h-60 overflow-y-auto",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:s.jsx(no,{content:i.prd})})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:["Tasks (",g,")"]}),s.jsx("div",{className:"space-y-2",children:i.tasks.map(b=>s.jsxs("div",{className:"rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sm font-medium",style:{color:"var(--terminal-text)"},children:b.title}),s.jsx(iC,{status:b.status})]}),s.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-muted)"},children:b.role}),b.description&&s.jsx("div",{className:"text-xs mt-1.5 line-clamp-2",style:{color:"var(--terminal-text-secondary)"},children:b.description})]},b.id))})]})]})]})]})}function iC({status:e}){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[e]??l.todo;return s.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:r.bg,color:r.color},children:e})}const sC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function oC({roleId:e,roleName:l,mode:r="assign",onClose:i,onExecutionStart:c}){const[u,d]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const x=()=>{u.trim()&&(c(e,u.trim()),i())},f=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&x(),y.key==="Escape"&&i()},g=sC[e]??"#666";return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[520px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[s.jsxs("div",{className:"p-5 text-white",style:{background:`linear-gradient(135deg, ${g}, ${g}cc)`},children:[s.jsx("div",{className:"text-lg font-bold",children:r==="ask"?"Ask":"Assign Task"}),s.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:r==="ask"?`to ${l}`:`to ${l} (${e})`})]}),s.jsxs("div",{className:"p-5",children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Task Description"}),s.jsx("textarea",{ref:m,value:u,onChange:y=>d(y.target.value),onKeyDown:f,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"}),s.jsx("div",{className:"text-[10px] text-white/30 mt-1",children:"Cmd+Enter to submit"})]}),s.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[s.jsx("button",{onClick:i,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),s.jsx("button",{onClick:x,disabled:!u.trim(),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:g},children:r==="ask"?"Ask":"Assign"})]})]})]})}const A0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function bg({event:e,isThinkingCollapsed:l,onToggleThinking:r,onNavigateToJob:i,onOpenKnowledgeDoc:c,compact:u}){var m;const d=A0[e.roleId]??"#888";switch(e.type){case"text":{const x=e.data.text??"",f=u?x.slice(0,300):x;return/[#*|`\[\]_~>-]/.test(f)?s.jsx("div",{className:"text-green-300/90 leading-relaxed event-markdown",children:s.jsx(Eh,{remarkPlugins:[Th],children:f})}):s.jsx("div",{className:"text-green-300/90 whitespace-pre-wrap leading-relaxed",children:f})}case"thinking":{const x=e.data.text??"";return s.jsxs("div",{className:"group",children:[s.jsxs("button",{onClick:r,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-[10px] cursor-pointer flex items-center gap-1 select-text",children:[s.jsx("span",{children:l?"▶":"▼"}),s.jsx("span",{className:"italic",children:"thinking..."})]}),!l&&s.jsxs("div",{className:`ml-3 text-[var(--terminal-text-muted)] italic whitespace-pre-wrap opacity-60 text-[11px] overflow-hidden ${u?"max-h-[60px]":"max-h-[120px]"}`,children:[x.slice(0,u?200:500),x.length>(u?200:500)?"...":""]})]})}case"tool:start":{const x=String(e.data.name??""),f=e.data.input,g=typeof(f==null?void 0:f.command)=="string"?f.command.slice(0,80):"",y=typeof(f==null?void 0:f.file_path)=="string"?String(f.file_path):typeof(f==null?void 0:f.path)=="string"?String(f.path):"",b=y?y.split("/").pop()??"":"",v=/^(write_file|Write|edit_file|Edit)$/i.test(x),S=(m=y.match(/(?:^|\/)knowledge\/(.+\.md)$/))==null?void 0:m[1],j=v&&S&&c;return s.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[s.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${j?"text-green-400/80 bg-green-400/10":"text-blue-400/80 bg-blue-400/10"}`,children:j?v&&x.toLowerCase().includes("edit")?"Edit":"Write":x}),j?s.jsx("button",{onClick:()=>c(S),className:"text-[10px] text-green-400 hover:text-green-300 underline underline-offset-2 cursor-pointer truncate",style:{maxWidth:u?200:400},children:b}):s.jsxs(s.Fragment,{children:[g&&s.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:g}),b&&s.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:b})]})]})}case"dispatch:start":{const x=e.data.targetRoleId??e.data.roleId??"",f=e.data.task??"",g=e.data.childJobId,y=A0[x]??"#888";return s.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:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{style:{color:y},className:"font-bold text-[11px]",children:["→"," ",x.toUpperCase()]}),s.jsx("span",{className:"text-[var(--terminal-text-secondary)] text-[10px] truncate flex-1",children:f.slice(0,u?60:100)}),g&&i&&s.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/10 text-[var(--terminal-text-muted)]",children:["View ","→"]})]})})}case"dispatch:done":return s.jsx("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pl-3 border-l-2 border-[var(--terminal-border)] my-0.5",children:"Dispatch completed"});case"turn:complete":return s.jsx("div",{className:"border-t border-[var(--terminal-border)] my-2 relative",children:s.jsxs("span",{className:"absolute -top-2 left-2 bg-[var(--terminal-bg)] px-2 text-[9px] text-[var(--terminal-text-muted)]",children:["Turn ",e.data.turn]})});case"stderr":return s.jsxs("div",{className:"text-red-400/80 text-[11px]",children:["⚠"," ",e.data.message]});case"job:start":return s.jsxs("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pb-1",children:[s.jsx("span",{style:{color:d},className:"font-bold",children:e.roleId.toUpperCase()})," ","started: ",(e.data.task??"").slice(0,u?50:80)]});case"job:done":{const x=e.data.turns??0,f=e.data.toolCalls??0;return s.jsx("div",{className:"mt-2 p-2 rounded-lg bg-green-900/20 border border-green-800/30",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-green-400"}),s.jsx("span",{className:"text-green-300 font-bold text-[11px]",children:"Complete"}),s.jsxs("span",{className:"text-[var(--terminal-text-muted)] text-[10px]",children:[x," turns · ",f," tools"]})]})})}case"job:error":return s.jsx("div",{className:"mt-2 p-2 rounded-lg bg-red-900/20 border border-red-800/30",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-red-400"}),s.jsx("span",{className:"text-red-300 font-bold text-[11px]",children:"Error"}),s.jsx("span",{className:"text-red-200/70 text-[10px]",children:e.data.message})]})});case"job:awaiting_input":{const x=e.data.question??"";return s.jsxs("div",{className:"mt-2 p-2 rounded-lg border",style:{background:"#F59E0B11",borderColor:"#F59E0B33"},children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:"#F59E0B",animation:"wave-pulse 1.5s ease-in-out infinite"}}),s.jsx("span",{className:"font-bold text-[11px]",style:{color:"#F59E0B"},children:"Awaiting Reply"})]}),x&&s.jsx("div",{className:"mt-1 text-[11px] text-[var(--terminal-text)] whitespace-pre-wrap",children:x})]})}case"job:reply":return s.jsx("div",{className:"mt-1 p-2 rounded-lg bg-blue-900/20 border border-blue-800/30",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-blue-300 font-bold text-[11px]",children:"CEO replied:"}),s.jsx("span",{className:"text-blue-200/80 text-[11px]",children:e.data.response??""})]})});case"import:scan":case"import:process":case"import:created":return s.jsxs("div",{className:"text-cyan-300/70 text-[11px]",children:["[",e.type,"] ",JSON.stringify(e.data)]});default:return null}}function cC({jobId:e,title:l,color:r,variant:i,style:c,onClose:u,onMinimize:d,onDone:m,onNavigateToJob:x,onOpenKnowledgeDoc:f}){const{events:g,status:y,textOutput:b,childJobIds:v}=P0(e),[S,j]=k.useState(0),[C,E]=k.useState(new Set),N=k.useRef(null),z=k.useRef(Date.now()),O=k.useRef(!1);k.useEffect(()=>{const $=setInterval(()=>{j(Math.floor((Date.now()-z.current)/1e3))},1e3);return()=>clearInterval($)},[]),k.useEffect(()=>{N.current&&(N.current.scrollTop=N.current.scrollHeight)},[g]),k.useEffect(()=>{(y==="done"||y==="error")&&!O.current&&(O.current=!0,m==null||m())},[y,m]);const I=$=>{E(B=>{const G=new Set(B);return G.has($)?G.delete($):G.add($),G})},_={idle:"Waiting",connecting:"Connecting...",streaming:"Working",done:"Complete",error:"Error"}[y],q={idle:"#888",connecting:"#888",streaming:r,done:"#2E7D32",error:"#C62828"}[y],W=$=>`${Math.floor($/60)}:${String($%60).padStart(2,"0")}`,Y=y==="done"||y==="error",T=s.jsxs("div",{className:i==="modal"?"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] h-[85vh] z-[61] bg-[var(--terminal-bg)] rounded-2xl shadow-2xl overflow-hidden flex flex-col":"bg-[var(--terminal-bg)] rounded-xl border border-[var(--terminal-border)] overflow-hidden flex flex-col max-h-[400px]",style:c,children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{background:q}}),s.jsx("div",{children:s.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:l})})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:W(S)}),s.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:`${q}22`,color:q},children:_}),d&&i==="modal"&&s.jsx("button",{onClick:d,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),Y&&s.jsx("button",{onClick:u,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),s.jsxs("div",{ref:N,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[g.length===0&&y==="connecting"&&s.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:"Connecting to activity stream..."}),g.map($=>s.jsx(bg,{event:$,isThinkingCollapsed:C.has($.seq),onToggleThinking:()=>I($.seq),onNavigateToJob:x,onOpenKnowledgeDoc:f},$.seq)),y==="streaming"&&s.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),s.jsxs("div",{className:"px-5 py-3 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[s.jsxs("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:[g.length>0&&`${g.length} events`,b.length>0&&` · ${b.length} chars`,v.length>0&&` · ${v.length} dispatches`]}),Y&&s.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"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:Y?u:void 0}),T]}):T}const Af={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function uC({orgNodes:e,rootId:l}){const r=e[l];if(!r)return null;const c=r.children.map(m=>e[m]).filter(Boolean),u=[];for(const m of c)for(const x of m.children){const f=e[x];f&&u.push({node:f,parentId:m.id})}const d=c.length+u.length;return s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Propagation Preview"}),s.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-lg p-4",children:[s.jsx("div",{className:"flex justify-center mb-2",children:s.jsx("span",{className:"px-3 py-1 text-[10px] font-bold rounded border-2 border-white/20 bg-white/5 text-white/30 uppercase",children:"CEO"})}),c.length>0&&s.jsx("div",{className:"flex justify-center mb-1",children:s.jsx("div",{className:"w-px h-3 bg-white/15"})}),c.length>1&&s.jsx("div",{className:"flex justify-center mb-1",children:s.jsx("div",{className:"h-px bg-white/15",style:{width:`${Math.min(c.length*80,320)}px`}})}),s.jsx("div",{className:"flex justify-center gap-3 mb-2 flex-wrap",children:c.map(m=>s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("span",{className:"px-2.5 py-1 text-[10px] font-bold rounded border-2 uppercase",style:{borderColor:Af[m.id]??"#888",color:Af[m.id]??"#888",background:`${Af[m.id]??"#888"}22`},children:m.id}),s.jsx("span",{className:"text-[8px] text-white/30 mt-0.5",children:"direct"})]},m.id))}),u.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex justify-center mb-1",children:s.jsx("div",{className:"w-px h-2 bg-white/10"})}),s.jsx("div",{className:"flex justify-center gap-2 flex-wrap",children:u.map(({node:m})=>s.jsx("span",{className:"px-2 py-0.5 text-[9px] font-semibold rounded border border-white/15 text-white/40 uppercase",children:m.id},m.id))}),s.jsx("div",{className:"text-center text-[8px] text-white/30 mt-1",children:"via re-dispatch"})]})]}),s.jsxs("div",{className:"text-[10px] text-gray-400 mt-1.5",children:[d," role",d!==1?"s":""," will receive this wave"]})]})}function dC({cLevelRoles:e,orgNodes:l,rootId:r,onClose:i,onDispatch:c}){const[u,d]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const x=()=>{!u.trim()||e.length===0||(c(u.trim()),i())},f=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&x(),y.key==="Escape"&&i()},g=r&&Object.keys(l).length>0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[560px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[s.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[s.jsx("div",{className:"text-lg font-bold",children:"CEO Wave"}),s.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:"Broadcast a directive to all C-Level reports"})]}),s.jsxs("div",{className:"p-5 space-y-4",children:[g&&s.jsx(uC,{orgNodes:l,rootId:r}),!g&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Dispatching to"}),s.jsx("div",{className:"flex gap-2 flex-wrap",children:e.length>0?e.map(y=>s.jsxs("span",{className:"px-3 py-1.5 text-xs font-semibold rounded-lg border-2 border-red-200 bg-red-50 text-red-800",children:[y.id.toUpperCase()," · ",y.name]},y.id)):s.jsx("span",{className:"text-xs text-gray-400 italic",children:"No C-Level roles found"})}),s.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Each C-Level receives the directive and delegates to their reports"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Directive"}),s.jsx("textarea",{ref:m,value:u,onChange:y=>d(y.target.value),onKeyDown:f,placeholder:"e.g. Report current status across all departments",className:"w-full h-28 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),s.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Cmd+Enter to dispatch"})]})]}),s.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[s.jsx("button",{onClick:i,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),s.jsxs("button",{onClick:x,disabled:!u.trim()||e.length===0,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#B71C1C"},children:["Dispatch to ",e.length," Role",e.length!==1?"s":""]})]})]})]})}function fC(e,l,r){const[i,c]=k.useState(new Map),[u,d]=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=j=>{const C=l[j];C&&(b.set(j,{jobId:null,roleId:j,roleName:C.name,children:C.children,status:"waiting",events:[],streamStatus:"idle"}),C.children.forEach(v))},S=l[r];S&&(b.set(r,{jobId:null,roleId:r,roleName:"CEO",children:S.children,status:"not-dispatched",events:[],streamStatus:"idle"}),S.children.forEach(v));for(const j of e){const C=b.get(j.roleId);C&&(C.jobId=j.jobId,C.status="running",C.streamStatus="connecting")}c(b),e.length>0&&d(e[0].roleId)},[e,l,r]);const f=k.useCallback((b,v)=>{const S=m.current.get(b);S&&S.controller.abort();const j=new AbortController,C={controller:j,lastSeq:-1};m.current.set(b,C);const N=`/api/jobs/${b}/stream?from=0`;fetch(N,{signal:j.signal}).then(async z=>{if(!z.ok||!z.body){c(q=>{const W=new Map(q),Y=W.get(v);return Y&&W.set(v,{...Y,streamStatus:"error"}),W});return}c(q=>{const W=new Map(q),Y=W.get(v);return Y&&W.set(v,{...Y,streamStatus:"streaming",status:"running"}),W});const O=z.body.getReader(),I=new TextDecoder;let _="";for(;;){const{done:q,value:W}=await O.read();if(q)break;_+=I.decode(W,{stream:!0});const Y=_.split(`
|
|
81
|
-
`);_=Y.pop()??"";let T="";for(const $ of Y)if($.startsWith("event: "))T=$.slice(7).trim();else if($.startsWith("data: ")){try{const B=JSON.parse($.slice(6));if(T==="activity"){const G=B;G.seq>C.lastSeq&&(C.lastSeq=G.seq),c(ne=>{const V=new Map(ne),U=V.get(v);if(!U||U.events.some(ie=>ie.seq===G.seq))return ne;const Z={...U,events:[...U.events,G]};if(G.type==="dispatch:start"&&G.data.childJobId){const ie=G.data.childJobId,je=G.data.targetRoleId??G.data.roleId;if(je){const R=V.get(je);R&&(V.set(je,{...R,jobId:ie,status:"running",streamStatus:"connecting"}),setTimeout(()=>f(ie,je),0))}}return G.type==="job:done"?(Z.status="done",Z.streamStatus="done"):G.type==="job:error"?(Z.status="error",Z.streamStatus="error"):G.type==="job:awaiting_input"?(Z.status="awaiting_input",Z.streamStatus="done"):G.type==="job:reply"&&(Z.status="running",Z.streamStatus="streaming"),V.set(v,Z),V})}else if(T==="stream:end"){const G=B.reason;G!=="replied"&&c(ne=>{const V=new Map(ne),U=V.get(v);if(!U)return ne;const Z=G==="error"?"error":G==="awaiting_input"?"awaiting_input":"done";return V.set(v,{...U,status:U.status==="running"?Z:U.status,streamStatus:Z==="error"?"error":"done"}),V})}}catch{}T=""}}}).catch(z=>{z.name!=="AbortError"&&c(O=>{const I=new Map(O),_=I.get(v);return _&&I.set(v,{..._,streamStatus:"error"}),I})})},[]);k.useEffect(()=>{if(e.length!==0){for(const b of e)f(b.jobId,b.roleId);return()=>{for(const[,b]of m.current)b.controller.abort();m.current.clear()}}},[e,f]);const g=(()=>{let b=0,v=0,S=0,j=0;for(const[C,E]of i)C!==r&&(j++,E.status==="done"?b++:E.status==="running"?v++:E.status==="awaiting_input"&&S++);return{done:b,total:j,running:v,awaitingInput:S}})(),y=g.total>0&&g.running===0&&g.awaitingInput===0&&Array.from(i.values()).every(b=>b.status!=="running"&&b.status!=="awaiting_input"&&b.streamStatus!=="streaming"&&b.streamStatus!=="connecting");return k.useEffect(()=>{y&&c(b=>{const v=new Map(b);let S=!1;for(const[j,C]of v)C.status==="waiting"&&(v.set(j,{...C,status:"not-dispatched"}),S=!0);return S?v:b})},[y]),{nodes:i,selectedRoleId:u,selectNode:d,progress:g,allDone:y,connectStream:f}}const D0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},Fa=120,xr=44,T0=80;function hC(e,l){if(!e.get(l))return{layout:[],width:300,height:200};const i=[],c=[],u=[{id:l,depth:0,parentId:null}],d=new Set;for(;u.length>0;){const{id:g,depth:y,parentId:b}=u.shift();if(d.has(g))continue;for(d.add(g);c.length<=y;)c.push([]);c[y].push(g),i.push({roleId:g,x:0,y:y*T0+20,parentId:b});const v=e.get(g);if(v)for(const S of v.children)e.has(S)&&!d.has(S)&&u.push({id:S,depth:y+1,parentId:g})}const m=Math.max(...c.map(g=>g.length))*(Fa+16),x=Math.max(m,280);for(const g of c){const y=g.length*(Fa+16)-16,b=(x-y)/2;g.forEach((v,S)=>{const j=i.find(C=>C.roleId===v);j&&(j.x=b+S*(Fa+16))})}const f=c.length*T0+40;return{layout:i,width:x,height:f}}function mC({nodes:e,rootId:l,selectedRoleId:r,onSelectNode:i}){const{layout:c,width:u,height:d}=hC(e,l),m=f=>{const g=c.find(y=>y.roleId===f);return g?{cx:g.x+Fa/2,cy:g.y+xr/2}:{cx:0,cy:0}},x=f=>{switch(f.status){case"running":return D0[f.roleId]??"#FBBF24";case"awaiting_input":return"#F59E0B";case"done":return"#2E7D32";case"error":return"#C62828";case"not-dispatched":return"#666";default:return"#888"}};return s.jsxs("svg",{viewBox:`0 0 ${u} ${d}`,width:Math.max(u,280),height:d,className:"block",style:{minWidth:u},children:[s.jsx("defs",{children:s.jsxs("filter",{id:"glow",children:[s.jsx("feGaussianBlur",{stdDeviation:"2",result:"blur"}),s.jsxs("feMerge",{children:[s.jsx("feMergeNode",{in:"blur"}),s.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),c.filter(f=>f.parentId).map(f=>{const g=m(f.parentId),y=m(f.roleId),b=e.get(f.roleId),v=e.get(f.parentId);let S="rgba(180,200,240,0.15)",j="4 4",C="";return(b==null?void 0:b.status)==="done"||(v==null?void 0:v.status)==="done"?(S="#2E7D3266",j=""):(b==null?void 0:b.status)==="awaiting_input"?(S="#F59E0B",j="6 4",C="wave-edge-flow"):(b==null?void 0:b.status)==="running"&&(S=D0[f.roleId]??"#FBBF24",j="6 4",C="wave-edge-flow"),s.jsx("line",{x1:g.cx,y1:g.cy+xr/2-4,x2:y.cx,y2:y.cy-xr/2+4,stroke:S,strokeWidth:1.5,strokeDasharray:j,className:C},`${f.parentId}-${f.roleId}`)}),c.map(f=>{const g=e.get(f.roleId);if(!g)return null;const y=x(g),b=r===f.roleId,v=f.roleId===l,S=v?.4:g.status==="not-dispatched"?.35:1;return s.jsxs("g",{transform:`translate(${f.x}, ${f.y})`,style:{cursor:v?"default":"pointer",opacity:S},onClick:()=>!v&&i(f.roleId),children:[s.jsx("rect",{x:0,y:0,width:Fa,height:xr,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":""}),s.jsx("circle",{cx:14,cy:xr/2,r:4,fill:y,filter:g.status==="running"||g.status==="awaiting_input"?"url(#glow)":void 0,children:(g.status==="running"||g.status==="awaiting_input")&&s.jsx("animate",{attributeName:"opacity",values:"1;0.4;1",dur:"1.5s",repeatCount:"indefinite"})}),s.jsx("text",{x:26,y:xr/2-4,fill:"var(--terminal-text, #fff)",fontSize:10,fontWeight:700,fontFamily:"var(--pixel-font)",children:g.roleId.toUpperCase()}),s.jsx("text",{x:26,y:xr/2+10,fill:"var(--terminal-text-muted, #888)",fontSize:8,fontFamily:"var(--pixel-font)",children:g.status==="running"?"Working...":g.status==="awaiting_input"?"Awaiting Reply":g.status==="done"?"Complete":g.status==="error"?"Error":g.status==="waiting"?"Waiting":""}),g.status==="done"&&s.jsx("text",{x:Fa-18,y:xr/2+4,fontSize:14,fill:"#2E7D32",children:"✓"}),g.status==="error"&&s.jsx("text",{x:Fa-18,y:xr/2+4,fontSize:14,fill:"#C62828",children:"✗"})]},f.roleId)})]})}const xC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function pC({directive:e,rootJobs:l,orgNodes:r,rootRoleId:i,onClose:c,onMinimize:u,onDone:d,onOpenKnowledgeDoc:m,onSave:x}){const{nodes:f,selectedRoleId:g,selectNode:y,progress:b,allDone:v,connectStream:S}=fC(l,r,i),[j,C]=k.useState(0),[E,N]=k.useState(new Set),[z,O]=k.useState(""),[I,_]=k.useState(!1),[q,W]=k.useState(!1),Y=k.useRef(null),T=k.useRef(Date.now()),$=k.useRef(!1),B=k.useCallback(async()=>{if(x){W(!0);try{const M=l.map(K=>K.jobId);await x(M)}catch(M){console.error("Save failed:",M)}finally{W(!1),c()}}},[x,l,c]),G=k.useCallback(async()=>{if(!g||!z.trim())return;const M=f.get(g);if(!(!(M!=null&&M.jobId)||M.status!=="awaiting_input")){_(!0);try{const{jobId:K}=await Ce.replyToJob(M.jobId,z.trim());O(""),S(K,g)}catch(K){console.error("Reply failed:",K)}finally{_(!1)}}},[g,z,f,S]),ne=k.useCallback(async M=>{const K=f.get(M);if(K!=null&&K.jobId)try{await Ce.abortJob(K.jobId)}catch(D){console.error("Abort failed:",D)}},[f]),V=k.useCallback(async()=>{for(const[,M]of f)if((M.status==="running"||M.status==="awaiting_input")&&M.jobId)try{await Ce.abortJob(M.jobId)}catch{}},[f]);k.useEffect(()=>{const M=setInterval(()=>{C(Math.floor((Date.now()-T.current)/1e3))},1e3);return()=>clearInterval(M)},[]);const U=k.useRef(!1);k.useEffect(()=>{const M=Y.current;if(!M)return;const K=()=>{const D=M.scrollHeight-M.scrollTop-M.clientHeight<60;U.current=!D};return M.addEventListener("scroll",K),()=>M.removeEventListener("scroll",K)},[]),k.useEffect(()=>{U.current=!1,Y.current&&(Y.current.scrollTop=Y.current.scrollHeight)},[g]),k.useEffect(()=>{Y.current&&!U.current&&(Y.current.scrollTop=Y.current.scrollHeight)},[f]),k.useEffect(()=>{v&&!$.current&&($.current=!0,d==null||d())},[v,d]);const Z=M=>`${Math.floor(M/60)}:${String(M%60).padStart(2,"0")}`,ie=g?f.get(g):null,je=g?xC[g]??"#888":"#888",R=M=>{N(K=>{const D=new Set(K);return D.has(M)?D.delete(M):D.add(M),D})};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm pointer-events-none"}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[960px] max-w-[95vw] h-[85vh] z-[61] bg-[var(--terminal-bg)] rounded-2xl shadow-2xl overflow-hidden flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:v?"#2E7D32":"#B71C1C",animation:v?void 0:"wave-pulse 2s ease-in-out infinite"}}),s.jsx("div",{children:s.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:v?"WAVE COMPLETE":"WAVE COMMAND CENTER"})})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:Z(j)}),b.awaitingInput>0&&s.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:"#F59E0B22",color:"#F59E0B"},children:[b.awaitingInput," awaiting reply"]}),s.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:v?"#2E7D3222":"#B71C1C22",color:v?"#2E7D32":"#B71C1C"},children:[b.done,"/",b.total," done"]}),!v&&(b.running>0||b.awaitingInput>0)&&s.jsx("button",{onClick:V,className:"text-xs px-2 py-0.5 rounded font-semibold cursor-pointer",style:{background:"#C6282822",color:"#C62828",border:"1px solid #C6282844"},title:"Stop all running jobs",children:"Stop All"}),s.jsx("button",{onClick:u,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),s.jsx("button",{onClick:c,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",title:v?"Dismiss wave":"Close (jobs keep running)",children:"×"})]})]}),s.jsx("div",{className:"px-5 py-2 border-b border-[var(--terminal-border)] shrink-0",children:s.jsxs("span",{className:"text-[var(--terminal-text-secondary)] text-xs italic",children:["“",e,"”"]})}),s.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[s.jsxs("div",{className:"shrink-0 border-b border-[var(--terminal-border)] flex flex-col",children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-1.5",children:[s.jsx("span",{className:"text-[10px] font-bold text-[var(--terminal-text-secondary)] uppercase tracking-wider",children:"Org Propagation"}),s.jsx("div",{className:"flex gap-x-3 ml-auto",children:[{label:"running",color:"#FBBF24",dot:!0},{label:"awaiting",color:"#F59E0B",dot:!0},{label:"done",color:"#2E7D32",dot:!1},{label:"waiting",color:"#888",dot:!1},{label:"error",color:"#C62828",dot:!1}].map(M=>s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:M.color,animation:M.dot?"wave-pulse 1.5s ease-in-out infinite":void 0}}),s.jsx("span",{className:"text-[8px] text-[var(--terminal-text-muted)]",children:M.label})]},M.label))})]}),s.jsx("div",{className:"overflow-x-auto overflow-y-auto px-3 pb-2",style:{maxHeight:"35vh"},children:s.jsx(mC,{nodes:f,rootId:i,selectedRoleId:g,onSelectNode:y})})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[ie&&s.jsxs("div",{className:"px-4 py-2 border-b border-[var(--terminal-border)] shrink-0 flex items-center gap-2",children:[s.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:je}}),s.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-xs",children:ie.roleId.toUpperCase()}),s.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs",children:ie.roleName}),s.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full font-semibold",style:{background:ie.status==="awaiting_input"?"#F59E0B22":`${je}22`,color:ie.status==="awaiting_input"?"#F59E0B":je},children:ie.status==="running"?"Working":ie.status==="done"?"Complete":ie.status==="error"?"Error":ie.status==="waiting"?"Waiting":ie.status==="awaiting_input"?"Awaiting Reply":"Not dispatched"}),(ie.status==="running"||ie.status==="awaiting_input")&&ie.jobId&&s.jsx("button",{onClick:()=>ne(ie.roleId),className:"text-[10px] px-2 py-0.5 rounded font-semibold cursor-pointer ml-1",style:{background:"#C6282822",color:"#C62828",border:"1px solid #C6282844"},title:"Force stop this job",children:"Stop"})]}),s.jsxs("div",{ref:Y,className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-1 text-xs font-mono select-text",children:[ie&&ie.events.length===0&&s.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:ie.status==="waiting"?"Waiting for dispatch...":ie.status==="running"?"Connecting to activity stream...":ie.status==="not-dispatched"?"This role was not dispatched in this wave.":""}),ie==null?void 0:ie.events.map(M=>s.jsx(bg,{event:M,isThinkingCollapsed:E.has(M.seq),onToggleThinking:()=>R(M.seq),onNavigateToJob:K=>{for(const[,D]of f)if(D.jobId===K){y(D.roleId);return}},onOpenKnowledgeDoc:m},M.seq)),(ie==null?void 0:ie.status)==="running"&&s.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),(ie==null?void 0:ie.status)==="awaiting_input"&&s.jsxs("div",{className:"px-4 py-3 border-t border-[var(--terminal-border)] shrink-0",style:{background:"#F59E0B0A"},children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:"#F59E0B",animation:"wave-pulse 1.5s ease-in-out infinite"}}),s.jsxs("span",{className:"text-[11px] font-semibold",style:{color:"#F59E0B"},children:[ie.roleName," is waiting for your response"]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",value:z,onChange:M=>O(M.target.value),onKeyDown:M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),G())},placeholder:"Type your response...",disabled:I,className:"flex-1 px-3 py-1.5 text-xs rounded border bg-[var(--terminal-bg)] text-[var(--terminal-text)] border-[var(--terminal-border)] outline-none focus:border-[#F59E0B]",autoFocus:!0}),s.jsx("button",{onClick:G,disabled:I||!z.trim(),className:"px-4 py-1.5 text-xs rounded font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#F59E0B",color:"#000"},children:I?"...":"Reply"})]})]}),!ie&&s.jsx("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-xs",children:"Click a node in the org tree to view activity"}),s.jsxs("div",{className:"px-4 py-2 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:ie&&ie.events.length>0&&`${ie.events.length} events`}),v&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:c,className:"px-4 py-1.5 text-xs rounded-lg font-semibold cursor-pointer",style:{background:"rgba(255,255,255,0.08)",color:"var(--terminal-text-muted)"},children:"Dismiss"}),x&&s.jsx("button",{onClick:B,disabled:q,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer disabled:opacity-50",style:{background:"#2E7D32"},children:q?"Saving...":"Save Wave"})]})]})]})]})]})]})}const yC={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 Bh(e){return yC[e]??{skinColor:"#B0BEC5",hairColor:"#78909C",shirtColor:"#607D8B",pantsColor:"#455A64",shoeColor:"#37474F"}}const vg=["#FDEBD0","#F5CBA7","#D4A07A","#C68642","#8D5524","#5C3A1E","#F3D1C7","#E8BEAC","#B07D62","#704214"],wg=["#1A0A00","#2C1810","#4E342E","#6D4C41","#8D6E63","#D4A574","#F5E6CA","#FFD700","#B71C1C","#AD1457","#4A148C","#1A237E","#004D40","#1A1A1A","#78909C","#E0E0E0"],kg=["#1565C0","#E65100","#2E7D32","#4A148C","#AD1457","#00695C","#D32F2F","#F57F17","#1B5E20","#283593","#4E342E","#37474F","#880E4F","#00838F","#6A1B9A","#FF6F00"],jg=["#37474F","#1A237E","#3E2723","#263238","#1B5E20","#455A64","#212121","#4E342E","#0D47A1","#311B92"],Sg=["#212121","#1A1A1A","#37474F","#4E342E","#7B1FA2","#D32F2F","#1565C0","#F57F17","#2E7D32","#FFFFFF"],oa={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 gC({color:e,selected:l,onClick:r}){return s.jsx("button",{onClick:r,className:"customize-swatch",style:{background:e,outline:l?"2px solid #fff":"2px solid transparent",boxShadow:l?`0 0 0 1px ${e}, 0 0 6px ${e}88`:"none"}})}function Os({label:e,presets:l,value:r,onChange:i}){return s.jsxs("div",{className:"customize-row",children:[s.jsxs("div",{className:"customize-row-header",children:[s.jsx("span",{className:"customize-row-label",children:e}),s.jsx("div",{className:"customize-row-current",style:{background:r}})]}),s.jsx("div",{className:"customize-swatches",children:l.map(c=>s.jsx(gC,{color:c,selected:c===r,onClick:()=>i(c)},c))})]})}function Df({label:e,items:l,value:r,onChange:i,lockInfo:c}){return s.jsxs("div",{className:"customize-row",children:[s.jsx("div",{className:"customize-row-header",children:s.jsx("span",{className:"customize-row-label",children:e})}),s.jsx("div",{className:"customize-swatches",style:{gap:4},children:l.map(u=>{const d=c?c.getLockLevel(u.id):1,m=u.id===r,x=c?d>c.roleLevel&&!m:!1,f=c?m&&d>c.roleLevel:!1;return s.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?f?"2px solid #F59E0B":"2px solid #fff":"2px solid transparent",color:x?"rgba(255,255,255,0.25)":m?"#fff":"rgba(255,255,255,0.5)",borderRadius:4,cursor:x?"not-allowed":"pointer",opacity:x?.35:1,position:"relative"},children:[u.name,x&&s.jsxs("span",{style:{position:"absolute",bottom:1,left:"50%",transform:"translateX(-50%)",fontSize:8,color:"rgba(255,255,255,0.5)",whiteSpace:"nowrap"},children:["🔒"," Lv.",d]}),f&&s.jsxs("span",{style:{position:"absolute",bottom:-8,left:"50%",transform:"translateX(-50%)",fontSize:7,color:"#F59E0B",whiteSpace:"nowrap"},children:["⚠"," Lv.",d]})]},u.id)})})]})}function Tf({label:e,active:l,onClick:r}){return s.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:e})}function na(e){return e[Math.floor(Math.random()*e.length)]}function Ci(e){var c,u,d;const l=sg(),r=og(),i=cg().filter(m=>!e||dg(m.id,e));return{skinColor:na(vg),hairColor:na(wg),shirtColor:na(kg),pantsColor:na(jg),shoeColor:na(Sg),hairStyle:(c=na(l))==null?void 0:c.id,outfitStyle:(u=na(r))==null?void 0:u.id,accessory:(d=na(i))==null?void 0:d.id}}function Cg({roleId:e,appearance:l,onChange:r,onRandomize:i,onReset:c,label:u,roleLevel:d}){const[m,x]=k.useState("look"),f=k.useCallback((C,E)=>{r({...l,[C]:E})},[l,r]),g=k.useRef(null),y=k.useCallback(C=>{var z;const E=(z=C.target.files)==null?void 0:z[0];if(!E)return;const N=new Image;N.onload=()=>{const O=Ij(N);r({...O,hairStyle:l.hairStyle,outfitStyle:l.outfitStyle,accessory:l.accessory}),URL.revokeObjectURL(N.src)},N.src=URL.createObjectURL(E),C.target.value=""},[l.hairStyle,l.outfitStyle,l.accessory,r]),b=sg(),v=og(),S=cg(),j=d!==void 0?S.filter(C=>dg(C.id,d)).length:S.length;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"customize-preview",children:[s.jsx("div",{className:"customize-preview-bg",children:s.jsx(Ws,{roleId:e,appearance:l,scale:12})}),u&&s.jsx("div",{className:"customize-preview-name",children:u}),s.jsxs("div",{className:"customize-preview-actions",children:[s.jsx("button",{className:"customize-btn customize-btn--random",onClick:i,children:"RANDOM"}),s.jsx("button",{className:"customize-btn customize-btn--reset",onClick:c,children:"RESET"}),s.jsx("button",{className:"customize-btn",onClick:()=>{var C;return(C=g.current)==null?void 0:C.click()},style:{fontSize:9,opacity:.7},children:"PHOTO"}),s.jsx("input",{ref:g,type:"file",accept:"image/*",onChange:y,style:{display:"none"}})]})]}),s.jsxs("div",{className:"customize-colors",children:[s.jsxs("div",{style:{display:"flex",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:[s.jsx(Tf,{label:"LOOK",active:m==="look",onClick:()=>x("look")}),s.jsx(Tf,{label:"OUTFIT",active:m==="outfit",onClick:()=>x("outfit")}),s.jsx(Tf,{label:"ACCESSORY",active:m==="accessory",onClick:()=>x("accessory")})]}),m==="look"&&s.jsxs(s.Fragment,{children:[s.jsx(Os,{label:"SKIN",presets:vg,value:l.skinColor,onChange:C=>f("skinColor",C)}),s.jsx(Os,{label:"HAIR COLOR",presets:wg,value:l.hairColor,onChange:C=>f("hairColor",C)}),s.jsx(Df,{label:"HAIR STYLE",items:b,value:l.hairStyle,onChange:C=>f("hairStyle",C)})]}),m==="outfit"&&s.jsxs(s.Fragment,{children:[s.jsx(Df,{label:"STYLE",items:v,value:l.outfitStyle,onChange:C=>f("outfitStyle",C)}),s.jsx(Os,{label:"TOP",presets:kg,value:l.shirtColor,onChange:C=>f("shirtColor",C)}),s.jsx(Os,{label:"PANTS",presets:jg,value:l.pantsColor,onChange:C=>f("pantsColor",C)}),s.jsx(Os,{label:"SHOES",presets:Sg,value:l.shoeColor,onChange:C=>f("shoeColor",C)})]}),m==="accessory"&&s.jsxs(s.Fragment,{children:[d!==void 0&&s.jsxs("div",{style:{padding:"4px 8px",marginBottom:4,background:"rgba(255,255,255,0.04)",borderRadius:4,fontSize:9,fontFamily:"var(--font-pixel, monospace)",color:"rgba(255,255,255,0.5)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s.jsxs("span",{children:["Lv.",d]}),s.jsxs("span",{children:[j,"/",S.length," unlocked"]})]}),s.jsx(Df,{label:"ACCESSORY",items:S,value:l.accessory,onChange:C=>f("accessory",C),lockInfo:d!==void 0?{roleLevel:d,getLockLevel:ug}:void 0}),s.jsx("div",{style:{marginTop:12,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:6,border:"1px dashed rgba(255,255,255,0.08)",color:"rgba(255,255,255,0.25)",fontSize:9,fontFamily:"var(--font-pixel, monospace)",textAlign:"center"},children:d!==void 0&&d<10?"Level up to unlock more accessories":"More accessories coming soon"})]})]})]})}const bC=[{value:"c-level",label:"C-Level"},{value:"team-lead",label:"Team Lead"},{value:"member",label:"Member"}];function ih(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,24)}function zf(e){switch(e){case"c-level":return{authority:{autonomous:["Strategic decisions within domain","Task delegation to reports"],needsApproval:["Budget over $5K","External commitments"]},knowledge:{reads:["company/","operations/","projects/"],writes:["operations/","knowledge/"]},reports:{daily:"standup",weekly:"summary"}};case"team-lead":return{authority:{autonomous:["Task planning","Sprint management"],needsApproval:["Architecture changes","New tool adoption"]},knowledge:{reads:["projects/","architecture/"],writes:["projects/"]},reports:{daily:"standup",weekly:"summary"}};default:return{authority:{autonomous:["Implementation within assigned tasks"],needsApproval:["Design changes","New dependencies"]},knowledge:{reads:["projects/"],writes:[]},reports:{daily:"standup",weekly:""}}}}let aa=null;async function vC(){if(aa)return aa;try{const r=await Ce.getPreferences();if(r.instanceId)return aa=r.instanceId,localStorage.setItem("tycono_instance_id",aa),aa}catch{}const e="tycono_instance_id";let l=localStorage.getItem(e);return l||(l=crypto.randomUUID(),localStorage.setItem(e,l)),aa=l,l}const Bs=4;function wC(e,l,r){const i=e.trim();if(!i||i.startsWith("#"))return null;const c=i.split(",").map(y=>y.trim()),u=c[0];if(!u)return null;const d=ih(u),m=(c[1]||"member").toLowerCase(),x=m==="c-level"?"c-level":m==="team-lead"?"team-lead":"member",f=c[2]||"ceo";let g;return l.has(d)?g="ID already exists":r.has(d)&&(g="Duplicate ID in batch"),r.add(d),{name:u,id:d,level:x,reportsTo:f,error:g}}function kC({existingRoles:e,onClose:l,onHire:r}){const[i,c]=k.useState("single"),[u,d]=k.useState([]),[m,x]=k.useState(!1),[f,g]=k.useState("popular"),[y,b]=k.useState(""),[v,S]=k.useState(null),[j,C]=k.useState(!1),[E,N]=k.useState(""),[z,O]=k.useState("browse"),[I,_]=k.useState(""),[q,W]=k.useState(""),[Y,T]=k.useState("ceo"),[$,B]=k.useState(null),[G,ne]=k.useState(1),[V,U]=k.useState(""),[Z,ie]=k.useState(""),[je,R]=k.useState(!1),[M,K]=k.useState("member"),[D,de]=k.useState("ceo"),[Se,ve]=k.useState(""),[Fe,Me]=k.useState(Ci),[$e,fe]=k.useState(!1),[tt,mt]=k.useState(""),[he,ye]=k.useState([]),[ge,Le]=k.useState(new Set),[Ee,ze]=k.useState(""),[Te,Ne]=k.useState("input"),[Ie,Ge]=k.useState({done:0,total:0}),Dt=k.useRef(null),ct=k.useRef(null),Ot=k.useRef(null);k.useEffect(()=>{Ce.getSkills().then(J=>ye(J.filter(Oe=>Oe.installed))).catch(()=>{}),vC().then(J=>B(J)).catch(()=>{})},[]),k.useEffect(()=>{var J,Oe,rt;i==="single"?(G===1&&((J=Dt.current)==null||J.focus()),G===2&&((Oe=ct.current)==null||Oe.focus())):i==="bulk"&&Te==="input"&&((rt=Ot.current)==null||rt.focus())},[G,i,Te]),k.useEffect(()=>{i==="store"&&z==="browse"&&u.length===0&&se()},[i,z]);const se=async()=>{x(!0);try{const J=await bl.getCharacters({sort:f,instanceId:$??void 0});d(J.characters)}catch{N("Failed to load store")}x(!1)};k.useEffect(()=>{i==="store"&&z==="browse"&&se()},[f,$]);const be=k.useMemo(()=>{if(!y.trim())return u;const J=y.toLowerCase();return u.filter(Oe=>Oe.name.toLowerCase().includes(J)||Oe.id.toLowerCase().includes(J)||(Oe.tagline??"").toLowerCase().includes(J))},[u,y]),Re=k.useMemo(()=>new Set(e.map(J=>J.id)),[e]),_e=k.useMemo(()=>{const J=Ee.split(`
|
|
82
|
-
`),Oe=new Set;return J.map(rt=>wC(rt,Re,Oe)).filter(rt=>rt!==null)},[Ee,Re]),xe=_e.length>0&&_e.every(J=>!J.error),De=J=>{U(J),je||ie(ih(J))},vt=V.trim().length>0&&Z.trim().length>0&&!e.some(J=>J.id===Z),Pe=Se.trim().length>0,nt=async()=>{fe(!0),mt("");const J=zf(M);try{await r({id:Z,name:V.trim(),level:M,reportsTo:D,persona:Se.trim(),...J,skills:ge.size>0?[...ge]:void 0},Fe),l()}catch(Oe){mt(Oe instanceof Error?Oe.message:"Failed to create role"),fe(!1)}},At=J=>J===1?vt:J===2?Pe:!0,ut=async()=>{fe(!0),mt(""),Ge({done:0,total:_e.length});try{for(let J=0;J<_e.length;J++){const Oe=_e[J],rt=zf(Oe.level),pe=Ci(),gt=`${Oe.name}. A ${Oe.level} role reporting to ${Oe.reportsTo}.`;await r({id:Oe.id,name:Oe.name,level:Oe.level,reportsTo:Oe.reportsTo,persona:gt,...rt},pe),Ge({done:J+1,total:_e.length})}l()}catch(J){mt(J instanceof Error?J.message:"Failed to create roles"),fe(!1)}},tn=async J=>{C(!0),N("");try{const Oe=await bl.getCharacter(J);S(Oe),_(Oe.name||""),W(ih(Oe.name||J)),O("review")}catch{N("Failed to load character details")}finally{C(!1)}},yn=async(J,Oe)=>{if(!$)return;const rt=u.find(gt=>gt.id===J);if(!rt)return;const pe=rt.my_vote===Oe?0:Oe;try{const gt=await bl.voteCharacter(J,$,pe);d(dn=>dn.map(nn=>nn.id===J?{...nn,upvotes:gt.upvotes,downvotes:gt.downvotes,vote_score:gt.upvotes-gt.downvotes,my_vote:pe===0?null:pe}:nn))}catch{}},Ml=async()=>{if(!v)return;fe(!0),mt("");const J=v,Oe=J.level==="c-level"||J.level==="team-lead"?J.level:"member",rt=zf(Oe),pe=J.skills!=null&&typeof J.skills=="object"&&!Array.isArray(J.skills)&&"primary"in J.skills;try{await r({id:q,name:I.trim(),level:Oe,reportsTo:Y,persona:J.persona||`${I}. Imported from Tycono Store.`,authority:J.authority||rt.authority,knowledge:rt.knowledge,reports:rt.reports,source:{id:`tycono/${J.id}`,sync:"manual",forked_at:"1.0.0",upstream_version:"1.0.0"},skillContent:pe?J.skills:void 0},J.appearance?J.appearance:Ci()),bl.trackInstall(J.id).catch(()=>{}),l()}catch(gt){mt(gt instanceof Error?gt.message:"Failed to hire"),fe(!1)}},kt=async J=>{if($)try{await bl.deleteCharacter(J,$),d(Oe=>Oe.filter(rt=>rt.id!==J))}catch{}},Rl=J=>{J.key==="Escape"&&l(),J.key==="Enter"&&(J.metaKey||J.ctrlKey)&&(i==="single"?G<Bs&&At(G)?ne(G+1):G===Bs&&nt():i==="bulk"?Te==="input"&&xe?Ne("review"):Te==="review"&&ut():i==="store"&&z==="review"&&Ml())},$n=e.some(J=>J.id===Z)&&Z.length>0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:l}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[560px] max-h-[90vh] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden flex flex-col",onKeyDown:Rl,children:[s.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #2E7D32, #43A047)"},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"text-lg font-bold",children:"Hire New Role"}),s.jsxs("div",{className:"flex bg-black/20 rounded-lg p-0.5",children:[s.jsx("button",{onClick:()=>{c("single"),mt("")},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"}),s.jsx("button",{onClick:()=>{c("bulk"),mt("")},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"}),s.jsx("button",{onClick:()=>{c("store"),mt("")},className:`px-3 py-1 text-xs font-semibold rounded-md cursor-pointer transition-colors ${i==="store"?"bg-white/20 text-white":"text-white/50 hover:text-white/70"}`,children:"Store"})]})]}),s.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:i==="single"?`Step ${G} of ${Bs}`:i==="bulk"?Te==="input"?"Enter roles, one per line":`Review ${_e.length} roles`:z==="browse"?`${u.length} characters available`:"Review & customize"})]}),i==="single"&&s.jsx("div",{className:"flex gap-1 px-5 pt-4",children:Array.from({length:Bs},(J,Oe)=>Oe+1).map(J=>s.jsx("div",{className:"flex-1 h-1 rounded-full transition-colors",style:{background:J<=G?"#2E7D32":"rgba(255,255,255,0.1)"}},J))}),s.jsx("div",{className:"p-5 min-h-[240px] overflow-y-auto flex-1",children:i==="store"?s.jsxs(s.Fragment,{children:[z==="browse"&&s.jsxs("div",{className:"space-y-3",children:[$?s.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 rounded-lg bg-green-900/10 border border-green-800/20 text-[10px]",children:[s.jsxs("span",{className:"text-green-400/70",children:["Signed in · ",s.jsxs("span",{className:"font-mono text-white/40",children:[$.slice(0,8),"..."]})]}),s.jsx("button",{onClick:()=>{aa=null,localStorage.removeItem("tycono_instance_id"),B(null)},className:"text-white/30 hover:text-white/60 cursor-pointer",children:"Sign out"})]}):s.jsx(jC,{onLogin:J=>{aa=J,localStorage.setItem("tycono_instance_id",J),B(J)}}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{value:y,onChange:J=>b(J.target.value),placeholder:"Search characters...",className:"flex-1 p-2 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 focus:outline-none focus:border-white/25 transition-colors",autoFocus:!0}),s.jsxs("select",{value:f,onChange:J=>g(J.target.value),className:"px-2 py-2 rounded-lg border border-white/10 bg-white/5 text-xs text-white/70 focus:outline-none cursor-pointer",children:[s.jsx("option",{value:"popular",className:"bg-[var(--wall)]",children:"Popular"}),s.jsx("option",{value:"installs",className:"bg-[var(--wall)]",children:"Most Hired"}),s.jsx("option",{value:"newest",className:"bg-[var(--wall)]",children:"Newest"}),s.jsx("option",{value:"name",className:"bg-[var(--wall)]",children:"A-Z"})]})]}),m?s.jsx("div",{className:"text-center py-8 text-sm text-white/40",children:"Loading store..."}):E?s.jsxs("div",{className:"text-center py-8",children:[s.jsx("div",{className:"text-xs text-red-400 mb-2",children:E}),s.jsx("button",{onClick:se,className:"text-xs text-green-400 hover:underline cursor-pointer",children:"Retry"})]}):be.length===0?s.jsx("div",{className:"text-center py-8 text-sm text-white/40",children:y?"No matches found":"No characters in store yet"}):s.jsx("div",{className:"space-y-2 max-h-[380px] overflow-y-auto pr-1",children:be.map(J=>s.jsx(SC,{char:J,isHired:Re.has(J.id),onSelect:()=>tn(J.id),onVote:Oe=>yn(J.id,Oe),onDelete:()=>kt(J.id),fetching:j,token:$},J.id))})]}),z==="review"&&v&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"bg-white/5 rounded-xl p-4 border border-white/10",children:[s.jsxs("div",{className:"flex gap-4",children:[v.appearance&&s.jsx("div",{className:"flex-shrink-0 rounded-lg overflow-hidden",style:{background:"#0d1117",padding:8},children:s.jsx(Ws,{roleId:"store-preview",appearance:v.appearance,scale:4})}),s.jsxs("div",{className:"flex-1 space-y-2.5",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Name"}),s.jsx("input",{value:I,onChange:J=>_(J.target.value),className:"w-full p-2 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 focus:outline-none focus:border-white/25 transition-colors"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Role ID"}),s.jsx("input",{value:q,onChange:J=>W(J.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),className:"w-full p-2 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 font-mono focus:outline-none focus:border-white/25 transition-colors"}),e.some(J=>J.id===q)&&q.length>0&&s.jsx("div",{className:"text-xs text-red-500 mt-1",children:"ID already exists"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Level"}),s.jsx("div",{className:"text-sm text-white/70 p-2 rounded-lg bg-white/5 border border-white/10",children:v.level==="c-level"?"C-Level":v.level==="team-lead"?"Lead":"Member"})]}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Reports To"}),s.jsxs("select",{value:Y,onChange:J=>T(J.target.value),className:"w-full p-2 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 focus:outline-none focus:border-white/25 transition-colors",children:[s.jsx("option",{value:"ceo",className:"bg-[var(--wall)] text-white",children:"CEO"}),e.map(J=>s.jsxs("option",{value:J.id,className:"bg-[var(--wall)] text-white",children:[J.name," (",J.id,")"]},J.id))]})]})]})]})]}),v.persona&&s.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[s.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Persona"}),s.jsx("div",{className:"text-xs text-white/60 leading-relaxed line-clamp-3",children:v.persona})]}),v.skills&&s.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[s.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Skills"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:(()=>{var pe,gt;const J=v.skills;if(J&&typeof J=="object"&&!Array.isArray(J)&&"primary"in J){const dn=[];return(gt=(pe=J.primary)==null?void 0:pe.frontmatter)!=null&>.name&&dn.push(J.primary.frontmatter.name),J.shared&&J.shared.forEach(nn=>{var br;return dn.push(((br=nn.frontmatter)==null?void 0:br.name)||nn.id)}),dn.map(nn=>s.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono bg-green-900/20 border border-green-800/30 text-green-400",children:nn},nn))}return(Array.isArray(J)?J:[]).map((dn,nn)=>s.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono bg-green-900/20 border border-green-800/30 text-green-400",children:typeof dn=="string"?dn:dn.name},nn))})()})]})]}),tt&&s.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:tt})]})]}):i==="single"?s.jsxs(s.Fragment,{children:[G===1&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role Name"}),s.jsx("input",{ref:Dt,value:V,onChange:J=>De(J.target.value),placeholder:"e.g. Data Analyst",className:"w-full p-2.5 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 focus:outline-none focus:border-white/25 transition-colors"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role ID (slug)"}),s.jsx("input",{value:Z,onChange:J=>{ie(J.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),R(!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 ${$n?"border-red-400":"border-white/10 focus:border-white/25"}`}),$n&&s.jsx("div",{className:"text-xs text-red-500 mt-1",children:"ID already exists"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Level"}),s.jsx("div",{className:"flex gap-2",children:bC.map(J=>s.jsx("button",{onClick:()=>K(J.value),className:`flex-1 p-2 text-xs font-semibold rounded-lg border cursor-pointer transition-colors ${M===J.value?"border-green-600 bg-green-900/30 text-green-400":"border-white/10 text-white/50 hover:border-white/20"}`,children:J.label},J.value))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Reports To"}),s.jsxs("select",{value:D,onChange:J=>de(J.target.value),className:"w-full p-2.5 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 focus:outline-none focus:border-white/25 transition-colors",children:[s.jsx("option",{value:"ceo",className:"bg-[var(--wall)] text-white",children:"CEO"}),e.map(J=>s.jsxs("option",{value:J.id,className:"bg-[var(--wall)] text-white",children:[J.name," (",J.id,")"]},J.id))]})]})]}),G===2&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Persona"}),s.jsx("textarea",{ref:ct,value:Se,onChange:J=>ve(J.target.value),placeholder:"Describe this role's personality, expertise, and working style...",className:"w-full h-32 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),s.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"This defines how the AI agent will behave in this role"})]}),he.length>0&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Skills"}),s.jsx("div",{className:"space-y-1.5 max-h-[120px] overflow-y-auto",children:he.map(J=>s.jsxs("label",{className:"flex items-center gap-2 p-2 rounded-lg border border-white/10 bg-white/5 cursor-pointer hover:border-white/20 transition-colors",children:[s.jsx("input",{type:"checkbox",checked:ge.has(J.id),onChange:()=>Le(Oe=>{const rt=new Set(Oe);return rt.has(J.id)?rt.delete(J.id):rt.add(J.id),rt}),className:"accent-green-600"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-xs font-semibold text-white/80",children:J.name}),s.jsx("div",{className:"text-[10px] text-white/40 truncate",children:J.description})]})]},J.id))})]})]}),G===3&&s.jsx("div",{className:"customize-body",style:{padding:0},children:s.jsx(Cg,{roleId:"default",appearance:Fe,onChange:Me,onRandomize:()=>Me(Ci()),onReset:()=>Me(Ci()),label:s.jsxs("span",{children:[Z||"new-role"," — ",V||"New Role"]})})}),G===4&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Review"}),s.jsxs("div",{className:"bg-white/5 rounded-xl p-4 border border-white/10",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsx("div",{className:"flex-shrink-0 rounded-lg overflow-hidden",style:{background:"#0d1117",padding:8},children:s.jsx(Ws,{roleId:"default",appearance:Fe,scale:4})}),s.jsxs("div",{className:"flex-1 space-y-2.5",children:[s.jsx($s,{label:"Name",value:V}),s.jsx($s,{label:"ID",value:Z,mono:!0}),s.jsx($s,{label:"Level",value:M}),s.jsx($s,{label:"Reports To",value:D}),ge.size>0&&s.jsx($s,{label:"Skills",value:[...ge].join(", ")})]})]}),s.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[s.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Persona"}),s.jsx("div",{className:"text-xs text-white/60 leading-relaxed",children:Se})]})]}),tt&&s.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:tt})]})]}):s.jsxs(s.Fragment,{children:[Te==="input"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Roles (one per line)"}),s.jsx("textarea",{ref:Ot,value:Ee,onChange:J=>ze(J.target.value),placeholder:`Name, Level, ReportsTo
|
|
79
|
+
`)?s.jsx(Sj,{language:i==null?void 0:i[1],children:l}):s.jsx("code",{className:"bg-gray-100 text-gray-700 px-1 py-0.5 rounded text-[0.9em] font-mono",...r,children:l})}function Sj({children:e,language:l}){const[r,i]=k.useState(!1),c=String(e).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(c),i(!0),setTimeout(()=>i(!1),1500)};return s.jsxs("div",{className:"office-code-block group relative my-2",children:[l&&s.jsx("div",{className:"text-[10px] text-gray-400 px-3 pt-1.5",children:l}),s.jsx("button",{onClick:u,className:"absolute top-1.5 right-2 text-[10px] text-gray-400 hover:text-gray-600 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:r?"Copied!":"Copy"}),s.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:s.jsx("code",{children:c})})]})}const h0={$skin:"skinColor",$hair:"hairColor",$shirt:"shirtColor",$pants:"pantsColor",$shoes:"shoeColor"},Cj=/^(darken|lighten)\((\$\w+),\s*(\d+)\)$/;function Ej(e,l){const r=parseInt(e.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 Nj(e,l){const r=parseInt(e.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 rg(e,l){const r=h0[e];if(r&&l)return l[r];const i=Cj.exec(e);if(i){const[,c,u,d]=i,m=h0[u],x=m&&l?l[m]:u,f=parseInt(d,10);return c==="darken"?Ej(x,f):Nj(x,f)}return e}function m0(e,l=12){return e.map(r=>({...r,x:l-r.x-r.w}))}function Aj(e,l){return l==="down"?e.down:l==="up"&&e.up?e.up:l==="left"&&e.left?e.left:l==="right"&&e.right?e.right:l==="right"&&e.left?{name:e.left.name,pixels:m0(e.left.pixels)}:l==="left"&&e.right?{name:e.right.name,pixels:m0(e.right.pixels)}:e.down}function Dj(e,l){return th(e,"hair",l,1)}function th(e,l,r,i){const c=e.layers.findIndex(d=>d.name===l),u=[...e.layers];if(c>=0)u[c]={...r,name:l};else{const d=i??u.length;u.splice(d,0,{...r,name:l})}return{...e,layers:u}}const zh=new Map,Mh=new Map;function ag(e,l){zh.set(e,l)}function Qc(e,l){Mh.set(e,l)}function nh(e){return zh.get(e)}function Tj(e){return Mh.get(e)}function NN(){return Array.from(zh.keys())}function AN(){return Array.from(Mh.keys())}function zj(e,l,r,i,c=2){e.clearRect(0,0,l.width*c,l.height*c);for(const u of l.layers)ig(e,u.pixels,c,r,i)}function lh(e,l,r,i,c){for(const u of l){const d=rg(u.c,c);u.a!==void 0&&u.a!==1&&(e.globalAlpha=u.a),e.fillStyle=d,e.fillRect(r+u.x,i+u.y,u.w,u.h),u.a!==void 0&&u.a!==1&&(e.globalAlpha=1)}}function Mj(e,l){const r=l.scale;e.clearRect(0,0,l.canvasWidth,l.canvasHeight),ig(e,l.pixels,r,0)}function ig(e,l,r,i,c){for(const u of l){const d=rg(u.c,c);u.a!==void 0&&u.a!==1&&(e.globalAlpha=u.a),e.fillStyle=d,e.fillRect(u.x*r,(u.y+i)*r,u.w*r,u.h*r),u.a!==void 0&&u.a!==1&&(e.globalAlpha=1)}}const Lc=new Map;function ua(e,l,r){if("down"in r&&!("pixels"in r)){const c=r;Lc.set(e,{id:e,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;Lc.set(e,{id:e,name:l,layer:{...c,name:"hair"}})}}function Rj(e){return Lc.get(e)}function sg(){return Array.from(Lc.values())}ua("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}]}});ua("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}]}});ua("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}]}});ua("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}]}});ua("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"}]}});ua("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}]}});ua("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}]}});ua("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 Hc=new Map;function Wl(e,l,r){if("down"in r&&!("pixels"in r)){const c=r;Hc.set(e,{id:e,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;Hc.set(e,{id:e,name:l,layer:{...c,name:"torso"}})}}function Fj(e){return Hc.get(e)}function og(){return Array.from(Hc.values())}Wl("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"}]}});Wl("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"}]}});Wl("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"}]}});Wl("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)"}]}});Wl("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)"}]}});Wl("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"}]}});Wl("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"}]}});Wl("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"}]}});Wl("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"}]}});Wl("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 Ks=new Map;function Nt(e,l,r){if("down"in r&&!("pixels"in r)){const c=r;Ks.set(e,{id:e,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;Ks.set(e,{id:e,name:l,layer:{...c,name:"accessory"}})}}function _j(e){return Ks.get(e)}function Oj(e,l){const r=Ks.get(e);if(!r)return;if(r.directions)return Aj(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 cg(){return Array.from(Ks.values())}Nt("none","None",{name:"accessory",pixels:[]});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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"}]}});Nt("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}]}});Nt("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}]}});Nt("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"}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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"}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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}]}});Nt("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"}]}});Nt("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"}]}});Nt("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}]}});Nt("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}]}});Nt("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 Bj={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 ug(e){return Bj[e]??1}function dg(e,l){return l>=ug(e)}Nt("star-glasses","Star Glasses",{down:{name:"accessory",pixels:[{x:1,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:2,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:2,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:7,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:8,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:8,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:5,y:4,w:2,h:1,c:"#FF4081",a:.4}]},up:{name:"accessory",pixels:[{x:0,y:3,w:2,h:1,c:"#FF4081",a:.3},{x:10,y:3,w:2,h:1,c:"#FF4081",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:2,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:2,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:5,y:4,w:6,h:1,c:"#FF4081",a:.3}]}});function Fs({r:e,g:l,b:r}){return`#${(e<<16|l<<8|r).toString(16).padStart(6,"0")}`}function Tc(e,l){const r=e.r-l.r,i=e.g-l.g,c=e.b-l.b;return r*r+i*i+c*c}function $j(e,l){const r=[];r.push(e[Math.floor(Math.random()*e.length)]);for(let i=1;i<l;i++){const c=e.map(m=>{let x=1/0;for(const f of r)x=Math.min(x,Tc(m,f));return x}),u=c.reduce((m,x)=>m+x,0);let d=Math.random()*u;for(let m=0;m<e.length;m++)if(d-=c[m],d<=0){r.push(e[m]);break}r.length<=i&&r.push(e[Math.floor(Math.random()*e.length)])}return r}function Lj(e,l,r=20){if(e.length===0)return[];const i=$j(e,l);for(let u=0;u<r;u++){const d=Array.from({length:l},()=>[]);for(const x of e){let f=1/0,g=0;for(let y=0;y<l;y++){const b=Tc(x,i[y]);b<f&&(f=b,g=y)}d[g].push(x)}let m=!0;for(let x=0;x<l;x++){if(d[x].length===0)continue;const f={r:0,g:0,b:0};for(const b of d[x])f.r+=b.r,f.g+=b.g,f.b+=b.b;const g=d[x].length,y={r:Math.round(f.r/g),g:Math.round(f.g/g),b:Math.round(f.b/g)};Tc(y,i[x])>1&&(m=!1),i[x]=y}if(m)break}const c=new Array(l).fill(0);for(const u of e){let d=1/0,m=0;for(let x=0;x<l;x++){const f=Tc(u,i[x]);f<d&&(d=f,m=x)}c[m]++}return i.map((u,d)=>({c:u,count:c[d]})).sort((u,d)=>d.count-u.count).map(u=>u.c)}function Hj(e,l=1e4){const r=document.createElement("canvas"),i=e instanceof HTMLImageElement?e.naturalWidth:e.width,c=e instanceof HTMLImageElement?e.naturalHeight:e.height;r.width=i,r.height=c;const u=r.getContext("2d");u.drawImage(e,0,0);const d=u.getImageData(0,0,i,c).data,m=i*c,x=Math.max(1,Math.floor(m/l)),f=[];for(let g=0;g<m;g+=x){const y=g*4;d[y+3]<128||f.push({r:d[y],g:d[y+1],b:d[y+2]})}return f}function x0(e){return .299*e.r+.587*e.g+.114*e.b}function p0(e){const l=Math.max(e.r,e.g,e.b),r=Math.min(e.r,e.g,e.b);return l===0?0:(l-r)/l*255}function Ij(e,l=8){const r=Hj(e),i=Lj(r,l);if(i.length<5)return{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121"};const c=[...i].sort((y,b)=>x0(b)-x0(y)),u=[...i].sort((y,b)=>p0(b)-p0(y)),d=c[0],m=c[c.length-1],x=u[0],f=c[c.length-2],g=c[c.length-1];return{skinColor:Fs(d),hairColor:Fs(m),shirtColor:Fs(x),pantsColor:Fs(f),shoeColor:Fs(g)}}const Uj=[{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}],Yj=[{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"}],qj=[{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"}],Xj=[{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 Vj(){return{width:12,height:22,layers:[{name:"lower",pixels:Uj},{name:"torso",pixels:Yj},{name:"head",pixels:qj},{name:"hair",pixels:Xj},{name:"accessory",pixels:[]}]}}const Gj=["cto","cbo","pm","engineer","designer","qa","data-analyst","default"];for(const e of Gj)ag(`mini:${e}`,Vj());const Kj=[{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"}],Wj=[{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"}],Qj=[{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 Zj(){return{width:12,height:22,layers:[{name:"torso",pixels:Kj},{name:"head",pixels:Wj},{name:"hair",pixels:Qj},{name:"accessory",pixels:[]}]}}ag("mini-seated:default",Zj());const Jj={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"}]},Pj={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"}]},eS={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"}]},tS={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"}]};Qc("meeting",Jj);Qc("bulletin",Pj);Qc("decision",tS);Qc("knowledge",eS);const kf=16,jf=24,nS=60,lS={cbo:0,cto:8,pm:15,engineer:22,designer:5,qa:12};function fg(e,l){if(!e)return e;let r=e;if(l!=null&&l.hairStyle){const i=Rj(l.hairStyle);i&&(r=Dj(r,i.layer))}if(l!=null&&l.outfitStyle){const i=Fj(l.outfitStyle);i&&(r=th(r,"torso",i.layer,1))}if(l!=null&&l.accessory&&l.accessory!=="none"){const i=_j(l.accessory);i&&(r=th(r,"accessory",i.layer))}return r}function Ws({roleId:e,className:l,appearance:r,scale:i}){const c=k.useRef(null),u=k.useRef(0),d=k.useRef(0),m=k.useRef(r);m.current=r;const x=i??4,f=kf*x,g=jf*x,y=k.useMemo(()=>{const b=nh(`mini:${e}`)??nh("mini:default");return fg(b,r)},[e,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 S=lS[e]??0,j=()=>{d.current++;const C=m.current;if(!C||!y){u.current=requestAnimationFrame(j);return}const N=(d.current+S)%nS<30?1:0;v.clearRect(0,0,kf,jf),v.save(),v.translate(2,1),zj(v,y,N,C,1),v.restore(),u.current=requestAnimationFrame(j)};return u.current=requestAnimationFrame(j),()=>cancelAnimationFrame(u.current)},[e,y]),s.jsx("canvas",{ref:c,width:kf,height:jf,className:l,style:{imageRendering:"pixelated",display:"block",width:f,height:g}})}const rS="https://api.tycono.ai",Rh=rS;async function yc(e){const l=await fetch(`${Rh}${e}`);if(!l.ok)throw new Error(`Cloud API error: ${l.status}`);return l.json()}async function ki(e,l){const r=await fetch(`${Rh}${e}`,{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 bl={health:()=>yc("/api/health"),getCharacters:e=>{const l=new URLSearchParams;e!=null&&e.sort&&l.set("sort",e.sort),e!=null&&e.instanceId&&l.set("instance_id",e.instanceId);const r=l.toString();return yc(`/api/store/characters${r?`?${r}`:""}`)},getCharacter:e=>yc(`/api/store/characters/${e}`),getCharacterVersion:e=>yc(`/api/store/characters/${e}/version`),voteCharacter:(e,l,r)=>ki(`/api/store/characters/${e}/vote`,{instanceId:l,vote:r}),trackInstall:e=>ki(`/api/store/characters/${e}/install`,{}),syncCheck:e=>ki("/api/sync/check",{roles:e}),syncPull:e=>ki("/api/sync/pull",{sourceId:e}),publishCharacter:e=>ki("/api/store/publish",e),deleteCharacter:(e,l)=>{const r=l?`?publisher_id=${encodeURIComponent(l)}`:"";return fetch(`${Rh}/api/store/characters/${e}${r}`,{method:"DELETE"}).then(i=>i.json())},uploadTelemetry:e=>ki("/api/telemetry",e)},aS={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"},Sf={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},iS={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},sS=500,y0=360,g0=700,oS=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`;function cS({role:e,allRoles:l,recentActivity:r,onClose:i,onFireRole:c,terminalWidth:u=0,activeJobId:d,activeTask:m,isWorking:x,jobStartedAt:f,onStopJob:g,sessions:y,streamingSessionId:b,onCreateSessionSilent:v,onSendMessage:S,onFocusTerminal:j,onCustomize:C,onUpdateRole:E,appearance:N,relationships:z,roleLevel:O}){var Re,_e;const[I,_]=k.useState(sS),[q,W]=k.useState(!1),Y=k.useRef(0),T=k.useRef(0),[$,B]=k.useState(!1),[G,ne]=k.useState(!1),[V,U]=k.useState(!1),[J,ie]=k.useState(!1),[je,R]=k.useState("talk"),[M,K]=k.useState(!1),[D,de]=k.useState(""),[Se,ve]=k.useState(!1),Fe=k.useRef(null),{events:Me,status:$e}=P0(d??null),[fe,tt]=k.useState(0);k.useEffect(()=>{if(!x||!f){tt(0);return}const xe=new Date(f).getTime(),De=()=>tt(Math.floor((Date.now()-xe)/1e3));De();const vt=setInterval(De,1e3);return()=>clearInterval(vt)},[x,f]);const mt=u>0,he=mt?u:0,ye=mt?Math.max(y0,window.innerWidth-u-100):g0,ge=Math.min(I,ye),Le=k.useCallback(xe=>{xe.preventDefault(),Y.current=xe.clientX,T.current=ge,W(!0);const De=Pe=>{const nt=Y.current-Pe.clientX,At=Math.min(g0,Math.max(y0,T.current+nt));_(At)},vt=()=>{W(!1),document.removeEventListener("mousemove",De),document.removeEventListener("mouseup",vt)};document.addEventListener("mousemove",De),document.addEventListener("mouseup",vt)},[ge]),Ee=k.useRef(null),ze=e?y.find(xe=>xe.roleId===e.id):null,Te=xe=>{if(!e)return;const De=x?"talk":je;ze?(S(ze.id,xe,De),j(e.id)):(Ee.current={content:xe,mode:De},v(e.id))};k.useEffect(()=>{if(ze&&Ee.current){const{content:xe,mode:De}=Ee.current;Ee.current=null,S(ze.id,xe,De),e&&j(e.id)}},[ze==null?void 0:ze.id]);const Ne=(()=>{if(!Me.length)return null;const xe=[];let De=0,vt=0,Pe=0;for(const nt of Me)if(nt.type==="thinking")De++;else if(nt.type==="text")vt++;else if(nt.type==="tool:start"){const At=String(nt.data.name??"");xe.includes(At)||xe.push(At)}else nt.type==="dispatch:start"&&Pe++;return{tools:xe,thinkCount:De,textCount:vt,dispatchCount:Pe,total:Me.length}})(),Ie=m||(()=>{if(!ze)return null;const xe=ze.messages;for(let De=xe.length-1;De>=0;De--)if(xe[De].from==="ceo")return xe[De].content;return null})(),Ge=(()=>{if(!ze)return null;const xe=ze.messages;for(let De=xe.length-1;De>=0;De--)if(xe[De].from==="role"&&xe[De].content)return xe[De].content;return null})();if(!e)return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:he},onClick:i}),s.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px]",style:{right:he,width:ge,background:"var(--terminal-bg)",borderLeftColor:"var(--pixel-border)"},children:s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading role..."})})]});const Dt=Sf[e.id]??"#666",ct=aS[e.id]??"👤",Ot=l.filter(xe=>xe.reportsTo===e.id),se=ze&&b===ze.id,be=e.name||iS[e.id]||e.id;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:he},onClick:i}),s.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${q?"resizing":""}`,style:{borderLeftColor:Dt,right:he,width:ge,background:"var(--terminal-bg)"},children:[s.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${q?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:Le}),s.jsxs("div",{className:"relative shrink-0 overflow-hidden",style:{background:`linear-gradient(135deg, ${Dt}ee, ${Dt}99)`},children:[s.jsx("div",{className:"absolute inset-0 opacity-[0.06]",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 8px, white 8px, white 9px)"}}),s.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-1.5 z-10",children:[C&&s.jsx("button",{onClick:()=>C(e.id),className:"w-7 h-7 rounded-full bg-black/20 text-white flex items-center justify-center text-sm hover:bg-black/30 cursor-pointer backdrop-blur-sm",title:"Customize",children:"🎨"}),s.jsx("button",{onClick:i,className:"w-7 h-7 rounded-full bg-black/20 text-white flex items-center justify-center text-lg hover:bg-black/30 cursor-pointer backdrop-blur-sm",children:"×"})]}),s.jsxs("div",{className:"relative flex items-end gap-4 px-4 pt-4 pb-3",children:[s.jsx("div",{className:"shrink-0 relative",style:{marginBottom:-2},children:s.jsx("div",{className:"rounded-lg p-1",style:{background:"rgba(0,0,0,0.2)"},children:s.jsx(Ws,{roleId:e.id,appearance:N,scale:8})})}),s.jsxs("div",{className:"flex-1 min-w-0 text-white pb-1",children:[s.jsxs("div",{className:"text-lg font-bold flex items-center gap-2",style:{fontFamily:"var(--pixel-font)"},children:[ct," ",e.id.toUpperCase(),x&&s.jsx("span",{className:"text-[9px] font-semibold px-2 py-0.5 rounded-full animate-pulse",style:{background:"rgba(251,191,36,0.25)",color:"#fde68a"},children:"WORKING"})]}),M?s.jsxs("form",{className:"flex items-center gap-1.5 mt-0.5",onSubmit:async xe=>{xe.preventDefault();const De=D.trim();if(!De||De===be||!E){K(!1);return}ve(!0);try{await E(e.id,{name:De})}catch{}ve(!1),K(!1)},children:[s.jsx("input",{ref:Fe,value:D,onChange:xe=>de(xe.target.value),onKeyDown:xe=>{xe.key==="Escape"&&K(!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"}}),s.jsx("button",{type:"submit",disabled:Se,className:"text-white/80 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✓"}),s.jsx("button",{type:"button",onClick:()=>K(!1),className:"text-white/60 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✕"})]}):s.jsxs("div",{className:"text-xs opacity-75 mt-0.5 group/name flex items-center gap-1 cursor-pointer hover:opacity-100 transition-opacity",onClick:()=>{E&&(de(be),K(!0))},title:E?"Click to edit name":void 0,children:[be,E&&s.jsx("span",{className:"opacity-0 group-hover/name:opacity-60 text-[10px]",children:"✎"})]})]})]}),s.jsxs("div",{className:"relative flex items-center gap-3 px-4 py-2 text-[10px] font-bold text-white/80",style:{background:"rgba(0,0,0,0.2)",fontFamily:"var(--pixel-font)"},children:[s.jsxs("span",{children:["Lv.",O??1]}),s.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:x?"var(--idle-amber)":"var(--active-green)"}}),x?"Working":"Idle"]}),s.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),s.jsx("span",{children:e.level}),e.reportsTo&&s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),s.jsxs("span",{className:"opacity-60",children:["→"," ",e.reportsTo]})]})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:[x&&s.jsxs("div",{className:"px-4 py-3 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"var(--idle-amber)"}}),s.jsxs("span",{className:"text-xs font-semibold",style:{color:"var(--idle-amber)"},children:["Working",fe>0?` · ${oS(fe)}`:""]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>j(e.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"}),d&&g&&s.jsx("button",{onClick:()=>g(d),className:"text-[10px] px-2 py-0.5 rounded cursor-pointer font-semibold transition-colors",style:{background:"rgba(239,68,68,0.15)",color:"#ef4444"},children:"Stop"})]})]}),Ie&&s.jsx("div",{className:"text-xs truncate",style:{color:"var(--terminal-text-secondary)"},children:Ie})]}),x&&d&&Ne&&s.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Activity"}),s.jsx("button",{onClick:()=>j(e.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"View details ↗"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[Ne.thinkCount>0&&s.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(168,85,247,0.15)",color:"#c084fc"},children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:"#a855f7"}}),"thinking ×",Ne.thinkCount]}),Ne.tools.map(xe=>s.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa"},children:xe},xe)),Ne.dispatchCount>0&&s.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(249,115,22,0.15)",color:"#fb923c"},children:["dispatch ×",Ne.dispatchCount]}),Ne.textCount>0&&s.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(34,197,94,0.15)",color:"#4ade80"},children:["output ×",Ne.textCount]}),($e==="streaming"||$e==="connecting")&&s.jsx("span",{className:"inline-block w-1.5 h-3 animate-pulse rounded-sm",style:{background:"var(--active-green)"}})]}),s.jsxs("div",{className:"text-[10px] mt-1",style:{color:"var(--terminal-text-muted)"},children:[Ne.total," events"]})]}),x&&Ge&&s.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Last Message"}),s.jsx("button",{onClick:()=>j(e.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"})]}),s.jsxs("div",{className:"rounded-lg p-2.5 text-xs leading-relaxed line-clamp-3 overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:[Ge.slice(0,200),Ge.length>200&&"..."]})]}),x&&s.jsx("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:s.jsx(b0,{onSend:Te,disabled:!!se,placeholder:"Ask something...",color:Dt})}),!x&&s.jsxs("div",{className:"px-4 pt-4 pb-2",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-secondary)"},children:"Latest"}),s.jsx(dS,{icon:ct,roleId:e.id,roleName:be,color:Dt,text:r})]}),!x&&s.jsx("div",{className:"px-4 py-3",style:{borderBottom:"1px solid var(--terminal-border)"},children:s.jsxs("div",{className:"rounded-xl overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[Ge&&s.jsxs("div",{className:"px-3 pt-2.5 pb-2 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--terminal-border)"},onClick:()=>j(e.id),children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Last response"}),s.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"View ↗"})]}),s.jsxs("div",{className:"text-xs leading-relaxed line-clamp-2 overflow-hidden",style:{color:"var(--terminal-text-secondary)"},children:[Ge.slice(0,150),Ge.length>150&&"..."]})]}),s.jsx("div",{className:"p-2",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex rounded-lg overflow-hidden shrink-0",style:{border:"1px solid var(--pixel-border)"},children:[s.jsx("button",{onClick:()=>R("talk"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:je==="talk"?"var(--accent)":"transparent",color:je==="talk"?"#fff":"var(--terminal-text-secondary)"},children:"Talk"}),s.jsx("button",{onClick:()=>R("do"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:je==="do"?"var(--idle-amber)":"transparent",color:je==="do"?"#fff":"var(--terminal-text-secondary)"},children:"Do"})]}),s.jsx(b0,{onSend:Te,disabled:!!se,placeholder:je==="talk"?"Ask something...":"Give a directive...",color:Dt})]})})]})}),s.jsxs("div",{className:"px-4 py-2 space-y-1",children:[s.jsxs(gc,{title:`Profile${e.persona?"":" (empty)"}`,open:$,onToggle:()=>B(xe=>!xe),children:[e.persona&&s.jsx("div",{className:"text-xs leading-relaxed rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:e.persona}),s.jsxs("div",{className:"space-y-0 mt-2",children:[s.jsx(Cf,{label:"Level",value:e.level}),s.jsx(Cf,{label:"Reports to",value:e.reportsTo}),s.jsx(Cf,{label:"Status",value:e.status})]}),Ot.length>0&&s.jsxs("div",{className:"mt-3",children:[s.jsx("div",{className:"text-[11px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Direct Reports"}),s.jsx("div",{className:"space-y-1",children:Ot.map(xe=>s.jsxs("div",{className:"flex items-center gap-2 p-1.5 rounded-lg",style:{background:"var(--hud-bg-alt)"},children:[s.jsx("div",{className:"w-6 h-6 rounded flex items-center justify-center text-white text-[10px] font-bold",style:{background:Sf[xe.id]??"#666"},children:xe.id.slice(0,2).toUpperCase()}),s.jsx("div",{className:"text-xs",style:{color:"var(--terminal-text)"},children:xe.name})]},xe.id))})]})]}),e.authority&&s.jsxs(gc,{title:"Authority",open:G,onToggle:()=>ne(xe=>!xe),children:[((Re=e.authority.autonomous)==null?void 0:Re.length)>0&&s.jsxs("div",{className:"mb-2",children:[s.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--active-green)"},children:"Autonomous"}),e.authority.autonomous.map((xe,De)=>s.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",xe]},De))]}),((_e=e.authority.needsApproval)==null?void 0:_e.length)>0&&s.jsxs("div",{children:[s.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--idle-amber)"},children:"Needs Approval"}),e.authority.needsApproval.map((xe,De)=>s.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",xe]},De))]})]}),e&&z&&(()=>{const xe=z.filter(De=>De.roleA===e.id||De.roleB===e.id).filter(De=>De.familiarity>0).sort((De,vt)=>vt.familiarity-De.familiarity);return xe.length===0?null:s.jsx(gc,{title:`Relationships (${xe.length})`,open:V,onToggle:()=>U(De=>!De),children:s.jsx("div",{className:"space-y-1.5",children:xe.map((De,vt)=>{const Pe=De.roleA===e.id?De.roleB:De.roleA,nt=l.find(tn=>tn.id===Pe),At=De.familiarity>=80?"Best Partner":De.familiarity>=50?"Friend":De.familiarity>=20?"Colleague":"Acquaintance",ut=De.familiarity>=80?"#4CAF50":De.familiarity>=50?"#2196F3":De.familiarity>=20?"#FF9800":"#9E9E9E";return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs w-20 truncate",style:{color:Sf[Pe]??"var(--terminal-text-secondary)"},children:(nt==null?void 0:nt.name)??Pe}),s.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-white/10",children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${De.familiarity}%`,background:ut}})}),s.jsx("span",{className:"text-[10px] w-16 text-right",style:{color:"var(--terminal-text-muted)"},children:At})]},vt)})})})})(),e.journal&&s.jsx(gc,{title:`Journal (${(e.journal.match(/### /g)??[]).length})`,open:J,onToggle:()=>ie(xe=>!xe),children:s.jsxs("div",{className:"text-xs leading-relaxed rounded-lg p-3 max-h-[300px] overflow-y-auto",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:[s.jsx(no,{content:e.journal.slice(0,3e3)}),e.journal.length>3e3&&s.jsx("div",{className:"italic mt-2",style:{color:"var(--terminal-text-muted)"},children:"... (truncated)"})]})})]}),s.jsx(uS,{role:e,appearance:N}),c&&s.jsx("div",{className:"px-4 pb-4 mt-auto shrink-0",children:s.jsx("button",{onClick:()=>{c(e.id,e.name),i()},className:"w-full p-2 text-center text-xs font-medium border-2 border-dashed rounded-lg cursor-pointer transition-colors",style:{borderColor:"rgba(239,68,68,0.3)",color:"rgba(239,68,68,0.5)"},children:"Fire Role"})})]})]})]})}function uS({role:e,appearance:l}){const[r,i]=k.useState("idle"),[c,u]=k.useState(""),[d,m]=k.useState(!1),[x,f]=k.useState(null),[g,y]=k.useState(!1),[b,v]=k.useState(!1),[S,j]=k.useState(null);k.useEffect(()=>{bl.getCharacterVersion(e.id).then(N=>f((N==null?void 0:N.version)??null)).catch(()=>f(null)),Ce.getPreferences().then(N=>j(N.instanceId??null)).catch(()=>{})},[e.id]);const C=async()=>{var N,z;if(!d){m(!0);return}i("publishing");try{let O=null;try{O=await Ce.exportSkills(e.id)}catch{}const I={roleId:e.id,persona:e.persona??"",authority:e.authority??{autonomous:[],needsApproval:[]},level:e.level,tagline:((N=(e.persona??"").split(/[.\n]/)[0])==null?void 0:N.trim().slice(0,80))||e.name,chatStyle:"Professional and focused",skills:O??[],resume:{summary:((z=e.persona)==null?void 0:z.split(`
|
|
80
|
+
`)[0])??"",strengths:[],specialties:[],experience:""},author:{id:"tycono",name:"Tycono"},tags:[e.level,e.id],price:"free",installs:0,rating:0,featured:!1,randomActive:!0,randomPersonality:""};l&&(I.appearance=l);let _="1.0.0";try{const q=await bl.getCharacterVersion(e.id);if(q!=null&&q.version){const W=q.version.split(".").map(Number);W[2]=(W[2]??0)+1,_=W.join(".")}}catch{}await bl.publishCharacter({id:e.id,name:e.name||e.id,version:_,data:I,publisherId:S??void 0}),i("done"),u(`Published v${_}`),f(_),m(!1)}catch(O){i("error"),u(O instanceof Error?O.message:"Failed"),m(!1)}},E=async()=>{v(!0);try{await bl.deleteCharacter(e.id,S??void 0),f(null),i("idle"),u(""),y(!1)}catch{u("Delete failed")}v(!1)};return s.jsx("div",{className:"px-4 pb-2 shrink-0",children:s.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:s.jsxs("div",{className:"px-3 py-2.5 flex items-center justify-between gap-2",style:{background:"var(--hud-bg-alt)"},children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider shrink-0",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Cloud Store"}),x&&s.jsxs("span",{className:"text-[9px] px-1.5 py-0.5 rounded shrink-0",style:{background:"rgba(34,197,94,0.1)",color:"rgba(34,197,94,0.6)",border:"1px solid rgba(34,197,94,0.2)"},children:["v",x]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[r==="done"?s.jsxs(s.Fragment,{children:[s.jsx("a",{href:"https://tycono.ai/store.html",target:"_blank",rel:"noopener noreferrer",className:"text-[10px] hover:underline",style:{color:"var(--terminal-text-muted)"},onClick:N=>N.stopPropagation(),children:"View on Store ↗"}),s.jsx("span",{className:"text-[10px] font-semibold",style:{color:"var(--active-green)"},children:c})]}):r==="error"?s.jsx("span",{className:"text-[10px] font-semibold",style:{color:"#ef4444"},children:c}):s.jsx("button",{onClick:C,disabled:r==="publishing",className:"text-[10px] px-2.5 py-1 rounded font-semibold cursor-pointer transition-colors disabled:opacity-50",style:{background:d?"rgba(59,130,246,0.3)":"rgba(59,130,246,0.15)",color:"#60a5fa",border:d?"1px solid rgba(59,130,246,0.5)":"1px solid transparent"},children:r==="publishing"?"Publishing...":d?"Confirm?":x?"Update":"Publish"}),x&&!g&&s.jsx("button",{onClick:()=>y(!0),className:"text-[10px] px-1.5 py-1 rounded cursor-pointer transition-colors",style:{color:"rgba(239,68,68,0.4)"},title:"Remove from store",children:"✕"}),g&&s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:E,disabled:b,className:"text-[10px] px-2 py-1 rounded font-semibold cursor-pointer disabled:opacity-50",style:{background:"rgba(239,68,68,0.2)",color:"#ef4444",border:"1px solid rgba(239,68,68,0.3)"},children:b?"...":"Delete"}),s.jsx("button",{onClick:()=>y(!1),className:"text-[10px] px-1.5 py-1 rounded cursor-pointer",style:{color:"var(--terminal-text-muted)"},children:"No"})]})]})]})})})}function dS({icon:e,roleId:l,roleName:r,color:i,text:c}){const u=!!c;return s.jsx("div",{className:"relative",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsxs("div",{className:"shrink-0",children:[s.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center text-xl shadow-sm",style:{background:`${i}18`,border:`2px solid ${i}44`},children:e}),s.jsx("div",{className:"text-[9px] font-bold text-center mt-0.5 uppercase tracking-wide",style:{color:i},children:l})]}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute top-3 -left-2 w-0 h-0",style:{borderTop:"6px solid transparent",borderBottom:"6px solid transparent",borderRight:`8px solid ${i}12`}}),s.jsxs("div",{className:"rounded-xl rounded-tl-sm p-4 border",style:{background:`${i}08`,borderColor:`${i}22`},children:[s.jsx("div",{className:"text-[10px] font-semibold mb-1.5 uppercase tracking-wider",style:{color:i},children:r}),u?s.jsx("div",{className:"text-sm leading-relaxed",style:{color:"var(--terminal-text)"},children:s.jsx(no,{content:c})}):s.jsx("div",{className:"text-sm italic",style:{color:"var(--terminal-text-muted)"},children:"No recent activity."})]})]})})]})})}function gc({title:e,open:l,onToggle:r,children:i}){return s.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:[s.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:[s.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:e}),s.jsx("span",{className:"text-[10px] transition-transform",style:{color:"var(--terminal-text-muted)",transform:l?"rotate(0deg)":"rotate(-90deg)"},children:"▼"})]}),l&&s.jsx("div",{className:"px-3 pb-3 pt-2",style:{borderTop:"1px solid var(--terminal-border)"},children:i})]})}function b0({onSend:e,disabled:l,placeholder:r,color:i}){const[c,u]=k.useState(""),d=()=>{const m=c.trim();!m||l||(e(m),u(""))};return s.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[s.jsx("input",{type:"text",value:c,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),d())},placeholder: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)"}}),s.jsx("button",{onClick:d,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:s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M22 2L11 13"}),s.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})}function Cf({label:e,value:l}){return s.jsxs("div",{className:"flex justify-between py-1.5 text-xs",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:e}),s.jsx("span",{className:"font-semibold",style:{color:"var(--terminal-text)"},children:l})]})}function fS(e,l){var r,i=1;e==null&&(e=0),l==null&&(l=0);function c(){var u,d=r.length,m,x=0,f=0;for(u=0;u<d;++u)m=r[u],x+=m.x,f+=m.y;for(x=(x/d-e)*i,f=(f/d-l)*i,u=0;u<d;++u)m=r[u],m.x-=x,m.y-=f}return c.initialize=function(u){r=u},c.x=function(u){return arguments.length?(e=+u,c):e},c.y=function(u){return arguments.length?(l=+u,c):l},c.strength=function(u){return arguments.length?(i=+u,c):i},c}function hS(e){const l=+this._x.call(null,e),r=+this._y.call(null,e);return hg(this.cover(l,r),l,r,e)}function hg(e,l,r,i){if(isNaN(l)||isNaN(r))return e;var c,u=e._root,d={data:i},m=e._x0,x=e._y0,f=e._x1,g=e._y1,y,b,v,S,j,C,E,N;if(!u)return e._root=d,e;for(;u.length;)if((j=l>=(y=(m+f)/2))?m=y:f=y,(C=r>=(b=(x+g)/2))?x=b:g=b,c=u,!(u=u[E=C<<1|j]))return c[E]=d,e;if(v=+e._x.call(null,u.data),S=+e._y.call(null,u.data),l===v&&r===S)return d.next=u,c?c[E]=d:e._root=d,e;do c=c?c[E]=new Array(4):e._root=new Array(4),(j=l>=(y=(m+f)/2))?m=y:f=y,(C=r>=(b=(x+g)/2))?x=b:g=b;while((E=C<<1|j)===(N=(S>=b)<<1|v>=y));return c[N]=u,c[E]=d,e}function mS(e){var l,r,i=e.length,c,u,d=new Array(i),m=new Array(i),x=1/0,f=1/0,g=-1/0,y=-1/0;for(r=0;r<i;++r)isNaN(c=+this._x.call(null,l=e[r]))||isNaN(u=+this._y.call(null,l))||(d[r]=c,m[r]=u,c<x&&(x=c),c>g&&(g=c),u<f&&(f=u),u>y&&(y=u));if(x>g||f>y)return this;for(this.cover(x,f).cover(g,y),r=0;r<i;++r)hg(this,d[r],m[r],e[r]);return this}function xS(e,l){if(isNaN(e=+e)||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(e))+1,u=(i=Math.floor(l))+1;else{for(var d=c-r||1,m=this._root,x,f;r>e||e>=c||i>l||l>=u;)switch(f=(l<i)<<1|e<r,x=new Array(4),x[f]=m,m=x,d*=2,f){case 0:c=r+d,u=i+d;break;case 1:r=c-d,u=i+d;break;case 2:c=r+d,i=u-d;break;case 3:r=c-d,i=u-d;break}this._root&&this._root.length&&(this._root=m)}return this._x0=r,this._y0=i,this._x1=c,this._y1=u,this}function pS(){var e=[];return this.visit(function(l){if(!l.length)do e.push(l.data);while(l=l.next)}),e}function yS(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function On(e,l,r,i,c){this.node=e,this.x0=l,this.y0=r,this.x1=i,this.y1=c}function gS(e,l,r){var i,c=this._x0,u=this._y0,d,m,x,f,g=this._x1,y=this._y1,b=[],v=this._root,S,j;for(v&&b.push(new On(v,c,u,g,y)),r==null?r=1/0:(c=e-r,u=l-r,g=e+r,y=l+r,r*=r);S=b.pop();)if(!(!(v=S.node)||(d=S.x0)>g||(m=S.y0)>y||(x=S.x1)<c||(f=S.y1)<u))if(v.length){var C=(d+x)/2,E=(m+f)/2;b.push(new On(v[3],C,E,x,f),new On(v[2],d,E,C,f),new On(v[1],C,m,x,E),new On(v[0],d,m,C,E)),(j=(l>=E)<<1|e>=C)&&(S=b[b.length-1],b[b.length-1]=b[b.length-1-j],b[b.length-1-j]=S)}else{var N=e-+this._x.call(null,v.data),z=l-+this._y.call(null,v.data),O=N*N+z*z;if(O<r){var I=Math.sqrt(r=O);c=e-I,u=l-I,g=e+I,y=l+I,i=v.data}}return i}function bS(e){if(isNaN(g=+this._x.call(null,e))||isNaN(y=+this._y.call(null,e)))return this;var l,r=this._root,i,c,u,d=this._x0,m=this._y0,x=this._x1,f=this._y1,g,y,b,v,S,j,C,E;if(!r)return this;if(r.length)for(;;){if((S=g>=(b=(d+x)/2))?d=b:x=b,(j=y>=(v=(m+f)/2))?m=v:f=v,l=r,!(r=r[C=j<<1|S]))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!==e;)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 vS(e){for(var l=0,r=e.length;l<r;++l)this.remove(e[l]);return this}function wS(){return this._root}function kS(){var e=0;return this.visit(function(l){if(!l.length)do++e;while(l=l.next)}),e}function jS(e){var l=[],r,i=this._root,c,u,d,m,x;for(i&&l.push(new On(i,this._x0,this._y0,this._x1,this._y1));r=l.pop();)if(!e(i=r.node,u=r.x0,d=r.y0,m=r.x1,x=r.y1)&&i.length){var f=(u+m)/2,g=(d+x)/2;(c=i[3])&&l.push(new On(c,f,g,m,x)),(c=i[2])&&l.push(new On(c,u,g,f,x)),(c=i[1])&&l.push(new On(c,f,d,m,g)),(c=i[0])&&l.push(new On(c,u,d,f,g))}return this}function SS(e){var l=[],r=[],i;for(this._root&&l.push(new On(this._root,this._x0,this._y0,this._x1,this._y1));i=l.pop();){var c=i.node;if(c.length){var u,d=i.x0,m=i.y0,x=i.x1,f=i.y1,g=(d+x)/2,y=(m+f)/2;(u=c[0])&&l.push(new On(u,d,m,g,y)),(u=c[1])&&l.push(new On(u,g,m,x,y)),(u=c[2])&&l.push(new On(u,d,y,g,f)),(u=c[3])&&l.push(new On(u,g,y,x,f))}r.push(i)}for(;i=r.pop();)e(i.node,i.x0,i.y0,i.x1,i.y1);return this}function CS(e){return e[0]}function ES(e){return arguments.length?(this._x=e,this):this._x}function NS(e){return e[1]}function AS(e){return arguments.length?(this._y=e,this):this._y}function Fh(e,l,r){var i=new _h(l??CS,r??NS,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function _h(e,l,r,i,c,u){this._x=e,this._y=l,this._x0=r,this._y0=i,this._x1=c,this._y1=u,this._root=void 0}function v0(e){for(var l={data:e.data},r=l;e=e.next;)r=r.next={data:e.data};return l}var Bn=Fh.prototype=_h.prototype;Bn.copy=function(){var e=new _h(this._x,this._y,this._x0,this._y0,this._x1,this._y1),l=this._root,r,i;if(!l)return e;if(!l.length)return e._root=v0(l),e;for(r=[{source:l,target:e._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]=v0(i));return e};Bn.add=hS;Bn.addAll=mS;Bn.cover=xS;Bn.data=pS;Bn.extent=yS;Bn.find=gS;Bn.remove=bS;Bn.removeAll=vS;Bn.root=wS;Bn.size=kS;Bn.visit=jS;Bn.visitAfter=SS;Bn.x=ES;Bn.y=AS;function Oa(e){return function(){return e}}function sa(e){return(e()-.5)*1e-6}function DS(e){return e.x+e.vx}function TS(e){return e.y+e.vy}function zS(e){var l,r,i,c=1,u=1;typeof e!="function"&&(e=Oa(e==null?1:+e));function d(){for(var f,g=l.length,y,b,v,S,j,C,E=0;E<u;++E)for(y=Fh(l,DS,TS).visitAfter(m),f=0;f<g;++f)b=l[f],j=r[b.index],C=j*j,v=b.x+b.vx,S=b.y+b.vy,y.visit(N);function N(z,O,I,_,q){var W=z.data,Y=z.r,T=j+Y;if(W){if(W.index>b.index){var $=v-W.x-W.vx,B=S-W.y-W.vy,G=$*$+B*B;G<T*T&&($===0&&($=sa(i),G+=$*$),B===0&&(B=sa(i),G+=B*B),G=(T-(G=Math.sqrt(G)))/G*c,b.vx+=($*=G)*(T=(Y*=Y)/(C+Y)),b.vy+=(B*=G)*T,W.vx-=$*(T=1-T),W.vy-=B*T)}return}return O>v+T||_<v-T||I>S+T||q<S-T}}function m(f){if(f.data)return f.r=r[f.data.index];for(var g=f.r=0;g<4;++g)f[g]&&f[g].r>f.r&&(f.r=f[g].r)}function x(){if(l){var f,g=l.length,y;for(r=new Array(g),f=0;f<g;++f)y=l[f],r[y.index]=+e(y,f,l)}}return d.initialize=function(f,g){l=f,i=g,x()},d.iterations=function(f){return arguments.length?(u=+f,d):u},d.strength=function(f){return arguments.length?(c=+f,d):c},d.radius=function(f){return arguments.length?(e=typeof f=="function"?f:Oa(+f),x(),d):e},d}function MS(e){return e.index}function w0(e,l){var r=e.get(l);if(!r)throw new Error("node not found: "+l);return r}function RS(e){var l=MS,r=y,i,c=Oa(30),u,d,m,x,f,g=1;e==null&&(e=[]);function y(C){return 1/Math.min(m[C.source.index],m[C.target.index])}function b(C){for(var E=0,N=e.length;E<g;++E)for(var z=0,O,I,_,q,W,Y,T;z<N;++z)O=e[z],I=O.source,_=O.target,q=_.x+_.vx-I.x-I.vx||sa(f),W=_.y+_.vy-I.y-I.vy||sa(f),Y=Math.sqrt(q*q+W*W),Y=(Y-u[z])/Y*C*i[z],q*=Y,W*=Y,_.vx-=q*(T=x[z]),_.vy-=W*T,I.vx+=q*(T=1-T),I.vy+=W*T}function v(){if(d){var C,E=d.length,N=e.length,z=new Map(d.map((I,_)=>[l(I,_,d),I])),O;for(C=0,m=new Array(E);C<N;++C)O=e[C],O.index=C,typeof O.source!="object"&&(O.source=w0(z,O.source)),typeof O.target!="object"&&(O.target=w0(z,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(N);C<N;++C)O=e[C],x[C]=m[O.source.index]/(m[O.source.index]+m[O.target.index]);i=new Array(N),S(),u=new Array(N),j()}}function S(){if(d)for(var C=0,E=e.length;C<E;++C)i[C]=+r(e[C],C,e)}function j(){if(d)for(var C=0,E=e.length;C<E;++C)u[C]=+c(e[C],C,e)}return b.initialize=function(C,E){d=C,f=E,v()},b.links=function(C){return arguments.length?(e=C,v(),b):e},b.id=function(C){return arguments.length?(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:Oa(+C),S(),b):r},b.distance=function(C){return arguments.length?(c=typeof C=="function"?C:Oa(+C),j(),b):c},b}var FS={value:()=>{}};function mg(){for(var e=0,l=arguments.length,r={},i;e<l;++e){if(!(i=arguments[e]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new zc(r)}function zc(e){this._=e}function _S(e,l){return e.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}})}zc.prototype=mg.prototype={constructor:zc,on:function(e,l){var r=this._,i=_S(e+"",r),c,u=-1,d=i.length;if(arguments.length<2){for(;++u<d;)if((c=(e=i[u]).type)&&(c=OS(r[c],e.name)))return c;return}if(l!=null&&typeof l!="function")throw new Error("invalid callback: "+l);for(;++u<d;)if(c=(e=i[u]).type)r[c]=k0(r[c],e.name,l);else if(l==null)for(c in r)r[c]=k0(r[c],e.name,null);return this},copy:function(){var e={},l=this._;for(var r in l)e[r]=l[r].slice();return new zc(e)},call:function(e,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(e))throw new Error("unknown type: "+e);for(u=this._[e],i=0,c=u.length;i<c;++i)u[i].value.apply(l,r)},apply:function(e,l,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],c=0,u=i.length;c<u;++c)i[c].value.apply(l,r)}};function OS(e,l){for(var r=0,i=e.length,c;r<i;++r)if((c=e[r]).name===l)return c.value}function k0(e,l,r){for(var i=0,c=e.length;i<c;++i)if(e[i].name===l){e[i]=FS,e=e.slice(0,i).concat(e.slice(i+1));break}return r!=null&&e.push({name:l,value:r}),e}var Ai=0,Ls=0,_s=0,xg=1e3,Ic,Hs,Uc=0,$a=0,Zc=0,Qs=typeof performance=="object"&&performance.now?performance:Date,pg=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function yg(){return $a||(pg(BS),$a=Qs.now()+Zc)}function BS(){$a=0}function rh(){this._call=this._time=this._next=null}rh.prototype=gg.prototype={constructor:rh,restart:function(e,l,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?yg():+r)+(l==null?0:+l),!this._next&&Hs!==this&&(Hs?Hs._next=this:Ic=this,Hs=this),this._call=e,this._time=r,ah()},stop:function(){this._call&&(this._call=null,this._time=1/0,ah())}};function gg(e,l,r){var i=new rh;return i.restart(e,l,r),i}function $S(){yg(),++Ai;for(var e=Ic,l;e;)(l=$a-e._time)>=0&&e._call.call(void 0,l),e=e._next;--Ai}function j0(){$a=(Uc=Qs.now())+Zc,Ai=Ls=0;try{$S()}finally{Ai=0,HS(),$a=0}}function LS(){var e=Qs.now(),l=e-Uc;l>xg&&(Zc-=l,Uc=e)}function HS(){for(var e,l=Ic,r,i=1/0;l;)l._call?(i>l._time&&(i=l._time),e=l,l=l._next):(r=l._next,l._next=null,l=e?e._next=r:Ic=r);Hs=e,ah(i)}function ah(e){if(!Ai){Ls&&(Ls=clearTimeout(Ls));var l=e-$a;l>24?(e<1/0&&(Ls=setTimeout(j0,e-Qs.now()-Zc)),_s&&(_s=clearInterval(_s))):(_s||(Uc=Qs.now(),_s=setInterval(LS,xg)),Ai=1,pg(j0))}}const IS=1664525,US=1013904223,S0=4294967296;function YS(){let e=1;return()=>(e=(IS*e+US)%S0)/S0}function qS(e){return e.x}function XS(e){return e.y}var VS=10,GS=Math.PI*(3-Math.sqrt(5));function KS(e){var l,r=1,i=.001,c=1-Math.pow(i,1/300),u=0,d=.6,m=new Map,x=gg(y),f=mg("tick","end"),g=YS();e==null&&(e=[]);function y(){b(),f.call("tick",l),r<i&&(x.stop(),f.call("end",l))}function b(j){var C,E=e.length,N;j===void 0&&(j=1);for(var z=0;z<j;++z)for(r+=(u-r)*c,m.forEach(function(O){O(r)}),C=0;C<E;++C)N=e[C],N.fx==null?N.x+=N.vx*=d:(N.x=N.fx,N.vx=0),N.fy==null?N.y+=N.vy*=d:(N.y=N.fy,N.vy=0);return l}function v(){for(var j=0,C=e.length,E;j<C;++j){if(E=e[j],E.index=j,E.fx!=null&&(E.x=E.fx),E.fy!=null&&(E.y=E.fy),isNaN(E.x)||isNaN(E.y)){var N=VS*Math.sqrt(.5+j),z=j*GS;E.x=N*Math.cos(z),E.y=N*Math.sin(z)}(isNaN(E.vx)||isNaN(E.vy))&&(E.vx=E.vy=0)}}function S(j){return j.initialize&&j.initialize(e,g),j}return v(),l={tick:b,restart:function(){return x.restart(y),l},stop:function(){return x.stop(),l},nodes:function(j){return arguments.length?(e=j,v(),m.forEach(S),l):e},alpha:function(j){return arguments.length?(r=+j,l):r},alphaMin:function(j){return arguments.length?(i=+j,l):i},alphaDecay:function(j){return arguments.length?(c=+j,l):+c},alphaTarget:function(j){return arguments.length?(u=+j,l):u},velocityDecay:function(j){return arguments.length?(d=1-j,l):1-d},randomSource:function(j){return arguments.length?(g=j,m.forEach(S),l):g},force:function(j,C){return arguments.length>1?(C==null?m.delete(j):m.set(j,S(C)),l):m.get(j)},find:function(j,C,E){var N=0,z=e.length,O,I,_,q,W;for(E==null?E=1/0:E*=E,N=0;N<z;++N)q=e[N],O=j-q.x,I=C-q.y,_=O*O+I*I,_<E&&(W=q,E=_);return W},on:function(j,C){return arguments.length>1?(f.on(j,C),l):f.on(j)}}}function WS(){var e,l,r,i,c=Oa(-30),u,d=1,m=1/0,x=.81;function f(v){var S,j=e.length,C=Fh(e,qS,XS).visitAfter(y);for(i=v,S=0;S<j;++S)l=e[S],C.visit(b)}function g(){if(e){var v,S=e.length,j;for(u=new Array(S),v=0;v<S;++v)j=e[v],u[j.index]=+c(j,v,e)}}function y(v){var S=0,j,C,E=0,N,z,O;if(v.length){for(N=z=O=0;O<4;++O)(j=v[O])&&(C=Math.abs(j.value))&&(S+=j.value,E+=C,N+=C*j.x,z+=C*j.y);v.x=N/E,v.y=z/E}else{j=v,j.x=j.data.x,j.y=j.data.y;do S+=u[j.data.index];while(j=j.next)}v.value=S}function b(v,S,j,C){if(!v.value)return!0;var E=v.x-l.x,N=v.y-l.y,z=C-S,O=E*E+N*N;if(z*z/x<O)return O<m&&(E===0&&(E=sa(r),O+=E*E),N===0&&(N=sa(r),O+=N*N),O<d&&(O=Math.sqrt(d*O)),l.vx+=E*v.value*i/O,l.vy+=N*v.value*i/O),!0;if(v.length||O>=m)return;(v.data!==l||v.next)&&(E===0&&(E=sa(r),O+=E*E),N===0&&(N=sa(r),O+=N*N),O<d&&(O=Math.sqrt(d*O)));do v.data!==l&&(z=u[v.data.index]*i/O,l.vx+=E*z,l.vy+=N*z);while(v=v.next)}return f.initialize=function(v,S){e=v,r=S,g()},f.strength=function(v){return arguments.length?(c=typeof v=="function"?v:Oa(+v),g(),f):c},f.distanceMin=function(v){return arguments.length?(d=v*v,f):Math.sqrt(d)},f.distanceMax=function(v){return arguments.length?(m=v*v,f):Math.sqrt(m)},f.theta=function(v){return arguments.length?(x=v*v,f):Math.sqrt(x)},f}const Zs={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 QS(e){return Zs[e]??Zs.general}function ZS({docs:e,onNodeClick:l,selectedDocId:r}){var $;const i=k.useRef(null),c=k.useRef(null),[u,d]=k.useState({width:600,height:400}),[m,x]=k.useState({nodes:[],links:[]}),[f,g]=k.useState(null),[y,b]=k.useState(null),[v,S]=k.useState({x:0,y:0}),[j,C]=k.useState({x:0,y:0,w:600,h:400}),E=k.useRef(!1),N=k.useRef({x:0,y:0,vx:0,vy:0}),z=k.useRef(null),O=k.useRef(null);k.useEffect(()=>{const B=i.current;if(!B)return;const G=new ResizeObserver(ne=>{const{width:V,height:U}=ne[0].contentRect;V>0&&U>0&&(d({width:V,height:U}),C(J=>({...J,w:V,h:U})))});return G.observe(B),()=>G.disconnect()},[]),k.useEffect(()=>{if(e.length===0)return;const B=new Set(e.map(ve=>ve.id)),G=e.map(ve=>({id:ve.id,title:ve.title,category:ve.category,akb_type:ve.akb_type})),ne=(ve,Fe)=>{if(!Fe.startsWith(".")&&!Fe.startsWith("/"))return Fe;const Me=ve.split("/");Me.pop();const $e=Fe.split("/");for(const fe of $e)fe===".."?Me.pop():fe!=="."&&fe!==""&&Me.push(fe);return Me.join("/")},V=[];for(const ve of e)for(const Fe of ve.links){const Me=ne(ve.id,Fe.href);B.has(Me)&&Me!==ve.id&&(V.some($e=>$e.source===ve.id&&$e.target===Me||$e.source===Me&&$e.target===ve.id)||V.push({source:ve.id,target:Me,label:Fe.text}))}const{width:U,height:J}=u,ie=G.length,je=ie>100?-600:ie>50?-500:-400,R=ie>100?180:ie>50?160:140,M=ie>100?60:50,K=Math.max(U,ie*12),D=Math.max(J,ie*10),de=KS(G).force("link",RS(V).id(ve=>ve.id).distance(R)).force("charge",WS().strength(je)).force("center",fS(K/2,D/2)).force("collide",zS(M));O.current=de,de.on("tick",()=>{x({nodes:[...G],links:[...V]})}),de.alpha(1).restart();const Se=ie>100?300:150;for(let ve=0;ve<Se;ve++)de.tick();if(de.stop(),x({nodes:[...G],links:[...V]}),G.length>0){let ve=1/0,Fe=1/0,Me=-1/0,$e=-1/0;for(const tt of G){const mt=tt.x??0,he=tt.y??0;mt<ve&&(ve=mt),he<Fe&&(Fe=he),mt>Me&&(Me=mt),he>$e&&($e=he)}const fe=100;C({x:ve-fe,y:Fe-fe,w:Math.max(U,Me-ve+fe*2),h:Math.max(J,$e-Fe+fe*2)})}return()=>{de.stop()}},[e,u]);const I=B=>{if(typeof B=="string"){const G=m.nodes.find(ne=>ne.id===B);return{x:(G==null?void 0:G.x)??0,y:(G==null?void 0:G.y)??0}}return{x:B.x??0,y:B.y??0}},_=k.useCallback(B=>{B.preventDefault();const G=B.deltaY>0?1.1:.9;C(ne=>{const V=Math.max(200,Math.min(u.width*3,ne.w*G)),U=Math.max(150,Math.min(u.height*3,ne.h*G)),J=(V-ne.w)/2,ie=(U-ne.h)/2;return{x:ne.x-J,y:ne.y-ie,w:V,h:U}})},[u]),q=k.useCallback(B=>{B.button===0&&(E.current=!0,N.current={x:B.clientX,y:B.clientY,vx:j.x,vy:j.y})},[j]),W=k.useCallback(B=>{var G;if(z.current){const ne=c.current;if(!ne)return;const V=ne.getBoundingClientRect(),U=j.w/V.width,J=j.h/V.height,ie=j.x+(B.clientX-V.left)*U,je=j.y+(B.clientY-V.top)*J;z.current.fx=ie,z.current.fy=je,(G=O.current)==null||G.alpha(.3).restart();return}if(E.current){const ne=(B.clientX-N.current.x)*(j.w/u.width),V=(B.clientY-N.current.y)*(j.h/u.height);C(U=>({...U,x:N.current.vx-ne,y:N.current.vy-V}))}},[j,u]),Y=k.useCallback(()=>{E.current=!1,z.current&&(z.current.fx=null,z.current.fy=null,z.current=null)},[]),T=k.useCallback((B,G)=>{var ne;B.stopPropagation(),z.current=G,(ne=O.current)==null||ne.alpha(.3).restart()},[]);return s.jsxs("div",{ref:i,className:"relative flex-1 overflow-hidden",style:{background:"#1e1e2e"},children:[s.jsxs("svg",{ref:c,width:u.width,height:u.height,viewBox:`${j.x} ${j.y} ${j.w} ${j.h}`,style:{display:"block",cursor:E.current?"grabbing":"grab"},onWheel:_,onMouseDown:q,onMouseMove:W,onMouseUp:Y,onMouseLeave:Y,children:[s.jsx("defs",{children:s.jsx("pattern",{id:"grid",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:s.jsx("circle",{cx:"0",cy:"0",r:"0.5",fill:"rgba(255,255,255,0.06)"})})}),s.jsx("rect",{x:j.x-100,y:j.y-100,width:j.w+200,height:j.h+200,fill:"url(#grid)",pointerEvents:"none"}),m.links.map((B,G)=>{const ne=I(B.source),V=I(B.target),U=y===G,J=(ne.x+V.x)/2,ie=(ne.y+V.y)/2;return s.jsxs("g",{children:[s.jsx("line",{x1:ne.x,y1:ne.y,x2:V.x,y2:V.y,stroke:"transparent",strokeWidth:12,style:{cursor:"default"},onMouseEnter:()=>b(G),onMouseLeave:()=>b(null)}),s.jsx("line",{x1:ne.x,y1:ne.y,x2:V.x,y2:V.y,stroke:U?"rgba(148,163,184,0.7)":"rgba(148,163,184,0.3)",strokeWidth:U?2:1.5,strokeDasharray:"4 3",pointerEvents:"none"}),U&&B.label&&s.jsx("text",{x:J,y:ie-6,textAnchor:"middle",fill:"#e2e8f0",fontSize:9,fontFamily:"monospace",style:{pointerEvents:"none"},children:s.jsx("tspan",{style:{filter:"drop-shadow(0 0 2px rgba(0,0,0,0.8))"},children:B.label.length>30?B.label.slice(0,28)+"..":B.label})})]},G)}),m.nodes.map(B=>{const G=Zs[B.category]??Zs.general,ne=B.akb_type==="hub",V=ne?24:16,U=(f==null?void 0:f.id)===B.id,J=r===B.id,ie=U?1.2:J?1.15:1;return s.jsxs("g",{transform:`translate(${B.x??0}, ${B.y??0}) scale(${ie})`,style:{cursor:"pointer",transition:"transform 0.15s ease"},onClick:je=>{je.stopPropagation();const R=e.find(M=>M.id===B.id);R&&l(R)},onMouseDown:je=>T(je,B),onMouseEnter:je=>{var M;g(B);const R=(M=i.current)==null?void 0:M.getBoundingClientRect();R&&S({x:je.clientX-R.left,y:je.clientY-R.top})},onMouseLeave:()=>g(null),children:[J&&s.jsx("rect",{x:-V/2-4,y:-V/2-4,width:V+8,height:V+8,fill:"none",stroke:"#22c55e",strokeWidth:2,rx:ne?5:2,opacity:.6}),s.jsx("rect",{x:-V/2,y:-V/2,width:V,height:V,fill:G.border,rx:ne?4:2,opacity:U?1:.9}),s.jsx("rect",{x:-V/2+3,y:-V/2+3,width:Math.max(0,V-6),height:Math.max(0,V-6),fill:G.bg,rx:ne?3:1}),s.jsx("text",{y:V/2+14,textAnchor:"middle",fill:J?"#e2e8f0":"#94a3b8",fontSize:11,fontFamily:"monospace",fontWeight:J?"bold":"normal",style:{pointerEvents:"none"},children:B.title.length>24?B.title.slice(0,22)+"..":B.title})]},B.id)})]}),f&&!z.current&&s.jsxs("div",{className:"absolute z-10 pointer-events-none p-2.5 rounded text-xs max-w-[240px]",style:{left:Math.min(v.x+16,u.width-250),top:Math.max(v.y-30,8),background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",boxShadow:"0 4px 12px rgba(0,0,0,0.4)"},children:[s.jsx("div",{className:"font-bold mb-1",children:f.title}),s.jsxs("div",{className:"text-[10px] opacity-60 mb-1",children:[f.akb_type.toUpperCase()," / ",f.category]}),(($=e.find(B=>B.id===f.id))==null?void 0:$.tldr)&&s.jsx("div",{className:"text-[10px] opacity-80 mb-1",children:e.find(B=>B.id===f.id).tldr}),s.jsx("div",{className:"text-[10px] text-green-400",children:"Click to open | Drag to move"})]}),e.length===0&&s.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"No knowledge documents found"})]})}function JS({doc:e,allDocs:l,onOpen:r,onNavigateDoc:i}){const[c,u]=k.useState(!1),d=QS(e.category),m=e.akb_type==="hub",x=new Set(l.map(f=>f.id));return s.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:[s.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>u(!c),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:"shrink-0 text-sm",children:m?"🗂":e.format==="html"?"🌐":"📄"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[s.jsx("span",{className:"font-semibold text-xs truncate",style:{color:"var(--terminal-text)"},children:e.title}),s.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:e.status==="active"?"#16a34a":e.status==="draft"?"#f59e0b":"#94a3b8"},title:e.status})]}),s.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:e.tags.slice(0,4).map(f=>s.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium",style:{background:d.bg,color:d.text,border:`1px solid ${d.border}`},children:f},f))})]}),s.jsx("span",{className:"text-xs shrink-0",style:{color:"var(--terminal-text-muted)"},children:c?"▲":"▼"})]}),!c&&e.tldr&&s.jsx("div",{className:"mt-1.5 text-[10px] line-clamp-2 ml-6",style:{color:"var(--terminal-text-secondary)"},children:e.tldr})]}),c&&s.jsxs("div",{className:"px-3 pb-3",style:{borderTop:"1px solid var(--terminal-border)"},children:[e.tldr&&s.jsx("div",{className:"mt-2 text-[11px] leading-relaxed italic",style:{color:"var(--terminal-text-secondary)"},children:e.tldr}),e.links.length>0&&s.jsxs("div",{className:"mt-2",children:[s.jsx("div",{className:"text-[9px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Cross-links"}),s.jsx("div",{className:"flex flex-wrap gap-1",children:e.links.slice(0,5).map((f,g)=>{const y=f.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,""),b=x.has(y);return s.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:["🔗"," ",f.text]},g)})})]}),s.jsxs("button",{className:"mt-2 text-[10px] font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},onClick:f=>{f.stopPropagation(),r(e)},children:["Open full ","→"]})]})]})}function PS({docId:e,onBack:l,onDocUpdated:r,onDelete:i,onNavigateDoc:c,allDocs:u}){const[d,m]=k.useState(null),[x,f]=k.useState(!0),[g,y]=k.useState(!1),[b,v]=k.useState(""),[S,j]=k.useState(!1),C=new Set(u.map(I=>I.id)),E=k.useCallback(I=>{const _=I.split("#")[0];if(!_.match(/\.(md|html)$/))return null;const q=e.includes("/")?e.replace(/\/[^/]+$/,""):"";let W;if(_.startsWith("./"))W=q?`${q}/${_.slice(2)}`:_.slice(2);else if(_.startsWith("../")){const $=q.split("/").filter(Boolean);let B=_;for(;B.startsWith("../");)$.length>0&&$.pop(),B=B.slice(3);W=$.length>0?`${$.join("/")}/${B}`:B}else W=_;if(C.has(W))return W;const Y=W.split("/").pop()??"",T=u.find($=>$.id===Y||$.id.endsWith("/"+Y));return T?T.id:null},[e,C,u]),N=k.useCallback(I=>{const q=I.target.closest("a");if(!q)return;const W=q.getAttribute("href");if(!W||W.startsWith("http://")||W.startsWith("https://")||!W.match(/\.(md|html)(#.*)?$/))return;I.preventDefault(),I.stopPropagation();const Y=E(W);Y&&c(Y)},[E,c]);k.useEffect(()=>{f(!0),Ce.getKnowledgeDoc(e).then(I=>{m(I),v(I.content)}).catch(console.error).finally(()=>f(!1))},[e]);const z=async()=>{if(d){j(!0);try{await Ce.updateKnowledgeDoc(e,b),m({...d,content:b}),y(!1),r()}catch(I){console.error("Save failed:",I)}finally{j(!1)}}},O=async()=>{if(confirm(`Delete "${d==null?void 0:d.title}"?`))try{await Ce.deleteKnowledgeDoc(e),i(e)}catch(I){console.error("Delete failed:",I)}};return x?s.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Loading..."}):d?s.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col",children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Back"]}),s.jsx("div",{className:"flex-1"}),g?s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>{y(!1),v(d.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"}),s.jsx("button",{onClick:z,disabled:S,className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold text-white",style:{background:S?"#86efac":"#16a34a"},children:S?"Saving...":"Save"})]}):s.jsxs(s.Fragment,{children:[s.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"}),s.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"})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[s.jsx("h2",{className:"text-sm font-bold mb-1",style:{color:"var(--terminal-text)"},children:d.title}),d.tldr&&!g&&s.jsx("div",{className:"mb-3 text-xs italic",style:{color:"var(--terminal-text-secondary)"},children:d.tldr}),d.format==="html"?g?s.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:I=>v(I.target.value),spellCheck:!1}):s.jsx("iframe",{srcDoc:d.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:d.title}):g?s.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:I=>v(I.target.value),spellCheck:!1}):s.jsx("div",{className:"text-xs leading-relaxed",style:{color:"var(--terminal-text-secondary)"},onClick:N,children:s.jsx(no,{content:d.content})})]})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Failed to load document"})}function eC({onCreated:e,onCancel:l}){const[r,i]=k.useState(""),[c,u]=k.useState(""),[d,m]=k.useState(""),[x,f]=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}f(!0),y("");try{const v=await Ce.createKnowledgeDoc({filename:c,title:r,category:d||void 0});e(v.id)}catch(v){y(v instanceof Error?v.message:"Failed to create")}finally{f(!1)}};return s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[s.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Cancel"]}),s.jsx("h2",{className:"text-sm font-bold",style:{color:"var(--terminal-text)"},children:"New Document"})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"TITLE"}),s.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)"}})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"FILENAME"}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.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)"}}),s.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:".md"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"CATEGORY (optional)"}),s.jsx("input",{type:"text",value:d,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&&s.jsx("div",{className:"text-[10px] px-3 py-1.5 rounded",style:{background:"rgba(239,68,68,0.15)",color:"#f87171"},children:g}),s.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 tC=500,C0=360,E0=700;function Oh(e){const[l,r]=k.useState(tC),[i,c]=k.useState(!1),u=k.useRef(0),d=k.useRef(0),m=e>0,x=m?e:0,f=m?Math.max(C0,window.innerWidth-e-100):E0,g=Math.min(l,f),y=k.useCallback(b=>{b.preventDefault(),u.current=b.clientX,d.current=g,c(!0);const v=j=>{const C=u.current-j.clientX,E=Math.min(E0,Math.max(C0,d.current+C));r(E)},S=()=>{c(!1),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",S)};document.addEventListener("mousemove",v),document.addEventListener("mouseup",S)},[g]);return{panelRight:x,panelWidth:g,isResizing:i,handleResizeStart:y}}function nC({docs:e,onClose:l,onRefresh:r,terminalWidth:i=0,initialDocId:c}){const[u,d]=k.useState("list"),[m,x]=k.useState("all"),[f,g]=k.useState(c??null),[y,b]=k.useState(""),[v,S]=k.useState(!1),[j,C]=k.useState(null),{panelRight:E,panelWidth:N,isResizing:z,handleResizeStart:O}=Oh(i),I=["all",...Array.from(new Set(e.map($=>$.category))).sort()],_=e.filter($=>{if(m!=="all"&&$.category!==m)return!1;if(y){const B=y.toLowerCase();return $.title.toLowerCase().includes(B)||($.tldr??"").toLowerCase().includes(B)||$.tags.some(G=>G.toLowerCase().includes(B))}return!0}),q=$=>{S(!1),r(),g($)},W=$=>{g(null),r()},Y=$=>{C($.id)},T=j?e.find($=>$.id===j):null;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:E},onClick:l}),s.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${z?"resizing":""}`,style:{right:E,width:N,background:"var(--terminal-bg)",borderLeftColor:"#16a34a"},children:[s.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${z?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:O}),s.jsxs("div",{className:"p-5 text-white relative",style:{background:"#16a34a"},children:[s.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:"×"}),s.jsxs("div",{className:"text-lg font-bold",children:["📚"," Knowledge Base"]}),s.jsxs("div",{className:"text-xs opacity-80 mt-0.5",children:[e.length," documents"]})]}),s.jsxs("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx(N0,{label:"List",active:u==="list",onClick:()=>{d("list"),C(null)}}),s.jsx(N0,{label:"Graph",active:u==="graph",onClick:()=>d("graph")})]}),u==="list"&&!f&&!v&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx("input",{type:"text",value:y,onChange:$=>b($.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)"}}),s.jsx("button",{onClick:()=>S(!0),className:"px-2.5 py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white shrink-0",style:{background:"#16a34a"},children:"+ New"})]}),s.jsx("div",{className:"flex overflow-x-auto shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",scrollbarWidth:"none"},children:I.map($=>s.jsx("button",{onClick:()=>x($),className:"px-3 py-1.5 text-[10px] font-medium cursor-pointer whitespace-nowrap",style:{color:m===$?"#4ade80":"var(--terminal-text-muted)",borderBottom:m===$?"2px solid #4ade80":"2px solid transparent"},children:$==="all"?`All (${e.length})`:`${$} (${e.filter(B=>B.category===$).length})`},$))}),s.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:_.length===0?s.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"}):_.map($=>s.jsx(JS,{doc:$,allDocs:e,onOpen:B=>g(B.id),onNavigateDoc:B=>g(B)},$.id))})]}),u==="list"&&f&&!v&&s.jsx(PS,{docId:f,onBack:()=>g(null),onDocUpdated:r,onDelete:W,onNavigateDoc:$=>g($),allDocs:e}),u==="list"&&v&&s.jsx(eC,{onCreated:q,onCancel:()=>S(!1)}),u==="graph"&&s.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[s.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[s.jsx(ZS,{docs:e,onNodeClick:Y,selectedDocId:j}),T&&s.jsxs("div",{className:"shrink-0 overflow-y-auto p-3",style:{width:200,background:"var(--hud-bg-alt)",borderLeft:"1px solid var(--terminal-border)"},children:[s.jsx("div",{className:"text-[10px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Selected"}),s.jsx("div",{className:"text-xs font-bold mb-1",style:{color:"var(--terminal-text)"},children:T.title}),s.jsx("div",{className:"w-2 h-2 rounded-full mb-2",style:{background:T.status==="active"?"#16a34a":T.status==="draft"?"#f59e0b":"#94a3b8"}}),T.tldr&&s.jsx("div",{className:"text-[10px] mb-2 leading-relaxed",style:{color:"var(--terminal-text-secondary)"},children:T.tldr}),T.links.length>0&&s.jsxs("div",{className:"mb-2",children:[s.jsx("div",{className:"text-[9px] font-bold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Links"}),T.links.slice(0,5).map(($,B)=>s.jsxs("div",{className:"text-[9px] mb-0.5 truncate",style:{color:"var(--terminal-text-secondary)"},children:["🔗"," ",$.text]},B))]}),s.jsx("button",{className:"w-full py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white",style:{background:"#16a34a"},onClick:()=>{d("list"),g(T.id),C(null)},children:"Open Document"})]})]}),s.jsx("div",{className:"shrink-0 p-2",style:{borderTop:"1px solid var(--terminal-border)"},children:s.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(Zs).map(([$,B])=>s.jsxs("div",{className:"flex items-center gap-1 text-[9px]",children:[s.jsx("div",{className:"w-2 h-2",style:{background:B.border}}),s.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:$})]},$))})})]})]})]})}function N0({label:e,active:l,onClick:r}){return s.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:e})}function lC({standups:e,waves:l,decisions:r,mode:i,onClose:c,terminalWidth:u=0}){const[d,m]=k.useState(i==="decisions"?"decisions":"standups"),{panelRight:x,panelWidth:f,isResizing:g,handleResizeStart:y}=Oh(u);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:x},onClick:c}),s.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${g?"resizing":""}`,style:{right:x,width:f,background:"var(--terminal-bg)",borderLeftColor:"var(--desk-wood)"},children:[s.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${g?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:y}),s.jsxs("div",{className:"p-5 bg-[var(--desk-wood)] text-white relative",children:[s.jsx("button",{onClick:c,className:"absolute top-3 right-3 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),s.jsx("div",{className:"text-lg font-bold",children:i==="bulletin"?"📌 Bulletin Board":"📜 Decision Log"})]}),s.jsx("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:i==="bulletin"?s.jsxs(s.Fragment,{children:[s.jsx(Ef,{label:`Standups (${e.length})`,active:d==="standups",onClick:()=>m("standups")}),s.jsx(Ef,{label:`Waves (${l.length})`,active:d==="waves",onClick:()=>m("waves")})]}):s.jsx(Ef,{label:`Decisions (${r.length})`,active:d==="decisions",onClick:()=>m("decisions")})}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[d==="standups"&&e.map((b,v)=>s.jsx(Nf,{title:`Standup ${b.date}`,content:b.content},v)),d==="waves"&&l.map((b,v)=>s.jsx(Nf,{title:`Wave ${b.id}`,subtitle:b.timestamp,content:b.content},v)),d==="decisions"&&r.map((b,v)=>s.jsx(Nf,{title:`#${b.id} ${b.title}`,subtitle:b.date,content:b.content},v))]})]})]})}function Ef({label:e,active:l,onClick:r}){return s.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:e})}function rC(e){return e.replace(/^#{1,6}\s+/gm,"").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/```[\s\S]*?```/g,"").replace(/^\s*[-*+]\s+/gm,"• ").replace(/^\s*\d+\.\s+/gm,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/^>\s+/gm,"").replace(/^---+$/gm,"").replace(/\|[^|]*\|/g,"").replace(/\n{2,}/g," · ").replace(/\n/g," ").trim()}function Nf({title:e,subtitle:l,content:r}){const[i,c]=k.useState(!1),u=r.length>100,d=rC(r).slice(0,160);return s.jsxs("div",{className:"mb-3 rounded-lg overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>c(!i),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"font-medium text-sm",style:{color:"var(--terminal-text)"},children:e}),s.jsx("span",{className:"text-xs shrink-0 ml-2",style:{color:"var(--terminal-text-muted)"},children:i?"▲":"▼"})]}),l&&s.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--terminal-text-muted)"},children:l})]}),i&&s.jsx("div",{className:"px-3 pb-3 text-xs leading-relaxed pt-2",style:{borderTop:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:s.jsx(no,{content:r})}),!i&&u&&s.jsx("div",{className:"px-3 pb-2 text-xs line-clamp-2 leading-relaxed",style:{color:"var(--terminal-text-muted)"},children:d})]})}function aC({projectId:e,onClose:l,terminalWidth:r=0}){const[i,c]=k.useState(null),{panelRight:u,panelWidth:d,isResizing:m,handleResizeStart:x}=Oh(r);if(k.useEffect(()=>{Ce.getProject(e).then(c).catch(console.error)},[e]),!i)return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),s.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px] border-[var(--meeting-blue)]",style:{right:u,width:d,background:"var(--terminal-bg)"},children:s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading project..."})})]});const f=i.tasks.filter(b=>b.status==="done").length,g=i.tasks.length,y=g>0?Math.round(f/g*100):0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),s.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] border-[var(--meeting-blue)] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${m?"resizing":""}`,style:{right:u,width:d,background:"var(--terminal-bg)"},children:[s.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${m?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:x}),s.jsxs("div",{className:"p-5 bg-[var(--meeting-blue)] text-white relative",children:[s.jsx("div",{className:"text-sm opacity-70",children:"Meeting Room"}),s.jsx("button",{onClick: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:"×"}),s.jsx("div",{className:"text-xl font-bold mt-1",children:i.name}),s.jsxs("div",{className:"flex items-center gap-3 mt-3 text-sm",children:[s.jsxs("span",{children:["Tasks: ",g]}),s.jsxs("span",{children:["Done: ",f]}),s.jsxs("span",{children:["Progress: ",y,"%"]})]}),s.jsx("div",{className:"mt-2 h-1.5 bg-white/20 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-white rounded-full transition-all",style:{width:`${y}%`}})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[i.prd&&s.jsxs("div",{className:"mb-5",children:[s.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"PRD"}),s.jsx("div",{className:"rounded-lg p-4 text-xs leading-relaxed max-h-60 overflow-y-auto",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:s.jsx(no,{content:i.prd})})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:["Tasks (",g,")"]}),s.jsx("div",{className:"space-y-2",children:i.tasks.map(b=>s.jsxs("div",{className:"rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sm font-medium",style:{color:"var(--terminal-text)"},children:b.title}),s.jsx(iC,{status:b.status})]}),s.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-muted)"},children:b.role}),b.description&&s.jsx("div",{className:"text-xs mt-1.5 line-clamp-2",style:{color:"var(--terminal-text-secondary)"},children:b.description})]},b.id))})]})]})]})]})}function iC({status:e}){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[e]??l.todo;return s.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:r.bg,color:r.color},children:e})}const sC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function oC({roleId:e,roleName:l,mode:r="assign",onClose:i,onExecutionStart:c}){const[u,d]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const x=()=>{u.trim()&&(c(e,u.trim()),i())},f=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&x(),y.key==="Escape"&&i()},g=sC[e]??"#666";return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[520px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[s.jsxs("div",{className:"p-5 text-white",style:{background:`linear-gradient(135deg, ${g}, ${g}cc)`},children:[s.jsx("div",{className:"text-lg font-bold",children:r==="ask"?"Ask":"Assign Task"}),s.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:r==="ask"?`to ${l}`:`to ${l} (${e})`})]}),s.jsxs("div",{className:"p-5",children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Task Description"}),s.jsx("textarea",{ref:m,value:u,onChange:y=>d(y.target.value),onKeyDown:f,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"}),s.jsx("div",{className:"text-[10px] text-white/30 mt-1",children:"Cmd+Enter to submit"})]}),s.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[s.jsx("button",{onClick:i,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),s.jsx("button",{onClick:x,disabled:!u.trim(),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:g},children:r==="ask"?"Ask":"Assign"})]})]})]})}const A0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function bg({event:e,isThinkingCollapsed:l,onToggleThinking:r,onNavigateToJob:i,onOpenKnowledgeDoc:c,compact:u}){var m;const d=A0[e.roleId]??"#888";switch(e.type){case"text":{const x=e.data.text??"",f=u?x.slice(0,300):x;return/[#*|`\[\]_~>-]/.test(f)?s.jsx("div",{className:"text-green-300/90 leading-relaxed event-markdown",children:s.jsx(Eh,{remarkPlugins:[Th],children:f})}):s.jsx("div",{className:"text-green-300/90 whitespace-pre-wrap leading-relaxed",children:f})}case"thinking":{const x=e.data.text??"";return s.jsxs("div",{className:"group",children:[s.jsxs("button",{onClick:r,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-[10px] cursor-pointer flex items-center gap-1 select-text",children:[s.jsx("span",{children:l?"▶":"▼"}),s.jsx("span",{className:"italic",children:"thinking..."})]}),!l&&s.jsxs("div",{className:`ml-3 text-[var(--terminal-text-muted)] italic whitespace-pre-wrap opacity-60 text-[11px] overflow-hidden ${u?"max-h-[60px]":"max-h-[120px]"}`,children:[x.slice(0,u?200:500),x.length>(u?200:500)?"...":""]})]})}case"tool:start":{const x=String(e.data.name??""),f=e.data.input,g=typeof(f==null?void 0:f.command)=="string"?f.command.slice(0,80):"",y=typeof(f==null?void 0:f.file_path)=="string"?String(f.file_path):typeof(f==null?void 0:f.path)=="string"?String(f.path):"",b=y?y.split("/").pop()??"":"",v=/^(write_file|Write|edit_file|Edit)$/i.test(x),S=(m=y.match(/(?:^|\/)knowledge\/(.+\.md)$/))==null?void 0:m[1],j=v&&S&&c;return s.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[s.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${j?"text-green-400/80 bg-green-400/10":"text-blue-400/80 bg-blue-400/10"}`,children:j?v&&x.toLowerCase().includes("edit")?"Edit":"Write":x}),j?s.jsx("button",{onClick:()=>c(S),className:"text-[10px] text-green-400 hover:text-green-300 underline underline-offset-2 cursor-pointer truncate",style:{maxWidth:u?200:400},children:b}):s.jsxs(s.Fragment,{children:[g&&s.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:g}),b&&s.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:b})]})]})}case"dispatch:start":{const x=e.data.targetRoleId??e.data.roleId??"",f=e.data.task??"",g=e.data.childJobId,y=A0[x]??"#888";return s.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:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{style:{color:y},className:"font-bold text-[11px]",children:["→"," ",x.toUpperCase()]}),s.jsx("span",{className:"text-[var(--terminal-text-secondary)] text-[10px] truncate flex-1",children:f.slice(0,u?60:100)}),g&&i&&s.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/10 text-[var(--terminal-text-muted)]",children:["View ","→"]})]})})}case"dispatch:done":return s.jsx("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pl-3 border-l-2 border-[var(--terminal-border)] my-0.5",children:"Dispatch completed"});case"turn:complete":return s.jsx("div",{className:"border-t border-[var(--terminal-border)] my-2 relative",children:s.jsxs("span",{className:"absolute -top-2 left-2 bg-[var(--terminal-bg)] px-2 text-[9px] text-[var(--terminal-text-muted)]",children:["Turn ",e.data.turn]})});case"stderr":return s.jsxs("div",{className:"text-red-400/80 text-[11px]",children:["⚠"," ",e.data.message]});case"job:start":return s.jsxs("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pb-1",children:[s.jsx("span",{style:{color:d},className:"font-bold",children:e.roleId.toUpperCase()})," ","started: ",(e.data.task??"").slice(0,u?50:80)]});case"job:done":{const x=e.data.turns??0,f=e.data.toolCalls??0;return s.jsx("div",{className:"mt-2 p-2 rounded-lg bg-green-900/20 border border-green-800/30",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-green-400"}),s.jsx("span",{className:"text-green-300 font-bold text-[11px]",children:"Complete"}),s.jsxs("span",{className:"text-[var(--terminal-text-muted)] text-[10px]",children:[x," turns · ",f," tools"]})]})})}case"job:error":return s.jsx("div",{className:"mt-2 p-2 rounded-lg bg-red-900/20 border border-red-800/30",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-red-400"}),s.jsx("span",{className:"text-red-300 font-bold text-[11px]",children:"Error"}),s.jsx("span",{className:"text-red-200/70 text-[10px]",children:e.data.message})]})});case"job:awaiting_input":{const x=e.data.question??"";return s.jsxs("div",{className:"mt-2 p-2 rounded-lg border",style:{background:"#F59E0B11",borderColor:"#F59E0B33"},children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:"#F59E0B",animation:"wave-pulse 1.5s ease-in-out infinite"}}),s.jsx("span",{className:"font-bold text-[11px]",style:{color:"#F59E0B"},children:"Awaiting Reply"})]}),x&&s.jsx("div",{className:"mt-1 text-[11px] text-[var(--terminal-text)] whitespace-pre-wrap",children:x})]})}case"job:reply":return s.jsx("div",{className:"mt-1 p-2 rounded-lg bg-blue-900/20 border border-blue-800/30",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-blue-300 font-bold text-[11px]",children:"CEO replied:"}),s.jsx("span",{className:"text-blue-200/80 text-[11px]",children:e.data.response??""})]})});case"import:scan":case"import:process":case"import:created":return s.jsxs("div",{className:"text-cyan-300/70 text-[11px]",children:["[",e.type,"] ",JSON.stringify(e.data)]});default:return null}}function cC({jobId:e,title:l,color:r,variant:i,style:c,onClose:u,onMinimize:d,onDone:m,onNavigateToJob:x,onOpenKnowledgeDoc:f}){const{events:g,status:y,textOutput:b,childJobIds:v}=P0(e),[S,j]=k.useState(0),[C,E]=k.useState(new Set),N=k.useRef(null),z=k.useRef(Date.now()),O=k.useRef(!1);k.useEffect(()=>{const $=setInterval(()=>{j(Math.floor((Date.now()-z.current)/1e3))},1e3);return()=>clearInterval($)},[]),k.useEffect(()=>{N.current&&(N.current.scrollTop=N.current.scrollHeight)},[g]),k.useEffect(()=>{(y==="done"||y==="error")&&!O.current&&(O.current=!0,m==null||m())},[y,m]);const I=$=>{E(B=>{const G=new Set(B);return G.has($)?G.delete($):G.add($),G})},_={idle:"Waiting",connecting:"Connecting...",streaming:"Working",done:"Complete",error:"Error"}[y],q={idle:"#888",connecting:"#888",streaming:r,done:"#2E7D32",error:"#C62828"}[y],W=$=>`${Math.floor($/60)}:${String($%60).padStart(2,"0")}`,Y=y==="done"||y==="error",T=s.jsxs("div",{className:i==="modal"?"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] h-[85vh] z-[61] bg-[var(--terminal-bg)] rounded-2xl shadow-2xl overflow-hidden flex flex-col":"bg-[var(--terminal-bg)] rounded-xl border border-[var(--terminal-border)] overflow-hidden flex flex-col max-h-[400px]",style:c,children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{background:q}}),s.jsx("div",{children:s.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:l})})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:W(S)}),s.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:`${q}22`,color:q},children:_}),d&&i==="modal"&&s.jsx("button",{onClick:d,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),Y&&s.jsx("button",{onClick:u,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),s.jsxs("div",{ref:N,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[g.length===0&&y==="connecting"&&s.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:"Connecting to activity stream..."}),g.map($=>s.jsx(bg,{event:$,isThinkingCollapsed:C.has($.seq),onToggleThinking:()=>I($.seq),onNavigateToJob:x,onOpenKnowledgeDoc:f},$.seq)),y==="streaming"&&s.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),s.jsxs("div",{className:"px-5 py-3 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[s.jsxs("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:[g.length>0&&`${g.length} events`,b.length>0&&` · ${b.length} chars`,v.length>0&&` · ${v.length} dispatches`]}),Y&&s.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"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:Y?u:void 0}),T]}):T}const Af={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function uC({orgNodes:e,rootId:l}){const r=e[l];if(!r)return null;const c=r.children.map(m=>e[m]).filter(Boolean),u=[];for(const m of c)for(const x of m.children){const f=e[x];f&&u.push({node:f,parentId:m.id})}const d=c.length+u.length;return s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Propagation Preview"}),s.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-lg p-4",children:[s.jsx("div",{className:"flex justify-center mb-2",children:s.jsx("span",{className:"px-3 py-1 text-[10px] font-bold rounded border-2 border-white/20 bg-white/5 text-white/30 uppercase",children:"CEO"})}),c.length>0&&s.jsx("div",{className:"flex justify-center mb-1",children:s.jsx("div",{className:"w-px h-3 bg-white/15"})}),c.length>1&&s.jsx("div",{className:"flex justify-center mb-1",children:s.jsx("div",{className:"h-px bg-white/15",style:{width:`${Math.min(c.length*80,320)}px`}})}),s.jsx("div",{className:"flex justify-center gap-3 mb-2 flex-wrap",children:c.map(m=>s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("span",{className:"px-2.5 py-1 text-[10px] font-bold rounded border-2 uppercase",style:{borderColor:Af[m.id]??"#888",color:Af[m.id]??"#888",background:`${Af[m.id]??"#888"}22`},children:m.id}),s.jsx("span",{className:"text-[8px] text-white/30 mt-0.5",children:"direct"})]},m.id))}),u.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex justify-center mb-1",children:s.jsx("div",{className:"w-px h-2 bg-white/10"})}),s.jsx("div",{className:"flex justify-center gap-2 flex-wrap",children:u.map(({node:m})=>s.jsx("span",{className:"px-2 py-0.5 text-[9px] font-semibold rounded border border-white/15 text-white/40 uppercase",children:m.id},m.id))}),s.jsx("div",{className:"text-center text-[8px] text-white/30 mt-1",children:"via re-dispatch"})]})]}),s.jsxs("div",{className:"text-[10px] text-gray-400 mt-1.5",children:[d," role",d!==1?"s":""," will receive this wave"]})]})}function dC({cLevelRoles:e,orgNodes:l,rootId:r,onClose:i,onDispatch:c}){const[u,d]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const x=()=>{!u.trim()||e.length===0||(c(u.trim()),i())},f=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&x(),y.key==="Escape"&&i()},g=r&&Object.keys(l).length>0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[560px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[s.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[s.jsx("div",{className:"text-lg font-bold",children:"CEO Wave"}),s.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:"Broadcast a directive to all C-Level reports"})]}),s.jsxs("div",{className:"p-5 space-y-4",children:[g&&s.jsx(uC,{orgNodes:l,rootId:r}),!g&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Dispatching to"}),s.jsx("div",{className:"flex gap-2 flex-wrap",children:e.length>0?e.map(y=>s.jsxs("span",{className:"px-3 py-1.5 text-xs font-semibold rounded-lg border-2 border-red-200 bg-red-50 text-red-800",children:[y.id.toUpperCase()," · ",y.name]},y.id)):s.jsx("span",{className:"text-xs text-gray-400 italic",children:"No C-Level roles found"})}),s.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Each C-Level receives the directive and delegates to their reports"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Directive"}),s.jsx("textarea",{ref:m,value:u,onChange:y=>d(y.target.value),onKeyDown:f,placeholder:"e.g. Report current status across all departments",className:"w-full h-28 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),s.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Cmd+Enter to dispatch"})]})]}),s.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[s.jsx("button",{onClick:i,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),s.jsxs("button",{onClick:x,disabled:!u.trim()||e.length===0,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#B71C1C"},children:["Dispatch to ",e.length," Role",e.length!==1?"s":""]})]})]})]})}function fC(e,l,r){const[i,c]=k.useState(new Map),[u,d]=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=j=>{const C=l[j];C&&(b.set(j,{jobId:null,roleId:j,roleName:C.name,children:C.children,status:"waiting",events:[],streamStatus:"idle"}),C.children.forEach(v))},S=l[r];S&&(b.set(r,{jobId:null,roleId:r,roleName:"CEO",children:S.children,status:"not-dispatched",events:[],streamStatus:"idle"}),S.children.forEach(v));for(const j of e){const C=b.get(j.roleId);C&&(C.jobId=j.jobId,C.status="running",C.streamStatus="connecting")}c(b),e.length>0&&d(e[0].roleId)},[e,l,r]);const f=k.useCallback((b,v)=>{const S=m.current.get(b);S&&S.controller.abort();const j=new AbortController,C={controller:j,lastSeq:-1};m.current.set(b,C);const N=`/api/jobs/${b}/stream?from=0`;fetch(N,{signal:j.signal}).then(async z=>{if(!z.ok||!z.body){c(q=>{const W=new Map(q),Y=W.get(v);return Y&&W.set(v,{...Y,streamStatus:"error"}),W});return}c(q=>{const W=new Map(q),Y=W.get(v);return Y&&W.set(v,{...Y,streamStatus:"streaming",status:"running"}),W});const O=z.body.getReader(),I=new TextDecoder;let _="";for(;;){const{done:q,value:W}=await O.read();if(q)break;_+=I.decode(W,{stream:!0});const Y=_.split(`
|
|
81
|
+
`);_=Y.pop()??"";let T="";for(const $ of Y)if($.startsWith("event: "))T=$.slice(7).trim();else if($.startsWith("data: ")){try{const B=JSON.parse($.slice(6));if(T==="activity"){const G=B;G.seq>C.lastSeq&&(C.lastSeq=G.seq),c(ne=>{const V=new Map(ne),U=V.get(v);if(!U||U.events.some(ie=>ie.seq===G.seq))return ne;const J={...U,events:[...U.events,G]};if(G.type==="dispatch:start"&&G.data.childJobId){const ie=G.data.childJobId,je=G.data.targetRoleId??G.data.roleId;if(je){const R=V.get(je);R&&(V.set(je,{...R,jobId:ie,status:"running",streamStatus:"connecting"}),setTimeout(()=>f(ie,je),0))}}return G.type==="job:done"?(J.status="done",J.streamStatus="done"):G.type==="job:error"?(J.status="error",J.streamStatus="error"):G.type==="job:awaiting_input"?(J.status="awaiting_input",J.streamStatus="done"):G.type==="job:reply"&&(J.status="running",J.streamStatus="streaming"),V.set(v,J),V})}else if(T==="stream:end"){const G=B.reason;G!=="replied"&&c(ne=>{const V=new Map(ne),U=V.get(v);if(!U)return ne;const J=G==="error"?"error":G==="awaiting_input"?"awaiting_input":"done";return V.set(v,{...U,status:U.status==="running"?J:U.status,streamStatus:J==="error"?"error":"done"}),V})}}catch{}T=""}}}).catch(z=>{z.name!=="AbortError"&&c(O=>{const I=new Map(O),_=I.get(v);return _&&I.set(v,{..._,streamStatus:"error"}),I})})},[]);k.useEffect(()=>{if(e.length!==0){for(const b of e)f(b.jobId,b.roleId);return()=>{for(const[,b]of m.current)b.controller.abort();m.current.clear()}}},[e,f]);const g=(()=>{let b=0,v=0,S=0,j=0;for(const[C,E]of i)C!==r&&(j++,E.status==="done"?b++:E.status==="running"?v++:E.status==="awaiting_input"&&S++);return{done:b,total:j,running:v,awaitingInput:S}})(),y=g.total>0&&g.running===0&&g.awaitingInput===0&&Array.from(i.values()).every(b=>b.status!=="running"&&b.status!=="awaiting_input"&&b.streamStatus!=="streaming"&&b.streamStatus!=="connecting");return k.useEffect(()=>{y&&c(b=>{const v=new Map(b);let S=!1;for(const[j,C]of v)C.status==="waiting"&&(v.set(j,{...C,status:"not-dispatched"}),S=!0);return S?v:b})},[y]),{nodes:i,selectedRoleId:u,selectNode:d,progress:g,allDone:y,connectStream:f}}const D0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},Fa=120,xr=44,T0=80;function hC(e,l){if(!e.get(l))return{layout:[],width:300,height:200};const i=[],c=[],u=[{id:l,depth:0,parentId:null}],d=new Set;for(;u.length>0;){const{id:g,depth:y,parentId:b}=u.shift();if(d.has(g))continue;for(d.add(g);c.length<=y;)c.push([]);c[y].push(g),i.push({roleId:g,x:0,y:y*T0+20,parentId:b});const v=e.get(g);if(v)for(const S of v.children)e.has(S)&&!d.has(S)&&u.push({id:S,depth:y+1,parentId:g})}const m=Math.max(...c.map(g=>g.length))*(Fa+16),x=Math.max(m,280);for(const g of c){const y=g.length*(Fa+16)-16,b=(x-y)/2;g.forEach((v,S)=>{const j=i.find(C=>C.roleId===v);j&&(j.x=b+S*(Fa+16))})}const f=c.length*T0+40;return{layout:i,width:x,height:f}}function mC({nodes:e,rootId:l,selectedRoleId:r,onSelectNode:i}){const{layout:c,width:u,height:d}=hC(e,l),m=f=>{const g=c.find(y=>y.roleId===f);return g?{cx:g.x+Fa/2,cy:g.y+xr/2}:{cx:0,cy:0}},x=f=>{switch(f.status){case"running":return D0[f.roleId]??"#FBBF24";case"awaiting_input":return"#F59E0B";case"done":return"#2E7D32";case"error":return"#C62828";case"not-dispatched":return"#666";default:return"#888"}};return s.jsxs("svg",{viewBox:`0 0 ${u} ${d}`,width:Math.max(u,280),height:d,className:"block",style:{minWidth:u},children:[s.jsx("defs",{children:s.jsxs("filter",{id:"glow",children:[s.jsx("feGaussianBlur",{stdDeviation:"2",result:"blur"}),s.jsxs("feMerge",{children:[s.jsx("feMergeNode",{in:"blur"}),s.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),c.filter(f=>f.parentId).map(f=>{const g=m(f.parentId),y=m(f.roleId),b=e.get(f.roleId),v=e.get(f.parentId);let S="rgba(180,200,240,0.15)",j="4 4",C="";return(b==null?void 0:b.status)==="done"||(v==null?void 0:v.status)==="done"?(S="#2E7D3266",j=""):(b==null?void 0:b.status)==="awaiting_input"?(S="#F59E0B",j="6 4",C="wave-edge-flow"):(b==null?void 0:b.status)==="running"&&(S=D0[f.roleId]??"#FBBF24",j="6 4",C="wave-edge-flow"),s.jsx("line",{x1:g.cx,y1:g.cy+xr/2-4,x2:y.cx,y2:y.cy-xr/2+4,stroke:S,strokeWidth:1.5,strokeDasharray:j,className:C},`${f.parentId}-${f.roleId}`)}),c.map(f=>{const g=e.get(f.roleId);if(!g)return null;const y=x(g),b=r===f.roleId,v=f.roleId===l,S=v?.4:g.status==="not-dispatched"?.35:1;return s.jsxs("g",{transform:`translate(${f.x}, ${f.y})`,style:{cursor:v?"default":"pointer",opacity:S},onClick:()=>!v&&i(f.roleId),children:[s.jsx("rect",{x:0,y:0,width:Fa,height:xr,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":""}),s.jsx("circle",{cx:14,cy:xr/2,r:4,fill:y,filter:g.status==="running"||g.status==="awaiting_input"?"url(#glow)":void 0,children:(g.status==="running"||g.status==="awaiting_input")&&s.jsx("animate",{attributeName:"opacity",values:"1;0.4;1",dur:"1.5s",repeatCount:"indefinite"})}),s.jsx("text",{x:26,y:xr/2-4,fill:"var(--terminal-text, #fff)",fontSize:10,fontWeight:700,fontFamily:"var(--pixel-font)",children:g.roleId.toUpperCase()}),s.jsx("text",{x:26,y:xr/2+10,fill:"var(--terminal-text-muted, #888)",fontSize:8,fontFamily:"var(--pixel-font)",children:g.status==="running"?"Working...":g.status==="awaiting_input"?"Awaiting Reply":g.status==="done"?"Complete":g.status==="error"?"Error":g.status==="waiting"?"Waiting":""}),g.status==="done"&&s.jsx("text",{x:Fa-18,y:xr/2+4,fontSize:14,fill:"#2E7D32",children:"✓"}),g.status==="error"&&s.jsx("text",{x:Fa-18,y:xr/2+4,fontSize:14,fill:"#C62828",children:"✗"})]},f.roleId)})]})}const xC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function pC({directive:e,rootJobs:l,orgNodes:r,rootRoleId:i,onClose:c,onMinimize:u,onDone:d,onOpenKnowledgeDoc:m,onSave:x}){const{nodes:f,selectedRoleId:g,selectNode:y,progress:b,allDone:v,connectStream:S}=fC(l,r,i),[j,C]=k.useState(0),[E,N]=k.useState(new Set),[z,O]=k.useState(""),[I,_]=k.useState(!1),[q,W]=k.useState(!1),Y=k.useRef(null),T=k.useRef(Date.now()),$=k.useRef(!1),B=k.useCallback(async()=>{if(x){W(!0);try{const M=l.map(K=>K.jobId);await x(M)}catch(M){console.error("Save failed:",M)}finally{W(!1),c()}}},[x,l,c]),G=k.useCallback(async()=>{if(!g||!z.trim())return;const M=f.get(g);if(!(!(M!=null&&M.jobId)||M.status!=="awaiting_input")){_(!0);try{const{jobId:K}=await Ce.replyToJob(M.jobId,z.trim());O(""),S(K,g)}catch(K){console.error("Reply failed:",K)}finally{_(!1)}}},[g,z,f,S]),ne=k.useCallback(async M=>{const K=f.get(M);if(K!=null&&K.jobId)try{await Ce.abortJob(K.jobId)}catch(D){console.error("Abort failed:",D)}},[f]),V=k.useCallback(async()=>{for(const[,M]of f)if((M.status==="running"||M.status==="awaiting_input")&&M.jobId)try{await Ce.abortJob(M.jobId)}catch{}},[f]);k.useEffect(()=>{const M=setInterval(()=>{C(Math.floor((Date.now()-T.current)/1e3))},1e3);return()=>clearInterval(M)},[]);const U=k.useRef(!1);k.useEffect(()=>{const M=Y.current;if(!M)return;const K=()=>{const D=M.scrollHeight-M.scrollTop-M.clientHeight<60;U.current=!D};return M.addEventListener("scroll",K),()=>M.removeEventListener("scroll",K)},[]),k.useEffect(()=>{U.current=!1,Y.current&&(Y.current.scrollTop=Y.current.scrollHeight)},[g]),k.useEffect(()=>{Y.current&&!U.current&&(Y.current.scrollTop=Y.current.scrollHeight)},[f]),k.useEffect(()=>{v&&!$.current&&($.current=!0,d==null||d())},[v,d]);const J=M=>`${Math.floor(M/60)}:${String(M%60).padStart(2,"0")}`,ie=g?f.get(g):null,je=g?xC[g]??"#888":"#888",R=M=>{N(K=>{const D=new Set(K);return D.has(M)?D.delete(M):D.add(M),D})};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm pointer-events-none"}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[960px] max-w-[95vw] h-[85vh] z-[61] bg-[var(--terminal-bg)] rounded-2xl shadow-2xl overflow-hidden flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:v?"#2E7D32":"#B71C1C",animation:v?void 0:"wave-pulse 2s ease-in-out infinite"}}),s.jsx("div",{children:s.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:v?"WAVE COMPLETE":"WAVE COMMAND CENTER"})})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:J(j)}),b.awaitingInput>0&&s.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:"#F59E0B22",color:"#F59E0B"},children:[b.awaitingInput," awaiting reply"]}),s.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:v?"#2E7D3222":"#B71C1C22",color:v?"#2E7D32":"#B71C1C"},children:[b.done,"/",b.total," done"]}),!v&&(b.running>0||b.awaitingInput>0)&&s.jsx("button",{onClick:V,className:"text-xs px-2 py-0.5 rounded font-semibold cursor-pointer",style:{background:"#C6282822",color:"#C62828",border:"1px solid #C6282844"},title:"Stop all running jobs",children:"Stop All"}),s.jsx("button",{onClick:u,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),s.jsx("button",{onClick:c,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",title:v?"Dismiss wave":"Close (jobs keep running)",children:"×"})]})]}),s.jsx("div",{className:"px-5 py-2 border-b border-[var(--terminal-border)] shrink-0",children:s.jsxs("span",{className:"text-[var(--terminal-text-secondary)] text-xs italic",children:["“",e,"”"]})}),s.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[s.jsxs("div",{className:"shrink-0 border-b border-[var(--terminal-border)] flex flex-col",children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-1.5",children:[s.jsx("span",{className:"text-[10px] font-bold text-[var(--terminal-text-secondary)] uppercase tracking-wider",children:"Org Propagation"}),s.jsx("div",{className:"flex gap-x-3 ml-auto",children:[{label:"running",color:"#FBBF24",dot:!0},{label:"awaiting",color:"#F59E0B",dot:!0},{label:"done",color:"#2E7D32",dot:!1},{label:"waiting",color:"#888",dot:!1},{label:"error",color:"#C62828",dot:!1}].map(M=>s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:M.color,animation:M.dot?"wave-pulse 1.5s ease-in-out infinite":void 0}}),s.jsx("span",{className:"text-[8px] text-[var(--terminal-text-muted)]",children:M.label})]},M.label))})]}),s.jsx("div",{className:"overflow-x-auto overflow-y-auto px-3 pb-2",style:{maxHeight:"35vh"},children:s.jsx(mC,{nodes:f,rootId:i,selectedRoleId:g,onSelectNode:y})})]}),s.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[ie&&s.jsxs("div",{className:"px-4 py-2 border-b border-[var(--terminal-border)] shrink-0 flex items-center gap-2",children:[s.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:je}}),s.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-xs",children:ie.roleId.toUpperCase()}),s.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs",children:ie.roleName}),s.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full font-semibold",style:{background:ie.status==="awaiting_input"?"#F59E0B22":`${je}22`,color:ie.status==="awaiting_input"?"#F59E0B":je},children:ie.status==="running"?"Working":ie.status==="done"?"Complete":ie.status==="error"?"Error":ie.status==="waiting"?"Waiting":ie.status==="awaiting_input"?"Awaiting Reply":"Not dispatched"}),(ie.status==="running"||ie.status==="awaiting_input")&&ie.jobId&&s.jsx("button",{onClick:()=>ne(ie.roleId),className:"text-[10px] px-2 py-0.5 rounded font-semibold cursor-pointer ml-1",style:{background:"#C6282822",color:"#C62828",border:"1px solid #C6282844"},title:"Force stop this job",children:"Stop"})]}),s.jsxs("div",{ref:Y,className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-1 text-xs font-mono select-text",children:[ie&&ie.events.length===0&&s.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:ie.status==="waiting"?"Waiting for dispatch...":ie.status==="running"?"Connecting to activity stream...":ie.status==="not-dispatched"?"This role was not dispatched in this wave.":""}),ie==null?void 0:ie.events.map(M=>s.jsx(bg,{event:M,isThinkingCollapsed:E.has(M.seq),onToggleThinking:()=>R(M.seq),onNavigateToJob:K=>{for(const[,D]of f)if(D.jobId===K){y(D.roleId);return}},onOpenKnowledgeDoc:m},M.seq)),(ie==null?void 0:ie.status)==="running"&&s.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),(ie==null?void 0:ie.status)==="awaiting_input"&&s.jsxs("div",{className:"px-4 py-3 border-t border-[var(--terminal-border)] shrink-0",style:{background:"#F59E0B0A"},children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:"#F59E0B",animation:"wave-pulse 1.5s ease-in-out infinite"}}),s.jsxs("span",{className:"text-[11px] font-semibold",style:{color:"#F59E0B"},children:[ie.roleName," is waiting for your response"]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",value:z,onChange:M=>O(M.target.value),onKeyDown:M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),G())},placeholder:"Type your response...",disabled:I,className:"flex-1 px-3 py-1.5 text-xs rounded border bg-[var(--terminal-bg)] text-[var(--terminal-text)] border-[var(--terminal-border)] outline-none focus:border-[#F59E0B]",autoFocus:!0}),s.jsx("button",{onClick:G,disabled:I||!z.trim(),className:"px-4 py-1.5 text-xs rounded font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#F59E0B",color:"#000"},children:I?"...":"Reply"})]})]}),!ie&&s.jsx("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-xs",children:"Click a node in the org tree to view activity"}),s.jsxs("div",{className:"px-4 py-2 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:ie&&ie.events.length>0&&`${ie.events.length} events`}),v&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:c,className:"px-4 py-1.5 text-xs rounded-lg font-semibold cursor-pointer",style:{background:"rgba(255,255,255,0.08)",color:"var(--terminal-text-muted)"},children:"Dismiss"}),x&&s.jsx("button",{onClick:B,disabled:q,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer disabled:opacity-50",style:{background:"#2E7D32"},children:q?"Saving...":"Save Wave"})]})]})]})]})]})]})}const yC={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 Bh(e){return yC[e]??{skinColor:"#B0BEC5",hairColor:"#78909C",shirtColor:"#607D8B",pantsColor:"#455A64",shoeColor:"#37474F"}}const vg=["#FDEBD0","#F5CBA7","#D4A07A","#C68642","#8D5524","#5C3A1E","#F3D1C7","#E8BEAC","#B07D62","#704214"],wg=["#1A0A00","#2C1810","#4E342E","#6D4C41","#8D6E63","#D4A574","#F5E6CA","#FFD700","#B71C1C","#AD1457","#4A148C","#1A237E","#004D40","#1A1A1A","#78909C","#E0E0E0"],kg=["#1565C0","#E65100","#2E7D32","#4A148C","#AD1457","#00695C","#D32F2F","#F57F17","#1B5E20","#283593","#4E342E","#37474F","#880E4F","#00838F","#6A1B9A","#FF6F00"],jg=["#37474F","#1A237E","#3E2723","#263238","#1B5E20","#455A64","#212121","#4E342E","#0D47A1","#311B92"],Sg=["#212121","#1A1A1A","#37474F","#4E342E","#7B1FA2","#D32F2F","#1565C0","#F57F17","#2E7D32","#FFFFFF"],oa={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 gC({color:e,selected:l,onClick:r}){return s.jsx("button",{onClick:r,className:"customize-swatch",style:{background:e,outline:l?"2px solid #fff":"2px solid transparent",boxShadow:l?`0 0 0 1px ${e}, 0 0 6px ${e}88`:"none"}})}function Os({label:e,presets:l,value:r,onChange:i}){return s.jsxs("div",{className:"customize-row",children:[s.jsxs("div",{className:"customize-row-header",children:[s.jsx("span",{className:"customize-row-label",children:e}),s.jsx("div",{className:"customize-row-current",style:{background:r}})]}),s.jsx("div",{className:"customize-swatches",children:l.map(c=>s.jsx(gC,{color:c,selected:c===r,onClick:()=>i(c)},c))})]})}function Df({label:e,items:l,value:r,onChange:i,lockInfo:c}){return s.jsxs("div",{className:"customize-row",children:[s.jsx("div",{className:"customize-row-header",children:s.jsx("span",{className:"customize-row-label",children:e})}),s.jsx("div",{className:"customize-swatches",style:{gap:4},children:l.map(u=>{const d=c?c.getLockLevel(u.id):1,m=u.id===r,x=c?d>c.roleLevel&&!m:!1,f=c?m&&d>c.roleLevel:!1;return s.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?f?"2px solid #F59E0B":"2px solid #fff":"2px solid transparent",color:x?"rgba(255,255,255,0.25)":m?"#fff":"rgba(255,255,255,0.5)",borderRadius:4,cursor:x?"not-allowed":"pointer",opacity:x?.35:1,position:"relative"},children:[u.name,x&&s.jsxs("span",{style:{position:"absolute",bottom:1,left:"50%",transform:"translateX(-50%)",fontSize:8,color:"rgba(255,255,255,0.5)",whiteSpace:"nowrap"},children:["🔒"," Lv.",d]}),f&&s.jsxs("span",{style:{position:"absolute",bottom:-8,left:"50%",transform:"translateX(-50%)",fontSize:7,color:"#F59E0B",whiteSpace:"nowrap"},children:["⚠"," Lv.",d]})]},u.id)})})]})}function Tf({label:e,active:l,onClick:r}){return s.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:e})}function na(e){return e[Math.floor(Math.random()*e.length)]}function Ci(e){var c,u,d;const l=sg(),r=og(),i=cg().filter(m=>!e||dg(m.id,e));return{skinColor:na(vg),hairColor:na(wg),shirtColor:na(kg),pantsColor:na(jg),shoeColor:na(Sg),hairStyle:(c=na(l))==null?void 0:c.id,outfitStyle:(u=na(r))==null?void 0:u.id,accessory:(d=na(i))==null?void 0:d.id}}function Cg({roleId:e,appearance:l,onChange:r,onRandomize:i,onReset:c,label:u,roleLevel:d}){const[m,x]=k.useState("look"),f=k.useCallback((C,E)=>{r({...l,[C]:E})},[l,r]),g=k.useRef(null),y=k.useCallback(C=>{var z;const E=(z=C.target.files)==null?void 0:z[0];if(!E)return;const N=new Image;N.onload=()=>{const O=Ij(N);r({...O,hairStyle:l.hairStyle,outfitStyle:l.outfitStyle,accessory:l.accessory}),URL.revokeObjectURL(N.src)},N.src=URL.createObjectURL(E),C.target.value=""},[l.hairStyle,l.outfitStyle,l.accessory,r]),b=sg(),v=og(),S=cg(),j=d!==void 0?S.filter(C=>dg(C.id,d)).length:S.length;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"customize-preview",children:[s.jsx("div",{className:"customize-preview-bg",children:s.jsx(Ws,{roleId:e,appearance:l,scale:12})}),u&&s.jsx("div",{className:"customize-preview-name",children:u}),s.jsxs("div",{className:"customize-preview-actions",children:[s.jsx("button",{className:"customize-btn customize-btn--random",onClick:i,children:"RANDOM"}),s.jsx("button",{className:"customize-btn customize-btn--reset",onClick:c,children:"RESET"}),s.jsx("button",{className:"customize-btn",onClick:()=>{var C;return(C=g.current)==null?void 0:C.click()},style:{fontSize:9,opacity:.7},children:"PHOTO"}),s.jsx("input",{ref:g,type:"file",accept:"image/*",onChange:y,style:{display:"none"}})]})]}),s.jsxs("div",{className:"customize-colors",children:[s.jsxs("div",{style:{display:"flex",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:[s.jsx(Tf,{label:"LOOK",active:m==="look",onClick:()=>x("look")}),s.jsx(Tf,{label:"OUTFIT",active:m==="outfit",onClick:()=>x("outfit")}),s.jsx(Tf,{label:"ACCESSORY",active:m==="accessory",onClick:()=>x("accessory")})]}),m==="look"&&s.jsxs(s.Fragment,{children:[s.jsx(Os,{label:"SKIN",presets:vg,value:l.skinColor,onChange:C=>f("skinColor",C)}),s.jsx(Os,{label:"HAIR COLOR",presets:wg,value:l.hairColor,onChange:C=>f("hairColor",C)}),s.jsx(Df,{label:"HAIR STYLE",items:b,value:l.hairStyle,onChange:C=>f("hairStyle",C)})]}),m==="outfit"&&s.jsxs(s.Fragment,{children:[s.jsx(Df,{label:"STYLE",items:v,value:l.outfitStyle,onChange:C=>f("outfitStyle",C)}),s.jsx(Os,{label:"TOP",presets:kg,value:l.shirtColor,onChange:C=>f("shirtColor",C)}),s.jsx(Os,{label:"PANTS",presets:jg,value:l.pantsColor,onChange:C=>f("pantsColor",C)}),s.jsx(Os,{label:"SHOES",presets:Sg,value:l.shoeColor,onChange:C=>f("shoeColor",C)})]}),m==="accessory"&&s.jsxs(s.Fragment,{children:[d!==void 0&&s.jsxs("div",{style:{padding:"4px 8px",marginBottom:4,background:"rgba(255,255,255,0.04)",borderRadius:4,fontSize:9,fontFamily:"var(--font-pixel, monospace)",color:"rgba(255,255,255,0.5)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s.jsxs("span",{children:["Lv.",d]}),s.jsxs("span",{children:[j,"/",S.length," unlocked"]})]}),s.jsx(Df,{label:"ACCESSORY",items:S,value:l.accessory,onChange:C=>f("accessory",C),lockInfo:d!==void 0?{roleLevel:d,getLockLevel:ug}:void 0}),s.jsx("div",{style:{marginTop:12,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:6,border:"1px dashed rgba(255,255,255,0.08)",color:"rgba(255,255,255,0.25)",fontSize:9,fontFamily:"var(--font-pixel, monospace)",textAlign:"center"},children:d!==void 0&&d<10?"Level up to unlock more accessories":"More accessories coming soon"})]})]})]})}const bC=[{value:"c-level",label:"C-Level"},{value:"team-lead",label:"Team Lead"},{value:"member",label:"Member"}];function ih(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,24)}function zf(e){switch(e){case"c-level":return{authority:{autonomous:["Strategic decisions within domain","Task delegation to reports"],needsApproval:["Budget over $5K","External commitments"]},knowledge:{reads:["company/","operations/","projects/"],writes:["operations/","knowledge/"]},reports:{daily:"standup",weekly:"summary"}};case"team-lead":return{authority:{autonomous:["Task planning","Sprint management"],needsApproval:["Architecture changes","New tool adoption"]},knowledge:{reads:["projects/","architecture/"],writes:["projects/"]},reports:{daily:"standup",weekly:"summary"}};default:return{authority:{autonomous:["Implementation within assigned tasks"],needsApproval:["Design changes","New dependencies"]},knowledge:{reads:["projects/"],writes:[]},reports:{daily:"standup",weekly:""}}}}let aa=null;async function vC(){if(aa)return aa;try{const r=await Ce.getPreferences();if(r.instanceId)return aa=r.instanceId,localStorage.setItem("tycono_instance_id",aa),aa}catch{}const e="tycono_instance_id";let l=localStorage.getItem(e);return l||(l=crypto.randomUUID(),localStorage.setItem(e,l)),aa=l,l}const Bs=4;function wC(e,l,r){const i=e.trim();if(!i||i.startsWith("#"))return null;const c=i.split(",").map(y=>y.trim()),u=c[0];if(!u)return null;const d=ih(u),m=(c[1]||"member").toLowerCase(),x=m==="c-level"?"c-level":m==="team-lead"?"team-lead":"member",f=c[2]||"ceo";let g;return l.has(d)?g="ID already exists":r.has(d)&&(g="Duplicate ID in batch"),r.add(d),{name:u,id:d,level:x,reportsTo:f,error:g}}function kC({existingRoles:e,onClose:l,onHire:r}){const[i,c]=k.useState("single"),[u,d]=k.useState([]),[m,x]=k.useState(!1),[f,g]=k.useState("popular"),[y,b]=k.useState(""),[v,S]=k.useState(null),[j,C]=k.useState(!1),[E,N]=k.useState(""),[z,O]=k.useState("browse"),[I,_]=k.useState(""),[q,W]=k.useState(""),[Y,T]=k.useState("ceo"),[$,B]=k.useState(null),[G,ne]=k.useState(1),[V,U]=k.useState(""),[J,ie]=k.useState(""),[je,R]=k.useState(!1),[M,K]=k.useState("member"),[D,de]=k.useState("ceo"),[Se,ve]=k.useState(""),[Fe,Me]=k.useState(Ci),[$e,fe]=k.useState(!1),[tt,mt]=k.useState(""),[he,ye]=k.useState([]),[ge,Le]=k.useState(new Set),[Ee,ze]=k.useState(""),[Te,Ne]=k.useState("input"),[Ie,Ge]=k.useState({done:0,total:0}),Dt=k.useRef(null),ct=k.useRef(null),Ot=k.useRef(null);k.useEffect(()=>{Ce.getSkills().then(Z=>ye(Z.filter(Oe=>Oe.installed))).catch(()=>{}),vC().then(Z=>B(Z)).catch(()=>{})},[]),k.useEffect(()=>{var Z,Oe,rt;i==="single"?(G===1&&((Z=Dt.current)==null||Z.focus()),G===2&&((Oe=ct.current)==null||Oe.focus())):i==="bulk"&&Te==="input"&&((rt=Ot.current)==null||rt.focus())},[G,i,Te]),k.useEffect(()=>{i==="store"&&z==="browse"&&u.length===0&&se()},[i,z]);const se=async()=>{x(!0);try{const Z=await bl.getCharacters({sort:f,instanceId:$??void 0});d(Z.characters)}catch{N("Failed to load store")}x(!1)};k.useEffect(()=>{i==="store"&&z==="browse"&&se()},[f,$]);const be=k.useMemo(()=>{if(!y.trim())return u;const Z=y.toLowerCase();return u.filter(Oe=>Oe.name.toLowerCase().includes(Z)||Oe.id.toLowerCase().includes(Z)||(Oe.tagline??"").toLowerCase().includes(Z))},[u,y]),Re=k.useMemo(()=>new Set(e.map(Z=>Z.id)),[e]),_e=k.useMemo(()=>{const Z=Ee.split(`
|
|
82
|
+
`),Oe=new Set;return Z.map(rt=>wC(rt,Re,Oe)).filter(rt=>rt!==null)},[Ee,Re]),xe=_e.length>0&&_e.every(Z=>!Z.error),De=Z=>{U(Z),je||ie(ih(Z))},vt=V.trim().length>0&&J.trim().length>0&&!e.some(Z=>Z.id===J),Pe=Se.trim().length>0,nt=async()=>{fe(!0),mt("");const Z=zf(M);try{await r({id:J,name:V.trim(),level:M,reportsTo:D,persona:Se.trim(),...Z,skills:ge.size>0?[...ge]:void 0},Fe),l()}catch(Oe){mt(Oe instanceof Error?Oe.message:"Failed to create role"),fe(!1)}},At=Z=>Z===1?vt:Z===2?Pe:!0,ut=async()=>{fe(!0),mt(""),Ge({done:0,total:_e.length});try{for(let Z=0;Z<_e.length;Z++){const Oe=_e[Z],rt=zf(Oe.level),pe=Ci(),gt=`${Oe.name}. A ${Oe.level} role reporting to ${Oe.reportsTo}.`;await r({id:Oe.id,name:Oe.name,level:Oe.level,reportsTo:Oe.reportsTo,persona:gt,...rt},pe),Ge({done:Z+1,total:_e.length})}l()}catch(Z){mt(Z instanceof Error?Z.message:"Failed to create roles"),fe(!1)}},tn=async Z=>{C(!0),N("");try{const Oe=await bl.getCharacter(Z);S(Oe),_(Oe.name||""),W(ih(Oe.name||Z)),O("review")}catch{N("Failed to load character details")}finally{C(!1)}},yn=async(Z,Oe)=>{if(!$)return;const rt=u.find(gt=>gt.id===Z);if(!rt)return;const pe=rt.my_vote===Oe?0:Oe;try{const gt=await bl.voteCharacter(Z,$,pe);d(dn=>dn.map(nn=>nn.id===Z?{...nn,upvotes:gt.upvotes,downvotes:gt.downvotes,vote_score:gt.upvotes-gt.downvotes,my_vote:pe===0?null:pe}:nn))}catch{}},Ml=async()=>{if(!v)return;fe(!0),mt("");const Z=v,Oe=Z.level==="c-level"||Z.level==="team-lead"?Z.level:"member",rt=zf(Oe),pe=Z.skills!=null&&typeof Z.skills=="object"&&!Array.isArray(Z.skills)&&"primary"in Z.skills;try{await r({id:q,name:I.trim(),level:Oe,reportsTo:Y,persona:Z.persona||`${I}. Imported from Tycono Store.`,authority:Z.authority||rt.authority,knowledge:rt.knowledge,reports:rt.reports,source:{id:`tycono/${Z.id}`,sync:"manual",forked_at:"1.0.0",upstream_version:"1.0.0"},skillContent:pe?Z.skills:void 0},Z.appearance?Z.appearance:Ci()),bl.trackInstall(Z.id).catch(()=>{}),l()}catch(gt){mt(gt instanceof Error?gt.message:"Failed to hire"),fe(!1)}},kt=async Z=>{if($)try{await bl.deleteCharacter(Z,$),d(Oe=>Oe.filter(rt=>rt.id!==Z))}catch{}},Rl=Z=>{Z.key==="Escape"&&l(),Z.key==="Enter"&&(Z.metaKey||Z.ctrlKey)&&(i==="single"?G<Bs&&At(G)?ne(G+1):G===Bs&&nt():i==="bulk"?Te==="input"&&xe?Ne("review"):Te==="review"&&ut():i==="store"&&z==="review"&&Ml())},$n=e.some(Z=>Z.id===J)&&J.length>0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:l}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[560px] max-h-[90vh] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden flex flex-col",onKeyDown:Rl,children:[s.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #2E7D32, #43A047)"},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"text-lg font-bold",children:"Hire New Role"}),s.jsxs("div",{className:"flex bg-black/20 rounded-lg p-0.5",children:[s.jsx("button",{onClick:()=>{c("single"),mt("")},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"}),s.jsx("button",{onClick:()=>{c("bulk"),mt("")},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"}),s.jsx("button",{onClick:()=>{c("store"),mt("")},className:`px-3 py-1 text-xs font-semibold rounded-md cursor-pointer transition-colors ${i==="store"?"bg-white/20 text-white":"text-white/50 hover:text-white/70"}`,children:"Store"})]})]}),s.jsxs("div",{className:"text-sm opacity-80 mt-0.5 flex items-center gap-2",children:[s.jsx("span",{children:i==="single"?`Step ${G} of ${Bs}`:i==="bulk"?Te==="input"?"Enter roles, one per line":`Review ${_e.length} roles`:z==="browse"?`${u.length} characters available`:"Review & customize"}),i==="store"&&z==="browse"&&s.jsx("a",{href:"https://tycono.ai/store.html",target:"_blank",rel:"noopener noreferrer",className:"text-[10px] opacity-60 hover:opacity-100 transition-opacity",onClick:Z=>Z.stopPropagation(),children:"Open in browser ↗"})]})]}),i==="single"&&s.jsx("div",{className:"flex gap-1 px-5 pt-4",children:Array.from({length:Bs},(Z,Oe)=>Oe+1).map(Z=>s.jsx("div",{className:"flex-1 h-1 rounded-full transition-colors",style:{background:Z<=G?"#2E7D32":"rgba(255,255,255,0.1)"}},Z))}),s.jsx("div",{className:"p-5 min-h-[240px] overflow-y-auto flex-1",children:i==="store"?s.jsxs(s.Fragment,{children:[z==="browse"&&s.jsxs("div",{className:"space-y-3",children:[$?s.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 rounded-lg bg-green-900/10 border border-green-800/20 text-[10px]",children:[s.jsxs("span",{className:"text-green-400/70",children:["Signed in · ",s.jsxs("span",{className:"font-mono text-white/40",children:[$.slice(0,8),"..."]})]}),s.jsx("button",{onClick:()=>{aa=null,localStorage.removeItem("tycono_instance_id"),B(null)},className:"text-white/30 hover:text-white/60 cursor-pointer",children:"Sign out"})]}):s.jsx(jC,{onLogin:Z=>{aa=Z,localStorage.setItem("tycono_instance_id",Z),B(Z)}}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{value:y,onChange:Z=>b(Z.target.value),placeholder:"Search characters...",className:"flex-1 p-2 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 focus:outline-none focus:border-white/25 transition-colors",autoFocus:!0}),s.jsxs("select",{value:f,onChange:Z=>g(Z.target.value),className:"px-2 py-2 rounded-lg border border-white/10 bg-white/5 text-xs text-white/70 focus:outline-none cursor-pointer",children:[s.jsx("option",{value:"popular",className:"bg-[var(--wall)]",children:"Popular"}),s.jsx("option",{value:"installs",className:"bg-[var(--wall)]",children:"Most Hired"}),s.jsx("option",{value:"newest",className:"bg-[var(--wall)]",children:"Newest"}),s.jsx("option",{value:"name",className:"bg-[var(--wall)]",children:"A-Z"})]})]}),m?s.jsx("div",{className:"text-center py-8 text-sm text-white/40",children:"Loading store..."}):E?s.jsxs("div",{className:"text-center py-8",children:[s.jsx("div",{className:"text-xs text-red-400 mb-2",children:E}),s.jsx("button",{onClick:se,className:"text-xs text-green-400 hover:underline cursor-pointer",children:"Retry"})]}):be.length===0?s.jsx("div",{className:"text-center py-8 text-sm text-white/40",children:y?"No matches found":"No characters in store yet"}):s.jsx("div",{className:"space-y-2 max-h-[380px] overflow-y-auto pr-1",children:be.map(Z=>s.jsx(SC,{char:Z,isHired:Re.has(Z.id),onSelect:()=>tn(Z.id),onVote:Oe=>yn(Z.id,Oe),onDelete:()=>kt(Z.id),fetching:j,token:$},Z.id))})]}),z==="review"&&v&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"bg-white/5 rounded-xl p-4 border border-white/10",children:[s.jsxs("div",{className:"flex gap-4",children:[v.appearance&&s.jsx("div",{className:"flex-shrink-0 rounded-lg overflow-hidden",style:{background:"#0d1117",padding:8},children:s.jsx(Ws,{roleId:"store-preview",appearance:v.appearance,scale:4})}),s.jsxs("div",{className:"flex-1 space-y-2.5",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Name"}),s.jsx("input",{value:I,onChange:Z=>_(Z.target.value),className:"w-full p-2 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 focus:outline-none focus:border-white/25 transition-colors"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Role ID"}),s.jsx("input",{value:q,onChange:Z=>W(Z.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),className:"w-full p-2 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 font-mono focus:outline-none focus:border-white/25 transition-colors"}),e.some(Z=>Z.id===q)&&q.length>0&&s.jsx("div",{className:"text-xs text-red-500 mt-1",children:"ID already exists"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Level"}),s.jsx("div",{className:"text-sm text-white/70 p-2 rounded-lg bg-white/5 border border-white/10",children:v.level==="c-level"?"C-Level":v.level==="team-lead"?"Lead":"Member"})]}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"block text-[10px] text-white/30 uppercase tracking-wider mb-0.5",children:"Reports To"}),s.jsxs("select",{value:Y,onChange:Z=>T(Z.target.value),className:"w-full p-2 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 focus:outline-none focus:border-white/25 transition-colors",children:[s.jsx("option",{value:"ceo",className:"bg-[var(--wall)] text-white",children:"CEO"}),e.map(Z=>s.jsxs("option",{value:Z.id,className:"bg-[var(--wall)] text-white",children:[Z.name," (",Z.id,")"]},Z.id))]})]})]})]})]}),v.persona&&s.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[s.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Persona"}),s.jsx("div",{className:"text-xs text-white/60 leading-relaxed line-clamp-3",children:v.persona})]}),v.skills&&s.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[s.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Skills"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:(()=>{var pe,gt;const Z=v.skills;if(Z&&typeof Z=="object"&&!Array.isArray(Z)&&"primary"in Z){const dn=[];return(gt=(pe=Z.primary)==null?void 0:pe.frontmatter)!=null&>.name&&dn.push(Z.primary.frontmatter.name),Z.shared&&Z.shared.forEach(nn=>{var br;return dn.push(((br=nn.frontmatter)==null?void 0:br.name)||nn.id)}),dn.map(nn=>s.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono bg-green-900/20 border border-green-800/30 text-green-400",children:nn},nn))}return(Array.isArray(Z)?Z:[]).map((dn,nn)=>s.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono bg-green-900/20 border border-green-800/30 text-green-400",children:typeof dn=="string"?dn:dn.name},nn))})()})]})]}),tt&&s.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:tt})]})]}):i==="single"?s.jsxs(s.Fragment,{children:[G===1&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role Name"}),s.jsx("input",{ref:Dt,value:V,onChange:Z=>De(Z.target.value),placeholder:"e.g. Data Analyst",className:"w-full p-2.5 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 focus:outline-none focus:border-white/25 transition-colors"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role ID (slug)"}),s.jsx("input",{value:J,onChange:Z=>{ie(Z.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),R(!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 ${$n?"border-red-400":"border-white/10 focus:border-white/25"}`}),$n&&s.jsx("div",{className:"text-xs text-red-500 mt-1",children:"ID already exists"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Level"}),s.jsx("div",{className:"flex gap-2",children:bC.map(Z=>s.jsx("button",{onClick:()=>K(Z.value),className:`flex-1 p-2 text-xs font-semibold rounded-lg border cursor-pointer transition-colors ${M===Z.value?"border-green-600 bg-green-900/30 text-green-400":"border-white/10 text-white/50 hover:border-white/20"}`,children:Z.label},Z.value))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Reports To"}),s.jsxs("select",{value:D,onChange:Z=>de(Z.target.value),className:"w-full p-2.5 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 focus:outline-none focus:border-white/25 transition-colors",children:[s.jsx("option",{value:"ceo",className:"bg-[var(--wall)] text-white",children:"CEO"}),e.map(Z=>s.jsxs("option",{value:Z.id,className:"bg-[var(--wall)] text-white",children:[Z.name," (",Z.id,")"]},Z.id))]})]})]}),G===2&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Persona"}),s.jsx("textarea",{ref:ct,value:Se,onChange:Z=>ve(Z.target.value),placeholder:"Describe this role's personality, expertise, and working style...",className:"w-full h-32 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),s.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"This defines how the AI agent will behave in this role"})]}),he.length>0&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Skills"}),s.jsx("div",{className:"space-y-1.5 max-h-[120px] overflow-y-auto",children:he.map(Z=>s.jsxs("label",{className:"flex items-center gap-2 p-2 rounded-lg border border-white/10 bg-white/5 cursor-pointer hover:border-white/20 transition-colors",children:[s.jsx("input",{type:"checkbox",checked:ge.has(Z.id),onChange:()=>Le(Oe=>{const rt=new Set(Oe);return rt.has(Z.id)?rt.delete(Z.id):rt.add(Z.id),rt}),className:"accent-green-600"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-xs font-semibold text-white/80",children:Z.name}),s.jsx("div",{className:"text-[10px] text-white/40 truncate",children:Z.description})]})]},Z.id))})]})]}),G===3&&s.jsx("div",{className:"customize-body",style:{padding:0},children:s.jsx(Cg,{roleId:"default",appearance:Fe,onChange:Me,onRandomize:()=>Me(Ci()),onReset:()=>Me(Ci()),label:s.jsxs("span",{children:[J||"new-role"," — ",V||"New Role"]})})}),G===4&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Review"}),s.jsxs("div",{className:"bg-white/5 rounded-xl p-4 border border-white/10",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsx("div",{className:"flex-shrink-0 rounded-lg overflow-hidden",style:{background:"#0d1117",padding:8},children:s.jsx(Ws,{roleId:"default",appearance:Fe,scale:4})}),s.jsxs("div",{className:"flex-1 space-y-2.5",children:[s.jsx($s,{label:"Name",value:V}),s.jsx($s,{label:"ID",value:J,mono:!0}),s.jsx($s,{label:"Level",value:M}),s.jsx($s,{label:"Reports To",value:D}),ge.size>0&&s.jsx($s,{label:"Skills",value:[...ge].join(", ")})]})]}),s.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[s.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Persona"}),s.jsx("div",{className:"text-xs text-white/60 leading-relaxed",children:Se})]})]}),tt&&s.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:tt})]})]}):s.jsxs(s.Fragment,{children:[Te==="input"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Roles (one per line)"}),s.jsx("textarea",{ref:Ot,value:Ee,onChange:Z=>ze(Z.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"}),s.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Format: Name, Level (member/team-lead/c-level), ReportsTo. Level and ReportsTo are optional."})]}),_e.length>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Preview (",_e.length," role",_e.length!==1?"s":"",")"]}),s.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden",children:s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-white/10",children:[s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),s.jsx("tbody",{children:_e.map((J,Oe)=>s.jsxs("tr",{className:`border-b border-white/5 ${J.error?"bg-red-900/10":""}`,children:[s.jsx("td",{className:"p-2 text-white/80",children:J.name}),s.jsx("td",{className:"p-2 text-white/60 font-mono",children:J.id}),s.jsx("td",{className:"p-2 text-white/60",children:J.level}),s.jsx("td",{className:"p-2 text-white/60",children:J.reportsTo}),J.error&&s.jsx("td",{className:"p-2 text-red-400 text-[10px]",children:J.error})]},Oe))})]})})]})]}),Te==="review"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Confirm Bulk Hire — ",_e.length," roles"]}),s.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden max-h-[300px] overflow-y-auto",children:s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{className:"sticky top-0 bg-[var(--wall)]",children:s.jsxs("tr",{className:"border-b border-white/10",children:[s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"#"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),s.jsx("tbody",{children:_e.map((J,Oe)=>s.jsxs("tr",{className:"border-b border-white/5",children:[s.jsx("td",{className:"p-2 text-white/30",children:Oe+1}),s.jsx("td",{className:"p-2 text-white/80",children:J.name}),s.jsx("td",{className:"p-2 text-white/60 font-mono",children:J.id}),s.jsx("td",{className:"p-2 text-white/60",children:J.level}),s.jsx("td",{className:"p-2 text-white/60",children:J.reportsTo})]},Oe))})]})}),$e&&Ie.total>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between text-[10px] text-white/40 mb-1",children:[s.jsx("span",{children:"Hiring..."}),s.jsxs("span",{children:[Ie.done,"/",Ie.total]})]}),s.jsx("div",{className:"h-1.5 bg-white/10 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Ie.done/Ie.total*100}%`,background:"#2E7D32"}})})]}),s.jsx("div",{className:"text-[10px] text-white/30",children:"Each role will get a random appearance and auto-generated persona. You can customize them later."}),tt&&s.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:tt})]})]})}),s.jsxs("div",{className:"flex justify-between px-5 pb-5",children:[s.jsxs("div",{children:[i==="single"&&G>1&&s.jsx("button",{onClick:()=>ne(G-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"&&Te==="review"&&s.jsx("button",{onClick:()=>Ne("input"),disabled:$e,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"}),i==="store"&&z==="review"&&s.jsx("button",{onClick:()=>{O("browse"),S(null),mt("")},disabled:$e,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer disabled:opacity-40",children:"Back"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{onClick: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"?G<Bs?s.jsx("button",{onClick:()=>ne(G+1),disabled:!At(G),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:"Next"}):s.jsx("button",{onClick:nt,disabled:$e,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:$e?"Hiring...":"HIRE"}):i==="bulk"?Te==="input"?s.jsxs("button",{onClick:()=>Ne("review"),disabled:!xe,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 (",_e.length,")"]}):s.jsx("button",{onClick:ut,disabled:$e,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:$e?`Hiring ${Ie.done}/${Ie.total}...`:`HIRE ALL (${_e.length})`}):z==="review"?s.jsx("button",{onClick:Ml,disabled:$e||!I.trim()||!q.trim()||e.some(J=>J.id===q),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:$e?"Hiring...":"HIRE"}):null]})]})]})]})}function jC({onLogin:e}){const[l,r]=k.useState(""),[i,c]=k.useState(!1),[u,d]=k.useState(""),m=()=>{const x=l.trim();if(x){if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(x)){d("Invalid token format");return}e(x)}};return s.jsxs("div",{className:"rounded-lg border border-white/10 bg-white/[0.03] p-3 space-y-2",children:[s.jsx("div",{className:"text-[11px] text-white/50",children:"Sign in to vote, publish, and manage your characters."}),i?s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{value:l,onChange:x=>{r(x.target.value),d("")},onKeyDown:x=>{x.key==="Enter"&&m()},placeholder:"Paste your token here...",className:"flex-1 px-2 py-1.5 rounded-lg border border-white/10 bg-white/5 text-xs text-white/90 font-mono placeholder-white/20 focus:outline-none focus:border-amber-800/40",autoFocus:!0}),s.jsx("button",{onClick:m,disabled:!l.trim(),className:"px-3 py-1.5 text-[11px] font-semibold rounded-lg cursor-pointer text-green-400 bg-green-900/20 border border-green-800/30 hover:bg-green-900/40 disabled:opacity-30 transition-colors",children:"Sign in"})]}),u&&s.jsx("div",{className:"text-[10px] text-red-400",children:u}),s.jsx("button",{onClick:c.bind(null,!1),className:"text-[10px] text-white/30 hover:text-white/50 cursor-pointer",children:"Cancel"})]}):s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:c.bind(null,!0),className:"px-3 py-1.5 text-[11px] font-semibold rounded-lg cursor-pointer text-amber-400 bg-amber-900/20 border border-amber-800/30 hover:bg-amber-900/40 transition-colors",children:"Paste Token"}),s.jsx("span",{className:"text-[10px] text-white/20 self-center",children:"from Settings → Token"})]})]})}function SC({char:e,isHired:l,onSelect:r,onVote:i,onDelete:c,fetching:u,token:d}){const[m,x]=k.useState(!1),f=d&&e.publisher_id===d,g=!!d;return s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl border border-white/10 bg-white/[0.03] hover:bg-white/[0.06] transition-colors group",children:[s.jsxs("div",{className:"flex flex-col items-center gap-0.5 shrink-0 w-8",children:[s.jsx("button",{onClick:y=>{y.stopPropagation(),i(1)},disabled:!g,className:`text-[14px] leading-none transition-colors ${g?"cursor-pointer":"cursor-not-allowed opacity-30"} ${e.my_vote===1?"text-green-400":"text-white/20 hover:text-green-400/60"}`,title:g?"Upvote":"Sign in to vote",children:"▲"}),s.jsx("span",{className:`text-[11px] font-bold tabular-nums ${(e.vote_score??0)>0?"text-green-400/80":(e.vote_score??0)<0?"text-red-400/80":"text-white/30"}`,children:e.vote_score??0}),s.jsx("button",{onClick:y=>{y.stopPropagation(),i(-1)},disabled:!g,className:`text-[14px] leading-none transition-colors ${g?"cursor-pointer":"cursor-not-allowed opacity-30"} ${e.my_vote===-1?"text-red-400":"text-white/20 hover:text-red-400/60"}`,title:g?"Downvote":"Sign in to vote",children:"▼"})]}),s.jsxs("div",{className:"flex-1 min-w-0 cursor-pointer",onClick:r,children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-semibold text-white/90 truncate",children:e.name}),s.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded font-semibold uppercase ${e.level==="c-level"?"bg-amber-900/30 text-amber-400 border border-amber-800/30":e.level==="team-lead"?"bg-blue-900/30 text-blue-400 border border-blue-800/30":"bg-white/5 text-white/40 border border-white/10"}`,children:e.level}),l&&s.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-green-900/20 text-green-400/60 border border-green-800/20",children:"Hired"})]}),e.tagline&&s.jsx("div",{className:"text-[11px] text-white/40 truncate mt-0.5",children:e.tagline}),s.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[s.jsxs("span",{className:"text-[10px] text-white/25",children:[e.installs??0," installs"]}),s.jsxs("span",{className:"text-[10px] text-white/25",children:["v",e.version]}),s.jsx("span",{className:"text-[10px] text-white/25 font-mono",children:e.id})]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsx("button",{onClick:r,disabled:u,className:"px-3 py-1.5 text-[11px] font-semibold rounded-lg cursor-pointer transition-colors disabled:opacity-40 text-green-400 bg-green-900/20 border border-green-800/30 hover:bg-green-900/40",children:"Hire"}),f&&(m?s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:y=>{y.stopPropagation(),c(),x(!1)},className:"px-2 py-1.5 text-[10px] font-semibold rounded cursor-pointer text-red-400 bg-red-900/30 border border-red-800/40 hover:bg-red-900/50",children:"Confirm"}),s.jsx("button",{onClick:y=>{y.stopPropagation(),x(!1)},className:"px-2 py-1.5 text-[10px] rounded cursor-pointer text-white/40 hover:text-white/60",children:"No"})]}):s.jsx("button",{onClick:y=>{y.stopPropagation(),x(!0)},className:"w-7 h-7 rounded-lg flex items-center justify-center cursor-pointer text-white/15 hover:text-red-400/60 hover:bg-red-900/10 transition-colors opacity-0 group-hover:opacity-100",title:"Delete from store",children:s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2"})})}))]})]})}function $s({label:e,value:l,mono:r}){return s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-white/40",children:e}),s.jsx("span",{className:`font-semibold text-white/80 ${r?"font-mono":""}`,children:l})]})}function CC({roleId:e,roleName:l,onClose:r,onConfirm:i}){const[c,u]=k.useState(!1),d=async()=>{u(!0);try{await i(e)}finally{u(!1)}};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[480px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[s.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[s.jsx("div",{className:"text-lg font-bold",children:"Fire Role"}),s.jsxs("div",{className:"text-sm opacity-80 mt-0.5",children:["Remove ",l," (",e,")"]})]}),s.jsxs("div",{className:"p-5",children:[s.jsxs("div",{className:"p-4 rounded-lg border-2 border-red-300 bg-red-50 mb-4",children:[s.jsx("div",{className:"text-sm font-bold text-red-800 mb-1",children:"Warning"}),s.jsxs("div",{className:"text-xs text-red-700 leading-relaxed",children:["This will permanently delete the role directory including",s.jsx("strong",{children:" role.yaml"}),", ",s.jsx("strong",{children:"profile.md"}),", ",s.jsx("strong",{children:"SKILL.md"}),", and all journal entries. This action cannot be undone."]})]}),s.jsxs("div",{className:"text-sm text-gray-600",children:["Are you sure you want to fire ",s.jsx("strong",{children:l}),"?"]})]}),s.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[s.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"}),s.jsx("button",{onClick:d,disabled:c,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#B71C1C"},children:c?"Removing...":"Confirm Fire"})]})]})]})}const EC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function NC({roleId:e,title:l,roleColor:r,active:i,isWave:c,isWaveStreaming:u,onClick:d,onClose:m,"data-session-id":x}){const f=c?"#F59E0B":r;return s.jsxs("button",{onClick:d,"data-session-id":x,className:`flex items-center gap-1.5 px-3 py-1.5 text-[11px] rounded-t-lg shrink-0 cursor-pointer transition-colors max-w-[180px] group ${i?"bg-[var(--terminal-bg)] text-[var(--terminal-text)]":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] hover:bg-[var(--terminal-surface)]"}`,style:i?{borderTop:`2px solid ${f}`}:void 0,children:[c&&u&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse shrink-0"}),s.jsx("span",{className:"text-xs",children:EC[e]??"👤"}),s.jsx("span",{className:`truncate ${c?"text-amber-400/90":""}`,children:l}),s.jsx("span",{onClick:m,className:"ml-auto text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none",children:"×"})]})}function AC({content:e,streaming:l}){let r=e;return l&&(e.match(/```/g)??[]).length%2!==0&&(r+="\n```"),s.jsx("div",{className:"terminal-markdown",children:s.jsx(Eh,{remarkPlugins:[Th],components:{code:DC,table:({children:i})=>s.jsx("div",{className:"overflow-x-auto my-2",children:s.jsx("table",{className:"terminal-table",children:i})})},children:r})})}function DC({className:e,children:l,...r}){const i=/language-(\w+)/.exec(e??"");return i||typeof l=="string"&&l.includes(`
|
|
87
|
-
`)?s.jsx(TC,{language:i==null?void 0:i[1],children:l}):s.jsx("code",{className:"terminal-inline-code",...r,children:l})}function TC({children:e,language:l}){const[r,i]=k.useState(!1),c=String(e).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(c),i(!0),setTimeout(()=>i(!1),1500)};return s.jsxs("div",{className:"terminal-code-block group relative my-2",children:[l&&s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] px-3 pt-1.5",children:l}),s.jsx("button",{onClick:u,className:"absolute top-1.5 right-2 text-[10px] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:r?"Copied!":"Copy"}),s.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:s.jsx("code",{children:c})})]})}const zC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function MC({attachments:e}){const[l,r]=k.useState(null);return e.length===0?null:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:e.map((i,c)=>s.jsxs("button",{onClick:()=>r(c),className:"relative w-20 h-20 rounded-lg overflow-hidden border border-[var(--terminal-border)] bg-[var(--terminal-inline-bg)] cursor-pointer hover:border-[var(--terminal-border-hover)] transition-colors",children:[s.jsx("img",{src:`data:${i.mediaType};base64,${i.data}`,alt:i.name,className:"w-full h-full object-cover"}),s.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-[8px] text-white truncate px-1 py-0.5",children:i.name})]},c))}),l!==null&&s.jsx("div",{className:"fixed inset-0 z-[100] bg-black/80 flex items-center justify-center",onClick:()=>r(null),children:s.jsxs("div",{className:"relative max-w-[90vw] max-h-[90vh]",children:[s.jsx("img",{src:`data:${e[l].mediaType};base64,${e[l].data}`,alt:e[l].name,className:"max-w-full max-h-[90vh] object-contain rounded-lg"}),s.jsx("button",{onClick:()=>r(null),className:"absolute top-2 right-2 w-8 h-8 rounded-full bg-black/70 text-white flex items-center justify-center cursor-pointer hover:bg-black/90",children:"x"}),s.jsx("div",{className:"absolute bottom-2 left-1/2 -translate-x-1/2 bg-black/70 text-white text-sm px-3 py-1 rounded",children:e[l].name})]})})]})}function Mf(e,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 RC(e){const l=[];let r="";for(const i of e)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:Mf(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=Mf(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?Mf(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 FC({event:e,isStreaming:l}){var c,u,d;const[r,i]=k.useState(!1);switch(e.type){case"thinking":return s.jsxs("div",{className:"stream-event-thinking",children:[s.jsxs("div",{className:"stream-event-thinking-header",onClick:()=>i(!r),children:[s.jsx("span",{className:"stream-event-thinking-icon"}),s.jsxs("span",{className:"stream-event-thinking-label",children:["thinking",l?"...":""]}),e.text&&!l&&s.jsx("span",{className:"stream-event-thinking-toggle",children:r?"▾":"▸"})]}),(l||r)&&e.text&&s.jsx("div",{className:"stream-event-thinking-content",children:e.text.slice(-500)})]});case"tool":return s.jsxs("div",{className:"stream-event-tool",children:[s.jsx("span",{className:"stream-event-tool-badge",children:e.toolName}),e.toolSummary&&s.jsx("span",{className:"stream-event-tool-path",children:e.toolSummary}),e.toolInput&&s.jsx("span",{className:"stream-event-tool-toggle",onClick:()=>i(!r),children:r?"▾":"▸"}),r&&e.toolInput&&s.jsx("div",{className:"stream-event-tool-detail",children:JSON.stringify(e.toolInput,null,1).slice(0,300)})]});case"dispatch":return s.jsxs("div",{className:"stream-event-dispatch",children:[s.jsxs("span",{className:"stream-event-dispatch-badge",children:["→"," ",(c=e.roleId)==null?void 0:c.toUpperCase()]}),s.jsx("span",{className:"stream-event-dispatch-task",children:(u=e.task)==null?void 0:u.slice(0,80)})]});case"dispatch:progress":return s.jsxs("div",{className:"stream-event-dispatch-progress",children:[s.jsx("span",{className:"stream-event-dispatch-progress-role",children:(d=e.roleId)==null?void 0:d.toUpperCase()}),e.progressType==="thinking"&&s.jsxs("span",{className:"stream-event-dispatch-progress-status",children:["thinking",l?"...":""]}),e.progressType==="tool"&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"stream-event-tool-badge",children:e.toolName}),e.toolSummary&&s.jsx("span",{className:"stream-event-tool-path",children:e.toolSummary})]}),e.progressType==="text"&&e.text&&s.jsx("span",{className:"stream-event-dispatch-progress-status",children:"responding..."}),e.progressType==="done"&&s.jsx("span",{className:"stream-event-dispatch-progress-done",children:"done"}),e.progressType==="error"&&s.jsx("span",{className:"stream-event-dispatch-progress-error",children:"error"})]});default:return null}}function _C({events:e,isStreaming:l}){const[r,i]=k.useState(!1);if(e.length===0)return null;const c=RC(e);if(c.length===0)return null;const u=e.filter(b=>b.type==="thinking").length,d=e.filter(b=>b.type==="tool"),m=e.filter(b=>b.type==="dispatch"||b.type==="dispatch:progress"),x=e.filter(b=>b.type==="turn").reduce((b,v)=>Math.max(b,v.turn??0),0),f=[];if(u>0&&f.push("thinking"),d.length>0){const b=[...new Set(d.map(v=>v.toolName))];b.length<=3?f.push(b.join(", ")):f.push(`${d.length} tool calls`)}m.length>0&&f.push(`${m.length} dispatch`),x>1&&f.push(`${x} turns`);const g=f.join(" · "),y=!r;return s.jsxs("div",{className:"stream-activity-log",children:[s.jsxs("div",{className:"stream-activity-header",onClick:()=>i(!r),children:[l&&s.jsx("span",{className:"stream-activity-pulse"}),s.jsxs("span",{className:"stream-activity-summary",children:[r?"▸":"▾"," ",g,l?"...":""]})]}),y&&s.jsx("div",{className:"stream-activity-events",children:c.map((b,v)=>s.jsx(FC,{event:b,isStreaming:l&&v===c.length-1},v))})]})}function OC({message:e,roleId:l,roleColor:r}){var f;const i=e.from==="ceo",c=e.type==="system",u=e.status==="streaming";if(c)return s.jsx("div",{className:"flex justify-center my-2",children:s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] bg-[var(--terminal-inline-bg)] px-3 py-1 rounded-full",children:e.content})});if(i)return s.jsx("div",{className:"flex justify-end mb-3",children:s.jsxs("div",{className:"max-w-[85%]",children:[s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] text-right mb-1",children:"CEO"}),e.attachments&&e.attachments.length>0&&s.jsx("div",{className:"flex justify-end mb-1",children:s.jsx(MC,{attachments:e.attachments})}),s.jsxs("div",{className:"bg-[var(--terminal-surface-light)] rounded-xl rounded-tr-sm px-4 py-2.5 text-sm text-[var(--terminal-text)] leading-relaxed",children:[e.type==="directive"&&s.jsx("span",{className:"text-amber-400 text-[10px] font-bold mr-1.5",children:"DO"}),e.content]})]})});const d=(((f=e.streamEvents)==null?void 0:f.length)??0)>0,m=!!e.thinking,x=m&&!e.content&&u&&!d;return s.jsxs("div",{className:"flex gap-2.5 mb-3",children:[s.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center text-sm shrink-0 mt-5",style:{background:`${r}33`},children:zC[l]??"👤"}),s.jsxs("div",{className:"max-w-[85%] min-w-0",children:[s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] mb-1",children:l.toUpperCase()}),d&&s.jsx(_C,{events:e.streamEvents,isStreaming:u}),m&&!d&&s.jsxs("details",{open:x,className:"mb-1",children:[s.jsxs("summary",{className:"text-[10px] text-purple-400/70 cursor-pointer select-none flex items-center gap-1",children:[x&&s.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-purple-400 animate-pulse"}),"thinking",x?"...":` (${e.thinking.length} chars)`]}),s.jsx("div",{className:"text-[11px] text-[var(--terminal-text-muted)] leading-relaxed mt-1 pl-2 border-l border-purple-400/20 max-h-32 overflow-y-auto",children:e.thinking.slice(-500)})]}),s.jsxs("div",{className:"rounded-xl rounded-tl-sm px-4 py-2.5 text-sm text-[var(--terminal-text)] leading-relaxed",style:{borderLeft:`3px solid ${r}`,background:"var(--terminal-surface)"},children:[e.content?s.jsx(AC,{content:e.content,streaming:u}):u&&!m?s.jsx("span",{className:"inline-block w-2 h-4 bg-[var(--terminal-text-secondary)] animate-pulse"}):u&&m?s.jsx("span",{className:"text-[11px] text-purple-400/50 italic",children:"analyzing..."}):null,u&&e.content&&s.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-[var(--terminal-text-secondary)] animate-pulse ml-0.5 align-middle"})]}),e.status==="error"&&s.jsx("div",{className:"text-[10px] text-red-400 mt-1",children:"Error occurred"})]})]})}function BC({messages:e,roleId:l,roleColor:r}){var c;const i=k.useRef(null);return k.useEffect(()=>{var u;(u=i.current)==null||u.scrollIntoView({behavior:"smooth"})},[e,(c=e[e.length-1])==null?void 0:c.content]),e.length===0?s.jsxs("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:["Start a conversation with ",l.toUpperCase()]}):s.jsxs("div",{className:"flex-1 overflow-y-auto p-4 terminal-scrollbar",children:[e.map(u=>s.jsx(OC,{message:u,roleId:l,roleColor:r},u.id)),s.jsx("div",{ref:i})]})}const $C=5*1024*1024,LC=["image/png","image/jpeg","image/gif","image/webp"];function HC({mode:e,onModeChange:l,onSend:r,disabled:i,disabledReason:c}){const[u,d]=k.useState(""),[m,x]=k.useState([]),[f,g]=k.useState(!1),[y,b]=k.useState(null),v=k.useRef(null),S=k.useRef(null);k.useEffect(()=>{const Y=v.current;Y&&(Y.style.height="0",Y.style.height=Math.min(Y.scrollHeight,120)+"px")},[u]),k.useEffect(()=>{if(y){const Y=setTimeout(()=>b(null),3e3);return()=>clearTimeout(Y)}},[y]);const j=k.useCallback(async Y=>LC.includes(Y.type)?Y.size>$C?(b(`File too large: ${(Y.size/1024/1024).toFixed(1)}MB. Max 5MB.`),null):new Promise(T=>{const $=new FileReader;$.onload=()=>{const G=$.result.split(",")[1];T({type:"image",data:G,name:Y.name,mediaType:Y.type})},$.onerror=()=>{b("Failed to read file"),T(null)},$.readAsDataURL(Y)}):(b(`Unsupported format: ${Y.type}. Use PNG, JPG, GIF, or WebP.`),null),[]),C=k.useCallback(async Y=>{const T=Array.from(Y),$=[];for(const B of T){const G=await j(B);G&&$.push(G)}$.length>0&&x(B=>[...B,...$])},[j]),E=k.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),g(!0)},[]),N=k.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),g(!1)},[]),z=k.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),g(!1);const T=Y.dataTransfer.files;T.length>0&&C(T)},[C]),O=k.useCallback(Y=>{const T=Y.clipboardData.items,$=[];for(let B=0;B<T.length;B++){const G=T[B];if(G.type.startsWith("image/")){const ne=G.getAsFile();ne&&$.push(ne)}}$.length>0&&(Y.preventDefault(),C($))},[C]),I=k.useCallback(Y=>{const T=Y.target.files;T&&T.length>0&&C(T),Y.target.value=""},[C]),_=k.useCallback(Y=>{x(T=>T.filter(($,B)=>B!==Y))},[]),q=()=>{const Y=u.trim();!Y&&m.length===0||i||(r(Y,m.length>0?m:void 0),d(""),x([]))},W=Y=>{Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),q())};return s.jsxs("div",{className:`border-t border-[var(--terminal-border)] p-3 shrink-0 transition-colors ${f?"bg-[var(--terminal-surface-light)] border-amber-500/50":""}`,onDragOver:E,onDragLeave:N,onDrop:z,children:[y&&s.jsx("div",{className:"text-[10px] text-red-400 mb-2 text-center",children:y}),c&&s.jsx("div",{className:"text-[10px] text-amber-400/70 mb-2 text-center",children:c}),m.length>0&&s.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:m.map((Y,T)=>s.jsxs("div",{className:"relative group w-16 h-16 rounded-lg overflow-hidden border border-[var(--terminal-border)] bg-[var(--terminal-inline-bg)]",children:[s.jsx("img",{src:`data:${Y.mediaType};base64,${Y.data}`,alt:Y.name,className:"w-full h-full object-cover"}),s.jsx("button",{onClick:()=>_(T),className:"absolute top-0.5 right-0.5 w-4 h-4 rounded-full bg-black/70 text-white text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:"x"}),s.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-[8px] text-white truncate px-1 py-0.5",children:Y.name})]},T))}),f&&s.jsx("div",{className:"text-[11px] text-amber-400 text-center mb-2",children:"Drop image here"}),s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsxs("div",{className:"flex rounded-lg overflow-hidden border border-[var(--terminal-border)] shrink-0",children:[s.jsx("button",{onClick:()=>l("talk"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${e==="talk"?"bg-[var(--desk-wood)] text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Talk"}),s.jsx("button",{onClick:()=>l("do"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${e==="do"?"bg-amber-700 text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Do"})]}),s.jsx("button",{onClick:()=>{var Y;return(Y=S.current)==null?void 0:Y.click()},disabled:i,className:"w-8 h-8 rounded-lg bg-[var(--terminal-inline-bg)] border border-[var(--terminal-border)] text-[var(--terminal-text-muted)] flex items-center justify-center shrink-0 cursor-pointer hover:bg-[var(--terminal-surface-light)] hover:text-[var(--terminal-text-secondary)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:"Attach image (PNG, JPG, GIF, WebP)",children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})}),s.jsx("input",{ref:S,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,onChange:I,className:"hidden"}),s.jsx("textarea",{ref:v,value:u,onChange:Y=>d(Y.target.value),onKeyDown:W,onPaste:O,placeholder:i?"Waiting...":e==="talk"?"Ask something...":"Give a directive...",disabled:i,rows:1,className:"flex-1 bg-[var(--terminal-inline-bg)] border border-[var(--terminal-border)] rounded-lg px-3 py-2 text-sm text-[var(--terminal-text)] placeholder:text-[var(--terminal-text-muted)] resize-none focus:outline-none focus:border-[var(--terminal-border-hover)] disabled:opacity-40 terminal-scrollbar"}),s.jsx("button",{onClick:q,disabled:i||!u.trim()&&m.length===0,className:"w-8 h-8 rounded-lg bg-[var(--terminal-surface-light)] text-[var(--terminal-text-secondary)] flex items-center justify-center shrink-0 cursor-pointer hover:bg-[var(--desk-wood)] hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M22 2L11 13"}),s.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})]})}const IC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},Eg={cto:"CTO",cbo:"CBO",pm:"PM",engineer:"Engineer",designer:"Designer",qa:"QA","data-analyst":"Data Analyst"};function z0(e){return new Date(e).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit"})}function UC({msg:e}){const l=IC[e.roleId]??"#888",r=Eg[e.roleId]??e.roleId;if(e.type==="dispatch"){const i=e.text.includes("WAVE"),c=e.text.includes("completed")||e.text.includes("완료"),u=i?"📡":c?"✓":"→",d=c?"text-green-400/70":"text-[var(--terminal-text-muted)]";return s.jsxs("div",{className:"flex items-start gap-2 px-3 py-1 hover:bg-white/[0.02]",children:[s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:z0(e.ts)}),s.jsx("span",{className:"text-[10px] shrink-0 mt-0.5",children:u}),s.jsx("span",{className:`text-[11px] ${d}`,children:e.text})]})}return s.jsxs("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-white/[0.02]",children:[s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:z0(e.ts)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("span",{className:"text-[11px] font-semibold mr-1.5",style:{color:l},children:r}),s.jsx("span",{className:"text-xs text-[var(--terminal-text-secondary)]",children:e.text})]})]})}function YC({channel:e,allRoles:l,onUpdateMembers:r,onUpdateTopic:i}){const c=k.useRef(null),u=k.useRef(null);k.useEffect(()=>{var S;const b=u.current;if(!b)return;b.scrollHeight-b.scrollTop-b.clientHeight<80&&((S=c.current)==null||S.scrollIntoView({behavior:"smooth"}))},[e.messages.length]);const[d,m]=k.useState(!1),[x,f]=k.useState(!1),[g,y]=k.useState("");return s.jsxs("div",{ref:u,className:"flex-1 overflow-y-auto terminal-scrollbar py-2",children:[s.jsxs("div",{className:"px-3 py-2 mb-2 border-b border-[var(--terminal-border)] flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-semibold text-[var(--terminal-text)]",children:e.name}),e.members.length>0&&s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:e.members.map(b=>Eg[b]??b).join(", ")}),e.members.length===0&&s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:e.isDefault?"system logs":"no members"}),!e.isDefault&&l&&r&&s.jsx("button",{className:"ml-auto text-[10px] px-2 py-0.5 rounded bg-white/5 hover:bg-white/10 text-[var(--terminal-text-muted)]",onClick:()=>m(!d),children:d?"Done":"Invite"})]}),!e.isDefault&&i&&s.jsx("div",{className:"px-3 pb-2 mb-1",children:x?s.jsx("input",{autoFocus:!0,value:g,onChange:b=>y(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(i(e.id,g.trim()),f(!1)),b.key==="Escape"&&f(!1)},onBlur:()=>{i(e.id,g.trim()),f(!1)},placeholder:"Set a topic for this channel...",className:"w-full bg-transparent text-[10px] text-[var(--terminal-text-muted)] outline-none border-b border-[var(--terminal-border)] pb-0.5"}):s.jsx("button",{onClick:()=>{y(e.topic??""),f(!0)},className:"text-[10px] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] cursor-pointer italic",children:e.topic||"Click to set channel topic..."})}),d&&!e.isDefault&&l&&r&&s.jsx("div",{className:"px-3 pb-2 mb-2 border-b border-[var(--terminal-border)]",children:s.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(b=>{const v=e.members.includes(b.id);return s.jsxs("button",{className:`text-[10px] px-2 py-1 rounded ${v?"bg-white/15 text-[var(--terminal-text)]":"bg-white/5 text-[var(--terminal-text-muted)]"}`,onClick:()=>{const S=v?e.members.filter(j=>j!==b.id):[...e.members,b.id];r(e.id,S)},children:[v?"✓ ":"",b.name]},b.id)})})}),e.messages.length===0&&s.jsx("div",{className:"flex-1 flex flex-col items-center justify-center text-[var(--terminal-text-muted)] text-xs gap-1 py-8",children:s.jsx("span",{children:e.isDefault?"No dispatch events yet":"No messages yet — invite roles to start chatting"})}),e.messages.map(b=>s.jsx(UC,{msg:b},b.id)),s.jsx("div",{ref:c})]})}const Rf={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},qC=400,XC=800;function VC({sessions:e,activeSessionId:l,roles:r,streamingSessionId:i,width:c,onWidthChange:u,onSwitchSession:d,onCloseSession:m,onCreateSession:x,onClearEmpty:f,onCloseAll:g,onSendMessage:y,onModeChange:b,onCloseTerminal:v,chatChannels:S,activeChatChannelId:j,onSwitchChatChannel:C,onCreateChatChannel:E,onDeleteChatChannel:N,onUpdateChatMembers:z,onUpdateChatTopic:O,unreadChannels:I}){const[_,q]=k.useState(!1),[W,Y]=k.useState(!1),[T,$]=k.useState(!1),[B,G]=k.useState(""),ne=j!=null,V=S==null?void 0:S.find(fe=>fe.id===j),[U,Z]=k.useState(!1),[ie,je]=k.useState(!1),[R,M]=k.useState(!1),K=k.useRef(0),D=k.useRef(0),de=k.useRef(null),Se=e.find(fe=>fe.id===l),ve=i===l,Fe=e.filter(fe=>fe.messages.length===0).length,Me=k.useCallback(()=>{const fe=de.current;fe&&(je(fe.scrollLeft>0),M(fe.scrollLeft+fe.clientWidth<fe.scrollWidth-1))},[]);k.useEffect(()=>{if(!l||!de.current)return;const fe=de.current.querySelector(`[data-session-id="${l}"]`);fe&&fe.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),Me()},[l,e.length,Me]),k.useEffect(()=>{const fe=de.current;if(!fe)return;Me(),fe.addEventListener("scroll",Me);const tt=new ResizeObserver(Me);return tt.observe(fe),()=>{fe.removeEventListener("scroll",Me),tt.disconnect()}},[Me]);const $e=k.useCallback(fe=>{fe.preventDefault(),K.current=fe.clientX,D.current=c,Z(!0);const tt=he=>{const ye=K.current-he.clientX,ge=Math.min(XC,Math.max(qC,D.current+ye));u==null||u(ge)},mt=()=>{Z(!1),document.removeEventListener("mousemove",tt),document.removeEventListener("mouseup",mt)};document.addEventListener("mousemove",tt),document.addEventListener("mouseup",mt)},[c,u]);return s.jsxs("div",{className:"shrink-0 bg-[var(--terminal-bg)] border-l border-[var(--terminal-border)] flex flex-col h-full relative",style:{width:c},children:[u&&s.jsx("div",{className:`terminal-resize-handle absolute top-0 left-0 w-1 h-full cursor-col-resize z-10 transition-colors ${U?"bg-[var(--terminal-border-hover)]":"bg-transparent"}`,onMouseDown:$e}),s.jsxs("div",{className:"flex items-center bg-[var(--terminal-bg-deeper)] border-b border-[var(--terminal-border)] shrink-0",children:[s.jsxs("div",{className:"relative flex-1 min-w-0",children:[ie&&s.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-6 bg-gradient-to-r from-[var(--terminal-bg-deeper)] to-transparent z-10 pointer-events-none"}),s.jsxs("div",{ref:de,className:"flex items-center overflow-x-auto terminal-tab-scroll gap-px px-1 py-1",children:[S==null?void 0:S.map(fe=>s.jsxs("button",{onClick:()=>{C==null||C(fe.id)},className:`flex items-center gap-1 px-2.5 py-1.5 text-[11px] rounded-t-lg shrink-0 cursor-pointer transition-colors group ${j===fe.id?"bg-[var(--terminal-bg)] text-[var(--terminal-text)]":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface)]"}`,style:j===fe.id?{borderTop:"2px solid #4CAF50"}:void 0,children:[s.jsx("span",{className:"text-[10px]",children:"💬"}),s.jsx("span",{className:"truncate",children:fe.name}),(I==null?void 0:I.has(fe.id))&&j!==fe.id&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 shrink-0"}),!fe.isDefault&&s.jsx("span",{onClick:tt=>{tt.stopPropagation(),N==null||N(fe.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:"×"})]},fe.id)),S&&S.length>0&&e.length>0&&s.jsx("div",{className:"w-px h-4 bg-[var(--terminal-border)] shrink-0 mx-1"}),e.map(fe=>s.jsx(NC,{roleId:fe.roleId,title:fe.title,roleColor:Rf[fe.roleId]??"#666",active:!ne&&fe.id===l,isWave:fe.source==="wave",isWaveStreaming:fe.source==="wave"&&fe.status==="active",onClick:()=>{C==null||C(null),d(fe.id)},onClose:tt=>{tt.stopPropagation(),m(fe.id)},"data-session-id":fe.id},fe.id))]}),R&&s.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-6 bg-gradient-to-l from-[var(--terminal-bg-deeper)] to-transparent z-10 pointer-events-none"})]}),s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("button",{onClick:()=>{q(!_),Y(!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:"+"}),_&&s.jsxs("div",{className:"absolute top-full right-0 mt-1 bg-[var(--terminal-surface)] border border-[var(--terminal-border)] rounded-lg shadow-xl z-50 py-1 min-w-[200px]",children:[E&&s.jsxs(s.Fragment,{children:[T?s.jsxs("div",{className:"px-3 py-2 flex items-center gap-1",children:[s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:"#"}),s.jsx("input",{autoFocus:!0,value:B,onChange:fe=>G(fe.target.value),onKeyDown:fe=>{fe.key==="Enter"&&B.trim()&&(E(B.trim(),[]),G(""),$(!1),q(!1)),fe.key==="Escape"&&($(!1),G(""))},placeholder:"channel name",className:"flex-1 bg-transparent text-xs text-[var(--terminal-text)] outline-none border-b border-[var(--terminal-border)]"})]}):s.jsxs("button",{onClick:()=>$(!0),className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer flex items-center gap-2",children:[s.jsx("span",{className:"text-[10px]",children:"💬"}),"New Channel"]}),s.jsx("div",{className:"border-b border-[var(--terminal-border)] my-1"})]}),r.map(fe=>s.jsxs("button",{onClick:()=>{x(fe.id),C==null||C(null),q(!1)},className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:Rf[fe.id]??"#666"}}),fe.id.toUpperCase()," — ",fe.name]},fe.id))]})]}),s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("button",{onClick:()=>{Y(!W),q(!1)},className:"w-7 h-7 flex items-center justify-center text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-xs cursor-pointer tracking-tight",title:"Manage sessions",children:"···"}),W&&s.jsxs("div",{className:"absolute top-full right-0 mt-1 bg-[var(--terminal-surface)] border border-[var(--terminal-border)] rounded-lg shadow-xl z-50 py-1 min-w-[200px]",children:[s.jsxs("div",{className:"px-3 py-1.5 text-[10px] text-[var(--terminal-text-muted)] border-b border-[var(--terminal-border)]",children:[e.length," session",e.length!==1?"s":""]}),Fe>0&&f&&s.jsxs("button",{onClick:()=>{f(),Y(!1)},className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer",children:["Clear empty sessions (",Fe,")"]}),e.length>0&&g&&s.jsx("button",{onClick:()=>{g(),Y(!1)},className:"w-full text-left px-3 py-2 text-xs text-[#E57373] hover:bg-[var(--terminal-surface-light)] cursor-pointer",children:"Close all sessions"}),e.length===0&&s.jsx("div",{className:"px-3 py-2 text-xs text-[var(--terminal-text-muted)]",children:"No sessions"})]})]}),s.jsx("button",{onClick:v,className:"px-2 py-1 text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm cursor-pointer shrink-0",children:"×"})]}),ne&&V?s.jsx(YC,{channel:V,allRoles:r,onUpdateMembers:z,onUpdateTopic:O}):Se?s.jsxs(s.Fragment,{children:[s.jsx(BC,{messages:Se.messages,roleId:Se.roleId,roleColor:Rf[Se.roleId]??"#666"}),Se.source==="wave"?s.jsxs("div",{className:"shrink-0 px-4 py-2 border-t border-[var(--terminal-border)] bg-[var(--terminal-bg-deeper)] flex items-center gap-2",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 shrink-0",style:Se.status==="active"?{animation:"pulse 2s infinite"}:void 0}),s.jsx("span",{className:"text-[11px] text-amber-400/80",children:"Wave execution · read-only"}),s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] ml-auto",children:"Interact via Wave Command Center"})]}):s.jsx(HC,{mode:Se.mode,onModeChange:fe=>b(Se.id,fe),onSend:(fe,tt)=>y(Se.id,fe,Se.mode,tt),disabled:ve,disabledReason:ve?`${Se.roleId.toUpperCase()} is responding...`:void 0})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:"No active session. Click [+] to start."})]})}function GC(){const e=k.useRef(null),l=k.useCallback(()=>{var i;(i=e.current)==null||i.abort(),e.current=null},[]);return{sendMessage:k.useCallback((i,c,u,d,m)=>{l();const x=new AbortController;return e.current=x,fetch(`/api/exec/session/${i}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:c,mode:u,attachments:m}),signal:x.signal}).then(async f=>{var C,E,N,z,O;if(!f.ok||!f.body){d.onError("Failed to connect");return}const g=f.body.getReader(),y=new TextDecoder;let b="",v=Date.now();const S=6e4,j=setInterval(()=>{Date.now()-v>S&&(clearInterval(j),x.abort(),d.onError("Connection stale — no data received for 60s"))},1e4);try{for(;;){const{done:I,value:_}=await g.read();if(I)break;v=Date.now(),b+=y.decode(_,{stream:!0});const q=b.split(`
|
|
88
|
-
`);b=q.pop()??"";let W="";for(let Y=0;Y<q.length;Y++){const T=q[Y];if(T.startsWith("event: ")){W=T.slice(7).trim();continue}if(T.startsWith("data: ")){let $;try{$=JSON.parse(T.slice(6))}catch{W="";continue}switch(W){case"thinking":$.text&&((C=d.onThinking)==null||C.call(d,$.text));break;case"output":$.text&&d.onText($.text);break;case"tool":(E=d.onToolUse)==null||E.call(d,$.name,$.input);break;case"dispatch":(N=d.onDispatch)==null||N.call(d,$.roleId,$.task);break;case"dispatch:progress":(z=d.onDispatchProgress)==null||z.call(d,$.roleId,$.type,$);break;case"turn":(O=d.onTurn)==null||O.call(d,$.turn);break;case"done":d.onDone($);break;case"error":d.onError($.message??"Unknown error");break;default:$.text&&d.onText($.text);break}W=""}}}}finally{clearInterval(j)}}).catch(f=>{f.name!=="AbortError"&&d.onError(f.message)}),{abort:l}},[l]),abort:l}}const Ng="tycono-appearances",sh="tycono-theme";function M0(){try{const e=localStorage.getItem(Ng);return e?JSON.parse(e):{}}catch{return{}}}function Ff(e){localStorage.setItem(Ng,JSON.stringify(e))}function R0(){try{const e=localStorage.getItem(sh);if(e&&e in oa)return e}catch{}return"default"}function KC(e){var i;const l=(i=oa[e])==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 _f={mode:"auto",intervalSec:18,dailyBudgetUsd:1},oh="tycono-speech-settings",Of="tycono-language";function WC(){try{const e=localStorage.getItem(oh);return e?{..._f,...JSON.parse(e)}:_f}catch{return _f}}function QC(){const[e,l]=k.useState(M0),[r,i]=k.useState(R0),[c,u]=k.useState(WC),[d,m]=k.useState(()=>{try{return localStorage.getItem(Of)??"auto"}catch{return"auto"}}),x=k.useRef(!1);k.useEffect(()=>{x.current||(x.current=!0,Ce.getPreferences().then(j=>{const C=Object.keys(j.appearances??{}).length>0||j.theme!=="default";if(j.speech&&(u(E=>({...E,...j.speech})),localStorage.setItem(oh,JSON.stringify(j.speech))),j.language&&(m(j.language),localStorage.setItem(Of,j.language)),C){const E=j.appearances;l(E),Ff(E),j.theme&&j.theme in oa&&(i(j.theme),localStorage.setItem(sh,j.theme))}else{const E=M0(),N=R0();(Object.keys(E).length>0||N!=="default")&&Ce.updatePreferences({appearances:E,theme:N}).catch(()=>{})}}).catch(()=>{}))},[]),k.useEffect(()=>{KC(r)},[r]);const f=k.useCallback(j=>e[j]??Bh(j),[e]),g=k.useCallback((j,C)=>{l(E=>{const N={...E,[j]:C};return Ff(N),Ce.updatePreferences({appearances:N}).catch(()=>{}),N})},[]),y=k.useCallback(j=>{l(C=>{const E={...C};return delete E[j],Ff(E),Ce.updatePreferences({appearances:E}).catch(()=>{}),E})},[]),b=k.useCallback(j=>{i(j),localStorage.setItem(sh,j),Ce.updatePreferences({theme:j}).catch(()=>{})},[]),v=k.useCallback(j=>{u(C=>{const E={...C,...j};return localStorage.setItem(oh,JSON.stringify(E)),Ce.updatePreferences({speech:E}).catch(()=>{}),E})},[]),S=k.useCallback(j=>{m(j),localStorage.setItem(Of,j),Ce.updatePreferences({language:j}).catch(()=>{})},[]);return{appearances:e,getAppearance:f,setAppearance:g,resetAppearance:y,theme:r,setTheme:b,speechSettings:c,setSpeechSettings:v,language:d,setLanguage:S}}const ZC=3e4;function JC(){var C;const[e,l]=k.useState(null),[r,i]=k.useState("synced"),[c,u]=k.useState([]),d=k.useRef(null),m=k.useCallback(async()=>{try{const E=await Ce.getSaveStatus();l(E),E.noGit?i("no-git"):i(N=>N==="saving"?N:E.dirty?"dirty":"synced")}catch{i("error")}},[]),x=k.useCallback(()=>{d.current||(m(),d.current=setInterval(m,ZC))},[m]);k.useEffect(()=>()=>{d.current&&clearInterval(d.current)},[]);const f=k.useCallback(async E=>{i("saving");try{const N=await Ce.save(E);return await m(),N}catch(N){throw i("error"),N}},[m]),g=k.useCallback(async()=>{try{const E=await Ce.getSaveHistory(20);u(E)}catch{}},[]),y=k.useCallback(async E=>{i("saving");try{await Ce.restoreSave(E),await m()}catch(N){throw i("error"),N}},[m]),b=k.useCallback(async()=>{try{await Ce.initGit(),await m()}catch{i("error")}},[m]),v=e?e.modified.length+e.untracked.length:0,S=((C=e==null?void 0:e.lastCommit)==null?void 0:C.date)??null,j=k.useCallback(async()=>{x()},[x]);return{state:r,dirtyCount:v,lastSaved:S,status:e,save:f,history:c,loadHistory:g,restore:y,refresh:j,initGit:b}}const F0={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."]},_0={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."]},PC=[{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."}]}],eE=18e3,O0=6e3,tE=2500,nE=30*6e4,Ag="tycono:relationships";function lE(){try{const e=localStorage.getItem(Ag);return e?JSON.parse(e):[]}catch{return[]}}function rE(e){localStorage.setItem(Ag,JSON.stringify(e))}function bc(e,l,r){const[i,c]=l<r?[l,r]:[r,l];let u=e.find(d=>d.roleA===i&&d.roleB===c);return u||(u={roleA:i,roleB:c,dispatches:0,wavesTogether:0,conversations:0,familiarity:0,lastInteraction:new Date().toISOString()},e.push(u)),u}function vc(e){return Math.min(100,e.dispatches*5+e.wavesTogether*10+e.conversations*2)}function wc(e){return e[Math.floor(Math.random()*e.length)]}function aE(e,l,r){const i=r.find(m=>m.id===e),c=r.find(m=>m.id===l);if(!i||!c)return null;const u=i.level==="c-level",d=c.level==="c-level";return u&&d?"c-level":i.reportsTo===l||c.reportsTo===e?"superior-subordinate":(i.reportsTo===c.reportsTo,"peer")}function iE(e,l){return e.relation==="any"?!0:e.relation===l}function sE({roles:e,roleStatuses:l,activeExecs:r,getStandupSpeech:i}){const[c,u]=k.useState(new Map),[d,m]=k.useState(lE),x=k.useRef({}),f=k.useRef(null),g=k.useRef(e),y=k.useRef(l),b=k.useRef(r),v=k.useRef(i),S=k.useRef(d);g.current=e,y.current=l,b.current=r,v.current=i,S.current=d,k.useEffect(()=>{const O=Date.now();for(const[I,_]of Object.entries(l))_==="working"&&(x.current[I]=O)},[l]),k.useEffect(()=>{rE(d)},[d]);const j=k.useCallback(O=>{const I=y.current[O],_=b.current.find($=>$.roleId===O);if(I==="working"&&(_!=null&&_.task))return null;const q=v.current(O);if(q&&Math.random()<.3)return{text:q,type:"work",ts:Date.now()};const W=Date.now(),Y=x.current[O]??0;if(W-Y>nE&&Math.random()<.5){const $=_0[O]??_0.engineer;return{text:wc($),type:"guilt",ts:W}}const T=F0[O]??F0.engineer;return{text:wc(T),type:"personality",ts:W}},[]),C=k.useCallback(O=>{if(f.current)return!1;const I=O.filter(Z=>y.current[Z.id]!=="working");if(I.length<2)return!1;const _=[...I].sort(()=>Math.random()-.5),q=_[0],W=_[1],Y=aE(q.id,W.id,O);if(!Y)return!1;const T=bc(S.current,q.id,W.id),$=vc(T),B=PC.filter(Z=>iE(Z,Y)&&$>=Z.minFamiliarity);if(B.length===0)return!1;const G=wc(B);let ne=q.id,V=W.id;G.relation==="superior-subordinate"&&(W.reportsTo===q.id||q.level==="c-level"?(ne=q.id,V=W.id):(ne=W.id,V=q.id)),f.current={templateId:G.id,roleA:ne,roleB:V,turnIdx:0,timer:null};const U=Z=>{if(!f.current||Z>=G.turns.length){f.current=null,m(M=>{const K=[...M],D=bc(K,ne,V);return D.conversations++,D.familiarity=vc(D),D.lastInteraction=new Date().toISOString(),K}),setTimeout(()=>{u(M=>{const K=new Map(M);return K.delete(ne),K.delete(V),K})},O0);return}const ie=G.turns[Z],je=ie.speaker==="A"?ne:V,R=ie.speaker==="A"?V:ne;u(M=>{const K=new Map(M);if(K.set(je,{text:ie.text,type:"social",partnerId:R,ts:Date.now()}),Z>0){const D=G.turns[Z-1].speaker==="A"?ne:V;D!==je&&K.delete(D)}return K}),f.current.turnIdx=Z,f.current.timer=setTimeout(()=>U(Z+1),tE)};return U(0),!0},[]);k.useEffect(()=>{const O=setInterval(()=>{const I=g.current;if(I.length===0||f.current||Math.random()<.35&&C(I))return;const _=I.filter(Y=>y.current[Y.id]!=="working");if(_.length===0)return;const q=wc(_),W=j(q.id);W&&(u(Y=>{const T=new Map(Y);return T.set(q.id,W),T}),setTimeout(()=>{u(Y=>{const T=new Map(Y),$=T.get(q.id);return $&&$.ts===W.ts&&T.delete(q.id),T})},O0))},eE);return()=>{var I;clearInterval(O),(I=f.current)!=null&&I.timer&&clearTimeout(f.current.timer)}},[j,C]);const E=k.useCallback(O=>{const I=c.get(O);return(I==null?void 0:I.text)??""},[c]),N=k.useCallback((O,I)=>{m(_=>{const q=[..._],W=bc(q,O,I);return W.dispatches++,W.familiarity=vc(W),W.lastInteraction=new Date().toISOString(),q})},[]),z=k.useCallback(O=>{O.length<2||m(I=>{const _=[...I];for(let q=0;q<O.length;q++)for(let W=q+1;W<O.length;W++){const Y=bc(_,O[q],O[W]);Y.wavesTogether++,Y.familiarity=vc(Y),Y.lastInteraction=new Date().toISOString()}return _})},[]);return{speeches:c,getSpeech:E,relationships:d,notifyDispatch:N,notifyWave:z}}const Dg="tycono:office-chat";let oE=0;function cE(){return`chat-${Date.now()}-${++oE}`}function Bf(){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 uE(){try{const e=localStorage.getItem(Dg);if(e){const l=JSON.parse(e);if(l.find(i=>i.id==="office")&&!l.find(i=>i.id==="general")){const i=l.filter(c=>c.id!=="office");return[...Bf(),...i]}const r=Bf();for(const i of r)l.find(c=>c.id===i.id)||l.unshift(i);return l}}catch{}return Bf()}function dE(e){const l=e.map(r=>({...r,messages:r.messages.slice(-200)}));localStorage.setItem(Dg,JSON.stringify(l))}function fE(){const[e,l]=k.useState(uE),[r,i]=k.useState(null),[c,u]=k.useState(new Set);k.useEffect(()=>{dE(e)},[e]);const d=k.useCallback(v=>{i(v),v&&u(S=>{const j=new Set(S);return j.delete(v),j})},[]),m=k.useCallback(v=>{const S={...v,id:cE()};l(j=>{const C=j.map(E=>E.id==="general"?v.type==="dispatch"?{...E,messages:[...E.messages,S].slice(-200)}:E:v.channelId?E.id===v.channelId?{...E,messages:[...E.messages,S].slice(-200)}:E:E.members.length>0&&E.members.includes(v.roleId)?{...E,messages:[...E.messages,S].slice(-200)}:E);return u(E=>{const N=new Set(E);for(const z of C){const O=j.find(I=>I.id===z.id);O&&z.messages.length>O.messages.length&&N.add(z.id)}return N}),C})},[]),x=k.useCallback((v,S,j)=>{const C=`ch-${Date.now()}`,E={id:C,name:v.startsWith("#")?v:`#${v}`,members:S,isDefault:!1,messages:[],topic:j};l(N=>[...N,E]),i(C)},[]),f=k.useCallback(v=>{l(S=>S.filter(j=>j.id!==v||j.isDefault)),i(S=>S===v?"general":S)},[]),g=k.useCallback((v,S)=>{l(j=>j.map(C=>C.id===v&&!C.isDefault?{...C,members:S}:C))},[]),y=k.useCallback((v,S)=>{l(j=>j.map(C=>C.id===v&&!C.isDefault?{...C,topic:S||void 0}:C))},[]),b=k.useCallback(v=>{l(S=>S.map(j=>{if(j.id==="watercooler"){const C=v.filter(E=>E.level!=="c-level").map(E=>E.id);if(j.members.length!==C.length||!C.every(E=>j.members.includes(E)))return{...j,members:C}}return j}))},[]);return{channels:e,activeChannelId:r,setActiveChannelId:d,pushMessage:m,createChannel:x,deleteChannel:f,updateMembers:g,updateTopic:y,unreadChannels:c,syncDefaultMembers:b}}const hE=45e3,mE=5e3,xE=4,pE=20;function yE({roles:e,roleStatuses:l,activeExecs:r,channels:i,relationships:c,pushMessage:u,speechSettings:d,engineType:m,hasApiKey:x}){const g=((d==null?void 0:d.mode)==="auto"?m==="claude-cli"||m==="local"?"llm":"template":(d==null?void 0:d.mode)??"template")==="llm"&&(x!==!1||m==="claude-cli"),y=((d==null?void 0:d.intervalSec)??hE/1e3)*1e3,b=k.useRef(e),v=k.useRef(l),S=k.useRef(r),j=k.useRef(i),C=k.useRef(c),E=k.useRef(u),N=k.useRef(0),z=k.useRef(!1);b.current=e,v.current=l,S.current=r,j.current=i,C.current=c,E.current=u;const O=k.useCallback(async(_,q)=>{if(z.current)return!1;z.current=!0;try{if(!b.current.find(V=>V.id===_))return!1;const Y=q.messages.slice(-pE).map(V=>({roleId:V.roleId,text:V.text,ts:V.ts})),T=b.current.filter(V=>q.members.includes(V.id)),$=C.current.filter(V=>V.roleA===_||V.roleB===_).map(V=>({partnerId:V.roleA===_?V.roleB:V.roleA,familiarity:V.familiarity})),B=S.current.find(V=>V.roleId===_),G=B?{currentTask:B.task,taskProgress:null}:{currentTask:null,taskProgress:null},ne=await Ce.chatInChannel({channelId:q.name.replace("#",""),channelTopic:q.topic,roleId:_,history:Y,members:T.map(V=>({id:V.id,name:V.name,level:V.level})),relationships:$,workContext:G});return ne.message?(E.current({ts:Date.now(),roleId:_,text:ne.message,type:"chat",channelId:q.id}),!0):!1}catch{return!1}finally{z.current=!1}},[]),I=k.useCallback(async(_,q)=>{if(N.current>=xE){N.current=0;return}const W=_.members.filter(B=>B!==q&&v.current[B]!=="working");if(W.length===0){N.current=0;return}const Y=W[Math.floor(Math.random()*W.length)];if(Math.random()>.7){N.current=0;return}const T=N.current*2e3,$=Math.random()*5e3;setTimeout(async()=>{N.current++;const B=j.current.find(ne=>ne.id===_.id);if(!B)return;if(await O(Y,B)){const ne=.6-N.current*.1;Math.random()<ne?I(B,Y):N.current=0}else N.current=0},mE+T+$)},[O]);k.useEffect(()=>{if(!g)return;const _=setInterval(async()=>{const q=b.current;if(q.length===0||z.current)return;const W=q.filter(G=>v.current[G.id]!=="working");if(W.length===0)return;const Y=W[Math.floor(Math.random()*W.length)],T=j.current.filter(G=>G.members.length===0?!0:G.members.includes(Y.id));if(T.length===0)return;const $=T[Math.floor(Math.random()*T.length)];N.current=0,await O(Y.id,$)&&I($,Y.id)},y);return()=>clearInterval(_)},[g,y,O,I])}function kc({type:e,className:l}){const r=k.useRef(null),i=Tj(e);return k.useEffect(()=>{const c=r.current;if(!c||!i)return;const u=c.getContext("2d");u&&Mj(u,i)},[e,i]),i?s.jsx("canvas",{ref:r,width:i.canvasWidth,height:i.canvasHeight,className:l,style:{imageRendering:"pixelated",display:"block"}}):null}const Tg=[[1,8],[3,5],[8,1],[5,3]],gE=[[1,4],[2,3],[4,1],[3,2]];function jc(e){const l=e===1||e===3?-1:0,r=Tg[e],i=e<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 Sc(e){const l=e===1||e===3?-1:0,r=Tg[e],i=e<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 la(e,l){const r=e===1||e===3?-1:0,i=gE[e],c=r,u=e%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 B0={down:[jc(0),jc(1),jc(2),jc(3)],up:[Sc(0),Sc(1),Sc(2),Sc(3)],right:[la(0,!0),la(1,!0),la(2,!0),la(3,!0)],left:[la(0,!1),la(1,!1),la(2,!1),la(3,!1)]},Ze=4,_t=28,pn=2,yt=4,st=4,yr=[{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 $h(e,l,r){const u=e.fy+Math.max(10,Math.floor(e.fh*.18)),d=Math.min(l,r),m=Math.ceil(l/d),x=[],f=d*28,g=e.fx+Math.max(8,Math.floor((e.fw-f)/2));for(let y=0;y<m&&x.length<l;y++){const b=Math.min(d,l-y*d);for(let v=0;v<b;v++)x.push({dx:g+v*28,dy:u+y*28,room:e.id})}return x}function bE(e){const i=yr[0],c={id:"main",wx:Ze+st,wy:Ze,ww:160-2*(Ze+st),wh:_t,fx:Ze+st,fy:Ze+_t+pn,fw:160-2*(Ze+st),fh:120-Ze-_t-pn-Ze,...i},u=$h(c,Math.min(e,6),3),d=[{id:"s-window-l",type:"window",room:"main",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"s-window-r",type:"window",room:"main",zone:"wall",anchorX:"right",offsetX:-26,offsetY:6,windowW:16,windowH:14},{id:"s-clock",type:"clock",room:"main",zone:"wall",offsetX:Math.floor((160-2*(Ze+st))/2),offsetY:10}],m=[{id:"s-plant-l",type:"plant",room:"main",zone:"floor",offsetX:4,offsetY:4},{id:"s-plant-r",type:"plant",room:"main",zone:"floor",anchorX:"right",offsetX:-8,offsetY:4}];return{preset:"S",canvasW:160,canvasH:120,rooms:{main:c},desks:u,doors:{},adjacency:{main:[]},corridorY:{main:c.fy+c.fh-12},waypoints:{main:[{x:c.fx+10,y:c.fy+c.fh-14},{x:c.fx+c.fw/2,y:c.fy+c.fh-14},{x:c.fx+c.fw-10,y:c.fy+c.fh-14}]},wallDecorations:d,furniture:m}}function vE(e){const c={id:"exec",wx:Ze+st,wy:Ze,ww:144-Ze-st-yt/2,wh:_t,fx:Ze+st,fy:Ze+_t+pn,fw:144-Ze-st-yt/2,fh:66,...yr[0]},u={id:"work",wx:144+yt/2+st,wy:Ze,ww:144-yt/2-st-Ze,wh:_t,fx:144+yt/2+st,fy:Ze+_t+pn,fw:144-yt/2-st-Ze,fh:66,...yr[1]},d={id:"meet",wx:Ze+st,wy:Ze+_t+pn+66+yt,ww:144-Ze-st-yt/2,wh:_t,fx:Ze+st,fy:Ze+_t+pn+66+yt+_t+pn,fw:144-Ze-st-yt/2,fh:70,...yr[2]},m={id:"comm",wx:144+yt/2+st,wy:Ze+_t+pn+66+yt,ww:144-yt/2-st-Ze,wh:_t,fx:144+yt/2+st,fy:Ze+_t+pn+66+yt+_t+pn,fw:144-yt/2-st-Ze,fh:70,...yr[3]},x={exec:c,work:u,meet:d,comm:m},f=[];let g=e;const y=[[c,Math.min(3,g)],[u,0]];y[1][1]=Math.min(3,g-y[0][1]);const b=[[d,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[_,q]of[...y,...b])q>0&&f.push(...$h(_,q,3));const S=Ze+_t+pn+66,j=144-yt/2,C={exec_work:{id:"exec_work",type:"v",doorY:Ze+_t+pn+20+12,xA:j-2,xB:u.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:Ze+_t+pn+66+yt+_t+pn+20+12,xA:j-2,xB:m.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:Ze+st+40+14,yA:S-2,yB:d.fy+2},work_comm:{id:"work_comm",type:"h",doorX:144+yt/2+st+40+14,yA:S-2,yB:m.fy+2}},E={exec:[{room:"work",door:"exec_work",side:"A"},{room:"meet",door:"exec_meet",side:"A"}],work:[{room:"exec",door:"exec_work",side:"B"},{room:"comm",door:"work_comm",side:"A"}],meet:[{room:"exec",door:"exec_meet",side:"B"},{room:"comm",door:"meet_comm",side:"A"}],comm:[{room:"work",door:"work_comm",side:"B"},{room:"meet",door:"meet_comm",side:"B"}]},N={exec:c.fy+52,work:u.fy+48,meet:d.fy+56,comm:m.fy+42},z={exec:[{x:c.fx+6,y:c.fy+52},{x:c.fx+60,y:c.fy+54},{x:c.fx+112,y:c.fy+50},{x:c.fx+50,y:c.fy+52}],work:[{x:u.fx+14,y:u.fy+48},{x:u.fx+44,y:u.fy+48},{x:u.fx+70,y:u.fy+48},{x:u.fx+100,y:u.fy+48}],meet:[{x:d.fx+60,y:d.fy+56},{x:d.fx+30,y:d.fy+54},{x:d.fx+110,y:d.fy+50},{x:d.fx+80,y:d.fy+56}],comm:[{x:m.fx+96,y:m.fy+8},{x:m.fx+60,y:m.fy+42},{x:m.fx+40,y:m.fy+42},{x:m.fx+20,y:m.fy+42}]},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}],I=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(c.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"M",canvasW:288,canvasH:208,rooms:x,desks:f,doors:C,adjacency:E,corridorY:N,waypoints:z,wallDecorations:O,furniture:I}}function wE(e){const d={id:"exec",wx:Ze+st,wy:Ze,ww:180-Ze-st-yt/2,wh:_t,fx:Ze+st,fy:Ze+_t+pn,fw:180-Ze-st-yt/2,fh:82,...yr[0]},m={id:"work",wx:180+yt/2+st,wy:Ze,ww:180-yt/2-st-Ze,wh:_t,fx:180+yt/2+st,fy:Ze+_t+pn,fw:180-yt/2-st-Ze,fh:82,...yr[1]},x=Ze+_t+pn+82,f={id:"meet",wx:Ze+st,wy:x+yt,ww:180-Ze-st-yt/2,wh:_t,fx:Ze+st,fy:x+yt+_t+pn,fw:180-Ze-st-yt/2,fh:86,...yr[2]},g={id:"comm",wx:180+yt/2+st,wy:x+yt,ww:180-yt/2-st-Ze,wh:_t,fx:180+yt/2+st,fy:x+yt+_t+pn,fw:180-yt/2-st-Ze,fh:86,...yr[3]},y={exec:d,work:m,meet:f,comm:g},b=[];let v=e;const S=[[d,Math.min(5,v)],[m,0]];S[1][1]=Math.min(5,v-S[0][1]);const j=[[f,0],[g,0]];let C=v-S[0][1]-S[1][1];C>0&&(j[0][1]=Math.min(3,C),C-=j[0][1]),C>0&&(j[1][1]=Math.min(3,C));for(const[W,Y]of[...S,...j])Y>0&&b.push(...$h(W,Y,4));const E=180-yt/2,N={exec_work:{id:"exec_work",type:"v",doorY:d.fy+82/2,xA:E-2,xB:m.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:f.fy+86/2,xA:E-2,xB:g.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:d.fx+54,yA:x-2,yB:f.fy+2},work_comm:{id:"work_comm",type:"h",doorX:m.fx+54,yA:x-2,yB:g.fy+2}},z={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:d.fy+82-12,work:m.fy+82-12,meet:f.fy+86-12,comm:g.fy+86-12},I={exec:[{x:d.fx+10,y:O.exec},{x:d.fx+d.fw/2,y:O.exec},{x:d.fx+d.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:f.fx+10,y:O.meet},{x:f.fx+f.fw/2,y:O.meet},{x:f.fx+f.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}]},_=[{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}],q=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(d.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"L",canvasW:360,canvasH:260,rooms:y,desks:b,doors:N,adjacency:z,corridorY:O,waypoints:I,wallDecorations:_,furniture:q}}const kE=2;function zg(e,l){return l?l==="L"&&e<=12-kE?"M":l==="M"&&e>12?"L":l:e<=12?"M":"L"}function Mg(e,l){switch(l??zg(e)){case"S":return bE(e);case"M":return vE(e);case"L":return wE(e)}}function $0(e,l){if(!l||Object.keys(l).length===0)return e;const r=i=>i.map(c=>{const u=l[c.id];return u?{...c,offsetX:u.offsetX,offsetY:u.offsetY}:c});return{...e,wallDecorations:r(e.wallDecorations),furniture:r(e.furniture)}}function L0(e,l){if(l)for(const[r,i]of Object.entries(l))e[r]&&(e[r]={...e[r],dx:i.dx,dy:i.dy})}function $f(e,l){if(!l||l.length===0)return e;const r=new Set(l);return{...e,wallDecorations:e.wallDecorations.filter(i=>!r.has(i.id)),furniture:e.furniture.filter(i=>!r.has(i.id))}}function H0(e,l){if(!l||l.length===0)return e;const r=[],i=[];for(const c of l)c.zone==="wall"?r.push(c):i.push(c);return{...e,wallDecorations:[...e.wallDecorations,...r],furniture:[...e.furniture,...i]}}let Is;function jE(e){Is=e}function L(e,l,r,i,c,u){e=Math.round(e),l=Math.round(l),!(u!==void 0&&u<.01)&&(u!==void 0&&u!==1&&(Is.globalAlpha=u),Is.fillStyle=c,Is.fillRect(e,l,r,i),u!==void 0&&u!==1&&(Is.globalAlpha=1))}function ot(e,l,r,i){L(e,l,1,1,r,i)}let Mc=1;function Mi(e){Mc=e}function Vl(){return Mc=Mc*16807%2147483647,(Mc&65535)/65535}function Rg(e){const l=parseInt(e.slice(1,3),16)/255,r=parseInt(e.slice(3,5),16)/255,i=parseInt(e.slice(5,7),16)/255,c=Math.max(l,r,i),u=Math.min(l,r,i);let d=0,m=0;const x=(c+u)/2;if(c!==u){const f=c-u;m=x>.5?f/(2-c-u):f/(c+u),c===l?d=((r-i)/f+(r<i?6:0))/6:c===r?d=((i-l)/f+2)/6:d=((l-r)/f+4)/6}return[d*360,m*100,x*100]}function Fg(e,l,r){e=(e%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=d=>{const m=(d+e/30)%12;return r-i*Math.max(-1,Math.min(m-3,9-m,1))},u=d=>Math.round(d*255).toString(16).padStart(2,"0");return"#"+u(c(0))+u(c(8))+u(c(4))}function Gl(e,l=1){const[r,i,c]=Rg(e);return Fg(r+15*l,Math.min(100,i+8),c-12*l)}function Qt(e,l=1){const[r,i,c]=Rg(e);return Fg(r-10*l,i-3,c+10*l)}const xn={hi:"#D4AA5C",base:"#B08040",sh:"#7A5038",deep:"#4E3028"},Xl={hi:"#8A6848",base:"#604832",sh:"#3A2E24",deep:"#2A1E18"},Ul={hi:"#5A6A80",base:"#485868",sh:"#364858",deep:"#283848"},da="#100A06";function SE(e,l,r=14,i=12){L(e,l,r,i,"#4A3828"),L(e+1,l+1,r-2,i-2,"#5A4838"),L(e+2,l+2,r-4,i-4,"#4A7098"),L(e+2,l+2,r-4,Math.floor((i-4)/2),"#6A90B8",.35);const c=Math.floor(r/2);L(e+c,l+1,1,i-2,"#4A3828"),L(e+1,l+Math.floor(i/2),r-2,1,"#4A3828",.5),ot(e+3,l+3,"#8AB8E8",.35),ot(e+c+2,l+3,"#8AB8E8",.25),L(e-1,l+i,r+2,2,"#5A4838"),L(e-1,l+i,r+2,1,Qt("#5A4838",.5),.35)}function CE(e,l,r){L(e,l,10,8,"#3A2818"),L(e+1,l+1,8,6,r),L(e+2,l+2,4,3,Qt(r,1.2),.3),ot(e+3,l+2,Qt(r,2),.25)}function EE(e,l){L(e,l,7,7,"#3A2818"),L(e+1,l+1,5,5,"#F0EDE5"),ot(e+3,l+1,"#AAA"),ot(e+3,l+5,"#AAA"),ot(e+1,l+3,"#AAA"),ot(e+5,l+3,"#AAA"),ot(e+3,l+3,"#222"),L(e+3,l+1,1,2,"#333"),ot(e+4,l+3,"#D32F2F")}function NE(e,l){L(e,l,26,16,"#586878"),L(e+1,l+1,24,13,"#ECEFF1"),L(e+1,l+1,24,1,"#F5F5F5",.4),L(e+3,l+3,14,1,"#1565C0",.6),L(e+3,l+5,18,1,"#333",.2),L(e+3,l+7,12,1,"#D32F2F",.35),L(e+3,l+9,16,1,"#333",.15),L(e+1,l+14,24,2,"#708898"),L(e+3,l+14,3,1,"#D32F2F"),L(e+7,l+14,3,1,"#1565C0"),L(e+11,l+14,3,1,"#2E7D32")}function AE(e,l){L(e,l,22,16,"#6A5030"),L(e+1,l+1,20,14,"#C4A66A"),Mi(88);for(let r=0;r<14;r++)for(let i=0;i<20;i++)Vl()>.5&&ot(e+1+i,l+1+r,Vl()>.5?"#B89858":"#D4B87A",.18);L(e+2,l+2,5,4,"#FFF176"),L(e+8,l+2,5,4,"#90CAF9"),L(e+14,l+3,5,4,"#CE93D8"),L(e+3,l+8,7,4,"#C8E6C9"),L(e+11,l+8,8,4,"#F8BBD0"),ot(e+4,l+2,"#E53935"),ot(e+10,l+2,"#1E88E5"),ot(e+16,l+3,"#FF9800")}function DE(e,l){L(e,l,20,3,"#5A4030"),L(e,l,20,1,Qt("#5A4030",.5),.35),L(e,l+2,20,1,Gl("#5A4030",.5),.3),L(e+2,l-4,3,4,"#E53935"),L(e+2,l-4,3,1,Qt("#E53935",1),.3),L(e+6,l-3,2,3,"#1E88E5"),L(e+9,l-5,4,5,"#43A047"),L(e+14,l-3,3,3,"#FFD54F"),ot(e+15,l-3,"#FFF176",.4)}function TE(e,l){L(e,l,16,12,"#1E1E28"),L(e+1,l+1,14,9,"#0C1420"),L(e+2,l+2,12,1,"#EF4444",.6),ot(e+2,l+4,"#4CAF50"),L(e+4,l+4,7,1,"#8b949e",.4),ot(e+2,l+6,"#FF9800"),L(e+4,l+6,5,1,"#8b949e",.3),ot(e+2,l+8,"#42A5F5"),L(e+4,l+8,8,1,"#8b949e",.25),L(e+7,l+10,2,2,"#1E1E28"),L(e+5,l+11,6,1,"#586878")}function zE(e,l,r){L(e+2,l+20,22,2,da,.15),L(e,l,22,20,Xl.deep),L(e+1,l+1,20,18,Xl.base),L(e,l,22,1,Xl.hi,.35),L(e,l,1,20,Xl.hi,.2);for(const u of[6,12])L(e+1,l+u,20,2,Xl.sh),L(e+1,l+u,20,1,Xl.hi,.2);const i=["#E53935","#1E88E5","#43A047","#8E24AA","#FB8C00","#00897B","#5C6BC0"];let c=e+2;for(let u=0;u<5;u++){const d=2+u%2;L(c,l+1,d,5,i[u]),L(c,l+1,d,1,Qt(i[u],1),.35),c+=d+1}c=e+2;for(let u=0;u<4;u++)L(c,l+7,4,5,i[u+3]),L(c,l+7,4,1,Qt(i[u+3],1),.25),c+=5;L(e+2,l+14,4,4,"#FFD54F"),L(e+8,l+14,7,4,"#90CAF9"),r&&L(e,l-1,22,1,r,.7)}function ME(e,l){L(e+2,l+11,6,2,da,.1),L(e+2,l+8,6,4,"#8B5E3C"),L(e+1,l+7,8,2,Gl("#A06E48",.3)),L(e+2,l+7,6,1,Qt("#A06E48",.5),.4),L(e+1,l+3,3,4,"#2E7D32"),L(e+5,l+2,3,4,"#2E7D32"),L(e+2,l+1,4,4,"#43A047"),L(e+3,l+0,3,3,"#66BB6A"),ot(e+4,l,"#81C784"),ot(e+3,l+1,"#A5D6A7",.4)}function RE(e,l){Ma(e+4,l-4,"down"),Ma(e+16,l-4,"down"),Ma(e+28,l-4,"down"),L(e+3,l+24,34,3,da,.15),L(e,l+2,36,18,xn.deep),L(e+1,l+3,34,16,xn.base),L(e+1,l+3,34,1,xn.hi,.35);for(let r=0;r<14;r+=3)L(e+1,l+4+r,34,1,Gl(xn.base,.2),.08);L(e,l+20,36,4,xn.deep),L(e+1,l+21,34,2,xn.sh),L(e+6,l+7,10,6,"#1A1A24"),L(e+7,l+8,8,4,"#0C1420"),L(e+8,l+9,4,1,"#2A6898",.4),L(e+20,l+8,6,4,"#F0F0F0"),L(e+15,l+7,3,3,"#ECEFF1"),ot(e+16,l+8,"#795548"),Ma(e+4,l+24,"up"),Ma(e+16,l+24,"up"),Ma(e+28,l+24,"up")}function FE(e,l){L(e+2,l+16,36,3,da,.15),L(e,l,36,5,"#5D4037"),L(e+1,l+1,34,3,"#6D4C41"),L(e+1,l+1,34,1,Qt("#6D4C41",.5),.3),L(e,l+5,36,8,"#5D4037"),L(e+2,l+6,15,6,"#6D4C41"),L(e+3,l+6,13,1,Qt("#6D4C41",.5),.35),L(e+19,l+6,15,6,"#6D4C41"),L(e+20,l+6,13,1,Qt("#6D4C41",.5),.35),L(e+17,l+6,2,6,"#5D4037"),L(e,l+13,36,3,Gl("#5D4037",1)),L(e-2,l+2,3,12,"#5D4037"),L(e+35,l+2,3,12,"#5D4037"),L(e+4,l+7,6,4,"#FF8A65"),L(e+5,l+7,4,1,Qt("#FF8A65",1),.35)}function _E(e,l){L(e+2,l+10,22,2,da,.12),L(e,l,22,8,Xl.deep),L(e+1,l+1,20,6,Xl.base),L(e+1,l+1,20,1,Xl.hi,.3),L(e,l+8,22,2,Xl.sh),L(e+3,l+2,6,4,"#F0F0F0"),L(e+13,l+3,3,3,"#ECEFF1"),ot(e+14,l+4,"#795548")}function OE(e,l){L(e+1,l+14,10,2,da,.12),L(e,l,10,14,"#546E7A"),L(e,l,10,1,Qt("#546E7A",1),.35),L(e+1,l+1,8,3,"#78909C"),L(e+1,l+5,8,4,"#37474F"),ot(e+2,l+6,"#EF5350"),ot(e+4,l+6,"#66BB6A"),L(e+2,l+11,4,2,"#ECEFF1")}function BE(e,l){L(e+2,l+16,26,3,da,.18),L(e,l,26,10,xn.deep),L(e+1,l+1,24,8,xn.base),L(e+1,l+2,24,1,xn.hi,.2),L(e+1,l+4,24,1,Gl(xn.base,.2),.1),L(e+1,l+6,24,1,xn.hi,.15),L(e+1,l+1,24,1,xn.hi,.4),L(e+1,l+1,1,8,xn.hi,.2),L(e,l+10,26,5,xn.deep),L(e+1,l+11,24,3,xn.sh),L(e+1,l+10,24,1,Gl(xn.base,1.5),.4),L(e+1,l+14,24,1,xn.base,.15),L(e+2,l+12,10,1,xn.deep,.4),L(e+14,l+12,10,1,xn.deep,.4),ot(e+7,l+11,"#C8D0D8",.6),ot(e+19,l+11,"#C8D0D8",.6),L(e+6,l-5,14,7,"#1E1E28"),L(e+7,l-4,12,5,"#0C1420"),L(e+8,l-3,5,1,"#2A6898",.6),L(e+8,l-2,8,1,"#1A3858",.4),L(e+8,l-1,3,1,"#2A6898",.35),ot(e+7,l-4,"#4A98D8",.25),ot(e+12,l+1,"#4CAF50",.4),L(e+12,l+2,2,3,"#586878"),L(e+10,l+4,6,1,"#8898A8"),L(e+6,l+4,12,4,"#222228"),L(e+6,l+4,12,1,"#333338",.4);for(let r=0;r<5;r++)ot(e+7+r*2,l+5,"#444",.6),ot(e+7+r*2,l+6,"#3A3A3E",.4);L(e+20,l+5,3,4,"#333338"),L(e+20,l+5,3,1,"#444448"),L(e+1,l+3,4,4,"#F0EDE8"),L(e+1,l+3,4,1,"#F8F6F2"),ot(e+2,l+5,"#6D4C41")}function Ma(e,l,r){L(e+1,l+9,10,2,da,.1),ot(e+5,l+9,"#1E1E22"),ot(e+1,l+10,"#1A1A1E"),ot(e+9,l+10,"#1A1A1E"),ot(e+3,l+11,"#1A1A1E"),ot(e+7,l+11,"#1A1A1E"),L(e+1,l+2,8,6,Ul.base),L(e+2,l+3,6,4,Ul.hi,.35),L(e+2,l+3,6,1,Qt(Ul.hi,.5),.25),L(e+1,l+7,8,1,Ul.deep),r==="up"?(L(e,l+7,10,3,Ul.deep),L(e+1,l+8,8,1,Ul.sh)):(L(e,l-1,10,3,Ul.deep),L(e+1,l,8,1,Ul.sh)),L(e,l+3,1,4,Ul.sh),L(e+9,l+3,1,4,Ul.sh)}const _g={bookshelf:(e,l,r)=>zE(e,l,r.accent),plant:(e,l)=>ME(e,l),"meeting-table":(e,l)=>RE(e,l),sofa:(e,l)=>FE(e,l),"coffee-table":(e,l)=>_E(e,l),"coffee-machine":(e,l)=>OE(e,l),window:(e,l,r)=>SE(e,l,r.windowW??16,r.windowH??14),picture:(e,l,r)=>CE(e,l,r.pictureColor??"#1565C0"),clock:(e,l)=>EE(e,l),whiteboard:(e,l)=>NE(e,l),"bulletin-board":(e,l)=>AE(e,l),shelf:(e,l)=>DE(e,l),screen:(e,l)=>TE(e,l)};function Di(e,l){const r=e.zone==="wall"?l.wx:l.fx,i=e.zone==="wall"?l.wy:l.fy;return{x:e.anchorX==="right"?(e.zone==="wall"?l.wx+l.ww:l.fx+l.fw)+e.offsetX:r+e.offsetX,y:i+e.offsetY}}function $E(e){for(const l of e.wallDecorations){const r=e.rooms[l.room];if(!r)continue;const{x:i,y:c}=Di(l,r),u=_g[l.type];u&&u(i,c,l)}}function LE(e,l,r){for(const i of e.furniture){const c=e.rooms[i.room];if(!c||i.condition==="no-desks"&&r.has(i.room))continue;const{x:u,y:d}=Di(i,c),m=_g[i.type];m&&l.push({y:d,draw:()=>m(u,d,i)})}}function ra(e){const l=[],r=[...e.wallDecorations,...e.furniture];for(const i of r){if(!i.facility)continue;const c=e.rooms[i.room];if(!c)continue;const{x:u,y:d}=Di(i,c);l.push({id:i.facility.id,label:i.facility.label,icon:i.facility.icon,color:i.facility.color,dx:u,dy:d,pw:i.facility.hitW,ph:i.facility.hitH})}return l}const HE={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 ch(e){return HE[e]??{w:16,h:16}}function Lf(e,l,r,i){for(let c=e.furniture.length-1;c>=0;c--){const u=e.furniture[c],d=e.rooms[u.room];if(!d||u.condition==="no-desks"&&i.has(u.room))continue;const{x:m,y:x}=Di(u,d),f=ch(u.type);if(l>=m&&l<=m+f.w&&r>=x&&r<=x+f.h)return u.id}for(let c=e.wallDecorations.length-1;c>=0;c--){const u=e.wallDecorations[c],d=e.rooms[u.room];if(!d)continue;const{x:m,y:x}=Di(u,d),f=ch(u.type);if(l>=m&&l<=m+f.w&&r>=x&&r<=x+f.h)return u.id}return null}function I0(e,l,r,i,c){const d=[...l.wallDecorations,...l.furniture].find(y=>y.id===r);if(!d||d.condition==="no-desks"&&c.has(d.room))return;const m=l.rooms[d.room];if(!m)return;const{x,y:f}=Di(d,m),g=ch(d.type);e.save(),e.fillStyle=i,e.globalAlpha=.2,e.fillRect(x-1,f-1,g.w+2,g.h+2),e.globalAlpha=.9,e.strokeStyle=i,e.lineWidth=1,e.strokeRect(x-.5,f-.5,g.w+1,g.h+1),e.restore()}function U0(e,l,r,i){e.save(),e.fillStyle=i,e.globalAlpha=.2,e.fillRect(l-1,r-1,28,42),e.globalAlpha=.9,e.strokeStyle=i,e.lineWidth=1,e.strokeRect(l-.5,r-.5,27,41),e.restore()}function Y0(e,l,r){for(const[i,c]of Object.entries(e))if(l>=c.dx&&l<=c.dx+26&&r>=c.dy&&r<=c.dy+40)return i;return null}const IE=[{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:"🖥️"}],Cc=16,UE=4,za=4,Rc=2,Ct=4,ia=4;let Ue=Mg(7);const Yc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};let Dl=ra(Ue);function Og(e){return{x:e.dx,y:e.dy,w:e.pw,h:e.ph}}function Bg(e){return{cx:e.dx+e.pw/2,botY:e.dy+e.ph}}let en={};function YE(e){const l={};for(let r=0;r<e.length&&r<Ue.desks.length;r++)l[e[r]]=Ue.desks[r];return l}let Xt,_a=null,Ra=null,pr=!1,Tl=null,sl=null,An=null,mn=null,ji=null,Yl=null;function qE(e,l){const{wx:r,wy:i,ww:c,wh:u,wallColor:d,baseboardColor:m}=e,x=Gl(d,.5),f=Qt(d,.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){L(y.sx,i,y.sw,u,d);for(let b=0;b<u;b+=4)L(y.sx,i+b,y.sw,1,f,.08),L(y.sx,i+b+2,y.sw,1,x,.05);Mi(Math.round(y.sx*7+i*13));for(let b=0;b<y.sw;b+=3)Vl()>.4&&L(y.sx+b,i,1,u,f,.04);L(y.sx,i,y.sw,2,f,.3),L(y.sx,i,y.sw,1,Qt(d,1),.2),L(y.sx,i+u-2,y.sw,2,x,.3),L(y.sx,i+u,y.sw,Rc,m),L(y.sx,i+u,y.sw,1,Qt(m,.5),.4)}l&&(L(l.x-1,i,1,u+Rc,"#4A3828"),L(l.x+l.w,i,1,u+Rc,"#4A3828"),L(l.x,i,l.w,1,"#0A0808",.12)),L(e.fx,e.fy,e.fw,3,"#0A0808",.12),L(e.fx,e.fy+3,e.fw,2,"#0A0808",.06)}function XE(e){const l="#504038",r=Gl(l,.5),i=Qt(l,.5),c=e.wx-ia,u=e.wy,d=e.wh+Rc+e.fh;L(c,u,ia,d,l),L(c,u,1,d,i,.3),L(c+ia-1,u,1,d,r,.4);for(let x=0;x<d;x+=6)L(c+1,u+x,ia-2,1,i,.06);const m=e.wx+e.ww;L(m,u,ia,d,l),L(m,u,1,d,i,.2),L(m+ia-1,u,1,d,r,.3)}function Hf(e){const{fx:l,fy:r,fw:i,fh:c}=e,u="#B08040",d="#C89848",m="#8A6030",x="#6A4820";L(l,r,i,c,u),Mi(42);for(let f=0;f<c;f+=5){const g=Math.floor(f/5)%2*10;for(let y=-10;y<i+10;y+=20){const b=l+y+g,v=Math.max(l,b),S=Math.min(b+19,l+i)-v;if(S<=0)continue;const j=Vl()>.5?d:u;L(v,r+f,S,4,j,.25),L(v,r+f,S,1,d,.3),L(v,r+f+4,S,1,x,.35),b>=l&&b<l+i&&L(b,r+f,1,4,x,.2),L(v,r+f+2,S,1,m,.1)}}L(l,r,i,2,"#0A0808",.08),L(l,r,2,c,"#0A0808",.06)}function q0(e){const{fx:l,fy:r,fw:i,fh:c}=e,u="#1C2A38",d="#101820";Mi(99),L(l,r,i,c,u);for(let m=0;m<c;m+=Cc)for(let x=0;x<i;x+=Cc){const f=Math.min(Cc,i-x),g=Math.min(Cc,c-m);Vl()>.5&&L(l+x,r+m,f,g,Qt(u,.2),.15),L(l+x+2,r+m+2,f-4,g-4,Qt(u,.3),.08),L(l+x,r+m,f,1,d,.5),L(l+x,r+m,1,g,d,.5),L(l+x+1,r+m+1,1,g-1,Qt(u,.4),.1),Vl()>.85&&ot(l+x+4+Math.floor(Vl()*8),r+m+4+Math.floor(Vl()*8),"#3A6A9A",.08)}}function VE(e){const{fx:l,fy:r,fw:i,fh:c}=e,u="#387848",d="#4A9058",m="#285E38";L(l,r,i,c,u),Mi(77);for(let f=0;f<c;f+=2)for(let g=0;g<i;g+=2)Vl()>.5&&ot(l+g,r+f,d,.1),Vl()>.8&&ot(l+g+1,r+f+1,m,.12);const x=5;L(l+x,r+x,i-x*2,1,d,.45),L(l+x,r+c-x-1,i-x*2,1,m,.45),L(l+x,r+x,1,c-x*2,d,.35),L(l+i-x-1,r+x,1,c-x*2,m,.35)}function GE(e){const{fx:l,fy:r,fw:i,fh:c}=e,u="#D8C490",d="#B09060",m="#907848";Mi(55);for(let x=0;x<c;x+=8)for(let f=0;f<i;f+=8){const g=Math.min(8,i-f),y=Math.min(8,c-x),b=(f/8+x/8)%2===0?d:u;L(l+f,r+x,g,y,b),L(l+f+1,r+x+1,g-2,1,Qt(b,.4),.2),L(l+f+1,r+x+1,1,y-2,Qt(b,.4),.15),L(l+f+g-2,r+x+2,1,y-3,Gl(b,.4),.15),L(l+f+2,r+x+y-2,g-3,1,Gl(b,.4),.15),L(l+f,r+x,g,1,m,.3),L(l+f,r+x,1,y,m,.3)}}function KE(){const{canvasW:e,canvasH:l,rooms:r,doors:i}=Ue,c="#2A1E14",u="#3A2E24";if(L(0,0,e,za,c),L(0,l-za,e,za,c),L(0,0,za,l,c),L(e-za,0,za,l,c),L(0,0,e,1,u,.3),L(0,0,1,l,u,.2),!r.exec||!r.work||!r.meet||!r.comm)return;const d=r.exec,m=r.meet,x=e/2,f=x-Ct/2,g=d.fy+d.fh,y=i.exec_work,b=i.meet_comm,v=i.exec_meet,S=i.work_comm,j=24,C=28,E=((y==null?void 0:y.doorY)??d.fy+20)-j/2,N=((v==null?void 0:v.doorX)??za+ia+54)-C/2,z=((S==null?void 0:S.doorX)??x+Ct/2+ia+54)-C/2,O=((b==null?void 0:b.doorY)??m.fy+20)-j/2;L(0,g,N,Ct,c),L(N+C,g,f-N-C,Ct,c),L(f+Ct,g,z-f-Ct,Ct,c),L(z+C,g,e-z-C,Ct,c),L(0,g,N,1,u,.3),L(N+C,g,f-N-C,1,u,.3),L(f+Ct,g,z-f-Ct,1,u,.3),L(z+C,g,e-z-C,1,u,.3),L(f,0,Ct,E,c),L(f,E+j,Ct,g-E-j,c),L(f,g+Ct,Ct,O-g-Ct,c),L(f,O+j,Ct,l-O-j,c),L(f,0,1,E,u,.2),L(f,E+j,1,g-E-j,u,.2),L(f,g+Ct,1,O-g-Ct,u,.2),L(f,O+j,1,l-O-j,u,.2),L(f,E,Ct,j,"#C4A070"),L(f+Ct/2,E,Ct/2,j,"#3A4858"),L(f,O,Ct,j,"#7AA880"),L(f+Ct/2,O,Ct/2,j,"#C8B890");const I="#4A3828";L(f,E-1,Ct,1,I),L(f,E+j,Ct,1,I),L(N-1,g,1,Ct,I),L(N+C,g,1,Ct,I),L(z-1,g,1,Ct,I),L(z+C,g,1,Ct,I),L(f,O-1,Ct,1,I),L(f,O+j,Ct,1,I)}const X0=new Map;function WE(e){const l=`${e.hairStyle??""}|${e.outfitStyle??""}|${e.accessory??""}`;let r=X0.get(l);if(!r){const i=nh("mini-seated:default"),c=fg(i,e);r=c?c.layers.flatMap(u=>u.pixels):[],X0.set(l,r)}return r}function QE(e,l,r){lh(Xt,WE(r),e,l,r)}function ZE(e,l,r,i,c){Ma(e+8,l+20,"up"),c||QE(e+8,l+0+i,r),BE(e,l+14)}function JE(e,l,r,i,c){const u=i in B0?i:"down",d=c%4,m=B0[u][d];lh(Xt,m,e,l,r);const x=d===1||d===3?-1:0;if(r.accessory&&r.accessory!=="none"){const f=Oj(r.accessory,u);f&&f.pixels.length>0&&lh(Xt,f.pixels,e,l+x,r)}Xt.globalAlpha=1}function PE(e){const l={};let r=0;for(const i of e){const c=en[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 Xs(e,l,r,i,c){const u=Ue.corridorY[c]??l,d=[];return l<u-4&&d.push({x:e,y:u}),Math.abs(e-r)>4&&d.push({x:r,y:u}),d.push({x:r,y:i}),d}function If(e,l,r,i){const c=Ue.adjacency[r];if(!c)return[];const u=c.find(g=>g.room===i);if(!u)return[];const d=Ue.doors[u.door];if(!d)return[];const m=[],x=Ue.corridorY[r]??l,f=Ue.corridorY[i]??l;if(Math.abs(l-x)>4&&m.push({x:e,y:x}),d.type==="v"){const g=u.side==="A"?d.xA:d.xB,y=u.side==="A"?d.xB:d.xA;m.push({x:g,y:x}),m.push({x:g,y:d.doorY}),m.push({x:y,y:d.doorY}),m.push({x:y,y:f})}else{const g=u.side==="A"?d.yA:d.yB,y=u.side==="A"?d.yB:d.yA;m.push({x:d.doorX,y:x}),m.push({x:d.doorX,y:g}),m.push({x:d.doorX,y}),m.push({x:d.doorX,y:f})}return m}function $g(e,l){const r=Ue.adjacency[e.room];if(!r)return[];if(!r.find(c=>c.room===l)){for(const c of r){const u=Ue.adjacency[c.room];if(u!=null&&u.find(d=>d.room===l)){const d=If(e.x,e.y,e.room,c.room),m=d[d.length-1],x=If((m==null?void 0:m.x)??e.x,(m==null?void 0:m.y)??e.y,c.room,l);return[...d,...x]}}return[]}return If(e.x,e.y,e.room,l)}function eN(e){if(e.room!==e.homeRoom){const l=$g({...e},e.homeRoom),r=l[l.length-1],i=Xs((r==null?void 0:r.x)??e.x,(r==null?void 0:r.y)??e.y,e.homeX,e.homeY,e.homeRoom);return[...l,...i]}return Xs(e.x,e.y,e.homeX,e.homeY,e.room)}function tN(e,l){for(const[,r]of Object.entries(e))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(Ue.rooms);if(Math.random()<.25&&i.length>1){const c=i.filter(x=>x!==r.room),u=c[Math.floor(Math.random()*c.length)],d=$g(r,u),m=Ue.waypoints[u];if(m&&m.length>0){const x=m[Math.floor(Math.random()*m.length)],f=d[d.length-1]??{x:r.x,y:r.y},g=Xs(f.x,f.y,x.x,x.y,u);r.path=[...d,...g]}else r.path=d;r.walkTimer=0}else{const c=Ue.waypoints[r.room];if(c&&c.length>0){const u=c[Math.floor(Math.random()*c.length)];r.path=Xs(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,d=Math.sqrt(c*c+u*u);if(d<1.5){r.x=i.x,r.y=i.y,r.path.shift();for(const[m,x]of Object.entries(Ue.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/d*.2,r.y+=u/d*.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=Ue.waypoints[r.room];if(i&&i.length>0){const c=i[Math.floor(Math.random()*i.length)];r.path=Xs(r.x,r.y,c.x,c.y,r.room)}r.walkTimer=0}else r.state="returning",r.path=eN(r),r.walkTimer=0}function nN(e,l,r){const{canvasW:i,canvasH:c,rooms:u}=Ue;Xt.clearRect(0,0,i,c),L(0,0,i,c,"#2A1E14");const d={wood:Hf,dark:q0,carpet:VE,tile:GE};for(const y of Object.values(u))(d[y.floorType]??Hf)(y);const m=Object.keys(u);if(m.length>=4){const y=u.exec,b=u.meet,{doors:v}=Ue;if(y&&b&&v.exec_meet&&v.work_comm){const j=(v.exec_meet.doorX??0)-14,C=(v.work_comm.doorX??0)-28/2,E=y.fy+y.fh,N=b.fy;Hf({fx:j,fy:E,fw:28,fh:N-E}),q0({fx:C,fy:E,fw:28,fh:N-E})}}const x={};if(m.length>=4){const{doors:y}=Ue,b=28,v=y.exec_meet,S=y.work_comm;v!=null&&v.doorX&&(x.meet={x:v.doorX-b/2,w:b}),S!=null&&S.doorX&&(x.comm={x:S.doorX-b/2,w:b})}for(const y of Object.values(u))qE(y,x[y.id]),XE(y);KE(),$E(Ue);const f=[],g=new Set(Object.values(en).map(y=>y.room));LE(Ue,f,g);for(const[y,b]of Object.entries(en)){const v=e[y];if(!v)continue;const S=v.state==="sitting",j=l(y),C=r[y]==="working";f.push({y:b.dy+14,draw:()=>{if(ZE(b.dx,b.dy,j,S?v.bobY:0,!S),S&&C){const E=Yc[y]??"#388bfd";L(b.dx+7,b.dy+14-4,12,5,E,.15),ot(b.dx+12,b.dy+14+1,"#4CAF50",.8)}}})}for(const[y,b]of Object.entries(e))if(b.state!=="sitting"){const v=l(y);f.push({y:b.y+14,draw:()=>JE(Math.round(b.x),Math.round(b.y),v,b.dir,b.walkFrame)})}f.sort((y,b)=>y.y-b.y);for(const y of f)y.draw();for(const y of Dl){const b=Ra===y.id,v=Bg(y);if(Xt.save(),Xt.globalAlpha=b?.9:.5,Xt.fillStyle=y.color,Xt.fillRect(v.cx-1,v.botY-2,3,3),b){const S=Og(y);Xt.globalAlpha=.3,Xt.strokeStyle=y.color,Xt.lineWidth=1,Xt.strokeRect(S.x-1,S.y-1,S.w+2,S.h+2)}Xt.restore()}if(pr){const y=new Set(Object.values(en).map(b=>b.room));if(Tl&&Tl!==sl)if(Tl.startsWith("desk:")){const b=Tl.slice(5),v=en[b];v&&U0(Xt,v.dx,v.dy,"#FBBF24")}else I0(Xt,Ue,Tl,"#FBBF24",y);if(sl)if(sl.startsWith("desk:")){const b=sl.slice(5),v=en[b];v&&U0(Xt,v.dx,v.dy,"#3B82F6")}else I0(Xt,Ue,sl,"#3B82F6",y)}if(_a){const y=en[_a],b=e[_a];y&&b&&(Xt.save(),Xt.globalAlpha=.25,Xt.fillStyle=Yc[_a]??"#fff",b.state==="sitting"?Xt.fillRect(y.dx-1,y.dy+6,28,30):Xt.fillRect(Math.round(b.x)-1,Math.round(b.y)-1,14,24),Xt.restore())}}function lN({roles:e,projects:l,roleStatuses:r,activeExecs:i,onRoleClick:c,onProjectClick:u,onBulletinClick:d,onDecisionsClick:m,onKnowledgeClick:x,onSettingsClick:f,onThemeClick:g,onStatsClick:y,getRoleSpeech:b,getAppearance:v,onHireClick:S,roleLevels:j}){const C=k.useRef(null),E=k.useRef(null),N=k.useRef(null),z=k.useRef({}),O=k.useRef(0),I=k.useRef(UE),[_,q]=k.useState(!1),[W,Y]=k.useState(null),[T,$]=k.useState(null),B=k.useRef({}),G=k.useRef({}),ne=k.useRef([]),V=k.useRef([]);k.useEffect(()=>{pr=_},[_]),k.useEffect(()=>{ji=W,Yl=T},[W,T]),k.useEffect(()=>{Ce.getPreferences().then(he=>{const ye=he.furnitureOverrides;ye&&Object.keys(ye).length>0&&(B.current=ye,Ue=$0(Ue,ye));const ge=he.deskOverrides;if(ge&&Object.keys(ge).length>0){G.current=ge,L0(en,ge);for(const[ze,Te]of Object.entries(en)){const Ne=z.current[ze];Ne&&(Ne.homeX=Te.dx+8,Ne.homeY=Te.dy+34)}}const Le=he.removedFurniture;Le&&Le.length>0&&(ne.current=Le,Ue=$f(Ue,Le));const Ee=he.addedFurniture;Ee&&Ee.length>0&&(V.current=Ee,Ue=H0(Ue,Ee)),Dl=ra(Ue)}).catch(()=>{})},[]);const U=k.useRef({roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v});U.current={roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v};const Z=k.useMemo(()=>e.map(he=>he.id),[e]),ie=k.useRef(Ue);k.useEffect(()=>{const he=Z.length,ye=zg(he,ie.current.preset);let ge=Mg(he,ye);ne.current.length>0&&(ge=$f(ge,ne.current)),V.current.length>0&&(ge=H0(ge,V.current)),Object.keys(B.current).length>0&&(ge=$0(ge,B.current)),Ue=ge,ie.current=ge,en=YE(Z),Object.keys(G.current).length>0&&L0(en,G.current),Dl=ra(ge),z.current=PE(Z);const Le=C.current;Le&&(Le.width=ge.canvasW,Le.height=ge.canvasH),R()},[Z]);const je=k.useCallback(he=>{var ye,ge;return((ge=(ye=U.current).getAppearance)==null?void 0:ge.call(ye,he))??Bh(he)},[]),R=k.useCallback(()=>{const he=E.current,ye=C.current;if(!he||!ye)return;const ge=he.parentElement;if(!ge)return;const Le=ge.clientWidth,Ee=ge.clientHeight;if(Le===0||Ee===0)return;const{canvasW:ze,canvasH:Te}=Ue;let Ne=Math.floor(Math.min(Le/ze,Ee/Te));Ne=Math.max(2,Math.min(Ne,5)),I.current=Ne,ye.style.width=ze*Ne+"px",ye.style.height=Te*Ne+"px",he.style.width=ze*Ne+"px",he.style.height=Te*Ne+"px"},[]);k.useEffect(()=>{var Te;const he=C.current;if(!he)return;const ye=he.getContext("2d");if(!ye)return;Xt=ye,jE(ye),R();const ge=new ResizeObserver(()=>R()),Le=(Te=E.current)==null?void 0:Te.parentElement;Le&&ge.observe(Le);let Ee;const ze=()=>{O.current++,tN(z.current,O.current),nN(z.current,je,U.current.roleStatuses),M(),Ee=requestAnimationFrame(ze)};return Ee=requestAnimationFrame(ze),()=>{cancelAnimationFrame(Ee),ge.disconnect()}},[je,R]),k.useEffect(()=>{var Le;const he=N.current;if(!he)return;he.innerHTML="";const ye={};for(const Ee of e)ye[Ee.id]=Ee.name;for(const Ee of Z){const ze=Yc[Ee]??"#8b949e",Te=ye[Ee],Ne=Te&&Te.toLowerCase()!==Ee.toLowerCase()?`${Ee.toUpperCase()} · ${Te}`:Ee.toUpperCase(),Ie=document.createElement("div");Ie.className="td-nametag",Ie.dataset.role=Ee;const Ge=document.createElement("span");Ge.className="td-dot",Ge.style.background=ze,Ie.appendChild(Ge),Ie.appendChild(document.createTextNode(Ne));const Dt=((Le=j==null?void 0:j[Ee])==null?void 0:Le.level)??1;if(Dt>1){const Ot=document.createElement("span");Ot.className="td-lvl",Ot.textContent=`Lv.${Dt}`,Ie.appendChild(Ot)}he.appendChild(Ie);const ct=document.createElement("div");ct.className="td-bubble",ct.dataset.role=Ee,ct.dataset.type="bubble",he.appendChild(ct)}const ge={meeting:()=>{const Ee=l[0];Ee?u(Ee.id):d()},bulletin:d,decisions:m,knowledge:x,settings:f,theme:g,stats:y};for(const Ee of Dl){const ze=document.createElement("div");ze.className="td-facility-label",ze.dataset.facility=Ee.id,ze.textContent=`${Ee.icon} ${Ee.label}`,ze.style.borderColor=`${Ee.color}44`;const Te=ge[Ee.id];Te&&ze.addEventListener("click",Te),ze.addEventListener("mouseenter",()=>{Ra=Ee.id}),ze.addEventListener("mouseleave",()=>{Ra=null}),he.appendChild(ze)}},[Z,e,l,u,d,m,x,f,g,y,j]);const M=k.useCallback(()=>{var Te;const he=N.current;if(!he)return;const ye=I.current,ge=z.current,{getRoleSpeech:Le,roleStatuses:Ee,activeExecs:ze}=U.current;for(const Ne of Object.keys(ge)){const Ie=ge[Ne],Ge=en[Ne];if(!Ge)continue;let Dt,ct,Ot;Ie.state==="sitting"?(Dt=Ge.dx+13,Ot=Ge.dy+2,ct=Ge.dy+37):(Dt=Math.round(Ie.x)+6,Ot=Math.round(Ie.y)-2,ct=Math.round(Ie.y)+18);const se=Dt/Ue.canvasW*100,be=he.querySelector(`.td-nametag[data-role="${Ne}"]`);if(be){be.style.left=se+"%",be.style.top=ct*ye+2+"px";const _e=be.querySelector(".td-dot");if(_e){const xe=Ee[Ne]==="working";_e.style.background=xe?"#FBBF24":Yc[Ne]??"#8b949e",xe?_e.style.animation="td-pulse 1s ease-in-out infinite":_e.style.animation=""}}const Re=he.querySelector(`.td-bubble[data-role="${Ne}"]`);if(Re){const _e=Ee[Ne]==="working",xe=(Te=ze.find(Pe=>Pe.roleId===Ne))==null?void 0:Te.task,De=Le(Ne),vt=_e&&xe?xe.slice(0,60):De?De.slice(0,60):"";vt&&Ie.state==="sitting"?(Re.style.display="",Re.style.left=se+"%",Re.style.top=(Ot-10)*ye+"px",Re.textContent=vt):Re.style.display="none"}}for(const Ne of Dl){const Ie=he.querySelector(`.td-facility-label[data-facility="${Ne.id}"]`);if(Ie){const Ge=Bg(Ne);Ie.style.left=Ge.cx/Ue.canvasW*100+"%",Ie.style.top=Ge.botY*ye-4+"px",Ie.classList.toggle("td-facility-label--hover",Ra===Ne.id)}}},[]),K=k.useCallback(he=>{const ye=C.current;if(!ye)return null;const ge=ye.getBoundingClientRect(),Le=I.current,Ee=(he.clientX-ge.left)/Le,ze=(he.clientY-ge.top)/Le,Te=z.current;for(const[Ne,Ie]of Object.entries(en)){if(!Te[Ne])continue;const Ge=Te[Ne];if(Ge.state==="sitting"){if(Ee>=Ie.dx&&Ee<=Ie.dx+26&&ze>=Ie.dy&&ze<=Ie.dy+40)return{type:"role",id:Ne}}else if(Ee>=Ge.x-2&&Ee<=Ge.x+14&&ze>=Ge.y-2&&ze<=Ge.y+20)return{type:"role",id:Ne}}for(const Ne of Dl){const Ie=Og(Ne);if(Ee>=Ie.x&&Ee<=Ie.x+Ie.w&&ze>=Ie.y&&ze<=Ie.y+Ie.h)return{type:"facility",id:Ne.id}}return null},[]),D=k.useCallback(he=>{const ye=C.current;if(!ye)return{mx:0,my:0};const ge=ye.getBoundingClientRect(),Le=I.current;return{mx:(he.clientX-ge.left)/Le,my:(he.clientY-ge.top)/Le}},[]),de=k.useCallback(he=>{Ce.updatePreferences(he).catch(()=>{})},[]),Se=k.useCallback(he=>{const ye=[...ne.current,he];ne.current=ye,Ue=$f(Ue,[he]),Dl=ra(Ue),sl=null,Tl=null,de({removedFurniture:ye})},[de]),ve=k.useCallback((he,ye)=>{if(!ji||!Yl)return;let ge=null;for(const[Ie,Ge]of Object.entries(Ue.rooms)){const Dt=Yl==="wall"?Ge.wx:Ge.fx,ct=Yl==="wall"?Ge.wy:Ge.fy,Ot=Yl==="wall"?Ge.ww:Ge.fw,se=Yl==="wall"?Ge.wh:Ge.fh;if(he>=Dt&&he<=Dt+Ot&&ye>=ct&&ye<=ct+se){ge=Ie;break}}if(!ge)return;const Le=Ue.rooms[ge],Ee=Yl==="wall"?Le.wx:Le.fx,ze=Yl==="wall"?Le.wy:Le.fy,Te={id:`user-${ji}-${Date.now()}`,type:ji,room:ge,zone:Yl,offsetX:Math.round(he-Ee),offsetY:Math.round(ye-ze)},Ne=[...V.current,Te];V.current=Ne,Yl==="wall"?Ue.wallDecorations.push(Te):Ue.furniture.push(Te),Dl=ra(Ue),de({addedFurniture:Ne}),Y(null),$(null)},[de]),Fe=k.useCallback(he=>{const ye=C.current;if(pr&&An){const{mx:Le,my:Ee}=D(he),Te=[...Ue.furniture,...Ue.wallDecorations].find(Ge=>Ge.id===An.defId);if(!Te)return;const Ne=Le-An.startMx,Ie=Ee-An.startMy;Te.offsetX=Math.round(An.origOffX+Ne),Te.offsetY=Math.round(An.origOffY+Ie),Dl=ra(Ue),ye&&(ye.style.cursor="grabbing");return}if(pr&&mn){const{mx:Le,my:Ee}=D(he),ze=en[mn.roleId];if(!ze)return;ze.dx=Math.round(mn.origDx+(Le-mn.startMx)),ze.dy=Math.round(mn.origDy+(Ee-mn.startMy));const Te=z.current[mn.roleId];Te&&(Te.homeX=ze.dx+8,Te.homeY=ze.dy+34),ye&&(ye.style.cursor="grabbing");return}if(pr){const{mx:Le,my:Ee}=D(he);if(ji){ye&&(ye.style.cursor="crosshair");return}const ze=new Set(Object.values(en).map(Ne=>Ne.room)),Te=Lf(Ue,Le,Ee,ze);if(Te)Tl=Te;else{const Ne=Y0(en,Le,Ee);Tl=Ne?`desk:${Ne}`:null}_a=null,Ra=null,ye&&(ye.style.cursor=Tl?"grab":"default");return}const ge=K(he);_a=(ge==null?void 0:ge.type)==="role"?ge.id:null,Ra=(ge==null?void 0:ge.type)==="facility"?ge.id:null,Tl=null,ye&&(ye.style.cursor=ge?"pointer":"default")},[K,D]),Me=k.useCallback(he=>{if(!pr)return;const{mx:ye,my:ge}=D(he);if(ji){ve(ye,ge),he.preventDefault();return}const Le=new Set(Object.values(en).map(Te=>Te.room)),Ee=Lf(Ue,ye,ge,Le);if(Ee){const Ne=[...Ue.furniture,...Ue.wallDecorations].find(Ie=>Ie.id===Ee);Ne&&(sl=Ee,An={defId:Ee,startMx:ye,startMy:ge,origOffX:Ne.offsetX,origOffY:Ne.offsetY},he.preventDefault());return}const ze=Y0(en,ye,ge);if(ze){const Te=en[ze];sl=`desk:${ze}`,mn={roleId:ze,startMx:ye,startMy:ge,origDx:Te.dx,origDy:Te.dy},he.preventDefault();return}sl=null},[D,ve]),$e=k.useCallback(he=>{if(An){const ge=[...Ue.furniture,...Ue.wallDecorations].find(Le=>Le.id===An.defId);if(ge){const Le={...B.current,[ge.id]:{offsetX:ge.offsetX,offsetY:ge.offsetY}};B.current=Le,de({furnitureOverrides:Le}),Dl=ra(Ue)}An=null,C.current&&(C.current.style.cursor="grab");return}if(mn){const ye=en[mn.roleId];if(ye){const ge={...G.current,[mn.roleId]:{dx:ye.dx,dy:ye.dy}};G.current=ge,de({deskOverrides:ge})}mn=null,C.current&&(C.current.style.cursor="grab")}},[de]),fe=k.useCallback(he=>{if(!pr)return;he.preventDefault();const{mx:ye,my:ge}=D(he),Le=new Set(Object.values(en).map(ze=>ze.room)),Ee=Lf(Ue,ye,ge,Le);Ee&&Se(Ee)},[D,Se]);k.useEffect(()=>{const he=ye=>{!pr||!sl||(ye.key==="Delete"||ye.key==="Backspace")&&(sl.startsWith("desk:")||Se(sl))};return window.addEventListener("keydown",he),()=>window.removeEventListener("keydown",he)},[Se]);const tt=k.useCallback(()=>{if(An){const ye=[...Ue.furniture,...Ue.wallDecorations].find(ge=>ge.id===An.defId);ye&&(ye.offsetX=An.origOffX,ye.offsetY=An.origOffY,Dl=ra(Ue)),An=null}if(mn){const he=en[mn.roleId];he&&(he.dx=mn.origDx,he.dy=mn.origDy);const ye=z.current[mn.roleId];ye&&(ye.homeX=he.dx+8,ye.homeY=he.dy+34),mn=null}_a=null,Ra=null,Tl=null,C.current&&(C.current.style.cursor="default")},[]),mt=k.useCallback(he=>{if(pr)return;const ye=K(he);if(ye){if(ye.type==="role"){c(ye.id);return}switch(ye.id){case"meeting":{const ge=l[0];ge?u(ge.id):d();break}case"bulletin":d();break;case"decisions":m();break;case"knowledge":x();break;case"settings":f==null||f();break;case"theme":g==null||g();break;case"stats":y==null||y();break}}},[K,c,u,d,m,x,f,g,y]);return s.jsxs("div",{className:`td-scene${_?" td-scene--editing":""}`,children:[s.jsxs("div",{ref:E,className:"td-wrap",children:[s.jsx("canvas",{ref:C,width:Ue.canvasW,height:Ue.canvasH,className:"td-canvas",onClick:mt,onMouseDown:Me,onMouseUp:$e,onMouseMove:Fe,onMouseLeave:tt,onContextMenu:fe}),s.jsx("div",{ref:N,className:"td-overlay"})]}),_&&s.jsxs("div",{className:"td-edit-banner",children:[s.jsx("span",{className:"td-edit-banner__icon",children:"✎"})," EDIT MODE — Click DONE when finished"]}),s.jsxs("button",{className:`td-edit-btn${_?" td-edit-btn--active":""}`,onClick:()=>{q(he=>{const ye=!he;return ye||(Y(null),$(null)),ye}),sl=null,An=null,mn=null},title:_?"Exit Edit Mode":"Edit Furniture Layout",children:[s.jsx("span",{className:"td-edit-btn__icon",children:_?"✓":"✎"}),s.jsx("span",{className:"td-edit-btn__label",children:_?"DONE":"EDIT"})]}),_&&s.jsx("div",{className:"td-palette",children:IE.map(he=>s.jsx("button",{className:`td-palette__item${W===he.type?" td-palette__item--active":""}`,onClick:()=>{W===he.type?(Y(null),$(null)):(Y(he.type),$(he.zone))},title:he.label,children:s.jsx("span",{children:he.icon})},he.type))}),S&&s.jsxs("button",{className:"td-hire-btn",onClick:S,title:"Hire New Role",children:[s.jsx("span",{className:"td-hire-btn__icon",children:"+"}),s.jsx("span",{className:"td-hire-btn__label",children:"HIRE"})]})]})}function rN({role:e,appearance:l,onSave:r,onReset:i,onClose:c,theme:u,onThemeChange:d,onUpdateName:m,initialTab:x,characterOnly:f,speechSettings:g,onSpeechSettingsChange:y,language:b,onLanguageChange:v,roleLevel:S}){var $;const[j,C]=k.useState(x??"character"),[E,N]=k.useState({...l}),[z,O]=k.useState(e.name),[I,_]=k.useState(!1),q=k.useCallback(()=>N(Ci(S)),[S]),W=k.useCallback(()=>{const B=Bh(e.id);N({...B}),i()},[e.id,i]),Y=k.useCallback(async()=>{r(E);const B=z.trim();if(m&&B&&B!==e.name){_(!0);try{await m(e.id,B)}catch{}_(!1)}c()},[E,r,c,z,e.name,e.id,m]),T=s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsxs("span",{children:[e.id.toUpperCase()," –"]}),m?s.jsx("input",{value:z,onChange:B=>O(B.target.value),disabled:I,className:"customize-name-input",style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:4,color:"inherit",font:"inherit",padding:"2px 6px",flex:1,minWidth:0}}):s.jsx("span",{children:e.name})]});return s.jsx("div",{className:"customize-overlay",onClick:c,children:s.jsxs("div",{className:"customize-modal",onClick:B=>B.stopPropagation(),children:[s.jsxs("div",{className:"customize-header",children:[s.jsxs("div",{className:"customize-tabs",children:[s.jsx("button",{className:`customize-tab ${j==="character"?"active":""}`,onClick:()=>C("character"),children:"CHARACTER"}),!f&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:`customize-tab ${j==="office"?"active":""}`,onClick:()=>C("office"),children:"OFFICE THEME"}),s.jsx("button",{className:`customize-tab ${j==="settings"?"active":""}`,onClick:()=>C("settings"),children:"SETTINGS"})]})]}),s.jsx("button",{className:"customize-close",onClick:c,children:"X"})]}),j==="character"?s.jsx("div",{className:"customize-body",children:s.jsx(Cg,{roleId:e.id,appearance:E,onChange:N,onRandomize:q,onReset:W,label:T,roleLevel:S})}):j==="office"?s.jsx("div",{className:"customize-body",children:s.jsx("div",{className:"customize-themes",children:Object.entries(oa).map(([B,G])=>s.jsxs("button",{className:`customize-theme-card ${u===B?"active":""}`,onClick:()=>d(B),children:[s.jsxs("div",{className:"customize-theme-preview",style:{background:G.vars["--floor-light"],borderColor:G.vars["--pixel-border"]},children:[s.jsx("div",{style:{background:G.vars["--hud-bg"],height:8,borderBottom:`2px solid ${G.vars["--pixel-border"]}`}}),s.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1 p-1",children:[s.jsx("div",{style:{width:10,height:14,background:G.vars["--accent"],borderRadius:1}}),s.jsx("div",{style:{width:10,height:14,background:G.vars["--active-green"],borderRadius:1}}),s.jsx("div",{style:{width:10,height:14,background:G.vars["--idle-amber"],borderRadius:1}})]}),s.jsx("div",{style:{background:G.vars["--hud-bg"],height:6,borderTop:`2px solid ${G.vars["--pixel-border"]}`}})]}),s.jsxs("div",{className:"customize-theme-name",children:[G.icon," ",G.name]})]},B))})}):s.jsx("div",{className:"customize-body",children:s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,padding:"8px 0"},children:[s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),s.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(B=>s.jsxs("button",{onClick:()=>y==null?void 0:y({mode:B}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(g==null?void 0:g.mode)===B?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(g==null?void 0:g.mode)===B?"rgba(255,255,255,0.08)":"transparent",color:(g==null?void 0:g.mode)===B?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[s.jsx("div",{style:{fontWeight:600,marginBottom:2},children:B==="template"?"TEMPLATE":B==="llm"?"AI":"AUTO"}),s.jsx("div",{style:{fontSize:9,opacity:.7},children:B==="template"?"Static pool ($0)":B==="llm"?"LLM generated":"Detect engine"})]},B))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(g==null?void 0:g.intervalSec)??18,"s"]}),s.jsx("input",{type:"range",min:5,max:120,step:5,value:(g==null?void 0:g.intervalSec)??18,onChange:B=>y==null?void 0:y({intervalSec:Number(B.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"5s (frequent)"}),s.jsx("span",{children:"120s (rare)"})]})]}),(g==null?void 0:g.mode)!=="template"&&s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",(($=g==null?void 0:g.dailyBudgetUsd)==null?void 0:$.toFixed(2))??"1.00"]}),s.jsx("input",{type:"range",min:0,max:5,step:.25,value:(g==null?void 0:g.dailyBudgetUsd)??1,onChange:B=>y==null?void 0:y({dailyBudgetUsd:Number(B.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"$0 (unlimited)"}),s.jsx("span",{children:"$5.00/day"})]})]}),s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),s.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:B,label:G})=>s.jsx("button",{onClick:()=>v==null?void 0:v(B),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(b??"auto")===B?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(b??"auto")===B?"rgba(255,255,255,0.08)":"transparent",color:(b??"auto")===B?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:G},B))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]})]})}),j==="character"&&s.jsxs("div",{className:"customize-footer",children:[s.jsx("button",{className:"customize-btn customize-btn--cancel",onClick:c,children:"CANCEL"}),s.jsx("button",{className:"customize-btn customize-btn--save",onClick:Y,children:"SAVE"})]})]})})}function V0(e){if(e.length===0)return"";const l={};for(const{file:m}of e){const x=m.split("/"),f=x[0]==="."?x[1]??"root":x[0];(l[f]??(l[f]=[])).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 f=r[m]??m;if(x.length===1){const g=x[0].split("/").pop()??x[0];i.push(`${f}/${g}`)}else i.push(`${f} (${x.length} files)`)}const c=e.some(m=>m.status==="A"),u=e.some(m=>m.status==="M");return`${c&&!u?"add":"update"}: ${i.join(", ")}`}function G0(e){const l=Date.now()-new Date(e).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 aN({status:e,history:l,onClose:r,onSave:i,onLoadHistory:c,onRestore:u,saving:d,onDelegate:m,delegateRoleName:x}){const[f,g]=k.useState("save"),[y,b]=k.useState(""),[v,S]=k.useState(null),[j,C]=k.useState(!1),[E,N]=k.useState(null),z=k.useRef(null);k.useEffect(()=>{f==="history"&&c()},[f,c]),k.useEffect(()=>{var T;(T=z.current)==null||T.focus()},[]);const O=[...((e==null?void 0:e.modified)??[]).map(T=>({status:"M",file:T})),...((e==null?void 0:e.untracked)??[]).map(T=>({status:"A",file:T}))],I=k.useRef(!1);k.useEffect(()=>{!I.current&&O.length>0&&!y&&(b(V0(O)),I.current=!0)},[O.length]);const _=k.useCallback(()=>{b(V0(O))},[O]),q=async()=>{S(null),N(null);try{const T=await i(y||void 0);N(T),b("")}catch(T){S(T instanceof Error?T.message:"Save failed")}},W=async T=>{if(confirm(`Restore from commit ${T.slice(0,7)}? This creates a new commit with those files.`)){C(!0);try{await u(T),C(!1)}catch($){S($ instanceof Error?$.message:"Restore failed"),C(!1)}}};k.useEffect(()=>{const T=$=>{$.key==="Escape"&&r()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[r]);const Y=T=>{T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&q()};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[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:Y,children:[s.jsxs("div",{className:"px-5 py-3 flex items-center justify-between shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-lg font-black tracking-tight",children:"SAVE GAME"}),s.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:(e==null?void 0:e.branch)??""})]}),s.jsx("button",{onClick:r,className:"text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] cursor-pointer text-lg",children:"×"})]}),s.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["save","history"].map(T=>s.jsx("button",{onClick:()=>g(T),className:"flex-1 py-2 text-[11px] font-bold uppercase tracking-wider cursor-pointer",style:{background:f===T?"var(--hud-bg-alt)":"transparent",color:f===T?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:f===T?"2px solid var(--accent)":"2px solid transparent"},children:T==="save"?"SAVE":"HISTORY"},T))}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[f==="save"&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-[11px]",style:{color:"var(--terminal-text-secondary)"},children:O.length>0?s.jsxs("span",{style:{color:"var(--idle-amber)"},children:["* ",O.length," unsaved change",O.length>1?"s":""]}):s.jsx("span",{style:{color:"var(--active-green)"},children:"All changes saved"})}),O.length>0&&s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Changed Files"}),s.jsx("div",{className:"text-[11px] max-h-[160px] overflow-y-auto p-2 space-y-0.5",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)"},children:O.map(({status:T,file:$})=>s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{style:{color:T==="A"?"var(--active-green)":"var(--idle-amber)",width:"14px"},children:T}),s.jsx("span",{style:{color:"var(--terminal-text-secondary)"},children:$})]},$))})]}),O.length>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Save Message"}),s.jsxs("button",{onClick:_,className:"text-[9px] px-1.5 py-0.5 cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--accent)",fontFamily:"var(--pixel-font)"},title:"Auto-generate message from changes",children:["✨"," AUTO"]})]}),s.jsx("input",{ref:z,type:"text",value:y,onChange:T=>b(T.target.value),placeholder:"Auto-generated — edit if needed",className:"w-full px-3 py-2 text-[12px] outline-none",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"}})]}),O.length>0&&s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:q,disabled:d,className:"flex-1 py-2.5 text-[12px] font-black uppercase tracking-wider cursor-pointer disabled:opacity-50",style:{background:"var(--accent)",color:"#fff",border:"2px solid var(--accent)"},children:d?"SAVING...":e!=null&&e.hasRemote?"SAVE & PUSH":"SAVE"}),m&&s.jsxs("button",{onClick:()=>{const T=O.map($=>`${$.status} ${$.file}`).join(`
|
|
89
|
-
`);m(T)},disabled:d,className:"py-2.5 px-4 text-[11px] font-bold uppercase tracking-wider cursor-pointer disabled:opacity-50",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"2px solid var(--pixel-border)"},title:`Delegate to ${x??"AI role"} — they'll review, commit, push & merge`,children:["🤖"," ",(x==null?void 0:x.toUpperCase())??"DELEGATE"]})]}),O.length>0&&e&&!e.hasRemote&&s.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"Local save only — add a git remote to enable push"}),E&&s.jsxs("div",{className:"text-[11px] p-2",style:{background:"rgba(59,185,80,0.1)",border:"1px solid var(--active-green)",color:"var(--active-green)"},children:["Saved! ",E.filesChanged," file",E.filesChanged>1?"s":""," committed",E.pushed?" & pushed":"",E.pushError?` (push error: ${E.pushError})`:""]}),v&&s.jsx("div",{className:"text-[11px] p-2",style:{background:"rgba(211,47,47,0.1)",border:"1px solid #D32F2F",color:"#EF5350"},children:v}),(e==null?void 0:e.lastCommit)&&s.jsxs("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:["Last save: ",e.lastCommit.message," (",G0(e.lastCommit.date),")"]})]}),f==="history"&&s.jsxs(s.Fragment,{children:[l.length===0&&s.jsx("div",{className:"text-[11px] text-center py-8",style:{color:"var(--terminal-text-muted)"},children:"No save history"}),s.jsx("div",{className:"space-y-1",children:l.map(T=>s.jsxs("div",{className:"flex items-center justify-between py-2 px-3 group",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--accent)"},children:T.shortSha}),s.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--terminal-text)"},children:T.message})]}),s.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:G0(T.date)})]}),s.jsx("button",{onClick:()=>W(T.sha),disabled:j,className:"text-[10px] font-bold px-2 py-1 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--idle-amber)"},children:"LOAD"})]},T.sha))})]})]})]})]})}function iN({onClose:e}){const[l,r]=k.useState(null),[i,c]=k.useState(!0),[u,d]=k.useState(null);return k.useEffect(()=>{Ce.getCompanyStats().then(r).catch(m=>d(m.message)).finally(()=>c(!1))},[]),i?s.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading stats..."}):u||!l?s.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u||"Failed to load stats",s.jsx("button",{onClick:e,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]}):s.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:20},children:[s.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Company Stats"}),s.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]}),s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:20},children:[s.jsx(Ec,{label:"Roles",value:String(l.company.roleCount)}),s.jsx(Ec,{label:"Avg Level",value:`Lv.${l.company.avgLevel}`}),s.jsx(Ec,{label:"Total Tokens",value:l.company.formattedTokens}),s.jsx(Ec,{label:"Total Cost",value:`$${l.company.totalCostUsd.toFixed(2)}`})]}),s.jsx("h4",{style:{margin:"0 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Role Leaderboard"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[l.roles.map((m,x)=>s.jsx(sN,{role:m,rank:x+1},m.roleId)),l.roles.length===0&&s.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"8px 0"},children:"No role activity yet. Assign tasks to start leveling up!"})]}),Object.keys(l.byModel).length>0&&s.jsxs(s.Fragment,{children:[s.jsx("h4",{style:{margin:"20px 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Model Usage"}),s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:Object.entries(l.byModel).map(([m,x])=>s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"6px 10px",background:"rgba(255,255,255,0.03)",borderRadius:6,fontSize:12},children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.7)"},children:oN(m)}),s.jsxs("span",{style:{color:"rgba(255,255,255,0.5)"},children:["$",x.costUsd.toFixed(2)]})]},m))})]})]})}function Ec({label:e,value:l}){return s.jsxs("div",{style:{padding:"12px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[s.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.45)",marginBottom:4},children:e}),s.jsx("div",{style:{fontSize:18,fontWeight:600},children:l})]})}function sN({role:e,rank:l}){const r=["🥇","🥈","🥉"],i=l<=3?r[l-1]:`#${l}`;return s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:8},children:[s.jsx("span",{style:{fontSize:14,width:28,textAlign:"center",flexShrink:0},children:i}),s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:4},children:[s.jsx("span",{style:{fontSize:13,fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),s.jsxs("span",{style:{fontSize:12,color:K0(e.level),fontWeight:600,flexShrink:0,marginLeft:8},children:["Lv.",e.level]})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsx("div",{style:{flex:1,height:4,background:"rgba(255,255,255,0.08)",borderRadius:2,overflow:"hidden"},children:s.jsx("div",{style:{width:`${e.progress*100}%`,height:"100%",background:K0(e.level),borderRadius:2,transition:"width 0.3s ease"}})}),s.jsx("span",{style:{fontSize:10,color:"rgba(255,255,255,0.4)",flexShrink:0},children:e.formattedTokens})]})]})]})}function K0(e){return e>=9?"#FFD700":e>=7?"#C0A0FF":e>=5?"#4FC3F7":e>=3?"#81C784":"rgba(255,255,255,0.4)"}function oN(e){return e.includes("opus")?"Opus":e.includes("sonnet")?"Sonnet":e.includes("haiku")?"Haiku":e.split("-").slice(0,2).join(" ")}function cN({onClose:e,onSyncComplete:l}){const[r,i]=k.useState([]),[c,u]=k.useState([]),[d,m]=k.useState(!0),[x,f]=k.useState(null),[g,y]=k.useState(new Set),[b,v]=k.useState(null),[S,j]=k.useState(null),C=k.useCallback(async()=>{m(!0),v(null);try{const{roles:N}=await Ce.getSyncRoles();i(N);const z=N.filter(O=>O.source.sync!=="off");if(z.length===0){u([]),j(null);return}try{const O=await bl.syncCheck(z.map(_=>({roleId:_.roleId,sourceId:_.source.id,currentVersion:_.source.upstream_version??_.source.forked_at??"0.0.0"})));j(!0);const I=[];for(const _ of O.updates){if(!_.hasUpdate)continue;const q=z.find(B=>B.roleId===_.roleId);if(!q)continue;const{character:W}=await bl.syncPull(_.sourceId),Y=[];q.persona.trim()!==W.persona.trim()&&Y.push({field:"persona",local:q.persona.slice(0,120)+(q.persona.length>120?"...":""),upstream:W.persona.slice(0,120)+(W.persona.length>120?"...":"")});const T=JSON.stringify(q.authority),$=JSON.stringify(W.authority);T!==$&&Y.push({field:"authority",local:`${q.authority.autonomous.length} autonomous, ${q.authority.needsApproval.length} approval`,upstream:`${W.authority.autonomous.length} autonomous, ${W.authority.needsApproval.length} approval`}),Y.length>0&&I.push({roleId:_.roleId,roleName:q.name,sourceId:_.sourceId,currentVersion:_.currentVersion,latestVersion:_.latestVersion,fields:Y})}u(I)}catch{j(!1),u([])}}catch(N){v(N instanceof Error?N.message:"Failed to check for updates")}finally{m(!1)}},[]);k.useEffect(()=>{C()},[C]);const E=async N=>{f(N.roleId);try{const{character:z,version:O}=await bl.syncPull(N.sourceId);await Ce.applySyncUpdate({roleId:N.roleId,changes:{persona:z.persona,authority:z.authority},upstreamVersion:O}),y(I=>new Set(I).add(N.roleId)),l==null||l()}catch(z){v(z instanceof Error?z.message:"Failed to apply update")}finally{f(null)}};return s.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[s.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Role Sync"}),s.jsxs("div",{style:{display:"flex",gap:8},children:[s.jsx("button",{onClick:C,disabled:d,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:d?"wait":"pointer"},children:d?"Checking...":"Refresh"}),s.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),S===!1&&s.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,180,0,0.1)",borderRadius:6,color:"#FFB74D",fontSize:12,marginBottom:12},children:"Cloud API unreachable. Sync requires connection to api.tycono.ai."}),b&&s.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:b}),s.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Tracked roles: "}),s.jsx("span",{style:{fontWeight:500},children:r.length}),s.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Updates available: "}),s.jsx("span",{style:{fontWeight:500,color:c.length>0?"#4FC3F7":"rgba(255,255,255,0.7)"},children:c.filter(N=>!g.has(N.roleId)).length}),S===!0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),s.jsx("span",{style:{fontSize:11,color:"#81C784"},children:"Cloud connected"})]})]}),c.length===0&&!d&&s.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:r.length===0?"No roles with source tracking. Hire from the Store to enable sync.":"All roles are up to date!"}),c.map(N=>s.jsxs("div",{style:{marginBottom:12,padding:14,background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:14,fontWeight:500},children:N.roleName}),s.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.4)"},children:[N.sourceId," · v",N.currentVersion," → v",N.latestVersion]})]}),g.has(N.roleId)?s.jsx("span",{style:{fontSize:12,color:"#81C784"},children:"Applied ✓"}):s.jsx("button",{onClick:()=>E(N),disabled:x===N.roleId,style:{background:"#1565C0",border:"none",color:"white",borderRadius:6,padding:"5px 12px",fontSize:12,cursor:x===N.roleId?"wait":"pointer",opacity:x===N.roleId?.6:1},children:x===N.roleId?"Applying...":"Apply Update"})]}),N.fields.map(z=>s.jsxs("div",{style:{marginBottom:6,fontSize:12},children:[s.jsx("div",{style:{color:"rgba(255,255,255,0.5)",marginBottom:2,textTransform:"uppercase",fontSize:10,letterSpacing:.5},children:z.field}),s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},children:[s.jsxs("div",{style:{padding:"4px 8px",background:"rgba(255,100,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[s.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"LOCAL"}),s.jsx("br",{}),z.local]}),s.jsxs("div",{style:{padding:"4px 8px",background:"rgba(100,255,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[s.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"UPSTREAM"}),s.jsx("br",{}),z.upstream]})]})]},z.field))]},N.roleId)),r.length>0&&s.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Roles hired from the Store are tracked automatically. Set ",s.jsx("code",{style:{background:"rgba(255,255,255,0.06)",padding:"1px 4px",borderRadius:3},children:"sync: off"})," in role.yaml to stop tracking."]})]})}function uN({onClose:e}){const[l,r]=k.useState(null),[i,c]=k.useState(!0),[u,d]=k.useState(null),[m,x]=k.useState(null),f=k.useCallback(async()=>{c(!0),d(null);try{const N=await Ce.getGitStatus();r(N)}catch(N){d(N instanceof Error?N.message:"Failed to load git status")}finally{c(!1)}},[]);k.useEffect(()=>{f()},[f]);const g=async N=>{x(N.path);try{await Ce.deleteWorktree(N.path),await f()}catch(z){d(z instanceof Error?z.message:"Failed to remove worktree")}finally{x(null)}},y=async N=>{x(N);try{await Ce.deleteBranch(N),await f()}catch(z){d(z instanceof Error?z.message:"Failed to delete branch")}finally{x(null)}};if(i&&!l)return s.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading git status..."});if(u&&!l)return s.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u,s.jsx("button",{onClick:e,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]});if(!l)return null;const b=l.worktrees.filter(N=>N.status==="active"),v=l.worktrees.filter(N=>N.status==="pending-merge"),S=l.worktrees.filter(N=>N.status==="stale");function j(N){const z=N.split("/");if(z.length>1){const O=z[z.length-1],I=["cto","cbo","pm","engineer","designer","qa","data-analyst"];for(const _ of I)if(O.toLowerCase().includes(_))return _}return null}function C(N,z=40){return N.length<=z?N:"..."+N.slice(N.length-z+3)}function E(N){const z=Date.now()-new Date(N).getTime(),O=Math.floor(z/6e4);if(O<1)return"just now";if(O<60)return`${O}m ago`;const I=Math.floor(O/60);return I<24?`${I}h ago`:`${Math.floor(I/24)}d ago`}return s.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[s.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"GIT STATUS"}),s.jsxs("div",{style:{display:"flex",gap:8},children:[s.jsx("button",{onClick:f,disabled:i,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:i?"wait":"pointer"},children:i?"Checking...":"Refresh"}),s.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),u&&s.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:u}),s.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s.jsxs("div",{children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Branch: "}),s.jsx("span",{style:{fontWeight:500},children:l.currentBranch})]}),s.jsx("div",{children:l.unsavedCount>0&&s.jsxs("span",{style:{color:"#FFB74D",fontSize:12},children:[l.unsavedCount," unsaved"]})})]}),l.lastCommit&&s.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&&s.jsxs(s.Fragment,{children:[s.jsx(Nc,{label:"Active Worktrees",count:b.length}),b.map(N=>s.jsx(Uf,{wt:N,roleFromBranch:N.roleId||j(N.branch),truncatePath:C,timeAgo:E,removing:m===N.path,onRemove:()=>g(N),statusColor:"#4FC3F7",statusIcon:"📂"},N.path))]}),v.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(Nc,{label:"Pending Merge",count:v.length}),v.map(N=>s.jsx(Uf,{wt:N,roleFromBranch:N.roleId||j(N.branch),truncatePath:C,timeAgo:E,removing:m===N.path,onRemove:()=>g(N),statusColor:"#FFB74D",statusIcon:"⚠️"},N.path))]}),S.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(Nc,{label:"Stale",count:S.length}),S.map(N=>s.jsx(Uf,{wt:N,roleFromBranch:N.roleId||j(N.branch),truncatePath:C,timeAgo:E,removing:m===N.path,onRemove:()=>g(N),statusColor:"#ff6b6b",statusIcon:"🔴"},N.path))]}),l.staleBranches.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(Nc,{label:"Unmerged Branches",count:l.staleBranches.length}),l.staleBranches.map(N=>s.jsxs("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s.jsxs("div",{style:{fontSize:13},children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.5)",marginRight:6},children:"⚠️"}),s.jsx("span",{style:{fontWeight:500},children:N})]}),s.jsx("button",{onClick:()=>y(N),disabled:m===N,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:"#ff6b6b",borderRadius:4,padding:"3px 8px",fontSize:10,cursor:m===N?"wait":"pointer",opacity:m===N?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5},children:m===N?"...":"DELETE"})]},N))]}),b.length===0&&v.length===0&&S.length===0&&l.staleBranches.length===0&&s.jsxs("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:["✓"," All clean. No active worktrees or stale branches."]}),l.lastMerge&&s.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Last merge: ",s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:l.lastMerge.branch})," · ",l.lastMerge.roleId," · ",E(l.lastMerge.mergedAt)]})]})}function Nc({label:e,count:l}){return s.jsxs("h4",{style:{margin:"16px 0 8px",fontSize:11,fontWeight:600,color:"rgba(255,255,255,0.5)",textTransform:"uppercase",letterSpacing:1},children:[e," (",l,")"]})}function Uf({wt:e,roleFromBranch:l,truncatePath:r,timeAgo:i,removing:c,onRemove:u,statusColor:d,statusIcon:m}){return s.jsx("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsxs("div",{style:{fontSize:13,fontWeight:500,marginBottom:2},children:[s.jsx("span",{style:{marginRight:6},children:m}),e.branch,l&&s.jsx("span",{style:{marginLeft:8,fontSize:10,padding:"1px 6px",background:"rgba(255,255,255,0.08)",borderRadius:3,color:"rgba(255,255,255,0.6)",textTransform:"uppercase"},children:l})]}),e.task&&s.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.5)",marginBottom:2},children:['"',e.task.slice(0,50),e.task.length>50?"...":"",'"']}),s.jsxs("div",{style:{fontSize:10,color:"rgba(255,255,255,0.35)"},children:[r(e.path)," · ",e.filesChanged," file",e.filesChanged!==1?"s":""," changed"," · ",i(e.createdAt)]}),e.conflictFiles&&e.conflictFiles.length>0&&s.jsxs("div",{style:{fontSize:10,color:"#ff6b6b",marginTop:4},children:["⛔"," CONFLICT: ",e.conflictFiles.join(", ")]})]}),s.jsx("button",{onClick:u,disabled:c,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:d,borderRadius:4,padding:"3px 8px",fontSize:10,cursor:c?"wait":"pointer",opacity:c?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5,flexShrink:0,marginLeft:8},children:c?"...":"REMOVE"})]})})}function dN({onClose:e,speechSettings:l,onSpeechSettingsChange:r,language:i,onLanguageChange:c,onOpenSync:u,onOpenGitStatus:d,onOpenStats:m}){var N;const[x,f]=k.useState(null),[g,y]=k.useState(!1),[b,v]=k.useState(!1),[S,j]=k.useState(!1);k.useEffect(()=>{Ce.getPreferences().then(z=>f(z.instanceId??null)).catch(()=>{})},[]);const C=async()=>{j(!0);try{const O=await(await fetch("/api/preferences/regenerate-token",{method:"POST"})).json();O.ok&&(f(O.newInstanceId),v(!1))}catch{}j(!1)},E=()=>{x&&navigator.clipboard.writeText(x).then(()=>{y(!0),setTimeout(()=>y(!1),2e3)})};return s.jsx("div",{className:"customize-overlay",onClick:e,children:s.jsxs("div",{className:"customize-modal",onClick:z=>z.stopPropagation(),style:{maxWidth:480},children:[s.jsxs("div",{className:"customize-header",children:[s.jsx("div",{style:{fontSize:12,fontWeight:700,letterSpacing:1,color:"var(--terminal-text)"},children:"SETTINGS"}),s.jsx("button",{className:"customize-close",onClick:e,children:"X"})]}),s.jsx("div",{className:"customize-body",style:{padding:"12px 20px 20px"},children:s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),s.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(z=>s.jsxs("button",{onClick:()=>r==null?void 0:r({mode:z}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(l==null?void 0:l.mode)===z?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(l==null?void 0:l.mode)===z?"rgba(255,255,255,0.08)":"transparent",color:(l==null?void 0:l.mode)===z?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[s.jsx("div",{style:{fontWeight:600,marginBottom:2},children:z==="template"?"TEMPLATE":z==="llm"?"AI":"AUTO"}),s.jsx("div",{style:{fontSize:9,opacity:.7},children:z==="template"?"Static pool ($0)":z==="llm"?"LLM generated":"Detect engine"})]},z))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(l==null?void 0:l.intervalSec)??18,"s"]}),s.jsx("input",{type:"range",min:5,max:120,step:5,value:(l==null?void 0:l.intervalSec)??18,onChange:z=>r==null?void 0:r({intervalSec:Number(z.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"5s (frequent)"}),s.jsx("span",{children:"120s (rare)"})]})]}),(l==null?void 0:l.mode)!=="template"&&s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((N=l==null?void 0:l.dailyBudgetUsd)==null?void 0:N.toFixed(2))??"1.00"]}),s.jsx("input",{type:"range",min:0,max:5,step:.25,value:(l==null?void 0:l.dailyBudgetUsd)??1,onChange:z=>r==null?void 0:r({dailyBudgetUsd:Number(z.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"$0 (unlimited)"}),s.jsx("span",{children:"$5.00/day"})]})]}),s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),s.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:z,label:O})=>s.jsx("button",{onClick:()=>c==null?void 0:c(z),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(i??"auto")===z?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(i??"auto")===z?"rgba(255,255,255,0.08)":"transparent",color:(i??"auto")===z?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:O},z))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]}),x&&s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"STORE TOKEN"}),s.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[s.jsx("code",{style:{flex:1,padding:"8px 10px",fontSize:10,background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:6,color:"var(--terminal-text-muted)",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x}),s.jsx("button",{onClick:E,style:{padding:"8px 12px",fontSize:10,fontWeight:600,border:"2px solid rgba(255,255,255,0.1)",background:"transparent",color:g?"#4ade80":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",whiteSpace:"nowrap"},children:g?"Copied!":"Copy"})]}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Use this token to sign in on the web Store. Keep it secret — anyone with this token can act as you."}),s.jsx("div",{style:{marginTop:6},children:b?s.jsxs("div",{style:{background:"rgba(255,50,50,0.08)",border:"1px solid rgba(255,50,50,0.2)",borderRadius:6,padding:"8px 10px"},children:[s.jsx("div",{style:{fontSize:9,color:"rgba(255,100,100,0.8)",marginBottom:6},children:"This will invalidate your current token. Published characters will lose ownership. No migration."}),s.jsxs("div",{style:{display:"flex",gap:6},children:[s.jsx("button",{onClick:C,disabled:S,style:{padding:"4px 12px",fontSize:9,fontWeight:700,border:"1px solid rgba(255,50,50,0.4)",background:"rgba(255,50,50,0.15)",color:"#ff6464",borderRadius:4,cursor:"pointer"},children:S?"...":"Confirm Regenerate"}),s.jsx("button",{onClick:()=>v(!1),style:{padding:"4px 12px",fontSize:9,border:"none",background:"transparent",color:"var(--terminal-text-muted)",cursor:"pointer"},children:"Cancel"})]})]}):s.jsx("button",{onClick:()=>v(!0),style:{padding:"4px 10px",fontSize:9,fontWeight:600,border:"1px solid rgba(255,100,100,0.2)",background:"transparent",color:"rgba(255,100,100,0.6)",borderRadius:4,cursor:"pointer"},children:"Regenerate Token"})})]}),s.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.08)",paddingTop:16,display:"flex",gap:8},children:[u&&s.jsx("button",{onClick:()=>{e(),u()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"🔄 ROLE SYNC"}),d&&s.jsx("button",{onClick:()=>{e(),d()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📂 GIT STATUS"}),m&&s.jsx("button",{onClick:()=>{e(),m()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📊 COMPANY STATS"})]})]})})]})})}function fN({theme:e,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]),s.jsx("div",{ref:i,className:"theme-dropup",children:Object.entries(oa).map(([c,u])=>s.jsxs("button",{className:`theme-dropup__item${e===c?" theme-dropup__item--active":""}`,onClick:()=>{l(c),r()},title:u.name,children:[s.jsxs("span",{className:"theme-dropup__swatch",style:{background:u.vars["--hud-bg"],borderColor:u.vars["--pixel-border"]},children:[s.jsx("span",{style:{background:u.vars["--accent"],width:5,height:5,borderRadius:1}}),s.jsx("span",{style:{background:u.vars["--active-green"],width:5,height:5,borderRadius:1}}),s.jsx("span",{style:{background:u.vars["--idle-amber"],width:5,height:5,borderRadius:1}})]}),s.jsx("span",{className:"theme-dropup__name",children:u.icon})]},c))})}const qc=[0,1e4,5e4,15e4,4e5,1e6,25e5,5e6,1e7,25e6];function Lg(e){let l=1;for(let r=qc.length-1;r>=0;r--)if(e>=qc[r]){l=r+1;break}return Math.min(l,10)}function hN(e){const l=Lg(e);if(l>=10)return 1;const r=qc[l-1],i=qc[l];return Math.min(1,(e-r)/(i-r))}function Yf(e){const l={};for(const[r,i]of Object.entries(e)){const c=i.inputTokens+i.outputTokens;l[r]={level:Lg(c),totalTokens:c,progress:hN(c)}}return l}const mN=[{id:"first-employee",name:"First Employee",icon:"🏆",description:"Hired your first role",check:e=>e.roleCount>=1},{id:"full-team",name:"Full Team",icon:"👥",description:"Hired 5+ roles",check:e=>e.roleCount>=5},{id:"token-10k",name:"Getting Started",icon:"📊",description:"Used 10K tokens total",check:e=>e.totalTokens>=1e4},{id:"token-100k",name:"Power User",icon:"💪",description:"Used 100K tokens total",check:e=>e.totalTokens>=1e5},{id:"token-millionaire",name:"Token Millionaire",icon:"🎖",description:"Used 1M tokens total",check:e=>e.totalTokens>=1e6},{id:"token-mogul",name:"Token Mogul",icon:"💎",description:"Used 10M tokens total",check:e=>e.totalTokens>=1e7},{id:"first-promotion",name:"First Promotion",icon:"⭐",description:"Any role reached Lv.3",check:e=>e.roles.some(l=>l.level>=3)},{id:"senior-staff",name:"Senior Staff",icon:"🌟",description:"Any role reached Lv.5",check:e=>e.roles.some(l=>l.level>=5)},{id:"master-class",name:"Master Class",icon:"👑",description:"Any role reached Lv.10",check:e=>e.roles.some(l=>l.level>=10)},{id:"full-house",name:"Full House",icon:"🏠",description:"All roles Lv.5+",check:e=>e.roleCount>=3&&e.roles.every(l=>l.level>=5)}];function W0(e){return mN.filter(l=>l.check(e))}const xN={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍","data-analyst":"📊"},Fc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},pN={cto:"아키텍처",cbo:"시장 분석",pm:"PRD 작성",engineer:"코딩",designer:"시안 제작",qa:"품질 검증"};function yN(e){let l=0;for(let i=0;i<e.length;i++)l=e.charCodeAt(i)+((l<<5)-l);return`hsl(${(l%360+360)%360}, 50%, 40%)`}function gN({importJob:e,onImportDone:l}){var cl,qa,Dr;const[r,i]=k.useState([]),[c,u]=k.useState([]),[d,m]=k.useState([]),[x,f]=k.useState([]),[g,y]=k.useState([]),[b,v]=k.useState([]),[S,j]=k.useState("TYCONO"),[C,E]=k.useState(!0),[N,z]=k.useState(null),[O,I]=k.useState({type:"none"}),[_,q]=k.useState(null),[W,Y]=k.useState(null),[T,$]=k.useState([]),[B,G]=k.useState(!1),[ne,V]=k.useState([]),[U,Z]=k.useState(0),[ie,je]=k.useState(!1),[R,M]=k.useState({}),[K,D]=k.useState("ceo"),[de,Se]=k.useState(null),[ve,Fe]=k.useState(!1),[Me,$e]=k.useState(!1),[fe,tt]=k.useState({}),mt=k.useRef({}),[he,ye]=k.useState(!1),[ge,Le]=k.useState(null),[Ee,ze]=k.useState({}),[Te,Ne]=k.useState([]),Ie=k.useMemo(()=>{const F={};for(const le of Te)F[le.roleId]=le;return F},[Te]),[Ge,Dt]=k.useState([]),[ct,Ot]=k.useState(void 0),[se,be]=k.useState(!1);k.useEffect(()=>{Ce.getStatus().then(F=>{Ot(F.engine),be(!!F.hasApiKey)}).catch(()=>{})},[]);const{getAppearance:Re,setAppearance:_e,resetAppearance:xe,theme:De,setTheme:vt,speechSettings:Pe,setSpeechSettings:nt,language:At,setLanguage:ut}=QC(),[tn,yn]=k.useState(null),[,Ml]=k.useState("character"),kt=JC(),[Rl,$n]=k.useState(!1),[J,Oe]=k.useState(!1),[rt,pe]=k.useState(!1),[gt,dn]=k.useState(!1),[nn,br]=k.useState(!1),[Ri,Ha]=k.useState(!1),[Gn,Fi]=k.useState(null);k.useEffect(()=>{const F=le=>{(le.metaKey||le.ctrlKey)&&le.key==="s"&&(le.preventDefault(),kt.dirtyCount>0&&$n(!0))};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[kt.dirtyCount]),k.useEffect(()=>{if(!gt)return;let F=!1;const le=async()=>{try{const me=await Ce.getGitStatus();F||Fi(me)}catch{}};le();const ae=setInterval(le,1e4);return()=>{F=!0,clearInterval(ae)}},[gt]);const[Fl,Ia]=k.useState(null),[Ql,zn]=k.useState(null),[Vt,vn]=k.useState([]),[Kn,Ua]=k.useState(!1),lo=k.useRef(!1),_i=k.useRef(null);let Oi=k.useRef(0);const vr=k.useRef(new Set),vl=(F,le,ae)=>{const me={id:Oi.current++,type:F,text:le,detail:ae};vn(we=>[...we,me])};k.useEffect(()=>{var F;Kn&&((F=_i.current)==null||F.scrollIntoView({behavior:"smooth"}))},[Vt,Kn]),k.useEffect(()=>{e&&(lo.current||(lo.current=!0,zn("Scanning knowledge sources..."),vn([{id:0,type:"scan",text:"Starting knowledge import..."}]),Oi.current=1,fetch("/api/setup/import-knowledge",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:e.paths,companyRoot:e.companyRoot})}).then(async F=>{var we;const le=(we=F.body)==null?void 0:we.getReader();if(!le)return;const ae=new TextDecoder;let me="";for(;;){const{done:Je,value:qe}=await le.read();if(Je)break;me+=ae.decode(qe,{stream:!0});const Ae=me.split(`
|
|
86
|
+
VP Marketing, c-level, ceo`,className:"w-full h-40 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors font-mono"}),s.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Format: Name, Level (member/team-lead/c-level), ReportsTo. Level and ReportsTo are optional."})]}),_e.length>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Preview (",_e.length," role",_e.length!==1?"s":"",")"]}),s.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden",children:s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-white/10",children:[s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),s.jsx("tbody",{children:_e.map((Z,Oe)=>s.jsxs("tr",{className:`border-b border-white/5 ${Z.error?"bg-red-900/10":""}`,children:[s.jsx("td",{className:"p-2 text-white/80",children:Z.name}),s.jsx("td",{className:"p-2 text-white/60 font-mono",children:Z.id}),s.jsx("td",{className:"p-2 text-white/60",children:Z.level}),s.jsx("td",{className:"p-2 text-white/60",children:Z.reportsTo}),Z.error&&s.jsx("td",{className:"p-2 text-red-400 text-[10px]",children:Z.error})]},Oe))})]})})]})]}),Te==="review"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Confirm Bulk Hire — ",_e.length," roles"]}),s.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden max-h-[300px] overflow-y-auto",children:s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{className:"sticky top-0 bg-[var(--wall)]",children:s.jsxs("tr",{className:"border-b border-white/10",children:[s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"#"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),s.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),s.jsx("tbody",{children:_e.map((Z,Oe)=>s.jsxs("tr",{className:"border-b border-white/5",children:[s.jsx("td",{className:"p-2 text-white/30",children:Oe+1}),s.jsx("td",{className:"p-2 text-white/80",children:Z.name}),s.jsx("td",{className:"p-2 text-white/60 font-mono",children:Z.id}),s.jsx("td",{className:"p-2 text-white/60",children:Z.level}),s.jsx("td",{className:"p-2 text-white/60",children:Z.reportsTo})]},Oe))})]})}),$e&&Ie.total>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between text-[10px] text-white/40 mb-1",children:[s.jsx("span",{children:"Hiring..."}),s.jsxs("span",{children:[Ie.done,"/",Ie.total]})]}),s.jsx("div",{className:"h-1.5 bg-white/10 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Ie.done/Ie.total*100}%`,background:"#2E7D32"}})})]}),s.jsx("div",{className:"text-[10px] text-white/30",children:"Each role will get a random appearance and auto-generated persona. You can customize them later."}),tt&&s.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:tt})]})]})}),s.jsxs("div",{className:"flex justify-between px-5 pb-5",children:[s.jsxs("div",{children:[i==="single"&&G>1&&s.jsx("button",{onClick:()=>ne(G-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"&&Te==="review"&&s.jsx("button",{onClick:()=>Ne("input"),disabled:$e,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"}),i==="store"&&z==="review"&&s.jsx("button",{onClick:()=>{O("browse"),S(null),mt("")},disabled:$e,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer disabled:opacity-40",children:"Back"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("button",{onClick: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"?G<Bs?s.jsx("button",{onClick:()=>ne(G+1),disabled:!At(G),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:"Next"}):s.jsx("button",{onClick:nt,disabled:$e,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:$e?"Hiring...":"HIRE"}):i==="bulk"?Te==="input"?s.jsxs("button",{onClick:()=>Ne("review"),disabled:!xe,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 (",_e.length,")"]}):s.jsx("button",{onClick:ut,disabled:$e,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:$e?`Hiring ${Ie.done}/${Ie.total}...`:`HIRE ALL (${_e.length})`}):z==="review"?s.jsx("button",{onClick:Ml,disabled:$e||!I.trim()||!q.trim()||e.some(Z=>Z.id===q),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:$e?"Hiring...":"HIRE"}):null]})]})]})]})}function jC({onLogin:e}){const[l,r]=k.useState(""),[i,c]=k.useState(!1),[u,d]=k.useState(""),m=()=>{const x=l.trim();if(x){if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(x)){d("Invalid token format");return}e(x)}};return s.jsxs("div",{className:"rounded-lg border border-white/10 bg-white/[0.03] p-3 space-y-2",children:[s.jsx("div",{className:"text-[11px] text-white/50",children:"Sign in to vote, publish, and manage your characters."}),i?s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{value:l,onChange:x=>{r(x.target.value),d("")},onKeyDown:x=>{x.key==="Enter"&&m()},placeholder:"Paste your token here...",className:"flex-1 px-2 py-1.5 rounded-lg border border-white/10 bg-white/5 text-xs text-white/90 font-mono placeholder-white/20 focus:outline-none focus:border-amber-800/40",autoFocus:!0}),s.jsx("button",{onClick:m,disabled:!l.trim(),className:"px-3 py-1.5 text-[11px] font-semibold rounded-lg cursor-pointer text-green-400 bg-green-900/20 border border-green-800/30 hover:bg-green-900/40 disabled:opacity-30 transition-colors",children:"Sign in"})]}),u&&s.jsx("div",{className:"text-[10px] text-red-400",children:u}),s.jsx("button",{onClick:c.bind(null,!1),className:"text-[10px] text-white/30 hover:text-white/50 cursor-pointer",children:"Cancel"})]}):s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:c.bind(null,!0),className:"px-3 py-1.5 text-[11px] font-semibold rounded-lg cursor-pointer text-amber-400 bg-amber-900/20 border border-amber-800/30 hover:bg-amber-900/40 transition-colors",children:"Paste Token"}),s.jsx("span",{className:"text-[10px] text-white/20 self-center",children:"from Settings → Token"})]})]})}function SC({char:e,isHired:l,onSelect:r,onVote:i,onDelete:c,fetching:u,token:d}){const[m,x]=k.useState(!1),f=d&&e.publisher_id===d,g=!!d;return s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl border border-white/10 bg-white/[0.03] hover:bg-white/[0.06] transition-colors group",children:[s.jsxs("div",{className:"flex flex-col items-center gap-0.5 shrink-0 w-8",children:[s.jsx("button",{onClick:y=>{y.stopPropagation(),i(1)},disabled:!g,className:`text-[14px] leading-none transition-colors ${g?"cursor-pointer":"cursor-not-allowed opacity-30"} ${e.my_vote===1?"text-green-400":"text-white/20 hover:text-green-400/60"}`,title:g?"Upvote":"Sign in to vote",children:"▲"}),s.jsx("span",{className:`text-[11px] font-bold tabular-nums ${(e.vote_score??0)>0?"text-green-400/80":(e.vote_score??0)<0?"text-red-400/80":"text-white/30"}`,children:e.vote_score??0}),s.jsx("button",{onClick:y=>{y.stopPropagation(),i(-1)},disabled:!g,className:`text-[14px] leading-none transition-colors ${g?"cursor-pointer":"cursor-not-allowed opacity-30"} ${e.my_vote===-1?"text-red-400":"text-white/20 hover:text-red-400/60"}`,title:g?"Downvote":"Sign in to vote",children:"▼"})]}),s.jsxs("div",{className:"flex-1 min-w-0 cursor-pointer",onClick:r,children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-semibold text-white/90 truncate",children:e.name}),s.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded font-semibold uppercase ${e.level==="c-level"?"bg-amber-900/30 text-amber-400 border border-amber-800/30":e.level==="team-lead"?"bg-blue-900/30 text-blue-400 border border-blue-800/30":"bg-white/5 text-white/40 border border-white/10"}`,children:e.level}),l&&s.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-green-900/20 text-green-400/60 border border-green-800/20",children:"Hired"})]}),e.tagline&&s.jsx("div",{className:"text-[11px] text-white/40 truncate mt-0.5",children:e.tagline}),s.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[s.jsxs("span",{className:"text-[10px] text-white/25",children:[e.installs??0," installs"]}),s.jsxs("span",{className:"text-[10px] text-white/25",children:["v",e.version]}),s.jsx("span",{className:"text-[10px] text-white/25 font-mono",children:e.id})]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsx("button",{onClick:r,disabled:u,className:"px-3 py-1.5 text-[11px] font-semibold rounded-lg cursor-pointer transition-colors disabled:opacity-40 text-green-400 bg-green-900/20 border border-green-800/30 hover:bg-green-900/40",children:"Hire"}),f&&(m?s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:y=>{y.stopPropagation(),c(),x(!1)},className:"px-2 py-1.5 text-[10px] font-semibold rounded cursor-pointer text-red-400 bg-red-900/30 border border-red-800/40 hover:bg-red-900/50",children:"Confirm"}),s.jsx("button",{onClick:y=>{y.stopPropagation(),x(!1)},className:"px-2 py-1.5 text-[10px] rounded cursor-pointer text-white/40 hover:text-white/60",children:"No"})]}):s.jsx("button",{onClick:y=>{y.stopPropagation(),x(!0)},className:"w-7 h-7 rounded-lg flex items-center justify-center cursor-pointer text-white/15 hover:text-red-400/60 hover:bg-red-900/10 transition-colors opacity-0 group-hover:opacity-100",title:"Delete from store",children:s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2"})})}))]})]})}function $s({label:e,value:l,mono:r}){return s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-white/40",children:e}),s.jsx("span",{className:`font-semibold text-white/80 ${r?"font-mono":""}`,children:l})]})}function CC({roleId:e,roleName:l,onClose:r,onConfirm:i}){const[c,u]=k.useState(!1),d=async()=>{u(!0);try{await i(e)}finally{u(!1)}};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[480px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[s.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[s.jsx("div",{className:"text-lg font-bold",children:"Fire Role"}),s.jsxs("div",{className:"text-sm opacity-80 mt-0.5",children:["Remove ",l," (",e,")"]})]}),s.jsxs("div",{className:"p-5",children:[s.jsxs("div",{className:"p-4 rounded-lg border-2 border-red-300 bg-red-50 mb-4",children:[s.jsx("div",{className:"text-sm font-bold text-red-800 mb-1",children:"Warning"}),s.jsxs("div",{className:"text-xs text-red-700 leading-relaxed",children:["This will permanently delete the role directory including",s.jsx("strong",{children:" role.yaml"}),", ",s.jsx("strong",{children:"profile.md"}),", ",s.jsx("strong",{children:"SKILL.md"}),", and all journal entries. This action cannot be undone."]})]}),s.jsxs("div",{className:"text-sm text-gray-600",children:["Are you sure you want to fire ",s.jsx("strong",{children:l}),"?"]})]}),s.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[s.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"}),s.jsx("button",{onClick:d,disabled:c,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#B71C1C"},children:c?"Removing...":"Confirm Fire"})]})]})]})}const EC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function NC({roleId:e,title:l,roleColor:r,active:i,isWave:c,isWaveStreaming:u,onClick:d,onClose:m,"data-session-id":x}){const f=c?"#F59E0B":r;return s.jsxs("button",{onClick:d,"data-session-id":x,className:`flex items-center gap-1.5 px-3 py-1.5 text-[11px] rounded-t-lg shrink-0 cursor-pointer transition-colors max-w-[180px] group ${i?"bg-[var(--terminal-bg)] text-[var(--terminal-text)]":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] hover:bg-[var(--terminal-surface)]"}`,style:i?{borderTop:`2px solid ${f}`}:void 0,children:[c&&u&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse shrink-0"}),s.jsx("span",{className:"text-xs",children:EC[e]??"👤"}),s.jsx("span",{className:`truncate ${c?"text-amber-400/90":""}`,children:l}),s.jsx("span",{onClick:m,className:"ml-auto text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none",children:"×"})]})}function AC({content:e,streaming:l}){let r=e;return l&&(e.match(/```/g)??[]).length%2!==0&&(r+="\n```"),s.jsx("div",{className:"terminal-markdown",children:s.jsx(Eh,{remarkPlugins:[Th],components:{code:DC,table:({children:i})=>s.jsx("div",{className:"overflow-x-auto my-2",children:s.jsx("table",{className:"terminal-table",children:i})})},children:r})})}function DC({className:e,children:l,...r}){const i=/language-(\w+)/.exec(e??"");return i||typeof l=="string"&&l.includes(`
|
|
87
|
+
`)?s.jsx(TC,{language:i==null?void 0:i[1],children:l}):s.jsx("code",{className:"terminal-inline-code",...r,children:l})}function TC({children:e,language:l}){const[r,i]=k.useState(!1),c=String(e).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(c),i(!0),setTimeout(()=>i(!1),1500)};return s.jsxs("div",{className:"terminal-code-block group relative my-2",children:[l&&s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] px-3 pt-1.5",children:l}),s.jsx("button",{onClick:u,className:"absolute top-1.5 right-2 text-[10px] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:r?"Copied!":"Copy"}),s.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:s.jsx("code",{children:c})})]})}const zC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function MC({attachments:e}){const[l,r]=k.useState(null);return e.length===0?null:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:e.map((i,c)=>s.jsxs("button",{onClick:()=>r(c),className:"relative w-20 h-20 rounded-lg overflow-hidden border border-[var(--terminal-border)] bg-[var(--terminal-inline-bg)] cursor-pointer hover:border-[var(--terminal-border-hover)] transition-colors",children:[s.jsx("img",{src:`data:${i.mediaType};base64,${i.data}`,alt:i.name,className:"w-full h-full object-cover"}),s.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-[8px] text-white truncate px-1 py-0.5",children:i.name})]},c))}),l!==null&&s.jsx("div",{className:"fixed inset-0 z-[100] bg-black/80 flex items-center justify-center",onClick:()=>r(null),children:s.jsxs("div",{className:"relative max-w-[90vw] max-h-[90vh]",children:[s.jsx("img",{src:`data:${e[l].mediaType};base64,${e[l].data}`,alt:e[l].name,className:"max-w-full max-h-[90vh] object-contain rounded-lg"}),s.jsx("button",{onClick:()=>r(null),className:"absolute top-2 right-2 w-8 h-8 rounded-full bg-black/70 text-white flex items-center justify-center cursor-pointer hover:bg-black/90",children:"x"}),s.jsx("div",{className:"absolute bottom-2 left-1/2 -translate-x-1/2 bg-black/70 text-white text-sm px-3 py-1 rounded",children:e[l].name})]})})]})}function Mf(e,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 RC(e){const l=[];let r="";for(const i of e)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:Mf(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=Mf(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?Mf(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 FC({event:e,isStreaming:l}){var c,u,d;const[r,i]=k.useState(!1);switch(e.type){case"thinking":return s.jsxs("div",{className:"stream-event-thinking",children:[s.jsxs("div",{className:"stream-event-thinking-header",onClick:()=>i(!r),children:[s.jsx("span",{className:"stream-event-thinking-icon"}),s.jsxs("span",{className:"stream-event-thinking-label",children:["thinking",l?"...":""]}),e.text&&!l&&s.jsx("span",{className:"stream-event-thinking-toggle",children:r?"▾":"▸"})]}),(l||r)&&e.text&&s.jsx("div",{className:"stream-event-thinking-content",children:e.text.slice(-500)})]});case"tool":return s.jsxs("div",{className:"stream-event-tool",children:[s.jsx("span",{className:"stream-event-tool-badge",children:e.toolName}),e.toolSummary&&s.jsx("span",{className:"stream-event-tool-path",children:e.toolSummary}),e.toolInput&&s.jsx("span",{className:"stream-event-tool-toggle",onClick:()=>i(!r),children:r?"▾":"▸"}),r&&e.toolInput&&s.jsx("div",{className:"stream-event-tool-detail",children:JSON.stringify(e.toolInput,null,1).slice(0,300)})]});case"dispatch":return s.jsxs("div",{className:"stream-event-dispatch",children:[s.jsxs("span",{className:"stream-event-dispatch-badge",children:["→"," ",(c=e.roleId)==null?void 0:c.toUpperCase()]}),s.jsx("span",{className:"stream-event-dispatch-task",children:(u=e.task)==null?void 0:u.slice(0,80)})]});case"dispatch:progress":return s.jsxs("div",{className:"stream-event-dispatch-progress",children:[s.jsx("span",{className:"stream-event-dispatch-progress-role",children:(d=e.roleId)==null?void 0:d.toUpperCase()}),e.progressType==="thinking"&&s.jsxs("span",{className:"stream-event-dispatch-progress-status",children:["thinking",l?"...":""]}),e.progressType==="tool"&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"stream-event-tool-badge",children:e.toolName}),e.toolSummary&&s.jsx("span",{className:"stream-event-tool-path",children:e.toolSummary})]}),e.progressType==="text"&&e.text&&s.jsx("span",{className:"stream-event-dispatch-progress-status",children:"responding..."}),e.progressType==="done"&&s.jsx("span",{className:"stream-event-dispatch-progress-done",children:"done"}),e.progressType==="error"&&s.jsx("span",{className:"stream-event-dispatch-progress-error",children:"error"})]});default:return null}}function _C({events:e,isStreaming:l}){const[r,i]=k.useState(!1);if(e.length===0)return null;const c=RC(e);if(c.length===0)return null;const u=e.filter(b=>b.type==="thinking").length,d=e.filter(b=>b.type==="tool"),m=e.filter(b=>b.type==="dispatch"||b.type==="dispatch:progress"),x=e.filter(b=>b.type==="turn").reduce((b,v)=>Math.max(b,v.turn??0),0),f=[];if(u>0&&f.push("thinking"),d.length>0){const b=[...new Set(d.map(v=>v.toolName))];b.length<=3?f.push(b.join(", ")):f.push(`${d.length} tool calls`)}m.length>0&&f.push(`${m.length} dispatch`),x>1&&f.push(`${x} turns`);const g=f.join(" · "),y=!r;return s.jsxs("div",{className:"stream-activity-log",children:[s.jsxs("div",{className:"stream-activity-header",onClick:()=>i(!r),children:[l&&s.jsx("span",{className:"stream-activity-pulse"}),s.jsxs("span",{className:"stream-activity-summary",children:[r?"▸":"▾"," ",g,l?"...":""]})]}),y&&s.jsx("div",{className:"stream-activity-events",children:c.map((b,v)=>s.jsx(FC,{event:b,isStreaming:l&&v===c.length-1},v))})]})}function OC({message:e,roleId:l,roleColor:r}){var f;const i=e.from==="ceo",c=e.type==="system",u=e.status==="streaming";if(c)return s.jsx("div",{className:"flex justify-center my-2",children:s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] bg-[var(--terminal-inline-bg)] px-3 py-1 rounded-full",children:e.content})});if(i)return s.jsx("div",{className:"flex justify-end mb-3",children:s.jsxs("div",{className:"max-w-[85%]",children:[s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] text-right mb-1",children:"CEO"}),e.attachments&&e.attachments.length>0&&s.jsx("div",{className:"flex justify-end mb-1",children:s.jsx(MC,{attachments:e.attachments})}),s.jsxs("div",{className:"bg-[var(--terminal-surface-light)] rounded-xl rounded-tr-sm px-4 py-2.5 text-sm text-[var(--terminal-text)] leading-relaxed",children:[e.type==="directive"&&s.jsx("span",{className:"text-amber-400 text-[10px] font-bold mr-1.5",children:"DO"}),e.content]})]})});const d=(((f=e.streamEvents)==null?void 0:f.length)??0)>0,m=!!e.thinking,x=m&&!e.content&&u&&!d;return s.jsxs("div",{className:"flex gap-2.5 mb-3",children:[s.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center text-sm shrink-0 mt-5",style:{background:`${r}33`},children:zC[l]??"👤"}),s.jsxs("div",{className:"max-w-[85%] min-w-0",children:[s.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] mb-1",children:l.toUpperCase()}),d&&s.jsx(_C,{events:e.streamEvents,isStreaming:u}),m&&!d&&s.jsxs("details",{open:x,className:"mb-1",children:[s.jsxs("summary",{className:"text-[10px] text-purple-400/70 cursor-pointer select-none flex items-center gap-1",children:[x&&s.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-purple-400 animate-pulse"}),"thinking",x?"...":` (${e.thinking.length} chars)`]}),s.jsx("div",{className:"text-[11px] text-[var(--terminal-text-muted)] leading-relaxed mt-1 pl-2 border-l border-purple-400/20 max-h-32 overflow-y-auto",children:e.thinking.slice(-500)})]}),s.jsxs("div",{className:"rounded-xl rounded-tl-sm px-4 py-2.5 text-sm text-[var(--terminal-text)] leading-relaxed",style:{borderLeft:`3px solid ${r}`,background:"var(--terminal-surface)"},children:[e.content?s.jsx(AC,{content:e.content,streaming:u}):u&&!m?s.jsx("span",{className:"inline-block w-2 h-4 bg-[var(--terminal-text-secondary)] animate-pulse"}):u&&m?s.jsx("span",{className:"text-[11px] text-purple-400/50 italic",children:"analyzing..."}):null,u&&e.content&&s.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-[var(--terminal-text-secondary)] animate-pulse ml-0.5 align-middle"})]}),e.status==="error"&&s.jsx("div",{className:"text-[10px] text-red-400 mt-1",children:"Error occurred"})]})]})}function BC({messages:e,roleId:l,roleColor:r}){var c;const i=k.useRef(null);return k.useEffect(()=>{var u;(u=i.current)==null||u.scrollIntoView({behavior:"smooth"})},[e,(c=e[e.length-1])==null?void 0:c.content]),e.length===0?s.jsxs("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:["Start a conversation with ",l.toUpperCase()]}):s.jsxs("div",{className:"flex-1 overflow-y-auto p-4 terminal-scrollbar",children:[e.map(u=>s.jsx(OC,{message:u,roleId:l,roleColor:r},u.id)),s.jsx("div",{ref:i})]})}const $C=5*1024*1024,LC=["image/png","image/jpeg","image/gif","image/webp"];function HC({mode:e,onModeChange:l,onSend:r,disabled:i,disabledReason:c}){const[u,d]=k.useState(""),[m,x]=k.useState([]),[f,g]=k.useState(!1),[y,b]=k.useState(null),v=k.useRef(null),S=k.useRef(null);k.useEffect(()=>{const Y=v.current;Y&&(Y.style.height="0",Y.style.height=Math.min(Y.scrollHeight,120)+"px")},[u]),k.useEffect(()=>{if(y){const Y=setTimeout(()=>b(null),3e3);return()=>clearTimeout(Y)}},[y]);const j=k.useCallback(async Y=>LC.includes(Y.type)?Y.size>$C?(b(`File too large: ${(Y.size/1024/1024).toFixed(1)}MB. Max 5MB.`),null):new Promise(T=>{const $=new FileReader;$.onload=()=>{const G=$.result.split(",")[1];T({type:"image",data:G,name:Y.name,mediaType:Y.type})},$.onerror=()=>{b("Failed to read file"),T(null)},$.readAsDataURL(Y)}):(b(`Unsupported format: ${Y.type}. Use PNG, JPG, GIF, or WebP.`),null),[]),C=k.useCallback(async Y=>{const T=Array.from(Y),$=[];for(const B of T){const G=await j(B);G&&$.push(G)}$.length>0&&x(B=>[...B,...$])},[j]),E=k.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),g(!0)},[]),N=k.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),g(!1)},[]),z=k.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),g(!1);const T=Y.dataTransfer.files;T.length>0&&C(T)},[C]),O=k.useCallback(Y=>{const T=Y.clipboardData.items,$=[];for(let B=0;B<T.length;B++){const G=T[B];if(G.type.startsWith("image/")){const ne=G.getAsFile();ne&&$.push(ne)}}$.length>0&&(Y.preventDefault(),C($))},[C]),I=k.useCallback(Y=>{const T=Y.target.files;T&&T.length>0&&C(T),Y.target.value=""},[C]),_=k.useCallback(Y=>{x(T=>T.filter(($,B)=>B!==Y))},[]),q=()=>{const Y=u.trim();!Y&&m.length===0||i||(r(Y,m.length>0?m:void 0),d(""),x([]))},W=Y=>{Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),q())};return s.jsxs("div",{className:`border-t border-[var(--terminal-border)] p-3 shrink-0 transition-colors ${f?"bg-[var(--terminal-surface-light)] border-amber-500/50":""}`,onDragOver:E,onDragLeave:N,onDrop:z,children:[y&&s.jsx("div",{className:"text-[10px] text-red-400 mb-2 text-center",children:y}),c&&s.jsx("div",{className:"text-[10px] text-amber-400/70 mb-2 text-center",children:c}),m.length>0&&s.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:m.map((Y,T)=>s.jsxs("div",{className:"relative group w-16 h-16 rounded-lg overflow-hidden border border-[var(--terminal-border)] bg-[var(--terminal-inline-bg)]",children:[s.jsx("img",{src:`data:${Y.mediaType};base64,${Y.data}`,alt:Y.name,className:"w-full h-full object-cover"}),s.jsx("button",{onClick:()=>_(T),className:"absolute top-0.5 right-0.5 w-4 h-4 rounded-full bg-black/70 text-white text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:"x"}),s.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 text-[8px] text-white truncate px-1 py-0.5",children:Y.name})]},T))}),f&&s.jsx("div",{className:"text-[11px] text-amber-400 text-center mb-2",children:"Drop image here"}),s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsxs("div",{className:"flex rounded-lg overflow-hidden border border-[var(--terminal-border)] shrink-0",children:[s.jsx("button",{onClick:()=>l("talk"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${e==="talk"?"bg-[var(--desk-wood)] text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Talk"}),s.jsx("button",{onClick:()=>l("do"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${e==="do"?"bg-amber-700 text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Do"})]}),s.jsx("button",{onClick:()=>{var Y;return(Y=S.current)==null?void 0:Y.click()},disabled:i,className:"w-8 h-8 rounded-lg bg-[var(--terminal-inline-bg)] border border-[var(--terminal-border)] text-[var(--terminal-text-muted)] flex items-center justify-center shrink-0 cursor-pointer hover:bg-[var(--terminal-surface-light)] hover:text-[var(--terminal-text-secondary)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:"Attach image (PNG, JPG, GIF, WebP)",children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})}),s.jsx("input",{ref:S,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,onChange:I,className:"hidden"}),s.jsx("textarea",{ref:v,value:u,onChange:Y=>d(Y.target.value),onKeyDown:W,onPaste:O,placeholder:i?"Waiting...":e==="talk"?"Ask something...":"Give a directive...",disabled:i,rows:1,className:"flex-1 bg-[var(--terminal-inline-bg)] border border-[var(--terminal-border)] rounded-lg px-3 py-2 text-sm text-[var(--terminal-text)] placeholder:text-[var(--terminal-text-muted)] resize-none focus:outline-none focus:border-[var(--terminal-border-hover)] disabled:opacity-40 terminal-scrollbar"}),s.jsx("button",{onClick:q,disabled:i||!u.trim()&&m.length===0,className:"w-8 h-8 rounded-lg bg-[var(--terminal-surface-light)] text-[var(--terminal-text-secondary)] flex items-center justify-center shrink-0 cursor-pointer hover:bg-[var(--desk-wood)] hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M22 2L11 13"}),s.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})]})}const IC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},Eg={cto:"CTO",cbo:"CBO",pm:"PM",engineer:"Engineer",designer:"Designer",qa:"QA","data-analyst":"Data Analyst"};function z0(e){return new Date(e).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit"})}function UC({msg:e}){const l=IC[e.roleId]??"#888",r=Eg[e.roleId]??e.roleId;if(e.type==="dispatch"){const i=e.text.includes("WAVE"),c=e.text.includes("completed")||e.text.includes("완료"),u=i?"📡":c?"✓":"→",d=c?"text-green-400/70":"text-[var(--terminal-text-muted)]";return s.jsxs("div",{className:"flex items-start gap-2 px-3 py-1 hover:bg-white/[0.02]",children:[s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:z0(e.ts)}),s.jsx("span",{className:"text-[10px] shrink-0 mt-0.5",children:u}),s.jsx("span",{className:`text-[11px] ${d}`,children:e.text})]})}return s.jsxs("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-white/[0.02]",children:[s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:z0(e.ts)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("span",{className:"text-[11px] font-semibold mr-1.5",style:{color:l},children:r}),s.jsx("span",{className:"text-xs text-[var(--terminal-text-secondary)]",children:e.text})]})]})}function YC({channel:e,allRoles:l,onUpdateMembers:r,onUpdateTopic:i}){const c=k.useRef(null),u=k.useRef(null);k.useEffect(()=>{var S;const b=u.current;if(!b)return;b.scrollHeight-b.scrollTop-b.clientHeight<80&&((S=c.current)==null||S.scrollIntoView({behavior:"smooth"}))},[e.messages.length]);const[d,m]=k.useState(!1),[x,f]=k.useState(!1),[g,y]=k.useState("");return s.jsxs("div",{ref:u,className:"flex-1 overflow-y-auto terminal-scrollbar py-2",children:[s.jsxs("div",{className:"px-3 py-2 mb-2 border-b border-[var(--terminal-border)] flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-semibold text-[var(--terminal-text)]",children:e.name}),e.members.length>0&&s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:e.members.map(b=>Eg[b]??b).join(", ")}),e.members.length===0&&s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:e.isDefault?"system logs":"no members"}),!e.isDefault&&l&&r&&s.jsx("button",{className:"ml-auto text-[10px] px-2 py-0.5 rounded bg-white/5 hover:bg-white/10 text-[var(--terminal-text-muted)]",onClick:()=>m(!d),children:d?"Done":"Invite"})]}),!e.isDefault&&i&&s.jsx("div",{className:"px-3 pb-2 mb-1",children:x?s.jsx("input",{autoFocus:!0,value:g,onChange:b=>y(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(i(e.id,g.trim()),f(!1)),b.key==="Escape"&&f(!1)},onBlur:()=>{i(e.id,g.trim()),f(!1)},placeholder:"Set a topic for this channel...",className:"w-full bg-transparent text-[10px] text-[var(--terminal-text-muted)] outline-none border-b border-[var(--terminal-border)] pb-0.5"}):s.jsx("button",{onClick:()=>{y(e.topic??""),f(!0)},className:"text-[10px] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] cursor-pointer italic",children:e.topic||"Click to set channel topic..."})}),d&&!e.isDefault&&l&&r&&s.jsx("div",{className:"px-3 pb-2 mb-2 border-b border-[var(--terminal-border)]",children:s.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(b=>{const v=e.members.includes(b.id);return s.jsxs("button",{className:`text-[10px] px-2 py-1 rounded ${v?"bg-white/15 text-[var(--terminal-text)]":"bg-white/5 text-[var(--terminal-text-muted)]"}`,onClick:()=>{const S=v?e.members.filter(j=>j!==b.id):[...e.members,b.id];r(e.id,S)},children:[v?"✓ ":"",b.name]},b.id)})})}),e.messages.length===0&&s.jsx("div",{className:"flex-1 flex flex-col items-center justify-center text-[var(--terminal-text-muted)] text-xs gap-1 py-8",children:s.jsx("span",{children:e.isDefault?"No dispatch events yet":"No messages yet — invite roles to start chatting"})}),e.messages.map(b=>s.jsx(UC,{msg:b},b.id)),s.jsx("div",{ref:c})]})}const Rf={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},qC=400,XC=800;function VC({sessions:e,activeSessionId:l,roles:r,streamingSessionId:i,width:c,onWidthChange:u,onSwitchSession:d,onCloseSession:m,onCreateSession:x,onClearEmpty:f,onCloseAll:g,onSendMessage:y,onModeChange:b,onCloseTerminal:v,chatChannels:S,activeChatChannelId:j,onSwitchChatChannel:C,onCreateChatChannel:E,onDeleteChatChannel:N,onUpdateChatMembers:z,onUpdateChatTopic:O,unreadChannels:I}){const[_,q]=k.useState(!1),[W,Y]=k.useState(!1),[T,$]=k.useState(!1),[B,G]=k.useState(""),ne=j!=null,V=S==null?void 0:S.find(fe=>fe.id===j),[U,J]=k.useState(!1),[ie,je]=k.useState(!1),[R,M]=k.useState(!1),K=k.useRef(0),D=k.useRef(0),de=k.useRef(null),Se=e.find(fe=>fe.id===l),ve=i===l,Fe=e.filter(fe=>fe.messages.length===0).length,Me=k.useCallback(()=>{const fe=de.current;fe&&(je(fe.scrollLeft>0),M(fe.scrollLeft+fe.clientWidth<fe.scrollWidth-1))},[]);k.useEffect(()=>{if(!l||!de.current)return;const fe=de.current.querySelector(`[data-session-id="${l}"]`);fe&&fe.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),Me()},[l,e.length,Me]),k.useEffect(()=>{const fe=de.current;if(!fe)return;Me(),fe.addEventListener("scroll",Me);const tt=new ResizeObserver(Me);return tt.observe(fe),()=>{fe.removeEventListener("scroll",Me),tt.disconnect()}},[Me]);const $e=k.useCallback(fe=>{fe.preventDefault(),K.current=fe.clientX,D.current=c,J(!0);const tt=he=>{const ye=K.current-he.clientX,ge=Math.min(XC,Math.max(qC,D.current+ye));u==null||u(ge)},mt=()=>{J(!1),document.removeEventListener("mousemove",tt),document.removeEventListener("mouseup",mt)};document.addEventListener("mousemove",tt),document.addEventListener("mouseup",mt)},[c,u]);return s.jsxs("div",{className:"shrink-0 bg-[var(--terminal-bg)] border-l border-[var(--terminal-border)] flex flex-col h-full relative",style:{width:c},children:[u&&s.jsx("div",{className:`terminal-resize-handle absolute top-0 left-0 w-1 h-full cursor-col-resize z-10 transition-colors ${U?"bg-[var(--terminal-border-hover)]":"bg-transparent"}`,onMouseDown:$e}),s.jsxs("div",{className:"flex items-center bg-[var(--terminal-bg-deeper)] border-b border-[var(--terminal-border)] shrink-0",children:[s.jsxs("div",{className:"relative flex-1 min-w-0",children:[ie&&s.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-6 bg-gradient-to-r from-[var(--terminal-bg-deeper)] to-transparent z-10 pointer-events-none"}),s.jsxs("div",{ref:de,className:"flex items-center overflow-x-auto terminal-tab-scroll gap-px px-1 py-1",children:[S==null?void 0:S.map(fe=>s.jsxs("button",{onClick:()=>{C==null||C(fe.id)},className:`flex items-center gap-1 px-2.5 py-1.5 text-[11px] rounded-t-lg shrink-0 cursor-pointer transition-colors group ${j===fe.id?"bg-[var(--terminal-bg)] text-[var(--terminal-text)]":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface)]"}`,style:j===fe.id?{borderTop:"2px solid #4CAF50"}:void 0,children:[s.jsx("span",{className:"text-[10px]",children:"💬"}),s.jsx("span",{className:"truncate",children:fe.name}),(I==null?void 0:I.has(fe.id))&&j!==fe.id&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 shrink-0"}),!fe.isDefault&&s.jsx("span",{onClick:tt=>{tt.stopPropagation(),N==null||N(fe.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:"×"})]},fe.id)),S&&S.length>0&&e.length>0&&s.jsx("div",{className:"w-px h-4 bg-[var(--terminal-border)] shrink-0 mx-1"}),e.map(fe=>s.jsx(NC,{roleId:fe.roleId,title:fe.title,roleColor:Rf[fe.roleId]??"#666",active:!ne&&fe.id===l,isWave:fe.source==="wave",isWaveStreaming:fe.source==="wave"&&fe.status==="active",onClick:()=>{C==null||C(null),d(fe.id)},onClose:tt=>{tt.stopPropagation(),m(fe.id)},"data-session-id":fe.id},fe.id))]}),R&&s.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-6 bg-gradient-to-l from-[var(--terminal-bg-deeper)] to-transparent z-10 pointer-events-none"})]}),s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("button",{onClick:()=>{q(!_),Y(!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:"+"}),_&&s.jsxs("div",{className:"absolute top-full right-0 mt-1 bg-[var(--terminal-surface)] border border-[var(--terminal-border)] rounded-lg shadow-xl z-50 py-1 min-w-[200px]",children:[E&&s.jsxs(s.Fragment,{children:[T?s.jsxs("div",{className:"px-3 py-2 flex items-center gap-1",children:[s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:"#"}),s.jsx("input",{autoFocus:!0,value:B,onChange:fe=>G(fe.target.value),onKeyDown:fe=>{fe.key==="Enter"&&B.trim()&&(E(B.trim(),[]),G(""),$(!1),q(!1)),fe.key==="Escape"&&($(!1),G(""))},placeholder:"channel name",className:"flex-1 bg-transparent text-xs text-[var(--terminal-text)] outline-none border-b border-[var(--terminal-border)]"})]}):s.jsxs("button",{onClick:()=>$(!0),className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer flex items-center gap-2",children:[s.jsx("span",{className:"text-[10px]",children:"💬"}),"New Channel"]}),s.jsx("div",{className:"border-b border-[var(--terminal-border)] my-1"})]}),r.map(fe=>s.jsxs("button",{onClick:()=>{x(fe.id),C==null||C(null),q(!1)},className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:Rf[fe.id]??"#666"}}),fe.id.toUpperCase()," — ",fe.name]},fe.id))]})]}),s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("button",{onClick:()=>{Y(!W),q(!1)},className:"w-7 h-7 flex items-center justify-center text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-xs cursor-pointer tracking-tight",title:"Manage sessions",children:"···"}),W&&s.jsxs("div",{className:"absolute top-full right-0 mt-1 bg-[var(--terminal-surface)] border border-[var(--terminal-border)] rounded-lg shadow-xl z-50 py-1 min-w-[200px]",children:[s.jsxs("div",{className:"px-3 py-1.5 text-[10px] text-[var(--terminal-text-muted)] border-b border-[var(--terminal-border)]",children:[e.length," session",e.length!==1?"s":""]}),Fe>0&&f&&s.jsxs("button",{onClick:()=>{f(),Y(!1)},className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer",children:["Clear empty sessions (",Fe,")"]}),e.length>0&&g&&s.jsx("button",{onClick:()=>{g(),Y(!1)},className:"w-full text-left px-3 py-2 text-xs text-[#E57373] hover:bg-[var(--terminal-surface-light)] cursor-pointer",children:"Close all sessions"}),e.length===0&&s.jsx("div",{className:"px-3 py-2 text-xs text-[var(--terminal-text-muted)]",children:"No sessions"})]})]}),s.jsx("button",{onClick:v,className:"px-2 py-1 text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm cursor-pointer shrink-0",children:"×"})]}),ne&&V?s.jsx(YC,{channel:V,allRoles:r,onUpdateMembers:z,onUpdateTopic:O}):Se?s.jsxs(s.Fragment,{children:[s.jsx(BC,{messages:Se.messages,roleId:Se.roleId,roleColor:Rf[Se.roleId]??"#666"}),Se.source==="wave"?s.jsxs("div",{className:"shrink-0 px-4 py-2 border-t border-[var(--terminal-border)] bg-[var(--terminal-bg-deeper)] flex items-center gap-2",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 shrink-0",style:Se.status==="active"?{animation:"pulse 2s infinite"}:void 0}),s.jsx("span",{className:"text-[11px] text-amber-400/80",children:"Wave execution · read-only"}),s.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] ml-auto",children:"Interact via Wave Command Center"})]}):s.jsx(HC,{mode:Se.mode,onModeChange:fe=>b(Se.id,fe),onSend:(fe,tt)=>y(Se.id,fe,Se.mode,tt),disabled:ve,disabledReason:ve?`${Se.roleId.toUpperCase()} is responding...`:void 0})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:"No active session. Click [+] to start."})]})}function GC(){const e=k.useRef(null),l=k.useCallback(()=>{var i;(i=e.current)==null||i.abort(),e.current=null},[]);return{sendMessage:k.useCallback((i,c,u,d,m)=>{l();const x=new AbortController;return e.current=x,fetch(`/api/exec/session/${i}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:c,mode:u,attachments:m}),signal:x.signal}).then(async f=>{var C,E,N,z,O;if(!f.ok||!f.body){d.onError("Failed to connect");return}const g=f.body.getReader(),y=new TextDecoder;let b="",v=Date.now();const S=6e4,j=setInterval(()=>{Date.now()-v>S&&(clearInterval(j),x.abort(),d.onError("Connection stale — no data received for 60s"))},1e4);try{for(;;){const{done:I,value:_}=await g.read();if(I)break;v=Date.now(),b+=y.decode(_,{stream:!0});const q=b.split(`
|
|
88
|
+
`);b=q.pop()??"";let W="";for(let Y=0;Y<q.length;Y++){const T=q[Y];if(T.startsWith("event: ")){W=T.slice(7).trim();continue}if(T.startsWith("data: ")){let $;try{$=JSON.parse(T.slice(6))}catch{W="";continue}switch(W){case"thinking":$.text&&((C=d.onThinking)==null||C.call(d,$.text));break;case"output":$.text&&d.onText($.text);break;case"tool":(E=d.onToolUse)==null||E.call(d,$.name,$.input);break;case"dispatch":(N=d.onDispatch)==null||N.call(d,$.roleId,$.task);break;case"dispatch:progress":(z=d.onDispatchProgress)==null||z.call(d,$.roleId,$.type,$);break;case"turn":(O=d.onTurn)==null||O.call(d,$.turn);break;case"done":d.onDone($);break;case"error":d.onError($.message??"Unknown error");break;default:$.text&&d.onText($.text);break}W=""}}}}finally{clearInterval(j)}}).catch(f=>{f.name!=="AbortError"&&d.onError(f.message)}),{abort:l}},[l]),abort:l}}const Ng="tycono-appearances",sh="tycono-theme";function M0(){try{const e=localStorage.getItem(Ng);return e?JSON.parse(e):{}}catch{return{}}}function Ff(e){localStorage.setItem(Ng,JSON.stringify(e))}function R0(){try{const e=localStorage.getItem(sh);if(e&&e in oa)return e}catch{}return"default"}function KC(e){var i;const l=(i=oa[e])==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 _f={mode:"auto",intervalSec:18,dailyBudgetUsd:1},oh="tycono-speech-settings",Of="tycono-language";function WC(){try{const e=localStorage.getItem(oh);return e?{..._f,...JSON.parse(e)}:_f}catch{return _f}}function QC(){const[e,l]=k.useState(M0),[r,i]=k.useState(R0),[c,u]=k.useState(WC),[d,m]=k.useState(()=>{try{return localStorage.getItem(Of)??"auto"}catch{return"auto"}}),x=k.useRef(!1);k.useEffect(()=>{x.current||(x.current=!0,Ce.getPreferences().then(j=>{const C=Object.keys(j.appearances??{}).length>0||j.theme!=="default";if(j.speech&&(u(E=>({...E,...j.speech})),localStorage.setItem(oh,JSON.stringify(j.speech))),j.language&&(m(j.language),localStorage.setItem(Of,j.language)),C){const E=j.appearances;l(E),Ff(E),j.theme&&j.theme in oa&&(i(j.theme),localStorage.setItem(sh,j.theme))}else{const E=M0(),N=R0();(Object.keys(E).length>0||N!=="default")&&Ce.updatePreferences({appearances:E,theme:N}).catch(()=>{})}}).catch(()=>{}))},[]),k.useEffect(()=>{KC(r)},[r]);const f=k.useCallback(j=>e[j]??Bh(j),[e]),g=k.useCallback((j,C)=>{l(E=>{const N={...E,[j]:C};return Ff(N),Ce.updatePreferences({appearances:N}).catch(()=>{}),N})},[]),y=k.useCallback(j=>{l(C=>{const E={...C};return delete E[j],Ff(E),Ce.updatePreferences({appearances:E}).catch(()=>{}),E})},[]),b=k.useCallback(j=>{i(j),localStorage.setItem(sh,j),Ce.updatePreferences({theme:j}).catch(()=>{})},[]),v=k.useCallback(j=>{u(C=>{const E={...C,...j};return localStorage.setItem(oh,JSON.stringify(E)),Ce.updatePreferences({speech:E}).catch(()=>{}),E})},[]),S=k.useCallback(j=>{m(j),localStorage.setItem(Of,j),Ce.updatePreferences({language:j}).catch(()=>{})},[]);return{appearances:e,getAppearance:f,setAppearance:g,resetAppearance:y,theme:r,setTheme:b,speechSettings:c,setSpeechSettings:v,language:d,setLanguage:S}}const ZC=3e4;function JC(){var C;const[e,l]=k.useState(null),[r,i]=k.useState("synced"),[c,u]=k.useState([]),d=k.useRef(null),m=k.useCallback(async()=>{try{const E=await Ce.getSaveStatus();l(E),E.noGit?i("no-git"):i(N=>N==="saving"?N:E.dirty?"dirty":"synced")}catch{i("error")}},[]),x=k.useCallback(()=>{d.current||(m(),d.current=setInterval(m,ZC))},[m]);k.useEffect(()=>()=>{d.current&&clearInterval(d.current)},[]);const f=k.useCallback(async E=>{i("saving");try{const N=await Ce.save(E);return await m(),N}catch(N){throw i("error"),N}},[m]),g=k.useCallback(async()=>{try{const E=await Ce.getSaveHistory(20);u(E)}catch{}},[]),y=k.useCallback(async E=>{i("saving");try{await Ce.restoreSave(E),await m()}catch(N){throw i("error"),N}},[m]),b=k.useCallback(async()=>{try{await Ce.initGit(),await m()}catch{i("error")}},[m]),v=e?e.modified.length+e.untracked.length:0,S=((C=e==null?void 0:e.lastCommit)==null?void 0:C.date)??null,j=k.useCallback(async()=>{x()},[x]);return{state:r,dirtyCount:v,lastSaved:S,status:e,save:f,history:c,loadHistory:g,restore:y,refresh:j,initGit:b}}const F0={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."]},_0={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."]},PC=[{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."}]}],eE=18e3,O0=6e3,tE=2500,nE=30*6e4,Ag="tycono:relationships";function lE(){try{const e=localStorage.getItem(Ag);return e?JSON.parse(e):[]}catch{return[]}}function rE(e){localStorage.setItem(Ag,JSON.stringify(e))}function bc(e,l,r){const[i,c]=l<r?[l,r]:[r,l];let u=e.find(d=>d.roleA===i&&d.roleB===c);return u||(u={roleA:i,roleB:c,dispatches:0,wavesTogether:0,conversations:0,familiarity:0,lastInteraction:new Date().toISOString()},e.push(u)),u}function vc(e){return Math.min(100,e.dispatches*5+e.wavesTogether*10+e.conversations*2)}function wc(e){return e[Math.floor(Math.random()*e.length)]}function aE(e,l,r){const i=r.find(m=>m.id===e),c=r.find(m=>m.id===l);if(!i||!c)return null;const u=i.level==="c-level",d=c.level==="c-level";return u&&d?"c-level":i.reportsTo===l||c.reportsTo===e?"superior-subordinate":(i.reportsTo===c.reportsTo,"peer")}function iE(e,l){return e.relation==="any"?!0:e.relation===l}function sE({roles:e,roleStatuses:l,activeExecs:r,getStandupSpeech:i}){const[c,u]=k.useState(new Map),[d,m]=k.useState(lE),x=k.useRef({}),f=k.useRef(null),g=k.useRef(e),y=k.useRef(l),b=k.useRef(r),v=k.useRef(i),S=k.useRef(d);g.current=e,y.current=l,b.current=r,v.current=i,S.current=d,k.useEffect(()=>{const O=Date.now();for(const[I,_]of Object.entries(l))_==="working"&&(x.current[I]=O)},[l]),k.useEffect(()=>{rE(d)},[d]);const j=k.useCallback(O=>{const I=y.current[O],_=b.current.find($=>$.roleId===O);if(I==="working"&&(_!=null&&_.task))return null;const q=v.current(O);if(q&&Math.random()<.3)return{text:q,type:"work",ts:Date.now()};const W=Date.now(),Y=x.current[O]??0;if(W-Y>nE&&Math.random()<.5){const $=_0[O]??_0.engineer;return{text:wc($),type:"guilt",ts:W}}const T=F0[O]??F0.engineer;return{text:wc(T),type:"personality",ts:W}},[]),C=k.useCallback(O=>{if(f.current)return!1;const I=O.filter(J=>y.current[J.id]!=="working");if(I.length<2)return!1;const _=[...I].sort(()=>Math.random()-.5),q=_[0],W=_[1],Y=aE(q.id,W.id,O);if(!Y)return!1;const T=bc(S.current,q.id,W.id),$=vc(T),B=PC.filter(J=>iE(J,Y)&&$>=J.minFamiliarity);if(B.length===0)return!1;const G=wc(B);let ne=q.id,V=W.id;G.relation==="superior-subordinate"&&(W.reportsTo===q.id||q.level==="c-level"?(ne=q.id,V=W.id):(ne=W.id,V=q.id)),f.current={templateId:G.id,roleA:ne,roleB:V,turnIdx:0,timer:null};const U=J=>{if(!f.current||J>=G.turns.length){f.current=null,m(M=>{const K=[...M],D=bc(K,ne,V);return D.conversations++,D.familiarity=vc(D),D.lastInteraction=new Date().toISOString(),K}),setTimeout(()=>{u(M=>{const K=new Map(M);return K.delete(ne),K.delete(V),K})},O0);return}const ie=G.turns[J],je=ie.speaker==="A"?ne:V,R=ie.speaker==="A"?V:ne;u(M=>{const K=new Map(M);if(K.set(je,{text:ie.text,type:"social",partnerId:R,ts:Date.now()}),J>0){const D=G.turns[J-1].speaker==="A"?ne:V;D!==je&&K.delete(D)}return K}),f.current.turnIdx=J,f.current.timer=setTimeout(()=>U(J+1),tE)};return U(0),!0},[]);k.useEffect(()=>{const O=setInterval(()=>{const I=g.current;if(I.length===0||f.current||Math.random()<.35&&C(I))return;const _=I.filter(Y=>y.current[Y.id]!=="working");if(_.length===0)return;const q=wc(_),W=j(q.id);W&&(u(Y=>{const T=new Map(Y);return T.set(q.id,W),T}),setTimeout(()=>{u(Y=>{const T=new Map(Y),$=T.get(q.id);return $&&$.ts===W.ts&&T.delete(q.id),T})},O0))},eE);return()=>{var I;clearInterval(O),(I=f.current)!=null&&I.timer&&clearTimeout(f.current.timer)}},[j,C]);const E=k.useCallback(O=>{const I=c.get(O);return(I==null?void 0:I.text)??""},[c]),N=k.useCallback((O,I)=>{m(_=>{const q=[..._],W=bc(q,O,I);return W.dispatches++,W.familiarity=vc(W),W.lastInteraction=new Date().toISOString(),q})},[]),z=k.useCallback(O=>{O.length<2||m(I=>{const _=[...I];for(let q=0;q<O.length;q++)for(let W=q+1;W<O.length;W++){const Y=bc(_,O[q],O[W]);Y.wavesTogether++,Y.familiarity=vc(Y),Y.lastInteraction=new Date().toISOString()}return _})},[]);return{speeches:c,getSpeech:E,relationships:d,notifyDispatch:N,notifyWave:z}}const Dg="tycono:office-chat";let oE=0;function cE(){return`chat-${Date.now()}-${++oE}`}function Bf(){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 uE(){try{const e=localStorage.getItem(Dg);if(e){const l=JSON.parse(e);if(l.find(i=>i.id==="office")&&!l.find(i=>i.id==="general")){const i=l.filter(c=>c.id!=="office");return[...Bf(),...i]}const r=Bf();for(const i of r)l.find(c=>c.id===i.id)||l.unshift(i);return l}}catch{}return Bf()}function dE(e){const l=e.map(r=>({...r,messages:r.messages.slice(-200)}));localStorage.setItem(Dg,JSON.stringify(l))}function fE(){const[e,l]=k.useState(uE),[r,i]=k.useState(null),[c,u]=k.useState(new Set);k.useEffect(()=>{dE(e)},[e]);const d=k.useCallback(v=>{i(v),v&&u(S=>{const j=new Set(S);return j.delete(v),j})},[]),m=k.useCallback(v=>{const S={...v,id:cE()};l(j=>{const C=j.map(E=>E.id==="general"?v.type==="dispatch"?{...E,messages:[...E.messages,S].slice(-200)}:E:v.channelId?E.id===v.channelId?{...E,messages:[...E.messages,S].slice(-200)}:E:E.members.length>0&&E.members.includes(v.roleId)?{...E,messages:[...E.messages,S].slice(-200)}:E);return u(E=>{const N=new Set(E);for(const z of C){const O=j.find(I=>I.id===z.id);O&&z.messages.length>O.messages.length&&N.add(z.id)}return N}),C})},[]),x=k.useCallback((v,S,j)=>{const C=`ch-${Date.now()}`,E={id:C,name:v.startsWith("#")?v:`#${v}`,members:S,isDefault:!1,messages:[],topic:j};l(N=>[...N,E]),i(C)},[]),f=k.useCallback(v=>{l(S=>S.filter(j=>j.id!==v||j.isDefault)),i(S=>S===v?"general":S)},[]),g=k.useCallback((v,S)=>{l(j=>j.map(C=>C.id===v&&!C.isDefault?{...C,members:S}:C))},[]),y=k.useCallback((v,S)=>{l(j=>j.map(C=>C.id===v&&!C.isDefault?{...C,topic:S||void 0}:C))},[]),b=k.useCallback(v=>{l(S=>S.map(j=>{if(j.id==="watercooler"){const C=v.filter(E=>E.level!=="c-level").map(E=>E.id);if(j.members.length!==C.length||!C.every(E=>j.members.includes(E)))return{...j,members:C}}return j}))},[]);return{channels:e,activeChannelId:r,setActiveChannelId:d,pushMessage:m,createChannel:x,deleteChannel:f,updateMembers:g,updateTopic:y,unreadChannels:c,syncDefaultMembers:b}}const hE=45e3,mE=5e3,xE=4,pE=20;function yE({roles:e,roleStatuses:l,activeExecs:r,channels:i,relationships:c,pushMessage:u,speechSettings:d,engineType:m,hasApiKey:x}){const g=((d==null?void 0:d.mode)==="auto"?m==="claude-cli"||m==="local"?"llm":"template":(d==null?void 0:d.mode)??"template")==="llm"&&(x!==!1||m==="claude-cli"),y=((d==null?void 0:d.intervalSec)??hE/1e3)*1e3,b=k.useRef(e),v=k.useRef(l),S=k.useRef(r),j=k.useRef(i),C=k.useRef(c),E=k.useRef(u),N=k.useRef(0),z=k.useRef(!1);b.current=e,v.current=l,S.current=r,j.current=i,C.current=c,E.current=u;const O=k.useCallback(async(_,q)=>{if(z.current)return!1;z.current=!0;try{if(!b.current.find(V=>V.id===_))return!1;const Y=q.messages.slice(-pE).map(V=>({roleId:V.roleId,text:V.text,ts:V.ts})),T=b.current.filter(V=>q.members.includes(V.id)),$=C.current.filter(V=>V.roleA===_||V.roleB===_).map(V=>({partnerId:V.roleA===_?V.roleB:V.roleA,familiarity:V.familiarity})),B=S.current.find(V=>V.roleId===_),G=B?{currentTask:B.task,taskProgress:null}:{currentTask:null,taskProgress:null},ne=await Ce.chatInChannel({channelId:q.name.replace("#",""),channelTopic:q.topic,roleId:_,history:Y,members:T.map(V=>({id:V.id,name:V.name,level:V.level})),relationships:$,workContext:G});return ne.message?(E.current({ts:Date.now(),roleId:_,text:ne.message,type:"chat",channelId:q.id}),!0):!1}catch{return!1}finally{z.current=!1}},[]),I=k.useCallback(async(_,q)=>{if(N.current>=xE){N.current=0;return}const W=_.members.filter(B=>B!==q&&v.current[B]!=="working");if(W.length===0){N.current=0;return}const Y=W[Math.floor(Math.random()*W.length)];if(Math.random()>.7){N.current=0;return}const T=N.current*2e3,$=Math.random()*5e3;setTimeout(async()=>{N.current++;const B=j.current.find(ne=>ne.id===_.id);if(!B)return;if(await O(Y,B)){const ne=.6-N.current*.1;Math.random()<ne?I(B,Y):N.current=0}else N.current=0},mE+T+$)},[O]);k.useEffect(()=>{if(!g)return;const _=setInterval(async()=>{const q=b.current;if(q.length===0||z.current)return;const W=q.filter(G=>v.current[G.id]!=="working");if(W.length===0)return;const Y=W[Math.floor(Math.random()*W.length)],T=j.current.filter(G=>G.members.length===0?!0:G.members.includes(Y.id));if(T.length===0)return;const $=T[Math.floor(Math.random()*T.length)];N.current=0,await O(Y.id,$)&&I($,Y.id)},y);return()=>clearInterval(_)},[g,y,O,I])}function kc({type:e,className:l}){const r=k.useRef(null),i=Tj(e);return k.useEffect(()=>{const c=r.current;if(!c||!i)return;const u=c.getContext("2d");u&&Mj(u,i)},[e,i]),i?s.jsx("canvas",{ref:r,width:i.canvasWidth,height:i.canvasHeight,className:l,style:{imageRendering:"pixelated",display:"block"}}):null}const Tg=[[1,8],[3,5],[8,1],[5,3]],gE=[[1,4],[2,3],[4,1],[3,2]];function jc(e){const l=e===1||e===3?-1:0,r=Tg[e],i=e<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 Sc(e){const l=e===1||e===3?-1:0,r=Tg[e],i=e<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 la(e,l){const r=e===1||e===3?-1:0,i=gE[e],c=r,u=e%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 B0={down:[jc(0),jc(1),jc(2),jc(3)],up:[Sc(0),Sc(1),Sc(2),Sc(3)],right:[la(0,!0),la(1,!0),la(2,!0),la(3,!0)],left:[la(0,!1),la(1,!1),la(2,!1),la(3,!1)]},Ze=4,_t=28,pn=2,yt=4,st=4,yr=[{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 $h(e,l,r){const u=e.fy+Math.max(10,Math.floor(e.fh*.18)),d=Math.min(l,r),m=Math.ceil(l/d),x=[],f=d*28,g=e.fx+Math.max(8,Math.floor((e.fw-f)/2));for(let y=0;y<m&&x.length<l;y++){const b=Math.min(d,l-y*d);for(let v=0;v<b;v++)x.push({dx:g+v*28,dy:u+y*28,room:e.id})}return x}function bE(e){const i=yr[0],c={id:"main",wx:Ze+st,wy:Ze,ww:160-2*(Ze+st),wh:_t,fx:Ze+st,fy:Ze+_t+pn,fw:160-2*(Ze+st),fh:120-Ze-_t-pn-Ze,...i},u=$h(c,Math.min(e,6),3),d=[{id:"s-window-l",type:"window",room:"main",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"s-window-r",type:"window",room:"main",zone:"wall",anchorX:"right",offsetX:-26,offsetY:6,windowW:16,windowH:14},{id:"s-clock",type:"clock",room:"main",zone:"wall",offsetX:Math.floor((160-2*(Ze+st))/2),offsetY:10}],m=[{id:"s-plant-l",type:"plant",room:"main",zone:"floor",offsetX:4,offsetY:4},{id:"s-plant-r",type:"plant",room:"main",zone:"floor",anchorX:"right",offsetX:-8,offsetY:4}];return{preset:"S",canvasW:160,canvasH:120,rooms:{main:c},desks:u,doors:{},adjacency:{main:[]},corridorY:{main:c.fy+c.fh-12},waypoints:{main:[{x:c.fx+10,y:c.fy+c.fh-14},{x:c.fx+c.fw/2,y:c.fy+c.fh-14},{x:c.fx+c.fw-10,y:c.fy+c.fh-14}]},wallDecorations:d,furniture:m}}function vE(e){const c={id:"exec",wx:Ze+st,wy:Ze,ww:144-Ze-st-yt/2,wh:_t,fx:Ze+st,fy:Ze+_t+pn,fw:144-Ze-st-yt/2,fh:66,...yr[0]},u={id:"work",wx:144+yt/2+st,wy:Ze,ww:144-yt/2-st-Ze,wh:_t,fx:144+yt/2+st,fy:Ze+_t+pn,fw:144-yt/2-st-Ze,fh:66,...yr[1]},d={id:"meet",wx:Ze+st,wy:Ze+_t+pn+66+yt,ww:144-Ze-st-yt/2,wh:_t,fx:Ze+st,fy:Ze+_t+pn+66+yt+_t+pn,fw:144-Ze-st-yt/2,fh:70,...yr[2]},m={id:"comm",wx:144+yt/2+st,wy:Ze+_t+pn+66+yt,ww:144-yt/2-st-Ze,wh:_t,fx:144+yt/2+st,fy:Ze+_t+pn+66+yt+_t+pn,fw:144-yt/2-st-Ze,fh:70,...yr[3]},x={exec:c,work:u,meet:d,comm:m},f=[];let g=e;const y=[[c,Math.min(3,g)],[u,0]];y[1][1]=Math.min(3,g-y[0][1]);const b=[[d,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[_,q]of[...y,...b])q>0&&f.push(...$h(_,q,3));const S=Ze+_t+pn+66,j=144-yt/2,C={exec_work:{id:"exec_work",type:"v",doorY:Ze+_t+pn+20+12,xA:j-2,xB:u.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:Ze+_t+pn+66+yt+_t+pn+20+12,xA:j-2,xB:m.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:Ze+st+40+14,yA:S-2,yB:d.fy+2},work_comm:{id:"work_comm",type:"h",doorX:144+yt/2+st+40+14,yA:S-2,yB:m.fy+2}},E={exec:[{room:"work",door:"exec_work",side:"A"},{room:"meet",door:"exec_meet",side:"A"}],work:[{room:"exec",door:"exec_work",side:"B"},{room:"comm",door:"work_comm",side:"A"}],meet:[{room:"exec",door:"exec_meet",side:"B"},{room:"comm",door:"meet_comm",side:"A"}],comm:[{room:"work",door:"work_comm",side:"B"},{room:"meet",door:"meet_comm",side:"B"}]},N={exec:c.fy+52,work:u.fy+48,meet:d.fy+56,comm:m.fy+42},z={exec:[{x:c.fx+6,y:c.fy+52},{x:c.fx+60,y:c.fy+54},{x:c.fx+112,y:c.fy+50},{x:c.fx+50,y:c.fy+52}],work:[{x:u.fx+14,y:u.fy+48},{x:u.fx+44,y:u.fy+48},{x:u.fx+70,y:u.fy+48},{x:u.fx+100,y:u.fy+48}],meet:[{x:d.fx+60,y:d.fy+56},{x:d.fx+30,y:d.fy+54},{x:d.fx+110,y:d.fy+50},{x:d.fx+80,y:d.fy+56}],comm:[{x:m.fx+96,y:m.fy+8},{x:m.fx+60,y:m.fy+42},{x:m.fx+40,y:m.fy+42},{x:m.fx+20,y:m.fy+42}]},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}],I=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(c.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"M",canvasW:288,canvasH:208,rooms:x,desks:f,doors:C,adjacency:E,corridorY:N,waypoints:z,wallDecorations:O,furniture:I}}function wE(e){const d={id:"exec",wx:Ze+st,wy:Ze,ww:180-Ze-st-yt/2,wh:_t,fx:Ze+st,fy:Ze+_t+pn,fw:180-Ze-st-yt/2,fh:82,...yr[0]},m={id:"work",wx:180+yt/2+st,wy:Ze,ww:180-yt/2-st-Ze,wh:_t,fx:180+yt/2+st,fy:Ze+_t+pn,fw:180-yt/2-st-Ze,fh:82,...yr[1]},x=Ze+_t+pn+82,f={id:"meet",wx:Ze+st,wy:x+yt,ww:180-Ze-st-yt/2,wh:_t,fx:Ze+st,fy:x+yt+_t+pn,fw:180-Ze-st-yt/2,fh:86,...yr[2]},g={id:"comm",wx:180+yt/2+st,wy:x+yt,ww:180-yt/2-st-Ze,wh:_t,fx:180+yt/2+st,fy:x+yt+_t+pn,fw:180-yt/2-st-Ze,fh:86,...yr[3]},y={exec:d,work:m,meet:f,comm:g},b=[];let v=e;const S=[[d,Math.min(5,v)],[m,0]];S[1][1]=Math.min(5,v-S[0][1]);const j=[[f,0],[g,0]];let C=v-S[0][1]-S[1][1];C>0&&(j[0][1]=Math.min(3,C),C-=j[0][1]),C>0&&(j[1][1]=Math.min(3,C));for(const[W,Y]of[...S,...j])Y>0&&b.push(...$h(W,Y,4));const E=180-yt/2,N={exec_work:{id:"exec_work",type:"v",doorY:d.fy+82/2,xA:E-2,xB:m.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:f.fy+86/2,xA:E-2,xB:g.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:d.fx+54,yA:x-2,yB:f.fy+2},work_comm:{id:"work_comm",type:"h",doorX:m.fx+54,yA:x-2,yB:g.fy+2}},z={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:d.fy+82-12,work:m.fy+82-12,meet:f.fy+86-12,comm:g.fy+86-12},I={exec:[{x:d.fx+10,y:O.exec},{x:d.fx+d.fw/2,y:O.exec},{x:d.fx+d.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:f.fx+10,y:O.meet},{x:f.fx+f.fw/2,y:O.meet},{x:f.fx+f.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}]},_=[{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}],q=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(d.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"L",canvasW:360,canvasH:260,rooms:y,desks:b,doors:N,adjacency:z,corridorY:O,waypoints:I,wallDecorations:_,furniture:q}}const kE=2;function zg(e,l){return l?l==="L"&&e<=12-kE?"M":l==="M"&&e>12?"L":l:e<=12?"M":"L"}function Mg(e,l){switch(l??zg(e)){case"S":return bE(e);case"M":return vE(e);case"L":return wE(e)}}function $0(e,l){if(!l||Object.keys(l).length===0)return e;const r=i=>i.map(c=>{const u=l[c.id];return u?{...c,offsetX:u.offsetX,offsetY:u.offsetY}:c});return{...e,wallDecorations:r(e.wallDecorations),furniture:r(e.furniture)}}function L0(e,l){if(l)for(const[r,i]of Object.entries(l))e[r]&&(e[r]={...e[r],dx:i.dx,dy:i.dy})}function $f(e,l){if(!l||l.length===0)return e;const r=new Set(l);return{...e,wallDecorations:e.wallDecorations.filter(i=>!r.has(i.id)),furniture:e.furniture.filter(i=>!r.has(i.id))}}function H0(e,l){if(!l||l.length===0)return e;const r=[],i=[];for(const c of l)c.zone==="wall"?r.push(c):i.push(c);return{...e,wallDecorations:[...e.wallDecorations,...r],furniture:[...e.furniture,...i]}}let Is;function jE(e){Is=e}function L(e,l,r,i,c,u){e=Math.round(e),l=Math.round(l),!(u!==void 0&&u<.01)&&(u!==void 0&&u!==1&&(Is.globalAlpha=u),Is.fillStyle=c,Is.fillRect(e,l,r,i),u!==void 0&&u!==1&&(Is.globalAlpha=1))}function ot(e,l,r,i){L(e,l,1,1,r,i)}let Mc=1;function Mi(e){Mc=e}function Vl(){return Mc=Mc*16807%2147483647,(Mc&65535)/65535}function Rg(e){const l=parseInt(e.slice(1,3),16)/255,r=parseInt(e.slice(3,5),16)/255,i=parseInt(e.slice(5,7),16)/255,c=Math.max(l,r,i),u=Math.min(l,r,i);let d=0,m=0;const x=(c+u)/2;if(c!==u){const f=c-u;m=x>.5?f/(2-c-u):f/(c+u),c===l?d=((r-i)/f+(r<i?6:0))/6:c===r?d=((i-l)/f+2)/6:d=((l-r)/f+4)/6}return[d*360,m*100,x*100]}function Fg(e,l,r){e=(e%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=d=>{const m=(d+e/30)%12;return r-i*Math.max(-1,Math.min(m-3,9-m,1))},u=d=>Math.round(d*255).toString(16).padStart(2,"0");return"#"+u(c(0))+u(c(8))+u(c(4))}function Gl(e,l=1){const[r,i,c]=Rg(e);return Fg(r+15*l,Math.min(100,i+8),c-12*l)}function Qt(e,l=1){const[r,i,c]=Rg(e);return Fg(r-10*l,i-3,c+10*l)}const xn={hi:"#D4AA5C",base:"#B08040",sh:"#7A5038",deep:"#4E3028"},Xl={hi:"#8A6848",base:"#604832",sh:"#3A2E24",deep:"#2A1E18"},Ul={hi:"#5A6A80",base:"#485868",sh:"#364858",deep:"#283848"},da="#100A06";function SE(e,l,r=14,i=12){L(e,l,r,i,"#4A3828"),L(e+1,l+1,r-2,i-2,"#5A4838"),L(e+2,l+2,r-4,i-4,"#4A7098"),L(e+2,l+2,r-4,Math.floor((i-4)/2),"#6A90B8",.35);const c=Math.floor(r/2);L(e+c,l+1,1,i-2,"#4A3828"),L(e+1,l+Math.floor(i/2),r-2,1,"#4A3828",.5),ot(e+3,l+3,"#8AB8E8",.35),ot(e+c+2,l+3,"#8AB8E8",.25),L(e-1,l+i,r+2,2,"#5A4838"),L(e-1,l+i,r+2,1,Qt("#5A4838",.5),.35)}function CE(e,l,r){L(e,l,10,8,"#3A2818"),L(e+1,l+1,8,6,r),L(e+2,l+2,4,3,Qt(r,1.2),.3),ot(e+3,l+2,Qt(r,2),.25)}function EE(e,l){L(e,l,7,7,"#3A2818"),L(e+1,l+1,5,5,"#F0EDE5"),ot(e+3,l+1,"#AAA"),ot(e+3,l+5,"#AAA"),ot(e+1,l+3,"#AAA"),ot(e+5,l+3,"#AAA"),ot(e+3,l+3,"#222"),L(e+3,l+1,1,2,"#333"),ot(e+4,l+3,"#D32F2F")}function NE(e,l){L(e,l,26,16,"#586878"),L(e+1,l+1,24,13,"#ECEFF1"),L(e+1,l+1,24,1,"#F5F5F5",.4),L(e+3,l+3,14,1,"#1565C0",.6),L(e+3,l+5,18,1,"#333",.2),L(e+3,l+7,12,1,"#D32F2F",.35),L(e+3,l+9,16,1,"#333",.15),L(e+1,l+14,24,2,"#708898"),L(e+3,l+14,3,1,"#D32F2F"),L(e+7,l+14,3,1,"#1565C0"),L(e+11,l+14,3,1,"#2E7D32")}function AE(e,l){L(e,l,22,16,"#6A5030"),L(e+1,l+1,20,14,"#C4A66A"),Mi(88);for(let r=0;r<14;r++)for(let i=0;i<20;i++)Vl()>.5&&ot(e+1+i,l+1+r,Vl()>.5?"#B89858":"#D4B87A",.18);L(e+2,l+2,5,4,"#FFF176"),L(e+8,l+2,5,4,"#90CAF9"),L(e+14,l+3,5,4,"#CE93D8"),L(e+3,l+8,7,4,"#C8E6C9"),L(e+11,l+8,8,4,"#F8BBD0"),ot(e+4,l+2,"#E53935"),ot(e+10,l+2,"#1E88E5"),ot(e+16,l+3,"#FF9800")}function DE(e,l){L(e,l,20,3,"#5A4030"),L(e,l,20,1,Qt("#5A4030",.5),.35),L(e,l+2,20,1,Gl("#5A4030",.5),.3),L(e+2,l-4,3,4,"#E53935"),L(e+2,l-4,3,1,Qt("#E53935",1),.3),L(e+6,l-3,2,3,"#1E88E5"),L(e+9,l-5,4,5,"#43A047"),L(e+14,l-3,3,3,"#FFD54F"),ot(e+15,l-3,"#FFF176",.4)}function TE(e,l){L(e,l,16,12,"#1E1E28"),L(e+1,l+1,14,9,"#0C1420"),L(e+2,l+2,12,1,"#EF4444",.6),ot(e+2,l+4,"#4CAF50"),L(e+4,l+4,7,1,"#8b949e",.4),ot(e+2,l+6,"#FF9800"),L(e+4,l+6,5,1,"#8b949e",.3),ot(e+2,l+8,"#42A5F5"),L(e+4,l+8,8,1,"#8b949e",.25),L(e+7,l+10,2,2,"#1E1E28"),L(e+5,l+11,6,1,"#586878")}function zE(e,l,r){L(e+2,l+20,22,2,da,.15),L(e,l,22,20,Xl.deep),L(e+1,l+1,20,18,Xl.base),L(e,l,22,1,Xl.hi,.35),L(e,l,1,20,Xl.hi,.2);for(const u of[6,12])L(e+1,l+u,20,2,Xl.sh),L(e+1,l+u,20,1,Xl.hi,.2);const i=["#E53935","#1E88E5","#43A047","#8E24AA","#FB8C00","#00897B","#5C6BC0"];let c=e+2;for(let u=0;u<5;u++){const d=2+u%2;L(c,l+1,d,5,i[u]),L(c,l+1,d,1,Qt(i[u],1),.35),c+=d+1}c=e+2;for(let u=0;u<4;u++)L(c,l+7,4,5,i[u+3]),L(c,l+7,4,1,Qt(i[u+3],1),.25),c+=5;L(e+2,l+14,4,4,"#FFD54F"),L(e+8,l+14,7,4,"#90CAF9"),r&&L(e,l-1,22,1,r,.7)}function ME(e,l){L(e+2,l+11,6,2,da,.1),L(e+2,l+8,6,4,"#8B5E3C"),L(e+1,l+7,8,2,Gl("#A06E48",.3)),L(e+2,l+7,6,1,Qt("#A06E48",.5),.4),L(e+1,l+3,3,4,"#2E7D32"),L(e+5,l+2,3,4,"#2E7D32"),L(e+2,l+1,4,4,"#43A047"),L(e+3,l+0,3,3,"#66BB6A"),ot(e+4,l,"#81C784"),ot(e+3,l+1,"#A5D6A7",.4)}function RE(e,l){Ma(e+4,l-4,"down"),Ma(e+16,l-4,"down"),Ma(e+28,l-4,"down"),L(e+3,l+24,34,3,da,.15),L(e,l+2,36,18,xn.deep),L(e+1,l+3,34,16,xn.base),L(e+1,l+3,34,1,xn.hi,.35);for(let r=0;r<14;r+=3)L(e+1,l+4+r,34,1,Gl(xn.base,.2),.08);L(e,l+20,36,4,xn.deep),L(e+1,l+21,34,2,xn.sh),L(e+6,l+7,10,6,"#1A1A24"),L(e+7,l+8,8,4,"#0C1420"),L(e+8,l+9,4,1,"#2A6898",.4),L(e+20,l+8,6,4,"#F0F0F0"),L(e+15,l+7,3,3,"#ECEFF1"),ot(e+16,l+8,"#795548"),Ma(e+4,l+24,"up"),Ma(e+16,l+24,"up"),Ma(e+28,l+24,"up")}function FE(e,l){L(e+2,l+16,36,3,da,.15),L(e,l,36,5,"#5D4037"),L(e+1,l+1,34,3,"#6D4C41"),L(e+1,l+1,34,1,Qt("#6D4C41",.5),.3),L(e,l+5,36,8,"#5D4037"),L(e+2,l+6,15,6,"#6D4C41"),L(e+3,l+6,13,1,Qt("#6D4C41",.5),.35),L(e+19,l+6,15,6,"#6D4C41"),L(e+20,l+6,13,1,Qt("#6D4C41",.5),.35),L(e+17,l+6,2,6,"#5D4037"),L(e,l+13,36,3,Gl("#5D4037",1)),L(e-2,l+2,3,12,"#5D4037"),L(e+35,l+2,3,12,"#5D4037"),L(e+4,l+7,6,4,"#FF8A65"),L(e+5,l+7,4,1,Qt("#FF8A65",1),.35)}function _E(e,l){L(e+2,l+10,22,2,da,.12),L(e,l,22,8,Xl.deep),L(e+1,l+1,20,6,Xl.base),L(e+1,l+1,20,1,Xl.hi,.3),L(e,l+8,22,2,Xl.sh),L(e+3,l+2,6,4,"#F0F0F0"),L(e+13,l+3,3,3,"#ECEFF1"),ot(e+14,l+4,"#795548")}function OE(e,l){L(e+1,l+14,10,2,da,.12),L(e,l,10,14,"#546E7A"),L(e,l,10,1,Qt("#546E7A",1),.35),L(e+1,l+1,8,3,"#78909C"),L(e+1,l+5,8,4,"#37474F"),ot(e+2,l+6,"#EF5350"),ot(e+4,l+6,"#66BB6A"),L(e+2,l+11,4,2,"#ECEFF1")}function BE(e,l){L(e+2,l+16,26,3,da,.18),L(e,l,26,10,xn.deep),L(e+1,l+1,24,8,xn.base),L(e+1,l+2,24,1,xn.hi,.2),L(e+1,l+4,24,1,Gl(xn.base,.2),.1),L(e+1,l+6,24,1,xn.hi,.15),L(e+1,l+1,24,1,xn.hi,.4),L(e+1,l+1,1,8,xn.hi,.2),L(e,l+10,26,5,xn.deep),L(e+1,l+11,24,3,xn.sh),L(e+1,l+10,24,1,Gl(xn.base,1.5),.4),L(e+1,l+14,24,1,xn.base,.15),L(e+2,l+12,10,1,xn.deep,.4),L(e+14,l+12,10,1,xn.deep,.4),ot(e+7,l+11,"#C8D0D8",.6),ot(e+19,l+11,"#C8D0D8",.6),L(e+6,l-5,14,7,"#1E1E28"),L(e+7,l-4,12,5,"#0C1420"),L(e+8,l-3,5,1,"#2A6898",.6),L(e+8,l-2,8,1,"#1A3858",.4),L(e+8,l-1,3,1,"#2A6898",.35),ot(e+7,l-4,"#4A98D8",.25),ot(e+12,l+1,"#4CAF50",.4),L(e+12,l+2,2,3,"#586878"),L(e+10,l+4,6,1,"#8898A8"),L(e+6,l+4,12,4,"#222228"),L(e+6,l+4,12,1,"#333338",.4);for(let r=0;r<5;r++)ot(e+7+r*2,l+5,"#444",.6),ot(e+7+r*2,l+6,"#3A3A3E",.4);L(e+20,l+5,3,4,"#333338"),L(e+20,l+5,3,1,"#444448"),L(e+1,l+3,4,4,"#F0EDE8"),L(e+1,l+3,4,1,"#F8F6F2"),ot(e+2,l+5,"#6D4C41")}function Ma(e,l,r){L(e+1,l+9,10,2,da,.1),ot(e+5,l+9,"#1E1E22"),ot(e+1,l+10,"#1A1A1E"),ot(e+9,l+10,"#1A1A1E"),ot(e+3,l+11,"#1A1A1E"),ot(e+7,l+11,"#1A1A1E"),L(e+1,l+2,8,6,Ul.base),L(e+2,l+3,6,4,Ul.hi,.35),L(e+2,l+3,6,1,Qt(Ul.hi,.5),.25),L(e+1,l+7,8,1,Ul.deep),r==="up"?(L(e,l+7,10,3,Ul.deep),L(e+1,l+8,8,1,Ul.sh)):(L(e,l-1,10,3,Ul.deep),L(e+1,l,8,1,Ul.sh)),L(e,l+3,1,4,Ul.sh),L(e+9,l+3,1,4,Ul.sh)}const _g={bookshelf:(e,l,r)=>zE(e,l,r.accent),plant:(e,l)=>ME(e,l),"meeting-table":(e,l)=>RE(e,l),sofa:(e,l)=>FE(e,l),"coffee-table":(e,l)=>_E(e,l),"coffee-machine":(e,l)=>OE(e,l),window:(e,l,r)=>SE(e,l,r.windowW??16,r.windowH??14),picture:(e,l,r)=>CE(e,l,r.pictureColor??"#1565C0"),clock:(e,l)=>EE(e,l),whiteboard:(e,l)=>NE(e,l),"bulletin-board":(e,l)=>AE(e,l),shelf:(e,l)=>DE(e,l),screen:(e,l)=>TE(e,l)};function Di(e,l){const r=e.zone==="wall"?l.wx:l.fx,i=e.zone==="wall"?l.wy:l.fy;return{x:e.anchorX==="right"?(e.zone==="wall"?l.wx+l.ww:l.fx+l.fw)+e.offsetX:r+e.offsetX,y:i+e.offsetY}}function $E(e){for(const l of e.wallDecorations){const r=e.rooms[l.room];if(!r)continue;const{x:i,y:c}=Di(l,r),u=_g[l.type];u&&u(i,c,l)}}function LE(e,l,r){for(const i of e.furniture){const c=e.rooms[i.room];if(!c||i.condition==="no-desks"&&r.has(i.room))continue;const{x:u,y:d}=Di(i,c),m=_g[i.type];m&&l.push({y:d,draw:()=>m(u,d,i)})}}function ra(e){const l=[],r=[...e.wallDecorations,...e.furniture];for(const i of r){if(!i.facility)continue;const c=e.rooms[i.room];if(!c)continue;const{x:u,y:d}=Di(i,c);l.push({id:i.facility.id,label:i.facility.label,icon:i.facility.icon,color:i.facility.color,dx:u,dy:d,pw:i.facility.hitW,ph:i.facility.hitH})}return l}const HE={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 ch(e){return HE[e]??{w:16,h:16}}function Lf(e,l,r,i){for(let c=e.furniture.length-1;c>=0;c--){const u=e.furniture[c],d=e.rooms[u.room];if(!d||u.condition==="no-desks"&&i.has(u.room))continue;const{x:m,y:x}=Di(u,d),f=ch(u.type);if(l>=m&&l<=m+f.w&&r>=x&&r<=x+f.h)return u.id}for(let c=e.wallDecorations.length-1;c>=0;c--){const u=e.wallDecorations[c],d=e.rooms[u.room];if(!d)continue;const{x:m,y:x}=Di(u,d),f=ch(u.type);if(l>=m&&l<=m+f.w&&r>=x&&r<=x+f.h)return u.id}return null}function I0(e,l,r,i,c){const d=[...l.wallDecorations,...l.furniture].find(y=>y.id===r);if(!d||d.condition==="no-desks"&&c.has(d.room))return;const m=l.rooms[d.room];if(!m)return;const{x,y:f}=Di(d,m),g=ch(d.type);e.save(),e.fillStyle=i,e.globalAlpha=.2,e.fillRect(x-1,f-1,g.w+2,g.h+2),e.globalAlpha=.9,e.strokeStyle=i,e.lineWidth=1,e.strokeRect(x-.5,f-.5,g.w+1,g.h+1),e.restore()}function U0(e,l,r,i){e.save(),e.fillStyle=i,e.globalAlpha=.2,e.fillRect(l-1,r-1,28,42),e.globalAlpha=.9,e.strokeStyle=i,e.lineWidth=1,e.strokeRect(l-.5,r-.5,27,41),e.restore()}function Y0(e,l,r){for(const[i,c]of Object.entries(e))if(l>=c.dx&&l<=c.dx+26&&r>=c.dy&&r<=c.dy+40)return i;return null}const IE=[{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:"🖥️"}],Cc=16,UE=4,za=4,Rc=2,Ct=4,ia=4;let Ue=Mg(7);const Yc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};let Dl=ra(Ue);function Og(e){return{x:e.dx,y:e.dy,w:e.pw,h:e.ph}}function Bg(e){return{cx:e.dx+e.pw/2,botY:e.dy+e.ph}}let en={};function YE(e){const l={};for(let r=0;r<e.length&&r<Ue.desks.length;r++)l[e[r]]=Ue.desks[r];return l}let Xt,_a=null,Ra=null,pr=!1,Tl=null,sl=null,An=null,mn=null,ji=null,Yl=null;function qE(e,l){const{wx:r,wy:i,ww:c,wh:u,wallColor:d,baseboardColor:m}=e,x=Gl(d,.5),f=Qt(d,.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){L(y.sx,i,y.sw,u,d);for(let b=0;b<u;b+=4)L(y.sx,i+b,y.sw,1,f,.08),L(y.sx,i+b+2,y.sw,1,x,.05);Mi(Math.round(y.sx*7+i*13));for(let b=0;b<y.sw;b+=3)Vl()>.4&&L(y.sx+b,i,1,u,f,.04);L(y.sx,i,y.sw,2,f,.3),L(y.sx,i,y.sw,1,Qt(d,1),.2),L(y.sx,i+u-2,y.sw,2,x,.3),L(y.sx,i+u,y.sw,Rc,m),L(y.sx,i+u,y.sw,1,Qt(m,.5),.4)}l&&(L(l.x-1,i,1,u+Rc,"#4A3828"),L(l.x+l.w,i,1,u+Rc,"#4A3828"),L(l.x,i,l.w,1,"#0A0808",.12)),L(e.fx,e.fy,e.fw,3,"#0A0808",.12),L(e.fx,e.fy+3,e.fw,2,"#0A0808",.06)}function XE(e){const l="#504038",r=Gl(l,.5),i=Qt(l,.5),c=e.wx-ia,u=e.wy,d=e.wh+Rc+e.fh;L(c,u,ia,d,l),L(c,u,1,d,i,.3),L(c+ia-1,u,1,d,r,.4);for(let x=0;x<d;x+=6)L(c+1,u+x,ia-2,1,i,.06);const m=e.wx+e.ww;L(m,u,ia,d,l),L(m,u,1,d,i,.2),L(m+ia-1,u,1,d,r,.3)}function Hf(e){const{fx:l,fy:r,fw:i,fh:c}=e,u="#B08040",d="#C89848",m="#8A6030",x="#6A4820";L(l,r,i,c,u),Mi(42);for(let f=0;f<c;f+=5){const g=Math.floor(f/5)%2*10;for(let y=-10;y<i+10;y+=20){const b=l+y+g,v=Math.max(l,b),S=Math.min(b+19,l+i)-v;if(S<=0)continue;const j=Vl()>.5?d:u;L(v,r+f,S,4,j,.25),L(v,r+f,S,1,d,.3),L(v,r+f+4,S,1,x,.35),b>=l&&b<l+i&&L(b,r+f,1,4,x,.2),L(v,r+f+2,S,1,m,.1)}}L(l,r,i,2,"#0A0808",.08),L(l,r,2,c,"#0A0808",.06)}function q0(e){const{fx:l,fy:r,fw:i,fh:c}=e,u="#1C2A38",d="#101820";Mi(99),L(l,r,i,c,u);for(let m=0;m<c;m+=Cc)for(let x=0;x<i;x+=Cc){const f=Math.min(Cc,i-x),g=Math.min(Cc,c-m);Vl()>.5&&L(l+x,r+m,f,g,Qt(u,.2),.15),L(l+x+2,r+m+2,f-4,g-4,Qt(u,.3),.08),L(l+x,r+m,f,1,d,.5),L(l+x,r+m,1,g,d,.5),L(l+x+1,r+m+1,1,g-1,Qt(u,.4),.1),Vl()>.85&&ot(l+x+4+Math.floor(Vl()*8),r+m+4+Math.floor(Vl()*8),"#3A6A9A",.08)}}function VE(e){const{fx:l,fy:r,fw:i,fh:c}=e,u="#387848",d="#4A9058",m="#285E38";L(l,r,i,c,u),Mi(77);for(let f=0;f<c;f+=2)for(let g=0;g<i;g+=2)Vl()>.5&&ot(l+g,r+f,d,.1),Vl()>.8&&ot(l+g+1,r+f+1,m,.12);const x=5;L(l+x,r+x,i-x*2,1,d,.45),L(l+x,r+c-x-1,i-x*2,1,m,.45),L(l+x,r+x,1,c-x*2,d,.35),L(l+i-x-1,r+x,1,c-x*2,m,.35)}function GE(e){const{fx:l,fy:r,fw:i,fh:c}=e,u="#D8C490",d="#B09060",m="#907848";Mi(55);for(let x=0;x<c;x+=8)for(let f=0;f<i;f+=8){const g=Math.min(8,i-f),y=Math.min(8,c-x),b=(f/8+x/8)%2===0?d:u;L(l+f,r+x,g,y,b),L(l+f+1,r+x+1,g-2,1,Qt(b,.4),.2),L(l+f+1,r+x+1,1,y-2,Qt(b,.4),.15),L(l+f+g-2,r+x+2,1,y-3,Gl(b,.4),.15),L(l+f+2,r+x+y-2,g-3,1,Gl(b,.4),.15),L(l+f,r+x,g,1,m,.3),L(l+f,r+x,1,y,m,.3)}}function KE(){const{canvasW:e,canvasH:l,rooms:r,doors:i}=Ue,c="#2A1E14",u="#3A2E24";if(L(0,0,e,za,c),L(0,l-za,e,za,c),L(0,0,za,l,c),L(e-za,0,za,l,c),L(0,0,e,1,u,.3),L(0,0,1,l,u,.2),!r.exec||!r.work||!r.meet||!r.comm)return;const d=r.exec,m=r.meet,x=e/2,f=x-Ct/2,g=d.fy+d.fh,y=i.exec_work,b=i.meet_comm,v=i.exec_meet,S=i.work_comm,j=24,C=28,E=((y==null?void 0:y.doorY)??d.fy+20)-j/2,N=((v==null?void 0:v.doorX)??za+ia+54)-C/2,z=((S==null?void 0:S.doorX)??x+Ct/2+ia+54)-C/2,O=((b==null?void 0:b.doorY)??m.fy+20)-j/2;L(0,g,N,Ct,c),L(N+C,g,f-N-C,Ct,c),L(f+Ct,g,z-f-Ct,Ct,c),L(z+C,g,e-z-C,Ct,c),L(0,g,N,1,u,.3),L(N+C,g,f-N-C,1,u,.3),L(f+Ct,g,z-f-Ct,1,u,.3),L(z+C,g,e-z-C,1,u,.3),L(f,0,Ct,E,c),L(f,E+j,Ct,g-E-j,c),L(f,g+Ct,Ct,O-g-Ct,c),L(f,O+j,Ct,l-O-j,c),L(f,0,1,E,u,.2),L(f,E+j,1,g-E-j,u,.2),L(f,g+Ct,1,O-g-Ct,u,.2),L(f,O+j,1,l-O-j,u,.2),L(f,E,Ct,j,"#C4A070"),L(f+Ct/2,E,Ct/2,j,"#3A4858"),L(f,O,Ct,j,"#7AA880"),L(f+Ct/2,O,Ct/2,j,"#C8B890");const I="#4A3828";L(f,E-1,Ct,1,I),L(f,E+j,Ct,1,I),L(N-1,g,1,Ct,I),L(N+C,g,1,Ct,I),L(z-1,g,1,Ct,I),L(z+C,g,1,Ct,I),L(f,O-1,Ct,1,I),L(f,O+j,Ct,1,I)}const X0=new Map;function WE(e){const l=`${e.hairStyle??""}|${e.outfitStyle??""}|${e.accessory??""}`;let r=X0.get(l);if(!r){const i=nh("mini-seated:default"),c=fg(i,e);r=c?c.layers.flatMap(u=>u.pixels):[],X0.set(l,r)}return r}function QE(e,l,r){lh(Xt,WE(r),e,l,r)}function ZE(e,l,r,i,c){Ma(e+8,l+20,"up"),c||QE(e+8,l+0+i,r),BE(e,l+14)}function JE(e,l,r,i,c){const u=i in B0?i:"down",d=c%4,m=B0[u][d];lh(Xt,m,e,l,r);const x=d===1||d===3?-1:0;if(r.accessory&&r.accessory!=="none"){const f=Oj(r.accessory,u);f&&f.pixels.length>0&&lh(Xt,f.pixels,e,l+x,r)}Xt.globalAlpha=1}function PE(e){const l={};let r=0;for(const i of e){const c=en[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 Xs(e,l,r,i,c){const u=Ue.corridorY[c]??l,d=[];return l<u-4&&d.push({x:e,y:u}),Math.abs(e-r)>4&&d.push({x:r,y:u}),d.push({x:r,y:i}),d}function If(e,l,r,i){const c=Ue.adjacency[r];if(!c)return[];const u=c.find(g=>g.room===i);if(!u)return[];const d=Ue.doors[u.door];if(!d)return[];const m=[],x=Ue.corridorY[r]??l,f=Ue.corridorY[i]??l;if(Math.abs(l-x)>4&&m.push({x:e,y:x}),d.type==="v"){const g=u.side==="A"?d.xA:d.xB,y=u.side==="A"?d.xB:d.xA;m.push({x:g,y:x}),m.push({x:g,y:d.doorY}),m.push({x:y,y:d.doorY}),m.push({x:y,y:f})}else{const g=u.side==="A"?d.yA:d.yB,y=u.side==="A"?d.yB:d.yA;m.push({x:d.doorX,y:x}),m.push({x:d.doorX,y:g}),m.push({x:d.doorX,y}),m.push({x:d.doorX,y:f})}return m}function $g(e,l){const r=Ue.adjacency[e.room];if(!r)return[];if(!r.find(c=>c.room===l)){for(const c of r){const u=Ue.adjacency[c.room];if(u!=null&&u.find(d=>d.room===l)){const d=If(e.x,e.y,e.room,c.room),m=d[d.length-1],x=If((m==null?void 0:m.x)??e.x,(m==null?void 0:m.y)??e.y,c.room,l);return[...d,...x]}}return[]}return If(e.x,e.y,e.room,l)}function eN(e){if(e.room!==e.homeRoom){const l=$g({...e},e.homeRoom),r=l[l.length-1],i=Xs((r==null?void 0:r.x)??e.x,(r==null?void 0:r.y)??e.y,e.homeX,e.homeY,e.homeRoom);return[...l,...i]}return Xs(e.x,e.y,e.homeX,e.homeY,e.room)}function tN(e,l){for(const[,r]of Object.entries(e))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(Ue.rooms);if(Math.random()<.25&&i.length>1){const c=i.filter(x=>x!==r.room),u=c[Math.floor(Math.random()*c.length)],d=$g(r,u),m=Ue.waypoints[u];if(m&&m.length>0){const x=m[Math.floor(Math.random()*m.length)],f=d[d.length-1]??{x:r.x,y:r.y},g=Xs(f.x,f.y,x.x,x.y,u);r.path=[...d,...g]}else r.path=d;r.walkTimer=0}else{const c=Ue.waypoints[r.room];if(c&&c.length>0){const u=c[Math.floor(Math.random()*c.length)];r.path=Xs(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,d=Math.sqrt(c*c+u*u);if(d<1.5){r.x=i.x,r.y=i.y,r.path.shift();for(const[m,x]of Object.entries(Ue.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/d*.2,r.y+=u/d*.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=Ue.waypoints[r.room];if(i&&i.length>0){const c=i[Math.floor(Math.random()*i.length)];r.path=Xs(r.x,r.y,c.x,c.y,r.room)}r.walkTimer=0}else r.state="returning",r.path=eN(r),r.walkTimer=0}function nN(e,l,r){const{canvasW:i,canvasH:c,rooms:u}=Ue;Xt.clearRect(0,0,i,c),L(0,0,i,c,"#2A1E14");const d={wood:Hf,dark:q0,carpet:VE,tile:GE};for(const y of Object.values(u))(d[y.floorType]??Hf)(y);const m=Object.keys(u);if(m.length>=4){const y=u.exec,b=u.meet,{doors:v}=Ue;if(y&&b&&v.exec_meet&&v.work_comm){const j=(v.exec_meet.doorX??0)-14,C=(v.work_comm.doorX??0)-28/2,E=y.fy+y.fh,N=b.fy;Hf({fx:j,fy:E,fw:28,fh:N-E}),q0({fx:C,fy:E,fw:28,fh:N-E})}}const x={};if(m.length>=4){const{doors:y}=Ue,b=28,v=y.exec_meet,S=y.work_comm;v!=null&&v.doorX&&(x.meet={x:v.doorX-b/2,w:b}),S!=null&&S.doorX&&(x.comm={x:S.doorX-b/2,w:b})}for(const y of Object.values(u))qE(y,x[y.id]),XE(y);KE(),$E(Ue);const f=[],g=new Set(Object.values(en).map(y=>y.room));LE(Ue,f,g);for(const[y,b]of Object.entries(en)){const v=e[y];if(!v)continue;const S=v.state==="sitting",j=l(y),C=r[y]==="working";f.push({y:b.dy+14,draw:()=>{if(ZE(b.dx,b.dy,j,S?v.bobY:0,!S),S&&C){const E=Yc[y]??"#388bfd";L(b.dx+7,b.dy+14-4,12,5,E,.15),ot(b.dx+12,b.dy+14+1,"#4CAF50",.8)}}})}for(const[y,b]of Object.entries(e))if(b.state!=="sitting"){const v=l(y);f.push({y:b.y+14,draw:()=>JE(Math.round(b.x),Math.round(b.y),v,b.dir,b.walkFrame)})}f.sort((y,b)=>y.y-b.y);for(const y of f)y.draw();for(const y of Dl){const b=Ra===y.id,v=Bg(y);if(Xt.save(),Xt.globalAlpha=b?.9:.5,Xt.fillStyle=y.color,Xt.fillRect(v.cx-1,v.botY-2,3,3),b){const S=Og(y);Xt.globalAlpha=.3,Xt.strokeStyle=y.color,Xt.lineWidth=1,Xt.strokeRect(S.x-1,S.y-1,S.w+2,S.h+2)}Xt.restore()}if(pr){const y=new Set(Object.values(en).map(b=>b.room));if(Tl&&Tl!==sl)if(Tl.startsWith("desk:")){const b=Tl.slice(5),v=en[b];v&&U0(Xt,v.dx,v.dy,"#FBBF24")}else I0(Xt,Ue,Tl,"#FBBF24",y);if(sl)if(sl.startsWith("desk:")){const b=sl.slice(5),v=en[b];v&&U0(Xt,v.dx,v.dy,"#3B82F6")}else I0(Xt,Ue,sl,"#3B82F6",y)}if(_a){const y=en[_a],b=e[_a];y&&b&&(Xt.save(),Xt.globalAlpha=.25,Xt.fillStyle=Yc[_a]??"#fff",b.state==="sitting"?Xt.fillRect(y.dx-1,y.dy+6,28,30):Xt.fillRect(Math.round(b.x)-1,Math.round(b.y)-1,14,24),Xt.restore())}}function lN({roles:e,projects:l,roleStatuses:r,activeExecs:i,onRoleClick:c,onProjectClick:u,onBulletinClick:d,onDecisionsClick:m,onKnowledgeClick:x,onSettingsClick:f,onThemeClick:g,onStatsClick:y,getRoleSpeech:b,getAppearance:v,onHireClick:S,roleLevels:j}){const C=k.useRef(null),E=k.useRef(null),N=k.useRef(null),z=k.useRef({}),O=k.useRef(0),I=k.useRef(UE),[_,q]=k.useState(!1),[W,Y]=k.useState(null),[T,$]=k.useState(null),B=k.useRef({}),G=k.useRef({}),ne=k.useRef([]),V=k.useRef([]);k.useEffect(()=>{pr=_},[_]),k.useEffect(()=>{ji=W,Yl=T},[W,T]),k.useEffect(()=>{Ce.getPreferences().then(he=>{const ye=he.furnitureOverrides;ye&&Object.keys(ye).length>0&&(B.current=ye,Ue=$0(Ue,ye));const ge=he.deskOverrides;if(ge&&Object.keys(ge).length>0){G.current=ge,L0(en,ge);for(const[ze,Te]of Object.entries(en)){const Ne=z.current[ze];Ne&&(Ne.homeX=Te.dx+8,Ne.homeY=Te.dy+34)}}const Le=he.removedFurniture;Le&&Le.length>0&&(ne.current=Le,Ue=$f(Ue,Le));const Ee=he.addedFurniture;Ee&&Ee.length>0&&(V.current=Ee,Ue=H0(Ue,Ee)),Dl=ra(Ue)}).catch(()=>{})},[]);const U=k.useRef({roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v});U.current={roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v};const J=k.useMemo(()=>e.map(he=>he.id),[e]),ie=k.useRef(Ue);k.useEffect(()=>{const he=J.length,ye=zg(he,ie.current.preset);let ge=Mg(he,ye);ne.current.length>0&&(ge=$f(ge,ne.current)),V.current.length>0&&(ge=H0(ge,V.current)),Object.keys(B.current).length>0&&(ge=$0(ge,B.current)),Ue=ge,ie.current=ge,en=YE(J),Object.keys(G.current).length>0&&L0(en,G.current),Dl=ra(ge),z.current=PE(J);const Le=C.current;Le&&(Le.width=ge.canvasW,Le.height=ge.canvasH),R()},[J]);const je=k.useCallback(he=>{var ye,ge;return((ge=(ye=U.current).getAppearance)==null?void 0:ge.call(ye,he))??Bh(he)},[]),R=k.useCallback(()=>{const he=E.current,ye=C.current;if(!he||!ye)return;const ge=he.parentElement;if(!ge)return;const Le=ge.clientWidth,Ee=ge.clientHeight;if(Le===0||Ee===0)return;const{canvasW:ze,canvasH:Te}=Ue;let Ne=Math.floor(Math.min(Le/ze,Ee/Te));Ne=Math.max(2,Math.min(Ne,5)),I.current=Ne,ye.style.width=ze*Ne+"px",ye.style.height=Te*Ne+"px",he.style.width=ze*Ne+"px",he.style.height=Te*Ne+"px"},[]);k.useEffect(()=>{var Te;const he=C.current;if(!he)return;const ye=he.getContext("2d");if(!ye)return;Xt=ye,jE(ye),R();const ge=new ResizeObserver(()=>R()),Le=(Te=E.current)==null?void 0:Te.parentElement;Le&&ge.observe(Le);let Ee;const ze=()=>{O.current++,tN(z.current,O.current),nN(z.current,je,U.current.roleStatuses),M(),Ee=requestAnimationFrame(ze)};return Ee=requestAnimationFrame(ze),()=>{cancelAnimationFrame(Ee),ge.disconnect()}},[je,R]),k.useEffect(()=>{var Le;const he=N.current;if(!he)return;he.innerHTML="";const ye={};for(const Ee of e)ye[Ee.id]=Ee.name;for(const Ee of J){const ze=Yc[Ee]??"#8b949e",Te=ye[Ee],Ne=Te&&Te.toLowerCase()!==Ee.toLowerCase()?`${Ee.toUpperCase()} · ${Te}`:Ee.toUpperCase(),Ie=document.createElement("div");Ie.className="td-nametag",Ie.dataset.role=Ee;const Ge=document.createElement("span");Ge.className="td-dot",Ge.style.background=ze,Ie.appendChild(Ge),Ie.appendChild(document.createTextNode(Ne));const Dt=((Le=j==null?void 0:j[Ee])==null?void 0:Le.level)??1;if(Dt>1){const Ot=document.createElement("span");Ot.className="td-lvl",Ot.textContent=`Lv.${Dt}`,Ie.appendChild(Ot)}he.appendChild(Ie);const ct=document.createElement("div");ct.className="td-bubble",ct.dataset.role=Ee,ct.dataset.type="bubble",he.appendChild(ct)}const ge={meeting:()=>{const Ee=l[0];Ee?u(Ee.id):d()},bulletin:d,decisions:m,knowledge:x,settings:f,theme:g,stats:y};for(const Ee of Dl){const ze=document.createElement("div");ze.className="td-facility-label",ze.dataset.facility=Ee.id,ze.textContent=`${Ee.icon} ${Ee.label}`,ze.style.borderColor=`${Ee.color}44`;const Te=ge[Ee.id];Te&&ze.addEventListener("click",Te),ze.addEventListener("mouseenter",()=>{Ra=Ee.id}),ze.addEventListener("mouseleave",()=>{Ra=null}),he.appendChild(ze)}},[J,e,l,u,d,m,x,f,g,y,j]);const M=k.useCallback(()=>{var Te;const he=N.current;if(!he)return;const ye=I.current,ge=z.current,{getRoleSpeech:Le,roleStatuses:Ee,activeExecs:ze}=U.current;for(const Ne of Object.keys(ge)){const Ie=ge[Ne],Ge=en[Ne];if(!Ge)continue;let Dt,ct,Ot;Ie.state==="sitting"?(Dt=Ge.dx+13,Ot=Ge.dy+2,ct=Ge.dy+37):(Dt=Math.round(Ie.x)+6,Ot=Math.round(Ie.y)-2,ct=Math.round(Ie.y)+18);const se=Dt/Ue.canvasW*100,be=he.querySelector(`.td-nametag[data-role="${Ne}"]`);if(be){be.style.left=se+"%",be.style.top=ct*ye+2+"px";const _e=be.querySelector(".td-dot");if(_e){const xe=Ee[Ne]==="working";_e.style.background=xe?"#FBBF24":Yc[Ne]??"#8b949e",xe?_e.style.animation="td-pulse 1s ease-in-out infinite":_e.style.animation=""}}const Re=he.querySelector(`.td-bubble[data-role="${Ne}"]`);if(Re){const _e=Ee[Ne]==="working",xe=(Te=ze.find(Pe=>Pe.roleId===Ne))==null?void 0:Te.task,De=Le(Ne),vt=_e&&xe?xe.slice(0,60):De?De.slice(0,60):"";vt&&Ie.state==="sitting"?(Re.style.display="",Re.style.left=se+"%",Re.style.top=(Ot-10)*ye+"px",Re.textContent=vt):Re.style.display="none"}}for(const Ne of Dl){const Ie=he.querySelector(`.td-facility-label[data-facility="${Ne.id}"]`);if(Ie){const Ge=Bg(Ne);Ie.style.left=Ge.cx/Ue.canvasW*100+"%",Ie.style.top=Ge.botY*ye-4+"px",Ie.classList.toggle("td-facility-label--hover",Ra===Ne.id)}}},[]),K=k.useCallback(he=>{const ye=C.current;if(!ye)return null;const ge=ye.getBoundingClientRect(),Le=I.current,Ee=(he.clientX-ge.left)/Le,ze=(he.clientY-ge.top)/Le,Te=z.current;for(const[Ne,Ie]of Object.entries(en)){if(!Te[Ne])continue;const Ge=Te[Ne];if(Ge.state==="sitting"){if(Ee>=Ie.dx&&Ee<=Ie.dx+26&&ze>=Ie.dy&&ze<=Ie.dy+40)return{type:"role",id:Ne}}else if(Ee>=Ge.x-2&&Ee<=Ge.x+14&&ze>=Ge.y-2&&ze<=Ge.y+20)return{type:"role",id:Ne}}for(const Ne of Dl){const Ie=Og(Ne);if(Ee>=Ie.x&&Ee<=Ie.x+Ie.w&&ze>=Ie.y&&ze<=Ie.y+Ie.h)return{type:"facility",id:Ne.id}}return null},[]),D=k.useCallback(he=>{const ye=C.current;if(!ye)return{mx:0,my:0};const ge=ye.getBoundingClientRect(),Le=I.current;return{mx:(he.clientX-ge.left)/Le,my:(he.clientY-ge.top)/Le}},[]),de=k.useCallback(he=>{Ce.updatePreferences(he).catch(()=>{})},[]),Se=k.useCallback(he=>{const ye=[...ne.current,he];ne.current=ye,Ue=$f(Ue,[he]),Dl=ra(Ue),sl=null,Tl=null,de({removedFurniture:ye})},[de]),ve=k.useCallback((he,ye)=>{if(!ji||!Yl)return;let ge=null;for(const[Ie,Ge]of Object.entries(Ue.rooms)){const Dt=Yl==="wall"?Ge.wx:Ge.fx,ct=Yl==="wall"?Ge.wy:Ge.fy,Ot=Yl==="wall"?Ge.ww:Ge.fw,se=Yl==="wall"?Ge.wh:Ge.fh;if(he>=Dt&&he<=Dt+Ot&&ye>=ct&&ye<=ct+se){ge=Ie;break}}if(!ge)return;const Le=Ue.rooms[ge],Ee=Yl==="wall"?Le.wx:Le.fx,ze=Yl==="wall"?Le.wy:Le.fy,Te={id:`user-${ji}-${Date.now()}`,type:ji,room:ge,zone:Yl,offsetX:Math.round(he-Ee),offsetY:Math.round(ye-ze)},Ne=[...V.current,Te];V.current=Ne,Yl==="wall"?Ue.wallDecorations.push(Te):Ue.furniture.push(Te),Dl=ra(Ue),de({addedFurniture:Ne}),Y(null),$(null)},[de]),Fe=k.useCallback(he=>{const ye=C.current;if(pr&&An){const{mx:Le,my:Ee}=D(he),Te=[...Ue.furniture,...Ue.wallDecorations].find(Ge=>Ge.id===An.defId);if(!Te)return;const Ne=Le-An.startMx,Ie=Ee-An.startMy;Te.offsetX=Math.round(An.origOffX+Ne),Te.offsetY=Math.round(An.origOffY+Ie),Dl=ra(Ue),ye&&(ye.style.cursor="grabbing");return}if(pr&&mn){const{mx:Le,my:Ee}=D(he),ze=en[mn.roleId];if(!ze)return;ze.dx=Math.round(mn.origDx+(Le-mn.startMx)),ze.dy=Math.round(mn.origDy+(Ee-mn.startMy));const Te=z.current[mn.roleId];Te&&(Te.homeX=ze.dx+8,Te.homeY=ze.dy+34),ye&&(ye.style.cursor="grabbing");return}if(pr){const{mx:Le,my:Ee}=D(he);if(ji){ye&&(ye.style.cursor="crosshair");return}const ze=new Set(Object.values(en).map(Ne=>Ne.room)),Te=Lf(Ue,Le,Ee,ze);if(Te)Tl=Te;else{const Ne=Y0(en,Le,Ee);Tl=Ne?`desk:${Ne}`:null}_a=null,Ra=null,ye&&(ye.style.cursor=Tl?"grab":"default");return}const ge=K(he);_a=(ge==null?void 0:ge.type)==="role"?ge.id:null,Ra=(ge==null?void 0:ge.type)==="facility"?ge.id:null,Tl=null,ye&&(ye.style.cursor=ge?"pointer":"default")},[K,D]),Me=k.useCallback(he=>{if(!pr)return;const{mx:ye,my:ge}=D(he);if(ji){ve(ye,ge),he.preventDefault();return}const Le=new Set(Object.values(en).map(Te=>Te.room)),Ee=Lf(Ue,ye,ge,Le);if(Ee){const Ne=[...Ue.furniture,...Ue.wallDecorations].find(Ie=>Ie.id===Ee);Ne&&(sl=Ee,An={defId:Ee,startMx:ye,startMy:ge,origOffX:Ne.offsetX,origOffY:Ne.offsetY},he.preventDefault());return}const ze=Y0(en,ye,ge);if(ze){const Te=en[ze];sl=`desk:${ze}`,mn={roleId:ze,startMx:ye,startMy:ge,origDx:Te.dx,origDy:Te.dy},he.preventDefault();return}sl=null},[D,ve]),$e=k.useCallback(he=>{if(An){const ge=[...Ue.furniture,...Ue.wallDecorations].find(Le=>Le.id===An.defId);if(ge){const Le={...B.current,[ge.id]:{offsetX:ge.offsetX,offsetY:ge.offsetY}};B.current=Le,de({furnitureOverrides:Le}),Dl=ra(Ue)}An=null,C.current&&(C.current.style.cursor="grab");return}if(mn){const ye=en[mn.roleId];if(ye){const ge={...G.current,[mn.roleId]:{dx:ye.dx,dy:ye.dy}};G.current=ge,de({deskOverrides:ge})}mn=null,C.current&&(C.current.style.cursor="grab")}},[de]),fe=k.useCallback(he=>{if(!pr)return;he.preventDefault();const{mx:ye,my:ge}=D(he),Le=new Set(Object.values(en).map(ze=>ze.room)),Ee=Lf(Ue,ye,ge,Le);Ee&&Se(Ee)},[D,Se]);k.useEffect(()=>{const he=ye=>{!pr||!sl||(ye.key==="Delete"||ye.key==="Backspace")&&(sl.startsWith("desk:")||Se(sl))};return window.addEventListener("keydown",he),()=>window.removeEventListener("keydown",he)},[Se]);const tt=k.useCallback(()=>{if(An){const ye=[...Ue.furniture,...Ue.wallDecorations].find(ge=>ge.id===An.defId);ye&&(ye.offsetX=An.origOffX,ye.offsetY=An.origOffY,Dl=ra(Ue)),An=null}if(mn){const he=en[mn.roleId];he&&(he.dx=mn.origDx,he.dy=mn.origDy);const ye=z.current[mn.roleId];ye&&(ye.homeX=he.dx+8,ye.homeY=he.dy+34),mn=null}_a=null,Ra=null,Tl=null,C.current&&(C.current.style.cursor="default")},[]),mt=k.useCallback(he=>{if(pr)return;const ye=K(he);if(ye){if(ye.type==="role"){c(ye.id);return}switch(ye.id){case"meeting":{const ge=l[0];ge?u(ge.id):d();break}case"bulletin":d();break;case"decisions":m();break;case"knowledge":x();break;case"settings":f==null||f();break;case"theme":g==null||g();break;case"stats":y==null||y();break}}},[K,c,u,d,m,x,f,g,y]);return s.jsxs("div",{className:`td-scene${_?" td-scene--editing":""}`,children:[s.jsxs("div",{ref:E,className:"td-wrap",children:[s.jsx("canvas",{ref:C,width:Ue.canvasW,height:Ue.canvasH,className:"td-canvas",onClick:mt,onMouseDown:Me,onMouseUp:$e,onMouseMove:Fe,onMouseLeave:tt,onContextMenu:fe}),s.jsx("div",{ref:N,className:"td-overlay"})]}),_&&s.jsxs("div",{className:"td-edit-banner",children:[s.jsx("span",{className:"td-edit-banner__icon",children:"✎"})," EDIT MODE — Click DONE when finished"]}),s.jsxs("button",{className:`td-edit-btn${_?" td-edit-btn--active":""}`,onClick:()=>{q(he=>{const ye=!he;return ye||(Y(null),$(null)),ye}),sl=null,An=null,mn=null},title:_?"Exit Edit Mode":"Edit Furniture Layout",children:[s.jsx("span",{className:"td-edit-btn__icon",children:_?"✓":"✎"}),s.jsx("span",{className:"td-edit-btn__label",children:_?"DONE":"EDIT"})]}),_&&s.jsx("div",{className:"td-palette",children:IE.map(he=>s.jsx("button",{className:`td-palette__item${W===he.type?" td-palette__item--active":""}`,onClick:()=>{W===he.type?(Y(null),$(null)):(Y(he.type),$(he.zone))},title:he.label,children:s.jsx("span",{children:he.icon})},he.type))}),S&&s.jsxs("button",{className:"td-hire-btn",onClick:S,title:"Hire New Role",children:[s.jsx("span",{className:"td-hire-btn__icon",children:"+"}),s.jsx("span",{className:"td-hire-btn__label",children:"HIRE"})]})]})}function rN({role:e,appearance:l,onSave:r,onReset:i,onClose:c,theme:u,onThemeChange:d,onUpdateName:m,initialTab:x,characterOnly:f,speechSettings:g,onSpeechSettingsChange:y,language:b,onLanguageChange:v,roleLevel:S}){var $;const[j,C]=k.useState(x??"character"),[E,N]=k.useState({...l}),[z,O]=k.useState(e.name),[I,_]=k.useState(!1),q=k.useCallback(()=>N(Ci(S)),[S]),W=k.useCallback(()=>{const B=Bh(e.id);N({...B}),i()},[e.id,i]),Y=k.useCallback(async()=>{r(E);const B=z.trim();if(m&&B&&B!==e.name){_(!0);try{await m(e.id,B)}catch{}_(!1)}c()},[E,r,c,z,e.name,e.id,m]),T=s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsxs("span",{children:[e.id.toUpperCase()," –"]}),m?s.jsx("input",{value:z,onChange:B=>O(B.target.value),disabled:I,className:"customize-name-input",style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:4,color:"inherit",font:"inherit",padding:"2px 6px",flex:1,minWidth:0}}):s.jsx("span",{children:e.name})]});return s.jsx("div",{className:"customize-overlay",onClick:c,children:s.jsxs("div",{className:"customize-modal",onClick:B=>B.stopPropagation(),children:[s.jsxs("div",{className:"customize-header",children:[s.jsxs("div",{className:"customize-tabs",children:[s.jsx("button",{className:`customize-tab ${j==="character"?"active":""}`,onClick:()=>C("character"),children:"CHARACTER"}),!f&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:`customize-tab ${j==="office"?"active":""}`,onClick:()=>C("office"),children:"OFFICE THEME"}),s.jsx("button",{className:`customize-tab ${j==="settings"?"active":""}`,onClick:()=>C("settings"),children:"SETTINGS"})]})]}),s.jsx("button",{className:"customize-close",onClick:c,children:"X"})]}),j==="character"?s.jsx("div",{className:"customize-body",children:s.jsx(Cg,{roleId:e.id,appearance:E,onChange:N,onRandomize:q,onReset:W,label:T,roleLevel:S})}):j==="office"?s.jsx("div",{className:"customize-body",children:s.jsx("div",{className:"customize-themes",children:Object.entries(oa).map(([B,G])=>s.jsxs("button",{className:`customize-theme-card ${u===B?"active":""}`,onClick:()=>d(B),children:[s.jsxs("div",{className:"customize-theme-preview",style:{background:G.vars["--floor-light"],borderColor:G.vars["--pixel-border"]},children:[s.jsx("div",{style:{background:G.vars["--hud-bg"],height:8,borderBottom:`2px solid ${G.vars["--pixel-border"]}`}}),s.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1 p-1",children:[s.jsx("div",{style:{width:10,height:14,background:G.vars["--accent"],borderRadius:1}}),s.jsx("div",{style:{width:10,height:14,background:G.vars["--active-green"],borderRadius:1}}),s.jsx("div",{style:{width:10,height:14,background:G.vars["--idle-amber"],borderRadius:1}})]}),s.jsx("div",{style:{background:G.vars["--hud-bg"],height:6,borderTop:`2px solid ${G.vars["--pixel-border"]}`}})]}),s.jsxs("div",{className:"customize-theme-name",children:[G.icon," ",G.name]})]},B))})}):s.jsx("div",{className:"customize-body",children:s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,padding:"8px 0"},children:[s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),s.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(B=>s.jsxs("button",{onClick:()=>y==null?void 0:y({mode:B}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(g==null?void 0:g.mode)===B?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(g==null?void 0:g.mode)===B?"rgba(255,255,255,0.08)":"transparent",color:(g==null?void 0:g.mode)===B?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[s.jsx("div",{style:{fontWeight:600,marginBottom:2},children:B==="template"?"TEMPLATE":B==="llm"?"AI":"AUTO"}),s.jsx("div",{style:{fontSize:9,opacity:.7},children:B==="template"?"Static pool ($0)":B==="llm"?"LLM generated":"Detect engine"})]},B))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(g==null?void 0:g.intervalSec)??18,"s"]}),s.jsx("input",{type:"range",min:5,max:120,step:5,value:(g==null?void 0:g.intervalSec)??18,onChange:B=>y==null?void 0:y({intervalSec:Number(B.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"5s (frequent)"}),s.jsx("span",{children:"120s (rare)"})]})]}),(g==null?void 0:g.mode)!=="template"&&s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",(($=g==null?void 0:g.dailyBudgetUsd)==null?void 0:$.toFixed(2))??"1.00"]}),s.jsx("input",{type:"range",min:0,max:5,step:.25,value:(g==null?void 0:g.dailyBudgetUsd)??1,onChange:B=>y==null?void 0:y({dailyBudgetUsd:Number(B.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"$0 (unlimited)"}),s.jsx("span",{children:"$5.00/day"})]})]}),s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),s.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:B,label:G})=>s.jsx("button",{onClick:()=>v==null?void 0:v(B),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(b??"auto")===B?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(b??"auto")===B?"rgba(255,255,255,0.08)":"transparent",color:(b??"auto")===B?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:G},B))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]})]})}),j==="character"&&s.jsxs("div",{className:"customize-footer",children:[s.jsx("button",{className:"customize-btn customize-btn--cancel",onClick:c,children:"CANCEL"}),s.jsx("button",{className:"customize-btn customize-btn--save",onClick:Y,children:"SAVE"})]})]})})}function V0(e){if(e.length===0)return"";const l={};for(const{file:m}of e){const x=m.split("/"),f=x[0]==="."?x[1]??"root":x[0];(l[f]??(l[f]=[])).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 f=r[m]??m;if(x.length===1){const g=x[0].split("/").pop()??x[0];i.push(`${f}/${g}`)}else i.push(`${f} (${x.length} files)`)}const c=e.some(m=>m.status==="A"),u=e.some(m=>m.status==="M");return`${c&&!u?"add":"update"}: ${i.join(", ")}`}function G0(e){const l=Date.now()-new Date(e).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 aN({status:e,history:l,onClose:r,onSave:i,onLoadHistory:c,onRestore:u,saving:d,onDelegate:m,delegateRoleName:x}){const[f,g]=k.useState("save"),[y,b]=k.useState(""),[v,S]=k.useState(null),[j,C]=k.useState(!1),[E,N]=k.useState(null),z=k.useRef(null);k.useEffect(()=>{f==="history"&&c()},[f,c]),k.useEffect(()=>{var T;(T=z.current)==null||T.focus()},[]);const O=[...((e==null?void 0:e.modified)??[]).map(T=>({status:"M",file:T})),...((e==null?void 0:e.untracked)??[]).map(T=>({status:"A",file:T}))],I=k.useRef(!1);k.useEffect(()=>{!I.current&&O.length>0&&!y&&(b(V0(O)),I.current=!0)},[O.length]);const _=k.useCallback(()=>{b(V0(O))},[O]),q=async()=>{S(null),N(null);try{const T=await i(y||void 0);N(T),b("")}catch(T){S(T instanceof Error?T.message:"Save failed")}},W=async T=>{if(confirm(`Restore from commit ${T.slice(0,7)}? This creates a new commit with those files.`)){C(!0);try{await u(T),C(!1)}catch($){S($ instanceof Error?$.message:"Restore failed"),C(!1)}}};k.useEffect(()=>{const T=$=>{$.key==="Escape"&&r()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[r]);const Y=T=>{T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&q()};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),s.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[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:Y,children:[s.jsxs("div",{className:"px-5 py-3 flex items-center justify-between shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-lg font-black tracking-tight",children:"SAVE GAME"}),s.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:(e==null?void 0:e.branch)??""})]}),s.jsx("button",{onClick:r,className:"text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] cursor-pointer text-lg",children:"×"})]}),s.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["save","history"].map(T=>s.jsx("button",{onClick:()=>g(T),className:"flex-1 py-2 text-[11px] font-bold uppercase tracking-wider cursor-pointer",style:{background:f===T?"var(--hud-bg-alt)":"transparent",color:f===T?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:f===T?"2px solid var(--accent)":"2px solid transparent"},children:T==="save"?"SAVE":"HISTORY"},T))}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[f==="save"&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-[11px]",style:{color:"var(--terminal-text-secondary)"},children:O.length>0?s.jsxs("span",{style:{color:"var(--idle-amber)"},children:["* ",O.length," unsaved change",O.length>1?"s":""]}):s.jsx("span",{style:{color:"var(--active-green)"},children:"All changes saved"})}),O.length>0&&s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Changed Files"}),s.jsx("div",{className:"text-[11px] max-h-[160px] overflow-y-auto p-2 space-y-0.5",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)"},children:O.map(({status:T,file:$})=>s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{style:{color:T==="A"?"var(--active-green)":"var(--idle-amber)",width:"14px"},children:T}),s.jsx("span",{style:{color:"var(--terminal-text-secondary)"},children:$})]},$))})]}),O.length>0&&s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Save Message"}),s.jsxs("button",{onClick:_,className:"text-[9px] px-1.5 py-0.5 cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--accent)",fontFamily:"var(--pixel-font)"},title:"Auto-generate message from changes",children:["✨"," AUTO"]})]}),s.jsx("input",{ref:z,type:"text",value:y,onChange:T=>b(T.target.value),placeholder:"Auto-generated — edit if needed",className:"w-full px-3 py-2 text-[12px] outline-none",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"}})]}),O.length>0&&s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:q,disabled:d,className:"flex-1 py-2.5 text-[12px] font-black uppercase tracking-wider cursor-pointer disabled:opacity-50",style:{background:"var(--accent)",color:"#fff",border:"2px solid var(--accent)"},children:d?"SAVING...":e!=null&&e.hasRemote?"SAVE & PUSH":"SAVE"}),m&&s.jsxs("button",{onClick:()=>{const T=O.map($=>`${$.status} ${$.file}`).join(`
|
|
89
|
+
`);m(T)},disabled:d,className:"py-2.5 px-4 text-[11px] font-bold uppercase tracking-wider cursor-pointer disabled:opacity-50",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"2px solid var(--pixel-border)"},title:`Delegate to ${x??"AI role"} — they'll review, commit, push & merge`,children:["🤖"," ",(x==null?void 0:x.toUpperCase())??"DELEGATE"]})]}),O.length>0&&e&&!e.hasRemote&&s.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"Local save only — add a git remote to enable push"}),E&&s.jsxs("div",{className:"text-[11px] p-2",style:{background:"rgba(59,185,80,0.1)",border:"1px solid var(--active-green)",color:"var(--active-green)"},children:["Saved! ",E.filesChanged," file",E.filesChanged>1?"s":""," committed",E.pushed?" & pushed":"",E.pushError?` (push error: ${E.pushError})`:""]}),v&&s.jsx("div",{className:"text-[11px] p-2",style:{background:"rgba(211,47,47,0.1)",border:"1px solid #D32F2F",color:"#EF5350"},children:v}),(e==null?void 0:e.lastCommit)&&s.jsxs("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:["Last save: ",e.lastCommit.message," (",G0(e.lastCommit.date),")"]})]}),f==="history"&&s.jsxs(s.Fragment,{children:[l.length===0&&s.jsx("div",{className:"text-[11px] text-center py-8",style:{color:"var(--terminal-text-muted)"},children:"No save history"}),s.jsx("div",{className:"space-y-1",children:l.map(T=>s.jsxs("div",{className:"flex items-center justify-between py-2 px-3 group",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--accent)"},children:T.shortSha}),s.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--terminal-text)"},children:T.message})]}),s.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:G0(T.date)})]}),s.jsx("button",{onClick:()=>W(T.sha),disabled:j,className:"text-[10px] font-bold px-2 py-1 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--idle-amber)"},children:"LOAD"})]},T.sha))})]})]})]})]})}function iN({onClose:e}){const[l,r]=k.useState(null),[i,c]=k.useState(!0),[u,d]=k.useState(null);return k.useEffect(()=>{Ce.getCompanyStats().then(r).catch(m=>d(m.message)).finally(()=>c(!1))},[]),i?s.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading stats..."}):u||!l?s.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u||"Failed to load stats",s.jsx("button",{onClick:e,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]}):s.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:20},children:[s.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Company Stats"}),s.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]}),s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:20},children:[s.jsx(Ec,{label:"Roles",value:String(l.company.roleCount)}),s.jsx(Ec,{label:"Avg Level",value:`Lv.${l.company.avgLevel}`}),s.jsx(Ec,{label:"Total Tokens",value:l.company.formattedTokens}),s.jsx(Ec,{label:"Total Cost",value:`$${l.company.totalCostUsd.toFixed(2)}`})]}),s.jsx("h4",{style:{margin:"0 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Role Leaderboard"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[l.roles.map((m,x)=>s.jsx(sN,{role:m,rank:x+1},m.roleId)),l.roles.length===0&&s.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"8px 0"},children:"No role activity yet. Assign tasks to start leveling up!"})]}),Object.keys(l.byModel).length>0&&s.jsxs(s.Fragment,{children:[s.jsx("h4",{style:{margin:"20px 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Model Usage"}),s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:Object.entries(l.byModel).map(([m,x])=>s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"6px 10px",background:"rgba(255,255,255,0.03)",borderRadius:6,fontSize:12},children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.7)"},children:oN(m)}),s.jsxs("span",{style:{color:"rgba(255,255,255,0.5)"},children:["$",x.costUsd.toFixed(2)]})]},m))})]})]})}function Ec({label:e,value:l}){return s.jsxs("div",{style:{padding:"12px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[s.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.45)",marginBottom:4},children:e}),s.jsx("div",{style:{fontSize:18,fontWeight:600},children:l})]})}function sN({role:e,rank:l}){const r=["🥇","🥈","🥉"],i=l<=3?r[l-1]:`#${l}`;return s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:8},children:[s.jsx("span",{style:{fontSize:14,width:28,textAlign:"center",flexShrink:0},children:i}),s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:4},children:[s.jsx("span",{style:{fontSize:13,fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),s.jsxs("span",{style:{fontSize:12,color:K0(e.level),fontWeight:600,flexShrink:0,marginLeft:8},children:["Lv.",e.level]})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsx("div",{style:{flex:1,height:4,background:"rgba(255,255,255,0.08)",borderRadius:2,overflow:"hidden"},children:s.jsx("div",{style:{width:`${e.progress*100}%`,height:"100%",background:K0(e.level),borderRadius:2,transition:"width 0.3s ease"}})}),s.jsx("span",{style:{fontSize:10,color:"rgba(255,255,255,0.4)",flexShrink:0},children:e.formattedTokens})]})]})]})}function K0(e){return e>=9?"#FFD700":e>=7?"#C0A0FF":e>=5?"#4FC3F7":e>=3?"#81C784":"rgba(255,255,255,0.4)"}function oN(e){return e.includes("opus")?"Opus":e.includes("sonnet")?"Sonnet":e.includes("haiku")?"Haiku":e.split("-").slice(0,2).join(" ")}function cN({onClose:e,onSyncComplete:l}){const[r,i]=k.useState([]),[c,u]=k.useState([]),[d,m]=k.useState(!0),[x,f]=k.useState(null),[g,y]=k.useState(new Set),[b,v]=k.useState(null),[S,j]=k.useState(null),C=k.useCallback(async()=>{m(!0),v(null);try{const{roles:N}=await Ce.getSyncRoles();i(N);const z=N.filter(O=>O.source.sync!=="off");if(z.length===0){u([]),j(null);return}try{const O=await bl.syncCheck(z.map(_=>({roleId:_.roleId,sourceId:_.source.id,currentVersion:_.source.upstream_version??_.source.forked_at??"0.0.0"})));j(!0);const I=[];for(const _ of O.updates){if(!_.hasUpdate)continue;const q=z.find(B=>B.roleId===_.roleId);if(!q)continue;const{character:W}=await bl.syncPull(_.sourceId),Y=[];q.persona.trim()!==W.persona.trim()&&Y.push({field:"persona",local:q.persona.slice(0,120)+(q.persona.length>120?"...":""),upstream:W.persona.slice(0,120)+(W.persona.length>120?"...":"")});const T=JSON.stringify(q.authority),$=JSON.stringify(W.authority);T!==$&&Y.push({field:"authority",local:`${q.authority.autonomous.length} autonomous, ${q.authority.needsApproval.length} approval`,upstream:`${W.authority.autonomous.length} autonomous, ${W.authority.needsApproval.length} approval`}),Y.length>0&&I.push({roleId:_.roleId,roleName:q.name,sourceId:_.sourceId,currentVersion:_.currentVersion,latestVersion:_.latestVersion,fields:Y})}u(I)}catch{j(!1),u([])}}catch(N){v(N instanceof Error?N.message:"Failed to check for updates")}finally{m(!1)}},[]);k.useEffect(()=>{C()},[C]);const E=async N=>{f(N.roleId);try{const{character:z,version:O}=await bl.syncPull(N.sourceId);await Ce.applySyncUpdate({roleId:N.roleId,changes:{persona:z.persona,authority:z.authority},upstreamVersion:O}),y(I=>new Set(I).add(N.roleId)),l==null||l()}catch(z){v(z instanceof Error?z.message:"Failed to apply update")}finally{f(null)}};return s.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[s.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Role Sync"}),s.jsxs("div",{style:{display:"flex",gap:8},children:[s.jsx("button",{onClick:C,disabled:d,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:d?"wait":"pointer"},children:d?"Checking...":"Refresh"}),s.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),S===!1&&s.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,180,0,0.1)",borderRadius:6,color:"#FFB74D",fontSize:12,marginBottom:12},children:"Cloud API unreachable. Sync requires connection to api.tycono.ai."}),b&&s.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:b}),s.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Tracked roles: "}),s.jsx("span",{style:{fontWeight:500},children:r.length}),s.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Updates available: "}),s.jsx("span",{style:{fontWeight:500,color:c.length>0?"#4FC3F7":"rgba(255,255,255,0.7)"},children:c.filter(N=>!g.has(N.roleId)).length}),S===!0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),s.jsx("span",{style:{fontSize:11,color:"#81C784"},children:"Cloud connected"})]})]}),c.length===0&&!d&&s.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:r.length===0?"No roles with source tracking. Hire from the Store to enable sync.":"All roles are up to date!"}),c.map(N=>s.jsxs("div",{style:{marginBottom:12,padding:14,background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:14,fontWeight:500},children:N.roleName}),s.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.4)"},children:[N.sourceId," · v",N.currentVersion," → v",N.latestVersion]})]}),g.has(N.roleId)?s.jsx("span",{style:{fontSize:12,color:"#81C784"},children:"Applied ✓"}):s.jsx("button",{onClick:()=>E(N),disabled:x===N.roleId,style:{background:"#1565C0",border:"none",color:"white",borderRadius:6,padding:"5px 12px",fontSize:12,cursor:x===N.roleId?"wait":"pointer",opacity:x===N.roleId?.6:1},children:x===N.roleId?"Applying...":"Apply Update"})]}),N.fields.map(z=>s.jsxs("div",{style:{marginBottom:6,fontSize:12},children:[s.jsx("div",{style:{color:"rgba(255,255,255,0.5)",marginBottom:2,textTransform:"uppercase",fontSize:10,letterSpacing:.5},children:z.field}),s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},children:[s.jsxs("div",{style:{padding:"4px 8px",background:"rgba(255,100,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[s.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"LOCAL"}),s.jsx("br",{}),z.local]}),s.jsxs("div",{style:{padding:"4px 8px",background:"rgba(100,255,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[s.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"UPSTREAM"}),s.jsx("br",{}),z.upstream]})]})]},z.field))]},N.roleId)),r.length>0&&s.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Roles hired from the Store are tracked automatically. Set ",s.jsx("code",{style:{background:"rgba(255,255,255,0.06)",padding:"1px 4px",borderRadius:3},children:"sync: off"})," in role.yaml to stop tracking."]})]})}function uN({onClose:e}){const[l,r]=k.useState(null),[i,c]=k.useState(!0),[u,d]=k.useState(null),[m,x]=k.useState(null),f=k.useCallback(async()=>{c(!0),d(null);try{const N=await Ce.getGitStatus();r(N)}catch(N){d(N instanceof Error?N.message:"Failed to load git status")}finally{c(!1)}},[]);k.useEffect(()=>{f()},[f]);const g=async N=>{x(N.path);try{await Ce.deleteWorktree(N.path),await f()}catch(z){d(z instanceof Error?z.message:"Failed to remove worktree")}finally{x(null)}},y=async N=>{x(N);try{await Ce.deleteBranch(N),await f()}catch(z){d(z instanceof Error?z.message:"Failed to delete branch")}finally{x(null)}};if(i&&!l)return s.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading git status..."});if(u&&!l)return s.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u,s.jsx("button",{onClick:e,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]});if(!l)return null;const b=l.worktrees.filter(N=>N.status==="active"),v=l.worktrees.filter(N=>N.status==="pending-merge"),S=l.worktrees.filter(N=>N.status==="stale");function j(N){const z=N.split("/");if(z.length>1){const O=z[z.length-1],I=["cto","cbo","pm","engineer","designer","qa","data-analyst"];for(const _ of I)if(O.toLowerCase().includes(_))return _}return null}function C(N,z=40){return N.length<=z?N:"..."+N.slice(N.length-z+3)}function E(N){const z=Date.now()-new Date(N).getTime(),O=Math.floor(z/6e4);if(O<1)return"just now";if(O<60)return`${O}m ago`;const I=Math.floor(O/60);return I<24?`${I}h ago`:`${Math.floor(I/24)}d ago`}return s.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[s.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"GIT STATUS"}),s.jsxs("div",{style:{display:"flex",gap:8},children:[s.jsx("button",{onClick:f,disabled:i,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:i?"wait":"pointer"},children:i?"Checking...":"Refresh"}),s.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),u&&s.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:u}),s.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s.jsxs("div",{children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Branch: "}),s.jsx("span",{style:{fontWeight:500},children:l.currentBranch})]}),s.jsx("div",{children:l.unsavedCount>0&&s.jsxs("span",{style:{color:"#FFB74D",fontSize:12},children:[l.unsavedCount," unsaved"]})})]}),l.lastCommit&&s.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&&s.jsxs(s.Fragment,{children:[s.jsx(Nc,{label:"Active Worktrees",count:b.length}),b.map(N=>s.jsx(Uf,{wt:N,roleFromBranch:N.roleId||j(N.branch),truncatePath:C,timeAgo:E,removing:m===N.path,onRemove:()=>g(N),statusColor:"#4FC3F7",statusIcon:"📂"},N.path))]}),v.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(Nc,{label:"Pending Merge",count:v.length}),v.map(N=>s.jsx(Uf,{wt:N,roleFromBranch:N.roleId||j(N.branch),truncatePath:C,timeAgo:E,removing:m===N.path,onRemove:()=>g(N),statusColor:"#FFB74D",statusIcon:"⚠️"},N.path))]}),S.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(Nc,{label:"Stale",count:S.length}),S.map(N=>s.jsx(Uf,{wt:N,roleFromBranch:N.roleId||j(N.branch),truncatePath:C,timeAgo:E,removing:m===N.path,onRemove:()=>g(N),statusColor:"#ff6b6b",statusIcon:"🔴"},N.path))]}),l.staleBranches.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(Nc,{label:"Unmerged Branches",count:l.staleBranches.length}),l.staleBranches.map(N=>s.jsxs("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s.jsxs("div",{style:{fontSize:13},children:[s.jsx("span",{style:{color:"rgba(255,255,255,0.5)",marginRight:6},children:"⚠️"}),s.jsx("span",{style:{fontWeight:500},children:N})]}),s.jsx("button",{onClick:()=>y(N),disabled:m===N,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:"#ff6b6b",borderRadius:4,padding:"3px 8px",fontSize:10,cursor:m===N?"wait":"pointer",opacity:m===N?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5},children:m===N?"...":"DELETE"})]},N))]}),b.length===0&&v.length===0&&S.length===0&&l.staleBranches.length===0&&s.jsxs("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:["✓"," All clean. No active worktrees or stale branches."]}),l.lastMerge&&s.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Last merge: ",s.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:l.lastMerge.branch})," · ",l.lastMerge.roleId," · ",E(l.lastMerge.mergedAt)]})]})}function Nc({label:e,count:l}){return s.jsxs("h4",{style:{margin:"16px 0 8px",fontSize:11,fontWeight:600,color:"rgba(255,255,255,0.5)",textTransform:"uppercase",letterSpacing:1},children:[e," (",l,")"]})}function Uf({wt:e,roleFromBranch:l,truncatePath:r,timeAgo:i,removing:c,onRemove:u,statusColor:d,statusIcon:m}){return s.jsx("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsxs("div",{style:{fontSize:13,fontWeight:500,marginBottom:2},children:[s.jsx("span",{style:{marginRight:6},children:m}),e.branch,l&&s.jsx("span",{style:{marginLeft:8,fontSize:10,padding:"1px 6px",background:"rgba(255,255,255,0.08)",borderRadius:3,color:"rgba(255,255,255,0.6)",textTransform:"uppercase"},children:l})]}),e.task&&s.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.5)",marginBottom:2},children:['"',e.task.slice(0,50),e.task.length>50?"...":"",'"']}),s.jsxs("div",{style:{fontSize:10,color:"rgba(255,255,255,0.35)"},children:[r(e.path)," · ",e.filesChanged," file",e.filesChanged!==1?"s":""," changed"," · ",i(e.createdAt)]}),e.conflictFiles&&e.conflictFiles.length>0&&s.jsxs("div",{style:{fontSize:10,color:"#ff6b6b",marginTop:4},children:["⛔"," CONFLICT: ",e.conflictFiles.join(", ")]})]}),s.jsx("button",{onClick:u,disabled:c,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:d,borderRadius:4,padding:"3px 8px",fontSize:10,cursor:c?"wait":"pointer",opacity:c?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5,flexShrink:0,marginLeft:8},children:c?"...":"REMOVE"})]})})}function dN({onClose:e,speechSettings:l,onSpeechSettingsChange:r,language:i,onLanguageChange:c,onOpenSync:u,onOpenGitStatus:d,onOpenStats:m}){var N;const[x,f]=k.useState(null),[g,y]=k.useState(!1),[b,v]=k.useState(!1),[S,j]=k.useState(!1);k.useEffect(()=>{Ce.getPreferences().then(z=>f(z.instanceId??null)).catch(()=>{})},[]);const C=async()=>{j(!0);try{const O=await(await fetch("/api/preferences/regenerate-token",{method:"POST"})).json();O.ok&&(f(O.newInstanceId),v(!1))}catch{}j(!1)},E=()=>{x&&navigator.clipboard.writeText(x).then(()=>{y(!0),setTimeout(()=>y(!1),2e3)})};return s.jsx("div",{className:"customize-overlay",onClick:e,children:s.jsxs("div",{className:"customize-modal",onClick:z=>z.stopPropagation(),style:{maxWidth:480},children:[s.jsxs("div",{className:"customize-header",children:[s.jsx("div",{style:{fontSize:12,fontWeight:700,letterSpacing:1,color:"var(--terminal-text)"},children:"SETTINGS"}),s.jsx("button",{className:"customize-close",onClick:e,children:"X"})]}),s.jsx("div",{className:"customize-body",style:{padding:"12px 20px 20px"},children:s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),s.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(z=>s.jsxs("button",{onClick:()=>r==null?void 0:r({mode:z}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(l==null?void 0:l.mode)===z?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(l==null?void 0:l.mode)===z?"rgba(255,255,255,0.08)":"transparent",color:(l==null?void 0:l.mode)===z?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[s.jsx("div",{style:{fontWeight:600,marginBottom:2},children:z==="template"?"TEMPLATE":z==="llm"?"AI":"AUTO"}),s.jsx("div",{style:{fontSize:9,opacity:.7},children:z==="template"?"Static pool ($0)":z==="llm"?"LLM generated":"Detect engine"})]},z))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(l==null?void 0:l.intervalSec)??18,"s"]}),s.jsx("input",{type:"range",min:5,max:120,step:5,value:(l==null?void 0:l.intervalSec)??18,onChange:z=>r==null?void 0:r({intervalSec:Number(z.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"5s (frequent)"}),s.jsx("span",{children:"120s (rare)"})]})]}),(l==null?void 0:l.mode)!=="template"&&s.jsxs("div",{children:[s.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((N=l==null?void 0:l.dailyBudgetUsd)==null?void 0:N.toFixed(2))??"1.00"]}),s.jsx("input",{type:"range",min:0,max:5,step:.25,value:(l==null?void 0:l.dailyBudgetUsd)??1,onChange:z=>r==null?void 0:r({dailyBudgetUsd:Number(z.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[s.jsx("span",{children:"$0 (unlimited)"}),s.jsx("span",{children:"$5.00/day"})]})]}),s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),s.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:z,label:O})=>s.jsx("button",{onClick:()=>c==null?void 0:c(z),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(i??"auto")===z?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(i??"auto")===z?"rgba(255,255,255,0.08)":"transparent",color:(i??"auto")===z?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:O},z))}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]}),x&&s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"STORE TOKEN"}),s.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[s.jsx("code",{style:{flex:1,padding:"8px 10px",fontSize:10,background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:6,color:"var(--terminal-text-muted)",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x}),s.jsx("button",{onClick:E,style:{padding:"8px 12px",fontSize:10,fontWeight:600,border:"2px solid rgba(255,255,255,0.1)",background:"transparent",color:g?"#4ade80":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",whiteSpace:"nowrap"},children:g?"Copied!":"Copy"})]}),s.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Use this token to sign in on the web Store. Keep it secret — anyone with this token can act as you."}),s.jsx("div",{style:{marginTop:6},children:b?s.jsxs("div",{style:{background:"rgba(255,50,50,0.08)",border:"1px solid rgba(255,50,50,0.2)",borderRadius:6,padding:"8px 10px"},children:[s.jsx("div",{style:{fontSize:9,color:"rgba(255,100,100,0.8)",marginBottom:6},children:"This will invalidate your current token. Published characters will lose ownership. No migration."}),s.jsxs("div",{style:{display:"flex",gap:6},children:[s.jsx("button",{onClick:C,disabled:S,style:{padding:"4px 12px",fontSize:9,fontWeight:700,border:"1px solid rgba(255,50,50,0.4)",background:"rgba(255,50,50,0.15)",color:"#ff6464",borderRadius:4,cursor:"pointer"},children:S?"...":"Confirm Regenerate"}),s.jsx("button",{onClick:()=>v(!1),style:{padding:"4px 12px",fontSize:9,border:"none",background:"transparent",color:"var(--terminal-text-muted)",cursor:"pointer"},children:"Cancel"})]})]}):s.jsx("button",{onClick:()=>v(!0),style:{padding:"4px 10px",fontSize:9,fontWeight:600,border:"1px solid rgba(255,100,100,0.2)",background:"transparent",color:"rgba(255,100,100,0.6)",borderRadius:4,cursor:"pointer"},children:"Regenerate Token"})})]}),s.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.08)",paddingTop:16,display:"flex",gap:8},children:[u&&s.jsx("button",{onClick:()=>{e(),u()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"🔄 ROLE SYNC"}),d&&s.jsx("button",{onClick:()=>{e(),d()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📂 GIT STATUS"}),m&&s.jsx("button",{onClick:()=>{e(),m()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📊 COMPANY STATS"}),s.jsx("button",{onClick:()=>window.open("https://tycono.ai/store.html","_blank"),className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"🌐 WEB STORE"})]})]})})]})})}function fN({theme:e,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]),s.jsx("div",{ref:i,className:"theme-dropup",children:Object.entries(oa).map(([c,u])=>s.jsxs("button",{className:`theme-dropup__item${e===c?" theme-dropup__item--active":""}`,onClick:()=>{l(c),r()},title:u.name,children:[s.jsxs("span",{className:"theme-dropup__swatch",style:{background:u.vars["--hud-bg"],borderColor:u.vars["--pixel-border"]},children:[s.jsx("span",{style:{background:u.vars["--accent"],width:5,height:5,borderRadius:1}}),s.jsx("span",{style:{background:u.vars["--active-green"],width:5,height:5,borderRadius:1}}),s.jsx("span",{style:{background:u.vars["--idle-amber"],width:5,height:5,borderRadius:1}})]}),s.jsx("span",{className:"theme-dropup__name",children:u.icon})]},c))})}const qc=[0,1e4,5e4,15e4,4e5,1e6,25e5,5e6,1e7,25e6];function Lg(e){let l=1;for(let r=qc.length-1;r>=0;r--)if(e>=qc[r]){l=r+1;break}return Math.min(l,10)}function hN(e){const l=Lg(e);if(l>=10)return 1;const r=qc[l-1],i=qc[l];return Math.min(1,(e-r)/(i-r))}function Yf(e){const l={};for(const[r,i]of Object.entries(e)){const c=i.inputTokens+i.outputTokens;l[r]={level:Lg(c),totalTokens:c,progress:hN(c)}}return l}const mN=[{id:"first-employee",name:"First Employee",icon:"🏆",description:"Hired your first role",check:e=>e.roleCount>=1},{id:"full-team",name:"Full Team",icon:"👥",description:"Hired 5+ roles",check:e=>e.roleCount>=5},{id:"token-10k",name:"Getting Started",icon:"📊",description:"Used 10K tokens total",check:e=>e.totalTokens>=1e4},{id:"token-100k",name:"Power User",icon:"💪",description:"Used 100K tokens total",check:e=>e.totalTokens>=1e5},{id:"token-millionaire",name:"Token Millionaire",icon:"🎖",description:"Used 1M tokens total",check:e=>e.totalTokens>=1e6},{id:"token-mogul",name:"Token Mogul",icon:"💎",description:"Used 10M tokens total",check:e=>e.totalTokens>=1e7},{id:"first-promotion",name:"First Promotion",icon:"⭐",description:"Any role reached Lv.3",check:e=>e.roles.some(l=>l.level>=3)},{id:"senior-staff",name:"Senior Staff",icon:"🌟",description:"Any role reached Lv.5",check:e=>e.roles.some(l=>l.level>=5)},{id:"master-class",name:"Master Class",icon:"👑",description:"Any role reached Lv.10",check:e=>e.roles.some(l=>l.level>=10)},{id:"full-house",name:"Full House",icon:"🏠",description:"All roles Lv.5+",check:e=>e.roleCount>=3&&e.roles.every(l=>l.level>=5)}];function W0(e){return mN.filter(l=>l.check(e))}const xN={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍","data-analyst":"📊"},Fc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},pN={cto:"아키텍처",cbo:"시장 분석",pm:"PRD 작성",engineer:"코딩",designer:"시안 제작",qa:"품질 검증"};function yN(e){let l=0;for(let i=0;i<e.length;i++)l=e.charCodeAt(i)+((l<<5)-l);return`hsl(${(l%360+360)%360}, 50%, 40%)`}function gN({importJob:e,onImportDone:l}){var cl,qa,Dr;const[r,i]=k.useState([]),[c,u]=k.useState([]),[d,m]=k.useState([]),[x,f]=k.useState([]),[g,y]=k.useState([]),[b,v]=k.useState([]),[S,j]=k.useState("TYCONO"),[C,E]=k.useState(!0),[N,z]=k.useState(null),[O,I]=k.useState({type:"none"}),[_,q]=k.useState(null),[W,Y]=k.useState(null),[T,$]=k.useState([]),[B,G]=k.useState(!1),[ne,V]=k.useState([]),[U,J]=k.useState(0),[ie,je]=k.useState(!1),[R,M]=k.useState({}),[K,D]=k.useState("ceo"),[de,Se]=k.useState(null),[ve,Fe]=k.useState(!1),[Me,$e]=k.useState(!1),[fe,tt]=k.useState({}),mt=k.useRef({}),[he,ye]=k.useState(!1),[ge,Le]=k.useState(null),[Ee,ze]=k.useState({}),[Te,Ne]=k.useState([]),Ie=k.useMemo(()=>{const F={};for(const le of Te)F[le.roleId]=le;return F},[Te]),[Ge,Dt]=k.useState([]),[ct,Ot]=k.useState(void 0),[se,be]=k.useState(!1);k.useEffect(()=>{Ce.getStatus().then(F=>{Ot(F.engine),be(!!F.hasApiKey)}).catch(()=>{})},[]);const{getAppearance:Re,setAppearance:_e,resetAppearance:xe,theme:De,setTheme:vt,speechSettings:Pe,setSpeechSettings:nt,language:At,setLanguage:ut}=QC(),[tn,yn]=k.useState(null),[,Ml]=k.useState("character"),kt=JC(),[Rl,$n]=k.useState(!1),[Z,Oe]=k.useState(!1),[rt,pe]=k.useState(!1),[gt,dn]=k.useState(!1),[nn,br]=k.useState(!1),[Ri,Ha]=k.useState(!1),[Gn,Fi]=k.useState(null);k.useEffect(()=>{const F=le=>{(le.metaKey||le.ctrlKey)&&le.key==="s"&&(le.preventDefault(),kt.dirtyCount>0&&$n(!0))};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[kt.dirtyCount]),k.useEffect(()=>{if(!gt)return;let F=!1;const le=async()=>{try{const me=await Ce.getGitStatus();F||Fi(me)}catch{}};le();const ae=setInterval(le,1e4);return()=>{F=!0,clearInterval(ae)}},[gt]);const[Fl,Ia]=k.useState(null),[Ql,zn]=k.useState(null),[Vt,vn]=k.useState([]),[Kn,Ua]=k.useState(!1),lo=k.useRef(!1),_i=k.useRef(null);let Oi=k.useRef(0);const vr=k.useRef(new Set),vl=(F,le,ae)=>{const me={id:Oi.current++,type:F,text:le,detail:ae};vn(we=>[...we,me])};k.useEffect(()=>{var F;Kn&&((F=_i.current)==null||F.scrollIntoView({behavior:"smooth"}))},[Vt,Kn]),k.useEffect(()=>{e&&(lo.current||(lo.current=!0,zn("Scanning knowledge sources..."),vn([{id:0,type:"scan",text:"Starting knowledge import..."}]),Oi.current=1,fetch("/api/setup/import-knowledge",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:e.paths,companyRoot:e.companyRoot})}).then(async F=>{var we;const le=(we=F.body)==null?void 0:we.getReader();if(!le)return;const ae=new TextDecoder;let me="";for(;;){const{done:Je,value:qe}=await le.read();if(Je)break;me+=ae.decode(qe,{stream:!0});const Ae=me.split(`
|
|
90
90
|
`);me=Ae.pop()||"";let Ke="";for(const We of Ae)if(We.startsWith("event: "))Ke=We.slice(7).trim();else if(We.startsWith("data: ")&&Ke){try{const Xe=JSON.parse(We.slice(6));switch(Ke){case"scanning":zn(`Scanning: ${Xe.path} (${Xe.fileCount} files)`),vl("scan",`Found ${Xe.fileCount} files`,Xe.path);break;case"processing":Ia({index:Xe.index,total:Xe.total}),zn(`Importing knowledge... (${Xe.index}/${Xe.total})`),vl("process",`Processing: ${Xe.file}`,`${Xe.index} / ${Xe.total}`);break;case"created":vl("created",Xe.title,Xe.summary);break;case"skipped":vl("process",`Skipped: ${Xe.file}`,Xe.reason);break;case"done":zn(null),Ia(null),vl("done",`Import complete! ${Xe.created} created, ${Xe.skipped} skipped.`),Ut(`Knowledge import complete! ${Xe.created} documents imported.`,"#2E7D32"),l==null||l();break;case"error":zn(null),Ia(null),vl("error",Xe.message),Ut(`Import failed: ${Xe.message}`,"#B71C1C"),l==null||l();break}}catch{}Ke=""}}}).catch(F=>{zn(null),vl("error",F.message),Ut(`Import error: ${F.message}`,"#B71C1C"),l==null||l()})))},[e]);const[_l,Zl]=k.useState("iso"),[wr,kr]=k.useState(typeof window<"u"?window.innerWidth:1200);k.useEffect(()=>{const F=()=>kr(window.innerWidth);return window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[]);const Zt=wr<1024,[Wn,wl]=k.useState(!1),[Qn,jr]=k.useState(560),[kl,It]=k.useState([]),[Ol,Mn]=k.useState(null),[Bl,Sr]=k.useState(null),{sendMessage:jl}=GC(),gn=k.useRef(new Map);k.useEffect(()=>{Promise.all([Ce.getCompany().then(F=>{j(F.name),i(F.roles)}),Ce.getOrgTree().then(F=>{M(F.nodes),D(F.root)}).catch(()=>{}),Ce.getCostSummary().then(F=>Er(Yf(F.byRole))).catch(()=>{})]).catch(F=>z(`Failed to load: ${F.message}`)).finally(()=>E(!1)),Ce.getProjects().then(u).catch(()=>{}),Ce.getStandups().then(m).catch(()=>{}),Ce.getWaves().then(f).catch(()=>{}),Ce.getDecisions().then(y).catch(()=>{}),Ce.getKnowledge().then(v).catch(()=>{})},[]),k.useEffect(()=>{Ce.getSessions().then(F=>{if(F.length>0){const le=F.map(me=>({...me,messages:[]}));It(le);const ae=le.find(me=>me.status==="active")??le[0];Mn(ae.id),wl(!0)}}).catch(F=>{console.error("Failed to load sessions",F)})},[]),k.useEffect(()=>{const F=()=>{fetch("/api/exec/status").then(ae=>ae.json()).then(ae=>{ze(ae.statuses??{}),Ne(ae.activeExecutions??[])}).catch(()=>{})};F();const le=setInterval(F,3e3);return()=>clearInterval(le)},[]);const Cr=k.useMemo(()=>{const F={...Ee};if(Bl){const le=kl.find(ae=>ae.id===Bl);le&&(F[le.roleId]="working")}return F},[Ee,Bl,kl]);k.useEffect(()=>{O.type==="role"?Ce.getRole(O.roleId).then(q).catch(console.error):q(null)},[O]);const fa=()=>I({type:"none"}),Bi=async(F,le)=>{const ae=r.find(we=>we.id===F),me=(W==null?void 0:W.mode)==="ask";Y(null);try{const{jobId:we}=await Ce.startJob({type:"assign",roleId:F,task:le,readOnly:me}),Je=Fc[F]??"#666",qe=`${F.toUpperCase()} · ${(ae==null?void 0:ae.name)??F}`;je(!1),$([{jobId:we,title:qe,color:Je}]),fn.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO → ${(ae==null?void 0:ae.name)??F}] ${me?"Ask":"Assign"}: ${le}`,type:"dispatch",targetRoleId:F})}catch(we){Ut(`Failed to start job: ${we instanceof Error?we.message:"unknown"}`,"#C62828")}},Ut=(F,le)=>{const ae=Date.now();Dt(me=>[...me,{id:ae,message:F,color:le}]),setTimeout(()=>Dt(me=>me.filter(we=>we.id!==ae)),4e3)},Er=F=>{var ae,me;const le=mt.current;for(const[we,Je]of Object.entries(F)){const qe=((ae=le[we])==null?void 0:ae.level)??0;if(qe>0&&Je.level>qe){const Ae=((me=r.find(Ke=>Ke.id===we))==null?void 0:me.name)??we.toUpperCase();Ut(`${Ae} leveled up to Lv.${Je.level}!`,"#7C3AED")}}mt.current=F,tt(F)};k.useEffect(()=>{const F={roles:Object.entries(fe).map(([me,we])=>({id:me,level:we.level,totalTokens:we.totalTokens})),totalTokens:Object.values(fe).reduce((me,we)=>me+we.totalTokens,0),roleCount:r.length},le=W0(F),ae=vr.current;for(const me of le)ae.has(me.id)||ae.size>0&&Ut(`${me.icon} Badge earned: ${me.name}!`,"#D4A017");vr.current=new Set(le.map(me=>me.id))},[fe,r.length]);const Jc=()=>{var le;const F=T[T.length-1];F&&(Ut(`${F.title} completed`,F.color),fn.pushMessage({ts:Date.now(),roleId:((le=F.title.split(" · ")[0])==null?void 0:le.toLowerCase())??"unknown",text:`[${F.title}] Job completed`,type:"dispatch"})),Ce.getStandups().then(m).catch(console.error),Ce.getCompany().then(ae=>i(ae.roles)).catch(console.error),Ce.getCostSummary().then(ae=>Er(Yf(ae.byRole))).catch(()=>{})},Ln=(F,le)=>{const ae=`wave-${F}`,me=new AbortController;gn.current.set(F,me);const we={id:`msg-wave-${F}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:new Date().toISOString(),streamEvents:[]};It(Je=>Je.map(qe=>qe.id===ae?{...qe,messages:[...qe.messages,we]}:qe)),fetch(`/api/jobs/${F}/stream?from=0`,{signal:me.signal}).then(async Je=>{if(!Je.ok||!Je.body)return;const qe=Je.body.getReader(),Ae=new TextDecoder;let Ke="";for(;;){const{done:We,value:Xe}=await qe.read();if(We)break;Ke+=Ae.decode(Xe,{stream:!0});const oo=Ke.split(`
|
|
91
|
-
`);Ke=oo.pop()??"";let Tr="";for(const zr of oo)if(zr.startsWith("event: "))Tr=zr.slice(7).trim();else if(zr.startsWith("data: ")){try{const ma=JSON.parse(zr.slice(6));if(Tr==="activity"){const Gt=ma;It(Pl=>Pl.map(Cl=>{if(Cl.id!==ae)return Cl;const wn=[...Cl.messages],qi=wn[wn.length-1];if(!qi||qi.from!=="role")return Cl;const Wt={...qi};if(Gt.type==="text")Wt.content=(Wt.content??"")+(Gt.data.text??"");else if(Gt.type==="thinking")Wt.thinking=(Wt.thinking??"")+(Gt.data.text??""),Wt.streamEvents=[...Wt.streamEvents??[],{type:"thinking",timestamp:Date.now(),text:Gt.data.text}];else if(Gt.type==="tool:start")Wt.streamEvents=[...Wt.streamEvents??[],{type:"tool",timestamp:Date.now(),toolName:Gt.data.name,toolInput:Gt.data.input}];else if(Gt.type==="dispatch:start")Wt.streamEvents=[...Wt.streamEvents??[],{type:"dispatch",timestamp:Date.now(),roleId:Gt.data.targetRoleId,task:Gt.data.task}];else if(Gt.type==="turn:complete")Wt.streamEvents=[...Wt.streamEvents??[],{type:"turn",timestamp:Date.now(),turn:Gt.data.turn}];else{if(Gt.type==="job:done")return Wt.status="done",wn[wn.length-1]=Wt,{...Cl,messages:wn,status:"closed"};if(Gt.type==="job:error")return Wt.status="error",Gt.data.message&&(Wt.content=Wt.content||Gt.data.message),wn[wn.length-1]=Wt,{...Cl,messages:wn,status:"closed"}}return wn[wn.length-1]=Wt,{...Cl,messages:wn}}))}else Tr==="stream:end"&&It(Gt=>Gt.map(Pl=>{if(Pl.id!==ae)return Pl;const Cl=Pl.messages.map(wn=>wn.status==="streaming"?{...wn,status:"done"}:wn);return{...Pl,messages:Cl,status:"closed"}}))}catch{}Tr=""}}}).catch(Je=>{Je.name!=="AbortError"&&It(qe=>qe.map(Ae=>{if(Ae.id!==ae)return Ae;const Ke=Ae.messages.map(We=>We.status==="streaming"?{...We,status:"error"}:We);return{...Ae,messages:Ke,status:"closed"}}))})},$i=async F=>{G(!1);try{const le=await Ce.startJob({type:"wave",directive:F}),ae=le.jobIds??(le.jobId?[le.jobId]:[]),me=r.filter(Ae=>Ae.level==="c-level"),we=ae.map((Ae,Ke)=>{var We,Xe;return{jobId:Ae,roleId:((We=me[Ke])==null?void 0:We.id)??`role-${Ke}`,roleName:((Xe=me[Ke])==null?void 0:Xe.name)??`C-Level ${Ke+1}`}});fn.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO WAVE] "${F}" → ${we.map(Ae=>Ae.roleName).join(", ")}`,type:"dispatch"}),Object.keys(R).length>0?(Se({directive:F,rootJobs:we}),Fe(!1)):(V(we),
|
|
91
|
+
`);Ke=oo.pop()??"";let Tr="";for(const zr of oo)if(zr.startsWith("event: "))Tr=zr.slice(7).trim();else if(zr.startsWith("data: ")){try{const ma=JSON.parse(zr.slice(6));if(Tr==="activity"){const Gt=ma;It(Pl=>Pl.map(Cl=>{if(Cl.id!==ae)return Cl;const wn=[...Cl.messages],qi=wn[wn.length-1];if(!qi||qi.from!=="role")return Cl;const Wt={...qi};if(Gt.type==="text")Wt.content=(Wt.content??"")+(Gt.data.text??"");else if(Gt.type==="thinking")Wt.thinking=(Wt.thinking??"")+(Gt.data.text??""),Wt.streamEvents=[...Wt.streamEvents??[],{type:"thinking",timestamp:Date.now(),text:Gt.data.text}];else if(Gt.type==="tool:start")Wt.streamEvents=[...Wt.streamEvents??[],{type:"tool",timestamp:Date.now(),toolName:Gt.data.name,toolInput:Gt.data.input}];else if(Gt.type==="dispatch:start")Wt.streamEvents=[...Wt.streamEvents??[],{type:"dispatch",timestamp:Date.now(),roleId:Gt.data.targetRoleId,task:Gt.data.task}];else if(Gt.type==="turn:complete")Wt.streamEvents=[...Wt.streamEvents??[],{type:"turn",timestamp:Date.now(),turn:Gt.data.turn}];else{if(Gt.type==="job:done")return Wt.status="done",wn[wn.length-1]=Wt,{...Cl,messages:wn,status:"closed"};if(Gt.type==="job:error")return Wt.status="error",Gt.data.message&&(Wt.content=Wt.content||Gt.data.message),wn[wn.length-1]=Wt,{...Cl,messages:wn,status:"closed"}}return wn[wn.length-1]=Wt,{...Cl,messages:wn}}))}else Tr==="stream:end"&&It(Gt=>Gt.map(Pl=>{if(Pl.id!==ae)return Pl;const Cl=Pl.messages.map(wn=>wn.status==="streaming"?{...wn,status:"done"}:wn);return{...Pl,messages:Cl,status:"closed"}}))}catch{}Tr=""}}}).catch(Je=>{Je.name!=="AbortError"&&It(qe=>qe.map(Ae=>{if(Ae.id!==ae)return Ae;const Ke=Ae.messages.map(We=>We.status==="streaming"?{...We,status:"error"}:We);return{...Ae,messages:Ke,status:"closed"}}))})},$i=async F=>{G(!1);try{const le=await Ce.startJob({type:"wave",directive:F}),ae=le.jobIds??(le.jobId?[le.jobId]:[]),me=r.filter(Ae=>Ae.level==="c-level"),we=ae.map((Ae,Ke)=>{var We,Xe;return{jobId:Ae,roleId:((We=me[Ke])==null?void 0:We.id)??`role-${Ke}`,roleName:((Xe=me[Ke])==null?void 0:Xe.name)??`C-Level ${Ke+1}`}});fn.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO WAVE] "${F}" → ${we.map(Ae=>Ae.roleName).join(", ")}`,type:"dispatch"}),Object.keys(R).length>0?(Se({directive:F,rootJobs:we}),Fe(!1)):(V(we),J(0),je(!1),we.length>0&&$([{jobId:we[0].jobId,title:`CEO WAVE · ${we[0].roleId.toUpperCase()}`,color:"#B71C1C"}]));const Je=new Date().toISOString(),qe=we.map(Ae=>({id:`wave-${Ae.jobId}`,roleId:Ae.roleId,title:`WAVE: ${Ae.roleName}`,mode:"do",source:"wave",jobId:Ae.jobId,messages:[{id:`msg-wave-${Ae.jobId}-ceo`,from:"ceo",content:F,type:"directive",status:"done",timestamp:Je}],status:"active",createdAt:Je,updatedAt:Je}));It(Ae=>[...qe,...Ae]),qe.length>0&&(Mn(qe[0].id),wl(!0));for(const Ae of we)Ln(Ae.jobId,Ae.roleId)}catch(le){Ut(`Failed to start wave: ${le instanceof Error?le.message:"unknown"}`,"#C62828")}},Ya=()=>{Ce.getWaves().then(f).catch(console.error),Ce.getStandups().then(m).catch(console.error)},ha=()=>{Ce.getCompany().then(F=>i(F.roles)).catch(console.error),Ce.getOrgTree().then(F=>{M(F.nodes),D(F.root)}).catch(console.error),Ce.getCostSummary().then(F=>Er(Yf(F.byRole))).catch(()=>{})},Nr=async(F,le)=>{await Ce.createRole(F),_e(F.id,le),ha(),Ut(`${F.name} hired!`,"#2E7D32")},ro=async F=>{var le;await Ce.deleteRole(F),ha(),It(ae=>ae.filter(me=>me.roleId!==F)),Ol&&((le=kl.find(ae=>ae.id===Ol))==null?void 0:le.roleId)===F&&Mn(null),Le(null),Ut(`${F.toUpperCase()} removed`,"#B71C1C")},Li=async(F,le)=>{await Ce.updateRole(F,le),ha(),O.type==="role"&&O.roleId===F&&Ce.getRole(F).then(q).catch(console.error),le.name&&Ut(`${F.toUpperCase()} renamed to "${le.name}"`,"#1565C0")},Ar=F=>{wl(!0)},Pc=async F=>{try{const le=await Ce.createSession(F,"talk");It(ae=>[le,...ae]),Mn(le.id),wl(!0)}catch(le){console.error("Failed to create session",le),Ut(`Failed to create session: ${le instanceof Error?le.message:"API unreachable"}`,"#B71C1C")}},ao=async F=>{try{const le=await Ce.createSession(F,"talk");It(ae=>[le,...ae]),Mn(le.id)}catch(le){console.error("Failed to create session",le),Ut(`Failed to create session: ${le instanceof Error?le.message:"API unreachable"}`,"#B71C1C")}},io=async F=>{const le=Ie[F],ae=(le==null?void 0:le.jobId)??(le==null?void 0:le.id);if(ae&&Cr[F]==="working"){const we=r.find(Ae=>Ae.id===F),Je=Fc[F]??"#666",qe=`${F.toUpperCase()} · ${(we==null?void 0:we.name)??F}`;$([{jobId:ae,title:qe,color:Je}]),je(!1);return}const me=kl.find(we=>we.roleId===F);if(me)Mn(me.id),fn.setActiveChannelId(null);else try{const we=await Ce.createSession(F,"talk");It(Je=>[we,...Je]),Mn(we.id),fn.setActiveChannelId(null)}catch(we){console.error("Failed to create session",we)}wl(!0)},Hi=async F=>{const le=kl.find(ae=>ae.id===F);if((le==null?void 0:le.source)==="wave"){if(le.jobId){const ae=gn.current.get(le.jobId);ae&&(ae.abort(),gn.current.delete(le.jobId))}It(ae=>{var we;const me=ae.filter(Je=>Je.id!==F);return Ol===F&&Mn(((we=me[0])==null?void 0:we.id)??null),me});return}try{await Ce.deleteSession(F),It(ae=>{var we;const me=ae.filter(Je=>Je.id!==F);return Ol===F&&Mn(((we=me[0])==null?void 0:we.id)??null),me})}catch(ae){console.error("Failed to delete session",ae),Ut(`Failed to close session: ${ae instanceof Error?ae.message:"API error"}`,"#B71C1C")}},eu=async()=>{try{const{ids:F}=await Ce.deleteEmptySessions();if(F.length===0)return;It(le=>{var me;const ae=le.filter(we=>!F.includes(we.id));return Ol&&F.includes(Ol)&&Mn(((me=ae[0])==null?void 0:me.id)??null),ae}),Ut(`Cleared ${F.length} empty session${F.length!==1?"s":""}`,"#2E7D32")}catch(F){Ut(`Failed to clear empty sessions: ${F instanceof Error?F.message:"API error"}`,"#B71C1C")}},tu=async()=>{if(!confirm("Close all sessions? This cannot be undone."))return;const F=kl.filter(le=>le.source!=="wave").map(le=>le.id);for(const le of kl)if(le.source==="wave"&&le.jobId){const ae=gn.current.get(le.jobId);ae&&(ae.abort(),gn.current.delete(le.jobId))}try{F.length>0&&await Ce.deleteSessions(F),It([]),Mn(null),Ut("All sessions closed","#2E7D32")}catch(le){Ut(`Failed to close sessions: ${le instanceof Error?le.message:"API error"}`,"#B71C1C")}},Zn=(F,le)=>{It(ae=>ae.map(me=>{if(me.id!==F)return me;const we=[...me.messages],Je=we[we.length-1];if(Je&&Je.from==="role"&&Je.status==="streaming"){const qe=[...Je.streamEvents??[],le];we[we.length-1]={...Je,streamEvents:qe}}return{...me,messages:we}}))},Jn=(F,le,ae,me)=>{const we={id:`msg-${Date.now()}-ceo`,from:"ceo",content:le,type:ae==="do"?"directive":"conversation",status:"done",timestamp:new Date().toISOString(),attachments:me},Je={id:`msg-${Date.now()+1}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:new Date().toISOString(),streamEvents:[]};It(qe=>qe.map(Ae=>Ae.id===F?{...Ae,messages:[...Ae.messages,we,Je],updatedAt:new Date().toISOString()}:Ae)),Sr(F),jl(F,le,ae,{onThinking:qe=>{It(Ae=>Ae.map(Ke=>{if(Ke.id!==F)return Ke;const We=[...Ke.messages],Xe=We[We.length-1];return Xe&&Xe.from==="role"&&Xe.status==="streaming"&&(We[We.length-1]={...Xe,thinking:(Xe.thinking??"")+qe}),{...Ke,messages:We}})),Zn(F,{type:"thinking",timestamp:Date.now(),text:qe})},onText:qe=>{It(Ae=>Ae.map(Ke=>{if(Ke.id!==F)return Ke;const We=[...Ke.messages],Xe=We[We.length-1];return Xe&&Xe.from==="role"&&Xe.status==="streaming"&&(We[We.length-1]={...Xe,content:Xe.content+qe}),{...Ke,messages:We}}))},onToolUse:(qe,Ae)=>{Zn(F,{type:"tool",timestamp:Date.now(),toolName:qe,toolInput:Ae})},onDispatch:(qe,Ae)=>{Zn(F,{type:"dispatch",timestamp:Date.now(),roleId:qe,task:Ae})},onDispatchProgress:(qe,Ae,Ke)=>{var We;Ae==="tool"?Zn(F,{type:"dispatch:progress",timestamp:Date.now(),roleId:qe,progressType:"tool",toolName:Ke.name,toolInput:Ke.input}):Ae==="thinking"?Zn(F,{type:"dispatch:progress",timestamp:Date.now(),roleId:qe,progressType:"thinking",text:Ke.text}):Ae==="text"?Zn(F,{type:"dispatch:progress",timestamp:Date.now(),roleId:qe,progressType:"text",text:(We=Ke.text)==null?void 0:We.slice(-200)}):(Ae==="done"||Ae==="error")&&Zn(F,{type:"dispatch:progress",timestamp:Date.now(),roleId:qe,progressType:Ae})},onTurn:qe=>{Zn(F,{type:"turn",timestamp:Date.now(),turn:qe})},onDone:()=>{It(qe=>qe.map(Ae=>{if(Ae.id!==F)return Ae;const Ke=Ae.messages.map(Xe=>Xe.status==="streaming"?{...Xe,status:"done"}:Xe),We=Ae.messages.length<=2?le.slice(0,40).replace(/\n/g," "):Ae.title;return{...Ae,messages:Ke,title:We}})),Sr(null)},onError:qe=>{It(Ae=>Ae.map(Ke=>{if(Ke.id!==F)return Ke;const We=Ke.messages.map(Xe=>Xe.status==="streaming"?{...Xe,status:"error",content:Xe.content||qe}:Xe);return{...Ke,messages:We}})),Sr(null)}},me)},Ii=(F,le)=>{It(ae=>ae.map(me=>me.id===F?{...me,mode:le}:me)),Ce.updateSession(F,{mode:le}).catch(console.error)},Ui=new Date().toISOString().slice(0,10),Rn=c[0],Jl={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},so=F=>{const le=Jl[F];if(!le)return"";for(const ae of d){const me=ae.content,we=me.indexOf(`## ${le}`);if(we===-1)continue;const Je=me.indexOf(`
|
|
92
92
|
## `,we+10),Ae=(Je===-1?me.slice(we):me.slice(we,Je)).split(`
|
|
93
93
|
`).filter(Ke=>Ke.trim().length>0);for(const Ke of Ae){const We=Ke.replace(/^#+\s*/,"").replace(/\*\*/g,"").replace(/^[-*]\s+/,"").trim();if(!(We.startsWith("|")||We.startsWith("{")||We.startsWith("[")||We.startsWith("```")||We.startsWith("---")||We.includes("Journal")||We.includes("(c-level)")||We.includes("(team-lead)")||We.includes("(member)")||/^(CEO |작업 결과|생성\/수정|APPROVAL|비고|상황 보고|태스크$)/.test(We))&&We.length>15&&We.length<120)return We}}return""},Yi=F=>{const le=Jl[F];if(!le)return"";for(const ae of d){const me=ae.content,we=me.indexOf(`## ${le}`);if(we===-1)continue;const Je=me.indexOf(`
|
|
94
|
-
## `,we+10),Ae=(Je===-1?me.slice(we):me.slice(we,Je)).replace(/^## .+\n/,"").trim();if(Ae)return Ae.slice(0,1500)}return""},fn=fE();k.useEffect(()=>{r.length>0&&fn.syncDefaultMembers(r)},[r]);const Sl=sE({roles:r,roleStatuses:Ee,activeExecs:Te,getStandupSpeech:so});return yE({roles:r,roleStatuses:Ee,activeExecs:Te,channels:fn.channels,relationships:Sl.relationships,pushMessage:fn.pushMessage,speechSettings:Pe,engineType:ct,hasApiKey:se}),C?s.jsxs("div",{className:"h-screen flex flex-col bg-[var(--floor-light)]",style:{fontFamily:"var(--pixel-font)"},children:[(Ql||Vt.length>0)&&s.jsxs("div",{className:"shrink-0 z-[44]",children:[s.jsxs("div",{className:"flex items-center gap-3 px-5 py-2 text-xs cursor-pointer select-none",style:{background:"var(--accent)",color:"#fff",fontFamily:"var(--pixel-font)"},onClick:()=>Ua(F=>!F),children:[Ql?s.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):s.jsx("span",{className:"shrink-0",children:"✅"}),s.jsx("span",{className:"flex-1",children:Ql||"Knowledge import finished"}),Fl&&s.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Fl.index/Fl.total*100}%`,background:"#fff"}})}),s.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:Kn?"▲":"▼"})]}),Kn&&s.jsxs("div",{className:"overflow-y-auto text-xs",style:{background:"var(--terminal-bg)",borderBottom:"2px solid var(--accent)",maxHeight:240,fontFamily:"var(--pixel-font)"},children:[Vt.map(F=>s.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[F.type==="scan"&&"🔍",F.type==="process"&&"⚙️",F.type==="created"&&"✅",F.type==="done"&&"🎉",F.type==="error"&&"❌"]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{style:{color:F.type==="error"?"#EF4444":F.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:F.text}),F.detail&&s.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:F.detail})]})]},F.id)),s.jsx("div",{ref:_i})]})]}),s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-4xl mb-3",children:"🏢"}),s.jsx("div",{className:"text-gray-600 font-semibold text-xs",children:"LOADING OFFICE..."})]})})]}):N?s.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:s.jsxs("div",{className:"text-center max-w-md",style:{fontFamily:"var(--pixel-font)"},children:[s.jsx("div",{className:"text-4xl mb-3",children:"⚠️"}),s.jsx("div",{className:"text-gray-800 font-semibold mb-2 text-xs",children:"CONNECTION ERROR"}),s.jsx("div",{className:"text-gray-500 text-xs mb-4",children:N}),s.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-gray-800 text-white text-xs font-bold cursor-pointer border-2 border-gray-600",style:{fontFamily:"var(--pixel-font)"},children:"RETRY"})]})}):s.jsxs("div",{className:"flex flex-col",style:{height:"100dvh",fontFamily:"var(--pixel-font)"},children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-2 bg-[var(--hud-bg)] text-white text-sm shrink-0 z-[45]",style:{borderBottom:"3px solid var(--pixel-border)"},children:[s.jsxs("div",{className:"font-black text-[13px] tracking-tight",style:{color:"var(--idle-amber)",textShadow:"2px 2px 0 rgba(0,0,0,0.5)"},children:["🏢"," ",s.jsx("span",{style:{color:"var(--terminal-text)"},children:S})]}),s.jsxs("div",{className:"flex gap-4 text-[var(--terminal-text-secondary)] text-[11px] items-center",children:[(()=>{const F=Object.values(fe).reduce((Je,qe)=>Je+qe.totalTokens,0),le=F>=1e6?`${(F/1e6).toFixed(1)}M`:F>=1e3?`${Math.round(F/1e3)}K`:String(F),ae=Math.min(100,Math.round(F/25e4*100)),me=Te.length,we=r.length>0?Math.round(me/r.length*100):0;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["💰",s.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:s.jsx("div",{className:"h-full",style:{width:`${ae}%`,background:"linear-gradient(90deg,#22c55e,#34D399)"}})}),s.jsx("strong",{className:"text-[var(--active-green)]",children:le})]}),s.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["⚡",s.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:s.jsx("div",{className:"h-full",style:{width:`${we}%`,background:"linear-gradient(90deg,#3b82f6,#60A5FA)"}})}),s.jsx("strong",{className:"text-[var(--terminal-text)]",children:we})]})]})})(),s.jsxs("span",{className:"hidden sm:inline",children:["Roles: ",s.jsx("strong",{className:"text-[var(--terminal-text)]",children:r.length})]}),s.jsxs("span",{className:"hidden sm:inline",children:["Projects: ",s.jsx("strong",{className:"text-[var(--terminal-text)]",children:c.length})]}),Te.length>0&&s.jsxs("span",{className:"text-amber-400",children:["Working: ",s.jsx("strong",{children:Te.length})]}),(()=>{const F={roles:Object.entries(fe).map(([ae,me])=>({id:ae,level:me.level,totalTokens:me.totalTokens})),totalTokens:Object.values(fe).reduce((ae,me)=>ae+me.totalTokens,0),roleCount:r.length},le=W0(F);return le.length>0?s.jsx("div",{className:"hidden sm:flex",style:{gap:2,alignItems:"center",marginLeft:8,paddingLeft:8,borderLeft:"1px solid rgba(255,255,255,0.1)"},children:le.map(ae=>s.jsx("span",{title:`${ae.name}: ${ae.description}`,style:{fontSize:12,cursor:"default"},children:ae.icon},ae.id))}):null})(),s.jsx("span",{className:"px-1.5 py-0.5",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--pixel-border)"},children:Ui})]})]}),(Ql||Vt.length>0)&&s.jsxs("div",{className:"shrink-0 z-[44]",children:[s.jsxs("div",{className:"flex items-center gap-3 px-5 py-2 text-xs cursor-pointer select-none",style:{background:"var(--accent)",color:"#fff",fontFamily:"var(--pixel-font)"},onClick:()=>Ua(F=>!F),children:[Ql?s.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):s.jsx("span",{className:"shrink-0",children:"✅"}),s.jsx("span",{className:"flex-1",children:Ql||"Knowledge import finished"}),Fl&&s.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Fl.index/Fl.total*100}%`,background:"#fff"}})}),s.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:Kn?"▲":"▼"})]}),Kn&&s.jsxs("div",{className:"overflow-y-auto text-xs",style:{background:"var(--terminal-bg)",borderBottom:"2px solid var(--accent)",maxHeight:240,fontFamily:"var(--pixel-font)"},children:[Vt.map(F=>s.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[F.type==="scan"&&"🔍",F.type==="process"&&"⚙️",F.type==="created"&&"✅",F.type==="done"&&"🎉",F.type==="error"&&"❌"]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{style:{color:F.type==="error"?"#EF4444":F.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:F.text}),F.detail&&s.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:F.detail})]})]},F.id)),s.jsx("div",{ref:_i}),Vt.length===0&&s.jsx("div",{className:"px-5 py-4 text-center",style:{color:"var(--terminal-text-muted)"},children:"Waiting for events..."})]})]}),s.jsxs("div",{className:"flex-1 overflow-hidden flex relative",children:[s.jsx("div",{className:"flex-1 overflow-y-auto relative floor-grid",style:{background:"var(--floor-light)"},children:_l==="iso"?s.jsx(lN,{roles:r,projects:c,waves:x,standups:d,decisions:g,roleStatuses:Cr,activeExecs:Te,onRoleClick:F=>I({type:"role",roleId:F}),onProjectClick:F=>I({type:"project",projectId:F}),onBulletinClick:()=>I({type:"bulletin"}),onDecisionsClick:()=>I({type:"decisions"}),onKnowledgeClick:()=>I({type:"knowledge"}),onSettingsClick:()=>br(!0),onThemeClick:()=>Ha(F=>!F),onStatsClick:()=>Oe(!0),knowledgeDocsCount:b.length,getRoleSpeech:Sl.getSpeech,getAppearance:Re,onHireClick:()=>ye(!0),roleLevels:fe}):s.jsxs("div",{className:`${Wn?"max-w-full":"max-w-[1100px]"} mx-auto h-full p-4 flex flex-col gap-3 relative z-[1]`,children:[(()=>{const F=r.filter(ae=>ae.level==="c-level"),le=r.filter(ae=>ae.level!=="c-level");return s.jsxs(s.Fragment,{children:[F.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"pixel-section-label",children:"LEADERSHIP"}),s.jsx("div",{className:`grid gap-2 ${F.length===1?"grid-cols-1":"grid-cols-2"}`,children:F.map(ae=>{var me,we;return s.jsx(Q0,{role:ae,speech:Sl.getSpeech(ae.id),onClick:()=>I({type:"role",roleId:ae.id}),liveStatus:Cr[ae.id],activeTask:(me=Ie[ae.id])==null?void 0:me.task,featured:!0,appearance:Re(ae.id),xpLevel:(we=fe[ae.id])==null?void 0:we.level},ae.id)})})]}),s.jsx("div",{className:"pixel-section-label",children:"TEAM"}),s.jsxs("div",{className:`grid gap-2 ${Wn?"grid-cols-3":"grid-cols-4"}`,children:[le.map(ae=>{var me,we;return s.jsx(Q0,{role:ae,speech:Sl.getSpeech(ae.id),onClick:()=>I({type:"role",roleId:ae.id}),liveStatus:Cr[ae.id],activeTask:(me=Ie[ae.id])==null?void 0:me.task,appearance:Re(ae.id),xpLevel:(we=fe[ae.id])==null?void 0:we.level},ae.id)}),s.jsx("div",{className:"pixel-card pixel-card--hire",onClick:()=>ye(!0),children:s.jsxs("div",{className:"pixel-card--hire-inner",children:[s.jsx("span",{className:"pixel-card--hire-icon",children:"+"}),s.jsx("span",{className:"pixel-card--hire-label",children:"HIRE NEW ROLE"})]})})]})]})})(),s.jsx("div",{className:"pixel-section-label mt-1",children:"OFFICE"}),s.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[s.jsxs("div",{className:"facility-card-compact",onClick:Rn?()=>I({type:"project",projectId:Rn.id}):void 0,style:Rn?void 0:{borderStyle:"dashed",opacity:.5},children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#3B82F6"},children:["🏢"," MEETING ROOM"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(kc,{type:"meeting"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"Projects, PRDs, and task boards"}),Rn?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"fcc-title",children:['"',Rn.name,'"']}),s.jsxs("div",{className:"fcc-meta",children:["Status: ",s.jsx("strong",{style:{color:"var(--active-green)"},children:Rn.status})]})]}):s.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No active projects"})]})]}),s.jsxs("div",{className:"facility-card-compact",onClick:()=>I({type:"bulletin"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#64748b"},children:["📋"," BULLETIN"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(kc,{type:"bulletin"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"Waves and daily standups"}),x.slice(0,1).map(F=>s.jsxs("div",{className:"fcc-item",children:["Wave ",F.id]},F.id)),d.slice(0,1).map(F=>s.jsxs("div",{className:"fcc-item",children:["Standup ",F.date]},F.date)),x.length===0&&d.length===0&&s.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No entries yet"})]})]}),s.jsxs("div",{className:"facility-card-compact",onClick:()=>I({type:"decisions"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#EF4444"},children:["📜"," DECISIONS"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(kc,{type:"decision"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"CEO strategic decision log"}),s.jsxs("div",{className:"fcc-title",children:[g.length," decisions"]}),g.slice(0,2).map(F=>s.jsxs("div",{className:"fcc-item",children:["#",F.id," ",F.title]},F.id))]})]}),s.jsxs("div",{className:"facility-card-compact",onClick:()=>I({type:"knowledge"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#0D9488"},children:["📚"," KNOWLEDGE"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(kc,{type:"knowledge"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"Research, analysis, and references"}),s.jsxs("div",{className:"fcc-title",children:[b.length," docs"]}),b.slice(0,2).map(F=>s.jsx("div",{className:"fcc-item",children:F.title},F.id))]})]})]})]})}),Wn&&s.jsx("div",{className:Zt?"absolute inset-0 z-50":"contents",children:s.jsx(VC,{sessions:kl,activeSessionId:Ol,roles:r,streamingSessionId:Bl,width:Zt?wr:Qn,onWidthChange:Zt?void 0:jr,onSwitchSession:Mn,onCloseSession:Hi,onCreateSession:Pc,onClearEmpty:eu,onCloseAll:tu,onSendMessage:Jn,onModeChange:Ii,onCloseTerminal:()=>wl(!1),chatChannels:fn.channels,activeChatChannelId:fn.activeChannelId,onSwitchChatChannel:fn.setActiveChannelId,onCreateChatChannel:fn.createChannel,onDeleteChatChannel:fn.deleteChannel,onUpdateChatMembers:fn.updateMembers,onUpdateChatTopic:fn.updateTopic,unreadChannels:fn.unreadChannels})})]}),s.jsxs("div",{className:"flex items-center justify-between px-5 py-2 bg-[var(--hud-bg)] text-[var(--terminal-text-secondary)] text-[10px] shrink-0 z-[45]",style:{borderTop:"3px solid var(--pixel-border)"},children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>Zl("card"),className:`view-toggle-btn ${_l==="card"?"active":""}`,children:"CARD"}),s.jsx("button",{onClick:()=>Zl("iso"),className:`view-toggle-btn ${_l==="iso"?"active":""}`,children:"OFFICE"}),s.jsx("span",{className:"mx-1",children:"|"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsxs("button",{className:`theme-btn${Ri?" active":""}`,onClick:()=>Ha(F=>!F),title:"Office Theme",children:[((cl=oa[De])==null?void 0:cl.icon)??"","▾"]}),Ri&&s.jsx(fN,{theme:De,onThemeChange:vt,onClose:()=>Ha(!1)})]}),s.jsx("button",{className:"theme-btn",onClick:()=>br(!0),title:"Settings",children:"⚙"}),s.jsx("span",{className:"mx-1",children:"|"}),s.jsxs("button",{onClick:()=>{kt.state==="no-git"?kt.initGit():kt.state==="dirty"?$n(!0):dn(!0)},title:kt.state==="dirty"?`${kt.dirtyCount} unsaved — click to save`:"Git Status",style:{background:"none",border:"none",cursor:"pointer",fontSize:10,fontFamily:"var(--pixel-font)",color:"var(--terminal-text-muted)",display:"flex",alignItems:"center",gap:4},children:[s.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:kt.state==="no-git"?"var(--terminal-text-muted)":kt.state==="saving"||kt.state==="dirty"?"var(--idle-amber)":kt.state==="error"?"#EF5350":"var(--active-green)",animation:kt.state==="saving"?"pulse 1s infinite":void 0}}),s.jsx("span",{style:{color:kt.state==="dirty"?"var(--idle-amber)":"var(--terminal-text-muted)"},children:kt.state==="no-git"?"No git":kt.state==="saving"?"Saving...":kt.state==="dirty"?`${kt.dirtyCount} unsaved`:"Saved"}),Gn&&(Gn.worktrees.length>0||Gn.staleBranches.length>0)&&s.jsxs("span",{style:{color:Gn.worktrees.some(F=>F.status==="stale")?"#ff6b6b":Gn.worktrees.some(F=>F.status==="pending-merge")?"#FFB74D":"#4FC3F7"},children:["·"," ","📂"," ",Gn.worktrees.length," worktree",Gn.worktrees.length!==1?"s":"",Gn.staleBranches.length>0&&` · ⚠ ${Gn.staleBranches.length} branch${Gn.staleBranches.length!==1?"es":""}`]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[de&&ve&&s.jsx("button",{onClick:()=>Fe(!1),className:`px-3 py-1 font-black text-white cursor-pointer ${Me?"":"animate-pulse"}`,style:{background:Me?"#2E7D32":"#B71C1C",border:`2px solid ${Me?"#1b5e2088":"#7f121288"}`,fontFamily:"var(--pixel-font)",borderRadius:4},children:Me?"WAVE DONE":"WAVE"}),T.length>0&&ie&&s.jsxs("button",{onClick:()=>je(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:T[T.length-1].color,border:`2px solid ${T[T.length-1].color}88`,fontFamily:"var(--pixel-font)",borderRadius:4},children:[T[T.length-1].title.slice(0,20),T[T.length-1].title.length>20?"..":""]}),s.jsxs("button",{onClick:()=>G(!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"]}),s.jsx("button",{onClick:()=>Wn?wl(!1):Ar(),className:"px-3 py-1 font-black cursor-pointer",style:{background:Wn?"var(--terminal-bg)":"var(--hud-bg-alt)",color:"var(--terminal-text)",border:`2px solid ${Wn?"var(--terminal-border-hover)":"var(--pixel-border)"}`,fontFamily:"var(--pixel-font)"},children:"TERMINAL"})]})]}),O.type==="role"&&_&&(()=>{var le;const F=Ie[_.id];return s.jsx(cS,{role:_,allRoles:r,recentActivity:Yi(_.id),onClose:fa,onFireRole:(ae,me)=>{Le({roleId:ae,roleName:me}),fa()},terminalWidth:Wn?Qn:0,activeJobId:F==null?void 0:F.id,activeTask:F==null?void 0:F.task,isWorking:Cr[_.id]==="working",jobStartedAt:F==null?void 0:F.startedAt,onStopJob:ae=>Ce.abortJob(ae),sessions:kl,streamingSessionId:Bl,onCreateSessionSilent:ao,onSendMessage:Jn,onFocusTerminal:io,onCustomize:ae=>{const me=r.find(we=>we.id===ae);me&&(Ml("character"),yn(me))},onUpdateRole:Li,appearance:Re(_.id),relationships:Sl.relationships,roleLevel:(le=fe[_.id])==null?void 0:le.level})})(),O.type==="project"&&Rn&&s.jsx(aC,{projectId:Rn.id,onClose:fa,terminalWidth:Wn?Qn:0}),(O.type==="bulletin"||O.type==="decisions")&&s.jsx(lC,{standups:d,waves:x,decisions:g,mode:O.type==="bulletin"?"bulletin":"decisions",onClose:fa,terminalWidth:Wn?Qn:0}),O.type==="knowledge"&&s.jsx(nC,{docs:b,onClose:fa,onRefresh:()=>Ce.getKnowledge().then(v).catch(()=>{}),terminalWidth:Wn?Qn:0,initialDocId:O.docId}),W&&s.jsx(oC,{roleId:W.roleId,roleName:W.roleName,mode:W.mode,onClose:()=>Y(null),onExecutionStart:Bi}),de&&!ve&&s.jsx(pC,{directive:de.directive,rootJobs:de.rootJobs,orgNodes:R,rootRoleId:K,onClose:()=>{Se(null),Fe(!1),$e(!1)},onMinimize:()=>Fe(!0),onDone:()=>{Ya(),$e(!0),Ut("Wave complete — review & save results","#2E7D32")},onSave:async F=>{try{await Ce.saveWave({directive:de.directive,jobIds:F}),Ya(),Ut("Wave saved to bulletin","#2E7D32")}catch(le){Ut(`Save failed: ${le instanceof Error?le.message:"unknown"}`,"#C62828")}},onOpenKnowledgeDoc:F=>{Se(null),Fe(!1),$e(!1),I({type:"knowledge",docId:F}),Ce.getKnowledge().then(v).catch(()=>{})}}),T.length>0&&!ie&&(()=>{var ae;const F=T[T.length-1],le=ne.length>1;return s.jsxs(s.Fragment,{children:[le&&T.length===1&&s.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[63] flex gap-1 px-2 pt-2",children:ne.map((me,we)=>s.jsx("button",{onClick:()=>{Z(we),$([{jobId:me.jobId,title:`CEO WAVE · ${me.roleId.toUpperCase()}`,color:"#B71C1C"}])},className:"px-3 py-1.5 text-xs font-bold rounded-t-lg cursor-pointer transition-colors",style:{background:U===we?"#B71C1C":"var(--terminal-bg)",color:U===we?"#fff":"var(--terminal-text-secondary)",border:`1px solid ${U===we?"#B71C1C":"var(--terminal-border)"}`,borderBottom:"none"},children:me.roleId.toUpperCase()},me.jobId))}),s.jsx(cC,{jobId:F.jobId,title:T.length>1?F.title:le?`CEO WAVE · ${((ae=ne[U])==null?void 0:ae.roleName)??""}`:F.title,color:F.color,variant:"modal",style:le&&T.length===1?{marginTop:28}:void 0,onClose:()=>{$([]),V([]),Z(0),je(!1)},onMinimize:()=>je(!0),onDone:()=>{Jc(),Ya()},onNavigateToJob:me=>{Ce.getJob(me).then(we=>{const Je=Fc[we.roleId]??"#888";$(qe=>[...qe,{jobId:me,title:`${we.roleId.toUpperCase()} · ${we.task.slice(0,40)}`,color:Je}])}).catch(console.error)},onOpenKnowledgeDoc:me=>{$([]),V([]),Z(0),je(!1),I({type:"knowledge",docId:me}),Ce.getKnowledge().then(v).catch(()=>{})}},F.jobId)]})})(),T.length>1&&s.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[62] pointer-events-none",children:s.jsx("div",{className:"pointer-events-auto",children:s.jsxs("button",{onClick:()=>$(F=>F.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 ",(qa=T[T.length-2])==null?void 0:qa.title]})})}),B&&s.jsx(dC,{cLevelRoles:r.filter(F=>F.level==="c-level"),orgNodes:R,rootId:K,onClose:()=>G(!1),onDispatch:$i}),he&&s.jsx(kC,{existingRoles:r,onClose:()=>ye(!1),onHire:Nr}),ge&&s.jsx(CC,{roleId:ge.roleId,roleName:ge.roleName,onClose:()=>Le(null),onConfirm:ro}),tn&&s.jsx(rN,{role:tn,appearance:Re(tn.id),onSave:F=>_e(tn.id,F),onReset:()=>xe(tn.id),onClose:()=>{yn(null),Ml("character")},theme:De,onThemeChange:vt,onUpdateName:async(F,le)=>{await Li(F,{name:le})},initialTab:"character",characterOnly:!0,speechSettings:Pe,onSpeechSettingsChange:nt,language:At,onLanguageChange:ut,roleLevel:(Dr=fe[tn.id])==null?void 0:Dr.level}),Rl&&(()=>{const F=r.find(le=>le.id==="cto")??r.find(le=>le.level==="c-level")??r[0];return s.jsx(aN,{status:kt.status,history:kt.history,onClose:()=>$n(!1),onSave:async le=>await kt.save(le),onLoadHistory:kt.loadHistory,onRestore:kt.restore,saving:kt.state==="saving",delegateRoleName:(F==null?void 0:F.name)??(F==null?void 0:F.id),onDelegate:F?async le=>{$n(!1);try{const ae=await Ce.createSession(F.id,"do");It(we=>[ae,...we]),Mn(ae.id),wl(!0);const me=`Review the following unsaved changes, write a proper commit message, save (git add + commit), and push. If the current branch is not the main branch, create a PR and merge it.
|
|
94
|
+
## `,we+10),Ae=(Je===-1?me.slice(we):me.slice(we,Je)).replace(/^## .+\n/,"").trim();if(Ae)return Ae.slice(0,1500)}return""},fn=fE();k.useEffect(()=>{r.length>0&&fn.syncDefaultMembers(r)},[r]);const Sl=sE({roles:r,roleStatuses:Ee,activeExecs:Te,getStandupSpeech:so});return yE({roles:r,roleStatuses:Ee,activeExecs:Te,channels:fn.channels,relationships:Sl.relationships,pushMessage:fn.pushMessage,speechSettings:Pe,engineType:ct,hasApiKey:se}),C?s.jsxs("div",{className:"h-screen flex flex-col bg-[var(--floor-light)]",style:{fontFamily:"var(--pixel-font)"},children:[(Ql||Vt.length>0)&&s.jsxs("div",{className:"shrink-0 z-[44]",children:[s.jsxs("div",{className:"flex items-center gap-3 px-5 py-2 text-xs cursor-pointer select-none",style:{background:"var(--accent)",color:"#fff",fontFamily:"var(--pixel-font)"},onClick:()=>Ua(F=>!F),children:[Ql?s.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):s.jsx("span",{className:"shrink-0",children:"✅"}),s.jsx("span",{className:"flex-1",children:Ql||"Knowledge import finished"}),Fl&&s.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Fl.index/Fl.total*100}%`,background:"#fff"}})}),s.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:Kn?"▲":"▼"})]}),Kn&&s.jsxs("div",{className:"overflow-y-auto text-xs",style:{background:"var(--terminal-bg)",borderBottom:"2px solid var(--accent)",maxHeight:240,fontFamily:"var(--pixel-font)"},children:[Vt.map(F=>s.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[F.type==="scan"&&"🔍",F.type==="process"&&"⚙️",F.type==="created"&&"✅",F.type==="done"&&"🎉",F.type==="error"&&"❌"]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{style:{color:F.type==="error"?"#EF4444":F.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:F.text}),F.detail&&s.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:F.detail})]})]},F.id)),s.jsx("div",{ref:_i})]})]}),s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-4xl mb-3",children:"🏢"}),s.jsx("div",{className:"text-gray-600 font-semibold text-xs",children:"LOADING OFFICE..."})]})})]}):N?s.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:s.jsxs("div",{className:"text-center max-w-md",style:{fontFamily:"var(--pixel-font)"},children:[s.jsx("div",{className:"text-4xl mb-3",children:"⚠️"}),s.jsx("div",{className:"text-gray-800 font-semibold mb-2 text-xs",children:"CONNECTION ERROR"}),s.jsx("div",{className:"text-gray-500 text-xs mb-4",children:N}),s.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-gray-800 text-white text-xs font-bold cursor-pointer border-2 border-gray-600",style:{fontFamily:"var(--pixel-font)"},children:"RETRY"})]})}):s.jsxs("div",{className:"flex flex-col",style:{height:"100dvh",fontFamily:"var(--pixel-font)"},children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-2 bg-[var(--hud-bg)] text-white text-sm shrink-0 z-[45]",style:{borderBottom:"3px solid var(--pixel-border)"},children:[s.jsxs("div",{className:"font-black text-[13px] tracking-tight",style:{color:"var(--idle-amber)",textShadow:"2px 2px 0 rgba(0,0,0,0.5)"},children:["🏢"," ",s.jsx("span",{style:{color:"var(--terminal-text)"},children:S})]}),s.jsxs("div",{className:"flex gap-4 text-[var(--terminal-text-secondary)] text-[11px] items-center",children:[(()=>{const F=Object.values(fe).reduce((Je,qe)=>Je+qe.totalTokens,0),le=F>=1e6?`${(F/1e6).toFixed(1)}M`:F>=1e3?`${Math.round(F/1e3)}K`:String(F),ae=Math.min(100,Math.round(F/25e4*100)),me=Te.length,we=r.length>0?Math.round(me/r.length*100):0;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["💰",s.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:s.jsx("div",{className:"h-full",style:{width:`${ae}%`,background:"linear-gradient(90deg,#22c55e,#34D399)"}})}),s.jsx("strong",{className:"text-[var(--active-green)]",children:le})]}),s.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["⚡",s.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:s.jsx("div",{className:"h-full",style:{width:`${we}%`,background:"linear-gradient(90deg,#3b82f6,#60A5FA)"}})}),s.jsx("strong",{className:"text-[var(--terminal-text)]",children:we})]})]})})(),s.jsxs("span",{className:"hidden sm:inline",children:["Roles: ",s.jsx("strong",{className:"text-[var(--terminal-text)]",children:r.length})]}),s.jsxs("span",{className:"hidden sm:inline",children:["Projects: ",s.jsx("strong",{className:"text-[var(--terminal-text)]",children:c.length})]}),Te.length>0&&s.jsxs("span",{className:"text-amber-400",children:["Working: ",s.jsx("strong",{children:Te.length})]}),(()=>{const F={roles:Object.entries(fe).map(([ae,me])=>({id:ae,level:me.level,totalTokens:me.totalTokens})),totalTokens:Object.values(fe).reduce((ae,me)=>ae+me.totalTokens,0),roleCount:r.length},le=W0(F);return le.length>0?s.jsx("div",{className:"hidden sm:flex",style:{gap:2,alignItems:"center",marginLeft:8,paddingLeft:8,borderLeft:"1px solid rgba(255,255,255,0.1)"},children:le.map(ae=>s.jsx("span",{title:`${ae.name}: ${ae.description}`,style:{fontSize:12,cursor:"default"},children:ae.icon},ae.id))}):null})(),s.jsx("span",{className:"px-1.5 py-0.5",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--pixel-border)"},children:Ui})]})]}),(Ql||Vt.length>0)&&s.jsxs("div",{className:"shrink-0 z-[44]",children:[s.jsxs("div",{className:"flex items-center gap-3 px-5 py-2 text-xs cursor-pointer select-none",style:{background:"var(--accent)",color:"#fff",fontFamily:"var(--pixel-font)"},onClick:()=>Ua(F=>!F),children:[Ql?s.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):s.jsx("span",{className:"shrink-0",children:"✅"}),s.jsx("span",{className:"flex-1",children:Ql||"Knowledge import finished"}),Fl&&s.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Fl.index/Fl.total*100}%`,background:"#fff"}})}),s.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:Kn?"▲":"▼"})]}),Kn&&s.jsxs("div",{className:"overflow-y-auto text-xs",style:{background:"var(--terminal-bg)",borderBottom:"2px solid var(--accent)",maxHeight:240,fontFamily:"var(--pixel-font)"},children:[Vt.map(F=>s.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[s.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[F.type==="scan"&&"🔍",F.type==="process"&&"⚙️",F.type==="created"&&"✅",F.type==="done"&&"🎉",F.type==="error"&&"❌"]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{style:{color:F.type==="error"?"#EF4444":F.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:F.text}),F.detail&&s.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:F.detail})]})]},F.id)),s.jsx("div",{ref:_i}),Vt.length===0&&s.jsx("div",{className:"px-5 py-4 text-center",style:{color:"var(--terminal-text-muted)"},children:"Waiting for events..."})]})]}),s.jsxs("div",{className:"flex-1 overflow-hidden flex relative",children:[s.jsx("div",{className:"flex-1 overflow-y-auto relative floor-grid",style:{background:"var(--floor-light)"},children:_l==="iso"?s.jsx(lN,{roles:r,projects:c,waves:x,standups:d,decisions:g,roleStatuses:Cr,activeExecs:Te,onRoleClick:F=>I({type:"role",roleId:F}),onProjectClick:F=>I({type:"project",projectId:F}),onBulletinClick:()=>I({type:"bulletin"}),onDecisionsClick:()=>I({type:"decisions"}),onKnowledgeClick:()=>I({type:"knowledge"}),onSettingsClick:()=>br(!0),onThemeClick:()=>Ha(F=>!F),onStatsClick:()=>Oe(!0),knowledgeDocsCount:b.length,getRoleSpeech:Sl.getSpeech,getAppearance:Re,onHireClick:()=>ye(!0),roleLevels:fe}):s.jsxs("div",{className:`${Wn?"max-w-full":"max-w-[1100px]"} mx-auto h-full p-4 flex flex-col gap-3 relative z-[1]`,children:[(()=>{const F=r.filter(ae=>ae.level==="c-level"),le=r.filter(ae=>ae.level!=="c-level");return s.jsxs(s.Fragment,{children:[F.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"pixel-section-label",children:"LEADERSHIP"}),s.jsx("div",{className:`grid gap-2 ${F.length===1?"grid-cols-1":"grid-cols-2"}`,children:F.map(ae=>{var me,we;return s.jsx(Q0,{role:ae,speech:Sl.getSpeech(ae.id),onClick:()=>I({type:"role",roleId:ae.id}),liveStatus:Cr[ae.id],activeTask:(me=Ie[ae.id])==null?void 0:me.task,featured:!0,appearance:Re(ae.id),xpLevel:(we=fe[ae.id])==null?void 0:we.level},ae.id)})})]}),s.jsx("div",{className:"pixel-section-label",children:"TEAM"}),s.jsxs("div",{className:`grid gap-2 ${Wn?"grid-cols-3":"grid-cols-4"}`,children:[le.map(ae=>{var me,we;return s.jsx(Q0,{role:ae,speech:Sl.getSpeech(ae.id),onClick:()=>I({type:"role",roleId:ae.id}),liveStatus:Cr[ae.id],activeTask:(me=Ie[ae.id])==null?void 0:me.task,appearance:Re(ae.id),xpLevel:(we=fe[ae.id])==null?void 0:we.level},ae.id)}),s.jsx("div",{className:"pixel-card pixel-card--hire",onClick:()=>ye(!0),children:s.jsxs("div",{className:"pixel-card--hire-inner",children:[s.jsx("span",{className:"pixel-card--hire-icon",children:"+"}),s.jsx("span",{className:"pixel-card--hire-label",children:"HIRE NEW ROLE"})]})})]})]})})(),s.jsx("div",{className:"pixel-section-label mt-1",children:"OFFICE"}),s.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[s.jsxs("div",{className:"facility-card-compact",onClick:Rn?()=>I({type:"project",projectId:Rn.id}):void 0,style:Rn?void 0:{borderStyle:"dashed",opacity:.5},children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#3B82F6"},children:["🏢"," MEETING ROOM"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(kc,{type:"meeting"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"Projects, PRDs, and task boards"}),Rn?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"fcc-title",children:['"',Rn.name,'"']}),s.jsxs("div",{className:"fcc-meta",children:["Status: ",s.jsx("strong",{style:{color:"var(--active-green)"},children:Rn.status})]})]}):s.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No active projects"})]})]}),s.jsxs("div",{className:"facility-card-compact",onClick:()=>I({type:"bulletin"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#64748b"},children:["📋"," BULLETIN"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(kc,{type:"bulletin"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"Waves and daily standups"}),x.slice(0,1).map(F=>s.jsxs("div",{className:"fcc-item",children:["Wave ",F.id]},F.id)),d.slice(0,1).map(F=>s.jsxs("div",{className:"fcc-item",children:["Standup ",F.date]},F.date)),x.length===0&&d.length===0&&s.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No entries yet"})]})]}),s.jsxs("div",{className:"facility-card-compact",onClick:()=>I({type:"decisions"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#EF4444"},children:["📜"," DECISIONS"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(kc,{type:"decision"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"CEO strategic decision log"}),s.jsxs("div",{className:"fcc-title",children:[g.length," decisions"]}),g.slice(0,2).map(F=>s.jsxs("div",{className:"fcc-item",children:["#",F.id," ",F.title]},F.id))]})]}),s.jsxs("div",{className:"facility-card-compact",onClick:()=>I({type:"knowledge"}),children:[s.jsxs("div",{className:"fcc-hdr",style:{background:"#0D9488"},children:["📚"," KNOWLEDGE"]}),s.jsx("div",{className:"fcc-canvas",children:s.jsx(kc,{type:"knowledge"})}),s.jsxs("div",{className:"fcc-body",children:[s.jsx("div",{className:"fcc-desc",children:"Research, analysis, and references"}),s.jsxs("div",{className:"fcc-title",children:[b.length," docs"]}),b.slice(0,2).map(F=>s.jsx("div",{className:"fcc-item",children:F.title},F.id))]})]})]})]})}),Wn&&s.jsx("div",{className:Zt?"absolute inset-0 z-50":"contents",children:s.jsx(VC,{sessions:kl,activeSessionId:Ol,roles:r,streamingSessionId:Bl,width:Zt?wr:Qn,onWidthChange:Zt?void 0:jr,onSwitchSession:Mn,onCloseSession:Hi,onCreateSession:Pc,onClearEmpty:eu,onCloseAll:tu,onSendMessage:Jn,onModeChange:Ii,onCloseTerminal:()=>wl(!1),chatChannels:fn.channels,activeChatChannelId:fn.activeChannelId,onSwitchChatChannel:fn.setActiveChannelId,onCreateChatChannel:fn.createChannel,onDeleteChatChannel:fn.deleteChannel,onUpdateChatMembers:fn.updateMembers,onUpdateChatTopic:fn.updateTopic,unreadChannels:fn.unreadChannels})})]}),s.jsxs("div",{className:"flex items-center justify-between px-5 py-2 bg-[var(--hud-bg)] text-[var(--terminal-text-secondary)] text-[10px] shrink-0 z-[45]",style:{borderTop:"3px solid var(--pixel-border)"},children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>Zl("card"),className:`view-toggle-btn ${_l==="card"?"active":""}`,children:"CARD"}),s.jsx("button",{onClick:()=>Zl("iso"),className:`view-toggle-btn ${_l==="iso"?"active":""}`,children:"OFFICE"}),s.jsx("span",{className:"mx-1",children:"|"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsxs("button",{className:`theme-btn${Ri?" active":""}`,onClick:()=>Ha(F=>!F),title:"Office Theme",children:[((cl=oa[De])==null?void 0:cl.icon)??"","▾"]}),Ri&&s.jsx(fN,{theme:De,onThemeChange:vt,onClose:()=>Ha(!1)})]}),s.jsx("button",{className:"theme-btn",onClick:()=>br(!0),title:"Settings",children:"⚙"}),s.jsx("span",{className:"mx-1",children:"|"}),s.jsxs("button",{onClick:()=>{kt.state==="no-git"?kt.initGit():kt.state==="dirty"?$n(!0):dn(!0)},title:kt.state==="dirty"?`${kt.dirtyCount} unsaved — click to save`:"Git Status",style:{background:"none",border:"none",cursor:"pointer",fontSize:10,fontFamily:"var(--pixel-font)",color:"var(--terminal-text-muted)",display:"flex",alignItems:"center",gap:4},children:[s.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:kt.state==="no-git"?"var(--terminal-text-muted)":kt.state==="saving"||kt.state==="dirty"?"var(--idle-amber)":kt.state==="error"?"#EF5350":"var(--active-green)",animation:kt.state==="saving"?"pulse 1s infinite":void 0}}),s.jsx("span",{style:{color:kt.state==="dirty"?"var(--idle-amber)":"var(--terminal-text-muted)"},children:kt.state==="no-git"?"No git":kt.state==="saving"?"Saving...":kt.state==="dirty"?`${kt.dirtyCount} unsaved`:"Saved"}),Gn&&(Gn.worktrees.length>0||Gn.staleBranches.length>0)&&s.jsxs("span",{style:{color:Gn.worktrees.some(F=>F.status==="stale")?"#ff6b6b":Gn.worktrees.some(F=>F.status==="pending-merge")?"#FFB74D":"#4FC3F7"},children:["·"," ","📂"," ",Gn.worktrees.length," worktree",Gn.worktrees.length!==1?"s":"",Gn.staleBranches.length>0&&` · ⚠ ${Gn.staleBranches.length} branch${Gn.staleBranches.length!==1?"es":""}`]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[de&&ve&&s.jsx("button",{onClick:()=>Fe(!1),className:`px-3 py-1 font-black text-white cursor-pointer ${Me?"":"animate-pulse"}`,style:{background:Me?"#2E7D32":"#B71C1C",border:`2px solid ${Me?"#1b5e2088":"#7f121288"}`,fontFamily:"var(--pixel-font)",borderRadius:4},children:Me?"WAVE DONE":"WAVE"}),T.length>0&&ie&&s.jsxs("button",{onClick:()=>je(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:T[T.length-1].color,border:`2px solid ${T[T.length-1].color}88`,fontFamily:"var(--pixel-font)",borderRadius:4},children:[T[T.length-1].title.slice(0,20),T[T.length-1].title.length>20?"..":""]}),s.jsxs("button",{onClick:()=>G(!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"]}),s.jsx("button",{onClick:()=>Wn?wl(!1):Ar(),className:"px-3 py-1 font-black cursor-pointer",style:{background:Wn?"var(--terminal-bg)":"var(--hud-bg-alt)",color:"var(--terminal-text)",border:`2px solid ${Wn?"var(--terminal-border-hover)":"var(--pixel-border)"}`,fontFamily:"var(--pixel-font)"},children:"TERMINAL"})]})]}),O.type==="role"&&_&&(()=>{var le;const F=Ie[_.id];return s.jsx(cS,{role:_,allRoles:r,recentActivity:Yi(_.id),onClose:fa,onFireRole:(ae,me)=>{Le({roleId:ae,roleName:me}),fa()},terminalWidth:Wn?Qn:0,activeJobId:F==null?void 0:F.id,activeTask:F==null?void 0:F.task,isWorking:Cr[_.id]==="working",jobStartedAt:F==null?void 0:F.startedAt,onStopJob:ae=>Ce.abortJob(ae),sessions:kl,streamingSessionId:Bl,onCreateSessionSilent:ao,onSendMessage:Jn,onFocusTerminal:io,onCustomize:ae=>{const me=r.find(we=>we.id===ae);me&&(Ml("character"),yn(me))},onUpdateRole:Li,appearance:Re(_.id),relationships:Sl.relationships,roleLevel:(le=fe[_.id])==null?void 0:le.level})})(),O.type==="project"&&Rn&&s.jsx(aC,{projectId:Rn.id,onClose:fa,terminalWidth:Wn?Qn:0}),(O.type==="bulletin"||O.type==="decisions")&&s.jsx(lC,{standups:d,waves:x,decisions:g,mode:O.type==="bulletin"?"bulletin":"decisions",onClose:fa,terminalWidth:Wn?Qn:0}),O.type==="knowledge"&&s.jsx(nC,{docs:b,onClose:fa,onRefresh:()=>Ce.getKnowledge().then(v).catch(()=>{}),terminalWidth:Wn?Qn:0,initialDocId:O.docId}),W&&s.jsx(oC,{roleId:W.roleId,roleName:W.roleName,mode:W.mode,onClose:()=>Y(null),onExecutionStart:Bi}),de&&!ve&&s.jsx(pC,{directive:de.directive,rootJobs:de.rootJobs,orgNodes:R,rootRoleId:K,onClose:()=>{Se(null),Fe(!1),$e(!1)},onMinimize:()=>Fe(!0),onDone:()=>{Ya(),$e(!0),Ut("Wave complete — review & save results","#2E7D32")},onSave:async F=>{try{await Ce.saveWave({directive:de.directive,jobIds:F}),Ya(),Ut("Wave saved to bulletin","#2E7D32")}catch(le){Ut(`Save failed: ${le instanceof Error?le.message:"unknown"}`,"#C62828")}},onOpenKnowledgeDoc:F=>{Se(null),Fe(!1),$e(!1),I({type:"knowledge",docId:F}),Ce.getKnowledge().then(v).catch(()=>{})}}),T.length>0&&!ie&&(()=>{var ae;const F=T[T.length-1],le=ne.length>1;return s.jsxs(s.Fragment,{children:[le&&T.length===1&&s.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[63] flex gap-1 px-2 pt-2",children:ne.map((me,we)=>s.jsx("button",{onClick:()=>{J(we),$([{jobId:me.jobId,title:`CEO WAVE · ${me.roleId.toUpperCase()}`,color:"#B71C1C"}])},className:"px-3 py-1.5 text-xs font-bold rounded-t-lg cursor-pointer transition-colors",style:{background:U===we?"#B71C1C":"var(--terminal-bg)",color:U===we?"#fff":"var(--terminal-text-secondary)",border:`1px solid ${U===we?"#B71C1C":"var(--terminal-border)"}`,borderBottom:"none"},children:me.roleId.toUpperCase()},me.jobId))}),s.jsx(cC,{jobId:F.jobId,title:T.length>1?F.title:le?`CEO WAVE · ${((ae=ne[U])==null?void 0:ae.roleName)??""}`:F.title,color:F.color,variant:"modal",style:le&&T.length===1?{marginTop:28}:void 0,onClose:()=>{$([]),V([]),J(0),je(!1)},onMinimize:()=>je(!0),onDone:()=>{Jc(),Ya()},onNavigateToJob:me=>{Ce.getJob(me).then(we=>{const Je=Fc[we.roleId]??"#888";$(qe=>[...qe,{jobId:me,title:`${we.roleId.toUpperCase()} · ${we.task.slice(0,40)}`,color:Je}])}).catch(console.error)},onOpenKnowledgeDoc:me=>{$([]),V([]),J(0),je(!1),I({type:"knowledge",docId:me}),Ce.getKnowledge().then(v).catch(()=>{})}},F.jobId)]})})(),T.length>1&&s.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[62] pointer-events-none",children:s.jsx("div",{className:"pointer-events-auto",children:s.jsxs("button",{onClick:()=>$(F=>F.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 ",(qa=T[T.length-2])==null?void 0:qa.title]})})}),B&&s.jsx(dC,{cLevelRoles:r.filter(F=>F.level==="c-level"),orgNodes:R,rootId:K,onClose:()=>G(!1),onDispatch:$i}),he&&s.jsx(kC,{existingRoles:r,onClose:()=>ye(!1),onHire:Nr}),ge&&s.jsx(CC,{roleId:ge.roleId,roleName:ge.roleName,onClose:()=>Le(null),onConfirm:ro}),tn&&s.jsx(rN,{role:tn,appearance:Re(tn.id),onSave:F=>_e(tn.id,F),onReset:()=>xe(tn.id),onClose:()=>{yn(null),Ml("character")},theme:De,onThemeChange:vt,onUpdateName:async(F,le)=>{await Li(F,{name:le})},initialTab:"character",characterOnly:!0,speechSettings:Pe,onSpeechSettingsChange:nt,language:At,onLanguageChange:ut,roleLevel:(Dr=fe[tn.id])==null?void 0:Dr.level}),Rl&&(()=>{const F=r.find(le=>le.id==="cto")??r.find(le=>le.level==="c-level")??r[0];return s.jsx(aN,{status:kt.status,history:kt.history,onClose:()=>$n(!1),onSave:async le=>await kt.save(le),onLoadHistory:kt.loadHistory,onRestore:kt.restore,saving:kt.state==="saving",delegateRoleName:(F==null?void 0:F.name)??(F==null?void 0:F.id),onDelegate:F?async le=>{$n(!1);try{const ae=await Ce.createSession(F.id,"do");It(we=>[ae,...we]),Mn(ae.id),wl(!0);const me=`Review the following unsaved changes, write a proper commit message, save (git add + commit), and push. If the current branch is not the main branch, create a PR and merge it.
|
|
95
95
|
|
|
96
96
|
Changed files:
|
|
97
|
-
${le}`;Jn(ae.id,me,"do")}catch(ae){Ut(`Failed to delegate: ${ae instanceof Error?ae.message:"error"}`,"#B71C1C")}}:void 0})})(),
|
|
97
|
+
${le}`;Jn(ae.id,me,"do")}catch(ae){Ut(`Failed to delegate: ${ae instanceof Error?ae.message:"error"}`,"#B71C1C")}}:void 0})})(),Z&&s.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>Oe(!1),children:s.jsx("div",{style:{width:420,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8},onClick:F=>F.stopPropagation(),children:s.jsx(iN,{onClose:()=>Oe(!1)})})}),rt&&s.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>pe(!1),children:s.jsx("div",{style:{width:480,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8,overflowY:"auto"},onClick:F=>F.stopPropagation(),children:s.jsx(cN,{onClose:()=>pe(!1),onSyncComplete:()=>{}})})}),nn&&s.jsx(dN,{onClose:()=>br(!1),speechSettings:Pe,onSpeechSettingsChange:nt,language:At,onLanguageChange:ut,onOpenSync:()=>pe(!0),onOpenGitStatus:()=>dn(!0),onOpenStats:()=>Oe(!0)}),gt&&s.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>dn(!1),children:s.jsx("div",{style:{width:520,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8,overflowY:"auto"},onClick:F=>F.stopPropagation(),children:s.jsx(uN,{onClose:()=>dn(!1)})})}),s.jsx("div",{className:"fixed top-16 right-4 z-[70] flex flex-col gap-2",children:Ge.map(F=>s.jsxs("div",{className:"toast-enter flex items-center gap-2 px-4 py-2.5 shadow-lg text-white text-xs font-black",style:{background:F.color,border:"2px solid rgba(0,0,0,0.3)",fontFamily:"var(--pixel-font)"},children:[s.jsx("div",{className:"w-2 h-2 bg-white/60"}),F.message]},F.id))})]})}function Q0({role:e,speech:l,onClick:r,liveStatus:i,activeTask:c,featured:u,appearance:d,xpLevel:m}){const x=Fc[e.id]??yN(e.id),f=m??1,g=pN[e.id]??e.name,y=i==="working",b=y&&c?c:l||g;return s.jsxs("div",{className:`pixel-card ${y?"working":""} ${u?"pixel-card--featured":""}`,onClick:r,children:[s.jsxs("div",{className:"pixel-card-hdr",style:{background:x},children:[s.jsxs("span",{children:[e.id.toUpperCase()," ","·"," ",e.name.toUpperCase()]}),s.jsxs("span",{className:"lvl",children:["Lv.",f]})]}),s.jsxs("div",{className:"pixel-card-body",children:[s.jsx("div",{className:"pixel-desk"}),s.jsx(Ws,{roleId:e.id,appearance:d}),s.jsx("div",{className:"pixel-status-dot",style:{background:y?"var(--idle-amber)":"var(--active-green)"}})]}),s.jsxs("div",{className:"pixel-card-task",children:[s.jsx("span",{className:"pixel-card-task-icon",children:y?"🛠️":xN[e.id]??"👤"}),s.jsx("span",{className:"pixel-card-task-text",children:b||g})]})]})}function Ac({onSelect:e,onClose:l}){const[r,i]=k.useState(null),[c,u]=k.useState(!0),d=k.useCallback(async m=>{u(!0);try{const x=await Ce.browse(m);i(x)}catch{}finally{u(!1)}},[]);return k.useEffect(()=>{d()},[d]),c&&!r?s.jsx("div",{className:"mt-3 rounded-lg p-4 text-xs text-center",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-muted)"},children:"Loading..."}):r?s.jsxs("div",{className:"mt-3 rounded-lg overflow-hidden text-xs",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",maxHeight:220,overflowY:"auto"},children:[s.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 sticky top-0",style:{background:"var(--terminal-surface)",borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx("span",{style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},className:"truncate flex-1",children:r.current}),s.jsx("button",{onClick:()=>e(r.current),className:"px-2 py-1 rounded text-[10px] font-medium shrink-0",style:{background:"var(--active-green)",color:"#fff"},children:"Select"}),s.jsx("button",{onClick:l,className:"opacity-50 hover:opacity-100 shrink-0",style:{color:"var(--terminal-text)"},children:"✕"})]}),r.parent&&s.jsxs("div",{className:"px-3 py-1.5 cursor-pointer flex items-center gap-2 hover:bg-[var(--terminal-surface-light)]",style:{color:"var(--terminal-text-secondary)"},onClick:()=>d(r.parent),children:[s.jsx("span",{children:"⬆️"}),s.jsx("span",{children:".."})]}),r.dirs.map(m=>s.jsxs("div",{className:"px-3 py-1.5 cursor-pointer flex items-center gap-2 hover:bg-[var(--terminal-surface-light)]",style:{color:"var(--terminal-text)"},onClick:()=>d(m.path),children:[s.jsx("span",{children:"📁"}),s.jsx("span",{children:m.name})]},m.path)),r.dirs.length===0&&s.jsx("div",{className:"px-3 py-3 text-center",style:{color:"var(--terminal-text-muted)"},children:"No subdirectories"})]}):null}const bN={engine:"AI Engine",company:"Company Info",project:"Project",knowledge:"Knowledge",team:"Team Template",create:"Create"};function Z0(e){switch(e){case"skip":return["engine","company","project","knowledge","team","create"];case"import":return["engine","company","project","knowledge","team","create"];case"existing-akb":return["engine","knowledge","create"]}}function vN({onComplete:e}){const[l,r]=k.useState(0),[i,c]=k.useState(null),[u,d]=k.useState("none"),[m,x]=k.useState(""),[f,g]=k.useState(!0),[y,b]=k.useState(""),[v,S]=k.useState(""),[j,C]=k.useState("auto"),[E,N]=k.useState(""),[z,O]=k.useState(""),[I,_]=k.useState(!1),[q,W]=k.useState(!1),Y=k.useRef(null),[T,$]=k.useState("fresh"),[B,G]=k.useState(""),[ne,V]=k.useState(null),[U,J]=k.useState(!1),[ie,je]=k.useState(!1),[R,M]=k.useState("skip"),[K,D]=k.useState([]),[de,Se]=k.useState(""),[ve,Fe]=k.useState(!1),[Me,$e]=k.useState(""),[fe,tt]=k.useState(null),[mt,he]=k.useState(!1),[ye,ge]=k.useState(!1),[Le,Ee]=k.useState([]),[ze,Te]=k.useState("startup"),[Ne,Ie]=k.useState(!1),[Ge,Dt]=k.useState(!1),[ct,Ot]=k.useState(null),[se,be]=k.useState([]),[Re,_e]=k.useState(""),[xe,De]=k.useState(!1),vt=k.useMemo(()=>Z0(R),[R]),Pe=vt[l]??"engine";k.useEffect(()=>{Ce.detectEngine().then(pe=>{c(pe),d(pe.recommended),g(!1)}).catch(()=>g(!1)),Ce.getTeams().then(Ee).catch(()=>{}),Ce.getStatus().then(pe=>{O(pe.companyRoot||"")}).catch(()=>{})},[]),k.useEffect(()=>{var pe;Pe==="company"&&((pe=Y.current)==null||pe.focus())},[Pe]),k.useEffect(()=>{if(I||!z)return;const pe=y.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");N(pe?`${z}/${pe}`:z)},[y,z,I]);const nt=()=>{switch(Pe){case"engine":return u!=="none"||m.length>10;case"company":return y.trim().length>0;case"project":return T==="fresh"||T==="existing"&&ne===!0;case"knowledge":return R==="existing-akb"?fe===!0:R==="import"?K.length>0:!0;case"team":return!0;case"create":return!Ge;default:return!1}},At=()=>{l<vt.length-1&&nt()&&r(l+1),Pe==="create"&&!Ne&&!xe&&(R==="existing-akb"?Rl():kt())},ut=()=>{l>0&&r(l-1)};k.useEffect(()=>{const pe=Z0(R);l>=pe.length&&r(pe.length-1)},[R,l]);const tn=async()=>{if(B.trim()){J(!0);try{const pe=await Ce.validatePath(B.trim());V(pe.valid)}catch{V(!1)}finally{J(!1)}}},yn=async()=>{if(Me.trim()){he(!0);try{const pe=await Ce.validatePath(Me.trim());tt(pe.valid&&pe.hasClaudeMd===!0)}catch{tt(!1)}finally{he(!1)}}},Ml=()=>{const pe=de.trim();pe&&!K.includes(pe)&&(D([...K,pe]),Se(""))},kt=async()=>{Ie(!0),Ot(null);try{const pe={companyName:y.trim(),description:v.trim()||"An AI-powered organization",team:ze,existingProjectPath:T==="existing"?B.trim():void 0,knowledgePaths:R==="import"&&K.length>0?K:void 0,language:j!=="auto"?j:void 0,location:E.trim()||void 0};(u==="direct-api"||m)&&(pe.apiKey=m||void 0);const gt=await Ce.scaffold(pe);be(gt.created),_e(gt.projectRoot),Dt(!0)}catch(pe){Ot(pe instanceof Error?pe.message:"Scaffold failed")}finally{Ie(!1)}},Rl=async()=>{De(!0),Ot(null);try{const pe=await Ce.connectAkb(Me.trim());pe.ok?(Dt(!0),be([`Connected to: ${pe.companyRoot}`])):Ot(pe.error||"Failed to connect")}catch(pe){Ot(pe instanceof Error?pe.message:"Connect failed")}finally{De(!1)}},$n=()=>{R==="import"&&K.length>0?e({paths:K,companyRoot:""}):e()},Z=pe=>{pe.key==="Enter"&&nt()&&(pe.preventDefault(),At())},Oe=`w-full px-3 py-2 rounded text-sm outline-none transition-colors
|
|
98
98
|
bg-[var(--terminal-bg)] text-[var(--terminal-text)]
|
|
99
99
|
border border-[var(--terminal-border)]
|
|
100
100
|
focus:border-[var(--terminal-border-hover)]
|
|
101
|
-
placeholder:text-[var(--terminal-text-muted)]`,rt=pe=>`p-4 rounded-lg border-2 cursor-pointer transition-all text-[var(--terminal-text)] ${pe?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--terminal-border)] bg-[var(--hud-bg-alt)] hover:border-[var(--accent)]/50"}`;return s.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},onKeyDown:J,children:s.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl overflow-hidden",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"px-6 py-5",style:{background:"var(--terminal-bg)",borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx("div",{className:"text-lg font-bold",style:{color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"},children:"tycono"}),s.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-secondary)"},children:"Build an AI company. Watch them work."}),s.jsx("div",{className:"flex gap-1.5 mt-4",children:vt.map((pe,gt)=>s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"h-1 rounded-full transition-colors",style:{background:gt<=l?"var(--accent)":"var(--terminal-surface-light)"}}),s.jsx("div",{className:"text-[9px] mt-1 truncate",style:{color:gt===l?"var(--terminal-text)":"var(--terminal-text-muted)"},children:bN[pe]})]},pe))})]}),s.jsxs("div",{className:"px-6 py-5 min-h-[280px]",children:[Pe==="engine"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"AI Engine Setup"}),f?s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:"Detecting AI engine..."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:rt(u==="claude-cli"),onClick:()=>(i==null?void 0:i.claudeCli)&&d("claude-cli"),style:{opacity:i!=null&&i.claudeCli?1:.4},children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-lg",children:i!=null&&i.claudeCli?"✅":"❌"}),s.jsxs("div",{children:[s.jsx("div",{className:"font-medium text-sm",children:"Claude Code CLI"}),s.jsx("div",{className:"text-xs opacity-70",children:i!=null&&i.claudeCli?"Detected! Recommended — zero config needed.":"Not installed. Get it at claude.ai/download"})]})]})}),s.jsxs("div",{className:rt(u==="direct-api"),onClick:()=>d("direct-api"),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-lg",children:i!=null&&i.apiKey?"✅":"🔑"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"font-medium text-sm",children:"Anthropic API Key (BYOK)"}),s.jsx("div",{className:"text-xs opacity-70",children:i!=null&&i.apiKey?"API key found in environment.":"Enter your ANTHROPIC_API_KEY"})]})]}),u==="direct-api"&&!(i!=null&&i.apiKey)&&s.jsx("input",{type:"password",className:`${Oe} mt-3`,placeholder:"sk-ant-...",value:m,onChange:pe=>x(pe.target.value),autoFocus:!0})]})]})]}),Pe==="company"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Company Info"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Company Name *"}),s.jsx("input",{ref:Y,className:Oe,placeholder:"e.g. Acme Corp",value:y,onChange:pe=>b(pe.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Description"}),s.jsx("textarea",{className:`${Oe} resize-none`,rows:3,placeholder:"What does your AI company do?",value:v,onChange:pe=>S(pe.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Location"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${Oe} flex-1`,placeholder:"/path/to/your-company",value:E,onChange:pe=>{N(pe.target.value),_(!0)}}),s.jsx("button",{onClick:()=>W(!q),className:"px-3 py-2 rounded text-xs font-medium transition-colors shrink-0",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},title:"Browse folders",children:"📁"})]}),s.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--terminal-text-muted)"},children:"Where your AI company files will be created."}),q&&s.jsx(Ac,{onSelect:pe=>{N(pe),_(!0),W(!1)},onClose:()=>W(!1)})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"AI Response Language"}),s.jsxs("select",{className:Oe,value:j,onChange:pe=>C(pe.target.value),children:[s.jsx("option",{value:"auto",children:"Auto"}),s.jsx("option",{value:"en",children:"English"}),s.jsx("option",{value:"ko",children:"한국어"}),s.jsx("option",{value:"ja",children:"日本語"})]})]})]}),Pe==="project"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Project Setup"}),s.jsxs("div",{className:rt(T==="fresh"),onClick:()=>{$("fresh"),V(null)},children:[s.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Create a new AI company from scratch with clean directory structure."})]}),s.jsxs("div",{className:rt(T==="existing"),onClick:()=>$("existing"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["📂"," Connect Existing Project"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Add AI company structure to an existing codebase or knowledge base."}),T==="existing"&&s.jsxs("div",{className:"mt-3",onClick:pe=>pe.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${Oe} flex-1`,placeholder:"/path/to/your/project",value:B,onChange:pe=>{G(pe.target.value),V(null)},autoFocus:!0}),s.jsx("button",{onClick:()=>je(!ie),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),s.jsx("button",{onClick:tn,disabled:U||!B.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:U||!B.trim()?.5:1},children:U?"...":"Verify"})]}),ne===!0&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Path verified: ",B]}),ne===!1&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," Invalid path"]}),ie&&s.jsx(Ac,{onSelect:pe=>{G(pe),V(!0),je(!1)},onClose:()=>je(!1)})]})]})]}),Pe==="knowledge"&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Knowledge Strategy"}),s.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"How should AI handle your knowledge base?"}),s.jsxs("div",{className:rt(R==="skip"),onClick:()=>M("skip"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Empty knowledge base. Add documents later from the office."})]}),s.jsxs("div",{className:rt(R==="import"),onClick:()=>M("import"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["📚"," Import & Build"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Select folders with documents — AI reads, summarizes, and organizes them."}),R==="import"&&s.jsxs("div",{className:"mt-3 space-y-2",onClick:pe=>pe.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${Oe} flex-1`,placeholder:"/path/to/docs",value:de,onChange:pe=>Se(pe.target.value),onKeyDown:pe=>{pe.key==="Enter"&&(pe.preventDefault(),Ml())},autoFocus:!0}),s.jsx("button",{onClick:()=>Fe(!ve),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),s.jsx("button",{onClick:Ml,disabled:!de.trim(),className:"px-3 py-2 rounded text-xs font-medium",style:{background:"var(--accent)",color:"#fff",opacity:de.trim()?1:.5},children:"Add"})]}),ve&&s.jsx(Ac,{onSelect:pe=>{K.includes(pe)||D([...K,pe]),Fe(!1)},onClose:()=>Fe(!1)}),K.length>0&&s.jsx("div",{className:"space-y-1",children:K.map((pe,gt)=>s.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:[s.jsx("span",{className:"flex-1 truncate",style:{fontFamily:"var(--pixel-font)"},children:pe}),s.jsx("button",{onClick:()=>D(K.filter((dn,nn)=>nn!==gt)),className:"opacity-50 hover:opacity-100",children:"✕"})]},gt))}),K.length===0&&s.jsx("div",{className:"text-[10px] text-center py-2",style:{color:"var(--terminal-text-muted)"},children:"Add at least one folder to import."})]})]}),s.jsxs("div",{className:rt(R==="existing-akb"),onClick:()=>M("existing-akb"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["🔗"," Connect Existing AKB"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Connect a directory that already has CLAUDE.md and AKB structure."}),R==="existing-akb"&&s.jsxs("div",{className:"mt-3",onClick:pe=>pe.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${Oe} flex-1`,placeholder:"/path/to/your/akb",value:Me,onChange:pe=>{$e(pe.target.value),tt(null)},autoFocus:!0}),s.jsx("button",{onClick:()=>ge(!ye),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),s.jsx("button",{onClick:yn,disabled:mt||!Me.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:mt||!Me.trim()?.5:1},children:mt?"...":"Verify"})]}),fe===!0&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Valid AKB found: ",Me]}),fe===!1&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," No valid AKB (CLAUDE.md required)"]}),ye&&s.jsx(Ac,{onSelect:pe=>{$e(pe),tt(null),ge(!1)},onClose:()=>ge(!1)})]})]})]}),Pe==="team"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Team Template"}),s.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"Choose a starting team. You can add or remove roles later."}),Le.map(pe=>s.jsxs("div",{className:rt(ze===pe.id),onClick:()=>Te(pe.id),children:[s.jsx("div",{className:"font-medium text-sm capitalize",children:pe.id}),s.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:pe.roles.map(gt=>s.jsx("span",{className:"px-2 py-0.5 rounded text-[10px]",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:gt.name},gt.id))})]},pe.id)),s.jsxs("div",{className:rt(ze==="custom"),onClick:()=>Te("custom"),children:[s.jsx("div",{className:"font-medium text-sm",children:"Custom"}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Start with no pre-built roles. Hire them from the office."})]})]}),Pe==="create"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:Ge?R==="existing-akb"?"AKB Connected!":"Company Created!":"Review & Create"}),!Ge&&!Ne&&!xe&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"rounded-lg p-4 space-y-2 text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:R==="existing-akb"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Mode:"})," Connect Existing AKB"]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Path:"})," ",Me]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Company:"})," ",y]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Location:"})," ",E||"(default)"]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Project:"})," ",T==="fresh"?"Start Fresh":`Existing (${B})`]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Knowledge:"})," ",R==="skip"?"Fresh (empty)":`Import ${K.length} source(s)`]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Team:"})," ",ze]}),R==="import"&&K.length>0&&s.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--idle-amber)"},children:"Knowledge import will run in the background after entering the office."})]})}),ct&&s.jsx("div",{className:"text-xs p-3 rounded",style:{background:"rgba(220,38,38,0.15)",color:"#f87171"},children:ct})]}),(Ne||xe)&&s.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[s.jsx("div",{className:"w-8 h-8 border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:xe?"Connecting to AKB...":"Scaffolding your company..."})]}),Ge&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-center py-4 text-4xl",children:"🏢"}),Re&&s.jsxs("div",{className:"rounded-lg p-3 text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:[s.jsx("span",{className:"opacity-50",children:"Location:"})," ",Re]}),s.jsx("div",{className:"rounded-lg p-4 text-xs max-h-40 overflow-y-auto",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:se.map((pe,gt)=>s.jsxs("div",{className:"py-0.5",children:[s.jsx("span",{style:{color:"var(--active-green)"},children:"✓"})," ",pe]},gt))}),R==="import"&&K.length>0&&s.jsx("div",{className:"text-xs p-3 rounded",style:{background:"var(--accent)",color:"#fff",opacity:.9},children:"Knowledge import will start in the background after entering the office."})]})]})]}),s.jsxs("div",{className:"px-6 py-4 flex justify-between items-center",style:{borderTop:"1px solid var(--terminal-border)"},children:[s.jsx("div",{children:l>0&&!Ge&&s.jsx("button",{onClick:ut,className:"px-4 py-2 rounded text-sm transition-colors",style:{color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Back"})}),s.jsxs("div",{className:"text-xs",style:{color:"var(--terminal-text-muted)"},children:[l+1," / ",vt.length]}),s.jsx("div",{children:Ge?s.jsx("button",{onClick:$n,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:"var(--active-green)",color:"#fff"},children:"Enter Office"}):s.jsx("button",{onClick:At,disabled:!nt()||Ne||xe,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:nt()?"var(--accent)":"var(--terminal-border)",color:"#fff",opacity:nt()&&!Ne&&!xe?1:.5},children:Pe==="create"?Ne||xe?xe?"Connecting...":"Creating...":R==="existing-akb"?"Connect AKB":"Create Company":"Next"})})]})]})})}function wN(){const[e,l]=k.useState(null),[r,i]=k.useState(!0),[c,u]=k.useState(null),d=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(()=>{d()},[d]),{initialized:(e==null?void 0:e.initialized)??!1,companyName:(e==null?void 0:e.companyName)??null,engine:(e==null?void 0:e.engine)??"none",companyRoot:(e==null?void 0:e.companyRoot)??"",loading:r,error:c,refetch:d}}const kN=k.lazy(()=>P2(()=>import("./preview-app-BO1ZIxzi.js"),[]));function Hg(){return s.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-10 h-10 mx-auto border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),s.jsx("div",{className:"mt-4 text-sm",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Loading..."})]})})}function jN(){var e;try{const l=localStorage.getItem("tycono-theme"),r=l&&l in oa?l:"default",i=(e=oa[r])==null?void 0:e.vars;if(!i)return;const c=document.documentElement;for(const[u,d]of Object.entries(i))c.style.setProperty(u,d)}catch{}}function SN(){const{initialized:e,loading:l,refetch:r}=wN(),[i,c]=k.useState(null);k.useEffect(()=>{jN()},[]);const u=d=>{d&&c(d),r()};return l?s.jsx(Hg,{}):e?s.jsx(gN,{importJob:i,onImportDone:()=>c(null)}):s.jsx(vN,{onComplete:u})}function CN(){const e=new URLSearchParams(window.location.search).has("sprite-preview");return s.jsx(ev,{children:e?s.jsx(k.Suspense,{fallback:s.jsx(Hg,{}),children:s.jsx(kN,{})}):s.jsx(SN,{})})}Q2.createRoot(document.getElementById("root")).render(s.jsx(k.StrictMode,{children:s.jsx(CN,{})}));export{wg as H,jg as P,Sg as S,AN as a,kg as b,vg as c,nh as d,zj as e,Tj as f,NN as g,Mj as h,s as j,k as r};
|
|
101
|
+
placeholder:text-[var(--terminal-text-muted)]`,rt=pe=>`p-4 rounded-lg border-2 cursor-pointer transition-all text-[var(--terminal-text)] ${pe?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--terminal-border)] bg-[var(--hud-bg-alt)] hover:border-[var(--accent)]/50"}`;return s.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},onKeyDown:Z,children:s.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl overflow-hidden",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)"},children:[s.jsxs("div",{className:"px-6 py-5",style:{background:"var(--terminal-bg)",borderBottom:"1px solid var(--terminal-border)"},children:[s.jsx("div",{className:"text-lg font-bold",style:{color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"},children:"tycono"}),s.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-secondary)"},children:"Build an AI company. Watch them work."}),s.jsx("div",{className:"flex gap-1.5 mt-4",children:vt.map((pe,gt)=>s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"h-1 rounded-full transition-colors",style:{background:gt<=l?"var(--accent)":"var(--terminal-surface-light)"}}),s.jsx("div",{className:"text-[9px] mt-1 truncate",style:{color:gt===l?"var(--terminal-text)":"var(--terminal-text-muted)"},children:bN[pe]})]},pe))})]}),s.jsxs("div",{className:"px-6 py-5 min-h-[280px]",children:[Pe==="engine"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"AI Engine Setup"}),f?s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:"Detecting AI engine..."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:rt(u==="claude-cli"),onClick:()=>(i==null?void 0:i.claudeCli)&&d("claude-cli"),style:{opacity:i!=null&&i.claudeCli?1:.4},children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-lg",children:i!=null&&i.claudeCli?"✅":"❌"}),s.jsxs("div",{children:[s.jsx("div",{className:"font-medium text-sm",children:"Claude Code CLI"}),s.jsx("div",{className:"text-xs opacity-70",children:i!=null&&i.claudeCli?"Detected! Recommended — zero config needed.":"Not installed. Get it at claude.ai/download"})]})]})}),s.jsxs("div",{className:rt(u==="direct-api"),onClick:()=>d("direct-api"),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-lg",children:i!=null&&i.apiKey?"✅":"🔑"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"font-medium text-sm",children:"Anthropic API Key (BYOK)"}),s.jsx("div",{className:"text-xs opacity-70",children:i!=null&&i.apiKey?"API key found in environment.":"Enter your ANTHROPIC_API_KEY"})]})]}),u==="direct-api"&&!(i!=null&&i.apiKey)&&s.jsx("input",{type:"password",className:`${Oe} mt-3`,placeholder:"sk-ant-...",value:m,onChange:pe=>x(pe.target.value),autoFocus:!0})]})]})]}),Pe==="company"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Company Info"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Company Name *"}),s.jsx("input",{ref:Y,className:Oe,placeholder:"e.g. Acme Corp",value:y,onChange:pe=>b(pe.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Description"}),s.jsx("textarea",{className:`${Oe} resize-none`,rows:3,placeholder:"What does your AI company do?",value:v,onChange:pe=>S(pe.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Location"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${Oe} flex-1`,placeholder:"/path/to/your-company",value:E,onChange:pe=>{N(pe.target.value),_(!0)}}),s.jsx("button",{onClick:()=>W(!q),className:"px-3 py-2 rounded text-xs font-medium transition-colors shrink-0",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},title:"Browse folders",children:"📁"})]}),s.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--terminal-text-muted)"},children:"Where your AI company files will be created."}),q&&s.jsx(Ac,{onSelect:pe=>{N(pe),_(!0),W(!1)},onClose:()=>W(!1)})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"AI Response Language"}),s.jsxs("select",{className:Oe,value:j,onChange:pe=>C(pe.target.value),children:[s.jsx("option",{value:"auto",children:"Auto"}),s.jsx("option",{value:"en",children:"English"}),s.jsx("option",{value:"ko",children:"한국어"}),s.jsx("option",{value:"ja",children:"日本語"})]})]})]}),Pe==="project"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Project Setup"}),s.jsxs("div",{className:rt(T==="fresh"),onClick:()=>{$("fresh"),V(null)},children:[s.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Create a new AI company from scratch with clean directory structure."})]}),s.jsxs("div",{className:rt(T==="existing"),onClick:()=>$("existing"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["📂"," Connect Existing Project"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Add AI company structure to an existing codebase or knowledge base."}),T==="existing"&&s.jsxs("div",{className:"mt-3",onClick:pe=>pe.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${Oe} flex-1`,placeholder:"/path/to/your/project",value:B,onChange:pe=>{G(pe.target.value),V(null)},autoFocus:!0}),s.jsx("button",{onClick:()=>je(!ie),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),s.jsx("button",{onClick:tn,disabled:U||!B.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:U||!B.trim()?.5:1},children:U?"...":"Verify"})]}),ne===!0&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Path verified: ",B]}),ne===!1&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," Invalid path"]}),ie&&s.jsx(Ac,{onSelect:pe=>{G(pe),V(!0),je(!1)},onClose:()=>je(!1)})]})]})]}),Pe==="knowledge"&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Knowledge Strategy"}),s.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"How should AI handle your knowledge base?"}),s.jsxs("div",{className:rt(R==="skip"),onClick:()=>M("skip"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Empty knowledge base. Add documents later from the office."})]}),s.jsxs("div",{className:rt(R==="import"),onClick:()=>M("import"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["📚"," Import & Build"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Select folders with documents — AI reads, summarizes, and organizes them."}),R==="import"&&s.jsxs("div",{className:"mt-3 space-y-2",onClick:pe=>pe.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${Oe} flex-1`,placeholder:"/path/to/docs",value:de,onChange:pe=>Se(pe.target.value),onKeyDown:pe=>{pe.key==="Enter"&&(pe.preventDefault(),Ml())},autoFocus:!0}),s.jsx("button",{onClick:()=>Fe(!ve),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),s.jsx("button",{onClick:Ml,disabled:!de.trim(),className:"px-3 py-2 rounded text-xs font-medium",style:{background:"var(--accent)",color:"#fff",opacity:de.trim()?1:.5},children:"Add"})]}),ve&&s.jsx(Ac,{onSelect:pe=>{K.includes(pe)||D([...K,pe]),Fe(!1)},onClose:()=>Fe(!1)}),K.length>0&&s.jsx("div",{className:"space-y-1",children:K.map((pe,gt)=>s.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:[s.jsx("span",{className:"flex-1 truncate",style:{fontFamily:"var(--pixel-font)"},children:pe}),s.jsx("button",{onClick:()=>D(K.filter((dn,nn)=>nn!==gt)),className:"opacity-50 hover:opacity-100",children:"✕"})]},gt))}),K.length===0&&s.jsx("div",{className:"text-[10px] text-center py-2",style:{color:"var(--terminal-text-muted)"},children:"Add at least one folder to import."})]})]}),s.jsxs("div",{className:rt(R==="existing-akb"),onClick:()=>M("existing-akb"),children:[s.jsxs("div",{className:"font-medium text-sm",children:["🔗"," Connect Existing AKB"]}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Connect a directory that already has CLAUDE.md and AKB structure."}),R==="existing-akb"&&s.jsxs("div",{className:"mt-3",onClick:pe=>pe.stopPropagation(),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{className:`${Oe} flex-1`,placeholder:"/path/to/your/akb",value:Me,onChange:pe=>{$e(pe.target.value),tt(null)},autoFocus:!0}),s.jsx("button",{onClick:()=>ge(!ye),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),s.jsx("button",{onClick:yn,disabled:mt||!Me.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:mt||!Me.trim()?.5:1},children:mt?"...":"Verify"})]}),fe===!0&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Valid AKB found: ",Me]}),fe===!1&&s.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," No valid AKB (CLAUDE.md required)"]}),ye&&s.jsx(Ac,{onSelect:pe=>{$e(pe),tt(null),ge(!1)},onClose:()=>ge(!1)})]})]})]}),Pe==="team"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Team Template"}),s.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"Choose a starting team. You can add or remove roles later."}),Le.map(pe=>s.jsxs("div",{className:rt(ze===pe.id),onClick:()=>Te(pe.id),children:[s.jsx("div",{className:"font-medium text-sm capitalize",children:pe.id}),s.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:pe.roles.map(gt=>s.jsx("span",{className:"px-2 py-0.5 rounded text-[10px]",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:gt.name},gt.id))})]},pe.id)),s.jsxs("div",{className:rt(ze==="custom"),onClick:()=>Te("custom"),children:[s.jsx("div",{className:"font-medium text-sm",children:"Custom"}),s.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Start with no pre-built roles. Hire them from the office."})]})]}),Pe==="create"&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:Ge?R==="existing-akb"?"AKB Connected!":"Company Created!":"Review & Create"}),!Ge&&!Ne&&!xe&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"rounded-lg p-4 space-y-2 text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:R==="existing-akb"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Mode:"})," Connect Existing AKB"]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Path:"})," ",Me]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Company:"})," ",y]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Location:"})," ",E||"(default)"]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Project:"})," ",T==="fresh"?"Start Fresh":`Existing (${B})`]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Knowledge:"})," ",R==="skip"?"Fresh (empty)":`Import ${K.length} source(s)`]}),s.jsxs("div",{children:[s.jsx("span",{className:"opacity-50",children:"Team:"})," ",ze]}),R==="import"&&K.length>0&&s.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--idle-amber)"},children:"Knowledge import will run in the background after entering the office."})]})}),ct&&s.jsx("div",{className:"text-xs p-3 rounded",style:{background:"rgba(220,38,38,0.15)",color:"#f87171"},children:ct})]}),(Ne||xe)&&s.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[s.jsx("div",{className:"w-8 h-8 border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),s.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:xe?"Connecting to AKB...":"Scaffolding your company..."})]}),Ge&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-center py-4 text-4xl",children:"🏢"}),Re&&s.jsxs("div",{className:"rounded-lg p-3 text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:[s.jsx("span",{className:"opacity-50",children:"Location:"})," ",Re]}),s.jsx("div",{className:"rounded-lg p-4 text-xs max-h-40 overflow-y-auto",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:se.map((pe,gt)=>s.jsxs("div",{className:"py-0.5",children:[s.jsx("span",{style:{color:"var(--active-green)"},children:"✓"})," ",pe]},gt))}),R==="import"&&K.length>0&&s.jsx("div",{className:"text-xs p-3 rounded",style:{background:"var(--accent)",color:"#fff",opacity:.9},children:"Knowledge import will start in the background after entering the office."})]})]})]}),s.jsxs("div",{className:"px-6 py-4 flex justify-between items-center",style:{borderTop:"1px solid var(--terminal-border)"},children:[s.jsx("div",{children:l>0&&!Ge&&s.jsx("button",{onClick:ut,className:"px-4 py-2 rounded text-sm transition-colors",style:{color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Back"})}),s.jsxs("div",{className:"text-xs",style:{color:"var(--terminal-text-muted)"},children:[l+1," / ",vt.length]}),s.jsx("div",{children:Ge?s.jsx("button",{onClick:$n,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:"var(--active-green)",color:"#fff"},children:"Enter Office"}):s.jsx("button",{onClick:At,disabled:!nt()||Ne||xe,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:nt()?"var(--accent)":"var(--terminal-border)",color:"#fff",opacity:nt()&&!Ne&&!xe?1:.5},children:Pe==="create"?Ne||xe?xe?"Connecting...":"Creating...":R==="existing-akb"?"Connect AKB":"Create Company":"Next"})})]})]})})}function wN(){const[e,l]=k.useState(null),[r,i]=k.useState(!0),[c,u]=k.useState(null),d=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(()=>{d()},[d]),{initialized:(e==null?void 0:e.initialized)??!1,companyName:(e==null?void 0:e.companyName)??null,engine:(e==null?void 0:e.engine)??"none",companyRoot:(e==null?void 0:e.companyRoot)??"",loading:r,error:c,refetch:d}}const kN=k.lazy(()=>P2(()=>import("./preview-app-BOW9DPhf.js"),[]));function Hg(){return s.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"w-10 h-10 mx-auto border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),s.jsx("div",{className:"mt-4 text-sm",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Loading..."})]})})}function jN(){var e;try{const l=localStorage.getItem("tycono-theme"),r=l&&l in oa?l:"default",i=(e=oa[r])==null?void 0:e.vars;if(!i)return;const c=document.documentElement;for(const[u,d]of Object.entries(i))c.style.setProperty(u,d)}catch{}}function SN(){const{initialized:e,loading:l,refetch:r}=wN(),[i,c]=k.useState(null);k.useEffect(()=>{jN()},[]);const u=d=>{d&&c(d),r()};return l?s.jsx(Hg,{}):e?s.jsx(gN,{importJob:i,onImportDone:()=>c(null)}):s.jsx(vN,{onComplete:u})}function CN(){const e=new URLSearchParams(window.location.search).has("sprite-preview");return s.jsx(ev,{children:e?s.jsx(k.Suspense,{fallback:s.jsx(Hg,{}),children:s.jsx(kN,{})}):s.jsx(SN,{})})}Q2.createRoot(document.getElementById("root")).render(s.jsx(k.StrictMode,{children:s.jsx(CN,{})}));export{wg as H,jg as P,Sg as S,AN as a,kg as b,vg as c,nh as d,zj as e,Tj as f,NN as g,Mj as h,s as j,k as r};
|