tycono 0.1.23 → 0.1.25
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.
|
@@ -6,7 +6,7 @@ var Lb=Object.defineProperty;var $b=(t,l,r)=>l in t?Lb(t,l,{enumerable:!0,config
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var r1;function Hb(){if(r1)return fs;r1=1;var t=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function r(i,c,u){var f=null;if(u!==void 0&&(f=""+u),c.key!==void 0&&(f=""+c.key),"key"in c){u={};for(var m in c)m!=="key"&&(u[m]=c[m])}else u=c;return c=u.ref,{$$typeof:t,type:i,key:f,ref:c!==void 0?c:null,props:u}}return fs.Fragment=l,fs.jsx=r,fs.jsxs=r,fs}var a1;function Ub(){return a1||(a1=1,Vf.exports=Hb()),Vf.exports}var o=Ub(),Gf={exports:{}},
|
|
9
|
+
*/var r1;function Hb(){if(r1)return fs;r1=1;var t=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function r(i,c,u){var f=null;if(u!==void 0&&(f=""+u),c.key!==void 0&&(f=""+c.key),"key"in c){u={};for(var m in c)m!=="key"&&(u[m]=c[m])}else u=c;return c=u.ref,{$$typeof:t,type:i,key:f,ref:c!==void 0?c:null,props:u}}return fs.Fragment=l,fs.jsx=r,fs.jsxs=r,fs}var a1;function Ub(){return a1||(a1=1,Vf.exports=Hb()),Vf.exports}var o=Ub(),Gf={exports:{}},Ve={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react.production.js
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@ var Lb=Object.defineProperty;var $b=(t,l,r)=>l in t?Lb(t,l,{enumerable:!0,config
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var i1;function Ib(){if(i1)return
|
|
17
|
+
*/var i1;function Ib(){if(i1)return Ve;i1=1;var t=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),f=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function v(B){return B===null||typeof B!="object"?null:(B=b&&B[b]||B["@@iterator"],typeof B=="function"?B:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,E={};function C(B,W,T){this.props=B,this.context=W,this.refs=E,this.updater=T||j}C.prototype.isReactComponent={},C.prototype.setState=function(B,W){if(typeof B!="object"&&typeof B!="function"&&B!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,B,W,"setState")},C.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function A(){}A.prototype=C.prototype;function M(B,W,T){this.props=B,this.context=W,this.refs=E,this.updater=T||j}var R=M.prototype=new A;R.constructor=M,S(R,C.prototype),R.isPureReactComponent=!0;var L=Array.isArray;function O(){}var U={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function ne(B,W,T){var me=T.ref;return{$$typeof:t,type:B,key:W,ref:me!==void 0?me:null,props:T}}function D(B,W){return ne(B.type,W,B.props)}function Y(B){return typeof B=="object"&&B!==null&&B.$$typeof===t}function F(B){var W={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(T){return W[T]})}var Q=/\/+/g;function ee(B,W){return typeof B=="object"&&B!==null&&B.key!=null?F(""+B.key):W.toString(36)}function V(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(O,O):(B.status="pending",B.then(function(W){B.status==="pending"&&(B.status="fulfilled",B.value=W)},function(W){B.status==="pending"&&(B.status="rejected",B.reason=W)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function I(B,W,T,me,Se){var Ee=typeof B;(Ee==="undefined"||Ee==="boolean")&&(B=null);var Oe=!1;if(B===null)Oe=!0;else switch(Ee){case"bigint":case"string":case"number":Oe=!0;break;case"object":switch(B.$$typeof){case t:case l:Oe=!0;break;case g:return Oe=B._init,I(Oe(B._payload),W,T,me,Se)}}if(Oe)return Se=Se(B),Oe=me===""?"."+ee(B,0):me,L(Se)?(T="",Oe!=null&&(T=Oe.replace(Q,"$&/")+"/"),I(Se,W,T,"",function(ke){return ke})):Se!=null&&(Y(Se)&&(Se=D(Se,T+(Se.key==null||B&&B.key===Se.key?"":(""+Se.key).replace(Q,"$&/")+"/")+Oe)),W.push(Se)),1;Oe=0;var He=me===""?".":me+":";if(L(B))for(var Ge=0;Ge<B.length;Ge++)me=B[Ge],Ee=He+ee(me,Ge),Oe+=I(me,W,T,Ee,Se);else if(Ge=v(B),typeof Ge=="function")for(B=Ge.call(B),Ge=0;!(me=B.next()).done;)me=me.value,Ee=He+ee(me,Ge++),Oe+=I(me,W,T,Ee,Se);else if(Ee==="object"){if(typeof B.then=="function")return I(V(B),W,T,me,Se);throw W=String(B),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return Oe}function Z(B,W,T){if(B==null)return B;var me=[],Se=0;return I(B,me,"","",function(Ee){return W.call(T,Ee,Se++)}),me}function ce(B){if(B._status===-1){var W=B._result;W=W(),W.then(function(T){(B._status===0||B._status===-1)&&(B._status=1,B._result=T)},function(T){(B._status===0||B._status===-1)&&(B._status=2,B._result=T)}),B._status===-1&&(B._status=0,B._result=W)}if(B._status===1)return B._result.default;throw B._result}var we=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},z={map:Z,forEach:function(B,W,T){Z(B,function(){W.apply(this,arguments)},T)},count:function(B){var W=0;return Z(B,function(){W++}),W},toArray:function(B){return Z(B,function(W){return W})||[]},only:function(B){if(!Y(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return Ve.Activity=y,Ve.Children=z,Ve.Component=C,Ve.Fragment=r,Ve.Profiler=c,Ve.PureComponent=M,Ve.StrictMode=i,Ve.Suspense=x,Ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=U,Ve.__COMPILER_RUNTIME={__proto__:null,c:function(B){return U.H.useMemoCache(B)}},Ve.cache=function(B){return function(){return B.apply(null,arguments)}},Ve.cacheSignal=function(){return null},Ve.cloneElement=function(B,W,T){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var me=S({},B.props),Se=B.key;if(W!=null)for(Ee in W.key!==void 0&&(Se=""+W.key),W)!X.call(W,Ee)||Ee==="key"||Ee==="__self"||Ee==="__source"||Ee==="ref"&&W.ref===void 0||(me[Ee]=W[Ee]);var Ee=arguments.length-2;if(Ee===1)me.children=T;else if(1<Ee){for(var Oe=Array(Ee),He=0;He<Ee;He++)Oe[He]=arguments[He+2];me.children=Oe}return ne(B.type,Se,me)},Ve.createContext=function(B){return B={$$typeof:f,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:u,_context:B},B},Ve.createElement=function(B,W,T){var me,Se={},Ee=null;if(W!=null)for(me in W.key!==void 0&&(Ee=""+W.key),W)X.call(W,me)&&me!=="key"&&me!=="__self"&&me!=="__source"&&(Se[me]=W[me]);var Oe=arguments.length-2;if(Oe===1)Se.children=T;else if(1<Oe){for(var He=Array(Oe),Ge=0;Ge<Oe;Ge++)He[Ge]=arguments[Ge+2];Se.children=He}if(B&&B.defaultProps)for(me in Oe=B.defaultProps,Oe)Se[me]===void 0&&(Se[me]=Oe[me]);return ne(B,Ee,Se)},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(B){return{$$typeof:m,render:B}},Ve.isValidElement=Y,Ve.lazy=function(B){return{$$typeof:g,_payload:{_status:-1,_result:B},_init:ce}},Ve.memo=function(B,W){return{$$typeof:d,type:B,compare:W===void 0?null:W}},Ve.startTransition=function(B){var W=U.T,T={};U.T=T;try{var me=B(),Se=U.S;Se!==null&&Se(T,me),typeof me=="object"&&me!==null&&typeof me.then=="function"&&me.then(O,we)}catch(Ee){we(Ee)}finally{W!==null&&T.types!==null&&(W.types=T.types),U.T=W}},Ve.unstable_useCacheRefresh=function(){return U.H.useCacheRefresh()},Ve.use=function(B){return U.H.use(B)},Ve.useActionState=function(B,W,T){return U.H.useActionState(B,W,T)},Ve.useCallback=function(B,W){return U.H.useCallback(B,W)},Ve.useContext=function(B){return U.H.useContext(B)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(B,W){return U.H.useDeferredValue(B,W)},Ve.useEffect=function(B,W){return U.H.useEffect(B,W)},Ve.useEffectEvent=function(B){return U.H.useEffectEvent(B)},Ve.useId=function(){return U.H.useId()},Ve.useImperativeHandle=function(B,W,T){return U.H.useImperativeHandle(B,W,T)},Ve.useInsertionEffect=function(B,W){return U.H.useInsertionEffect(B,W)},Ve.useLayoutEffect=function(B,W){return U.H.useLayoutEffect(B,W)},Ve.useMemo=function(B,W){return U.H.useMemo(B,W)},Ve.useOptimistic=function(B,W){return U.H.useOptimistic(B,W)},Ve.useReducer=function(B,W,T){return U.H.useReducer(B,W,T)},Ve.useRef=function(B){return U.H.useRef(B)},Ve.useState=function(B){return U.H.useState(B)},Ve.useSyncExternalStore=function(B,W,T){return U.H.useSyncExternalStore(B,W,T)},Ve.useTransition=function(){return U.H.useTransition()},Ve.version="19.2.4",Ve}var s1;function th(){return s1||(s1=1,Gf.exports=Ib()),Gf.exports}var k=th(),Kf={exports:{}},ds={},Qf={exports:{}},Wf={};/**
|
|
18
18
|
* @license React
|
|
19
19
|
* scheduler.production.js
|
|
20
20
|
*
|
|
@@ -22,7 +22,7 @@ var Lb=Object.defineProperty;var $b=(t,l,r)=>l in t?Lb(t,l,{enumerable:!0,config
|
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the MIT license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var o1;function Yb(){return o1||(o1=1,(function(t){function l(I,Z){var ce=I.length;I.push(Z);e:for(;0<ce;){var we=ce-1>>>1,z=I[we];if(0<c(z,Z))I[we]=Z,I[ce]=z,ce=we;else break e}}function r(I){return I.length===0?null:I[0]}function i(I){if(I.length===0)return null;var Z=I[0],ce=I.pop();if(ce!==Z){I[0]=ce;e:for(var we=0,z=I.length,B=z>>>1;we<B;){var W=2*(we+1)-1,T=I[W],me=W+1,Se=I[me];if(0>c(T,ce))me<z&&0>c(Se,T)?(I[we]=Se,I[me]=ce,we=me):(I[we]=T,I[W]=ce,we=W);else if(me<z&&0>c(Se,ce))I[we]=Se,I[me]=ce,we=me;else break e}}return Z}function c(I,Z){var ce=I.sortIndex-Z.sortIndex;return ce!==0?ce:I.id-Z.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var f=Date,m=f.now();t.unstable_now=function(){return f.now()-m}}var x=[],d=[],g=1,y=null,b=3,v=!1,j=!1,S=!1,E=!1,C=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function
|
|
25
|
+
*/var o1;function Yb(){return o1||(o1=1,(function(t){function l(I,Z){var ce=I.length;I.push(Z);e:for(;0<ce;){var we=ce-1>>>1,z=I[we];if(0<c(z,Z))I[we]=Z,I[ce]=z,ce=we;else break e}}function r(I){return I.length===0?null:I[0]}function i(I){if(I.length===0)return null;var Z=I[0],ce=I.pop();if(ce!==Z){I[0]=ce;e:for(var we=0,z=I.length,B=z>>>1;we<B;){var W=2*(we+1)-1,T=I[W],me=W+1,Se=I[me];if(0>c(T,ce))me<z&&0>c(Se,T)?(I[we]=Se,I[me]=ce,we=me):(I[we]=T,I[W]=ce,we=W);else if(me<z&&0>c(Se,ce))I[we]=Se,I[me]=ce,we=me;else break e}}return Z}function c(I,Z){var ce=I.sortIndex-Z.sortIndex;return ce!==0?ce:I.id-Z.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var f=Date,m=f.now();t.unstable_now=function(){return f.now()-m}}var x=[],d=[],g=1,y=null,b=3,v=!1,j=!1,S=!1,E=!1,C=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function R(I){for(var Z=r(d);Z!==null;){if(Z.callback===null)i(d);else if(Z.startTime<=I)i(d),Z.sortIndex=Z.expirationTime,l(x,Z);else break;Z=r(d)}}function L(I){if(S=!1,R(I),!j)if(r(x)!==null)j=!0,O||(O=!0,F());else{var Z=r(d);Z!==null&&V(L,Z.startTime-I)}}var O=!1,U=-1,X=5,ne=-1;function D(){return E?!0:!(t.unstable_now()-ne<X)}function Y(){if(E=!1,O){var I=t.unstable_now();ne=I;var Z=!0;try{e:{j=!1,S&&(S=!1,A(U),U=-1),v=!0;var ce=b;try{t:{for(R(I),y=r(x);y!==null&&!(y.expirationTime>I&&D());){var we=y.callback;if(typeof we=="function"){y.callback=null,b=y.priorityLevel;var z=we(y.expirationTime<=I);if(I=t.unstable_now(),typeof z=="function"){y.callback=z,R(I),Z=!0;break t}y===r(x)&&i(x),R(I)}else i(x);y=r(x)}if(y!==null)Z=!0;else{var B=r(d);B!==null&&V(L,B.startTime-I),Z=!1}}break e}finally{y=null,b=ce,v=!1}Z=void 0}}finally{Z?F():O=!1}}}var F;if(typeof M=="function")F=function(){M(Y)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,ee=Q.port2;Q.port1.onmessage=Y,F=function(){ee.postMessage(null)}}else F=function(){C(Y,0)};function V(I,Z){U=C(function(){I(t.unstable_now())},Z)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(I){I.callback=null},t.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<I?Math.floor(1e3/I):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(I){switch(b){case 1:case 2:case 3:var Z=3;break;default:Z=b}var ce=b;b=Z;try{return I()}finally{b=ce}},t.unstable_requestPaint=function(){E=!0},t.unstable_runWithPriority=function(I,Z){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var ce=b;b=I;try{return Z()}finally{b=ce}},t.unstable_scheduleCallback=function(I,Z,ce){var we=t.unstable_now();switch(typeof ce=="object"&&ce!==null?(ce=ce.delay,ce=typeof ce=="number"&&0<ce?we+ce:we):ce=we,I){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=ce+z,I={id:g++,callback:Z,priorityLevel:I,startTime:ce,expirationTime:z,sortIndex:-1},ce>we?(I.sortIndex=ce,l(d,I),r(x)===null&&I===r(d)&&(S?(A(U),U=-1):S=!0,V(L,ce-we))):(I.sortIndex=z,l(x,I),j||v||(j=!0,O||(O=!0,F()))),I},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(I){var Z=b;return function(){var ce=b;b=Z;try{return I.apply(this,arguments)}finally{b=ce}}}})(Wf)),Wf}var c1;function qb(){return c1||(c1=1,Qf.exports=Yb()),Qf.exports}var Zf={exports:{}},pn={};/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.js
|
|
28
28
|
*
|
|
@@ -30,7 +30,7 @@ var Lb=Object.defineProperty;var $b=(t,l,r)=>l in t?Lb(t,l,{enumerable:!0,config
|
|
|
30
30
|
*
|
|
31
31
|
* This source code is licensed under the MIT license found in the
|
|
32
32
|
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var u1;function Xb(){if(u1)return
|
|
33
|
+
*/var u1;function Xb(){if(u1)return pn;u1=1;var t=th();function l(x){var d="https://react.dev/errors/"+x;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)d+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+x+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var i={d:{f:r,r:function(){throw Error(l(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},c=Symbol.for("react.portal");function u(x,d,g){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:y==null?null:""+y,children:x,containerInfo:d,implementation:g}}var f=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(x,d){if(x==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return pn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,pn.createPortal=function(x,d){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(l(299));return u(x,d,null,g)},pn.flushSync=function(x){var d=f.T,g=i.p;try{if(f.T=null,i.p=2,x)return x()}finally{f.T=d,i.p=g,i.d.f()}},pn.preconnect=function(x,d){typeof x=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,i.d.C(x,d))},pn.prefetchDNS=function(x){typeof x=="string"&&i.d.D(x)},pn.preinit=function(x,d){if(typeof x=="string"&&d&&typeof d.as=="string"){var g=d.as,y=m(g,d.crossOrigin),b=typeof d.integrity=="string"?d.integrity:void 0,v=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;g==="style"?i.d.S(x,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:v}):g==="script"&&i.d.X(x,{crossOrigin:y,integrity:b,fetchPriority:v,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},pn.preinitModule=function(x,d){if(typeof x=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var g=m(d.as,d.crossOrigin);i.d.M(x,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&i.d.M(x)},pn.preload=function(x,d){if(typeof x=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var g=d.as,y=m(g,d.crossOrigin);i.d.L(x,g,{crossOrigin:y,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},pn.preloadModule=function(x,d){if(typeof x=="string")if(d){var g=m(d.as,d.crossOrigin);i.d.m(x,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else i.d.m(x)},pn.requestFormReset=function(x){i.d.r(x)},pn.unstable_batchedUpdates=function(x,d){return x(d)},pn.useFormState=function(x,d,g){return f.H.useFormState(x,d,g)},pn.useFormStatus=function(){return f.H.useHostTransitionStatus()},pn.version="19.2.4",pn}var f1;function Vb(){if(f1)return Zf.exports;f1=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(l){console.error(l)}}return t(),Zf.exports=Xb(),Zf.exports}/**
|
|
34
34
|
* @license React
|
|
35
35
|
* react-dom-client.production.js
|
|
36
36
|
*
|
|
@@ -38,63 +38,63 @@ var Lb=Object.defineProperty;var $b=(t,l,r)=>l in t?Lb(t,l,{enumerable:!0,config
|
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the MIT license found in the
|
|
40
40
|
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var d1;function Gb(){if(d1)return ds;d1=1;var t=qb(),l=th(),r=Vb();function i(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a:null}function f(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function x(e){if(u(e)!==e)throw Error(i(188))}function d(e){var n=e.alternate;if(!n){if(n=u(e),n===null)throw Error(i(188));return n!==e?null:e}for(var a=e,s=n;;){var h=a.return;if(h===null)break;var p=h.alternate;if(p===null){if(s=h.return,s!==null){a=s;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===a)return x(h),e;if(p===s)return x(h),n;p=p.sibling}throw Error(i(188))}if(a.return!==s.return)a=h,s=p;else{for(var w=!1,N=h.child;N;){if(N===a){w=!0,a=h,s=p;break}if(N===s){w=!0,s=h,a=p;break}N=N.sibling}if(!w){for(N=p.child;N;){if(N===a){w=!0,a=p,s=h;break}if(N===s){w=!0,s=p,a=h;break}N=N.sibling}if(!w)throw Error(i(189))}}if(a.alternate!==s)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?e:n}function g(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=g(e),n!==null)return n;e=e.sibling}return null}var y=Object.assign,b=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),M=Symbol.for("react.context"),
|
|
41
|
+
*/var d1;function Gb(){if(d1)return ds;d1=1;var t=qb(),l=th(),r=Vb();function i(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a:null}function f(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function x(e){if(u(e)!==e)throw Error(i(188))}function d(e){var n=e.alternate;if(!n){if(n=u(e),n===null)throw Error(i(188));return n!==e?null:e}for(var a=e,s=n;;){var h=a.return;if(h===null)break;var p=h.alternate;if(p===null){if(s=h.return,s!==null){a=s;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===a)return x(h),e;if(p===s)return x(h),n;p=p.sibling}throw Error(i(188))}if(a.return!==s.return)a=h,s=p;else{for(var w=!1,N=h.child;N;){if(N===a){w=!0,a=h,s=p;break}if(N===s){w=!0,s=h,a=p;break}N=N.sibling}if(!w){for(N=p.child;N;){if(N===a){w=!0,a=p,s=h;break}if(N===s){w=!0,s=p,a=h;break}N=N.sibling}if(!w)throw Error(i(189))}}if(a.alternate!==s)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?e:n}function g(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=g(e),n!==null)return n;e=e.sibling}return null}var y=Object.assign,b=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),M=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),ne=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),Y=Symbol.iterator;function F(e){return e===null||typeof e!="object"?null:(e=Y&&e[Y]||e["@@iterator"],typeof e=="function"?e:null)}var Q=Symbol.for("react.client.reference");function ee(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Q?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case C:return"Profiler";case E:return"StrictMode";case L:return"Suspense";case O:return"SuspenseList";case ne:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case j:return"Portal";case M:return e.displayName||"Context";case A:return(e._context.displayName||"Context")+".Consumer";case R:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case U:return n=e.displayName||null,n!==null?n:ee(e.type)||"Memo";case X:n=e._payload,e=e._init;try{return ee(e(n))}catch{}}return null}var V=Array.isArray,I=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},we=[],z=-1;function B(e){return{current:e}}function W(e){0>z||(e.current=we[z],we[z]=null,z--)}function T(e,n){z++,we[z]=e.current,e.current=n}var me=B(null),Se=B(null),Ee=B(null),Oe=B(null);function He(e,n){switch(T(Ee,n),T(Se,e),T(me,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?Ep(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=Ep(n),e=Np(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}W(me),T(me,e)}function Ge(){W(me),W(Se),W(Ee)}function ke(e){e.memoizedState!==null&&T(Oe,e);var n=me.current,a=Np(n,e.type);n!==a&&(T(Se,e),T(me,a))}function xt(e){Se.current===e&&(W(me),W(Se)),Oe.current===e&&(W(Oe),ss._currentValue=ce)}var he,G;function ie(e){if(he===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);he=n&&n[1]||"",G=-1<a.stack.indexOf(`
|
|
42
42
|
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
43
|
`+he+e+G}var xe=!1;function Te(e,n){if(!e||xe)return"";xe=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(n){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(le){var te=le}Reflect.construct(e,[],fe)}else{try{fe.call()}catch(le){te=le}e.call(fe.prototype)}}else{try{throw Error()}catch(le){te=le}(fe=e())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(le){if(le&&te&&typeof le.stack=="string")return[le.stack,te.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=s.DetermineComponentFrameRoot(),w=p[0],N=p[1];if(w&&N){var H=w.split(`
|
|
44
44
|
`),P=N.split(`
|
|
45
45
|
`);for(h=s=0;s<H.length&&!H[s].includes("DetermineComponentFrameRoot");)s++;for(;h<P.length&&!P[h].includes("DetermineComponentFrameRoot");)h++;if(s===H.length||h===P.length)for(s=H.length-1,h=P.length-1;1<=s&&0<=h&&H[s]!==P[h];)h--;for(;1<=s&&0<=h;s--,h--)if(H[s]!==P[h]){if(s!==1||h!==1)do if(s--,h--,0>h||H[s]!==P[h]){var se=`
|
|
46
|
-
`+H[s].replace(" at new "," at ");return e.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",e.displayName)),se}while(1<=s&&0<=h);break}}}finally{xe=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?ie(a):""}function Ne(e,n){switch(e.tag){case 26:case 27:case 5:return ie(e.type);case 16:return ie("Lazy");case 13:return e.child!==n&&n!==null?ie("Suspense Fallback"):ie("Suspense");case 19:return ie("SuspenseList");case 0:case 15:return Te(e.type,!1);case 11:return Te(e.type.render,!1);case 1:return Te(e.type,!0);case 31:return ie("Activity");default:return""}}function
|
|
46
|
+
`+H[s].replace(" at new "," at ");return e.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",e.displayName)),se}while(1<=s&&0<=h);break}}}finally{xe=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?ie(a):""}function Ne(e,n){switch(e.tag){case 26:case 27:case 5:return ie(e.type);case 16:return ie("Lazy");case 13:return e.child!==n&&n!==null?ie("Suspense Fallback"):ie("Suspense");case 19:return ie("SuspenseList");case 0:case 15:return Te(e.type,!1);case 11:return Te(e.type.render,!1);case 1:return Te(e.type,!0);case 31:return ie("Activity");default:return""}}function Re(e){try{var n="",a=null;do n+=Ne(e,a),a=e,e=e.return;while(e);return n}catch(s){return`
|
|
47
47
|
Error generating stack: `+s.message+`
|
|
48
|
-
`+s.stack}}var Ae=Object.prototype.hasOwnProperty,Re=t.unstable_scheduleCallback,Ke=t.unstable_cancelCallback,Lt=t.unstable_shouldYield,gt=t.unstable_requestPaint,ht=t.unstable_now,Zt=t.unstable_getCurrentPriorityLevel,re=t.unstable_ImmediatePriority,ye=t.unstable_UserBlockingPriority,ze=t.unstable_NormalPriority,Ue=t.unstable_LowPriority,be=t.unstable_IdlePriority,je=t.log,jt=t.unstable_setDisableYieldValue,wt=null,Xe=null;function ft(e){if(typeof je=="function"&&jt(e),Xe&&typeof Xe.setStrictMode=="function")try{Xe.setStrictMode(wt,e)}catch{}}var de=Math.clz32?Math.clz32:mi,Mt=Math.log,it=Math.LN2;function mi(e){return e>>>=0,e===0?32:31-(Mt(e)/it|0)|0}var Tl=256,ka=262144,Dl=4194304;function zl(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ar(e,n,a){var s=e.pendingLanes;if(s===0)return 0;var h=0,p=e.suspendedLanes,w=e.pingedLanes;e=e.warmLanes;var N=s&134217727;return N!==0?(s=N&~p,s!==0?h=zl(s):(w&=N,w!==0?h=zl(w):a||(a=N&~e,a!==0&&(h=zl(a))))):(N=s&~p,N!==0?h=zl(N):w!==0?h=zl(w):a||(a=s&~e,a!==0&&(h=zl(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 Ml(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function Sa(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Us(){var e=Dl;return Dl<<=1,(Dl&62914560)===0&&(Dl=4194304),e}function Xr(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function ir(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function xi(e,n,a,s,h,p){var w=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var N=e.entanglements,H=e.expirationTimes,P=e.hiddenUpdates;for(a=w&~a;0<a;){var se=31-de(a),fe=1<<se;N[se]=0,H[se]=-1;var te=P[se];if(te!==null)for(P[se]=null,se=0;se<te.length;se++){var le=te[se];le!==null&&(le.lane&=-536870913)}a&=~fe}s!==0&&On(e,s,0),p!==0&&h===0&&e.tag!==0&&(e.suspendedLanes|=p&~(w&~n))}function On(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var s=31-de(n);e.entangledLanes|=n,e.entanglements[s]=e.entanglements[s]|1073741824|a&261930}function Is(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var s=31-de(a),h=1<<s;h&n|e[s]&n&&(e[s]|=n),a&=~h}}function Fl(e,n){var a=n&-n;return a=(a&42)!==0?1:Vr(a),(a&(e.suspendedLanes|n))!==0?0:a}function Vr(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ml(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Rl(){var e=Z.p;return e!==0?e:(e=window.event,e===void 0?32:Wp(e.type))}function _l(e,n){var a=Z.p;try{return Z.p=e,n()}finally{Z.p=a}}var il=Math.random().toString(36).slice(2),$t="__reactFiber$"+il,cn="__reactProps$"+il,Ol="__reactContainer$"+il,Gr="__reactEvents$"+il,Ys="__reactListeners$"+il,qs="__reactHandles$"+il,xl="__reactResources$"+il,Bl="__reactMarker$"+il;function ja(e){delete e[$t],delete e[cn],delete e[Gr],delete e[Ys],delete e[qs]}function Ll(e){var n=e[$t];if(n)return n;for(var a=e.parentNode;a;){if(n=a[Ol]||a[$t]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=Rp(e);e!==null;){if(a=e[$t])return a;e=Rp(e)}return n}e=a,a=e.parentNode}return null}function sr(e){if(e=e[$t]||e[Ol]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function $l(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(i(33))}function un(e){var n=e[xl];return n||(n=e[xl]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Ft(e){e[Bl]=!0}var or=new Set,Xs={};function Cn(e,n){Xt(e,n),Xt(e+"Capture",n)}function Xt(e,n){for(Xs[e]=n,e=0;e<n.length;e++)or.add(n[e])}var Ca=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]*$"),Bn={},cr={};function pi(e){return Ae.call(cr,e)?!0:Ae.call(Bn,e)?!1:Ca.test(e)?cr[e]=!0:(Bn[e]=!0,!1)}function Ea(e,n,a){if(pi(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var s=n.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function pl(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function bn(e,n,a,s){if(s===null)e.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+s)}}function En(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ut(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Vs(e,n,a){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var h=s.get,p=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return h.call(this)},set:function(w){a=""+w,p.call(this,w)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function yi(e){if(!e._valueTracker){var n=Ut(e)?"checked":"value";e._valueTracker=Vs(e,n,""+e[n])}}function Gs(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),s="";return e&&(s=Ut(e)?e.checked?"true":"false":e.value),e=s,e!==a?(n.setValue(e),!0):!1}function Kr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var gi=/[\n"\\]/g;function Nn(e){return e.replace(gi,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function bi(e,n,a,s,h,p,w,N){e.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.type=w:e.removeAttribute("type"),n!=null?w==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+En(n)):e.value!==""+En(n)&&(e.value=""+En(n)):w!=="submit"&&w!=="reset"||e.removeAttribute("value"),n!=null?wi(e,w,En(n)):a!=null?wi(e,w,En(a)):s!=null&&e.removeAttribute("value"),h==null&&p!=null&&(e.defaultChecked=!!p),h!=null&&(e.checked=h&&typeof h!="function"&&typeof h!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+En(N):e.removeAttribute("name")}function vi(e,n,a,s,h,p,w,N){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),n!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||n!=null)){yi(e);return}a=a!=null?""+En(a):"",n=n!=null?""+En(n):a,N||n===e.value||(e.value=n),e.defaultValue=n}s=s??h,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=N?e.checked:!!s,e.defaultChecked=!!s,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(e.name=w),yi(e)}function wi(e,n,a){n==="number"&&Kr(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function ur(e,n,a,s){if(e=e.options,n){n={};for(var h=0;h<a.length;h++)n["$"+a[h]]=!0;for(a=0;a<e.length;a++)h=n.hasOwnProperty("$"+e[a].value),e[a].selected!==h&&(e[a].selected=h),h&&s&&(e[a].defaultSelected=!0)}else{for(a=""+En(a),n=null,h=0;h<e.length;h++){if(e[h].value===a){e[h].selected=!0,s&&(e[h].defaultSelected=!0);return}n!==null||e[h].disabled||(n=e[h])}n!==null&&(n.selected=!0)}}function Ks(e,n,a){if(n!=null&&(n=""+En(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+En(a):""}function Qs(e,n,a,s){if(n==null){if(s!=null){if(a!=null)throw Error(i(92));if(V(s)){if(1<s.length)throw Error(i(93));s=s[0]}a=s}a==null&&(a=""),n=a}a=En(n),e.defaultValue=a,s=e.textContent,s===a&&s!==""&&s!==null&&(e.value=s),yi(e)}function fr(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var qc=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Ws(e,n,a){var s=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?s?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":s?e.setProperty(n,a):typeof a!="number"||a===0||qc.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function sl(e,n,a){if(n!=null&&typeof n!="object")throw Error(i(62));if(e=e.style,a!=null){for(var s in a)!a.hasOwnProperty(s)||n!=null&&n.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var h in n)s=n[h],n.hasOwnProperty(h)&&a[h]!==s&&Ws(e,h,s)}else for(var p in n)n.hasOwnProperty(p)&&Ws(e,p,n[p])}function Qr(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Xc=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Vc=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ln(e){return Vc.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Qn(){}var ki=null;function Si(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var It=null,Wn=null;function ji(e){var n=sr(e);if(n&&(e=n.stateNode)){var a=e[cn]||null;e:switch(e=n.stateNode,n.type){case"input":if(bi(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Nn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var s=a[n];if(s!==e&&s.form===e.form){var h=s[cn]||null;if(!h)throw Error(i(90));bi(s,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(n=0;n<a.length;n++)s=a[n],s.form===e.form&&Gs(s)}break e;case"textarea":Ks(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&ur(e,!!a.multiple,n,!1)}}}var Na=!1;function Ci(e,n,a){if(Na)return e(n,a);Na=!0;try{var s=e(n);return s}finally{if(Na=!1,(It!==null||Wn!==null)&&(_o(),It&&(n=It,e=Wn,Wn=It=null,ji(n),e)))for(n=0;n<e.length;n++)ji(e[n])}}function _(e,n){var a=e.stateNode;if(a===null)return null;var s=a[cn]||null;if(s===null)return null;a=s[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(i(231,n,typeof a));return a}var ae=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ue=!1;if(ae)try{var pe={};Object.defineProperty(pe,"passive",{get:function(){ue=!0}}),window.addEventListener("test",pe,pe),window.removeEventListener("test",pe,pe)}catch{ue=!1}var ge=null,Me=null,Le=null;function Pe(){if(Le)return Le;var e,n=Me,a=n.length,s,h="value"in ge?ge.value:ge.textContent,p=h.length;for(e=0;e<a&&n[e]===h[e];e++);var w=a-e;for(s=1;s<=w&&n[a-s]===h[p-s];s++);return Le=h.slice(e,1<s?1-s:void 0)}function nt(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Ve(){return!0}function Yt(){return!1}function An(e){function n(a,s,h,p,w){this._reactName=a,this._targetInst=h,this.type=s,this.nativeEvent=p,this.target=w,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(a=e[N],this[N]=a?a(p):p[N]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Ve:Yt,this.isPropagationStopped=Yt,this}return y(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Ve)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Ve)},persist:function(){},isPersistent:Ve}),n}var Wr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zs=An(Wr),Ei=y({},Wr,{view:0,detail:0}),Og=An(Ei),Gc,Kc,Ni,Js=y({},Ei,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ni&&(Ni&&e.type==="mousemove"?(Gc=e.screenX-Ni.screenX,Kc=e.screenY-Ni.screenY):Kc=Gc=0,Ni=e),Gc)},movementY:function(e){return"movementY"in e?e.movementY:Kc}}),Th=An(Js),Bg=y({},Js,{dataTransfer:0}),Lg=An(Bg),$g=y({},Ei,{relatedTarget:0}),Qc=An($g),Hg=y({},Wr,{animationName:0,elapsedTime:0,pseudoElement:0}),Ug=An(Hg),Ig=y({},Wr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Yg=An(Ig),qg=y({},Wr,{data:0}),Dh=An(qg),Xg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Vg={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Gg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Kg(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Gg[e])?!!n[e]:!1}function Wc(){return Kg}var Qg=y({},Ei,{key:function(e){if(e.key){var n=Xg[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=nt(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Vg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wc,charCode:function(e){return e.type==="keypress"?nt(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?nt(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Wg=An(Qg),Zg=y({},Js,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zh=An(Zg),Jg=y({},Ei,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wc}),Pg=An(Jg),e2=y({},Wr,{propertyName:0,elapsedTime:0,pseudoElement:0}),t2=An(e2),n2=y({},Js,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),l2=An(n2),r2=y({},Wr,{newState:0,oldState:0}),a2=An(r2),i2=[9,13,27,32],Zc=ae&&"CompositionEvent"in window,Ai=null;ae&&"documentMode"in document&&(Ai=document.documentMode);var s2=ae&&"TextEvent"in window&&!Ai,Mh=ae&&(!Zc||Ai&&8<Ai&&11>=Ai),Fh=" ",Rh=!1;function _h(e,n){switch(e){case"keyup":return i2.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Oh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Aa=!1;function o2(e,n){switch(e){case"compositionend":return Oh(n);case"keypress":return n.which!==32?null:(Rh=!0,Fh);case"textInput":return e=n.data,e===Fh&&Rh?null:e;default:return null}}function c2(e,n){if(Aa)return e==="compositionend"||!Zc&&_h(e,n)?(e=Pe(),Le=Me=ge=null,Aa=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Mh&&n.locale!=="ko"?null:n.data;default:return null}}var u2={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Bh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!u2[e.type]:n==="textarea"}function Lh(e,n,a,s){It?Wn?Wn.push(s):Wn=[s]:It=s,n=Io(n,"onChange"),0<n.length&&(a=new Zs("onChange","change",null,a,s),e.push({event:a,listeners:n}))}var Ti=null,Di=null;function f2(e){vp(e,0)}function Ps(e){var n=$l(e);if(Gs(n))return e}function $h(e,n){if(e==="change")return n}var Hh=!1;if(ae){var Jc;if(ae){var Pc="oninput"in document;if(!Pc){var Uh=document.createElement("div");Uh.setAttribute("oninput","return;"),Pc=typeof Uh.oninput=="function"}Jc=Pc}else Jc=!1;Hh=Jc&&(!document.documentMode||9<document.documentMode)}function Ih(){Ti&&(Ti.detachEvent("onpropertychange",Yh),Di=Ti=null)}function Yh(e){if(e.propertyName==="value"&&Ps(Di)){var n=[];Lh(n,Di,e,Si(e)),Ci(f2,n)}}function d2(e,n,a){e==="focusin"?(Ih(),Ti=n,Di=a,Ti.attachEvent("onpropertychange",Yh)):e==="focusout"&&Ih()}function h2(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ps(Di)}function m2(e,n){if(e==="click")return Ps(n)}function x2(e,n){if(e==="input"||e==="change")return Ps(n)}function p2(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var $n=typeof Object.is=="function"?Object.is:p2;function zi(e,n){if($n(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),s=Object.keys(n);if(a.length!==s.length)return!1;for(s=0;s<a.length;s++){var h=a[s];if(!Ae.call(n,h)||!$n(e[h],n[h]))return!1}return!0}function qh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xh(e,n){var a=qh(e);e=0;for(var s;a;){if(a.nodeType===3){if(s=e+a.textContent.length,e<=n&&s>=n)return{node:a,offset:n-e};e=s}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=qh(a)}}function Vh(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Vh(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Gh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Kr(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=Kr(e.document)}return n}function eu(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var y2=ae&&"documentMode"in document&&11>=document.documentMode,Ta=null,tu=null,Mi=null,nu=!1;function Kh(e,n,a){var s=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;nu||Ta==null||Ta!==Kr(s)||(s=Ta,"selectionStart"in s&&eu(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Mi&&zi(Mi,s)||(Mi=s,s=Io(tu,"onSelect"),0<s.length&&(n=new Zs("onSelect","select",null,n,a),e.push({event:n,listeners:s}),n.target=Ta)))}function Zr(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var Da={animationend:Zr("Animation","AnimationEnd"),animationiteration:Zr("Animation","AnimationIteration"),animationstart:Zr("Animation","AnimationStart"),transitionrun:Zr("Transition","TransitionRun"),transitionstart:Zr("Transition","TransitionStart"),transitioncancel:Zr("Transition","TransitionCancel"),transitionend:Zr("Transition","TransitionEnd")},lu={},Qh={};ae&&(Qh=document.createElement("div").style,"AnimationEvent"in window||(delete Da.animationend.animation,delete Da.animationiteration.animation,delete Da.animationstart.animation),"TransitionEvent"in window||delete Da.transitionend.transition);function Jr(e){if(lu[e])return lu[e];if(!Da[e])return e;var n=Da[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Qh)return lu[e]=n[a];return e}var Wh=Jr("animationend"),Zh=Jr("animationiteration"),Jh=Jr("animationstart"),g2=Jr("transitionrun"),b2=Jr("transitionstart"),v2=Jr("transitioncancel"),Ph=Jr("transitionend"),em=new Map,ru="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");ru.push("scrollEnd");function ol(e,n){em.set(e,n),Cn(n,[e])}var eo=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Zn=[],za=0,au=0;function to(){for(var e=za,n=au=za=0;n<e;){var a=Zn[n];Zn[n++]=null;var s=Zn[n];Zn[n++]=null;var h=Zn[n];Zn[n++]=null;var p=Zn[n];if(Zn[n++]=null,s!==null&&h!==null){var w=s.pending;w===null?h.next=h:(h.next=w.next,w.next=h),s.pending=h}p!==0&&tm(a,h,p)}}function no(e,n,a,s){Zn[za++]=e,Zn[za++]=n,Zn[za++]=a,Zn[za++]=s,au|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function iu(e,n,a,s){return no(e,n,a,s),lo(e)}function Pr(e,n){return no(e,null,null,n),lo(e)}function tm(e,n,a){e.lanes|=a;var s=e.alternate;s!==null&&(s.lanes|=a);for(var h=!1,p=e.return;p!==null;)p.childLanes|=a,s=p.alternate,s!==null&&(s.childLanes|=a),p.tag===22&&(e=p.stateNode,e===null||e._visibility&1||(h=!0)),e=p,p=p.return;return e.tag===3?(p=e.stateNode,h&&n!==null&&(h=31-de(a),e=p.hiddenUpdates,s=e[h],s===null?e[h]=[n]:s.push(n),n.lane=a|536870912),p):null}function lo(e){if(50<es)throw es=0,pf=null,Error(i(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Ma={};function w2(e,n,a,s){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Hn(e,n,a,s){return new w2(e,n,a,s)}function su(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Hl(e,n){var a=e.alternate;return a===null?(a=Hn(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function nm(e,n){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function ro(e,n,a,s,h,p){var w=0;if(s=e,typeof e=="function")su(e)&&(w=1);else if(typeof e=="string")w=Eb(e,a,me.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ne:return e=Hn(31,a,n,h),e.elementType=ne,e.lanes=p,e;case S:return ea(a.children,h,p,n);case E:w=8,h|=24;break;case C:return e=Hn(12,a,n,h|2),e.elementType=C,e.lanes=p,e;case L:return e=Hn(13,a,n,h),e.elementType=L,e.lanes=p,e;case O:return e=Hn(19,a,n,h),e.elementType=O,e.lanes=p,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case M:w=10;break e;case A:w=9;break e;case F:w=11;break e;case U:w=14;break e;case X:w=16,s=null;break e}w=29,a=Error(i(130,e===null?"null":typeof e,"")),s=null}return n=Hn(w,a,n,h),n.elementType=e,n.type=s,n.lanes=p,n}function ea(e,n,a,s){return e=Hn(7,e,s,n),e.lanes=a,e}function ou(e,n,a){return e=Hn(6,e,null,n),e.lanes=a,e}function lm(e){var n=Hn(18,null,null,0);return n.stateNode=e,n}function cu(e,n,a){return n=Hn(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var rm=new WeakMap;function Jn(e,n){if(typeof e=="object"&&e!==null){var a=rm.get(e);return a!==void 0?a:(n={value:e,source:n,stack:Fe(n)},rm.set(e,n),n)}return{value:e,source:n,stack:Fe(n)}}var Fa=[],Ra=0,ao=null,Fi=0,Pn=[],el=0,dr=null,yl=1,gl="";function Ul(e,n){Fa[Ra++]=Fi,Fa[Ra++]=ao,ao=e,Fi=n}function am(e,n,a){Pn[el++]=yl,Pn[el++]=gl,Pn[el++]=dr,dr=e;var s=yl;e=gl;var h=32-de(s)-1;s&=~(1<<h),a+=1;var p=32-de(n)+h;if(30<p){var w=h-h%5;p=(s&(1<<w)-1).toString(32),s>>=w,h-=w,yl=1<<32-de(n)+h|a<<h|s,gl=p+e}else yl=1<<p|a<<h|s,gl=e}function uu(e){e.return!==null&&(Ul(e,1),am(e,1,0))}function fu(e){for(;e===ao;)ao=Fa[--Ra],Fa[Ra]=null,Fi=Fa[--Ra],Fa[Ra]=null;for(;e===dr;)dr=Pn[--el],Pn[el]=null,gl=Pn[--el],Pn[el]=null,yl=Pn[--el],Pn[el]=null}function im(e,n){Pn[el++]=yl,Pn[el++]=gl,Pn[el++]=dr,yl=n.id,gl=n.overflow,dr=e}var fn=null,_t=null,ut=!1,hr=null,tl=!1,du=Error(i(519));function mr(e){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ri(Jn(n,e)),du}function sm(e){var n=e.stateNode,a=e.type,s=e.memoizedProps;switch(n[$t]=e,n[cn]=s,a){case"dialog":rt("cancel",n),rt("close",n);break;case"iframe":case"object":case"embed":rt("load",n);break;case"video":case"audio":for(a=0;a<ns.length;a++)rt(ns[a],n);break;case"source":rt("error",n);break;case"img":case"image":case"link":rt("error",n),rt("load",n);break;case"details":rt("toggle",n);break;case"input":rt("invalid",n),vi(n,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":rt("invalid",n);break;case"textarea":rt("invalid",n),Qs(n,s.value,s.defaultValue,s.children)}a=s.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||s.suppressHydrationWarning===!0||jp(n.textContent,a)?(s.popover!=null&&(rt("beforetoggle",n),rt("toggle",n)),s.onScroll!=null&&rt("scroll",n),s.onScrollEnd!=null&&rt("scrollend",n),s.onClick!=null&&(n.onclick=Qn),n=!0):n=!1,n||mr(e,!0)}function om(e){for(fn=e.return;fn;)switch(fn.tag){case 5:case 31:case 13:tl=!1;return;case 27:case 3:tl=!0;return;default:fn=fn.return}}function _a(e){if(e!==fn)return!1;if(!ut)return om(e),ut=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||zf(e.type,e.memoizedProps)),a=!a),a&&_t&&mr(e),om(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));_t=Fp(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));_t=Fp(e)}else n===27?(n=_t,Ar(e.type)?(e=Of,Of=null,_t=e):_t=n):_t=fn?ll(e.stateNode.nextSibling):null;return!0}function ta(){_t=fn=null,ut=!1}function hu(){var e=hr;return e!==null&&(Mn===null?Mn=e:Mn.push.apply(Mn,e),hr=null),e}function Ri(e){hr===null?hr=[e]:hr.push(e)}var mu=B(null),na=null,Il=null;function xr(e,n,a){T(mu,n._currentValue),n._currentValue=a}function Yl(e){e._currentValue=mu.current,W(mu)}function xu(e,n,a){for(;e!==null;){var s=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,s!==null&&(s.childLanes|=n)):s!==null&&(s.childLanes&n)!==n&&(s.childLanes|=n),e===a)break;e=e.return}}function pu(e,n,a,s){var h=e.child;for(h!==null&&(h.return=e);h!==null;){var p=h.dependencies;if(p!==null){var w=h.child;p=p.firstContext;e:for(;p!==null;){var N=p;p=h;for(var H=0;H<n.length;H++)if(N.context===n[H]){p.lanes|=a,N=p.alternate,N!==null&&(N.lanes|=a),xu(p.return,a,e),s||(w=null);break e}p=N.next}}else if(h.tag===18){if(w=h.return,w===null)throw Error(i(341));w.lanes|=a,p=w.alternate,p!==null&&(p.lanes|=a),xu(w,a,e),w=null}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===e){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}}function Oa(e,n,a,s){e=null;for(var h=n,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var w=h.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var N=h.type;$n(h.pendingProps.value,w.value)||(e!==null?e.push(N):e=[N])}}else if(h===Be.current){if(w=h.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(e!==null?e.push(ss):e=[ss])}h=h.return}e!==null&&pu(n,e,a,s),n.flags|=262144}function io(e){for(e=e.firstContext;e!==null;){if(!$n(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function la(e){na=e,Il=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function dn(e){return cm(na,e)}function so(e,n){return na===null&&la(e),cm(e,n)}function cm(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Il===null){if(e===null)throw Error(i(308));Il=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Il=Il.next=n;return a}var k2=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,s){e.push(s)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},S2=t.unstable_scheduleCallback,j2=t.unstable_NormalPriority,Jt={$$typeof:M,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function yu(){return{controller:new k2,data:new Map,refCount:0}}function _i(e){e.refCount--,e.refCount===0&&S2(j2,function(){e.controller.abort()})}var Oi=null,gu=0,Ba=0,La=null;function C2(e,n){if(Oi===null){var a=Oi=[];gu=0,Ba=kf(),La={status:"pending",value:void 0,then:function(s){a.push(s)}}}return gu++,n.then(um,um),n}function um(){if(--gu===0&&Oi!==null){La!==null&&(La.status="fulfilled");var e=Oi;Oi=null,Ba=0,La=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function E2(e,n){var a=[],s={status:"pending",value:null,reason:null,then:function(h){a.push(h)}};return e.then(function(){s.status="fulfilled",s.value=n;for(var h=0;h<a.length;h++)(0,a[h])(n)},function(h){for(s.status="rejected",s.reason=h,h=0;h<a.length;h++)(0,a[h])(void 0)}),s}var fm=I.S;I.S=function(e,n){Kx=ht(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&C2(e,n),fm!==null&&fm(e,n)};var ra=B(null);function bu(){var e=ra.current;return e!==null?e:Tt.pooledCache}function oo(e,n){n===null?T(ra,ra.current):T(ra,n.pool)}function dm(){var e=bu();return e===null?null:{parent:Jt._currentValue,pool:e}}var $a=Error(i(460)),vu=Error(i(474)),co=Error(i(542)),uo={then:function(){}};function hm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function mm(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(Qn,Qn),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,pm(e),e;default:if(typeof n.status=="string")n.then(Qn,Qn);else{if(e=Tt,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=n,e.status="pending",e.then(function(s){if(n.status==="pending"){var h=n;h.status="fulfilled",h.value=s}},function(s){if(n.status==="pending"){var h=n;h.status="rejected",h.reason=s}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,pm(e),e}throw ia=n,$a}}function aa(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ia=a,$a):a}}var ia=null;function xm(){if(ia===null)throw Error(i(459));var e=ia;return ia=null,e}function pm(e){if(e===$a||e===co)throw Error(i(483))}var Ha=null,Bi=0;function fo(e){var n=Bi;return Bi+=1,Ha===null&&(Ha=[]),mm(Ha,e,n)}function Li(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function ho(e,n){throw n.$$typeof===b?Error(i(525)):(e=Object.prototype.toString.call(n),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function ym(e){function n(K,q){if(e){var J=K.deletions;J===null?(K.deletions=[q],K.flags|=16):J.push(q)}}function a(K,q){if(!e)return null;for(;q!==null;)n(K,q),q=q.sibling;return null}function s(K){for(var q=new Map;K!==null;)K.key!==null?q.set(K.key,K):q.set(K.index,K),K=K.sibling;return q}function h(K,q){return K=Hl(K,q),K.index=0,K.sibling=null,K}function p(K,q,J){return K.index=J,e?(J=K.alternate,J!==null?(J=J.index,J<q?(K.flags|=67108866,q):J):(K.flags|=67108866,q)):(K.flags|=1048576,q)}function w(K){return e&&K.alternate===null&&(K.flags|=67108866),K}function N(K,q,J,oe){return q===null||q.tag!==6?(q=ou(J,K.mode,oe),q.return=K,q):(q=h(q,J),q.return=K,q)}function H(K,q,J,oe){var $e=J.type;return $e===S?se(K,q,J.props.children,oe,J.key):q!==null&&(q.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===X&&aa($e)===q.type)?(q=h(q,J.props),Li(q,J),q.return=K,q):(q=ro(J.type,J.key,J.props,null,K.mode,oe),Li(q,J),q.return=K,q)}function P(K,q,J,oe){return q===null||q.tag!==4||q.stateNode.containerInfo!==J.containerInfo||q.stateNode.implementation!==J.implementation?(q=cu(J,K.mode,oe),q.return=K,q):(q=h(q,J.children||[]),q.return=K,q)}function se(K,q,J,oe,$e){return q===null||q.tag!==7?(q=ea(J,K.mode,oe,$e),q.return=K,q):(q=h(q,J),q.return=K,q)}function fe(K,q,J){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=ou(""+q,K.mode,J),q.return=K,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case v:return J=ro(q.type,q.key,q.props,null,K.mode,J),Li(J,q),J.return=K,J;case j:return q=cu(q,K.mode,J),q.return=K,q;case X:return q=aa(q),fe(K,q,J)}if(V(q)||R(q))return q=ea(q,K.mode,J,null),q.return=K,q;if(typeof q.then=="function")return fe(K,fo(q),J);if(q.$$typeof===M)return fe(K,so(K,q),J);ho(K,q)}return null}function te(K,q,J,oe){var $e=q!==null?q.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return $e!==null?null:N(K,q,""+J,oe);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case v:return J.key===$e?H(K,q,J,oe):null;case j:return J.key===$e?P(K,q,J,oe):null;case X:return J=aa(J),te(K,q,J,oe)}if(V(J)||R(J))return $e!==null?null:se(K,q,J,oe,null);if(typeof J.then=="function")return te(K,q,fo(J),oe);if(J.$$typeof===M)return te(K,q,so(K,J),oe);ho(K,J)}return null}function le(K,q,J,oe,$e){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return K=K.get(J)||null,N(q,K,""+oe,$e);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case v:return K=K.get(oe.key===null?J:oe.key)||null,H(q,K,oe,$e);case j:return K=K.get(oe.key===null?J:oe.key)||null,P(q,K,oe,$e);case X:return oe=aa(oe),le(K,q,J,oe,$e)}if(V(oe)||R(oe))return K=K.get(J)||null,se(q,K,oe,$e,null);if(typeof oe.then=="function")return le(K,q,J,fo(oe),$e);if(oe.$$typeof===M)return le(K,q,J,so(q,oe),$e);ho(q,oe)}return null}function De(K,q,J,oe){for(var $e=null,mt=null,_e=q,Ze=q=0,ot=null;_e!==null&&Ze<J.length;Ze++){_e.index>Ze?(ot=_e,_e=null):ot=_e.sibling;var xt=te(K,_e,J[Ze],oe);if(xt===null){_e===null&&(_e=ot);break}e&&_e&&xt.alternate===null&&n(K,_e),q=p(xt,q,Ze),mt===null?$e=xt:mt.sibling=xt,mt=xt,_e=ot}if(Ze===J.length)return a(K,_e),ut&&Ul(K,Ze),$e;if(_e===null){for(;Ze<J.length;Ze++)_e=fe(K,J[Ze],oe),_e!==null&&(q=p(_e,q,Ze),mt===null?$e=_e:mt.sibling=_e,mt=_e);return ut&&Ul(K,Ze),$e}for(_e=s(_e);Ze<J.length;Ze++)ot=le(_e,K,Ze,J[Ze],oe),ot!==null&&(e&&ot.alternate!==null&&_e.delete(ot.key===null?Ze:ot.key),q=p(ot,q,Ze),mt===null?$e=ot:mt.sibling=ot,mt=ot);return e&&_e.forEach(function(Fr){return n(K,Fr)}),ut&&Ul(K,Ze),$e}function Ye(K,q,J,oe){if(J==null)throw Error(i(151));for(var $e=null,mt=null,_e=q,Ze=q=0,ot=null,xt=J.next();_e!==null&&!xt.done;Ze++,xt=J.next()){_e.index>Ze?(ot=_e,_e=null):ot=_e.sibling;var Fr=te(K,_e,xt.value,oe);if(Fr===null){_e===null&&(_e=ot);break}e&&_e&&Fr.alternate===null&&n(K,_e),q=p(Fr,q,Ze),mt===null?$e=Fr:mt.sibling=Fr,mt=Fr,_e=ot}if(xt.done)return a(K,_e),ut&&Ul(K,Ze),$e;if(_e===null){for(;!xt.done;Ze++,xt=J.next())xt=fe(K,xt.value,oe),xt!==null&&(q=p(xt,q,Ze),mt===null?$e=xt:mt.sibling=xt,mt=xt);return ut&&Ul(K,Ze),$e}for(_e=s(_e);!xt.done;Ze++,xt=J.next())xt=le(_e,K,Ze,xt.value,oe),xt!==null&&(e&&xt.alternate!==null&&_e.delete(xt.key===null?Ze:xt.key),q=p(xt,q,Ze),mt===null?$e=xt:mt.sibling=xt,mt=xt);return e&&_e.forEach(function(Bb){return n(K,Bb)}),ut&&Ul(K,Ze),$e}function Nt(K,q,J,oe){if(typeof J=="object"&&J!==null&&J.type===S&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case v:e:{for(var $e=J.key;q!==null;){if(q.key===$e){if($e=J.type,$e===S){if(q.tag===7){a(K,q.sibling),oe=h(q,J.props.children),oe.return=K,K=oe;break e}}else if(q.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===X&&aa($e)===q.type){a(K,q.sibling),oe=h(q,J.props),Li(oe,J),oe.return=K,K=oe;break e}a(K,q);break}else n(K,q);q=q.sibling}J.type===S?(oe=ea(J.props.children,K.mode,oe,J.key),oe.return=K,K=oe):(oe=ro(J.type,J.key,J.props,null,K.mode,oe),Li(oe,J),oe.return=K,K=oe)}return w(K);case j:e:{for($e=J.key;q!==null;){if(q.key===$e)if(q.tag===4&&q.stateNode.containerInfo===J.containerInfo&&q.stateNode.implementation===J.implementation){a(K,q.sibling),oe=h(q,J.children||[]),oe.return=K,K=oe;break e}else{a(K,q);break}else n(K,q);q=q.sibling}oe=cu(J,K.mode,oe),oe.return=K,K=oe}return w(K);case X:return J=aa(J),Nt(K,q,J,oe)}if(V(J))return De(K,q,J,oe);if(R(J)){if($e=R(J),typeof $e!="function")throw Error(i(150));return J=$e.call(J),Ye(K,q,J,oe)}if(typeof J.then=="function")return Nt(K,q,fo(J),oe);if(J.$$typeof===M)return Nt(K,q,so(K,J),oe);ho(K,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,q!==null&&q.tag===6?(a(K,q.sibling),oe=h(q,J),oe.return=K,K=oe):(a(K,q),oe=ou(J,K.mode,oe),oe.return=K,K=oe),w(K)):a(K,q)}return function(K,q,J,oe){try{Bi=0;var $e=Nt(K,q,J,oe);return Ha=null,$e}catch(_e){if(_e===$a||_e===co)throw _e;var mt=Hn(29,_e,null,K.mode);return mt.lanes=oe,mt.return=K,mt}finally{}}}var sa=ym(!0),gm=ym(!1),pr=!1;function wu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ku(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function yr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function gr(e,n,a){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(bt&2)!==0){var h=s.pending;return h===null?n.next=n:(n.next=h.next,h.next=n),s.pending=n,n=lo(e),tm(e,null,a),n}return no(e,s,n,a),lo(e)}function $i(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var s=n.lanes;s&=e.pendingLanes,a|=s,n.lanes=a,Is(e,a)}}function Su(e,n){var a=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,a===s)){var h=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?h=p=w:p=p.next=w,a=a.next}while(a!==null);p===null?h=p=n:p=p.next=n}else h=p=n;a={baseState:s.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:s.shared,callbacks:s.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var ju=!1;function Hi(){if(ju){var e=La;if(e!==null)throw e}}function Ui(e,n,a,s){ju=!1;var h=e.updateQueue;pr=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,N=h.shared.pending;if(N!==null){h.shared.pending=null;var H=N,P=H.next;H.next=null,w===null?p=P:w.next=P,w=H;var se=e.alternate;se!==null&&(se=se.updateQueue,N=se.lastBaseUpdate,N!==w&&(N===null?se.firstBaseUpdate=P:N.next=P,se.lastBaseUpdate=H))}if(p!==null){var fe=h.baseState;w=0,se=P=H=null,N=p;do{var te=N.lane&-536870913,le=te!==N.lane;if(le?(st&te)===te:(s&te)===te){te!==0&&te===Ba&&(ju=!0),se!==null&&(se=se.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var De=e,Ye=N;te=n;var Nt=a;switch(Ye.tag){case 1:if(De=Ye.payload,typeof De=="function"){fe=De.call(Nt,fe,te);break e}fe=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=Ye.payload,te=typeof De=="function"?De.call(Nt,fe,te):De,te==null)break e;fe=y({},fe,te);break e;case 2:pr=!0}}te=N.callback,te!==null&&(e.flags|=64,le&&(e.flags|=8192),le=h.callbacks,le===null?h.callbacks=[te]:le.push(te))}else le={lane:te,tag:N.tag,payload:N.payload,callback:N.callback,next:null},se===null?(P=se=le,H=fe):se=se.next=le,w|=te;if(N=N.next,N===null){if(N=h.shared.pending,N===null)break;le=N,N=le.next,le.next=null,h.lastBaseUpdate=le,h.shared.pending=null}}while(!0);se===null&&(H=fe),h.baseState=H,h.firstBaseUpdate=P,h.lastBaseUpdate=se,p===null&&(h.shared.lanes=0),Sr|=w,e.lanes=w,e.memoizedState=fe}}function bm(e,n){if(typeof e!="function")throw Error(i(191,e));e.call(n)}function vm(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)bm(a[e],n)}var Ua=B(null),mo=B(0);function wm(e,n){e=Jl,T(mo,e),T(Ua,n),Jl=e|n.baseLanes}function Cu(){T(mo,Jl),T(Ua,Ua.current)}function Eu(){Jl=mo.current,W(Ua),W(mo)}var Un=B(null),nl=null;function br(e){var n=e.alternate;T(Qt,Qt.current&1),T(Un,e),nl===null&&(n===null||Ua.current!==null||n.memoizedState!==null)&&(nl=e)}function Nu(e){T(Qt,Qt.current),T(Un,e),nl===null&&(nl=e)}function km(e){e.tag===22?(T(Qt,Qt.current),T(Un,e),nl===null&&(nl=e)):vr()}function vr(){T(Qt,Qt.current),T(Un,Un.current)}function In(e){W(Un),nl===e&&(nl=null),W(Qt)}var Qt=B(0);function xo(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Rf(a)||_f(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var ql=0,We=null,Ct=null,Pt=null,po=!1,Ia=!1,oa=!1,yo=0,Ii=0,Ya=null,N2=0;function Vt(){throw Error(i(321))}function Au(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!$n(e[a],n[a]))return!1;return!0}function Tu(e,n,a,s,h,p){return ql=p,We=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,I.H=e===null||e.memoizedState===null?ax:qu,oa=!1,p=a(s,h),oa=!1,Ia&&(p=jm(n,a,s,h)),Sm(e),p}function Sm(e){I.H=Xi;var n=Ct!==null&&Ct.next!==null;if(ql=0,Pt=Ct=We=null,po=!1,Ii=0,Ya=null,n)throw Error(i(300));e===null||en||(e=e.dependencies,e!==null&&io(e)&&(en=!0))}function jm(e,n,a,s){We=e;var h=0;do{if(Ia&&(Ya=null),Ii=0,Ia=!1,25<=h)throw Error(i(301));if(h+=1,Pt=Ct=null,e.updateQueue!=null){var p=e.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}I.H=ix,p=n(a,s)}while(Ia);return p}function A2(){var e=I.H,n=e.useState()[0];return n=typeof n.then=="function"?Yi(n):n,e=e.useState()[0],(Ct!==null?Ct.memoizedState:null)!==e&&(We.flags|=1024),n}function Du(){var e=yo!==0;return yo=0,e}function zu(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function Mu(e){if(po){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}po=!1}ql=0,Pt=Ct=We=null,Ia=!1,Ii=yo=0,Ya=null}function vn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pt===null?We.memoizedState=Pt=e:Pt=Pt.next=e,Pt}function Wt(){if(Ct===null){var e=We.alternate;e=e!==null?e.memoizedState:null}else e=Ct.next;var n=Pt===null?We.memoizedState:Pt.next;if(n!==null)Pt=n,Ct=e;else{if(e===null)throw We.alternate===null?Error(i(467)):Error(i(310));Ct=e,e={memoizedState:Ct.memoizedState,baseState:Ct.baseState,baseQueue:Ct.baseQueue,queue:Ct.queue,next:null},Pt===null?We.memoizedState=Pt=e:Pt=Pt.next=e}return Pt}function go(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Yi(e){var n=Ii;return Ii+=1,Ya===null&&(Ya=[]),e=mm(Ya,e,n),n=We,(Pt===null?n.memoizedState:Pt.next)===null&&(n=n.alternate,I.H=n===null||n.memoizedState===null?ax:qu),e}function bo(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Yi(e);if(e.$$typeof===M)return dn(e)}throw Error(i(438,String(e)))}function Fu(e){var n=null,a=We.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var s=We.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(n={data:s.data.map(function(h){return h.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=go(),We.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),s=0;s<e;s++)a[s]=D;return n.index++,a}function Xl(e,n){return typeof n=="function"?n(e):n}function vo(e){var n=Wt();return Ru(n,Ct,e)}function Ru(e,n,a){var s=e.queue;if(s===null)throw Error(i(311));s.lastRenderedReducer=a;var h=e.baseQueue,p=s.pending;if(p!==null){if(h!==null){var w=h.next;h.next=p.next,p.next=w}n.baseQueue=h=p,s.pending=null}if(p=e.baseState,h===null)e.memoizedState=p;else{n=h.next;var N=w=null,H=null,P=n,se=!1;do{var fe=P.lane&-536870913;if(fe!==P.lane?(st&fe)===fe:(ql&fe)===fe){var te=P.revertLane;if(te===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),fe===Ba&&(se=!0);else if((ql&te)===te){P=P.next,te===Ba&&(se=!0);continue}else fe={lane:0,revertLane:P.revertLane,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},H===null?(N=H=fe,w=p):H=H.next=fe,We.lanes|=te,Sr|=te;fe=P.action,oa&&a(p,fe),p=P.hasEagerState?P.eagerState:a(p,fe)}else te={lane:fe,revertLane:P.revertLane,gesture:P.gesture,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},H===null?(N=H=te,w=p):H=H.next=te,We.lanes|=fe,Sr|=fe;P=P.next}while(P!==null&&P!==n);if(H===null?w=p:H.next=N,!$n(p,e.memoizedState)&&(en=!0,se&&(a=La,a!==null)))throw a;e.memoizedState=p,e.baseState=w,e.baseQueue=H,s.lastRenderedState=p}return h===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function _u(e){var n=Wt(),a=n.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=e;var s=a.dispatch,h=a.pending,p=n.memoizedState;if(h!==null){a.pending=null;var w=h=h.next;do p=e(p,w.action),w=w.next;while(w!==h);$n(p,n.memoizedState)||(en=!0),n.memoizedState=p,n.baseQueue===null&&(n.baseState=p),a.lastRenderedState=p}return[p,s]}function Cm(e,n,a){var s=We,h=Wt(),p=ut;if(p){if(a===void 0)throw Error(i(407));a=a()}else a=n();var w=!$n((Ct||h).memoizedState,a);if(w&&(h.memoizedState=a,en=!0),h=h.queue,Lu(Am.bind(null,s,h,e),[e]),h.getSnapshot!==n||w||Pt!==null&&Pt.memoizedState.tag&1){if(s.flags|=2048,qa(9,{destroy:void 0},Nm.bind(null,s,h,a,n),null),Tt===null)throw Error(i(349));p||(ql&127)!==0||Em(s,n,a)}return a}function Em(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=We.updateQueue,n===null?(n=go(),We.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function Nm(e,n,a,s){n.value=a,n.getSnapshot=s,Tm(n)&&Dm(e)}function Am(e,n,a){return a(function(){Tm(n)&&Dm(e)})}function Tm(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!$n(e,a)}catch{return!0}}function Dm(e){var n=Pr(e,2);n!==null&&Fn(n,e,2)}function Ou(e){var n=vn();if(typeof e=="function"){var a=e;if(e=a(),oa){ft(!0);try{a()}finally{ft(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xl,lastRenderedState:e},n}function zm(e,n,a,s){return e.baseState=a,Ru(e,Ct,typeof s=="function"?s:Xl)}function T2(e,n,a,s,h){if(So(e))throw Error(i(485));if(e=n.action,e!==null){var p={payload:h,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){p.listeners.push(w)}};I.T!==null?a(!0):p.isTransition=!1,s(p),a=n.pending,a===null?(p.next=n.pending=p,Mm(n,p)):(p.next=a.next,n.pending=a.next=p)}}function Mm(e,n){var a=n.action,s=n.payload,h=e.state;if(n.isTransition){var p=I.T,w={};I.T=w;try{var N=a(h,s),H=I.S;H!==null&&H(w,N),Fm(e,n,N)}catch(P){Bu(e,n,P)}finally{p!==null&&w.types!==null&&(p.types=w.types),I.T=p}}else try{p=a(h,s),Fm(e,n,p)}catch(P){Bu(e,n,P)}}function Fm(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(s){Rm(e,n,s)},function(s){return Bu(e,n,s)}):Rm(e,n,a)}function Rm(e,n,a){n.status="fulfilled",n.value=a,_m(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,Mm(e,a)))}function Bu(e,n,a){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do n.status="rejected",n.reason=a,_m(n),n=n.next;while(n!==s)}e.action=null}function _m(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Om(e,n){return n}function Bm(e,n){if(ut){var a=Tt.formState;if(a!==null){e:{var s=We;if(ut){if(_t){t:{for(var h=_t,p=tl;h.nodeType!==8;){if(!p){h=null;break t}if(h=ll(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){_t=ll(h.nextSibling),s=h.data==="F!";break e}}mr(s)}s=!1}s&&(n=a[0])}}return a=vn(),a.memoizedState=a.baseState=n,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Om,lastRenderedState:n},a.queue=s,a=nx.bind(null,We,s),s.dispatch=a,s=Ou(!1),p=Yu.bind(null,We,!1,s.queue),s=vn(),h={state:n,dispatch:null,action:e,pending:null},s.queue=h,a=T2.bind(null,We,h,p,a),h.dispatch=a,s.memoizedState=e,[n,a,!1]}function Lm(e){var n=Wt();return $m(n,Ct,e)}function $m(e,n,a){if(n=Ru(e,n,Om)[0],e=vo(Xl)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var s=Yi(n)}catch(w){throw w===$a?co:w}else s=n;n=Wt();var h=n.queue,p=h.dispatch;return a!==n.memoizedState&&(We.flags|=2048,qa(9,{destroy:void 0},D2.bind(null,h,a),null)),[s,p,e]}function D2(e,n){e.action=n}function Hm(e){var n=Wt(),a=Ct;if(a!==null)return $m(n,a,e);Wt(),n=n.memoizedState,a=Wt();var s=a.queue.dispatch;return a.memoizedState=e,[n,s,!1]}function qa(e,n,a,s){return e={tag:e,create:a,deps:s,inst:n,next:null},n=We.updateQueue,n===null&&(n=go(),We.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(s=a.next,a.next=e,e.next=s,n.lastEffect=e),e}function Um(){return Wt().memoizedState}function wo(e,n,a,s){var h=vn();We.flags|=e,h.memoizedState=qa(1|n,{destroy:void 0},a,s===void 0?null:s)}function ko(e,n,a,s){var h=Wt();s=s===void 0?null:s;var p=h.memoizedState.inst;Ct!==null&&s!==null&&Au(s,Ct.memoizedState.deps)?h.memoizedState=qa(n,p,a,s):(We.flags|=e,h.memoizedState=qa(1|n,p,a,s))}function Im(e,n){wo(8390656,8,e,n)}function Lu(e,n){ko(2048,8,e,n)}function z2(e){We.flags|=4;var n=We.updateQueue;if(n===null)n=go(),We.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function Ym(e){var n=Wt().memoizedState;return z2({ref:n,nextImpl:e}),function(){if((bt&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function qm(e,n){return ko(4,2,e,n)}function Xm(e,n){return ko(4,4,e,n)}function Vm(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Gm(e,n,a){a=a!=null?a.concat([e]):null,ko(4,4,Vm.bind(null,n,e),a)}function $u(){}function Km(e,n){var a=Wt();n=n===void 0?null:n;var s=a.memoizedState;return n!==null&&Au(n,s[1])?s[0]:(a.memoizedState=[e,n],e)}function Qm(e,n){var a=Wt();n=n===void 0?null:n;var s=a.memoizedState;if(n!==null&&Au(n,s[1]))return s[0];if(s=e(),oa){ft(!0);try{e()}finally{ft(!1)}}return a.memoizedState=[s,n],s}function Hu(e,n,a){return a===void 0||(ql&1073741824)!==0&&(st&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Wx(),We.lanes|=e,Sr|=e,a)}function Wm(e,n,a,s){return $n(a,n)?a:Ua.current!==null?(e=Hu(e,a,s),$n(e,n)||(en=!0),e):(ql&42)===0||(ql&1073741824)!==0&&(st&261930)===0?(en=!0,e.memoizedState=a):(e=Wx(),We.lanes|=e,Sr|=e,n)}function Zm(e,n,a,s,h){var p=Z.p;Z.p=p!==0&&8>p?p:8;var w=I.T,N={};I.T=N,Yu(e,!1,n,a);try{var H=h(),P=I.S;if(P!==null&&P(N,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var se=E2(H,s);qi(e,n,se,Xn(e))}else qi(e,n,s,Xn(e))}catch(fe){qi(e,n,{then:function(){},status:"rejected",reason:fe},Xn())}finally{Z.p=p,w!==null&&N.types!==null&&(w.types=N.types),I.T=w}}function M2(){}function Uu(e,n,a,s){if(e.tag!==5)throw Error(i(476));var h=Jm(e).queue;Zm(e,h,n,ce,a===null?M2:function(){return Pm(e),a(s)})}function Jm(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xl,lastRenderedState:ce},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xl,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Pm(e){var n=Jm(e);n.next===null&&(n=e.alternate.memoizedState),qi(e,n.next.queue,{},Xn())}function Iu(){return dn(ss)}function ex(){return Wt().memoizedState}function tx(){return Wt().memoizedState}function F2(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=Xn();e=yr(a);var s=gr(n,e,a);s!==null&&(Fn(s,n,a),$i(s,n,a)),n={cache:yu()},e.payload=n;return}n=n.return}}function R2(e,n,a){var s=Xn();a={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},So(e)?lx(n,a):(a=iu(e,n,a,s),a!==null&&(Fn(a,e,s),rx(a,n,s)))}function nx(e,n,a){var s=Xn();qi(e,n,a,s)}function qi(e,n,a,s){var h={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(So(e))lx(n,h);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var w=n.lastRenderedState,N=p(w,a);if(h.hasEagerState=!0,h.eagerState=N,$n(N,w))return no(e,n,h,0),Tt===null&&to(),!1}catch{}finally{}if(a=iu(e,n,h,s),a!==null)return Fn(a,e,s),rx(a,n,s),!0}return!1}function Yu(e,n,a,s){if(s={lane:2,revertLane:kf(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},So(e)){if(n)throw Error(i(479))}else n=iu(e,a,s,2),n!==null&&Fn(n,e,2)}function So(e){var n=e.alternate;return e===We||n!==null&&n===We}function lx(e,n){Ia=po=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function rx(e,n,a){if((a&4194048)!==0){var s=n.lanes;s&=e.pendingLanes,a|=s,n.lanes=a,Is(e,a)}}var Xi={readContext:dn,use:bo,useCallback:Vt,useContext:Vt,useEffect:Vt,useImperativeHandle:Vt,useLayoutEffect:Vt,useInsertionEffect:Vt,useMemo:Vt,useReducer:Vt,useRef:Vt,useState:Vt,useDebugValue:Vt,useDeferredValue:Vt,useTransition:Vt,useSyncExternalStore:Vt,useId:Vt,useHostTransitionStatus:Vt,useFormState:Vt,useActionState:Vt,useOptimistic:Vt,useMemoCache:Vt,useCacheRefresh:Vt};Xi.useEffectEvent=Vt;var ax={readContext:dn,use:bo,useCallback:function(e,n){return vn().memoizedState=[e,n===void 0?null:n],e},useContext:dn,useEffect:Im,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,wo(4194308,4,Vm.bind(null,n,e),a)},useLayoutEffect:function(e,n){return wo(4194308,4,e,n)},useInsertionEffect:function(e,n){wo(4,2,e,n)},useMemo:function(e,n){var a=vn();n=n===void 0?null:n;var s=e();if(oa){ft(!0);try{e()}finally{ft(!1)}}return a.memoizedState=[s,n],s},useReducer:function(e,n,a){var s=vn();if(a!==void 0){var h=a(n);if(oa){ft(!0);try{a(n)}finally{ft(!1)}}}else h=n;return s.memoizedState=s.baseState=h,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:h},s.queue=e,e=e.dispatch=R2.bind(null,We,e),[s.memoizedState,e]},useRef:function(e){var n=vn();return e={current:e},n.memoizedState=e},useState:function(e){e=Ou(e);var n=e.queue,a=nx.bind(null,We,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:$u,useDeferredValue:function(e,n){var a=vn();return Hu(a,e,n)},useTransition:function(){var e=Ou(!1);return e=Zm.bind(null,We,e.queue,!0,!1),vn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var s=We,h=vn();if(ut){if(a===void 0)throw Error(i(407));a=a()}else{if(a=n(),Tt===null)throw Error(i(349));(st&127)!==0||Em(s,n,a)}h.memoizedState=a;var p={value:a,getSnapshot:n};return h.queue=p,Im(Am.bind(null,s,p,e),[e]),s.flags|=2048,qa(9,{destroy:void 0},Nm.bind(null,s,p,a,n),null),a},useId:function(){var e=vn(),n=Tt.identifierPrefix;if(ut){var a=gl,s=yl;a=(s&~(1<<32-de(s)-1)).toString(32)+a,n="_"+n+"R_"+a,a=yo++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=N2++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Iu,useFormState:Bm,useActionState:Bm,useOptimistic:function(e){var n=vn();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Yu.bind(null,We,!0,a),a.dispatch=n,[e,n]},useMemoCache:Fu,useCacheRefresh:function(){return vn().memoizedState=F2.bind(null,We)},useEffectEvent:function(e){var n=vn(),a={impl:e};return n.memoizedState=a,function(){if((bt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},qu={readContext:dn,use:bo,useCallback:Km,useContext:dn,useEffect:Lu,useImperativeHandle:Gm,useInsertionEffect:qm,useLayoutEffect:Xm,useMemo:Qm,useReducer:vo,useRef:Um,useState:function(){return vo(Xl)},useDebugValue:$u,useDeferredValue:function(e,n){var a=Wt();return Wm(a,Ct.memoizedState,e,n)},useTransition:function(){var e=vo(Xl)[0],n=Wt().memoizedState;return[typeof e=="boolean"?e:Yi(e),n]},useSyncExternalStore:Cm,useId:ex,useHostTransitionStatus:Iu,useFormState:Lm,useActionState:Lm,useOptimistic:function(e,n){var a=Wt();return zm(a,Ct,e,n)},useMemoCache:Fu,useCacheRefresh:tx};qu.useEffectEvent=Ym;var ix={readContext:dn,use:bo,useCallback:Km,useContext:dn,useEffect:Lu,useImperativeHandle:Gm,useInsertionEffect:qm,useLayoutEffect:Xm,useMemo:Qm,useReducer:_u,useRef:Um,useState:function(){return _u(Xl)},useDebugValue:$u,useDeferredValue:function(e,n){var a=Wt();return Ct===null?Hu(a,e,n):Wm(a,Ct.memoizedState,e,n)},useTransition:function(){var e=_u(Xl)[0],n=Wt().memoizedState;return[typeof e=="boolean"?e:Yi(e),n]},useSyncExternalStore:Cm,useId:ex,useHostTransitionStatus:Iu,useFormState:Hm,useActionState:Hm,useOptimistic:function(e,n){var a=Wt();return Ct!==null?zm(a,Ct,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Fu,useCacheRefresh:tx};ix.useEffectEvent=Ym;function Xu(e,n,a,s){n=e.memoizedState,a=a(s,n),a=a==null?n:y({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Vu={enqueueSetState:function(e,n,a){e=e._reactInternals;var s=Xn(),h=yr(s);h.payload=n,a!=null&&(h.callback=a),n=gr(e,h,s),n!==null&&(Fn(n,e,s),$i(n,e,s))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var s=Xn(),h=yr(s);h.tag=1,h.payload=n,a!=null&&(h.callback=a),n=gr(e,h,s),n!==null&&(Fn(n,e,s),$i(n,e,s))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=Xn(),s=yr(a);s.tag=2,n!=null&&(s.callback=n),n=gr(e,s,a),n!==null&&(Fn(n,e,a),$i(n,e,a))}};function sx(e,n,a,s,h,p,w){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,p,w):n.prototype&&n.prototype.isPureReactComponent?!zi(a,s)||!zi(h,p):!0}function ox(e,n,a,s){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,s),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,s),n.state!==e&&Vu.enqueueReplaceState(n,n.state,null)}function ca(e,n){var a=n;if("ref"in n){a={};for(var s in n)s!=="ref"&&(a[s]=n[s])}if(e=e.defaultProps){a===n&&(a=y({},a));for(var h in e)a[h]===void 0&&(a[h]=e[h])}return a}function cx(e){eo(e)}function ux(e){console.error(e)}function fx(e){eo(e)}function jo(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(s){setTimeout(function(){throw s})}}function dx(e,n,a){try{var s=e.onCaughtError;s(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Gu(e,n,a){return a=yr(a),a.tag=3,a.payload={element:null},a.callback=function(){jo(e,n)},a}function hx(e){return e=yr(e),e.tag=3,e}function mx(e,n,a,s){var h=a.type.getDerivedStateFromError;if(typeof h=="function"){var p=s.value;e.payload=function(){return h(p)},e.callback=function(){dx(n,a,s)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(e.callback=function(){dx(n,a,s),typeof h!="function"&&(jr===null?jr=new Set([this]):jr.add(this));var N=s.stack;this.componentDidCatch(s.value,{componentStack:N!==null?N:""})})}function _2(e,n,a,s,h){if(a.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(n=a.alternate,n!==null&&Oa(n,a,h,!0),a=Un.current,a!==null){switch(a.tag){case 31:case 13:return nl===null?Oo():a.alternate===null&&Gt===0&&(Gt=3),a.flags&=-257,a.flags|=65536,a.lanes=h,s===uo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([s]):n.add(s),bf(e,s,h)),!1;case 22:return a.flags|=65536,s===uo?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([s])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([s]):a.add(s)),bf(e,s,h)),!1}throw Error(i(435,a.tag))}return bf(e,s,h),Oo(),!1}if(ut)return n=Un.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=h,s!==du&&(e=Error(i(422),{cause:s}),Ri(Jn(e,a)))):(s!==du&&(n=Error(i(423),{cause:s}),Ri(Jn(n,a))),e=e.current.alternate,e.flags|=65536,h&=-h,e.lanes|=h,s=Jn(s,a),h=Gu(e.stateNode,s,h),Su(e,h),Gt!==4&&(Gt=2)),!1;var p=Error(i(520),{cause:s});if(p=Jn(p,a),Pi===null?Pi=[p]:Pi.push(p),Gt!==4&&(Gt=2),n===null)return!0;s=Jn(s,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=h&-h,a.lanes|=e,e=Gu(a.stateNode,s,e),Su(a,e),!1;case 1:if(n=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(jr===null||!jr.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=hx(h),mx(h,e,a,s),Su(a,h),!1}a=a.return}while(a!==null);return!1}var Ku=Error(i(461)),en=!1;function hn(e,n,a,s){n.child=e===null?gm(n,null,a,s):sa(n,e.child,a,s)}function xx(e,n,a,s,h){a=a.render;var p=n.ref;if("ref"in s){var w={};for(var N in s)N!=="ref"&&(w[N]=s[N])}else w=s;return la(n),s=Tu(e,n,a,w,p,h),N=Du(),e!==null&&!en?(zu(e,n,h),Vl(e,n,h)):(ut&&N&&uu(n),n.flags|=1,hn(e,n,s,h),n.child)}function px(e,n,a,s,h){if(e===null){var p=a.type;return typeof p=="function"&&!su(p)&&p.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=p,yx(e,n,p,s,h)):(e=ro(a.type,null,s,n,n.mode,h),e.ref=n.ref,e.return=n,n.child=e)}if(p=e.child,!nf(e,h)){var w=p.memoizedProps;if(a=a.compare,a=a!==null?a:zi,a(w,s)&&e.ref===n.ref)return Vl(e,n,h)}return n.flags|=1,e=Hl(p,s),e.ref=n.ref,e.return=n,n.child=e}function yx(e,n,a,s,h){if(e!==null){var p=e.memoizedProps;if(zi(p,s)&&e.ref===n.ref)if(en=!1,n.pendingProps=s=p,nf(e,h))(e.flags&131072)!==0&&(en=!0);else return n.lanes=e.lanes,Vl(e,n,h)}return Qu(e,n,a,s,h)}function gx(e,n,a,s){var h=s.children,p=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((n.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,e!==null){for(s=n.child=e.child,h=0;s!==null;)h=h|s.lanes|s.childLanes,s=s.sibling;s=h&~p}else s=0,n.child=null;return bx(e,n,p,a,s)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&oo(n,p!==null?p.cachePool:null),p!==null?wm(n,p):Cu(),km(n);else return s=n.lanes=536870912,bx(e,n,p!==null?p.baseLanes|a:a,a,s)}else p!==null?(oo(n,p.cachePool),wm(n,p),vr(),n.memoizedState=null):(e!==null&&oo(n,null),Cu(),vr());return hn(e,n,h,a),n.child}function Vi(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function bx(e,n,a,s,h){var p=bu();return p=p===null?null:{parent:Jt._currentValue,pool:p},n.memoizedState={baseLanes:a,cachePool:p},e!==null&&oo(n,null),Cu(),km(n),e!==null&&Oa(e,n,s,!0),n.childLanes=h,null}function Co(e,n){return n=No({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function vx(e,n,a){return sa(n,e.child,null,a),e=Co(n,n.pendingProps),e.flags|=2,In(n),n.memoizedState=null,e}function O2(e,n,a){var s=n.pendingProps,h=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(ut){if(s.mode==="hidden")return e=Co(n,s),n.lanes=536870912,Vi(null,e);if(Nu(n),(e=_t)?(e=Mp(e,tl),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:dr!==null?{id:yl,overflow:gl}:null,retryLane:536870912,hydrationErrors:null},a=lm(e),a.return=n,n.child=a,fn=n,_t=null)):e=null,e===null)throw mr(n);return n.lanes=536870912,null}return Co(n,s)}var p=e.memoizedState;if(p!==null){var w=p.dehydrated;if(Nu(n),h)if(n.flags&256)n.flags&=-257,n=vx(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(i(558));else if(en||Oa(e,n,a,!1),h=(a&e.childLanes)!==0,en||h){if(s=Tt,s!==null&&(w=Fl(s,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,Pr(e,w),Fn(s,e,w),Ku;Oo(),n=vx(e,n,a)}else e=p.treeContext,_t=ll(w.nextSibling),fn=n,ut=!0,hr=null,tl=!1,e!==null&&im(n,e),n=Co(n,s),n.flags|=4096;return n}return e=Hl(e.child,{mode:s.mode,children:s.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Eo(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Qu(e,n,a,s,h){return la(n),a=Tu(e,n,a,s,void 0,h),s=Du(),e!==null&&!en?(zu(e,n,h),Vl(e,n,h)):(ut&&s&&uu(n),n.flags|=1,hn(e,n,a,h),n.child)}function wx(e,n,a,s,h,p){return la(n),n.updateQueue=null,a=jm(n,s,a,h),Sm(e),s=Du(),e!==null&&!en?(zu(e,n,p),Vl(e,n,p)):(ut&&s&&uu(n),n.flags|=1,hn(e,n,a,p),n.child)}function kx(e,n,a,s,h){if(la(n),n.stateNode===null){var p=Ma,w=a.contextType;typeof w=="object"&&w!==null&&(p=dn(w)),p=new a(s,p),n.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Vu,n.stateNode=p,p._reactInternals=n,p=n.stateNode,p.props=s,p.state=n.memoizedState,p.refs={},wu(n),w=a.contextType,p.context=typeof w=="object"&&w!==null?dn(w):Ma,p.state=n.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(Xu(n,a,w,s),p.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(w=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),w!==p.state&&Vu.enqueueReplaceState(p,p.state,null),Ui(n,s,p,h),Hi(),p.state=n.memoizedState),typeof p.componentDidMount=="function"&&(n.flags|=4194308),s=!0}else if(e===null){p=n.stateNode;var N=n.memoizedProps,H=ca(a,N);p.props=H;var P=p.context,se=a.contextType;w=Ma,typeof se=="object"&&se!==null&&(w=dn(se));var fe=a.getDerivedStateFromProps;se=typeof fe=="function"||typeof p.getSnapshotBeforeUpdate=="function",N=n.pendingProps!==N,se||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(N||P!==w)&&ox(n,p,s,w),pr=!1;var te=n.memoizedState;p.state=te,Ui(n,s,p,h),Hi(),P=n.memoizedState,N||te!==P||pr?(typeof fe=="function"&&(Xu(n,a,fe,s),P=n.memoizedState),(H=pr||sx(n,a,H,s,te,P,w))?(se||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(n.flags|=4194308)):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=s,n.memoizedState=P),p.props=s,p.state=P,p.context=w,s=H):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),s=!1)}else{p=n.stateNode,ku(e,n),w=n.memoizedProps,se=ca(a,w),p.props=se,fe=n.pendingProps,te=p.context,P=a.contextType,H=Ma,typeof P=="object"&&P!==null&&(H=dn(P)),N=a.getDerivedStateFromProps,(P=typeof N=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==fe||te!==H)&&ox(n,p,s,H),pr=!1,te=n.memoizedState,p.state=te,Ui(n,s,p,h),Hi();var le=n.memoizedState;w!==fe||te!==le||pr||e!==null&&e.dependencies!==null&&io(e.dependencies)?(typeof N=="function"&&(Xu(n,a,N,s),le=n.memoizedState),(se=pr||sx(n,a,se,s,te,le,H)||e!==null&&e.dependencies!==null&&io(e.dependencies))?(P||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(s,le,H),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(s,le,H)),typeof p.componentDidUpdate=="function"&&(n.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=1024),n.memoizedProps=s,n.memoizedState=le),p.props=s,p.state=le,p.context=H,s=se):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=1024),s=!1)}return p=s,Eo(e,n),s=(n.flags&128)!==0,p||s?(p=n.stateNode,a=s&&typeof a.getDerivedStateFromError!="function"?null:p.render(),n.flags|=1,e!==null&&s?(n.child=sa(n,e.child,null,h),n.child=sa(n,null,a,h)):hn(e,n,a,h),n.memoizedState=p.state,e=n.child):e=Vl(e,n,h),e}function Sx(e,n,a,s){return ta(),n.flags|=256,hn(e,n,a,s),n.child}var Wu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Zu(e){return{baseLanes:e,cachePool:dm()}}function Ju(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=qn),e}function jx(e,n,a){var s=n.pendingProps,h=!1,p=(n.flags&128)!==0,w;if((w=p)||(w=e!==null&&e.memoizedState===null?!1:(Qt.current&2)!==0),w&&(h=!0,n.flags&=-129),w=(n.flags&32)!==0,n.flags&=-33,e===null){if(ut){if(h?br(n):vr(),(e=_t)?(e=Mp(e,tl),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:dr!==null?{id:yl,overflow:gl}:null,retryLane:536870912,hydrationErrors:null},a=lm(e),a.return=n,n.child=a,fn=n,_t=null)):e=null,e===null)throw mr(n);return _f(e)?n.lanes=32:n.lanes=536870912,null}var N=s.children;return s=s.fallback,h?(vr(),h=n.mode,N=No({mode:"hidden",children:N},h),s=ea(s,h,a,null),N.return=n,s.return=n,N.sibling=s,n.child=N,s=n.child,s.memoizedState=Zu(a),s.childLanes=Ju(e,w,a),n.memoizedState=Wu,Vi(null,s)):(br(n),Pu(n,N))}var H=e.memoizedState;if(H!==null&&(N=H.dehydrated,N!==null)){if(p)n.flags&256?(br(n),n.flags&=-257,n=ef(e,n,a)):n.memoizedState!==null?(vr(),n.child=e.child,n.flags|=128,n=null):(vr(),N=s.fallback,h=n.mode,s=No({mode:"visible",children:s.children},h),N=ea(N,h,a,null),N.flags|=2,s.return=n,N.return=n,s.sibling=N,n.child=s,sa(n,e.child,null,a),s=n.child,s.memoizedState=Zu(a),s.childLanes=Ju(e,w,a),n.memoizedState=Wu,n=Vi(null,s));else if(br(n),_f(N)){if(w=N.nextSibling&&N.nextSibling.dataset,w)var P=w.dgst;w=P,s=Error(i(419)),s.stack="",s.digest=w,Ri({value:s,source:null,stack:null}),n=ef(e,n,a)}else if(en||Oa(e,n,a,!1),w=(a&e.childLanes)!==0,en||w){if(w=Tt,w!==null&&(s=Fl(w,a),s!==0&&s!==H.retryLane))throw H.retryLane=s,Pr(e,s),Fn(w,e,s),Ku;Rf(N)||Oo(),n=ef(e,n,a)}else Rf(N)?(n.flags|=192,n.child=e.child,n=null):(e=H.treeContext,_t=ll(N.nextSibling),fn=n,ut=!0,hr=null,tl=!1,e!==null&&im(n,e),n=Pu(n,s.children),n.flags|=4096);return n}return h?(vr(),N=s.fallback,h=n.mode,H=e.child,P=H.sibling,s=Hl(H,{mode:"hidden",children:s.children}),s.subtreeFlags=H.subtreeFlags&65011712,P!==null?N=Hl(P,N):(N=ea(N,h,a,null),N.flags|=2),N.return=n,s.return=n,s.sibling=N,n.child=s,Vi(null,s),s=n.child,N=e.child.memoizedState,N===null?N=Zu(a):(h=N.cachePool,h!==null?(H=Jt._currentValue,h=h.parent!==H?{parent:H,pool:H}:h):h=dm(),N={baseLanes:N.baseLanes|a,cachePool:h}),s.memoizedState=N,s.childLanes=Ju(e,w,a),n.memoizedState=Wu,Vi(e.child,s)):(br(n),a=e.child,e=a.sibling,a=Hl(a,{mode:"visible",children:s.children}),a.return=n,a.sibling=null,e!==null&&(w=n.deletions,w===null?(n.deletions=[e],n.flags|=16):w.push(e)),n.child=a,n.memoizedState=null,a)}function Pu(e,n){return n=No({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function No(e,n){return e=Hn(22,e,null,n),e.lanes=0,e}function ef(e,n,a){return sa(n,e.child,null,a),e=Pu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Cx(e,n,a){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n),xu(e.return,n,a)}function tf(e,n,a,s,h,p){var w=e.memoizedState;w===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:s,tail:a,tailMode:h,treeForkCount:p}:(w.isBackwards=n,w.rendering=null,w.renderingStartTime=0,w.last=s,w.tail=a,w.tailMode=h,w.treeForkCount=p)}function Ex(e,n,a){var s=n.pendingProps,h=s.revealOrder,p=s.tail;s=s.children;var w=Qt.current,N=(w&2)!==0;if(N?(w=w&1|2,n.flags|=128):w&=1,T(Qt,w),hn(e,n,s,a),s=ut?Fi:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cx(e,a,n);else if(e.tag===19)Cx(e,a,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(h){case"forwards":for(a=n.child,h=null;a!==null;)e=a.alternate,e!==null&&xo(e)===null&&(h=a),a=a.sibling;a=h,a===null?(h=n.child,n.child=null):(h=a.sibling,a.sibling=null),tf(n,!1,h,a,p,s);break;case"backwards":case"unstable_legacy-backwards":for(a=null,h=n.child,n.child=null;h!==null;){if(e=h.alternate,e!==null&&xo(e)===null){n.child=h;break}e=h.sibling,h.sibling=a,a=h,h=e}tf(n,!0,a,null,p,s);break;case"together":tf(n,!1,null,null,void 0,s);break;default:n.memoizedState=null}return n.child}function Vl(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),Sr|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(Oa(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(i(153));if(n.child!==null){for(e=n.child,a=Hl(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Hl(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function nf(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&io(e)))}function B2(e,n,a){switch(n.tag){case 3:He(n,n.stateNode.containerInfo),xr(n,Jt,e.memoizedState.cache),ta();break;case 27:case 5:ke(n);break;case 4:He(n,n.stateNode.containerInfo);break;case 10:xr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Nu(n),null;break;case 13:var s=n.memoizedState;if(s!==null)return s.dehydrated!==null?(br(n),n.flags|=128,null):(a&n.child.childLanes)!==0?jx(e,n,a):(br(n),e=Vl(e,n,a),e!==null?e.sibling:null);br(n);break;case 19:var h=(e.flags&128)!==0;if(s=(a&n.childLanes)!==0,s||(Oa(e,n,a,!1),s=(a&n.childLanes)!==0),h){if(s)return Ex(e,n,a);n.flags|=128}if(h=n.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),T(Qt,Qt.current),s)break;return null;case 22:return n.lanes=0,gx(e,n,a,n.pendingProps);case 24:xr(n,Jt,e.memoizedState.cache)}return Vl(e,n,a)}function Nx(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)en=!0;else{if(!nf(e,a)&&(n.flags&128)===0)return en=!1,B2(e,n,a);en=(e.flags&131072)!==0}else en=!1,ut&&(n.flags&1048576)!==0&&am(n,Fi,n.index);switch(n.lanes=0,n.tag){case 16:e:{var s=n.pendingProps;if(e=aa(n.elementType),n.type=e,typeof e=="function")su(e)?(s=ca(e,s),n.tag=1,n=kx(null,n,e,s,a)):(n.tag=0,n=Qu(null,n,e,s,a));else{if(e!=null){var h=e.$$typeof;if(h===F){n.tag=11,n=xx(null,n,e,s,a);break e}else if(h===U){n.tag=14,n=px(null,n,e,s,a);break e}}throw n=ee(e)||e,Error(i(306,n,""))}}return n;case 0:return Qu(e,n,n.type,n.pendingProps,a);case 1:return s=n.type,h=ca(s,n.pendingProps),kx(e,n,s,h,a);case 3:e:{if(He(n,n.stateNode.containerInfo),e===null)throw Error(i(387));s=n.pendingProps;var p=n.memoizedState;h=p.element,ku(e,n),Ui(n,s,null,a);var w=n.memoizedState;if(s=w.cache,xr(n,Jt,s),s!==p.cache&&pu(n,[Jt],a,!0),Hi(),s=w.element,p.isDehydrated)if(p={element:s,isDehydrated:!1,cache:w.cache},n.updateQueue.baseState=p,n.memoizedState=p,n.flags&256){n=Sx(e,n,s,a);break e}else if(s!==h){h=Jn(Error(i(424)),n),Ri(h),n=Sx(e,n,s,a);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(_t=ll(e.firstChild),fn=n,ut=!0,hr=null,tl=!0,a=gm(n,null,s,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ta(),s===h){n=Vl(e,n,a);break e}hn(e,n,s,a)}n=n.child}return n;case 26:return Eo(e,n),e===null?(a=Lp(n.type,null,n.pendingProps,null))?n.memoizedState=a:ut||(a=n.type,e=n.pendingProps,s=Yo(Ee.current).createElement(a),s[$t]=n,s[cn]=e,mn(s,a,e),Ft(s),n.stateNode=s):n.memoizedState=Lp(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return ke(n),e===null&&ut&&(s=n.stateNode=_p(n.type,n.pendingProps,Ee.current),fn=n,tl=!0,h=_t,Ar(n.type)?(Of=h,_t=ll(s.firstChild)):_t=h),hn(e,n,n.pendingProps.children,a),Eo(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&ut&&((h=s=_t)&&(s=hb(s,n.type,n.pendingProps,tl),s!==null?(n.stateNode=s,fn=n,_t=ll(s.firstChild),tl=!1,h=!0):h=!1),h||mr(n)),ke(n),h=n.type,p=n.pendingProps,w=e!==null?e.memoizedProps:null,s=p.children,zf(h,p)?s=null:w!==null&&zf(h,w)&&(n.flags|=32),n.memoizedState!==null&&(h=Tu(e,n,A2,null,null,a),ss._currentValue=h),Eo(e,n),hn(e,n,s,a),n.child;case 6:return e===null&&ut&&((e=a=_t)&&(a=mb(a,n.pendingProps,tl),a!==null?(n.stateNode=a,fn=n,_t=null,e=!0):e=!1),e||mr(n)),null;case 13:return jx(e,n,a);case 4:return He(n,n.stateNode.containerInfo),s=n.pendingProps,e===null?n.child=sa(n,null,s,a):hn(e,n,s,a),n.child;case 11:return xx(e,n,n.type,n.pendingProps,a);case 7:return hn(e,n,n.pendingProps,a),n.child;case 8:return hn(e,n,n.pendingProps.children,a),n.child;case 12:return hn(e,n,n.pendingProps.children,a),n.child;case 10:return s=n.pendingProps,xr(n,n.type,s.value),hn(e,n,s.children,a),n.child;case 9:return h=n.type._context,s=n.pendingProps.children,la(n),h=dn(h),s=s(h),n.flags|=1,hn(e,n,s,a),n.child;case 14:return px(e,n,n.type,n.pendingProps,a);case 15:return yx(e,n,n.type,n.pendingProps,a);case 19:return Ex(e,n,a);case 31:return O2(e,n,a);case 22:return gx(e,n,a,n.pendingProps);case 24:return la(n),s=dn(Jt),e===null?(h=bu(),h===null&&(h=Tt,p=yu(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),n.memoizedState={parent:s,cache:h},wu(n),xr(n,Jt,h)):((e.lanes&a)!==0&&(ku(e,n),Ui(n,null,null,a),Hi()),h=e.memoizedState,p=n.memoizedState,h.parent!==s?(h={parent:s,cache:s},n.memoizedState=h,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=h),xr(n,Jt,s)):(s=p.cache,xr(n,Jt,s),s!==h.cache&&pu(n,[Jt],a,!0))),hn(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function Gl(e){e.flags|=4}function lf(e,n,a,s,h){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(h&335544128)===h)if(e.stateNode.complete)e.flags|=8192;else if(ep())e.flags|=8192;else throw ia=uo,vu}else e.flags&=-16777217}function Ax(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Yp(n))if(ep())e.flags|=8192;else throw ia=uo,vu}function Ao(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Us():536870912,e.lanes|=n,Ka|=n)}function Gi(e,n){if(!ut)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var s=null;a!==null;)a.alternate!==null&&(s=a),a=a.sibling;s===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Ot(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,s=0;if(n)for(var h=e.child;h!==null;)a|=h.lanes|h.childLanes,s|=h.subtreeFlags&65011712,s|=h.flags&65011712,h.return=e,h=h.sibling;else for(h=e.child;h!==null;)a|=h.lanes|h.childLanes,s|=h.subtreeFlags,s|=h.flags,h.return=e,h=h.sibling;return e.subtreeFlags|=s,e.childLanes=a,n}function L2(e,n,a){var s=n.pendingProps;switch(fu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ot(n),null;case 1:return Ot(n),null;case 3:return a=n.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),n.memoizedState.cache!==s&&(n.flags|=2048),Yl(Jt),Qe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(_a(n)?Gl(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,hu())),Ot(n),null;case 26:var h=n.type,p=n.memoizedState;return e===null?(Gl(n),p!==null?(Ot(n),Ax(n,p)):(Ot(n),lf(n,h,null,s,a))):p?p!==e.memoizedState?(Gl(n),Ot(n),Ax(n,p)):(Ot(n),n.flags&=-16777217):(e=e.memoizedProps,e!==s&&Gl(n),Ot(n),lf(n,h,e,s,a)),null;case 27:if(yt(n),a=Ee.current,h=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Gl(n);else{if(!s){if(n.stateNode===null)throw Error(i(166));return Ot(n),null}e=me.current,_a(n)?sm(n):(e=_p(h,s,a),n.stateNode=e,Gl(n))}return Ot(n),null;case 5:if(yt(n),h=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Gl(n);else{if(!s){if(n.stateNode===null)throw Error(i(166));return Ot(n),null}if(p=me.current,_a(n))sm(n);else{var w=Yo(Ee.current);switch(p){case 1:p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":p=w.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof s.is=="string"?w.createElement("select",{is:s.is}):w.createElement("select"),s.multiple?p.multiple=!0:s.size&&(p.size=s.size);break;default:p=typeof s.is=="string"?w.createElement(h,{is:s.is}):w.createElement(h)}}p[$t]=n,p[cn]=s;e:for(w=n.child;w!==null;){if(w.tag===5||w.tag===6)p.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===n)break e;for(;w.sibling===null;){if(w.return===null||w.return===n)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}n.stateNode=p;e:switch(mn(p,h,s),h){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Gl(n)}}return Ot(n),lf(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==s&&Gl(n);else{if(typeof s!="string"&&n.stateNode===null)throw Error(i(166));if(e=Ee.current,_a(n)){if(e=n.stateNode,a=n.memoizedProps,s=null,h=fn,h!==null)switch(h.tag){case 27:case 5:s=h.memoizedProps}e[$t]=n,e=!!(e.nodeValue===a||s!==null&&s.suppressHydrationWarning===!0||jp(e.nodeValue,a)),e||mr(n,!0)}else e=Yo(e).createTextNode(s),e[$t]=n,n.stateNode=e}return Ot(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(s=_a(n),a!==null){if(e===null){if(!s)throw Error(i(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(557));e[$t]=n}else ta(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ot(n),e=!1}else a=hu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(In(n),n):(In(n),null);if((n.flags&128)!==0)throw Error(i(558))}return Ot(n),null;case 13:if(s=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(h=_a(n),s!==null&&s.dehydrated!==null){if(e===null){if(!h)throw Error(i(318));if(h=n.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(317));h[$t]=n}else ta(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ot(n),h=!1}else h=hu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=h),h=!0;if(!h)return n.flags&256?(In(n),n):(In(n),null)}return In(n),(n.flags&128)!==0?(n.lanes=a,n):(a=s!==null,e=e!==null&&e.memoizedState!==null,a&&(s=n.child,h=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(h=s.alternate.memoizedState.cachePool.pool),p=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(p=s.memoizedState.cachePool.pool),p!==h&&(s.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),Ao(n,n.updateQueue),Ot(n),null);case 4:return Qe(),e===null&&Ef(n.stateNode.containerInfo),Ot(n),null;case 10:return Yl(n.type),Ot(n),null;case 19:if(W(Qt),s=n.memoizedState,s===null)return Ot(n),null;if(h=(n.flags&128)!==0,p=s.rendering,p===null)if(h)Gi(s,!1);else{if(Gt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(p=xo(e),p!==null){for(n.flags|=128,Gi(s,!1),e=p.updateQueue,n.updateQueue=e,Ao(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)nm(a,e),a=a.sibling;return T(Qt,Qt.current&1|2),ut&&Ul(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&&ht()>Fo&&(n.flags|=128,h=!0,Gi(s,!1),n.lanes=4194304)}else{if(!h)if(e=xo(p),e!==null){if(n.flags|=128,h=!0,e=e.updateQueue,n.updateQueue=e,Ao(n,e),Gi(s,!0),s.tail===null&&s.tailMode==="hidden"&&!p.alternate&&!ut)return Ot(n),null}else 2*ht()-s.renderingStartTime>Fo&&a!==536870912&&(n.flags|=128,h=!0,Gi(s,!1),n.lanes=4194304);s.isBackwards?(p.sibling=n.child,n.child=p):(e=s.last,e!==null?e.sibling=p:n.child=p,s.last=p)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=ht(),e.sibling=null,a=Qt.current,T(Qt,h?a&1|2:a&1),ut&&Ul(n,s.treeForkCount),e):(Ot(n),null);case 22:case 23:return In(n),Eu(),s=n.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(n.flags|=8192):s&&(n.flags|=8192),s?(a&536870912)!==0&&(n.flags&128)===0&&(Ot(n),n.subtreeFlags&6&&(n.flags|=8192)):Ot(n),a=n.updateQueue,a!==null&&Ao(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==a&&(n.flags|=2048),e!==null&&W(ra),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Yl(Jt),Ot(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function $2(e,n){switch(fu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Yl(Jt),Qe(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return yt(n),null;case 31:if(n.memoizedState!==null){if(In(n),n.alternate===null)throw Error(i(340));ta()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(In(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));ta()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return W(Qt),null;case 4:return Qe(),null;case 10:return Yl(n.type),null;case 22:case 23:return In(n),Eu(),e!==null&&W(ra),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Yl(Jt),null;case 25:return null;default:return null}}function Tx(e,n){switch(fu(n),n.tag){case 3:Yl(Jt),Qe();break;case 26:case 27:case 5:yt(n);break;case 4:Qe();break;case 31:n.memoizedState!==null&&In(n);break;case 13:In(n);break;case 19:W(Qt);break;case 10:Yl(n.type);break;case 22:case 23:In(n),Eu(),e!==null&&W(ra);break;case 24:Yl(Jt)}}function Ki(e,n){try{var a=n.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var h=s.next;a=h;do{if((a.tag&e)===e){s=void 0;var p=a.create,w=a.inst;s=p(),w.destroy=s}a=a.next}while(a!==h)}}catch(N){St(n,n.return,N)}}function wr(e,n,a){try{var s=n.updateQueue,h=s!==null?s.lastEffect:null;if(h!==null){var p=h.next;s=p;do{if((s.tag&e)===e){var w=s.inst,N=w.destroy;if(N!==void 0){w.destroy=void 0,h=n;var H=a,P=N;try{P()}catch(se){St(h,H,se)}}}s=s.next}while(s!==p)}}catch(se){St(n,n.return,se)}}function Dx(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{vm(n,a)}catch(s){St(e,e.return,s)}}}function zx(e,n,a){a.props=ca(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(s){St(e,n,s)}}function Qi(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof a=="function"?e.refCleanup=a(s):a.current=s}}catch(h){St(e,n,h)}}function bl(e,n){var a=e.ref,s=e.refCleanup;if(a!==null)if(typeof s=="function")try{s()}catch(h){St(e,n,h)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(h){St(e,n,h)}else a.current=null}function Mx(e){var n=e.type,a=e.memoizedProps,s=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&s.focus();break e;case"img":a.src?s.src=a.src:a.srcSet&&(s.srcset=a.srcSet)}}catch(h){St(e,e.return,h)}}function rf(e,n,a){try{var s=e.stateNode;sb(s,e.type,a,n),s[cn]=n}catch(h){St(e,e.return,h)}}function Fx(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ar(e.type)||e.tag===4}function af(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Fx(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ar(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function sf(e,n,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=Qn));else if(s!==4&&(s===27&&Ar(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(sf(e,n,a),e=e.sibling;e!==null;)sf(e,n,a),e=e.sibling}function To(e,n,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(s!==4&&(s===27&&Ar(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(To(e,n,a),e=e.sibling;e!==null;)To(e,n,a),e=e.sibling}function Rx(e){var n=e.stateNode,a=e.memoizedProps;try{for(var s=e.type,h=n.attributes;h.length;)n.removeAttributeNode(h[0]);mn(n,s,a),n[$t]=e,n[cn]=a}catch(p){St(e,e.return,p)}}var Kl=!1,tn=!1,of=!1,_x=typeof WeakSet=="function"?WeakSet:Set,on=null;function H2(e,n){if(e=e.containerInfo,Tf=Wo,e=Gh(e),eu(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var s=a.getSelection&&a.getSelection();if(s&&s.rangeCount!==0){a=s.anchorNode;var h=s.anchorOffset,p=s.focusNode;s=s.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var w=0,N=-1,H=-1,P=0,se=0,fe=e,te=null;t:for(;;){for(var le;fe!==a||h!==0&&fe.nodeType!==3||(N=w+h),fe!==p||s!==0&&fe.nodeType!==3||(H=w+s),fe.nodeType===3&&(w+=fe.nodeValue.length),(le=fe.firstChild)!==null;)te=fe,fe=le;for(;;){if(fe===e)break t;if(te===a&&++P===h&&(N=w),te===p&&++se===s&&(H=w),(le=fe.nextSibling)!==null)break;fe=te,te=fe.parentNode}fe=le}a=N===-1||H===-1?null:{start:N,end:H}}else a=null}a=a||{start:0,end:0}}else a=null;for(Df={focusedElem:e,selectionRange:a},Wo=!1,on=n;on!==null;)if(n=on,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,on=e;else for(;on!==null;){switch(n=on,p=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)h=e[a],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&p!==null){e=void 0,a=n,h=p.memoizedProps,p=p.memoizedState,s=a.stateNode;try{var De=ca(a.type,h);e=s.getSnapshotBeforeUpdate(De,p),s.__reactInternalSnapshotBeforeUpdate=e}catch(Ye){St(a,a.return,Ye)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)Ff(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Ff(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(i(163))}if(e=n.sibling,e!==null){e.return=n.return,on=e;break}on=n.return}}function Ox(e,n,a){var s=a.flags;switch(a.tag){case 0:case 11:case 15:Wl(e,a),s&4&&Ki(5,a);break;case 1:if(Wl(e,a),s&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(w){St(a,a.return,w)}else{var h=ca(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(h,n,e.__reactInternalSnapshotBeforeUpdate)}catch(w){St(a,a.return,w)}}s&64&&Dx(a),s&512&&Qi(a,a.return);break;case 3:if(Wl(e,a),s&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{vm(e,n)}catch(w){St(a,a.return,w)}}break;case 27:n===null&&s&4&&Rx(a);case 26:case 5:Wl(e,a),n===null&&s&4&&Mx(a),s&512&&Qi(a,a.return);break;case 12:Wl(e,a);break;case 31:Wl(e,a),s&4&&$x(e,a);break;case 13:Wl(e,a),s&4&&Hx(e,a),s&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Q2.bind(null,a),xb(e,a))));break;case 22:if(s=a.memoizedState!==null||Kl,!s){n=n!==null&&n.memoizedState!==null||tn,h=Kl;var p=tn;Kl=s,(tn=n)&&!p?Zl(e,a,(a.subtreeFlags&8772)!==0):Wl(e,a),Kl=h,tn=p}break;case 30:break;default:Wl(e,a)}}function Bx(e){var n=e.alternate;n!==null&&(e.alternate=null,Bx(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&ja(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Ht=null,Tn=!1;function Ql(e,n,a){for(a=a.child;a!==null;)Lx(e,n,a),a=a.sibling}function Lx(e,n,a){if(Xe&&typeof Xe.onCommitFiberUnmount=="function")try{Xe.onCommitFiberUnmount(wt,a)}catch{}switch(a.tag){case 26:tn||bl(a,n),Ql(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:tn||bl(a,n);var s=Ht,h=Tn;Ar(a.type)&&(Ht=a.stateNode,Tn=!1),Ql(e,n,a),rs(a.stateNode),Ht=s,Tn=h;break;case 5:tn||bl(a,n);case 6:if(s=Ht,h=Tn,Ht=null,Ql(e,n,a),Ht=s,Tn=h,Ht!==null)if(Tn)try{(Ht.nodeType===9?Ht.body:Ht.nodeName==="HTML"?Ht.ownerDocument.body:Ht).removeChild(a.stateNode)}catch(p){St(a,n,p)}else try{Ht.removeChild(a.stateNode)}catch(p){St(a,n,p)}break;case 18:Ht!==null&&(Tn?(e=Ht,Dp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),ni(e)):Dp(Ht,a.stateNode));break;case 4:s=Ht,h=Tn,Ht=a.stateNode.containerInfo,Tn=!0,Ql(e,n,a),Ht=s,Tn=h;break;case 0:case 11:case 14:case 15:wr(2,a,n),tn||wr(4,a,n),Ql(e,n,a);break;case 1:tn||(bl(a,n),s=a.stateNode,typeof s.componentWillUnmount=="function"&&zx(a,n,s)),Ql(e,n,a);break;case 21:Ql(e,n,a);break;case 22:tn=(s=tn)||a.memoizedState!==null,Ql(e,n,a),tn=s;break;default:Ql(e,n,a)}}function $x(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ni(e)}catch(a){St(n,n.return,a)}}}function Hx(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ni(e)}catch(a){St(n,n.return,a)}}function U2(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new _x),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new _x),n;default:throw Error(i(435,e.tag))}}function Do(e,n){var a=U2(e);n.forEach(function(s){if(!a.has(s)){a.add(s);var h=W2.bind(null,e,s);s.then(h,h)}})}function Dn(e,n){var a=n.deletions;if(a!==null)for(var s=0;s<a.length;s++){var h=a[s],p=e,w=n,N=w;e:for(;N!==null;){switch(N.tag){case 27:if(Ar(N.type)){Ht=N.stateNode,Tn=!1;break e}break;case 5:Ht=N.stateNode,Tn=!1;break e;case 3:case 4:Ht=N.stateNode.containerInfo,Tn=!0;break e}N=N.return}if(Ht===null)throw Error(i(160));Lx(p,w,h),Ht=null,Tn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Ux(n,e),n=n.sibling}var cl=null;function Ux(e,n){var a=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Dn(n,e),zn(e),s&4&&(wr(3,e,e.return),Ki(3,e),wr(5,e,e.return));break;case 1:Dn(n,e),zn(e),s&512&&(tn||a===null||bl(a,a.return)),s&64&&Kl&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?s:a.concat(s))));break;case 26:var h=cl;if(Dn(n,e),zn(e),s&512&&(tn||a===null||bl(a,a.return)),s&4){var p=a!==null?a.memoizedState:null;if(s=e.memoizedState,a===null)if(s===null)if(e.stateNode===null){e:{s=e.type,a=e.memoizedProps,h=h.ownerDocument||h;t:switch(s){case"title":p=h.getElementsByTagName("title")[0],(!p||p[Bl]||p[$t]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(s),h.head.insertBefore(p,h.querySelector("head > title"))),mn(p,s,a),p[$t]=e,Ft(p),s=p;break e;case"link":var w=Up("link","href",h).get(s+(a.href||""));if(w){for(var N=0;N<w.length;N++)if(p=w[N],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){w.splice(N,1);break t}}p=h.createElement(s),mn(p,s,a),h.head.appendChild(p);break;case"meta":if(w=Up("meta","content",h).get(s+(a.content||""))){for(N=0;N<w.length;N++)if(p=w[N],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){w.splice(N,1);break t}}p=h.createElement(s),mn(p,s,a),h.head.appendChild(p);break;default:throw Error(i(468,s))}p[$t]=e,Ft(p),s=p}e.stateNode=s}else Ip(h,e.type,e.stateNode);else e.stateNode=Hp(h,s,e.memoizedProps);else p!==s?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,s===null?Ip(h,e.type,e.stateNode):Hp(h,s,e.memoizedProps)):s===null&&e.stateNode!==null&&rf(e,e.memoizedProps,a.memoizedProps)}break;case 27:Dn(n,e),zn(e),s&512&&(tn||a===null||bl(a,a.return)),a!==null&&s&4&&rf(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Dn(n,e),zn(e),s&512&&(tn||a===null||bl(a,a.return)),e.flags&32){h=e.stateNode;try{fr(h,"")}catch(De){St(e,e.return,De)}}s&4&&e.stateNode!=null&&(h=e.memoizedProps,rf(e,h,a!==null?a.memoizedProps:h)),s&1024&&(of=!0);break;case 6:if(Dn(n,e),zn(e),s&4){if(e.stateNode===null)throw Error(i(162));s=e.memoizedProps,a=e.stateNode;try{a.nodeValue=s}catch(De){St(e,e.return,De)}}break;case 3:if(Vo=null,h=cl,cl=qo(n.containerInfo),Dn(n,e),cl=h,zn(e),s&4&&a!==null&&a.memoizedState.isDehydrated)try{ni(n.containerInfo)}catch(De){St(e,e.return,De)}of&&(of=!1,Ix(e));break;case 4:s=cl,cl=qo(e.stateNode.containerInfo),Dn(n,e),zn(e),cl=s;break;case 12:Dn(n,e),zn(e);break;case 31:Dn(n,e),zn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Do(e,s)));break;case 13:Dn(n,e),zn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Mo=ht()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Do(e,s)));break;case 22:h=e.memoizedState!==null;var H=a!==null&&a.memoizedState!==null,P=Kl,se=tn;if(Kl=P||h,tn=se||H,Dn(n,e),tn=se,Kl=P,zn(e),s&8192)e:for(n=e.stateNode,n._visibility=h?n._visibility&-2:n._visibility|1,h&&(a===null||H||Kl||tn||ua(e)),a=null,n=e;;){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{N=H.stateNode;var fe=H.memoizedProps.style,te=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;N.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(De){St(H,H.return,De)}}}else if(n.tag===6){if(a===null){H=n;try{H.stateNode.nodeValue=h?"":H.memoizedProps}catch(De){St(H,H.return,De)}}}else if(n.tag===18){if(a===null){H=n;try{var le=H.stateNode;h?zp(le,!0):zp(H.stateNode,!1)}catch(De){St(H,H.return,De)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}s&4&&(s=e.updateQueue,s!==null&&(a=s.retryQueue,a!==null&&(s.retryQueue=null,Do(e,a))));break;case 19:Dn(n,e),zn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Do(e,s)));break;case 30:break;case 21:break;default:Dn(n,e),zn(e)}}function zn(e){var n=e.flags;if(n&2){try{for(var a,s=e.return;s!==null;){if(Fx(s)){a=s;break}s=s.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var h=a.stateNode,p=af(e);To(e,p,h);break;case 5:var w=a.stateNode;a.flags&32&&(fr(w,""),a.flags&=-33);var N=af(e);To(e,N,w);break;case 3:case 4:var H=a.stateNode.containerInfo,P=af(e);sf(e,P,H);break;default:throw Error(i(161))}}catch(se){St(e,e.return,se)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Ix(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Ix(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Wl(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Ox(e,n.alternate,n),n=n.sibling}function ua(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:wr(4,n,n.return),ua(n);break;case 1:bl(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&zx(n,n.return,a),ua(n);break;case 27:rs(n.stateNode);case 26:case 5:bl(n,n.return),ua(n);break;case 22:n.memoizedState===null&&ua(n);break;case 30:ua(n);break;default:ua(n)}e=e.sibling}}function Zl(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var s=n.alternate,h=e,p=n,w=p.flags;switch(p.tag){case 0:case 11:case 15:Zl(h,p,a),Ki(4,p);break;case 1:if(Zl(h,p,a),s=p,h=s.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(P){St(s,s.return,P)}if(s=p,h=s.updateQueue,h!==null){var N=s.stateNode;try{var H=h.shared.hiddenCallbacks;if(H!==null)for(h.shared.hiddenCallbacks=null,h=0;h<H.length;h++)bm(H[h],N)}catch(P){St(s,s.return,P)}}a&&w&64&&Dx(p),Qi(p,p.return);break;case 27:Rx(p);case 26:case 5:Zl(h,p,a),a&&s===null&&w&4&&Mx(p),Qi(p,p.return);break;case 12:Zl(h,p,a);break;case 31:Zl(h,p,a),a&&w&4&&$x(h,p);break;case 13:Zl(h,p,a),a&&w&4&&Hx(h,p);break;case 22:p.memoizedState===null&&Zl(h,p,a),Qi(p,p.return);break;case 30:break;default:Zl(h,p,a)}n=n.sibling}}function cf(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&_i(a))}function uf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&_i(e))}function ul(e,n,a,s){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Yx(e,n,a,s),n=n.sibling}function Yx(e,n,a,s){var h=n.flags;switch(n.tag){case 0:case 11:case 15:ul(e,n,a,s),h&2048&&Ki(9,n);break;case 1:ul(e,n,a,s);break;case 3:ul(e,n,a,s),h&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&_i(e)));break;case 12:if(h&2048){ul(e,n,a,s),e=n.stateNode;try{var p=n.memoizedProps,w=p.id,N=p.onPostCommit;typeof N=="function"&&N(w,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(H){St(n,n.return,H)}}else ul(e,n,a,s);break;case 31:ul(e,n,a,s);break;case 13:ul(e,n,a,s);break;case 23:break;case 22:p=n.stateNode,w=n.alternate,n.memoizedState!==null?p._visibility&2?ul(e,n,a,s):Wi(e,n):p._visibility&2?ul(e,n,a,s):(p._visibility|=2,Xa(e,n,a,s,(n.subtreeFlags&10256)!==0||!1)),h&2048&&cf(w,n);break;case 24:ul(e,n,a,s),h&2048&&uf(n.alternate,n);break;default:ul(e,n,a,s)}}function Xa(e,n,a,s,h){for(h=h&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var p=e,w=n,N=a,H=s,P=w.flags;switch(w.tag){case 0:case 11:case 15:Xa(p,w,N,H,h),Ki(8,w);break;case 23:break;case 22:var se=w.stateNode;w.memoizedState!==null?se._visibility&2?Xa(p,w,N,H,h):Wi(p,w):(se._visibility|=2,Xa(p,w,N,H,h)),h&&P&2048&&cf(w.alternate,w);break;case 24:Xa(p,w,N,H,h),h&&P&2048&&uf(w.alternate,w);break;default:Xa(p,w,N,H,h)}n=n.sibling}}function Wi(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,s=n,h=s.flags;switch(s.tag){case 22:Wi(a,s),h&2048&&cf(s.alternate,s);break;case 24:Wi(a,s),h&2048&&uf(s.alternate,s);break;default:Wi(a,s)}n=n.sibling}}var Zi=8192;function Va(e,n,a){if(e.subtreeFlags&Zi)for(e=e.child;e!==null;)qx(e,n,a),e=e.sibling}function qx(e,n,a){switch(e.tag){case 26:Va(e,n,a),e.flags&Zi&&e.memoizedState!==null&&Nb(a,cl,e.memoizedState,e.memoizedProps);break;case 5:Va(e,n,a);break;case 3:case 4:var s=cl;cl=qo(e.stateNode.containerInfo),Va(e,n,a),cl=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Zi,Zi=16777216,Va(e,n,a),Zi=s):Va(e,n,a));break;default:Va(e,n,a)}}function Xx(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function Ji(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var s=n[a];on=s,Gx(s,e)}Xx(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Vx(e),e=e.sibling}function Vx(e){switch(e.tag){case 0:case 11:case 15:Ji(e),e.flags&2048&&wr(9,e,e.return);break;case 3:Ji(e);break;case 12:Ji(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,zo(e)):Ji(e);break;default:Ji(e)}}function zo(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var s=n[a];on=s,Gx(s,e)}Xx(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:wr(8,n,n.return),zo(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,zo(n));break;default:zo(n)}e=e.sibling}}function Gx(e,n){for(;on!==null;){var a=on;switch(a.tag){case 0:case 11:case 15:wr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var s=a.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:_i(a.memoizedState.cache)}if(s=a.child,s!==null)s.return=a,on=s;else e:for(a=e;on!==null;){s=on;var h=s.sibling,p=s.return;if(Bx(s),s===a){on=null;break e}if(h!==null){h.return=p,on=h;break e}on=p}}}var I2={getCacheForType:function(e){var n=dn(Jt),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return dn(Jt).controller.signal}},Y2=typeof WeakMap=="function"?WeakMap:Map,bt=0,Tt=null,lt=null,st=0,kt=0,Yn=null,kr=!1,Ga=!1,ff=!1,Jl=0,Gt=0,Sr=0,fa=0,df=0,qn=0,Ka=0,Pi=null,Mn=null,hf=!1,Mo=0,Kx=0,Fo=1/0,Ro=null,jr=null,ln=0,Cr=null,Qa=null,Pl=0,mf=0,xf=null,Qx=null,es=0,pf=null;function Xn(){return(bt&2)!==0&&st!==0?st&-st:I.T!==null?kf():Rl()}function Wx(){if(qn===0)if((st&536870912)===0||ut){var e=ka;ka<<=1,(ka&3932160)===0&&(ka=262144),qn=e}else qn=536870912;return e=Un.current,e!==null&&(e.flags|=32),qn}function Fn(e,n,a){(e===Tt&&(kt===2||kt===9)||e.cancelPendingCommit!==null)&&(Wa(e,0),Er(e,st,qn,!1)),ir(e,a),((bt&2)===0||e!==Tt)&&(e===Tt&&((bt&2)===0&&(fa|=a),Gt===4&&Er(e,st,qn,!1)),vl(e))}function Zx(e,n,a){if((bt&6)!==0)throw Error(i(327));var s=!a&&(n&127)===0&&(n&e.expiredLanes)===0||Ml(e,n),h=s?V2(e,n):gf(e,n,!0),p=s;do{if(h===0){Ga&&!s&&Er(e,n,0,!1);break}else{if(a=e.current.alternate,p&&!q2(a)){h=gf(e,n,!1),p=!1;continue}if(h===2){if(p=n,e.errorRecoveryDisabledLanes&p)var w=0;else w=e.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){n=w;e:{var N=e;h=Pi;var H=N.current.memoizedState.isDehydrated;if(H&&(Wa(N,w).flags|=256),w=gf(N,w,!1),w!==2){if(ff&&!H){N.errorRecoveryDisabledLanes|=p,fa|=p,h=4;break e}p=Mn,Mn=h,p!==null&&(Mn===null?Mn=p:Mn.push.apply(Mn,p))}h=w}if(p=!1,h!==2)continue}}if(h===1){Wa(e,0),Er(e,n,0,!0);break}e:{switch(s=e,p=h,p){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:Er(s,n,qn,!kr);break e;case 2:Mn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(h=Mo+300-ht(),10<h)){if(Er(s,n,qn,!kr),ar(s,0,!0)!==0)break e;Pl=n,s.timeoutHandle=Ap(Jx.bind(null,s,a,Mn,Ro,hf,n,qn,fa,Ka,kr,p,"Throttled",-0,0),h);break e}Jx(s,a,Mn,Ro,hf,n,qn,fa,Ka,kr,p,null,-0,0)}}break}while(!0);vl(e)}function Jx(e,n,a,s,h,p,w,N,H,P,se,fe,te,le){if(e.timeoutHandle=-1,fe=n.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Qn},qx(n,p,fe);var De=(p&62914560)===p?Mo-ht():(p&4194048)===p?Kx-ht():0;if(De=Ab(fe,De),De!==null){Pl=p,e.cancelPendingCommit=De(ip.bind(null,e,n,p,a,s,h,w,N,H,se,fe,null,te,le)),Er(e,p,w,!P);return}}ip(e,n,p,a,s,h,w,N,H)}function q2(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var s=0;s<a.length;s++){var h=a[s],p=h.getSnapshot;h=h.value;try{if(!$n(p(),h))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Er(e,n,a,s){n&=~df,n&=~fa,e.suspendedLanes|=n,e.pingedLanes&=~n,s&&(e.warmLanes|=n),s=e.expirationTimes;for(var h=n;0<h;){var p=31-de(h),w=1<<p;s[p]=-1,h&=~w}a!==0&&On(e,a,n)}function _o(){return(bt&6)===0?(ts(0),!1):!0}function yf(){if(lt!==null){if(kt===0)var e=lt.return;else e=lt,Il=na=null,Mu(e),Ha=null,Bi=0,e=lt;for(;e!==null;)Tx(e.alternate,e),e=e.return;lt=null}}function Wa(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,ub(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Pl=0,yf(),Tt=e,lt=a=Hl(e.current,null),st=n,kt=0,Yn=null,kr=!1,Ga=Ml(e,n),ff=!1,Ka=qn=df=fa=Sr=Gt=0,Mn=Pi=null,hf=!1,(n&8)!==0&&(n|=n&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=n;0<s;){var h=31-de(s),p=1<<h;n|=e[h],s&=~p}return Jl=n,to(),a}function Px(e,n){We=null,I.H=Xi,n===$a||n===co?(n=xm(),kt=3):n===vu?(n=xm(),kt=4):kt=n===Ku?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Yn=n,lt===null&&(Gt=1,jo(e,Jn(n,e.current)))}function ep(){var e=Un.current;return e===null?!0:(st&4194048)===st?nl===null:(st&62914560)===st||(st&536870912)!==0?e===nl:!1}function tp(){var e=I.H;return I.H=Xi,e===null?Xi:e}function np(){var e=I.A;return I.A=I2,e}function Oo(){Gt=4,kr||(st&4194048)!==st&&Un.current!==null||(Ga=!0),(Sr&134217727)===0&&(fa&134217727)===0||Tt===null||Er(Tt,st,qn,!1)}function gf(e,n,a){var s=bt;bt|=2;var h=tp(),p=np();(Tt!==e||st!==n)&&(Ro=null,Wa(e,n)),n=!1;var w=Gt;e:do try{if(kt!==0&<!==null){var N=lt,H=Yn;switch(kt){case 8:yf(),w=6;break e;case 3:case 2:case 9:case 6:Un.current===null&&(n=!0);var P=kt;if(kt=0,Yn=null,Za(e,N,H,P),a&&Ga){w=0;break e}break;default:P=kt,kt=0,Yn=null,Za(e,N,H,P)}}X2(),w=Gt;break}catch(se){Px(e,se)}while(!0);return n&&e.shellSuspendCounter++,Il=na=null,bt=s,I.H=h,I.A=p,lt===null&&(Tt=null,st=0,to()),w}function X2(){for(;lt!==null;)lp(lt)}function V2(e,n){var a=bt;bt|=2;var s=tp(),h=np();Tt!==e||st!==n?(Ro=null,Fo=ht()+500,Wa(e,n)):Ga=Ml(e,n);e:do try{if(kt!==0&<!==null){n=lt;var p=Yn;t:switch(kt){case 1:kt=0,Yn=null,Za(e,n,p,1);break;case 2:case 9:if(hm(p)){kt=0,Yn=null,rp(n);break}n=function(){kt!==2&&kt!==9||Tt!==e||(kt=7),vl(e)},p.then(n,n);break e;case 3:kt=7;break e;case 4:kt=5;break e;case 7:hm(p)?(kt=0,Yn=null,rp(n)):(kt=0,Yn=null,Za(e,n,p,7));break;case 5:var w=null;switch(lt.tag){case 26:w=lt.memoizedState;case 5:case 27:var N=lt;if(w?Yp(w):N.stateNode.complete){kt=0,Yn=null;var H=N.sibling;if(H!==null)lt=H;else{var P=N.return;P!==null?(lt=P,Bo(P)):lt=null}break t}}kt=0,Yn=null,Za(e,n,p,5);break;case 6:kt=0,Yn=null,Za(e,n,p,6);break;case 8:yf(),Gt=6;break e;default:throw Error(i(462))}}G2();break}catch(se){Px(e,se)}while(!0);return Il=na=null,I.H=s,I.A=h,bt=a,lt!==null?0:(Tt=null,st=0,to(),Gt)}function G2(){for(;lt!==null&&!Lt();)lp(lt)}function lp(e){var n=Nx(e.alternate,e,Jl);e.memoizedProps=e.pendingProps,n===null?Bo(e):lt=n}function rp(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=wx(a,n,n.pendingProps,n.type,void 0,st);break;case 11:n=wx(a,n,n.pendingProps,n.type.render,n.ref,st);break;case 5:Mu(n);default:Tx(a,n),n=lt=nm(n,Jl),n=Nx(a,n,Jl)}e.memoizedProps=e.pendingProps,n===null?Bo(e):lt=n}function Za(e,n,a,s){Il=na=null,Mu(n),Ha=null,Bi=0;var h=n.return;try{if(_2(e,h,n,a,st)){Gt=1,jo(e,Jn(a,e.current)),lt=null;return}}catch(p){if(h!==null)throw lt=h,p;Gt=1,jo(e,Jn(a,e.current)),lt=null;return}n.flags&32768?(ut||s===1?e=!0:Ga||(st&536870912)!==0?e=!1:(kr=e=!0,(s===2||s===9||s===3||s===6)&&(s=Un.current,s!==null&&s.tag===13&&(s.flags|=16384))),ap(n,e)):Bo(n)}function Bo(e){var n=e;do{if((n.flags&32768)!==0){ap(n,kr);return}e=n.return;var a=L2(n.alternate,n,Jl);if(a!==null){lt=a;return}if(n=n.sibling,n!==null){lt=n;return}lt=n=e}while(n!==null);Gt===0&&(Gt=5)}function ap(e,n){do{var a=$2(e.alternate,e);if(a!==null){a.flags&=32767,lt=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){lt=e;return}lt=e=a}while(e!==null);Gt=6,lt=null}function ip(e,n,a,s,h,p,w,N,H){e.cancelPendingCommit=null;do Lo();while(ln!==0);if((bt&6)!==0)throw Error(i(327));if(n!==null){if(n===e.current)throw Error(i(177));if(p=n.lanes|n.childLanes,p|=au,xi(e,a,p,w,N,H),e===Tt&&(lt=Tt=null,st=0),Qa=n,Cr=e,Pl=a,mf=p,xf=h,Qx=s,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Z2(ze,function(){return fp(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||s){s=I.T,I.T=null,h=Z.p,Z.p=2,w=bt,bt|=4;try{H2(e,n,a)}finally{bt=w,Z.p=h,I.T=s}}ln=1,sp(),op(),cp()}}function sp(){if(ln===1){ln=0;var e=Cr,n=Qa,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=I.T,I.T=null;var s=Z.p;Z.p=2;var h=bt;bt|=4;try{Ux(n,e);var p=Df,w=Gh(e.containerInfo),N=p.focusedElem,H=p.selectionRange;if(w!==N&&N&&N.ownerDocument&&Vh(N.ownerDocument.documentElement,N)){if(H!==null&&eu(N)){var P=H.start,se=H.end;if(se===void 0&&(se=P),"selectionStart"in N)N.selectionStart=P,N.selectionEnd=Math.min(se,N.value.length);else{var fe=N.ownerDocument||document,te=fe&&fe.defaultView||window;if(te.getSelection){var le=te.getSelection(),De=N.textContent.length,Ye=Math.min(H.start,De),Nt=H.end===void 0?Ye:Math.min(H.end,De);!le.extend&&Ye>Nt&&(w=Nt,Nt=Ye,Ye=w);var K=Xh(N,Ye),q=Xh(N,Nt);if(K&&q&&(le.rangeCount!==1||le.anchorNode!==K.node||le.anchorOffset!==K.offset||le.focusNode!==q.node||le.focusOffset!==q.offset)){var J=fe.createRange();J.setStart(K.node,K.offset),le.removeAllRanges(),Ye>Nt?(le.addRange(J),le.extend(q.node,q.offset)):(J.setEnd(q.node,q.offset),le.addRange(J))}}}}for(fe=[],le=N;le=le.parentNode;)le.nodeType===1&&fe.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<fe.length;N++){var oe=fe[N];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}Wo=!!Tf,Df=Tf=null}finally{bt=h,Z.p=s,I.T=a}}e.current=n,ln=2}}function op(){if(ln===2){ln=0;var e=Cr,n=Qa,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=I.T,I.T=null;var s=Z.p;Z.p=2;var h=bt;bt|=4;try{Ox(e,n.alternate,n)}finally{bt=h,Z.p=s,I.T=a}}ln=3}}function cp(){if(ln===4||ln===3){ln=0,gt();var e=Cr,n=Qa,a=Pl,s=Qx;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?ln=5:(ln=0,Qa=Cr=null,up(e,e.pendingLanes));var h=e.pendingLanes;if(h===0&&(jr=null),ml(a),n=n.stateNode,Xe&&typeof Xe.onCommitFiberRoot=="function")try{Xe.onCommitFiberRoot(wt,n,void 0,(n.current.flags&128)===128)}catch{}if(s!==null){n=I.T,h=Z.p,Z.p=2,I.T=null;try{for(var p=e.onRecoverableError,w=0;w<s.length;w++){var N=s[w];p(N.value,{componentStack:N.stack})}}finally{I.T=n,Z.p=h}}(Pl&3)!==0&&Lo(),vl(e),h=e.pendingLanes,(a&261930)!==0&&(h&42)!==0?e===pf?es++:(es=0,pf=e):es=0,ts(0)}}function up(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,_i(n)))}function Lo(){return sp(),op(),cp(),fp()}function fp(){if(ln!==5)return!1;var e=Cr,n=mf;mf=0;var a=ml(Pl),s=I.T,h=Z.p;try{Z.p=32>a?32:a,I.T=null,a=xf,xf=null;var p=Cr,w=Pl;if(ln=0,Qa=Cr=null,Pl=0,(bt&6)!==0)throw Error(i(331));var N=bt;if(bt|=4,Vx(p.current),Yx(p,p.current,w,a),bt=N,ts(0,!1),Xe&&typeof Xe.onPostCommitFiberRoot=="function")try{Xe.onPostCommitFiberRoot(wt,p)}catch{}return!0}finally{Z.p=h,I.T=s,up(e,n)}}function dp(e,n,a){n=Jn(a,n),n=Gu(e.stateNode,n,2),e=gr(e,n,2),e!==null&&(ir(e,2),vl(e))}function St(e,n,a){if(e.tag===3)dp(e,e,a);else for(;n!==null;){if(n.tag===3){dp(n,e,a);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(jr===null||!jr.has(s))){e=Jn(a,e),a=hx(2),s=gr(n,a,2),s!==null&&(mx(a,s,n,e),ir(s,2),vl(s));break}}n=n.return}}function bf(e,n,a){var s=e.pingCache;if(s===null){s=e.pingCache=new Y2;var h=new Set;s.set(n,h)}else h=s.get(n),h===void 0&&(h=new Set,s.set(n,h));h.has(a)||(ff=!0,h.add(a),e=K2.bind(null,e,n,a),n.then(e,e))}function K2(e,n,a){var s=e.pingCache;s!==null&&s.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Tt===e&&(st&a)===a&&(Gt===4||Gt===3&&(st&62914560)===st&&300>ht()-Mo?(bt&2)===0&&Wa(e,0):df|=a,Ka===st&&(Ka=0)),vl(e)}function hp(e,n){n===0&&(n=Us()),e=Pr(e,n),e!==null&&(ir(e,n),vl(e))}function Q2(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),hp(e,a)}function W2(e,n){var a=0;switch(e.tag){case 31:case 13:var s=e.stateNode,h=e.memoizedState;h!==null&&(a=h.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(i(314))}s!==null&&s.delete(n),hp(e,a)}function Z2(e,n){return Re(e,n)}var $o=null,Ja=null,vf=!1,Ho=!1,wf=!1,Nr=0;function vl(e){e!==Ja&&e.next===null&&(Ja===null?$o=Ja=e:Ja=Ja.next=e),Ho=!0,vf||(vf=!0,P2())}function ts(e,n){if(!wf&&Ho){wf=!0;do for(var a=!1,s=$o;s!==null;){if(e!==0){var h=s.pendingLanes;if(h===0)var p=0;else{var w=s.suspendedLanes,N=s.pingedLanes;p=(1<<31-de(42|e)+1)-1,p&=h&~(w&~N),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,yp(s,p))}else p=st,p=ar(s,s===Tt?p:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(p&3)===0||Ml(s,p)||(a=!0,yp(s,p));s=s.next}while(a);wf=!1}}function J2(){mp()}function mp(){Ho=vf=!1;var e=0;Nr!==0&&cb()&&(e=Nr);for(var n=ht(),a=null,s=$o;s!==null;){var h=s.next,p=xp(s,n);p===0?(s.next=null,a===null?$o=h:a.next=h,h===null&&(Ja=a)):(a=s,(e!==0||(p&3)!==0)&&(Ho=!0)),s=h}ln!==0&&ln!==5||ts(e),Nr!==0&&(Nr=0)}function xp(e,n){for(var a=e.suspendedLanes,s=e.pingedLanes,h=e.expirationTimes,p=e.pendingLanes&-62914561;0<p;){var w=31-de(p),N=1<<w,H=h[w];H===-1?((N&a)===0||(N&s)!==0)&&(h[w]=Sa(N,n)):H<=n&&(e.expiredLanes|=N),p&=~N}if(n=Tt,a=st,a=ar(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,a===0||e===n&&(kt===2||kt===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&Ke(s),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Ml(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(s!==null&&Ke(s),ml(a)){case 2:case 8:a=ye;break;case 32:a=ze;break;case 268435456:a=be;break;default:a=ze}return s=pp.bind(null,e),a=Re(a,s),e.callbackPriority=n,e.callbackNode=a,n}return s!==null&&s!==null&&Ke(s),e.callbackPriority=2,e.callbackNode=null,2}function pp(e,n){if(ln!==0&&ln!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Lo()&&e.callbackNode!==a)return null;var s=st;return s=ar(e,e===Tt?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Zx(e,s,n),xp(e,ht()),e.callbackNode!=null&&e.callbackNode===a?pp.bind(null,e):null)}function yp(e,n){if(Lo())return null;Zx(e,n,!0)}function P2(){fb(function(){(bt&6)!==0?Re(re,J2):mp()})}function kf(){if(Nr===0){var e=Ba;e===0&&(e=Tl,Tl<<=1,(Tl&261888)===0&&(Tl=256)),Nr=e}return Nr}function gp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ln(""+e)}function bp(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function eb(e,n,a,s,h){if(n==="submit"&&a&&a.stateNode===h){var p=gp((h[cn]||null).action),w=s.submitter;w&&(n=(n=w[cn]||null)?gp(n.formAction):w.getAttribute("formAction"),n!==null&&(p=n,w=null));var N=new Zs("action","action",null,s,h);e.push({event:N,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Nr!==0){var H=w?bp(h,w):new FormData(h);Uu(a,{pending:!0,data:H,method:h.method,action:p},null,H)}}else typeof p=="function"&&(N.preventDefault(),H=w?bp(h,w):new FormData(h),Uu(a,{pending:!0,data:H,method:h.method,action:p},p,H))},currentTarget:h}]})}}for(var Sf=0;Sf<ru.length;Sf++){var jf=ru[Sf],tb=jf.toLowerCase(),nb=jf[0].toUpperCase()+jf.slice(1);ol(tb,"on"+nb)}ol(Wh,"onAnimationEnd"),ol(Zh,"onAnimationIteration"),ol(Jh,"onAnimationStart"),ol("dblclick","onDoubleClick"),ol("focusin","onFocus"),ol("focusout","onBlur"),ol(g2,"onTransitionRun"),ol(b2,"onTransitionStart"),ol(v2,"onTransitionCancel"),ol(Ph,"onTransitionEnd"),Xt("onMouseEnter",["mouseout","mouseover"]),Xt("onMouseLeave",["mouseout","mouseover"]),Xt("onPointerEnter",["pointerout","pointerover"]),Xt("onPointerLeave",["pointerout","pointerover"]),Cn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Cn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Cn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Cn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Cn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Cn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ns="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),lb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ns));function vp(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var s=e[a],h=s.event;s=s.listeners;e:{var p=void 0;if(n)for(var w=s.length-1;0<=w;w--){var N=s[w],H=N.instance,P=N.currentTarget;if(N=N.listener,H!==p&&h.isPropagationStopped())break e;p=N,h.currentTarget=P;try{p(h)}catch(se){eo(se)}h.currentTarget=null,p=H}else for(w=0;w<s.length;w++){if(N=s[w],H=N.instance,P=N.currentTarget,N=N.listener,H!==p&&h.isPropagationStopped())break e;p=N,h.currentTarget=P;try{p(h)}catch(se){eo(se)}h.currentTarget=null,p=H}}}}function rt(e,n){var a=n[Gr];a===void 0&&(a=n[Gr]=new Set);var s=e+"__bubble";a.has(s)||(wp(n,e,2,!1),a.add(s))}function Cf(e,n,a){var s=0;n&&(s|=4),wp(a,e,s,n)}var Uo="_reactListening"+Math.random().toString(36).slice(2);function Ef(e){if(!e[Uo]){e[Uo]=!0,or.forEach(function(a){a!=="selectionchange"&&(lb.has(a)||Cf(a,!1,e),Cf(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Uo]||(n[Uo]=!0,Cf("selectionchange",!1,n))}}function wp(e,n,a,s){switch(Wp(n)){case 2:var h=zb;break;case 8:h=Mb;break;default:h=Uf}a=h.bind(null,n,a,e),h=void 0,!ue||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(h=!0),s?h!==void 0?e.addEventListener(n,a,{capture:!0,passive:h}):e.addEventListener(n,a,!0):h!==void 0?e.addEventListener(n,a,{passive:h}):e.addEventListener(n,a,!1)}function Nf(e,n,a,s,h){var p=s;if((n&1)===0&&(n&2)===0&&s!==null)e:for(;;){if(s===null)return;var w=s.tag;if(w===3||w===4){var N=s.stateNode.containerInfo;if(N===h)break;if(w===4)for(w=s.return;w!==null;){var H=w.tag;if((H===3||H===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;N!==null;){if(w=Ll(N),w===null)return;if(H=w.tag,H===5||H===6||H===26||H===27){s=p=w;continue e}N=N.parentNode}}s=s.return}Ci(function(){var P=p,se=Si(a),fe=[];e:{var te=em.get(e);if(te!==void 0){var le=Zs,De=e;switch(e){case"keypress":if(nt(a)===0)break e;case"keydown":case"keyup":le=Wg;break;case"focusin":De="focus",le=Qc;break;case"focusout":De="blur",le=Qc;break;case"beforeblur":case"afterblur":le=Qc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=Th;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=Lg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=Pg;break;case Wh:case Zh:case Jh:le=Ug;break;case Ph:le=t2;break;case"scroll":case"scrollend":le=Og;break;case"wheel":le=l2;break;case"copy":case"cut":case"paste":le=Yg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=zh;break;case"toggle":case"beforetoggle":le=a2}var Ye=(n&4)!==0,Nt=!Ye&&(e==="scroll"||e==="scrollend"),K=Ye?te!==null?te+"Capture":null:te;Ye=[];for(var q=P,J;q!==null;){var oe=q;if(J=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||J===null||K===null||(oe=_(q,K),oe!=null&&Ye.push(ls(q,oe,J))),Nt)break;q=q.return}0<Ye.length&&(te=new le(te,De,null,a,se),fe.push({event:te,listeners:Ye}))}}if((n&7)===0){e:{if(te=e==="mouseover"||e==="pointerover",le=e==="mouseout"||e==="pointerout",te&&a!==ki&&(De=a.relatedTarget||a.fromElement)&&(Ll(De)||De[Ol]))break e;if((le||te)&&(te=se.window===se?se:(te=se.ownerDocument)?te.defaultView||te.parentWindow:window,le?(De=a.relatedTarget||a.toElement,le=P,De=De?Ll(De):null,De!==null&&(Nt=u(De),Ye=De.tag,De!==Nt||Ye!==5&&Ye!==27&&Ye!==6)&&(De=null)):(le=null,De=P),le!==De)){if(Ye=Th,oe="onMouseLeave",K="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(Ye=zh,oe="onPointerLeave",K="onPointerEnter",q="pointer"),Nt=le==null?te:$l(le),J=De==null?te:$l(De),te=new Ye(oe,q+"leave",le,a,se),te.target=Nt,te.relatedTarget=J,oe=null,Ll(se)===P&&(Ye=new Ye(K,q+"enter",De,a,se),Ye.target=J,Ye.relatedTarget=Nt,oe=Ye),Nt=oe,le&&De)t:{for(Ye=rb,K=le,q=De,J=0,oe=K;oe;oe=Ye(oe))J++;oe=0;for(var $e=q;$e;$e=Ye($e))oe++;for(;0<J-oe;)K=Ye(K),J--;for(;0<oe-J;)q=Ye(q),oe--;for(;J--;){if(K===q||q!==null&&K===q.alternate){Ye=K;break t}K=Ye(K),q=Ye(q)}Ye=null}else Ye=null;le!==null&&kp(fe,te,le,Ye,!1),De!==null&&Nt!==null&&kp(fe,Nt,De,Ye,!0)}}e:{if(te=P?$l(P):window,le=te.nodeName&&te.nodeName.toLowerCase(),le==="select"||le==="input"&&te.type==="file")var mt=$h;else if(Bh(te))if(Hh)mt=x2;else{mt=h2;var _e=d2}else le=te.nodeName,!le||le.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?P&&Qr(P.elementType)&&(mt=$h):mt=m2;if(mt&&(mt=mt(e,P))){Lh(fe,mt,a,se);break e}_e&&_e(e,te,P),e==="focusout"&&P&&te.type==="number"&&P.memoizedProps.value!=null&&wi(te,"number",te.value)}switch(_e=P?$l(P):window,e){case"focusin":(Bh(_e)||_e.contentEditable==="true")&&(Ta=_e,tu=P,Mi=null);break;case"focusout":Mi=tu=Ta=null;break;case"mousedown":nu=!0;break;case"contextmenu":case"mouseup":case"dragend":nu=!1,Kh(fe,a,se);break;case"selectionchange":if(y2)break;case"keydown":case"keyup":Kh(fe,a,se)}var Ze;if(Zc)e:{switch(e){case"compositionstart":var ot="onCompositionStart";break e;case"compositionend":ot="onCompositionEnd";break e;case"compositionupdate":ot="onCompositionUpdate";break e}ot=void 0}else Aa?_h(e,a)&&(ot="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(ot="onCompositionStart");ot&&(Mh&&a.locale!=="ko"&&(Aa||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&Aa&&(Ze=Pe()):(ge=se,Me="value"in ge?ge.value:ge.textContent,Aa=!0)),_e=Io(P,ot),0<_e.length&&(ot=new Dh(ot,e,null,a,se),fe.push({event:ot,listeners:_e}),Ze?ot.data=Ze:(Ze=Oh(a),Ze!==null&&(ot.data=Ze)))),(Ze=s2?o2(e,a):c2(e,a))&&(ot=Io(P,"onBeforeInput"),0<ot.length&&(_e=new Dh("onBeforeInput","beforeinput",null,a,se),fe.push({event:_e,listeners:ot}),_e.data=Ze)),eb(fe,e,P,a,se)}vp(fe,n)})}function ls(e,n,a){return{instance:e,listener:n,currentTarget:a}}function Io(e,n){for(var a=n+"Capture",s=[];e!==null;){var h=e,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=_(e,a),h!=null&&s.unshift(ls(e,h,p)),h=_(e,n),h!=null&&s.push(ls(e,h,p))),e.tag===3)return s;e=e.return}return[]}function rb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function kp(e,n,a,s,h){for(var p=n._reactName,w=[];a!==null&&a!==s;){var N=a,H=N.alternate,P=N.stateNode;if(N=N.tag,H!==null&&H===s)break;N!==5&&N!==26&&N!==27||P===null||(H=P,h?(P=_(a,p),P!=null&&w.unshift(ls(a,P,H))):h||(P=_(a,p),P!=null&&w.push(ls(a,P,H)))),a=a.return}w.length!==0&&e.push({event:n,listeners:w})}var ab=/\r\n?/g,ib=/\u0000|\uFFFD/g;function Sp(e){return(typeof e=="string"?e:""+e).replace(ab,`
|
|
49
|
-
`).replace(ib,"")}function jp(e,n){return n=Sp(n),Sp(e)===n}function Et(e,n,a,s,h,p){switch(a){case"children":typeof s=="string"?n==="body"||n==="textarea"&&s===""||fr(e,s):(typeof s=="number"||typeof s=="bigint")&&n!=="body"&&fr(e,""+s);break;case"className":pl(e,"class",s);break;case"tabIndex":pl(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":pl(e,a,s);break;case"style":sl(e,s,p);break;case"data":if(n!=="object"){pl(e,"data",s);break}case"src":case"href":if(s===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=Ln(""+s),e.setAttribute(a,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(a==="formAction"?(n!=="input"&&Et(e,n,"name",h.name,h,null),Et(e,n,"formEncType",h.formEncType,h,null),Et(e,n,"formMethod",h.formMethod,h,null),Et(e,n,"formTarget",h.formTarget,h,null)):(Et(e,n,"encType",h.encType,h,null),Et(e,n,"method",h.method,h,null),Et(e,n,"target",h.target,h,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=Ln(""+s),e.setAttribute(a,s);break;case"onClick":s!=null&&(e.onclick=Qn);break;case"onScroll":s!=null&&rt("scroll",e);break;case"onScrollEnd":s!=null&&rt("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(i(61));if(a=s.__html,a!=null){if(h.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}a=Ln(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,""+s):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":s===!0?e.setAttribute(a,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,s):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(a,s):e.removeAttribute(a);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(a):e.setAttribute(a,s);break;case"popover":rt("beforetoggle",e),rt("toggle",e),Ea(e,"popover",s);break;case"xlinkActuate":bn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":bn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":bn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":bn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":bn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":bn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":bn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":bn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":bn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Ea(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Xc.get(a)||a,Ea(e,a,s))}}function Af(e,n,a,s,h,p){switch(a){case"style":sl(e,s,p);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(i(61));if(a=s.__html,a!=null){if(h.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"children":typeof s=="string"?fr(e,s):(typeof s=="number"||typeof s=="bigint")&&fr(e,""+s);break;case"onScroll":s!=null&&rt("scroll",e);break;case"onScrollEnd":s!=null&&rt("scrollend",e);break;case"onClick":s!=null&&(e.onclick=Qn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xs.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(h=a.endsWith("Capture"),n=a.slice(2,h?a.length-7:void 0),p=e[cn]||null,p=p!=null?p[a]:null,typeof p=="function"&&e.removeEventListener(n,p,h),typeof s=="function")){typeof p!="function"&&p!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,s,h);break e}a in e?e[a]=s:s===!0?e.setAttribute(a,""):Ea(e,a,s)}}}function mn(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":rt("error",e),rt("load",e);var s=!1,h=!1,p;for(p in a)if(a.hasOwnProperty(p)){var w=a[p];if(w!=null)switch(p){case"src":s=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Et(e,n,p,w,a,null)}}h&&Et(e,n,"srcSet",a.srcSet,a,null),s&&Et(e,n,"src",a.src,a,null);return;case"input":rt("invalid",e);var N=p=w=h=null,H=null,P=null;for(s in a)if(a.hasOwnProperty(s)){var se=a[s];if(se!=null)switch(s){case"name":h=se;break;case"type":w=se;break;case"checked":H=se;break;case"defaultChecked":P=se;break;case"value":p=se;break;case"defaultValue":N=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(i(137,n));break;default:Et(e,n,s,se,a,null)}}vi(e,p,N,H,P,w,h,!1);return;case"select":rt("invalid",e),s=w=p=null;for(h in a)if(a.hasOwnProperty(h)&&(N=a[h],N!=null))switch(h){case"value":p=N;break;case"defaultValue":w=N;break;case"multiple":s=N;default:Et(e,n,h,N,a,null)}n=p,a=w,e.multiple=!!s,n!=null?ur(e,!!s,n,!1):a!=null&&ur(e,!!s,a,!0);return;case"textarea":rt("invalid",e),p=h=s=null;for(w in a)if(a.hasOwnProperty(w)&&(N=a[w],N!=null))switch(w){case"value":s=N;break;case"defaultValue":h=N;break;case"children":p=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(i(91));break;default:Et(e,n,w,N,a,null)}Qs(e,s,h,p);return;case"option":for(H in a)if(a.hasOwnProperty(H)&&(s=a[H],s!=null))switch(H){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:Et(e,n,H,s,a,null)}return;case"dialog":rt("beforetoggle",e),rt("toggle",e),rt("cancel",e),rt("close",e);break;case"iframe":case"object":rt("load",e);break;case"video":case"audio":for(s=0;s<ns.length;s++)rt(ns[s],e);break;case"image":rt("error",e),rt("load",e);break;case"details":rt("toggle",e);break;case"embed":case"source":case"link":rt("error",e),rt("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(P in a)if(a.hasOwnProperty(P)&&(s=a[P],s!=null))switch(P){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Et(e,n,P,s,a,null)}return;default:if(Qr(n)){for(se in a)a.hasOwnProperty(se)&&(s=a[se],s!==void 0&&Af(e,n,se,s,a,void 0));return}}for(N in a)a.hasOwnProperty(N)&&(s=a[N],s!=null&&Et(e,n,N,s,a,null))}function sb(e,n,a,s){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,w=null,N=null,H=null,P=null,se=null;for(le in a){var fe=a[le];if(a.hasOwnProperty(le)&&fe!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":H=fe;default:s.hasOwnProperty(le)||Et(e,n,le,null,s,fe)}}for(var te in s){var le=s[te];if(fe=a[te],s.hasOwnProperty(te)&&(le!=null||fe!=null))switch(te){case"type":p=le;break;case"name":h=le;break;case"checked":P=le;break;case"defaultChecked":se=le;break;case"value":w=le;break;case"defaultValue":N=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(i(137,n));break;default:le!==fe&&Et(e,n,te,le,s,fe)}}bi(e,w,N,H,P,se,p,h);return;case"select":le=w=N=te=null;for(p in a)if(H=a[p],a.hasOwnProperty(p)&&H!=null)switch(p){case"value":break;case"multiple":le=H;default:s.hasOwnProperty(p)||Et(e,n,p,null,s,H)}for(h in s)if(p=s[h],H=a[h],s.hasOwnProperty(h)&&(p!=null||H!=null))switch(h){case"value":te=p;break;case"defaultValue":N=p;break;case"multiple":w=p;default:p!==H&&Et(e,n,h,p,s,H)}n=N,a=w,s=le,te!=null?ur(e,!!a,te,!1):!!s!=!!a&&(n!=null?ur(e,!!a,n,!0):ur(e,!!a,a?[]:"",!1));return;case"textarea":le=te=null;for(N in a)if(h=a[N],a.hasOwnProperty(N)&&h!=null&&!s.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:Et(e,n,N,null,s,h)}for(w in s)if(h=s[w],p=a[w],s.hasOwnProperty(w)&&(h!=null||p!=null))switch(w){case"value":te=h;break;case"defaultValue":le=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(i(91));break;default:h!==p&&Et(e,n,w,h,s,p)}Ks(e,te,le);return;case"option":for(var De in a)if(te=a[De],a.hasOwnProperty(De)&&te!=null&&!s.hasOwnProperty(De))switch(De){case"selected":e.selected=!1;break;default:Et(e,n,De,null,s,te)}for(H in s)if(te=s[H],le=a[H],s.hasOwnProperty(H)&&te!==le&&(te!=null||le!=null))switch(H){case"selected":e.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:Et(e,n,H,te,s,le)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ye in a)te=a[Ye],a.hasOwnProperty(Ye)&&te!=null&&!s.hasOwnProperty(Ye)&&Et(e,n,Ye,null,s,te);for(P in s)if(te=s[P],le=a[P],s.hasOwnProperty(P)&&te!==le&&(te!=null||le!=null))switch(P){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(i(137,n));break;default:Et(e,n,P,te,s,le)}return;default:if(Qr(n)){for(var Nt in a)te=a[Nt],a.hasOwnProperty(Nt)&&te!==void 0&&!s.hasOwnProperty(Nt)&&Af(e,n,Nt,void 0,s,te);for(se in s)te=s[se],le=a[se],!s.hasOwnProperty(se)||te===le||te===void 0&&le===void 0||Af(e,n,se,te,s,le);return}}for(var K in a)te=a[K],a.hasOwnProperty(K)&&te!=null&&!s.hasOwnProperty(K)&&Et(e,n,K,null,s,te);for(fe in s)te=s[fe],le=a[fe],!s.hasOwnProperty(fe)||te===le||te==null&&le==null||Et(e,n,fe,te,s,le)}function Cp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function ob(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),s=0;s<a.length;s++){var h=a[s],p=h.transferSize,w=h.initiatorType,N=h.duration;if(p&&N&&Cp(w)){for(w=0,N=h.responseEnd,s+=1;s<a.length;s++){var H=a[s],P=H.startTime;if(P>N)break;var se=H.transferSize,fe=H.initiatorType;se&&Cp(fe)&&(H=H.responseEnd,w+=se*(H<N?1:(N-P)/(H-P)))}if(--s,n+=8*(p+w)/(h.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Tf=null,Df=null;function Yo(e){return e.nodeType===9?e:e.ownerDocument}function Ep(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Np(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function zf(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Mf=null;function cb(){var e=window.event;return e&&e.type==="popstate"?e===Mf?!1:(Mf=e,!0):(Mf=null,!1)}var Ap=typeof setTimeout=="function"?setTimeout:void 0,ub=typeof clearTimeout=="function"?clearTimeout:void 0,Tp=typeof Promise=="function"?Promise:void 0,fb=typeof queueMicrotask=="function"?queueMicrotask:typeof Tp<"u"?function(e){return Tp.resolve(null).then(e).catch(db)}:Ap;function db(e){setTimeout(function(){throw e})}function Ar(e){return e==="head"}function Dp(e,n){var a=n,s=0;do{var h=a.nextSibling;if(e.removeChild(a),h&&h.nodeType===8)if(a=h.data,a==="/$"||a==="/&"){if(s===0){e.removeChild(h),ni(n);return}s--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")s++;else if(a==="html")rs(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,rs(a);for(var p=a.firstChild;p;){var w=p.nextSibling,N=p.nodeName;p[Bl]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=w}}else a==="body"&&rs(e.ownerDocument.body);a=h}while(a);ni(n)}function zp(e,n){var a=e;e=0;do{var s=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),s&&s.nodeType===8)if(a=s.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=s}while(a)}function Ff(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Ff(a),ja(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function hb(e,n,a,s){for(;e.nodeType===1;){var h=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[Bl])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(p=e.getAttribute("rel"),p==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(p!==h.rel||e.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||e.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||e.getAttribute("title")!==(h.title==null?null:h.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(p=e.getAttribute("src"),(p!==(h.src==null?null:h.src)||e.getAttribute("type")!==(h.type==null?null:h.type)||e.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&e.getAttribute("name")===p)return e}else return e;if(e=ll(e.nextSibling),e===null)break}return null}function mb(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=ll(e.nextSibling),e===null))return null;return e}function Mp(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ll(e.nextSibling),e===null))return null;return e}function Rf(e){return e.data==="$?"||e.data==="$~"}function _f(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function xb(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var s=function(){n(),a.removeEventListener("DOMContentLoaded",s)};a.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function ll(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Of=null;function Fp(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return ll(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function Rp(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function _p(e,n,a){switch(n=Yo(a),e){case"html":if(e=n.documentElement,!e)throw Error(i(452));return e;case"head":if(e=n.head,!e)throw Error(i(453));return e;case"body":if(e=n.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function rs(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);ja(e)}var rl=new Map,Op=new Set;function qo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var er=Z.d;Z.d={f:pb,r:yb,D:gb,C:bb,L:vb,m:wb,X:Sb,S:kb,M:jb};function pb(){var e=er.f(),n=_o();return e||n}function yb(e){var n=sr(e);n!==null&&n.tag===5&&n.type==="form"?Pm(n):er.r(e)}var Pa=typeof document>"u"?null:document;function Bp(e,n,a){var s=Pa;if(s&&typeof n=="string"&&n){var h=Nn(n);h='link[rel="'+e+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),Op.has(h)||(Op.add(h),e={rel:e,crossOrigin:a,href:n},s.querySelector(h)===null&&(n=s.createElement("link"),mn(n,"link",e),Ft(n),s.head.appendChild(n)))}}function gb(e){er.D(e),Bp("dns-prefetch",e,null)}function bb(e,n){er.C(e,n),Bp("preconnect",e,n)}function vb(e,n,a){er.L(e,n,a);var s=Pa;if(s&&e&&n){var h='link[rel="preload"][as="'+Nn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+Nn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+Nn(a.imageSizes)+'"]')):h+='[href="'+Nn(e)+'"]';var p=h;switch(n){case"style":p=ei(e);break;case"script":p=ti(e)}rl.has(p)||(e=y({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),rl.set(p,e),s.querySelector(h)!==null||n==="style"&&s.querySelector(as(p))||n==="script"&&s.querySelector(is(p))||(n=s.createElement("link"),mn(n,"link",e),Ft(n),s.head.appendChild(n)))}}function wb(e,n){er.m(e,n);var a=Pa;if(a&&e){var s=n&&typeof n.as=="string"?n.as:"script",h='link[rel="modulepreload"][as="'+Nn(s)+'"][href="'+Nn(e)+'"]',p=h;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=ti(e)}if(!rl.has(p)&&(e=y({rel:"modulepreload",href:e},n),rl.set(p,e),a.querySelector(h)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(is(p)))return}s=a.createElement("link"),mn(s,"link",e),Ft(s),a.head.appendChild(s)}}}function kb(e,n,a){er.S(e,n,a);var s=Pa;if(s&&e){var h=un(s).hoistableStyles,p=ei(e);n=n||"default";var w=h.get(p);if(!w){var N={loading:0,preload:null};if(w=s.querySelector(as(p)))N.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},a),(a=rl.get(p))&&Bf(e,a);var H=w=s.createElement("link");Ft(H),mn(H,"link",e),H._p=new Promise(function(P,se){H.onload=P,H.onerror=se}),H.addEventListener("load",function(){N.loading|=1}),H.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Xo(w,n,s)}w={type:"stylesheet",instance:w,count:1,state:N},h.set(p,w)}}}function Sb(e,n){er.X(e,n);var a=Pa;if(a&&e){var s=un(a).hoistableScripts,h=ti(e),p=s.get(h);p||(p=a.querySelector(is(h)),p||(e=y({src:e,async:!0},n),(n=rl.get(h))&&Lf(e,n),p=a.createElement("script"),Ft(p),mn(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},s.set(h,p))}}function jb(e,n){er.M(e,n);var a=Pa;if(a&&e){var s=un(a).hoistableScripts,h=ti(e),p=s.get(h);p||(p=a.querySelector(is(h)),p||(e=y({src:e,async:!0,type:"module"},n),(n=rl.get(h))&&Lf(e,n),p=a.createElement("script"),Ft(p),mn(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},s.set(h,p))}}function Lp(e,n,a,s){var h=(h=Ee.current)?qo(h):null;if(!h)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=ei(a.href),a=un(h).hoistableStyles,s=a.get(n),s||(s={type:"style",instance:null,count:0,state:null},a.set(n,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=ei(a.href);var p=un(h).hoistableStyles,w=p.get(e);if(w||(h=h.ownerDocument||h,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,w),(p=h.querySelector(as(e)))&&!p._p&&(w.instance=p,w.state.loading=5),rl.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},rl.set(e,a),p||Cb(h,e,a,w.state))),n&&s===null)throw Error(i(528,""));return w}if(n&&s!==null)throw Error(i(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=ti(a),a=un(h).hoistableScripts,s=a.get(n),s||(s={type:"script",instance:null,count:0,state:null},a.set(n,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function ei(e){return'href="'+Nn(e)+'"'}function as(e){return'link[rel="stylesheet"]['+e+"]"}function $p(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function Cb(e,n,a,s){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?s.loading=1:(n=e.createElement("link"),s.preload=n,n.addEventListener("load",function(){return s.loading|=1}),n.addEventListener("error",function(){return s.loading|=2}),mn(n,"link",a),Ft(n),e.head.appendChild(n))}function ti(e){return'[src="'+Nn(e)+'"]'}function is(e){return"script[async]"+e}function Hp(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var s=e.querySelector('style[data-href~="'+Nn(a.href)+'"]');if(s)return n.instance=s,Ft(s),s;var h=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Ft(s),mn(s,"style",h),Xo(s,a.precedence,e),n.instance=s;case"stylesheet":h=ei(a.href);var p=e.querySelector(as(h));if(p)return n.state.loading|=4,n.instance=p,Ft(p),p;s=$p(a),(h=rl.get(h))&&Bf(s,h),p=(e.ownerDocument||e).createElement("link"),Ft(p);var w=p;return w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),mn(p,"link",s),n.state.loading|=4,Xo(p,a.precedence,e),n.instance=p;case"script":return p=ti(a.src),(h=e.querySelector(is(p)))?(n.instance=h,Ft(h),h):(s=a,(h=rl.get(p))&&(s=y({},a),Lf(s,h)),e=e.ownerDocument||e,h=e.createElement("script"),Ft(h),mn(h,"link",s),e.head.appendChild(h),n.instance=h);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(s=n.instance,n.state.loading|=4,Xo(s,a.precedence,e));return n.instance}function Xo(e,n,a){for(var s=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=s.length?s[s.length-1]:null,p=h,w=0;w<s.length;w++){var N=s[w];if(N.dataset.precedence===n)p=N;else if(p!==h)break}p?p.parentNode.insertBefore(e,p.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function Bf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Lf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Vo=null;function Up(e,n,a){if(Vo===null){var s=new Map,h=Vo=new Map;h.set(a,s)}else h=Vo,s=h.get(a),s||(s=new Map,h.set(a,s));if(s.has(e))return s;for(s.set(e,null),a=a.getElementsByTagName(e),h=0;h<a.length;h++){var p=a[h];if(!(p[Bl]||p[$t]||e==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var w=p.getAttribute(n)||"";w=e+w;var N=s.get(w);N?N.push(p):s.set(w,[p])}}return s}function Ip(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function Eb(e,n,a){if(a===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Yp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Nb(e,n,a,s){if(a.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var h=ei(s.href),p=n.querySelector(as(h));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Go.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=p,Ft(p);return}p=n.ownerDocument||n,s=$p(s),(h=rl.get(h))&&Bf(s,h),p=p.createElement("link"),Ft(p);var w=p;w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),mn(p,"link",s),a.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Go.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var $f=0;function Ab(e,n){return e.stylesheets&&e.count===0&&Qo(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var s=setTimeout(function(){if(e.stylesheets&&Qo(e,e.stylesheets),e.unsuspend){var p=e.unsuspend;e.unsuspend=null,p()}},6e4+n);0<e.imgBytes&&$f===0&&($f=62500*ob());var h=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Qo(e,e.stylesheets),e.unsuspend)){var p=e.unsuspend;e.unsuspend=null,p()}},(e.imgBytes>$f?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(h)}}:null}function Go(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Qo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ko=null;function Qo(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ko=new Map,n.forEach(Tb,e),Ko=null,Go.call(e))}function Tb(e,n){if(!(n.state.loading&4)){var a=Ko.get(e);if(a)var s=a.get(null);else{a=new Map,Ko.set(e,a);for(var h=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var w=h[p];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),s=w)}s&&a.set(null,s)}h=n.instance,w=h.getAttribute("data-precedence"),p=a.get(w)||s,p===s&&a.set(null,h),a.set(w,h),this.count++,s=Go.bind(this),h.addEventListener("load",s),h.addEventListener("error",s),p?p.parentNode.insertBefore(h,p.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(h,e.firstChild)),n.state.loading|=4}}var ss={$$typeof:M,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function Db(e,n,a,s,h,p,w,N,H){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Xr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xr(0),this.hiddenUpdates=Xr(null),this.identifierPrefix=s,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function qp(e,n,a,s,h,p,w,N,H,P,se,fe){return e=new Db(e,n,a,w,H,P,se,fe,N),n=1,p===!0&&(n|=24),p=Hn(3,null,null,n),e.current=p,p.stateNode=e,n=yu(),n.refCount++,e.pooledCache=n,n.refCount++,p.memoizedState={element:s,isDehydrated:a,cache:n},wu(p),e}function Xp(e){return e?(e=Ma,e):Ma}function Vp(e,n,a,s,h,p){h=Xp(h),s.context===null?s.context=h:s.pendingContext=h,s=yr(n),s.payload={element:a},p=p===void 0?null:p,p!==null&&(s.callback=p),a=gr(e,s,n),a!==null&&(Fn(a,e,n),$i(a,e,n))}function Gp(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function Hf(e,n){Gp(e,n),(e=e.alternate)&&Gp(e,n)}function Kp(e){if(e.tag===13||e.tag===31){var n=Pr(e,67108864);n!==null&&Fn(n,e,67108864),Hf(e,67108864)}}function Qp(e){if(e.tag===13||e.tag===31){var n=Xn();n=Vr(n);var a=Pr(e,n);a!==null&&Fn(a,e,n),Hf(e,n)}}var Wo=!0;function zb(e,n,a,s){var h=I.T;I.T=null;var p=Z.p;try{Z.p=2,Uf(e,n,a,s)}finally{Z.p=p,I.T=h}}function Mb(e,n,a,s){var h=I.T;I.T=null;var p=Z.p;try{Z.p=8,Uf(e,n,a,s)}finally{Z.p=p,I.T=h}}function Uf(e,n,a,s){if(Wo){var h=If(s);if(h===null)Nf(e,n,s,Zo,a),Zp(e,s);else if(Rb(h,e,n,a,s))s.stopPropagation();else if(Zp(e,s),n&4&&-1<Fb.indexOf(e)){for(;h!==null;){var p=sr(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=zl(p.pendingLanes);if(w!==0){var N=p;for(N.pendingLanes|=2,N.entangledLanes|=2;w;){var H=1<<31-de(w);N.entanglements[1]|=H,w&=~H}vl(p),(bt&6)===0&&(Fo=ht()+500,ts(0))}}break;case 31:case 13:N=Pr(p,2),N!==null&&Fn(N,p,2),_o(),Hf(p,2)}if(p=If(s),p===null&&Nf(e,n,s,Zo,a),p===h)break;h=p}h!==null&&s.stopPropagation()}else Nf(e,n,s,null,a)}}function If(e){return e=Si(e),Yf(e)}var Zo=null;function Yf(e){if(Zo=null,e=Ll(e),e!==null){var n=u(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=f(n),e!==null)return e;e=null}else if(a===31){if(e=m(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Zo=e,null}function Wp(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Zt()){case re:return 2;case ye:return 8;case ze:case Ue:return 32;case be:return 268435456;default:return 32}default:return 32}}var qf=!1,Tr=null,Dr=null,zr=null,os=new Map,cs=new Map,Mr=[],Fb="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Zp(e,n){switch(e){case"focusin":case"focusout":Tr=null;break;case"dragenter":case"dragleave":Dr=null;break;case"mouseover":case"mouseout":zr=null;break;case"pointerover":case"pointerout":os.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":cs.delete(n.pointerId)}}function us(e,n,a,s,h,p){return e===null||e.nativeEvent!==p?(e={blockedOn:n,domEventName:a,eventSystemFlags:s,nativeEvent:p,targetContainers:[h]},n!==null&&(n=sr(n),n!==null&&Kp(n)),e):(e.eventSystemFlags|=s,n=e.targetContainers,h!==null&&n.indexOf(h)===-1&&n.push(h),e)}function Rb(e,n,a,s,h){switch(n){case"focusin":return Tr=us(Tr,e,n,a,s,h),!0;case"dragenter":return Dr=us(Dr,e,n,a,s,h),!0;case"mouseover":return zr=us(zr,e,n,a,s,h),!0;case"pointerover":var p=h.pointerId;return os.set(p,us(os.get(p)||null,e,n,a,s,h)),!0;case"gotpointercapture":return p=h.pointerId,cs.set(p,us(cs.get(p)||null,e,n,a,s,h)),!0}return!1}function Jp(e){var n=Ll(e.target);if(n!==null){var a=u(n);if(a!==null){if(n=a.tag,n===13){if(n=f(a),n!==null){e.blockedOn=n,_l(e.priority,function(){Qp(a)});return}}else if(n===31){if(n=m(a),n!==null){e.blockedOn=n,_l(e.priority,function(){Qp(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Jo(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=If(e.nativeEvent);if(a===null){a=e.nativeEvent;var s=new a.constructor(a.type,a);ki=s,a.target.dispatchEvent(s),ki=null}else return n=sr(a),n!==null&&Kp(n),e.blockedOn=a,!1;n.shift()}return!0}function Pp(e,n,a){Jo(e)&&a.delete(n)}function _b(){qf=!1,Tr!==null&&Jo(Tr)&&(Tr=null),Dr!==null&&Jo(Dr)&&(Dr=null),zr!==null&&Jo(zr)&&(zr=null),os.forEach(Pp),cs.forEach(Pp)}function Po(e,n){e.blockedOn===n&&(e.blockedOn=null,qf||(qf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,_b)))}var ec=null;function e1(e){ec!==e&&(ec=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){ec===e&&(ec=null);for(var n=0;n<e.length;n+=3){var a=e[n],s=e[n+1],h=e[n+2];if(typeof s!="function"){if(Yf(s||a)===null)continue;break}var p=sr(a);p!==null&&(e.splice(n,3),n-=3,Uu(p,{pending:!0,data:h,method:a.method,action:s},s,h))}}))}function ni(e){function n(H){return Po(H,e)}Tr!==null&&Po(Tr,e),Dr!==null&&Po(Dr,e),zr!==null&&Po(zr,e),os.forEach(n),cs.forEach(n);for(var a=0;a<Mr.length;a++){var s=Mr[a];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Mr.length&&(a=Mr[0],a.blockedOn===null);)Jp(a),a.blockedOn===null&&Mr.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(s=0;s<a.length;s+=3){var h=a[s],p=a[s+1],w=h[cn]||null;if(typeof p=="function")w||e1(a);else if(w){var N=null;if(p&&p.hasAttribute("formAction")){if(h=p,w=p[cn]||null)N=w.formAction;else if(Yf(h)!==null)continue}else N=w.action;typeof N=="function"?a[s+1]=N:(a.splice(s,3),s-=3),e1(a)}}}function t1(){function e(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(w){return h=w})},focusReset:"manual",scroll:"manual"})}function n(){h!==null&&(h(),h=null),s||setTimeout(a,20)}function a(){if(!s&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,h=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),h!==null&&(h(),h=null)}}}function Xf(e){this._internalRoot=e}tc.prototype.render=Xf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(i(409));var a=n.current,s=Xn();Vp(a,s,e,n,null,null)},tc.prototype.unmount=Xf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Vp(e.current,2,null,e,null,null),_o(),n[Ol]=null}};function tc(e){this._internalRoot=e}tc.prototype.unstable_scheduleHydration=function(e){if(e){var n=Rl();e={blockedOn:null,target:e,priority:n};for(var a=0;a<Mr.length&&n!==0&&n<Mr[a].priority;a++);Mr.splice(a,0,e),a===0&&Jp(e)}};var n1=l.version;if(n1!=="19.2.4")throw Error(i(527,n1,"19.2.4"));Z.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=d(n),e=e!==null?g(e):null,e=e===null?null:e.stateNode,e};var Ob={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nc.isDisabled&&nc.supportsFiber)try{wt=nc.inject(Ob),Xe=nc}catch{}}return ds.createRoot=function(e,n){if(!c(e))throw Error(i(299));var a=!1,s="",h=cx,p=ux,w=fx;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(h=n.onUncaughtError),n.onCaughtError!==void 0&&(p=n.onCaughtError),n.onRecoverableError!==void 0&&(w=n.onRecoverableError)),n=qp(e,1,!1,null,null,a,s,null,h,p,w,t1),e[Ol]=n.current,Ef(e),new Xf(n)},ds.hydrateRoot=function(e,n,a){if(!c(e))throw Error(i(299));var s=!1,h="",p=cx,w=ux,N=fx,H=null;return a!=null&&(a.unstable_strictMode===!0&&(s=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(N=a.onRecoverableError),a.formState!==void 0&&(H=a.formState)),n=qp(e,1,!0,n,a??null,s,h,H,p,w,N,t1),n.context=Xp(null),a=n.current,s=Xn(),s=Vr(s),h=yr(s),h.callback=null,gr(a,h,s),a=s,n.current.lanes=a,ir(n,a),vl(n),e[Ol]=n.current,Ef(e),new tc(n)},ds.version="19.2.4",ds}var h1;function Kb(){if(h1)return Kf.exports;h1=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(l){console.error(l)}}return t(),Kf.exports=Gb(),Kf.exports}var Qb=Kb();const Wb="modulepreload",Zb=function(t){return"/"+t},m1={},Jb=function(l,r,i){let c=Promise.resolve();if(r&&r.length>0){let f=function(d){return Promise.all(d.map(g=>Promise.resolve(g).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),x=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));c=f(r.map(d=>{if(d=Zb(d),d in m1)return;m1[d]=!0;const g=d.endsWith(".css"),y=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${y}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":Wb,g||(b.as="script"),b.crossOrigin="",b.href=d,x&&b.setAttribute("nonce",x),document.head.appendChild(b),g)return new Promise((v,j)=>{b.addEventListener("load",v),b.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${d}`)))})}))}function u(f){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=f,window.dispatchEvent(m),!m.defaultPrevented)throw f}return c.then(f=>{for(const m of f||[])m.status==="rejected"&&u(m.reason);return l().catch(u)})};class Pb extends k.Component{constructor(){super(...arguments);l1(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(r){return{hasError:!0,error:r}}render(){var r;return this.state.hasError?o.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:o.jsxs("div",{className:"text-center max-w-md",children:[o.jsx("div",{className:"text-4xl mb-3",children:"🚨"}),o.jsx("div",{className:"text-gray-800 font-semibold mb-2",children:"Something went wrong"}),o.jsx("div",{className:"text-gray-500 text-sm mb-4",children:((r=this.state.error)==null?void 0:r.message)??"An unexpected error occurred."}),o.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-gray-800 text-white rounded-lg text-sm hover:bg-gray-700",children:"Reload"})]})}):this.props.children}}const Os="/api";async function Dt(t){const l=await fetch(`${Os}${t}`);if(!l.ok)throw new Error(`API error: ${l.status}`);return l.json()}async function wn(t,l){const r=await fetch(`${Os}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}async function Jf(t,l){const r=await fetch(`${Os}${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}async function Rr(t,l){const r={method:"DELETE"};l!==void 0&&(r.headers={"Content-Type":"application/json"},r.body=JSON.stringify(l));const i=await fetch(`${Os}${t}`,r);if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()}const Ce={getCompany:()=>Dt("/company"),getRoles:()=>Dt("/roles"),getRole:t=>Dt(`/roles/${t}`),getProjects:()=>Dt("/projects"),getProject:t=>Dt(`/projects/${t}`),getStandups:()=>Dt("/operations/standups"),getWaves:()=>Dt("/operations/waves"),getDecisions:()=>Dt("/operations/decisions"),getOrgTree:()=>Dt("/engine/org"),getSkills:()=>Dt("/skills"),exportSkills:t=>Dt(`/skills/export/${t}`),getSkillRegistry:()=>Dt("/skills/registry"),installRegistrySkill:(t,l)=>wn("/skills/registry/install",{skillId:t,url:l}),createRole:t=>wn("/engine/roles",t),updateRole:(t,l)=>Jf(`/engine/roles/${t}`,l),deleteRole:t=>Rr(`/engine/roles/${t}`),getSessions:()=>Dt("/sessions"),getSession:t=>Dt(`/sessions/${t}`),createSession:(t,l="talk")=>wn("/sessions",{roleId:t,mode:l}),deleteSession:t=>Rr(`/sessions/${t}`),deleteSessions:t=>Rr("/sessions",{ids:t}),deleteEmptySessions:()=>Rr("/sessions?empty=true"),updateSession:(t,l)=>Jf(`/sessions/${t}`,l),startJob:t=>wn("/jobs",t),getJob:t=>Dt(`/jobs/${t}`),listJobs:t=>{const l=new URLSearchParams;t!=null&&t.status&&l.set("status",t.status),t!=null&&t.roleId&&l.set("roleId",t.roleId);const r=l.toString();return Dt(`/jobs${r?"?"+r:""}`)},abortJob:t=>Rr(`/jobs/${t}`),getStatus:()=>Dt("/status"),detectEngine:()=>wn("/setup/detect-engine",{}),validatePath:t=>wn("/setup/validate-path",{path:t}),scaffold:t=>wn("/setup/scaffold",t),getTeams:()=>Dt("/setup/teams"),browse:t=>wn("/setup/browse",{path:t}),connectAkb:t=>wn("/setup/connect-akb",{path:t}),getKnowledge:()=>Dt("/knowledge"),getKnowledgeDoc:t=>Dt(`/knowledge/${t}`),createKnowledgeDoc:t=>wn("/knowledge",t),updateKnowledgeDoc:(t,l)=>fetch(`${Os}/knowledge/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:l})}).then(r=>{if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}),deleteKnowledgeDoc:t=>Rr(`/knowledge/${t}`),getPreferences:()=>Dt("/preferences"),updatePreferences:t=>Jf("/preferences",t),chatInChannel:t=>wn("/speech/chat",t),getSaveStatus:()=>Dt("/save/status"),save:t=>wn("/save",{message:t}),getSaveHistory:(t=20)=>Dt(`/save/history?limit=${t}`),restoreSave:(t,l)=>wn("/save/restore",{sha:t,paths:l}),initGit:()=>wn("/save/init",{}),getCostSummary:()=>Dt("/cost/summary"),getSyncRoles:()=>Dt("/sync/roles"),applySyncUpdate:t=>wn("/sync/apply",t),getCompanyStats:()=>Dt("/sync/stats"),getGitStatus:()=>Dt("/git/status"),deleteWorktree:t=>Rr(`/git/worktrees/${encodeURIComponent(t)}`),deleteBranch:t=>Rr(`/git/branches/${encodeURIComponent(t)}`)};function V0(t){const[l,r]=k.useState([]),[i,c]=k.useState("idle"),[u,f]=k.useState(""),[m,x]=k.useState([]),d=k.useRef(-1),g=k.useRef(null),y=k.useRef(0),b=k.useCallback(()=>{var C;if(!t)return;(C=g.current)==null||C.abort();const j=new AbortController;g.current=j,c("connecting");const S=d.current+1,E=`/api/jobs/${t}/stream?from=${S}`;fetch(E,{signal:j.signal}).then(async A=>{if(!A.ok||!A.body){c("error");return}c("streaming");const M=A.body.getReader(),F=new TextDecoder;let L="";for(;;){const{done:O,value:U}=await M.read();if(O)break;L+=F.decode(U,{stream:!0});const X=L.split(`
|
|
50
|
-
`);L=X.pop()??"";let ne="";for(const D of X)if(D.startsWith("event: "))ne=D.slice(7).trim();else if(D.startsWith("data: ")){try{const Y=JSON.parse(D.slice(6));if(ne==="activity"){const R=Y;R.seq>d.current&&(d.current=R.seq),r(Q=>Q.some(ee=>ee.seq===R.seq)?Q:[...Q,R]),R.type==="text"&&f(Q=>Q+(R.data.text??"")),R.type==="dispatch:start"&&R.data.childJobId&&x(Q=>[...Q,R.data.childJobId]),R.type==="job:done"?c("done"):R.type==="job:error"&&c("error")}else if(ne==="stream:end"){const R=Y.reason;c(R==="done"?"done":R==="error"?"error":"done")}}catch{}ne=""}}i==="streaming"&&c("done")}).catch(A=>{A.name!=="AbortError"&&(c("error"),y.current<3&&(y.current++,setTimeout(b,1e3*y.current)))})},[t]),v=k.useCallback(()=>{y.current=0,b()},[b]);return k.useEffect(()=>{if(!t){r([]),c("idle"),f(""),x([]),d.current=-1;return}return r([]),f(""),x([]),d.current=-1,y.current=0,b(),()=>{var j;(j=g.current)==null||j.abort()}},[t,b]),{events:l,status:i,textOutput:u,childJobIds:m,reconnect:v}}function ev(t,l){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const tv=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nv=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lv={};function x1(t,l){return(lv.jsx?nv:tv).test(t)}const rv=/[ \t\n\f\r]/g;function av(t){return typeof t=="object"?t.type==="text"?p1(t.value):!1:p1(t)}function p1(t){return t.replace(rv,"")===""}class Bs{constructor(l,r,i){this.normal=r,this.property=l,i&&(this.space=i)}}Bs.prototype.normal={};Bs.prototype.property={};Bs.prototype.space=void 0;function G0(t,l){const r={},i={};for(const c of t)Object.assign(r,c.property),Object.assign(i,c.normal);return new Bs(r,i,l)}function Bd(t){return t.toLowerCase()}class _n{constructor(l,r){this.attribute=r,this.property=l}}_n.prototype.attribute="";_n.prototype.booleanish=!1;_n.prototype.boolean=!1;_n.prototype.commaOrSpaceSeparated=!1;_n.prototype.commaSeparated=!1;_n.prototype.defined=!1;_n.prototype.mustUseProperty=!1;_n.prototype.number=!1;_n.prototype.overloadedBoolean=!1;_n.prototype.property="";_n.prototype.spaceSeparated=!1;_n.prototype.space=void 0;let iv=0;const Je=wa(),nn=wa(),Ld=wa(),ve=wa(),Rt=wa(),si=wa(),Vn=wa();function wa(){return 2**++iv}const $d=Object.freeze(Object.defineProperty({__proto__:null,boolean:Je,booleanish:nn,commaOrSpaceSeparated:Vn,commaSeparated:si,number:ve,overloadedBoolean:Ld,spaceSeparated:Rt},Symbol.toStringTag,{value:"Module"})),Pf=Object.keys($d);class nh extends _n{constructor(l,r,i,c){let u=-1;if(super(l,r),y1(this,"space",c),typeof i=="number")for(;++u<Pf.length;){const f=Pf[u];y1(this,Pf[u],(i&$d[f])===$d[f])}}}nh.prototype.defined=!0;function y1(t,l,r){r&&(t[l]=r)}function fi(t){const l={},r={};for(const[i,c]of Object.entries(t.properties)){const u=new nh(i,t.transform(t.attributes||{},i),c,t.space);t.mustUseProperty&&t.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),l[i]=u,r[Bd(i)]=i,r[Bd(u.attribute)]=i}return new Bs(l,r,t.space)}const K0=fi({properties:{ariaActiveDescendant:null,ariaAtomic:nn,ariaAutoComplete:null,ariaBusy:nn,ariaChecked:nn,ariaColCount:ve,ariaColIndex:ve,ariaColSpan:ve,ariaControls:Rt,ariaCurrent:null,ariaDescribedBy:Rt,ariaDetails:null,ariaDisabled:nn,ariaDropEffect:Rt,ariaErrorMessage:null,ariaExpanded:nn,ariaFlowTo:Rt,ariaGrabbed:nn,ariaHasPopup:null,ariaHidden:nn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Rt,ariaLevel:ve,ariaLive:null,ariaModal:nn,ariaMultiLine:nn,ariaMultiSelectable:nn,ariaOrientation:null,ariaOwns:Rt,ariaPlaceholder:null,ariaPosInSet:ve,ariaPressed:nn,ariaReadOnly:nn,ariaRelevant:null,ariaRequired:nn,ariaRoleDescription:Rt,ariaRowCount:ve,ariaRowIndex:ve,ariaRowSpan:ve,ariaSelected:nn,ariaSetSize:ve,ariaSort:null,ariaValueMax:ve,ariaValueMin:ve,ariaValueNow:ve,ariaValueText:null,role:null},transform(t,l){return l==="role"?l:"aria-"+l.slice(4).toLowerCase()}});function Q0(t,l){return l in t?t[l]:l}function W0(t,l){return Q0(t,l.toLowerCase())}const sv=fi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:si,acceptCharset:Rt,accessKey:Rt,action:null,allow:null,allowFullScreen:Je,allowPaymentRequest:Je,allowUserMedia:Je,alt:null,as:null,async:Je,autoCapitalize:null,autoComplete:Rt,autoFocus:Je,autoPlay:Je,blocking:Rt,capture:null,charSet:null,checked:Je,cite:null,className:Rt,cols:ve,colSpan:null,content:null,contentEditable:nn,controls:Je,controlsList:Rt,coords:ve|si,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Je,defer:Je,dir:null,dirName:null,disabled:Je,download:Ld,draggable:nn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Je,formTarget:null,headers:Rt,height:ve,hidden:Ld,high:ve,href:null,hrefLang:null,htmlFor:Rt,httpEquiv:Rt,id:null,imageSizes:null,imageSrcSet:null,inert:Je,inputMode:null,integrity:null,is:null,isMap:Je,itemId:null,itemProp:Rt,itemRef:Rt,itemScope:Je,itemType:Rt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Je,low:ve,manifest:null,max:null,maxLength:ve,media:null,method:null,min:null,minLength:ve,multiple:Je,muted:Je,name:null,nonce:null,noModule:Je,noValidate:Je,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:Je,optimum:ve,pattern:null,ping:Rt,placeholder:null,playsInline:Je,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Je,referrerPolicy:null,rel:Rt,required:Je,reversed:Je,rows:ve,rowSpan:ve,sandbox:Rt,scope:null,scoped:Je,seamless:Je,selected:Je,shadowRootClonable:Je,shadowRootDelegatesFocus:Je,shadowRootMode:null,shape:null,size:ve,sizes:null,slot:null,span:ve,spellCheck:nn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ve,step:null,style:null,tabIndex:ve,target:null,title:null,translate:null,type:null,typeMustMatch:Je,useMap:null,value:nn,width:ve,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Rt,axis:null,background:null,bgColor:null,border:ve,borderColor:null,bottomMargin:ve,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Je,declare:Je,event:null,face:null,frame:null,frameBorder:null,hSpace:ve,leftMargin:ve,link:null,longDesc:null,lowSrc:null,marginHeight:ve,marginWidth:ve,noResize:Je,noHref:Je,noShade:Je,noWrap:Je,object:null,profile:null,prompt:null,rev:null,rightMargin:ve,rules:null,scheme:null,scrolling:nn,standby:null,summary:null,text:null,topMargin:ve,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ve,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Je,disableRemotePlayback:Je,prefix:null,property:null,results:ve,security:null,unselectable:null},space:"html",transform:W0}),ov=fi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Vn,accentHeight:ve,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ve,amplitude:ve,arabicForm:null,ascent:ve,attributeName:null,attributeType:null,azimuth:ve,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ve,by:null,calcMode:null,capHeight:ve,className:Rt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ve,diffuseConstant:ve,direction:null,display:null,dur:null,divisor:ve,dominantBaseline:null,download:Je,dx:null,dy:null,edgeMode:null,editable:null,elevation:ve,enableBackground:null,end:null,event:null,exponent:ve,externalResourcesRequired:null,fill:null,fillOpacity:ve,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:si,g2:si,glyphName:si,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ve,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ve,horizOriginX:ve,horizOriginY:ve,id:null,ideographic:ve,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ve,k:ve,k1:ve,k2:ve,k3:ve,k4:ve,kernelMatrix:Vn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ve,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:ve,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:ve,overlineThickness:ve,paintOrder:null,panose1:null,path:null,pathLength:ve,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Rt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ve,pointsAtY:ve,pointsAtZ:ve,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Vn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Vn,rev:Vn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Vn,requiredFeatures:Vn,requiredFonts:Vn,requiredFormats:Vn,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:ve,specularExponent:ve,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ve,strikethroughThickness:ve,string:null,stroke:null,strokeDashArray:Vn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ve,strokeOpacity:ve,strokeWidth:null,style:null,surfaceScale:ve,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Vn,tabIndex:ve,tableValues:null,target:null,targetX:ve,targetY:ve,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Vn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ve,underlineThickness:ve,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ve,values:null,vAlphabetic:ve,vMathematical:ve,vectorEffect:null,vHanging:ve,vIdeographic:ve,version:null,vertAdvY:ve,vertOriginX:ve,vertOriginY:ve,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ve,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Q0}),Z0=fi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,l){return"xlink:"+l.slice(5).toLowerCase()}}),J0=fi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:W0}),P0=fi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,l){return"xml:"+l.slice(3).toLowerCase()}}),cv={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},uv=/[A-Z]/g,g1=/-[a-z]/g,fv=/^data[-\w.:]+$/i;function dv(t,l){const r=Bd(l);let i=l,c=_n;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&fv.test(l)){if(l.charAt(4)==="-"){const u=l.slice(5).replace(g1,mv);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=l.slice(4);if(!g1.test(u)){let f=u.replace(uv,hv);f.charAt(0)!=="-"&&(f="-"+f),l="data"+f}}c=nh}return new c(i,l)}function hv(t){return"-"+t.toLowerCase()}function mv(t){return t.charAt(1).toUpperCase()}const xv=G0([K0,sv,Z0,J0,P0],"html"),lh=G0([K0,ov,Z0,J0,P0],"svg");function pv(t){return t.join(" ").trim()}var li={},ed,b1;function yv(){if(b1)return ed;b1=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,l=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,m=/^\s+|\s+$/g,x=`
|
|
51
|
-
`,d="/",g="*",y="",b="comment",v="declaration";function j(E,C){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];C=C||{};var A=1,M=1;function F(ee){var V=ee.match(l);V&&(A+=V.length);var I=ee.lastIndexOf(x);M=~I?ee.length-I:M+ee.length}function L(){var ee={line:A,column:M};return function(V){return V.position=new O(ee),ne(),V}}function O(ee){this.start=ee,this.end={line:A,column:M},this.source=C.source}O.prototype.content=E;function U(ee){var V=new Error(C.source+":"+A+":"+M+": "+ee);if(V.reason=ee,V.filename=C.source,V.line=A,V.column=M,V.source=E,!C.silent)throw V}function X(ee){var V=ee.exec(E);if(V){var I=V[0];return F(I),E=E.slice(I.length),V}}function ne(){X(r)}function D(ee){var V;for(ee=ee||[];V=Y();)V!==!1&&ee.push(V);return ee}function Y(){var ee=L();if(!(d!=E.charAt(0)||g!=E.charAt(1))){for(var V=2;y!=E.charAt(V)&&(g!=E.charAt(V)||d!=E.charAt(V+1));)++V;if(V+=2,y===E.charAt(V-1))return U("End of comment missing");var I=E.slice(2,V-2);return M+=2,F(I),E=E.slice(V),M+=2,ee({type:b,comment:I})}}function R(){var ee=L(),V=X(i);if(V){if(Y(),!X(c))return U("property missing ':'");var I=X(u),Z=ee({type:v,property:S(V[0].replace(t,y)),value:I?S(I[0].replace(t,y)):y});return X(f),Z}}function Q(){var ee=[];D(ee);for(var V;V=R();)V!==!1&&(ee.push(V),D(ee));return ee}return ne(),Q()}function S(E){return E?E.replace(m,y):y}return ed=j,ed}var v1;function gv(){if(v1)return li;v1=1;var t=li&&li.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(li,"__esModule",{value:!0}),li.default=r;const l=t(yv());function r(i,c){let u=null;if(!i||typeof i!="string")return u;const f=(0,l.default)(i),m=typeof c=="function";return f.forEach(x=>{if(x.type!=="declaration")return;const{property:d,value:g}=x;m?c(d,g,x):g&&(u=u||{},u[d]=g)}),u}return li}var hs={},w1;function bv(){if(w1)return hs;w1=1,Object.defineProperty(hs,"__esModule",{value:!0}),hs.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,l=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,u=function(d){return!d||r.test(d)||t.test(d)},f=function(d,g){return g.toUpperCase()},m=function(d,g){return"".concat(g,"-")},x=function(d,g){return g===void 0&&(g={}),u(d)?d:(d=d.toLowerCase(),g.reactCompat?d=d.replace(c,m):d=d.replace(i,m),d.replace(l,f))};return hs.camelCase=x,hs}var ms,k1;function vv(){if(k1)return ms;k1=1;var t=ms&&ms.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},l=t(gv()),r=bv();function i(c,u){var f={};return!c||typeof c!="string"||(0,l.default)(c,function(m,x){m&&x&&(f[(0,r.camelCase)(m,u)]=x)}),f}return i.default=i,ms=i,ms}var wv=vv();const kv=X0(wv),ey=ty("end"),rh=ty("start");function ty(t){return l;function l(r){const i=r&&r.position&&r.position[t]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function Sv(t){const l=rh(t),r=ey(t);if(l&&r)return{start:l,end:r}}function Es(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?S1(t.position):"start"in t||"end"in t?S1(t):"line"in t||"column"in t?Hd(t):""}function Hd(t){return j1(t&&t.line)+":"+j1(t&&t.column)}function S1(t){return Hd(t&&t.start)+"-"+Hd(t&&t.end)}function j1(t){return t&&typeof t=="number"?t:1}class gn extends Error{constructor(l,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let c="",u={},f=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof l=="string"?c=l:!u.cause&&l&&(f=!0,c=l.message,u.cause=l),!u.ruleId&&!u.source&&typeof i=="string"){const x=i.indexOf(":");x===-1?u.ruleId=i:(u.source=i.slice(0,x),u.ruleId=i.slice(x+1))}if(!u.place&&u.ancestors&&u.ancestors){const x=u.ancestors[u.ancestors.length-1];x&&(u.place=x.position)}const m=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=m?m.column:void 0,this.fatal=void 0,this.file="",this.message=c,this.line=m?m.line:void 0,this.name=Es(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=f&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}gn.prototype.file="";gn.prototype.name="";gn.prototype.reason="";gn.prototype.message="";gn.prototype.stack="";gn.prototype.column=void 0;gn.prototype.line=void 0;gn.prototype.ancestors=void 0;gn.prototype.cause=void 0;gn.prototype.fatal=void 0;gn.prototype.place=void 0;gn.prototype.ruleId=void 0;gn.prototype.source=void 0;const ah={}.hasOwnProperty,jv=new Map,Cv=/[A-Z]/g,Ev=new Set(["table","tbody","thead","tfoot","tr"]),Nv=new Set(["td","th"]),ny="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Av(t,l){if(!l||l.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=l.filePath||void 0;let i;if(l.development){if(typeof l.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=Ov(r,l.jsxDEV)}else{if(typeof l.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof l.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=_v(r,l.jsx,l.jsxs)}const c={Fragment:l.Fragment,ancestors:[],components:l.components||{},create:i,elementAttributeNameCase:l.elementAttributeNameCase||"react",evaluater:l.createEvaluater?l.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:l.ignoreInvalidStyle||!1,passKeys:l.passKeys!==!1,passNode:l.passNode||!1,schema:l.space==="svg"?lh:xv,stylePropertyNameCase:l.stylePropertyNameCase||"dom",tableCellAlignToStyle:l.tableCellAlignToStyle!==!1},u=ly(c,t,void 0);return u&&typeof u!="string"?u:c.create(t,c.Fragment,{children:u||void 0},void 0)}function ly(t,l,r){if(l.type==="element")return Tv(t,l,r);if(l.type==="mdxFlowExpression"||l.type==="mdxTextExpression")return Dv(t,l);if(l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement")return Mv(t,l,r);if(l.type==="mdxjsEsm")return zv(t,l);if(l.type==="root")return Fv(t,l,r);if(l.type==="text")return Rv(t,l)}function Tv(t,l,r){const i=t.schema;let c=i;l.tagName.toLowerCase()==="svg"&&i.space==="html"&&(c=lh,t.schema=c),t.ancestors.push(l);const u=ay(t,l.tagName,!1),f=Bv(t,l);let m=sh(t,l);return Ev.has(l.tagName)&&(m=m.filter(function(x){return typeof x=="string"?!av(x):!0})),ry(t,f,u,l),ih(f,m),t.ancestors.pop(),t.schema=i,t.create(l,u,f,r)}function Dv(t,l){if(l.data&&l.data.estree&&t.evaluater){const i=l.data.estree.body[0];return i.type,t.evaluater.evaluateExpression(i.expression)}zs(t,l.position)}function zv(t,l){if(l.data&&l.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(l.data.estree);zs(t,l.position)}function Mv(t,l,r){const i=t.schema;let c=i;l.name==="svg"&&i.space==="html"&&(c=lh,t.schema=c),t.ancestors.push(l);const u=l.name===null?t.Fragment:ay(t,l.name,!0),f=Lv(t,l),m=sh(t,l);return ry(t,f,u,l),ih(f,m),t.ancestors.pop(),t.schema=i,t.create(l,u,f,r)}function Fv(t,l,r){const i={};return ih(i,sh(t,l)),t.create(l,t.Fragment,i,r)}function Rv(t,l){return l.value}function ry(t,l,r,i){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(l.node=i)}function ih(t,l){if(l.length>0){const r=l.length>1?l:l[0];r&&(t.children=r)}}function _v(t,l,r){return i;function i(c,u,f,m){const d=Array.isArray(f.children)?r:l;return m?d(u,f,m):d(u,f)}}function Ov(t,l){return r;function r(i,c,u,f){const m=Array.isArray(u.children),x=rh(i);return l(c,u,f,m,{columnNumber:x?x.column-1:void 0,fileName:t,lineNumber:x?x.line:void 0},void 0)}}function Bv(t,l){const r={};let i,c;for(c in l.properties)if(c!=="children"&&ah.call(l.properties,c)){const u=$v(t,c,l.properties[c]);if(u){const[f,m]=u;t.tableCellAlignToStyle&&f==="align"&&typeof m=="string"&&Nv.has(l.tagName)?i=m:r[f]=m}}if(i){const u=r.style||(r.style={});u[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return r}function Lv(t,l){const r={};for(const i of l.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&t.evaluater){const u=i.data.estree.body[0];u.type;const f=u.expression;f.type;const m=f.properties[0];m.type,Object.assign(r,t.evaluater.evaluateExpression(m.argument))}else zs(t,l.position);else{const c=i.name;let u;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&t.evaluater){const m=i.value.data.estree.body[0];m.type,u=t.evaluater.evaluateExpression(m.expression)}else zs(t,l.position);else u=i.value===null?!0:i.value;r[c]=u}return r}function sh(t,l){const r=[];let i=-1;const c=t.passKeys?new Map:jv;for(;++i<l.children.length;){const u=l.children[i];let f;if(t.passKeys){const x=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(x){const d=c.get(x)||0;f=x+"-"+d,c.set(x,d+1)}}const m=ly(t,u,f);m!==void 0&&r.push(m)}return r}function $v(t,l,r){const i=dv(t.schema,l);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=i.commaSeparated?ev(r):pv(r)),i.property==="style"){let c=typeof r=="object"?r:Hv(t,String(r));return t.stylePropertyNameCase==="css"&&(c=Uv(c)),["style",c]}return[t.elementAttributeNameCase==="react"&&i.space?cv[i.property]||i.property:i.attribute,r]}}function Hv(t,l){try{return kv(l,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const i=r,c=new gn("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=t.filePath||void 0,c.url=ny+"#cannot-parse-style-attribute",c}}function ay(t,l,r){let i;if(!r)i={type:"Literal",value:l};else if(l.includes(".")){const c=l.split(".");let u=-1,f;for(;++u<c.length;){const m=x1(c[u])?{type:"Identifier",name:c[u]}:{type:"Literal",value:c[u]};f=f?{type:"MemberExpression",object:f,property:m,computed:!!(u&&m.type==="Literal"),optional:!1}:m}i=f}else i=x1(l)&&!/^[a-z]/.test(l)?{type:"Identifier",name:l}:{type:"Literal",value:l};if(i.type==="Literal"){const c=i.value;return ah.call(t.components,c)?t.components[c]:c}if(t.evaluater)return t.evaluater.evaluateExpression(i);zs(t)}function zs(t,l){const r=new gn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:l,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=t.filePath||void 0,r.url=ny+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Uv(t){const l={};let r;for(r in t)ah.call(t,r)&&(l[Iv(r)]=t[r]);return l}function Iv(t){let l=t.replace(Cv,Yv);return l.slice(0,3)==="ms-"&&(l="-"+l),l}function Yv(t){return"-"+t.toLowerCase()}const td={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},qv={};function oh(t,l){const r=qv,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,c=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return iy(t,i,c)}function iy(t,l,r){if(Xv(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(l&&"alt"in t&&t.alt)return t.alt;if("children"in t)return C1(t.children,l,r)}return Array.isArray(t)?C1(t,l,r):""}function C1(t,l,r){const i=[];let c=-1;for(;++c<t.length;)i[c]=iy(t[c],l,r);return i.join("")}function Xv(t){return!!(t&&typeof t=="object")}const E1=document.createElement("i");function ch(t){const l="&"+t+";";E1.innerHTML=l;const r=E1.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===l?!1:r}function Kn(t,l,r,i){const c=t.length;let u=0,f;if(l<0?l=-l>c?0:c+l:l=l>c?c:l,r=r>0?r:0,i.length<1e4)f=Array.from(i),f.unshift(l,r),t.splice(...f);else for(r&&t.splice(l,r);u<i.length;)f=i.slice(u,u+1e4),f.unshift(l,0),t.splice(...f),u+=1e4,l+=1e4}function al(t,l){return t.length>0?(Kn(t,t.length,0,l),t):l}const N1={}.hasOwnProperty;function sy(t){const l={};let r=-1;for(;++r<t.length;)Vv(l,t[r]);return l}function Vv(t,l){let r;for(r in l){const c=(N1.call(t,r)?t[r]:void 0)||(t[r]={}),u=l[r];let f;if(u)for(f in u){N1.call(c,f)||(c[f]=[]);const m=u[f];Gv(c[f],Array.isArray(m)?m:m?[m]:[])}}}function Gv(t,l){let r=-1;const i=[];for(;++r<l.length;)(l[r].add==="after"?t:i).push(l[r]);Kn(t,0,0,i)}function oy(t,l){const r=Number.parseInt(t,l);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function hl(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const kn=Ir(/[A-Za-z]/),yn=Ir(/[\dA-Za-z]/),Kv=Ir(/[#-'*+\--9=?A-Z^-~]/);function Cc(t){return t!==null&&(t<32||t===127)}const Ud=Ir(/\d/),Qv=Ir(/[\dA-Fa-f]/),Wv=Ir(/[!-/:-@[-`{-~]/);function Ie(t){return t!==null&&t<-2}function zt(t){return t!==null&&(t<0||t===32)}function at(t){return t===-2||t===-1||t===32}const Oc=Ir(new RegExp("\\p{P}|\\p{S}","u")),ba=Ir(/\s/);function Ir(t){return l;function l(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function di(t){const l=[];let r=-1,i=0,c=0;for(;++r<t.length;){const u=t.charCodeAt(r);let f="";if(u===37&&yn(t.charCodeAt(r+1))&&yn(t.charCodeAt(r+2)))c=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(f=String.fromCharCode(u));else if(u>55295&&u<57344){const m=t.charCodeAt(r+1);u<56320&&m>56319&&m<57344?(f=String.fromCharCode(u,m),c=1):f="�"}else f=String.fromCharCode(u);f&&(l.push(t.slice(i,r),encodeURIComponent(f)),i=r+c+1,f=""),c&&(r+=c,c=0)}return l.join("")+t.slice(i)}function dt(t,l,r,i){const c=i?i-1:Number.POSITIVE_INFINITY;let u=0;return f;function f(x){return at(x)?(t.enter(r),m(x)):l(x)}function m(x){return at(x)&&u++<c?(t.consume(x),m):(t.exit(r),l(x))}}const Zv={tokenize:Jv};function Jv(t){const l=t.attempt(this.parser.constructs.contentInitial,i,c);let r;return l;function i(m){if(m===null){t.consume(m);return}return t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),dt(t,l,"linePrefix")}function c(m){return t.enter("paragraph"),u(m)}function u(m){const x=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=x),r=x,f(m)}function f(m){if(m===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(m);return}return Ie(m)?(t.consume(m),t.exit("chunkText"),u):(t.consume(m),f)}}const Pv={tokenize:ew},A1={tokenize:tw};function ew(t){const l=this,r=[];let i=0,c,u,f;return m;function m(M){if(i<r.length){const F=r[i];return l.containerState=F[1],t.attempt(F[0].continuation,x,d)(M)}return d(M)}function x(M){if(i++,l.containerState._closeFlow){l.containerState._closeFlow=void 0,c&&A();const F=l.events.length;let L=F,O;for(;L--;)if(l.events[L][0]==="exit"&&l.events[L][1].type==="chunkFlow"){O=l.events[L][1].end;break}C(i);let U=F;for(;U<l.events.length;)l.events[U][1].end={...O},U++;return Kn(l.events,L+1,0,l.events.slice(F)),l.events.length=U,d(M)}return m(M)}function d(M){if(i===r.length){if(!c)return b(M);if(c.currentConstruct&&c.currentConstruct.concrete)return j(M);l.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return l.containerState={},t.check(A1,g,y)(M)}function g(M){return c&&A(),C(i),b(M)}function y(M){return l.parser.lazy[l.now().line]=i!==r.length,f=l.now().offset,j(M)}function b(M){return l.containerState={},t.attempt(A1,v,j)(M)}function v(M){return i++,r.push([l.currentConstruct,l.containerState]),b(M)}function j(M){if(M===null){c&&A(),C(0),t.consume(M);return}return c=c||l.parser.flow(l.now()),t.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:u}),S(M)}function S(M){if(M===null){E(t.exit("chunkFlow"),!0),C(0),t.consume(M);return}return Ie(M)?(t.consume(M),E(t.exit("chunkFlow")),i=0,l.interrupt=void 0,m):(t.consume(M),S)}function E(M,F){const L=l.sliceStream(M);if(F&&L.push(null),M.previous=u,u&&(u.next=M),u=M,c.defineSkip(M.start),c.write(L),l.parser.lazy[M.start.line]){let O=c.events.length;for(;O--;)if(c.events[O][1].start.offset<f&&(!c.events[O][1].end||c.events[O][1].end.offset>f))return;const U=l.events.length;let X=U,ne,D;for(;X--;)if(l.events[X][0]==="exit"&&l.events[X][1].type==="chunkFlow"){if(ne){D=l.events[X][1].end;break}ne=!0}for(C(i),O=U;O<l.events.length;)l.events[O][1].end={...D},O++;Kn(l.events,X+1,0,l.events.slice(U)),l.events.length=O}}function C(M){let F=r.length;for(;F-- >M;){const L=r[F];l.containerState=L[1],L[0].exit.call(l,t)}r.length=M}function A(){c.write([null]),u=void 0,c=void 0,l.containerState._closeFlow=void 0}}function tw(t,l,r){return dt(t,t.attempt(this.parser.constructs.document,l,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function oi(t){if(t===null||zt(t)||ba(t))return 1;if(Oc(t))return 2}function Bc(t,l,r){const i=[];let c=-1;for(;++c<t.length;){const u=t[c].resolveAll;u&&!i.includes(u)&&(l=u(l,r),i.push(u))}return l}const Id={name:"attention",resolveAll:nw,tokenize:lw};function nw(t,l){let r=-1,i,c,u,f,m,x,d,g;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(i=r;i--;)if(t[i][0]==="exit"&&t[i][1].type==="attentionSequence"&&t[i][1]._open&&l.sliceSerialize(t[i][1]).charCodeAt(0)===l.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[i][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[i][1].end.offset-t[i][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;x=t[i][1].end.offset-t[i][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;const y={...t[i][1].end},b={...t[r][1].start};T1(y,-x),T1(b,x),f={type:x>1?"strongSequence":"emphasisSequence",start:y,end:{...t[i][1].end}},m={type:x>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:b},u={type:x>1?"strongText":"emphasisText",start:{...t[i][1].end},end:{...t[r][1].start}},c={type:x>1?"strong":"emphasis",start:{...f.start},end:{...m.end}},t[i][1].end={...f.start},t[r][1].start={...m.end},d=[],t[i][1].end.offset-t[i][1].start.offset&&(d=al(d,[["enter",t[i][1],l],["exit",t[i][1],l]])),d=al(d,[["enter",c,l],["enter",f,l],["exit",f,l],["enter",u,l]]),d=al(d,Bc(l.parser.constructs.insideSpan.null,t.slice(i+1,r),l)),d=al(d,[["exit",u,l],["enter",m,l],["exit",m,l],["exit",c,l]]),t[r][1].end.offset-t[r][1].start.offset?(g=2,d=al(d,[["enter",t[r][1],l],["exit",t[r][1],l]])):g=0,Kn(t,i-1,r-i+3,d),r=i+d.length-g-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function lw(t,l){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,c=oi(i);let u;return f;function f(x){return u=x,t.enter("attentionSequence"),m(x)}function m(x){if(x===u)return t.consume(x),m;const d=t.exit("attentionSequence"),g=oi(x),y=!g||g===2&&c||r.includes(x),b=!c||c===2&&g||r.includes(i);return d._open=!!(u===42?y:y&&(c||!b)),d._close=!!(u===42?b:b&&(g||!y)),l(x)}}function T1(t,l){t.column+=l,t.offset+=l,t._bufferIndex+=l}const rw={name:"autolink",tokenize:aw};function aw(t,l,r){let i=0;return c;function c(v){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),u}function u(v){return kn(v)?(t.consume(v),f):v===64?r(v):d(v)}function f(v){return v===43||v===45||v===46||yn(v)?(i=1,m(v)):d(v)}function m(v){return v===58?(t.consume(v),i=0,x):(v===43||v===45||v===46||yn(v))&&i++<32?(t.consume(v),m):(i=0,d(v))}function x(v){return v===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),l):v===null||v===32||v===60||Cc(v)?r(v):(t.consume(v),x)}function d(v){return v===64?(t.consume(v),g):Kv(v)?(t.consume(v),d):r(v)}function g(v){return yn(v)?y(v):r(v)}function y(v){return v===46?(t.consume(v),i=0,g):v===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),l):b(v)}function b(v){if((v===45||yn(v))&&i++<63){const j=v===45?b:y;return t.consume(v),j}return r(v)}}const Ls={partial:!0,tokenize:iw};function iw(t,l,r){return i;function i(u){return at(u)?dt(t,c,"linePrefix")(u):c(u)}function c(u){return u===null||Ie(u)?l(u):r(u)}}const cy={continuation:{tokenize:ow},exit:cw,name:"blockQuote",tokenize:sw};function sw(t,l,r){const i=this;return c;function c(f){if(f===62){const m=i.containerState;return m.open||(t.enter("blockQuote",{_container:!0}),m.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(f),t.exit("blockQuoteMarker"),u}return r(f)}function u(f){return at(f)?(t.enter("blockQuotePrefixWhitespace"),t.consume(f),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),l):(t.exit("blockQuotePrefix"),l(f))}}function ow(t,l,r){const i=this;return c;function c(f){return at(f)?dt(t,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):u(f)}function u(f){return t.attempt(cy,l,r)(f)}}function cw(t){t.exit("blockQuote")}const uy={name:"characterEscape",tokenize:uw};function uw(t,l,r){return i;function i(u){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(u),t.exit("escapeMarker"),c}function c(u){return Wv(u)?(t.enter("characterEscapeValue"),t.consume(u),t.exit("characterEscapeValue"),t.exit("characterEscape"),l):r(u)}}const fy={name:"characterReference",tokenize:fw};function fw(t,l,r){const i=this;let c=0,u,f;return m;function m(y){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),x}function x(y){return y===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(y),t.exit("characterReferenceMarkerNumeric"),d):(t.enter("characterReferenceValue"),u=31,f=yn,g(y))}function d(y){return y===88||y===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(y),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),u=6,f=Qv,g):(t.enter("characterReferenceValue"),u=7,f=Ud,g(y))}function g(y){if(y===59&&c){const b=t.exit("characterReferenceValue");return f===yn&&!ch(i.sliceSerialize(b))?r(y):(t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),t.exit("characterReference"),l)}return f(y)&&c++<u?(t.consume(y),g):r(y)}}const D1={partial:!0,tokenize:hw},z1={concrete:!0,name:"codeFenced",tokenize:dw};function dw(t,l,r){const i=this,c={partial:!0,tokenize:L};let u=0,f=0,m;return x;function x(O){return d(O)}function d(O){const U=i.events[i.events.length-1];return u=U&&U[1].type==="linePrefix"?U[2].sliceSerialize(U[1],!0).length:0,m=O,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),g(O)}function g(O){return O===m?(f++,t.consume(O),g):f<3?r(O):(t.exit("codeFencedFenceSequence"),at(O)?dt(t,y,"whitespace")(O):y(O))}function y(O){return O===null||Ie(O)?(t.exit("codeFencedFence"),i.interrupt?l(O):t.check(D1,S,F)(O)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),b(O))}function b(O){return O===null||Ie(O)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),y(O)):at(O)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),dt(t,v,"whitespace")(O)):O===96&&O===m?r(O):(t.consume(O),b)}function v(O){return O===null||Ie(O)?y(O):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),j(O))}function j(O){return O===null||Ie(O)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),y(O)):O===96&&O===m?r(O):(t.consume(O),j)}function S(O){return t.attempt(c,F,E)(O)}function E(O){return t.enter("lineEnding"),t.consume(O),t.exit("lineEnding"),C}function C(O){return u>0&&at(O)?dt(t,A,"linePrefix",u+1)(O):A(O)}function A(O){return O===null||Ie(O)?t.check(D1,S,F)(O):(t.enter("codeFlowValue"),M(O))}function M(O){return O===null||Ie(O)?(t.exit("codeFlowValue"),A(O)):(t.consume(O),M)}function F(O){return t.exit("codeFenced"),l(O)}function L(O,U,X){let ne=0;return D;function D(V){return O.enter("lineEnding"),O.consume(V),O.exit("lineEnding"),Y}function Y(V){return O.enter("codeFencedFence"),at(V)?dt(O,R,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):R(V)}function R(V){return V===m?(O.enter("codeFencedFenceSequence"),Q(V)):X(V)}function Q(V){return V===m?(ne++,O.consume(V),Q):ne>=f?(O.exit("codeFencedFenceSequence"),at(V)?dt(O,ee,"whitespace")(V):ee(V)):X(V)}function ee(V){return V===null||Ie(V)?(O.exit("codeFencedFence"),U(V)):X(V)}}}function hw(t,l,r){const i=this;return c;function c(f){return f===null?r(f):(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u)}function u(f){return i.parser.lazy[i.now().line]?r(f):l(f)}}const nd={name:"codeIndented",tokenize:xw},mw={partial:!0,tokenize:pw};function xw(t,l,r){const i=this;return c;function c(d){return t.enter("codeIndented"),dt(t,u,"linePrefix",5)(d)}function u(d){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?f(d):r(d)}function f(d){return d===null?x(d):Ie(d)?t.attempt(mw,f,x)(d):(t.enter("codeFlowValue"),m(d))}function m(d){return d===null||Ie(d)?(t.exit("codeFlowValue"),f(d)):(t.consume(d),m)}function x(d){return t.exit("codeIndented"),l(d)}}function pw(t,l,r){const i=this;return c;function c(f){return i.parser.lazy[i.now().line]?r(f):Ie(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):dt(t,u,"linePrefix",5)(f)}function u(f){const m=i.events[i.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(f):Ie(f)?c(f):r(f)}}const yw={name:"codeText",previous:bw,resolve:gw,tokenize:vw};function gw(t){let l=t.length-4,r=3,i,c;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[l][1].type==="lineEnding"||t[l][1].type==="space")){for(i=r;++i<l;)if(t[i][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[l][1].type="codeTextPadding",r+=2,l-=2;break}}for(i=r-1,l++;++i<=l;)c===void 0?i!==l&&t[i][1].type!=="lineEnding"&&(c=i):(i===l||t[i][1].type==="lineEnding")&&(t[c][1].type="codeTextData",i!==c+2&&(t[c][1].end=t[i-1][1].end,t.splice(c+2,i-c-2),l-=i-c-2,i=c+2),c=void 0);return t}function bw(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function vw(t,l,r){let i=0,c,u;return f;function f(y){return t.enter("codeText"),t.enter("codeTextSequence"),m(y)}function m(y){return y===96?(t.consume(y),i++,m):(t.exit("codeTextSequence"),x(y))}function x(y){return y===null?r(y):y===32?(t.enter("space"),t.consume(y),t.exit("space"),x):y===96?(u=t.enter("codeTextSequence"),c=0,g(y)):Ie(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),x):(t.enter("codeTextData"),d(y))}function d(y){return y===null||y===32||y===96||Ie(y)?(t.exit("codeTextData"),x(y)):(t.consume(y),d)}function g(y){return y===96?(t.consume(y),c++,g):c===i?(t.exit("codeTextSequence"),t.exit("codeText"),l(y)):(u.type="codeTextData",d(y))}}class ww{constructor(l){this.left=l?[...l]:[],this.right=[]}get(l){if(l<0||l>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+l+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return l<this.left.length?this.left[l]:this.right[this.right.length-l+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(l,r){const i=r??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(l,i):l>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-l+this.left.length).reverse():this.left.slice(l).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(l,r,i){const c=r||0;this.setCursor(Math.trunc(l));const u=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return i&&xs(this.left,i),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(l){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(l)}pushMany(l){this.setCursor(Number.POSITIVE_INFINITY),xs(this.left,l)}unshift(l){this.setCursor(0),this.right.push(l)}unshiftMany(l){this.setCursor(0),xs(this.right,l.reverse())}setCursor(l){if(!(l===this.left.length||l>this.left.length&&this.right.length===0||l<0&&this.left.length===0))if(l<this.left.length){const r=this.left.splice(l,Number.POSITIVE_INFINITY);xs(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-l,Number.POSITIVE_INFINITY);xs(this.left,r.reverse())}}}function xs(t,l){let r=0;if(l.length<1e4)t.push(...l);else for(;r<l.length;)t.push(...l.slice(r,r+1e4)),r+=1e4}function dy(t){const l={};let r=-1,i,c,u,f,m,x,d;const g=new ww(t);for(;++r<g.length;){for(;r in l;)r=l[r];if(i=g.get(r),r&&i[1].type==="chunkFlow"&&g.get(r-1)[1].type==="listItemPrefix"&&(x=i[1]._tokenizer.events,u=0,u<x.length&&x[u][1].type==="lineEndingBlank"&&(u+=2),u<x.length&&x[u][1].type==="content"))for(;++u<x.length&&x[u][1].type!=="content";)x[u][1].type==="chunkText"&&(x[u][1]._isInFirstContentOfListItem=!0,u++);if(i[0]==="enter")i[1].contentType&&(Object.assign(l,kw(g,r)),r=l[r],d=!0);else if(i[1]._container){for(u=r,c=void 0;u--;)if(f=g.get(u),f[1].type==="lineEnding"||f[1].type==="lineEndingBlank")f[0]==="enter"&&(c&&(g.get(c)[1].type="lineEndingBlank"),f[1].type="lineEnding",c=u);else if(!(f[1].type==="linePrefix"||f[1].type==="listItemIndent"))break;c&&(i[1].end={...g.get(c)[1].start},m=g.slice(c,r),m.unshift(i),g.splice(c,r-c+1,m))}}return Kn(t,0,Number.POSITIVE_INFINITY,g.slice(0)),!d}function kw(t,l){const r=t.get(l)[1],i=t.get(l)[2];let c=l-1;const u=[];let f=r._tokenizer;f||(f=i.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(f._contentTypeTextTrailing=!0));const m=f.events,x=[],d={};let g,y,b=-1,v=r,j=0,S=0;const E=[S];for(;v;){for(;t.get(++c)[1]!==v;);u.push(c),v._tokenizer||(g=i.sliceStream(v),v.next||g.push(null),y&&f.defineSkip(v.start),v._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=!0),f.write(g),v._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=void 0)),y=v,v=v.next}for(v=r;++b<m.length;)m[b][0]==="exit"&&m[b-1][0]==="enter"&&m[b][1].type===m[b-1][1].type&&m[b][1].start.line!==m[b][1].end.line&&(S=b+1,E.push(S),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(f.events=[],v?(v._tokenizer=void 0,v.previous=void 0):E.pop(),b=E.length;b--;){const C=m.slice(E[b],E[b+1]),A=u.pop();x.push([A,A+C.length-1]),t.splice(A,2,C)}for(x.reverse(),b=-1;++b<x.length;)d[j+x[b][0]]=j+x[b][1],j+=x[b][1]-x[b][0]-1;return d}const Sw={resolve:Cw,tokenize:Ew},jw={partial:!0,tokenize:Nw};function Cw(t){return dy(t),t}function Ew(t,l){let r;return i;function i(m){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),c(m)}function c(m){return m===null?u(m):Ie(m)?t.check(jw,f,u)(m):(t.consume(m),c)}function u(m){return t.exit("chunkContent"),t.exit("content"),l(m)}function f(m){return t.consume(m),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,c}}function Nw(t,l,r){const i=this;return c;function c(f){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),dt(t,u,"linePrefix")}function u(f){if(f===null||Ie(f))return r(f);const m=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(f):t.interrupt(i.parser.constructs.flow,r,l)(f)}}function hy(t,l,r,i,c,u,f,m,x){const d=x||Number.POSITIVE_INFINITY;let g=0;return y;function y(C){return C===60?(t.enter(i),t.enter(c),t.enter(u),t.consume(C),t.exit(u),b):C===null||C===32||C===41||Cc(C)?r(C):(t.enter(i),t.enter(f),t.enter(m),t.enter("chunkString",{contentType:"string"}),S(C))}function b(C){return C===62?(t.enter(u),t.consume(C),t.exit(u),t.exit(c),t.exit(i),l):(t.enter(m),t.enter("chunkString",{contentType:"string"}),v(C))}function v(C){return C===62?(t.exit("chunkString"),t.exit(m),b(C)):C===null||C===60||Ie(C)?r(C):(t.consume(C),C===92?j:v)}function j(C){return C===60||C===62||C===92?(t.consume(C),v):v(C)}function S(C){return!g&&(C===null||C===41||zt(C))?(t.exit("chunkString"),t.exit(m),t.exit(f),t.exit(i),l(C)):g<d&&C===40?(t.consume(C),g++,S):C===41?(t.consume(C),g--,S):C===null||C===32||C===40||Cc(C)?r(C):(t.consume(C),C===92?E:S)}function E(C){return C===40||C===41||C===92?(t.consume(C),S):S(C)}}function my(t,l,r,i,c,u){const f=this;let m=0,x;return d;function d(v){return t.enter(i),t.enter(c),t.consume(v),t.exit(c),t.enter(u),g}function g(v){return m>999||v===null||v===91||v===93&&!x||v===94&&!m&&"_hiddenFootnoteSupport"in f.parser.constructs?r(v):v===93?(t.exit(u),t.enter(c),t.consume(v),t.exit(c),t.exit(i),l):Ie(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),g):(t.enter("chunkString",{contentType:"string"}),y(v))}function y(v){return v===null||v===91||v===93||Ie(v)||m++>999?(t.exit("chunkString"),g(v)):(t.consume(v),x||(x=!at(v)),v===92?b:y)}function b(v){return v===91||v===92||v===93?(t.consume(v),m++,y):y(v)}}function xy(t,l,r,i,c,u){let f;return m;function m(b){return b===34||b===39||b===40?(t.enter(i),t.enter(c),t.consume(b),t.exit(c),f=b===40?41:b,x):r(b)}function x(b){return b===f?(t.enter(c),t.consume(b),t.exit(c),t.exit(i),l):(t.enter(u),d(b))}function d(b){return b===f?(t.exit(u),x(f)):b===null?r(b):Ie(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),dt(t,d,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===f||b===null||Ie(b)?(t.exit("chunkString"),d(b)):(t.consume(b),b===92?y:g)}function y(b){return b===f||b===92?(t.consume(b),g):g(b)}}function Ns(t,l){let r;return i;function i(c){return Ie(c)?(t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),r=!0,i):at(c)?dt(t,i,r?"linePrefix":"lineSuffix")(c):l(c)}}const Aw={name:"definition",tokenize:Dw},Tw={partial:!0,tokenize:zw};function Dw(t,l,r){const i=this;let c;return u;function u(v){return t.enter("definition"),f(v)}function f(v){return my.call(i,t,m,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function m(v){return c=hl(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),x):r(v)}function x(v){return zt(v)?Ns(t,d)(v):d(v)}function d(v){return hy(t,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function g(v){return t.attempt(Tw,y,y)(v)}function y(v){return at(v)?dt(t,b,"whitespace")(v):b(v)}function b(v){return v===null||Ie(v)?(t.exit("definition"),i.parser.defined.push(c),l(v)):r(v)}}function zw(t,l,r){return i;function i(m){return zt(m)?Ns(t,c)(m):r(m)}function c(m){return xy(t,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(m)}function u(m){return at(m)?dt(t,f,"whitespace")(m):f(m)}function f(m){return m===null||Ie(m)?l(m):r(m)}}const Mw={name:"hardBreakEscape",tokenize:Fw};function Fw(t,l,r){return i;function i(u){return t.enter("hardBreakEscape"),t.consume(u),c}function c(u){return Ie(u)?(t.exit("hardBreakEscape"),l(u)):r(u)}}const Rw={name:"headingAtx",resolve:_w,tokenize:Ow};function _w(t,l){let r=t.length-2,i=3,c,u;return t[i][1].type==="whitespace"&&(i+=2),r-2>i&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(i===r-1||r-4>i&&t[r-2][1].type==="whitespace")&&(r-=i+1===r?2:4),r>i&&(c={type:"atxHeadingText",start:t[i][1].start,end:t[r][1].end},u={type:"chunkText",start:t[i][1].start,end:t[r][1].end,contentType:"text"},Kn(t,i,r-i+1,[["enter",c,l],["enter",u,l],["exit",u,l],["exit",c,l]])),t}function Ow(t,l,r){let i=0;return c;function c(g){return t.enter("atxHeading"),u(g)}function u(g){return t.enter("atxHeadingSequence"),f(g)}function f(g){return g===35&&i++<6?(t.consume(g),f):g===null||zt(g)?(t.exit("atxHeadingSequence"),m(g)):r(g)}function m(g){return g===35?(t.enter("atxHeadingSequence"),x(g)):g===null||Ie(g)?(t.exit("atxHeading"),l(g)):at(g)?dt(t,m,"whitespace")(g):(t.enter("atxHeadingText"),d(g))}function x(g){return g===35?(t.consume(g),x):(t.exit("atxHeadingSequence"),m(g))}function d(g){return g===null||g===35||zt(g)?(t.exit("atxHeadingText"),m(g)):(t.consume(g),d)}}const Bw=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],M1=["pre","script","style","textarea"],Lw={concrete:!0,name:"htmlFlow",resolveTo:Uw,tokenize:Iw},$w={partial:!0,tokenize:qw},Hw={partial:!0,tokenize:Yw};function Uw(t){let l=t.length;for(;l--&&!(t[l][0]==="enter"&&t[l][1].type==="htmlFlow"););return l>1&&t[l-2][1].type==="linePrefix"&&(t[l][1].start=t[l-2][1].start,t[l+1][1].start=t[l-2][1].start,t.splice(l-2,2)),t}function Iw(t,l,r){const i=this;let c,u,f,m,x;return d;function d(T){return g(T)}function g(T){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(T),y}function y(T){return T===33?(t.consume(T),b):T===47?(t.consume(T),u=!0,S):T===63?(t.consume(T),c=3,i.interrupt?l:z):kn(T)?(t.consume(T),f=String.fromCharCode(T),E):r(T)}function b(T){return T===45?(t.consume(T),c=2,v):T===91?(t.consume(T),c=5,m=0,j):kn(T)?(t.consume(T),c=4,i.interrupt?l:z):r(T)}function v(T){return T===45?(t.consume(T),i.interrupt?l:z):r(T)}function j(T){const me="CDATA[";return T===me.charCodeAt(m++)?(t.consume(T),m===me.length?i.interrupt?l:R:j):r(T)}function S(T){return kn(T)?(t.consume(T),f=String.fromCharCode(T),E):r(T)}function E(T){if(T===null||T===47||T===62||zt(T)){const me=T===47,Se=f.toLowerCase();return!me&&!u&&M1.includes(Se)?(c=1,i.interrupt?l(T):R(T)):Bw.includes(f.toLowerCase())?(c=6,me?(t.consume(T),C):i.interrupt?l(T):R(T)):(c=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(T):u?A(T):M(T))}return T===45||yn(T)?(t.consume(T),f+=String.fromCharCode(T),E):r(T)}function C(T){return T===62?(t.consume(T),i.interrupt?l:R):r(T)}function A(T){return at(T)?(t.consume(T),A):D(T)}function M(T){return T===47?(t.consume(T),D):T===58||T===95||kn(T)?(t.consume(T),F):at(T)?(t.consume(T),M):D(T)}function F(T){return T===45||T===46||T===58||T===95||yn(T)?(t.consume(T),F):L(T)}function L(T){return T===61?(t.consume(T),O):at(T)?(t.consume(T),L):M(T)}function O(T){return T===null||T===60||T===61||T===62||T===96?r(T):T===34||T===39?(t.consume(T),x=T,U):at(T)?(t.consume(T),O):X(T)}function U(T){return T===x?(t.consume(T),x=null,ne):T===null||Ie(T)?r(T):(t.consume(T),U)}function X(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||zt(T)?L(T):(t.consume(T),X)}function ne(T){return T===47||T===62||at(T)?M(T):r(T)}function D(T){return T===62?(t.consume(T),Y):r(T)}function Y(T){return T===null||Ie(T)?R(T):at(T)?(t.consume(T),Y):r(T)}function R(T){return T===45&&c===2?(t.consume(T),I):T===60&&c===1?(t.consume(T),Z):T===62&&c===4?(t.consume(T),B):T===63&&c===3?(t.consume(T),z):T===93&&c===5?(t.consume(T),we):Ie(T)&&(c===6||c===7)?(t.exit("htmlFlowData"),t.check($w,W,Q)(T)):T===null||Ie(T)?(t.exit("htmlFlowData"),Q(T)):(t.consume(T),R)}function Q(T){return t.check(Hw,ee,W)(T)}function ee(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),V}function V(T){return T===null||Ie(T)?Q(T):(t.enter("htmlFlowData"),R(T))}function I(T){return T===45?(t.consume(T),z):R(T)}function Z(T){return T===47?(t.consume(T),f="",ce):R(T)}function ce(T){if(T===62){const me=f.toLowerCase();return M1.includes(me)?(t.consume(T),B):R(T)}return kn(T)&&f.length<8?(t.consume(T),f+=String.fromCharCode(T),ce):R(T)}function we(T){return T===93?(t.consume(T),z):R(T)}function z(T){return T===62?(t.consume(T),B):T===45&&c===2?(t.consume(T),z):R(T)}function B(T){return T===null||Ie(T)?(t.exit("htmlFlowData"),W(T)):(t.consume(T),B)}function W(T){return t.exit("htmlFlow"),l(T)}}function Yw(t,l,r){const i=this;return c;function c(f){return Ie(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u):r(f)}function u(f){return i.parser.lazy[i.now().line]?r(f):l(f)}}function qw(t,l,r){return i;function i(c){return t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),t.attempt(Ls,l,r)}}const Xw={name:"htmlText",tokenize:Vw};function Vw(t,l,r){const i=this;let c,u,f;return m;function m(z){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(z),x}function x(z){return z===33?(t.consume(z),d):z===47?(t.consume(z),L):z===63?(t.consume(z),M):kn(z)?(t.consume(z),X):r(z)}function d(z){return z===45?(t.consume(z),g):z===91?(t.consume(z),u=0,j):kn(z)?(t.consume(z),A):r(z)}function g(z){return z===45?(t.consume(z),v):r(z)}function y(z){return z===null?r(z):z===45?(t.consume(z),b):Ie(z)?(f=y,Z(z)):(t.consume(z),y)}function b(z){return z===45?(t.consume(z),v):y(z)}function v(z){return z===62?I(z):z===45?b(z):y(z)}function j(z){const B="CDATA[";return z===B.charCodeAt(u++)?(t.consume(z),u===B.length?S:j):r(z)}function S(z){return z===null?r(z):z===93?(t.consume(z),E):Ie(z)?(f=S,Z(z)):(t.consume(z),S)}function E(z){return z===93?(t.consume(z),C):S(z)}function C(z){return z===62?I(z):z===93?(t.consume(z),C):S(z)}function A(z){return z===null||z===62?I(z):Ie(z)?(f=A,Z(z)):(t.consume(z),A)}function M(z){return z===null?r(z):z===63?(t.consume(z),F):Ie(z)?(f=M,Z(z)):(t.consume(z),M)}function F(z){return z===62?I(z):M(z)}function L(z){return kn(z)?(t.consume(z),O):r(z)}function O(z){return z===45||yn(z)?(t.consume(z),O):U(z)}function U(z){return Ie(z)?(f=U,Z(z)):at(z)?(t.consume(z),U):I(z)}function X(z){return z===45||yn(z)?(t.consume(z),X):z===47||z===62||zt(z)?ne(z):r(z)}function ne(z){return z===47?(t.consume(z),I):z===58||z===95||kn(z)?(t.consume(z),D):Ie(z)?(f=ne,Z(z)):at(z)?(t.consume(z),ne):I(z)}function D(z){return z===45||z===46||z===58||z===95||yn(z)?(t.consume(z),D):Y(z)}function Y(z){return z===61?(t.consume(z),R):Ie(z)?(f=Y,Z(z)):at(z)?(t.consume(z),Y):ne(z)}function R(z){return z===null||z===60||z===61||z===62||z===96?r(z):z===34||z===39?(t.consume(z),c=z,Q):Ie(z)?(f=R,Z(z)):at(z)?(t.consume(z),R):(t.consume(z),ee)}function Q(z){return z===c?(t.consume(z),c=void 0,V):z===null?r(z):Ie(z)?(f=Q,Z(z)):(t.consume(z),Q)}function ee(z){return z===null||z===34||z===39||z===60||z===61||z===96?r(z):z===47||z===62||zt(z)?ne(z):(t.consume(z),ee)}function V(z){return z===47||z===62||zt(z)?ne(z):r(z)}function I(z){return z===62?(t.consume(z),t.exit("htmlTextData"),t.exit("htmlText"),l):r(z)}function Z(z){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),ce}function ce(z){return at(z)?dt(t,we,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):we(z)}function we(z){return t.enter("htmlTextData"),f(z)}}const uh={name:"labelEnd",resolveAll:Ww,resolveTo:Zw,tokenize:Jw},Gw={tokenize:Pw},Kw={tokenize:e5},Qw={tokenize:t5};function Ww(t){let l=-1;const r=[];for(;++l<t.length;){const i=t[l][1];if(r.push(t[l]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const c=i.type==="labelImage"?4:2;i.type="data",l+=c}}return t.length!==r.length&&Kn(t,0,t.length,r),t}function Zw(t,l){let r=t.length,i=0,c,u,f,m;for(;r--;)if(c=t[r][1],u){if(c.type==="link"||c.type==="labelLink"&&c._inactive)break;t[r][0]==="enter"&&c.type==="labelLink"&&(c._inactive=!0)}else if(f){if(t[r][0]==="enter"&&(c.type==="labelImage"||c.type==="labelLink")&&!c._balanced&&(u=r,c.type!=="labelLink")){i=2;break}}else c.type==="labelEnd"&&(f=r);const x={type:t[u][1].type==="labelLink"?"link":"image",start:{...t[u][1].start},end:{...t[t.length-1][1].end}},d={type:"label",start:{...t[u][1].start},end:{...t[f][1].end}},g={type:"labelText",start:{...t[u+i+2][1].end},end:{...t[f-2][1].start}};return m=[["enter",x,l],["enter",d,l]],m=al(m,t.slice(u+1,u+i+3)),m=al(m,[["enter",g,l]]),m=al(m,Bc(l.parser.constructs.insideSpan.null,t.slice(u+i+4,f-3),l)),m=al(m,[["exit",g,l],t[f-2],t[f-1],["exit",d,l]]),m=al(m,t.slice(f+1)),m=al(m,[["exit",x,l]]),Kn(t,u,t.length,m),t}function Jw(t,l,r){const i=this;let c=i.events.length,u,f;for(;c--;)if((i.events[c][1].type==="labelImage"||i.events[c][1].type==="labelLink")&&!i.events[c][1]._balanced){u=i.events[c][1];break}return m;function m(b){return u?u._inactive?y(b):(f=i.parser.defined.includes(hl(i.sliceSerialize({start:u.end,end:i.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(b),t.exit("labelMarker"),t.exit("labelEnd"),x):r(b)}function x(b){return b===40?t.attempt(Gw,g,f?g:y)(b):b===91?t.attempt(Kw,g,f?d:y)(b):f?g(b):y(b)}function d(b){return t.attempt(Qw,g,y)(b)}function g(b){return l(b)}function y(b){return u._balanced=!0,r(b)}}function Pw(t,l,r){return i;function i(y){return t.enter("resource"),t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),c}function c(y){return zt(y)?Ns(t,u)(y):u(y)}function u(y){return y===41?g(y):hy(t,f,m,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function f(y){return zt(y)?Ns(t,x)(y):g(y)}function m(y){return r(y)}function x(y){return y===34||y===39||y===40?xy(t,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function d(y){return zt(y)?Ns(t,g)(y):g(y)}function g(y){return y===41?(t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),t.exit("resource"),l):r(y)}}function e5(t,l,r){const i=this;return c;function c(m){return my.call(i,t,u,f,"reference","referenceMarker","referenceString")(m)}function u(m){return i.parser.defined.includes(hl(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?l(m):r(m)}function f(m){return r(m)}}function t5(t,l,r){return i;function i(u){return t.enter("reference"),t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),c}function c(u){return u===93?(t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),t.exit("reference"),l):r(u)}}const n5={name:"labelStartImage",resolveAll:uh.resolveAll,tokenize:l5};function l5(t,l,r){const i=this;return c;function c(m){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(m),t.exit("labelImageMarker"),u}function u(m){return m===91?(t.enter("labelMarker"),t.consume(m),t.exit("labelMarker"),t.exit("labelImage"),f):r(m)}function f(m){return m===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(m):l(m)}}const r5={name:"labelStartLink",resolveAll:uh.resolveAll,tokenize:a5};function a5(t,l,r){const i=this;return c;function c(f){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(f),t.exit("labelMarker"),t.exit("labelLink"),u}function u(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(f):l(f)}}const ld={name:"lineEnding",tokenize:i5};function i5(t,l){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),dt(t,l,"linePrefix")}}const bc={name:"thematicBreak",tokenize:s5};function s5(t,l,r){let i=0,c;return u;function u(d){return t.enter("thematicBreak"),f(d)}function f(d){return c=d,m(d)}function m(d){return d===c?(t.enter("thematicBreakSequence"),x(d)):i>=3&&(d===null||Ie(d))?(t.exit("thematicBreak"),l(d)):r(d)}function x(d){return d===c?(t.consume(d),i++,x):(t.exit("thematicBreakSequence"),at(d)?dt(t,m,"whitespace")(d):m(d))}}const Rn={continuation:{tokenize:f5},exit:h5,name:"list",tokenize:u5},o5={partial:!0,tokenize:m5},c5={partial:!0,tokenize:d5};function u5(t,l,r){const i=this,c=i.events[i.events.length-1];let u=c&&c[1].type==="linePrefix"?c[2].sliceSerialize(c[1],!0).length:0,f=0;return m;function m(v){const j=i.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(j==="listUnordered"?!i.containerState.marker||v===i.containerState.marker:Ud(v)){if(i.containerState.type||(i.containerState.type=j,t.enter(j,{_container:!0})),j==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(bc,r,d)(v):d(v);if(!i.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),x(v)}return r(v)}function x(v){return Ud(v)&&++f<10?(t.consume(v),x):(!i.interrupt||f<2)&&(i.containerState.marker?v===i.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),d(v)):r(v)}function d(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||v,t.check(Ls,i.interrupt?r:g,t.attempt(o5,b,y))}function g(v){return i.containerState.initialBlankLine=!0,u++,b(v)}function y(v){return at(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),b):r(v)}function b(v){return i.containerState.size=u+i.sliceSerialize(t.exit("listItemPrefix"),!0).length,l(v)}}function f5(t,l,r){const i=this;return i.containerState._closeFlow=void 0,t.check(Ls,c,u);function c(m){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,dt(t,l,"listItemIndent",i.containerState.size+1)(m)}function u(m){return i.containerState.furtherBlankLines||!at(m)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,f(m)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,t.attempt(c5,l,f)(m))}function f(m){return i.containerState._closeFlow=!0,i.interrupt=void 0,dt(t,t.attempt(Rn,l,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m)}}function d5(t,l,r){const i=this;return dt(t,c,"listItemIndent",i.containerState.size+1);function c(u){const f=i.events[i.events.length-1];return f&&f[1].type==="listItemIndent"&&f[2].sliceSerialize(f[1],!0).length===i.containerState.size?l(u):r(u)}}function h5(t){t.exit(this.containerState.type)}function m5(t,l,r){const i=this;return dt(t,c,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(u){const f=i.events[i.events.length-1];return!at(u)&&f&&f[1].type==="listItemPrefixWhitespace"?l(u):r(u)}}const F1={name:"setextUnderline",resolveTo:x5,tokenize:p5};function x5(t,l){let r=t.length,i,c,u;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){i=r;break}t[r][1].type==="paragraph"&&(c=r)}else t[r][1].type==="content"&&t.splice(r,1),!u&&t[r][1].type==="definition"&&(u=r);const f={type:"setextHeading",start:{...t[i][1].start},end:{...t[t.length-1][1].end}};return t[c][1].type="setextHeadingText",u?(t.splice(c,0,["enter",f,l]),t.splice(u+1,0,["exit",t[i][1],l]),t[i][1].end={...t[u][1].end}):t[i][1]=f,t.push(["exit",f,l]),t}function p5(t,l,r){const i=this;let c;return u;function u(d){let g=i.events.length,y;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){y=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||y)?(t.enter("setextHeadingLine"),c=d,f(d)):r(d)}function f(d){return t.enter("setextHeadingLineSequence"),m(d)}function m(d){return d===c?(t.consume(d),m):(t.exit("setextHeadingLineSequence"),at(d)?dt(t,x,"lineSuffix")(d):x(d))}function x(d){return d===null||Ie(d)?(t.exit("setextHeadingLine"),l(d)):r(d)}}const y5={tokenize:g5};function g5(t){const l=this,r=t.attempt(Ls,i,t.attempt(this.parser.constructs.flowInitial,c,dt(t,t.attempt(this.parser.constructs.flow,c,t.attempt(Sw,c)),"linePrefix")));return r;function i(u){if(u===null){t.consume(u);return}return t.enter("lineEndingBlank"),t.consume(u),t.exit("lineEndingBlank"),l.currentConstruct=void 0,r}function c(u){if(u===null){t.consume(u);return}return t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),l.currentConstruct=void 0,r}}const b5={resolveAll:yy()},v5=py("string"),w5=py("text");function py(t){return{resolveAll:yy(t==="text"?k5:void 0),tokenize:l};function l(r){const i=this,c=this.parser.constructs[t],u=r.attempt(c,f,m);return f;function f(g){return d(g)?u(g):m(g)}function m(g){if(g===null){r.consume(g);return}return r.enter("data"),r.consume(g),x}function x(g){return d(g)?(r.exit("data"),u(g)):(r.consume(g),x)}function d(g){if(g===null)return!0;const y=c[g];let b=-1;if(y)for(;++b<y.length;){const v=y[b];if(!v.previous||v.previous.call(i,i.previous))return!0}return!1}}}function yy(t){return l;function l(r,i){let c=-1,u;for(;++c<=r.length;)u===void 0?r[c]&&r[c][1].type==="data"&&(u=c,c++):(!r[c]||r[c][1].type!=="data")&&(c!==u+2&&(r[u][1].end=r[c-1][1].end,r.splice(u+2,c-u-2),c=u+2),u=void 0);return t?t(r,i):r}}function k5(t,l){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){const i=t[r-1][1],c=l.sliceStream(i);let u=c.length,f=-1,m=0,x;for(;u--;){const d=c[u];if(typeof d=="string"){for(f=d.length;d.charCodeAt(f-1)===32;)m++,f--;if(f)break;f=-1}else if(d===-2)x=!0,m++;else if(d!==-1){u++;break}}if(l._contentTypeTextTrailing&&r===t.length&&(m=0),m){const d={type:r===t.length||x||m<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?f:i.start._bufferIndex+f,_index:i.start._index+u,line:i.end.line,column:i.end.column-m,offset:i.end.offset-m},end:{...i.end}};i.end={...d.start},i.start.offset===i.end.offset?Object.assign(i,d):(t.splice(r,0,["enter",d,l],["exit",d,l]),r+=2)}r++}return t}const S5={42:Rn,43:Rn,45:Rn,48:Rn,49:Rn,50:Rn,51:Rn,52:Rn,53:Rn,54:Rn,55:Rn,56:Rn,57:Rn,62:cy},j5={91:Aw},C5={[-2]:nd,[-1]:nd,32:nd},E5={35:Rw,42:bc,45:[F1,bc],60:Lw,61:F1,95:bc,96:z1,126:z1},N5={38:fy,92:uy},A5={[-5]:ld,[-4]:ld,[-3]:ld,33:n5,38:fy,42:Id,60:[rw,Xw],91:r5,92:[Mw,uy],93:uh,95:Id,96:yw},T5={null:[Id,b5]},D5={null:[42,95]},z5={null:[]},M5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:D5,contentInitial:j5,disable:z5,document:S5,flow:E5,flowInitial:C5,insideSpan:T5,string:N5,text:A5},Symbol.toStringTag,{value:"Module"}));function F5(t,l,r){let i={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const c={},u=[];let f=[],m=[];const x={attempt:U(L),check:U(O),consume:A,enter:M,exit:F,interrupt:U(O,{interrupt:!0})},d={code:null,containerState:{},defineSkip:S,events:[],now:j,parser:t,previous:null,sliceSerialize:b,sliceStream:v,write:y};let g=l.tokenize.call(d,x);return l.resolveAll&&u.push(l),d;function y(Y){return f=al(f,Y),E(),f[f.length-1]!==null?[]:(X(l,0),d.events=Bc(u,d.events,d),d.events)}function b(Y,R){return _5(v(Y),R)}function v(Y){return R5(f,Y)}function j(){const{_bufferIndex:Y,_index:R,line:Q,column:ee,offset:V}=i;return{_bufferIndex:Y,_index:R,line:Q,column:ee,offset:V}}function S(Y){c[Y.line]=Y.column,D()}function E(){let Y;for(;i._index<f.length;){const R=f[i._index];if(typeof R=="string")for(Y=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===Y&&i._bufferIndex<R.length;)C(R.charCodeAt(i._bufferIndex));else C(R)}}function C(Y){g=g(Y)}function A(Y){Ie(Y)?(i.line++,i.column=1,i.offset+=Y===-3?2:1,D()):Y!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===f[i._index].length&&(i._bufferIndex=-1,i._index++)),d.previous=Y}function M(Y,R){const Q=R||{};return Q.type=Y,Q.start=j(),d.events.push(["enter",Q,d]),m.push(Q),Q}function F(Y){const R=m.pop();return R.end=j(),d.events.push(["exit",R,d]),R}function L(Y,R){X(Y,R.from)}function O(Y,R){R.restore()}function U(Y,R){return Q;function Q(ee,V,I){let Z,ce,we,z;return Array.isArray(ee)?W(ee):"tokenize"in ee?W([ee]):B(ee);function B(Ee){return Be;function Be(He){const Qe=He!==null&&Ee[He],ke=He!==null&&Ee.null,yt=[...Array.isArray(Qe)?Qe:Qe?[Qe]:[],...Array.isArray(ke)?ke:ke?[ke]:[]];return W(yt)(He)}}function W(Ee){return Z=Ee,ce=0,Ee.length===0?I:T(Ee[ce])}function T(Ee){return Be;function Be(He){return z=ne(),we=Ee,Ee.partial||(d.currentConstruct=Ee),Ee.name&&d.parser.constructs.disable.null.includes(Ee.name)?Se():Ee.tokenize.call(R?Object.assign(Object.create(d),R):d,x,me,Se)(He)}}function me(Ee){return Y(we,z),V}function Se(Ee){return z.restore(),++ce<Z.length?T(Z[ce]):I}}}function X(Y,R){Y.resolveAll&&!u.includes(Y)&&u.push(Y),Y.resolve&&Kn(d.events,R,d.events.length-R,Y.resolve(d.events.slice(R),d)),Y.resolveTo&&(d.events=Y.resolveTo(d.events,d))}function ne(){const Y=j(),R=d.previous,Q=d.currentConstruct,ee=d.events.length,V=Array.from(m);return{from:ee,restore:I};function I(){i=Y,d.previous=R,d.currentConstruct=Q,d.events.length=ee,m=V,D()}}function D(){i.line in c&&i.column<2&&(i.column=c[i.line],i.offset+=c[i.line]-1)}}function R5(t,l){const r=l.start._index,i=l.start._bufferIndex,c=l.end._index,u=l.end._bufferIndex;let f;if(r===c)f=[t[r].slice(i,u)];else{if(f=t.slice(r,c),i>-1){const m=f[0];typeof m=="string"?f[0]=m.slice(i):f.shift()}u>0&&f.push(t[c].slice(0,u))}return f}function _5(t,l){let r=-1;const i=[];let c;for(;++r<t.length;){const u=t[r];let f;if(typeof u=="string")f=u;else switch(u){case-5:{f="\r";break}case-4:{f=`
|
|
48
|
+
`+s.stack}}var Ae=Object.prototype.hasOwnProperty,Be=t.unstable_scheduleCallback,Ke=t.unstable_cancelCallback,St=t.unstable_shouldYield,Xt=t.unstable_requestPaint,pt=t.unstable_now,bt=t.unstable_getCurrentPriorityLevel,re=t.unstable_ImmediatePriority,ye=t.unstable_UserBlockingPriority,ze=t.unstable_NormalPriority,Ie=t.unstable_LowPriority,be=t.unstable_IdlePriority,je=t.log,jt=t.unstable_setDisableYieldValue,vt=null,Je=null;function Mt(e){if(typeof je=="function"&&jt(e),Je&&typeof Je.setStrictMode=="function")try{Je.setStrictMode(vt,e)}catch{}}var nt=Math.clz32?Math.clz32:cn,Ht=Math.log,de=Math.LN2;function cn(e){return e>>>=0,e===0?32:31-(Ht(e)/de|0)|0}var xl=256,ir=262144,zl=4194304;function Ml(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function sr(e,n,a){var s=e.pendingLanes;if(s===0)return 0;var h=0,p=e.suspendedLanes,w=e.pingedLanes;e=e.warmLanes;var N=s&134217727;return N!==0?(s=N&~p,s!==0?h=Ml(s):(w&=N,w!==0?h=Ml(w):a||(a=N&~e,a!==0&&(h=Ml(a))))):(N=s&~p,N!==0?h=Ml(N):w!==0?h=Ml(w):a||(a=s&~e,a!==0&&(h=Ml(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 Rl(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function ja(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Us(){var e=zl;return zl<<=1,(zl&62914560)===0&&(zl=4194304),e}function Gr(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function or(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function xi(e,n,a,s,h,p){var w=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var N=e.entanglements,H=e.expirationTimes,P=e.hiddenUpdates;for(a=w&~a;0<a;){var se=31-nt(a),fe=1<<se;N[se]=0,H[se]=-1;var te=P[se];if(te!==null)for(P[se]=null,se=0;se<te.length;se++){var le=te[se];le!==null&&(le.lane&=-536870913)}a&=~fe}s!==0&&Bn(e,s,0),p!==0&&h===0&&e.tag!==0&&(e.suspendedLanes|=p&~(w&~n))}function Bn(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var s=31-nt(n);e.entangledLanes|=n,e.entanglements[s]=e.entanglements[s]|1073741824|a&261930}function Is(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var s=31-nt(a),h=1<<s;h&n|e[s]&n&&(e[s]|=n),a&=~h}}function Fl(e,n){var a=n&-n;return a=(a&42)!==0?1:Kr(a),(a&(e.suspendedLanes|n))!==0?0:a}function Kr(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function pl(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function _l(){var e=Z.p;return e!==0?e:(e=window.event,e===void 0?32:Wp(e.type))}function Ol(e,n){var a=Z.p;try{return Z.p=e,n()}finally{Z.p=a}}var sl=Math.random().toString(36).slice(2),Lt="__reactFiber$"+sl,un="__reactProps$"+sl,Bl="__reactContainer$"+sl,Qr="__reactEvents$"+sl,Ys="__reactListeners$"+sl,qs="__reactHandles$"+sl,yl="__reactResources$"+sl,Ll="__reactMarker$"+sl;function Ca(e){delete e[Lt],delete e[un],delete e[Qr],delete e[Ys],delete e[qs]}function $l(e){var n=e[Lt];if(n)return n;for(var a=e.parentNode;a;){if(n=a[Bl]||a[Lt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=Fp(e);e!==null;){if(a=e[Lt])return a;e=Fp(e)}return n}e=a,a=e.parentNode}return null}function cr(e){if(e=e[Lt]||e[Bl]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Hl(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(i(33))}function fn(e){var n=e[yl];return n||(n=e[yl]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Rt(e){e[Ll]=!0}var ur=new Set,Xs={};function En(e,n){Vt(e,n),Vt(e+"Capture",n)}function Vt(e,n){for(Xs[e]=n,e=0;e<n.length;e++)ur.add(n[e])}var Ea=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]*$"),Ln={},fr={};function pi(e){return Ae.call(fr,e)?!0:Ae.call(Ln,e)?!1:Ea.test(e)?fr[e]=!0:(Ln[e]=!0,!1)}function Na(e,n,a){if(pi(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var s=n.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function gl(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function vn(e,n,a,s){if(s===null)e.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+s)}}function Nn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ut(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Vs(e,n,a){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var h=s.get,p=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return h.call(this)},set:function(w){a=""+w,p.call(this,w)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function yi(e){if(!e._valueTracker){var n=Ut(e)?"checked":"value";e._valueTracker=Vs(e,n,""+e[n])}}function Gs(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),s="";return e&&(s=Ut(e)?e.checked?"true":"false":e.value),e=s,e!==a?(n.setValue(e),!0):!1}function Wr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var gi=/[\n"\\]/g;function An(e){return e.replace(gi,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function bi(e,n,a,s,h,p,w,N){e.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.type=w:e.removeAttribute("type"),n!=null?w==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Nn(n)):e.value!==""+Nn(n)&&(e.value=""+Nn(n)):w!=="submit"&&w!=="reset"||e.removeAttribute("value"),n!=null?wi(e,w,Nn(n)):a!=null?wi(e,w,Nn(a)):s!=null&&e.removeAttribute("value"),h==null&&p!=null&&(e.defaultChecked=!!p),h!=null&&(e.checked=h&&typeof h!="function"&&typeof h!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+Nn(N):e.removeAttribute("name")}function vi(e,n,a,s,h,p,w,N){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),n!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||n!=null)){yi(e);return}a=a!=null?""+Nn(a):"",n=n!=null?""+Nn(n):a,N||n===e.value||(e.value=n),e.defaultValue=n}s=s??h,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=N?e.checked:!!s,e.defaultChecked=!!s,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(e.name=w),yi(e)}function wi(e,n,a){n==="number"&&Wr(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function dr(e,n,a,s){if(e=e.options,n){n={};for(var h=0;h<a.length;h++)n["$"+a[h]]=!0;for(a=0;a<e.length;a++)h=n.hasOwnProperty("$"+e[a].value),e[a].selected!==h&&(e[a].selected=h),h&&s&&(e[a].defaultSelected=!0)}else{for(a=""+Nn(a),n=null,h=0;h<e.length;h++){if(e[h].value===a){e[h].selected=!0,s&&(e[h].defaultSelected=!0);return}n!==null||e[h].disabled||(n=e[h])}n!==null&&(n.selected=!0)}}function Ks(e,n,a){if(n!=null&&(n=""+Nn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+Nn(a):""}function Qs(e,n,a,s){if(n==null){if(s!=null){if(a!=null)throw Error(i(92));if(V(s)){if(1<s.length)throw Error(i(93));s=s[0]}a=s}a==null&&(a=""),n=a}a=Nn(n),e.defaultValue=a,s=e.textContent,s===a&&s!==""&&s!==null&&(e.value=s),yi(e)}function hr(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var qc=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Ws(e,n,a){var s=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?s?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":s?e.setProperty(n,a):typeof a!="number"||a===0||qc.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function ol(e,n,a){if(n!=null&&typeof n!="object")throw Error(i(62));if(e=e.style,a!=null){for(var s in a)!a.hasOwnProperty(s)||n!=null&&n.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var h in n)s=n[h],n.hasOwnProperty(h)&&a[h]!==s&&Ws(e,h,s)}else for(var p in n)n.hasOwnProperty(p)&&Ws(e,p,n[p])}function Zr(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Xc=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Vc=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function $n(e){return Vc.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Wn(){}var ki=null;function Si(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var It=null,Zn=null;function ji(e){var n=cr(e);if(n&&(e=n.stateNode)){var a=e[un]||null;e:switch(e=n.stateNode,n.type){case"input":if(bi(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+An(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var s=a[n];if(s!==e&&s.form===e.form){var h=s[un]||null;if(!h)throw Error(i(90));bi(s,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(n=0;n<a.length;n++)s=a[n],s.form===e.form&&Gs(s)}break e;case"textarea":Ks(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&dr(e,!!a.multiple,n,!1)}}}var Aa=!1;function Ci(e,n,a){if(Aa)return e(n,a);Aa=!0;try{var s=e(n);return s}finally{if(Aa=!1,(It!==null||Zn!==null)&&(_o(),It&&(n=It,e=Zn,Zn=It=null,ji(n),e)))for(n=0;n<e.length;n++)ji(e[n])}}function _(e,n){var a=e.stateNode;if(a===null)return null;var s=a[un]||null;if(s===null)return null;a=s[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(i(231,n,typeof a));return a}var ae=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ue=!1;if(ae)try{var pe={};Object.defineProperty(pe,"passive",{get:function(){ue=!0}}),window.addEventListener("test",pe,pe),window.removeEventListener("test",pe,pe)}catch{ue=!1}var ge=null,Me=null,Le=null;function Pe(){if(Le)return Le;var e,n=Me,a=n.length,s,h="value"in ge?ge.value:ge.textContent,p=h.length;for(e=0;e<a&&n[e]===h[e];e++);var w=a-e;for(s=1;s<=w&&n[a-s]===h[p-s];s++);return Le=h.slice(e,1<s?1-s:void 0)}function lt(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Xe(){return!0}function Yt(){return!1}function Tn(e){function n(a,s,h,p,w){this._reactName=a,this._targetInst=h,this.type=s,this.nativeEvent=p,this.target=w,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(a=e[N],this[N]=a?a(p):p[N]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Xe:Yt,this.isPropagationStopped=Yt,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=Xe)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Xe)},persist:function(){},isPersistent:Xe}),n}var Jr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zs=Tn(Jr),Ei=y({},Jr,{view:0,detail:0}),Og=Tn(Ei),Gc,Kc,Ni,Js=y({},Ei,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ni&&(Ni&&e.type==="mousemove"?(Gc=e.screenX-Ni.screenX,Kc=e.screenY-Ni.screenY):Kc=Gc=0,Ni=e),Gc)},movementY:function(e){return"movementY"in e?e.movementY:Kc}}),Th=Tn(Js),Bg=y({},Js,{dataTransfer:0}),Lg=Tn(Bg),$g=y({},Ei,{relatedTarget:0}),Qc=Tn($g),Hg=y({},Jr,{animationName:0,elapsedTime:0,pseudoElement:0}),Ug=Tn(Hg),Ig=y({},Jr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Yg=Tn(Ig),qg=y({},Jr,{data:0}),Dh=Tn(qg),Xg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Vg={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Gg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Kg(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Gg[e])?!!n[e]:!1}function Wc(){return Kg}var Qg=y({},Ei,{key:function(e){if(e.key){var n=Xg[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=lt(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Vg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wc,charCode:function(e){return e.type==="keypress"?lt(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?lt(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Wg=Tn(Qg),Zg=y({},Js,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zh=Tn(Zg),Jg=y({},Ei,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wc}),Pg=Tn(Jg),e2=y({},Jr,{propertyName:0,elapsedTime:0,pseudoElement:0}),t2=Tn(e2),n2=y({},Js,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),l2=Tn(n2),r2=y({},Jr,{newState:0,oldState:0}),a2=Tn(r2),i2=[9,13,27,32],Zc=ae&&"CompositionEvent"in window,Ai=null;ae&&"documentMode"in document&&(Ai=document.documentMode);var s2=ae&&"TextEvent"in window&&!Ai,Mh=ae&&(!Zc||Ai&&8<Ai&&11>=Ai),Rh=" ",Fh=!1;function _h(e,n){switch(e){case"keyup":return i2.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Oh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ta=!1;function o2(e,n){switch(e){case"compositionend":return Oh(n);case"keypress":return n.which!==32?null:(Fh=!0,Rh);case"textInput":return e=n.data,e===Rh&&Fh?null:e;default:return null}}function c2(e,n){if(Ta)return e==="compositionend"||!Zc&&_h(e,n)?(e=Pe(),Le=Me=ge=null,Ta=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Mh&&n.locale!=="ko"?null:n.data;default:return null}}var u2={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Bh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!u2[e.type]:n==="textarea"}function Lh(e,n,a,s){It?Zn?Zn.push(s):Zn=[s]:It=s,n=Io(n,"onChange"),0<n.length&&(a=new Zs("onChange","change",null,a,s),e.push({event:a,listeners:n}))}var Ti=null,Di=null;function f2(e){vp(e,0)}function Ps(e){var n=Hl(e);if(Gs(n))return e}function $h(e,n){if(e==="change")return n}var Hh=!1;if(ae){var Jc;if(ae){var Pc="oninput"in document;if(!Pc){var Uh=document.createElement("div");Uh.setAttribute("oninput","return;"),Pc=typeof Uh.oninput=="function"}Jc=Pc}else Jc=!1;Hh=Jc&&(!document.documentMode||9<document.documentMode)}function Ih(){Ti&&(Ti.detachEvent("onpropertychange",Yh),Di=Ti=null)}function Yh(e){if(e.propertyName==="value"&&Ps(Di)){var n=[];Lh(n,Di,e,Si(e)),Ci(f2,n)}}function d2(e,n,a){e==="focusin"?(Ih(),Ti=n,Di=a,Ti.attachEvent("onpropertychange",Yh)):e==="focusout"&&Ih()}function h2(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ps(Di)}function m2(e,n){if(e==="click")return Ps(n)}function x2(e,n){if(e==="input"||e==="change")return Ps(n)}function p2(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Hn=typeof Object.is=="function"?Object.is:p2;function zi(e,n){if(Hn(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),s=Object.keys(n);if(a.length!==s.length)return!1;for(s=0;s<a.length;s++){var h=a[s];if(!Ae.call(n,h)||!Hn(e[h],n[h]))return!1}return!0}function qh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xh(e,n){var a=qh(e);e=0;for(var s;a;){if(a.nodeType===3){if(s=e+a.textContent.length,e<=n&&s>=n)return{node:a,offset:n-e};e=s}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=qh(a)}}function Vh(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Vh(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Gh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Wr(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=Wr(e.document)}return n}function eu(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var y2=ae&&"documentMode"in document&&11>=document.documentMode,Da=null,tu=null,Mi=null,nu=!1;function Kh(e,n,a){var s=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;nu||Da==null||Da!==Wr(s)||(s=Da,"selectionStart"in s&&eu(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Mi&&zi(Mi,s)||(Mi=s,s=Io(tu,"onSelect"),0<s.length&&(n=new Zs("onSelect","select",null,n,a),e.push({event:n,listeners:s}),n.target=Da)))}function Pr(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var za={animationend:Pr("Animation","AnimationEnd"),animationiteration:Pr("Animation","AnimationIteration"),animationstart:Pr("Animation","AnimationStart"),transitionrun:Pr("Transition","TransitionRun"),transitionstart:Pr("Transition","TransitionStart"),transitioncancel:Pr("Transition","TransitionCancel"),transitionend:Pr("Transition","TransitionEnd")},lu={},Qh={};ae&&(Qh=document.createElement("div").style,"AnimationEvent"in window||(delete za.animationend.animation,delete za.animationiteration.animation,delete za.animationstart.animation),"TransitionEvent"in window||delete za.transitionend.transition);function ea(e){if(lu[e])return lu[e];if(!za[e])return e;var n=za[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Qh)return lu[e]=n[a];return e}var Wh=ea("animationend"),Zh=ea("animationiteration"),Jh=ea("animationstart"),g2=ea("transitionrun"),b2=ea("transitionstart"),v2=ea("transitioncancel"),Ph=ea("transitionend"),em=new Map,ru="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");ru.push("scrollEnd");function cl(e,n){em.set(e,n),En(n,[e])}var eo=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Jn=[],Ma=0,au=0;function to(){for(var e=Ma,n=au=Ma=0;n<e;){var a=Jn[n];Jn[n++]=null;var s=Jn[n];Jn[n++]=null;var h=Jn[n];Jn[n++]=null;var p=Jn[n];if(Jn[n++]=null,s!==null&&h!==null){var w=s.pending;w===null?h.next=h:(h.next=w.next,w.next=h),s.pending=h}p!==0&&tm(a,h,p)}}function no(e,n,a,s){Jn[Ma++]=e,Jn[Ma++]=n,Jn[Ma++]=a,Jn[Ma++]=s,au|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function iu(e,n,a,s){return no(e,n,a,s),lo(e)}function ta(e,n){return no(e,null,null,n),lo(e)}function tm(e,n,a){e.lanes|=a;var s=e.alternate;s!==null&&(s.lanes|=a);for(var h=!1,p=e.return;p!==null;)p.childLanes|=a,s=p.alternate,s!==null&&(s.childLanes|=a),p.tag===22&&(e=p.stateNode,e===null||e._visibility&1||(h=!0)),e=p,p=p.return;return e.tag===3?(p=e.stateNode,h&&n!==null&&(h=31-nt(a),e=p.hiddenUpdates,s=e[h],s===null?e[h]=[n]:s.push(n),n.lane=a|536870912),p):null}function lo(e){if(50<es)throw es=0,pf=null,Error(i(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Ra={};function w2(e,n,a,s){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Un(e,n,a,s){return new w2(e,n,a,s)}function su(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ul(e,n){var a=e.alternate;return a===null?(a=Un(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function nm(e,n){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function ro(e,n,a,s,h,p){var w=0;if(s=e,typeof e=="function")su(e)&&(w=1);else if(typeof e=="string")w=Eb(e,a,me.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ne:return e=Un(31,a,n,h),e.elementType=ne,e.lanes=p,e;case S:return na(a.children,h,p,n);case E:w=8,h|=24;break;case C:return e=Un(12,a,n,h|2),e.elementType=C,e.lanes=p,e;case L:return e=Un(13,a,n,h),e.elementType=L,e.lanes=p,e;case O:return e=Un(19,a,n,h),e.elementType=O,e.lanes=p,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case M:w=10;break e;case A:w=9;break e;case R:w=11;break e;case U:w=14;break e;case X:w=16,s=null;break e}w=29,a=Error(i(130,e===null?"null":typeof e,"")),s=null}return n=Un(w,a,n,h),n.elementType=e,n.type=s,n.lanes=p,n}function na(e,n,a,s){return e=Un(7,e,s,n),e.lanes=a,e}function ou(e,n,a){return e=Un(6,e,null,n),e.lanes=a,e}function lm(e){var n=Un(18,null,null,0);return n.stateNode=e,n}function cu(e,n,a){return n=Un(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var rm=new WeakMap;function Pn(e,n){if(typeof e=="object"&&e!==null){var a=rm.get(e);return a!==void 0?a:(n={value:e,source:n,stack:Re(n)},rm.set(e,n),n)}return{value:e,source:n,stack:Re(n)}}var Fa=[],_a=0,ao=null,Ri=0,el=[],tl=0,mr=null,bl=1,vl="";function Il(e,n){Fa[_a++]=Ri,Fa[_a++]=ao,ao=e,Ri=n}function am(e,n,a){el[tl++]=bl,el[tl++]=vl,el[tl++]=mr,mr=e;var s=bl;e=vl;var h=32-nt(s)-1;s&=~(1<<h),a+=1;var p=32-nt(n)+h;if(30<p){var w=h-h%5;p=(s&(1<<w)-1).toString(32),s>>=w,h-=w,bl=1<<32-nt(n)+h|a<<h|s,vl=p+e}else bl=1<<p|a<<h|s,vl=e}function uu(e){e.return!==null&&(Il(e,1),am(e,1,0))}function fu(e){for(;e===ao;)ao=Fa[--_a],Fa[_a]=null,Ri=Fa[--_a],Fa[_a]=null;for(;e===mr;)mr=el[--tl],el[tl]=null,vl=el[--tl],el[tl]=null,bl=el[--tl],el[tl]=null}function im(e,n){el[tl++]=bl,el[tl++]=vl,el[tl++]=mr,bl=n.id,vl=n.overflow,mr=e}var dn=null,_t=null,ut=!1,xr=null,nl=!1,du=Error(i(519));function pr(e){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Fi(Pn(n,e)),du}function sm(e){var n=e.stateNode,a=e.type,s=e.memoizedProps;switch(n[Lt]=e,n[un]=s,a){case"dialog":at("cancel",n),at("close",n);break;case"iframe":case"object":case"embed":at("load",n);break;case"video":case"audio":for(a=0;a<ns.length;a++)at(ns[a],n);break;case"source":at("error",n);break;case"img":case"image":case"link":at("error",n),at("load",n);break;case"details":at("toggle",n);break;case"input":at("invalid",n),vi(n,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":at("invalid",n);break;case"textarea":at("invalid",n),Qs(n,s.value,s.defaultValue,s.children)}a=s.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||s.suppressHydrationWarning===!0||jp(n.textContent,a)?(s.popover!=null&&(at("beforetoggle",n),at("toggle",n)),s.onScroll!=null&&at("scroll",n),s.onScrollEnd!=null&&at("scrollend",n),s.onClick!=null&&(n.onclick=Wn),n=!0):n=!1,n||pr(e,!0)}function om(e){for(dn=e.return;dn;)switch(dn.tag){case 5:case 31:case 13:nl=!1;return;case 27:case 3:nl=!0;return;default:dn=dn.return}}function Oa(e){if(e!==dn)return!1;if(!ut)return om(e),ut=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||zf(e.type,e.memoizedProps)),a=!a),a&&_t&&pr(e),om(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));_t=Rp(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));_t=Rp(e)}else n===27?(n=_t,Dr(e.type)?(e=Of,Of=null,_t=e):_t=n):_t=dn?rl(e.stateNode.nextSibling):null;return!0}function la(){_t=dn=null,ut=!1}function hu(){var e=xr;return e!==null&&(Rn===null?Rn=e:Rn.push.apply(Rn,e),xr=null),e}function Fi(e){xr===null?xr=[e]:xr.push(e)}var mu=B(null),ra=null,Yl=null;function yr(e,n,a){T(mu,n._currentValue),n._currentValue=a}function ql(e){e._currentValue=mu.current,W(mu)}function xu(e,n,a){for(;e!==null;){var s=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,s!==null&&(s.childLanes|=n)):s!==null&&(s.childLanes&n)!==n&&(s.childLanes|=n),e===a)break;e=e.return}}function pu(e,n,a,s){var h=e.child;for(h!==null&&(h.return=e);h!==null;){var p=h.dependencies;if(p!==null){var w=h.child;p=p.firstContext;e:for(;p!==null;){var N=p;p=h;for(var H=0;H<n.length;H++)if(N.context===n[H]){p.lanes|=a,N=p.alternate,N!==null&&(N.lanes|=a),xu(p.return,a,e),s||(w=null);break e}p=N.next}}else if(h.tag===18){if(w=h.return,w===null)throw Error(i(341));w.lanes|=a,p=w.alternate,p!==null&&(p.lanes|=a),xu(w,a,e),w=null}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===e){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}}function Ba(e,n,a,s){e=null;for(var h=n,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var w=h.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var N=h.type;Hn(h.pendingProps.value,w.value)||(e!==null?e.push(N):e=[N])}}else if(h===Oe.current){if(w=h.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(e!==null?e.push(ss):e=[ss])}h=h.return}e!==null&&pu(n,e,a,s),n.flags|=262144}function io(e){for(e=e.firstContext;e!==null;){if(!Hn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function aa(e){ra=e,Yl=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function hn(e){return cm(ra,e)}function so(e,n){return ra===null&&aa(e),cm(e,n)}function cm(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Yl===null){if(e===null)throw Error(i(308));Yl=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Yl=Yl.next=n;return a}var k2=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,s){e.push(s)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},S2=t.unstable_scheduleCallback,j2=t.unstable_NormalPriority,Jt={$$typeof:M,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function yu(){return{controller:new k2,data:new Map,refCount:0}}function _i(e){e.refCount--,e.refCount===0&&S2(j2,function(){e.controller.abort()})}var Oi=null,gu=0,La=0,$a=null;function C2(e,n){if(Oi===null){var a=Oi=[];gu=0,La=kf(),$a={status:"pending",value:void 0,then:function(s){a.push(s)}}}return gu++,n.then(um,um),n}function um(){if(--gu===0&&Oi!==null){$a!==null&&($a.status="fulfilled");var e=Oi;Oi=null,La=0,$a=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function E2(e,n){var a=[],s={status:"pending",value:null,reason:null,then:function(h){a.push(h)}};return e.then(function(){s.status="fulfilled",s.value=n;for(var h=0;h<a.length;h++)(0,a[h])(n)},function(h){for(s.status="rejected",s.reason=h,h=0;h<a.length;h++)(0,a[h])(void 0)}),s}var fm=I.S;I.S=function(e,n){Kx=pt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&C2(e,n),fm!==null&&fm(e,n)};var ia=B(null);function bu(){var e=ia.current;return e!==null?e:Tt.pooledCache}function oo(e,n){n===null?T(ia,ia.current):T(ia,n.pool)}function dm(){var e=bu();return e===null?null:{parent:Jt._currentValue,pool:e}}var Ha=Error(i(460)),vu=Error(i(474)),co=Error(i(542)),uo={then:function(){}};function hm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function mm(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(Wn,Wn),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,pm(e),e;default:if(typeof n.status=="string")n.then(Wn,Wn);else{if(e=Tt,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=n,e.status="pending",e.then(function(s){if(n.status==="pending"){var h=n;h.status="fulfilled",h.value=s}},function(s){if(n.status==="pending"){var h=n;h.status="rejected",h.reason=s}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,pm(e),e}throw oa=n,Ha}}function sa(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(oa=a,Ha):a}}var oa=null;function xm(){if(oa===null)throw Error(i(459));var e=oa;return oa=null,e}function pm(e){if(e===Ha||e===co)throw Error(i(483))}var Ua=null,Bi=0;function fo(e){var n=Bi;return Bi+=1,Ua===null&&(Ua=[]),mm(Ua,e,n)}function Li(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function ho(e,n){throw n.$$typeof===b?Error(i(525)):(e=Object.prototype.toString.call(n),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function ym(e){function n(K,q){if(e){var J=K.deletions;J===null?(K.deletions=[q],K.flags|=16):J.push(q)}}function a(K,q){if(!e)return null;for(;q!==null;)n(K,q),q=q.sibling;return null}function s(K){for(var q=new Map;K!==null;)K.key!==null?q.set(K.key,K):q.set(K.index,K),K=K.sibling;return q}function h(K,q){return K=Ul(K,q),K.index=0,K.sibling=null,K}function p(K,q,J){return K.index=J,e?(J=K.alternate,J!==null?(J=J.index,J<q?(K.flags|=67108866,q):J):(K.flags|=67108866,q)):(K.flags|=1048576,q)}function w(K){return e&&K.alternate===null&&(K.flags|=67108866),K}function N(K,q,J,oe){return q===null||q.tag!==6?(q=ou(J,K.mode,oe),q.return=K,q):(q=h(q,J),q.return=K,q)}function H(K,q,J,oe){var $e=J.type;return $e===S?se(K,q,J.props.children,oe,J.key):q!==null&&(q.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===X&&sa($e)===q.type)?(q=h(q,J.props),Li(q,J),q.return=K,q):(q=ro(J.type,J.key,J.props,null,K.mode,oe),Li(q,J),q.return=K,q)}function P(K,q,J,oe){return q===null||q.tag!==4||q.stateNode.containerInfo!==J.containerInfo||q.stateNode.implementation!==J.implementation?(q=cu(J,K.mode,oe),q.return=K,q):(q=h(q,J.children||[]),q.return=K,q)}function se(K,q,J,oe,$e){return q===null||q.tag!==7?(q=na(J,K.mode,oe,$e),q.return=K,q):(q=h(q,J),q.return=K,q)}function fe(K,q,J){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=ou(""+q,K.mode,J),q.return=K,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case v:return J=ro(q.type,q.key,q.props,null,K.mode,J),Li(J,q),J.return=K,J;case j:return q=cu(q,K.mode,J),q.return=K,q;case X:return q=sa(q),fe(K,q,J)}if(V(q)||F(q))return q=na(q,K.mode,J,null),q.return=K,q;if(typeof q.then=="function")return fe(K,fo(q),J);if(q.$$typeof===M)return fe(K,so(K,q),J);ho(K,q)}return null}function te(K,q,J,oe){var $e=q!==null?q.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return $e!==null?null:N(K,q,""+J,oe);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case v:return J.key===$e?H(K,q,J,oe):null;case j:return J.key===$e?P(K,q,J,oe):null;case X:return J=sa(J),te(K,q,J,oe)}if(V(J)||F(J))return $e!==null?null:se(K,q,J,oe,null);if(typeof J.then=="function")return te(K,q,fo(J),oe);if(J.$$typeof===M)return te(K,q,so(K,J),oe);ho(K,J)}return null}function le(K,q,J,oe,$e){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return K=K.get(J)||null,N(q,K,""+oe,$e);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case v:return K=K.get(oe.key===null?J:oe.key)||null,H(q,K,oe,$e);case j:return K=K.get(oe.key===null?J:oe.key)||null,P(q,K,oe,$e);case X:return oe=sa(oe),le(K,q,J,oe,$e)}if(V(oe)||F(oe))return K=K.get(J)||null,se(q,K,oe,$e,null);if(typeof oe.then=="function")return le(K,q,J,fo(oe),$e);if(oe.$$typeof===M)return le(K,q,J,so(q,oe),$e);ho(q,oe)}return null}function De(K,q,J,oe){for(var $e=null,dt=null,Fe=q,We=q=0,ot=null;Fe!==null&&We<J.length;We++){Fe.index>We?(ot=Fe,Fe=null):ot=Fe.sibling;var ht=te(K,Fe,J[We],oe);if(ht===null){Fe===null&&(Fe=ot);break}e&&Fe&&ht.alternate===null&&n(K,Fe),q=p(ht,q,We),dt===null?$e=ht:dt.sibling=ht,dt=ht,Fe=ot}if(We===J.length)return a(K,Fe),ut&&Il(K,We),$e;if(Fe===null){for(;We<J.length;We++)Fe=fe(K,J[We],oe),Fe!==null&&(q=p(Fe,q,We),dt===null?$e=Fe:dt.sibling=Fe,dt=Fe);return ut&&Il(K,We),$e}for(Fe=s(Fe);We<J.length;We++)ot=le(Fe,K,We,J[We],oe),ot!==null&&(e&&ot.alternate!==null&&Fe.delete(ot.key===null?We:ot.key),q=p(ot,q,We),dt===null?$e=ot:dt.sibling=ot,dt=ot);return e&&Fe.forEach(function(_r){return n(K,_r)}),ut&&Il(K,We),$e}function Ye(K,q,J,oe){if(J==null)throw Error(i(151));for(var $e=null,dt=null,Fe=q,We=q=0,ot=null,ht=J.next();Fe!==null&&!ht.done;We++,ht=J.next()){Fe.index>We?(ot=Fe,Fe=null):ot=Fe.sibling;var _r=te(K,Fe,ht.value,oe);if(_r===null){Fe===null&&(Fe=ot);break}e&&Fe&&_r.alternate===null&&n(K,Fe),q=p(_r,q,We),dt===null?$e=_r:dt.sibling=_r,dt=_r,Fe=ot}if(ht.done)return a(K,Fe),ut&&Il(K,We),$e;if(Fe===null){for(;!ht.done;We++,ht=J.next())ht=fe(K,ht.value,oe),ht!==null&&(q=p(ht,q,We),dt===null?$e=ht:dt.sibling=ht,dt=ht);return ut&&Il(K,We),$e}for(Fe=s(Fe);!ht.done;We++,ht=J.next())ht=le(Fe,K,We,ht.value,oe),ht!==null&&(e&&ht.alternate!==null&&Fe.delete(ht.key===null?We:ht.key),q=p(ht,q,We),dt===null?$e=ht:dt.sibling=ht,dt=ht);return e&&Fe.forEach(function(Bb){return n(K,Bb)}),ut&&Il(K,We),$e}function Nt(K,q,J,oe){if(typeof J=="object"&&J!==null&&J.type===S&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case v:e:{for(var $e=J.key;q!==null;){if(q.key===$e){if($e=J.type,$e===S){if(q.tag===7){a(K,q.sibling),oe=h(q,J.props.children),oe.return=K,K=oe;break e}}else if(q.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===X&&sa($e)===q.type){a(K,q.sibling),oe=h(q,J.props),Li(oe,J),oe.return=K,K=oe;break e}a(K,q);break}else n(K,q);q=q.sibling}J.type===S?(oe=na(J.props.children,K.mode,oe,J.key),oe.return=K,K=oe):(oe=ro(J.type,J.key,J.props,null,K.mode,oe),Li(oe,J),oe.return=K,K=oe)}return w(K);case j:e:{for($e=J.key;q!==null;){if(q.key===$e)if(q.tag===4&&q.stateNode.containerInfo===J.containerInfo&&q.stateNode.implementation===J.implementation){a(K,q.sibling),oe=h(q,J.children||[]),oe.return=K,K=oe;break e}else{a(K,q);break}else n(K,q);q=q.sibling}oe=cu(J,K.mode,oe),oe.return=K,K=oe}return w(K);case X:return J=sa(J),Nt(K,q,J,oe)}if(V(J))return De(K,q,J,oe);if(F(J)){if($e=F(J),typeof $e!="function")throw Error(i(150));return J=$e.call(J),Ye(K,q,J,oe)}if(typeof J.then=="function")return Nt(K,q,fo(J),oe);if(J.$$typeof===M)return Nt(K,q,so(K,J),oe);ho(K,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,q!==null&&q.tag===6?(a(K,q.sibling),oe=h(q,J),oe.return=K,K=oe):(a(K,q),oe=ou(J,K.mode,oe),oe.return=K,K=oe),w(K)):a(K,q)}return function(K,q,J,oe){try{Bi=0;var $e=Nt(K,q,J,oe);return Ua=null,$e}catch(Fe){if(Fe===Ha||Fe===co)throw Fe;var dt=Un(29,Fe,null,K.mode);return dt.lanes=oe,dt.return=K,dt}finally{}}}var ca=ym(!0),gm=ym(!1),gr=!1;function wu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ku(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function br(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function vr(e,n,a){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(yt&2)!==0){var h=s.pending;return h===null?n.next=n:(n.next=h.next,h.next=n),s.pending=n,n=lo(e),tm(e,null,a),n}return no(e,s,n,a),lo(e)}function $i(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var s=n.lanes;s&=e.pendingLanes,a|=s,n.lanes=a,Is(e,a)}}function Su(e,n){var a=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,a===s)){var h=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?h=p=w:p=p.next=w,a=a.next}while(a!==null);p===null?h=p=n:p=p.next=n}else h=p=n;a={baseState:s.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:s.shared,callbacks:s.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var ju=!1;function Hi(){if(ju){var e=$a;if(e!==null)throw e}}function Ui(e,n,a,s){ju=!1;var h=e.updateQueue;gr=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,N=h.shared.pending;if(N!==null){h.shared.pending=null;var H=N,P=H.next;H.next=null,w===null?p=P:w.next=P,w=H;var se=e.alternate;se!==null&&(se=se.updateQueue,N=se.lastBaseUpdate,N!==w&&(N===null?se.firstBaseUpdate=P:N.next=P,se.lastBaseUpdate=H))}if(p!==null){var fe=h.baseState;w=0,se=P=H=null,N=p;do{var te=N.lane&-536870913,le=te!==N.lane;if(le?(st&te)===te:(s&te)===te){te!==0&&te===La&&(ju=!0),se!==null&&(se=se.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var De=e,Ye=N;te=n;var Nt=a;switch(Ye.tag){case 1:if(De=Ye.payload,typeof De=="function"){fe=De.call(Nt,fe,te);break e}fe=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=Ye.payload,te=typeof De=="function"?De.call(Nt,fe,te):De,te==null)break e;fe=y({},fe,te);break e;case 2:gr=!0}}te=N.callback,te!==null&&(e.flags|=64,le&&(e.flags|=8192),le=h.callbacks,le===null?h.callbacks=[te]:le.push(te))}else le={lane:te,tag:N.tag,payload:N.payload,callback:N.callback,next:null},se===null?(P=se=le,H=fe):se=se.next=le,w|=te;if(N=N.next,N===null){if(N=h.shared.pending,N===null)break;le=N,N=le.next,le.next=null,h.lastBaseUpdate=le,h.shared.pending=null}}while(!0);se===null&&(H=fe),h.baseState=H,h.firstBaseUpdate=P,h.lastBaseUpdate=se,p===null&&(h.shared.lanes=0),Cr|=w,e.lanes=w,e.memoizedState=fe}}function bm(e,n){if(typeof e!="function")throw Error(i(191,e));e.call(n)}function vm(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)bm(a[e],n)}var Ia=B(null),mo=B(0);function wm(e,n){e=Pl,T(mo,e),T(Ia,n),Pl=e|n.baseLanes}function Cu(){T(mo,Pl),T(Ia,Ia.current)}function Eu(){Pl=mo.current,W(Ia),W(mo)}var In=B(null),ll=null;function wr(e){var n=e.alternate;T(Wt,Wt.current&1),T(In,e),ll===null&&(n===null||Ia.current!==null||n.memoizedState!==null)&&(ll=e)}function Nu(e){T(Wt,Wt.current),T(In,e),ll===null&&(ll=e)}function km(e){e.tag===22?(T(Wt,Wt.current),T(In,e),ll===null&&(ll=e)):kr()}function kr(){T(Wt,Wt.current),T(In,In.current)}function Yn(e){W(In),ll===e&&(ll=null),W(Wt)}var Wt=B(0);function xo(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Ff(a)||_f(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Xl=0,Qe=null,Ct=null,Pt=null,po=!1,Ya=!1,ua=!1,yo=0,Ii=0,qa=null,N2=0;function Gt(){throw Error(i(321))}function Au(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!Hn(e[a],n[a]))return!1;return!0}function Tu(e,n,a,s,h,p){return Xl=p,Qe=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,I.H=e===null||e.memoizedState===null?ax:qu,ua=!1,p=a(s,h),ua=!1,Ya&&(p=jm(n,a,s,h)),Sm(e),p}function Sm(e){I.H=Xi;var n=Ct!==null&&Ct.next!==null;if(Xl=0,Pt=Ct=Qe=null,po=!1,Ii=0,qa=null,n)throw Error(i(300));e===null||en||(e=e.dependencies,e!==null&&io(e)&&(en=!0))}function jm(e,n,a,s){Qe=e;var h=0;do{if(Ya&&(qa=null),Ii=0,Ya=!1,25<=h)throw Error(i(301));if(h+=1,Pt=Ct=null,e.updateQueue!=null){var p=e.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}I.H=ix,p=n(a,s)}while(Ya);return p}function A2(){var e=I.H,n=e.useState()[0];return n=typeof n.then=="function"?Yi(n):n,e=e.useState()[0],(Ct!==null?Ct.memoizedState:null)!==e&&(Qe.flags|=1024),n}function Du(){var e=yo!==0;return yo=0,e}function zu(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function Mu(e){if(po){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}po=!1}Xl=0,Pt=Ct=Qe=null,Ya=!1,Ii=yo=0,qa=null}function wn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pt===null?Qe.memoizedState=Pt=e:Pt=Pt.next=e,Pt}function Zt(){if(Ct===null){var e=Qe.alternate;e=e!==null?e.memoizedState:null}else e=Ct.next;var n=Pt===null?Qe.memoizedState:Pt.next;if(n!==null)Pt=n,Ct=e;else{if(e===null)throw Qe.alternate===null?Error(i(467)):Error(i(310));Ct=e,e={memoizedState:Ct.memoizedState,baseState:Ct.baseState,baseQueue:Ct.baseQueue,queue:Ct.queue,next:null},Pt===null?Qe.memoizedState=Pt=e:Pt=Pt.next=e}return Pt}function go(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Yi(e){var n=Ii;return Ii+=1,qa===null&&(qa=[]),e=mm(qa,e,n),n=Qe,(Pt===null?n.memoizedState:Pt.next)===null&&(n=n.alternate,I.H=n===null||n.memoizedState===null?ax:qu),e}function bo(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Yi(e);if(e.$$typeof===M)return hn(e)}throw Error(i(438,String(e)))}function Ru(e){var n=null,a=Qe.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var s=Qe.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(n={data:s.data.map(function(h){return h.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=go(),Qe.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),s=0;s<e;s++)a[s]=D;return n.index++,a}function Vl(e,n){return typeof n=="function"?n(e):n}function vo(e){var n=Zt();return Fu(n,Ct,e)}function Fu(e,n,a){var s=e.queue;if(s===null)throw Error(i(311));s.lastRenderedReducer=a;var h=e.baseQueue,p=s.pending;if(p!==null){if(h!==null){var w=h.next;h.next=p.next,p.next=w}n.baseQueue=h=p,s.pending=null}if(p=e.baseState,h===null)e.memoizedState=p;else{n=h.next;var N=w=null,H=null,P=n,se=!1;do{var fe=P.lane&-536870913;if(fe!==P.lane?(st&fe)===fe:(Xl&fe)===fe){var te=P.revertLane;if(te===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),fe===La&&(se=!0);else if((Xl&te)===te){P=P.next,te===La&&(se=!0);continue}else fe={lane:0,revertLane:P.revertLane,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},H===null?(N=H=fe,w=p):H=H.next=fe,Qe.lanes|=te,Cr|=te;fe=P.action,ua&&a(p,fe),p=P.hasEagerState?P.eagerState:a(p,fe)}else te={lane:fe,revertLane:P.revertLane,gesture:P.gesture,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},H===null?(N=H=te,w=p):H=H.next=te,Qe.lanes|=fe,Cr|=fe;P=P.next}while(P!==null&&P!==n);if(H===null?w=p:H.next=N,!Hn(p,e.memoizedState)&&(en=!0,se&&(a=$a,a!==null)))throw a;e.memoizedState=p,e.baseState=w,e.baseQueue=H,s.lastRenderedState=p}return h===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function _u(e){var n=Zt(),a=n.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=e;var s=a.dispatch,h=a.pending,p=n.memoizedState;if(h!==null){a.pending=null;var w=h=h.next;do p=e(p,w.action),w=w.next;while(w!==h);Hn(p,n.memoizedState)||(en=!0),n.memoizedState=p,n.baseQueue===null&&(n.baseState=p),a.lastRenderedState=p}return[p,s]}function Cm(e,n,a){var s=Qe,h=Zt(),p=ut;if(p){if(a===void 0)throw Error(i(407));a=a()}else a=n();var w=!Hn((Ct||h).memoizedState,a);if(w&&(h.memoizedState=a,en=!0),h=h.queue,Lu(Am.bind(null,s,h,e),[e]),h.getSnapshot!==n||w||Pt!==null&&Pt.memoizedState.tag&1){if(s.flags|=2048,Xa(9,{destroy:void 0},Nm.bind(null,s,h,a,n),null),Tt===null)throw Error(i(349));p||(Xl&127)!==0||Em(s,n,a)}return a}function Em(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Qe.updateQueue,n===null?(n=go(),Qe.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function Nm(e,n,a,s){n.value=a,n.getSnapshot=s,Tm(n)&&Dm(e)}function Am(e,n,a){return a(function(){Tm(n)&&Dm(e)})}function Tm(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!Hn(e,a)}catch{return!0}}function Dm(e){var n=ta(e,2);n!==null&&Fn(n,e,2)}function Ou(e){var n=wn();if(typeof e=="function"){var a=e;if(e=a(),ua){Mt(!0);try{a()}finally{Mt(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vl,lastRenderedState:e},n}function zm(e,n,a,s){return e.baseState=a,Fu(e,Ct,typeof s=="function"?s:Vl)}function T2(e,n,a,s,h){if(So(e))throw Error(i(485));if(e=n.action,e!==null){var p={payload:h,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){p.listeners.push(w)}};I.T!==null?a(!0):p.isTransition=!1,s(p),a=n.pending,a===null?(p.next=n.pending=p,Mm(n,p)):(p.next=a.next,n.pending=a.next=p)}}function Mm(e,n){var a=n.action,s=n.payload,h=e.state;if(n.isTransition){var p=I.T,w={};I.T=w;try{var N=a(h,s),H=I.S;H!==null&&H(w,N),Rm(e,n,N)}catch(P){Bu(e,n,P)}finally{p!==null&&w.types!==null&&(p.types=w.types),I.T=p}}else try{p=a(h,s),Rm(e,n,p)}catch(P){Bu(e,n,P)}}function Rm(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(s){Fm(e,n,s)},function(s){return Bu(e,n,s)}):Fm(e,n,a)}function Fm(e,n,a){n.status="fulfilled",n.value=a,_m(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,Mm(e,a)))}function Bu(e,n,a){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do n.status="rejected",n.reason=a,_m(n),n=n.next;while(n!==s)}e.action=null}function _m(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Om(e,n){return n}function Bm(e,n){if(ut){var a=Tt.formState;if(a!==null){e:{var s=Qe;if(ut){if(_t){t:{for(var h=_t,p=nl;h.nodeType!==8;){if(!p){h=null;break t}if(h=rl(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){_t=rl(h.nextSibling),s=h.data==="F!";break e}}pr(s)}s=!1}s&&(n=a[0])}}return a=wn(),a.memoizedState=a.baseState=n,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Om,lastRenderedState:n},a.queue=s,a=nx.bind(null,Qe,s),s.dispatch=a,s=Ou(!1),p=Yu.bind(null,Qe,!1,s.queue),s=wn(),h={state:n,dispatch:null,action:e,pending:null},s.queue=h,a=T2.bind(null,Qe,h,p,a),h.dispatch=a,s.memoizedState=e,[n,a,!1]}function Lm(e){var n=Zt();return $m(n,Ct,e)}function $m(e,n,a){if(n=Fu(e,n,Om)[0],e=vo(Vl)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var s=Yi(n)}catch(w){throw w===Ha?co:w}else s=n;n=Zt();var h=n.queue,p=h.dispatch;return a!==n.memoizedState&&(Qe.flags|=2048,Xa(9,{destroy:void 0},D2.bind(null,h,a),null)),[s,p,e]}function D2(e,n){e.action=n}function Hm(e){var n=Zt(),a=Ct;if(a!==null)return $m(n,a,e);Zt(),n=n.memoizedState,a=Zt();var s=a.queue.dispatch;return a.memoizedState=e,[n,s,!1]}function Xa(e,n,a,s){return e={tag:e,create:a,deps:s,inst:n,next:null},n=Qe.updateQueue,n===null&&(n=go(),Qe.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(s=a.next,a.next=e,e.next=s,n.lastEffect=e),e}function Um(){return Zt().memoizedState}function wo(e,n,a,s){var h=wn();Qe.flags|=e,h.memoizedState=Xa(1|n,{destroy:void 0},a,s===void 0?null:s)}function ko(e,n,a,s){var h=Zt();s=s===void 0?null:s;var p=h.memoizedState.inst;Ct!==null&&s!==null&&Au(s,Ct.memoizedState.deps)?h.memoizedState=Xa(n,p,a,s):(Qe.flags|=e,h.memoizedState=Xa(1|n,p,a,s))}function Im(e,n){wo(8390656,8,e,n)}function Lu(e,n){ko(2048,8,e,n)}function z2(e){Qe.flags|=4;var n=Qe.updateQueue;if(n===null)n=go(),Qe.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function Ym(e){var n=Zt().memoizedState;return z2({ref:n,nextImpl:e}),function(){if((yt&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function qm(e,n){return ko(4,2,e,n)}function Xm(e,n){return ko(4,4,e,n)}function Vm(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Gm(e,n,a){a=a!=null?a.concat([e]):null,ko(4,4,Vm.bind(null,n,e),a)}function $u(){}function Km(e,n){var a=Zt();n=n===void 0?null:n;var s=a.memoizedState;return n!==null&&Au(n,s[1])?s[0]:(a.memoizedState=[e,n],e)}function Qm(e,n){var a=Zt();n=n===void 0?null:n;var s=a.memoizedState;if(n!==null&&Au(n,s[1]))return s[0];if(s=e(),ua){Mt(!0);try{e()}finally{Mt(!1)}}return a.memoizedState=[s,n],s}function Hu(e,n,a){return a===void 0||(Xl&1073741824)!==0&&(st&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Wx(),Qe.lanes|=e,Cr|=e,a)}function Wm(e,n,a,s){return Hn(a,n)?a:Ia.current!==null?(e=Hu(e,a,s),Hn(e,n)||(en=!0),e):(Xl&42)===0||(Xl&1073741824)!==0&&(st&261930)===0?(en=!0,e.memoizedState=a):(e=Wx(),Qe.lanes|=e,Cr|=e,n)}function Zm(e,n,a,s,h){var p=Z.p;Z.p=p!==0&&8>p?p:8;var w=I.T,N={};I.T=N,Yu(e,!1,n,a);try{var H=h(),P=I.S;if(P!==null&&P(N,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var se=E2(H,s);qi(e,n,se,Vn(e))}else qi(e,n,s,Vn(e))}catch(fe){qi(e,n,{then:function(){},status:"rejected",reason:fe},Vn())}finally{Z.p=p,w!==null&&N.types!==null&&(w.types=N.types),I.T=w}}function M2(){}function Uu(e,n,a,s){if(e.tag!==5)throw Error(i(476));var h=Jm(e).queue;Zm(e,h,n,ce,a===null?M2:function(){return Pm(e),a(s)})}function Jm(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vl,lastRenderedState:ce},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vl,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Pm(e){var n=Jm(e);n.next===null&&(n=e.alternate.memoizedState),qi(e,n.next.queue,{},Vn())}function Iu(){return hn(ss)}function ex(){return Zt().memoizedState}function tx(){return Zt().memoizedState}function R2(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=Vn();e=br(a);var s=vr(n,e,a);s!==null&&(Fn(s,n,a),$i(s,n,a)),n={cache:yu()},e.payload=n;return}n=n.return}}function F2(e,n,a){var s=Vn();a={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},So(e)?lx(n,a):(a=iu(e,n,a,s),a!==null&&(Fn(a,e,s),rx(a,n,s)))}function nx(e,n,a){var s=Vn();qi(e,n,a,s)}function qi(e,n,a,s){var h={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(So(e))lx(n,h);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var w=n.lastRenderedState,N=p(w,a);if(h.hasEagerState=!0,h.eagerState=N,Hn(N,w))return no(e,n,h,0),Tt===null&&to(),!1}catch{}finally{}if(a=iu(e,n,h,s),a!==null)return Fn(a,e,s),rx(a,n,s),!0}return!1}function Yu(e,n,a,s){if(s={lane:2,revertLane:kf(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},So(e)){if(n)throw Error(i(479))}else n=iu(e,a,s,2),n!==null&&Fn(n,e,2)}function So(e){var n=e.alternate;return e===Qe||n!==null&&n===Qe}function lx(e,n){Ya=po=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function rx(e,n,a){if((a&4194048)!==0){var s=n.lanes;s&=e.pendingLanes,a|=s,n.lanes=a,Is(e,a)}}var Xi={readContext:hn,use:bo,useCallback:Gt,useContext:Gt,useEffect:Gt,useImperativeHandle:Gt,useLayoutEffect:Gt,useInsertionEffect:Gt,useMemo:Gt,useReducer:Gt,useRef:Gt,useState:Gt,useDebugValue:Gt,useDeferredValue:Gt,useTransition:Gt,useSyncExternalStore:Gt,useId:Gt,useHostTransitionStatus:Gt,useFormState:Gt,useActionState:Gt,useOptimistic:Gt,useMemoCache:Gt,useCacheRefresh:Gt};Xi.useEffectEvent=Gt;var ax={readContext:hn,use:bo,useCallback:function(e,n){return wn().memoizedState=[e,n===void 0?null:n],e},useContext:hn,useEffect:Im,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,wo(4194308,4,Vm.bind(null,n,e),a)},useLayoutEffect:function(e,n){return wo(4194308,4,e,n)},useInsertionEffect:function(e,n){wo(4,2,e,n)},useMemo:function(e,n){var a=wn();n=n===void 0?null:n;var s=e();if(ua){Mt(!0);try{e()}finally{Mt(!1)}}return a.memoizedState=[s,n],s},useReducer:function(e,n,a){var s=wn();if(a!==void 0){var h=a(n);if(ua){Mt(!0);try{a(n)}finally{Mt(!1)}}}else h=n;return s.memoizedState=s.baseState=h,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:h},s.queue=e,e=e.dispatch=F2.bind(null,Qe,e),[s.memoizedState,e]},useRef:function(e){var n=wn();return e={current:e},n.memoizedState=e},useState:function(e){e=Ou(e);var n=e.queue,a=nx.bind(null,Qe,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:$u,useDeferredValue:function(e,n){var a=wn();return Hu(a,e,n)},useTransition:function(){var e=Ou(!1);return e=Zm.bind(null,Qe,e.queue,!0,!1),wn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var s=Qe,h=wn();if(ut){if(a===void 0)throw Error(i(407));a=a()}else{if(a=n(),Tt===null)throw Error(i(349));(st&127)!==0||Em(s,n,a)}h.memoizedState=a;var p={value:a,getSnapshot:n};return h.queue=p,Im(Am.bind(null,s,p,e),[e]),s.flags|=2048,Xa(9,{destroy:void 0},Nm.bind(null,s,p,a,n),null),a},useId:function(){var e=wn(),n=Tt.identifierPrefix;if(ut){var a=vl,s=bl;a=(s&~(1<<32-nt(s)-1)).toString(32)+a,n="_"+n+"R_"+a,a=yo++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=N2++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Iu,useFormState:Bm,useActionState:Bm,useOptimistic:function(e){var n=wn();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Yu.bind(null,Qe,!0,a),a.dispatch=n,[e,n]},useMemoCache:Ru,useCacheRefresh:function(){return wn().memoizedState=R2.bind(null,Qe)},useEffectEvent:function(e){var n=wn(),a={impl:e};return n.memoizedState=a,function(){if((yt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},qu={readContext:hn,use:bo,useCallback:Km,useContext:hn,useEffect:Lu,useImperativeHandle:Gm,useInsertionEffect:qm,useLayoutEffect:Xm,useMemo:Qm,useReducer:vo,useRef:Um,useState:function(){return vo(Vl)},useDebugValue:$u,useDeferredValue:function(e,n){var a=Zt();return Wm(a,Ct.memoizedState,e,n)},useTransition:function(){var e=vo(Vl)[0],n=Zt().memoizedState;return[typeof e=="boolean"?e:Yi(e),n]},useSyncExternalStore:Cm,useId:ex,useHostTransitionStatus:Iu,useFormState:Lm,useActionState:Lm,useOptimistic:function(e,n){var a=Zt();return zm(a,Ct,e,n)},useMemoCache:Ru,useCacheRefresh:tx};qu.useEffectEvent=Ym;var ix={readContext:hn,use:bo,useCallback:Km,useContext:hn,useEffect:Lu,useImperativeHandle:Gm,useInsertionEffect:qm,useLayoutEffect:Xm,useMemo:Qm,useReducer:_u,useRef:Um,useState:function(){return _u(Vl)},useDebugValue:$u,useDeferredValue:function(e,n){var a=Zt();return Ct===null?Hu(a,e,n):Wm(a,Ct.memoizedState,e,n)},useTransition:function(){var e=_u(Vl)[0],n=Zt().memoizedState;return[typeof e=="boolean"?e:Yi(e),n]},useSyncExternalStore:Cm,useId:ex,useHostTransitionStatus:Iu,useFormState:Hm,useActionState:Hm,useOptimistic:function(e,n){var a=Zt();return Ct!==null?zm(a,Ct,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Ru,useCacheRefresh:tx};ix.useEffectEvent=Ym;function Xu(e,n,a,s){n=e.memoizedState,a=a(s,n),a=a==null?n:y({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Vu={enqueueSetState:function(e,n,a){e=e._reactInternals;var s=Vn(),h=br(s);h.payload=n,a!=null&&(h.callback=a),n=vr(e,h,s),n!==null&&(Fn(n,e,s),$i(n,e,s))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var s=Vn(),h=br(s);h.tag=1,h.payload=n,a!=null&&(h.callback=a),n=vr(e,h,s),n!==null&&(Fn(n,e,s),$i(n,e,s))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=Vn(),s=br(a);s.tag=2,n!=null&&(s.callback=n),n=vr(e,s,a),n!==null&&(Fn(n,e,a),$i(n,e,a))}};function sx(e,n,a,s,h,p,w){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,p,w):n.prototype&&n.prototype.isPureReactComponent?!zi(a,s)||!zi(h,p):!0}function ox(e,n,a,s){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,s),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,s),n.state!==e&&Vu.enqueueReplaceState(n,n.state,null)}function fa(e,n){var a=n;if("ref"in n){a={};for(var s in n)s!=="ref"&&(a[s]=n[s])}if(e=e.defaultProps){a===n&&(a=y({},a));for(var h in e)a[h]===void 0&&(a[h]=e[h])}return a}function cx(e){eo(e)}function ux(e){console.error(e)}function fx(e){eo(e)}function jo(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(s){setTimeout(function(){throw s})}}function dx(e,n,a){try{var s=e.onCaughtError;s(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Gu(e,n,a){return a=br(a),a.tag=3,a.payload={element:null},a.callback=function(){jo(e,n)},a}function hx(e){return e=br(e),e.tag=3,e}function mx(e,n,a,s){var h=a.type.getDerivedStateFromError;if(typeof h=="function"){var p=s.value;e.payload=function(){return h(p)},e.callback=function(){dx(n,a,s)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(e.callback=function(){dx(n,a,s),typeof h!="function"&&(Er===null?Er=new Set([this]):Er.add(this));var N=s.stack;this.componentDidCatch(s.value,{componentStack:N!==null?N:""})})}function _2(e,n,a,s,h){if(a.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(n=a.alternate,n!==null&&Ba(n,a,h,!0),a=In.current,a!==null){switch(a.tag){case 31:case 13:return ll===null?Oo():a.alternate===null&&Kt===0&&(Kt=3),a.flags&=-257,a.flags|=65536,a.lanes=h,s===uo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([s]):n.add(s),bf(e,s,h)),!1;case 22:return a.flags|=65536,s===uo?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([s])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([s]):a.add(s)),bf(e,s,h)),!1}throw Error(i(435,a.tag))}return bf(e,s,h),Oo(),!1}if(ut)return n=In.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=h,s!==du&&(e=Error(i(422),{cause:s}),Fi(Pn(e,a)))):(s!==du&&(n=Error(i(423),{cause:s}),Fi(Pn(n,a))),e=e.current.alternate,e.flags|=65536,h&=-h,e.lanes|=h,s=Pn(s,a),h=Gu(e.stateNode,s,h),Su(e,h),Kt!==4&&(Kt=2)),!1;var p=Error(i(520),{cause:s});if(p=Pn(p,a),Pi===null?Pi=[p]:Pi.push(p),Kt!==4&&(Kt=2),n===null)return!0;s=Pn(s,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=h&-h,a.lanes|=e,e=Gu(a.stateNode,s,e),Su(a,e),!1;case 1:if(n=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Er===null||!Er.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=hx(h),mx(h,e,a,s),Su(a,h),!1}a=a.return}while(a!==null);return!1}var Ku=Error(i(461)),en=!1;function mn(e,n,a,s){n.child=e===null?gm(n,null,a,s):ca(n,e.child,a,s)}function xx(e,n,a,s,h){a=a.render;var p=n.ref;if("ref"in s){var w={};for(var N in s)N!=="ref"&&(w[N]=s[N])}else w=s;return aa(n),s=Tu(e,n,a,w,p,h),N=Du(),e!==null&&!en?(zu(e,n,h),Gl(e,n,h)):(ut&&N&&uu(n),n.flags|=1,mn(e,n,s,h),n.child)}function px(e,n,a,s,h){if(e===null){var p=a.type;return typeof p=="function"&&!su(p)&&p.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=p,yx(e,n,p,s,h)):(e=ro(a.type,null,s,n,n.mode,h),e.ref=n.ref,e.return=n,n.child=e)}if(p=e.child,!nf(e,h)){var w=p.memoizedProps;if(a=a.compare,a=a!==null?a:zi,a(w,s)&&e.ref===n.ref)return Gl(e,n,h)}return n.flags|=1,e=Ul(p,s),e.ref=n.ref,e.return=n,n.child=e}function yx(e,n,a,s,h){if(e!==null){var p=e.memoizedProps;if(zi(p,s)&&e.ref===n.ref)if(en=!1,n.pendingProps=s=p,nf(e,h))(e.flags&131072)!==0&&(en=!0);else return n.lanes=e.lanes,Gl(e,n,h)}return Qu(e,n,a,s,h)}function gx(e,n,a,s){var h=s.children,p=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((n.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,e!==null){for(s=n.child=e.child,h=0;s!==null;)h=h|s.lanes|s.childLanes,s=s.sibling;s=h&~p}else s=0,n.child=null;return bx(e,n,p,a,s)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&oo(n,p!==null?p.cachePool:null),p!==null?wm(n,p):Cu(),km(n);else return s=n.lanes=536870912,bx(e,n,p!==null?p.baseLanes|a:a,a,s)}else p!==null?(oo(n,p.cachePool),wm(n,p),kr(),n.memoizedState=null):(e!==null&&oo(n,null),Cu(),kr());return mn(e,n,h,a),n.child}function Vi(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function bx(e,n,a,s,h){var p=bu();return p=p===null?null:{parent:Jt._currentValue,pool:p},n.memoizedState={baseLanes:a,cachePool:p},e!==null&&oo(n,null),Cu(),km(n),e!==null&&Ba(e,n,s,!0),n.childLanes=h,null}function Co(e,n){return n=No({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function vx(e,n,a){return ca(n,e.child,null,a),e=Co(n,n.pendingProps),e.flags|=2,Yn(n),n.memoizedState=null,e}function O2(e,n,a){var s=n.pendingProps,h=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(ut){if(s.mode==="hidden")return e=Co(n,s),n.lanes=536870912,Vi(null,e);if(Nu(n),(e=_t)?(e=Mp(e,nl),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:mr!==null?{id:bl,overflow:vl}:null,retryLane:536870912,hydrationErrors:null},a=lm(e),a.return=n,n.child=a,dn=n,_t=null)):e=null,e===null)throw pr(n);return n.lanes=536870912,null}return Co(n,s)}var p=e.memoizedState;if(p!==null){var w=p.dehydrated;if(Nu(n),h)if(n.flags&256)n.flags&=-257,n=vx(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(i(558));else if(en||Ba(e,n,a,!1),h=(a&e.childLanes)!==0,en||h){if(s=Tt,s!==null&&(w=Fl(s,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,ta(e,w),Fn(s,e,w),Ku;Oo(),n=vx(e,n,a)}else e=p.treeContext,_t=rl(w.nextSibling),dn=n,ut=!0,xr=null,nl=!1,e!==null&&im(n,e),n=Co(n,s),n.flags|=4096;return n}return e=Ul(e.child,{mode:s.mode,children:s.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Eo(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Qu(e,n,a,s,h){return aa(n),a=Tu(e,n,a,s,void 0,h),s=Du(),e!==null&&!en?(zu(e,n,h),Gl(e,n,h)):(ut&&s&&uu(n),n.flags|=1,mn(e,n,a,h),n.child)}function wx(e,n,a,s,h,p){return aa(n),n.updateQueue=null,a=jm(n,s,a,h),Sm(e),s=Du(),e!==null&&!en?(zu(e,n,p),Gl(e,n,p)):(ut&&s&&uu(n),n.flags|=1,mn(e,n,a,p),n.child)}function kx(e,n,a,s,h){if(aa(n),n.stateNode===null){var p=Ra,w=a.contextType;typeof w=="object"&&w!==null&&(p=hn(w)),p=new a(s,p),n.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Vu,n.stateNode=p,p._reactInternals=n,p=n.stateNode,p.props=s,p.state=n.memoizedState,p.refs={},wu(n),w=a.contextType,p.context=typeof w=="object"&&w!==null?hn(w):Ra,p.state=n.memoizedState,w=a.getDerivedStateFromProps,typeof w=="function"&&(Xu(n,a,w,s),p.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(w=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),w!==p.state&&Vu.enqueueReplaceState(p,p.state,null),Ui(n,s,p,h),Hi(),p.state=n.memoizedState),typeof p.componentDidMount=="function"&&(n.flags|=4194308),s=!0}else if(e===null){p=n.stateNode;var N=n.memoizedProps,H=fa(a,N);p.props=H;var P=p.context,se=a.contextType;w=Ra,typeof se=="object"&&se!==null&&(w=hn(se));var fe=a.getDerivedStateFromProps;se=typeof fe=="function"||typeof p.getSnapshotBeforeUpdate=="function",N=n.pendingProps!==N,se||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(N||P!==w)&&ox(n,p,s,w),gr=!1;var te=n.memoizedState;p.state=te,Ui(n,s,p,h),Hi(),P=n.memoizedState,N||te!==P||gr?(typeof fe=="function"&&(Xu(n,a,fe,s),P=n.memoizedState),(H=gr||sx(n,a,H,s,te,P,w))?(se||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(n.flags|=4194308)):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=s,n.memoizedState=P),p.props=s,p.state=P,p.context=w,s=H):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),s=!1)}else{p=n.stateNode,ku(e,n),w=n.memoizedProps,se=fa(a,w),p.props=se,fe=n.pendingProps,te=p.context,P=a.contextType,H=Ra,typeof P=="object"&&P!==null&&(H=hn(P)),N=a.getDerivedStateFromProps,(P=typeof N=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==fe||te!==H)&&ox(n,p,s,H),gr=!1,te=n.memoizedState,p.state=te,Ui(n,s,p,h),Hi();var le=n.memoizedState;w!==fe||te!==le||gr||e!==null&&e.dependencies!==null&&io(e.dependencies)?(typeof N=="function"&&(Xu(n,a,N,s),le=n.memoizedState),(se=gr||sx(n,a,se,s,te,le,H)||e!==null&&e.dependencies!==null&&io(e.dependencies))?(P||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(s,le,H),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(s,le,H)),typeof p.componentDidUpdate=="function"&&(n.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=1024),n.memoizedProps=s,n.memoizedState=le),p.props=s,p.state=le,p.context=H,s=se):(typeof p.componentDidUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&te===e.memoizedState||(n.flags|=1024),s=!1)}return p=s,Eo(e,n),s=(n.flags&128)!==0,p||s?(p=n.stateNode,a=s&&typeof a.getDerivedStateFromError!="function"?null:p.render(),n.flags|=1,e!==null&&s?(n.child=ca(n,e.child,null,h),n.child=ca(n,null,a,h)):mn(e,n,a,h),n.memoizedState=p.state,e=n.child):e=Gl(e,n,h),e}function Sx(e,n,a,s){return la(),n.flags|=256,mn(e,n,a,s),n.child}var Wu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Zu(e){return{baseLanes:e,cachePool:dm()}}function Ju(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=Xn),e}function jx(e,n,a){var s=n.pendingProps,h=!1,p=(n.flags&128)!==0,w;if((w=p)||(w=e!==null&&e.memoizedState===null?!1:(Wt.current&2)!==0),w&&(h=!0,n.flags&=-129),w=(n.flags&32)!==0,n.flags&=-33,e===null){if(ut){if(h?wr(n):kr(),(e=_t)?(e=Mp(e,nl),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:mr!==null?{id:bl,overflow:vl}:null,retryLane:536870912,hydrationErrors:null},a=lm(e),a.return=n,n.child=a,dn=n,_t=null)):e=null,e===null)throw pr(n);return _f(e)?n.lanes=32:n.lanes=536870912,null}var N=s.children;return s=s.fallback,h?(kr(),h=n.mode,N=No({mode:"hidden",children:N},h),s=na(s,h,a,null),N.return=n,s.return=n,N.sibling=s,n.child=N,s=n.child,s.memoizedState=Zu(a),s.childLanes=Ju(e,w,a),n.memoizedState=Wu,Vi(null,s)):(wr(n),Pu(n,N))}var H=e.memoizedState;if(H!==null&&(N=H.dehydrated,N!==null)){if(p)n.flags&256?(wr(n),n.flags&=-257,n=ef(e,n,a)):n.memoizedState!==null?(kr(),n.child=e.child,n.flags|=128,n=null):(kr(),N=s.fallback,h=n.mode,s=No({mode:"visible",children:s.children},h),N=na(N,h,a,null),N.flags|=2,s.return=n,N.return=n,s.sibling=N,n.child=s,ca(n,e.child,null,a),s=n.child,s.memoizedState=Zu(a),s.childLanes=Ju(e,w,a),n.memoizedState=Wu,n=Vi(null,s));else if(wr(n),_f(N)){if(w=N.nextSibling&&N.nextSibling.dataset,w)var P=w.dgst;w=P,s=Error(i(419)),s.stack="",s.digest=w,Fi({value:s,source:null,stack:null}),n=ef(e,n,a)}else if(en||Ba(e,n,a,!1),w=(a&e.childLanes)!==0,en||w){if(w=Tt,w!==null&&(s=Fl(w,a),s!==0&&s!==H.retryLane))throw H.retryLane=s,ta(e,s),Fn(w,e,s),Ku;Ff(N)||Oo(),n=ef(e,n,a)}else Ff(N)?(n.flags|=192,n.child=e.child,n=null):(e=H.treeContext,_t=rl(N.nextSibling),dn=n,ut=!0,xr=null,nl=!1,e!==null&&im(n,e),n=Pu(n,s.children),n.flags|=4096);return n}return h?(kr(),N=s.fallback,h=n.mode,H=e.child,P=H.sibling,s=Ul(H,{mode:"hidden",children:s.children}),s.subtreeFlags=H.subtreeFlags&65011712,P!==null?N=Ul(P,N):(N=na(N,h,a,null),N.flags|=2),N.return=n,s.return=n,s.sibling=N,n.child=s,Vi(null,s),s=n.child,N=e.child.memoizedState,N===null?N=Zu(a):(h=N.cachePool,h!==null?(H=Jt._currentValue,h=h.parent!==H?{parent:H,pool:H}:h):h=dm(),N={baseLanes:N.baseLanes|a,cachePool:h}),s.memoizedState=N,s.childLanes=Ju(e,w,a),n.memoizedState=Wu,Vi(e.child,s)):(wr(n),a=e.child,e=a.sibling,a=Ul(a,{mode:"visible",children:s.children}),a.return=n,a.sibling=null,e!==null&&(w=n.deletions,w===null?(n.deletions=[e],n.flags|=16):w.push(e)),n.child=a,n.memoizedState=null,a)}function Pu(e,n){return n=No({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function No(e,n){return e=Un(22,e,null,n),e.lanes=0,e}function ef(e,n,a){return ca(n,e.child,null,a),e=Pu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Cx(e,n,a){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n),xu(e.return,n,a)}function tf(e,n,a,s,h,p){var w=e.memoizedState;w===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:s,tail:a,tailMode:h,treeForkCount:p}:(w.isBackwards=n,w.rendering=null,w.renderingStartTime=0,w.last=s,w.tail=a,w.tailMode=h,w.treeForkCount=p)}function Ex(e,n,a){var s=n.pendingProps,h=s.revealOrder,p=s.tail;s=s.children;var w=Wt.current,N=(w&2)!==0;if(N?(w=w&1|2,n.flags|=128):w&=1,T(Wt,w),mn(e,n,s,a),s=ut?Ri:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cx(e,a,n);else if(e.tag===19)Cx(e,a,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(h){case"forwards":for(a=n.child,h=null;a!==null;)e=a.alternate,e!==null&&xo(e)===null&&(h=a),a=a.sibling;a=h,a===null?(h=n.child,n.child=null):(h=a.sibling,a.sibling=null),tf(n,!1,h,a,p,s);break;case"backwards":case"unstable_legacy-backwards":for(a=null,h=n.child,n.child=null;h!==null;){if(e=h.alternate,e!==null&&xo(e)===null){n.child=h;break}e=h.sibling,h.sibling=a,a=h,h=e}tf(n,!0,a,null,p,s);break;case"together":tf(n,!1,null,null,void 0,s);break;default:n.memoizedState=null}return n.child}function Gl(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),Cr|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(Ba(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(i(153));if(n.child!==null){for(e=n.child,a=Ul(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Ul(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function nf(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&io(e)))}function B2(e,n,a){switch(n.tag){case 3:He(n,n.stateNode.containerInfo),yr(n,Jt,e.memoizedState.cache),la();break;case 27:case 5:ke(n);break;case 4:He(n,n.stateNode.containerInfo);break;case 10:yr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Nu(n),null;break;case 13:var s=n.memoizedState;if(s!==null)return s.dehydrated!==null?(wr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?jx(e,n,a):(wr(n),e=Gl(e,n,a),e!==null?e.sibling:null);wr(n);break;case 19:var h=(e.flags&128)!==0;if(s=(a&n.childLanes)!==0,s||(Ba(e,n,a,!1),s=(a&n.childLanes)!==0),h){if(s)return Ex(e,n,a);n.flags|=128}if(h=n.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),T(Wt,Wt.current),s)break;return null;case 22:return n.lanes=0,gx(e,n,a,n.pendingProps);case 24:yr(n,Jt,e.memoizedState.cache)}return Gl(e,n,a)}function Nx(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)en=!0;else{if(!nf(e,a)&&(n.flags&128)===0)return en=!1,B2(e,n,a);en=(e.flags&131072)!==0}else en=!1,ut&&(n.flags&1048576)!==0&&am(n,Ri,n.index);switch(n.lanes=0,n.tag){case 16:e:{var s=n.pendingProps;if(e=sa(n.elementType),n.type=e,typeof e=="function")su(e)?(s=fa(e,s),n.tag=1,n=kx(null,n,e,s,a)):(n.tag=0,n=Qu(null,n,e,s,a));else{if(e!=null){var h=e.$$typeof;if(h===R){n.tag=11,n=xx(null,n,e,s,a);break e}else if(h===U){n.tag=14,n=px(null,n,e,s,a);break e}}throw n=ee(e)||e,Error(i(306,n,""))}}return n;case 0:return Qu(e,n,n.type,n.pendingProps,a);case 1:return s=n.type,h=fa(s,n.pendingProps),kx(e,n,s,h,a);case 3:e:{if(He(n,n.stateNode.containerInfo),e===null)throw Error(i(387));s=n.pendingProps;var p=n.memoizedState;h=p.element,ku(e,n),Ui(n,s,null,a);var w=n.memoizedState;if(s=w.cache,yr(n,Jt,s),s!==p.cache&&pu(n,[Jt],a,!0),Hi(),s=w.element,p.isDehydrated)if(p={element:s,isDehydrated:!1,cache:w.cache},n.updateQueue.baseState=p,n.memoizedState=p,n.flags&256){n=Sx(e,n,s,a);break e}else if(s!==h){h=Pn(Error(i(424)),n),Fi(h),n=Sx(e,n,s,a);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(_t=rl(e.firstChild),dn=n,ut=!0,xr=null,nl=!0,a=gm(n,null,s,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(la(),s===h){n=Gl(e,n,a);break e}mn(e,n,s,a)}n=n.child}return n;case 26:return Eo(e,n),e===null?(a=Lp(n.type,null,n.pendingProps,null))?n.memoizedState=a:ut||(a=n.type,e=n.pendingProps,s=Yo(Ee.current).createElement(a),s[Lt]=n,s[un]=e,xn(s,a,e),Rt(s),n.stateNode=s):n.memoizedState=Lp(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return ke(n),e===null&&ut&&(s=n.stateNode=_p(n.type,n.pendingProps,Ee.current),dn=n,nl=!0,h=_t,Dr(n.type)?(Of=h,_t=rl(s.firstChild)):_t=h),mn(e,n,n.pendingProps.children,a),Eo(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&ut&&((h=s=_t)&&(s=hb(s,n.type,n.pendingProps,nl),s!==null?(n.stateNode=s,dn=n,_t=rl(s.firstChild),nl=!1,h=!0):h=!1),h||pr(n)),ke(n),h=n.type,p=n.pendingProps,w=e!==null?e.memoizedProps:null,s=p.children,zf(h,p)?s=null:w!==null&&zf(h,w)&&(n.flags|=32),n.memoizedState!==null&&(h=Tu(e,n,A2,null,null,a),ss._currentValue=h),Eo(e,n),mn(e,n,s,a),n.child;case 6:return e===null&&ut&&((e=a=_t)&&(a=mb(a,n.pendingProps,nl),a!==null?(n.stateNode=a,dn=n,_t=null,e=!0):e=!1),e||pr(n)),null;case 13:return jx(e,n,a);case 4:return He(n,n.stateNode.containerInfo),s=n.pendingProps,e===null?n.child=ca(n,null,s,a):mn(e,n,s,a),n.child;case 11:return xx(e,n,n.type,n.pendingProps,a);case 7:return mn(e,n,n.pendingProps,a),n.child;case 8:return mn(e,n,n.pendingProps.children,a),n.child;case 12:return mn(e,n,n.pendingProps.children,a),n.child;case 10:return s=n.pendingProps,yr(n,n.type,s.value),mn(e,n,s.children,a),n.child;case 9:return h=n.type._context,s=n.pendingProps.children,aa(n),h=hn(h),s=s(h),n.flags|=1,mn(e,n,s,a),n.child;case 14:return px(e,n,n.type,n.pendingProps,a);case 15:return yx(e,n,n.type,n.pendingProps,a);case 19:return Ex(e,n,a);case 31:return O2(e,n,a);case 22:return gx(e,n,a,n.pendingProps);case 24:return aa(n),s=hn(Jt),e===null?(h=bu(),h===null&&(h=Tt,p=yu(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),n.memoizedState={parent:s,cache:h},wu(n),yr(n,Jt,h)):((e.lanes&a)!==0&&(ku(e,n),Ui(n,null,null,a),Hi()),h=e.memoizedState,p=n.memoizedState,h.parent!==s?(h={parent:s,cache:s},n.memoizedState=h,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=h),yr(n,Jt,s)):(s=p.cache,yr(n,Jt,s),s!==h.cache&&pu(n,[Jt],a,!0))),mn(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function Kl(e){e.flags|=4}function lf(e,n,a,s,h){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(h&335544128)===h)if(e.stateNode.complete)e.flags|=8192;else if(ep())e.flags|=8192;else throw oa=uo,vu}else e.flags&=-16777217}function Ax(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Yp(n))if(ep())e.flags|=8192;else throw oa=uo,vu}function Ao(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Us():536870912,e.lanes|=n,Qa|=n)}function Gi(e,n){if(!ut)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var s=null;a!==null;)a.alternate!==null&&(s=a),a=a.sibling;s===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Ot(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,s=0;if(n)for(var h=e.child;h!==null;)a|=h.lanes|h.childLanes,s|=h.subtreeFlags&65011712,s|=h.flags&65011712,h.return=e,h=h.sibling;else for(h=e.child;h!==null;)a|=h.lanes|h.childLanes,s|=h.subtreeFlags,s|=h.flags,h.return=e,h=h.sibling;return e.subtreeFlags|=s,e.childLanes=a,n}function L2(e,n,a){var s=n.pendingProps;switch(fu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ot(n),null;case 1:return Ot(n),null;case 3:return a=n.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),n.memoizedState.cache!==s&&(n.flags|=2048),ql(Jt),Ge(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Oa(n)?Kl(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,hu())),Ot(n),null;case 26:var h=n.type,p=n.memoizedState;return e===null?(Kl(n),p!==null?(Ot(n),Ax(n,p)):(Ot(n),lf(n,h,null,s,a))):p?p!==e.memoizedState?(Kl(n),Ot(n),Ax(n,p)):(Ot(n),n.flags&=-16777217):(e=e.memoizedProps,e!==s&&Kl(n),Ot(n),lf(n,h,e,s,a)),null;case 27:if(xt(n),a=Ee.current,h=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Kl(n);else{if(!s){if(n.stateNode===null)throw Error(i(166));return Ot(n),null}e=me.current,Oa(n)?sm(n):(e=_p(h,s,a),n.stateNode=e,Kl(n))}return Ot(n),null;case 5:if(xt(n),h=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&Kl(n);else{if(!s){if(n.stateNode===null)throw Error(i(166));return Ot(n),null}if(p=me.current,Oa(n))sm(n);else{var w=Yo(Ee.current);switch(p){case 1:p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":p=w.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof s.is=="string"?w.createElement("select",{is:s.is}):w.createElement("select"),s.multiple?p.multiple=!0:s.size&&(p.size=s.size);break;default:p=typeof s.is=="string"?w.createElement(h,{is:s.is}):w.createElement(h)}}p[Lt]=n,p[un]=s;e:for(w=n.child;w!==null;){if(w.tag===5||w.tag===6)p.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===n)break e;for(;w.sibling===null;){if(w.return===null||w.return===n)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}n.stateNode=p;e:switch(xn(p,h,s),h){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Kl(n)}}return Ot(n),lf(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==s&&Kl(n);else{if(typeof s!="string"&&n.stateNode===null)throw Error(i(166));if(e=Ee.current,Oa(n)){if(e=n.stateNode,a=n.memoizedProps,s=null,h=dn,h!==null)switch(h.tag){case 27:case 5:s=h.memoizedProps}e[Lt]=n,e=!!(e.nodeValue===a||s!==null&&s.suppressHydrationWarning===!0||jp(e.nodeValue,a)),e||pr(n,!0)}else e=Yo(e).createTextNode(s),e[Lt]=n,n.stateNode=e}return Ot(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(s=Oa(n),a!==null){if(e===null){if(!s)throw Error(i(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(557));e[Lt]=n}else la(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ot(n),e=!1}else a=hu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(Yn(n),n):(Yn(n),null);if((n.flags&128)!==0)throw Error(i(558))}return Ot(n),null;case 13:if(s=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(h=Oa(n),s!==null&&s.dehydrated!==null){if(e===null){if(!h)throw Error(i(318));if(h=n.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(317));h[Lt]=n}else la(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ot(n),h=!1}else h=hu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=h),h=!0;if(!h)return n.flags&256?(Yn(n),n):(Yn(n),null)}return Yn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=s!==null,e=e!==null&&e.memoizedState!==null,a&&(s=n.child,h=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(h=s.alternate.memoizedState.cachePool.pool),p=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(p=s.memoizedState.cachePool.pool),p!==h&&(s.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),Ao(n,n.updateQueue),Ot(n),null);case 4:return Ge(),e===null&&Ef(n.stateNode.containerInfo),Ot(n),null;case 10:return ql(n.type),Ot(n),null;case 19:if(W(Wt),s=n.memoizedState,s===null)return Ot(n),null;if(h=(n.flags&128)!==0,p=s.rendering,p===null)if(h)Gi(s,!1);else{if(Kt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(p=xo(e),p!==null){for(n.flags|=128,Gi(s,!1),e=p.updateQueue,n.updateQueue=e,Ao(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)nm(a,e),a=a.sibling;return T(Wt,Wt.current&1|2),ut&&Il(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&&pt()>Ro&&(n.flags|=128,h=!0,Gi(s,!1),n.lanes=4194304)}else{if(!h)if(e=xo(p),e!==null){if(n.flags|=128,h=!0,e=e.updateQueue,n.updateQueue=e,Ao(n,e),Gi(s,!0),s.tail===null&&s.tailMode==="hidden"&&!p.alternate&&!ut)return Ot(n),null}else 2*pt()-s.renderingStartTime>Ro&&a!==536870912&&(n.flags|=128,h=!0,Gi(s,!1),n.lanes=4194304);s.isBackwards?(p.sibling=n.child,n.child=p):(e=s.last,e!==null?e.sibling=p:n.child=p,s.last=p)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=pt(),e.sibling=null,a=Wt.current,T(Wt,h?a&1|2:a&1),ut&&Il(n,s.treeForkCount),e):(Ot(n),null);case 22:case 23:return Yn(n),Eu(),s=n.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(n.flags|=8192):s&&(n.flags|=8192),s?(a&536870912)!==0&&(n.flags&128)===0&&(Ot(n),n.subtreeFlags&6&&(n.flags|=8192)):Ot(n),a=n.updateQueue,a!==null&&Ao(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==a&&(n.flags|=2048),e!==null&&W(ia),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),ql(Jt),Ot(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function $2(e,n){switch(fu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return ql(Jt),Ge(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return xt(n),null;case 31:if(n.memoizedState!==null){if(Yn(n),n.alternate===null)throw Error(i(340));la()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Yn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));la()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return W(Wt),null;case 4:return Ge(),null;case 10:return ql(n.type),null;case 22:case 23:return Yn(n),Eu(),e!==null&&W(ia),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return ql(Jt),null;case 25:return null;default:return null}}function Tx(e,n){switch(fu(n),n.tag){case 3:ql(Jt),Ge();break;case 26:case 27:case 5:xt(n);break;case 4:Ge();break;case 31:n.memoizedState!==null&&Yn(n);break;case 13:Yn(n);break;case 19:W(Wt);break;case 10:ql(n.type);break;case 22:case 23:Yn(n),Eu(),e!==null&&W(ia);break;case 24:ql(Jt)}}function Ki(e,n){try{var a=n.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var h=s.next;a=h;do{if((a.tag&e)===e){s=void 0;var p=a.create,w=a.inst;s=p(),w.destroy=s}a=a.next}while(a!==h)}}catch(N){kt(n,n.return,N)}}function Sr(e,n,a){try{var s=n.updateQueue,h=s!==null?s.lastEffect:null;if(h!==null){var p=h.next;s=p;do{if((s.tag&e)===e){var w=s.inst,N=w.destroy;if(N!==void 0){w.destroy=void 0,h=n;var H=a,P=N;try{P()}catch(se){kt(h,H,se)}}}s=s.next}while(s!==p)}}catch(se){kt(n,n.return,se)}}function Dx(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{vm(n,a)}catch(s){kt(e,e.return,s)}}}function zx(e,n,a){a.props=fa(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(s){kt(e,n,s)}}function Qi(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof a=="function"?e.refCleanup=a(s):a.current=s}}catch(h){kt(e,n,h)}}function wl(e,n){var a=e.ref,s=e.refCleanup;if(a!==null)if(typeof s=="function")try{s()}catch(h){kt(e,n,h)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(h){kt(e,n,h)}else a.current=null}function Mx(e){var n=e.type,a=e.memoizedProps,s=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&s.focus();break e;case"img":a.src?s.src=a.src:a.srcSet&&(s.srcset=a.srcSet)}}catch(h){kt(e,e.return,h)}}function rf(e,n,a){try{var s=e.stateNode;sb(s,e.type,a,n),s[un]=n}catch(h){kt(e,e.return,h)}}function Rx(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Dr(e.type)||e.tag===4}function af(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Rx(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Dr(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function sf(e,n,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=Wn));else if(s!==4&&(s===27&&Dr(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(sf(e,n,a),e=e.sibling;e!==null;)sf(e,n,a),e=e.sibling}function To(e,n,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(s!==4&&(s===27&&Dr(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(To(e,n,a),e=e.sibling;e!==null;)To(e,n,a),e=e.sibling}function Fx(e){var n=e.stateNode,a=e.memoizedProps;try{for(var s=e.type,h=n.attributes;h.length;)n.removeAttributeNode(h[0]);xn(n,s,a),n[Lt]=e,n[un]=a}catch(p){kt(e,e.return,p)}}var Ql=!1,tn=!1,of=!1,_x=typeof WeakSet=="function"?WeakSet:Set,on=null;function H2(e,n){if(e=e.containerInfo,Tf=Wo,e=Gh(e),eu(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var s=a.getSelection&&a.getSelection();if(s&&s.rangeCount!==0){a=s.anchorNode;var h=s.anchorOffset,p=s.focusNode;s=s.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var w=0,N=-1,H=-1,P=0,se=0,fe=e,te=null;t:for(;;){for(var le;fe!==a||h!==0&&fe.nodeType!==3||(N=w+h),fe!==p||s!==0&&fe.nodeType!==3||(H=w+s),fe.nodeType===3&&(w+=fe.nodeValue.length),(le=fe.firstChild)!==null;)te=fe,fe=le;for(;;){if(fe===e)break t;if(te===a&&++P===h&&(N=w),te===p&&++se===s&&(H=w),(le=fe.nextSibling)!==null)break;fe=te,te=fe.parentNode}fe=le}a=N===-1||H===-1?null:{start:N,end:H}}else a=null}a=a||{start:0,end:0}}else a=null;for(Df={focusedElem:e,selectionRange:a},Wo=!1,on=n;on!==null;)if(n=on,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,on=e;else for(;on!==null;){switch(n=on,p=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)h=e[a],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&p!==null){e=void 0,a=n,h=p.memoizedProps,p=p.memoizedState,s=a.stateNode;try{var De=fa(a.type,h);e=s.getSnapshotBeforeUpdate(De,p),s.__reactInternalSnapshotBeforeUpdate=e}catch(Ye){kt(a,a.return,Ye)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)Rf(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Rf(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(i(163))}if(e=n.sibling,e!==null){e.return=n.return,on=e;break}on=n.return}}function Ox(e,n,a){var s=a.flags;switch(a.tag){case 0:case 11:case 15:Zl(e,a),s&4&&Ki(5,a);break;case 1:if(Zl(e,a),s&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(w){kt(a,a.return,w)}else{var h=fa(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(h,n,e.__reactInternalSnapshotBeforeUpdate)}catch(w){kt(a,a.return,w)}}s&64&&Dx(a),s&512&&Qi(a,a.return);break;case 3:if(Zl(e,a),s&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{vm(e,n)}catch(w){kt(a,a.return,w)}}break;case 27:n===null&&s&4&&Fx(a);case 26:case 5:Zl(e,a),n===null&&s&4&&Mx(a),s&512&&Qi(a,a.return);break;case 12:Zl(e,a);break;case 31:Zl(e,a),s&4&&$x(e,a);break;case 13:Zl(e,a),s&4&&Hx(e,a),s&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Q2.bind(null,a),xb(e,a))));break;case 22:if(s=a.memoizedState!==null||Ql,!s){n=n!==null&&n.memoizedState!==null||tn,h=Ql;var p=tn;Ql=s,(tn=n)&&!p?Jl(e,a,(a.subtreeFlags&8772)!==0):Zl(e,a),Ql=h,tn=p}break;case 30:break;default:Zl(e,a)}}function Bx(e){var n=e.alternate;n!==null&&(e.alternate=null,Bx(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Ca(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var $t=null,Dn=!1;function Wl(e,n,a){for(a=a.child;a!==null;)Lx(e,n,a),a=a.sibling}function Lx(e,n,a){if(Je&&typeof Je.onCommitFiberUnmount=="function")try{Je.onCommitFiberUnmount(vt,a)}catch{}switch(a.tag){case 26:tn||wl(a,n),Wl(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:tn||wl(a,n);var s=$t,h=Dn;Dr(a.type)&&($t=a.stateNode,Dn=!1),Wl(e,n,a),rs(a.stateNode),$t=s,Dn=h;break;case 5:tn||wl(a,n);case 6:if(s=$t,h=Dn,$t=null,Wl(e,n,a),$t=s,Dn=h,$t!==null)if(Dn)try{($t.nodeType===9?$t.body:$t.nodeName==="HTML"?$t.ownerDocument.body:$t).removeChild(a.stateNode)}catch(p){kt(a,n,p)}else try{$t.removeChild(a.stateNode)}catch(p){kt(a,n,p)}break;case 18:$t!==null&&(Dn?(e=$t,Dp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),li(e)):Dp($t,a.stateNode));break;case 4:s=$t,h=Dn,$t=a.stateNode.containerInfo,Dn=!0,Wl(e,n,a),$t=s,Dn=h;break;case 0:case 11:case 14:case 15:Sr(2,a,n),tn||Sr(4,a,n),Wl(e,n,a);break;case 1:tn||(wl(a,n),s=a.stateNode,typeof s.componentWillUnmount=="function"&&zx(a,n,s)),Wl(e,n,a);break;case 21:Wl(e,n,a);break;case 22:tn=(s=tn)||a.memoizedState!==null,Wl(e,n,a),tn=s;break;default:Wl(e,n,a)}}function $x(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{li(e)}catch(a){kt(n,n.return,a)}}}function Hx(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{li(e)}catch(a){kt(n,n.return,a)}}function U2(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new _x),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new _x),n;default:throw Error(i(435,e.tag))}}function Do(e,n){var a=U2(e);n.forEach(function(s){if(!a.has(s)){a.add(s);var h=W2.bind(null,e,s);s.then(h,h)}})}function zn(e,n){var a=n.deletions;if(a!==null)for(var s=0;s<a.length;s++){var h=a[s],p=e,w=n,N=w;e:for(;N!==null;){switch(N.tag){case 27:if(Dr(N.type)){$t=N.stateNode,Dn=!1;break e}break;case 5:$t=N.stateNode,Dn=!1;break e;case 3:case 4:$t=N.stateNode.containerInfo,Dn=!0;break e}N=N.return}if($t===null)throw Error(i(160));Lx(p,w,h),$t=null,Dn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Ux(n,e),n=n.sibling}var ul=null;function Ux(e,n){var a=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:zn(n,e),Mn(e),s&4&&(Sr(3,e,e.return),Ki(3,e),Sr(5,e,e.return));break;case 1:zn(n,e),Mn(e),s&512&&(tn||a===null||wl(a,a.return)),s&64&&Ql&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?s:a.concat(s))));break;case 26:var h=ul;if(zn(n,e),Mn(e),s&512&&(tn||a===null||wl(a,a.return)),s&4){var p=a!==null?a.memoizedState:null;if(s=e.memoizedState,a===null)if(s===null)if(e.stateNode===null){e:{s=e.type,a=e.memoizedProps,h=h.ownerDocument||h;t:switch(s){case"title":p=h.getElementsByTagName("title")[0],(!p||p[Ll]||p[Lt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(s),h.head.insertBefore(p,h.querySelector("head > title"))),xn(p,s,a),p[Lt]=e,Rt(p),s=p;break e;case"link":var w=Up("link","href",h).get(s+(a.href||""));if(w){for(var N=0;N<w.length;N++)if(p=w[N],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){w.splice(N,1);break t}}p=h.createElement(s),xn(p,s,a),h.head.appendChild(p);break;case"meta":if(w=Up("meta","content",h).get(s+(a.content||""))){for(N=0;N<w.length;N++)if(p=w[N],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){w.splice(N,1);break t}}p=h.createElement(s),xn(p,s,a),h.head.appendChild(p);break;default:throw Error(i(468,s))}p[Lt]=e,Rt(p),s=p}e.stateNode=s}else Ip(h,e.type,e.stateNode);else e.stateNode=Hp(h,s,e.memoizedProps);else p!==s?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,s===null?Ip(h,e.type,e.stateNode):Hp(h,s,e.memoizedProps)):s===null&&e.stateNode!==null&&rf(e,e.memoizedProps,a.memoizedProps)}break;case 27:zn(n,e),Mn(e),s&512&&(tn||a===null||wl(a,a.return)),a!==null&&s&4&&rf(e,e.memoizedProps,a.memoizedProps);break;case 5:if(zn(n,e),Mn(e),s&512&&(tn||a===null||wl(a,a.return)),e.flags&32){h=e.stateNode;try{hr(h,"")}catch(De){kt(e,e.return,De)}}s&4&&e.stateNode!=null&&(h=e.memoizedProps,rf(e,h,a!==null?a.memoizedProps:h)),s&1024&&(of=!0);break;case 6:if(zn(n,e),Mn(e),s&4){if(e.stateNode===null)throw Error(i(162));s=e.memoizedProps,a=e.stateNode;try{a.nodeValue=s}catch(De){kt(e,e.return,De)}}break;case 3:if(Vo=null,h=ul,ul=qo(n.containerInfo),zn(n,e),ul=h,Mn(e),s&4&&a!==null&&a.memoizedState.isDehydrated)try{li(n.containerInfo)}catch(De){kt(e,e.return,De)}of&&(of=!1,Ix(e));break;case 4:s=ul,ul=qo(e.stateNode.containerInfo),zn(n,e),Mn(e),ul=s;break;case 12:zn(n,e),Mn(e);break;case 31:zn(n,e),Mn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Do(e,s)));break;case 13:zn(n,e),Mn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Mo=pt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Do(e,s)));break;case 22:h=e.memoizedState!==null;var H=a!==null&&a.memoizedState!==null,P=Ql,se=tn;if(Ql=P||h,tn=se||H,zn(n,e),tn=se,Ql=P,Mn(e),s&8192)e:for(n=e.stateNode,n._visibility=h?n._visibility&-2:n._visibility|1,h&&(a===null||H||Ql||tn||da(e)),a=null,n=e;;){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{N=H.stateNode;var fe=H.memoizedProps.style,te=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;N.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(De){kt(H,H.return,De)}}}else if(n.tag===6){if(a===null){H=n;try{H.stateNode.nodeValue=h?"":H.memoizedProps}catch(De){kt(H,H.return,De)}}}else if(n.tag===18){if(a===null){H=n;try{var le=H.stateNode;h?zp(le,!0):zp(H.stateNode,!1)}catch(De){kt(H,H.return,De)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}s&4&&(s=e.updateQueue,s!==null&&(a=s.retryQueue,a!==null&&(s.retryQueue=null,Do(e,a))));break;case 19:zn(n,e),Mn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Do(e,s)));break;case 30:break;case 21:break;default:zn(n,e),Mn(e)}}function Mn(e){var n=e.flags;if(n&2){try{for(var a,s=e.return;s!==null;){if(Rx(s)){a=s;break}s=s.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var h=a.stateNode,p=af(e);To(e,p,h);break;case 5:var w=a.stateNode;a.flags&32&&(hr(w,""),a.flags&=-33);var N=af(e);To(e,N,w);break;case 3:case 4:var H=a.stateNode.containerInfo,P=af(e);sf(e,P,H);break;default:throw Error(i(161))}}catch(se){kt(e,e.return,se)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Ix(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Ix(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Zl(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Ox(e,n.alternate,n),n=n.sibling}function da(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Sr(4,n,n.return),da(n);break;case 1:wl(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&zx(n,n.return,a),da(n);break;case 27:rs(n.stateNode);case 26:case 5:wl(n,n.return),da(n);break;case 22:n.memoizedState===null&&da(n);break;case 30:da(n);break;default:da(n)}e=e.sibling}}function Jl(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var s=n.alternate,h=e,p=n,w=p.flags;switch(p.tag){case 0:case 11:case 15:Jl(h,p,a),Ki(4,p);break;case 1:if(Jl(h,p,a),s=p,h=s.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(P){kt(s,s.return,P)}if(s=p,h=s.updateQueue,h!==null){var N=s.stateNode;try{var H=h.shared.hiddenCallbacks;if(H!==null)for(h.shared.hiddenCallbacks=null,h=0;h<H.length;h++)bm(H[h],N)}catch(P){kt(s,s.return,P)}}a&&w&64&&Dx(p),Qi(p,p.return);break;case 27:Fx(p);case 26:case 5:Jl(h,p,a),a&&s===null&&w&4&&Mx(p),Qi(p,p.return);break;case 12:Jl(h,p,a);break;case 31:Jl(h,p,a),a&&w&4&&$x(h,p);break;case 13:Jl(h,p,a),a&&w&4&&Hx(h,p);break;case 22:p.memoizedState===null&&Jl(h,p,a),Qi(p,p.return);break;case 30:break;default:Jl(h,p,a)}n=n.sibling}}function cf(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&_i(a))}function uf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&_i(e))}function fl(e,n,a,s){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Yx(e,n,a,s),n=n.sibling}function Yx(e,n,a,s){var h=n.flags;switch(n.tag){case 0:case 11:case 15:fl(e,n,a,s),h&2048&&Ki(9,n);break;case 1:fl(e,n,a,s);break;case 3:fl(e,n,a,s),h&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&_i(e)));break;case 12:if(h&2048){fl(e,n,a,s),e=n.stateNode;try{var p=n.memoizedProps,w=p.id,N=p.onPostCommit;typeof N=="function"&&N(w,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(H){kt(n,n.return,H)}}else fl(e,n,a,s);break;case 31:fl(e,n,a,s);break;case 13:fl(e,n,a,s);break;case 23:break;case 22:p=n.stateNode,w=n.alternate,n.memoizedState!==null?p._visibility&2?fl(e,n,a,s):Wi(e,n):p._visibility&2?fl(e,n,a,s):(p._visibility|=2,Va(e,n,a,s,(n.subtreeFlags&10256)!==0||!1)),h&2048&&cf(w,n);break;case 24:fl(e,n,a,s),h&2048&&uf(n.alternate,n);break;default:fl(e,n,a,s)}}function Va(e,n,a,s,h){for(h=h&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var p=e,w=n,N=a,H=s,P=w.flags;switch(w.tag){case 0:case 11:case 15:Va(p,w,N,H,h),Ki(8,w);break;case 23:break;case 22:var se=w.stateNode;w.memoizedState!==null?se._visibility&2?Va(p,w,N,H,h):Wi(p,w):(se._visibility|=2,Va(p,w,N,H,h)),h&&P&2048&&cf(w.alternate,w);break;case 24:Va(p,w,N,H,h),h&&P&2048&&uf(w.alternate,w);break;default:Va(p,w,N,H,h)}n=n.sibling}}function Wi(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,s=n,h=s.flags;switch(s.tag){case 22:Wi(a,s),h&2048&&cf(s.alternate,s);break;case 24:Wi(a,s),h&2048&&uf(s.alternate,s);break;default:Wi(a,s)}n=n.sibling}}var Zi=8192;function Ga(e,n,a){if(e.subtreeFlags&Zi)for(e=e.child;e!==null;)qx(e,n,a),e=e.sibling}function qx(e,n,a){switch(e.tag){case 26:Ga(e,n,a),e.flags&Zi&&e.memoizedState!==null&&Nb(a,ul,e.memoizedState,e.memoizedProps);break;case 5:Ga(e,n,a);break;case 3:case 4:var s=ul;ul=qo(e.stateNode.containerInfo),Ga(e,n,a),ul=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Zi,Zi=16777216,Ga(e,n,a),Zi=s):Ga(e,n,a));break;default:Ga(e,n,a)}}function Xx(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function Ji(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var s=n[a];on=s,Gx(s,e)}Xx(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Vx(e),e=e.sibling}function Vx(e){switch(e.tag){case 0:case 11:case 15:Ji(e),e.flags&2048&&Sr(9,e,e.return);break;case 3:Ji(e);break;case 12:Ji(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,zo(e)):Ji(e);break;default:Ji(e)}}function zo(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var s=n[a];on=s,Gx(s,e)}Xx(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Sr(8,n,n.return),zo(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,zo(n));break;default:zo(n)}e=e.sibling}}function Gx(e,n){for(;on!==null;){var a=on;switch(a.tag){case 0:case 11:case 15:Sr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var s=a.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:_i(a.memoizedState.cache)}if(s=a.child,s!==null)s.return=a,on=s;else e:for(a=e;on!==null;){s=on;var h=s.sibling,p=s.return;if(Bx(s),s===a){on=null;break e}if(h!==null){h.return=p,on=h;break e}on=p}}}var I2={getCacheForType:function(e){var n=hn(Jt),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return hn(Jt).controller.signal}},Y2=typeof WeakMap=="function"?WeakMap:Map,yt=0,Tt=null,rt=null,st=0,wt=0,qn=null,jr=!1,Ka=!1,ff=!1,Pl=0,Kt=0,Cr=0,ha=0,df=0,Xn=0,Qa=0,Pi=null,Rn=null,hf=!1,Mo=0,Kx=0,Ro=1/0,Fo=null,Er=null,ln=0,Nr=null,Wa=null,er=0,mf=0,xf=null,Qx=null,es=0,pf=null;function Vn(){return(yt&2)!==0&&st!==0?st&-st:I.T!==null?kf():_l()}function Wx(){if(Xn===0)if((st&536870912)===0||ut){var e=ir;ir<<=1,(ir&3932160)===0&&(ir=262144),Xn=e}else Xn=536870912;return e=In.current,e!==null&&(e.flags|=32),Xn}function Fn(e,n,a){(e===Tt&&(wt===2||wt===9)||e.cancelPendingCommit!==null)&&(Za(e,0),Ar(e,st,Xn,!1)),or(e,a),((yt&2)===0||e!==Tt)&&(e===Tt&&((yt&2)===0&&(ha|=a),Kt===4&&Ar(e,st,Xn,!1)),kl(e))}function Zx(e,n,a){if((yt&6)!==0)throw Error(i(327));var s=!a&&(n&127)===0&&(n&e.expiredLanes)===0||Rl(e,n),h=s?V2(e,n):gf(e,n,!0),p=s;do{if(h===0){Ka&&!s&&Ar(e,n,0,!1);break}else{if(a=e.current.alternate,p&&!q2(a)){h=gf(e,n,!1),p=!1;continue}if(h===2){if(p=n,e.errorRecoveryDisabledLanes&p)var w=0;else w=e.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){n=w;e:{var N=e;h=Pi;var H=N.current.memoizedState.isDehydrated;if(H&&(Za(N,w).flags|=256),w=gf(N,w,!1),w!==2){if(ff&&!H){N.errorRecoveryDisabledLanes|=p,ha|=p,h=4;break e}p=Rn,Rn=h,p!==null&&(Rn===null?Rn=p:Rn.push.apply(Rn,p))}h=w}if(p=!1,h!==2)continue}}if(h===1){Za(e,0),Ar(e,n,0,!0);break}e:{switch(s=e,p=h,p){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:Ar(s,n,Xn,!jr);break e;case 2:Rn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(h=Mo+300-pt(),10<h)){if(Ar(s,n,Xn,!jr),sr(s,0,!0)!==0)break e;er=n,s.timeoutHandle=Ap(Jx.bind(null,s,a,Rn,Fo,hf,n,Xn,ha,Qa,jr,p,"Throttled",-0,0),h);break e}Jx(s,a,Rn,Fo,hf,n,Xn,ha,Qa,jr,p,null,-0,0)}}break}while(!0);kl(e)}function Jx(e,n,a,s,h,p,w,N,H,P,se,fe,te,le){if(e.timeoutHandle=-1,fe=n.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Wn},qx(n,p,fe);var De=(p&62914560)===p?Mo-pt():(p&4194048)===p?Kx-pt():0;if(De=Ab(fe,De),De!==null){er=p,e.cancelPendingCommit=De(ip.bind(null,e,n,p,a,s,h,w,N,H,se,fe,null,te,le)),Ar(e,p,w,!P);return}}ip(e,n,p,a,s,h,w,N,H)}function q2(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var s=0;s<a.length;s++){var h=a[s],p=h.getSnapshot;h=h.value;try{if(!Hn(p(),h))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Ar(e,n,a,s){n&=~df,n&=~ha,e.suspendedLanes|=n,e.pingedLanes&=~n,s&&(e.warmLanes|=n),s=e.expirationTimes;for(var h=n;0<h;){var p=31-nt(h),w=1<<p;s[p]=-1,h&=~w}a!==0&&Bn(e,a,n)}function _o(){return(yt&6)===0?(ts(0),!1):!0}function yf(){if(rt!==null){if(wt===0)var e=rt.return;else e=rt,Yl=ra=null,Mu(e),Ua=null,Bi=0,e=rt;for(;e!==null;)Tx(e.alternate,e),e=e.return;rt=null}}function Za(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,ub(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),er=0,yf(),Tt=e,rt=a=Ul(e.current,null),st=n,wt=0,qn=null,jr=!1,Ka=Rl(e,n),ff=!1,Qa=Xn=df=ha=Cr=Kt=0,Rn=Pi=null,hf=!1,(n&8)!==0&&(n|=n&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=n;0<s;){var h=31-nt(s),p=1<<h;n|=e[h],s&=~p}return Pl=n,to(),a}function Px(e,n){Qe=null,I.H=Xi,n===Ha||n===co?(n=xm(),wt=3):n===vu?(n=xm(),wt=4):wt=n===Ku?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,qn=n,rt===null&&(Kt=1,jo(e,Pn(n,e.current)))}function ep(){var e=In.current;return e===null?!0:(st&4194048)===st?ll===null:(st&62914560)===st||(st&536870912)!==0?e===ll:!1}function tp(){var e=I.H;return I.H=Xi,e===null?Xi:e}function np(){var e=I.A;return I.A=I2,e}function Oo(){Kt=4,jr||(st&4194048)!==st&&In.current!==null||(Ka=!0),(Cr&134217727)===0&&(ha&134217727)===0||Tt===null||Ar(Tt,st,Xn,!1)}function gf(e,n,a){var s=yt;yt|=2;var h=tp(),p=np();(Tt!==e||st!==n)&&(Fo=null,Za(e,n)),n=!1;var w=Kt;e:do try{if(wt!==0&&rt!==null){var N=rt,H=qn;switch(wt){case 8:yf(),w=6;break e;case 3:case 2:case 9:case 6:In.current===null&&(n=!0);var P=wt;if(wt=0,qn=null,Ja(e,N,H,P),a&&Ka){w=0;break e}break;default:P=wt,wt=0,qn=null,Ja(e,N,H,P)}}X2(),w=Kt;break}catch(se){Px(e,se)}while(!0);return n&&e.shellSuspendCounter++,Yl=ra=null,yt=s,I.H=h,I.A=p,rt===null&&(Tt=null,st=0,to()),w}function X2(){for(;rt!==null;)lp(rt)}function V2(e,n){var a=yt;yt|=2;var s=tp(),h=np();Tt!==e||st!==n?(Fo=null,Ro=pt()+500,Za(e,n)):Ka=Rl(e,n);e:do try{if(wt!==0&&rt!==null){n=rt;var p=qn;t:switch(wt){case 1:wt=0,qn=null,Ja(e,n,p,1);break;case 2:case 9:if(hm(p)){wt=0,qn=null,rp(n);break}n=function(){wt!==2&&wt!==9||Tt!==e||(wt=7),kl(e)},p.then(n,n);break e;case 3:wt=7;break e;case 4:wt=5;break e;case 7:hm(p)?(wt=0,qn=null,rp(n)):(wt=0,qn=null,Ja(e,n,p,7));break;case 5:var w=null;switch(rt.tag){case 26:w=rt.memoizedState;case 5:case 27:var N=rt;if(w?Yp(w):N.stateNode.complete){wt=0,qn=null;var H=N.sibling;if(H!==null)rt=H;else{var P=N.return;P!==null?(rt=P,Bo(P)):rt=null}break t}}wt=0,qn=null,Ja(e,n,p,5);break;case 6:wt=0,qn=null,Ja(e,n,p,6);break;case 8:yf(),Kt=6;break e;default:throw Error(i(462))}}G2();break}catch(se){Px(e,se)}while(!0);return Yl=ra=null,I.H=s,I.A=h,yt=a,rt!==null?0:(Tt=null,st=0,to(),Kt)}function G2(){for(;rt!==null&&!St();)lp(rt)}function lp(e){var n=Nx(e.alternate,e,Pl);e.memoizedProps=e.pendingProps,n===null?Bo(e):rt=n}function rp(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=wx(a,n,n.pendingProps,n.type,void 0,st);break;case 11:n=wx(a,n,n.pendingProps,n.type.render,n.ref,st);break;case 5:Mu(n);default:Tx(a,n),n=rt=nm(n,Pl),n=Nx(a,n,Pl)}e.memoizedProps=e.pendingProps,n===null?Bo(e):rt=n}function Ja(e,n,a,s){Yl=ra=null,Mu(n),Ua=null,Bi=0;var h=n.return;try{if(_2(e,h,n,a,st)){Kt=1,jo(e,Pn(a,e.current)),rt=null;return}}catch(p){if(h!==null)throw rt=h,p;Kt=1,jo(e,Pn(a,e.current)),rt=null;return}n.flags&32768?(ut||s===1?e=!0:Ka||(st&536870912)!==0?e=!1:(jr=e=!0,(s===2||s===9||s===3||s===6)&&(s=In.current,s!==null&&s.tag===13&&(s.flags|=16384))),ap(n,e)):Bo(n)}function Bo(e){var n=e;do{if((n.flags&32768)!==0){ap(n,jr);return}e=n.return;var a=L2(n.alternate,n,Pl);if(a!==null){rt=a;return}if(n=n.sibling,n!==null){rt=n;return}rt=n=e}while(n!==null);Kt===0&&(Kt=5)}function ap(e,n){do{var a=$2(e.alternate,e);if(a!==null){a.flags&=32767,rt=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){rt=e;return}rt=e=a}while(e!==null);Kt=6,rt=null}function ip(e,n,a,s,h,p,w,N,H){e.cancelPendingCommit=null;do Lo();while(ln!==0);if((yt&6)!==0)throw Error(i(327));if(n!==null){if(n===e.current)throw Error(i(177));if(p=n.lanes|n.childLanes,p|=au,xi(e,a,p,w,N,H),e===Tt&&(rt=Tt=null,st=0),Wa=n,Nr=e,er=a,mf=p,xf=h,Qx=s,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Z2(ze,function(){return fp(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||s){s=I.T,I.T=null,h=Z.p,Z.p=2,w=yt,yt|=4;try{H2(e,n,a)}finally{yt=w,Z.p=h,I.T=s}}ln=1,sp(),op(),cp()}}function sp(){if(ln===1){ln=0;var e=Nr,n=Wa,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=I.T,I.T=null;var s=Z.p;Z.p=2;var h=yt;yt|=4;try{Ux(n,e);var p=Df,w=Gh(e.containerInfo),N=p.focusedElem,H=p.selectionRange;if(w!==N&&N&&N.ownerDocument&&Vh(N.ownerDocument.documentElement,N)){if(H!==null&&eu(N)){var P=H.start,se=H.end;if(se===void 0&&(se=P),"selectionStart"in N)N.selectionStart=P,N.selectionEnd=Math.min(se,N.value.length);else{var fe=N.ownerDocument||document,te=fe&&fe.defaultView||window;if(te.getSelection){var le=te.getSelection(),De=N.textContent.length,Ye=Math.min(H.start,De),Nt=H.end===void 0?Ye:Math.min(H.end,De);!le.extend&&Ye>Nt&&(w=Nt,Nt=Ye,Ye=w);var K=Xh(N,Ye),q=Xh(N,Nt);if(K&&q&&(le.rangeCount!==1||le.anchorNode!==K.node||le.anchorOffset!==K.offset||le.focusNode!==q.node||le.focusOffset!==q.offset)){var J=fe.createRange();J.setStart(K.node,K.offset),le.removeAllRanges(),Ye>Nt?(le.addRange(J),le.extend(q.node,q.offset)):(J.setEnd(q.node,q.offset),le.addRange(J))}}}}for(fe=[],le=N;le=le.parentNode;)le.nodeType===1&&fe.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<fe.length;N++){var oe=fe[N];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}Wo=!!Tf,Df=Tf=null}finally{yt=h,Z.p=s,I.T=a}}e.current=n,ln=2}}function op(){if(ln===2){ln=0;var e=Nr,n=Wa,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=I.T,I.T=null;var s=Z.p;Z.p=2;var h=yt;yt|=4;try{Ox(e,n.alternate,n)}finally{yt=h,Z.p=s,I.T=a}}ln=3}}function cp(){if(ln===4||ln===3){ln=0,Xt();var e=Nr,n=Wa,a=er,s=Qx;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?ln=5:(ln=0,Wa=Nr=null,up(e,e.pendingLanes));var h=e.pendingLanes;if(h===0&&(Er=null),pl(a),n=n.stateNode,Je&&typeof Je.onCommitFiberRoot=="function")try{Je.onCommitFiberRoot(vt,n,void 0,(n.current.flags&128)===128)}catch{}if(s!==null){n=I.T,h=Z.p,Z.p=2,I.T=null;try{for(var p=e.onRecoverableError,w=0;w<s.length;w++){var N=s[w];p(N.value,{componentStack:N.stack})}}finally{I.T=n,Z.p=h}}(er&3)!==0&&Lo(),kl(e),h=e.pendingLanes,(a&261930)!==0&&(h&42)!==0?e===pf?es++:(es=0,pf=e):es=0,ts(0)}}function up(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,_i(n)))}function Lo(){return sp(),op(),cp(),fp()}function fp(){if(ln!==5)return!1;var e=Nr,n=mf;mf=0;var a=pl(er),s=I.T,h=Z.p;try{Z.p=32>a?32:a,I.T=null,a=xf,xf=null;var p=Nr,w=er;if(ln=0,Wa=Nr=null,er=0,(yt&6)!==0)throw Error(i(331));var N=yt;if(yt|=4,Vx(p.current),Yx(p,p.current,w,a),yt=N,ts(0,!1),Je&&typeof Je.onPostCommitFiberRoot=="function")try{Je.onPostCommitFiberRoot(vt,p)}catch{}return!0}finally{Z.p=h,I.T=s,up(e,n)}}function dp(e,n,a){n=Pn(a,n),n=Gu(e.stateNode,n,2),e=vr(e,n,2),e!==null&&(or(e,2),kl(e))}function kt(e,n,a){if(e.tag===3)dp(e,e,a);else for(;n!==null;){if(n.tag===3){dp(n,e,a);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Er===null||!Er.has(s))){e=Pn(a,e),a=hx(2),s=vr(n,a,2),s!==null&&(mx(a,s,n,e),or(s,2),kl(s));break}}n=n.return}}function bf(e,n,a){var s=e.pingCache;if(s===null){s=e.pingCache=new Y2;var h=new Set;s.set(n,h)}else h=s.get(n),h===void 0&&(h=new Set,s.set(n,h));h.has(a)||(ff=!0,h.add(a),e=K2.bind(null,e,n,a),n.then(e,e))}function K2(e,n,a){var s=e.pingCache;s!==null&&s.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Tt===e&&(st&a)===a&&(Kt===4||Kt===3&&(st&62914560)===st&&300>pt()-Mo?(yt&2)===0&&Za(e,0):df|=a,Qa===st&&(Qa=0)),kl(e)}function hp(e,n){n===0&&(n=Us()),e=ta(e,n),e!==null&&(or(e,n),kl(e))}function Q2(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),hp(e,a)}function W2(e,n){var a=0;switch(e.tag){case 31:case 13:var s=e.stateNode,h=e.memoizedState;h!==null&&(a=h.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(i(314))}s!==null&&s.delete(n),hp(e,a)}function Z2(e,n){return Be(e,n)}var $o=null,Pa=null,vf=!1,Ho=!1,wf=!1,Tr=0;function kl(e){e!==Pa&&e.next===null&&(Pa===null?$o=Pa=e:Pa=Pa.next=e),Ho=!0,vf||(vf=!0,P2())}function ts(e,n){if(!wf&&Ho){wf=!0;do for(var a=!1,s=$o;s!==null;){if(e!==0){var h=s.pendingLanes;if(h===0)var p=0;else{var w=s.suspendedLanes,N=s.pingedLanes;p=(1<<31-nt(42|e)+1)-1,p&=h&~(w&~N),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,yp(s,p))}else p=st,p=sr(s,s===Tt?p:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(p&3)===0||Rl(s,p)||(a=!0,yp(s,p));s=s.next}while(a);wf=!1}}function J2(){mp()}function mp(){Ho=vf=!1;var e=0;Tr!==0&&cb()&&(e=Tr);for(var n=pt(),a=null,s=$o;s!==null;){var h=s.next,p=xp(s,n);p===0?(s.next=null,a===null?$o=h:a.next=h,h===null&&(Pa=a)):(a=s,(e!==0||(p&3)!==0)&&(Ho=!0)),s=h}ln!==0&&ln!==5||ts(e),Tr!==0&&(Tr=0)}function xp(e,n){for(var a=e.suspendedLanes,s=e.pingedLanes,h=e.expirationTimes,p=e.pendingLanes&-62914561;0<p;){var w=31-nt(p),N=1<<w,H=h[w];H===-1?((N&a)===0||(N&s)!==0)&&(h[w]=ja(N,n)):H<=n&&(e.expiredLanes|=N),p&=~N}if(n=Tt,a=st,a=sr(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,a===0||e===n&&(wt===2||wt===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&Ke(s),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Rl(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(s!==null&&Ke(s),pl(a)){case 2:case 8:a=ye;break;case 32:a=ze;break;case 268435456:a=be;break;default:a=ze}return s=pp.bind(null,e),a=Be(a,s),e.callbackPriority=n,e.callbackNode=a,n}return s!==null&&s!==null&&Ke(s),e.callbackPriority=2,e.callbackNode=null,2}function pp(e,n){if(ln!==0&&ln!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Lo()&&e.callbackNode!==a)return null;var s=st;return s=sr(e,e===Tt?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Zx(e,s,n),xp(e,pt()),e.callbackNode!=null&&e.callbackNode===a?pp.bind(null,e):null)}function yp(e,n){if(Lo())return null;Zx(e,n,!0)}function P2(){fb(function(){(yt&6)!==0?Be(re,J2):mp()})}function kf(){if(Tr===0){var e=La;e===0&&(e=xl,xl<<=1,(xl&261888)===0&&(xl=256)),Tr=e}return Tr}function gp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:$n(""+e)}function bp(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function eb(e,n,a,s,h){if(n==="submit"&&a&&a.stateNode===h){var p=gp((h[un]||null).action),w=s.submitter;w&&(n=(n=w[un]||null)?gp(n.formAction):w.getAttribute("formAction"),n!==null&&(p=n,w=null));var N=new Zs("action","action",null,s,h);e.push({event:N,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Tr!==0){var H=w?bp(h,w):new FormData(h);Uu(a,{pending:!0,data:H,method:h.method,action:p},null,H)}}else typeof p=="function"&&(N.preventDefault(),H=w?bp(h,w):new FormData(h),Uu(a,{pending:!0,data:H,method:h.method,action:p},p,H))},currentTarget:h}]})}}for(var Sf=0;Sf<ru.length;Sf++){var jf=ru[Sf],tb=jf.toLowerCase(),nb=jf[0].toUpperCase()+jf.slice(1);cl(tb,"on"+nb)}cl(Wh,"onAnimationEnd"),cl(Zh,"onAnimationIteration"),cl(Jh,"onAnimationStart"),cl("dblclick","onDoubleClick"),cl("focusin","onFocus"),cl("focusout","onBlur"),cl(g2,"onTransitionRun"),cl(b2,"onTransitionStart"),cl(v2,"onTransitionCancel"),cl(Ph,"onTransitionEnd"),Vt("onMouseEnter",["mouseout","mouseover"]),Vt("onMouseLeave",["mouseout","mouseover"]),Vt("onPointerEnter",["pointerout","pointerover"]),Vt("onPointerLeave",["pointerout","pointerover"]),En("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),En("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),En("onBeforeInput",["compositionend","keypress","textInput","paste"]),En("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),En("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),En("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ns="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),lb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ns));function vp(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var s=e[a],h=s.event;s=s.listeners;e:{var p=void 0;if(n)for(var w=s.length-1;0<=w;w--){var N=s[w],H=N.instance,P=N.currentTarget;if(N=N.listener,H!==p&&h.isPropagationStopped())break e;p=N,h.currentTarget=P;try{p(h)}catch(se){eo(se)}h.currentTarget=null,p=H}else for(w=0;w<s.length;w++){if(N=s[w],H=N.instance,P=N.currentTarget,N=N.listener,H!==p&&h.isPropagationStopped())break e;p=N,h.currentTarget=P;try{p(h)}catch(se){eo(se)}h.currentTarget=null,p=H}}}}function at(e,n){var a=n[Qr];a===void 0&&(a=n[Qr]=new Set);var s=e+"__bubble";a.has(s)||(wp(n,e,2,!1),a.add(s))}function Cf(e,n,a){var s=0;n&&(s|=4),wp(a,e,s,n)}var Uo="_reactListening"+Math.random().toString(36).slice(2);function Ef(e){if(!e[Uo]){e[Uo]=!0,ur.forEach(function(a){a!=="selectionchange"&&(lb.has(a)||Cf(a,!1,e),Cf(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Uo]||(n[Uo]=!0,Cf("selectionchange",!1,n))}}function wp(e,n,a,s){switch(Wp(n)){case 2:var h=zb;break;case 8:h=Mb;break;default:h=Uf}a=h.bind(null,n,a,e),h=void 0,!ue||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(h=!0),s?h!==void 0?e.addEventListener(n,a,{capture:!0,passive:h}):e.addEventListener(n,a,!0):h!==void 0?e.addEventListener(n,a,{passive:h}):e.addEventListener(n,a,!1)}function Nf(e,n,a,s,h){var p=s;if((n&1)===0&&(n&2)===0&&s!==null)e:for(;;){if(s===null)return;var w=s.tag;if(w===3||w===4){var N=s.stateNode.containerInfo;if(N===h)break;if(w===4)for(w=s.return;w!==null;){var H=w.tag;if((H===3||H===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;N!==null;){if(w=$l(N),w===null)return;if(H=w.tag,H===5||H===6||H===26||H===27){s=p=w;continue e}N=N.parentNode}}s=s.return}Ci(function(){var P=p,se=Si(a),fe=[];e:{var te=em.get(e);if(te!==void 0){var le=Zs,De=e;switch(e){case"keypress":if(lt(a)===0)break e;case"keydown":case"keyup":le=Wg;break;case"focusin":De="focus",le=Qc;break;case"focusout":De="blur",le=Qc;break;case"beforeblur":case"afterblur":le=Qc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=Th;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=Lg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=Pg;break;case Wh:case Zh:case Jh:le=Ug;break;case Ph:le=t2;break;case"scroll":case"scrollend":le=Og;break;case"wheel":le=l2;break;case"copy":case"cut":case"paste":le=Yg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=zh;break;case"toggle":case"beforetoggle":le=a2}var Ye=(n&4)!==0,Nt=!Ye&&(e==="scroll"||e==="scrollend"),K=Ye?te!==null?te+"Capture":null:te;Ye=[];for(var q=P,J;q!==null;){var oe=q;if(J=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||J===null||K===null||(oe=_(q,K),oe!=null&&Ye.push(ls(q,oe,J))),Nt)break;q=q.return}0<Ye.length&&(te=new le(te,De,null,a,se),fe.push({event:te,listeners:Ye}))}}if((n&7)===0){e:{if(te=e==="mouseover"||e==="pointerover",le=e==="mouseout"||e==="pointerout",te&&a!==ki&&(De=a.relatedTarget||a.fromElement)&&($l(De)||De[Bl]))break e;if((le||te)&&(te=se.window===se?se:(te=se.ownerDocument)?te.defaultView||te.parentWindow:window,le?(De=a.relatedTarget||a.toElement,le=P,De=De?$l(De):null,De!==null&&(Nt=u(De),Ye=De.tag,De!==Nt||Ye!==5&&Ye!==27&&Ye!==6)&&(De=null)):(le=null,De=P),le!==De)){if(Ye=Th,oe="onMouseLeave",K="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(Ye=zh,oe="onPointerLeave",K="onPointerEnter",q="pointer"),Nt=le==null?te:Hl(le),J=De==null?te:Hl(De),te=new Ye(oe,q+"leave",le,a,se),te.target=Nt,te.relatedTarget=J,oe=null,$l(se)===P&&(Ye=new Ye(K,q+"enter",De,a,se),Ye.target=J,Ye.relatedTarget=Nt,oe=Ye),Nt=oe,le&&De)t:{for(Ye=rb,K=le,q=De,J=0,oe=K;oe;oe=Ye(oe))J++;oe=0;for(var $e=q;$e;$e=Ye($e))oe++;for(;0<J-oe;)K=Ye(K),J--;for(;0<oe-J;)q=Ye(q),oe--;for(;J--;){if(K===q||q!==null&&K===q.alternate){Ye=K;break t}K=Ye(K),q=Ye(q)}Ye=null}else Ye=null;le!==null&&kp(fe,te,le,Ye,!1),De!==null&&Nt!==null&&kp(fe,Nt,De,Ye,!0)}}e:{if(te=P?Hl(P):window,le=te.nodeName&&te.nodeName.toLowerCase(),le==="select"||le==="input"&&te.type==="file")var dt=$h;else if(Bh(te))if(Hh)dt=x2;else{dt=h2;var Fe=d2}else le=te.nodeName,!le||le.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?P&&Zr(P.elementType)&&(dt=$h):dt=m2;if(dt&&(dt=dt(e,P))){Lh(fe,dt,a,se);break e}Fe&&Fe(e,te,P),e==="focusout"&&P&&te.type==="number"&&P.memoizedProps.value!=null&&wi(te,"number",te.value)}switch(Fe=P?Hl(P):window,e){case"focusin":(Bh(Fe)||Fe.contentEditable==="true")&&(Da=Fe,tu=P,Mi=null);break;case"focusout":Mi=tu=Da=null;break;case"mousedown":nu=!0;break;case"contextmenu":case"mouseup":case"dragend":nu=!1,Kh(fe,a,se);break;case"selectionchange":if(y2)break;case"keydown":case"keyup":Kh(fe,a,se)}var We;if(Zc)e:{switch(e){case"compositionstart":var ot="onCompositionStart";break e;case"compositionend":ot="onCompositionEnd";break e;case"compositionupdate":ot="onCompositionUpdate";break e}ot=void 0}else Ta?_h(e,a)&&(ot="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(ot="onCompositionStart");ot&&(Mh&&a.locale!=="ko"&&(Ta||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&Ta&&(We=Pe()):(ge=se,Me="value"in ge?ge.value:ge.textContent,Ta=!0)),Fe=Io(P,ot),0<Fe.length&&(ot=new Dh(ot,e,null,a,se),fe.push({event:ot,listeners:Fe}),We?ot.data=We:(We=Oh(a),We!==null&&(ot.data=We)))),(We=s2?o2(e,a):c2(e,a))&&(ot=Io(P,"onBeforeInput"),0<ot.length&&(Fe=new Dh("onBeforeInput","beforeinput",null,a,se),fe.push({event:Fe,listeners:ot}),Fe.data=We)),eb(fe,e,P,a,se)}vp(fe,n)})}function ls(e,n,a){return{instance:e,listener:n,currentTarget:a}}function Io(e,n){for(var a=n+"Capture",s=[];e!==null;){var h=e,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=_(e,a),h!=null&&s.unshift(ls(e,h,p)),h=_(e,n),h!=null&&s.push(ls(e,h,p))),e.tag===3)return s;e=e.return}return[]}function rb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function kp(e,n,a,s,h){for(var p=n._reactName,w=[];a!==null&&a!==s;){var N=a,H=N.alternate,P=N.stateNode;if(N=N.tag,H!==null&&H===s)break;N!==5&&N!==26&&N!==27||P===null||(H=P,h?(P=_(a,p),P!=null&&w.unshift(ls(a,P,H))):h||(P=_(a,p),P!=null&&w.push(ls(a,P,H)))),a=a.return}w.length!==0&&e.push({event:n,listeners:w})}var ab=/\r\n?/g,ib=/\u0000|\uFFFD/g;function Sp(e){return(typeof e=="string"?e:""+e).replace(ab,`
|
|
49
|
+
`).replace(ib,"")}function jp(e,n){return n=Sp(n),Sp(e)===n}function Et(e,n,a,s,h,p){switch(a){case"children":typeof s=="string"?n==="body"||n==="textarea"&&s===""||hr(e,s):(typeof s=="number"||typeof s=="bigint")&&n!=="body"&&hr(e,""+s);break;case"className":gl(e,"class",s);break;case"tabIndex":gl(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":gl(e,a,s);break;case"style":ol(e,s,p);break;case"data":if(n!=="object"){gl(e,"data",s);break}case"src":case"href":if(s===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=$n(""+s),e.setAttribute(a,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(a==="formAction"?(n!=="input"&&Et(e,n,"name",h.name,h,null),Et(e,n,"formEncType",h.formEncType,h,null),Et(e,n,"formMethod",h.formMethod,h,null),Et(e,n,"formTarget",h.formTarget,h,null)):(Et(e,n,"encType",h.encType,h,null),Et(e,n,"method",h.method,h,null),Et(e,n,"target",h.target,h,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=$n(""+s),e.setAttribute(a,s);break;case"onClick":s!=null&&(e.onclick=Wn);break;case"onScroll":s!=null&&at("scroll",e);break;case"onScrollEnd":s!=null&&at("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(i(61));if(a=s.__html,a!=null){if(h.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}a=$n(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,""+s):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":s===!0?e.setAttribute(a,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,s):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(a,s):e.removeAttribute(a);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(a):e.setAttribute(a,s);break;case"popover":at("beforetoggle",e),at("toggle",e),Na(e,"popover",s);break;case"xlinkActuate":vn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":vn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":vn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":vn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":vn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":vn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":vn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":vn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":vn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Na(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Xc.get(a)||a,Na(e,a,s))}}function Af(e,n,a,s,h,p){switch(a){case"style":ol(e,s,p);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(i(61));if(a=s.__html,a!=null){if(h.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"children":typeof s=="string"?hr(e,s):(typeof s=="number"||typeof s=="bigint")&&hr(e,""+s);break;case"onScroll":s!=null&&at("scroll",e);break;case"onScrollEnd":s!=null&&at("scrollend",e);break;case"onClick":s!=null&&(e.onclick=Wn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xs.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(h=a.endsWith("Capture"),n=a.slice(2,h?a.length-7:void 0),p=e[un]||null,p=p!=null?p[a]:null,typeof p=="function"&&e.removeEventListener(n,p,h),typeof s=="function")){typeof p!="function"&&p!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,s,h);break e}a in e?e[a]=s:s===!0?e.setAttribute(a,""):Na(e,a,s)}}}function xn(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":at("error",e),at("load",e);var s=!1,h=!1,p;for(p in a)if(a.hasOwnProperty(p)){var w=a[p];if(w!=null)switch(p){case"src":s=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Et(e,n,p,w,a,null)}}h&&Et(e,n,"srcSet",a.srcSet,a,null),s&&Et(e,n,"src",a.src,a,null);return;case"input":at("invalid",e);var N=p=w=h=null,H=null,P=null;for(s in a)if(a.hasOwnProperty(s)){var se=a[s];if(se!=null)switch(s){case"name":h=se;break;case"type":w=se;break;case"checked":H=se;break;case"defaultChecked":P=se;break;case"value":p=se;break;case"defaultValue":N=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(i(137,n));break;default:Et(e,n,s,se,a,null)}}vi(e,p,N,H,P,w,h,!1);return;case"select":at("invalid",e),s=w=p=null;for(h in a)if(a.hasOwnProperty(h)&&(N=a[h],N!=null))switch(h){case"value":p=N;break;case"defaultValue":w=N;break;case"multiple":s=N;default:Et(e,n,h,N,a,null)}n=p,a=w,e.multiple=!!s,n!=null?dr(e,!!s,n,!1):a!=null&&dr(e,!!s,a,!0);return;case"textarea":at("invalid",e),p=h=s=null;for(w in a)if(a.hasOwnProperty(w)&&(N=a[w],N!=null))switch(w){case"value":s=N;break;case"defaultValue":h=N;break;case"children":p=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(i(91));break;default:Et(e,n,w,N,a,null)}Qs(e,s,h,p);return;case"option":for(H in a)if(a.hasOwnProperty(H)&&(s=a[H],s!=null))switch(H){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:Et(e,n,H,s,a,null)}return;case"dialog":at("beforetoggle",e),at("toggle",e),at("cancel",e),at("close",e);break;case"iframe":case"object":at("load",e);break;case"video":case"audio":for(s=0;s<ns.length;s++)at(ns[s],e);break;case"image":at("error",e),at("load",e);break;case"details":at("toggle",e);break;case"embed":case"source":case"link":at("error",e),at("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(P in a)if(a.hasOwnProperty(P)&&(s=a[P],s!=null))switch(P){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:Et(e,n,P,s,a,null)}return;default:if(Zr(n)){for(se in a)a.hasOwnProperty(se)&&(s=a[se],s!==void 0&&Af(e,n,se,s,a,void 0));return}}for(N in a)a.hasOwnProperty(N)&&(s=a[N],s!=null&&Et(e,n,N,s,a,null))}function sb(e,n,a,s){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,w=null,N=null,H=null,P=null,se=null;for(le in a){var fe=a[le];if(a.hasOwnProperty(le)&&fe!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":H=fe;default:s.hasOwnProperty(le)||Et(e,n,le,null,s,fe)}}for(var te in s){var le=s[te];if(fe=a[te],s.hasOwnProperty(te)&&(le!=null||fe!=null))switch(te){case"type":p=le;break;case"name":h=le;break;case"checked":P=le;break;case"defaultChecked":se=le;break;case"value":w=le;break;case"defaultValue":N=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(i(137,n));break;default:le!==fe&&Et(e,n,te,le,s,fe)}}bi(e,w,N,H,P,se,p,h);return;case"select":le=w=N=te=null;for(p in a)if(H=a[p],a.hasOwnProperty(p)&&H!=null)switch(p){case"value":break;case"multiple":le=H;default:s.hasOwnProperty(p)||Et(e,n,p,null,s,H)}for(h in s)if(p=s[h],H=a[h],s.hasOwnProperty(h)&&(p!=null||H!=null))switch(h){case"value":te=p;break;case"defaultValue":N=p;break;case"multiple":w=p;default:p!==H&&Et(e,n,h,p,s,H)}n=N,a=w,s=le,te!=null?dr(e,!!a,te,!1):!!s!=!!a&&(n!=null?dr(e,!!a,n,!0):dr(e,!!a,a?[]:"",!1));return;case"textarea":le=te=null;for(N in a)if(h=a[N],a.hasOwnProperty(N)&&h!=null&&!s.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:Et(e,n,N,null,s,h)}for(w in s)if(h=s[w],p=a[w],s.hasOwnProperty(w)&&(h!=null||p!=null))switch(w){case"value":te=h;break;case"defaultValue":le=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(i(91));break;default:h!==p&&Et(e,n,w,h,s,p)}Ks(e,te,le);return;case"option":for(var De in a)if(te=a[De],a.hasOwnProperty(De)&&te!=null&&!s.hasOwnProperty(De))switch(De){case"selected":e.selected=!1;break;default:Et(e,n,De,null,s,te)}for(H in s)if(te=s[H],le=a[H],s.hasOwnProperty(H)&&te!==le&&(te!=null||le!=null))switch(H){case"selected":e.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:Et(e,n,H,te,s,le)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ye in a)te=a[Ye],a.hasOwnProperty(Ye)&&te!=null&&!s.hasOwnProperty(Ye)&&Et(e,n,Ye,null,s,te);for(P in s)if(te=s[P],le=a[P],s.hasOwnProperty(P)&&te!==le&&(te!=null||le!=null))switch(P){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(i(137,n));break;default:Et(e,n,P,te,s,le)}return;default:if(Zr(n)){for(var Nt in a)te=a[Nt],a.hasOwnProperty(Nt)&&te!==void 0&&!s.hasOwnProperty(Nt)&&Af(e,n,Nt,void 0,s,te);for(se in s)te=s[se],le=a[se],!s.hasOwnProperty(se)||te===le||te===void 0&&le===void 0||Af(e,n,se,te,s,le);return}}for(var K in a)te=a[K],a.hasOwnProperty(K)&&te!=null&&!s.hasOwnProperty(K)&&Et(e,n,K,null,s,te);for(fe in s)te=s[fe],le=a[fe],!s.hasOwnProperty(fe)||te===le||te==null&&le==null||Et(e,n,fe,te,s,le)}function Cp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function ob(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),s=0;s<a.length;s++){var h=a[s],p=h.transferSize,w=h.initiatorType,N=h.duration;if(p&&N&&Cp(w)){for(w=0,N=h.responseEnd,s+=1;s<a.length;s++){var H=a[s],P=H.startTime;if(P>N)break;var se=H.transferSize,fe=H.initiatorType;se&&Cp(fe)&&(H=H.responseEnd,w+=se*(H<N?1:(N-P)/(H-P)))}if(--s,n+=8*(p+w)/(h.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Tf=null,Df=null;function Yo(e){return e.nodeType===9?e:e.ownerDocument}function Ep(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Np(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function zf(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Mf=null;function cb(){var e=window.event;return e&&e.type==="popstate"?e===Mf?!1:(Mf=e,!0):(Mf=null,!1)}var Ap=typeof setTimeout=="function"?setTimeout:void 0,ub=typeof clearTimeout=="function"?clearTimeout:void 0,Tp=typeof Promise=="function"?Promise:void 0,fb=typeof queueMicrotask=="function"?queueMicrotask:typeof Tp<"u"?function(e){return Tp.resolve(null).then(e).catch(db)}:Ap;function db(e){setTimeout(function(){throw e})}function Dr(e){return e==="head"}function Dp(e,n){var a=n,s=0;do{var h=a.nextSibling;if(e.removeChild(a),h&&h.nodeType===8)if(a=h.data,a==="/$"||a==="/&"){if(s===0){e.removeChild(h),li(n);return}s--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")s++;else if(a==="html")rs(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,rs(a);for(var p=a.firstChild;p;){var w=p.nextSibling,N=p.nodeName;p[Ll]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=w}}else a==="body"&&rs(e.ownerDocument.body);a=h}while(a);li(n)}function zp(e,n){var a=e;e=0;do{var s=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),s&&s.nodeType===8)if(a=s.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=s}while(a)}function Rf(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Rf(a),Ca(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function hb(e,n,a,s){for(;e.nodeType===1;){var h=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[Ll])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(p=e.getAttribute("rel"),p==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(p!==h.rel||e.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||e.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||e.getAttribute("title")!==(h.title==null?null:h.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(p=e.getAttribute("src"),(p!==(h.src==null?null:h.src)||e.getAttribute("type")!==(h.type==null?null:h.type)||e.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&e.getAttribute("name")===p)return e}else return e;if(e=rl(e.nextSibling),e===null)break}return null}function mb(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=rl(e.nextSibling),e===null))return null;return e}function Mp(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=rl(e.nextSibling),e===null))return null;return e}function Ff(e){return e.data==="$?"||e.data==="$~"}function _f(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function xb(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var s=function(){n(),a.removeEventListener("DOMContentLoaded",s)};a.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function rl(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Of=null;function Rp(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return rl(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function Fp(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function _p(e,n,a){switch(n=Yo(a),e){case"html":if(e=n.documentElement,!e)throw Error(i(452));return e;case"head":if(e=n.head,!e)throw Error(i(453));return e;case"body":if(e=n.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function rs(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Ca(e)}var al=new Map,Op=new Set;function qo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var tr=Z.d;Z.d={f:pb,r:yb,D:gb,C:bb,L:vb,m:wb,X:Sb,S:kb,M:jb};function pb(){var e=tr.f(),n=_o();return e||n}function yb(e){var n=cr(e);n!==null&&n.tag===5&&n.type==="form"?Pm(n):tr.r(e)}var ei=typeof document>"u"?null:document;function Bp(e,n,a){var s=ei;if(s&&typeof n=="string"&&n){var h=An(n);h='link[rel="'+e+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),Op.has(h)||(Op.add(h),e={rel:e,crossOrigin:a,href:n},s.querySelector(h)===null&&(n=s.createElement("link"),xn(n,"link",e),Rt(n),s.head.appendChild(n)))}}function gb(e){tr.D(e),Bp("dns-prefetch",e,null)}function bb(e,n){tr.C(e,n),Bp("preconnect",e,n)}function vb(e,n,a){tr.L(e,n,a);var s=ei;if(s&&e&&n){var h='link[rel="preload"][as="'+An(n)+'"]';n==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+An(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+An(a.imageSizes)+'"]')):h+='[href="'+An(e)+'"]';var p=h;switch(n){case"style":p=ti(e);break;case"script":p=ni(e)}al.has(p)||(e=y({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),al.set(p,e),s.querySelector(h)!==null||n==="style"&&s.querySelector(as(p))||n==="script"&&s.querySelector(is(p))||(n=s.createElement("link"),xn(n,"link",e),Rt(n),s.head.appendChild(n)))}}function wb(e,n){tr.m(e,n);var a=ei;if(a&&e){var s=n&&typeof n.as=="string"?n.as:"script",h='link[rel="modulepreload"][as="'+An(s)+'"][href="'+An(e)+'"]',p=h;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=ni(e)}if(!al.has(p)&&(e=y({rel:"modulepreload",href:e},n),al.set(p,e),a.querySelector(h)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(is(p)))return}s=a.createElement("link"),xn(s,"link",e),Rt(s),a.head.appendChild(s)}}}function kb(e,n,a){tr.S(e,n,a);var s=ei;if(s&&e){var h=fn(s).hoistableStyles,p=ti(e);n=n||"default";var w=h.get(p);if(!w){var N={loading:0,preload:null};if(w=s.querySelector(as(p)))N.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},a),(a=al.get(p))&&Bf(e,a);var H=w=s.createElement("link");Rt(H),xn(H,"link",e),H._p=new Promise(function(P,se){H.onload=P,H.onerror=se}),H.addEventListener("load",function(){N.loading|=1}),H.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Xo(w,n,s)}w={type:"stylesheet",instance:w,count:1,state:N},h.set(p,w)}}}function Sb(e,n){tr.X(e,n);var a=ei;if(a&&e){var s=fn(a).hoistableScripts,h=ni(e),p=s.get(h);p||(p=a.querySelector(is(h)),p||(e=y({src:e,async:!0},n),(n=al.get(h))&&Lf(e,n),p=a.createElement("script"),Rt(p),xn(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},s.set(h,p))}}function jb(e,n){tr.M(e,n);var a=ei;if(a&&e){var s=fn(a).hoistableScripts,h=ni(e),p=s.get(h);p||(p=a.querySelector(is(h)),p||(e=y({src:e,async:!0,type:"module"},n),(n=al.get(h))&&Lf(e,n),p=a.createElement("script"),Rt(p),xn(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},s.set(h,p))}}function Lp(e,n,a,s){var h=(h=Ee.current)?qo(h):null;if(!h)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=ti(a.href),a=fn(h).hoistableStyles,s=a.get(n),s||(s={type:"style",instance:null,count:0,state:null},a.set(n,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=ti(a.href);var p=fn(h).hoistableStyles,w=p.get(e);if(w||(h=h.ownerDocument||h,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,w),(p=h.querySelector(as(e)))&&!p._p&&(w.instance=p,w.state.loading=5),al.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},al.set(e,a),p||Cb(h,e,a,w.state))),n&&s===null)throw Error(i(528,""));return w}if(n&&s!==null)throw Error(i(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=ni(a),a=fn(h).hoistableScripts,s=a.get(n),s||(s={type:"script",instance:null,count:0,state:null},a.set(n,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function ti(e){return'href="'+An(e)+'"'}function as(e){return'link[rel="stylesheet"]['+e+"]"}function $p(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function Cb(e,n,a,s){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?s.loading=1:(n=e.createElement("link"),s.preload=n,n.addEventListener("load",function(){return s.loading|=1}),n.addEventListener("error",function(){return s.loading|=2}),xn(n,"link",a),Rt(n),e.head.appendChild(n))}function ni(e){return'[src="'+An(e)+'"]'}function is(e){return"script[async]"+e}function Hp(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var s=e.querySelector('style[data-href~="'+An(a.href)+'"]');if(s)return n.instance=s,Rt(s),s;var h=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Rt(s),xn(s,"style",h),Xo(s,a.precedence,e),n.instance=s;case"stylesheet":h=ti(a.href);var p=e.querySelector(as(h));if(p)return n.state.loading|=4,n.instance=p,Rt(p),p;s=$p(a),(h=al.get(h))&&Bf(s,h),p=(e.ownerDocument||e).createElement("link"),Rt(p);var w=p;return w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),xn(p,"link",s),n.state.loading|=4,Xo(p,a.precedence,e),n.instance=p;case"script":return p=ni(a.src),(h=e.querySelector(is(p)))?(n.instance=h,Rt(h),h):(s=a,(h=al.get(p))&&(s=y({},a),Lf(s,h)),e=e.ownerDocument||e,h=e.createElement("script"),Rt(h),xn(h,"link",s),e.head.appendChild(h),n.instance=h);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(s=n.instance,n.state.loading|=4,Xo(s,a.precedence,e));return n.instance}function Xo(e,n,a){for(var s=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=s.length?s[s.length-1]:null,p=h,w=0;w<s.length;w++){var N=s[w];if(N.dataset.precedence===n)p=N;else if(p!==h)break}p?p.parentNode.insertBefore(e,p.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function Bf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Lf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Vo=null;function Up(e,n,a){if(Vo===null){var s=new Map,h=Vo=new Map;h.set(a,s)}else h=Vo,s=h.get(a),s||(s=new Map,h.set(a,s));if(s.has(e))return s;for(s.set(e,null),a=a.getElementsByTagName(e),h=0;h<a.length;h++){var p=a[h];if(!(p[Ll]||p[Lt]||e==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var w=p.getAttribute(n)||"";w=e+w;var N=s.get(w);N?N.push(p):s.set(w,[p])}}return s}function Ip(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function Eb(e,n,a){if(a===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Yp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Nb(e,n,a,s){if(a.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var h=ti(s.href),p=n.querySelector(as(h));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Go.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=p,Rt(p);return}p=n.ownerDocument||n,s=$p(s),(h=al.get(h))&&Bf(s,h),p=p.createElement("link"),Rt(p);var w=p;w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),xn(p,"link",s),a.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Go.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var $f=0;function Ab(e,n){return e.stylesheets&&e.count===0&&Qo(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var s=setTimeout(function(){if(e.stylesheets&&Qo(e,e.stylesheets),e.unsuspend){var p=e.unsuspend;e.unsuspend=null,p()}},6e4+n);0<e.imgBytes&&$f===0&&($f=62500*ob());var h=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Qo(e,e.stylesheets),e.unsuspend)){var p=e.unsuspend;e.unsuspend=null,p()}},(e.imgBytes>$f?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(h)}}:null}function Go(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Qo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ko=null;function Qo(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ko=new Map,n.forEach(Tb,e),Ko=null,Go.call(e))}function Tb(e,n){if(!(n.state.loading&4)){var a=Ko.get(e);if(a)var s=a.get(null);else{a=new Map,Ko.set(e,a);for(var h=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var w=h[p];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(a.set(w.dataset.precedence,w),s=w)}s&&a.set(null,s)}h=n.instance,w=h.getAttribute("data-precedence"),p=a.get(w)||s,p===s&&a.set(null,h),a.set(w,h),this.count++,s=Go.bind(this),h.addEventListener("load",s),h.addEventListener("error",s),p?p.parentNode.insertBefore(h,p.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(h,e.firstChild)),n.state.loading|=4}}var ss={$$typeof:M,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function Db(e,n,a,s,h,p,w,N,H){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Gr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gr(0),this.hiddenUpdates=Gr(null),this.identifierPrefix=s,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function qp(e,n,a,s,h,p,w,N,H,P,se,fe){return e=new Db(e,n,a,w,H,P,se,fe,N),n=1,p===!0&&(n|=24),p=Un(3,null,null,n),e.current=p,p.stateNode=e,n=yu(),n.refCount++,e.pooledCache=n,n.refCount++,p.memoizedState={element:s,isDehydrated:a,cache:n},wu(p),e}function Xp(e){return e?(e=Ra,e):Ra}function Vp(e,n,a,s,h,p){h=Xp(h),s.context===null?s.context=h:s.pendingContext=h,s=br(n),s.payload={element:a},p=p===void 0?null:p,p!==null&&(s.callback=p),a=vr(e,s,n),a!==null&&(Fn(a,e,n),$i(a,e,n))}function Gp(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function Hf(e,n){Gp(e,n),(e=e.alternate)&&Gp(e,n)}function Kp(e){if(e.tag===13||e.tag===31){var n=ta(e,67108864);n!==null&&Fn(n,e,67108864),Hf(e,67108864)}}function Qp(e){if(e.tag===13||e.tag===31){var n=Vn();n=Kr(n);var a=ta(e,n);a!==null&&Fn(a,e,n),Hf(e,n)}}var Wo=!0;function zb(e,n,a,s){var h=I.T;I.T=null;var p=Z.p;try{Z.p=2,Uf(e,n,a,s)}finally{Z.p=p,I.T=h}}function Mb(e,n,a,s){var h=I.T;I.T=null;var p=Z.p;try{Z.p=8,Uf(e,n,a,s)}finally{Z.p=p,I.T=h}}function Uf(e,n,a,s){if(Wo){var h=If(s);if(h===null)Nf(e,n,s,Zo,a),Zp(e,s);else if(Fb(h,e,n,a,s))s.stopPropagation();else if(Zp(e,s),n&4&&-1<Rb.indexOf(e)){for(;h!==null;){var p=cr(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=Ml(p.pendingLanes);if(w!==0){var N=p;for(N.pendingLanes|=2,N.entangledLanes|=2;w;){var H=1<<31-nt(w);N.entanglements[1]|=H,w&=~H}kl(p),(yt&6)===0&&(Ro=pt()+500,ts(0))}}break;case 31:case 13:N=ta(p,2),N!==null&&Fn(N,p,2),_o(),Hf(p,2)}if(p=If(s),p===null&&Nf(e,n,s,Zo,a),p===h)break;h=p}h!==null&&s.stopPropagation()}else Nf(e,n,s,null,a)}}function If(e){return e=Si(e),Yf(e)}var Zo=null;function Yf(e){if(Zo=null,e=$l(e),e!==null){var n=u(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=f(n),e!==null)return e;e=null}else if(a===31){if(e=m(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Zo=e,null}function Wp(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(bt()){case re:return 2;case ye:return 8;case ze:case Ie:return 32;case be:return 268435456;default:return 32}default:return 32}}var qf=!1,zr=null,Mr=null,Rr=null,os=new Map,cs=new Map,Fr=[],Rb="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Zp(e,n){switch(e){case"focusin":case"focusout":zr=null;break;case"dragenter":case"dragleave":Mr=null;break;case"mouseover":case"mouseout":Rr=null;break;case"pointerover":case"pointerout":os.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":cs.delete(n.pointerId)}}function us(e,n,a,s,h,p){return e===null||e.nativeEvent!==p?(e={blockedOn:n,domEventName:a,eventSystemFlags:s,nativeEvent:p,targetContainers:[h]},n!==null&&(n=cr(n),n!==null&&Kp(n)),e):(e.eventSystemFlags|=s,n=e.targetContainers,h!==null&&n.indexOf(h)===-1&&n.push(h),e)}function Fb(e,n,a,s,h){switch(n){case"focusin":return zr=us(zr,e,n,a,s,h),!0;case"dragenter":return Mr=us(Mr,e,n,a,s,h),!0;case"mouseover":return Rr=us(Rr,e,n,a,s,h),!0;case"pointerover":var p=h.pointerId;return os.set(p,us(os.get(p)||null,e,n,a,s,h)),!0;case"gotpointercapture":return p=h.pointerId,cs.set(p,us(cs.get(p)||null,e,n,a,s,h)),!0}return!1}function Jp(e){var n=$l(e.target);if(n!==null){var a=u(n);if(a!==null){if(n=a.tag,n===13){if(n=f(a),n!==null){e.blockedOn=n,Ol(e.priority,function(){Qp(a)});return}}else if(n===31){if(n=m(a),n!==null){e.blockedOn=n,Ol(e.priority,function(){Qp(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Jo(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=If(e.nativeEvent);if(a===null){a=e.nativeEvent;var s=new a.constructor(a.type,a);ki=s,a.target.dispatchEvent(s),ki=null}else return n=cr(a),n!==null&&Kp(n),e.blockedOn=a,!1;n.shift()}return!0}function Pp(e,n,a){Jo(e)&&a.delete(n)}function _b(){qf=!1,zr!==null&&Jo(zr)&&(zr=null),Mr!==null&&Jo(Mr)&&(Mr=null),Rr!==null&&Jo(Rr)&&(Rr=null),os.forEach(Pp),cs.forEach(Pp)}function Po(e,n){e.blockedOn===n&&(e.blockedOn=null,qf||(qf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,_b)))}var ec=null;function e1(e){ec!==e&&(ec=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){ec===e&&(ec=null);for(var n=0;n<e.length;n+=3){var a=e[n],s=e[n+1],h=e[n+2];if(typeof s!="function"){if(Yf(s||a)===null)continue;break}var p=cr(a);p!==null&&(e.splice(n,3),n-=3,Uu(p,{pending:!0,data:h,method:a.method,action:s},s,h))}}))}function li(e){function n(H){return Po(H,e)}zr!==null&&Po(zr,e),Mr!==null&&Po(Mr,e),Rr!==null&&Po(Rr,e),os.forEach(n),cs.forEach(n);for(var a=0;a<Fr.length;a++){var s=Fr[a];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Fr.length&&(a=Fr[0],a.blockedOn===null);)Jp(a),a.blockedOn===null&&Fr.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(s=0;s<a.length;s+=3){var h=a[s],p=a[s+1],w=h[un]||null;if(typeof p=="function")w||e1(a);else if(w){var N=null;if(p&&p.hasAttribute("formAction")){if(h=p,w=p[un]||null)N=w.formAction;else if(Yf(h)!==null)continue}else N=w.action;typeof N=="function"?a[s+1]=N:(a.splice(s,3),s-=3),e1(a)}}}function t1(){function e(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(w){return h=w})},focusReset:"manual",scroll:"manual"})}function n(){h!==null&&(h(),h=null),s||setTimeout(a,20)}function a(){if(!s&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,h=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),h!==null&&(h(),h=null)}}}function Xf(e){this._internalRoot=e}tc.prototype.render=Xf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(i(409));var a=n.current,s=Vn();Vp(a,s,e,n,null,null)},tc.prototype.unmount=Xf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Vp(e.current,2,null,e,null,null),_o(),n[Bl]=null}};function tc(e){this._internalRoot=e}tc.prototype.unstable_scheduleHydration=function(e){if(e){var n=_l();e={blockedOn:null,target:e,priority:n};for(var a=0;a<Fr.length&&n!==0&&n<Fr[a].priority;a++);Fr.splice(a,0,e),a===0&&Jp(e)}};var n1=l.version;if(n1!=="19.2.4")throw Error(i(527,n1,"19.2.4"));Z.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=d(n),e=e!==null?g(e):null,e=e===null?null:e.stateNode,e};var Ob={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nc.isDisabled&&nc.supportsFiber)try{vt=nc.inject(Ob),Je=nc}catch{}}return ds.createRoot=function(e,n){if(!c(e))throw Error(i(299));var a=!1,s="",h=cx,p=ux,w=fx;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(h=n.onUncaughtError),n.onCaughtError!==void 0&&(p=n.onCaughtError),n.onRecoverableError!==void 0&&(w=n.onRecoverableError)),n=qp(e,1,!1,null,null,a,s,null,h,p,w,t1),e[Bl]=n.current,Ef(e),new Xf(n)},ds.hydrateRoot=function(e,n,a){if(!c(e))throw Error(i(299));var s=!1,h="",p=cx,w=ux,N=fx,H=null;return a!=null&&(a.unstable_strictMode===!0&&(s=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(N=a.onRecoverableError),a.formState!==void 0&&(H=a.formState)),n=qp(e,1,!0,n,a??null,s,h,H,p,w,N,t1),n.context=Xp(null),a=n.current,s=Vn(),s=Kr(s),h=br(s),h.callback=null,vr(a,h,s),a=s,n.current.lanes=a,or(n,a),kl(n),e[Bl]=n.current,Ef(e),new tc(n)},ds.version="19.2.4",ds}var h1;function Kb(){if(h1)return Kf.exports;h1=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(l){console.error(l)}}return t(),Kf.exports=Gb(),Kf.exports}var Qb=Kb();const Wb="modulepreload",Zb=function(t){return"/"+t},m1={},Jb=function(l,r,i){let c=Promise.resolve();if(r&&r.length>0){let f=function(d){return Promise.all(d.map(g=>Promise.resolve(g).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),x=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));c=f(r.map(d=>{if(d=Zb(d),d in m1)return;m1[d]=!0;const g=d.endsWith(".css"),y=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${y}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":Wb,g||(b.as="script"),b.crossOrigin="",b.href=d,x&&b.setAttribute("nonce",x),document.head.appendChild(b),g)return new Promise((v,j)=>{b.addEventListener("load",v),b.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${d}`)))})}))}function u(f){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=f,window.dispatchEvent(m),!m.defaultPrevented)throw f}return c.then(f=>{for(const m of f||[])m.status==="rejected"&&u(m.reason);return l().catch(u)})};class Pb extends k.Component{constructor(){super(...arguments);l1(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(r){return{hasError:!0,error:r}}render(){var r;return this.state.hasError?o.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:o.jsxs("div",{className:"text-center max-w-md",children:[o.jsx("div",{className:"text-4xl mb-3",children:"🚨"}),o.jsx("div",{className:"text-gray-800 font-semibold mb-2",children:"Something went wrong"}),o.jsx("div",{className:"text-gray-500 text-sm mb-4",children:((r=this.state.error)==null?void 0:r.message)??"An unexpected error occurred."}),o.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-gray-800 text-white rounded-lg text-sm hover:bg-gray-700",children:"Reload"})]})}):this.props.children}}const Os="/api";async function Dt(t){const l=await fetch(`${Os}${t}`);if(!l.ok)throw new Error(`API error: ${l.status}`);return l.json()}async function kn(t,l){const r=await fetch(`${Os}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}async function Jf(t,l){const r=await fetch(`${Os}${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}async function Or(t,l){const r={method:"DELETE"};l!==void 0&&(r.headers={"Content-Type":"application/json"},r.body=JSON.stringify(l));const i=await fetch(`${Os}${t}`,r);if(!i.ok)throw new Error(`API error: ${i.status}`);return i.json()}const Ce={getCompany:()=>Dt("/company"),getRoles:()=>Dt("/roles"),getRole:t=>Dt(`/roles/${t}`),getProjects:()=>Dt("/projects"),getProject:t=>Dt(`/projects/${t}`),getStandups:()=>Dt("/operations/standups"),getWaves:()=>Dt("/operations/waves"),getDecisions:()=>Dt("/operations/decisions"),getOrgTree:()=>Dt("/engine/org"),getSkills:()=>Dt("/skills"),exportSkills:t=>Dt(`/skills/export/${t}`),getSkillRegistry:()=>Dt("/skills/registry"),installRegistrySkill:(t,l)=>kn("/skills/registry/install",{skillId:t,url:l}),createRole:t=>kn("/engine/roles",t),updateRole:(t,l)=>Jf(`/engine/roles/${t}`,l),deleteRole:t=>Or(`/engine/roles/${t}`),getSessions:()=>Dt("/sessions"),getSession:t=>Dt(`/sessions/${t}`),createSession:(t,l="talk")=>kn("/sessions",{roleId:t,mode:l}),deleteSession:t=>Or(`/sessions/${t}`),deleteSessions:t=>Or("/sessions",{ids:t}),deleteEmptySessions:()=>Or("/sessions?empty=true"),updateSession:(t,l)=>Jf(`/sessions/${t}`,l),startJob:t=>kn("/jobs",t),getJob:t=>Dt(`/jobs/${t}`),listJobs:t=>{const l=new URLSearchParams;t!=null&&t.status&&l.set("status",t.status),t!=null&&t.roleId&&l.set("roleId",t.roleId);const r=l.toString();return Dt(`/jobs${r?"?"+r:""}`)},abortJob:t=>Or(`/jobs/${t}`),getStatus:()=>Dt("/status"),detectEngine:()=>kn("/setup/detect-engine",{}),validatePath:t=>kn("/setup/validate-path",{path:t}),scaffold:t=>kn("/setup/scaffold",t),getTeams:()=>Dt("/setup/teams"),browse:t=>kn("/setup/browse",{path:t}),connectAkb:t=>kn("/setup/connect-akb",{path:t}),getKnowledge:()=>Dt("/knowledge"),getKnowledgeDoc:t=>Dt(`/knowledge/${t}`),createKnowledgeDoc:t=>kn("/knowledge",t),updateKnowledgeDoc:(t,l)=>fetch(`${Os}/knowledge/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:l})}).then(r=>{if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}),deleteKnowledgeDoc:t=>Or(`/knowledge/${t}`),getPreferences:()=>Dt("/preferences"),updatePreferences:t=>Jf("/preferences",t),chatInChannel:t=>kn("/speech/chat",t),getSaveStatus:()=>Dt("/save/status"),save:t=>kn("/save",{message:t}),getSaveHistory:(t=20)=>Dt(`/save/history?limit=${t}`),restoreSave:(t,l)=>kn("/save/restore",{sha:t,paths:l}),initGit:()=>kn("/save/init",{}),getCostSummary:()=>Dt("/cost/summary"),getSyncRoles:()=>Dt("/sync/roles"),applySyncUpdate:t=>kn("/sync/apply",t),getCompanyStats:()=>Dt("/sync/stats"),getGitStatus:()=>Dt("/git/status"),deleteWorktree:t=>Or(`/git/worktrees/${encodeURIComponent(t)}`),deleteBranch:t=>Or(`/git/branches/${encodeURIComponent(t)}`)};function V0(t){const[l,r]=k.useState([]),[i,c]=k.useState("idle"),[u,f]=k.useState(""),[m,x]=k.useState([]),d=k.useRef(-1),g=k.useRef(null),y=k.useRef(0),b=k.useCallback(()=>{var C;if(!t)return;(C=g.current)==null||C.abort();const j=new AbortController;g.current=j,c("connecting");const S=d.current+1,E=`/api/jobs/${t}/stream?from=${S}`;fetch(E,{signal:j.signal}).then(async A=>{if(!A.ok||!A.body){c("error");return}c("streaming");const M=A.body.getReader(),R=new TextDecoder;let L="";for(;;){const{done:O,value:U}=await M.read();if(O)break;L+=R.decode(U,{stream:!0});const X=L.split(`
|
|
50
|
+
`);L=X.pop()??"";let ne="";for(const D of X)if(D.startsWith("event: "))ne=D.slice(7).trim();else if(D.startsWith("data: ")){try{const Y=JSON.parse(D.slice(6));if(ne==="activity"){const F=Y;F.seq>d.current&&(d.current=F.seq),r(Q=>Q.some(ee=>ee.seq===F.seq)?Q:[...Q,F]),F.type==="text"&&f(Q=>Q+(F.data.text??"")),F.type==="dispatch:start"&&F.data.childJobId&&x(Q=>[...Q,F.data.childJobId]),F.type==="job:done"?c("done"):F.type==="job:error"&&c("error")}else if(ne==="stream:end"){const F=Y.reason;c(F==="done"?"done":F==="error"?"error":"done")}}catch{}ne=""}}i==="streaming"&&c("done")}).catch(A=>{A.name!=="AbortError"&&(c("error"),y.current<3&&(y.current++,setTimeout(b,1e3*y.current)))})},[t]),v=k.useCallback(()=>{y.current=0,b()},[b]);return k.useEffect(()=>{if(!t){r([]),c("idle"),f(""),x([]),d.current=-1;return}return r([]),f(""),x([]),d.current=-1,y.current=0,b(),()=>{var j;(j=g.current)==null||j.abort()}},[t,b]),{events:l,status:i,textOutput:u,childJobIds:m,reconnect:v}}function ev(t,l){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const tv=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nv=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lv={};function x1(t,l){return(lv.jsx?nv:tv).test(t)}const rv=/[ \t\n\f\r]/g;function av(t){return typeof t=="object"?t.type==="text"?p1(t.value):!1:p1(t)}function p1(t){return t.replace(rv,"")===""}class Bs{constructor(l,r,i){this.normal=r,this.property=l,i&&(this.space=i)}}Bs.prototype.normal={};Bs.prototype.property={};Bs.prototype.space=void 0;function G0(t,l){const r={},i={};for(const c of t)Object.assign(r,c.property),Object.assign(i,c.normal);return new Bs(r,i,l)}function Bd(t){return t.toLowerCase()}class On{constructor(l,r){this.attribute=r,this.property=l}}On.prototype.attribute="";On.prototype.booleanish=!1;On.prototype.boolean=!1;On.prototype.commaOrSpaceSeparated=!1;On.prototype.commaSeparated=!1;On.prototype.defined=!1;On.prototype.mustUseProperty=!1;On.prototype.number=!1;On.prototype.overloadedBoolean=!1;On.prototype.property="";On.prototype.spaceSeparated=!1;On.prototype.space=void 0;let iv=0;const Ze=Sa(),nn=Sa(),Ld=Sa(),ve=Sa(),Ft=Sa(),oi=Sa(),Gn=Sa();function Sa(){return 2**++iv}const $d=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ze,booleanish:nn,commaOrSpaceSeparated:Gn,commaSeparated:oi,number:ve,overloadedBoolean:Ld,spaceSeparated:Ft},Symbol.toStringTag,{value:"Module"})),Pf=Object.keys($d);class nh extends On{constructor(l,r,i,c){let u=-1;if(super(l,r),y1(this,"space",c),typeof i=="number")for(;++u<Pf.length;){const f=Pf[u];y1(this,Pf[u],(i&$d[f])===$d[f])}}}nh.prototype.defined=!0;function y1(t,l,r){r&&(t[l]=r)}function di(t){const l={},r={};for(const[i,c]of Object.entries(t.properties)){const u=new nh(i,t.transform(t.attributes||{},i),c,t.space);t.mustUseProperty&&t.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),l[i]=u,r[Bd(i)]=i,r[Bd(u.attribute)]=i}return new Bs(l,r,t.space)}const K0=di({properties:{ariaActiveDescendant:null,ariaAtomic:nn,ariaAutoComplete:null,ariaBusy:nn,ariaChecked:nn,ariaColCount:ve,ariaColIndex:ve,ariaColSpan:ve,ariaControls:Ft,ariaCurrent:null,ariaDescribedBy:Ft,ariaDetails:null,ariaDisabled:nn,ariaDropEffect:Ft,ariaErrorMessage:null,ariaExpanded:nn,ariaFlowTo:Ft,ariaGrabbed:nn,ariaHasPopup:null,ariaHidden:nn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ft,ariaLevel:ve,ariaLive:null,ariaModal:nn,ariaMultiLine:nn,ariaMultiSelectable:nn,ariaOrientation:null,ariaOwns:Ft,ariaPlaceholder:null,ariaPosInSet:ve,ariaPressed:nn,ariaReadOnly:nn,ariaRelevant:null,ariaRequired:nn,ariaRoleDescription:Ft,ariaRowCount:ve,ariaRowIndex:ve,ariaRowSpan:ve,ariaSelected:nn,ariaSetSize:ve,ariaSort:null,ariaValueMax:ve,ariaValueMin:ve,ariaValueNow:ve,ariaValueText:null,role:null},transform(t,l){return l==="role"?l:"aria-"+l.slice(4).toLowerCase()}});function Q0(t,l){return l in t?t[l]:l}function W0(t,l){return Q0(t,l.toLowerCase())}const sv=di({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:oi,acceptCharset:Ft,accessKey:Ft,action:null,allow:null,allowFullScreen:Ze,allowPaymentRequest:Ze,allowUserMedia:Ze,alt:null,as:null,async:Ze,autoCapitalize:null,autoComplete:Ft,autoFocus:Ze,autoPlay:Ze,blocking:Ft,capture:null,charSet:null,checked:Ze,cite:null,className:Ft,cols:ve,colSpan:null,content:null,contentEditable:nn,controls:Ze,controlsList:Ft,coords:ve|oi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ze,defer:Ze,dir:null,dirName:null,disabled:Ze,download:Ld,draggable:nn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ze,formTarget:null,headers:Ft,height:ve,hidden:Ld,high:ve,href:null,hrefLang:null,htmlFor:Ft,httpEquiv:Ft,id:null,imageSizes:null,imageSrcSet:null,inert:Ze,inputMode:null,integrity:null,is:null,isMap:Ze,itemId:null,itemProp:Ft,itemRef:Ft,itemScope:Ze,itemType:Ft,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ze,low:ve,manifest:null,max:null,maxLength:ve,media:null,method:null,min:null,minLength:ve,multiple:Ze,muted:Ze,name:null,nonce:null,noModule:Ze,noValidate:Ze,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ze,optimum:ve,pattern:null,ping:Ft,placeholder:null,playsInline:Ze,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ze,referrerPolicy:null,rel:Ft,required:Ze,reversed:Ze,rows:ve,rowSpan:ve,sandbox:Ft,scope:null,scoped:Ze,seamless:Ze,selected:Ze,shadowRootClonable:Ze,shadowRootDelegatesFocus:Ze,shadowRootMode:null,shape:null,size:ve,sizes:null,slot:null,span:ve,spellCheck:nn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ve,step:null,style:null,tabIndex:ve,target:null,title:null,translate:null,type:null,typeMustMatch:Ze,useMap:null,value:nn,width:ve,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ft,axis:null,background:null,bgColor:null,border:ve,borderColor:null,bottomMargin:ve,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ze,declare:Ze,event:null,face:null,frame:null,frameBorder:null,hSpace:ve,leftMargin:ve,link:null,longDesc:null,lowSrc:null,marginHeight:ve,marginWidth:ve,noResize:Ze,noHref:Ze,noShade:Ze,noWrap:Ze,object:null,profile:null,prompt:null,rev:null,rightMargin:ve,rules:null,scheme:null,scrolling:nn,standby:null,summary:null,text:null,topMargin:ve,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ve,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ze,disableRemotePlayback:Ze,prefix:null,property:null,results:ve,security:null,unselectable:null},space:"html",transform:W0}),ov=di({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:Gn,accentHeight:ve,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ve,amplitude:ve,arabicForm:null,ascent:ve,attributeName:null,attributeType:null,azimuth:ve,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ve,by:null,calcMode:null,capHeight:ve,className:Ft,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:ve,diffuseConstant:ve,direction:null,display:null,dur:null,divisor:ve,dominantBaseline:null,download:Ze,dx:null,dy:null,edgeMode:null,editable:null,elevation:ve,enableBackground:null,end:null,event:null,exponent:ve,externalResourcesRequired:null,fill:null,fillOpacity:ve,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:oi,g2:oi,glyphName:oi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ve,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ve,horizOriginX:ve,horizOriginY:ve,id:null,ideographic:ve,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ve,k:ve,k1:ve,k2:ve,k3:ve,k4:ve,kernelMatrix:Gn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ve,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:ve,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:ve,overlineThickness:ve,paintOrder:null,panose1:null,path:null,pathLength:ve,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ft,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ve,pointsAtY:ve,pointsAtZ:ve,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Gn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Gn,rev:Gn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Gn,requiredFeatures:Gn,requiredFonts:Gn,requiredFormats:Gn,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:ve,specularExponent:ve,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ve,strikethroughThickness:ve,string:null,stroke:null,strokeDashArray:Gn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ve,strokeOpacity:ve,strokeWidth:null,style:null,surfaceScale:ve,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Gn,tabIndex:ve,tableValues:null,target:null,targetX:ve,targetY:ve,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Gn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ve,underlineThickness:ve,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ve,values:null,vAlphabetic:ve,vMathematical:ve,vectorEffect:null,vHanging:ve,vIdeographic:ve,version:null,vertAdvY:ve,vertOriginX:ve,vertOriginY:ve,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ve,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Q0}),Z0=di({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,l){return"xlink:"+l.slice(5).toLowerCase()}}),J0=di({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:W0}),P0=di({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,l){return"xml:"+l.slice(3).toLowerCase()}}),cv={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},uv=/[A-Z]/g,g1=/-[a-z]/g,fv=/^data[-\w.:]+$/i;function dv(t,l){const r=Bd(l);let i=l,c=On;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&fv.test(l)){if(l.charAt(4)==="-"){const u=l.slice(5).replace(g1,mv);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=l.slice(4);if(!g1.test(u)){let f=u.replace(uv,hv);f.charAt(0)!=="-"&&(f="-"+f),l="data"+f}}c=nh}return new c(i,l)}function hv(t){return"-"+t.toLowerCase()}function mv(t){return t.charAt(1).toUpperCase()}const xv=G0([K0,sv,Z0,J0,P0],"html"),lh=G0([K0,ov,Z0,J0,P0],"svg");function pv(t){return t.join(" ").trim()}var ri={},ed,b1;function yv(){if(b1)return ed;b1=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,l=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,m=/^\s+|\s+$/g,x=`
|
|
51
|
+
`,d="/",g="*",y="",b="comment",v="declaration";function j(E,C){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];C=C||{};var A=1,M=1;function R(ee){var V=ee.match(l);V&&(A+=V.length);var I=ee.lastIndexOf(x);M=~I?ee.length-I:M+ee.length}function L(){var ee={line:A,column:M};return function(V){return V.position=new O(ee),ne(),V}}function O(ee){this.start=ee,this.end={line:A,column:M},this.source=C.source}O.prototype.content=E;function U(ee){var V=new Error(C.source+":"+A+":"+M+": "+ee);if(V.reason=ee,V.filename=C.source,V.line=A,V.column=M,V.source=E,!C.silent)throw V}function X(ee){var V=ee.exec(E);if(V){var I=V[0];return R(I),E=E.slice(I.length),V}}function ne(){X(r)}function D(ee){var V;for(ee=ee||[];V=Y();)V!==!1&&ee.push(V);return ee}function Y(){var ee=L();if(!(d!=E.charAt(0)||g!=E.charAt(1))){for(var V=2;y!=E.charAt(V)&&(g!=E.charAt(V)||d!=E.charAt(V+1));)++V;if(V+=2,y===E.charAt(V-1))return U("End of comment missing");var I=E.slice(2,V-2);return M+=2,R(I),E=E.slice(V),M+=2,ee({type:b,comment:I})}}function F(){var ee=L(),V=X(i);if(V){if(Y(),!X(c))return U("property missing ':'");var I=X(u),Z=ee({type:v,property:S(V[0].replace(t,y)),value:I?S(I[0].replace(t,y)):y});return X(f),Z}}function Q(){var ee=[];D(ee);for(var V;V=F();)V!==!1&&(ee.push(V),D(ee));return ee}return ne(),Q()}function S(E){return E?E.replace(m,y):y}return ed=j,ed}var v1;function gv(){if(v1)return ri;v1=1;var t=ri&&ri.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(ri,"__esModule",{value:!0}),ri.default=r;const l=t(yv());function r(i,c){let u=null;if(!i||typeof i!="string")return u;const f=(0,l.default)(i),m=typeof c=="function";return f.forEach(x=>{if(x.type!=="declaration")return;const{property:d,value:g}=x;m?c(d,g,x):g&&(u=u||{},u[d]=g)}),u}return ri}var hs={},w1;function bv(){if(w1)return hs;w1=1,Object.defineProperty(hs,"__esModule",{value:!0}),hs.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,l=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,u=function(d){return!d||r.test(d)||t.test(d)},f=function(d,g){return g.toUpperCase()},m=function(d,g){return"".concat(g,"-")},x=function(d,g){return g===void 0&&(g={}),u(d)?d:(d=d.toLowerCase(),g.reactCompat?d=d.replace(c,m):d=d.replace(i,m),d.replace(l,f))};return hs.camelCase=x,hs}var ms,k1;function vv(){if(k1)return ms;k1=1;var t=ms&&ms.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},l=t(gv()),r=bv();function i(c,u){var f={};return!c||typeof c!="string"||(0,l.default)(c,function(m,x){m&&x&&(f[(0,r.camelCase)(m,u)]=x)}),f}return i.default=i,ms=i,ms}var wv=vv();const kv=X0(wv),ey=ty("end"),rh=ty("start");function ty(t){return l;function l(r){const i=r&&r.position&&r.position[t]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function Sv(t){const l=rh(t),r=ey(t);if(l&&r)return{start:l,end:r}}function Es(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?S1(t.position):"start"in t||"end"in t?S1(t):"line"in t||"column"in t?Hd(t):""}function Hd(t){return j1(t&&t.line)+":"+j1(t&&t.column)}function S1(t){return Hd(t&&t.start)+"-"+Hd(t&&t.end)}function j1(t){return t&&typeof t=="number"?t:1}class bn extends Error{constructor(l,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let c="",u={},f=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof l=="string"?c=l:!u.cause&&l&&(f=!0,c=l.message,u.cause=l),!u.ruleId&&!u.source&&typeof i=="string"){const x=i.indexOf(":");x===-1?u.ruleId=i:(u.source=i.slice(0,x),u.ruleId=i.slice(x+1))}if(!u.place&&u.ancestors&&u.ancestors){const x=u.ancestors[u.ancestors.length-1];x&&(u.place=x.position)}const m=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=m?m.column:void 0,this.fatal=void 0,this.file="",this.message=c,this.line=m?m.line:void 0,this.name=Es(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=f&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}bn.prototype.file="";bn.prototype.name="";bn.prototype.reason="";bn.prototype.message="";bn.prototype.stack="";bn.prototype.column=void 0;bn.prototype.line=void 0;bn.prototype.ancestors=void 0;bn.prototype.cause=void 0;bn.prototype.fatal=void 0;bn.prototype.place=void 0;bn.prototype.ruleId=void 0;bn.prototype.source=void 0;const ah={}.hasOwnProperty,jv=new Map,Cv=/[A-Z]/g,Ev=new Set(["table","tbody","thead","tfoot","tr"]),Nv=new Set(["td","th"]),ny="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Av(t,l){if(!l||l.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=l.filePath||void 0;let i;if(l.development){if(typeof l.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=Ov(r,l.jsxDEV)}else{if(typeof l.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof l.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=_v(r,l.jsx,l.jsxs)}const c={Fragment:l.Fragment,ancestors:[],components:l.components||{},create:i,elementAttributeNameCase:l.elementAttributeNameCase||"react",evaluater:l.createEvaluater?l.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:l.ignoreInvalidStyle||!1,passKeys:l.passKeys!==!1,passNode:l.passNode||!1,schema:l.space==="svg"?lh:xv,stylePropertyNameCase:l.stylePropertyNameCase||"dom",tableCellAlignToStyle:l.tableCellAlignToStyle!==!1},u=ly(c,t,void 0);return u&&typeof u!="string"?u:c.create(t,c.Fragment,{children:u||void 0},void 0)}function ly(t,l,r){if(l.type==="element")return Tv(t,l,r);if(l.type==="mdxFlowExpression"||l.type==="mdxTextExpression")return Dv(t,l);if(l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement")return Mv(t,l,r);if(l.type==="mdxjsEsm")return zv(t,l);if(l.type==="root")return Rv(t,l,r);if(l.type==="text")return Fv(t,l)}function Tv(t,l,r){const i=t.schema;let c=i;l.tagName.toLowerCase()==="svg"&&i.space==="html"&&(c=lh,t.schema=c),t.ancestors.push(l);const u=ay(t,l.tagName,!1),f=Bv(t,l);let m=sh(t,l);return Ev.has(l.tagName)&&(m=m.filter(function(x){return typeof x=="string"?!av(x):!0})),ry(t,f,u,l),ih(f,m),t.ancestors.pop(),t.schema=i,t.create(l,u,f,r)}function Dv(t,l){if(l.data&&l.data.estree&&t.evaluater){const i=l.data.estree.body[0];return i.type,t.evaluater.evaluateExpression(i.expression)}zs(t,l.position)}function zv(t,l){if(l.data&&l.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(l.data.estree);zs(t,l.position)}function Mv(t,l,r){const i=t.schema;let c=i;l.name==="svg"&&i.space==="html"&&(c=lh,t.schema=c),t.ancestors.push(l);const u=l.name===null?t.Fragment:ay(t,l.name,!0),f=Lv(t,l),m=sh(t,l);return ry(t,f,u,l),ih(f,m),t.ancestors.pop(),t.schema=i,t.create(l,u,f,r)}function Rv(t,l,r){const i={};return ih(i,sh(t,l)),t.create(l,t.Fragment,i,r)}function Fv(t,l){return l.value}function ry(t,l,r,i){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(l.node=i)}function ih(t,l){if(l.length>0){const r=l.length>1?l:l[0];r&&(t.children=r)}}function _v(t,l,r){return i;function i(c,u,f,m){const d=Array.isArray(f.children)?r:l;return m?d(u,f,m):d(u,f)}}function Ov(t,l){return r;function r(i,c,u,f){const m=Array.isArray(u.children),x=rh(i);return l(c,u,f,m,{columnNumber:x?x.column-1:void 0,fileName:t,lineNumber:x?x.line:void 0},void 0)}}function Bv(t,l){const r={};let i,c;for(c in l.properties)if(c!=="children"&&ah.call(l.properties,c)){const u=$v(t,c,l.properties[c]);if(u){const[f,m]=u;t.tableCellAlignToStyle&&f==="align"&&typeof m=="string"&&Nv.has(l.tagName)?i=m:r[f]=m}}if(i){const u=r.style||(r.style={});u[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return r}function Lv(t,l){const r={};for(const i of l.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&t.evaluater){const u=i.data.estree.body[0];u.type;const f=u.expression;f.type;const m=f.properties[0];m.type,Object.assign(r,t.evaluater.evaluateExpression(m.argument))}else zs(t,l.position);else{const c=i.name;let u;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&t.evaluater){const m=i.value.data.estree.body[0];m.type,u=t.evaluater.evaluateExpression(m.expression)}else zs(t,l.position);else u=i.value===null?!0:i.value;r[c]=u}return r}function sh(t,l){const r=[];let i=-1;const c=t.passKeys?new Map:jv;for(;++i<l.children.length;){const u=l.children[i];let f;if(t.passKeys){const x=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(x){const d=c.get(x)||0;f=x+"-"+d,c.set(x,d+1)}}const m=ly(t,u,f);m!==void 0&&r.push(m)}return r}function $v(t,l,r){const i=dv(t.schema,l);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=i.commaSeparated?ev(r):pv(r)),i.property==="style"){let c=typeof r=="object"?r:Hv(t,String(r));return t.stylePropertyNameCase==="css"&&(c=Uv(c)),["style",c]}return[t.elementAttributeNameCase==="react"&&i.space?cv[i.property]||i.property:i.attribute,r]}}function Hv(t,l){try{return kv(l,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const i=r,c=new bn("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=t.filePath||void 0,c.url=ny+"#cannot-parse-style-attribute",c}}function ay(t,l,r){let i;if(!r)i={type:"Literal",value:l};else if(l.includes(".")){const c=l.split(".");let u=-1,f;for(;++u<c.length;){const m=x1(c[u])?{type:"Identifier",name:c[u]}:{type:"Literal",value:c[u]};f=f?{type:"MemberExpression",object:f,property:m,computed:!!(u&&m.type==="Literal"),optional:!1}:m}i=f}else i=x1(l)&&!/^[a-z]/.test(l)?{type:"Identifier",name:l}:{type:"Literal",value:l};if(i.type==="Literal"){const c=i.value;return ah.call(t.components,c)?t.components[c]:c}if(t.evaluater)return t.evaluater.evaluateExpression(i);zs(t)}function zs(t,l){const r=new bn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:l,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=t.filePath||void 0,r.url=ny+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Uv(t){const l={};let r;for(r in t)ah.call(t,r)&&(l[Iv(r)]=t[r]);return l}function Iv(t){let l=t.replace(Cv,Yv);return l.slice(0,3)==="ms-"&&(l="-"+l),l}function Yv(t){return"-"+t.toLowerCase()}const td={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},qv={};function oh(t,l){const r=qv,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,c=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return iy(t,i,c)}function iy(t,l,r){if(Xv(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(l&&"alt"in t&&t.alt)return t.alt;if("children"in t)return C1(t.children,l,r)}return Array.isArray(t)?C1(t,l,r):""}function C1(t,l,r){const i=[];let c=-1;for(;++c<t.length;)i[c]=iy(t[c],l,r);return i.join("")}function Xv(t){return!!(t&&typeof t=="object")}const E1=document.createElement("i");function ch(t){const l="&"+t+";";E1.innerHTML=l;const r=E1.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===l?!1:r}function Qn(t,l,r,i){const c=t.length;let u=0,f;if(l<0?l=-l>c?0:c+l:l=l>c?c:l,r=r>0?r:0,i.length<1e4)f=Array.from(i),f.unshift(l,r),t.splice(...f);else for(r&&t.splice(l,r);u<i.length;)f=i.slice(u,u+1e4),f.unshift(l,0),t.splice(...f),u+=1e4,l+=1e4}function il(t,l){return t.length>0?(Qn(t,t.length,0,l),t):l}const N1={}.hasOwnProperty;function sy(t){const l={};let r=-1;for(;++r<t.length;)Vv(l,t[r]);return l}function Vv(t,l){let r;for(r in l){const c=(N1.call(t,r)?t[r]:void 0)||(t[r]={}),u=l[r];let f;if(u)for(f in u){N1.call(c,f)||(c[f]=[]);const m=u[f];Gv(c[f],Array.isArray(m)?m:m?[m]:[])}}}function Gv(t,l){let r=-1;const i=[];for(;++r<l.length;)(l[r].add==="after"?t:i).push(l[r]);Qn(t,0,0,i)}function oy(t,l){const r=Number.parseInt(t,l);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function ml(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Sn=qr(/[A-Za-z]/),gn=qr(/[\dA-Za-z]/),Kv=qr(/[#-'*+\--9=?A-Z^-~]/);function Cc(t){return t!==null&&(t<32||t===127)}const Ud=qr(/\d/),Qv=qr(/[\dA-Fa-f]/),Wv=qr(/[!-/:-@[-`{-~]/);function Ue(t){return t!==null&&t<-2}function zt(t){return t!==null&&(t<0||t===32)}function it(t){return t===-2||t===-1||t===32}const Oc=qr(new RegExp("\\p{P}|\\p{S}","u")),wa=qr(/\s/);function qr(t){return l;function l(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function hi(t){const l=[];let r=-1,i=0,c=0;for(;++r<t.length;){const u=t.charCodeAt(r);let f="";if(u===37&&gn(t.charCodeAt(r+1))&&gn(t.charCodeAt(r+2)))c=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(f=String.fromCharCode(u));else if(u>55295&&u<57344){const m=t.charCodeAt(r+1);u<56320&&m>56319&&m<57344?(f=String.fromCharCode(u,m),c=1):f="�"}else f=String.fromCharCode(u);f&&(l.push(t.slice(i,r),encodeURIComponent(f)),i=r+c+1,f=""),c&&(r+=c,c=0)}return l.join("")+t.slice(i)}function ft(t,l,r,i){const c=i?i-1:Number.POSITIVE_INFINITY;let u=0;return f;function f(x){return it(x)?(t.enter(r),m(x)):l(x)}function m(x){return it(x)&&u++<c?(t.consume(x),m):(t.exit(r),l(x))}}const Zv={tokenize:Jv};function Jv(t){const l=t.attempt(this.parser.constructs.contentInitial,i,c);let r;return l;function i(m){if(m===null){t.consume(m);return}return t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),ft(t,l,"linePrefix")}function c(m){return t.enter("paragraph"),u(m)}function u(m){const x=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=x),r=x,f(m)}function f(m){if(m===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(m);return}return Ue(m)?(t.consume(m),t.exit("chunkText"),u):(t.consume(m),f)}}const Pv={tokenize:ew},A1={tokenize:tw};function ew(t){const l=this,r=[];let i=0,c,u,f;return m;function m(M){if(i<r.length){const R=r[i];return l.containerState=R[1],t.attempt(R[0].continuation,x,d)(M)}return d(M)}function x(M){if(i++,l.containerState._closeFlow){l.containerState._closeFlow=void 0,c&&A();const R=l.events.length;let L=R,O;for(;L--;)if(l.events[L][0]==="exit"&&l.events[L][1].type==="chunkFlow"){O=l.events[L][1].end;break}C(i);let U=R;for(;U<l.events.length;)l.events[U][1].end={...O},U++;return Qn(l.events,L+1,0,l.events.slice(R)),l.events.length=U,d(M)}return m(M)}function d(M){if(i===r.length){if(!c)return b(M);if(c.currentConstruct&&c.currentConstruct.concrete)return j(M);l.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return l.containerState={},t.check(A1,g,y)(M)}function g(M){return c&&A(),C(i),b(M)}function y(M){return l.parser.lazy[l.now().line]=i!==r.length,f=l.now().offset,j(M)}function b(M){return l.containerState={},t.attempt(A1,v,j)(M)}function v(M){return i++,r.push([l.currentConstruct,l.containerState]),b(M)}function j(M){if(M===null){c&&A(),C(0),t.consume(M);return}return c=c||l.parser.flow(l.now()),t.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:u}),S(M)}function S(M){if(M===null){E(t.exit("chunkFlow"),!0),C(0),t.consume(M);return}return Ue(M)?(t.consume(M),E(t.exit("chunkFlow")),i=0,l.interrupt=void 0,m):(t.consume(M),S)}function E(M,R){const L=l.sliceStream(M);if(R&&L.push(null),M.previous=u,u&&(u.next=M),u=M,c.defineSkip(M.start),c.write(L),l.parser.lazy[M.start.line]){let O=c.events.length;for(;O--;)if(c.events[O][1].start.offset<f&&(!c.events[O][1].end||c.events[O][1].end.offset>f))return;const U=l.events.length;let X=U,ne,D;for(;X--;)if(l.events[X][0]==="exit"&&l.events[X][1].type==="chunkFlow"){if(ne){D=l.events[X][1].end;break}ne=!0}for(C(i),O=U;O<l.events.length;)l.events[O][1].end={...D},O++;Qn(l.events,X+1,0,l.events.slice(U)),l.events.length=O}}function C(M){let R=r.length;for(;R-- >M;){const L=r[R];l.containerState=L[1],L[0].exit.call(l,t)}r.length=M}function A(){c.write([null]),u=void 0,c=void 0,l.containerState._closeFlow=void 0}}function tw(t,l,r){return ft(t,t.attempt(this.parser.constructs.document,l,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ci(t){if(t===null||zt(t)||wa(t))return 1;if(Oc(t))return 2}function Bc(t,l,r){const i=[];let c=-1;for(;++c<t.length;){const u=t[c].resolveAll;u&&!i.includes(u)&&(l=u(l,r),i.push(u))}return l}const Id={name:"attention",resolveAll:nw,tokenize:lw};function nw(t,l){let r=-1,i,c,u,f,m,x,d,g;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(i=r;i--;)if(t[i][0]==="exit"&&t[i][1].type==="attentionSequence"&&t[i][1]._open&&l.sliceSerialize(t[i][1]).charCodeAt(0)===l.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[i][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[i][1].end.offset-t[i][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;x=t[i][1].end.offset-t[i][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;const y={...t[i][1].end},b={...t[r][1].start};T1(y,-x),T1(b,x),f={type:x>1?"strongSequence":"emphasisSequence",start:y,end:{...t[i][1].end}},m={type:x>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:b},u={type:x>1?"strongText":"emphasisText",start:{...t[i][1].end},end:{...t[r][1].start}},c={type:x>1?"strong":"emphasis",start:{...f.start},end:{...m.end}},t[i][1].end={...f.start},t[r][1].start={...m.end},d=[],t[i][1].end.offset-t[i][1].start.offset&&(d=il(d,[["enter",t[i][1],l],["exit",t[i][1],l]])),d=il(d,[["enter",c,l],["enter",f,l],["exit",f,l],["enter",u,l]]),d=il(d,Bc(l.parser.constructs.insideSpan.null,t.slice(i+1,r),l)),d=il(d,[["exit",u,l],["enter",m,l],["exit",m,l],["exit",c,l]]),t[r][1].end.offset-t[r][1].start.offset?(g=2,d=il(d,[["enter",t[r][1],l],["exit",t[r][1],l]])):g=0,Qn(t,i-1,r-i+3,d),r=i+d.length-g-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function lw(t,l){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,c=ci(i);let u;return f;function f(x){return u=x,t.enter("attentionSequence"),m(x)}function m(x){if(x===u)return t.consume(x),m;const d=t.exit("attentionSequence"),g=ci(x),y=!g||g===2&&c||r.includes(x),b=!c||c===2&&g||r.includes(i);return d._open=!!(u===42?y:y&&(c||!b)),d._close=!!(u===42?b:b&&(g||!y)),l(x)}}function T1(t,l){t.column+=l,t.offset+=l,t._bufferIndex+=l}const rw={name:"autolink",tokenize:aw};function aw(t,l,r){let i=0;return c;function c(v){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),u}function u(v){return Sn(v)?(t.consume(v),f):v===64?r(v):d(v)}function f(v){return v===43||v===45||v===46||gn(v)?(i=1,m(v)):d(v)}function m(v){return v===58?(t.consume(v),i=0,x):(v===43||v===45||v===46||gn(v))&&i++<32?(t.consume(v),m):(i=0,d(v))}function x(v){return v===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),l):v===null||v===32||v===60||Cc(v)?r(v):(t.consume(v),x)}function d(v){return v===64?(t.consume(v),g):Kv(v)?(t.consume(v),d):r(v)}function g(v){return gn(v)?y(v):r(v)}function y(v){return v===46?(t.consume(v),i=0,g):v===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),l):b(v)}function b(v){if((v===45||gn(v))&&i++<63){const j=v===45?b:y;return t.consume(v),j}return r(v)}}const Ls={partial:!0,tokenize:iw};function iw(t,l,r){return i;function i(u){return it(u)?ft(t,c,"linePrefix")(u):c(u)}function c(u){return u===null||Ue(u)?l(u):r(u)}}const cy={continuation:{tokenize:ow},exit:cw,name:"blockQuote",tokenize:sw};function sw(t,l,r){const i=this;return c;function c(f){if(f===62){const m=i.containerState;return m.open||(t.enter("blockQuote",{_container:!0}),m.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(f),t.exit("blockQuoteMarker"),u}return r(f)}function u(f){return it(f)?(t.enter("blockQuotePrefixWhitespace"),t.consume(f),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),l):(t.exit("blockQuotePrefix"),l(f))}}function ow(t,l,r){const i=this;return c;function c(f){return it(f)?ft(t,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):u(f)}function u(f){return t.attempt(cy,l,r)(f)}}function cw(t){t.exit("blockQuote")}const uy={name:"characterEscape",tokenize:uw};function uw(t,l,r){return i;function i(u){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(u),t.exit("escapeMarker"),c}function c(u){return Wv(u)?(t.enter("characterEscapeValue"),t.consume(u),t.exit("characterEscapeValue"),t.exit("characterEscape"),l):r(u)}}const fy={name:"characterReference",tokenize:fw};function fw(t,l,r){const i=this;let c=0,u,f;return m;function m(y){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),x}function x(y){return y===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(y),t.exit("characterReferenceMarkerNumeric"),d):(t.enter("characterReferenceValue"),u=31,f=gn,g(y))}function d(y){return y===88||y===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(y),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),u=6,f=Qv,g):(t.enter("characterReferenceValue"),u=7,f=Ud,g(y))}function g(y){if(y===59&&c){const b=t.exit("characterReferenceValue");return f===gn&&!ch(i.sliceSerialize(b))?r(y):(t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),t.exit("characterReference"),l)}return f(y)&&c++<u?(t.consume(y),g):r(y)}}const D1={partial:!0,tokenize:hw},z1={concrete:!0,name:"codeFenced",tokenize:dw};function dw(t,l,r){const i=this,c={partial:!0,tokenize:L};let u=0,f=0,m;return x;function x(O){return d(O)}function d(O){const U=i.events[i.events.length-1];return u=U&&U[1].type==="linePrefix"?U[2].sliceSerialize(U[1],!0).length:0,m=O,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),g(O)}function g(O){return O===m?(f++,t.consume(O),g):f<3?r(O):(t.exit("codeFencedFenceSequence"),it(O)?ft(t,y,"whitespace")(O):y(O))}function y(O){return O===null||Ue(O)?(t.exit("codeFencedFence"),i.interrupt?l(O):t.check(D1,S,R)(O)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),b(O))}function b(O){return O===null||Ue(O)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),y(O)):it(O)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),ft(t,v,"whitespace")(O)):O===96&&O===m?r(O):(t.consume(O),b)}function v(O){return O===null||Ue(O)?y(O):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),j(O))}function j(O){return O===null||Ue(O)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),y(O)):O===96&&O===m?r(O):(t.consume(O),j)}function S(O){return t.attempt(c,R,E)(O)}function E(O){return t.enter("lineEnding"),t.consume(O),t.exit("lineEnding"),C}function C(O){return u>0&&it(O)?ft(t,A,"linePrefix",u+1)(O):A(O)}function A(O){return O===null||Ue(O)?t.check(D1,S,R)(O):(t.enter("codeFlowValue"),M(O))}function M(O){return O===null||Ue(O)?(t.exit("codeFlowValue"),A(O)):(t.consume(O),M)}function R(O){return t.exit("codeFenced"),l(O)}function L(O,U,X){let ne=0;return D;function D(V){return O.enter("lineEnding"),O.consume(V),O.exit("lineEnding"),Y}function Y(V){return O.enter("codeFencedFence"),it(V)?ft(O,F,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):F(V)}function F(V){return V===m?(O.enter("codeFencedFenceSequence"),Q(V)):X(V)}function Q(V){return V===m?(ne++,O.consume(V),Q):ne>=f?(O.exit("codeFencedFenceSequence"),it(V)?ft(O,ee,"whitespace")(V):ee(V)):X(V)}function ee(V){return V===null||Ue(V)?(O.exit("codeFencedFence"),U(V)):X(V)}}}function hw(t,l,r){const i=this;return c;function c(f){return f===null?r(f):(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u)}function u(f){return i.parser.lazy[i.now().line]?r(f):l(f)}}const nd={name:"codeIndented",tokenize:xw},mw={partial:!0,tokenize:pw};function xw(t,l,r){const i=this;return c;function c(d){return t.enter("codeIndented"),ft(t,u,"linePrefix",5)(d)}function u(d){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?f(d):r(d)}function f(d){return d===null?x(d):Ue(d)?t.attempt(mw,f,x)(d):(t.enter("codeFlowValue"),m(d))}function m(d){return d===null||Ue(d)?(t.exit("codeFlowValue"),f(d)):(t.consume(d),m)}function x(d){return t.exit("codeIndented"),l(d)}}function pw(t,l,r){const i=this;return c;function c(f){return i.parser.lazy[i.now().line]?r(f):Ue(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):ft(t,u,"linePrefix",5)(f)}function u(f){const m=i.events[i.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(f):Ue(f)?c(f):r(f)}}const yw={name:"codeText",previous:bw,resolve:gw,tokenize:vw};function gw(t){let l=t.length-4,r=3,i,c;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[l][1].type==="lineEnding"||t[l][1].type==="space")){for(i=r;++i<l;)if(t[i][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[l][1].type="codeTextPadding",r+=2,l-=2;break}}for(i=r-1,l++;++i<=l;)c===void 0?i!==l&&t[i][1].type!=="lineEnding"&&(c=i):(i===l||t[i][1].type==="lineEnding")&&(t[c][1].type="codeTextData",i!==c+2&&(t[c][1].end=t[i-1][1].end,t.splice(c+2,i-c-2),l-=i-c-2,i=c+2),c=void 0);return t}function bw(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function vw(t,l,r){let i=0,c,u;return f;function f(y){return t.enter("codeText"),t.enter("codeTextSequence"),m(y)}function m(y){return y===96?(t.consume(y),i++,m):(t.exit("codeTextSequence"),x(y))}function x(y){return y===null?r(y):y===32?(t.enter("space"),t.consume(y),t.exit("space"),x):y===96?(u=t.enter("codeTextSequence"),c=0,g(y)):Ue(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),x):(t.enter("codeTextData"),d(y))}function d(y){return y===null||y===32||y===96||Ue(y)?(t.exit("codeTextData"),x(y)):(t.consume(y),d)}function g(y){return y===96?(t.consume(y),c++,g):c===i?(t.exit("codeTextSequence"),t.exit("codeText"),l(y)):(u.type="codeTextData",d(y))}}class ww{constructor(l){this.left=l?[...l]:[],this.right=[]}get(l){if(l<0||l>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+l+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return l<this.left.length?this.left[l]:this.right[this.right.length-l+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(l,r){const i=r??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(l,i):l>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-l+this.left.length).reverse():this.left.slice(l).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(l,r,i){const c=r||0;this.setCursor(Math.trunc(l));const u=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return i&&xs(this.left,i),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(l){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(l)}pushMany(l){this.setCursor(Number.POSITIVE_INFINITY),xs(this.left,l)}unshift(l){this.setCursor(0),this.right.push(l)}unshiftMany(l){this.setCursor(0),xs(this.right,l.reverse())}setCursor(l){if(!(l===this.left.length||l>this.left.length&&this.right.length===0||l<0&&this.left.length===0))if(l<this.left.length){const r=this.left.splice(l,Number.POSITIVE_INFINITY);xs(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-l,Number.POSITIVE_INFINITY);xs(this.left,r.reverse())}}}function xs(t,l){let r=0;if(l.length<1e4)t.push(...l);else for(;r<l.length;)t.push(...l.slice(r,r+1e4)),r+=1e4}function dy(t){const l={};let r=-1,i,c,u,f,m,x,d;const g=new ww(t);for(;++r<g.length;){for(;r in l;)r=l[r];if(i=g.get(r),r&&i[1].type==="chunkFlow"&&g.get(r-1)[1].type==="listItemPrefix"&&(x=i[1]._tokenizer.events,u=0,u<x.length&&x[u][1].type==="lineEndingBlank"&&(u+=2),u<x.length&&x[u][1].type==="content"))for(;++u<x.length&&x[u][1].type!=="content";)x[u][1].type==="chunkText"&&(x[u][1]._isInFirstContentOfListItem=!0,u++);if(i[0]==="enter")i[1].contentType&&(Object.assign(l,kw(g,r)),r=l[r],d=!0);else if(i[1]._container){for(u=r,c=void 0;u--;)if(f=g.get(u),f[1].type==="lineEnding"||f[1].type==="lineEndingBlank")f[0]==="enter"&&(c&&(g.get(c)[1].type="lineEndingBlank"),f[1].type="lineEnding",c=u);else if(!(f[1].type==="linePrefix"||f[1].type==="listItemIndent"))break;c&&(i[1].end={...g.get(c)[1].start},m=g.slice(c,r),m.unshift(i),g.splice(c,r-c+1,m))}}return Qn(t,0,Number.POSITIVE_INFINITY,g.slice(0)),!d}function kw(t,l){const r=t.get(l)[1],i=t.get(l)[2];let c=l-1;const u=[];let f=r._tokenizer;f||(f=i.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(f._contentTypeTextTrailing=!0));const m=f.events,x=[],d={};let g,y,b=-1,v=r,j=0,S=0;const E=[S];for(;v;){for(;t.get(++c)[1]!==v;);u.push(c),v._tokenizer||(g=i.sliceStream(v),v.next||g.push(null),y&&f.defineSkip(v.start),v._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=!0),f.write(g),v._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=void 0)),y=v,v=v.next}for(v=r;++b<m.length;)m[b][0]==="exit"&&m[b-1][0]==="enter"&&m[b][1].type===m[b-1][1].type&&m[b][1].start.line!==m[b][1].end.line&&(S=b+1,E.push(S),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(f.events=[],v?(v._tokenizer=void 0,v.previous=void 0):E.pop(),b=E.length;b--;){const C=m.slice(E[b],E[b+1]),A=u.pop();x.push([A,A+C.length-1]),t.splice(A,2,C)}for(x.reverse(),b=-1;++b<x.length;)d[j+x[b][0]]=j+x[b][1],j+=x[b][1]-x[b][0]-1;return d}const Sw={resolve:Cw,tokenize:Ew},jw={partial:!0,tokenize:Nw};function Cw(t){return dy(t),t}function Ew(t,l){let r;return i;function i(m){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),c(m)}function c(m){return m===null?u(m):Ue(m)?t.check(jw,f,u)(m):(t.consume(m),c)}function u(m){return t.exit("chunkContent"),t.exit("content"),l(m)}function f(m){return t.consume(m),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,c}}function Nw(t,l,r){const i=this;return c;function c(f){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),ft(t,u,"linePrefix")}function u(f){if(f===null||Ue(f))return r(f);const m=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(f):t.interrupt(i.parser.constructs.flow,r,l)(f)}}function hy(t,l,r,i,c,u,f,m,x){const d=x||Number.POSITIVE_INFINITY;let g=0;return y;function y(C){return C===60?(t.enter(i),t.enter(c),t.enter(u),t.consume(C),t.exit(u),b):C===null||C===32||C===41||Cc(C)?r(C):(t.enter(i),t.enter(f),t.enter(m),t.enter("chunkString",{contentType:"string"}),S(C))}function b(C){return C===62?(t.enter(u),t.consume(C),t.exit(u),t.exit(c),t.exit(i),l):(t.enter(m),t.enter("chunkString",{contentType:"string"}),v(C))}function v(C){return C===62?(t.exit("chunkString"),t.exit(m),b(C)):C===null||C===60||Ue(C)?r(C):(t.consume(C),C===92?j:v)}function j(C){return C===60||C===62||C===92?(t.consume(C),v):v(C)}function S(C){return!g&&(C===null||C===41||zt(C))?(t.exit("chunkString"),t.exit(m),t.exit(f),t.exit(i),l(C)):g<d&&C===40?(t.consume(C),g++,S):C===41?(t.consume(C),g--,S):C===null||C===32||C===40||Cc(C)?r(C):(t.consume(C),C===92?E:S)}function E(C){return C===40||C===41||C===92?(t.consume(C),S):S(C)}}function my(t,l,r,i,c,u){const f=this;let m=0,x;return d;function d(v){return t.enter(i),t.enter(c),t.consume(v),t.exit(c),t.enter(u),g}function g(v){return m>999||v===null||v===91||v===93&&!x||v===94&&!m&&"_hiddenFootnoteSupport"in f.parser.constructs?r(v):v===93?(t.exit(u),t.enter(c),t.consume(v),t.exit(c),t.exit(i),l):Ue(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),g):(t.enter("chunkString",{contentType:"string"}),y(v))}function y(v){return v===null||v===91||v===93||Ue(v)||m++>999?(t.exit("chunkString"),g(v)):(t.consume(v),x||(x=!it(v)),v===92?b:y)}function b(v){return v===91||v===92||v===93?(t.consume(v),m++,y):y(v)}}function xy(t,l,r,i,c,u){let f;return m;function m(b){return b===34||b===39||b===40?(t.enter(i),t.enter(c),t.consume(b),t.exit(c),f=b===40?41:b,x):r(b)}function x(b){return b===f?(t.enter(c),t.consume(b),t.exit(c),t.exit(i),l):(t.enter(u),d(b))}function d(b){return b===f?(t.exit(u),x(f)):b===null?r(b):Ue(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),ft(t,d,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===f||b===null||Ue(b)?(t.exit("chunkString"),d(b)):(t.consume(b),b===92?y:g)}function y(b){return b===f||b===92?(t.consume(b),g):g(b)}}function Ns(t,l){let r;return i;function i(c){return Ue(c)?(t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),r=!0,i):it(c)?ft(t,i,r?"linePrefix":"lineSuffix")(c):l(c)}}const Aw={name:"definition",tokenize:Dw},Tw={partial:!0,tokenize:zw};function Dw(t,l,r){const i=this;let c;return u;function u(v){return t.enter("definition"),f(v)}function f(v){return my.call(i,t,m,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function m(v){return c=ml(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),x):r(v)}function x(v){return zt(v)?Ns(t,d)(v):d(v)}function d(v){return hy(t,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function g(v){return t.attempt(Tw,y,y)(v)}function y(v){return it(v)?ft(t,b,"whitespace")(v):b(v)}function b(v){return v===null||Ue(v)?(t.exit("definition"),i.parser.defined.push(c),l(v)):r(v)}}function zw(t,l,r){return i;function i(m){return zt(m)?Ns(t,c)(m):r(m)}function c(m){return xy(t,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(m)}function u(m){return it(m)?ft(t,f,"whitespace")(m):f(m)}function f(m){return m===null||Ue(m)?l(m):r(m)}}const Mw={name:"hardBreakEscape",tokenize:Rw};function Rw(t,l,r){return i;function i(u){return t.enter("hardBreakEscape"),t.consume(u),c}function c(u){return Ue(u)?(t.exit("hardBreakEscape"),l(u)):r(u)}}const Fw={name:"headingAtx",resolve:_w,tokenize:Ow};function _w(t,l){let r=t.length-2,i=3,c,u;return t[i][1].type==="whitespace"&&(i+=2),r-2>i&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(i===r-1||r-4>i&&t[r-2][1].type==="whitespace")&&(r-=i+1===r?2:4),r>i&&(c={type:"atxHeadingText",start:t[i][1].start,end:t[r][1].end},u={type:"chunkText",start:t[i][1].start,end:t[r][1].end,contentType:"text"},Qn(t,i,r-i+1,[["enter",c,l],["enter",u,l],["exit",u,l],["exit",c,l]])),t}function Ow(t,l,r){let i=0;return c;function c(g){return t.enter("atxHeading"),u(g)}function u(g){return t.enter("atxHeadingSequence"),f(g)}function f(g){return g===35&&i++<6?(t.consume(g),f):g===null||zt(g)?(t.exit("atxHeadingSequence"),m(g)):r(g)}function m(g){return g===35?(t.enter("atxHeadingSequence"),x(g)):g===null||Ue(g)?(t.exit("atxHeading"),l(g)):it(g)?ft(t,m,"whitespace")(g):(t.enter("atxHeadingText"),d(g))}function x(g){return g===35?(t.consume(g),x):(t.exit("atxHeadingSequence"),m(g))}function d(g){return g===null||g===35||zt(g)?(t.exit("atxHeadingText"),m(g)):(t.consume(g),d)}}const Bw=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],M1=["pre","script","style","textarea"],Lw={concrete:!0,name:"htmlFlow",resolveTo:Uw,tokenize:Iw},$w={partial:!0,tokenize:qw},Hw={partial:!0,tokenize:Yw};function Uw(t){let l=t.length;for(;l--&&!(t[l][0]==="enter"&&t[l][1].type==="htmlFlow"););return l>1&&t[l-2][1].type==="linePrefix"&&(t[l][1].start=t[l-2][1].start,t[l+1][1].start=t[l-2][1].start,t.splice(l-2,2)),t}function Iw(t,l,r){const i=this;let c,u,f,m,x;return d;function d(T){return g(T)}function g(T){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(T),y}function y(T){return T===33?(t.consume(T),b):T===47?(t.consume(T),u=!0,S):T===63?(t.consume(T),c=3,i.interrupt?l:z):Sn(T)?(t.consume(T),f=String.fromCharCode(T),E):r(T)}function b(T){return T===45?(t.consume(T),c=2,v):T===91?(t.consume(T),c=5,m=0,j):Sn(T)?(t.consume(T),c=4,i.interrupt?l:z):r(T)}function v(T){return T===45?(t.consume(T),i.interrupt?l:z):r(T)}function j(T){const me="CDATA[";return T===me.charCodeAt(m++)?(t.consume(T),m===me.length?i.interrupt?l:F:j):r(T)}function S(T){return Sn(T)?(t.consume(T),f=String.fromCharCode(T),E):r(T)}function E(T){if(T===null||T===47||T===62||zt(T)){const me=T===47,Se=f.toLowerCase();return!me&&!u&&M1.includes(Se)?(c=1,i.interrupt?l(T):F(T)):Bw.includes(f.toLowerCase())?(c=6,me?(t.consume(T),C):i.interrupt?l(T):F(T)):(c=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(T):u?A(T):M(T))}return T===45||gn(T)?(t.consume(T),f+=String.fromCharCode(T),E):r(T)}function C(T){return T===62?(t.consume(T),i.interrupt?l:F):r(T)}function A(T){return it(T)?(t.consume(T),A):D(T)}function M(T){return T===47?(t.consume(T),D):T===58||T===95||Sn(T)?(t.consume(T),R):it(T)?(t.consume(T),M):D(T)}function R(T){return T===45||T===46||T===58||T===95||gn(T)?(t.consume(T),R):L(T)}function L(T){return T===61?(t.consume(T),O):it(T)?(t.consume(T),L):M(T)}function O(T){return T===null||T===60||T===61||T===62||T===96?r(T):T===34||T===39?(t.consume(T),x=T,U):it(T)?(t.consume(T),O):X(T)}function U(T){return T===x?(t.consume(T),x=null,ne):T===null||Ue(T)?r(T):(t.consume(T),U)}function X(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||zt(T)?L(T):(t.consume(T),X)}function ne(T){return T===47||T===62||it(T)?M(T):r(T)}function D(T){return T===62?(t.consume(T),Y):r(T)}function Y(T){return T===null||Ue(T)?F(T):it(T)?(t.consume(T),Y):r(T)}function F(T){return T===45&&c===2?(t.consume(T),I):T===60&&c===1?(t.consume(T),Z):T===62&&c===4?(t.consume(T),B):T===63&&c===3?(t.consume(T),z):T===93&&c===5?(t.consume(T),we):Ue(T)&&(c===6||c===7)?(t.exit("htmlFlowData"),t.check($w,W,Q)(T)):T===null||Ue(T)?(t.exit("htmlFlowData"),Q(T)):(t.consume(T),F)}function Q(T){return t.check(Hw,ee,W)(T)}function ee(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),V}function V(T){return T===null||Ue(T)?Q(T):(t.enter("htmlFlowData"),F(T))}function I(T){return T===45?(t.consume(T),z):F(T)}function Z(T){return T===47?(t.consume(T),f="",ce):F(T)}function ce(T){if(T===62){const me=f.toLowerCase();return M1.includes(me)?(t.consume(T),B):F(T)}return Sn(T)&&f.length<8?(t.consume(T),f+=String.fromCharCode(T),ce):F(T)}function we(T){return T===93?(t.consume(T),z):F(T)}function z(T){return T===62?(t.consume(T),B):T===45&&c===2?(t.consume(T),z):F(T)}function B(T){return T===null||Ue(T)?(t.exit("htmlFlowData"),W(T)):(t.consume(T),B)}function W(T){return t.exit("htmlFlow"),l(T)}}function Yw(t,l,r){const i=this;return c;function c(f){return Ue(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u):r(f)}function u(f){return i.parser.lazy[i.now().line]?r(f):l(f)}}function qw(t,l,r){return i;function i(c){return t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),t.attempt(Ls,l,r)}}const Xw={name:"htmlText",tokenize:Vw};function Vw(t,l,r){const i=this;let c,u,f;return m;function m(z){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(z),x}function x(z){return z===33?(t.consume(z),d):z===47?(t.consume(z),L):z===63?(t.consume(z),M):Sn(z)?(t.consume(z),X):r(z)}function d(z){return z===45?(t.consume(z),g):z===91?(t.consume(z),u=0,j):Sn(z)?(t.consume(z),A):r(z)}function g(z){return z===45?(t.consume(z),v):r(z)}function y(z){return z===null?r(z):z===45?(t.consume(z),b):Ue(z)?(f=y,Z(z)):(t.consume(z),y)}function b(z){return z===45?(t.consume(z),v):y(z)}function v(z){return z===62?I(z):z===45?b(z):y(z)}function j(z){const B="CDATA[";return z===B.charCodeAt(u++)?(t.consume(z),u===B.length?S:j):r(z)}function S(z){return z===null?r(z):z===93?(t.consume(z),E):Ue(z)?(f=S,Z(z)):(t.consume(z),S)}function E(z){return z===93?(t.consume(z),C):S(z)}function C(z){return z===62?I(z):z===93?(t.consume(z),C):S(z)}function A(z){return z===null||z===62?I(z):Ue(z)?(f=A,Z(z)):(t.consume(z),A)}function M(z){return z===null?r(z):z===63?(t.consume(z),R):Ue(z)?(f=M,Z(z)):(t.consume(z),M)}function R(z){return z===62?I(z):M(z)}function L(z){return Sn(z)?(t.consume(z),O):r(z)}function O(z){return z===45||gn(z)?(t.consume(z),O):U(z)}function U(z){return Ue(z)?(f=U,Z(z)):it(z)?(t.consume(z),U):I(z)}function X(z){return z===45||gn(z)?(t.consume(z),X):z===47||z===62||zt(z)?ne(z):r(z)}function ne(z){return z===47?(t.consume(z),I):z===58||z===95||Sn(z)?(t.consume(z),D):Ue(z)?(f=ne,Z(z)):it(z)?(t.consume(z),ne):I(z)}function D(z){return z===45||z===46||z===58||z===95||gn(z)?(t.consume(z),D):Y(z)}function Y(z){return z===61?(t.consume(z),F):Ue(z)?(f=Y,Z(z)):it(z)?(t.consume(z),Y):ne(z)}function F(z){return z===null||z===60||z===61||z===62||z===96?r(z):z===34||z===39?(t.consume(z),c=z,Q):Ue(z)?(f=F,Z(z)):it(z)?(t.consume(z),F):(t.consume(z),ee)}function Q(z){return z===c?(t.consume(z),c=void 0,V):z===null?r(z):Ue(z)?(f=Q,Z(z)):(t.consume(z),Q)}function ee(z){return z===null||z===34||z===39||z===60||z===61||z===96?r(z):z===47||z===62||zt(z)?ne(z):(t.consume(z),ee)}function V(z){return z===47||z===62||zt(z)?ne(z):r(z)}function I(z){return z===62?(t.consume(z),t.exit("htmlTextData"),t.exit("htmlText"),l):r(z)}function Z(z){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),ce}function ce(z){return it(z)?ft(t,we,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):we(z)}function we(z){return t.enter("htmlTextData"),f(z)}}const uh={name:"labelEnd",resolveAll:Ww,resolveTo:Zw,tokenize:Jw},Gw={tokenize:Pw},Kw={tokenize:e5},Qw={tokenize:t5};function Ww(t){let l=-1;const r=[];for(;++l<t.length;){const i=t[l][1];if(r.push(t[l]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const c=i.type==="labelImage"?4:2;i.type="data",l+=c}}return t.length!==r.length&&Qn(t,0,t.length,r),t}function Zw(t,l){let r=t.length,i=0,c,u,f,m;for(;r--;)if(c=t[r][1],u){if(c.type==="link"||c.type==="labelLink"&&c._inactive)break;t[r][0]==="enter"&&c.type==="labelLink"&&(c._inactive=!0)}else if(f){if(t[r][0]==="enter"&&(c.type==="labelImage"||c.type==="labelLink")&&!c._balanced&&(u=r,c.type!=="labelLink")){i=2;break}}else c.type==="labelEnd"&&(f=r);const x={type:t[u][1].type==="labelLink"?"link":"image",start:{...t[u][1].start},end:{...t[t.length-1][1].end}},d={type:"label",start:{...t[u][1].start},end:{...t[f][1].end}},g={type:"labelText",start:{...t[u+i+2][1].end},end:{...t[f-2][1].start}};return m=[["enter",x,l],["enter",d,l]],m=il(m,t.slice(u+1,u+i+3)),m=il(m,[["enter",g,l]]),m=il(m,Bc(l.parser.constructs.insideSpan.null,t.slice(u+i+4,f-3),l)),m=il(m,[["exit",g,l],t[f-2],t[f-1],["exit",d,l]]),m=il(m,t.slice(f+1)),m=il(m,[["exit",x,l]]),Qn(t,u,t.length,m),t}function Jw(t,l,r){const i=this;let c=i.events.length,u,f;for(;c--;)if((i.events[c][1].type==="labelImage"||i.events[c][1].type==="labelLink")&&!i.events[c][1]._balanced){u=i.events[c][1];break}return m;function m(b){return u?u._inactive?y(b):(f=i.parser.defined.includes(ml(i.sliceSerialize({start:u.end,end:i.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(b),t.exit("labelMarker"),t.exit("labelEnd"),x):r(b)}function x(b){return b===40?t.attempt(Gw,g,f?g:y)(b):b===91?t.attempt(Kw,g,f?d:y)(b):f?g(b):y(b)}function d(b){return t.attempt(Qw,g,y)(b)}function g(b){return l(b)}function y(b){return u._balanced=!0,r(b)}}function Pw(t,l,r){return i;function i(y){return t.enter("resource"),t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),c}function c(y){return zt(y)?Ns(t,u)(y):u(y)}function u(y){return y===41?g(y):hy(t,f,m,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function f(y){return zt(y)?Ns(t,x)(y):g(y)}function m(y){return r(y)}function x(y){return y===34||y===39||y===40?xy(t,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function d(y){return zt(y)?Ns(t,g)(y):g(y)}function g(y){return y===41?(t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),t.exit("resource"),l):r(y)}}function e5(t,l,r){const i=this;return c;function c(m){return my.call(i,t,u,f,"reference","referenceMarker","referenceString")(m)}function u(m){return i.parser.defined.includes(ml(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?l(m):r(m)}function f(m){return r(m)}}function t5(t,l,r){return i;function i(u){return t.enter("reference"),t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),c}function c(u){return u===93?(t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),t.exit("reference"),l):r(u)}}const n5={name:"labelStartImage",resolveAll:uh.resolveAll,tokenize:l5};function l5(t,l,r){const i=this;return c;function c(m){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(m),t.exit("labelImageMarker"),u}function u(m){return m===91?(t.enter("labelMarker"),t.consume(m),t.exit("labelMarker"),t.exit("labelImage"),f):r(m)}function f(m){return m===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(m):l(m)}}const r5={name:"labelStartLink",resolveAll:uh.resolveAll,tokenize:a5};function a5(t,l,r){const i=this;return c;function c(f){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(f),t.exit("labelMarker"),t.exit("labelLink"),u}function u(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(f):l(f)}}const ld={name:"lineEnding",tokenize:i5};function i5(t,l){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),ft(t,l,"linePrefix")}}const bc={name:"thematicBreak",tokenize:s5};function s5(t,l,r){let i=0,c;return u;function u(d){return t.enter("thematicBreak"),f(d)}function f(d){return c=d,m(d)}function m(d){return d===c?(t.enter("thematicBreakSequence"),x(d)):i>=3&&(d===null||Ue(d))?(t.exit("thematicBreak"),l(d)):r(d)}function x(d){return d===c?(t.consume(d),i++,x):(t.exit("thematicBreakSequence"),it(d)?ft(t,m,"whitespace")(d):m(d))}}const _n={continuation:{tokenize:f5},exit:h5,name:"list",tokenize:u5},o5={partial:!0,tokenize:m5},c5={partial:!0,tokenize:d5};function u5(t,l,r){const i=this,c=i.events[i.events.length-1];let u=c&&c[1].type==="linePrefix"?c[2].sliceSerialize(c[1],!0).length:0,f=0;return m;function m(v){const j=i.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(j==="listUnordered"?!i.containerState.marker||v===i.containerState.marker:Ud(v)){if(i.containerState.type||(i.containerState.type=j,t.enter(j,{_container:!0})),j==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(bc,r,d)(v):d(v);if(!i.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),x(v)}return r(v)}function x(v){return Ud(v)&&++f<10?(t.consume(v),x):(!i.interrupt||f<2)&&(i.containerState.marker?v===i.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),d(v)):r(v)}function d(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||v,t.check(Ls,i.interrupt?r:g,t.attempt(o5,b,y))}function g(v){return i.containerState.initialBlankLine=!0,u++,b(v)}function y(v){return it(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),b):r(v)}function b(v){return i.containerState.size=u+i.sliceSerialize(t.exit("listItemPrefix"),!0).length,l(v)}}function f5(t,l,r){const i=this;return i.containerState._closeFlow=void 0,t.check(Ls,c,u);function c(m){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,ft(t,l,"listItemIndent",i.containerState.size+1)(m)}function u(m){return i.containerState.furtherBlankLines||!it(m)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,f(m)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,t.attempt(c5,l,f)(m))}function f(m){return i.containerState._closeFlow=!0,i.interrupt=void 0,ft(t,t.attempt(_n,l,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m)}}function d5(t,l,r){const i=this;return ft(t,c,"listItemIndent",i.containerState.size+1);function c(u){const f=i.events[i.events.length-1];return f&&f[1].type==="listItemIndent"&&f[2].sliceSerialize(f[1],!0).length===i.containerState.size?l(u):r(u)}}function h5(t){t.exit(this.containerState.type)}function m5(t,l,r){const i=this;return ft(t,c,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(u){const f=i.events[i.events.length-1];return!it(u)&&f&&f[1].type==="listItemPrefixWhitespace"?l(u):r(u)}}const R1={name:"setextUnderline",resolveTo:x5,tokenize:p5};function x5(t,l){let r=t.length,i,c,u;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){i=r;break}t[r][1].type==="paragraph"&&(c=r)}else t[r][1].type==="content"&&t.splice(r,1),!u&&t[r][1].type==="definition"&&(u=r);const f={type:"setextHeading",start:{...t[i][1].start},end:{...t[t.length-1][1].end}};return t[c][1].type="setextHeadingText",u?(t.splice(c,0,["enter",f,l]),t.splice(u+1,0,["exit",t[i][1],l]),t[i][1].end={...t[u][1].end}):t[i][1]=f,t.push(["exit",f,l]),t}function p5(t,l,r){const i=this;let c;return u;function u(d){let g=i.events.length,y;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){y=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||y)?(t.enter("setextHeadingLine"),c=d,f(d)):r(d)}function f(d){return t.enter("setextHeadingLineSequence"),m(d)}function m(d){return d===c?(t.consume(d),m):(t.exit("setextHeadingLineSequence"),it(d)?ft(t,x,"lineSuffix")(d):x(d))}function x(d){return d===null||Ue(d)?(t.exit("setextHeadingLine"),l(d)):r(d)}}const y5={tokenize:g5};function g5(t){const l=this,r=t.attempt(Ls,i,t.attempt(this.parser.constructs.flowInitial,c,ft(t,t.attempt(this.parser.constructs.flow,c,t.attempt(Sw,c)),"linePrefix")));return r;function i(u){if(u===null){t.consume(u);return}return t.enter("lineEndingBlank"),t.consume(u),t.exit("lineEndingBlank"),l.currentConstruct=void 0,r}function c(u){if(u===null){t.consume(u);return}return t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),l.currentConstruct=void 0,r}}const b5={resolveAll:yy()},v5=py("string"),w5=py("text");function py(t){return{resolveAll:yy(t==="text"?k5:void 0),tokenize:l};function l(r){const i=this,c=this.parser.constructs[t],u=r.attempt(c,f,m);return f;function f(g){return d(g)?u(g):m(g)}function m(g){if(g===null){r.consume(g);return}return r.enter("data"),r.consume(g),x}function x(g){return d(g)?(r.exit("data"),u(g)):(r.consume(g),x)}function d(g){if(g===null)return!0;const y=c[g];let b=-1;if(y)for(;++b<y.length;){const v=y[b];if(!v.previous||v.previous.call(i,i.previous))return!0}return!1}}}function yy(t){return l;function l(r,i){let c=-1,u;for(;++c<=r.length;)u===void 0?r[c]&&r[c][1].type==="data"&&(u=c,c++):(!r[c]||r[c][1].type!=="data")&&(c!==u+2&&(r[u][1].end=r[c-1][1].end,r.splice(u+2,c-u-2),c=u+2),u=void 0);return t?t(r,i):r}}function k5(t,l){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){const i=t[r-1][1],c=l.sliceStream(i);let u=c.length,f=-1,m=0,x;for(;u--;){const d=c[u];if(typeof d=="string"){for(f=d.length;d.charCodeAt(f-1)===32;)m++,f--;if(f)break;f=-1}else if(d===-2)x=!0,m++;else if(d!==-1){u++;break}}if(l._contentTypeTextTrailing&&r===t.length&&(m=0),m){const d={type:r===t.length||x||m<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?f:i.start._bufferIndex+f,_index:i.start._index+u,line:i.end.line,column:i.end.column-m,offset:i.end.offset-m},end:{...i.end}};i.end={...d.start},i.start.offset===i.end.offset?Object.assign(i,d):(t.splice(r,0,["enter",d,l],["exit",d,l]),r+=2)}r++}return t}const S5={42:_n,43:_n,45:_n,48:_n,49:_n,50:_n,51:_n,52:_n,53:_n,54:_n,55:_n,56:_n,57:_n,62:cy},j5={91:Aw},C5={[-2]:nd,[-1]:nd,32:nd},E5={35:Fw,42:bc,45:[R1,bc],60:Lw,61:R1,95:bc,96:z1,126:z1},N5={38:fy,92:uy},A5={[-5]:ld,[-4]:ld,[-3]:ld,33:n5,38:fy,42:Id,60:[rw,Xw],91:r5,92:[Mw,uy],93:uh,95:Id,96:yw},T5={null:[Id,b5]},D5={null:[42,95]},z5={null:[]},M5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:D5,contentInitial:j5,disable:z5,document:S5,flow:E5,flowInitial:C5,insideSpan:T5,string:N5,text:A5},Symbol.toStringTag,{value:"Module"}));function R5(t,l,r){let i={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const c={},u=[];let f=[],m=[];const x={attempt:U(L),check:U(O),consume:A,enter:M,exit:R,interrupt:U(O,{interrupt:!0})},d={code:null,containerState:{},defineSkip:S,events:[],now:j,parser:t,previous:null,sliceSerialize:b,sliceStream:v,write:y};let g=l.tokenize.call(d,x);return l.resolveAll&&u.push(l),d;function y(Y){return f=il(f,Y),E(),f[f.length-1]!==null?[]:(X(l,0),d.events=Bc(u,d.events,d),d.events)}function b(Y,F){return _5(v(Y),F)}function v(Y){return F5(f,Y)}function j(){const{_bufferIndex:Y,_index:F,line:Q,column:ee,offset:V}=i;return{_bufferIndex:Y,_index:F,line:Q,column:ee,offset:V}}function S(Y){c[Y.line]=Y.column,D()}function E(){let Y;for(;i._index<f.length;){const F=f[i._index];if(typeof F=="string")for(Y=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===Y&&i._bufferIndex<F.length;)C(F.charCodeAt(i._bufferIndex));else C(F)}}function C(Y){g=g(Y)}function A(Y){Ue(Y)?(i.line++,i.column=1,i.offset+=Y===-3?2:1,D()):Y!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===f[i._index].length&&(i._bufferIndex=-1,i._index++)),d.previous=Y}function M(Y,F){const Q=F||{};return Q.type=Y,Q.start=j(),d.events.push(["enter",Q,d]),m.push(Q),Q}function R(Y){const F=m.pop();return F.end=j(),d.events.push(["exit",F,d]),F}function L(Y,F){X(Y,F.from)}function O(Y,F){F.restore()}function U(Y,F){return Q;function Q(ee,V,I){let Z,ce,we,z;return Array.isArray(ee)?W(ee):"tokenize"in ee?W([ee]):B(ee);function B(Ee){return Oe;function Oe(He){const Ge=He!==null&&Ee[He],ke=He!==null&&Ee.null,xt=[...Array.isArray(Ge)?Ge:Ge?[Ge]:[],...Array.isArray(ke)?ke:ke?[ke]:[]];return W(xt)(He)}}function W(Ee){return Z=Ee,ce=0,Ee.length===0?I:T(Ee[ce])}function T(Ee){return Oe;function Oe(He){return z=ne(),we=Ee,Ee.partial||(d.currentConstruct=Ee),Ee.name&&d.parser.constructs.disable.null.includes(Ee.name)?Se():Ee.tokenize.call(F?Object.assign(Object.create(d),F):d,x,me,Se)(He)}}function me(Ee){return Y(we,z),V}function Se(Ee){return z.restore(),++ce<Z.length?T(Z[ce]):I}}}function X(Y,F){Y.resolveAll&&!u.includes(Y)&&u.push(Y),Y.resolve&&Qn(d.events,F,d.events.length-F,Y.resolve(d.events.slice(F),d)),Y.resolveTo&&(d.events=Y.resolveTo(d.events,d))}function ne(){const Y=j(),F=d.previous,Q=d.currentConstruct,ee=d.events.length,V=Array.from(m);return{from:ee,restore:I};function I(){i=Y,d.previous=F,d.currentConstruct=Q,d.events.length=ee,m=V,D()}}function D(){i.line in c&&i.column<2&&(i.column=c[i.line],i.offset+=c[i.line]-1)}}function F5(t,l){const r=l.start._index,i=l.start._bufferIndex,c=l.end._index,u=l.end._bufferIndex;let f;if(r===c)f=[t[r].slice(i,u)];else{if(f=t.slice(r,c),i>-1){const m=f[0];typeof m=="string"?f[0]=m.slice(i):f.shift()}u>0&&f.push(t[c].slice(0,u))}return f}function _5(t,l){let r=-1;const i=[];let c;for(;++r<t.length;){const u=t[r];let f;if(typeof u=="string")f=u;else switch(u){case-5:{f="\r";break}case-4:{f=`
|
|
52
52
|
`;break}case-3:{f=`\r
|
|
53
|
-
`;break}case-2:{f=l?" ":" ";break}case-1:{if(!l&&c)continue;f=" ";break}default:f=String.fromCharCode(u)}c=u===-2,i.push(f)}return i.join("")}function O5(t){const i={constructs:sy([M5,...(t||{}).extensions||[]]),content:c(Zv),defined:[],document:c(Pv),flow:c(y5),lazy:{},string:c(v5),text:c(w5)};return i;function c(u){return f;function f(m){return F5(i,u,m)}}}function B5(t){for(;!dy(t););return t}const R1=/[\0\t\n\r]/g;function L5(){let t=1,l="",r=!0,i;return c;function c(u,f,m){const x=[];let d,g,y,b,v;for(u=l+(typeof u=="string"?u.toString():new TextDecoder(f||void 0).decode(u)),y=0,l="",r&&(u.charCodeAt(0)===65279&&y++,r=void 0);y<u.length;){if(R1.lastIndex=y,d=R1.exec(u),b=d&&d.index!==void 0?d.index:u.length,v=u.charCodeAt(b),!d){l=u.slice(y);break}if(v===10&&y===b&&i)x.push(-3),i=void 0;else switch(i&&(x.push(-5),i=void 0),y<b&&(x.push(u.slice(y,b)),t+=b-y),v){case 0:{x.push(65533),t++;break}case 9:{for(g=Math.ceil(t/4)*4,x.push(-2);t++<g;)x.push(-1);break}case 10:{x.push(-4),t=1;break}default:i=!0,t=1}y=b+1}return m&&(i&&x.push(-5),l&&x.push(l),x.push(null)),x}}const $5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function H5(t){return t.replace($5,U5)}function U5(t,l,r){if(l)return l;if(r.charCodeAt(0)===35){const c=r.charCodeAt(1),u=c===120||c===88;return oy(r.slice(u?2:1),u?16:10)}return ch(r)||t}const gy={}.hasOwnProperty;function I5(t,l,r){return l&&typeof l=="object"&&(r=l,l=void 0),Y5(r)(B5(O5(r).document().write(L5()(t,l,!0))))}function Y5(t){const l={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Ae),autolinkProtocol:ne,autolinkEmail:ne,atxHeading:u(xe),blockQuote:u(ke),characterEscape:ne,characterReference:ne,codeFenced:u(yt),codeFencedFenceInfo:f,codeFencedFenceMeta:f,codeIndented:u(yt,f),codeText:u(he,f),codeTextData:ne,data:ne,codeFlowValue:ne,definition:u(G),definitionDestinationString:f,definitionLabelString:f,definitionTitleString:f,emphasis:u(ie),hardBreakEscape:u(Te),hardBreakTrailing:u(Te),htmlFlow:u(Ne,f),htmlFlowData:ne,htmlText:u(Ne,f),htmlTextData:ne,image:u(Fe),label:f,link:u(Ae),listItem:u(Ke),listItemValue:b,listOrdered:u(Re,y),listUnordered:u(Re),paragraph:u(Lt),reference:T,referenceString:f,resourceDestinationString:f,resourceTitleString:f,setextHeading:u(xe),strong:u(gt),thematicBreak:u(Zt)},exit:{atxHeading:x(),atxHeadingSequence:L,autolink:x(),autolinkEmail:Qe,autolinkProtocol:He,blockQuote:x(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:Se,characterReferenceMarkerNumeric:Se,characterReferenceValue:Ee,characterReference:Be,codeFenced:x(E),codeFencedFence:S,codeFencedFenceInfo:v,codeFencedFenceMeta:j,codeFlowValue:D,codeIndented:x(C),codeText:x(V),codeTextData:D,data:D,definition:x(),definitionDestinationString:F,definitionLabelString:A,definitionTitleString:M,emphasis:x(),hardBreakEscape:x(R),hardBreakTrailing:x(R),htmlFlow:x(Q),htmlFlowData:D,htmlText:x(ee),htmlTextData:D,image:x(Z),label:we,labelText:ce,lineEnding:Y,link:x(I),listItem:x(),listOrdered:x(),listUnordered:x(),paragraph:x(),referenceString:me,resourceDestinationString:z,resourceTitleString:B,resource:W,setextHeading:x(X),setextHeadingLineSequence:U,setextHeadingText:O,strong:x(),thematicBreak:x()}};by(l,(t||{}).mdastExtensions||[]);const r={};return i;function i(re){let ye={type:"root",children:[]};const ze={stack:[ye],tokenStack:[],config:l,enter:m,exit:d,buffer:f,resume:g,data:r},Ue=[];let be=-1;for(;++be<re.length;)if(re[be][1].type==="listOrdered"||re[be][1].type==="listUnordered")if(re[be][0]==="enter")Ue.push(be);else{const je=Ue.pop();be=c(re,je,be)}for(be=-1;++be<re.length;){const je=l[re[be][0]];gy.call(je,re[be][1].type)&&je[re[be][1].type].call(Object.assign({sliceSerialize:re[be][2].sliceSerialize},ze),re[be][1])}if(ze.tokenStack.length>0){const je=ze.tokenStack[ze.tokenStack.length-1];(je[1]||_1).call(ze,void 0,je[0])}for(ye.position={start:_r(re.length>0?re[0][1].start:{line:1,column:1,offset:0}),end:_r(re.length>0?re[re.length-2][1].end:{line:1,column:1,offset:0})},be=-1;++be<l.transforms.length;)ye=l.transforms[be](ye)||ye;return ye}function c(re,ye,ze){let Ue=ye-1,be=-1,je=!1,jt,wt,Xe,ft;for(;++Ue<=ze;){const de=re[Ue];switch(de[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{de[0]==="enter"?be++:be--,ft=void 0;break}case"lineEndingBlank":{de[0]==="enter"&&(jt&&!ft&&!be&&!Xe&&(Xe=Ue),ft=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ft=void 0}if(!be&&de[0]==="enter"&&de[1].type==="listItemPrefix"||be===-1&&de[0]==="exit"&&(de[1].type==="listUnordered"||de[1].type==="listOrdered")){if(jt){let Mt=Ue;for(wt=void 0;Mt--;){const it=re[Mt];if(it[1].type==="lineEnding"||it[1].type==="lineEndingBlank"){if(it[0]==="exit")continue;wt&&(re[wt][1].type="lineEndingBlank",je=!0),it[1].type="lineEnding",wt=Mt}else if(!(it[1].type==="linePrefix"||it[1].type==="blockQuotePrefix"||it[1].type==="blockQuotePrefixWhitespace"||it[1].type==="blockQuoteMarker"||it[1].type==="listItemIndent"))break}Xe&&(!wt||Xe<wt)&&(jt._spread=!0),jt.end=Object.assign({},wt?re[wt][1].start:de[1].end),re.splice(wt||Ue,0,["exit",jt,de[2]]),Ue++,ze++}if(de[1].type==="listItemPrefix"){const Mt={type:"listItem",_spread:!1,start:Object.assign({},de[1].start),end:void 0};jt=Mt,re.splice(Ue,0,["enter",Mt,de[2]]),Ue++,ze++,Xe=void 0,ft=!0}}}return re[ye][1]._spread=je,ze}function u(re,ye){return ze;function ze(Ue){m.call(this,re(Ue),Ue),ye&&ye.call(this,Ue)}}function f(){this.stack.push({type:"fragment",children:[]})}function m(re,ye,ze){this.stack[this.stack.length-1].children.push(re),this.stack.push(re),this.tokenStack.push([ye,ze||void 0]),re.position={start:_r(ye.start),end:void 0}}function x(re){return ye;function ye(ze){re&&re.call(this,ze),d.call(this,ze)}}function d(re,ye){const ze=this.stack.pop(),Ue=this.tokenStack.pop();if(Ue)Ue[0].type!==re.type&&(ye?ye.call(this,re,Ue[0]):(Ue[1]||_1).call(this,re,Ue[0]));else throw new Error("Cannot close `"+re.type+"` ("+Es({start:re.start,end:re.end})+"): it’s not open");ze.position.end=_r(re.end)}function g(){return oh(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function b(re){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(re),10),this.data.expectingFirstListItemValue=void 0}}function v(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=re}function j(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=re}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re.replace(/(\r?\n|\r)$/g,"")}function A(re){const ye=this.resume(),ze=this.stack[this.stack.length-1];ze.label=ye,ze.identifier=hl(this.sliceSerialize(re)).toLowerCase()}function M(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.title=re}function F(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.url=re}function L(re){const ye=this.stack[this.stack.length-1];if(!ye.depth){const ze=this.sliceSerialize(re).length;ye.depth=ze}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function U(re){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(re).codePointAt(0)===61?1:2}function X(){this.data.setextHeadingSlurpLineEnding=void 0}function ne(re){const ze=this.stack[this.stack.length-1].children;let Ue=ze[ze.length-1];(!Ue||Ue.type!=="text")&&(Ue=ht(),Ue.position={start:_r(re.start),end:void 0},ze.push(Ue)),this.stack.push(Ue)}function D(re){const ye=this.stack.pop();ye.value+=this.sliceSerialize(re),ye.position.end=_r(re.end)}function Y(re){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ze=ye.children[ye.children.length-1];ze.position.end=_r(re.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&l.canContainEols.includes(ye.type)&&(ne.call(this,re),D.call(this,re))}function R(){this.data.atHardBreak=!0}function Q(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re}function ee(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re}function V(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re}function I(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=ye,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function Z(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=ye,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function ce(re){const ye=this.sliceSerialize(re),ze=this.stack[this.stack.length-2];ze.label=H5(ye),ze.identifier=hl(ye).toLowerCase()}function we(){const re=this.stack[this.stack.length-1],ye=this.resume(),ze=this.stack[this.stack.length-1];if(this.data.inReference=!0,ze.type==="link"){const Ue=re.children;ze.children=Ue}else ze.alt=ye}function z(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.url=re}function B(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.title=re}function W(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function me(re){const ye=this.resume(),ze=this.stack[this.stack.length-1];ze.label=ye,ze.identifier=hl(this.sliceSerialize(re)).toLowerCase(),this.data.referenceType="full"}function Se(re){this.data.characterReferenceType=re.type}function Ee(re){const ye=this.sliceSerialize(re),ze=this.data.characterReferenceType;let Ue;ze?(Ue=oy(ye,ze==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ue=ch(ye);const be=this.stack[this.stack.length-1];be.value+=Ue}function Be(re){const ye=this.stack.pop();ye.position.end=_r(re.end)}function He(re){D.call(this,re);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(re)}function Qe(re){D.call(this,re);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(re)}function ke(){return{type:"blockquote",children:[]}}function yt(){return{type:"code",lang:null,meta:null,value:""}}function he(){return{type:"inlineCode",value:""}}function G(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ie(){return{type:"emphasis",children:[]}}function xe(){return{type:"heading",depth:0,children:[]}}function Te(){return{type:"break"}}function Ne(){return{type:"html",value:""}}function Fe(){return{type:"image",title:null,url:"",alt:null}}function Ae(){return{type:"link",title:null,url:"",children:[]}}function Re(re){return{type:"list",ordered:re.type==="listOrdered",start:null,spread:re._spread,children:[]}}function Ke(re){return{type:"listItem",spread:re._spread,checked:null,children:[]}}function Lt(){return{type:"paragraph",children:[]}}function gt(){return{type:"strong",children:[]}}function ht(){return{type:"text",value:""}}function Zt(){return{type:"thematicBreak"}}}function _r(t){return{line:t.line,column:t.column,offset:t.offset}}function by(t,l){let r=-1;for(;++r<l.length;){const i=l[r];Array.isArray(i)?by(t,i):q5(t,i)}}function q5(t,l){let r;for(r in l)if(gy.call(l,r))switch(r){case"canContainEols":{const i=l[r];i&&t[r].push(...i);break}case"transforms":{const i=l[r];i&&t[r].push(...i);break}case"enter":case"exit":{const i=l[r];i&&Object.assign(t[r],i);break}}}function _1(t,l){throw t?new Error("Cannot close `"+t.type+"` ("+Es({start:t.start,end:t.end})+"): a different token (`"+l.type+"`, "+Es({start:l.start,end:l.end})+") is open"):new Error("Cannot close document, a token (`"+l.type+"`, "+Es({start:l.start,end:l.end})+") is still open")}function X5(t){const l=this;l.parser=r;function r(i){return I5(i,{...l.data("settings"),...t,extensions:l.data("micromarkExtensions")||[],mdastExtensions:l.data("fromMarkdownExtensions")||[]})}}function V5(t,l){const r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(l),!0)};return t.patch(l,r),t.applyData(l,r)}function G5(t,l){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(l,r),[t.applyData(l,r),{type:"text",value:`
|
|
53
|
+
`;break}case-2:{f=l?" ":" ";break}case-1:{if(!l&&c)continue;f=" ";break}default:f=String.fromCharCode(u)}c=u===-2,i.push(f)}return i.join("")}function O5(t){const i={constructs:sy([M5,...(t||{}).extensions||[]]),content:c(Zv),defined:[],document:c(Pv),flow:c(y5),lazy:{},string:c(v5),text:c(w5)};return i;function c(u){return f;function f(m){return R5(i,u,m)}}}function B5(t){for(;!dy(t););return t}const F1=/[\0\t\n\r]/g;function L5(){let t=1,l="",r=!0,i;return c;function c(u,f,m){const x=[];let d,g,y,b,v;for(u=l+(typeof u=="string"?u.toString():new TextDecoder(f||void 0).decode(u)),y=0,l="",r&&(u.charCodeAt(0)===65279&&y++,r=void 0);y<u.length;){if(F1.lastIndex=y,d=F1.exec(u),b=d&&d.index!==void 0?d.index:u.length,v=u.charCodeAt(b),!d){l=u.slice(y);break}if(v===10&&y===b&&i)x.push(-3),i=void 0;else switch(i&&(x.push(-5),i=void 0),y<b&&(x.push(u.slice(y,b)),t+=b-y),v){case 0:{x.push(65533),t++;break}case 9:{for(g=Math.ceil(t/4)*4,x.push(-2);t++<g;)x.push(-1);break}case 10:{x.push(-4),t=1;break}default:i=!0,t=1}y=b+1}return m&&(i&&x.push(-5),l&&x.push(l),x.push(null)),x}}const $5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function H5(t){return t.replace($5,U5)}function U5(t,l,r){if(l)return l;if(r.charCodeAt(0)===35){const c=r.charCodeAt(1),u=c===120||c===88;return oy(r.slice(u?2:1),u?16:10)}return ch(r)||t}const gy={}.hasOwnProperty;function I5(t,l,r){return l&&typeof l=="object"&&(r=l,l=void 0),Y5(r)(B5(O5(r).document().write(L5()(t,l,!0))))}function Y5(t){const l={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Ae),autolinkProtocol:ne,autolinkEmail:ne,atxHeading:u(xe),blockQuote:u(ke),characterEscape:ne,characterReference:ne,codeFenced:u(xt),codeFencedFenceInfo:f,codeFencedFenceMeta:f,codeIndented:u(xt,f),codeText:u(he,f),codeTextData:ne,data:ne,codeFlowValue:ne,definition:u(G),definitionDestinationString:f,definitionLabelString:f,definitionTitleString:f,emphasis:u(ie),hardBreakEscape:u(Te),hardBreakTrailing:u(Te),htmlFlow:u(Ne,f),htmlFlowData:ne,htmlText:u(Ne,f),htmlTextData:ne,image:u(Re),label:f,link:u(Ae),listItem:u(Ke),listItemValue:b,listOrdered:u(Be,y),listUnordered:u(Be),paragraph:u(St),reference:T,referenceString:f,resourceDestinationString:f,resourceTitleString:f,setextHeading:u(xe),strong:u(Xt),thematicBreak:u(bt)},exit:{atxHeading:x(),atxHeadingSequence:L,autolink:x(),autolinkEmail:Ge,autolinkProtocol:He,blockQuote:x(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:Se,characterReferenceMarkerNumeric:Se,characterReferenceValue:Ee,characterReference:Oe,codeFenced:x(E),codeFencedFence:S,codeFencedFenceInfo:v,codeFencedFenceMeta:j,codeFlowValue:D,codeIndented:x(C),codeText:x(V),codeTextData:D,data:D,definition:x(),definitionDestinationString:R,definitionLabelString:A,definitionTitleString:M,emphasis:x(),hardBreakEscape:x(F),hardBreakTrailing:x(F),htmlFlow:x(Q),htmlFlowData:D,htmlText:x(ee),htmlTextData:D,image:x(Z),label:we,labelText:ce,lineEnding:Y,link:x(I),listItem:x(),listOrdered:x(),listUnordered:x(),paragraph:x(),referenceString:me,resourceDestinationString:z,resourceTitleString:B,resource:W,setextHeading:x(X),setextHeadingLineSequence:U,setextHeadingText:O,strong:x(),thematicBreak:x()}};by(l,(t||{}).mdastExtensions||[]);const r={};return i;function i(re){let ye={type:"root",children:[]};const ze={stack:[ye],tokenStack:[],config:l,enter:m,exit:d,buffer:f,resume:g,data:r},Ie=[];let be=-1;for(;++be<re.length;)if(re[be][1].type==="listOrdered"||re[be][1].type==="listUnordered")if(re[be][0]==="enter")Ie.push(be);else{const je=Ie.pop();be=c(re,je,be)}for(be=-1;++be<re.length;){const je=l[re[be][0]];gy.call(je,re[be][1].type)&&je[re[be][1].type].call(Object.assign({sliceSerialize:re[be][2].sliceSerialize},ze),re[be][1])}if(ze.tokenStack.length>0){const je=ze.tokenStack[ze.tokenStack.length-1];(je[1]||_1).call(ze,void 0,je[0])}for(ye.position={start:Br(re.length>0?re[0][1].start:{line:1,column:1,offset:0}),end:Br(re.length>0?re[re.length-2][1].end:{line:1,column:1,offset:0})},be=-1;++be<l.transforms.length;)ye=l.transforms[be](ye)||ye;return ye}function c(re,ye,ze){let Ie=ye-1,be=-1,je=!1,jt,vt,Je,Mt;for(;++Ie<=ze;){const nt=re[Ie];switch(nt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{nt[0]==="enter"?be++:be--,Mt=void 0;break}case"lineEndingBlank":{nt[0]==="enter"&&(jt&&!Mt&&!be&&!Je&&(Je=Ie),Mt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Mt=void 0}if(!be&&nt[0]==="enter"&&nt[1].type==="listItemPrefix"||be===-1&&nt[0]==="exit"&&(nt[1].type==="listUnordered"||nt[1].type==="listOrdered")){if(jt){let Ht=Ie;for(vt=void 0;Ht--;){const de=re[Ht];if(de[1].type==="lineEnding"||de[1].type==="lineEndingBlank"){if(de[0]==="exit")continue;vt&&(re[vt][1].type="lineEndingBlank",je=!0),de[1].type="lineEnding",vt=Ht}else if(!(de[1].type==="linePrefix"||de[1].type==="blockQuotePrefix"||de[1].type==="blockQuotePrefixWhitespace"||de[1].type==="blockQuoteMarker"||de[1].type==="listItemIndent"))break}Je&&(!vt||Je<vt)&&(jt._spread=!0),jt.end=Object.assign({},vt?re[vt][1].start:nt[1].end),re.splice(vt||Ie,0,["exit",jt,nt[2]]),Ie++,ze++}if(nt[1].type==="listItemPrefix"){const Ht={type:"listItem",_spread:!1,start:Object.assign({},nt[1].start),end:void 0};jt=Ht,re.splice(Ie,0,["enter",Ht,nt[2]]),Ie++,ze++,Je=void 0,Mt=!0}}}return re[ye][1]._spread=je,ze}function u(re,ye){return ze;function ze(Ie){m.call(this,re(Ie),Ie),ye&&ye.call(this,Ie)}}function f(){this.stack.push({type:"fragment",children:[]})}function m(re,ye,ze){this.stack[this.stack.length-1].children.push(re),this.stack.push(re),this.tokenStack.push([ye,ze||void 0]),re.position={start:Br(ye.start),end:void 0}}function x(re){return ye;function ye(ze){re&&re.call(this,ze),d.call(this,ze)}}function d(re,ye){const ze=this.stack.pop(),Ie=this.tokenStack.pop();if(Ie)Ie[0].type!==re.type&&(ye?ye.call(this,re,Ie[0]):(Ie[1]||_1).call(this,re,Ie[0]));else throw new Error("Cannot close `"+re.type+"` ("+Es({start:re.start,end:re.end})+"): it’s not open");ze.position.end=Br(re.end)}function g(){return oh(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function b(re){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(re),10),this.data.expectingFirstListItemValue=void 0}}function v(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=re}function j(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=re}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re.replace(/(\r?\n|\r)$/g,"")}function A(re){const ye=this.resume(),ze=this.stack[this.stack.length-1];ze.label=ye,ze.identifier=ml(this.sliceSerialize(re)).toLowerCase()}function M(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.title=re}function R(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.url=re}function L(re){const ye=this.stack[this.stack.length-1];if(!ye.depth){const ze=this.sliceSerialize(re).length;ye.depth=ze}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function U(re){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(re).codePointAt(0)===61?1:2}function X(){this.data.setextHeadingSlurpLineEnding=void 0}function ne(re){const ze=this.stack[this.stack.length-1].children;let Ie=ze[ze.length-1];(!Ie||Ie.type!=="text")&&(Ie=pt(),Ie.position={start:Br(re.start),end:void 0},ze.push(Ie)),this.stack.push(Ie)}function D(re){const ye=this.stack.pop();ye.value+=this.sliceSerialize(re),ye.position.end=Br(re.end)}function Y(re){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ze=ye.children[ye.children.length-1];ze.position.end=Br(re.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&l.canContainEols.includes(ye.type)&&(ne.call(this,re),D.call(this,re))}function F(){this.data.atHardBreak=!0}function Q(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re}function ee(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re}function V(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.value=re}function I(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=ye,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function Z(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=ye,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function ce(re){const ye=this.sliceSerialize(re),ze=this.stack[this.stack.length-2];ze.label=H5(ye),ze.identifier=ml(ye).toLowerCase()}function we(){const re=this.stack[this.stack.length-1],ye=this.resume(),ze=this.stack[this.stack.length-1];if(this.data.inReference=!0,ze.type==="link"){const Ie=re.children;ze.children=Ie}else ze.alt=ye}function z(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.url=re}function B(){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.title=re}function W(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function me(re){const ye=this.resume(),ze=this.stack[this.stack.length-1];ze.label=ye,ze.identifier=ml(this.sliceSerialize(re)).toLowerCase(),this.data.referenceType="full"}function Se(re){this.data.characterReferenceType=re.type}function Ee(re){const ye=this.sliceSerialize(re),ze=this.data.characterReferenceType;let Ie;ze?(Ie=oy(ye,ze==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ie=ch(ye);const be=this.stack[this.stack.length-1];be.value+=Ie}function Oe(re){const ye=this.stack.pop();ye.position.end=Br(re.end)}function He(re){D.call(this,re);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(re)}function Ge(re){D.call(this,re);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(re)}function ke(){return{type:"blockquote",children:[]}}function xt(){return{type:"code",lang:null,meta:null,value:""}}function he(){return{type:"inlineCode",value:""}}function G(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ie(){return{type:"emphasis",children:[]}}function xe(){return{type:"heading",depth:0,children:[]}}function Te(){return{type:"break"}}function Ne(){return{type:"html",value:""}}function Re(){return{type:"image",title:null,url:"",alt:null}}function Ae(){return{type:"link",title:null,url:"",children:[]}}function Be(re){return{type:"list",ordered:re.type==="listOrdered",start:null,spread:re._spread,children:[]}}function Ke(re){return{type:"listItem",spread:re._spread,checked:null,children:[]}}function St(){return{type:"paragraph",children:[]}}function Xt(){return{type:"strong",children:[]}}function pt(){return{type:"text",value:""}}function bt(){return{type:"thematicBreak"}}}function Br(t){return{line:t.line,column:t.column,offset:t.offset}}function by(t,l){let r=-1;for(;++r<l.length;){const i=l[r];Array.isArray(i)?by(t,i):q5(t,i)}}function q5(t,l){let r;for(r in l)if(gy.call(l,r))switch(r){case"canContainEols":{const i=l[r];i&&t[r].push(...i);break}case"transforms":{const i=l[r];i&&t[r].push(...i);break}case"enter":case"exit":{const i=l[r];i&&Object.assign(t[r],i);break}}}function _1(t,l){throw t?new Error("Cannot close `"+t.type+"` ("+Es({start:t.start,end:t.end})+"): a different token (`"+l.type+"`, "+Es({start:l.start,end:l.end})+") is open"):new Error("Cannot close document, a token (`"+l.type+"`, "+Es({start:l.start,end:l.end})+") is still open")}function X5(t){const l=this;l.parser=r;function r(i){return I5(i,{...l.data("settings"),...t,extensions:l.data("micromarkExtensions")||[],mdastExtensions:l.data("fromMarkdownExtensions")||[]})}}function V5(t,l){const r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(l),!0)};return t.patch(l,r),t.applyData(l,r)}function G5(t,l){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(l,r),[t.applyData(l,r),{type:"text",value:`
|
|
54
54
|
`}]}function K5(t,l){const r=l.value?l.value+`
|
|
55
|
-
`:"",i={},c=l.lang?l.lang.split(/\s+/):[];c.length>0&&(i.className=["language-"+c[0]]);let u={type:"element",tagName:"code",properties:i,children:[{type:"text",value:r}]};return l.meta&&(u.data={meta:l.meta}),t.patch(l,u),u=t.applyData(l,u),u={type:"element",tagName:"pre",properties:{},children:[u]},t.patch(l,u),u}function Q5(t,l){const r={type:"element",tagName:"del",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function W5(t,l){const r={type:"element",tagName:"em",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function Z5(t,l){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",i=String(l.identifier).toUpperCase(),c=
|
|
55
|
+
`:"",i={},c=l.lang?l.lang.split(/\s+/):[];c.length>0&&(i.className=["language-"+c[0]]);let u={type:"element",tagName:"code",properties:i,children:[{type:"text",value:r}]};return l.meta&&(u.data={meta:l.meta}),t.patch(l,u),u=t.applyData(l,u),u={type:"element",tagName:"pre",properties:{},children:[u]},t.patch(l,u),u}function Q5(t,l){const r={type:"element",tagName:"del",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function W5(t,l){const r={type:"element",tagName:"em",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function Z5(t,l){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",i=String(l.identifier).toUpperCase(),c=hi(i.toLowerCase()),u=t.footnoteOrder.indexOf(i);let f,m=t.footnoteCounts.get(i);m===void 0?(m=0,t.footnoteOrder.push(i),f=t.footnoteOrder.length):f=u+1,m+=1,t.footnoteCounts.set(i,m);const x={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+c,id:r+"fnref-"+c+(m>1?"-"+m:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(f)}]};t.patch(l,x);const d={type:"element",tagName:"sup",properties:{},children:[x]};return t.patch(l,d),t.applyData(l,d)}function J5(t,l){const r={type:"element",tagName:"h"+l.depth,properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function P5(t,l){if(t.options.allowDangerousHtml){const r={type:"raw",value:l.value};return t.patch(l,r),t.applyData(l,r)}}function vy(t,l){const r=l.referenceType;let i="]";if(r==="collapsed"?i+="[]":r==="full"&&(i+="["+(l.label||l.identifier)+"]"),l.type==="imageReference")return[{type:"text",value:"!["+l.alt+i}];const c=t.all(l),u=c[0];u&&u.type==="text"?u.value="["+u.value:c.unshift({type:"text",value:"["});const f=c[c.length-1];return f&&f.type==="text"?f.value+=i:c.push({type:"text",value:i}),c}function e3(t,l){const r=String(l.identifier).toUpperCase(),i=t.definitionById.get(r);if(!i)return vy(t,l);const c={src:hi(i.url||""),alt:l.alt};i.title!==null&&i.title!==void 0&&(c.title=i.title);const u={type:"element",tagName:"img",properties:c,children:[]};return t.patch(l,u),t.applyData(l,u)}function t3(t,l){const r={src:hi(l.url)};l.alt!==null&&l.alt!==void 0&&(r.alt=l.alt),l.title!==null&&l.title!==void 0&&(r.title=l.title);const i={type:"element",tagName:"img",properties:r,children:[]};return t.patch(l,i),t.applyData(l,i)}function n3(t,l){const r={type:"text",value:l.value.replace(/\r?\n|\r/g," ")};t.patch(l,r);const i={type:"element",tagName:"code",properties:{},children:[r]};return t.patch(l,i),t.applyData(l,i)}function l3(t,l){const r=String(l.identifier).toUpperCase(),i=t.definitionById.get(r);if(!i)return vy(t,l);const c={href:hi(i.url||"")};i.title!==null&&i.title!==void 0&&(c.title=i.title);const u={type:"element",tagName:"a",properties:c,children:t.all(l)};return t.patch(l,u),t.applyData(l,u)}function r3(t,l){const r={href:hi(l.url)};l.title!==null&&l.title!==void 0&&(r.title=l.title);const i={type:"element",tagName:"a",properties:r,children:t.all(l)};return t.patch(l,i),t.applyData(l,i)}function a3(t,l,r){const i=t.all(l),c=r?i3(r):wy(l),u={},f=[];if(typeof l.checked=="boolean"){const g=i[0];let y;g&&g.type==="element"&&g.tagName==="p"?y=g:(y={type:"element",tagName:"p",properties:{},children:[]},i.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:l.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let m=-1;for(;++m<i.length;){const g=i[m];(c||m!==0||g.type!=="element"||g.tagName!=="p")&&f.push({type:"text",value:`
|
|
56
56
|
`}),g.type==="element"&&g.tagName==="p"&&!c?f.push(...g.children):f.push(g)}const x=i[i.length-1];x&&(c||x.type!=="element"||x.tagName!=="p")&&f.push({type:"text",value:`
|
|
57
|
-
`});const d={type:"element",tagName:"li",properties:u,children:f};return t.patch(l,d),t.applyData(l,d)}function i3(t){let l=!1;if(t.type==="list"){l=t.spread||!1;const r=t.children;let i=-1;for(;!l&&++i<r.length;)l=wy(r[i])}return l}function wy(t){const l=t.spread;return l??t.children.length>1}function s3(t,l){const r={},i=t.all(l);let c=-1;for(typeof l.start=="number"&&l.start!==1&&(r.start=l.start);++c<i.length;){const f=i[c];if(f.type==="element"&&f.tagName==="li"&&f.properties&&Array.isArray(f.properties.className)&&f.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const u={type:"element",tagName:l.ordered?"ol":"ul",properties:r,children:t.wrap(i,!0)};return t.patch(l,u),t.applyData(l,u)}function o3(t,l){const r={type:"element",tagName:"p",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function c3(t,l){const r={type:"root",children:t.wrap(t.all(l))};return t.patch(l,r),t.applyData(l,r)}function u3(t,l){const r={type:"element",tagName:"strong",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function f3(t,l){const r=t.all(l),i=r.shift(),c=[];if(i){const f={type:"element",tagName:"thead",properties:{},children:t.wrap([i],!0)};t.patch(l.children[0],f),c.push(f)}if(r.length>0){const f={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},m=rh(l.children[1]),x=ey(l.children[l.children.length-1]);m&&x&&(f.position={start:m,end:x}),c.push(f)}const u={type:"element",tagName:"table",properties:{},children:t.wrap(c,!0)};return t.patch(l,u),t.applyData(l,u)}function d3(t,l,r){const i=r?r.children:void 0,u=(i?i.indexOf(l):1)===0?"th":"td",f=r&&r.type==="table"?r.align:void 0,m=f?f.length:l.children.length;let x=-1;const d=[];for(;++x<m;){const y=l.children[x],b={},v=f?f[x]:void 0;v&&(b.align=v);let j={type:"element",tagName:u,properties:b,children:[]};y&&(j.children=t.all(y),t.patch(y,j),j=t.applyData(y,j)),d.push(j)}const g={type:"element",tagName:"tr",properties:{},children:t.wrap(d,!0)};return t.patch(l,g),t.applyData(l,g)}function h3(t,l){const r={type:"element",tagName:"td",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}const O1=9,B1=32;function m3(t){const l=String(t),r=/\r?\n|\r/g;let i=r.exec(l),c=0;const u=[];for(;i;)u.push(L1(l.slice(c,i.index),c>0,!0),i[0]),c=i.index+i[0].length,i=r.exec(l);return u.push(L1(l.slice(c),c>0,!1)),u.join("")}function L1(t,l,r){let i=0,c=t.length;if(l){let u=t.codePointAt(i);for(;u===O1||u===B1;)i++,u=t.codePointAt(i)}if(r){let u=t.codePointAt(c-1);for(;u===O1||u===B1;)c--,u=t.codePointAt(c-1)}return c>i?t.slice(i,c):""}function x3(t,l){const r={type:"text",value:m3(String(l.value))};return t.patch(l,r),t.applyData(l,r)}function p3(t,l){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(l,r),t.applyData(l,r)}const y3={blockquote:V5,break:G5,code:K5,delete:Q5,emphasis:W5,footnoteReference:Z5,heading:J5,html:P5,imageReference:e3,image:t3,inlineCode:n3,linkReference:l3,link:r3,listItem:a3,list:s3,paragraph:o3,root:c3,strong:u3,table:f3,tableCell:h3,tableRow:d3,text:x3,thematicBreak:p3,toml:lc,yaml:lc,definition:lc,footnoteDefinition:lc};function lc(){}const ky=-1,Lc=0,As=1,Ec=2,fh=3,dh=4,hh=5,mh=6,Sy=7,jy=8,$1=typeof self=="object"?self:globalThis,g3=(t,l)=>{const r=(c,u)=>(t.set(u,c),c),i=c=>{if(t.has(c))return t.get(c);const[u,f]=l[c];switch(u){case Lc:case ky:return r(f,c);case As:{const m=r([],c);for(const x of f)m.push(i(x));return m}case Ec:{const m=r({},c);for(const[x,d]of f)m[i(x)]=i(d);return m}case fh:return r(new Date(f),c);case dh:{const{source:m,flags:x}=f;return r(new RegExp(m,x),c)}case hh:{const m=r(new Map,c);for(const[x,d]of f)m.set(i(x),i(d));return m}case mh:{const m=r(new Set,c);for(const x of f)m.add(i(x));return m}case Sy:{const{name:m,message:x}=f;return r(new $1[m](x),c)}case jy:return r(BigInt(f),c);case"BigInt":return r(Object(BigInt(f)),c);case"ArrayBuffer":return r(new Uint8Array(f).buffer,f);case"DataView":{const{buffer:m}=new Uint8Array(f);return r(new DataView(m),f)}}return r(new $1[u](f),c)};return i},H1=t=>g3(new Map,t)(0),
|
|
57
|
+
`});const d={type:"element",tagName:"li",properties:u,children:f};return t.patch(l,d),t.applyData(l,d)}function i3(t){let l=!1;if(t.type==="list"){l=t.spread||!1;const r=t.children;let i=-1;for(;!l&&++i<r.length;)l=wy(r[i])}return l}function wy(t){const l=t.spread;return l??t.children.length>1}function s3(t,l){const r={},i=t.all(l);let c=-1;for(typeof l.start=="number"&&l.start!==1&&(r.start=l.start);++c<i.length;){const f=i[c];if(f.type==="element"&&f.tagName==="li"&&f.properties&&Array.isArray(f.properties.className)&&f.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const u={type:"element",tagName:l.ordered?"ol":"ul",properties:r,children:t.wrap(i,!0)};return t.patch(l,u),t.applyData(l,u)}function o3(t,l){const r={type:"element",tagName:"p",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function c3(t,l){const r={type:"root",children:t.wrap(t.all(l))};return t.patch(l,r),t.applyData(l,r)}function u3(t,l){const r={type:"element",tagName:"strong",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}function f3(t,l){const r=t.all(l),i=r.shift(),c=[];if(i){const f={type:"element",tagName:"thead",properties:{},children:t.wrap([i],!0)};t.patch(l.children[0],f),c.push(f)}if(r.length>0){const f={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},m=rh(l.children[1]),x=ey(l.children[l.children.length-1]);m&&x&&(f.position={start:m,end:x}),c.push(f)}const u={type:"element",tagName:"table",properties:{},children:t.wrap(c,!0)};return t.patch(l,u),t.applyData(l,u)}function d3(t,l,r){const i=r?r.children:void 0,u=(i?i.indexOf(l):1)===0?"th":"td",f=r&&r.type==="table"?r.align:void 0,m=f?f.length:l.children.length;let x=-1;const d=[];for(;++x<m;){const y=l.children[x],b={},v=f?f[x]:void 0;v&&(b.align=v);let j={type:"element",tagName:u,properties:b,children:[]};y&&(j.children=t.all(y),t.patch(y,j),j=t.applyData(y,j)),d.push(j)}const g={type:"element",tagName:"tr",properties:{},children:t.wrap(d,!0)};return t.patch(l,g),t.applyData(l,g)}function h3(t,l){const r={type:"element",tagName:"td",properties:{},children:t.all(l)};return t.patch(l,r),t.applyData(l,r)}const O1=9,B1=32;function m3(t){const l=String(t),r=/\r?\n|\r/g;let i=r.exec(l),c=0;const u=[];for(;i;)u.push(L1(l.slice(c,i.index),c>0,!0),i[0]),c=i.index+i[0].length,i=r.exec(l);return u.push(L1(l.slice(c),c>0,!1)),u.join("")}function L1(t,l,r){let i=0,c=t.length;if(l){let u=t.codePointAt(i);for(;u===O1||u===B1;)i++,u=t.codePointAt(i)}if(r){let u=t.codePointAt(c-1);for(;u===O1||u===B1;)c--,u=t.codePointAt(c-1)}return c>i?t.slice(i,c):""}function x3(t,l){const r={type:"text",value:m3(String(l.value))};return t.patch(l,r),t.applyData(l,r)}function p3(t,l){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(l,r),t.applyData(l,r)}const y3={blockquote:V5,break:G5,code:K5,delete:Q5,emphasis:W5,footnoteReference:Z5,heading:J5,html:P5,imageReference:e3,image:t3,inlineCode:n3,linkReference:l3,link:r3,listItem:a3,list:s3,paragraph:o3,root:c3,strong:u3,table:f3,tableCell:h3,tableRow:d3,text:x3,thematicBreak:p3,toml:lc,yaml:lc,definition:lc,footnoteDefinition:lc};function lc(){}const ky=-1,Lc=0,As=1,Ec=2,fh=3,dh=4,hh=5,mh=6,Sy=7,jy=8,$1=typeof self=="object"?self:globalThis,g3=(t,l)=>{const r=(c,u)=>(t.set(u,c),c),i=c=>{if(t.has(c))return t.get(c);const[u,f]=l[c];switch(u){case Lc:case ky:return r(f,c);case As:{const m=r([],c);for(const x of f)m.push(i(x));return m}case Ec:{const m=r({},c);for(const[x,d]of f)m[i(x)]=i(d);return m}case fh:return r(new Date(f),c);case dh:{const{source:m,flags:x}=f;return r(new RegExp(m,x),c)}case hh:{const m=r(new Map,c);for(const[x,d]of f)m.set(i(x),i(d));return m}case mh:{const m=r(new Set,c);for(const x of f)m.add(i(x));return m}case Sy:{const{name:m,message:x}=f;return r(new $1[m](x),c)}case jy:return r(BigInt(f),c);case"BigInt":return r(Object(BigInt(f)),c);case"ArrayBuffer":return r(new Uint8Array(f).buffer,f);case"DataView":{const{buffer:m}=new Uint8Array(f);return r(new DataView(m),f)}}return r(new $1[u](f),c)};return i},H1=t=>g3(new Map,t)(0),ai="",{toString:b3}={},{keys:v3}=Object,ps=t=>{const l=typeof t;if(l!=="object"||!t)return[Lc,l];const r=b3.call(t).slice(8,-1);switch(r){case"Array":return[As,ai];case"Object":return[Ec,ai];case"Date":return[fh,ai];case"RegExp":return[dh,ai];case"Map":return[hh,ai];case"Set":return[mh,ai];case"DataView":return[As,r]}return r.includes("Array")?[As,r]:r.includes("Error")?[Sy,r]:[Ec,r]},rc=([t,l])=>t===Lc&&(l==="function"||l==="symbol"),w3=(t,l,r,i)=>{const c=(f,m)=>{const x=i.push(f)-1;return r.set(m,x),x},u=f=>{if(r.has(f))return r.get(f);let[m,x]=ps(f);switch(m){case Lc:{let g=f;switch(x){case"bigint":m=jy,g=f.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+x);g=null;break;case"undefined":return c([ky],f)}return c([m,g],f)}case As:{if(x){let b=f;return x==="DataView"?b=new Uint8Array(f.buffer):x==="ArrayBuffer"&&(b=new Uint8Array(f)),c([x,[...b]],f)}const g=[],y=c([m,g],f);for(const b of f)g.push(u(b));return y}case Ec:{if(x)switch(x){case"BigInt":return c([x,f.toString()],f);case"Boolean":case"Number":case"String":return c([x,f.valueOf()],f)}if(l&&"toJSON"in f)return u(f.toJSON());const g=[],y=c([m,g],f);for(const b of v3(f))(t||!rc(ps(f[b])))&&g.push([u(b),u(f[b])]);return y}case fh:return c([m,f.toISOString()],f);case dh:{const{source:g,flags:y}=f;return c([m,{source:g,flags:y}],f)}case hh:{const g=[],y=c([m,g],f);for(const[b,v]of f)(t||!(rc(ps(b))||rc(ps(v))))&&g.push([u(b),u(v)]);return y}case mh:{const g=[],y=c([m,g],f);for(const b of f)(t||!rc(ps(b)))&&g.push(u(b));return y}}const{message:d}=f;return c([m,{name:x,message:d}],f)};return u},U1=(t,{json:l,lossy:r}={})=>{const i=[];return w3(!(l||r),!!l,new Map,i)(t),i},Nc=typeof structuredClone=="function"?(t,l)=>l&&("json"in l||"lossy"in l)?H1(U1(t,l)):structuredClone(t):(t,l)=>H1(U1(t,l));function k3(t,l){const r=[{type:"text",value:"↩"}];return l>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(l)}]}),r}function S3(t,l){return"Back to reference "+(t+1)+(l>1?"-"+l:"")}function j3(t){const l=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||k3,i=t.options.footnoteBackLabel||S3,c=t.options.footnoteLabel||"Footnotes",u=t.options.footnoteLabelTagName||"h2",f=t.options.footnoteLabelProperties||{className:["sr-only"]},m=[];let x=-1;for(;++x<t.footnoteOrder.length;){const d=t.footnoteById.get(t.footnoteOrder[x]);if(!d)continue;const g=t.all(d),y=String(d.identifier).toUpperCase(),b=hi(y.toLowerCase());let v=0;const j=[],S=t.footnoteCounts.get(y);for(;S!==void 0&&++v<=S;){j.length>0&&j.push({type:"text",value:" "});let A=typeof r=="string"?r:r(x,v);typeof A=="string"&&(A={type:"text",value:A}),j.push({type:"element",tagName:"a",properties:{href:"#"+l+"fnref-"+b+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(x,v),className:["data-footnote-backref"]},children:Array.isArray(A)?A:[A]})}const E=g[g.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const A=E.children[E.children.length-1];A&&A.type==="text"?A.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...j)}else g.push(...j);const C={type:"element",tagName:"li",properties:{id:l+"fn-"+b},children:t.wrap(g,!0)};t.patch(d,C),m.push(C)}if(m.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Nc(f),id:"footnote-label"},children:[{type:"text",value:c}]},{type:"text",value:`
|
|
58
58
|
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(m,!0)},{type:"text",value:`
|
|
59
|
-
`}]}}const $c=(function(t){if(t==null)return A3;if(typeof t=="function")return Hc(t);if(typeof t=="object")return Array.isArray(t)?C3(t):E3(t);if(typeof t=="string")return N3(t);throw new Error("Expected function, string, or object as test")});function C3(t){const l=[];let r=-1;for(;++r<t.length;)l[r]=$c(t[r]);return Hc(i);function i(...c){let u=-1;for(;++u<l.length;)if(l[u].apply(this,c))return!0;return!1}}function E3(t){const l=t;return Hc(r);function r(i){const c=i;let u;for(u in t)if(c[u]!==l[u])return!1;return!0}}function N3(t){return Hc(l);function l(r){return r&&r.type===t}}function Hc(t){return l;function l(r,i,c){return!!(T3(r)&&t.call(this,r,typeof i=="number"?i:void 0,c||void 0))}}function A3(){return!0}function T3(t){return t!==null&&typeof t=="object"&&"type"in t}const Cy=[],D3=!0,Yd=!1,z3="skip";function Ey(t,l,r,i){let c;typeof l=="function"&&typeof r!="function"?(i=r,r=l):c=l;const u=$c(c),f=i?-1:1;m(t,void 0,[])();function m(x,d,g){const y=x&&typeof x=="object"?x:{};if(typeof y.type=="string"){const v=typeof y.tagName=="string"?y.tagName:typeof y.name=="string"?y.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(x.type+(v?"<"+v+">":""))+")"})}return b;function b(){let v=Cy,j,S,E;if((!l||u(x,d,g[g.length-1]||void 0))&&(v=M3(r(x,g)),v[0]===Yd))return v;if("children"in x&&x.children){const C=x;if(C.children&&v[0]!==z3)for(S=(i?C.children.length:-1)+f,E=g.concat(C);S>-1&&S<C.children.length;){const A=C.children[S];if(j=m(A,S,E)(),j[0]===Yd)return j;S=typeof j[1]=="number"?j[1]:S+f}}return v}}}function M3(t){return Array.isArray(t)?t:typeof t=="number"?[D3,t]:t==null?Cy:[t]}function xh(t,l,r,i){let c,u,f;typeof l=="function"&&typeof r!="function"?(u=void 0,f=l,c=r):(u=l,f=r,c=i),Ey(t,u,m,c);function m(x,d){const g=d[d.length-1],y=g?g.children.indexOf(x):void 0;return f(x,y,g)}}const qd={}.hasOwnProperty,
|
|
59
|
+
`}]}}const $c=(function(t){if(t==null)return A3;if(typeof t=="function")return Hc(t);if(typeof t=="object")return Array.isArray(t)?C3(t):E3(t);if(typeof t=="string")return N3(t);throw new Error("Expected function, string, or object as test")});function C3(t){const l=[];let r=-1;for(;++r<t.length;)l[r]=$c(t[r]);return Hc(i);function i(...c){let u=-1;for(;++u<l.length;)if(l[u].apply(this,c))return!0;return!1}}function E3(t){const l=t;return Hc(r);function r(i){const c=i;let u;for(u in t)if(c[u]!==l[u])return!1;return!0}}function N3(t){return Hc(l);function l(r){return r&&r.type===t}}function Hc(t){return l;function l(r,i,c){return!!(T3(r)&&t.call(this,r,typeof i=="number"?i:void 0,c||void 0))}}function A3(){return!0}function T3(t){return t!==null&&typeof t=="object"&&"type"in t}const Cy=[],D3=!0,Yd=!1,z3="skip";function Ey(t,l,r,i){let c;typeof l=="function"&&typeof r!="function"?(i=r,r=l):c=l;const u=$c(c),f=i?-1:1;m(t,void 0,[])();function m(x,d,g){const y=x&&typeof x=="object"?x:{};if(typeof y.type=="string"){const v=typeof y.tagName=="string"?y.tagName:typeof y.name=="string"?y.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(x.type+(v?"<"+v+">":""))+")"})}return b;function b(){let v=Cy,j,S,E;if((!l||u(x,d,g[g.length-1]||void 0))&&(v=M3(r(x,g)),v[0]===Yd))return v;if("children"in x&&x.children){const C=x;if(C.children&&v[0]!==z3)for(S=(i?C.children.length:-1)+f,E=g.concat(C);S>-1&&S<C.children.length;){const A=C.children[S];if(j=m(A,S,E)(),j[0]===Yd)return j;S=typeof j[1]=="number"?j[1]:S+f}}return v}}}function M3(t){return Array.isArray(t)?t:typeof t=="number"?[D3,t]:t==null?Cy:[t]}function xh(t,l,r,i){let c,u,f;typeof l=="function"&&typeof r!="function"?(u=void 0,f=l,c=r):(u=l,f=r,c=i),Ey(t,u,m,c);function m(x,d){const g=d[d.length-1],y=g?g.children.indexOf(x):void 0;return f(x,y,g)}}const qd={}.hasOwnProperty,R3={};function F3(t,l){const r=l||R3,i=new Map,c=new Map,u=new Map,f={...y3,...r.handlers},m={all:d,applyData:O3,definitionById:i,footnoteById:c,footnoteCounts:u,footnoteOrder:[],handlers:f,one:x,options:r,patch:_3,wrap:L3};return xh(t,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const y=g.type==="definition"?i:c,b=String(g.identifier).toUpperCase();y.has(b)||y.set(b,g)}}),m;function x(g,y){const b=g.type,v=m.handlers[b];if(qd.call(m.handlers,b)&&v)return v(m,g,y);if(m.options.passThrough&&m.options.passThrough.includes(b)){if("children"in g){const{children:S,...E}=g,C=Nc(E);return C.children=m.all(g),C}return Nc(g)}return(m.options.unknownHandler||B3)(m,g,y)}function d(g){const y=[];if("children"in g){const b=g.children;let v=-1;for(;++v<b.length;){const j=m.one(b[v],g);if(j){if(v&&b[v-1].type==="break"&&(!Array.isArray(j)&&j.type==="text"&&(j.value=I1(j.value)),!Array.isArray(j)&&j.type==="element")){const S=j.children[0];S&&S.type==="text"&&(S.value=I1(S.value))}Array.isArray(j)?y.push(...j):y.push(j)}}}return y}}function _3(t,l){t.position&&(l.position=Sv(t))}function O3(t,l){let r=l;if(t&&t.data){const i=t.data.hName,c=t.data.hChildren,u=t.data.hProperties;if(typeof i=="string")if(r.type==="element")r.tagName=i;else{const f="children"in r?r.children:[r];r={type:"element",tagName:i,properties:{},children:f}}r.type==="element"&&u&&Object.assign(r.properties,Nc(u)),"children"in r&&r.children&&c!==null&&c!==void 0&&(r.children=c)}return r}function B3(t,l){const r=l.data||{},i="value"in l&&!(qd.call(r,"hProperties")||qd.call(r,"hChildren"))?{type:"text",value:l.value}:{type:"element",tagName:"div",properties:{},children:t.all(l)};return t.patch(l,i),t.applyData(l,i)}function L3(t,l){const r=[];let i=-1;for(l&&r.push({type:"text",value:`
|
|
60
60
|
`});++i<t.length;)i&&r.push({type:"text",value:`
|
|
61
61
|
`}),r.push(t[i]);return l&&t.length>0&&r.push({type:"text",value:`
|
|
62
|
-
`}),r}function I1(t){let l=0,r=t.charCodeAt(l);for(;r===9||r===32;)l++,r=t.charCodeAt(l);return t.slice(l)}function Y1(t,l){const r=
|
|
63
|
-
`},c),u}function $3(t,l){return t&&"run"in t?async function(r,i){const c=Y1(r,{file:i,...l});await t.run(c,i)}:function(r,i){return Y1(r,{file:i,...t||l})}}function q1(t){if(t)throw t}var rd,X1;function H3(){if(X1)return rd;X1=1;var t=Object.prototype.hasOwnProperty,l=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,c=function(d){return typeof Array.isArray=="function"?Array.isArray(d):l.call(d)==="[object Array]"},u=function(d){if(!d||l.call(d)!=="[object Object]")return!1;var g=t.call(d,"constructor"),y=d.constructor&&d.constructor.prototype&&t.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!g&&!y)return!1;var b;for(b in d);return typeof b>"u"||t.call(d,b)},f=function(d,g){r&&g.name==="__proto__"?r(d,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):d[g.name]=g.newValue},m=function(d,g){if(g==="__proto__")if(t.call(d,g)){if(i)return i(d,g).value}else return;return d[g]};return rd=function x(){var d,g,y,b,v,j,S=arguments[0],E=1,C=arguments.length,A=!1;for(typeof S=="boolean"&&(A=S,S=arguments[1]||{},E=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});E<C;++E)if(d=arguments[E],d!=null)for(g in d)y=m(S,g),b=m(d,g),S!==b&&(A&&b&&(u(b)||(v=c(b)))?(v?(v=!1,j=y&&c(y)?y:[]):j=y&&u(y)?y:{},f(S,{name:g,newValue:x(A,j,b)})):typeof b<"u"&&f(S,{name:g,newValue:b}));return S},rd}var U3=H3();const ad=X0(U3);function Xd(t){if(typeof t!="object"||t===null)return!1;const l=Object.getPrototypeOf(t);return(l===null||l===Object.prototype||Object.getPrototypeOf(l)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function I3(){const t=[],l={run:r,use:i};return l;function r(...c){let u=-1;const f=c.pop();if(typeof f!="function")throw new TypeError("Expected function as last argument, not "+f);m(null,...c);function m(x,...d){const g=t[++u];let y=-1;if(x){f(x);return}for(;++y<c.length;)(d[y]===null||d[y]===void 0)&&(d[y]=c[y]);c=d,g?Y3(g,m)(...d):f(null,...d)}}function i(c){if(typeof c!="function")throw new TypeError("Expected `middelware` to be a function, not "+c);return t.push(c),l}}function Y3(t,l){let r;return i;function i(...f){const m=t.length>f.length;let x;m&&f.push(c);try{x=t.apply(this,f)}catch(d){const g=d;if(m&&r)throw g;return c(g)}m||(x&&x.then&&typeof x.then=="function"?x.then(u,c):x instanceof Error?c(x):u(x))}function c(f,...m){r||(r=!0,l(f,...m))}function u(f){c(null,f)}}const Sl={basename:q3,dirname:X3,extname:V3,join:G3,sep:"/"};function q3(t,l){if(l!==void 0&&typeof l!="string")throw new TypeError('"ext" argument must be a string');$s(t);let r=0,i=-1,c=t.length,u;if(l===void 0||l.length===0||l.length>t.length){for(;c--;)if(t.codePointAt(c)===47){if(u){r=c+1;break}}else i<0&&(u=!0,i=c+1);return i<0?"":t.slice(r,i)}if(l===t)return"";let f=-1,m=l.length-1;for(;c--;)if(t.codePointAt(c)===47){if(u){r=c+1;break}}else f<0&&(u=!0,f=c+1),m>-1&&(t.codePointAt(c)===l.codePointAt(m--)?m<0&&(i=c):(m=-1,i=f));return r===i?i=f:i<0&&(i=t.length),t.slice(r,i)}function X3(t){if($s(t),t.length===0)return".";let l=-1,r=t.length,i;for(;--r;)if(t.codePointAt(r)===47){if(i){l=r;break}}else i||(i=!0);return l<0?t.codePointAt(0)===47?"/":".":l===1&&t.codePointAt(0)===47?"//":t.slice(0,l)}function V3(t){$s(t);let l=t.length,r=-1,i=0,c=-1,u=0,f;for(;l--;){const m=t.codePointAt(l);if(m===47){if(f){i=l+1;break}continue}r<0&&(f=!0,r=l+1),m===46?c<0?c=l:u!==1&&(u=1):c>-1&&(u=-1)}return c<0||r<0||u===0||u===1&&c===r-1&&c===i+1?"":t.slice(c,r)}function G3(...t){let l=-1,r;for(;++l<t.length;)$s(t[l]),t[l]&&(r=r===void 0?t[l]:r+"/"+t[l]);return r===void 0?".":K3(r)}function K3(t){$s(t);const l=t.codePointAt(0)===47;let r=Q3(t,!l);return r.length===0&&!l&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),l?"/"+r:r}function Q3(t,l){let r="",i=0,c=-1,u=0,f=-1,m,x;for(;++f<=t.length;){if(f<t.length)m=t.codePointAt(f);else{if(m===47)break;m=47}if(m===47){if(!(c===f-1||u===1))if(c!==f-1&&u===2){if(r.length<2||i!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(x=r.lastIndexOf("/"),x!==r.length-1){x<0?(r="",i=0):(r=r.slice(0,x),i=r.length-1-r.lastIndexOf("/")),c=f,u=0;continue}}else if(r.length>0){r="",i=0,c=f,u=0;continue}}l&&(r=r.length>0?r+"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(c+1,f):r=t.slice(c+1,f),i=f-c-1;c=f,u=0}else m===46&&u>-1?u++:u=-1}return r}function $s(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const W3={cwd:Z3};function Z3(){return"/"}function Vd(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function J3(t){if(typeof t=="string")t=new URL(t);else if(!Vd(t)){const l=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw l.code="ERR_INVALID_ARG_TYPE",l}if(t.protocol!=="file:"){const l=new TypeError("The URL must be of scheme file");throw l.code="ERR_INVALID_URL_SCHEME",l}return P3(t)}function P3(t){if(t.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const l=t.pathname;let r=-1;for(;++r<l.length;)if(l.codePointAt(r)===37&&l.codePointAt(r+1)===50){const i=l.codePointAt(r+2);if(i===70||i===102){const c=new TypeError("File URL path must not include encoded / characters");throw c.code="ERR_INVALID_FILE_URL_PATH",c}}return decodeURIComponent(l)}const id=["history","path","basename","stem","extname","dirname"];class Ny{constructor(l){let r;l?Vd(l)?r={path:l}:typeof l=="string"||ek(l)?r={value:l}:r=l:r={},this.cwd="cwd"in r?"":W3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<id.length;){const u=id[i];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let c;for(c in r)id.includes(c)||(this[c]=r[c])}get basename(){return typeof this.path=="string"?Sl.basename(this.path):void 0}set basename(l){od(l,"basename"),sd(l,"basename"),this.path=Sl.join(this.dirname||"",l)}get dirname(){return typeof this.path=="string"?Sl.dirname(this.path):void 0}set dirname(l){V1(this.basename,"dirname"),this.path=Sl.join(l||"",this.basename)}get extname(){return typeof this.path=="string"?Sl.extname(this.path):void 0}set extname(l){if(sd(l,"extname"),V1(this.dirname,"extname"),l){if(l.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(l.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Sl.join(this.dirname,this.stem+(l||""))}get path(){return this.history[this.history.length-1]}set path(l){Vd(l)&&(l=J3(l)),od(l,"path"),this.path!==l&&this.history.push(l)}get stem(){return typeof this.path=="string"?Sl.basename(this.path,this.extname):void 0}set stem(l){od(l,"stem"),sd(l,"stem"),this.path=Sl.join(this.dirname||"",l+(this.extname||""))}fail(l,r,i){const c=this.message(l,r,i);throw c.fatal=!0,c}info(l,r,i){const c=this.message(l,r,i);return c.fatal=void 0,c}message(l,r,i){const c=new gn(l,r,i);return this.path&&(c.name=this.path+":"+c.name,c.file=this.path),c.fatal=!1,this.messages.push(c),c}toString(l){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(l||void 0).decode(this.value)}}function sd(t,l){if(t&&t.includes(Sl.sep))throw new Error("`"+l+"` cannot be a path: did not expect `"+Sl.sep+"`")}function od(t,l){if(!t)throw new Error("`"+l+"` cannot be empty")}function V1(t,l){if(!t)throw new Error("Setting `"+l+"` requires `path` to be set too")}function ek(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const tk=(function(t){const i=this.constructor.prototype,c=i[t],u=function(){return c.apply(u,arguments)};return Object.setPrototypeOf(u,i),u}),nk={}.hasOwnProperty;class ph extends tk{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=I3()}copy(){const l=new ph;let r=-1;for(;++r<this.attachers.length;){const i=this.attachers[r];l.use(...i)}return l.data(ad(!0,{},this.namespace)),l}data(l,r){return typeof l=="string"?arguments.length===2?(fd("data",this.frozen),this.namespace[l]=r,this):nk.call(this.namespace,l)&&this.namespace[l]||void 0:l?(fd("data",this.frozen),this.namespace=l,this):this.namespace}freeze(){if(this.frozen)return this;const l=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const c=r.call(l,...i);typeof c=="function"&&this.transformers.use(c)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(l){this.freeze();const r=ac(l),i=this.parser||this.Parser;return cd("parse",i),i(String(r),r)}process(l,r){const i=this;return this.freeze(),cd("process",this.parser||this.Parser),ud("process",this.compiler||this.Compiler),r?c(void 0,r):new Promise(c);function c(u,f){const m=ac(l),x=i.parse(m);i.run(x,m,function(g,y,b){if(g||!y||!b)return d(g);const v=y,j=i.stringify(v,b);ak(j)?b.value=j:b.result=j,d(g,b)});function d(g,y){g||!y?f(g):u?u(y):r(void 0,y)}}}processSync(l){let r=!1,i;return this.freeze(),cd("processSync",this.parser||this.Parser),ud("processSync",this.compiler||this.Compiler),this.process(l,c),K1("processSync","process",r),i;function c(u,f){r=!0,q1(u),i=f}}run(l,r,i){G1(l),this.freeze();const c=this.transformers;return!i&&typeof r=="function"&&(i=r,r=void 0),i?u(void 0,i):new Promise(u);function u(f,m){const x=ac(r);c.run(l,x,d);function d(g,y,b){const v=y||l;g?m(g):f?f(v):i(void 0,v,b)}}}runSync(l,r){let i=!1,c;return this.run(l,r,u),K1("runSync","run",i),c;function u(f,m){q1(f),c=m,i=!0}}stringify(l,r){this.freeze();const i=ac(r),c=this.compiler||this.Compiler;return ud("stringify",c),G1(l),c(l,i)}use(l,...r){const i=this.attachers,c=this.namespace;if(fd("use",this.frozen),l!=null)if(typeof l=="function")x(l,r);else if(typeof l=="object")Array.isArray(l)?m(l):f(l);else throw new TypeError("Expected usable value, not `"+l+"`");return this;function u(d){if(typeof d=="function")x(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[g,...y]=d;x(g,y)}else f(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function f(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");m(d.plugins),d.settings&&(c.settings=ad(!0,c.settings,d.settings))}function m(d){let g=-1;if(d!=null)if(Array.isArray(d))for(;++g<d.length;){const y=d[g];u(y)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function x(d,g){let y=-1,b=-1;for(;++y<i.length;)if(i[y][0]===d){b=y;break}if(b===-1)i.push([d,...g]);else if(g.length>0){let[v,...j]=g;const S=i[b][1];Xd(S)&&Xd(v)&&(v=ad(!0,S,v)),i[b]=[d,v,...j]}}}}const lk=new ph().freeze();function cd(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function ud(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function fd(t,l){if(l)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function G1(t){if(!Xd(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function K1(t,l,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+l+"` instead")}function ac(t){return rk(t)?t:new Ny(t)}function rk(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function ak(t){return typeof t=="string"||ik(t)}function ik(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const sk="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Q1=[],W1={allowDangerousHtml:!0},ok=/^(https?|ircs?|mailto|xmpp)$/i,ck=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Ay(t){const l=uk(t),r=fk(t);return dk(l.runSync(l.parse(r),r),t)}function uk(t){const l=t.rehypePlugins||Q1,r=t.remarkPlugins||Q1,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...W1}:W1;return lk().use(X5).use(r).use($3,i).use(l)}function fk(t){const l=t.children||"",r=new Ny;return typeof l=="string"&&(r.value=l),r}function dk(t,l){const r=l.allowedElements,i=l.allowElement,c=l.components,u=l.disallowedElements,f=l.skipHtml,m=l.unwrapDisallowed,x=l.urlTransform||hk;for(const g of ck)Object.hasOwn(l,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+sk+g.id,void 0);return xh(t,d),Av(t,{Fragment:o.Fragment,components:c,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function d(g,y,b){if(g.type==="raw"&&b&&typeof y=="number")return f?b.children.splice(y,1):b.children[y]={type:"text",value:g.value},y;if(g.type==="element"){let v;for(v in td)if(Object.hasOwn(td,v)&&Object.hasOwn(g.properties,v)){const j=g.properties[v],S=td[v];(S===null||S.includes(g.tagName))&&(g.properties[v]=x(String(j||""),v,g))}}if(g.type==="element"){let v=r?!r.includes(g.tagName):u?u.includes(g.tagName):!1;if(!v&&i&&typeof y=="number"&&(v=!i(g,y,b)),v&&b&&typeof y=="number")return m&&g.children?b.children.splice(y,1,...g.children):b.children.splice(y,1),y}}}function hk(t){const l=t.indexOf(":"),r=t.indexOf("?"),i=t.indexOf("#"),c=t.indexOf("/");return l===-1||c!==-1&&l>c||r!==-1&&l>r||i!==-1&&l>i||ok.test(t.slice(0,l))?t:""}function Z1(t,l){const r=String(t);if(typeof l!="string")throw new TypeError("Expected character");let i=0,c=r.indexOf(l);for(;c!==-1;)i++,c=r.indexOf(l,c+l.length);return i}function mk(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function xk(t,l,r){const c=$c((r||{}).ignore||[]),u=pk(l);let f=-1;for(;++f<u.length;)Ey(t,"text",m);function m(d,g){let y=-1,b;for(;++y<g.length;){const v=g[y],j=b?b.children:void 0;if(c(v,j?j.indexOf(v):void 0,b))return;b=v}if(b)return x(d,g)}function x(d,g){const y=g[g.length-1],b=u[f][0],v=u[f][1];let j=0;const E=y.children.indexOf(d);let C=!1,A=[];b.lastIndex=0;let M=b.exec(d.value);for(;M;){const F=M.index,L={index:M.index,input:M.input,stack:[...g,d]};let O=v(...M,L);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?b.lastIndex=F+1:(j!==F&&A.push({type:"text",value:d.value.slice(j,F)}),Array.isArray(O)?A.push(...O):O&&A.push(O),j=F+M[0].length,C=!0),!b.global)break;M=b.exec(d.value)}return C?(j<d.value.length&&A.push({type:"text",value:d.value.slice(j)}),y.children.splice(E,1,...A)):A=[d],E+A.length}}function pk(t){const l=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!t[0]||Array.isArray(t[0])?t:[t];let i=-1;for(;++i<r.length;){const c=r[i];l.push([yk(c[0]),gk(c[1])])}return l}function yk(t){return typeof t=="string"?new RegExp(mk(t),"g"):t}function gk(t){return typeof t=="function"?t:function(){return t}}const dd="phrasing",hd=["autolink","link","image","label"];function bk(){return{transforms:[Ek],enter:{literalAutolink:wk,literalAutolinkEmail:md,literalAutolinkHttp:md,literalAutolinkWww:md},exit:{literalAutolink:Ck,literalAutolinkEmail:jk,literalAutolinkHttp:kk,literalAutolinkWww:Sk}}}function vk(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:dd,notInConstruct:hd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:dd,notInConstruct:hd},{character:":",before:"[ps]",after:"\\/",inConstruct:dd,notInConstruct:hd}]}}function wk(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function md(t){this.config.enter.autolinkProtocol.call(this,t)}function kk(t){this.config.exit.autolinkProtocol.call(this,t)}function Sk(t){this.config.exit.data.call(this,t);const l=this.stack[this.stack.length-1];l.type,l.url="http://"+this.sliceSerialize(t)}function jk(t){this.config.exit.autolinkEmail.call(this,t)}function Ck(t){this.exit(t)}function Ek(t){xk(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Nk],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Ak]],{ignore:["link","linkReference"]})}function Nk(t,l,r,i,c){let u="";if(!Ty(c)||(/^w/i.test(l)&&(r=l+r,l="",u="http://"),!Tk(r)))return!1;const f=Dk(r+i);if(!f[0])return!1;const m={type:"link",title:null,url:u+l+f[0],children:[{type:"text",value:l+f[0]}]};return f[1]?[m,{type:"text",value:f[1]}]:m}function Ak(t,l,r,i){return!Ty(i,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+l+"@"+r,children:[{type:"text",value:l+"@"+r}]}}function Tk(t){const l=t.split(".");return!(l.length<2||l[l.length-1]&&(/_/.test(l[l.length-1])||!/[a-zA-Z\d]/.test(l[l.length-1]))||l[l.length-2]&&(/_/.test(l[l.length-2])||!/[a-zA-Z\d]/.test(l[l.length-2])))}function Dk(t){const l=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!l)return[t,void 0];t=t.slice(0,l.index);let r=l[0],i=r.indexOf(")");const c=Z1(t,"(");let u=Z1(t,")");for(;i!==-1&&c>u;)t+=r.slice(0,i+1),r=r.slice(i+1),i=r.indexOf(")"),u++;return[t,r]}function Ty(t,l){const r=t.input.charCodeAt(t.index-1);return(t.index===0||ba(r)||Oc(r))&&(!l||r!==47)}Dy.peek=$k;function zk(){this.buffer()}function Mk(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function Fk(){this.buffer()}function Rk(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function _k(t){const l=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=hl(this.sliceSerialize(t)).toLowerCase(),r.label=l}function Ok(t){this.exit(t)}function Bk(t){const l=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=hl(this.sliceSerialize(t)).toLowerCase(),r.label=l}function Lk(t){this.exit(t)}function $k(){return"["}function Dy(t,l,r,i){const c=r.createTracker(i);let u=c.move("[^");const f=r.enter("footnoteReference"),m=r.enter("reference");return u+=c.move(r.safe(r.associationId(t),{after:"]",before:u})),m(),f(),u+=c.move("]"),u}function Hk(){return{enter:{gfmFootnoteCallString:zk,gfmFootnoteCall:Mk,gfmFootnoteDefinitionLabelString:Fk,gfmFootnoteDefinition:Rk},exit:{gfmFootnoteCallString:_k,gfmFootnoteCall:Ok,gfmFootnoteDefinitionLabelString:Bk,gfmFootnoteDefinition:Lk}}}function Uk(t){let l=!1;return t&&t.firstLineBlank&&(l=!0),{handlers:{footnoteDefinition:r,footnoteReference:Dy},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(i,c,u,f){const m=u.createTracker(f);let x=m.move("[^");const d=u.enter("footnoteDefinition"),g=u.enter("label");return x+=m.move(u.safe(u.associationId(i),{before:x,after:"]"})),g(),x+=m.move("]:"),i.children&&i.children.length>0&&(m.shift(4),x+=m.move((l?`
|
|
64
|
-
`:" ")+u.indentLines(u.containerFlow(i,m.current()),l?zy:Ik))),d(),x}}function Ik(t,l,r){return l===0?t:zy(t,l,r)}function zy(t,l,r){return(r?"":" ")+t}const Yk=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];My.peek=Kk;function qk(){return{canContainEols:["delete"],enter:{strikethrough:Vk},exit:{strikethrough:Gk}}}function Xk(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Yk}],handlers:{delete:My}}}function Vk(t){this.enter({type:"delete",children:[]},t)}function Gk(t){this.exit(t)}function My(t,l,r,i){const c=r.createTracker(i),u=r.enter("strikethrough");let f=c.move("~~");return f+=r.containerPhrasing(t,{...c.current(),before:f,after:"~"}),f+=c.move("~~"),u(),f}function Kk(){return"~"}function Qk(t){return t.length}function Wk(t,l){const r=l||{},i=(r.align||[]).concat(),c=r.stringLength||Qk,u=[],f=[],m=[],x=[];let d=0,g=-1;for(;++g<t.length;){const S=[],E=[];let C=-1;for(t[g].length>d&&(d=t[g].length);++C<t[g].length;){const A=Zk(t[g][C]);if(r.alignDelimiters!==!1){const M=c(A);E[C]=M,(x[C]===void 0||M>x[C])&&(x[C]=M)}S.push(A)}f[g]=S,m[g]=E}let y=-1;if(typeof i=="object"&&"length"in i)for(;++y<d;)u[y]=J1(i[y]);else{const S=J1(i);for(;++y<d;)u[y]=S}y=-1;const b=[],v=[];for(;++y<d;){const S=u[y];let E="",C="";S===99?(E=":",C=":"):S===108?E=":":S===114&&(C=":");let A=r.alignDelimiters===!1?1:Math.max(1,x[y]-E.length-C.length);const M=E+"-".repeat(A)+C;r.alignDelimiters!==!1&&(A=E.length+A+C.length,A>x[y]&&(x[y]=A),v[y]=A),b[y]=M}f.splice(1,0,b),m.splice(1,0,v),g=-1;const j=[];for(;++g<f.length;){const S=f[g],E=m[g];y=-1;const C=[];for(;++y<d;){const A=S[y]||"";let M="",
|
|
62
|
+
`}),r}function I1(t){let l=0,r=t.charCodeAt(l);for(;r===9||r===32;)l++,r=t.charCodeAt(l);return t.slice(l)}function Y1(t,l){const r=F3(t,l),i=r.one(t,void 0),c=j3(r),u=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return c&&u.children.push({type:"text",value:`
|
|
63
|
+
`},c),u}function $3(t,l){return t&&"run"in t?async function(r,i){const c=Y1(r,{file:i,...l});await t.run(c,i)}:function(r,i){return Y1(r,{file:i,...t||l})}}function q1(t){if(t)throw t}var rd,X1;function H3(){if(X1)return rd;X1=1;var t=Object.prototype.hasOwnProperty,l=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,c=function(d){return typeof Array.isArray=="function"?Array.isArray(d):l.call(d)==="[object Array]"},u=function(d){if(!d||l.call(d)!=="[object Object]")return!1;var g=t.call(d,"constructor"),y=d.constructor&&d.constructor.prototype&&t.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!g&&!y)return!1;var b;for(b in d);return typeof b>"u"||t.call(d,b)},f=function(d,g){r&&g.name==="__proto__"?r(d,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):d[g.name]=g.newValue},m=function(d,g){if(g==="__proto__")if(t.call(d,g)){if(i)return i(d,g).value}else return;return d[g]};return rd=function x(){var d,g,y,b,v,j,S=arguments[0],E=1,C=arguments.length,A=!1;for(typeof S=="boolean"&&(A=S,S=arguments[1]||{},E=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});E<C;++E)if(d=arguments[E],d!=null)for(g in d)y=m(S,g),b=m(d,g),S!==b&&(A&&b&&(u(b)||(v=c(b)))?(v?(v=!1,j=y&&c(y)?y:[]):j=y&&u(y)?y:{},f(S,{name:g,newValue:x(A,j,b)})):typeof b<"u"&&f(S,{name:g,newValue:b}));return S},rd}var U3=H3();const ad=X0(U3);function Xd(t){if(typeof t!="object"||t===null)return!1;const l=Object.getPrototypeOf(t);return(l===null||l===Object.prototype||Object.getPrototypeOf(l)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function I3(){const t=[],l={run:r,use:i};return l;function r(...c){let u=-1;const f=c.pop();if(typeof f!="function")throw new TypeError("Expected function as last argument, not "+f);m(null,...c);function m(x,...d){const g=t[++u];let y=-1;if(x){f(x);return}for(;++y<c.length;)(d[y]===null||d[y]===void 0)&&(d[y]=c[y]);c=d,g?Y3(g,m)(...d):f(null,...d)}}function i(c){if(typeof c!="function")throw new TypeError("Expected `middelware` to be a function, not "+c);return t.push(c),l}}function Y3(t,l){let r;return i;function i(...f){const m=t.length>f.length;let x;m&&f.push(c);try{x=t.apply(this,f)}catch(d){const g=d;if(m&&r)throw g;return c(g)}m||(x&&x.then&&typeof x.then=="function"?x.then(u,c):x instanceof Error?c(x):u(x))}function c(f,...m){r||(r=!0,l(f,...m))}function u(f){c(null,f)}}const Cl={basename:q3,dirname:X3,extname:V3,join:G3,sep:"/"};function q3(t,l){if(l!==void 0&&typeof l!="string")throw new TypeError('"ext" argument must be a string');$s(t);let r=0,i=-1,c=t.length,u;if(l===void 0||l.length===0||l.length>t.length){for(;c--;)if(t.codePointAt(c)===47){if(u){r=c+1;break}}else i<0&&(u=!0,i=c+1);return i<0?"":t.slice(r,i)}if(l===t)return"";let f=-1,m=l.length-1;for(;c--;)if(t.codePointAt(c)===47){if(u){r=c+1;break}}else f<0&&(u=!0,f=c+1),m>-1&&(t.codePointAt(c)===l.codePointAt(m--)?m<0&&(i=c):(m=-1,i=f));return r===i?i=f:i<0&&(i=t.length),t.slice(r,i)}function X3(t){if($s(t),t.length===0)return".";let l=-1,r=t.length,i;for(;--r;)if(t.codePointAt(r)===47){if(i){l=r;break}}else i||(i=!0);return l<0?t.codePointAt(0)===47?"/":".":l===1&&t.codePointAt(0)===47?"//":t.slice(0,l)}function V3(t){$s(t);let l=t.length,r=-1,i=0,c=-1,u=0,f;for(;l--;){const m=t.codePointAt(l);if(m===47){if(f){i=l+1;break}continue}r<0&&(f=!0,r=l+1),m===46?c<0?c=l:u!==1&&(u=1):c>-1&&(u=-1)}return c<0||r<0||u===0||u===1&&c===r-1&&c===i+1?"":t.slice(c,r)}function G3(...t){let l=-1,r;for(;++l<t.length;)$s(t[l]),t[l]&&(r=r===void 0?t[l]:r+"/"+t[l]);return r===void 0?".":K3(r)}function K3(t){$s(t);const l=t.codePointAt(0)===47;let r=Q3(t,!l);return r.length===0&&!l&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),l?"/"+r:r}function Q3(t,l){let r="",i=0,c=-1,u=0,f=-1,m,x;for(;++f<=t.length;){if(f<t.length)m=t.codePointAt(f);else{if(m===47)break;m=47}if(m===47){if(!(c===f-1||u===1))if(c!==f-1&&u===2){if(r.length<2||i!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(x=r.lastIndexOf("/"),x!==r.length-1){x<0?(r="",i=0):(r=r.slice(0,x),i=r.length-1-r.lastIndexOf("/")),c=f,u=0;continue}}else if(r.length>0){r="",i=0,c=f,u=0;continue}}l&&(r=r.length>0?r+"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(c+1,f):r=t.slice(c+1,f),i=f-c-1;c=f,u=0}else m===46&&u>-1?u++:u=-1}return r}function $s(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const W3={cwd:Z3};function Z3(){return"/"}function Vd(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function J3(t){if(typeof t=="string")t=new URL(t);else if(!Vd(t)){const l=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw l.code="ERR_INVALID_ARG_TYPE",l}if(t.protocol!=="file:"){const l=new TypeError("The URL must be of scheme file");throw l.code="ERR_INVALID_URL_SCHEME",l}return P3(t)}function P3(t){if(t.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const l=t.pathname;let r=-1;for(;++r<l.length;)if(l.codePointAt(r)===37&&l.codePointAt(r+1)===50){const i=l.codePointAt(r+2);if(i===70||i===102){const c=new TypeError("File URL path must not include encoded / characters");throw c.code="ERR_INVALID_FILE_URL_PATH",c}}return decodeURIComponent(l)}const id=["history","path","basename","stem","extname","dirname"];class Ny{constructor(l){let r;l?Vd(l)?r={path:l}:typeof l=="string"||ek(l)?r={value:l}:r=l:r={},this.cwd="cwd"in r?"":W3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<id.length;){const u=id[i];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let c;for(c in r)id.includes(c)||(this[c]=r[c])}get basename(){return typeof this.path=="string"?Cl.basename(this.path):void 0}set basename(l){od(l,"basename"),sd(l,"basename"),this.path=Cl.join(this.dirname||"",l)}get dirname(){return typeof this.path=="string"?Cl.dirname(this.path):void 0}set dirname(l){V1(this.basename,"dirname"),this.path=Cl.join(l||"",this.basename)}get extname(){return typeof this.path=="string"?Cl.extname(this.path):void 0}set extname(l){if(sd(l,"extname"),V1(this.dirname,"extname"),l){if(l.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(l.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Cl.join(this.dirname,this.stem+(l||""))}get path(){return this.history[this.history.length-1]}set path(l){Vd(l)&&(l=J3(l)),od(l,"path"),this.path!==l&&this.history.push(l)}get stem(){return typeof this.path=="string"?Cl.basename(this.path,this.extname):void 0}set stem(l){od(l,"stem"),sd(l,"stem"),this.path=Cl.join(this.dirname||"",l+(this.extname||""))}fail(l,r,i){const c=this.message(l,r,i);throw c.fatal=!0,c}info(l,r,i){const c=this.message(l,r,i);return c.fatal=void 0,c}message(l,r,i){const c=new bn(l,r,i);return this.path&&(c.name=this.path+":"+c.name,c.file=this.path),c.fatal=!1,this.messages.push(c),c}toString(l){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(l||void 0).decode(this.value)}}function sd(t,l){if(t&&t.includes(Cl.sep))throw new Error("`"+l+"` cannot be a path: did not expect `"+Cl.sep+"`")}function od(t,l){if(!t)throw new Error("`"+l+"` cannot be empty")}function V1(t,l){if(!t)throw new Error("Setting `"+l+"` requires `path` to be set too")}function ek(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const tk=(function(t){const i=this.constructor.prototype,c=i[t],u=function(){return c.apply(u,arguments)};return Object.setPrototypeOf(u,i),u}),nk={}.hasOwnProperty;class ph extends tk{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=I3()}copy(){const l=new ph;let r=-1;for(;++r<this.attachers.length;){const i=this.attachers[r];l.use(...i)}return l.data(ad(!0,{},this.namespace)),l}data(l,r){return typeof l=="string"?arguments.length===2?(fd("data",this.frozen),this.namespace[l]=r,this):nk.call(this.namespace,l)&&this.namespace[l]||void 0:l?(fd("data",this.frozen),this.namespace=l,this):this.namespace}freeze(){if(this.frozen)return this;const l=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const c=r.call(l,...i);typeof c=="function"&&this.transformers.use(c)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(l){this.freeze();const r=ac(l),i=this.parser||this.Parser;return cd("parse",i),i(String(r),r)}process(l,r){const i=this;return this.freeze(),cd("process",this.parser||this.Parser),ud("process",this.compiler||this.Compiler),r?c(void 0,r):new Promise(c);function c(u,f){const m=ac(l),x=i.parse(m);i.run(x,m,function(g,y,b){if(g||!y||!b)return d(g);const v=y,j=i.stringify(v,b);ak(j)?b.value=j:b.result=j,d(g,b)});function d(g,y){g||!y?f(g):u?u(y):r(void 0,y)}}}processSync(l){let r=!1,i;return this.freeze(),cd("processSync",this.parser||this.Parser),ud("processSync",this.compiler||this.Compiler),this.process(l,c),K1("processSync","process",r),i;function c(u,f){r=!0,q1(u),i=f}}run(l,r,i){G1(l),this.freeze();const c=this.transformers;return!i&&typeof r=="function"&&(i=r,r=void 0),i?u(void 0,i):new Promise(u);function u(f,m){const x=ac(r);c.run(l,x,d);function d(g,y,b){const v=y||l;g?m(g):f?f(v):i(void 0,v,b)}}}runSync(l,r){let i=!1,c;return this.run(l,r,u),K1("runSync","run",i),c;function u(f,m){q1(f),c=m,i=!0}}stringify(l,r){this.freeze();const i=ac(r),c=this.compiler||this.Compiler;return ud("stringify",c),G1(l),c(l,i)}use(l,...r){const i=this.attachers,c=this.namespace;if(fd("use",this.frozen),l!=null)if(typeof l=="function")x(l,r);else if(typeof l=="object")Array.isArray(l)?m(l):f(l);else throw new TypeError("Expected usable value, not `"+l+"`");return this;function u(d){if(typeof d=="function")x(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[g,...y]=d;x(g,y)}else f(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function f(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");m(d.plugins),d.settings&&(c.settings=ad(!0,c.settings,d.settings))}function m(d){let g=-1;if(d!=null)if(Array.isArray(d))for(;++g<d.length;){const y=d[g];u(y)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function x(d,g){let y=-1,b=-1;for(;++y<i.length;)if(i[y][0]===d){b=y;break}if(b===-1)i.push([d,...g]);else if(g.length>0){let[v,...j]=g;const S=i[b][1];Xd(S)&&Xd(v)&&(v=ad(!0,S,v)),i[b]=[d,v,...j]}}}}const lk=new ph().freeze();function cd(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function ud(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function fd(t,l){if(l)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function G1(t){if(!Xd(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function K1(t,l,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+l+"` instead")}function ac(t){return rk(t)?t:new Ny(t)}function rk(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function ak(t){return typeof t=="string"||ik(t)}function ik(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const sk="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Q1=[],W1={allowDangerousHtml:!0},ok=/^(https?|ircs?|mailto|xmpp)$/i,ck=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Ay(t){const l=uk(t),r=fk(t);return dk(l.runSync(l.parse(r),r),t)}function uk(t){const l=t.rehypePlugins||Q1,r=t.remarkPlugins||Q1,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...W1}:W1;return lk().use(X5).use(r).use($3,i).use(l)}function fk(t){const l=t.children||"",r=new Ny;return typeof l=="string"&&(r.value=l),r}function dk(t,l){const r=l.allowedElements,i=l.allowElement,c=l.components,u=l.disallowedElements,f=l.skipHtml,m=l.unwrapDisallowed,x=l.urlTransform||hk;for(const g of ck)Object.hasOwn(l,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+sk+g.id,void 0);return xh(t,d),Av(t,{Fragment:o.Fragment,components:c,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function d(g,y,b){if(g.type==="raw"&&b&&typeof y=="number")return f?b.children.splice(y,1):b.children[y]={type:"text",value:g.value},y;if(g.type==="element"){let v;for(v in td)if(Object.hasOwn(td,v)&&Object.hasOwn(g.properties,v)){const j=g.properties[v],S=td[v];(S===null||S.includes(g.tagName))&&(g.properties[v]=x(String(j||""),v,g))}}if(g.type==="element"){let v=r?!r.includes(g.tagName):u?u.includes(g.tagName):!1;if(!v&&i&&typeof y=="number"&&(v=!i(g,y,b)),v&&b&&typeof y=="number")return m&&g.children?b.children.splice(y,1,...g.children):b.children.splice(y,1),y}}}function hk(t){const l=t.indexOf(":"),r=t.indexOf("?"),i=t.indexOf("#"),c=t.indexOf("/");return l===-1||c!==-1&&l>c||r!==-1&&l>r||i!==-1&&l>i||ok.test(t.slice(0,l))?t:""}function Z1(t,l){const r=String(t);if(typeof l!="string")throw new TypeError("Expected character");let i=0,c=r.indexOf(l);for(;c!==-1;)i++,c=r.indexOf(l,c+l.length);return i}function mk(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function xk(t,l,r){const c=$c((r||{}).ignore||[]),u=pk(l);let f=-1;for(;++f<u.length;)Ey(t,"text",m);function m(d,g){let y=-1,b;for(;++y<g.length;){const v=g[y],j=b?b.children:void 0;if(c(v,j?j.indexOf(v):void 0,b))return;b=v}if(b)return x(d,g)}function x(d,g){const y=g[g.length-1],b=u[f][0],v=u[f][1];let j=0;const E=y.children.indexOf(d);let C=!1,A=[];b.lastIndex=0;let M=b.exec(d.value);for(;M;){const R=M.index,L={index:M.index,input:M.input,stack:[...g,d]};let O=v(...M,L);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?b.lastIndex=R+1:(j!==R&&A.push({type:"text",value:d.value.slice(j,R)}),Array.isArray(O)?A.push(...O):O&&A.push(O),j=R+M[0].length,C=!0),!b.global)break;M=b.exec(d.value)}return C?(j<d.value.length&&A.push({type:"text",value:d.value.slice(j)}),y.children.splice(E,1,...A)):A=[d],E+A.length}}function pk(t){const l=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!t[0]||Array.isArray(t[0])?t:[t];let i=-1;for(;++i<r.length;){const c=r[i];l.push([yk(c[0]),gk(c[1])])}return l}function yk(t){return typeof t=="string"?new RegExp(mk(t),"g"):t}function gk(t){return typeof t=="function"?t:function(){return t}}const dd="phrasing",hd=["autolink","link","image","label"];function bk(){return{transforms:[Ek],enter:{literalAutolink:wk,literalAutolinkEmail:md,literalAutolinkHttp:md,literalAutolinkWww:md},exit:{literalAutolink:Ck,literalAutolinkEmail:jk,literalAutolinkHttp:kk,literalAutolinkWww:Sk}}}function vk(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:dd,notInConstruct:hd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:dd,notInConstruct:hd},{character:":",before:"[ps]",after:"\\/",inConstruct:dd,notInConstruct:hd}]}}function wk(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function md(t){this.config.enter.autolinkProtocol.call(this,t)}function kk(t){this.config.exit.autolinkProtocol.call(this,t)}function Sk(t){this.config.exit.data.call(this,t);const l=this.stack[this.stack.length-1];l.type,l.url="http://"+this.sliceSerialize(t)}function jk(t){this.config.exit.autolinkEmail.call(this,t)}function Ck(t){this.exit(t)}function Ek(t){xk(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Nk],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Ak]],{ignore:["link","linkReference"]})}function Nk(t,l,r,i,c){let u="";if(!Ty(c)||(/^w/i.test(l)&&(r=l+r,l="",u="http://"),!Tk(r)))return!1;const f=Dk(r+i);if(!f[0])return!1;const m={type:"link",title:null,url:u+l+f[0],children:[{type:"text",value:l+f[0]}]};return f[1]?[m,{type:"text",value:f[1]}]:m}function Ak(t,l,r,i){return!Ty(i,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+l+"@"+r,children:[{type:"text",value:l+"@"+r}]}}function Tk(t){const l=t.split(".");return!(l.length<2||l[l.length-1]&&(/_/.test(l[l.length-1])||!/[a-zA-Z\d]/.test(l[l.length-1]))||l[l.length-2]&&(/_/.test(l[l.length-2])||!/[a-zA-Z\d]/.test(l[l.length-2])))}function Dk(t){const l=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!l)return[t,void 0];t=t.slice(0,l.index);let r=l[0],i=r.indexOf(")");const c=Z1(t,"(");let u=Z1(t,")");for(;i!==-1&&c>u;)t+=r.slice(0,i+1),r=r.slice(i+1),i=r.indexOf(")"),u++;return[t,r]}function Ty(t,l){const r=t.input.charCodeAt(t.index-1);return(t.index===0||wa(r)||Oc(r))&&(!l||r!==47)}Dy.peek=$k;function zk(){this.buffer()}function Mk(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function Rk(){this.buffer()}function Fk(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function _k(t){const l=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=ml(this.sliceSerialize(t)).toLowerCase(),r.label=l}function Ok(t){this.exit(t)}function Bk(t){const l=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=ml(this.sliceSerialize(t)).toLowerCase(),r.label=l}function Lk(t){this.exit(t)}function $k(){return"["}function Dy(t,l,r,i){const c=r.createTracker(i);let u=c.move("[^");const f=r.enter("footnoteReference"),m=r.enter("reference");return u+=c.move(r.safe(r.associationId(t),{after:"]",before:u})),m(),f(),u+=c.move("]"),u}function Hk(){return{enter:{gfmFootnoteCallString:zk,gfmFootnoteCall:Mk,gfmFootnoteDefinitionLabelString:Rk,gfmFootnoteDefinition:Fk},exit:{gfmFootnoteCallString:_k,gfmFootnoteCall:Ok,gfmFootnoteDefinitionLabelString:Bk,gfmFootnoteDefinition:Lk}}}function Uk(t){let l=!1;return t&&t.firstLineBlank&&(l=!0),{handlers:{footnoteDefinition:r,footnoteReference:Dy},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(i,c,u,f){const m=u.createTracker(f);let x=m.move("[^");const d=u.enter("footnoteDefinition"),g=u.enter("label");return x+=m.move(u.safe(u.associationId(i),{before:x,after:"]"})),g(),x+=m.move("]:"),i.children&&i.children.length>0&&(m.shift(4),x+=m.move((l?`
|
|
64
|
+
`:" ")+u.indentLines(u.containerFlow(i,m.current()),l?zy:Ik))),d(),x}}function Ik(t,l,r){return l===0?t:zy(t,l,r)}function zy(t,l,r){return(r?"":" ")+t}const Yk=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];My.peek=Kk;function qk(){return{canContainEols:["delete"],enter:{strikethrough:Vk},exit:{strikethrough:Gk}}}function Xk(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Yk}],handlers:{delete:My}}}function Vk(t){this.enter({type:"delete",children:[]},t)}function Gk(t){this.exit(t)}function My(t,l,r,i){const c=r.createTracker(i),u=r.enter("strikethrough");let f=c.move("~~");return f+=r.containerPhrasing(t,{...c.current(),before:f,after:"~"}),f+=c.move("~~"),u(),f}function Kk(){return"~"}function Qk(t){return t.length}function Wk(t,l){const r=l||{},i=(r.align||[]).concat(),c=r.stringLength||Qk,u=[],f=[],m=[],x=[];let d=0,g=-1;for(;++g<t.length;){const S=[],E=[];let C=-1;for(t[g].length>d&&(d=t[g].length);++C<t[g].length;){const A=Zk(t[g][C]);if(r.alignDelimiters!==!1){const M=c(A);E[C]=M,(x[C]===void 0||M>x[C])&&(x[C]=M)}S.push(A)}f[g]=S,m[g]=E}let y=-1;if(typeof i=="object"&&"length"in i)for(;++y<d;)u[y]=J1(i[y]);else{const S=J1(i);for(;++y<d;)u[y]=S}y=-1;const b=[],v=[];for(;++y<d;){const S=u[y];let E="",C="";S===99?(E=":",C=":"):S===108?E=":":S===114&&(C=":");let A=r.alignDelimiters===!1?1:Math.max(1,x[y]-E.length-C.length);const M=E+"-".repeat(A)+C;r.alignDelimiters!==!1&&(A=E.length+A+C.length,A>x[y]&&(x[y]=A),v[y]=A),b[y]=M}f.splice(1,0,b),m.splice(1,0,v),g=-1;const j=[];for(;++g<f.length;){const S=f[g],E=m[g];y=-1;const C=[];for(;++y<d;){const A=S[y]||"";let M="",R="";if(r.alignDelimiters!==!1){const L=x[y]-(E[y]||0),O=u[y];O===114?M=" ".repeat(L):O===99?L%2?(M=" ".repeat(L/2+.5),R=" ".repeat(L/2-.5)):(M=" ".repeat(L/2),R=M):R=" ".repeat(L)}r.delimiterStart!==!1&&!y&&C.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&A==="")&&(r.delimiterStart!==!1||y)&&C.push(" "),r.alignDelimiters!==!1&&C.push(M),C.push(A),r.alignDelimiters!==!1&&C.push(R),r.padding!==!1&&C.push(" "),(r.delimiterEnd!==!1||y!==d-1)&&C.push("|")}j.push(r.delimiterEnd===!1?C.join("").replace(/ +$/,""):C.join(""))}return j.join(`
|
|
65
65
|
`)}function Zk(t){return t==null?"":String(t)}function J1(t){const l=typeof t=="string"?t.codePointAt(0):0;return l===67||l===99?99:l===76||l===108?108:l===82||l===114?114:0}function Jk(t,l,r,i){const c=r.enter("blockquote"),u=r.createTracker(i);u.move("> "),u.shift(2);const f=r.indentLines(r.containerFlow(t,u.current()),Pk);return c(),f}function Pk(t,l,r){return">"+(r?"":" ")+t}function e4(t,l){return P1(t,l.inConstruct,!0)&&!P1(t,l.notInConstruct,!1)}function P1(t,l,r){if(typeof l=="string"&&(l=[l]),!l||l.length===0)return r;let i=-1;for(;++i<l.length;)if(t.includes(l[i]))return!0;return!1}function e0(t,l,r,i){let c=-1;for(;++c<r.unsafe.length;)if(r.unsafe[c].character===`
|
|
66
66
|
`&&e4(r.stack,r.unsafe[c]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
67
67
|
`}function t4(t,l){const r=String(t);let i=r.indexOf(l),c=i,u=0,f=0;if(typeof l!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===c?++u>f&&(f=u):u=1,c=i+l.length,i=r.indexOf(l,c);return f}function n4(t,l){return!!(l.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function l4(t){const l=t.options.fence||"`";if(l!=="`"&&l!=="~")throw new Error("Cannot serialize code with `"+l+"` for `options.fence`, expected `` ` `` or `~`");return l}function r4(t,l,r,i){const c=l4(r),u=t.value||"",f=c==="`"?"GraveAccent":"Tilde";if(n4(t,r)){const y=r.enter("codeIndented"),b=r.indentLines(u,a4);return y(),b}const m=r.createTracker(i),x=c.repeat(Math.max(t4(u,c)+1,3)),d=r.enter("codeFenced");let g=m.move(x);if(t.lang){const y=r.enter(`codeFencedLang${f}`);g+=m.move(r.safe(t.lang,{before:g,after:" ",encode:["`"],...m.current()})),y()}if(t.lang&&t.meta){const y=r.enter(`codeFencedMeta${f}`);g+=m.move(" "),g+=m.move(r.safe(t.meta,{before:g,after:`
|
|
68
68
|
`,encode:["`"],...m.current()})),y()}return g+=m.move(`
|
|
69
69
|
`),u&&(g+=m.move(u+`
|
|
70
70
|
`)),g+=m.move(x),d(),g}function a4(t,l,r){return(r?"":" ")+t}function yh(t){const l=t.options.quote||'"';if(l!=='"'&&l!=="'")throw new Error("Cannot serialize title with `"+l+"` for `options.quote`, expected `\"`, or `'`");return l}function i4(t,l,r,i){const c=yh(r),u=c==='"'?"Quote":"Apostrophe",f=r.enter("definition");let m=r.enter("label");const x=r.createTracker(i);let d=x.move("[");return d+=x.move(r.safe(r.associationId(t),{before:d,after:"]",...x.current()})),d+=x.move("]: "),m(),!t.url||/[\0- \u007F]/.test(t.url)?(m=r.enter("destinationLiteral"),d+=x.move("<"),d+=x.move(r.safe(t.url,{before:d,after:">",...x.current()})),d+=x.move(">")):(m=r.enter("destinationRaw"),d+=x.move(r.safe(t.url,{before:d,after:t.title?" ":`
|
|
71
|
-
`,...x.current()}))),m(),t.title&&(m=r.enter(`title${u}`),d+=x.move(" "+c),d+=x.move(r.safe(t.title,{before:d,after:c,...x.current()})),d+=x.move(c),m()),f(),d}function s4(t){const l=t.options.emphasis||"*";if(l!=="*"&&l!=="_")throw new Error("Cannot serialize emphasis with `"+l+"` for `options.emphasis`, expected `*`, or `_`");return l}function Ms(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Ac(t,l,r){const i=
|
|
71
|
+
`,...x.current()}))),m(),t.title&&(m=r.enter(`title${u}`),d+=x.move(" "+c),d+=x.move(r.safe(t.title,{before:d,after:c,...x.current()})),d+=x.move(c),m()),f(),d}function s4(t){const l=t.options.emphasis||"*";if(l!=="*"&&l!=="_")throw new Error("Cannot serialize emphasis with `"+l+"` for `options.emphasis`, expected `*`, or `_`");return l}function Ms(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Ac(t,l,r){const i=ci(t),c=ci(l);return i===void 0?c===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Ry.peek=o4;function Ry(t,l,r,i){const c=s4(r),u=r.enter("emphasis"),f=r.createTracker(i),m=f.move(c);let x=f.move(r.containerPhrasing(t,{after:c,before:m,...f.current()}));const d=x.charCodeAt(0),g=Ac(i.before.charCodeAt(i.before.length-1),d,c);g.inside&&(x=Ms(d)+x.slice(1));const y=x.charCodeAt(x.length-1),b=Ac(i.after.charCodeAt(0),y,c);b.inside&&(x=x.slice(0,-1)+Ms(y));const v=f.move(c);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},m+x+v}function o4(t,l,r){return r.options.emphasis||"*"}function c4(t,l){let r=!1;return xh(t,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return r=!0,Yd}),!!((!t.depth||t.depth<3)&&oh(t)&&(l.options.setext||r))}function u4(t,l,r,i){const c=Math.max(Math.min(6,t.depth||1),1),u=r.createTracker(i);if(c4(t,r)){const g=r.enter("headingSetext"),y=r.enter("phrasing"),b=r.containerPhrasing(t,{...u.current(),before:`
|
|
72
72
|
`,after:`
|
|
73
73
|
`});return y(),g(),b+`
|
|
74
74
|
`+(c===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
75
75
|
`))+1))}const f="#".repeat(c),m=r.enter("headingAtx"),x=r.enter("phrasing");u.move(f+" ");let d=r.containerPhrasing(t,{before:"# ",after:`
|
|
76
|
-
`,...u.current()});return/^[\t ]/.test(d)&&(d=Ms(d.charCodeAt(0))+d.slice(1)),d=d?f+" "+d:f,r.options.closeAtx&&(d+=" "+f),x(),m(),d}
|
|
76
|
+
`,...u.current()});return/^[\t ]/.test(d)&&(d=Ms(d.charCodeAt(0))+d.slice(1)),d=d?f+" "+d:f,r.options.closeAtx&&(d+=" "+f),x(),m(),d}Fy.peek=f4;function Fy(t){return t.value||""}function f4(){return"<"}_y.peek=d4;function _y(t,l,r,i){const c=yh(r),u=c==='"'?"Quote":"Apostrophe",f=r.enter("image");let m=r.enter("label");const x=r.createTracker(i);let d=x.move("![");return d+=x.move(r.safe(t.alt,{before:d,after:"]",...x.current()})),d+=x.move("]("),m(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(m=r.enter("destinationLiteral"),d+=x.move("<"),d+=x.move(r.safe(t.url,{before:d,after:">",...x.current()})),d+=x.move(">")):(m=r.enter("destinationRaw"),d+=x.move(r.safe(t.url,{before:d,after:t.title?" ":")",...x.current()}))),m(),t.title&&(m=r.enter(`title${u}`),d+=x.move(" "+c),d+=x.move(r.safe(t.title,{before:d,after:c,...x.current()})),d+=x.move(c),m()),d+=x.move(")"),f(),d}function d4(){return"!"}Oy.peek=h4;function Oy(t,l,r,i){const c=t.referenceType,u=r.enter("imageReference");let f=r.enter("label");const m=r.createTracker(i);let x=m.move("![");const d=r.safe(t.alt,{before:x,after:"]",...m.current()});x+=m.move(d+"]["),f();const g=r.stack;r.stack=[],f=r.enter("reference");const y=r.safe(r.associationId(t),{before:x,after:"]",...m.current()});return f(),r.stack=g,u(),c==="full"||!d||d!==y?x+=m.move(y+"]"):c==="shortcut"?x=x.slice(0,-1):x+=m.move("]"),x}function h4(){return"!"}By.peek=m4;function By(t,l,r){let i=t.value||"",c="`",u=-1;for(;new RegExp("(^|[^`])"+c+"([^`]|$)").test(i);)c+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++u<r.unsafe.length;){const f=r.unsafe[u],m=r.compilePattern(f);let x;if(f.atBreak)for(;x=m.exec(i);){let d=x.index;i.charCodeAt(d)===10&&i.charCodeAt(d-1)===13&&d--,i=i.slice(0,d)+" "+i.slice(x.index+1)}}return c+i+c}function m4(){return"`"}function Ly(t,l){const r=oh(t);return!!(!l.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(r===t.url||"mailto:"+r===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}$y.peek=x4;function $y(t,l,r,i){const c=yh(r),u=c==='"'?"Quote":"Apostrophe",f=r.createTracker(i);let m,x;if(Ly(t,r)){const g=r.stack;r.stack=[],m=r.enter("autolink");let y=f.move("<");return y+=f.move(r.containerPhrasing(t,{before:y,after:">",...f.current()})),y+=f.move(">"),m(),r.stack=g,y}m=r.enter("link"),x=r.enter("label");let d=f.move("[");return d+=f.move(r.containerPhrasing(t,{before:d,after:"](",...f.current()})),d+=f.move("]("),x(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(x=r.enter("destinationLiteral"),d+=f.move("<"),d+=f.move(r.safe(t.url,{before:d,after:">",...f.current()})),d+=f.move(">")):(x=r.enter("destinationRaw"),d+=f.move(r.safe(t.url,{before:d,after:t.title?" ":")",...f.current()}))),x(),t.title&&(x=r.enter(`title${u}`),d+=f.move(" "+c),d+=f.move(r.safe(t.title,{before:d,after:c,...f.current()})),d+=f.move(c),x()),d+=f.move(")"),m(),d}function x4(t,l,r){return Ly(t,r)?"<":"["}Hy.peek=p4;function Hy(t,l,r,i){const c=t.referenceType,u=r.enter("linkReference");let f=r.enter("label");const m=r.createTracker(i);let x=m.move("[");const d=r.containerPhrasing(t,{before:x,after:"]",...m.current()});x+=m.move(d+"]["),f();const g=r.stack;r.stack=[],f=r.enter("reference");const y=r.safe(r.associationId(t),{before:x,after:"]",...m.current()});return f(),r.stack=g,u(),c==="full"||!d||d!==y?x+=m.move(y+"]"):c==="shortcut"?x=x.slice(0,-1):x+=m.move("]"),x}function p4(){return"["}function gh(t){const l=t.options.bullet||"*";if(l!=="*"&&l!=="+"&&l!=="-")throw new Error("Cannot serialize items with `"+l+"` for `options.bullet`, expected `*`, `+`, or `-`");return l}function y4(t){const l=gh(t),r=t.options.bulletOther;if(!r)return l==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===l)throw new Error("Expected `bullet` (`"+l+"`) and `bulletOther` (`"+r+"`) to be different");return r}function g4(t){const l=t.options.bulletOrdered||".";if(l!=="."&&l!==")")throw new Error("Cannot serialize items with `"+l+"` for `options.bulletOrdered`, expected `.` or `)`");return l}function Uy(t){const l=t.options.rule||"*";if(l!=="*"&&l!=="-"&&l!=="_")throw new Error("Cannot serialize rules with `"+l+"` for `options.rule`, expected `*`, `-`, or `_`");return l}function b4(t,l,r,i){const c=r.enter("list"),u=r.bulletCurrent;let f=t.ordered?g4(r):gh(r);const m=t.ordered?f==="."?")":".":y4(r);let x=l&&r.bulletLastUsed?f===r.bulletLastUsed:!1;if(!t.ordered){const g=t.children?t.children[0]:void 0;if((f==="*"||f==="-")&&g&&(!g.children||!g.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(x=!0),Uy(r)===f&&g){let y=-1;for(;++y<t.children.length;){const b=t.children[y];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){x=!0;break}}}}x&&(f=m),r.bulletCurrent=f;const d=r.containerFlow(t,i);return r.bulletLastUsed=f,r.bulletCurrent=u,c(),d}function v4(t){const l=t.options.listItemIndent||"one";if(l!=="tab"&&l!=="one"&&l!=="mixed")throw new Error("Cannot serialize items with `"+l+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return l}function w4(t,l,r,i){const c=v4(r);let u=r.bulletCurrent||gh(r);l&&l.type==="list"&&l.ordered&&(u=(typeof l.start=="number"&&l.start>-1?l.start:1)+(r.options.incrementListMarker===!1?0:l.children.indexOf(t))+u);let f=u.length+1;(c==="tab"||c==="mixed"&&(l&&l.type==="list"&&l.spread||t.spread))&&(f=Math.ceil(f/4)*4);const m=r.createTracker(i);m.move(u+" ".repeat(f-u.length)),m.shift(f);const x=r.enter("listItem"),d=r.indentLines(r.containerFlow(t,m.current()),g);return x(),d;function g(y,b,v){return b?(v?"":" ".repeat(f))+y:(v?u:u+" ".repeat(f-u.length))+y}}function k4(t,l,r,i){const c=r.enter("paragraph"),u=r.enter("phrasing"),f=r.containerPhrasing(t,i);return u(),c(),f}const S4=$c(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function j4(t,l,r,i){return(t.children.some(function(f){return S4(f)})?r.containerPhrasing:r.containerFlow).call(r,t,i)}function C4(t){const l=t.options.strong||"*";if(l!=="*"&&l!=="_")throw new Error("Cannot serialize strong with `"+l+"` for `options.strong`, expected `*`, or `_`");return l}Iy.peek=E4;function Iy(t,l,r,i){const c=C4(r),u=r.enter("strong"),f=r.createTracker(i),m=f.move(c+c);let x=f.move(r.containerPhrasing(t,{after:c,before:m,...f.current()}));const d=x.charCodeAt(0),g=Ac(i.before.charCodeAt(i.before.length-1),d,c);g.inside&&(x=Ms(d)+x.slice(1));const y=x.charCodeAt(x.length-1),b=Ac(i.after.charCodeAt(0),y,c);b.inside&&(x=x.slice(0,-1)+Ms(y));const v=f.move(c+c);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},m+x+v}function E4(t,l,r){return r.options.strong||"*"}function N4(t,l,r,i){return r.safe(t.value,i)}function A4(t){const l=t.options.ruleRepetition||3;if(l<3)throw new Error("Cannot serialize rules with repetition `"+l+"` for `options.ruleRepetition`, expected `3` or more");return l}function T4(t,l,r){const i=(Uy(r)+(r.options.ruleSpaces?" ":"")).repeat(A4(r));return r.options.ruleSpaces?i.slice(0,-1):i}const Yy={blockquote:Jk,break:e0,code:r4,definition:i4,emphasis:Ry,hardBreak:e0,heading:u4,html:Fy,image:_y,imageReference:Oy,inlineCode:By,link:$y,linkReference:Hy,list:b4,listItem:w4,paragraph:k4,root:j4,strong:Iy,text:N4,thematicBreak:T4};function D4(){return{enter:{table:z4,tableData:t0,tableHeader:t0,tableRow:R4},exit:{codeText:F4,table:M4,tableData:xd,tableHeader:xd,tableRow:xd}}}function z4(t){const l=t._align;this.enter({type:"table",align:l.map(function(r){return r==="none"?null:r}),children:[]},t),this.data.inTable=!0}function M4(t){this.exit(t),this.data.inTable=void 0}function R4(t){this.enter({type:"tableRow",children:[]},t)}function xd(t){this.exit(t)}function t0(t){this.enter({type:"tableCell",children:[]},t)}function F4(t){let l=this.resume();this.data.inTable&&(l=l.replace(/\\([\\|])/g,_4));const r=this.stack[this.stack.length-1];r.type,r.value=l,this.exit(t)}function _4(t,l){return l==="|"?l:t}function O4(t){const l=t||{},r=l.tableCellPadding,i=l.tablePipeAlign,c=l.stringLength,u=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
77
77
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:f,tableCell:x,tableRow:m}};function f(v,j,S,E){return d(g(v,S,E),v.align)}function m(v,j,S,E){const C=y(v,S,E),A=d([C]);return A.slice(0,A.indexOf(`
|
|
78
|
-
`))}function x(v,j,S,E){const C=S.enter("tableCell"),A=S.enter("phrasing"),M=S.containerPhrasing(v,{...E,before:u,after:u});return A(),C(),M}function d(v,j){return Wk(v,{align:j,alignDelimiters:i,padding:r,stringLength:c})}function g(v,j,S){const E=v.children;let C=-1;const A=[],M=j.enter("table");for(;++C<E.length;)A[C]=y(E[C],j,S);return M(),A}function y(v,j,S){const E=v.children;let C=-1;const A=[],M=j.enter("tableRow");for(;++C<E.length;)A[C]=x(E[C],v,j,S);return M(),A}function b(v,j,S){let E=Yy.inlineCode(v,j,S);return S.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function B4(){return{exit:{taskListCheckValueChecked:n0,taskListCheckValueUnchecked:n0,paragraph:$4}}}function L4(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:H4}}}function n0(t){const l=this.stack[this.stack.length-2];l.type,l.checked=t.type==="taskListCheckValueChecked"}function $4(t){const l=this.stack[this.stack.length-2];if(l&&l.type==="listItem"&&typeof l.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const i=r.children[0];if(i&&i.type==="text"){const c=l.children;let u=-1,f;for(;++u<c.length;){const m=c[u];if(m.type==="paragraph"){f=m;break}}f===r&&(i.value=i.value.slice(1),i.value.length===0?r.children.shift():r.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,r.position.start=Object.assign({},i.position.start)))}}this.exit(t)}function H4(t,l,r,i){const c=t.children[0],u=typeof t.checked=="boolean"&&c&&c.type==="paragraph",f="["+(t.checked?"x":" ")+"] ",m=r.createTracker(i);u&&m.move(f);let x=Yy.listItem(t,l,r,{...i,...m.current()});return u&&(x=x.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),x;function d(g){return g+f}}function U4(){return[bk(),Hk(),qk(),D4(),B4()]}function I4(t){return{extensions:[vk(),Uk(t),Xk(),O4(t),L4()]}}const Y4={tokenize:Q4,partial:!0},qy={tokenize:W4,partial:!0},Xy={tokenize:Z4,partial:!0},Vy={tokenize:J4,partial:!0},q4={tokenize:P4,partial:!0},Gy={name:"wwwAutolink",tokenize:G4,previous:Qy},Ky={name:"protocolAutolink",tokenize:K4,previous:Wy},rr={name:"emailAutolink",tokenize:V4,previous:Zy},Nl={};function X4(){return{text:Nl}}let da=48;for(;da<123;)Nl[da]=rr,da++,da===58?da=65:da===91&&(da=97);Nl[43]=rr;Nl[45]=rr;Nl[46]=rr;Nl[95]=rr;Nl[72]=[rr,Ky];Nl[104]=[rr,Ky];Nl[87]=[rr,Gy];Nl[119]=[rr,Gy];function V4(t,l,r){const i=this;let c,u;return f;function f(y){return!Gd(y)||!Zy.call(i,i.previous)||bh(i.events)?r(y):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),m(y))}function m(y){return Gd(y)?(t.consume(y),m):y===64?(t.consume(y),x):r(y)}function x(y){return y===46?t.check(q4,g,d)(y):y===45||y===95||yn(y)?(u=!0,t.consume(y),x):g(y)}function d(y){return t.consume(y),c=!0,x}function g(y){return u&&c&&kn(i.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),l(y)):r(y)}}function G4(t,l,r){const i=this;return c;function c(f){return f!==87&&f!==119||!Qy.call(i,i.previous)||bh(i.events)?r(f):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Y4,t.attempt(qy,t.attempt(Xy,u),r),r)(f))}function u(f){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),l(f)}}function K4(t,l,r){const i=this;let c="",u=!1;return f;function f(y){return(y===72||y===104)&&Wy.call(i,i.previous)&&!bh(i.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),c+=String.fromCodePoint(y),t.consume(y),m):r(y)}function m(y){if(kn(y)&&c.length<5)return c+=String.fromCodePoint(y),t.consume(y),m;if(y===58){const b=c.toLowerCase();if(b==="http"||b==="https")return t.consume(y),x}return r(y)}function x(y){return y===47?(t.consume(y),u?d:(u=!0,x)):r(y)}function d(y){return y===null||Cc(y)||zt(y)||ba(y)||Oc(y)?r(y):t.attempt(qy,t.attempt(Xy,g),r)(y)}function g(y){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),l(y)}}function Q4(t,l,r){let i=0;return c;function c(f){return(f===87||f===119)&&i<3?(i++,t.consume(f),c):f===46&&i===3?(t.consume(f),u):r(f)}function u(f){return f===null?r(f):l(f)}}function W4(t,l,r){let i,c,u;return f;function f(d){return d===46||d===95?t.check(Vy,x,m)(d):d===null||zt(d)||ba(d)||d!==45&&Oc(d)?x(d):(u=!0,t.consume(d),f)}function m(d){return d===95?i=!0:(c=i,i=void 0),t.consume(d),f}function x(d){return c||i||!u?r(d):l(d)}}function Z4(t,l){let r=0,i=0;return c;function c(f){return f===40?(r++,t.consume(f),c):f===41&&i<r?u(f):f===33||f===34||f===38||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===60||f===63||f===93||f===95||f===126?t.check(Vy,l,u)(f):f===null||zt(f)||ba(f)?l(f):(t.consume(f),c)}function u(f){return f===41&&i++,t.consume(f),c}}function J4(t,l,r){return i;function i(m){return m===33||m===34||m===39||m===41||m===42||m===44||m===46||m===58||m===59||m===63||m===95||m===126?(t.consume(m),i):m===38?(t.consume(m),u):m===93?(t.consume(m),c):m===60||m===null||zt(m)||ba(m)?l(m):r(m)}function c(m){return m===null||m===40||m===91||zt(m)||ba(m)?l(m):i(m)}function u(m){return kn(m)?f(m):r(m)}function f(m){return m===59?(t.consume(m),i):kn(m)?(t.consume(m),f):r(m)}}function P4(t,l,r){return i;function i(u){return t.consume(u),c}function c(u){return yn(u)?r(u):l(u)}}function Qy(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||zt(t)}function Wy(t){return!kn(t)}function Zy(t){return!(t===47||Gd(t))}function Gd(t){return t===43||t===45||t===46||t===95||yn(t)}function bh(t){let l=t.length,r=!1;for(;l--;){const i=t[l][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){r=!0;break}if(i._gfmAutolinkLiteralWalkedInto){r=!1;break}}return t.length>0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const eS={tokenize:oS,partial:!0};function tS(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:aS,continuation:{tokenize:iS},exit:sS}},text:{91:{name:"gfmFootnoteCall",tokenize:rS},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:nS,resolveTo:lS}}}}function nS(t,l,r){const i=this;let c=i.events.length;const u=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let f;for(;c--;){const x=i.events[c][1];if(x.type==="labelImage"){f=x;break}if(x.type==="gfmFootnoteCall"||x.type==="labelLink"||x.type==="label"||x.type==="image"||x.type==="link")break}return m;function m(x){if(!f||!f._balanced)return r(x);const d=hl(i.sliceSerialize({start:f.end,end:i.now()}));return d.codePointAt(0)!==94||!u.includes(d.slice(1))?r(x):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(x),t.exit("gfmFootnoteCallLabelMarker"),l(x))}}function lS(t,l){let r=t.length;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};c.end.column++,c.end.offset++,c.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},c.end),end:Object.assign({},t[t.length-1][1].start)},f={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},m=[t[r+1],t[r+2],["enter",i,l],t[r+3],t[r+4],["enter",c,l],["exit",c,l],["enter",u,l],["enter",f,l],["exit",f,l],["exit",u,l],t[t.length-2],t[t.length-1],["exit",i,l]];return t.splice(r,t.length-r+1,...m),t}function rS(t,l,r){const i=this,c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u=0,f;return m;function m(y){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),x}function x(y){return y!==94?r(y):(t.enter("gfmFootnoteCallMarker"),t.consume(y),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",d)}function d(y){if(u>999||y===93&&!f||y===null||y===91||zt(y))return r(y);if(y===93){t.exit("chunkString");const b=t.exit("gfmFootnoteCallString");return c.includes(hl(i.sliceSerialize(b)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),l):r(y)}return zt(y)||(f=!0),u++,t.consume(y),y===92?g:d}function g(y){return y===91||y===92||y===93?(t.consume(y),u++,d):d(y)}}function aS(t,l,r){const i=this,c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u,f=0,m;return x;function x(j){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(j),t.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(j){return j===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(j),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",g):r(j)}function g(j){if(f>999||j===93&&!m||j===null||j===91||zt(j))return r(j);if(j===93){t.exit("chunkString");const S=t.exit("gfmFootnoteDefinitionLabelString");return u=hl(i.sliceSerialize(S)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(j),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),b}return zt(j)||(m=!0),f++,t.consume(j),j===92?y:g}function y(j){return j===91||j===92||j===93?(t.consume(j),f++,g):g(j)}function b(j){return j===58?(t.enter("definitionMarker"),t.consume(j),t.exit("definitionMarker"),c.includes(u)||c.push(u),dt(t,v,"gfmFootnoteDefinitionWhitespace")):r(j)}function v(j){return l(j)}}function iS(t,l,r){return t.check(Ls,l,t.attempt(eS,l,r))}function sS(t){t.exit("gfmFootnoteDefinition")}function oS(t,l,r){const i=this;return dt(t,c,"gfmFootnoteDefinitionIndent",5);function c(u){const f=i.events[i.events.length-1];return f&&f[1].type==="gfmFootnoteDefinitionIndent"&&f[2].sliceSerialize(f[1],!0).length===4?l(u):r(u)}}function cS(t){let r=(t||{}).singleTilde;const i={name:"strikethrough",tokenize:u,resolveAll:c};return r==null&&(r=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function c(f,m){let x=-1;for(;++x<f.length;)if(f[x][0]==="enter"&&f[x][1].type==="strikethroughSequenceTemporary"&&f[x][1]._close){let d=x;for(;d--;)if(f[d][0]==="exit"&&f[d][1].type==="strikethroughSequenceTemporary"&&f[d][1]._open&&f[x][1].end.offset-f[x][1].start.offset===f[d][1].end.offset-f[d][1].start.offset){f[x][1].type="strikethroughSequence",f[d][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},f[d][1].start),end:Object.assign({},f[x][1].end)},y={type:"strikethroughText",start:Object.assign({},f[d][1].end),end:Object.assign({},f[x][1].start)},b=[["enter",g,m],["enter",f[d][1],m],["exit",f[d][1],m],["enter",y,m]],v=m.parser.constructs.insideSpan.null;v&&Kn(b,b.length,0,Bc(v,f.slice(d+1,x),m)),Kn(b,b.length,0,[["exit",y,m],["enter",f[x][1],m],["exit",f[x][1],m],["exit",g,m]]),Kn(f,d-1,x-d+3,b),x=d+b.length-2;break}}for(x=-1;++x<f.length;)f[x][1].type==="strikethroughSequenceTemporary"&&(f[x][1].type="data");return f}function u(f,m,x){const d=this.previous,g=this.events;let y=0;return b;function b(j){return d===126&&g[g.length-1][1].type!=="characterEscape"?x(j):(f.enter("strikethroughSequenceTemporary"),v(j))}function v(j){const S=oi(d);if(j===126)return y>1?x(j):(f.consume(j),y++,v);if(y<2&&!r)return x(j);const E=f.exit("strikethroughSequenceTemporary"),C=oi(j);return E._open=!C||C===2&&!!S,E._close=!S||S===2&&!!C,m(j)}}}class uS{constructor(){this.map=[]}add(l,r,i){fS(this,l,r,i)}consume(l){if(this.map.sort(function(u,f){return u[0]-f[0]}),this.map.length===0)return;let r=this.map.length;const i=[];for(;r>0;)r-=1,i.push(l.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),l.length=this.map[r][0];i.push(l.slice()),l.length=0;let c=i.pop();for(;c;){for(const u of c)l.push(u);c=i.pop()}this.map.length=0}}function fS(t,l,r,i){let c=0;if(!(r===0&&i.length===0)){for(;c<t.map.length;){if(t.map[c][0]===l){t.map[c][1]+=r,t.map[c][2].push(...i);return}c+=1}t.map.push([l,r,i])}}function dS(t,l){let r=!1;const i=[];for(;l<t.length;){const c=t[l];if(r){if(c[0]==="enter")c[1].type==="tableContent"&&i.push(t[l+1][1].type==="tableDelimiterMarker"?"left":"none");else if(c[1].type==="tableContent"){if(t[l-1][1].type==="tableDelimiterMarker"){const u=i.length-1;i[u]=i[u]==="left"?"center":"right"}}else if(c[1].type==="tableDelimiterRow")break}else c[0]==="enter"&&c[1].type==="tableDelimiterRow"&&(r=!0);l+=1}return i}function hS(){return{flow:{null:{name:"table",tokenize:mS,resolveAll:xS}}}}function mS(t,l,r){const i=this;let c=0,u=0,f;return m;function m(D){let Y=i.events.length-1;for(;Y>-1;){const ee=i.events[Y][1].type;if(ee==="lineEnding"||ee==="linePrefix")Y--;else break}const R=Y>-1?i.events[Y][1].type:null,Q=R==="tableHead"||R==="tableRow"?O:x;return Q===O&&i.parser.lazy[i.now().line]?r(D):Q(D)}function x(D){return t.enter("tableHead"),t.enter("tableRow"),d(D)}function d(D){return D===124||(f=!0,u+=1),g(D)}function g(D){return D===null?r(D):Ie(D)?u>1?(u=0,i.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),v):r(D):at(D)?dt(t,g,"whitespace")(D):(u+=1,f&&(f=!1,c+=1),D===124?(t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),f=!0,g):(t.enter("data"),y(D)))}function y(D){return D===null||D===124||zt(D)?(t.exit("data"),g(D)):(t.consume(D),D===92?b:y)}function b(D){return D===92||D===124?(t.consume(D),y):y(D)}function v(D){return i.interrupt=!1,i.parser.lazy[i.now().line]?r(D):(t.enter("tableDelimiterRow"),f=!1,at(D)?dt(t,j,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):j(D))}function j(D){return D===45||D===58?E(D):D===124?(f=!0,t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),S):L(D)}function S(D){return at(D)?dt(t,E,"whitespace")(D):E(D)}function E(D){return D===58?(u+=1,f=!0,t.enter("tableDelimiterMarker"),t.consume(D),t.exit("tableDelimiterMarker"),C):D===45?(u+=1,C(D)):D===null||Ie(D)?F(D):L(D)}function C(D){return D===45?(t.enter("tableDelimiterFiller"),A(D)):L(D)}function A(D){return D===45?(t.consume(D),A):D===58?(f=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(D),t.exit("tableDelimiterMarker"),M):(t.exit("tableDelimiterFiller"),M(D))}function M(D){return at(D)?dt(t,F,"whitespace")(D):F(D)}function F(D){return D===124?j(D):D===null||Ie(D)?!f||c!==u?L(D):(t.exit("tableDelimiterRow"),t.exit("tableHead"),l(D)):L(D)}function L(D){return r(D)}function O(D){return t.enter("tableRow"),U(D)}function U(D){return D===124?(t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),U):D===null||Ie(D)?(t.exit("tableRow"),l(D)):at(D)?dt(t,U,"whitespace")(D):(t.enter("data"),X(D))}function X(D){return D===null||D===124||zt(D)?(t.exit("data"),U(D)):(t.consume(D),D===92?ne:X)}function ne(D){return D===92||D===124?(t.consume(D),X):X(D)}}function xS(t,l){let r=-1,i=!0,c=0,u=[0,0,0,0],f=[0,0,0,0],m=!1,x=0,d,g,y;const b=new uS;for(;++r<t.length;){const v=t[r],j=v[1];v[0]==="enter"?j.type==="tableHead"?(m=!1,x!==0&&(l0(b,l,x,d,g),g=void 0,x=0),d={type:"table",start:Object.assign({},j.start),end:Object.assign({},j.end)},b.add(r,0,[["enter",d,l]])):j.type==="tableRow"||j.type==="tableDelimiterRow"?(i=!0,y=void 0,u=[0,0,0,0],f=[0,r+1,0,0],m&&(m=!1,g={type:"tableBody",start:Object.assign({},j.start),end:Object.assign({},j.end)},b.add(r,0,[["enter",g,l]])),c=j.type==="tableDelimiterRow"?2:g?3:1):c&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")?(i=!1,f[2]===0&&(u[1]!==0&&(f[0]=f[1],y=ic(b,l,u,c,void 0,y),u=[0,0,0,0]),f[2]=r)):j.type==="tableCellDivider"&&(i?i=!1:(u[1]!==0&&(f[0]=f[1],y=ic(b,l,u,c,void 0,y)),u=f,f=[u[1],r,0,0])):j.type==="tableHead"?(m=!0,x=r):j.type==="tableRow"||j.type==="tableDelimiterRow"?(x=r,u[1]!==0?(f[0]=f[1],y=ic(b,l,u,c,r,y)):f[1]!==0&&(y=ic(b,l,f,c,r,y)),c=0):c&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")&&(f[3]=r)}for(x!==0&&l0(b,l,x,d,g),b.consume(l.events),r=-1;++r<l.events.length;){const v=l.events[r];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=dS(l.events,r))}return t}function ic(t,l,r,i,c,u){const f=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",m="tableContent";r[0]!==0&&(u.end=Object.assign({},ii(l.events,r[0])),t.add(r[0],0,[["exit",u,l]]));const x=ii(l.events,r[1]);if(u={type:f,start:Object.assign({},x),end:Object.assign({},x)},t.add(r[1],0,[["enter",u,l]]),r[2]!==0){const d=ii(l.events,r[2]),g=ii(l.events,r[3]),y={type:m,start:Object.assign({},d),end:Object.assign({},g)};if(t.add(r[2],0,[["enter",y,l]]),i!==2){const b=l.events[r[2]],v=l.events[r[3]];if(b[1].end=Object.assign({},v[1].end),b[1].type="chunkText",b[1].contentType="text",r[3]>r[2]+1){const j=r[2]+1,S=r[3]-r[2]-1;t.add(j,S,[])}}t.add(r[3]+1,0,[["exit",y,l]])}return c!==void 0&&(u.end=Object.assign({},ii(l.events,c)),t.add(c,0,[["exit",u,l]]),u=void 0),u}function l0(t,l,r,i,c){const u=[],f=ii(l.events,r);c&&(c.end=Object.assign({},f),u.push(["exit",c,l])),i.end=Object.assign({},f),u.push(["exit",i,l]),t.add(r+1,0,u)}function ii(t,l){const r=t[l],i=r[0]==="enter"?"start":"end";return r[1][i]}const pS={name:"tasklistCheck",tokenize:gS};function yS(){return{text:{91:pS}}}function gS(t,l,r){const i=this;return c;function c(x){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?r(x):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(x),t.exit("taskListCheckMarker"),u)}function u(x){return zt(x)?(t.enter("taskListCheckValueUnchecked"),t.consume(x),t.exit("taskListCheckValueUnchecked"),f):x===88||x===120?(t.enter("taskListCheckValueChecked"),t.consume(x),t.exit("taskListCheckValueChecked"),f):r(x)}function f(x){return x===93?(t.enter("taskListCheckMarker"),t.consume(x),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),m):r(x)}function m(x){return Ie(x)?l(x):at(x)?t.check({tokenize:bS},l,r)(x):r(x)}}function bS(t,l,r){return dt(t,i,"whitespace");function i(c){return c===null?r(c):l(c)}}function vS(t){return sy([X4(),tS(),cS(t),hS(),yS()])}const wS={};function Jy(t){const l=this,r=t||wS,i=l.data(),c=i.micromarkExtensions||(i.micromarkExtensions=[]),u=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),f=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);c.push(vS(r)),u.push(U4()),f.push(I4(r))}function Hs({content:t,className:l=""}){return o.jsx("div",{className:`office-markdown ${l}`,children:o.jsx(Ay,{remarkPlugins:[Jy],components:{code:kS,table:({children:r})=>o.jsx("div",{className:"overflow-x-auto my-2",children:o.jsx("table",{className:"office-table",children:r})})},children:t})})}function kS({className:t,children:l,...r}){const i=/language-(\w+)/.exec(t??"");return i||typeof l=="string"&&l.includes(`
|
|
79
|
-
`)?o.jsx(SS,{language:i==null?void 0:i[1],children:l}):o.jsx("code",{className:"bg-gray-100 text-gray-700 px-1 py-0.5 rounded text-[0.9em] font-mono",...r,children:l})}function SS({children:t,language:l}){const[r,i]=k.useState(!1),c=String(t).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(c),i(!0),setTimeout(()=>i(!1),1500)};return o.jsxs("div",{className:"office-code-block group relative my-2",children:[l&&o.jsx("div",{className:"text-[10px] text-gray-400 px-3 pt-1.5",children:l}),o.jsx("button",{onClick:u,className:"absolute top-1.5 right-2 text-[10px] text-gray-400 hover:text-gray-600 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:r?"Copied!":"Copy"}),o.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:o.jsx("code",{children:c})})]})}const r0={$skin:"skinColor",$hair:"hairColor",$shirt:"shirtColor",$pants:"pantsColor",$shoes:"shoeColor"},jS=/^(darken|lighten)\((\$\w+),\s*(\d+)\)$/;function CS(t,l){const r=parseInt(t.replace("#",""),16),i=Math.max(0,(r>>16&255)-l),c=Math.max(0,(r>>8&255)-l),u=Math.max(0,(r&255)-l);return`#${(i<<16|c<<8|u).toString(16).padStart(6,"0")}`}function ES(t,l){const r=parseInt(t.replace("#",""),16),i=Math.min(255,(r>>16&255)+l),c=Math.min(255,(r>>8&255)+l),u=Math.min(255,(r&255)+l);return`#${(i<<16|c<<8|u).toString(16).padStart(6,"0")}`}function Py(t,l){const r=r0[t];if(r&&l)return l[r];const i=jS.exec(t);if(i){const[,c,u,f]=i,m=r0[u],x=m&&l?l[m]:u,d=parseInt(f,10);return c==="darken"?CS(x,d):ES(x,d)}return t}function a0(t,l=12){return t.map(r=>({...r,x:l-r.x-r.w}))}function NS(t,l){return l==="down"?t.down:l==="up"&&t.up?t.up:l==="left"&&t.left?t.left:l==="right"&&t.right?t.right:l==="right"&&t.left?{name:t.left.name,pixels:a0(t.left.pixels)}:l==="left"&&t.right?{name:t.right.name,pixels:a0(t.right.pixels)}:t.down}function AS(t,l){return Kd(t,"hair",l,1)}function Kd(t,l,r,i){const c=t.layers.findIndex(f=>f.name===l),u=[...t.layers];if(c>=0)u[c]={...r,name:l};else{const f=i??u.length;u.splice(f,0,{...r,name:l})}return{...t,layers:u}}const vh=new Map,wh=new Map;function eg(t,l){vh.set(t,l)}function Uc(t,l){wh.set(t,l)}function Qd(t){return vh.get(t)}function TS(t){return wh.get(t)}function vN(){return Array.from(vh.keys())}function wN(){return Array.from(wh.keys())}function DS(t,l,r,i,c=2){t.clearRect(0,0,l.width*c,l.height*c);for(const u of l.layers)tg(t,u.pixels,c,r,i)}function Wd(t,l,r,i,c){for(const u of l){const f=Py(u.c,c);u.a!==void 0&&u.a!==1&&(t.globalAlpha=u.a),t.fillStyle=f,t.fillRect(r+u.x,i+u.y,u.w,u.h),u.a!==void 0&&u.a!==1&&(t.globalAlpha=1)}}function zS(t,l){const r=l.scale;t.clearRect(0,0,l.canvasWidth,l.canvasHeight),tg(t,l.pixels,r,0)}function tg(t,l,r,i,c){for(const u of l){const f=Py(u.c,c);u.a!==void 0&&u.a!==1&&(t.globalAlpha=u.a),t.fillStyle=f,t.fillRect(u.x*r,(u.y+i)*r,u.w*r,u.h*r),u.a!==void 0&&u.a!==1&&(t.globalAlpha=1)}}const Tc=new Map;function Yr(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Tc.set(t,{id:t,name:l,layer:{...c.down,name:"hair"},directions:{down:{...c.down,name:"hair"},up:c.up?{...c.up,name:"hair"}:void 0,left:c.left?{...c.left,name:"hair"}:void 0,right:c.right?{...c.right,name:"hair"}:void 0}})}else{const c=r;Tc.set(t,{id:t,name:l,layer:{...c,name:"hair"}})}}function MS(t){return Tc.get(t)}function ng(){return Array.from(Tc.values())}Yr("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}]}});Yr("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}]}});Yr("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}]}});Yr("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}]}});Yr("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"}]}});Yr("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}]}});Yr("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}]}});Yr("curly","Curly",{down:{name:"hair",pixels:[{x:0,y:0,w:12,h:4,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:11,y:1,w:2,h:5,c:"$hair"},{x:2,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:6,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:4,y:2,w:2,h:1,c:"lighten($hair, 15)",a:.3},{x:8,y:2,w:2,h:1,c:"lighten($hair, 15)",a:.3}]},up:{name:"hair",pixels:[{x:0,y:0,w:12,h:4,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:11,y:1,w:2,h:5,c:"$hair"},{x:1,y:2,w:10,h:4,c:"$hair"},{x:3,y:1,w:2,h:1,c:"lighten($hair, 15)",a:.3},{x:7,y:1,w:2,h:1,c:"lighten($hair, 15)",a:.3}]},left:{name:"hair",pixels:[{x:0,y:0,w:10,h:4,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:2,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:5,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:3,y:2,w:2,h:1,c:"lighten($hair, 15)",a:.3}]}});const Dc=new Map;function Al(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Dc.set(t,{id:t,name:l,layer:{...c.down,name:"torso"},directions:{down:{...c.down,name:"torso"},up:c.up?{...c.up,name:"torso"}:void 0,left:c.left?{...c.left,name:"torso"}:void 0,right:c.right?{...c.right,name:"torso"}:void 0}})}else{const c=r;Dc.set(t,{id:t,name:l,layer:{...c,name:"torso"}})}}function FS(t){return Dc.get(t)}function lg(){return Array.from(Dc.values())}Al("tshirt","T-Shirt",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:5,y:10,w:2,h:3,c:"darken($shirt, 10)",a:.15},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:2,y:10,w:7,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Al("suit","Suit",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 12)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:10,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:2,y:10,w:3,h:3,c:"darken($shirt, 20)",a:.3},{x:7,y:10,w:3,h:3,c:"darken($shirt, 20)",a:.3},{x:5,y:10,w:2,h:5,c:"#E8E8E8",a:.5},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:11,w:2,h:1,c:"darken($shirt, 20)",a:.2},{x:11,y:11,w:2,h:1,c:"darken($shirt, 20)",a:.2},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:10,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:5,y:12,w:2,h:4,c:"darken($shirt, 10)",a:.15},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 30)",a:.3},{x:2,y:10,w:3,h:3,c:"darken($shirt, 20)",a:.3},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:11,w:3,h:1,c:"darken($shirt, 20)",a:.2},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Al("hoodie","Hoodie",{down:{name:"torso",pixels:[{x:0,y:10,w:12,h:6,c:"$shirt"},{x:1,y:10,w:10,h:1,c:"lighten($shirt, 15)",a:.25},{x:0,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:2,y:8,w:8,h:2,c:"$shirt",a:.4},{x:3,y:13,w:6,h:2,c:"darken($shirt, 15)",a:.2},{x:5,y:10,w:1,h:2,c:"#DDD",a:.3},{x:6,y:10,w:1,h:2,c:"#DDD",a:.3},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:0,y:10,w:12,h:6,c:"$shirt"},{x:0,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:2,y:7,w:8,h:3,c:"$shirt",a:.5},{x:3,y:7,w:6,h:1,c:"darken($shirt, 10)",a:.3},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:0,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:8,h:1,c:"lighten($shirt, 15)",a:.25},{x:0,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.3},{x:2,y:8,w:6,h:2,c:"$shirt",a:.4},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Al("vest","Vest",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:5,y:10,w:2,h:2,c:"$skin",a:.6},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:-1,y:11,w:3,h:5,c:"$skin"},{x:-1,y:15,w:3,h:1,c:"darken($skin, 10)"}]}});Al("tank","Tank Top",{down:{name:"torso",pixels:[{x:2,y:10,w:8,h:6,c:"$shirt"},{x:3,y:10,w:6,h:1,c:"lighten($shirt, 18)",a:.3},{x:2,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:9,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:0,y:10,w:2,h:2,c:"$skin"},{x:10,y:10,w:2,h:2,c:"$skin"},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},up:{name:"torso",pixels:[{x:2,y:10,w:8,h:6,c:"$shirt"},{x:2,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:9,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:0,y:10,w:2,h:2,c:"$skin"},{x:10,y:10,w:2,h:2,c:"$skin"},{x:-1,y:11,w:2,h:5,c:"$skin"},{x:11,y:11,w:2,h:5,c:"$skin"},{x:-1,y:15,w:2,h:1,c:"darken($skin, 10)"},{x:11,y:15,w:2,h:1,c:"darken($skin, 10)"}]},left:{name:"torso",pixels:[{x:2,y:10,w:7,h:6,c:"$shirt"},{x:2,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:0,y:10,w:2,h:2,c:"$skin"},{x:-1,y:11,w:3,h:5,c:"$skin"},{x:-1,y:15,w:3,h:1,c:"darken($skin, 10)"}]}});Al("polo","Polo",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:9,w:6,h:2,c:"lighten($shirt, 25)",a:.5},{x:5,y:9,w:2,h:1,c:"$skin",a:.4},{x:5,y:10,w:2,h:3,c:"darken($shirt, 15)",a:.15},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:9,w:6,h:1,c:"lighten($shirt, 25)",a:.5},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:9,w:4,h:2,c:"lighten($shirt, 25)",a:.5},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Al("labcoat","Lab Coat",{down:{name:"torso",pixels:[{x:4,y:10,w:4,h:5,c:"$shirt"},{x:0,y:10,w:4,h:7,c:"#F0F0F0"},{x:8,y:10,w:4,h:7,c:"#F0F0F0"},{x:1,y:10,w:10,h:1,c:"#FAFAFA"},{x:0,y:10,w:1,h:7,c:"#DDD",a:.5},{x:11,y:10,w:1,h:7,c:"#DDD",a:.5},{x:1,y:13,w:2,h:2,c:"#E0E0E0",a:.4},{x:9,y:13,w:2,h:2,c:"#E0E0E0",a:.4},{x:-1,y:11,w:2,h:5,c:"#F0F0F0"},{x:11,y:11,w:2,h:5,c:"#F0F0F0"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:0,y:10,w:12,h:7,c:"#F0F0F0"},{x:0,y:10,w:1,h:7,c:"#DDD",a:.5},{x:11,y:10,w:1,h:7,c:"#DDD",a:.5},{x:5,y:11,w:2,h:5,c:"#E8E8E8",a:.3},{x:-1,y:11,w:2,h:5,c:"#F0F0F0"},{x:11,y:11,w:2,h:5,c:"#F0F0F0"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:3,y:10,w:3,h:5,c:"$shirt"},{x:0,y:10,w:3,h:7,c:"#F0F0F0"},{x:6,y:10,w:4,h:7,c:"#F0F0F0"},{x:1,y:10,w:8,h:1,c:"#FAFAFA"},{x:0,y:10,w:1,h:7,c:"#DDD",a:.5},{x:1,y:13,w:2,h:2,c:"#E0E0E0",a:.4},{x:-1,y:11,w:3,h:5,c:"#F0F0F0"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Al("overalls","Overalls",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:3,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:3,y:11,w:6,h:5,c:"#3D6B99"},{x:3,y:10,w:2,h:1,c:"#3D6B99"},{x:7,y:10,w:2,h:1,c:"#3D6B99"},{x:3,y:11,w:1,h:1,c:"#FFD700",a:.6},{x:8,y:11,w:1,h:1,c:"#FFD700",a:.6},{x:1,y:13,w:2,h:3,c:"#3D6B99"},{x:9,y:13,w:2,h:3,c:"#3D6B99"},{x:5,y:13,w:2,h:2,c:"#345E87",a:.4},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:3,c:"$shirt"},{x:3,y:10,w:2,h:1,c:"#3D6B99"},{x:7,y:10,w:2,h:1,c:"#3D6B99"},{x:1,y:13,w:10,h:3,c:"#3D6B99"},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:3,c:"$shirt"},{x:3,y:11,w:5,h:5,c:"#3D6B99"},{x:3,y:10,w:2,h:1,c:"#3D6B99"},{x:3,y:11,w:1,h:1,c:"#FFD700",a:.6},{x:1,y:13,w:2,h:3,c:"#3D6B99"},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Al("turtleneck","Turtleneck",{down:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:8,w:6,h:2,c:"$shirt"},{x:4,y:8,w:4,h:1,c:"lighten($shirt, 12)",a:.3},{x:3,y:9,w:1,h:1,c:"darken($shirt, 15)",a:.2},{x:8,y:9,w:1,h:1,c:"darken($shirt, 15)",a:.2},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:8,w:6,h:2,c:"$shirt"},{x:4,y:8,w:4,h:1,c:"lighten($shirt, 12)",a:.3},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:1,y:10,w:9,h:6,c:"$shirt"},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:3,y:8,w:4,h:2,c:"$shirt"},{x:3,y:8,w:3,h:1,c:"lighten($shirt, 12)",a:.3},{x:-1,y:11,w:3,h:5,c:"$shirt"},{x:-1,y:15,w:3,h:1,c:"$skin"}]}});Al("robe","Robe",{down:{name:"torso",pixels:[{x:0,y:10,w:12,h:7,c:"$shirt"},{x:0,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:3,y:10,w:3,h:4,c:"lighten($shirt, 15)",a:.25},{x:6,y:10,w:3,h:4,c:"darken($shirt, 10)",a:.2},{x:1,y:14,w:10,h:1,c:"darken($shirt, 35)"},{x:2,y:14,w:8,h:1,c:"darken($shirt, 25)",a:.4},{x:-2,y:11,w:3,h:5,c:"$shirt"},{x:11,y:11,w:3,h:5,c:"$shirt"},{x:-2,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:11,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:0,y:10,w:12,h:7,c:"$shirt"},{x:0,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:1,y:14,w:10,h:1,c:"darken($shirt, 35)"},{x:-2,y:11,w:3,h:5,c:"$shirt"},{x:11,y:11,w:3,h:5,c:"$shirt"},{x:-2,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:11,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:0,y:10,w:10,h:7,c:"$shirt"},{x:0,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:1,y:14,w:8,h:1,c:"darken($shirt, 35)"},{x:-2,y:11,w:4,h:5,c:"$shirt"},{x:-2,y:15,w:4,h:1,c:"darken($shirt, 15)",a:.3},{x:-1,y:15,w:2,h:1,c:"$skin"}]}});const Fs=new Map;function vt(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Fs.set(t,{id:t,name:l,layer:{...c.down,name:"accessory"},directions:{down:{...c.down,name:"accessory"},up:c.up?{...c.up,name:"accessory"}:void 0,left:c.left?{...c.left,name:"accessory"}:void 0,right:c.right?{...c.right,name:"accessory"}:void 0}})}else{const c=r;Fs.set(t,{id:t,name:l,layer:{...c,name:"accessory"}})}}function RS(t){return Fs.get(t)}function _S(t,l){const r=Fs.get(t);if(!r)return;if(r.directions)return NS(r.directions,l);if(l==="down")return r.layer;const i=r.layer.pixels.filter(u=>u.y<2);if(i.length===0)return;const c=l==="right"?1:l==="left"?-1:0;return{name:r.layer.name,pixels:c?i.map(u=>({...u,x:u.x+c})):i}}function rg(){return Array.from(Fs.values())}vt("none","None",{name:"accessory",pixels:[]});vt("glasses","Glasses",{down:{name:"accessory",pixels:[{x:2,y:4,w:3,h:2,c:"#2A3A50",a:.5},{x:7,y:4,w:3,h:2,c:"#2A3A50",a:.5},{x:5,y:4,w:2,h:1,c:"#2A3A50",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:3,w:2,h:1,c:"#2A3A50",a:.4},{x:10,y:3,w:2,h:1,c:"#2A3A50",a:.4}]},left:{name:"accessory",pixels:[{x:2,y:4,w:3,h:2,c:"#2A3A50",a:.5},{x:5,y:4,w:6,h:1,c:"#2A3A50",a:.3}]}});vt("round-glasses","Round Glasses",{down:{name:"accessory",pixels:[{x:2,y:3,w:3,h:3,c:"#8B7355",a:.4},{x:7,y:3,w:3,h:3,c:"#8B7355",a:.4},{x:3,y:4,w:1,h:1,c:"#B0E0FF",a:.15},{x:8,y:4,w:1,h:1,c:"#B0E0FF",a:.15},{x:5,y:4,w:2,h:1,c:"#8B7355",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:3,w:2,h:1,c:"#8B7355",a:.3},{x:10,y:3,w:2,h:1,c:"#8B7355",a:.3}]},left:{name:"accessory",pixels:[{x:2,y:3,w:3,h:3,c:"#8B7355",a:.4},{x:3,y:4,w:1,h:1,c:"#B0E0FF",a:.15},{x:5,y:4,w:6,h:1,c:"#8B7355",a:.25}]}});vt("sunglasses","Sunglasses",{down:{name:"accessory",pixels:[{x:2,y:4,w:3,h:2,c:"#1A1A2E",a:.7},{x:7,y:4,w:3,h:2,c:"#1A1A2E",a:.7},{x:5,y:4,w:2,h:1,c:"#1A1A2E",a:.4},{x:3,y:4,w:1,h:1,c:"#334",a:.3},{x:8,y:4,w:1,h:1,c:"#334",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:3,w:2,h:1,c:"#1A1A2E",a:.4},{x:10,y:3,w:2,h:1,c:"#1A1A2E",a:.4}]},left:{name:"accessory",pixels:[{x:2,y:4,w:3,h:2,c:"#1A1A2E",a:.7},{x:3,y:4,w:1,h:1,c:"#334",a:.3},{x:5,y:4,w:6,h:1,c:"#1A1A2E",a:.35}]}});vt("headphones","Headphones",{down:{name:"accessory",pixels:[{x:0,y:0,w:12,h:1,c:"#333",a:.7},{x:-1,y:1,w:2,h:5,c:"#444"},{x:11,y:1,w:2,h:5,c:"#444"},{x:-1,y:2,w:2,h:3,c:"#555",a:.3},{x:11,y:2,w:2,h:3,c:"#555",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:0,w:12,h:1,c:"#333",a:.7},{x:-1,y:1,w:2,h:5,c:"#444"},{x:11,y:1,w:2,h:5,c:"#444"},{x:-1,y:2,w:2,h:3,c:"#555",a:.3},{x:11,y:2,w:2,h:3,c:"#555",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:0,w:10,h:1,c:"#333",a:.7},{x:-1,y:1,w:3,h:5,c:"#444"},{x:-1,y:2,w:3,h:3,c:"#555",a:.3}]}});vt("beret","Beret",{down:{name:"accessory",pixels:[{x:2,y:-1,w:8,h:2,c:"#E91E63"},{x:1,y:0,w:2,h:1,c:"#E91E63",a:.6},{x:4,y:-1,w:4,h:1,c:"#F06292",a:.3}]},up:{name:"accessory",pixels:[{x:2,y:-1,w:8,h:2,c:"#E91E63"},{x:9,y:0,w:2,h:1,c:"#E91E63",a:.6}]},left:{name:"accessory",pixels:[{x:0,y:-1,w:8,h:2,c:"#E91E63"},{x:2,y:-1,w:4,h:1,c:"#F06292",a:.3}]}});vt("cap","Cap",{down:{name:"accessory",pixels:[{x:1,y:-1,w:10,h:2,c:"#1565C0"},{x:0,y:1,w:12,h:1,c:"#0D47A1"},{x:3,y:-1,w:6,h:1,c:"#1E88E5",a:.3}]},up:{name:"accessory",pixels:[{x:1,y:-1,w:10,h:2,c:"#1565C0"},{x:3,y:-1,w:6,h:1,c:"#1E88E5",a:.3},{x:5,y:1,w:2,h:1,c:"#0D47A1",a:.5}]},left:{name:"accessory",pixels:[{x:0,y:-1,w:9,h:2,c:"#1565C0"},{x:-2,y:1,w:6,h:1,c:"#0D47A1"},{x:2,y:-1,w:5,h:1,c:"#1E88E5",a:.3}]}});vt("badge","Badge",{down:{name:"accessory",pixels:[{x:5,y:8,w:2,h:3,c:"#2196F3",a:.4},{x:4,y:11,w:4,h:3,c:"#FFF",a:.5},{x:5,y:12,w:2,h:1,c:"#333",a:.3}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:3,y:8,w:1,h:3,c:"#2196F3",a:.4},{x:2,y:11,w:3,h:3,c:"#FFF",a:.5}]}});vt("lapels","Lapels",{down:{name:"accessory",pixels:[{x:1,y:10,w:3,h:2,c:"#1A1A2E",a:.4},{x:8,y:10,w:3,h:2,c:"#1A1A2E",a:.4}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:1,y:10,w:3,h:2,c:"#1A1A2E",a:.4}]}});vt("blush","Blush",{down:{name:"accessory",pixels:[{x:2,y:6,w:1,h:1,c:"#FFCDD2",a:.3},{x:9,y:6,w:1,h:1,c:"#FFCDD2",a:.3}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:2,y:6,w:1,h:1,c:"#FFCDD2",a:.3}]}});vt("scarf","Scarf",{down:{name:"accessory",pixels:[{x:2,y:9,w:8,h:2,c:"#E53935",a:.6},{x:3,y:9,w:6,h:1,c:"#EF5350",a:.3},{x:3,y:11,w:2,h:3,c:"#E53935",a:.5}]},up:{name:"accessory",pixels:[{x:2,y:9,w:8,h:2,c:"#E53935",a:.6},{x:3,y:9,w:6,h:1,c:"#EF5350",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:9,w:8,h:2,c:"#E53935",a:.6},{x:2,y:9,w:5,h:1,c:"#EF5350",a:.3},{x:1,y:11,w:2,h:3,c:"#E53935",a:.5}]}});vt("tie","Tie",{down:{name:"accessory",pixels:[{x:5,y:9,w:2,h:1,c:"#B71C1C"},{x:5,y:10,w:2,h:4,c:"#D32F2F"},{x:5,y:10,w:1,h:4,c:"#E53935",a:.3},{x:5,y:14,w:2,h:1,c:"#B71C1C",a:.8}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:4,y:9,w:2,h:1,c:"#B71C1C"},{x:4,y:10,w:2,h:4,c:"#D32F2F"},{x:4,y:14,w:2,h:1,c:"#B71C1C",a:.8}]}});vt("bowtie","Bowtie",{down:{name:"accessory",pixels:[{x:3,y:9,w:2,h:1,c:"#D32F2F"},{x:7,y:9,w:2,h:1,c:"#D32F2F"},{x:5,y:9,w:2,h:1,c:"#B71C1C"},{x:4,y:9,w:1,h:1,c:"#E53935",a:.3},{x:7,y:9,w:1,h:1,c:"#E53935",a:.3}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:3,y:9,w:3,h:1,c:"#D32F2F"},{x:4,y:9,w:1,h:1,c:"#B71C1C"}]}});vt("cat-ears","Cat Ears",{down:{name:"accessory",pixels:[{x:1,y:-3,w:2,h:1,c:"#555"},{x:0,y:-2,w:3,h:1,c:"#555"},{x:0,y:-1,w:3,h:1,c:"#555"},{x:1,y:-2,w:1,h:1,c:"#FFB0C0",a:.6},{x:9,y:-3,w:2,h:1,c:"#555"},{x:9,y:-2,w:3,h:1,c:"#555"},{x:9,y:-1,w:3,h:1,c:"#555"},{x:10,y:-2,w:1,h:1,c:"#FFB0C0",a:.6}]},up:{name:"accessory",pixels:[{x:1,y:-3,w:2,h:1,c:"#555"},{x:0,y:-2,w:3,h:1,c:"#555"},{x:0,y:-1,w:3,h:1,c:"#555"},{x:9,y:-3,w:2,h:1,c:"#555"},{x:9,y:-2,w:3,h:1,c:"#555"},{x:9,y:-1,w:3,h:1,c:"#555"}]},left:{name:"accessory",pixels:[{x:2,y:-3,w:2,h:1,c:"#555"},{x:1,y:-2,w:3,h:1,c:"#555"},{x:1,y:-1,w:3,h:1,c:"#555"},{x:2,y:-2,w:1,h:1,c:"#FFB0C0",a:.6}]}});vt("bear-ears","Bear Ears",{down:{name:"accessory",pixels:[{x:0,y:-2,w:3,h:2,c:"#8B6914"},{x:1,y:-1,w:1,h:1,c:"#C4A24A",a:.5},{x:9,y:-2,w:3,h:2,c:"#8B6914"},{x:10,y:-1,w:1,h:1,c:"#C4A24A",a:.5}]},up:{name:"accessory",pixels:[{x:0,y:-2,w:3,h:2,c:"#8B6914"},{x:9,y:-2,w:3,h:2,c:"#8B6914"}]},left:{name:"accessory",pixels:[{x:1,y:-2,w:3,h:2,c:"#8B6914"},{x:2,y:-1,w:1,h:1,c:"#C4A24A",a:.5}]}});vt("bunny-ears","Bunny Ears",{down:{name:"accessory",pixels:[{x:2,y:-5,w:2,h:4,c:"#F5F5F5"},{x:2,y:-4,w:1,h:2,c:"#FFB0C0",a:.5},{x:8,y:-5,w:2,h:4,c:"#F5F5F5"},{x:9,y:-4,w:1,h:2,c:"#FFB0C0",a:.5},{x:9,y:-6,w:2,h:1,c:"#F5F5F5"}]},up:{name:"accessory",pixels:[{x:2,y:-5,w:2,h:4,c:"#F5F5F5"},{x:8,y:-5,w:2,h:4,c:"#F5F5F5"},{x:9,y:-6,w:2,h:1,c:"#F5F5F5"}]},left:{name:"accessory",pixels:[{x:3,y:-5,w:2,h:4,c:"#F5F5F5"},{x:3,y:-4,w:1,h:2,c:"#FFB0C0",a:.5},{x:4,y:-6,w:2,h:1,c:"#F5F5F5"}]}});vt("dog-nose","Dog Nose",{down:{name:"accessory",pixels:[{x:4,y:5,w:4,h:3,c:"#D2B48C",a:.5},{x:5,y:5,w:2,h:1,c:"#222"},{x:6,y:7,w:1,h:1,c:"#FF6B8A",a:.7}]},up:{name:"accessory",pixels:[]},left:{name:"accessory",pixels:[{x:0,y:5,w:4,h:2,c:"#D2B48C",a:.5},{x:0,y:5,w:2,h:1,c:"#222"},{x:1,y:7,w:1,h:1,c:"#FF6B8A",a:.7}]}});vt("fox-mask","Fox Mask",{down:{name:"accessory",pixels:[{x:0,y:-3,w:2,h:1,c:"#E65100"},{x:-1,y:-2,w:3,h:1,c:"#E65100"},{x:0,y:-1,w:3,h:1,c:"#E65100"},{x:10,y:-3,w:2,h:1,c:"#E65100"},{x:10,y:-2,w:3,h:1,c:"#E65100"},{x:9,y:-1,w:3,h:1,c:"#E65100"},{x:0,y:-2,w:1,h:1,c:"#FFF",a:.4},{x:11,y:-2,w:1,h:1,c:"#FFF",a:.4},{x:1,y:5,w:2,h:2,c:"#FFF",a:.25},{x:9,y:5,w:2,h:2,c:"#FFF",a:.25},{x:5,y:6,w:2,h:1,c:"#222",a:.6}]},up:{name:"accessory",pixels:[{x:0,y:-3,w:2,h:1,c:"#E65100"},{x:-1,y:-2,w:3,h:1,c:"#E65100"},{x:0,y:-1,w:3,h:1,c:"#E65100"},{x:10,y:-3,w:2,h:1,c:"#E65100"},{x:10,y:-2,w:3,h:1,c:"#E65100"},{x:9,y:-1,w:3,h:1,c:"#E65100"}]},left:{name:"accessory",pixels:[{x:1,y:-3,w:2,h:1,c:"#E65100"},{x:0,y:-2,w:3,h:1,c:"#E65100"},{x:1,y:-1,w:3,h:1,c:"#E65100"},{x:1,y:-2,w:1,h:1,c:"#FFF",a:.4},{x:1,y:5,w:2,h:2,c:"#FFF",a:.25},{x:1,y:6,w:2,h:1,c:"#222",a:.6}]}});vt("crown","Crown",{down:{name:"accessory",pixels:[{x:2,y:-1,w:8,h:2,c:"#FFD700"},{x:3,y:-3,w:2,h:2,c:"#FFD700"},{x:5,y:-2,w:2,h:1,c:"#FFD700"},{x:7,y:-3,w:2,h:2,c:"#FFD700"},{x:4,y:-2,w:1,h:1,c:"#E53935",a:.8},{x:6,y:-1,w:1,h:1,c:"#42A5F5",a:.8},{x:8,y:-2,w:1,h:1,c:"#66BB6A",a:.8},{x:3,y:-1,w:6,h:1,c:"#FFF",a:.15}]},up:{name:"accessory",pixels:[{x:2,y:-1,w:8,h:2,c:"#FFD700"},{x:3,y:-3,w:2,h:2,c:"#FFD700"},{x:5,y:-2,w:2,h:1,c:"#FFD700"},{x:7,y:-3,w:2,h:2,c:"#FFD700"},{x:3,y:-1,w:6,h:1,c:"#FFF",a:.15}]},left:{name:"accessory",pixels:[{x:1,y:-1,w:7,h:2,c:"#FFD700"},{x:2,y:-3,w:2,h:2,c:"#FFD700"},{x:5,y:-2,w:2,h:1,c:"#FFD700"},{x:3,y:-2,w:1,h:1,c:"#E53935",a:.8},{x:5,y:-1,w:1,h:1,c:"#42A5F5",a:.8},{x:2,y:-1,w:5,h:1,c:"#FFF",a:.15}]}});vt("halo","Halo",{down:{name:"accessory",pixels:[{x:2,y:-3,w:8,h:1,c:"#FFE082",a:.7},{x:1,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:10,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:3,y:-4,w:6,h:1,c:"#FFF9C4",a:.4},{x:3,y:-3,w:6,h:1,c:"#FFF",a:.15}]},up:{name:"accessory",pixels:[{x:2,y:-3,w:8,h:1,c:"#FFE082",a:.7},{x:1,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:10,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:3,y:-4,w:6,h:1,c:"#FFF9C4",a:.4},{x:3,y:-3,w:6,h:1,c:"#FFF",a:.15}]},left:{name:"accessory",pixels:[{x:1,y:-3,w:7,h:1,c:"#FFE082",a:.7},{x:0,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:8,y:-2,w:1,h:1,c:"#FFE082",a:.5},{x:2,y:-4,w:5,h:1,c:"#FFF9C4",a:.4},{x:2,y:-3,w:5,h:1,c:"#FFF",a:.15}]}});vt("horns","Horns",{down:{name:"accessory",pixels:[{x:1,y:-1,w:2,h:2,c:"#8B0000"},{x:0,y:-3,w:2,h:2,c:"#A00"},{x:0,y:-4,w:1,h:1,c:"#C62828"},{x:9,y:-1,w:2,h:2,c:"#8B0000"},{x:10,y:-3,w:2,h:2,c:"#A00"},{x:11,y:-4,w:1,h:1,c:"#C62828"}]},up:{name:"accessory",pixels:[{x:1,y:-1,w:2,h:2,c:"#8B0000"},{x:0,y:-3,w:2,h:2,c:"#A00"},{x:0,y:-4,w:1,h:1,c:"#C62828"},{x:9,y:-1,w:2,h:2,c:"#8B0000"},{x:10,y:-3,w:2,h:2,c:"#A00"},{x:11,y:-4,w:1,h:1,c:"#C62828"}]},left:{name:"accessory",pixels:[{x:2,y:-1,w:2,h:2,c:"#8B0000"},{x:1,y:-3,w:2,h:2,c:"#A00"},{x:1,y:-4,w:1,h:1,c:"#C62828"}]}});vt("mask","Mask",{down:{name:"accessory",pixels:[{x:1,y:3,w:10,h:3,c:"#1A1A2E",a:.75},{x:3,y:4,w:2,h:1,c:"#000",a:0},{x:7,y:4,w:2,h:1,c:"#000",a:0},{x:1,y:3,w:10,h:1,c:"#FFD700",a:.3},{x:1,y:5,w:10,h:1,c:"#FFD700",a:.2}]},up:{name:"accessory",pixels:[{x:0,y:4,w:12,h:1,c:"#1A1A2E",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:3,w:6,h:3,c:"#1A1A2E",a:.75},{x:2,y:4,w:2,h:1,c:"#000",a:0},{x:1,y:3,w:6,h:1,c:"#FFD700",a:.3},{x:1,y:5,w:6,h:1,c:"#FFD700",a:.2}]}});vt("bandana","Bandana",{down:{name:"accessory",pixels:[{x:0,y:1,w:12,h:2,c:"#E53935"},{x:1,y:1,w:10,h:1,c:"#EF5350",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:1,w:12,h:2,c:"#E53935"},{x:1,y:1,w:10,h:1,c:"#EF5350",a:.3},{x:11,y:2,w:2,h:2,c:"#E53935",a:.7},{x:12,y:3,w:1,h:1,c:"#C62828",a:.5}]},left:{name:"accessory",pixels:[{x:0,y:1,w:10,h:2,c:"#E53935"},{x:1,y:1,w:8,h:1,c:"#EF5350",a:.3}]}});vt("eyepatch","Eye Patch",{down:{name:"accessory",pixels:[{x:0,y:3,w:12,h:1,c:"#222",a:.5},{x:2,y:3,w:3,h:3,c:"#1A1A1A"},{x:3,y:4,w:1,h:1,c:"#333",a:.3}]},up:{name:"accessory",pixels:[{x:0,y:3,w:12,h:1,c:"#222",a:.5}]},left:{name:"accessory",pixels:[{x:0,y:3,w:10,h:1,c:"#222",a:.5},{x:1,y:3,w:3,h:3,c:"#1A1A1A"},{x:2,y:4,w:1,h:1,c:"#333",a:.3}]}});vt("cat-face","Cat Face",{down:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#555"},{x:2,y:0,w:8,h:1,c:"#555"},{x:0,y:-2,w:3,h:2,c:"#555"},{x:1,y:-3,w:2,h:1,c:"#555"},{x:9,y:-2,w:3,h:2,c:"#555"},{x:9,y:-3,w:2,h:1,c:"#555"},{x:1,y:-1,w:1,h:1,c:"#FFB0C0",a:.7},{x:10,y:-1,w:1,h:1,c:"#FFB0C0",a:.7},{x:2,y:3,w:3,h:3,c:"#222"},{x:7,y:3,w:3,h:3,c:"#222"},{x:3,y:3,w:1,h:2,c:"#4FC3F7",a:.8},{x:8,y:3,w:1,h:2,c:"#4FC3F7",a:.8},{x:3,y:4,w:1,h:1,c:"#111"},{x:8,y:4,w:1,h:1,c:"#111"},{x:5,y:5,w:2,h:1,c:"#FFB0C0"},{x:4,y:6,w:1,h:1,c:"#444",a:.6},{x:7,y:6,w:1,h:1,c:"#444",a:.6},{x:0,y:5,w:2,h:1,c:"#888",a:.4},{x:10,y:5,w:2,h:1,c:"#888",a:.4},{x:0,y:6,w:2,h:1,c:"#888",a:.3},{x:10,y:6,w:2,h:1,c:"#888",a:.3}]},up:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#555"},{x:2,y:0,w:8,h:1,c:"#555"},{x:0,y:-2,w:3,h:2,c:"#555"},{x:1,y:-3,w:2,h:1,c:"#555"},{x:9,y:-2,w:3,h:2,c:"#555"},{x:9,y:-3,w:2,h:1,c:"#555"},{x:5,y:1,w:2,h:5,c:"#4A4A4A",a:.3},{x:9,y:8,w:2,h:2,c:"#555"},{x:10,y:7,w:1,h:1,c:"#555"}]},left:{name:"accessory",pixels:[{x:1,y:1,w:9,h:8,c:"#555"},{x:2,y:0,w:7,h:1,c:"#555"},{x:2,y:-2,w:3,h:2,c:"#555"},{x:3,y:-3,w:2,h:1,c:"#555"},{x:3,y:-1,w:1,h:1,c:"#FFB0C0",a:.7},{x:2,y:3,w:3,h:3,c:"#222"},{x:3,y:3,w:1,h:2,c:"#4FC3F7",a:.8},{x:3,y:4,w:1,h:1,c:"#111"},{x:0,y:5,w:3,h:2,c:"#555"},{x:0,y:5,w:2,h:1,c:"#FFB0C0"},{x:-1,y:5,w:2,h:1,c:"#888",a:.4},{x:-1,y:6,w:2,h:1,c:"#888",a:.3}]}});vt("bear-face","Bear Face",{down:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#8B6914"},{x:2,y:-1,w:8,h:1,c:"#8B6914"},{x:0,y:-1,w:3,h:3,c:"#8B6914"},{x:9,y:-1,w:3,h:3,c:"#8B6914"},{x:1,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:10,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:3,y:5,w:6,h:4,c:"#C4A24A",a:.7},{x:3,y:3,w:2,h:2,c:"#111"},{x:7,y:3,w:2,h:2,c:"#111"},{x:3,y:3,w:1,h:1,c:"#FFF",a:.3},{x:7,y:3,w:1,h:1,c:"#FFF",a:.3},{x:5,y:5,w:2,h:1,c:"#222"},{x:5,y:7,w:2,h:1,c:"#6B4F10",a:.5}]},up:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#8B6914"},{x:2,y:-1,w:8,h:1,c:"#8B6914"},{x:0,y:-1,w:3,h:3,c:"#8B6914"},{x:9,y:-1,w:3,h:3,c:"#8B6914"},{x:1,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:10,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:5,y:1,w:2,h:5,c:"#7A5B10",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:0,w:9,h:9,c:"#8B6914"},{x:2,y:-1,w:7,h:1,c:"#8B6914"},{x:0,y:-1,w:3,h:3,c:"#8B6914"},{x:0,y:0,w:1,h:1,c:"#C4A24A",a:.6},{x:0,y:4,w:3,h:4,c:"#C4A24A",a:.7},{x:3,y:3,w:2,h:2,c:"#111"},{x:3,y:3,w:1,h:1,c:"#FFF",a:.3},{x:1,y:5,w:2,h:1,c:"#222"}]}});vt("panda-face","Panda Face",{down:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#F5F5F5"},{x:2,y:-1,w:8,h:1,c:"#F5F5F5"},{x:0,y:-2,w:3,h:3,c:"#222"},{x:9,y:-2,w:3,h:3,c:"#222"},{x:2,y:2,w:3,h:4,c:"#222"},{x:7,y:2,w:3,h:4,c:"#222"},{x:3,y:3,w:1,h:2,c:"#FFF"},{x:8,y:3,w:1,h:2,c:"#FFF"},{x:3,y:4,w:1,h:1,c:"#111"},{x:8,y:4,w:1,h:1,c:"#111"},{x:5,y:6,w:2,h:1,c:"#222"},{x:5,y:7,w:1,h:1,c:"#CCC",a:.4},{x:6,y:7,w:1,h:1,c:"#CCC",a:.4}]},up:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#F5F5F5"},{x:2,y:-1,w:8,h:1,c:"#F5F5F5"},{x:0,y:-2,w:3,h:3,c:"#222"},{x:9,y:-2,w:3,h:3,c:"#222"},{x:5,y:1,w:2,h:5,c:"#EEE",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:0,w:9,h:9,c:"#F5F5F5"},{x:2,y:-1,w:7,h:1,c:"#F5F5F5"},{x:0,y:-2,w:3,h:3,c:"#222"},{x:2,y:2,w:3,h:4,c:"#222"},{x:3,y:3,w:1,h:2,c:"#FFF"},{x:3,y:4,w:1,h:1,c:"#111"},{x:0,y:5,w:3,h:2,c:"#F5F5F5"},{x:1,y:6,w:1,h:1,c:"#222"}]}});vt("frog-face","Frog Face",{down:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#4CAF50"},{x:2,y:0,w:8,h:1,c:"#4CAF50"},{x:1,y:-2,w:4,h:3,c:"#4CAF50"},{x:7,y:-2,w:4,h:3,c:"#4CAF50"},{x:2,y:-1,w:2,h:2,c:"#FFF"},{x:8,y:-1,w:2,h:2,c:"#FFF"},{x:3,y:0,w:1,h:1,c:"#111"},{x:9,y:0,w:1,h:1,c:"#111"},{x:3,y:5,w:6,h:3,c:"#81C784",a:.5},{x:2,y:7,w:8,h:1,c:"#388E3C",a:.6},{x:4,y:4,w:1,h:1,c:"#388E3C",a:.5},{x:7,y:4,w:1,h:1,c:"#388E3C",a:.5},{x:1,y:5,w:2,h:1,c:"#FF8A80",a:.25},{x:9,y:5,w:2,h:1,c:"#FF8A80",a:.25}]},up:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#4CAF50"},{x:2,y:0,w:8,h:1,c:"#4CAF50"},{x:1,y:-2,w:4,h:2,c:"#4CAF50"},{x:7,y:-2,w:4,h:2,c:"#4CAF50"},{x:5,y:2,w:2,h:4,c:"#388E3C",a:.2}]},left:{name:"accessory",pixels:[{x:1,y:1,w:9,h:8,c:"#4CAF50"},{x:2,y:0,w:7,h:1,c:"#4CAF50"},{x:0,y:-2,w:4,h:3,c:"#4CAF50"},{x:1,y:-1,w:2,h:2,c:"#FFF"},{x:2,y:0,w:1,h:1,c:"#111"},{x:0,y:5,w:3,h:3,c:"#81C784",a:.5},{x:0,y:7,w:8,h:1,c:"#388E3C",a:.6},{x:1,y:5,w:1,h:1,c:"#FF8A80",a:.25}]}});vt("rabbit-face","Rabbit Face",{down:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#F5F5F5"},{x:2,y:0,w:8,h:1,c:"#F5F5F5"},{x:2,y:-6,w:3,h:6,c:"#F5F5F5"},{x:7,y:-6,w:3,h:6,c:"#F5F5F5"},{x:3,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:8,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:2,y:3,w:3,h:3,c:"#E57373",a:.7},{x:7,y:3,w:3,h:3,c:"#E57373",a:.7},{x:3,y:3,w:1,h:1,c:"#FFF",a:.4},{x:8,y:3,w:1,h:1,c:"#FFF",a:.4},{x:5,y:5,w:2,h:1,c:"#FFB0C0"},{x:5,y:6,w:1,h:1,c:"#DDD",a:.4},{x:6,y:6,w:1,h:1,c:"#DDD",a:.4},{x:0,y:4,w:2,h:3,c:"#F5F5F5",a:.6},{x:10,y:4,w:2,h:3,c:"#F5F5F5",a:.6}]},up:{name:"accessory",pixels:[{x:1,y:1,w:10,h:8,c:"#F5F5F5"},{x:2,y:0,w:8,h:1,c:"#F5F5F5"},{x:2,y:-6,w:3,h:6,c:"#F5F5F5"},{x:7,y:-6,w:3,h:6,c:"#F5F5F5"},{x:3,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:8,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:5,y:8,w:3,h:2,c:"#FFF"}]},left:{name:"accessory",pixels:[{x:1,y:1,w:9,h:8,c:"#F5F5F5"},{x:2,y:0,w:7,h:1,c:"#F5F5F5"},{x:3,y:-6,w:3,h:6,c:"#F5F5F5"},{x:4,y:-5,w:1,h:4,c:"#FFB0C0",a:.6},{x:2,y:3,w:3,h:3,c:"#E57373",a:.7},{x:3,y:3,w:1,h:1,c:"#FFF",a:.4},{x:0,y:4,w:3,h:3,c:"#F5F5F5"},{x:1,y:5,w:1,h:1,c:"#FFB0C0"},{x:0,y:4,w:2,h:3,c:"#F5F5F5",a:.6}]}});vt("dog-face","Dog Face",{down:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#D2A25C"},{x:2,y:-1,w:8,h:1,c:"#D2A25C"},{x:-1,y:1,w:3,h:6,c:"#A67B3D"},{x:10,y:1,w:3,h:6,c:"#A67B3D"},{x:3,y:5,w:6,h:4,c:"#F5E6D0",a:.8},{x:3,y:2,w:2,h:3,c:"#3E2723"},{x:7,y:2,w:2,h:3,c:"#3E2723"},{x:3,y:2,w:1,h:1,c:"#FFF",a:.4},{x:7,y:2,w:1,h:1,c:"#FFF",a:.4},{x:5,y:5,w:2,h:2,c:"#222"},{x:5,y:7,w:2,h:2,c:"#FF6B8A",a:.8},{x:5,y:7,w:1,h:1,c:"#FF8A9E",a:.4}]},up:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#D2A25C"},{x:2,y:-1,w:8,h:1,c:"#D2A25C"},{x:-1,y:1,w:3,h:6,c:"#A67B3D"},{x:10,y:1,w:3,h:6,c:"#A67B3D"},{x:5,y:0,w:2,h:6,c:"#B8883C",a:.3},{x:2,y:8,w:8,h:1,c:"#A67B3D",a:.5}]},left:{name:"accessory",pixels:[{x:1,y:0,w:9,h:9,c:"#D2A25C"},{x:2,y:-1,w:7,h:1,c:"#D2A25C"},{x:-1,y:1,w:3,h:6,c:"#A67B3D"},{x:-1,y:4,w:3,h:4,c:"#D2A25C"},{x:-1,y:5,w:2,h:3,c:"#F5E6D0",a:.8},{x:3,y:2,w:2,h:3,c:"#3E2723"},{x:3,y:2,w:1,h:1,c:"#FFF",a:.4},{x:0,y:5,w:2,h:1,c:"#222"},{x:0,y:7,w:2,h:1,c:"#FF6B8A",a:.7}]}});const OS={none:1,glasses:1,beret:1,cap:1,badge:1,blush:1,lapels:1,"round-glasses":2,headphones:2,scarf:3,tie:3,bowtie:3,sunglasses:4,bandana:4,eyepatch:4,crown:5,halo:5,horns:5,mask:5,"cat-ears":6,"bear-ears":6,"bunny-ears":6,"dog-nose":6,"fox-mask":6,"cat-face":7,"bear-face":7,"panda-face":7,"frog-face":8,"rabbit-face":8,"dog-face":8,"star-glasses":9};function ag(t){return OS[t]??1}function ig(t,l){return l>=ag(t)}vt("star-glasses","Star Glasses",{down:{name:"accessory",pixels:[{x:1,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:2,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:2,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:7,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:8,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:8,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:5,y:4,w:2,h:1,c:"#FF4081",a:.4}]},up:{name:"accessory",pixels:[{x:0,y:3,w:2,h:1,c:"#FF4081",a:.3},{x:10,y:3,w:2,h:1,c:"#FF4081",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:2,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:2,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:5,y:4,w:6,h:1,c:"#FF4081",a:.3}]}});function ys({r:t,g:l,b:r}){return`#${(t<<16|l<<8|r).toString(16).padStart(6,"0")}`}function vc(t,l){const r=t.r-l.r,i=t.g-l.g,c=t.b-l.b;return r*r+i*i+c*c}function BS(t,l){const r=[];r.push(t[Math.floor(Math.random()*t.length)]);for(let i=1;i<l;i++){const c=t.map(m=>{let x=1/0;for(const d of r)x=Math.min(x,vc(m,d));return x}),u=c.reduce((m,x)=>m+x,0);let f=Math.random()*u;for(let m=0;m<t.length;m++)if(f-=c[m],f<=0){r.push(t[m]);break}r.length<=i&&r.push(t[Math.floor(Math.random()*t.length)])}return r}function LS(t,l,r=20){if(t.length===0)return[];const i=BS(t,l);for(let u=0;u<r;u++){const f=Array.from({length:l},()=>[]);for(const x of t){let d=1/0,g=0;for(let y=0;y<l;y++){const b=vc(x,i[y]);b<d&&(d=b,g=y)}f[g].push(x)}let m=!0;for(let x=0;x<l;x++){if(f[x].length===0)continue;const d={r:0,g:0,b:0};for(const b of f[x])d.r+=b.r,d.g+=b.g,d.b+=b.b;const g=f[x].length,y={r:Math.round(d.r/g),g:Math.round(d.g/g),b:Math.round(d.b/g)};vc(y,i[x])>1&&(m=!1),i[x]=y}if(m)break}const c=new Array(l).fill(0);for(const u of t){let f=1/0,m=0;for(let x=0;x<l;x++){const d=vc(u,i[x]);d<f&&(f=d,m=x)}c[m]++}return i.map((u,f)=>({c:u,count:c[f]})).sort((u,f)=>f.count-u.count).map(u=>u.c)}function $S(t,l=1e4){const r=document.createElement("canvas"),i=t instanceof HTMLImageElement?t.naturalWidth:t.width,c=t instanceof HTMLImageElement?t.naturalHeight:t.height;r.width=i,r.height=c;const u=r.getContext("2d");u.drawImage(t,0,0);const f=u.getImageData(0,0,i,c).data,m=i*c,x=Math.max(1,Math.floor(m/l)),d=[];for(let g=0;g<m;g+=x){const y=g*4;f[y+3]<128||d.push({r:f[y],g:f[y+1],b:f[y+2]})}return d}function i0(t){return .299*t.r+.587*t.g+.114*t.b}function s0(t){const l=Math.max(t.r,t.g,t.b),r=Math.min(t.r,t.g,t.b);return l===0?0:(l-r)/l*255}function HS(t,l=8){const r=$S(t),i=LS(r,l);if(i.length<5)return{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121"};const c=[...i].sort((y,b)=>i0(b)-i0(y)),u=[...i].sort((y,b)=>s0(b)-s0(y)),f=c[0],m=c[c.length-1],x=u[0],d=c[c.length-2],g=c[c.length-1];return{skinColor:ys(f),hairColor:ys(m),shirtColor:ys(x),pantsColor:ys(d),shoeColor:ys(g)}}const US=[{x:1,y:19,w:10,h:2,c:"#100A06",a:.15},{x:2,y:15,w:3,h:4,c:"$pants"},{x:7,y:15,w:3,h:4,c:"$pants"},{x:2,y:19,w:3,h:2,c:"$shoes"},{x:7,y:19,w:3,h:2,c:"$shoes"},{x:2,y:19,w:3,h:1,c:"lighten($shoes, 20)",a:.4},{x:7,y:19,w:3,h:1,c:"lighten($shoes, 20)",a:.4}],IS=[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:4,y:10,w:4,h:2,c:"darken($shirt, 25)",a:.2},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}],YS=[{x:4,y:8,w:4,h:3,c:"$skin"},{x:1,y:1,w:10,h:8,c:"$skin"},{x:3,y:4,w:2,h:2,c:"#1A1A2E"},{x:7,y:4,w:2,h:2,c:"#1A1A2E"},{x:3,y:4,w:1,h:1,c:"#FFF",a:.35},{x:7,y:4,w:1,h:1,c:"#FFF",a:.35},{x:5,y:7,w:2,h:1,c:"darken($skin, 25)",a:.4},{x:0,y:4,w:1,h:1,c:"$skin"},{x:11,y:4,w:1,h:1,c:"$skin"}],qS=[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:10,y:1,w:2,h:3,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:2,y:2,w:8,h:1,c:"darken($hair, 20)",a:.2}];function XS(){return{width:12,height:22,layers:[{name:"lower",pixels:US},{name:"torso",pixels:IS},{name:"head",pixels:YS},{name:"hair",pixels:qS},{name:"accessory",pixels:[]}]}}const VS=["cto","cbo","pm","engineer","designer","qa","data-analyst","default"];for(const t of VS)eg(`mini:${t}`,XS());const GS=[{x:1,y:10,w:10,h:8,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:7,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:7,c:"darken($shirt, 25)",a:.25},{x:4,y:10,w:4,h:2,c:"darken($shirt, 25)",a:.2},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"}],KS=[{x:4,y:8,w:4,h:3,c:"$skin"},{x:1,y:1,w:10,h:8,c:"$skin"},{x:3,y:4,w:2,h:2,c:"#1A1A2E"},{x:7,y:4,w:2,h:2,c:"#1A1A2E"},{x:3,y:4,w:1,h:1,c:"#FFF",a:.35},{x:7,y:4,w:1,h:1,c:"#FFF",a:.35},{x:5,y:7,w:2,h:1,c:"darken($skin, 25)",a:.4},{x:0,y:4,w:1,h:1,c:"$skin"},{x:11,y:4,w:1,h:1,c:"$skin"}],QS=[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:10,y:1,w:2,h:3,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:2,y:2,w:8,h:1,c:"darken($hair, 20)",a:.2}];function WS(){return{width:12,height:22,layers:[{name:"torso",pixels:GS},{name:"head",pixels:KS},{name:"hair",pixels:QS},{name:"accessory",pixels:[]}]}}eg("mini-seated:default",WS());const ZS={canvasWidth:160,canvasHeight:80,scale:2,pixels:[{x:0,y:0,w:80,h:40,c:"#1e2030"},{x:10,y:2,w:10,h:6,c:"#78889c"},{x:10,y:2,w:10,h:1,c:"#8899ad"},{x:24,y:0,w:10,h:6,c:"#78889c"},{x:24,y:0,w:10,h:1,c:"#8899ad"},{x:38,y:2,w:10,h:6,c:"#78889c"},{x:38,y:2,w:10,h:1,c:"#8899ad"},{x:54,y:2,w:10,h:6,c:"#78889c"},{x:54,y:2,w:10,h:1,c:"#8899ad"},{x:11,y:7,w:2,h:2,c:"#2a2a2a"},{x:17,y:7,w:2,h:2,c:"#2a2a2a"},{x:25,y:5,w:2,h:2,c:"#2a2a2a"},{x:31,y:5,w:2,h:2,c:"#2a2a2a"},{x:39,y:7,w:2,h:2,c:"#2a2a2a"},{x:45,y:7,w:2,h:2,c:"#2a2a2a"},{x:55,y:7,w:2,h:2,c:"#2a2a2a"},{x:61,y:7,w:2,h:2,c:"#2a2a2a"},{x:8,y:8,w:64,h:24,c:"#6b5b4b"},{x:4,y:10,w:72,h:20,c:"#7d6d5d"},{x:2,y:12,w:76,h:16,c:"#7d6d5d"},{x:2,y:12,w:76,h:2,c:"#8b7b6b"},{x:2,y:26,w:76,h:2,c:"#4b3b2b"},{x:2,y:28,w:76,h:3,c:"#4b3b2b"},{x:4,y:28,w:72,h:1,c:"#5b4b3b"},{x:6,y:30,w:3,h:2,c:"#3a2a1a"},{x:71,y:30,w:3,h:2,c:"#3a2a1a"},{x:18,y:14,w:44,h:12,c:"#6b5b4b",a:.5},{x:28,y:14,w:14,h:8,c:"#1a1a2e"},{x:29,y:15,w:12,h:6,c:"#1565C0",a:.5},{x:30,y:16,w:8,h:1,c:"#60A5FA",a:.45},{x:30,y:18,w:5,h:1,c:"#60A5FA",a:.3},{x:58,y:16,w:5,h:5,c:"#795548"},{x:59,y:17,w:3,h:3,c:"#A67C52"},{x:63,y:18,w:2,h:2,c:"#795548"},{x:10,y:16,w:10,h:8,c:"#FFEE58",a:.7},{x:11,y:17,w:8,h:1,c:"#9E9E9E",a:.5},{x:11,y:19,w:8,h:1,c:"#9E9E9E",a:.5},{x:11,y:21,w:6,h:1,c:"#9E9E9E",a:.5},{x:10,y:32,w:10,h:6,c:"#78889c"},{x:10,y:32,w:10,h:1,c:"#8899ad"},{x:24,y:34,w:10,h:6,c:"#78889c"},{x:24,y:34,w:10,h:1,c:"#8899ad"},{x:38,y:32,w:10,h:6,c:"#78889c"},{x:38,y:32,w:10,h:1,c:"#8899ad"},{x:54,y:32,w:10,h:6,c:"#78889c"},{x:54,y:32,w:10,h:1,c:"#8899ad"},{x:11,y:37,w:2,h:2,c:"#2a2a2a"},{x:17,y:37,w:2,h:2,c:"#2a2a2a"},{x:25,y:39,w:2,h:2,c:"#2a2a2a"},{x:31,y:39,w:2,h:2,c:"#2a2a2a"},{x:39,y:37,w:2,h:2,c:"#2a2a2a"},{x:45,y:37,w:2,h:2,c:"#2a2a2a"},{x:55,y:37,w:2,h:2,c:"#2a2a2a"},{x:61,y:37,w:2,h:2,c:"#2a2a2a"}]},JS={canvasWidth:128,canvasHeight:96,scale:2,pixels:[{x:0,y:0,w:64,h:48,c:"#4b3b2b"},{x:3,y:3,w:58,h:42,c:"#8B7355"},{x:4,y:4,w:10,h:10,c:"#A0845C",a:.5},{x:20,y:8,w:8,h:8,c:"#A0845C",a:.4},{x:40,y:6,w:12,h:6,c:"#A0845C",a:.3},{x:8,y:30,w:14,h:10,c:"#A0845C",a:.25},{x:44,y:32,w:10,h:8,c:"#A0845C",a:.3},{x:6,y:8,w:18,h:12,c:"#FFEE58"},{x:5,y:7,w:3,h:3,c:"#EF5350"},{x:6,y:7,w:2,h:2,c:"#C62828"},{x:8,y:10,w:14,h:1,c:"#9E9E9E"},{x:8,y:12,w:12,h:1,c:"#9E9E9E"},{x:8,y:14,w:10,h:1,c:"#9E9E9E"},{x:28,y:6,w:16,h:14,c:"#B3E5FC"},{x:35,y:5,w:3,h:3,c:"#42A5F5"},{x:36,y:5,w:2,h:2,c:"#1565C0"},{x:30,y:9,w:12,h:1,c:"#9E9E9E"},{x:30,y:11,w:10,h:1,c:"#9E9E9E"},{x:30,y:13,w:11,h:1,c:"#9E9E9E"},{x:8,y:24,w:16,h:14,c:"#C8E6C9"},{x:15,y:23,w:3,h:3,c:"#66BB6A"},{x:16,y:23,w:2,h:2,c:"#388E3C"},{x:10,y:27,w:12,h:1,c:"#9E9E9E"},{x:10,y:29,w:8,h:1,c:"#9E9E9E"},{x:10,y:31,w:10,h:1,c:"#9E9E9E"},{x:28,y:24,w:28,h:16,c:"#FFCDD2"},{x:43,y:23,w:3,h:3,c:"#EF5350"},{x:44,y:23,w:2,h:2,c:"#B71C1C"},{x:32,y:27,w:24,h:1,c:"#9E9E9E"},{x:32,y:29,w:20,h:1,c:"#9E9E9E"},{x:32,y:31,w:22,h:1,c:"#9E9E9E"},{x:32,y:33,w:15,h:1,c:"#9E9E9E"},{x:0,y:0,w:64,h:3,c:"#5a4a3a"},{x:0,y:45,w:64,h:3,c:"#3a2a1a"}]},PS={canvasWidth:128,canvasHeight:96,scale:2,pixels:[{x:2,y:0,w:60,h:48,c:"#3b1f0a"},{x:4,y:2,w:56,h:44,c:"#5a3310"},{x:4,y:13,w:56,h:2,c:"#2d1508"},{x:4,y:27,w:56,h:2,c:"#2d1508"},{x:4,y:41,w:56,h:2,c:"#2d1508"},{x:5,y:3,w:4,h:10,c:"#2563EB"},{x:5,y:3,w:4,h:2,c:"#1D4ED8"},{x:10,y:4,w:3,h:9,c:"#DC2626"},{x:10,y:4,w:3,h:2,c:"#B91C1C"},{x:14,y:3,w:5,h:10,c:"#16A34A"},{x:14,y:3,w:5,h:2,c:"#15803D"},{x:20,y:4,w:3,h:9,c:"#9333EA"},{x:20,y:4,w:3,h:2,c:"#7E22CE"},{x:24,y:3,w:4,h:10,c:"#D97706"},{x:24,y:3,w:4,h:2,c:"#B45309"},{x:29,y:4,w:3,h:9,c:"#0891B2"},{x:29,y:4,w:3,h:2,c:"#0E7490"},{x:33,y:3,w:5,h:10,c:"#BE123C"},{x:33,y:3,w:5,h:2,c:"#9F1239"},{x:39,y:4,w:4,h:9,c:"#4F46E5"},{x:39,y:4,w:4,h:2,c:"#3730A3"},{x:44,y:3,w:3,h:10,c:"#065F46"},{x:44,y:3,w:3,h:2,c:"#064E3B"},{x:48,y:4,w:4,h:9,c:"#92400E"},{x:48,y:4,w:4,h:2,c:"#78350F"},{x:53,y:3,w:5,h:10,c:"#1E3A5F"},{x:53,y:3,w:5,h:2,c:"#1e3060"},{x:6,y:6,w:2,h:1,c:"#BFDBFE",a:.7},{x:11,y:7,w:1,h:1,c:"#FCA5A5",a:.7},{x:16,y:6,w:3,h:1,c:"#BBF7D0",a:.7},{x:21,y:7,w:1,h:1,c:"#D8B4FE",a:.7},{x:25,y:6,w:2,h:1,c:"#FDE68A",a:.7},{x:5,y:16,w:5,h:11,c:"#0F766E"},{x:5,y:16,w:5,h:2,c:"#0D6056"},{x:11,y:17,w:3,h:10,c:"#C2410C"},{x:11,y:17,w:3,h:2,c:"#9A3412"},{x:15,y:16,w:4,h:11,c:"#7C3AED"},{x:15,y:16,w:4,h:2,c:"#6D28D9"},{x:20,y:17,w:3,h:10,c:"#1D4ED8"},{x:20,y:17,w:3,h:2,c:"#1E40AF"},{x:24,y:16,w:5,h:11,c:"#166534"},{x:24,y:16,w:5,h:2,c:"#14532D"},{x:30,y:17,w:4,h:10,c:"#991B1B"},{x:30,y:17,w:4,h:2,c:"#7F1D1D"},{x:35,y:16,w:3,h:11,c:"#854D0E"},{x:35,y:16,w:3,h:2,c:"#713F12"},{x:39,y:17,w:4,h:10,c:"#1E40AF"},{x:39,y:17,w:4,h:2,c:"#1E3A8A"},{x:44,y:16,w:5,h:11,c:"#065F46"},{x:44,y:16,w:5,h:2,c:"#064E3B"},{x:50,y:17,w:3,h:10,c:"#831843"},{x:50,y:17,w:3,h:2,c:"#6B21A8"},{x:54,y:16,w:5,h:11,c:"#374151"},{x:54,y:16,w:5,h:2,c:"#1F2937"},{x:5,y:30,w:4,h:11,c:"#0E7490"},{x:5,y:30,w:4,h:2,c:"#0C6B7E"},{x:10,y:31,w:3,h:10,c:"#B45309"},{x:10,y:31,w:3,h:2,c:"#92400E"},{x:14,y:30,w:5,h:11,c:"#6D28D9"},{x:14,y:30,w:5,h:2,c:"#5B21B6"},{x:20,y:30,w:7,h:8,c:"#1e293b"},{x:22,y:32,w:3,h:3,c:"#3b82f6",a:.9},{x:22,y:32,w:1,h:3,c:"#60a5fa",a:.6},{x:28,y:31,w:4,h:10,c:"#DC2626"},{x:28,y:31,w:4,h:2,c:"#B91C1C"},{x:33,y:30,w:3,h:11,c:"#065F46"},{x:33,y:30,w:3,h:2,c:"#064E3B"},{x:37,y:31,w:4,h:10,c:"#1D4ED8"},{x:37,y:31,w:4,h:2,c:"#1E40AF"},{x:42,y:35,w:6,h:6,c:"#92400E"},{x:43,y:30,w:4,h:6,c:"#16a34a",a:.8},{x:43,y:29,w:2,h:3,c:"#15803d",a:.7},{x:45,y:28,w:2,h:4,c:"#16a34a",a:.6},{x:49,y:30,w:3,h:11,c:"#7C3AED"},{x:49,y:30,w:3,h:2,c:"#6D28D9"},{x:53,y:31,w:5,h:10,c:"#B45309"},{x:53,y:31,w:5,h:2,c:"#92400E"},{x:2,y:46,w:60,h:2,c:"#1a0a03"},{x:2,y:0,w:60,h:2,c:"#4a2510"},{x:2,y:0,w:2,h:48,c:"#2d1508"},{x:60,y:0,w:2,h:48,c:"#2d1508"}]},ej={canvasWidth:96,canvasHeight:120,scale:2,pixels:[{x:2,y:0,w:44,h:60,c:"#546E7A"},{x:2,y:0,w:44,h:3,c:"#78909C"},{x:2,y:57,w:44,h:3,c:"#37474F"},{x:2,y:0,w:2,h:60,c:"#455A64"},{x:44,y:0,w:2,h:60,c:"#37474F"},{x:5,y:4,w:38,h:3,c:"#FFD54F",a:.5},{x:6,y:1,w:2,h:4,c:"#FFFDE7"},{x:10,y:0,w:2,h:5,c:"#FFF9C4"},{x:14,y:1,w:2,h:3,c:"#FFFDE7"},{x:18,y:0,w:2,h:4,c:"#FFF8E1"},{x:5,y:5,w:38,h:16,c:"#607D8B"},{x:5,y:5,w:38,h:2,c:"#78909C"},{x:15,y:12,w:18,h:4,c:"#37474F"},{x:22,y:11,w:4,h:6,c:"#455A64"},{x:23,y:13,w:2,h:2,c:"#B0BEC5"},{x:7,y:14,w:8,h:5,c:"#B0BEC5"},{x:8,y:15,w:6,h:1,c:"#607D8B"},{x:8,y:17,w:5,h:1,c:"#607D8B"},{x:5,y:23,w:38,h:16,c:"#607D8B"},{x:5,y:23,w:38,h:2,c:"#78909C"},{x:15,y:30,w:18,h:4,c:"#37474F"},{x:22,y:29,w:4,h:6,c:"#455A64"},{x:23,y:31,w:2,h:2,c:"#B0BEC5"},{x:7,y:32,w:8,h:5,c:"#B0BEC5"},{x:8,y:33,w:6,h:1,c:"#607D8B"},{x:8,y:35,w:4,h:1,c:"#607D8B"},{x:5,y:41,w:38,h:16,c:"#607D8B"},{x:5,y:41,w:38,h:2,c:"#78909C"},{x:15,y:48,w:18,h:4,c:"#37474F"},{x:22,y:47,w:4,h:6,c:"#455A64"},{x:23,y:49,w:2,h:2,c:"#B0BEC5"},{x:7,y:50,w:8,h:5,c:"#B0BEC5"},{x:8,y:51,w:6,h:1,c:"#607D8B"},{x:8,y:53,w:3,h:1,c:"#607D8B"}]};Uc("meeting",ZS);Uc("bulletin",JS);Uc("decision",ej);Uc("knowledge",PS);const pd=16,yd=24,tj=60,nj={cbo:0,cto:8,pm:15,engineer:22,designer:5,qa:12};function sg(t,l){if(!t)return t;let r=t;if(l!=null&&l.hairStyle){const i=MS(l.hairStyle);i&&(r=AS(r,i.layer))}if(l!=null&&l.outfitStyle){const i=FS(l.outfitStyle);i&&(r=Kd(r,"torso",i.layer,1))}if(l!=null&&l.accessory&&l.accessory!=="none"){const i=RS(l.accessory);i&&(r=Kd(r,"accessory",i.layer))}return r}function Ic({roleId:t,className:l,appearance:r,scale:i}){const c=k.useRef(null),u=k.useRef(0),f=k.useRef(0),m=k.useRef(r);m.current=r;const x=i??4,d=pd*x,g=yd*x,y=k.useMemo(()=>{const b=Qd(`mini:${t}`)??Qd("mini:default");return sg(b,r)},[t,r==null?void 0:r.hairStyle,r==null?void 0:r.outfitStyle,r==null?void 0:r.accessory]);return k.useEffect(()=>{const b=c.current;if(!b)return;const v=b.getContext("2d");if(!v)return;const j=nj[t]??0,S=()=>{f.current++;const E=m.current;if(!E||!y){u.current=requestAnimationFrame(S);return}const A=(f.current+j)%tj<30?1:0;v.clearRect(0,0,pd,yd),v.save(),v.translate(2,1),DS(v,y,A,E,1),v.restore(),u.current=requestAnimationFrame(S)};return u.current=requestAnimationFrame(S),()=>cancelAnimationFrame(u.current)},[t,y]),o.jsx("canvas",{ref:c,width:pd,height:yd,className:l,style:{imageRendering:"pixelated",display:"block",width:d,height:g}})}const lj="https://api.tycono.ai",kh=lj;async function sc(t){const l=await fetch(`${kh}${t}`);if(!l.ok)throw new Error(`Cloud API error: ${l.status}`);return l.json()}async function oc(t,l){const r=await fetch(`${kh}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw new Error(`Cloud API error: ${r.status}`);return r.json()}const Ts={health:()=>sc("/api/health"),getCharacters:()=>sc("/api/store/characters"),getCharacter:t=>sc(`/api/store/characters/${t}`),getCharacterVersion:t=>sc(`/api/store/characters/${t}/version`),syncCheck:t=>oc("/api/sync/check",{roles:t}),syncPull:t=>oc("/api/sync/pull",{sourceId:t}),publishCharacter:t=>oc("/api/store/publish",t),deleteCharacter:t=>fetch(`${kh}/api/store/characters/${t}`,{method:"DELETE"}).then(l=>l.json()),uploadTelemetry:t=>oc("/api/telemetry",t)},rj={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"},gd={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},aj={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},ij=500,o0=360,c0=700,sj=t=>`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`;function oj({role:t,allRoles:l,recentActivity:r,onClose:i,onFireRole:c,terminalWidth:u=0,activeJobId:f,activeTask:m,isWorking:x,jobStartedAt:d,onStopJob:g,sessions:y,streamingSessionId:b,onCreateSessionSilent:v,onSendMessage:j,onFocusTerminal:S,onCustomize:E,onUpdateRole:C,appearance:A,relationships:M,roleLevel:F}){var ze,Ue;const[L,O]=k.useState(ij),[U,X]=k.useState(!1),ne=k.useRef(0),D=k.useRef(0),[Y,R]=k.useState(!1),[Q,ee]=k.useState(!1),[V,I]=k.useState(!1),[Z,ce]=k.useState(!1),[we,z]=k.useState("talk"),[B,W]=k.useState(!1),[T,me]=k.useState(""),[Se,Ee]=k.useState(!1),Be=k.useRef(null),{events:He,status:Qe}=V0(f??null),[ke,yt]=k.useState(0);k.useEffect(()=>{if(!x||!d){yt(0);return}const be=new Date(d).getTime(),je=()=>yt(Math.floor((Date.now()-be)/1e3));je();const jt=setInterval(je,1e3);return()=>clearInterval(jt)},[x,d]);const he=u>0,G=he?u:0,ie=he?Math.max(o0,window.innerWidth-u-100):c0,xe=Math.min(L,ie),Te=k.useCallback(be=>{be.preventDefault(),ne.current=be.clientX,D.current=xe,X(!0);const je=wt=>{const Xe=ne.current-wt.clientX,ft=Math.min(c0,Math.max(o0,D.current+Xe));O(ft)},jt=()=>{X(!1),document.removeEventListener("mousemove",je),document.removeEventListener("mouseup",jt)};document.addEventListener("mousemove",je),document.addEventListener("mouseup",jt)},[xe]),Ne=k.useRef(null),Fe=t?y.find(be=>be.roleId===t.id):null,Ae=be=>{if(!t)return;const je=x?"talk":we;Fe?(j(Fe.id,be,je),S(t.id)):(Ne.current={content:be,mode:je},v(t.id))};k.useEffect(()=>{if(Fe&&Ne.current){const{content:be,mode:je}=Ne.current;Ne.current=null,j(Fe.id,be,je),t&&S(t.id)}},[Fe==null?void 0:Fe.id]);const Re=(()=>{if(!He.length)return null;const be=[];let je=0,jt=0,wt=0;for(const Xe of He)if(Xe.type==="thinking")je++;else if(Xe.type==="text")jt++;else if(Xe.type==="tool:start"){const ft=String(Xe.data.name??"");be.includes(ft)||be.push(ft)}else Xe.type==="dispatch:start"&&wt++;return{tools:be,thinkCount:je,textCount:jt,dispatchCount:wt,total:He.length}})(),Ke=m||(()=>{if(!Fe)return null;const be=Fe.messages;for(let je=be.length-1;je>=0;je--)if(be[je].from==="ceo")return be[je].content;return null})(),Lt=(()=>{if(!Fe)return null;const be=Fe.messages;for(let je=be.length-1;je>=0;je--)if(be[je].from==="role"&&be[je].content)return be[je].content;return null})();if(!t)return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:G},onClick:i}),o.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px]",style:{right:G,width:xe,background:"var(--terminal-bg)",borderLeftColor:"var(--pixel-border)"},children:o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading role..."})})]});const gt=gd[t.id]??"#666",ht=rj[t.id]??"👤",Zt=l.filter(be=>be.reportsTo===t.id),re=Fe&&b===Fe.id,ye=t.name||aj[t.id]||t.id;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:G},onClick:i}),o.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${U?"resizing":""}`,style:{borderLeftColor:gt,right:G,width:xe,background:"var(--terminal-bg)"},children:[o.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${U?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:Te}),o.jsxs("div",{className:"relative shrink-0 overflow-hidden",style:{background:`linear-gradient(135deg, ${gt}ee, ${gt}99)`},children:[o.jsx("div",{className:"absolute inset-0 opacity-[0.06]",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 8px, white 8px, white 9px)"}}),o.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-1.5 z-10",children:[E&&o.jsx("button",{onClick:()=>E(t.id),className:"w-7 h-7 rounded-full bg-black/20 text-white flex items-center justify-center text-sm hover:bg-black/30 cursor-pointer backdrop-blur-sm",title:"Customize",children:"🎨"}),o.jsx("button",{onClick:i,className:"w-7 h-7 rounded-full bg-black/20 text-white flex items-center justify-center text-lg hover:bg-black/30 cursor-pointer backdrop-blur-sm",children:"×"})]}),o.jsxs("div",{className:"relative flex items-end gap-4 px-4 pt-4 pb-3",children:[o.jsx("div",{className:"shrink-0 relative",style:{marginBottom:-2},children:o.jsx("div",{className:"rounded-lg p-1",style:{background:"rgba(0,0,0,0.2)"},children:o.jsx(Ic,{roleId:t.id,appearance:A,scale:8})})}),o.jsxs("div",{className:"flex-1 min-w-0 text-white pb-1",children:[o.jsxs("div",{className:"text-lg font-bold flex items-center gap-2",style:{fontFamily:"var(--pixel-font)"},children:[ht," ",t.id.toUpperCase(),x&&o.jsx("span",{className:"text-[9px] font-semibold px-2 py-0.5 rounded-full animate-pulse",style:{background:"rgba(251,191,36,0.25)",color:"#fde68a"},children:"WORKING"})]}),B?o.jsxs("form",{className:"flex items-center gap-1.5 mt-0.5",onSubmit:async be=>{be.preventDefault();const je=T.trim();if(!je||je===ye||!C){W(!1);return}Ee(!0);try{await C(t.id,{name:je})}catch{}Ee(!1),W(!1)},children:[o.jsx("input",{ref:Be,value:T,onChange:be=>me(be.target.value),onKeyDown:be=>{be.key==="Escape"&&W(!1)},disabled:Se,autoFocus:!0,className:"bg-white/20 text-white text-xs rounded px-1.5 py-0.5 outline-none focus:bg-white/30 w-full",style:{fontFamily:"inherit"}}),o.jsx("button",{type:"submit",disabled:Se,className:"text-white/80 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✓"}),o.jsx("button",{type:"button",onClick:()=>W(!1),className:"text-white/60 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✕"})]}):o.jsxs("div",{className:"text-xs opacity-75 mt-0.5 group/name flex items-center gap-1 cursor-pointer hover:opacity-100 transition-opacity",onClick:()=>{C&&(me(ye),W(!0))},title:C?"Click to edit name":void 0,children:[ye,C&&o.jsx("span",{className:"opacity-0 group-hover/name:opacity-60 text-[10px]",children:"✎"})]})]})]}),o.jsxs("div",{className:"relative flex items-center gap-3 px-4 py-2 text-[10px] font-bold text-white/80",style:{background:"rgba(0,0,0,0.2)",fontFamily:"var(--pixel-font)"},children:[o.jsxs("span",{children:["Lv.",F??1]}),o.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),o.jsxs("span",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:x?"var(--idle-amber)":"var(--active-green)"}}),x?"Working":"Idle"]}),o.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),o.jsx("span",{children:t.level}),t.reportsTo&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),o.jsxs("span",{className:"opacity-60",children:["→"," ",t.reportsTo]})]})]})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:[x&&o.jsxs("div",{className:"px-4 py-3 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"var(--idle-amber)"}}),o.jsxs("span",{className:"text-xs font-semibold",style:{color:"var(--idle-amber)"},children:["Working",ke>0?` · ${sj(ke)}`:""]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>S(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"}),f&&g&&o.jsx("button",{onClick:()=>g(f),className:"text-[10px] px-2 py-0.5 rounded cursor-pointer font-semibold transition-colors",style:{background:"rgba(239,68,68,0.15)",color:"#ef4444"},children:"Stop"})]})]}),Ke&&o.jsx("div",{className:"text-xs truncate",style:{color:"var(--terminal-text-secondary)"},children:Ke})]}),x&&f&&Re&&o.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Activity"}),o.jsx("button",{onClick:()=>S(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"View details ↗"})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[Re.thinkCount>0&&o.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(168,85,247,0.15)",color:"#c084fc"},children:[o.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:"#a855f7"}}),"thinking ×",Re.thinkCount]}),Re.tools.map(be=>o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa"},children:be},be)),Re.dispatchCount>0&&o.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(249,115,22,0.15)",color:"#fb923c"},children:["dispatch ×",Re.dispatchCount]}),Re.textCount>0&&o.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(34,197,94,0.15)",color:"#4ade80"},children:["output ×",Re.textCount]}),(Qe==="streaming"||Qe==="connecting")&&o.jsx("span",{className:"inline-block w-1.5 h-3 animate-pulse rounded-sm",style:{background:"var(--active-green)"}})]}),o.jsxs("div",{className:"text-[10px] mt-1",style:{color:"var(--terminal-text-muted)"},children:[Re.total," events"]})]}),x&&Lt&&o.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Last Message"}),o.jsx("button",{onClick:()=>S(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"})]}),o.jsxs("div",{className:"rounded-lg p-2.5 text-xs leading-relaxed line-clamp-3 overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:[Lt.slice(0,200),Lt.length>200&&"..."]})]}),x&&o.jsx("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:o.jsx(u0,{onSend:Ae,disabled:!!re,placeholder:"Ask something...",color:gt})}),!x&&o.jsxs("div",{className:"px-4 pt-4 pb-2",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-secondary)"},children:"Latest"}),o.jsx(uj,{icon:ht,roleId:t.id,roleName:ye,color:gt,text:r})]}),!x&&o.jsx("div",{className:"px-4 py-3",style:{borderBottom:"1px solid var(--terminal-border)"},children:o.jsxs("div",{className:"rounded-xl overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[Lt&&o.jsxs("div",{className:"px-3 pt-2.5 pb-2 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--terminal-border)"},onClick:()=>S(t.id),children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Last response"}),o.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"View ↗"})]}),o.jsxs("div",{className:"text-xs leading-relaxed line-clamp-2 overflow-hidden",style:{color:"var(--terminal-text-secondary)"},children:[Lt.slice(0,150),Lt.length>150&&"..."]})]}),o.jsx("div",{className:"p-2",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("div",{className:"flex rounded-lg overflow-hidden shrink-0",style:{border:"1px solid var(--pixel-border)"},children:[o.jsx("button",{onClick:()=>z("talk"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:we==="talk"?"var(--accent)":"transparent",color:we==="talk"?"#fff":"var(--terminal-text-secondary)"},children:"Talk"}),o.jsx("button",{onClick:()=>z("do"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:we==="do"?"var(--idle-amber)":"transparent",color:we==="do"?"#fff":"var(--terminal-text-secondary)"},children:"Do"})]}),o.jsx(u0,{onSend:Ae,disabled:!!re,placeholder:we==="talk"?"Ask something...":"Give a directive...",color:gt})]})})]})}),o.jsxs("div",{className:"px-4 py-2 space-y-1",children:[o.jsxs(cc,{title:`Profile${t.persona?"":" (empty)"}`,open:Y,onToggle:()=>R(be=>!be),children:[t.persona&&o.jsx("div",{className:"text-xs leading-relaxed rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:t.persona}),o.jsxs("div",{className:"space-y-0 mt-2",children:[o.jsx(bd,{label:"Level",value:t.level}),o.jsx(bd,{label:"Reports to",value:t.reportsTo}),o.jsx(bd,{label:"Status",value:t.status})]}),Zt.length>0&&o.jsxs("div",{className:"mt-3",children:[o.jsx("div",{className:"text-[11px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Direct Reports"}),o.jsx("div",{className:"space-y-1",children:Zt.map(be=>o.jsxs("div",{className:"flex items-center gap-2 p-1.5 rounded-lg",style:{background:"var(--hud-bg-alt)"},children:[o.jsx("div",{className:"w-6 h-6 rounded flex items-center justify-center text-white text-[10px] font-bold",style:{background:gd[be.id]??"#666"},children:be.id.slice(0,2).toUpperCase()}),o.jsx("div",{className:"text-xs",style:{color:"var(--terminal-text)"},children:be.name})]},be.id))})]})]}),t.authority&&o.jsxs(cc,{title:"Authority",open:Q,onToggle:()=>ee(be=>!be),children:[((ze=t.authority.autonomous)==null?void 0:ze.length)>0&&o.jsxs("div",{className:"mb-2",children:[o.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--active-green)"},children:"Autonomous"}),t.authority.autonomous.map((be,je)=>o.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",be]},je))]}),((Ue=t.authority.needsApproval)==null?void 0:Ue.length)>0&&o.jsxs("div",{children:[o.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--idle-amber)"},children:"Needs Approval"}),t.authority.needsApproval.map((be,je)=>o.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",be]},je))]})]}),t&&M&&(()=>{const be=M.filter(je=>je.roleA===t.id||je.roleB===t.id).filter(je=>je.familiarity>0).sort((je,jt)=>jt.familiarity-je.familiarity);return be.length===0?null:o.jsx(cc,{title:`Relationships (${be.length})`,open:V,onToggle:()=>I(je=>!je),children:o.jsx("div",{className:"space-y-1.5",children:be.map((je,jt)=>{const wt=je.roleA===t.id?je.roleB:je.roleA,Xe=l.find(Mt=>Mt.id===wt),ft=je.familiarity>=80?"Best Partner":je.familiarity>=50?"Friend":je.familiarity>=20?"Colleague":"Acquaintance",de=je.familiarity>=80?"#4CAF50":je.familiarity>=50?"#2196F3":je.familiarity>=20?"#FF9800":"#9E9E9E";return o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs w-20 truncate",style:{color:gd[wt]??"var(--terminal-text-secondary)"},children:(Xe==null?void 0:Xe.name)??wt}),o.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-white/10",children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${je.familiarity}%`,background:de}})}),o.jsx("span",{className:"text-[10px] w-16 text-right",style:{color:"var(--terminal-text-muted)"},children:ft})]},jt)})})})})(),t.journal&&o.jsx(cc,{title:`Journal (${(t.journal.match(/### /g)??[]).length})`,open:Z,onToggle:()=>ce(be=>!be),children:o.jsxs("div",{className:"text-xs leading-relaxed rounded-lg p-3 max-h-[300px] overflow-y-auto",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:[o.jsx(Hs,{content:t.journal.slice(0,3e3)}),t.journal.length>3e3&&o.jsx("div",{className:"italic mt-2",style:{color:"var(--terminal-text-muted)"},children:"... (truncated)"})]})})]}),o.jsx(cj,{role:t,appearance:A}),c&&o.jsx("div",{className:"px-4 pb-4 mt-auto shrink-0",children:o.jsx("button",{onClick:()=>{c(t.id,t.name),i()},className:"w-full p-2 text-center text-xs font-medium border-2 border-dashed rounded-lg cursor-pointer transition-colors",style:{borderColor:"rgba(239,68,68,0.3)",color:"rgba(239,68,68,0.5)"},children:"Fire Role"})})]})]})]})}function cj({role:t,appearance:l}){const[r,i]=k.useState("idle"),[c,u]=k.useState(""),[f,m]=k.useState(!1),x=async()=>{var d,g;if(!f){m(!0);return}i("publishing");try{let y=null;try{y=await Ce.exportSkills(t.id)}catch{}const b={roleId:t.id,persona:t.persona??"",authority:t.authority??{autonomous:[],needsApproval:[]},level:t.level,tagline:((d=(t.persona??"").split(/[.\n]/)[0])==null?void 0:d.trim().slice(0,80))||t.name,chatStyle:"Professional and focused",skills:y??[],resume:{summary:((g=t.persona)==null?void 0:g.split(`
|
|
80
|
-
`)[0])??"",strengths:[],specialties:[],experience:""},author:{id:"tycono",name:"Tycono"},tags:[t.level,t.id],price:"free",installs:0,rating:0,featured:!1,randomActive:!0,randomPersonality:""};l&&(b.appearance=l);let v="1.0.0";try{const j=await Ts.getCharacterVersion(t.id);if(j!=null&&j.version){const S=j.version.split(".").map(Number);S[2]=(S[2]??0)+1,v=S.join(".")}}catch{}await Ts.publishCharacter({id:t.id,name:t.name||t.id,version:v,data:b}),i("done"),u(`Published v${v}`),m(!1)}catch(y){i("error"),u(y instanceof Error?y.message:"Failed"),m(!1)}};return o.jsx("div",{className:"px-4 pb-2 shrink-0",children:o.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:o.jsxs("div",{className:"px-3 py-2.5 flex items-center justify-between",style:{background:"var(--hud-bg-alt)"},children:[o.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Cloud Store"}),r==="done"?o.jsx("span",{className:"text-[10px] font-semibold",style:{color:"var(--active-green)"},children:c}):r==="error"?o.jsx("span",{className:"text-[10px] font-semibold",style:{color:"#ef4444"},children:c}):o.jsx("button",{onClick:x,disabled:r==="publishing",className:"text-[10px] px-2.5 py-1 rounded font-semibold cursor-pointer transition-colors disabled:opacity-50",style:{background:f?"rgba(59,130,246,0.3)":"rgba(59,130,246,0.15)",color:"#60a5fa",border:f?"1px solid rgba(59,130,246,0.5)":"1px solid transparent"},children:r==="publishing"?"Publishing...":f?"Confirm Publish?":"Publish to Store"})]})})})}function uj({icon:t,roleId:l,roleName:r,color:i,text:c}){const u=!!c;return o.jsx("div",{className:"relative",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsxs("div",{className:"shrink-0",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center text-xl shadow-sm",style:{background:`${i}18`,border:`2px solid ${i}44`},children:t}),o.jsx("div",{className:"text-[9px] font-bold text-center mt-0.5 uppercase tracking-wide",style:{color:i},children:l})]}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsxs("div",{className:"relative",children:[o.jsx("div",{className:"absolute top-3 -left-2 w-0 h-0",style:{borderTop:"6px solid transparent",borderBottom:"6px solid transparent",borderRight:`8px solid ${i}12`}}),o.jsxs("div",{className:"rounded-xl rounded-tl-sm p-4 border",style:{background:`${i}08`,borderColor:`${i}22`},children:[o.jsx("div",{className:"text-[10px] font-semibold mb-1.5 uppercase tracking-wider",style:{color:i},children:r}),u?o.jsx("div",{className:"text-sm leading-relaxed",style:{color:"var(--terminal-text)"},children:o.jsx(Hs,{content:c})}):o.jsx("div",{className:"text-sm italic",style:{color:"var(--terminal-text-muted)"},children:"No recent activity."})]})]})})]})})}function cc({title:t,open:l,onToggle:r,children:i}){return o.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:[o.jsxs("button",{onClick:r,className:"w-full px-3 py-2.5 flex items-center justify-between cursor-pointer transition-colors group",style:{background:"var(--hud-bg-alt)"},children:[o.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:t}),o.jsx("span",{className:"text-[10px] transition-transform",style:{color:"var(--terminal-text-muted)",transform:l?"rotate(0deg)":"rotate(-90deg)"},children:"▼"})]}),l&&o.jsx("div",{className:"px-3 pb-3 pt-2",style:{borderTop:"1px solid var(--terminal-border)"},children:i})]})}function u0({onSend:t,disabled:l,placeholder:r,color:i}){const[c,u]=k.useState(""),f=()=>{const m=c.trim();!m||l||(t(m),u(""))};return o.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[o.jsx("input",{type:"text",value:c,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),f())},placeholder:l?"Waiting...":r,disabled:l,className:"flex-1 rounded-lg px-2.5 py-1.5 text-xs focus:outline-none disabled:opacity-40",style:{background:"var(--hud-bg)",border:"1px solid var(--pixel-border)",color:"var(--terminal-text)"}}),o.jsx("button",{onClick:f,disabled:l||!c.trim(),className:"w-7 h-7 rounded-lg flex items-center justify-center shrink-0 cursor-pointer text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",style:{background:l||!c.trim()?"#666":i},children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M22 2L11 13"}),o.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})}function bd({label:t,value:l}){return o.jsxs("div",{className:"flex justify-between py-1.5 text-xs",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:t}),o.jsx("span",{className:"font-semibold",style:{color:"var(--terminal-text)"},children:l})]})}function fj(t,l){var r,i=1;t==null&&(t=0),l==null&&(l=0);function c(){var u,f=r.length,m,x=0,d=0;for(u=0;u<f;++u)m=r[u],x+=m.x,d+=m.y;for(x=(x/f-t)*i,d=(d/f-l)*i,u=0;u<f;++u)m=r[u],m.x-=x,m.y-=d}return c.initialize=function(u){r=u},c.x=function(u){return arguments.length?(t=+u,c):t},c.y=function(u){return arguments.length?(l=+u,c):l},c.strength=function(u){return arguments.length?(i=+u,c):i},c}function dj(t){const l=+this._x.call(null,t),r=+this._y.call(null,t);return og(this.cover(l,r),l,r,t)}function og(t,l,r,i){if(isNaN(l)||isNaN(r))return t;var c,u=t._root,f={data:i},m=t._x0,x=t._y0,d=t._x1,g=t._y1,y,b,v,j,S,E,C,A;if(!u)return t._root=f,t;for(;u.length;)if((S=l>=(y=(m+d)/2))?m=y:d=y,(E=r>=(b=(x+g)/2))?x=b:g=b,c=u,!(u=u[C=E<<1|S]))return c[C]=f,t;if(v=+t._x.call(null,u.data),j=+t._y.call(null,u.data),l===v&&r===j)return f.next=u,c?c[C]=f:t._root=f,t;do c=c?c[C]=new Array(4):t._root=new Array(4),(S=l>=(y=(m+d)/2))?m=y:d=y,(E=r>=(b=(x+g)/2))?x=b:g=b;while((C=E<<1|S)===(A=(j>=b)<<1|v>=y));return c[A]=u,c[C]=f,t}function hj(t){var l,r,i=t.length,c,u,f=new Array(i),m=new Array(i),x=1/0,d=1/0,g=-1/0,y=-1/0;for(r=0;r<i;++r)isNaN(c=+this._x.call(null,l=t[r]))||isNaN(u=+this._y.call(null,l))||(f[r]=c,m[r]=u,c<x&&(x=c),c>g&&(g=c),u<d&&(d=u),u>y&&(y=u));if(x>g||d>y)return this;for(this.cover(x,d).cover(g,y),r=0;r<i;++r)og(this,f[r],m[r],t[r]);return this}function mj(t,l){if(isNaN(t=+t)||isNaN(l=+l))return this;var r=this._x0,i=this._y0,c=this._x1,u=this._y1;if(isNaN(r))c=(r=Math.floor(t))+1,u=(i=Math.floor(l))+1;else{for(var f=c-r||1,m=this._root,x,d;r>t||t>=c||i>l||l>=u;)switch(d=(l<i)<<1|t<r,x=new Array(4),x[d]=m,m=x,f*=2,d){case 0:c=r+f,u=i+f;break;case 1:r=c-f,u=i+f;break;case 2:c=r+f,i=u-f;break;case 3:r=c-f,i=u-f;break}this._root&&this._root.length&&(this._root=m)}return this._x0=r,this._y0=i,this._x1=c,this._y1=u,this}function xj(){var t=[];return this.visit(function(l){if(!l.length)do t.push(l.data);while(l=l.next)}),t}function pj(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Sn(t,l,r,i,c){this.node=t,this.x0=l,this.y0=r,this.x1=i,this.y1=c}function yj(t,l,r){var i,c=this._x0,u=this._y0,f,m,x,d,g=this._x1,y=this._y1,b=[],v=this._root,j,S;for(v&&b.push(new Sn(v,c,u,g,y)),r==null?r=1/0:(c=t-r,u=l-r,g=t+r,y=l+r,r*=r);j=b.pop();)if(!(!(v=j.node)||(f=j.x0)>g||(m=j.y0)>y||(x=j.x1)<c||(d=j.y1)<u))if(v.length){var E=(f+x)/2,C=(m+d)/2;b.push(new Sn(v[3],E,C,x,d),new Sn(v[2],f,C,E,d),new Sn(v[1],E,m,x,C),new Sn(v[0],f,m,E,C)),(S=(l>=C)<<1|t>=E)&&(j=b[b.length-1],b[b.length-1]=b[b.length-1-S],b[b.length-1-S]=j)}else{var A=t-+this._x.call(null,v.data),M=l-+this._y.call(null,v.data),F=A*A+M*M;if(F<r){var L=Math.sqrt(r=F);c=t-L,u=l-L,g=t+L,y=l+L,i=v.data}}return i}function gj(t){if(isNaN(g=+this._x.call(null,t))||isNaN(y=+this._y.call(null,t)))return this;var l,r=this._root,i,c,u,f=this._x0,m=this._y0,x=this._x1,d=this._y1,g,y,b,v,j,S,E,C;if(!r)return this;if(r.length)for(;;){if((j=g>=(b=(f+x)/2))?f=b:x=b,(S=y>=(v=(m+d)/2))?m=v:d=v,l=r,!(r=r[E=S<<1|j]))return this;if(!r.length)break;(l[E+1&3]||l[E+2&3]||l[E+3&3])&&(i=l,C=E)}for(;r.data!==t;)if(c=r,!(r=r.next))return this;return(u=r.next)&&delete r.next,c?(u?c.next=u:delete c.next,this):l?(u?l[E]=u:delete l[E],(r=l[0]||l[1]||l[2]||l[3])&&r===(l[3]||l[2]||l[1]||l[0])&&!r.length&&(i?i[C]=r:this._root=r),this):(this._root=u,this)}function bj(t){for(var l=0,r=t.length;l<r;++l)this.remove(t[l]);return this}function vj(){return this._root}function wj(){var t=0;return this.visit(function(l){if(!l.length)do++t;while(l=l.next)}),t}function kj(t){var l=[],r,i=this._root,c,u,f,m,x;for(i&&l.push(new Sn(i,this._x0,this._y0,this._x1,this._y1));r=l.pop();)if(!t(i=r.node,u=r.x0,f=r.y0,m=r.x1,x=r.y1)&&i.length){var d=(u+m)/2,g=(f+x)/2;(c=i[3])&&l.push(new Sn(c,d,g,m,x)),(c=i[2])&&l.push(new Sn(c,u,g,d,x)),(c=i[1])&&l.push(new Sn(c,d,f,m,g)),(c=i[0])&&l.push(new Sn(c,u,f,d,g))}return this}function Sj(t){var l=[],r=[],i;for(this._root&&l.push(new Sn(this._root,this._x0,this._y0,this._x1,this._y1));i=l.pop();){var c=i.node;if(c.length){var u,f=i.x0,m=i.y0,x=i.x1,d=i.y1,g=(f+x)/2,y=(m+d)/2;(u=c[0])&&l.push(new Sn(u,f,m,g,y)),(u=c[1])&&l.push(new Sn(u,g,m,x,y)),(u=c[2])&&l.push(new Sn(u,f,y,g,d)),(u=c[3])&&l.push(new Sn(u,g,y,x,d))}r.push(i)}for(;i=r.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function jj(t){return t[0]}function Cj(t){return arguments.length?(this._x=t,this):this._x}function Ej(t){return t[1]}function Nj(t){return arguments.length?(this._y=t,this):this._y}function Sh(t,l,r){var i=new jh(l??jj,r??Ej,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function jh(t,l,r,i,c,u){this._x=t,this._y=l,this._x0=r,this._y0=i,this._x1=c,this._y1=u,this._root=void 0}function f0(t){for(var l={data:t.data},r=l;t=t.next;)r=r.next={data:t.data};return l}var jn=Sh.prototype=jh.prototype;jn.copy=function(){var t=new jh(this._x,this._y,this._x0,this._y0,this._x1,this._y1),l=this._root,r,i;if(!l)return t;if(!l.length)return t._root=f0(l),t;for(r=[{source:l,target:t._root=new Array(4)}];l=r.pop();)for(var c=0;c<4;++c)(i=l.source[c])&&(i.length?r.push({source:i,target:l.target[c]=new Array(4)}):l.target[c]=f0(i));return t};jn.add=dj;jn.addAll=hj;jn.cover=mj;jn.data=xj;jn.extent=pj;jn.find=yj;jn.remove=gj;jn.removeAll=bj;jn.root=vj;jn.size=wj;jn.visit=kj;jn.visitAfter=Sj;jn.x=Cj;jn.y=Nj;function ga(t){return function(){return t}}function Hr(t){return(t()-.5)*1e-6}function Aj(t){return t.x+t.vx}function Tj(t){return t.y+t.vy}function Dj(t){var l,r,i,c=1,u=1;typeof t!="function"&&(t=ga(t==null?1:+t));function f(){for(var d,g=l.length,y,b,v,j,S,E,C=0;C<u;++C)for(y=Sh(l,Aj,Tj).visitAfter(m),d=0;d<g;++d)b=l[d],S=r[b.index],E=S*S,v=b.x+b.vx,j=b.y+b.vy,y.visit(A);function A(M,F,L,O,U){var X=M.data,ne=M.r,D=S+ne;if(X){if(X.index>b.index){var Y=v-X.x-X.vx,R=j-X.y-X.vy,Q=Y*Y+R*R;Q<D*D&&(Y===0&&(Y=Hr(i),Q+=Y*Y),R===0&&(R=Hr(i),Q+=R*R),Q=(D-(Q=Math.sqrt(Q)))/Q*c,b.vx+=(Y*=Q)*(D=(ne*=ne)/(E+ne)),b.vy+=(R*=Q)*D,X.vx-=Y*(D=1-D),X.vy-=R*D)}return}return F>v+D||O<v-D||L>j+D||U<j-D}}function m(d){if(d.data)return d.r=r[d.data.index];for(var g=d.r=0;g<4;++g)d[g]&&d[g].r>d.r&&(d.r=d[g].r)}function x(){if(l){var d,g=l.length,y;for(r=new Array(g),d=0;d<g;++d)y=l[d],r[y.index]=+t(y,d,l)}}return f.initialize=function(d,g){l=d,i=g,x()},f.iterations=function(d){return arguments.length?(u=+d,f):u},f.strength=function(d){return arguments.length?(c=+d,f):c},f.radius=function(d){return arguments.length?(t=typeof d=="function"?d:ga(+d),x(),f):t},f}function zj(t){return t.index}function d0(t,l){var r=t.get(l);if(!r)throw new Error("node not found: "+l);return r}function Mj(t){var l=zj,r=y,i,c=ga(30),u,f,m,x,d,g=1;t==null&&(t=[]);function y(E){return 1/Math.min(m[E.source.index],m[E.target.index])}function b(E){for(var C=0,A=t.length;C<g;++C)for(var M=0,F,L,O,U,X,ne,D;M<A;++M)F=t[M],L=F.source,O=F.target,U=O.x+O.vx-L.x-L.vx||Hr(d),X=O.y+O.vy-L.y-L.vy||Hr(d),ne=Math.sqrt(U*U+X*X),ne=(ne-u[M])/ne*E*i[M],U*=ne,X*=ne,O.vx-=U*(D=x[M]),O.vy-=X*D,L.vx+=U*(D=1-D),L.vy+=X*D}function v(){if(f){var E,C=f.length,A=t.length,M=new Map(f.map((L,O)=>[l(L,O,f),L])),F;for(E=0,m=new Array(C);E<A;++E)F=t[E],F.index=E,typeof F.source!="object"&&(F.source=d0(M,F.source)),typeof F.target!="object"&&(F.target=d0(M,F.target)),m[F.source.index]=(m[F.source.index]||0)+1,m[F.target.index]=(m[F.target.index]||0)+1;for(E=0,x=new Array(A);E<A;++E)F=t[E],x[E]=m[F.source.index]/(m[F.source.index]+m[F.target.index]);i=new Array(A),j(),u=new Array(A),S()}}function j(){if(f)for(var E=0,C=t.length;E<C;++E)i[E]=+r(t[E],E,t)}function S(){if(f)for(var E=0,C=t.length;E<C;++E)u[E]=+c(t[E],E,t)}return b.initialize=function(E,C){f=E,d=C,v()},b.links=function(E){return arguments.length?(t=E,v(),b):t},b.id=function(E){return arguments.length?(l=E,b):l},b.iterations=function(E){return arguments.length?(g=+E,b):g},b.strength=function(E){return arguments.length?(r=typeof E=="function"?E:ga(+E),j(),b):r},b.distance=function(E){return arguments.length?(c=typeof E=="function"?E:ga(+E),S(),b):c},b}var Fj={value:()=>{}};function cg(){for(var t=0,l=arguments.length,r={},i;t<l;++t){if(!(i=arguments[t]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new wc(r)}function wc(t){this._=t}function Rj(t,l){return t.trim().split(/^|\s+/).map(function(r){var i="",c=r.indexOf(".");if(c>=0&&(i=r.slice(c+1),r=r.slice(0,c)),r&&!l.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}wc.prototype=cg.prototype={constructor:wc,on:function(t,l){var r=this._,i=Rj(t+"",r),c,u=-1,f=i.length;if(arguments.length<2){for(;++u<f;)if((c=(t=i[u]).type)&&(c=_j(r[c],t.name)))return c;return}if(l!=null&&typeof l!="function")throw new Error("invalid callback: "+l);for(;++u<f;)if(c=(t=i[u]).type)r[c]=h0(r[c],t.name,l);else if(l==null)for(c in r)r[c]=h0(r[c],t.name,null);return this},copy:function(){var t={},l=this._;for(var r in l)t[r]=l[r].slice();return new wc(t)},call:function(t,l){if((c=arguments.length-2)>0)for(var r=new Array(c),i=0,c,u;i<c;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(u=this._[t],i=0,c=u.length;i<c;++i)u[i].value.apply(l,r)},apply:function(t,l,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],c=0,u=i.length;c<u;++c)i[c].value.apply(l,r)}};function _j(t,l){for(var r=0,i=t.length,c;r<i;++r)if((c=t[r]).name===l)return c.value}function h0(t,l,r){for(var i=0,c=t.length;i<c;++i)if(t[i].name===l){t[i]=Fj,t=t.slice(0,i).concat(t.slice(i+1));break}return r!=null&&t.push({name:l,value:r}),t}var ci=0,ks=0,gs=0,ug=1e3,zc,Ss,Mc=0,va=0,Yc=0,Rs=typeof performance=="object"&&performance.now?performance:Date,fg=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function dg(){return va||(fg(Oj),va=Rs.now()+Yc)}function Oj(){va=0}function Zd(){this._call=this._time=this._next=null}Zd.prototype=hg.prototype={constructor:Zd,restart:function(t,l,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?dg():+r)+(l==null?0:+l),!this._next&&Ss!==this&&(Ss?Ss._next=this:zc=this,Ss=this),this._call=t,this._time=r,Jd()},stop:function(){this._call&&(this._call=null,this._time=1/0,Jd())}};function hg(t,l,r){var i=new Zd;return i.restart(t,l,r),i}function Bj(){dg(),++ci;for(var t=zc,l;t;)(l=va-t._time)>=0&&t._call.call(void 0,l),t=t._next;--ci}function m0(){va=(Mc=Rs.now())+Yc,ci=ks=0;try{Bj()}finally{ci=0,$j(),va=0}}function Lj(){var t=Rs.now(),l=t-Mc;l>ug&&(Yc-=l,Mc=t)}function $j(){for(var t,l=zc,r,i=1/0;l;)l._call?(i>l._time&&(i=l._time),t=l,l=l._next):(r=l._next,l._next=null,l=t?t._next=r:zc=r);Ss=t,Jd(i)}function Jd(t){if(!ci){ks&&(ks=clearTimeout(ks));var l=t-va;l>24?(t<1/0&&(ks=setTimeout(m0,t-Rs.now()-Yc)),gs&&(gs=clearInterval(gs))):(gs||(Mc=Rs.now(),gs=setInterval(Lj,ug)),ci=1,fg(m0))}}const Hj=1664525,Uj=1013904223,x0=4294967296;function Ij(){let t=1;return()=>(t=(Hj*t+Uj)%x0)/x0}function Yj(t){return t.x}function qj(t){return t.y}var Xj=10,Vj=Math.PI*(3-Math.sqrt(5));function Gj(t){var l,r=1,i=.001,c=1-Math.pow(i,1/300),u=0,f=.6,m=new Map,x=hg(y),d=cg("tick","end"),g=Ij();t==null&&(t=[]);function y(){b(),d.call("tick",l),r<i&&(x.stop(),d.call("end",l))}function b(S){var E,C=t.length,A;S===void 0&&(S=1);for(var M=0;M<S;++M)for(r+=(u-r)*c,m.forEach(function(F){F(r)}),E=0;E<C;++E)A=t[E],A.fx==null?A.x+=A.vx*=f:(A.x=A.fx,A.vx=0),A.fy==null?A.y+=A.vy*=f:(A.y=A.fy,A.vy=0);return l}function v(){for(var S=0,E=t.length,C;S<E;++S){if(C=t[S],C.index=S,C.fx!=null&&(C.x=C.fx),C.fy!=null&&(C.y=C.fy),isNaN(C.x)||isNaN(C.y)){var A=Xj*Math.sqrt(.5+S),M=S*Vj;C.x=A*Math.cos(M),C.y=A*Math.sin(M)}(isNaN(C.vx)||isNaN(C.vy))&&(C.vx=C.vy=0)}}function j(S){return S.initialize&&S.initialize(t,g),S}return v(),l={tick:b,restart:function(){return x.restart(y),l},stop:function(){return x.stop(),l},nodes:function(S){return arguments.length?(t=S,v(),m.forEach(j),l):t},alpha:function(S){return arguments.length?(r=+S,l):r},alphaMin:function(S){return arguments.length?(i=+S,l):i},alphaDecay:function(S){return arguments.length?(c=+S,l):+c},alphaTarget:function(S){return arguments.length?(u=+S,l):u},velocityDecay:function(S){return arguments.length?(f=1-S,l):1-f},randomSource:function(S){return arguments.length?(g=S,m.forEach(j),l):g},force:function(S,E){return arguments.length>1?(E==null?m.delete(S):m.set(S,j(E)),l):m.get(S)},find:function(S,E,C){var A=0,M=t.length,F,L,O,U,X;for(C==null?C=1/0:C*=C,A=0;A<M;++A)U=t[A],F=S-U.x,L=E-U.y,O=F*F+L*L,O<C&&(X=U,C=O);return X},on:function(S,E){return arguments.length>1?(d.on(S,E),l):d.on(S)}}}function Kj(){var t,l,r,i,c=ga(-30),u,f=1,m=1/0,x=.81;function d(v){var j,S=t.length,E=Sh(t,Yj,qj).visitAfter(y);for(i=v,j=0;j<S;++j)l=t[j],E.visit(b)}function g(){if(t){var v,j=t.length,S;for(u=new Array(j),v=0;v<j;++v)S=t[v],u[S.index]=+c(S,v,t)}}function y(v){var j=0,S,E,C=0,A,M,F;if(v.length){for(A=M=F=0;F<4;++F)(S=v[F])&&(E=Math.abs(S.value))&&(j+=S.value,C+=E,A+=E*S.x,M+=E*S.y);v.x=A/C,v.y=M/C}else{S=v,S.x=S.data.x,S.y=S.data.y;do j+=u[S.data.index];while(S=S.next)}v.value=j}function b(v,j,S,E){if(!v.value)return!0;var C=v.x-l.x,A=v.y-l.y,M=E-j,F=C*C+A*A;if(M*M/x<F)return F<m&&(C===0&&(C=Hr(r),F+=C*C),A===0&&(A=Hr(r),F+=A*A),F<f&&(F=Math.sqrt(f*F)),l.vx+=C*v.value*i/F,l.vy+=A*v.value*i/F),!0;if(v.length||F>=m)return;(v.data!==l||v.next)&&(C===0&&(C=Hr(r),F+=C*C),A===0&&(A=Hr(r),F+=A*A),F<f&&(F=Math.sqrt(f*F)));do v.data!==l&&(M=u[v.data.index]*i/F,l.vx+=C*M,l.vy+=A*M);while(v=v.next)}return d.initialize=function(v,j){t=v,r=j,g()},d.strength=function(v){return arguments.length?(c=typeof v=="function"?v:ga(+v),g(),d):c},d.distanceMin=function(v){return arguments.length?(f=v*v,d):Math.sqrt(f)},d.distanceMax=function(v){return arguments.length?(m=v*v,d):Math.sqrt(m)},d.theta=function(v){return arguments.length?(x=v*v,d):Math.sqrt(x)},d}const _s={tech:{bg:"rgba(59,130,246,0.15)",border:"#3b82f6",text:"#60a5fa"},market:{bg:"rgba(245,158,11,0.15)",border:"#f59e0b",text:"#fbbf24"},strategy:{bg:"rgba(139,92,246,0.15)",border:"#8b5cf6",text:"#a78bfa"},financial:{bg:"rgba(34,197,94,0.15)",border:"#22c55e",text:"#4ade80"},process:{bg:"rgba(236,72,153,0.15)",border:"#ec4899",text:"#f472b6"},competitor:{bg:"rgba(239,68,68,0.15)",border:"#ef4444",text:"#f87171"},domain:{bg:"rgba(14,165,233,0.15)",border:"#0ea5e9",text:"#38bdf8"},general:{bg:"rgba(148,163,184,0.12)",border:"#64748b",text:"#94a3b8"}};function Qj(t){return _s[t]??_s.general}function Wj({docs:t,onNodeClick:l,selectedDocId:r}){var Y;const i=k.useRef(null),c=k.useRef(null),[u,f]=k.useState({width:600,height:400}),[m,x]=k.useState({nodes:[],links:[]}),[d,g]=k.useState(null),[y,b]=k.useState(null),[v,j]=k.useState({x:0,y:0}),[S,E]=k.useState({x:0,y:0,w:600,h:400}),C=k.useRef(!1),A=k.useRef({x:0,y:0,vx:0,vy:0}),M=k.useRef(null),F=k.useRef(null);k.useEffect(()=>{const R=i.current;if(!R)return;const Q=new ResizeObserver(ee=>{const{width:V,height:I}=ee[0].contentRect;V>0&&I>0&&(f({width:V,height:I}),E(Z=>({...Z,w:V,h:I})))});return Q.observe(R),()=>Q.disconnect()},[]),k.useEffect(()=>{if(t.length===0)return;const R=new Set(t.map(ce=>ce.id)),Q=t.map(ce=>({id:ce.id,title:ce.title,category:ce.category,akb_type:ce.akb_type})),ee=[];for(const ce of t)for(const we of ce.links){const z=we.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,"");R.has(z)&&z!==ce.id&&(ee.some(B=>B.source===ce.id&&B.target===z||B.source===z&&B.target===ce.id)||ee.push({source:ce.id,target:z,label:we.text}))}const{width:V,height:I}=u,Z=Gj(Q).force("link",Mj(ee).id(ce=>ce.id).distance(140)).force("charge",Kj().strength(-400)).force("center",fj(V/2,I/2)).force("collide",Dj(50));F.current=Z,Z.on("tick",()=>{for(const ce of Q)ce.x=Math.max(60,Math.min(V-60,ce.x??V/2)),ce.y=Math.max(60,Math.min(I-60,ce.y??I/2));x({nodes:[...Q],links:[...ee]})}),Z.alpha(1).restart();for(let ce=0;ce<150;ce++)Z.tick();return Z.stop(),x({nodes:[...Q],links:[...ee]}),()=>{Z.stop()}},[t,u]);const L=R=>{if(typeof R=="string"){const Q=m.nodes.find(ee=>ee.id===R);return{x:(Q==null?void 0:Q.x)??0,y:(Q==null?void 0:Q.y)??0}}return{x:R.x??0,y:R.y??0}},O=k.useCallback(R=>{R.preventDefault();const Q=R.deltaY>0?1.1:.9;E(ee=>{const V=Math.max(200,Math.min(u.width*3,ee.w*Q)),I=Math.max(150,Math.min(u.height*3,ee.h*Q)),Z=(V-ee.w)/2,ce=(I-ee.h)/2;return{x:ee.x-Z,y:ee.y-ce,w:V,h:I}})},[u]),U=k.useCallback(R=>{R.button===0&&(C.current=!0,A.current={x:R.clientX,y:R.clientY,vx:S.x,vy:S.y})},[S]),X=k.useCallback(R=>{var Q;if(M.current){const ee=c.current;if(!ee)return;const V=ee.getBoundingClientRect(),I=S.w/V.width,Z=S.h/V.height,ce=S.x+(R.clientX-V.left)*I,we=S.y+(R.clientY-V.top)*Z;M.current.fx=ce,M.current.fy=we,(Q=F.current)==null||Q.alpha(.3).restart();return}if(C.current){const ee=(R.clientX-A.current.x)*(S.w/u.width),V=(R.clientY-A.current.y)*(S.h/u.height);E(I=>({...I,x:A.current.vx-ee,y:A.current.vy-V}))}},[S,u]),ne=k.useCallback(()=>{C.current=!1,M.current&&(M.current.fx=null,M.current.fy=null,M.current=null)},[]),D=k.useCallback((R,Q)=>{var ee;R.stopPropagation(),M.current=Q,(ee=F.current)==null||ee.alpha(.3).restart()},[]);return o.jsxs("div",{ref:i,className:"relative flex-1 overflow-hidden",style:{background:"#1e1e2e"},children:[o.jsxs("svg",{ref:c,width:u.width,height:u.height,viewBox:`${S.x} ${S.y} ${S.w} ${S.h}`,style:{display:"block",cursor:C.current?"grabbing":"grab"},onWheel:O,onMouseDown:U,onMouseMove:X,onMouseUp:ne,onMouseLeave:ne,children:[o.jsx("defs",{children:o.jsx("pattern",{id:"grid",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:o.jsx("circle",{cx:"0",cy:"0",r:"0.5",fill:"rgba(255,255,255,0.06)"})})}),o.jsx("rect",{x:S.x-100,y:S.y-100,width:S.w+200,height:S.h+200,fill:"url(#grid)",pointerEvents:"none"}),m.links.map((R,Q)=>{const ee=L(R.source),V=L(R.target),I=y===Q,Z=(ee.x+V.x)/2,ce=(ee.y+V.y)/2;return o.jsxs("g",{children:[o.jsx("line",{x1:ee.x,y1:ee.y,x2:V.x,y2:V.y,stroke:"transparent",strokeWidth:12,style:{cursor:"default"},onMouseEnter:()=>b(Q),onMouseLeave:()=>b(null)}),o.jsx("line",{x1:ee.x,y1:ee.y,x2:V.x,y2:V.y,stroke:I?"rgba(148,163,184,0.7)":"rgba(148,163,184,0.3)",strokeWidth:I?2:1.5,strokeDasharray:"4 3",pointerEvents:"none"}),I&&R.label&&o.jsx("text",{x:Z,y:ce-6,textAnchor:"middle",fill:"#e2e8f0",fontSize:9,fontFamily:"monospace",style:{pointerEvents:"none"},children:o.jsx("tspan",{style:{filter:"drop-shadow(0 0 2px rgba(0,0,0,0.8))"},children:R.label.length>30?R.label.slice(0,28)+"..":R.label})})]},Q)}),m.nodes.map(R=>{const Q=_s[R.category]??_s.general,ee=R.akb_type==="hub",V=ee?24:16,I=(d==null?void 0:d.id)===R.id,Z=r===R.id,ce=I?1.2:Z?1.15:1;return o.jsxs("g",{transform:`translate(${R.x??0}, ${R.y??0}) scale(${ce})`,style:{cursor:"pointer",transition:"transform 0.15s ease"},onClick:we=>{we.stopPropagation();const z=t.find(B=>B.id===R.id);z&&l(z)},onMouseDown:we=>D(we,R),onMouseEnter:we=>{var B;g(R);const z=(B=i.current)==null?void 0:B.getBoundingClientRect();z&&j({x:we.clientX-z.left,y:we.clientY-z.top})},onMouseLeave:()=>g(null),children:[Z&&o.jsx("rect",{x:-V/2-4,y:-V/2-4,width:V+8,height:V+8,fill:"none",stroke:"#22c55e",strokeWidth:2,rx:ee?5:2,opacity:.6}),o.jsx("rect",{x:-V/2,y:-V/2,width:V,height:V,fill:Q.border,rx:ee?4:2,opacity:I?1:.9}),o.jsx("rect",{x:-V/2+3,y:-V/2+3,width:Math.max(0,V-6),height:Math.max(0,V-6),fill:Q.bg,rx:ee?3:1}),o.jsx("text",{y:V/2+14,textAnchor:"middle",fill:Z?"#e2e8f0":"#94a3b8",fontSize:11,fontFamily:"monospace",fontWeight:Z?"bold":"normal",style:{pointerEvents:"none"},children:R.title.length>24?R.title.slice(0,22)+"..":R.title})]},R.id)})]}),d&&!M.current&&o.jsxs("div",{className:"absolute z-10 pointer-events-none p-2.5 rounded text-xs max-w-[240px]",style:{left:Math.min(v.x+16,u.width-250),top:Math.max(v.y-30,8),background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",boxShadow:"0 4px 12px rgba(0,0,0,0.4)"},children:[o.jsx("div",{className:"font-bold mb-1",children:d.title}),o.jsxs("div",{className:"text-[10px] opacity-60 mb-1",children:[d.akb_type.toUpperCase()," / ",d.category]}),((Y=t.find(R=>R.id===d.id))==null?void 0:Y.tldr)&&o.jsx("div",{className:"text-[10px] opacity-80 mb-1",children:t.find(R=>R.id===d.id).tldr}),o.jsx("div",{className:"text-[10px] text-green-400",children:"Click to open | Drag to move"})]}),t.length===0&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"No knowledge documents found"})]})}function Zj({doc:t,allDocs:l,onOpen:r,onNavigateDoc:i}){const[c,u]=k.useState(!1),f=Qj(t.category),m=t.akb_type==="hub",x=new Set(l.map(d=>d.id));return o.jsxs("div",{className:"mb-2 rounded-lg overflow-hidden",style:{background:m?"rgba(22,163,106,0.08)":"var(--hud-bg-alt)",border:`2px solid ${m?"rgba(22,163,106,0.4)":"var(--terminal-border)"}`},children:[o.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>u(!c),children:[o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("span",{className:"shrink-0 text-sm",children:m?"🗂":t.format==="html"?"🌐":"📄"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[o.jsx("span",{className:"font-semibold text-xs truncate",style:{color:"var(--terminal-text)"},children:t.title}),o.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:t.status==="active"?"#16a34a":t.status==="draft"?"#f59e0b":"#94a3b8"},title:t.status})]}),o.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:t.tags.slice(0,4).map(d=>o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium",style:{background:f.bg,color:f.text,border:`1px solid ${f.border}`},children:d},d))})]}),o.jsx("span",{className:"text-xs shrink-0",style:{color:"var(--terminal-text-muted)"},children:c?"▲":"▼"})]}),!c&&t.tldr&&o.jsx("div",{className:"mt-1.5 text-[10px] line-clamp-2 ml-6",style:{color:"var(--terminal-text-secondary)"},children:t.tldr})]}),c&&o.jsxs("div",{className:"px-3 pb-3",style:{borderTop:"1px solid var(--terminal-border)"},children:[t.tldr&&o.jsx("div",{className:"mt-2 text-[11px] leading-relaxed italic",style:{color:"var(--terminal-text-secondary)"},children:t.tldr}),t.links.length>0&&o.jsxs("div",{className:"mt-2",children:[o.jsx("div",{className:"text-[9px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Cross-links"}),o.jsx("div",{className:"flex flex-wrap gap-1",children:t.links.slice(0,5).map((d,g)=>{const y=d.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,""),b=x.has(y);return o.jsxs("span",{className:`px-1.5 py-0.5 text-[9px] rounded ${b?"cursor-pointer hover:opacity-70":""}`,style:{background:b?"rgba(22,163,106,0.15)":"rgba(148,163,184,0.1)",color:b?"#4ade80":"var(--terminal-text-muted)",border:`1px solid ${b?"rgba(22,163,106,0.3)":"var(--terminal-border)"}`},onClick:v=>{b&&(v.stopPropagation(),i(y))},children:["🔗"," ",d.text]},g)})})]}),o.jsxs("button",{className:"mt-2 text-[10px] font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},onClick:d=>{d.stopPropagation(),r(t)},children:["Open full ","→"]})]})]})}function Jj({docId:t,onBack:l,onDocUpdated:r,onDelete:i,onNavigateDoc:c,allDocs:u}){const[f,m]=k.useState(null),[x,d]=k.useState(!0),[g,y]=k.useState(!1),[b,v]=k.useState(""),[j,S]=k.useState(!1),E=new Set(u.map(L=>L.id)),C=k.useCallback(L=>{const O=L.split("#")[0];if(!O.match(/\.(md|html)$/))return null;const U=t.includes("/")?t.replace(/\/[^/]+$/,""):"";let X;if(O.startsWith("./"))X=U?`${U}/${O.slice(2)}`:O.slice(2);else if(O.startsWith("../")){const Y=U.split("/").filter(Boolean);let R=O;for(;R.startsWith("../");)Y.length>0&&Y.pop(),R=R.slice(3);X=Y.length>0?`${Y.join("/")}/${R}`:R}else X=O;if(E.has(X))return X;const ne=X.split("/").pop()??"",D=u.find(Y=>Y.id===ne||Y.id.endsWith("/"+ne));return D?D.id:null},[t,E,u]),A=k.useCallback(L=>{const U=L.target.closest("a");if(!U)return;const X=U.getAttribute("href");if(!X||X.startsWith("http://")||X.startsWith("https://")||!X.match(/\.(md|html)(#.*)?$/))return;L.preventDefault(),L.stopPropagation();const ne=C(X);ne&&c(ne)},[C,c]);k.useEffect(()=>{d(!0),Ce.getKnowledgeDoc(t).then(L=>{m(L),v(L.content)}).catch(console.error).finally(()=>d(!1))},[t]);const M=async()=>{if(f){S(!0);try{await Ce.updateKnowledgeDoc(t,b),m({...f,content:b}),y(!1),r()}catch(L){console.error("Save failed:",L)}finally{S(!1)}}},F=async()=>{if(confirm(`Delete "${f==null?void 0:f.title}"?`))try{await Ce.deleteKnowledgeDoc(t),i(t)}catch(L){console.error("Delete failed:",L)}};return x?o.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Loading..."}):f?o.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col",children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Back"]}),o.jsx("div",{className:"flex-1"}),g?o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>{y(!1),v(f.content)},className:"px-2.5 py-1 text-[10px] rounded cursor-pointer",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Cancel"}),o.jsx("button",{onClick:M,disabled:j,className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold text-white",style:{background:j?"#86efac":"#16a34a"},children:j?"Saving...":"Save"})]}):o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>y(!0),className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa",border:"1px solid rgba(59,130,246,0.3)"},children:"Edit"}),o.jsx("button",{onClick:F,className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold",style:{background:"rgba(239,68,68,0.15)",color:"#f87171",border:"1px solid rgba(239,68,68,0.3)"},children:"Delete"})]})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[o.jsx("h2",{className:"text-sm font-bold mb-1",style:{color:"var(--terminal-text)"},children:f.title}),f.tldr&&!g&&o.jsx("div",{className:"mb-3 text-xs italic",style:{color:"var(--terminal-text-secondary)"},children:f.tldr}),f.format==="html"?g?o.jsx("textarea",{className:"w-full h-full min-h-[400px] p-3 text-xs leading-relaxed rounded border resize-y",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',background:"var(--hud-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},value:b,onChange:L=>v(L.target.value),spellCheck:!1}):o.jsx("iframe",{srcDoc:f.content,sandbox:"allow-same-origin",className:"w-full flex-1 min-h-[400px] rounded",style:{border:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},title:f.title}):g?o.jsx("textarea",{className:"w-full h-full min-h-[400px] p-3 text-xs leading-relaxed rounded border resize-y",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',background:"#1e1e2e",color:"#e2e8f0",border:"1px solid #334155"},value:b,onChange:L=>v(L.target.value),spellCheck:!1}):o.jsx("div",{className:"text-xs leading-relaxed",style:{color:"var(--terminal-text-secondary)"},onClick:A,children:o.jsx(Hs,{content:f.content})})]})]}):o.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Failed to load document"})}function Pj({onCreated:t,onCancel:l}){const[r,i]=k.useState(""),[c,u]=k.useState(""),[f,m]=k.useState(""),[x,d]=k.useState(!1),[g,y]=k.useState("");k.useEffect(()=>{if(!r){u("");return}const v=r.toLowerCase().replace(/[^a-z0-9가-힣\s-]/g,"").replace(/\s+/g,"-").slice(0,60);u(v)},[r]);const b=async()=>{if(!r.trim()||!c.trim()){y("Title and filename are required");return}d(!0),y("");try{const v=await Ce.createKnowledgeDoc({filename:c,title:r,category:f||void 0});t(v.id)}catch(v){y(v instanceof Error?v.message:"Failed to create")}finally{d(!1)}};return o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[o.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Cancel"]}),o.jsx("h2",{className:"text-sm font-bold",style:{color:"var(--terminal-text)"},children:"New Document"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"TITLE"}),o.jsx("input",{type:"text",value:r,onChange:v=>i(v.target.value),placeholder:"Document title...",className:"w-full px-3 py-2 text-xs rounded focus:outline-none",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"FILENAME"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("input",{type:"text",value:c,onChange:v=>u(v.target.value),className:"flex-1 px-3 py-2 text-xs rounded focus:outline-none font-mono",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}}),o.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:".md"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"CATEGORY (optional)"}),o.jsx("input",{type:"text",value:f,onChange:v=>m(v.target.value),placeholder:"e.g., tech, market, strategy",className:"w-full px-3 py-2 text-xs rounded focus:outline-none",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}})]}),g&&o.jsx("div",{className:"text-[10px] px-3 py-1.5 rounded",style:{background:"rgba(239,68,68,0.15)",color:"#f87171"},children:g}),o.jsx("button",{onClick:b,disabled:x||!r.trim(),className:"w-full py-2 text-xs font-semibold rounded cursor-pointer text-white",style:{background:x?"#86efac":"#16a34a"},children:x?"Creating...":"Create Document"})]})]})}const eC=500,p0=360,y0=700;function Ch(t){const[l,r]=k.useState(eC),[i,c]=k.useState(!1),u=k.useRef(0),f=k.useRef(0),m=t>0,x=m?t:0,d=m?Math.max(p0,window.innerWidth-t-100):y0,g=Math.min(l,d),y=k.useCallback(b=>{b.preventDefault(),u.current=b.clientX,f.current=g,c(!0);const v=S=>{const E=u.current-S.clientX,C=Math.min(y0,Math.max(p0,f.current+E));r(C)},j=()=>{c(!1),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",j)};document.addEventListener("mousemove",v),document.addEventListener("mouseup",j)},[g]);return{panelRight:x,panelWidth:g,isResizing:i,handleResizeStart:y}}function tC({docs:t,onClose:l,onRefresh:r,terminalWidth:i=0,initialDocId:c}){const[u,f]=k.useState("list"),[m,x]=k.useState("all"),[d,g]=k.useState(c??null),[y,b]=k.useState(""),[v,j]=k.useState(!1),[S,E]=k.useState(null),{panelRight:C,panelWidth:A,isResizing:M,handleResizeStart:F}=Ch(i),L=["all",...Array.from(new Set(t.map(Y=>Y.category))).sort()],O=t.filter(Y=>{if(m!=="all"&&Y.category!==m)return!1;if(y){const R=y.toLowerCase();return Y.title.toLowerCase().includes(R)||(Y.tldr??"").toLowerCase().includes(R)||Y.tags.some(Q=>Q.toLowerCase().includes(R))}return!0}),U=Y=>{j(!1),r(),g(Y)},X=Y=>{g(null),r()},ne=Y=>{E(Y.id)},D=S?t.find(Y=>Y.id===S):null;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:C},onClick:l}),o.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${M?"resizing":""}`,style:{right:C,width:A,background:"var(--terminal-bg)",borderLeftColor:"#16a34a"},children:[o.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${M?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:F}),o.jsxs("div",{className:"p-5 text-white relative",style:{background:"#16a34a"},children:[o.jsx("button",{onClick:l,className:"absolute top-3 right-3 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),o.jsxs("div",{className:"text-lg font-bold",children:["📚"," Knowledge Base"]}),o.jsxs("div",{className:"text-xs opacity-80 mt-0.5",children:[t.length," documents"]})]}),o.jsxs("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx(g0,{label:"List",active:u==="list",onClick:()=>{f("list"),E(null)}}),o.jsx(g0,{label:"Graph",active:u==="graph",onClick:()=>f("graph")})]}),u==="list"&&!d&&!v&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx("input",{type:"text",value:y,onChange:Y=>b(Y.target.value),placeholder:"Search docs...",className:"flex-1 px-2.5 py-1.5 text-[11px] rounded focus:outline-none",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}}),o.jsx("button",{onClick:()=>j(!0),className:"px-2.5 py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white shrink-0",style:{background:"#16a34a"},children:"+ New"})]}),o.jsx("div",{className:"flex overflow-x-auto shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",scrollbarWidth:"none"},children:L.map(Y=>o.jsx("button",{onClick:()=>x(Y),className:"px-3 py-1.5 text-[10px] font-medium cursor-pointer whitespace-nowrap",style:{color:m===Y?"#4ade80":"var(--terminal-text-muted)",borderBottom:m===Y?"2px solid #4ade80":"2px solid transparent"},children:Y==="all"?`All (${t.length})`:`${Y} (${t.filter(R=>R.category===Y).length})`},Y))}),o.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:O.length===0?o.jsx("div",{className:"text-center text-xs py-8",style:{color:"var(--terminal-text-muted)"},children:y?"No matching documents":"No documents in this category"}):O.map(Y=>o.jsx(Zj,{doc:Y,allDocs:t,onOpen:R=>g(R.id),onNavigateDoc:R=>g(R)},Y.id))})]}),u==="list"&&d&&!v&&o.jsx(Jj,{docId:d,onBack:()=>g(null),onDocUpdated:r,onDelete:X,onNavigateDoc:Y=>g(Y),allDocs:t}),u==="list"&&v&&o.jsx(Pj,{onCreated:U,onCancel:()=>j(!1)}),u==="graph"&&o.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[o.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[o.jsx(Wj,{docs:t,onNodeClick:ne,selectedDocId:S}),D&&o.jsxs("div",{className:"shrink-0 overflow-y-auto p-3",style:{width:200,background:"var(--hud-bg-alt)",borderLeft:"1px solid var(--terminal-border)"},children:[o.jsx("div",{className:"text-[10px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Selected"}),o.jsx("div",{className:"text-xs font-bold mb-1",style:{color:"var(--terminal-text)"},children:D.title}),o.jsx("div",{className:"w-2 h-2 rounded-full mb-2",style:{background:D.status==="active"?"#16a34a":D.status==="draft"?"#f59e0b":"#94a3b8"}}),D.tldr&&o.jsx("div",{className:"text-[10px] mb-2 leading-relaxed",style:{color:"var(--terminal-text-secondary)"},children:D.tldr}),D.links.length>0&&o.jsxs("div",{className:"mb-2",children:[o.jsx("div",{className:"text-[9px] font-bold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Links"}),D.links.slice(0,5).map((Y,R)=>o.jsxs("div",{className:"text-[9px] mb-0.5 truncate",style:{color:"var(--terminal-text-secondary)"},children:["🔗"," ",Y.text]},R))]}),o.jsx("button",{className:"w-full py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white",style:{background:"#16a34a"},onClick:()=>{f("list"),g(D.id),E(null)},children:"Open Document"})]})]}),o.jsx("div",{className:"shrink-0 p-2",style:{borderTop:"1px solid var(--terminal-border)"},children:o.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(_s).map(([Y,R])=>o.jsxs("div",{className:"flex items-center gap-1 text-[9px]",children:[o.jsx("div",{className:"w-2 h-2",style:{background:R.border}}),o.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:Y})]},Y))})})]})]})]})}function g0({label:t,active:l,onClick:r}){return o.jsx("button",{onClick:r,className:"px-4 py-2.5 text-sm font-medium cursor-pointer",style:{color:l?"#4ade80":"var(--terminal-text-muted)",borderBottom:l?"2px solid #4ade80":"2px solid transparent"},children:t})}function nC({standups:t,waves:l,decisions:r,mode:i,onClose:c,terminalWidth:u=0}){const[f,m]=k.useState(i==="decisions"?"decisions":"standups"),{panelRight:x,panelWidth:d,isResizing:g,handleResizeStart:y}=Ch(u);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:x},onClick:c}),o.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${g?"resizing":""}`,style:{right:x,width:d,background:"var(--terminal-bg)",borderLeftColor:"var(--desk-wood)"},children:[o.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${g?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:y}),o.jsxs("div",{className:"p-5 bg-[var(--desk-wood)] text-white relative",children:[o.jsx("button",{onClick:c,className:"absolute top-3 right-3 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),o.jsx("div",{className:"text-lg font-bold",children:i==="bulletin"?"📌 Bulletin Board":"📜 Decision Log"})]}),o.jsx("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:i==="bulletin"?o.jsxs(o.Fragment,{children:[o.jsx(vd,{label:`Standups (${t.length})`,active:f==="standups",onClick:()=>m("standups")}),o.jsx(vd,{label:`Waves (${l.length})`,active:f==="waves",onClick:()=>m("waves")})]}):o.jsx(vd,{label:`Decisions (${r.length})`,active:f==="decisions",onClick:()=>m("decisions")})}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[f==="standups"&&t.map((b,v)=>o.jsx(wd,{title:`Standup ${b.date}`,content:b.content},v)),f==="waves"&&l.map((b,v)=>o.jsx(wd,{title:`Wave ${b.id}`,subtitle:b.timestamp,content:b.content},v)),f==="decisions"&&r.map((b,v)=>o.jsx(wd,{title:`#${b.id} ${b.title}`,subtitle:b.date,content:b.content},v))]})]})]})}function vd({label:t,active:l,onClick:r}){return o.jsx("button",{onClick:r,className:"px-4 py-2.5 text-sm font-medium cursor-pointer",style:{color:l?"var(--accent)":"var(--terminal-text-muted)",borderBottom:l?"2px solid var(--accent)":"2px solid transparent"},children:t})}function lC(t){return t.replace(/^#{1,6}\s+/gm,"").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/```[\s\S]*?```/g,"").replace(/^\s*[-*+]\s+/gm,"• ").replace(/^\s*\d+\.\s+/gm,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/^>\s+/gm,"").replace(/^---+$/gm,"").replace(/\|[^|]*\|/g,"").replace(/\n{2,}/g," · ").replace(/\n/g," ").trim()}function wd({title:t,subtitle:l,content:r}){const[i,c]=k.useState(!1),u=r.length>100,f=lC(r).slice(0,160);return o.jsxs("div",{className:"mb-3 rounded-lg overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>c(!i),children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"font-medium text-sm",style:{color:"var(--terminal-text)"},children:t}),o.jsx("span",{className:"text-xs shrink-0 ml-2",style:{color:"var(--terminal-text-muted)"},children:i?"▲":"▼"})]}),l&&o.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--terminal-text-muted)"},children:l})]}),i&&o.jsx("div",{className:"px-3 pb-3 text-xs leading-relaxed pt-2",style:{borderTop:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:o.jsx(Hs,{content:r})}),!i&&u&&o.jsx("div",{className:"px-3 pb-2 text-xs line-clamp-2 leading-relaxed",style:{color:"var(--terminal-text-muted)"},children:f})]})}function rC({projectId:t,onClose:l,terminalWidth:r=0}){const[i,c]=k.useState(null),{panelRight:u,panelWidth:f,isResizing:m,handleResizeStart:x}=Ch(r);if(k.useEffect(()=>{Ce.getProject(t).then(c).catch(console.error)},[t]),!i)return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),o.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px] border-[var(--meeting-blue)]",style:{right:u,width:f,background:"var(--terminal-bg)"},children:o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading project..."})})]});const d=i.tasks.filter(b=>b.status==="done").length,g=i.tasks.length,y=g>0?Math.round(d/g*100):0;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),o.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] border-[var(--meeting-blue)] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${m?"resizing":""}`,style:{right:u,width:f,background:"var(--terminal-bg)"},children:[o.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${m?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:x}),o.jsxs("div",{className:"p-5 bg-[var(--meeting-blue)] text-white relative",children:[o.jsx("div",{className:"text-sm opacity-70",children:"Meeting Room"}),o.jsx("button",{onClick:l,className:"absolute top-3 right-3 z-10 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),o.jsx("div",{className:"text-xl font-bold mt-1",children:i.name}),o.jsxs("div",{className:"flex items-center gap-3 mt-3 text-sm",children:[o.jsxs("span",{children:["Tasks: ",g]}),o.jsxs("span",{children:["Done: ",d]}),o.jsxs("span",{children:["Progress: ",y,"%"]})]}),o.jsx("div",{className:"mt-2 h-1.5 bg-white/20 rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full bg-white rounded-full transition-all",style:{width:`${y}%`}})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[i.prd&&o.jsxs("div",{className:"mb-5",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"PRD"}),o.jsx("div",{className:"rounded-lg p-4 text-xs leading-relaxed max-h-60 overflow-y-auto",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:o.jsx(Hs,{content:i.prd})})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:["Tasks (",g,")"]}),o.jsx("div",{className:"space-y-2",children:i.tasks.map(b=>o.jsxs("div",{className:"rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium",style:{color:"var(--terminal-text)"},children:b.title}),o.jsx(aC,{status:b.status})]}),o.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-muted)"},children:b.role}),b.description&&o.jsx("div",{className:"text-xs mt-1.5 line-clamp-2",style:{color:"var(--terminal-text-secondary)"},children:b.description})]},b.id))})]})]})]})]})}function aC({status:t}){const l={done:{bg:"rgba(34,197,94,0.15)",color:"#4ade80"},"in-progress":{bg:"rgba(59,130,246,0.15)",color:"#60a5fa"},todo:{bg:"rgba(148,163,184,0.15)",color:"var(--terminal-text-muted)"}},r=l[t]??l.todo;return o.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:r.bg,color:r.color},children:t})}const iC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function sC({roleId:t,roleName:l,mode:r="assign",onClose:i,onExecutionStart:c}){const[u,f]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const x=()=>{u.trim()&&(c(t,u.trim()),i())},d=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&x(),y.key==="Escape"&&i()},g=iC[t]??"#666";return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),o.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[520px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[o.jsxs("div",{className:"p-5 text-white",style:{background:`linear-gradient(135deg, ${g}, ${g}cc)`},children:[o.jsx("div",{className:"text-lg font-bold",children:r==="ask"?"Ask":"Assign Task"}),o.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:r==="ask"?`to ${l}`:`to ${l} (${t})`})]}),o.jsxs("div",{className:"p-5",children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Task Description"}),o.jsx("textarea",{ref:m,value:u,onChange:y=>f(y.target.value),onKeyDown:d,placeholder:r==="ask"?"What would you like to ask?":"Describe the task...",className:"w-full h-32 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),o.jsx("div",{className:"text-[10px] text-white/30 mt-1",children:"Cmd+Enter to submit"})]}),o.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[o.jsx("button",{onClick:i,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),o.jsx("button",{onClick:x,disabled:!u.trim(),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:g},children:r==="ask"?"Ask":"Assign"})]})]})]})}const b0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function mg({event:t,isThinkingCollapsed:l,onToggleThinking:r,onNavigateToJob:i,onOpenKnowledgeDoc:c,compact:u}){var m;const f=b0[t.roleId]??"#888";switch(t.type){case"text":return o.jsx("div",{className:"text-green-300/90 whitespace-pre-wrap leading-relaxed",children:u?(t.data.text??"").slice(0,300):t.data.text});case"thinking":{const x=t.data.text??"";return o.jsxs("div",{className:"group",children:[o.jsxs("button",{onClick:r,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-[10px] cursor-pointer flex items-center gap-1",children:[o.jsx("span",{children:l?"▶":"▼"}),o.jsx("span",{className:"italic",children:"thinking..."})]}),!l&&o.jsxs("div",{className:`ml-3 text-[var(--terminal-text-muted)] italic whitespace-pre-wrap opacity-60 text-[11px] overflow-y-auto ${u?"max-h-[60px]":"max-h-[120px]"}`,children:[x.slice(0,u?200:500),x.length>(u?200:500)?"...":""]})]})}case"tool:start":{const x=String(t.data.name??""),d=t.data.input,g=typeof(d==null?void 0:d.command)=="string"?d.command.slice(0,80):"",y=typeof(d==null?void 0:d.file_path)=="string"?String(d.file_path):typeof(d==null?void 0:d.path)=="string"?String(d.path):"",b=y?y.split("/").pop()??"":"",v=/^(write_file|Write|edit_file|Edit)$/i.test(x),j=(m=y.match(/(?:^|\/)knowledge\/(.+\.md)$/))==null?void 0:m[1],S=v&&j&&c;return o.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[o.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${S?"text-green-400/80 bg-green-400/10":"text-blue-400/80 bg-blue-400/10"}`,children:S?v&&x.toLowerCase().includes("edit")?"Edit":"Write":x}),S?o.jsx("button",{onClick:()=>c(j),className:"text-[10px] text-green-400 hover:text-green-300 underline underline-offset-2 cursor-pointer truncate",style:{maxWidth:u?200:400},children:b}):o.jsxs(o.Fragment,{children:[g&&o.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:g}),b&&o.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:b})]})]})}case"dispatch:start":{const x=t.data.targetRoleId??t.data.roleId??"",d=t.data.task??"",g=t.data.childJobId,y=b0[x]??"#888";return o.jsx("div",{className:"my-1 p-2 rounded-lg border cursor-pointer hover:opacity-90 transition-opacity",style:{borderColor:`${y}44`,background:`${y}11`},onClick:()=>g&&(i==null?void 0:i(g)),children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{style:{color:y},className:"font-bold text-[11px]",children:["→"," ",x.toUpperCase()]}),o.jsx("span",{className:"text-[var(--terminal-text-secondary)] text-[10px] truncate flex-1",children:d.slice(0,u?60:100)}),g&&i&&o.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/10 text-[var(--terminal-text-muted)]",children:["View ","→"]})]})})}case"dispatch:done":return o.jsx("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pl-3 border-l-2 border-[var(--terminal-border)] my-0.5",children:"Dispatch completed"});case"turn:complete":return o.jsx("div",{className:"border-t border-[var(--terminal-border)] my-2 relative",children:o.jsxs("span",{className:"absolute -top-2 left-2 bg-[var(--terminal-bg)] px-2 text-[9px] text-[var(--terminal-text-muted)]",children:["Turn ",t.data.turn]})});case"stderr":return o.jsxs("div",{className:"text-red-400/80 text-[11px]",children:["⚠"," ",t.data.message]});case"job:start":return o.jsxs("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pb-1",children:[o.jsx("span",{style:{color:f},className:"font-bold",children:t.roleId.toUpperCase()})," ","started: ",(t.data.task??"").slice(0,u?50:80)]});case"job:done":{const x=t.data.turns??0,d=t.data.toolCalls??0;return o.jsx("div",{className:"mt-2 p-2 rounded-lg bg-green-900/20 border border-green-800/30",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-green-400"}),o.jsx("span",{className:"text-green-300 font-bold text-[11px]",children:"Complete"}),o.jsxs("span",{className:"text-[var(--terminal-text-muted)] text-[10px]",children:[x," turns · ",d," tools"]})]})})}case"job:error":return o.jsx("div",{className:"mt-2 p-2 rounded-lg bg-red-900/20 border border-red-800/30",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-red-400"}),o.jsx("span",{className:"text-red-300 font-bold text-[11px]",children:"Error"}),o.jsx("span",{className:"text-red-200/70 text-[10px]",children:t.data.message})]})});case"import:scan":case"import:process":case"import:created":return o.jsxs("div",{className:"text-cyan-300/70 text-[11px]",children:["[",t.type,"] ",JSON.stringify(t.data)]});default:return null}}function oC({jobId:t,title:l,color:r,variant:i,style:c,onClose:u,onMinimize:f,onDone:m,onNavigateToJob:x,onOpenKnowledgeDoc:d}){const{events:g,status:y,textOutput:b,childJobIds:v}=V0(t),[j,S]=k.useState(0),[E,C]=k.useState(new Set),A=k.useRef(null),M=k.useRef(Date.now()),F=k.useRef(!1);k.useEffect(()=>{const Y=setInterval(()=>{S(Math.floor((Date.now()-M.current)/1e3))},1e3);return()=>clearInterval(Y)},[]),k.useEffect(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[g]),k.useEffect(()=>{(y==="done"||y==="error")&&!F.current&&(F.current=!0,m==null||m())},[y,m]);const L=Y=>{C(R=>{const Q=new Set(R);return Q.has(Y)?Q.delete(Y):Q.add(Y),Q})},O={idle:"Waiting",connecting:"Connecting...",streaming:"Working",done:"Complete",error:"Error"}[y],U={idle:"#888",connecting:"#888",streaming:r,done:"#2E7D32",error:"#C62828"}[y],X=Y=>`${Math.floor(Y/60)}:${String(Y%60).padStart(2,"0")}`,ne=y==="done"||y==="error",D=o.jsxs("div",{className:i==="modal"?"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] h-[85vh] z-[61] bg-[var(--terminal-bg)] rounded-2xl shadow-2xl overflow-hidden flex flex-col":"bg-[var(--terminal-bg)] rounded-xl border border-[var(--terminal-border)] overflow-hidden flex flex-col max-h-[400px]",style:c,children:[o.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{background:U}}),o.jsx("div",{children:o.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:l})})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:X(j)}),o.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:`${U}22`,color:U},children:O}),f&&i==="modal"&&o.jsx("button",{onClick:f,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),ne&&o.jsx("button",{onClick:u,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),o.jsxs("div",{ref:A,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[g.length===0&&y==="connecting"&&o.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:"Connecting to activity stream..."}),g.map(Y=>o.jsx(mg,{event:Y,isThinkingCollapsed:E.has(Y.seq),onToggleThinking:()=>L(Y.seq),onNavigateToJob:x,onOpenKnowledgeDoc:d},Y.seq)),y==="streaming"&&o.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),o.jsxs("div",{className:"px-5 py-3 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[o.jsxs("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:[g.length>0&&`${g.length} events`,b.length>0&&` · ${b.length} chars`,v.length>0&&` · ${v.length} dispatches`]}),ne&&o.jsx("button",{onClick:u,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer",style:{background:r},children:"Close"})]})]});return i==="modal"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:ne?u:void 0}),D]}):D}const kd={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function cC({orgNodes:t,rootId:l}){const r=t[l];if(!r)return null;const c=r.children.map(m=>t[m]).filter(Boolean),u=[];for(const m of c)for(const x of m.children){const d=t[x];d&&u.push({node:d,parentId:m.id})}const f=c.length+u.length;return o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Propagation Preview"}),o.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-lg p-4",children:[o.jsx("div",{className:"flex justify-center mb-2",children:o.jsx("span",{className:"px-3 py-1 text-[10px] font-bold rounded border-2 border-white/20 bg-white/5 text-white/30 uppercase",children:"CEO"})}),c.length>0&&o.jsx("div",{className:"flex justify-center mb-1",children:o.jsx("div",{className:"w-px h-3 bg-white/15"})}),c.length>1&&o.jsx("div",{className:"flex justify-center mb-1",children:o.jsx("div",{className:"h-px bg-white/15",style:{width:`${Math.min(c.length*80,320)}px`}})}),o.jsx("div",{className:"flex justify-center gap-3 mb-2 flex-wrap",children:c.map(m=>o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("span",{className:"px-2.5 py-1 text-[10px] font-bold rounded border-2 uppercase",style:{borderColor:kd[m.id]??"#888",color:kd[m.id]??"#888",background:`${kd[m.id]??"#888"}22`},children:m.id}),o.jsx("span",{className:"text-[8px] text-white/30 mt-0.5",children:"direct"})]},m.id))}),u.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex justify-center mb-1",children:o.jsx("div",{className:"w-px h-2 bg-white/10"})}),o.jsx("div",{className:"flex justify-center gap-2 flex-wrap",children:u.map(({node:m})=>o.jsx("span",{className:"px-2 py-0.5 text-[9px] font-semibold rounded border border-white/15 text-white/40 uppercase",children:m.id},m.id))}),o.jsx("div",{className:"text-center text-[8px] text-white/30 mt-1",children:"via re-dispatch"})]})]}),o.jsxs("div",{className:"text-[10px] text-gray-400 mt-1.5",children:[f," role",f!==1?"s":""," will receive this wave"]})]})}function uC({cLevelRoles:t,orgNodes:l,rootId:r,onClose:i,onDispatch:c}){const[u,f]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const x=()=>{!u.trim()||t.length===0||(c(u.trim()),i())},d=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&x(),y.key==="Escape"&&i()},g=r&&Object.keys(l).length>0;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),o.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[560px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[o.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[o.jsx("div",{className:"text-lg font-bold",children:"CEO Wave"}),o.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:"Broadcast a directive to all C-Level reports"})]}),o.jsxs("div",{className:"p-5 space-y-4",children:[g&&o.jsx(cC,{orgNodes:l,rootId:r}),!g&&o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Dispatching to"}),o.jsx("div",{className:"flex gap-2 flex-wrap",children:t.length>0?t.map(y=>o.jsxs("span",{className:"px-3 py-1.5 text-xs font-semibold rounded-lg border-2 border-red-200 bg-red-50 text-red-800",children:[y.id.toUpperCase()," · ",y.name]},y.id)):o.jsx("span",{className:"text-xs text-gray-400 italic",children:"No C-Level roles found"})}),o.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Each C-Level receives the directive and delegates to their reports"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Directive"}),o.jsx("textarea",{ref:m,value:u,onChange:y=>f(y.target.value),onKeyDown:d,placeholder:"e.g. Report current status across all departments",className:"w-full h-28 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),o.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Cmd+Enter to dispatch"})]})]}),o.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[o.jsx("button",{onClick:i,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),o.jsxs("button",{onClick:x,disabled:!u.trim()||t.length===0,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#B71C1C"},children:["Dispatch to ",t.length," Role",t.length!==1?"s":""]})]})]})]})}function fC(t,l,r){const[i,c]=k.useState(new Map),[u,f]=k.useState(null),m=k.useRef(new Map),x=k.useRef(i);x.current=i,k.useEffect(()=>{if(!r||Object.keys(l).length===0)return;const b=new Map,v=S=>{const E=l[S];E&&(b.set(S,{jobId:null,roleId:S,roleName:E.name,children:E.children,status:"waiting",events:[],streamStatus:"idle"}),E.children.forEach(v))},j=l[r];j&&(b.set(r,{jobId:null,roleId:r,roleName:"CEO",children:j.children,status:"not-dispatched",events:[],streamStatus:"idle"}),j.children.forEach(v));for(const S of t){const E=b.get(S.roleId);E&&(E.jobId=S.jobId,E.status="running",E.streamStatus="connecting")}c(b),t.length>0&&f(t[0].roleId)},[t,l,r]);const d=k.useCallback((b,v)=>{const j=m.current.get(b);j&&j.controller.abort();const S=new AbortController,E={controller:S,lastSeq:-1};m.current.set(b,E);const A=`/api/jobs/${b}/stream?from=0`;fetch(A,{signal:S.signal}).then(async M=>{if(!M.ok||!M.body){c(U=>{const X=new Map(U),ne=X.get(v);return ne&&X.set(v,{...ne,streamStatus:"error"}),X});return}c(U=>{const X=new Map(U),ne=X.get(v);return ne&&X.set(v,{...ne,streamStatus:"streaming",status:"running"}),X});const F=M.body.getReader(),L=new TextDecoder;let O="";for(;;){const{done:U,value:X}=await F.read();if(U)break;O+=L.decode(X,{stream:!0});const ne=O.split(`
|
|
81
|
-
`);O=ne.pop()??"";let D="";for(const Y of ne)if(Y.startsWith("event: "))D=Y.slice(7).trim();else if(Y.startsWith("data: ")){try{const R=JSON.parse(Y.slice(6));if(D==="activity"){const Q=R;Q.seq>E.lastSeq&&(E.lastSeq=Q.seq),c(ee=>{const V=new Map(ee),I=V.get(v);if(!I||I.events.some(ce=>ce.seq===Q.seq))return ee;const Z={...I,events:[...I.events,Q]};if(Q.type==="dispatch:start"&&Q.data.childJobId){const ce=Q.data.childJobId,we=Q.data.targetRoleId??Q.data.roleId;if(we){const z=V.get(we);z&&(V.set(we,{...z,jobId:ce,status:"running",streamStatus:"connecting"}),setTimeout(()=>d(ce,we),0))}}return Q.type==="job:done"?(Z.status="done",Z.streamStatus="done"):Q.type==="job:error"&&(Z.status="error",Z.streamStatus="error"),V.set(v,Z),V})}else if(D==="stream:end"){const Q=R.reason;c(ee=>{const V=new Map(ee),I=V.get(v);if(!I)return ee;const Z=Q==="error"?"error":"done";return V.set(v,{...I,status:I.status==="running"?Z:I.status,streamStatus:Z==="error"?"error":"done"}),V})}}catch{}D=""}}}).catch(M=>{M.name!=="AbortError"&&c(F=>{const L=new Map(F),O=L.get(v);return O&&L.set(v,{...O,streamStatus:"error"}),L})})},[]);k.useEffect(()=>{if(t.length!==0){for(const b of t)d(b.jobId,b.roleId);return()=>{for(const[,b]of m.current)b.controller.abort();m.current.clear()}}},[t,d]);const g=(()=>{let b=0,v=0,j=0;for(const[S,E]of i)S!==r&&(j++,E.status==="done"?b++:E.status==="running"&&v++);return{done:b,total:j,running:v}})(),y=g.total>0&&g.running===0&&Array.from(i.values()).every(b=>b.status!=="running"&&b.streamStatus!=="streaming"&&b.streamStatus!=="connecting");return k.useEffect(()=>{y&&c(b=>{const v=new Map(b);let j=!1;for(const[S,E]of v)E.status==="waiting"&&(v.set(S,{...E,status:"not-dispatched"}),j=!0);return j?v:b})},[y]),{nodes:i,selectedRoleId:u,selectNode:f,progress:g,allDone:y}}const v0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},pa=120,tr=44,w0=80;function dC(t,l){if(!t.get(l))return{layout:[],width:300,height:200};const i=[],c=[],u=[{id:l,depth:0,parentId:null}],f=new Set;for(;u.length>0;){const{id:g,depth:y,parentId:b}=u.shift();if(f.has(g))continue;for(f.add(g);c.length<=y;)c.push([]);c[y].push(g),i.push({roleId:g,x:0,y:y*w0+20,parentId:b});const v=t.get(g);if(v)for(const j of v.children)t.has(j)&&!f.has(j)&&u.push({id:j,depth:y+1,parentId:g})}const m=Math.max(...c.map(g=>g.length))*(pa+16),x=Math.max(m,280);for(const g of c){const y=g.length*(pa+16)-16,b=(x-y)/2;g.forEach((v,j)=>{const S=i.find(E=>E.roleId===v);S&&(S.x=b+j*(pa+16))})}const d=c.length*w0+40;return{layout:i,width:x,height:d}}function hC({nodes:t,rootId:l,selectedRoleId:r,onSelectNode:i}){const{layout:c,width:u,height:f}=dC(t,l),m=d=>{const g=c.find(y=>y.roleId===d);return g?{cx:g.x+pa/2,cy:g.y+tr/2}:{cx:0,cy:0}},x=d=>{switch(d.status){case"running":return v0[d.roleId]??"#FBBF24";case"done":return"#2E7D32";case"error":return"#C62828";case"not-dispatched":return"#666";default:return"#888"}};return o.jsxs("svg",{viewBox:`0 0 ${u} ${f}`,width:"100%",height:"100%",className:"block",children:[o.jsx("defs",{children:o.jsxs("filter",{id:"glow",children:[o.jsx("feGaussianBlur",{stdDeviation:"2",result:"blur"}),o.jsxs("feMerge",{children:[o.jsx("feMergeNode",{in:"blur"}),o.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),c.filter(d=>d.parentId).map(d=>{const g=m(d.parentId),y=m(d.roleId),b=t.get(d.roleId),v=t.get(d.parentId);let j="rgba(180,200,240,0.15)",S="4 4",E="";return(b==null?void 0:b.status)==="done"||(v==null?void 0:v.status)==="done"?(j="#2E7D3266",S=""):(b==null?void 0:b.status)==="running"&&(j=v0[d.roleId]??"#FBBF24",S="6 4",E="wave-edge-flow"),o.jsx("line",{x1:g.cx,y1:g.cy+tr/2-4,x2:y.cx,y2:y.cy-tr/2+4,stroke:j,strokeWidth:1.5,strokeDasharray:S,className:E},`${d.parentId}-${d.roleId}`)}),c.map(d=>{const g=t.get(d.roleId);if(!g)return null;const y=x(g),b=r===d.roleId,v=d.roleId===l,j=v?.4:g.status==="not-dispatched"?.35:1;return o.jsxs("g",{transform:`translate(${d.x}, ${d.y})`,style:{cursor:v?"default":"pointer",opacity:j},onClick:()=>!v&&i(d.roleId),children:[o.jsx("rect",{x:0,y:0,width:pa,height:tr,rx:8,ry:8,fill:"var(--terminal-bg-deeper, #181825)",stroke:b?"#fff":y,strokeWidth:b?2:1.5,strokeDasharray:g.status==="not-dispatched"?"4 3":""}),o.jsx("circle",{cx:14,cy:tr/2,r:4,fill:y,filter:g.status==="running"?"url(#glow)":void 0,children:g.status==="running"&&o.jsx("animate",{attributeName:"opacity",values:"1;0.4;1",dur:"1.5s",repeatCount:"indefinite"})}),o.jsx("text",{x:26,y:tr/2-4,fill:"var(--terminal-text, #fff)",fontSize:10,fontWeight:700,fontFamily:"var(--pixel-font)",children:g.roleId.toUpperCase()}),o.jsx("text",{x:26,y:tr/2+10,fill:"var(--terminal-text-muted, #888)",fontSize:8,fontFamily:"var(--pixel-font)",children:g.status==="running"?"Working...":g.status==="done"?"Complete":g.status==="error"?"Error":g.status==="waiting"?"Waiting":""}),g.status==="done"&&o.jsx("text",{x:pa-18,y:tr/2+4,fontSize:14,fill:"#2E7D32",children:"✓"}),g.status==="error"&&o.jsx("text",{x:pa-18,y:tr/2+4,fontSize:14,fill:"#C62828",children:"✗"})]},d.roleId)})]})}const mC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function xC({directive:t,rootJobs:l,orgNodes:r,rootRoleId:i,onClose:c,onMinimize:u,onDone:f,onOpenKnowledgeDoc:m}){const{nodes:x,selectedRoleId:d,selectNode:g,progress:y,allDone:b}=fC(l,r,i),[v,j]=k.useState(0),[S,E]=k.useState(new Set),C=k.useRef(null),A=k.useRef(Date.now()),M=k.useRef(!1);k.useEffect(()=>{const X=setInterval(()=>{j(Math.floor((Date.now()-A.current)/1e3))},1e3);return()=>clearInterval(X)},[]),k.useEffect(()=>{C.current&&(C.current.scrollTop=C.current.scrollHeight)},[d,x]),k.useEffect(()=>{b&&!M.current&&(M.current=!0,f==null||f())},[b,f]);const F=X=>`${Math.floor(X/60)}:${String(X%60).padStart(2,"0")}`,L=d?x.get(d):null,O=d?mC[d]??"#888":"#888",U=X=>{E(ne=>{const D=new Set(ne);return D.has(X)?D.delete(X):D.add(X),D})};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:b?c:void 0}),o.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[960px] max-w-[95vw] h-[85vh] z-[61] bg-[var(--terminal-bg)] rounded-2xl shadow-2xl overflow-hidden flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:b?"#2E7D32":"#B71C1C",animation:b?void 0:"wave-pulse 2s ease-in-out infinite"}}),o.jsx("div",{children:o.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:b?"WAVE COMPLETE":"WAVE COMMAND CENTER"})})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:F(v)}),o.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:b?"#2E7D3222":"#B71C1C22",color:b?"#2E7D32":"#B71C1C"},children:[y.done,"/",y.total," done"]}),o.jsx("button",{onClick:u,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),b&&o.jsx("button",{onClick:c,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),o.jsx("div",{className:"px-5 py-2 border-b border-[var(--terminal-border)] shrink-0",children:o.jsxs("span",{className:"text-[var(--terminal-text-secondary)] text-xs italic",children:["“",t,"”"]})}),o.jsxs("div",{className:"flex flex-1 min-h-0",children:[o.jsxs("div",{className:"w-[280px] shrink-0 border-r border-[var(--terminal-border)] flex flex-col",children:[o.jsx("div",{className:"px-3 py-2 border-b border-[var(--terminal-border)]",children:o.jsx("span",{className:"text-[10px] font-bold text-[var(--terminal-text-secondary)] uppercase tracking-wider",children:"Org Propagation"})}),o.jsx("div",{className:"flex-1 overflow-auto p-3",children:o.jsx(hC,{nodes:x,rootId:i,selectedRoleId:d,onSelectNode:g})}),o.jsx("div",{className:"px-3 py-2 border-t border-[var(--terminal-border)] flex flex-wrap gap-x-3 gap-y-1",children:[{label:"running",color:"#FBBF24",dot:!0},{label:"done",color:"#2E7D32",dot:!1},{label:"waiting",color:"#888",dot:!1},{label:"error",color:"#C62828",dot:!1}].map(X=>o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:X.color,animation:X.dot?"wave-pulse 1.5s ease-in-out infinite":void 0}}),o.jsx("span",{className:"text-[8px] text-[var(--terminal-text-muted)]",children:X.label})]},X.label))})]}),o.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[L&&o.jsxs("div",{className:"px-4 py-2 border-b border-[var(--terminal-border)] shrink-0 flex items-center gap-2",children:[o.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:O}}),o.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-xs",children:L.roleId.toUpperCase()}),o.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs",children:L.roleName}),o.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full font-semibold",style:{background:`${O}22`,color:O},children:L.status==="running"?"Working":L.status==="done"?"Complete":L.status==="error"?"Error":L.status==="waiting"?"Waiting":"Not dispatched"})]}),o.jsxs("div",{ref:C,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[L&&L.events.length===0&&o.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:L.status==="waiting"?"Waiting for dispatch...":L.status==="running"?"Connecting to activity stream...":L.status==="not-dispatched"?"This role was not dispatched in this wave.":""}),L==null?void 0:L.events.map(X=>o.jsx(mg,{event:X,isThinkingCollapsed:S.has(X.seq),onToggleThinking:()=>U(X.seq),onNavigateToJob:ne=>{for(const[,D]of x)if(D.jobId===ne){g(D.roleId);return}},onOpenKnowledgeDoc:m},X.seq)),(L==null?void 0:L.status)==="running"&&o.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),!L&&o.jsx("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-xs",children:"Click a node in the org tree to view activity"}),o.jsxs("div",{className:"px-4 py-2 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:L&&L.events.length>0&&`${L.events.length} events`}),b&&o.jsx("button",{onClick:c,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer",style:{background:"#2E7D32"},children:"Close"})]})]})]})]})]})}const pC={cto:{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"short",outfitStyle:"tshirt",accessory:"glasses"},cbo:{skinColor:"#FDEBD0",hairColor:"#1A0A00",shirtColor:"#E65100",pantsColor:"#37474F",shoeColor:"#1A1A1A",hairStyle:"slicked",outfitStyle:"suit",accessory:"lapels"},pm:{skinColor:"#FDEBD0",hairColor:"#6D4C41",shirtColor:"#2E7D32",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"bun",outfitStyle:"tshirt",accessory:"blush"},engineer:{skinColor:"#F5CBA7",hairColor:"#1A1A1A",shirtColor:"#4A148C",pantsColor:"#37474F",shoeColor:"#7B1FA2",hairStyle:"messy",outfitStyle:"hoodie",accessory:"headphones"},designer:{skinColor:"#FDEBD0",hairColor:"#AD1457",shirtColor:"#AD1457",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"bob",outfitStyle:"tshirt",accessory:"beret"},qa:{skinColor:"#F5CBA7",hairColor:"#4E342E",shirtColor:"#00695C",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"short",outfitStyle:"tshirt",accessory:"badge"},"data-analyst":{skinColor:"#F5CBA7",hairColor:"#3E2723",shirtColor:"#0277BD",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"curly",outfitStyle:"vest",accessory:"none"}};function Eh(t){return pC[t]??{skinColor:"#B0BEC5",hairColor:"#78909C",shirtColor:"#607D8B",pantsColor:"#455A64",shoeColor:"#37474F"}}const xg=["#FDEBD0","#F5CBA7","#D4A07A","#C68642","#8D5524","#5C3A1E","#F3D1C7","#E8BEAC","#B07D62","#704214"],pg=["#1A0A00","#2C1810","#4E342E","#6D4C41","#8D6E63","#D4A574","#F5E6CA","#FFD700","#B71C1C","#AD1457","#4A148C","#1A237E","#004D40","#1A1A1A","#78909C","#E0E0E0"],yg=["#1565C0","#E65100","#2E7D32","#4A148C","#AD1457","#00695C","#D32F2F","#F57F17","#1B5E20","#283593","#4E342E","#37474F","#880E4F","#00838F","#6A1B9A","#FF6F00"],gg=["#37474F","#1A237E","#3E2723","#263238","#1B5E20","#455A64","#212121","#4E342E","#0D47A1","#311B92"],bg=["#212121","#1A1A1A","#37474F","#4E342E","#7B1FA2","#D32F2F","#1565C0","#F57F17","#2E7D32","#FFFFFF"],Ur={default:{name:"MIDNIGHT",icon:"🌃",vars:{"--floor-light":"#0d1117","--floor-dark":"#0a0e14","--hud-bg":"#0d1117","--hud-bg-alt":"#161b22","--pixel-border":"#30363d","--terminal-bg":"#0d1117","--terminal-border":"#21262d","--terminal-border-hover":"#388bfd","--terminal-text":"#e6edf3","--terminal-text-secondary":"#8b949e","--terminal-text-muted":"#484f58","--accent":"#388bfd","--active-green":"#3fb950","--idle-amber":"#d29922"}},light:{name:"DAYLIGHT",icon:"☀️",vars:{"--floor-light":"#f6f8fa","--floor-dark":"#eaeef2","--hud-bg":"#24292f","--hud-bg-alt":"#32383f","--pixel-border":"#d0d7de","--terminal-bg":"#ffffff","--terminal-border":"#d0d7de","--terminal-border-hover":"#0969da","--terminal-text":"#1f2328","--terminal-text-secondary":"#656d76","--terminal-text-muted":"#8c959f","--accent":"#0969da","--active-green":"#1a7f37","--idle-amber":"#9a6700"}},retro:{name:"RETRO",icon:"🎮",vars:{"--floor-light":"#1a1410","--floor-dark":"#140f0a","--hud-bg":"#1a1410","--hud-bg-alt":"#2a2018","--pixel-border":"#5c4a32","--terminal-bg":"#1a1410","--terminal-border":"#3a2e20","--terminal-border-hover":"#d4a44e","--terminal-text":"#e8d5b0","--terminal-text-secondary":"#a08860","--terminal-text-muted":"#6b5840","--accent":"#d4a44e","--active-green":"#8bba4a","--idle-amber":"#e8a030"}},cyberpunk:{name:"NEON",icon:"🌌",vars:{"--floor-light":"#0a0014","--floor-dark":"#06000e","--hud-bg":"#0a0014","--hud-bg-alt":"#14002a","--pixel-border":"#4a1a80","--terminal-bg":"#0a0014","--terminal-border":"#2a0a50","--terminal-border-hover":"#e040fb","--terminal-text":"#e0d0ff","--terminal-text-secondary":"#9070c0","--terminal-text-muted":"#5a3a80","--accent":"#e040fb","--active-green":"#00ff88","--idle-amber":"#ffab00"}},forest:{name:"FOREST",icon:"🌲",vars:{"--floor-light":"#0a1410","--floor-dark":"#060e0a","--hud-bg":"#0a1410","--hud-bg-alt":"#142a1e","--pixel-border":"#2a5a3a","--terminal-bg":"#0a1410","--terminal-border":"#1a3a26","--terminal-border-hover":"#4ade80","--terminal-text":"#d0f0d8","--terminal-text-secondary":"#70a880","--terminal-text-muted":"#3a6848","--accent":"#4ade80","--active-green":"#86efac","--idle-amber":"#fcd34d"}},ocean:{name:"OCEAN",icon:"🌊",vars:{"--floor-light":"#0a1420","--floor-dark":"#060e18","--hud-bg":"#0a1420","--hud-bg-alt":"#142a40","--pixel-border":"#1e4a6a","--terminal-bg":"#0a1420","--terminal-border":"#163050","--terminal-border-hover":"#38bdf8","--terminal-text":"#d0e8f8","--terminal-text-secondary":"#6090b0","--terminal-text-muted":"#305070","--accent":"#38bdf8","--active-green":"#34d399","--idle-amber":"#fbbf24"}}};function yC({color:t,selected:l,onClick:r}){return o.jsx("button",{onClick:r,className:"customize-swatch",style:{background:t,outline:l?"2px solid #fff":"2px solid transparent",boxShadow:l?`0 0 0 1px ${t}, 0 0 6px ${t}88`:"none"}})}function bs({label:t,presets:l,value:r,onChange:i}){return o.jsxs("div",{className:"customize-row",children:[o.jsxs("div",{className:"customize-row-header",children:[o.jsx("span",{className:"customize-row-label",children:t}),o.jsx("div",{className:"customize-row-current",style:{background:r}})]}),o.jsx("div",{className:"customize-swatches",children:l.map(c=>o.jsx(yC,{color:c,selected:c===r,onClick:()=>i(c)},c))})]})}function Sd({label:t,items:l,value:r,onChange:i,lockInfo:c}){return o.jsxs("div",{className:"customize-row",children:[o.jsx("div",{className:"customize-row-header",children:o.jsx("span",{className:"customize-row-label",children:t})}),o.jsx("div",{className:"customize-swatches",style:{gap:4},children:l.map(u=>{const f=c?c.getLockLevel(u.id):1,m=u.id===r,x=c?f>c.roleLevel&&!m:!1,d=c?m&&f>c.roleLevel:!1;return o.jsxs("button",{onClick:()=>{x||i(u.id===r?void 0:u.id)},className:"customize-swatch",style:{width:"auto",height:"auto",padding:x?"2px 6px 10px 6px":"2px 6px",fontSize:9,fontFamily:"var(--font-pixel, monospace)",background:m?"rgba(255,255,255,0.15)":x?"rgba(255,255,255,0.02)":"rgba(255,255,255,0.04)",outline:m?d?"2px solid #F59E0B":"2px solid #fff":"2px solid transparent",color:x?"rgba(255,255,255,0.25)":m?"#fff":"rgba(255,255,255,0.5)",borderRadius:4,cursor:x?"not-allowed":"pointer",opacity:x?.35:1,position:"relative"},children:[u.name,x&&o.jsxs("span",{style:{position:"absolute",bottom:1,left:"50%",transform:"translateX(-50%)",fontSize:8,color:"rgba(255,255,255,0.5)",whiteSpace:"nowrap"},children:["🔒"," Lv.",f]}),d&&o.jsxs("span",{style:{position:"absolute",bottom:-8,left:"50%",transform:"translateX(-50%)",fontSize:7,color:"#F59E0B",whiteSpace:"nowrap"},children:["⚠"," Lv.",f]})]},u.id)})})]})}function jd({label:t,active:l,onClick:r}){return o.jsx("button",{onClick:r,style:{flex:1,padding:"6px 0",fontSize:10,fontFamily:"var(--font-pixel, monospace)",fontWeight:"bold",letterSpacing:1,background:l?"rgba(255,255,255,0.08)":"transparent",color:l?"#fff":"rgba(255,255,255,0.35)",border:"none",borderBottom:l?"2px solid #3B82F6":"2px solid transparent",cursor:"pointer",transition:"all 0.15s"},children:t})}function Or(t){return t[Math.floor(Math.random()*t.length)]}function js(t){var c,u,f;const l=ng(),r=lg(),i=rg().filter(m=>!t||ig(m.id,t));return{skinColor:Or(xg),hairColor:Or(pg),shirtColor:Or(yg),pantsColor:Or(gg),shoeColor:Or(bg),hairStyle:(c=Or(l))==null?void 0:c.id,outfitStyle:(u=Or(r))==null?void 0:u.id,accessory:(f=Or(i))==null?void 0:f.id}}function vg({roleId:t,appearance:l,onChange:r,onRandomize:i,onReset:c,label:u,roleLevel:f}){const[m,x]=k.useState("look"),d=k.useCallback((E,C)=>{r({...l,[E]:C})},[l,r]),g=k.useRef(null),y=k.useCallback(E=>{var M;const C=(M=E.target.files)==null?void 0:M[0];if(!C)return;const A=new Image;A.onload=()=>{const F=HS(A);r({...F,hairStyle:l.hairStyle,outfitStyle:l.outfitStyle,accessory:l.accessory}),URL.revokeObjectURL(A.src)},A.src=URL.createObjectURL(C),E.target.value=""},[l.hairStyle,l.outfitStyle,l.accessory,r]),b=ng(),v=lg(),j=rg(),S=f!==void 0?j.filter(E=>ig(E.id,f)).length:j.length;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"customize-preview",children:[o.jsx("div",{className:"customize-preview-bg",children:o.jsx(Ic,{roleId:t,appearance:l,scale:12})}),u&&o.jsx("div",{className:"customize-preview-name",children:u}),o.jsxs("div",{className:"customize-preview-actions",children:[o.jsx("button",{className:"customize-btn customize-btn--random",onClick:i,children:"RANDOM"}),o.jsx("button",{className:"customize-btn customize-btn--reset",onClick:c,children:"RESET"}),o.jsx("button",{className:"customize-btn",onClick:()=>{var E;return(E=g.current)==null?void 0:E.click()},style:{fontSize:9,opacity:.7},children:"PHOTO"}),o.jsx("input",{ref:g,type:"file",accept:"image/*",onChange:y,style:{display:"none"}})]})]}),o.jsxs("div",{className:"customize-colors",children:[o.jsxs("div",{style:{display:"flex",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:[o.jsx(jd,{label:"LOOK",active:m==="look",onClick:()=>x("look")}),o.jsx(jd,{label:"OUTFIT",active:m==="outfit",onClick:()=>x("outfit")}),o.jsx(jd,{label:"ACCESSORY",active:m==="accessory",onClick:()=>x("accessory")})]}),m==="look"&&o.jsxs(o.Fragment,{children:[o.jsx(bs,{label:"SKIN",presets:xg,value:l.skinColor,onChange:E=>d("skinColor",E)}),o.jsx(bs,{label:"HAIR COLOR",presets:pg,value:l.hairColor,onChange:E=>d("hairColor",E)}),o.jsx(Sd,{label:"HAIR STYLE",items:b,value:l.hairStyle,onChange:E=>d("hairStyle",E)})]}),m==="outfit"&&o.jsxs(o.Fragment,{children:[o.jsx(Sd,{label:"STYLE",items:v,value:l.outfitStyle,onChange:E=>d("outfitStyle",E)}),o.jsx(bs,{label:"TOP",presets:yg,value:l.shirtColor,onChange:E=>d("shirtColor",E)}),o.jsx(bs,{label:"PANTS",presets:gg,value:l.pantsColor,onChange:E=>d("pantsColor",E)}),o.jsx(bs,{label:"SHOES",presets:bg,value:l.shoeColor,onChange:E=>d("shoeColor",E)})]}),m==="accessory"&&o.jsxs(o.Fragment,{children:[f!==void 0&&o.jsxs("div",{style:{padding:"4px 8px",marginBottom:4,background:"rgba(255,255,255,0.04)",borderRadius:4,fontSize:9,fontFamily:"var(--font-pixel, monospace)",color:"rgba(255,255,255,0.5)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o.jsxs("span",{children:["Lv.",f]}),o.jsxs("span",{children:[S,"/",j.length," unlocked"]})]}),o.jsx(Sd,{label:"ACCESSORY",items:j,value:l.accessory,onChange:E=>d("accessory",E),lockInfo:f!==void 0?{roleLevel:f,getLockLevel:ag}:void 0}),o.jsx("div",{style:{marginTop:12,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:6,border:"1px dashed rgba(255,255,255,0.08)",color:"rgba(255,255,255,0.25)",fontSize:9,fontFamily:"var(--font-pixel, monospace)",textAlign:"center"},children:f!==void 0&&f<10?"Level up to unlock more accessories":"More accessories coming soon"})]})]})]})}const gC=[{value:"c-level",label:"C-Level"},{value:"team-lead",label:"Team Lead"},{value:"member",label:"Member"}];function wg(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,24)}function k0(t){switch(t){case"c-level":return{authority:{autonomous:["Strategic decisions within domain","Task delegation to reports"],needsApproval:["Budget over $5K","External commitments"]},knowledge:{reads:["company/","operations/","projects/"],writes:["operations/","knowledge/"]},reports:{daily:"standup",weekly:"summary"}};case"team-lead":return{authority:{autonomous:["Task planning","Sprint management"],needsApproval:["Architecture changes","New tool adoption"]},knowledge:{reads:["projects/","architecture/"],writes:["projects/"]},reports:{daily:"standup",weekly:"summary"}};default:return{authority:{autonomous:["Implementation within assigned tasks"],needsApproval:["Design changes","New dependencies"]},knowledge:{reads:["projects/"],writes:[]},reports:{daily:"standup",weekly:""}}}}const vs=4;function bC(t,l,r){const i=t.trim();if(!i||i.startsWith("#"))return null;const c=i.split(",").map(y=>y.trim()),u=c[0];if(!u)return null;const f=wg(u),m=(c[1]||"member").toLowerCase(),x=m==="c-level"?"c-level":m==="team-lead"?"team-lead":"member",d=c[2]||"ceo";let g;return l.has(f)?g="ID already exists":r.has(f)&&(g="Duplicate ID in batch"),r.add(f),{name:u,id:f,level:x,reportsTo:d,error:g}}function vC({existingRoles:t,onClose:l,onHire:r}){const[i,c]=k.useState("single"),[u,f]=k.useState(1),[m,x]=k.useState(""),[d,g]=k.useState(""),[y,b]=k.useState(!1),[v,j]=k.useState("member"),[S,E]=k.useState("ceo"),[C,A]=k.useState(""),[M,F]=k.useState(js),[L,O]=k.useState(!1),[U,X]=k.useState(""),[ne,D]=k.useState([]),[Y,R]=k.useState(new Set),[Q,ee]=k.useState(""),[V,I]=k.useState("input"),[Z,ce]=k.useState({done:0,total:0}),we=k.useRef(null),z=k.useRef(null),B=k.useRef(null);k.useEffect(()=>{Ce.getSkills().then(G=>D(G.filter(ie=>ie.installed))).catch(()=>{})},[]),k.useEffect(()=>{var G,ie,xe;i==="single"?(u===1&&((G=we.current)==null||G.focus()),u===2&&((ie=z.current)==null||ie.focus())):V==="input"&&((xe=B.current)==null||xe.focus())},[u,i,V]);const W=k.useMemo(()=>new Set(t.map(G=>G.id)),[t]),T=k.useMemo(()=>{const G=Q.split(`
|
|
82
|
-
`),ie=new Set;return G.map(xe=>bC(xe,W,ie)).filter(xe=>xe!==null)},[Q,W]),me=T.length>0&&T.every(G=>!G.error),Se=G=>{x(G),y||g(wg(G))},Ee=m.trim().length>0&&d.trim().length>0&&!t.some(G=>G.id===d),
|
|
78
|
+
`))}function x(v,j,S,E){const C=S.enter("tableCell"),A=S.enter("phrasing"),M=S.containerPhrasing(v,{...E,before:u,after:u});return A(),C(),M}function d(v,j){return Wk(v,{align:j,alignDelimiters:i,padding:r,stringLength:c})}function g(v,j,S){const E=v.children;let C=-1;const A=[],M=j.enter("table");for(;++C<E.length;)A[C]=y(E[C],j,S);return M(),A}function y(v,j,S){const E=v.children;let C=-1;const A=[],M=j.enter("tableRow");for(;++C<E.length;)A[C]=x(E[C],v,j,S);return M(),A}function b(v,j,S){let E=Yy.inlineCode(v,j,S);return S.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function B4(){return{exit:{taskListCheckValueChecked:n0,taskListCheckValueUnchecked:n0,paragraph:$4}}}function L4(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:H4}}}function n0(t){const l=this.stack[this.stack.length-2];l.type,l.checked=t.type==="taskListCheckValueChecked"}function $4(t){const l=this.stack[this.stack.length-2];if(l&&l.type==="listItem"&&typeof l.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const i=r.children[0];if(i&&i.type==="text"){const c=l.children;let u=-1,f;for(;++u<c.length;){const m=c[u];if(m.type==="paragraph"){f=m;break}}f===r&&(i.value=i.value.slice(1),i.value.length===0?r.children.shift():r.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,r.position.start=Object.assign({},i.position.start)))}}this.exit(t)}function H4(t,l,r,i){const c=t.children[0],u=typeof t.checked=="boolean"&&c&&c.type==="paragraph",f="["+(t.checked?"x":" ")+"] ",m=r.createTracker(i);u&&m.move(f);let x=Yy.listItem(t,l,r,{...i,...m.current()});return u&&(x=x.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),x;function d(g){return g+f}}function U4(){return[bk(),Hk(),qk(),D4(),B4()]}function I4(t){return{extensions:[vk(),Uk(t),Xk(),O4(t),L4()]}}const Y4={tokenize:Q4,partial:!0},qy={tokenize:W4,partial:!0},Xy={tokenize:Z4,partial:!0},Vy={tokenize:J4,partial:!0},q4={tokenize:P4,partial:!0},Gy={name:"wwwAutolink",tokenize:G4,previous:Qy},Ky={name:"protocolAutolink",tokenize:K4,previous:Wy},ar={name:"emailAutolink",tokenize:V4,previous:Zy},Tl={};function X4(){return{text:Tl}}let ma=48;for(;ma<123;)Tl[ma]=ar,ma++,ma===58?ma=65:ma===91&&(ma=97);Tl[43]=ar;Tl[45]=ar;Tl[46]=ar;Tl[95]=ar;Tl[72]=[ar,Ky];Tl[104]=[ar,Ky];Tl[87]=[ar,Gy];Tl[119]=[ar,Gy];function V4(t,l,r){const i=this;let c,u;return f;function f(y){return!Gd(y)||!Zy.call(i,i.previous)||bh(i.events)?r(y):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),m(y))}function m(y){return Gd(y)?(t.consume(y),m):y===64?(t.consume(y),x):r(y)}function x(y){return y===46?t.check(q4,g,d)(y):y===45||y===95||gn(y)?(u=!0,t.consume(y),x):g(y)}function d(y){return t.consume(y),c=!0,x}function g(y){return u&&c&&Sn(i.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),l(y)):r(y)}}function G4(t,l,r){const i=this;return c;function c(f){return f!==87&&f!==119||!Qy.call(i,i.previous)||bh(i.events)?r(f):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Y4,t.attempt(qy,t.attempt(Xy,u),r),r)(f))}function u(f){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),l(f)}}function K4(t,l,r){const i=this;let c="",u=!1;return f;function f(y){return(y===72||y===104)&&Wy.call(i,i.previous)&&!bh(i.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),c+=String.fromCodePoint(y),t.consume(y),m):r(y)}function m(y){if(Sn(y)&&c.length<5)return c+=String.fromCodePoint(y),t.consume(y),m;if(y===58){const b=c.toLowerCase();if(b==="http"||b==="https")return t.consume(y),x}return r(y)}function x(y){return y===47?(t.consume(y),u?d:(u=!0,x)):r(y)}function d(y){return y===null||Cc(y)||zt(y)||wa(y)||Oc(y)?r(y):t.attempt(qy,t.attempt(Xy,g),r)(y)}function g(y){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),l(y)}}function Q4(t,l,r){let i=0;return c;function c(f){return(f===87||f===119)&&i<3?(i++,t.consume(f),c):f===46&&i===3?(t.consume(f),u):r(f)}function u(f){return f===null?r(f):l(f)}}function W4(t,l,r){let i,c,u;return f;function f(d){return d===46||d===95?t.check(Vy,x,m)(d):d===null||zt(d)||wa(d)||d!==45&&Oc(d)?x(d):(u=!0,t.consume(d),f)}function m(d){return d===95?i=!0:(c=i,i=void 0),t.consume(d),f}function x(d){return c||i||!u?r(d):l(d)}}function Z4(t,l){let r=0,i=0;return c;function c(f){return f===40?(r++,t.consume(f),c):f===41&&i<r?u(f):f===33||f===34||f===38||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===60||f===63||f===93||f===95||f===126?t.check(Vy,l,u)(f):f===null||zt(f)||wa(f)?l(f):(t.consume(f),c)}function u(f){return f===41&&i++,t.consume(f),c}}function J4(t,l,r){return i;function i(m){return m===33||m===34||m===39||m===41||m===42||m===44||m===46||m===58||m===59||m===63||m===95||m===126?(t.consume(m),i):m===38?(t.consume(m),u):m===93?(t.consume(m),c):m===60||m===null||zt(m)||wa(m)?l(m):r(m)}function c(m){return m===null||m===40||m===91||zt(m)||wa(m)?l(m):i(m)}function u(m){return Sn(m)?f(m):r(m)}function f(m){return m===59?(t.consume(m),i):Sn(m)?(t.consume(m),f):r(m)}}function P4(t,l,r){return i;function i(u){return t.consume(u),c}function c(u){return gn(u)?r(u):l(u)}}function Qy(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||zt(t)}function Wy(t){return!Sn(t)}function Zy(t){return!(t===47||Gd(t))}function Gd(t){return t===43||t===45||t===46||t===95||gn(t)}function bh(t){let l=t.length,r=!1;for(;l--;){const i=t[l][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){r=!0;break}if(i._gfmAutolinkLiteralWalkedInto){r=!1;break}}return t.length>0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const eS={tokenize:oS,partial:!0};function tS(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:aS,continuation:{tokenize:iS},exit:sS}},text:{91:{name:"gfmFootnoteCall",tokenize:rS},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:nS,resolveTo:lS}}}}function nS(t,l,r){const i=this;let c=i.events.length;const u=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let f;for(;c--;){const x=i.events[c][1];if(x.type==="labelImage"){f=x;break}if(x.type==="gfmFootnoteCall"||x.type==="labelLink"||x.type==="label"||x.type==="image"||x.type==="link")break}return m;function m(x){if(!f||!f._balanced)return r(x);const d=ml(i.sliceSerialize({start:f.end,end:i.now()}));return d.codePointAt(0)!==94||!u.includes(d.slice(1))?r(x):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(x),t.exit("gfmFootnoteCallLabelMarker"),l(x))}}function lS(t,l){let r=t.length;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};c.end.column++,c.end.offset++,c.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},c.end),end:Object.assign({},t[t.length-1][1].start)},f={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},m=[t[r+1],t[r+2],["enter",i,l],t[r+3],t[r+4],["enter",c,l],["exit",c,l],["enter",u,l],["enter",f,l],["exit",f,l],["exit",u,l],t[t.length-2],t[t.length-1],["exit",i,l]];return t.splice(r,t.length-r+1,...m),t}function rS(t,l,r){const i=this,c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u=0,f;return m;function m(y){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),x}function x(y){return y!==94?r(y):(t.enter("gfmFootnoteCallMarker"),t.consume(y),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",d)}function d(y){if(u>999||y===93&&!f||y===null||y===91||zt(y))return r(y);if(y===93){t.exit("chunkString");const b=t.exit("gfmFootnoteCallString");return c.includes(ml(i.sliceSerialize(b)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),l):r(y)}return zt(y)||(f=!0),u++,t.consume(y),y===92?g:d}function g(y){return y===91||y===92||y===93?(t.consume(y),u++,d):d(y)}}function aS(t,l,r){const i=this,c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u,f=0,m;return x;function x(j){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(j),t.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(j){return j===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(j),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",g):r(j)}function g(j){if(f>999||j===93&&!m||j===null||j===91||zt(j))return r(j);if(j===93){t.exit("chunkString");const S=t.exit("gfmFootnoteDefinitionLabelString");return u=ml(i.sliceSerialize(S)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(j),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),b}return zt(j)||(m=!0),f++,t.consume(j),j===92?y:g}function y(j){return j===91||j===92||j===93?(t.consume(j),f++,g):g(j)}function b(j){return j===58?(t.enter("definitionMarker"),t.consume(j),t.exit("definitionMarker"),c.includes(u)||c.push(u),ft(t,v,"gfmFootnoteDefinitionWhitespace")):r(j)}function v(j){return l(j)}}function iS(t,l,r){return t.check(Ls,l,t.attempt(eS,l,r))}function sS(t){t.exit("gfmFootnoteDefinition")}function oS(t,l,r){const i=this;return ft(t,c,"gfmFootnoteDefinitionIndent",5);function c(u){const f=i.events[i.events.length-1];return f&&f[1].type==="gfmFootnoteDefinitionIndent"&&f[2].sliceSerialize(f[1],!0).length===4?l(u):r(u)}}function cS(t){let r=(t||{}).singleTilde;const i={name:"strikethrough",tokenize:u,resolveAll:c};return r==null&&(r=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function c(f,m){let x=-1;for(;++x<f.length;)if(f[x][0]==="enter"&&f[x][1].type==="strikethroughSequenceTemporary"&&f[x][1]._close){let d=x;for(;d--;)if(f[d][0]==="exit"&&f[d][1].type==="strikethroughSequenceTemporary"&&f[d][1]._open&&f[x][1].end.offset-f[x][1].start.offset===f[d][1].end.offset-f[d][1].start.offset){f[x][1].type="strikethroughSequence",f[d][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},f[d][1].start),end:Object.assign({},f[x][1].end)},y={type:"strikethroughText",start:Object.assign({},f[d][1].end),end:Object.assign({},f[x][1].start)},b=[["enter",g,m],["enter",f[d][1],m],["exit",f[d][1],m],["enter",y,m]],v=m.parser.constructs.insideSpan.null;v&&Qn(b,b.length,0,Bc(v,f.slice(d+1,x),m)),Qn(b,b.length,0,[["exit",y,m],["enter",f[x][1],m],["exit",f[x][1],m],["exit",g,m]]),Qn(f,d-1,x-d+3,b),x=d+b.length-2;break}}for(x=-1;++x<f.length;)f[x][1].type==="strikethroughSequenceTemporary"&&(f[x][1].type="data");return f}function u(f,m,x){const d=this.previous,g=this.events;let y=0;return b;function b(j){return d===126&&g[g.length-1][1].type!=="characterEscape"?x(j):(f.enter("strikethroughSequenceTemporary"),v(j))}function v(j){const S=ci(d);if(j===126)return y>1?x(j):(f.consume(j),y++,v);if(y<2&&!r)return x(j);const E=f.exit("strikethroughSequenceTemporary"),C=ci(j);return E._open=!C||C===2&&!!S,E._close=!S||S===2&&!!C,m(j)}}}class uS{constructor(){this.map=[]}add(l,r,i){fS(this,l,r,i)}consume(l){if(this.map.sort(function(u,f){return u[0]-f[0]}),this.map.length===0)return;let r=this.map.length;const i=[];for(;r>0;)r-=1,i.push(l.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),l.length=this.map[r][0];i.push(l.slice()),l.length=0;let c=i.pop();for(;c;){for(const u of c)l.push(u);c=i.pop()}this.map.length=0}}function fS(t,l,r,i){let c=0;if(!(r===0&&i.length===0)){for(;c<t.map.length;){if(t.map[c][0]===l){t.map[c][1]+=r,t.map[c][2].push(...i);return}c+=1}t.map.push([l,r,i])}}function dS(t,l){let r=!1;const i=[];for(;l<t.length;){const c=t[l];if(r){if(c[0]==="enter")c[1].type==="tableContent"&&i.push(t[l+1][1].type==="tableDelimiterMarker"?"left":"none");else if(c[1].type==="tableContent"){if(t[l-1][1].type==="tableDelimiterMarker"){const u=i.length-1;i[u]=i[u]==="left"?"center":"right"}}else if(c[1].type==="tableDelimiterRow")break}else c[0]==="enter"&&c[1].type==="tableDelimiterRow"&&(r=!0);l+=1}return i}function hS(){return{flow:{null:{name:"table",tokenize:mS,resolveAll:xS}}}}function mS(t,l,r){const i=this;let c=0,u=0,f;return m;function m(D){let Y=i.events.length-1;for(;Y>-1;){const ee=i.events[Y][1].type;if(ee==="lineEnding"||ee==="linePrefix")Y--;else break}const F=Y>-1?i.events[Y][1].type:null,Q=F==="tableHead"||F==="tableRow"?O:x;return Q===O&&i.parser.lazy[i.now().line]?r(D):Q(D)}function x(D){return t.enter("tableHead"),t.enter("tableRow"),d(D)}function d(D){return D===124||(f=!0,u+=1),g(D)}function g(D){return D===null?r(D):Ue(D)?u>1?(u=0,i.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),v):r(D):it(D)?ft(t,g,"whitespace")(D):(u+=1,f&&(f=!1,c+=1),D===124?(t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),f=!0,g):(t.enter("data"),y(D)))}function y(D){return D===null||D===124||zt(D)?(t.exit("data"),g(D)):(t.consume(D),D===92?b:y)}function b(D){return D===92||D===124?(t.consume(D),y):y(D)}function v(D){return i.interrupt=!1,i.parser.lazy[i.now().line]?r(D):(t.enter("tableDelimiterRow"),f=!1,it(D)?ft(t,j,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):j(D))}function j(D){return D===45||D===58?E(D):D===124?(f=!0,t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),S):L(D)}function S(D){return it(D)?ft(t,E,"whitespace")(D):E(D)}function E(D){return D===58?(u+=1,f=!0,t.enter("tableDelimiterMarker"),t.consume(D),t.exit("tableDelimiterMarker"),C):D===45?(u+=1,C(D)):D===null||Ue(D)?R(D):L(D)}function C(D){return D===45?(t.enter("tableDelimiterFiller"),A(D)):L(D)}function A(D){return D===45?(t.consume(D),A):D===58?(f=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(D),t.exit("tableDelimiterMarker"),M):(t.exit("tableDelimiterFiller"),M(D))}function M(D){return it(D)?ft(t,R,"whitespace")(D):R(D)}function R(D){return D===124?j(D):D===null||Ue(D)?!f||c!==u?L(D):(t.exit("tableDelimiterRow"),t.exit("tableHead"),l(D)):L(D)}function L(D){return r(D)}function O(D){return t.enter("tableRow"),U(D)}function U(D){return D===124?(t.enter("tableCellDivider"),t.consume(D),t.exit("tableCellDivider"),U):D===null||Ue(D)?(t.exit("tableRow"),l(D)):it(D)?ft(t,U,"whitespace")(D):(t.enter("data"),X(D))}function X(D){return D===null||D===124||zt(D)?(t.exit("data"),U(D)):(t.consume(D),D===92?ne:X)}function ne(D){return D===92||D===124?(t.consume(D),X):X(D)}}function xS(t,l){let r=-1,i=!0,c=0,u=[0,0,0,0],f=[0,0,0,0],m=!1,x=0,d,g,y;const b=new uS;for(;++r<t.length;){const v=t[r],j=v[1];v[0]==="enter"?j.type==="tableHead"?(m=!1,x!==0&&(l0(b,l,x,d,g),g=void 0,x=0),d={type:"table",start:Object.assign({},j.start),end:Object.assign({},j.end)},b.add(r,0,[["enter",d,l]])):j.type==="tableRow"||j.type==="tableDelimiterRow"?(i=!0,y=void 0,u=[0,0,0,0],f=[0,r+1,0,0],m&&(m=!1,g={type:"tableBody",start:Object.assign({},j.start),end:Object.assign({},j.end)},b.add(r,0,[["enter",g,l]])),c=j.type==="tableDelimiterRow"?2:g?3:1):c&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")?(i=!1,f[2]===0&&(u[1]!==0&&(f[0]=f[1],y=ic(b,l,u,c,void 0,y),u=[0,0,0,0]),f[2]=r)):j.type==="tableCellDivider"&&(i?i=!1:(u[1]!==0&&(f[0]=f[1],y=ic(b,l,u,c,void 0,y)),u=f,f=[u[1],r,0,0])):j.type==="tableHead"?(m=!0,x=r):j.type==="tableRow"||j.type==="tableDelimiterRow"?(x=r,u[1]!==0?(f[0]=f[1],y=ic(b,l,u,c,r,y)):f[1]!==0&&(y=ic(b,l,f,c,r,y)),c=0):c&&(j.type==="data"||j.type==="tableDelimiterMarker"||j.type==="tableDelimiterFiller")&&(f[3]=r)}for(x!==0&&l0(b,l,x,d,g),b.consume(l.events),r=-1;++r<l.events.length;){const v=l.events[r];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=dS(l.events,r))}return t}function ic(t,l,r,i,c,u){const f=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",m="tableContent";r[0]!==0&&(u.end=Object.assign({},si(l.events,r[0])),t.add(r[0],0,[["exit",u,l]]));const x=si(l.events,r[1]);if(u={type:f,start:Object.assign({},x),end:Object.assign({},x)},t.add(r[1],0,[["enter",u,l]]),r[2]!==0){const d=si(l.events,r[2]),g=si(l.events,r[3]),y={type:m,start:Object.assign({},d),end:Object.assign({},g)};if(t.add(r[2],0,[["enter",y,l]]),i!==2){const b=l.events[r[2]],v=l.events[r[3]];if(b[1].end=Object.assign({},v[1].end),b[1].type="chunkText",b[1].contentType="text",r[3]>r[2]+1){const j=r[2]+1,S=r[3]-r[2]-1;t.add(j,S,[])}}t.add(r[3]+1,0,[["exit",y,l]])}return c!==void 0&&(u.end=Object.assign({},si(l.events,c)),t.add(c,0,[["exit",u,l]]),u=void 0),u}function l0(t,l,r,i,c){const u=[],f=si(l.events,r);c&&(c.end=Object.assign({},f),u.push(["exit",c,l])),i.end=Object.assign({},f),u.push(["exit",i,l]),t.add(r+1,0,u)}function si(t,l){const r=t[l],i=r[0]==="enter"?"start":"end";return r[1][i]}const pS={name:"tasklistCheck",tokenize:gS};function yS(){return{text:{91:pS}}}function gS(t,l,r){const i=this;return c;function c(x){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?r(x):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(x),t.exit("taskListCheckMarker"),u)}function u(x){return zt(x)?(t.enter("taskListCheckValueUnchecked"),t.consume(x),t.exit("taskListCheckValueUnchecked"),f):x===88||x===120?(t.enter("taskListCheckValueChecked"),t.consume(x),t.exit("taskListCheckValueChecked"),f):r(x)}function f(x){return x===93?(t.enter("taskListCheckMarker"),t.consume(x),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),m):r(x)}function m(x){return Ue(x)?l(x):it(x)?t.check({tokenize:bS},l,r)(x):r(x)}}function bS(t,l,r){return ft(t,i,"whitespace");function i(c){return c===null?r(c):l(c)}}function vS(t){return sy([X4(),tS(),cS(t),hS(),yS()])}const wS={};function Jy(t){const l=this,r=t||wS,i=l.data(),c=i.micromarkExtensions||(i.micromarkExtensions=[]),u=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),f=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);c.push(vS(r)),u.push(U4()),f.push(I4(r))}function Hs({content:t,className:l=""}){return o.jsx("div",{className:`office-markdown ${l}`,children:o.jsx(Ay,{remarkPlugins:[Jy],components:{code:kS,table:({children:r})=>o.jsx("div",{className:"overflow-x-auto my-2",children:o.jsx("table",{className:"office-table",children:r})})},children:t})})}function kS({className:t,children:l,...r}){const i=/language-(\w+)/.exec(t??"");return i||typeof l=="string"&&l.includes(`
|
|
79
|
+
`)?o.jsx(SS,{language:i==null?void 0:i[1],children:l}):o.jsx("code",{className:"bg-gray-100 text-gray-700 px-1 py-0.5 rounded text-[0.9em] font-mono",...r,children:l})}function SS({children:t,language:l}){const[r,i]=k.useState(!1),c=String(t).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(c),i(!0),setTimeout(()=>i(!1),1500)};return o.jsxs("div",{className:"office-code-block group relative my-2",children:[l&&o.jsx("div",{className:"text-[10px] text-gray-400 px-3 pt-1.5",children:l}),o.jsx("button",{onClick:u,className:"absolute top-1.5 right-2 text-[10px] text-gray-400 hover:text-gray-600 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:r?"Copied!":"Copy"}),o.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:o.jsx("code",{children:c})})]})}const r0={$skin:"skinColor",$hair:"hairColor",$shirt:"shirtColor",$pants:"pantsColor",$shoes:"shoeColor"},jS=/^(darken|lighten)\((\$\w+),\s*(\d+)\)$/;function CS(t,l){const r=parseInt(t.replace("#",""),16),i=Math.max(0,(r>>16&255)-l),c=Math.max(0,(r>>8&255)-l),u=Math.max(0,(r&255)-l);return`#${(i<<16|c<<8|u).toString(16).padStart(6,"0")}`}function ES(t,l){const r=parseInt(t.replace("#",""),16),i=Math.min(255,(r>>16&255)+l),c=Math.min(255,(r>>8&255)+l),u=Math.min(255,(r&255)+l);return`#${(i<<16|c<<8|u).toString(16).padStart(6,"0")}`}function Py(t,l){const r=r0[t];if(r&&l)return l[r];const i=jS.exec(t);if(i){const[,c,u,f]=i,m=r0[u],x=m&&l?l[m]:u,d=parseInt(f,10);return c==="darken"?CS(x,d):ES(x,d)}return t}function a0(t,l=12){return t.map(r=>({...r,x:l-r.x-r.w}))}function NS(t,l){return l==="down"?t.down:l==="up"&&t.up?t.up:l==="left"&&t.left?t.left:l==="right"&&t.right?t.right:l==="right"&&t.left?{name:t.left.name,pixels:a0(t.left.pixels)}:l==="left"&&t.right?{name:t.right.name,pixels:a0(t.right.pixels)}:t.down}function AS(t,l){return Kd(t,"hair",l,1)}function Kd(t,l,r,i){const c=t.layers.findIndex(f=>f.name===l),u=[...t.layers];if(c>=0)u[c]={...r,name:l};else{const f=i??u.length;u.splice(f,0,{...r,name:l})}return{...t,layers:u}}const vh=new Map,wh=new Map;function eg(t,l){vh.set(t,l)}function Uc(t,l){wh.set(t,l)}function Qd(t){return vh.get(t)}function TS(t){return wh.get(t)}function vN(){return Array.from(vh.keys())}function wN(){return Array.from(wh.keys())}function DS(t,l,r,i,c=2){t.clearRect(0,0,l.width*c,l.height*c);for(const u of l.layers)tg(t,u.pixels,c,r,i)}function Wd(t,l,r,i,c){for(const u of l){const f=Py(u.c,c);u.a!==void 0&&u.a!==1&&(t.globalAlpha=u.a),t.fillStyle=f,t.fillRect(r+u.x,i+u.y,u.w,u.h),u.a!==void 0&&u.a!==1&&(t.globalAlpha=1)}}function zS(t,l){const r=l.scale;t.clearRect(0,0,l.canvasWidth,l.canvasHeight),tg(t,l.pixels,r,0)}function tg(t,l,r,i,c){for(const u of l){const f=Py(u.c,c);u.a!==void 0&&u.a!==1&&(t.globalAlpha=u.a),t.fillStyle=f,t.fillRect(u.x*r,(u.y+i)*r,u.w*r,u.h*r),u.a!==void 0&&u.a!==1&&(t.globalAlpha=1)}}const Tc=new Map;function Xr(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Tc.set(t,{id:t,name:l,layer:{...c.down,name:"hair"},directions:{down:{...c.down,name:"hair"},up:c.up?{...c.up,name:"hair"}:void 0,left:c.left?{...c.left,name:"hair"}:void 0,right:c.right?{...c.right,name:"hair"}:void 0}})}else{const c=r;Tc.set(t,{id:t,name:l,layer:{...c,name:"hair"}})}}function MS(t){return Tc.get(t)}function ng(){return Array.from(Tc.values())}Xr("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}]}});Xr("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}]}});Xr("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}]}});Xr("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}]}});Xr("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"}]}});Xr("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}]}});Xr("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}]}});Xr("curly","Curly",{down:{name:"hair",pixels:[{x:0,y:0,w:12,h:4,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:11,y:1,w:2,h:5,c:"$hair"},{x:2,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:6,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:4,y:2,w:2,h:1,c:"lighten($hair, 15)",a:.3},{x:8,y:2,w:2,h:1,c:"lighten($hair, 15)",a:.3}]},up:{name:"hair",pixels:[{x:0,y:0,w:12,h:4,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:11,y:1,w:2,h:5,c:"$hair"},{x:1,y:2,w:10,h:4,c:"$hair"},{x:3,y:1,w:2,h:1,c:"lighten($hair, 15)",a:.3},{x:7,y:1,w:2,h:1,c:"lighten($hair, 15)",a:.3}]},left:{name:"hair",pixels:[{x:0,y:0,w:10,h:4,c:"$hair"},{x:-1,y:1,w:2,h:5,c:"$hair"},{x:2,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:5,y:0,w:2,h:1,c:"lighten($hair, 25)",a:.4},{x:3,y:2,w:2,h:1,c:"lighten($hair, 15)",a:.3}]}});const Dc=new Map;function Dl(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Dc.set(t,{id:t,name:l,layer:{...c.down,name:"torso"},directions:{down:{...c.down,name:"torso"},up:c.up?{...c.up,name:"torso"}:void 0,left:c.left?{...c.left,name:"torso"}:void 0,right:c.right?{...c.right,name:"torso"}:void 0}})}else{const c=r;Dc.set(t,{id:t,name:l,layer:{...c,name:"torso"}})}}function RS(t){return Dc.get(t)}function lg(){return Array.from(Dc.values())}Dl("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"}]}});Dl("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"}]}});Dl("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"}]}});Dl("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)"}]}});Dl("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)"}]}});Dl("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"}]}});Dl("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"}]}});Dl("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"}]}});Dl("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"}]}});Dl("robe","Robe",{down:{name:"torso",pixels:[{x:0,y:10,w:12,h:7,c:"$shirt"},{x:0,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:3,y:10,w:3,h:4,c:"lighten($shirt, 15)",a:.25},{x:6,y:10,w:3,h:4,c:"darken($shirt, 10)",a:.2},{x:1,y:14,w:10,h:1,c:"darken($shirt, 35)"},{x:2,y:14,w:8,h:1,c:"darken($shirt, 25)",a:.4},{x:-2,y:11,w:3,h:5,c:"$shirt"},{x:11,y:11,w:3,h:5,c:"$shirt"},{x:-2,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:11,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},up:{name:"torso",pixels:[{x:0,y:10,w:12,h:7,c:"$shirt"},{x:0,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:11,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:1,y:14,w:10,h:1,c:"darken($shirt, 35)"},{x:-2,y:11,w:3,h:5,c:"$shirt"},{x:11,y:11,w:3,h:5,c:"$shirt"},{x:-2,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:11,y:15,w:3,h:1,c:"darken($shirt, 15)",a:.3},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}]},left:{name:"torso",pixels:[{x:0,y:10,w:10,h:7,c:"$shirt"},{x:0,y:10,w:1,h:6,c:"darken($shirt, 25)",a:.3},{x:1,y:14,w:8,h:1,c:"darken($shirt, 35)"},{x:-2,y:11,w:4,h:5,c:"$shirt"},{x:-2,y:15,w:4,h:1,c:"darken($shirt, 15)",a:.3},{x:-1,y:15,w:2,h:1,c:"$skin"}]}});const Rs=new Map;function gt(t,l,r){if("down"in r&&!("pixels"in r)){const c=r;Rs.set(t,{id:t,name:l,layer:{...c.down,name:"accessory"},directions:{down:{...c.down,name:"accessory"},up:c.up?{...c.up,name:"accessory"}:void 0,left:c.left?{...c.left,name:"accessory"}:void 0,right:c.right?{...c.right,name:"accessory"}:void 0}})}else{const c=r;Rs.set(t,{id:t,name:l,layer:{...c,name:"accessory"}})}}function FS(t){return Rs.get(t)}function _S(t,l){const r=Rs.get(t);if(!r)return;if(r.directions)return NS(r.directions,l);if(l==="down")return r.layer;const i=r.layer.pixels.filter(u=>u.y<2);if(i.length===0)return;const c=l==="right"?1:l==="left"?-1:0;return{name:r.layer.name,pixels:c?i.map(u=>({...u,x:u.x+c})):i}}function rg(){return Array.from(Rs.values())}gt("none","None",{name:"accessory",pixels:[]});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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"}]}});gt("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}]}});gt("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}]}});gt("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"}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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"}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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}]}});gt("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"}]}});gt("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"}]}});gt("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}]}});gt("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}]}});gt("dog-face","Dog Face",{down:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#D2A25C"},{x:2,y:-1,w:8,h:1,c:"#D2A25C"},{x:-1,y:1,w:3,h:6,c:"#A67B3D"},{x:10,y:1,w:3,h:6,c:"#A67B3D"},{x:3,y:5,w:6,h:4,c:"#F5E6D0",a:.8},{x:3,y:2,w:2,h:3,c:"#3E2723"},{x:7,y:2,w:2,h:3,c:"#3E2723"},{x:3,y:2,w:1,h:1,c:"#FFF",a:.4},{x:7,y:2,w:1,h:1,c:"#FFF",a:.4},{x:5,y:5,w:2,h:2,c:"#222"},{x:5,y:7,w:2,h:2,c:"#FF6B8A",a:.8},{x:5,y:7,w:1,h:1,c:"#FF8A9E",a:.4}]},up:{name:"accessory",pixels:[{x:1,y:0,w:10,h:9,c:"#D2A25C"},{x:2,y:-1,w:8,h:1,c:"#D2A25C"},{x:-1,y:1,w:3,h:6,c:"#A67B3D"},{x:10,y:1,w:3,h:6,c:"#A67B3D"},{x:5,y:0,w:2,h:6,c:"#B8883C",a:.3},{x:2,y:8,w:8,h:1,c:"#A67B3D",a:.5}]},left:{name:"accessory",pixels:[{x:1,y:0,w:9,h:9,c:"#D2A25C"},{x:2,y:-1,w:7,h:1,c:"#D2A25C"},{x:-1,y:1,w:3,h:6,c:"#A67B3D"},{x:-1,y:4,w:3,h:4,c:"#D2A25C"},{x:-1,y:5,w:2,h:3,c:"#F5E6D0",a:.8},{x:3,y:2,w:2,h:3,c:"#3E2723"},{x:3,y:2,w:1,h:1,c:"#FFF",a:.4},{x:0,y:5,w:2,h:1,c:"#222"},{x:0,y:7,w:2,h:1,c:"#FF6B8A",a:.7}]}});const OS={none:1,glasses:1,beret:1,cap:1,badge:1,blush:1,lapels:1,"round-glasses":2,headphones:2,scarf:3,tie:3,bowtie:3,sunglasses:4,bandana:4,eyepatch:4,crown:5,halo:5,horns:5,mask:5,"cat-ears":6,"bear-ears":6,"bunny-ears":6,"dog-nose":6,"fox-mask":6,"cat-face":7,"bear-face":7,"panda-face":7,"frog-face":8,"rabbit-face":8,"dog-face":8,"star-glasses":9};function ag(t){return OS[t]??1}function ig(t,l){return l>=ag(t)}gt("star-glasses","Star Glasses",{down:{name:"accessory",pixels:[{x:1,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:2,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:2,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:7,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:8,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:8,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:5,y:4,w:2,h:1,c:"#FF4081",a:.4}]},up:{name:"accessory",pixels:[{x:0,y:3,w:2,h:1,c:"#FF4081",a:.3},{x:10,y:3,w:2,h:1,c:"#FF4081",a:.3}]},left:{name:"accessory",pixels:[{x:1,y:3,w:4,h:3,c:"#FF4081",a:.6},{x:2,y:2,w:2,h:1,c:"#FF4081",a:.6},{x:2,y:6,w:2,h:1,c:"#FF4081",a:.6},{x:5,y:4,w:6,h:1,c:"#FF4081",a:.3}]}});function ys({r:t,g:l,b:r}){return`#${(t<<16|l<<8|r).toString(16).padStart(6,"0")}`}function vc(t,l){const r=t.r-l.r,i=t.g-l.g,c=t.b-l.b;return r*r+i*i+c*c}function BS(t,l){const r=[];r.push(t[Math.floor(Math.random()*t.length)]);for(let i=1;i<l;i++){const c=t.map(m=>{let x=1/0;for(const d of r)x=Math.min(x,vc(m,d));return x}),u=c.reduce((m,x)=>m+x,0);let f=Math.random()*u;for(let m=0;m<t.length;m++)if(f-=c[m],f<=0){r.push(t[m]);break}r.length<=i&&r.push(t[Math.floor(Math.random()*t.length)])}return r}function LS(t,l,r=20){if(t.length===0)return[];const i=BS(t,l);for(let u=0;u<r;u++){const f=Array.from({length:l},()=>[]);for(const x of t){let d=1/0,g=0;for(let y=0;y<l;y++){const b=vc(x,i[y]);b<d&&(d=b,g=y)}f[g].push(x)}let m=!0;for(let x=0;x<l;x++){if(f[x].length===0)continue;const d={r:0,g:0,b:0};for(const b of f[x])d.r+=b.r,d.g+=b.g,d.b+=b.b;const g=f[x].length,y={r:Math.round(d.r/g),g:Math.round(d.g/g),b:Math.round(d.b/g)};vc(y,i[x])>1&&(m=!1),i[x]=y}if(m)break}const c=new Array(l).fill(0);for(const u of t){let f=1/0,m=0;for(let x=0;x<l;x++){const d=vc(u,i[x]);d<f&&(f=d,m=x)}c[m]++}return i.map((u,f)=>({c:u,count:c[f]})).sort((u,f)=>f.count-u.count).map(u=>u.c)}function $S(t,l=1e4){const r=document.createElement("canvas"),i=t instanceof HTMLImageElement?t.naturalWidth:t.width,c=t instanceof HTMLImageElement?t.naturalHeight:t.height;r.width=i,r.height=c;const u=r.getContext("2d");u.drawImage(t,0,0);const f=u.getImageData(0,0,i,c).data,m=i*c,x=Math.max(1,Math.floor(m/l)),d=[];for(let g=0;g<m;g+=x){const y=g*4;f[y+3]<128||d.push({r:f[y],g:f[y+1],b:f[y+2]})}return d}function i0(t){return .299*t.r+.587*t.g+.114*t.b}function s0(t){const l=Math.max(t.r,t.g,t.b),r=Math.min(t.r,t.g,t.b);return l===0?0:(l-r)/l*255}function HS(t,l=8){const r=$S(t),i=LS(r,l);if(i.length<5)return{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121"};const c=[...i].sort((y,b)=>i0(b)-i0(y)),u=[...i].sort((y,b)=>s0(b)-s0(y)),f=c[0],m=c[c.length-1],x=u[0],d=c[c.length-2],g=c[c.length-1];return{skinColor:ys(f),hairColor:ys(m),shirtColor:ys(x),pantsColor:ys(d),shoeColor:ys(g)}}const US=[{x:1,y:19,w:10,h:2,c:"#100A06",a:.15},{x:2,y:15,w:3,h:4,c:"$pants"},{x:7,y:15,w:3,h:4,c:"$pants"},{x:2,y:19,w:3,h:2,c:"$shoes"},{x:7,y:19,w:3,h:2,c:"$shoes"},{x:2,y:19,w:3,h:1,c:"lighten($shoes, 20)",a:.4},{x:7,y:19,w:3,h:1,c:"lighten($shoes, 20)",a:.4}],IS=[{x:1,y:10,w:10,h:6,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:5,c:"darken($shirt, 25)",a:.25},{x:4,y:10,w:4,h:2,c:"darken($shirt, 25)",a:.2},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"},{x:-1,y:15,w:2,h:1,c:"$skin"},{x:11,y:15,w:2,h:1,c:"$skin"}],YS=[{x:4,y:8,w:4,h:3,c:"$skin"},{x:1,y:1,w:10,h:8,c:"$skin"},{x:3,y:4,w:2,h:2,c:"#1A1A2E"},{x:7,y:4,w:2,h:2,c:"#1A1A2E"},{x:3,y:4,w:1,h:1,c:"#FFF",a:.35},{x:7,y:4,w:1,h:1,c:"#FFF",a:.35},{x:5,y:7,w:2,h:1,c:"darken($skin, 25)",a:.4},{x:0,y:4,w:1,h:1,c:"$skin"},{x:11,y:4,w:1,h:1,c:"$skin"}],qS=[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:10,y:1,w:2,h:3,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:2,y:2,w:8,h:1,c:"darken($hair, 20)",a:.2}];function XS(){return{width:12,height:22,layers:[{name:"lower",pixels:US},{name:"torso",pixels:IS},{name:"head",pixels:YS},{name:"hair",pixels:qS},{name:"accessory",pixels:[]}]}}const VS=["cto","cbo","pm","engineer","designer","qa","data-analyst","default"];for(const t of VS)eg(`mini:${t}`,XS());const GS=[{x:1,y:10,w:10,h:8,c:"$shirt"},{x:2,y:10,w:8,h:1,c:"lighten($shirt, 18)",a:.3},{x:1,y:10,w:1,h:7,c:"darken($shirt, 25)",a:.25},{x:10,y:10,w:1,h:7,c:"darken($shirt, 25)",a:.25},{x:4,y:10,w:4,h:2,c:"darken($shirt, 25)",a:.2},{x:-1,y:11,w:2,h:5,c:"$shirt"},{x:11,y:11,w:2,h:5,c:"$shirt"}],KS=[{x:4,y:8,w:4,h:3,c:"$skin"},{x:1,y:1,w:10,h:8,c:"$skin"},{x:3,y:4,w:2,h:2,c:"#1A1A2E"},{x:7,y:4,w:2,h:2,c:"#1A1A2E"},{x:3,y:4,w:1,h:1,c:"#FFF",a:.35},{x:7,y:4,w:1,h:1,c:"#FFF",a:.35},{x:5,y:7,w:2,h:1,c:"darken($skin, 25)",a:.4},{x:0,y:4,w:1,h:1,c:"$skin"},{x:11,y:4,w:1,h:1,c:"$skin"}],QS=[{x:1,y:0,w:10,h:3,c:"$hair"},{x:0,y:1,w:2,h:3,c:"$hair"},{x:10,y:1,w:2,h:3,c:"$hair"},{x:2,y:0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:2,y:2,w:8,h:1,c:"darken($hair, 20)",a:.2}];function WS(){return{width:12,height:22,layers:[{name:"torso",pixels:GS},{name:"head",pixels:KS},{name:"hair",pixels:QS},{name:"accessory",pixels:[]}]}}eg("mini-seated:default",WS());const ZS={canvasWidth:160,canvasHeight:80,scale:2,pixels:[{x:0,y:0,w:80,h:40,c:"#1e2030"},{x:10,y:2,w:10,h:6,c:"#78889c"},{x:10,y:2,w:10,h:1,c:"#8899ad"},{x:24,y:0,w:10,h:6,c:"#78889c"},{x:24,y:0,w:10,h:1,c:"#8899ad"},{x:38,y:2,w:10,h:6,c:"#78889c"},{x:38,y:2,w:10,h:1,c:"#8899ad"},{x:54,y:2,w:10,h:6,c:"#78889c"},{x:54,y:2,w:10,h:1,c:"#8899ad"},{x:11,y:7,w:2,h:2,c:"#2a2a2a"},{x:17,y:7,w:2,h:2,c:"#2a2a2a"},{x:25,y:5,w:2,h:2,c:"#2a2a2a"},{x:31,y:5,w:2,h:2,c:"#2a2a2a"},{x:39,y:7,w:2,h:2,c:"#2a2a2a"},{x:45,y:7,w:2,h:2,c:"#2a2a2a"},{x:55,y:7,w:2,h:2,c:"#2a2a2a"},{x:61,y:7,w:2,h:2,c:"#2a2a2a"},{x:8,y:8,w:64,h:24,c:"#6b5b4b"},{x:4,y:10,w:72,h:20,c:"#7d6d5d"},{x:2,y:12,w:76,h:16,c:"#7d6d5d"},{x:2,y:12,w:76,h:2,c:"#8b7b6b"},{x:2,y:26,w:76,h:2,c:"#4b3b2b"},{x:2,y:28,w:76,h:3,c:"#4b3b2b"},{x:4,y:28,w:72,h:1,c:"#5b4b3b"},{x:6,y:30,w:3,h:2,c:"#3a2a1a"},{x:71,y:30,w:3,h:2,c:"#3a2a1a"},{x:18,y:14,w:44,h:12,c:"#6b5b4b",a:.5},{x:28,y:14,w:14,h:8,c:"#1a1a2e"},{x:29,y:15,w:12,h:6,c:"#1565C0",a:.5},{x:30,y:16,w:8,h:1,c:"#60A5FA",a:.45},{x:30,y:18,w:5,h:1,c:"#60A5FA",a:.3},{x:58,y:16,w:5,h:5,c:"#795548"},{x:59,y:17,w:3,h:3,c:"#A67C52"},{x:63,y:18,w:2,h:2,c:"#795548"},{x:10,y:16,w:10,h:8,c:"#FFEE58",a:.7},{x:11,y:17,w:8,h:1,c:"#9E9E9E",a:.5},{x:11,y:19,w:8,h:1,c:"#9E9E9E",a:.5},{x:11,y:21,w:6,h:1,c:"#9E9E9E",a:.5},{x:10,y:32,w:10,h:6,c:"#78889c"},{x:10,y:32,w:10,h:1,c:"#8899ad"},{x:24,y:34,w:10,h:6,c:"#78889c"},{x:24,y:34,w:10,h:1,c:"#8899ad"},{x:38,y:32,w:10,h:6,c:"#78889c"},{x:38,y:32,w:10,h:1,c:"#8899ad"},{x:54,y:32,w:10,h:6,c:"#78889c"},{x:54,y:32,w:10,h:1,c:"#8899ad"},{x:11,y:37,w:2,h:2,c:"#2a2a2a"},{x:17,y:37,w:2,h:2,c:"#2a2a2a"},{x:25,y:39,w:2,h:2,c:"#2a2a2a"},{x:31,y:39,w:2,h:2,c:"#2a2a2a"},{x:39,y:37,w:2,h:2,c:"#2a2a2a"},{x:45,y:37,w:2,h:2,c:"#2a2a2a"},{x:55,y:37,w:2,h:2,c:"#2a2a2a"},{x:61,y:37,w:2,h:2,c:"#2a2a2a"}]},JS={canvasWidth:128,canvasHeight:96,scale:2,pixels:[{x:0,y:0,w:64,h:48,c:"#4b3b2b"},{x:3,y:3,w:58,h:42,c:"#8B7355"},{x:4,y:4,w:10,h:10,c:"#A0845C",a:.5},{x:20,y:8,w:8,h:8,c:"#A0845C",a:.4},{x:40,y:6,w:12,h:6,c:"#A0845C",a:.3},{x:8,y:30,w:14,h:10,c:"#A0845C",a:.25},{x:44,y:32,w:10,h:8,c:"#A0845C",a:.3},{x:6,y:8,w:18,h:12,c:"#FFEE58"},{x:5,y:7,w:3,h:3,c:"#EF5350"},{x:6,y:7,w:2,h:2,c:"#C62828"},{x:8,y:10,w:14,h:1,c:"#9E9E9E"},{x:8,y:12,w:12,h:1,c:"#9E9E9E"},{x:8,y:14,w:10,h:1,c:"#9E9E9E"},{x:28,y:6,w:16,h:14,c:"#B3E5FC"},{x:35,y:5,w:3,h:3,c:"#42A5F5"},{x:36,y:5,w:2,h:2,c:"#1565C0"},{x:30,y:9,w:12,h:1,c:"#9E9E9E"},{x:30,y:11,w:10,h:1,c:"#9E9E9E"},{x:30,y:13,w:11,h:1,c:"#9E9E9E"},{x:8,y:24,w:16,h:14,c:"#C8E6C9"},{x:15,y:23,w:3,h:3,c:"#66BB6A"},{x:16,y:23,w:2,h:2,c:"#388E3C"},{x:10,y:27,w:12,h:1,c:"#9E9E9E"},{x:10,y:29,w:8,h:1,c:"#9E9E9E"},{x:10,y:31,w:10,h:1,c:"#9E9E9E"},{x:28,y:24,w:28,h:16,c:"#FFCDD2"},{x:43,y:23,w:3,h:3,c:"#EF5350"},{x:44,y:23,w:2,h:2,c:"#B71C1C"},{x:32,y:27,w:24,h:1,c:"#9E9E9E"},{x:32,y:29,w:20,h:1,c:"#9E9E9E"},{x:32,y:31,w:22,h:1,c:"#9E9E9E"},{x:32,y:33,w:15,h:1,c:"#9E9E9E"},{x:0,y:0,w:64,h:3,c:"#5a4a3a"},{x:0,y:45,w:64,h:3,c:"#3a2a1a"}]},PS={canvasWidth:128,canvasHeight:96,scale:2,pixels:[{x:2,y:0,w:60,h:48,c:"#3b1f0a"},{x:4,y:2,w:56,h:44,c:"#5a3310"},{x:4,y:13,w:56,h:2,c:"#2d1508"},{x:4,y:27,w:56,h:2,c:"#2d1508"},{x:4,y:41,w:56,h:2,c:"#2d1508"},{x:5,y:3,w:4,h:10,c:"#2563EB"},{x:5,y:3,w:4,h:2,c:"#1D4ED8"},{x:10,y:4,w:3,h:9,c:"#DC2626"},{x:10,y:4,w:3,h:2,c:"#B91C1C"},{x:14,y:3,w:5,h:10,c:"#16A34A"},{x:14,y:3,w:5,h:2,c:"#15803D"},{x:20,y:4,w:3,h:9,c:"#9333EA"},{x:20,y:4,w:3,h:2,c:"#7E22CE"},{x:24,y:3,w:4,h:10,c:"#D97706"},{x:24,y:3,w:4,h:2,c:"#B45309"},{x:29,y:4,w:3,h:9,c:"#0891B2"},{x:29,y:4,w:3,h:2,c:"#0E7490"},{x:33,y:3,w:5,h:10,c:"#BE123C"},{x:33,y:3,w:5,h:2,c:"#9F1239"},{x:39,y:4,w:4,h:9,c:"#4F46E5"},{x:39,y:4,w:4,h:2,c:"#3730A3"},{x:44,y:3,w:3,h:10,c:"#065F46"},{x:44,y:3,w:3,h:2,c:"#064E3B"},{x:48,y:4,w:4,h:9,c:"#92400E"},{x:48,y:4,w:4,h:2,c:"#78350F"},{x:53,y:3,w:5,h:10,c:"#1E3A5F"},{x:53,y:3,w:5,h:2,c:"#1e3060"},{x:6,y:6,w:2,h:1,c:"#BFDBFE",a:.7},{x:11,y:7,w:1,h:1,c:"#FCA5A5",a:.7},{x:16,y:6,w:3,h:1,c:"#BBF7D0",a:.7},{x:21,y:7,w:1,h:1,c:"#D8B4FE",a:.7},{x:25,y:6,w:2,h:1,c:"#FDE68A",a:.7},{x:5,y:16,w:5,h:11,c:"#0F766E"},{x:5,y:16,w:5,h:2,c:"#0D6056"},{x:11,y:17,w:3,h:10,c:"#C2410C"},{x:11,y:17,w:3,h:2,c:"#9A3412"},{x:15,y:16,w:4,h:11,c:"#7C3AED"},{x:15,y:16,w:4,h:2,c:"#6D28D9"},{x:20,y:17,w:3,h:10,c:"#1D4ED8"},{x:20,y:17,w:3,h:2,c:"#1E40AF"},{x:24,y:16,w:5,h:11,c:"#166534"},{x:24,y:16,w:5,h:2,c:"#14532D"},{x:30,y:17,w:4,h:10,c:"#991B1B"},{x:30,y:17,w:4,h:2,c:"#7F1D1D"},{x:35,y:16,w:3,h:11,c:"#854D0E"},{x:35,y:16,w:3,h:2,c:"#713F12"},{x:39,y:17,w:4,h:10,c:"#1E40AF"},{x:39,y:17,w:4,h:2,c:"#1E3A8A"},{x:44,y:16,w:5,h:11,c:"#065F46"},{x:44,y:16,w:5,h:2,c:"#064E3B"},{x:50,y:17,w:3,h:10,c:"#831843"},{x:50,y:17,w:3,h:2,c:"#6B21A8"},{x:54,y:16,w:5,h:11,c:"#374151"},{x:54,y:16,w:5,h:2,c:"#1F2937"},{x:5,y:30,w:4,h:11,c:"#0E7490"},{x:5,y:30,w:4,h:2,c:"#0C6B7E"},{x:10,y:31,w:3,h:10,c:"#B45309"},{x:10,y:31,w:3,h:2,c:"#92400E"},{x:14,y:30,w:5,h:11,c:"#6D28D9"},{x:14,y:30,w:5,h:2,c:"#5B21B6"},{x:20,y:30,w:7,h:8,c:"#1e293b"},{x:22,y:32,w:3,h:3,c:"#3b82f6",a:.9},{x:22,y:32,w:1,h:3,c:"#60a5fa",a:.6},{x:28,y:31,w:4,h:10,c:"#DC2626"},{x:28,y:31,w:4,h:2,c:"#B91C1C"},{x:33,y:30,w:3,h:11,c:"#065F46"},{x:33,y:30,w:3,h:2,c:"#064E3B"},{x:37,y:31,w:4,h:10,c:"#1D4ED8"},{x:37,y:31,w:4,h:2,c:"#1E40AF"},{x:42,y:35,w:6,h:6,c:"#92400E"},{x:43,y:30,w:4,h:6,c:"#16a34a",a:.8},{x:43,y:29,w:2,h:3,c:"#15803d",a:.7},{x:45,y:28,w:2,h:4,c:"#16a34a",a:.6},{x:49,y:30,w:3,h:11,c:"#7C3AED"},{x:49,y:30,w:3,h:2,c:"#6D28D9"},{x:53,y:31,w:5,h:10,c:"#B45309"},{x:53,y:31,w:5,h:2,c:"#92400E"},{x:2,y:46,w:60,h:2,c:"#1a0a03"},{x:2,y:0,w:60,h:2,c:"#4a2510"},{x:2,y:0,w:2,h:48,c:"#2d1508"},{x:60,y:0,w:2,h:48,c:"#2d1508"}]},ej={canvasWidth:96,canvasHeight:120,scale:2,pixels:[{x:2,y:0,w:44,h:60,c:"#546E7A"},{x:2,y:0,w:44,h:3,c:"#78909C"},{x:2,y:57,w:44,h:3,c:"#37474F"},{x:2,y:0,w:2,h:60,c:"#455A64"},{x:44,y:0,w:2,h:60,c:"#37474F"},{x:5,y:4,w:38,h:3,c:"#FFD54F",a:.5},{x:6,y:1,w:2,h:4,c:"#FFFDE7"},{x:10,y:0,w:2,h:5,c:"#FFF9C4"},{x:14,y:1,w:2,h:3,c:"#FFFDE7"},{x:18,y:0,w:2,h:4,c:"#FFF8E1"},{x:5,y:5,w:38,h:16,c:"#607D8B"},{x:5,y:5,w:38,h:2,c:"#78909C"},{x:15,y:12,w:18,h:4,c:"#37474F"},{x:22,y:11,w:4,h:6,c:"#455A64"},{x:23,y:13,w:2,h:2,c:"#B0BEC5"},{x:7,y:14,w:8,h:5,c:"#B0BEC5"},{x:8,y:15,w:6,h:1,c:"#607D8B"},{x:8,y:17,w:5,h:1,c:"#607D8B"},{x:5,y:23,w:38,h:16,c:"#607D8B"},{x:5,y:23,w:38,h:2,c:"#78909C"},{x:15,y:30,w:18,h:4,c:"#37474F"},{x:22,y:29,w:4,h:6,c:"#455A64"},{x:23,y:31,w:2,h:2,c:"#B0BEC5"},{x:7,y:32,w:8,h:5,c:"#B0BEC5"},{x:8,y:33,w:6,h:1,c:"#607D8B"},{x:8,y:35,w:4,h:1,c:"#607D8B"},{x:5,y:41,w:38,h:16,c:"#607D8B"},{x:5,y:41,w:38,h:2,c:"#78909C"},{x:15,y:48,w:18,h:4,c:"#37474F"},{x:22,y:47,w:4,h:6,c:"#455A64"},{x:23,y:49,w:2,h:2,c:"#B0BEC5"},{x:7,y:50,w:8,h:5,c:"#B0BEC5"},{x:8,y:51,w:6,h:1,c:"#607D8B"},{x:8,y:53,w:3,h:1,c:"#607D8B"}]};Uc("meeting",ZS);Uc("bulletin",JS);Uc("decision",ej);Uc("knowledge",PS);const pd=16,yd=24,tj=60,nj={cbo:0,cto:8,pm:15,engineer:22,designer:5,qa:12};function sg(t,l){if(!t)return t;let r=t;if(l!=null&&l.hairStyle){const i=MS(l.hairStyle);i&&(r=AS(r,i.layer))}if(l!=null&&l.outfitStyle){const i=RS(l.outfitStyle);i&&(r=Kd(r,"torso",i.layer,1))}if(l!=null&&l.accessory&&l.accessory!=="none"){const i=FS(l.accessory);i&&(r=Kd(r,"accessory",i.layer))}return r}function Ic({roleId:t,className:l,appearance:r,scale:i}){const c=k.useRef(null),u=k.useRef(0),f=k.useRef(0),m=k.useRef(r);m.current=r;const x=i??4,d=pd*x,g=yd*x,y=k.useMemo(()=>{const b=Qd(`mini:${t}`)??Qd("mini:default");return sg(b,r)},[t,r==null?void 0:r.hairStyle,r==null?void 0:r.outfitStyle,r==null?void 0:r.accessory]);return k.useEffect(()=>{const b=c.current;if(!b)return;const v=b.getContext("2d");if(!v)return;const j=nj[t]??0,S=()=>{f.current++;const E=m.current;if(!E||!y){u.current=requestAnimationFrame(S);return}const A=(f.current+j)%tj<30?1:0;v.clearRect(0,0,pd,yd),v.save(),v.translate(2,1),DS(v,y,A,E,1),v.restore(),u.current=requestAnimationFrame(S)};return u.current=requestAnimationFrame(S),()=>cancelAnimationFrame(u.current)},[t,y]),o.jsx("canvas",{ref:c,width:pd,height:yd,className:l,style:{imageRendering:"pixelated",display:"block",width:d,height:g}})}const lj="https://api.tycono.ai",kh=lj;async function sc(t){const l=await fetch(`${kh}${t}`);if(!l.ok)throw new Error(`Cloud API error: ${l.status}`);return l.json()}async function oc(t,l){const r=await fetch(`${kh}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!r.ok)throw new Error(`Cloud API error: ${r.status}`);return r.json()}const Ts={health:()=>sc("/api/health"),getCharacters:()=>sc("/api/store/characters"),getCharacter:t=>sc(`/api/store/characters/${t}`),getCharacterVersion:t=>sc(`/api/store/characters/${t}/version`),syncCheck:t=>oc("/api/sync/check",{roles:t}),syncPull:t=>oc("/api/sync/pull",{sourceId:t}),publishCharacter:t=>oc("/api/store/publish",t),deleteCharacter:t=>fetch(`${kh}/api/store/characters/${t}`,{method:"DELETE"}).then(l=>l.json()),uploadTelemetry:t=>oc("/api/telemetry",t)},rj={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"},gd={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},aj={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},ij=500,o0=360,c0=700,sj=t=>`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`;function oj({role:t,allRoles:l,recentActivity:r,onClose:i,onFireRole:c,terminalWidth:u=0,activeJobId:f,activeTask:m,isWorking:x,jobStartedAt:d,onStopJob:g,sessions:y,streamingSessionId:b,onCreateSessionSilent:v,onSendMessage:j,onFocusTerminal:S,onCustomize:E,onUpdateRole:C,appearance:A,relationships:M,roleLevel:R}){var ze,Ie;const[L,O]=k.useState(ij),[U,X]=k.useState(!1),ne=k.useRef(0),D=k.useRef(0),[Y,F]=k.useState(!1),[Q,ee]=k.useState(!1),[V,I]=k.useState(!1),[Z,ce]=k.useState(!1),[we,z]=k.useState("talk"),[B,W]=k.useState(!1),[T,me]=k.useState(""),[Se,Ee]=k.useState(!1),Oe=k.useRef(null),{events:He,status:Ge}=V0(f??null),[ke,xt]=k.useState(0);k.useEffect(()=>{if(!x||!d){xt(0);return}const be=new Date(d).getTime(),je=()=>xt(Math.floor((Date.now()-be)/1e3));je();const jt=setInterval(je,1e3);return()=>clearInterval(jt)},[x,d]);const he=u>0,G=he?u:0,ie=he?Math.max(o0,window.innerWidth-u-100):c0,xe=Math.min(L,ie),Te=k.useCallback(be=>{be.preventDefault(),ne.current=be.clientX,D.current=xe,X(!0);const je=vt=>{const Je=ne.current-vt.clientX,Mt=Math.min(c0,Math.max(o0,D.current+Je));O(Mt)},jt=()=>{X(!1),document.removeEventListener("mousemove",je),document.removeEventListener("mouseup",jt)};document.addEventListener("mousemove",je),document.addEventListener("mouseup",jt)},[xe]),Ne=k.useRef(null),Re=t?y.find(be=>be.roleId===t.id):null,Ae=be=>{if(!t)return;const je=x?"talk":we;Re?(j(Re.id,be,je),S(t.id)):(Ne.current={content:be,mode:je},v(t.id))};k.useEffect(()=>{if(Re&&Ne.current){const{content:be,mode:je}=Ne.current;Ne.current=null,j(Re.id,be,je),t&&S(t.id)}},[Re==null?void 0:Re.id]);const Be=(()=>{if(!He.length)return null;const be=[];let je=0,jt=0,vt=0;for(const Je of He)if(Je.type==="thinking")je++;else if(Je.type==="text")jt++;else if(Je.type==="tool:start"){const Mt=String(Je.data.name??"");be.includes(Mt)||be.push(Mt)}else Je.type==="dispatch:start"&&vt++;return{tools:be,thinkCount:je,textCount:jt,dispatchCount:vt,total:He.length}})(),Ke=m||(()=>{if(!Re)return null;const be=Re.messages;for(let je=be.length-1;je>=0;je--)if(be[je].from==="ceo")return be[je].content;return null})(),St=(()=>{if(!Re)return null;const be=Re.messages;for(let je=be.length-1;je>=0;je--)if(be[je].from==="role"&&be[je].content)return be[je].content;return null})();if(!t)return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:G},onClick:i}),o.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px]",style:{right:G,width:xe,background:"var(--terminal-bg)",borderLeftColor:"var(--pixel-border)"},children:o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading role..."})})]});const Xt=gd[t.id]??"#666",pt=rj[t.id]??"👤",bt=l.filter(be=>be.reportsTo===t.id),re=Re&&b===Re.id,ye=t.name||aj[t.id]||t.id;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:G},onClick:i}),o.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${U?"resizing":""}`,style:{borderLeftColor:Xt,right:G,width:xe,background:"var(--terminal-bg)"},children:[o.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${U?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:Te}),o.jsxs("div",{className:"relative shrink-0 overflow-hidden",style:{background:`linear-gradient(135deg, ${Xt}ee, ${Xt}99)`},children:[o.jsx("div",{className:"absolute inset-0 opacity-[0.06]",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 8px, white 8px, white 9px)"}}),o.jsxs("div",{className:"absolute top-3 right-3 flex items-center gap-1.5 z-10",children:[E&&o.jsx("button",{onClick:()=>E(t.id),className:"w-7 h-7 rounded-full bg-black/20 text-white flex items-center justify-center text-sm hover:bg-black/30 cursor-pointer backdrop-blur-sm",title:"Customize",children:"🎨"}),o.jsx("button",{onClick:i,className:"w-7 h-7 rounded-full bg-black/20 text-white flex items-center justify-center text-lg hover:bg-black/30 cursor-pointer backdrop-blur-sm",children:"×"})]}),o.jsxs("div",{className:"relative flex items-end gap-4 px-4 pt-4 pb-3",children:[o.jsx("div",{className:"shrink-0 relative",style:{marginBottom:-2},children:o.jsx("div",{className:"rounded-lg p-1",style:{background:"rgba(0,0,0,0.2)"},children:o.jsx(Ic,{roleId:t.id,appearance:A,scale:8})})}),o.jsxs("div",{className:"flex-1 min-w-0 text-white pb-1",children:[o.jsxs("div",{className:"text-lg font-bold flex items-center gap-2",style:{fontFamily:"var(--pixel-font)"},children:[pt," ",t.id.toUpperCase(),x&&o.jsx("span",{className:"text-[9px] font-semibold px-2 py-0.5 rounded-full animate-pulse",style:{background:"rgba(251,191,36,0.25)",color:"#fde68a"},children:"WORKING"})]}),B?o.jsxs("form",{className:"flex items-center gap-1.5 mt-0.5",onSubmit:async be=>{be.preventDefault();const je=T.trim();if(!je||je===ye||!C){W(!1);return}Ee(!0);try{await C(t.id,{name:je})}catch{}Ee(!1),W(!1)},children:[o.jsx("input",{ref:Oe,value:T,onChange:be=>me(be.target.value),onKeyDown:be=>{be.key==="Escape"&&W(!1)},disabled:Se,autoFocus:!0,className:"bg-white/20 text-white text-xs rounded px-1.5 py-0.5 outline-none focus:bg-white/30 w-full",style:{fontFamily:"inherit"}}),o.jsx("button",{type:"submit",disabled:Se,className:"text-white/80 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✓"}),o.jsx("button",{type:"button",onClick:()=>W(!1),className:"text-white/60 hover:text-white text-[10px] cursor-pointer shrink-0",children:"✕"})]}):o.jsxs("div",{className:"text-xs opacity-75 mt-0.5 group/name flex items-center gap-1 cursor-pointer hover:opacity-100 transition-opacity",onClick:()=>{C&&(me(ye),W(!0))},title:C?"Click to edit name":void 0,children:[ye,C&&o.jsx("span",{className:"opacity-0 group-hover/name:opacity-60 text-[10px]",children:"✎"})]})]})]}),o.jsxs("div",{className:"relative flex items-center gap-3 px-4 py-2 text-[10px] font-bold text-white/80",style:{background:"rgba(0,0,0,0.2)",fontFamily:"var(--pixel-font)"},children:[o.jsxs("span",{children:["Lv.",R??1]}),o.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),o.jsxs("span",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:x?"var(--idle-amber)":"var(--active-green)"}}),x?"Working":"Idle"]}),o.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),o.jsx("span",{children:t.level}),t.reportsTo&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"|"}),o.jsxs("span",{className:"opacity-60",children:["→"," ",t.reportsTo]})]})]})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:[x&&o.jsxs("div",{className:"px-4 py-3 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-2 h-2 rounded-full animate-pulse",style:{background:"var(--idle-amber)"}}),o.jsxs("span",{className:"text-xs font-semibold",style:{color:"var(--idle-amber)"},children:["Working",ke>0?` · ${sj(ke)}`:""]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>S(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"}),f&&g&&o.jsx("button",{onClick:()=>g(f),className:"text-[10px] px-2 py-0.5 rounded cursor-pointer font-semibold transition-colors",style:{background:"rgba(239,68,68,0.15)",color:"#ef4444"},children:"Stop"})]})]}),Ke&&o.jsx("div",{className:"text-xs truncate",style:{color:"var(--terminal-text-secondary)"},children:Ke})]}),x&&f&&Be&&o.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Activity"}),o.jsx("button",{onClick:()=>S(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"View details ↗"})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[Be.thinkCount>0&&o.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(168,85,247,0.15)",color:"#c084fc"},children:[o.jsx("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:"#a855f7"}}),"thinking ×",Be.thinkCount]}),Be.tools.map(be=>o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa"},children:be},be)),Be.dispatchCount>0&&o.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(249,115,22,0.15)",color:"#fb923c"},children:["dispatch ×",Be.dispatchCount]}),Be.textCount>0&&o.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{background:"rgba(34,197,94,0.15)",color:"#4ade80"},children:["output ×",Be.textCount]}),(Ge==="streaming"||Ge==="connecting")&&o.jsx("span",{className:"inline-block w-1.5 h-3 animate-pulse rounded-sm",style:{background:"var(--active-green)"}})]}),o.jsxs("div",{className:"text-[10px] mt-1",style:{color:"var(--terminal-text-muted)"},children:[Be.total," events"]})]}),x&&St&&o.jsxs("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)"},children:"Last Message"}),o.jsx("button",{onClick:()=>S(t.id),className:"text-[10px] cursor-pointer hover:underline",style:{color:"var(--terminal-text-muted)"},children:"Open chat ↗"})]}),o.jsxs("div",{className:"rounded-lg p-2.5 text-xs leading-relaxed line-clamp-3 overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:[St.slice(0,200),St.length>200&&"..."]})]}),x&&o.jsx("div",{className:"px-4 py-2.5 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:o.jsx(u0,{onSend:Ae,disabled:!!re,placeholder:"Ask something...",color:Xt})}),!x&&o.jsxs("div",{className:"px-4 pt-4 pb-2",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-secondary)"},children:"Latest"}),o.jsx(uj,{icon:pt,roleId:t.id,roleName:ye,color:Xt,text:r})]}),!x&&o.jsx("div",{className:"px-4 py-3",style:{borderBottom:"1px solid var(--terminal-border)"},children:o.jsxs("div",{className:"rounded-xl overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[St&&o.jsxs("div",{className:"px-3 pt-2.5 pb-2 cursor-pointer transition-colors",style:{borderBottom:"1px solid var(--terminal-border)"},onClick:()=>S(t.id),children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Last response"}),o.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"View ↗"})]}),o.jsxs("div",{className:"text-xs leading-relaxed line-clamp-2 overflow-hidden",style:{color:"var(--terminal-text-secondary)"},children:[St.slice(0,150),St.length>150&&"..."]})]}),o.jsx("div",{className:"p-2",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("div",{className:"flex rounded-lg overflow-hidden shrink-0",style:{border:"1px solid var(--pixel-border)"},children:[o.jsx("button",{onClick:()=>z("talk"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:we==="talk"?"var(--accent)":"transparent",color:we==="talk"?"#fff":"var(--terminal-text-secondary)"},children:"Talk"}),o.jsx("button",{onClick:()=>z("do"),className:"px-2 py-1 text-[10px] font-semibold cursor-pointer transition-colors",style:{background:we==="do"?"var(--idle-amber)":"transparent",color:we==="do"?"#fff":"var(--terminal-text-secondary)"},children:"Do"})]}),o.jsx(u0,{onSend:Ae,disabled:!!re,placeholder:we==="talk"?"Ask something...":"Give a directive...",color:Xt})]})})]})}),o.jsxs("div",{className:"px-4 py-2 space-y-1",children:[o.jsxs(cc,{title:`Profile${t.persona?"":" (empty)"}`,open:Y,onToggle:()=>F(be=>!be),children:[t.persona&&o.jsx("div",{className:"text-xs leading-relaxed rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:t.persona}),o.jsxs("div",{className:"space-y-0 mt-2",children:[o.jsx(bd,{label:"Level",value:t.level}),o.jsx(bd,{label:"Reports to",value:t.reportsTo}),o.jsx(bd,{label:"Status",value:t.status})]}),bt.length>0&&o.jsxs("div",{className:"mt-3",children:[o.jsx("div",{className:"text-[11px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Direct Reports"}),o.jsx("div",{className:"space-y-1",children:bt.map(be=>o.jsxs("div",{className:"flex items-center gap-2 p-1.5 rounded-lg",style:{background:"var(--hud-bg-alt)"},children:[o.jsx("div",{className:"w-6 h-6 rounded flex items-center justify-center text-white text-[10px] font-bold",style:{background:gd[be.id]??"#666"},children:be.id.slice(0,2).toUpperCase()}),o.jsx("div",{className:"text-xs",style:{color:"var(--terminal-text)"},children:be.name})]},be.id))})]})]}),t.authority&&o.jsxs(cc,{title:"Authority",open:Q,onToggle:()=>ee(be=>!be),children:[((ze=t.authority.autonomous)==null?void 0:ze.length)>0&&o.jsxs("div",{className:"mb-2",children:[o.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--active-green)"},children:"Autonomous"}),t.authority.autonomous.map((be,je)=>o.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",be]},je))]}),((Ie=t.authority.needsApproval)==null?void 0:Ie.length)>0&&o.jsxs("div",{children:[o.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"var(--idle-amber)"},children:"Needs Approval"}),t.authority.needsApproval.map((be,je)=>o.jsxs("div",{className:"text-xs pl-3 py-0.5",style:{color:"var(--terminal-text-secondary)"},children:["- ",be]},je))]})]}),t&&M&&(()=>{const be=M.filter(je=>je.roleA===t.id||je.roleB===t.id).filter(je=>je.familiarity>0).sort((je,jt)=>jt.familiarity-je.familiarity);return be.length===0?null:o.jsx(cc,{title:`Relationships (${be.length})`,open:V,onToggle:()=>I(je=>!je),children:o.jsx("div",{className:"space-y-1.5",children:be.map((je,jt)=>{const vt=je.roleA===t.id?je.roleB:je.roleA,Je=l.find(Ht=>Ht.id===vt),Mt=je.familiarity>=80?"Best Partner":je.familiarity>=50?"Friend":je.familiarity>=20?"Colleague":"Acquaintance",nt=je.familiarity>=80?"#4CAF50":je.familiarity>=50?"#2196F3":je.familiarity>=20?"#FF9800":"#9E9E9E";return o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs w-20 truncate",style:{color:gd[vt]??"var(--terminal-text-secondary)"},children:(Je==null?void 0:Je.name)??vt}),o.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-white/10",children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${je.familiarity}%`,background:nt}})}),o.jsx("span",{className:"text-[10px] w-16 text-right",style:{color:"var(--terminal-text-muted)"},children:Mt})]},jt)})})})})(),t.journal&&o.jsx(cc,{title:`Journal (${(t.journal.match(/### /g)??[]).length})`,open:Z,onToggle:()=>ce(be=>!be),children:o.jsxs("div",{className:"text-xs leading-relaxed rounded-lg p-3 max-h-[300px] overflow-y-auto",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:[o.jsx(Hs,{content:t.journal.slice(0,3e3)}),t.journal.length>3e3&&o.jsx("div",{className:"italic mt-2",style:{color:"var(--terminal-text-muted)"},children:"... (truncated)"})]})})]}),o.jsx(cj,{role:t,appearance:A}),c&&o.jsx("div",{className:"px-4 pb-4 mt-auto shrink-0",children:o.jsx("button",{onClick:()=>{c(t.id,t.name),i()},className:"w-full p-2 text-center text-xs font-medium border-2 border-dashed rounded-lg cursor-pointer transition-colors",style:{borderColor:"rgba(239,68,68,0.3)",color:"rgba(239,68,68,0.5)"},children:"Fire Role"})})]})]})]})}function cj({role:t,appearance:l}){const[r,i]=k.useState("idle"),[c,u]=k.useState(""),[f,m]=k.useState(!1),x=async()=>{var d,g;if(!f){m(!0);return}i("publishing");try{let y=null;try{y=await Ce.exportSkills(t.id)}catch{}const b={roleId:t.id,persona:t.persona??"",authority:t.authority??{autonomous:[],needsApproval:[]},level:t.level,tagline:((d=(t.persona??"").split(/[.\n]/)[0])==null?void 0:d.trim().slice(0,80))||t.name,chatStyle:"Professional and focused",skills:y??[],resume:{summary:((g=t.persona)==null?void 0:g.split(`
|
|
80
|
+
`)[0])??"",strengths:[],specialties:[],experience:""},author:{id:"tycono",name:"Tycono"},tags:[t.level,t.id],price:"free",installs:0,rating:0,featured:!1,randomActive:!0,randomPersonality:""};l&&(b.appearance=l);let v="1.0.0";try{const j=await Ts.getCharacterVersion(t.id);if(j!=null&&j.version){const S=j.version.split(".").map(Number);S[2]=(S[2]??0)+1,v=S.join(".")}}catch{}await Ts.publishCharacter({id:t.id,name:t.name||t.id,version:v,data:b}),i("done"),u(`Published v${v}`),m(!1)}catch(y){i("error"),u(y instanceof Error?y.message:"Failed"),m(!1)}};return o.jsx("div",{className:"px-4 pb-2 shrink-0",children:o.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:o.jsxs("div",{className:"px-3 py-2.5 flex items-center justify-between",style:{background:"var(--hud-bg-alt)"},children:[o.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Cloud Store"}),r==="done"?o.jsx("span",{className:"text-[10px] font-semibold",style:{color:"var(--active-green)"},children:c}):r==="error"?o.jsx("span",{className:"text-[10px] font-semibold",style:{color:"#ef4444"},children:c}):o.jsx("button",{onClick:x,disabled:r==="publishing",className:"text-[10px] px-2.5 py-1 rounded font-semibold cursor-pointer transition-colors disabled:opacity-50",style:{background:f?"rgba(59,130,246,0.3)":"rgba(59,130,246,0.15)",color:"#60a5fa",border:f?"1px solid rgba(59,130,246,0.5)":"1px solid transparent"},children:r==="publishing"?"Publishing...":f?"Confirm Publish?":"Publish to Store"})]})})})}function uj({icon:t,roleId:l,roleName:r,color:i,text:c}){const u=!!c;return o.jsx("div",{className:"relative",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsxs("div",{className:"shrink-0",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center text-xl shadow-sm",style:{background:`${i}18`,border:`2px solid ${i}44`},children:t}),o.jsx("div",{className:"text-[9px] font-bold text-center mt-0.5 uppercase tracking-wide",style:{color:i},children:l})]}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsxs("div",{className:"relative",children:[o.jsx("div",{className:"absolute top-3 -left-2 w-0 h-0",style:{borderTop:"6px solid transparent",borderBottom:"6px solid transparent",borderRight:`8px solid ${i}12`}}),o.jsxs("div",{className:"rounded-xl rounded-tl-sm p-4 border",style:{background:`${i}08`,borderColor:`${i}22`},children:[o.jsx("div",{className:"text-[10px] font-semibold mb-1.5 uppercase tracking-wider",style:{color:i},children:r}),u?o.jsx("div",{className:"text-sm leading-relaxed",style:{color:"var(--terminal-text)"},children:o.jsx(Hs,{content:c})}):o.jsx("div",{className:"text-sm italic",style:{color:"var(--terminal-text-muted)"},children:"No recent activity."})]})]})})]})})}function cc({title:t,open:l,onToggle:r,children:i}){return o.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--terminal-border)"},children:[o.jsxs("button",{onClick:r,className:"w-full px-3 py-2.5 flex items-center justify-between cursor-pointer transition-colors group",style:{background:"var(--hud-bg-alt)"},children:[o.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:t}),o.jsx("span",{className:"text-[10px] transition-transform",style:{color:"var(--terminal-text-muted)",transform:l?"rotate(0deg)":"rotate(-90deg)"},children:"▼"})]}),l&&o.jsx("div",{className:"px-3 pb-3 pt-2",style:{borderTop:"1px solid var(--terminal-border)"},children:i})]})}function u0({onSend:t,disabled:l,placeholder:r,color:i}){const[c,u]=k.useState(""),f=()=>{const m=c.trim();!m||l||(t(m),u(""))};return o.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[o.jsx("input",{type:"text",value:c,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),f())},placeholder:l?"Waiting...":r,disabled:l,className:"flex-1 rounded-lg px-2.5 py-1.5 text-xs focus:outline-none disabled:opacity-40",style:{background:"var(--hud-bg)",border:"1px solid var(--pixel-border)",color:"var(--terminal-text)"}}),o.jsx("button",{onClick:f,disabled:l||!c.trim(),className:"w-7 h-7 rounded-lg flex items-center justify-center shrink-0 cursor-pointer text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",style:{background:l||!c.trim()?"#666":i},children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M22 2L11 13"}),o.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})}function bd({label:t,value:l}){return o.jsxs("div",{className:"flex justify-between py-1.5 text-xs",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:t}),o.jsx("span",{className:"font-semibold",style:{color:"var(--terminal-text)"},children:l})]})}function fj(t,l){var r,i=1;t==null&&(t=0),l==null&&(l=0);function c(){var u,f=r.length,m,x=0,d=0;for(u=0;u<f;++u)m=r[u],x+=m.x,d+=m.y;for(x=(x/f-t)*i,d=(d/f-l)*i,u=0;u<f;++u)m=r[u],m.x-=x,m.y-=d}return c.initialize=function(u){r=u},c.x=function(u){return arguments.length?(t=+u,c):t},c.y=function(u){return arguments.length?(l=+u,c):l},c.strength=function(u){return arguments.length?(i=+u,c):i},c}function dj(t){const l=+this._x.call(null,t),r=+this._y.call(null,t);return og(this.cover(l,r),l,r,t)}function og(t,l,r,i){if(isNaN(l)||isNaN(r))return t;var c,u=t._root,f={data:i},m=t._x0,x=t._y0,d=t._x1,g=t._y1,y,b,v,j,S,E,C,A;if(!u)return t._root=f,t;for(;u.length;)if((S=l>=(y=(m+d)/2))?m=y:d=y,(E=r>=(b=(x+g)/2))?x=b:g=b,c=u,!(u=u[C=E<<1|S]))return c[C]=f,t;if(v=+t._x.call(null,u.data),j=+t._y.call(null,u.data),l===v&&r===j)return f.next=u,c?c[C]=f:t._root=f,t;do c=c?c[C]=new Array(4):t._root=new Array(4),(S=l>=(y=(m+d)/2))?m=y:d=y,(E=r>=(b=(x+g)/2))?x=b:g=b;while((C=E<<1|S)===(A=(j>=b)<<1|v>=y));return c[A]=u,c[C]=f,t}function hj(t){var l,r,i=t.length,c,u,f=new Array(i),m=new Array(i),x=1/0,d=1/0,g=-1/0,y=-1/0;for(r=0;r<i;++r)isNaN(c=+this._x.call(null,l=t[r]))||isNaN(u=+this._y.call(null,l))||(f[r]=c,m[r]=u,c<x&&(x=c),c>g&&(g=c),u<d&&(d=u),u>y&&(y=u));if(x>g||d>y)return this;for(this.cover(x,d).cover(g,y),r=0;r<i;++r)og(this,f[r],m[r],t[r]);return this}function mj(t,l){if(isNaN(t=+t)||isNaN(l=+l))return this;var r=this._x0,i=this._y0,c=this._x1,u=this._y1;if(isNaN(r))c=(r=Math.floor(t))+1,u=(i=Math.floor(l))+1;else{for(var f=c-r||1,m=this._root,x,d;r>t||t>=c||i>l||l>=u;)switch(d=(l<i)<<1|t<r,x=new Array(4),x[d]=m,m=x,f*=2,d){case 0:c=r+f,u=i+f;break;case 1:r=c-f,u=i+f;break;case 2:c=r+f,i=u-f;break;case 3:r=c-f,i=u-f;break}this._root&&this._root.length&&(this._root=m)}return this._x0=r,this._y0=i,this._x1=c,this._y1=u,this}function xj(){var t=[];return this.visit(function(l){if(!l.length)do t.push(l.data);while(l=l.next)}),t}function pj(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function jn(t,l,r,i,c){this.node=t,this.x0=l,this.y0=r,this.x1=i,this.y1=c}function yj(t,l,r){var i,c=this._x0,u=this._y0,f,m,x,d,g=this._x1,y=this._y1,b=[],v=this._root,j,S;for(v&&b.push(new jn(v,c,u,g,y)),r==null?r=1/0:(c=t-r,u=l-r,g=t+r,y=l+r,r*=r);j=b.pop();)if(!(!(v=j.node)||(f=j.x0)>g||(m=j.y0)>y||(x=j.x1)<c||(d=j.y1)<u))if(v.length){var E=(f+x)/2,C=(m+d)/2;b.push(new jn(v[3],E,C,x,d),new jn(v[2],f,C,E,d),new jn(v[1],E,m,x,C),new jn(v[0],f,m,E,C)),(S=(l>=C)<<1|t>=E)&&(j=b[b.length-1],b[b.length-1]=b[b.length-1-S],b[b.length-1-S]=j)}else{var A=t-+this._x.call(null,v.data),M=l-+this._y.call(null,v.data),R=A*A+M*M;if(R<r){var L=Math.sqrt(r=R);c=t-L,u=l-L,g=t+L,y=l+L,i=v.data}}return i}function gj(t){if(isNaN(g=+this._x.call(null,t))||isNaN(y=+this._y.call(null,t)))return this;var l,r=this._root,i,c,u,f=this._x0,m=this._y0,x=this._x1,d=this._y1,g,y,b,v,j,S,E,C;if(!r)return this;if(r.length)for(;;){if((j=g>=(b=(f+x)/2))?f=b:x=b,(S=y>=(v=(m+d)/2))?m=v:d=v,l=r,!(r=r[E=S<<1|j]))return this;if(!r.length)break;(l[E+1&3]||l[E+2&3]||l[E+3&3])&&(i=l,C=E)}for(;r.data!==t;)if(c=r,!(r=r.next))return this;return(u=r.next)&&delete r.next,c?(u?c.next=u:delete c.next,this):l?(u?l[E]=u:delete l[E],(r=l[0]||l[1]||l[2]||l[3])&&r===(l[3]||l[2]||l[1]||l[0])&&!r.length&&(i?i[C]=r:this._root=r),this):(this._root=u,this)}function bj(t){for(var l=0,r=t.length;l<r;++l)this.remove(t[l]);return this}function vj(){return this._root}function wj(){var t=0;return this.visit(function(l){if(!l.length)do++t;while(l=l.next)}),t}function kj(t){var l=[],r,i=this._root,c,u,f,m,x;for(i&&l.push(new jn(i,this._x0,this._y0,this._x1,this._y1));r=l.pop();)if(!t(i=r.node,u=r.x0,f=r.y0,m=r.x1,x=r.y1)&&i.length){var d=(u+m)/2,g=(f+x)/2;(c=i[3])&&l.push(new jn(c,d,g,m,x)),(c=i[2])&&l.push(new jn(c,u,g,d,x)),(c=i[1])&&l.push(new jn(c,d,f,m,g)),(c=i[0])&&l.push(new jn(c,u,f,d,g))}return this}function Sj(t){var l=[],r=[],i;for(this._root&&l.push(new jn(this._root,this._x0,this._y0,this._x1,this._y1));i=l.pop();){var c=i.node;if(c.length){var u,f=i.x0,m=i.y0,x=i.x1,d=i.y1,g=(f+x)/2,y=(m+d)/2;(u=c[0])&&l.push(new jn(u,f,m,g,y)),(u=c[1])&&l.push(new jn(u,g,m,x,y)),(u=c[2])&&l.push(new jn(u,f,y,g,d)),(u=c[3])&&l.push(new jn(u,g,y,x,d))}r.push(i)}for(;i=r.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function jj(t){return t[0]}function Cj(t){return arguments.length?(this._x=t,this):this._x}function Ej(t){return t[1]}function Nj(t){return arguments.length?(this._y=t,this):this._y}function Sh(t,l,r){var i=new jh(l??jj,r??Ej,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function jh(t,l,r,i,c,u){this._x=t,this._y=l,this._x0=r,this._y0=i,this._x1=c,this._y1=u,this._root=void 0}function f0(t){for(var l={data:t.data},r=l;t=t.next;)r=r.next={data:t.data};return l}var Cn=Sh.prototype=jh.prototype;Cn.copy=function(){var t=new jh(this._x,this._y,this._x0,this._y0,this._x1,this._y1),l=this._root,r,i;if(!l)return t;if(!l.length)return t._root=f0(l),t;for(r=[{source:l,target:t._root=new Array(4)}];l=r.pop();)for(var c=0;c<4;++c)(i=l.source[c])&&(i.length?r.push({source:i,target:l.target[c]=new Array(4)}):l.target[c]=f0(i));return t};Cn.add=dj;Cn.addAll=hj;Cn.cover=mj;Cn.data=xj;Cn.extent=pj;Cn.find=yj;Cn.remove=gj;Cn.removeAll=bj;Cn.root=vj;Cn.size=wj;Cn.visit=kj;Cn.visitAfter=Sj;Cn.x=Cj;Cn.y=Nj;function va(t){return function(){return t}}function Ir(t){return(t()-.5)*1e-6}function Aj(t){return t.x+t.vx}function Tj(t){return t.y+t.vy}function Dj(t){var l,r,i,c=1,u=1;typeof t!="function"&&(t=va(t==null?1:+t));function f(){for(var d,g=l.length,y,b,v,j,S,E,C=0;C<u;++C)for(y=Sh(l,Aj,Tj).visitAfter(m),d=0;d<g;++d)b=l[d],S=r[b.index],E=S*S,v=b.x+b.vx,j=b.y+b.vy,y.visit(A);function A(M,R,L,O,U){var X=M.data,ne=M.r,D=S+ne;if(X){if(X.index>b.index){var Y=v-X.x-X.vx,F=j-X.y-X.vy,Q=Y*Y+F*F;Q<D*D&&(Y===0&&(Y=Ir(i),Q+=Y*Y),F===0&&(F=Ir(i),Q+=F*F),Q=(D-(Q=Math.sqrt(Q)))/Q*c,b.vx+=(Y*=Q)*(D=(ne*=ne)/(E+ne)),b.vy+=(F*=Q)*D,X.vx-=Y*(D=1-D),X.vy-=F*D)}return}return R>v+D||O<v-D||L>j+D||U<j-D}}function m(d){if(d.data)return d.r=r[d.data.index];for(var g=d.r=0;g<4;++g)d[g]&&d[g].r>d.r&&(d.r=d[g].r)}function x(){if(l){var d,g=l.length,y;for(r=new Array(g),d=0;d<g;++d)y=l[d],r[y.index]=+t(y,d,l)}}return f.initialize=function(d,g){l=d,i=g,x()},f.iterations=function(d){return arguments.length?(u=+d,f):u},f.strength=function(d){return arguments.length?(c=+d,f):c},f.radius=function(d){return arguments.length?(t=typeof d=="function"?d:va(+d),x(),f):t},f}function zj(t){return t.index}function d0(t,l){var r=t.get(l);if(!r)throw new Error("node not found: "+l);return r}function Mj(t){var l=zj,r=y,i,c=va(30),u,f,m,x,d,g=1;t==null&&(t=[]);function y(E){return 1/Math.min(m[E.source.index],m[E.target.index])}function b(E){for(var C=0,A=t.length;C<g;++C)for(var M=0,R,L,O,U,X,ne,D;M<A;++M)R=t[M],L=R.source,O=R.target,U=O.x+O.vx-L.x-L.vx||Ir(d),X=O.y+O.vy-L.y-L.vy||Ir(d),ne=Math.sqrt(U*U+X*X),ne=(ne-u[M])/ne*E*i[M],U*=ne,X*=ne,O.vx-=U*(D=x[M]),O.vy-=X*D,L.vx+=U*(D=1-D),L.vy+=X*D}function v(){if(f){var E,C=f.length,A=t.length,M=new Map(f.map((L,O)=>[l(L,O,f),L])),R;for(E=0,m=new Array(C);E<A;++E)R=t[E],R.index=E,typeof R.source!="object"&&(R.source=d0(M,R.source)),typeof R.target!="object"&&(R.target=d0(M,R.target)),m[R.source.index]=(m[R.source.index]||0)+1,m[R.target.index]=(m[R.target.index]||0)+1;for(E=0,x=new Array(A);E<A;++E)R=t[E],x[E]=m[R.source.index]/(m[R.source.index]+m[R.target.index]);i=new Array(A),j(),u=new Array(A),S()}}function j(){if(f)for(var E=0,C=t.length;E<C;++E)i[E]=+r(t[E],E,t)}function S(){if(f)for(var E=0,C=t.length;E<C;++E)u[E]=+c(t[E],E,t)}return b.initialize=function(E,C){f=E,d=C,v()},b.links=function(E){return arguments.length?(t=E,v(),b):t},b.id=function(E){return arguments.length?(l=E,b):l},b.iterations=function(E){return arguments.length?(g=+E,b):g},b.strength=function(E){return arguments.length?(r=typeof E=="function"?E:va(+E),j(),b):r},b.distance=function(E){return arguments.length?(c=typeof E=="function"?E:va(+E),S(),b):c},b}var Rj={value:()=>{}};function cg(){for(var t=0,l=arguments.length,r={},i;t<l;++t){if(!(i=arguments[t]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new wc(r)}function wc(t){this._=t}function Fj(t,l){return t.trim().split(/^|\s+/).map(function(r){var i="",c=r.indexOf(".");if(c>=0&&(i=r.slice(c+1),r=r.slice(0,c)),r&&!l.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}wc.prototype=cg.prototype={constructor:wc,on:function(t,l){var r=this._,i=Fj(t+"",r),c,u=-1,f=i.length;if(arguments.length<2){for(;++u<f;)if((c=(t=i[u]).type)&&(c=_j(r[c],t.name)))return c;return}if(l!=null&&typeof l!="function")throw new Error("invalid callback: "+l);for(;++u<f;)if(c=(t=i[u]).type)r[c]=h0(r[c],t.name,l);else if(l==null)for(c in r)r[c]=h0(r[c],t.name,null);return this},copy:function(){var t={},l=this._;for(var r in l)t[r]=l[r].slice();return new wc(t)},call:function(t,l){if((c=arguments.length-2)>0)for(var r=new Array(c),i=0,c,u;i<c;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(u=this._[t],i=0,c=u.length;i<c;++i)u[i].value.apply(l,r)},apply:function(t,l,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],c=0,u=i.length;c<u;++c)i[c].value.apply(l,r)}};function _j(t,l){for(var r=0,i=t.length,c;r<i;++r)if((c=t[r]).name===l)return c.value}function h0(t,l,r){for(var i=0,c=t.length;i<c;++i)if(t[i].name===l){t[i]=Rj,t=t.slice(0,i).concat(t.slice(i+1));break}return r!=null&&t.push({name:l,value:r}),t}var ui=0,ks=0,gs=0,ug=1e3,zc,Ss,Mc=0,ka=0,Yc=0,Fs=typeof performance=="object"&&performance.now?performance:Date,fg=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function dg(){return ka||(fg(Oj),ka=Fs.now()+Yc)}function Oj(){ka=0}function Zd(){this._call=this._time=this._next=null}Zd.prototype=hg.prototype={constructor:Zd,restart:function(t,l,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?dg():+r)+(l==null?0:+l),!this._next&&Ss!==this&&(Ss?Ss._next=this:zc=this,Ss=this),this._call=t,this._time=r,Jd()},stop:function(){this._call&&(this._call=null,this._time=1/0,Jd())}};function hg(t,l,r){var i=new Zd;return i.restart(t,l,r),i}function Bj(){dg(),++ui;for(var t=zc,l;t;)(l=ka-t._time)>=0&&t._call.call(void 0,l),t=t._next;--ui}function m0(){ka=(Mc=Fs.now())+Yc,ui=ks=0;try{Bj()}finally{ui=0,$j(),ka=0}}function Lj(){var t=Fs.now(),l=t-Mc;l>ug&&(Yc-=l,Mc=t)}function $j(){for(var t,l=zc,r,i=1/0;l;)l._call?(i>l._time&&(i=l._time),t=l,l=l._next):(r=l._next,l._next=null,l=t?t._next=r:zc=r);Ss=t,Jd(i)}function Jd(t){if(!ui){ks&&(ks=clearTimeout(ks));var l=t-ka;l>24?(t<1/0&&(ks=setTimeout(m0,t-Fs.now()-Yc)),gs&&(gs=clearInterval(gs))):(gs||(Mc=Fs.now(),gs=setInterval(Lj,ug)),ui=1,fg(m0))}}const Hj=1664525,Uj=1013904223,x0=4294967296;function Ij(){let t=1;return()=>(t=(Hj*t+Uj)%x0)/x0}function Yj(t){return t.x}function qj(t){return t.y}var Xj=10,Vj=Math.PI*(3-Math.sqrt(5));function Gj(t){var l,r=1,i=.001,c=1-Math.pow(i,1/300),u=0,f=.6,m=new Map,x=hg(y),d=cg("tick","end"),g=Ij();t==null&&(t=[]);function y(){b(),d.call("tick",l),r<i&&(x.stop(),d.call("end",l))}function b(S){var E,C=t.length,A;S===void 0&&(S=1);for(var M=0;M<S;++M)for(r+=(u-r)*c,m.forEach(function(R){R(r)}),E=0;E<C;++E)A=t[E],A.fx==null?A.x+=A.vx*=f:(A.x=A.fx,A.vx=0),A.fy==null?A.y+=A.vy*=f:(A.y=A.fy,A.vy=0);return l}function v(){for(var S=0,E=t.length,C;S<E;++S){if(C=t[S],C.index=S,C.fx!=null&&(C.x=C.fx),C.fy!=null&&(C.y=C.fy),isNaN(C.x)||isNaN(C.y)){var A=Xj*Math.sqrt(.5+S),M=S*Vj;C.x=A*Math.cos(M),C.y=A*Math.sin(M)}(isNaN(C.vx)||isNaN(C.vy))&&(C.vx=C.vy=0)}}function j(S){return S.initialize&&S.initialize(t,g),S}return v(),l={tick:b,restart:function(){return x.restart(y),l},stop:function(){return x.stop(),l},nodes:function(S){return arguments.length?(t=S,v(),m.forEach(j),l):t},alpha:function(S){return arguments.length?(r=+S,l):r},alphaMin:function(S){return arguments.length?(i=+S,l):i},alphaDecay:function(S){return arguments.length?(c=+S,l):+c},alphaTarget:function(S){return arguments.length?(u=+S,l):u},velocityDecay:function(S){return arguments.length?(f=1-S,l):1-f},randomSource:function(S){return arguments.length?(g=S,m.forEach(j),l):g},force:function(S,E){return arguments.length>1?(E==null?m.delete(S):m.set(S,j(E)),l):m.get(S)},find:function(S,E,C){var A=0,M=t.length,R,L,O,U,X;for(C==null?C=1/0:C*=C,A=0;A<M;++A)U=t[A],R=S-U.x,L=E-U.y,O=R*R+L*L,O<C&&(X=U,C=O);return X},on:function(S,E){return arguments.length>1?(d.on(S,E),l):d.on(S)}}}function Kj(){var t,l,r,i,c=va(-30),u,f=1,m=1/0,x=.81;function d(v){var j,S=t.length,E=Sh(t,Yj,qj).visitAfter(y);for(i=v,j=0;j<S;++j)l=t[j],E.visit(b)}function g(){if(t){var v,j=t.length,S;for(u=new Array(j),v=0;v<j;++v)S=t[v],u[S.index]=+c(S,v,t)}}function y(v){var j=0,S,E,C=0,A,M,R;if(v.length){for(A=M=R=0;R<4;++R)(S=v[R])&&(E=Math.abs(S.value))&&(j+=S.value,C+=E,A+=E*S.x,M+=E*S.y);v.x=A/C,v.y=M/C}else{S=v,S.x=S.data.x,S.y=S.data.y;do j+=u[S.data.index];while(S=S.next)}v.value=j}function b(v,j,S,E){if(!v.value)return!0;var C=v.x-l.x,A=v.y-l.y,M=E-j,R=C*C+A*A;if(M*M/x<R)return R<m&&(C===0&&(C=Ir(r),R+=C*C),A===0&&(A=Ir(r),R+=A*A),R<f&&(R=Math.sqrt(f*R)),l.vx+=C*v.value*i/R,l.vy+=A*v.value*i/R),!0;if(v.length||R>=m)return;(v.data!==l||v.next)&&(C===0&&(C=Ir(r),R+=C*C),A===0&&(A=Ir(r),R+=A*A),R<f&&(R=Math.sqrt(f*R)));do v.data!==l&&(M=u[v.data.index]*i/R,l.vx+=C*M,l.vy+=A*M);while(v=v.next)}return d.initialize=function(v,j){t=v,r=j,g()},d.strength=function(v){return arguments.length?(c=typeof v=="function"?v:va(+v),g(),d):c},d.distanceMin=function(v){return arguments.length?(f=v*v,d):Math.sqrt(f)},d.distanceMax=function(v){return arguments.length?(m=v*v,d):Math.sqrt(m)},d.theta=function(v){return arguments.length?(x=v*v,d):Math.sqrt(x)},d}const _s={tech:{bg:"rgba(59,130,246,0.15)",border:"#3b82f6",text:"#60a5fa"},market:{bg:"rgba(245,158,11,0.15)",border:"#f59e0b",text:"#fbbf24"},strategy:{bg:"rgba(139,92,246,0.15)",border:"#8b5cf6",text:"#a78bfa"},financial:{bg:"rgba(34,197,94,0.15)",border:"#22c55e",text:"#4ade80"},process:{bg:"rgba(236,72,153,0.15)",border:"#ec4899",text:"#f472b6"},competitor:{bg:"rgba(239,68,68,0.15)",border:"#ef4444",text:"#f87171"},domain:{bg:"rgba(14,165,233,0.15)",border:"#0ea5e9",text:"#38bdf8"},general:{bg:"rgba(148,163,184,0.12)",border:"#64748b",text:"#94a3b8"}};function Qj(t){return _s[t]??_s.general}function Wj({docs:t,onNodeClick:l,selectedDocId:r}){var Y;const i=k.useRef(null),c=k.useRef(null),[u,f]=k.useState({width:600,height:400}),[m,x]=k.useState({nodes:[],links:[]}),[d,g]=k.useState(null),[y,b]=k.useState(null),[v,j]=k.useState({x:0,y:0}),[S,E]=k.useState({x:0,y:0,w:600,h:400}),C=k.useRef(!1),A=k.useRef({x:0,y:0,vx:0,vy:0}),M=k.useRef(null),R=k.useRef(null);k.useEffect(()=>{const F=i.current;if(!F)return;const Q=new ResizeObserver(ee=>{const{width:V,height:I}=ee[0].contentRect;V>0&&I>0&&(f({width:V,height:I}),E(Z=>({...Z,w:V,h:I})))});return Q.observe(F),()=>Q.disconnect()},[]),k.useEffect(()=>{if(t.length===0)return;const F=new Set(t.map(ce=>ce.id)),Q=t.map(ce=>({id:ce.id,title:ce.title,category:ce.category,akb_type:ce.akb_type})),ee=[];for(const ce of t)for(const we of ce.links){const z=we.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,"");F.has(z)&&z!==ce.id&&(ee.some(B=>B.source===ce.id&&B.target===z||B.source===z&&B.target===ce.id)||ee.push({source:ce.id,target:z,label:we.text}))}const{width:V,height:I}=u,Z=Gj(Q).force("link",Mj(ee).id(ce=>ce.id).distance(140)).force("charge",Kj().strength(-400)).force("center",fj(V/2,I/2)).force("collide",Dj(50));R.current=Z,Z.on("tick",()=>{for(const ce of Q)ce.x=Math.max(60,Math.min(V-60,ce.x??V/2)),ce.y=Math.max(60,Math.min(I-60,ce.y??I/2));x({nodes:[...Q],links:[...ee]})}),Z.alpha(1).restart();for(let ce=0;ce<150;ce++)Z.tick();return Z.stop(),x({nodes:[...Q],links:[...ee]}),()=>{Z.stop()}},[t,u]);const L=F=>{if(typeof F=="string"){const Q=m.nodes.find(ee=>ee.id===F);return{x:(Q==null?void 0:Q.x)??0,y:(Q==null?void 0:Q.y)??0}}return{x:F.x??0,y:F.y??0}},O=k.useCallback(F=>{F.preventDefault();const Q=F.deltaY>0?1.1:.9;E(ee=>{const V=Math.max(200,Math.min(u.width*3,ee.w*Q)),I=Math.max(150,Math.min(u.height*3,ee.h*Q)),Z=(V-ee.w)/2,ce=(I-ee.h)/2;return{x:ee.x-Z,y:ee.y-ce,w:V,h:I}})},[u]),U=k.useCallback(F=>{F.button===0&&(C.current=!0,A.current={x:F.clientX,y:F.clientY,vx:S.x,vy:S.y})},[S]),X=k.useCallback(F=>{var Q;if(M.current){const ee=c.current;if(!ee)return;const V=ee.getBoundingClientRect(),I=S.w/V.width,Z=S.h/V.height,ce=S.x+(F.clientX-V.left)*I,we=S.y+(F.clientY-V.top)*Z;M.current.fx=ce,M.current.fy=we,(Q=R.current)==null||Q.alpha(.3).restart();return}if(C.current){const ee=(F.clientX-A.current.x)*(S.w/u.width),V=(F.clientY-A.current.y)*(S.h/u.height);E(I=>({...I,x:A.current.vx-ee,y:A.current.vy-V}))}},[S,u]),ne=k.useCallback(()=>{C.current=!1,M.current&&(M.current.fx=null,M.current.fy=null,M.current=null)},[]),D=k.useCallback((F,Q)=>{var ee;F.stopPropagation(),M.current=Q,(ee=R.current)==null||ee.alpha(.3).restart()},[]);return o.jsxs("div",{ref:i,className:"relative flex-1 overflow-hidden",style:{background:"#1e1e2e"},children:[o.jsxs("svg",{ref:c,width:u.width,height:u.height,viewBox:`${S.x} ${S.y} ${S.w} ${S.h}`,style:{display:"block",cursor:C.current?"grabbing":"grab"},onWheel:O,onMouseDown:U,onMouseMove:X,onMouseUp:ne,onMouseLeave:ne,children:[o.jsx("defs",{children:o.jsx("pattern",{id:"grid",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:o.jsx("circle",{cx:"0",cy:"0",r:"0.5",fill:"rgba(255,255,255,0.06)"})})}),o.jsx("rect",{x:S.x-100,y:S.y-100,width:S.w+200,height:S.h+200,fill:"url(#grid)",pointerEvents:"none"}),m.links.map((F,Q)=>{const ee=L(F.source),V=L(F.target),I=y===Q,Z=(ee.x+V.x)/2,ce=(ee.y+V.y)/2;return o.jsxs("g",{children:[o.jsx("line",{x1:ee.x,y1:ee.y,x2:V.x,y2:V.y,stroke:"transparent",strokeWidth:12,style:{cursor:"default"},onMouseEnter:()=>b(Q),onMouseLeave:()=>b(null)}),o.jsx("line",{x1:ee.x,y1:ee.y,x2:V.x,y2:V.y,stroke:I?"rgba(148,163,184,0.7)":"rgba(148,163,184,0.3)",strokeWidth:I?2:1.5,strokeDasharray:"4 3",pointerEvents:"none"}),I&&F.label&&o.jsx("text",{x:Z,y:ce-6,textAnchor:"middle",fill:"#e2e8f0",fontSize:9,fontFamily:"monospace",style:{pointerEvents:"none"},children:o.jsx("tspan",{style:{filter:"drop-shadow(0 0 2px rgba(0,0,0,0.8))"},children:F.label.length>30?F.label.slice(0,28)+"..":F.label})})]},Q)}),m.nodes.map(F=>{const Q=_s[F.category]??_s.general,ee=F.akb_type==="hub",V=ee?24:16,I=(d==null?void 0:d.id)===F.id,Z=r===F.id,ce=I?1.2:Z?1.15:1;return o.jsxs("g",{transform:`translate(${F.x??0}, ${F.y??0}) scale(${ce})`,style:{cursor:"pointer",transition:"transform 0.15s ease"},onClick:we=>{we.stopPropagation();const z=t.find(B=>B.id===F.id);z&&l(z)},onMouseDown:we=>D(we,F),onMouseEnter:we=>{var B;g(F);const z=(B=i.current)==null?void 0:B.getBoundingClientRect();z&&j({x:we.clientX-z.left,y:we.clientY-z.top})},onMouseLeave:()=>g(null),children:[Z&&o.jsx("rect",{x:-V/2-4,y:-V/2-4,width:V+8,height:V+8,fill:"none",stroke:"#22c55e",strokeWidth:2,rx:ee?5:2,opacity:.6}),o.jsx("rect",{x:-V/2,y:-V/2,width:V,height:V,fill:Q.border,rx:ee?4:2,opacity:I?1:.9}),o.jsx("rect",{x:-V/2+3,y:-V/2+3,width:Math.max(0,V-6),height:Math.max(0,V-6),fill:Q.bg,rx:ee?3:1}),o.jsx("text",{y:V/2+14,textAnchor:"middle",fill:Z?"#e2e8f0":"#94a3b8",fontSize:11,fontFamily:"monospace",fontWeight:Z?"bold":"normal",style:{pointerEvents:"none"},children:F.title.length>24?F.title.slice(0,22)+"..":F.title})]},F.id)})]}),d&&!M.current&&o.jsxs("div",{className:"absolute z-10 pointer-events-none p-2.5 rounded text-xs max-w-[240px]",style:{left:Math.min(v.x+16,u.width-250),top:Math.max(v.y-30,8),background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)",boxShadow:"0 4px 12px rgba(0,0,0,0.4)"},children:[o.jsx("div",{className:"font-bold mb-1",children:d.title}),o.jsxs("div",{className:"text-[10px] opacity-60 mb-1",children:[d.akb_type.toUpperCase()," / ",d.category]}),((Y=t.find(F=>F.id===d.id))==null?void 0:Y.tldr)&&o.jsx("div",{className:"text-[10px] opacity-80 mb-1",children:t.find(F=>F.id===d.id).tldr}),o.jsx("div",{className:"text-[10px] text-green-400",children:"Click to open | Drag to move"})]}),t.length===0&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"No knowledge documents found"})]})}function Zj({doc:t,allDocs:l,onOpen:r,onNavigateDoc:i}){const[c,u]=k.useState(!1),f=Qj(t.category),m=t.akb_type==="hub",x=new Set(l.map(d=>d.id));return o.jsxs("div",{className:"mb-2 rounded-lg overflow-hidden",style:{background:m?"rgba(22,163,106,0.08)":"var(--hud-bg-alt)",border:`2px solid ${m?"rgba(22,163,106,0.4)":"var(--terminal-border)"}`},children:[o.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>u(!c),children:[o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("span",{className:"shrink-0 text-sm",children:m?"🗂":t.format==="html"?"🌐":"📄"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[o.jsx("span",{className:"font-semibold text-xs truncate",style:{color:"var(--terminal-text)"},children:t.title}),o.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:t.status==="active"?"#16a34a":t.status==="draft"?"#f59e0b":"#94a3b8"},title:t.status})]}),o.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:t.tags.slice(0,4).map(d=>o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium",style:{background:f.bg,color:f.text,border:`1px solid ${f.border}`},children:d},d))})]}),o.jsx("span",{className:"text-xs shrink-0",style:{color:"var(--terminal-text-muted)"},children:c?"▲":"▼"})]}),!c&&t.tldr&&o.jsx("div",{className:"mt-1.5 text-[10px] line-clamp-2 ml-6",style:{color:"var(--terminal-text-secondary)"},children:t.tldr})]}),c&&o.jsxs("div",{className:"px-3 pb-3",style:{borderTop:"1px solid var(--terminal-border)"},children:[t.tldr&&o.jsx("div",{className:"mt-2 text-[11px] leading-relaxed italic",style:{color:"var(--terminal-text-secondary)"},children:t.tldr}),t.links.length>0&&o.jsxs("div",{className:"mt-2",children:[o.jsx("div",{className:"text-[9px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Cross-links"}),o.jsx("div",{className:"flex flex-wrap gap-1",children:t.links.slice(0,5).map((d,g)=>{const y=d.href.replace(/^.*knowledge\//,"").replace(/^\.\.\/.*$/,"").replace(/^\.\//,""),b=x.has(y);return o.jsxs("span",{className:`px-1.5 py-0.5 text-[9px] rounded ${b?"cursor-pointer hover:opacity-70":""}`,style:{background:b?"rgba(22,163,106,0.15)":"rgba(148,163,184,0.1)",color:b?"#4ade80":"var(--terminal-text-muted)",border:`1px solid ${b?"rgba(22,163,106,0.3)":"var(--terminal-border)"}`},onClick:v=>{b&&(v.stopPropagation(),i(y))},children:["🔗"," ",d.text]},g)})})]}),o.jsxs("button",{className:"mt-2 text-[10px] font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},onClick:d=>{d.stopPropagation(),r(t)},children:["Open full ","→"]})]})]})}function Jj({docId:t,onBack:l,onDocUpdated:r,onDelete:i,onNavigateDoc:c,allDocs:u}){const[f,m]=k.useState(null),[x,d]=k.useState(!0),[g,y]=k.useState(!1),[b,v]=k.useState(""),[j,S]=k.useState(!1),E=new Set(u.map(L=>L.id)),C=k.useCallback(L=>{const O=L.split("#")[0];if(!O.match(/\.(md|html)$/))return null;const U=t.includes("/")?t.replace(/\/[^/]+$/,""):"";let X;if(O.startsWith("./"))X=U?`${U}/${O.slice(2)}`:O.slice(2);else if(O.startsWith("../")){const Y=U.split("/").filter(Boolean);let F=O;for(;F.startsWith("../");)Y.length>0&&Y.pop(),F=F.slice(3);X=Y.length>0?`${Y.join("/")}/${F}`:F}else X=O;if(E.has(X))return X;const ne=X.split("/").pop()??"",D=u.find(Y=>Y.id===ne||Y.id.endsWith("/"+ne));return D?D.id:null},[t,E,u]),A=k.useCallback(L=>{const U=L.target.closest("a");if(!U)return;const X=U.getAttribute("href");if(!X||X.startsWith("http://")||X.startsWith("https://")||!X.match(/\.(md|html)(#.*)?$/))return;L.preventDefault(),L.stopPropagation();const ne=C(X);ne&&c(ne)},[C,c]);k.useEffect(()=>{d(!0),Ce.getKnowledgeDoc(t).then(L=>{m(L),v(L.content)}).catch(console.error).finally(()=>d(!1))},[t]);const M=async()=>{if(f){S(!0);try{await Ce.updateKnowledgeDoc(t,b),m({...f,content:b}),y(!1),r()}catch(L){console.error("Save failed:",L)}finally{S(!1)}}},R=async()=>{if(confirm(`Delete "${f==null?void 0:f.title}"?`))try{await Ce.deleteKnowledgeDoc(t),i(t)}catch(L){console.error("Delete failed:",L)}};return x?o.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Loading..."}):f?o.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col",children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Back"]}),o.jsx("div",{className:"flex-1"}),g?o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>{y(!1),v(f.content)},className:"px-2.5 py-1 text-[10px] rounded cursor-pointer",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Cancel"}),o.jsx("button",{onClick:M,disabled:j,className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold text-white",style:{background:j?"#86efac":"#16a34a"},children:j?"Saving...":"Save"})]}):o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>y(!0),className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold",style:{background:"rgba(59,130,246,0.15)",color:"#60a5fa",border:"1px solid rgba(59,130,246,0.3)"},children:"Edit"}),o.jsx("button",{onClick:R,className:"px-2.5 py-1 text-[10px] rounded cursor-pointer font-semibold",style:{background:"rgba(239,68,68,0.15)",color:"#f87171",border:"1px solid rgba(239,68,68,0.3)"},children:"Delete"})]})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[o.jsx("h2",{className:"text-sm font-bold mb-1",style:{color:"var(--terminal-text)"},children:f.title}),f.tldr&&!g&&o.jsx("div",{className:"mb-3 text-xs italic",style:{color:"var(--terminal-text-secondary)"},children:f.tldr}),f.format==="html"?g?o.jsx("textarea",{className:"w-full h-full min-h-[400px] p-3 text-xs leading-relaxed rounded border resize-y",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',background:"var(--hud-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},value:b,onChange:L=>v(L.target.value),spellCheck:!1}):o.jsx("iframe",{srcDoc:f.content,sandbox:"allow-same-origin",className:"w-full flex-1 min-h-[400px] rounded",style:{border:"1px solid var(--terminal-border)",background:"var(--hud-bg-alt)"},title:f.title}):g?o.jsx("textarea",{className:"w-full h-full min-h-[400px] p-3 text-xs leading-relaxed rounded border resize-y",style:{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',background:"#1e1e2e",color:"#e2e8f0",border:"1px solid #334155"},value:b,onChange:L=>v(L.target.value),spellCheck:!1}):o.jsx("div",{className:"text-xs leading-relaxed",style:{color:"var(--terminal-text-secondary)"},onClick:A,children:o.jsx(Hs,{content:f.content})})]})]}):o.jsx("div",{className:"flex-1 flex items-center justify-center text-xs",style:{color:"var(--terminal-text-muted)"},children:"Failed to load document"})}function Pj({onCreated:t,onCancel:l}){const[r,i]=k.useState(""),[c,u]=k.useState(""),[f,m]=k.useState(""),[x,d]=k.useState(!1),[g,y]=k.useState("");k.useEffect(()=>{if(!r){u("");return}const v=r.toLowerCase().replace(/[^a-z0-9가-힣\s-]/g,"").replace(/\s+/g,"-").slice(0,60);u(v)},[r]);const b=async()=>{if(!r.trim()||!c.trim()){y("Title and filename are required");return}d(!0),y("");try{const v=await Ce.createKnowledgeDoc({filename:c,title:r,category:f||void 0});t(v.id)}catch(v){y(v instanceof Error?v.message:"Failed to create")}finally{d(!1)}};return o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[o.jsxs("button",{onClick:l,className:"text-xs font-semibold cursor-pointer hover:opacity-70",style:{color:"var(--active-green)"},children:["←"," Cancel"]}),o.jsx("h2",{className:"text-sm font-bold",style:{color:"var(--terminal-text)"},children:"New Document"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"TITLE"}),o.jsx("input",{type:"text",value:r,onChange:v=>i(v.target.value),placeholder:"Document title...",className:"w-full px-3 py-2 text-xs rounded focus:outline-none",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"FILENAME"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("input",{type:"text",value:c,onChange:v=>u(v.target.value),className:"flex-1 px-3 py-2 text-xs rounded focus:outline-none font-mono",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}}),o.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:".md"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[10px] font-semibold mb-1",style:{color:"var(--terminal-text-muted)"},children:"CATEGORY (optional)"}),o.jsx("input",{type:"text",value:f,onChange:v=>m(v.target.value),placeholder:"e.g., tech, market, strategy",className:"w-full px-3 py-2 text-xs rounded focus:outline-none",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}})]}),g&&o.jsx("div",{className:"text-[10px] px-3 py-1.5 rounded",style:{background:"rgba(239,68,68,0.15)",color:"#f87171"},children:g}),o.jsx("button",{onClick:b,disabled:x||!r.trim(),className:"w-full py-2 text-xs font-semibold rounded cursor-pointer text-white",style:{background:x?"#86efac":"#16a34a"},children:x?"Creating...":"Create Document"})]})]})}const eC=500,p0=360,y0=700;function Ch(t){const[l,r]=k.useState(eC),[i,c]=k.useState(!1),u=k.useRef(0),f=k.useRef(0),m=t>0,x=m?t:0,d=m?Math.max(p0,window.innerWidth-t-100):y0,g=Math.min(l,d),y=k.useCallback(b=>{b.preventDefault(),u.current=b.clientX,f.current=g,c(!0);const v=S=>{const E=u.current-S.clientX,C=Math.min(y0,Math.max(p0,f.current+E));r(C)},j=()=>{c(!1),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",j)};document.addEventListener("mousemove",v),document.addEventListener("mouseup",j)},[g]);return{panelRight:x,panelWidth:g,isResizing:i,handleResizeStart:y}}function tC({docs:t,onClose:l,onRefresh:r,terminalWidth:i=0,initialDocId:c}){const[u,f]=k.useState("list"),[m,x]=k.useState("all"),[d,g]=k.useState(c??null),[y,b]=k.useState(""),[v,j]=k.useState(!1),[S,E]=k.useState(null),{panelRight:C,panelWidth:A,isResizing:M,handleResizeStart:R}=Ch(i),L=["all",...Array.from(new Set(t.map(Y=>Y.category))).sort()],O=t.filter(Y=>{if(m!=="all"&&Y.category!==m)return!1;if(y){const F=y.toLowerCase();return Y.title.toLowerCase().includes(F)||(Y.tldr??"").toLowerCase().includes(F)||Y.tags.some(Q=>Q.toLowerCase().includes(F))}return!0}),U=Y=>{j(!1),r(),g(Y)},X=Y=>{g(null),r()},ne=Y=>{E(Y.id)},D=S?t.find(Y=>Y.id===S):null;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:C},onClick:l}),o.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${M?"resizing":""}`,style:{right:C,width:A,background:"var(--terminal-bg)",borderLeftColor:"#16a34a"},children:[o.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${M?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:R}),o.jsxs("div",{className:"p-5 text-white relative",style:{background:"#16a34a"},children:[o.jsx("button",{onClick:l,className:"absolute top-3 right-3 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),o.jsxs("div",{className:"text-lg font-bold",children:["📚"," Knowledge Base"]}),o.jsxs("div",{className:"text-xs opacity-80 mt-0.5",children:[t.length," documents"]})]}),o.jsxs("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx(g0,{label:"List",active:u==="list",onClick:()=>{f("list"),E(null)}}),o.jsx(g0,{label:"Graph",active:u==="graph",onClick:()=>f("graph")})]}),u==="list"&&!d&&!v&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 shrink-0",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx("input",{type:"text",value:y,onChange:Y=>b(Y.target.value),placeholder:"Search docs...",className:"flex-1 px-2.5 py-1.5 text-[11px] rounded focus:outline-none",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text)"}}),o.jsx("button",{onClick:()=>j(!0),className:"px-2.5 py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white shrink-0",style:{background:"#16a34a"},children:"+ New"})]}),o.jsx("div",{className:"flex overflow-x-auto shrink-0",style:{borderBottom:"1px solid var(--terminal-border)",scrollbarWidth:"none"},children:L.map(Y=>o.jsx("button",{onClick:()=>x(Y),className:"px-3 py-1.5 text-[10px] font-medium cursor-pointer whitespace-nowrap",style:{color:m===Y?"#4ade80":"var(--terminal-text-muted)",borderBottom:m===Y?"2px solid #4ade80":"2px solid transparent"},children:Y==="all"?`All (${t.length})`:`${Y} (${t.filter(F=>F.category===Y).length})`},Y))}),o.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:O.length===0?o.jsx("div",{className:"text-center text-xs py-8",style:{color:"var(--terminal-text-muted)"},children:y?"No matching documents":"No documents in this category"}):O.map(Y=>o.jsx(Zj,{doc:Y,allDocs:t,onOpen:F=>g(F.id),onNavigateDoc:F=>g(F)},Y.id))})]}),u==="list"&&d&&!v&&o.jsx(Jj,{docId:d,onBack:()=>g(null),onDocUpdated:r,onDelete:X,onNavigateDoc:Y=>g(Y),allDocs:t}),u==="list"&&v&&o.jsx(Pj,{onCreated:U,onCancel:()=>j(!1)}),u==="graph"&&o.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[o.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[o.jsx(Wj,{docs:t,onNodeClick:ne,selectedDocId:S}),D&&o.jsxs("div",{className:"shrink-0 overflow-y-auto p-3",style:{width:200,background:"var(--hud-bg-alt)",borderLeft:"1px solid var(--terminal-border)"},children:[o.jsx("div",{className:"text-[10px] font-bold uppercase mb-1",style:{color:"var(--terminal-text-muted)"},children:"Selected"}),o.jsx("div",{className:"text-xs font-bold mb-1",style:{color:"var(--terminal-text)"},children:D.title}),o.jsx("div",{className:"w-2 h-2 rounded-full mb-2",style:{background:D.status==="active"?"#16a34a":D.status==="draft"?"#f59e0b":"#94a3b8"}}),D.tldr&&o.jsx("div",{className:"text-[10px] mb-2 leading-relaxed",style:{color:"var(--terminal-text-secondary)"},children:D.tldr}),D.links.length>0&&o.jsxs("div",{className:"mb-2",children:[o.jsx("div",{className:"text-[9px] font-bold mb-1",style:{color:"var(--terminal-text-muted)"},children:"Links"}),D.links.slice(0,5).map((Y,F)=>o.jsxs("div",{className:"text-[9px] mb-0.5 truncate",style:{color:"var(--terminal-text-secondary)"},children:["🔗"," ",Y.text]},F))]}),o.jsx("button",{className:"w-full py-1.5 text-[10px] font-semibold rounded cursor-pointer text-white",style:{background:"#16a34a"},onClick:()=>{f("list"),g(D.id),E(null)},children:"Open Document"})]})]}),o.jsx("div",{className:"shrink-0 p-2",style:{borderTop:"1px solid var(--terminal-border)"},children:o.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(_s).map(([Y,F])=>o.jsxs("div",{className:"flex items-center gap-1 text-[9px]",children:[o.jsx("div",{className:"w-2 h-2",style:{background:F.border}}),o.jsx("span",{style:{color:"var(--terminal-text-muted)"},children:Y})]},Y))})})]})]})]})}function g0({label:t,active:l,onClick:r}){return o.jsx("button",{onClick:r,className:"px-4 py-2.5 text-sm font-medium cursor-pointer",style:{color:l?"#4ade80":"var(--terminal-text-muted)",borderBottom:l?"2px solid #4ade80":"2px solid transparent"},children:t})}function nC({standups:t,waves:l,decisions:r,mode:i,onClose:c,terminalWidth:u=0}){const[f,m]=k.useState(i==="decisions"?"decisions":"standups"),{panelRight:x,panelWidth:d,isResizing:g,handleResizeStart:y}=Ch(u);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:x},onClick:c}),o.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${g?"resizing":""}`,style:{right:x,width:d,background:"var(--terminal-bg)",borderLeftColor:"var(--desk-wood)"},children:[o.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${g?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:y}),o.jsxs("div",{className:"p-5 bg-[var(--desk-wood)] text-white relative",children:[o.jsx("button",{onClick:c,className:"absolute top-3 right-3 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),o.jsx("div",{className:"text-lg font-bold",children:i==="bulletin"?"📌 Bulletin Board":"📜 Decision Log"})]}),o.jsx("div",{className:"flex",style:{borderBottom:"1px solid var(--terminal-border)"},children:i==="bulletin"?o.jsxs(o.Fragment,{children:[o.jsx(vd,{label:`Standups (${t.length})`,active:f==="standups",onClick:()=>m("standups")}),o.jsx(vd,{label:`Waves (${l.length})`,active:f==="waves",onClick:()=>m("waves")})]}):o.jsx(vd,{label:`Decisions (${r.length})`,active:f==="decisions",onClick:()=>m("decisions")})}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[f==="standups"&&t.map((b,v)=>o.jsx(wd,{title:`Standup ${b.date}`,content:b.content},v)),f==="waves"&&l.map((b,v)=>o.jsx(wd,{title:`Wave ${b.id}`,subtitle:b.timestamp,content:b.content},v)),f==="decisions"&&r.map((b,v)=>o.jsx(wd,{title:`#${b.id} ${b.title}`,subtitle:b.date,content:b.content},v))]})]})]})}function vd({label:t,active:l,onClick:r}){return o.jsx("button",{onClick:r,className:"px-4 py-2.5 text-sm font-medium cursor-pointer",style:{color:l?"var(--accent)":"var(--terminal-text-muted)",borderBottom:l?"2px solid var(--accent)":"2px solid transparent"},children:t})}function lC(t){return t.replace(/^#{1,6}\s+/gm,"").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/```[\s\S]*?```/g,"").replace(/^\s*[-*+]\s+/gm,"• ").replace(/^\s*\d+\.\s+/gm,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/^>\s+/gm,"").replace(/^---+$/gm,"").replace(/\|[^|]*\|/g,"").replace(/\n{2,}/g," · ").replace(/\n/g," ").trim()}function wd({title:t,subtitle:l,content:r}){const[i,c]=k.useState(!1),u=r.length>100,f=lC(r).slice(0,160);return o.jsxs("div",{className:"mb-3 rounded-lg overflow-hidden",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"p-3 cursor-pointer hover:bg-white/5",onClick:()=>c(!i),children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"font-medium text-sm",style:{color:"var(--terminal-text)"},children:t}),o.jsx("span",{className:"text-xs shrink-0 ml-2",style:{color:"var(--terminal-text-muted)"},children:i?"▲":"▼"})]}),l&&o.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--terminal-text-muted)"},children:l})]}),i&&o.jsx("div",{className:"px-3 pb-3 text-xs leading-relaxed pt-2",style:{borderTop:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:o.jsx(Hs,{content:r})}),!i&&u&&o.jsx("div",{className:"px-3 pb-2 text-xs line-clamp-2 leading-relaxed",style:{color:"var(--terminal-text-muted)"},children:f})]})}function rC({projectId:t,onClose:l,terminalWidth:r=0}){const[i,c]=k.useState(null),{panelRight:u,panelWidth:f,isResizing:m,handleResizeStart:x}=Ch(r);if(k.useEffect(()=>{Ce.getProject(t).then(c).catch(console.error)},[t]),!i)return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),o.jsx("div",{className:"side-panel open fixed top-0 h-full z-50 flex items-center justify-center border-l-[3px] border-[var(--meeting-blue)]",style:{right:u,width:f,background:"var(--terminal-bg)"},children:o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-muted)"},children:"Loading project..."})})]});const d=i.tasks.filter(b=>b.status==="done").length,g=i.tasks.length,y=g>0?Math.round(d/g*100):0;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"dimmer fixed top-0 left-0 bottom-0 bg-black/30 z-40 open",style:{right:u},onClick:l}),o.jsxs("div",{className:`side-panel open fixed top-0 h-full z-50 flex flex-col border-l-[3px] border-[var(--meeting-blue)] shadow-[-4px_0_20px_rgba(0,0,0,0.4)] ${m?"resizing":""}`,style:{right:u,width:f,background:"var(--terminal-bg)"},children:[o.jsx("div",{className:`absolute top-0 -left-[5px] w-[10px] h-full cursor-col-resize z-[60] transition-colors ${m?"bg-white/10":"hover:bg-white/5"}`,onMouseDown:x}),o.jsxs("div",{className:"p-5 bg-[var(--meeting-blue)] text-white relative",children:[o.jsx("div",{className:"text-sm opacity-70",children:"Meeting Room"}),o.jsx("button",{onClick:l,className:"absolute top-3 right-3 z-10 w-7 h-7 rounded-full bg-white/20 text-white flex items-center justify-center text-lg hover:bg-white/30 cursor-pointer",children:"×"}),o.jsx("div",{className:"text-xl font-bold mt-1",children:i.name}),o.jsxs("div",{className:"flex items-center gap-3 mt-3 text-sm",children:[o.jsxs("span",{children:["Tasks: ",g]}),o.jsxs("span",{children:["Done: ",d]}),o.jsxs("span",{children:["Progress: ",y,"%"]})]}),o.jsx("div",{className:"mt-2 h-1.5 bg-white/20 rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full bg-white rounded-full transition-all",style:{width:`${y}%`}})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[i.prd&&o.jsxs("div",{className:"mb-5",children:[o.jsx("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"PRD"}),o.jsx("div",{className:"rounded-lg p-4 text-xs leading-relaxed max-h-60 overflow-y-auto",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-secondary)"},children:o.jsx(Hs,{content:i.prd})})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"text-[11px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:["Tasks (",g,")"]}),o.jsx("div",{className:"space-y-2",children:i.tasks.map(b=>o.jsxs("div",{className:"rounded-lg p-3",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium",style:{color:"var(--terminal-text)"},children:b.title}),o.jsx(aC,{status:b.status})]}),o.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-muted)"},children:b.role}),b.description&&o.jsx("div",{className:"text-xs mt-1.5 line-clamp-2",style:{color:"var(--terminal-text-secondary)"},children:b.description})]},b.id))})]})]})]})]})}function aC({status:t}){const l={done:{bg:"rgba(34,197,94,0.15)",color:"#4ade80"},"in-progress":{bg:"rgba(59,130,246,0.15)",color:"#60a5fa"},todo:{bg:"rgba(148,163,184,0.15)",color:"var(--terminal-text-muted)"}},r=l[t]??l.todo;return o.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:r.bg,color:r.color},children:t})}const iC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function sC({roleId:t,roleName:l,mode:r="assign",onClose:i,onExecutionStart:c}){const[u,f]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const x=()=>{u.trim()&&(c(t,u.trim()),i())},d=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&x(),y.key==="Escape"&&i()},g=iC[t]??"#666";return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),o.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[520px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[o.jsxs("div",{className:"p-5 text-white",style:{background:`linear-gradient(135deg, ${g}, ${g}cc)`},children:[o.jsx("div",{className:"text-lg font-bold",children:r==="ask"?"Ask":"Assign Task"}),o.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:r==="ask"?`to ${l}`:`to ${l} (${t})`})]}),o.jsxs("div",{className:"p-5",children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Task Description"}),o.jsx("textarea",{ref:m,value:u,onChange:y=>f(y.target.value),onKeyDown:d,placeholder:r==="ask"?"What would you like to ask?":"Describe the task...",className:"w-full h-32 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),o.jsx("div",{className:"text-[10px] text-white/30 mt-1",children:"Cmd+Enter to submit"})]}),o.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[o.jsx("button",{onClick:i,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),o.jsx("button",{onClick:x,disabled:!u.trim(),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:g},children:r==="ask"?"Ask":"Assign"})]})]})]})}const b0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"};function mg({event:t,isThinkingCollapsed:l,onToggleThinking:r,onNavigateToJob:i,onOpenKnowledgeDoc:c,compact:u}){var m;const f=b0[t.roleId]??"#888";switch(t.type){case"text":return o.jsx("div",{className:"text-green-300/90 whitespace-pre-wrap leading-relaxed",children:u?(t.data.text??"").slice(0,300):t.data.text});case"thinking":{const x=t.data.text??"";return o.jsxs("div",{className:"group",children:[o.jsxs("button",{onClick:r,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-[10px] cursor-pointer flex items-center gap-1",children:[o.jsx("span",{children:l?"▶":"▼"}),o.jsx("span",{className:"italic",children:"thinking..."})]}),!l&&o.jsxs("div",{className:`ml-3 text-[var(--terminal-text-muted)] italic whitespace-pre-wrap opacity-60 text-[11px] overflow-y-auto ${u?"max-h-[60px]":"max-h-[120px]"}`,children:[x.slice(0,u?200:500),x.length>(u?200:500)?"...":""]})]})}case"tool:start":{const x=String(t.data.name??""),d=t.data.input,g=typeof(d==null?void 0:d.command)=="string"?d.command.slice(0,80):"",y=typeof(d==null?void 0:d.file_path)=="string"?String(d.file_path):typeof(d==null?void 0:d.path)=="string"?String(d.path):"",b=y?y.split("/").pop()??"":"",v=/^(write_file|Write|edit_file|Edit)$/i.test(x),j=(m=y.match(/(?:^|\/)knowledge\/(.+\.md)$/))==null?void 0:m[1],S=v&&j&&c;return o.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[o.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${S?"text-green-400/80 bg-green-400/10":"text-blue-400/80 bg-blue-400/10"}`,children:S?v&&x.toLowerCase().includes("edit")?"Edit":"Write":x}),S?o.jsx("button",{onClick:()=>c(j),className:"text-[10px] text-green-400 hover:text-green-300 underline underline-offset-2 cursor-pointer truncate",style:{maxWidth:u?200:400},children:b}):o.jsxs(o.Fragment,{children:[g&&o.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:g}),b&&o.jsx("span",{className:`text-[var(--terminal-text-muted)] text-[10px] truncate ${u?"max-w-[200px]":"max-w-[400px]"}`,children:b})]})]})}case"dispatch:start":{const x=t.data.targetRoleId??t.data.roleId??"",d=t.data.task??"",g=t.data.childJobId,y=b0[x]??"#888";return o.jsx("div",{className:"my-1 p-2 rounded-lg border cursor-pointer hover:opacity-90 transition-opacity",style:{borderColor:`${y}44`,background:`${y}11`},onClick:()=>g&&(i==null?void 0:i(g)),children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{style:{color:y},className:"font-bold text-[11px]",children:["→"," ",x.toUpperCase()]}),o.jsx("span",{className:"text-[var(--terminal-text-secondary)] text-[10px] truncate flex-1",children:d.slice(0,u?60:100)}),g&&i&&o.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/10 text-[var(--terminal-text-muted)]",children:["View ","→"]})]})})}case"dispatch:done":return o.jsx("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pl-3 border-l-2 border-[var(--terminal-border)] my-0.5",children:"Dispatch completed"});case"turn:complete":return o.jsx("div",{className:"border-t border-[var(--terminal-border)] my-2 relative",children:o.jsxs("span",{className:"absolute -top-2 left-2 bg-[var(--terminal-bg)] px-2 text-[9px] text-[var(--terminal-text-muted)]",children:["Turn ",t.data.turn]})});case"stderr":return o.jsxs("div",{className:"text-red-400/80 text-[11px]",children:["⚠"," ",t.data.message]});case"job:start":return o.jsxs("div",{className:"text-[var(--terminal-text-muted)] text-[10px] pb-1",children:[o.jsx("span",{style:{color:f},className:"font-bold",children:t.roleId.toUpperCase()})," ","started: ",(t.data.task??"").slice(0,u?50:80)]});case"job:done":{const x=t.data.turns??0,d=t.data.toolCalls??0;return o.jsx("div",{className:"mt-2 p-2 rounded-lg bg-green-900/20 border border-green-800/30",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-green-400"}),o.jsx("span",{className:"text-green-300 font-bold text-[11px]",children:"Complete"}),o.jsxs("span",{className:"text-[var(--terminal-text-muted)] text-[10px]",children:[x," turns · ",d," tools"]})]})})}case"job:error":return o.jsx("div",{className:"mt-2 p-2 rounded-lg bg-red-900/20 border border-red-800/30",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-red-400"}),o.jsx("span",{className:"text-red-300 font-bold text-[11px]",children:"Error"}),o.jsx("span",{className:"text-red-200/70 text-[10px]",children:t.data.message})]})});case"import:scan":case"import:process":case"import:created":return o.jsxs("div",{className:"text-cyan-300/70 text-[11px]",children:["[",t.type,"] ",JSON.stringify(t.data)]});default:return null}}function oC({jobId:t,title:l,color:r,variant:i,style:c,onClose:u,onMinimize:f,onDone:m,onNavigateToJob:x,onOpenKnowledgeDoc:d}){const{events:g,status:y,textOutput:b,childJobIds:v}=V0(t),[j,S]=k.useState(0),[E,C]=k.useState(new Set),A=k.useRef(null),M=k.useRef(Date.now()),R=k.useRef(!1);k.useEffect(()=>{const Y=setInterval(()=>{S(Math.floor((Date.now()-M.current)/1e3))},1e3);return()=>clearInterval(Y)},[]),k.useEffect(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[g]),k.useEffect(()=>{(y==="done"||y==="error")&&!R.current&&(R.current=!0,m==null||m())},[y,m]);const L=Y=>{C(F=>{const Q=new Set(F);return Q.has(Y)?Q.delete(Y):Q.add(Y),Q})},O={idle:"Waiting",connecting:"Connecting...",streaming:"Working",done:"Complete",error:"Error"}[y],U={idle:"#888",connecting:"#888",streaming:r,done:"#2E7D32",error:"#C62828"}[y],X=Y=>`${Math.floor(Y/60)}:${String(Y%60).padStart(2,"0")}`,ne=y==="done"||y==="error",D=o.jsxs("div",{className:i==="modal"?"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] h-[85vh] z-[61] bg-[var(--terminal-bg)] rounded-2xl shadow-2xl overflow-hidden flex flex-col":"bg-[var(--terminal-bg)] rounded-xl border border-[var(--terminal-border)] overflow-hidden flex flex-col max-h-[400px]",style:c,children:[o.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{background:U}}),o.jsx("div",{children:o.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:l})})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:X(j)}),o.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:`${U}22`,color:U},children:O}),f&&i==="modal"&&o.jsx("button",{onClick:f,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),ne&&o.jsx("button",{onClick:u,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),o.jsxs("div",{ref:A,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[g.length===0&&y==="connecting"&&o.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:"Connecting to activity stream..."}),g.map(Y=>o.jsx(mg,{event:Y,isThinkingCollapsed:E.has(Y.seq),onToggleThinking:()=>L(Y.seq),onNavigateToJob:x,onOpenKnowledgeDoc:d},Y.seq)),y==="streaming"&&o.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),o.jsxs("div",{className:"px-5 py-3 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[o.jsxs("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:[g.length>0&&`${g.length} events`,b.length>0&&` · ${b.length} chars`,v.length>0&&` · ${v.length} dispatches`]}),ne&&o.jsx("button",{onClick:u,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer",style:{background:r},children:"Close"})]})]});return i==="modal"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:ne?u:void 0}),D]}):D}const kd={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function cC({orgNodes:t,rootId:l}){const r=t[l];if(!r)return null;const c=r.children.map(m=>t[m]).filter(Boolean),u=[];for(const m of c)for(const x of m.children){const d=t[x];d&&u.push({node:d,parentId:m.id})}const f=c.length+u.length;return o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Propagation Preview"}),o.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-lg p-4",children:[o.jsx("div",{className:"flex justify-center mb-2",children:o.jsx("span",{className:"px-3 py-1 text-[10px] font-bold rounded border-2 border-white/20 bg-white/5 text-white/30 uppercase",children:"CEO"})}),c.length>0&&o.jsx("div",{className:"flex justify-center mb-1",children:o.jsx("div",{className:"w-px h-3 bg-white/15"})}),c.length>1&&o.jsx("div",{className:"flex justify-center mb-1",children:o.jsx("div",{className:"h-px bg-white/15",style:{width:`${Math.min(c.length*80,320)}px`}})}),o.jsx("div",{className:"flex justify-center gap-3 mb-2 flex-wrap",children:c.map(m=>o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("span",{className:"px-2.5 py-1 text-[10px] font-bold rounded border-2 uppercase",style:{borderColor:kd[m.id]??"#888",color:kd[m.id]??"#888",background:`${kd[m.id]??"#888"}22`},children:m.id}),o.jsx("span",{className:"text-[8px] text-white/30 mt-0.5",children:"direct"})]},m.id))}),u.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex justify-center mb-1",children:o.jsx("div",{className:"w-px h-2 bg-white/10"})}),o.jsx("div",{className:"flex justify-center gap-2 flex-wrap",children:u.map(({node:m})=>o.jsx("span",{className:"px-2 py-0.5 text-[9px] font-semibold rounded border border-white/15 text-white/40 uppercase",children:m.id},m.id))}),o.jsx("div",{className:"text-center text-[8px] text-white/30 mt-1",children:"via re-dispatch"})]})]}),o.jsxs("div",{className:"text-[10px] text-gray-400 mt-1.5",children:[f," role",f!==1?"s":""," will receive this wave"]})]})}function uC({cLevelRoles:t,orgNodes:l,rootId:r,onClose:i,onDispatch:c}){const[u,f]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const x=()=>{!u.trim()||t.length===0||(c(u.trim()),i())},d=y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&x(),y.key==="Escape"&&i()},g=r&&Object.keys(l).length>0;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:i}),o.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[560px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[o.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[o.jsx("div",{className:"text-lg font-bold",children:"CEO Wave"}),o.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:"Broadcast a directive to all C-Level reports"})]}),o.jsxs("div",{className:"p-5 space-y-4",children:[g&&o.jsx(cC,{orgNodes:l,rootId:r}),!g&&o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Dispatching to"}),o.jsx("div",{className:"flex gap-2 flex-wrap",children:t.length>0?t.map(y=>o.jsxs("span",{className:"px-3 py-1.5 text-xs font-semibold rounded-lg border-2 border-red-200 bg-red-50 text-red-800",children:[y.id.toUpperCase()," · ",y.name]},y.id)):o.jsx("span",{className:"text-xs text-gray-400 italic",children:"No C-Level roles found"})}),o.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Each C-Level receives the directive and delegates to their reports"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Directive"}),o.jsx("textarea",{ref:m,value:u,onChange:y=>f(y.target.value),onKeyDown:d,placeholder:"e.g. Report current status across all departments",className:"w-full h-28 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),o.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Cmd+Enter to dispatch"})]})]}),o.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[o.jsx("button",{onClick:i,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),o.jsxs("button",{onClick:x,disabled:!u.trim()||t.length===0,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#B71C1C"},children:["Dispatch to ",t.length," Role",t.length!==1?"s":""]})]})]})]})}function fC(t,l,r){const[i,c]=k.useState(new Map),[u,f]=k.useState(null),m=k.useRef(new Map),x=k.useRef(i);x.current=i,k.useEffect(()=>{if(!r||Object.keys(l).length===0)return;const b=new Map,v=S=>{const E=l[S];E&&(b.set(S,{jobId:null,roleId:S,roleName:E.name,children:E.children,status:"waiting",events:[],streamStatus:"idle"}),E.children.forEach(v))},j=l[r];j&&(b.set(r,{jobId:null,roleId:r,roleName:"CEO",children:j.children,status:"not-dispatched",events:[],streamStatus:"idle"}),j.children.forEach(v));for(const S of t){const E=b.get(S.roleId);E&&(E.jobId=S.jobId,E.status="running",E.streamStatus="connecting")}c(b),t.length>0&&f(t[0].roleId)},[t,l,r]);const d=k.useCallback((b,v)=>{const j=m.current.get(b);j&&j.controller.abort();const S=new AbortController,E={controller:S,lastSeq:-1};m.current.set(b,E);const A=`/api/jobs/${b}/stream?from=0`;fetch(A,{signal:S.signal}).then(async M=>{if(!M.ok||!M.body){c(U=>{const X=new Map(U),ne=X.get(v);return ne&&X.set(v,{...ne,streamStatus:"error"}),X});return}c(U=>{const X=new Map(U),ne=X.get(v);return ne&&X.set(v,{...ne,streamStatus:"streaming",status:"running"}),X});const R=M.body.getReader(),L=new TextDecoder;let O="";for(;;){const{done:U,value:X}=await R.read();if(U)break;O+=L.decode(X,{stream:!0});const ne=O.split(`
|
|
81
|
+
`);O=ne.pop()??"";let D="";for(const Y of ne)if(Y.startsWith("event: "))D=Y.slice(7).trim();else if(Y.startsWith("data: ")){try{const F=JSON.parse(Y.slice(6));if(D==="activity"){const Q=F;Q.seq>E.lastSeq&&(E.lastSeq=Q.seq),c(ee=>{const V=new Map(ee),I=V.get(v);if(!I||I.events.some(ce=>ce.seq===Q.seq))return ee;const Z={...I,events:[...I.events,Q]};if(Q.type==="dispatch:start"&&Q.data.childJobId){const ce=Q.data.childJobId,we=Q.data.targetRoleId??Q.data.roleId;if(we){const z=V.get(we);z&&(V.set(we,{...z,jobId:ce,status:"running",streamStatus:"connecting"}),setTimeout(()=>d(ce,we),0))}}return Q.type==="job:done"?(Z.status="done",Z.streamStatus="done"):Q.type==="job:error"&&(Z.status="error",Z.streamStatus="error"),V.set(v,Z),V})}else if(D==="stream:end"){const Q=F.reason;c(ee=>{const V=new Map(ee),I=V.get(v);if(!I)return ee;const Z=Q==="error"?"error":"done";return V.set(v,{...I,status:I.status==="running"?Z:I.status,streamStatus:Z==="error"?"error":"done"}),V})}}catch{}D=""}}}).catch(M=>{M.name!=="AbortError"&&c(R=>{const L=new Map(R),O=L.get(v);return O&&L.set(v,{...O,streamStatus:"error"}),L})})},[]);k.useEffect(()=>{if(t.length!==0){for(const b of t)d(b.jobId,b.roleId);return()=>{for(const[,b]of m.current)b.controller.abort();m.current.clear()}}},[t,d]);const g=(()=>{let b=0,v=0,j=0;for(const[S,E]of i)S!==r&&(j++,E.status==="done"?b++:E.status==="running"&&v++);return{done:b,total:j,running:v}})(),y=g.total>0&&g.running===0&&Array.from(i.values()).every(b=>b.status!=="running"&&b.streamStatus!=="streaming"&&b.streamStatus!=="connecting");return k.useEffect(()=>{y&&c(b=>{const v=new Map(b);let j=!1;for(const[S,E]of v)E.status==="waiting"&&(v.set(S,{...E,status:"not-dispatched"}),j=!0);return j?v:b})},[y]),{nodes:i,selectedRoleId:u,selectNode:f,progress:g,allDone:y}}const v0={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},ga=120,nr=44,w0=80;function dC(t,l){if(!t.get(l))return{layout:[],width:300,height:200};const i=[],c=[],u=[{id:l,depth:0,parentId:null}],f=new Set;for(;u.length>0;){const{id:g,depth:y,parentId:b}=u.shift();if(f.has(g))continue;for(f.add(g);c.length<=y;)c.push([]);c[y].push(g),i.push({roleId:g,x:0,y:y*w0+20,parentId:b});const v=t.get(g);if(v)for(const j of v.children)t.has(j)&&!f.has(j)&&u.push({id:j,depth:y+1,parentId:g})}const m=Math.max(...c.map(g=>g.length))*(ga+16),x=Math.max(m,280);for(const g of c){const y=g.length*(ga+16)-16,b=(x-y)/2;g.forEach((v,j)=>{const S=i.find(E=>E.roleId===v);S&&(S.x=b+j*(ga+16))})}const d=c.length*w0+40;return{layout:i,width:x,height:d}}function hC({nodes:t,rootId:l,selectedRoleId:r,onSelectNode:i}){const{layout:c,width:u,height:f}=dC(t,l),m=d=>{const g=c.find(y=>y.roleId===d);return g?{cx:g.x+ga/2,cy:g.y+nr/2}:{cx:0,cy:0}},x=d=>{switch(d.status){case"running":return v0[d.roleId]??"#FBBF24";case"done":return"#2E7D32";case"error":return"#C62828";case"not-dispatched":return"#666";default:return"#888"}};return o.jsxs("svg",{viewBox:`0 0 ${u} ${f}`,width:"100%",height:"100%",className:"block",children:[o.jsx("defs",{children:o.jsxs("filter",{id:"glow",children:[o.jsx("feGaussianBlur",{stdDeviation:"2",result:"blur"}),o.jsxs("feMerge",{children:[o.jsx("feMergeNode",{in:"blur"}),o.jsx("feMergeNode",{in:"SourceGraphic"})]})]})}),c.filter(d=>d.parentId).map(d=>{const g=m(d.parentId),y=m(d.roleId),b=t.get(d.roleId),v=t.get(d.parentId);let j="rgba(180,200,240,0.15)",S="4 4",E="";return(b==null?void 0:b.status)==="done"||(v==null?void 0:v.status)==="done"?(j="#2E7D3266",S=""):(b==null?void 0:b.status)==="running"&&(j=v0[d.roleId]??"#FBBF24",S="6 4",E="wave-edge-flow"),o.jsx("line",{x1:g.cx,y1:g.cy+nr/2-4,x2:y.cx,y2:y.cy-nr/2+4,stroke:j,strokeWidth:1.5,strokeDasharray:S,className:E},`${d.parentId}-${d.roleId}`)}),c.map(d=>{const g=t.get(d.roleId);if(!g)return null;const y=x(g),b=r===d.roleId,v=d.roleId===l,j=v?.4:g.status==="not-dispatched"?.35:1;return o.jsxs("g",{transform:`translate(${d.x}, ${d.y})`,style:{cursor:v?"default":"pointer",opacity:j},onClick:()=>!v&&i(d.roleId),children:[o.jsx("rect",{x:0,y:0,width:ga,height:nr,rx:8,ry:8,fill:"var(--terminal-bg-deeper, #181825)",stroke:b?"#fff":y,strokeWidth:b?2:1.5,strokeDasharray:g.status==="not-dispatched"?"4 3":""}),o.jsx("circle",{cx:14,cy:nr/2,r:4,fill:y,filter:g.status==="running"?"url(#glow)":void 0,children:g.status==="running"&&o.jsx("animate",{attributeName:"opacity",values:"1;0.4;1",dur:"1.5s",repeatCount:"indefinite"})}),o.jsx("text",{x:26,y:nr/2-4,fill:"var(--terminal-text, #fff)",fontSize:10,fontWeight:700,fontFamily:"var(--pixel-font)",children:g.roleId.toUpperCase()}),o.jsx("text",{x:26,y:nr/2+10,fill:"var(--terminal-text-muted, #888)",fontSize:8,fontFamily:"var(--pixel-font)",children:g.status==="running"?"Working...":g.status==="done"?"Complete":g.status==="error"?"Error":g.status==="waiting"?"Waiting":""}),g.status==="done"&&o.jsx("text",{x:ga-18,y:nr/2+4,fontSize:14,fill:"#2E7D32",children:"✓"}),g.status==="error"&&o.jsx("text",{x:ga-18,y:nr/2+4,fontSize:14,fill:"#C62828",children:"✗"})]},d.roleId)})]})}const mC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};function xC({directive:t,rootJobs:l,orgNodes:r,rootRoleId:i,onClose:c,onMinimize:u,onDone:f,onOpenKnowledgeDoc:m}){const{nodes:x,selectedRoleId:d,selectNode:g,progress:y,allDone:b}=fC(l,r,i),[v,j]=k.useState(0),[S,E]=k.useState(new Set),C=k.useRef(null),A=k.useRef(Date.now()),M=k.useRef(!1);k.useEffect(()=>{const X=setInterval(()=>{j(Math.floor((Date.now()-A.current)/1e3))},1e3);return()=>clearInterval(X)},[]),k.useEffect(()=>{C.current&&(C.current.scrollTop=C.current.scrollHeight)},[d,x]),k.useEffect(()=>{b&&!M.current&&(M.current=!0,f==null||f())},[b,f]);const R=X=>`${Math.floor(X/60)}:${String(X%60).padStart(2,"0")}`,L=d?x.get(d):null,O=d?mC[d]??"#888":"#888",U=X=>{E(ne=>{const D=new Set(ne);return D.has(X)?D.delete(X):D.add(X),D})};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:b?c:void 0}),o.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[960px] max-w-[95vw] h-[85vh] z-[61] bg-[var(--terminal-bg)] rounded-2xl shadow-2xl overflow-hidden flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-[var(--terminal-border)] shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:b?"#2E7D32":"#B71C1C",animation:b?void 0:"wave-pulse 2s ease-in-out infinite"}}),o.jsx("div",{children:o.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-sm",children:b?"WAVE COMPLETE":"WAVE COMMAND CENTER"})})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs font-mono",children:R(v)}),o.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full font-semibold",style:{background:b?"#2E7D3222":"#B71C1C22",color:b?"#2E7D32":"#B71C1C"},children:[y.done,"/",y.total," done"]}),o.jsx("button",{onClick:u,title:"Minimize",className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-sm cursor-pointer px-1",children:"–"}),b&&o.jsx("button",{onClick:c,className:"text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text)] text-lg cursor-pointer",children:"×"})]})]}),o.jsx("div",{className:"px-5 py-2 border-b border-[var(--terminal-border)] shrink-0",children:o.jsxs("span",{className:"text-[var(--terminal-text-secondary)] text-xs italic",children:["“",t,"”"]})}),o.jsxs("div",{className:"flex flex-1 min-h-0",children:[o.jsxs("div",{className:"w-[280px] shrink-0 border-r border-[var(--terminal-border)] flex flex-col",children:[o.jsx("div",{className:"px-3 py-2 border-b border-[var(--terminal-border)]",children:o.jsx("span",{className:"text-[10px] font-bold text-[var(--terminal-text-secondary)] uppercase tracking-wider",children:"Org Propagation"})}),o.jsx("div",{className:"flex-1 overflow-auto p-3",children:o.jsx(hC,{nodes:x,rootId:i,selectedRoleId:d,onSelectNode:g})}),o.jsx("div",{className:"px-3 py-2 border-t border-[var(--terminal-border)] flex flex-wrap gap-x-3 gap-y-1",children:[{label:"running",color:"#FBBF24",dot:!0},{label:"done",color:"#2E7D32",dot:!1},{label:"waiting",color:"#888",dot:!1},{label:"error",color:"#C62828",dot:!1}].map(X=>o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:X.color,animation:X.dot?"wave-pulse 1.5s ease-in-out infinite":void 0}}),o.jsx("span",{className:"text-[8px] text-[var(--terminal-text-muted)]",children:X.label})]},X.label))})]}),o.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[L&&o.jsxs("div",{className:"px-4 py-2 border-b border-[var(--terminal-border)] shrink-0 flex items-center gap-2",children:[o.jsx("div",{className:"w-2 h-2 rounded-full",style:{background:O}}),o.jsx("span",{className:"text-[var(--terminal-text)] font-bold text-xs",children:L.roleId.toUpperCase()}),o.jsx("span",{className:"text-[var(--terminal-text-muted)] text-xs",children:L.roleName}),o.jsx("span",{className:"ml-auto text-[10px] px-2 py-0.5 rounded-full font-semibold",style:{background:`${O}22`,color:O},children:L.status==="running"?"Working":L.status==="done"?"Complete":L.status==="error"?"Error":L.status==="waiting"?"Waiting":"Not dispatched"})]}),o.jsxs("div",{ref:C,className:"flex-1 overflow-y-auto p-4 space-y-1 text-xs font-mono",children:[L&&L.events.length===0&&o.jsx("div",{className:"text-[var(--terminal-text-muted)]",children:L.status==="waiting"?"Waiting for dispatch...":L.status==="running"?"Connecting to activity stream...":L.status==="not-dispatched"?"This role was not dispatched in this wave.":""}),L==null?void 0:L.events.map(X=>o.jsx(mg,{event:X,isThinkingCollapsed:S.has(X.seq),onToggleThinking:()=>U(X.seq),onNavigateToJob:ne=>{for(const[,D]of x)if(D.jobId===ne){g(D.roleId);return}},onOpenKnowledgeDoc:m},X.seq)),(L==null?void 0:L.status)==="running"&&o.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]}),!L&&o.jsx("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-xs",children:"Click a node in the org tree to view activity"}),o.jsxs("div",{className:"px-4 py-2 border-t border-[var(--terminal-border)] flex items-center justify-between shrink-0",children:[o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:L&&L.events.length>0&&`${L.events.length} events`}),b&&o.jsx("button",{onClick:c,className:"px-4 py-1.5 text-xs text-white rounded-lg font-semibold cursor-pointer",style:{background:"#2E7D32"},children:"Close"})]})]})]})]})]})}const pC={cto:{skinColor:"#F5CBA7",hairColor:"#2C1810",shirtColor:"#1565C0",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"short",outfitStyle:"tshirt",accessory:"glasses"},cbo:{skinColor:"#FDEBD0",hairColor:"#1A0A00",shirtColor:"#E65100",pantsColor:"#37474F",shoeColor:"#1A1A1A",hairStyle:"slicked",outfitStyle:"suit",accessory:"lapels"},pm:{skinColor:"#FDEBD0",hairColor:"#6D4C41",shirtColor:"#2E7D32",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"bun",outfitStyle:"tshirt",accessory:"blush"},engineer:{skinColor:"#F5CBA7",hairColor:"#1A1A1A",shirtColor:"#4A148C",pantsColor:"#37474F",shoeColor:"#7B1FA2",hairStyle:"messy",outfitStyle:"hoodie",accessory:"headphones"},designer:{skinColor:"#FDEBD0",hairColor:"#AD1457",shirtColor:"#AD1457",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"bob",outfitStyle:"tshirt",accessory:"beret"},qa:{skinColor:"#F5CBA7",hairColor:"#4E342E",shirtColor:"#00695C",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"short",outfitStyle:"tshirt",accessory:"badge"},"data-analyst":{skinColor:"#F5CBA7",hairColor:"#3E2723",shirtColor:"#0277BD",pantsColor:"#37474F",shoeColor:"#212121",hairStyle:"curly",outfitStyle:"vest",accessory:"none"}};function Eh(t){return pC[t]??{skinColor:"#B0BEC5",hairColor:"#78909C",shirtColor:"#607D8B",pantsColor:"#455A64",shoeColor:"#37474F"}}const xg=["#FDEBD0","#F5CBA7","#D4A07A","#C68642","#8D5524","#5C3A1E","#F3D1C7","#E8BEAC","#B07D62","#704214"],pg=["#1A0A00","#2C1810","#4E342E","#6D4C41","#8D6E63","#D4A574","#F5E6CA","#FFD700","#B71C1C","#AD1457","#4A148C","#1A237E","#004D40","#1A1A1A","#78909C","#E0E0E0"],yg=["#1565C0","#E65100","#2E7D32","#4A148C","#AD1457","#00695C","#D32F2F","#F57F17","#1B5E20","#283593","#4E342E","#37474F","#880E4F","#00838F","#6A1B9A","#FF6F00"],gg=["#37474F","#1A237E","#3E2723","#263238","#1B5E20","#455A64","#212121","#4E342E","#0D47A1","#311B92"],bg=["#212121","#1A1A1A","#37474F","#4E342E","#7B1FA2","#D32F2F","#1565C0","#F57F17","#2E7D32","#FFFFFF"],Yr={default:{name:"MIDNIGHT",icon:"🌃",vars:{"--floor-light":"#0d1117","--floor-dark":"#0a0e14","--hud-bg":"#0d1117","--hud-bg-alt":"#161b22","--pixel-border":"#30363d","--terminal-bg":"#0d1117","--terminal-border":"#21262d","--terminal-border-hover":"#388bfd","--terminal-text":"#e6edf3","--terminal-text-secondary":"#8b949e","--terminal-text-muted":"#484f58","--accent":"#388bfd","--active-green":"#3fb950","--idle-amber":"#d29922"}},light:{name:"DAYLIGHT",icon:"☀️",vars:{"--floor-light":"#f6f8fa","--floor-dark":"#eaeef2","--hud-bg":"#24292f","--hud-bg-alt":"#32383f","--pixel-border":"#d0d7de","--terminal-bg":"#ffffff","--terminal-border":"#d0d7de","--terminal-border-hover":"#0969da","--terminal-text":"#1f2328","--terminal-text-secondary":"#656d76","--terminal-text-muted":"#8c959f","--accent":"#0969da","--active-green":"#1a7f37","--idle-amber":"#9a6700"}},retro:{name:"RETRO",icon:"🎮",vars:{"--floor-light":"#1a1410","--floor-dark":"#140f0a","--hud-bg":"#1a1410","--hud-bg-alt":"#2a2018","--pixel-border":"#5c4a32","--terminal-bg":"#1a1410","--terminal-border":"#3a2e20","--terminal-border-hover":"#d4a44e","--terminal-text":"#e8d5b0","--terminal-text-secondary":"#a08860","--terminal-text-muted":"#6b5840","--accent":"#d4a44e","--active-green":"#8bba4a","--idle-amber":"#e8a030"}},cyberpunk:{name:"NEON",icon:"🌌",vars:{"--floor-light":"#0a0014","--floor-dark":"#06000e","--hud-bg":"#0a0014","--hud-bg-alt":"#14002a","--pixel-border":"#4a1a80","--terminal-bg":"#0a0014","--terminal-border":"#2a0a50","--terminal-border-hover":"#e040fb","--terminal-text":"#e0d0ff","--terminal-text-secondary":"#9070c0","--terminal-text-muted":"#5a3a80","--accent":"#e040fb","--active-green":"#00ff88","--idle-amber":"#ffab00"}},forest:{name:"FOREST",icon:"🌲",vars:{"--floor-light":"#0a1410","--floor-dark":"#060e0a","--hud-bg":"#0a1410","--hud-bg-alt":"#142a1e","--pixel-border":"#2a5a3a","--terminal-bg":"#0a1410","--terminal-border":"#1a3a26","--terminal-border-hover":"#4ade80","--terminal-text":"#d0f0d8","--terminal-text-secondary":"#70a880","--terminal-text-muted":"#3a6848","--accent":"#4ade80","--active-green":"#86efac","--idle-amber":"#fcd34d"}},ocean:{name:"OCEAN",icon:"🌊",vars:{"--floor-light":"#0a1420","--floor-dark":"#060e18","--hud-bg":"#0a1420","--hud-bg-alt":"#142a40","--pixel-border":"#1e4a6a","--terminal-bg":"#0a1420","--terminal-border":"#163050","--terminal-border-hover":"#38bdf8","--terminal-text":"#d0e8f8","--terminal-text-secondary":"#6090b0","--terminal-text-muted":"#305070","--accent":"#38bdf8","--active-green":"#34d399","--idle-amber":"#fbbf24"}}};function yC({color:t,selected:l,onClick:r}){return o.jsx("button",{onClick:r,className:"customize-swatch",style:{background:t,outline:l?"2px solid #fff":"2px solid transparent",boxShadow:l?`0 0 0 1px ${t}, 0 0 6px ${t}88`:"none"}})}function bs({label:t,presets:l,value:r,onChange:i}){return o.jsxs("div",{className:"customize-row",children:[o.jsxs("div",{className:"customize-row-header",children:[o.jsx("span",{className:"customize-row-label",children:t}),o.jsx("div",{className:"customize-row-current",style:{background:r}})]}),o.jsx("div",{className:"customize-swatches",children:l.map(c=>o.jsx(yC,{color:c,selected:c===r,onClick:()=>i(c)},c))})]})}function Sd({label:t,items:l,value:r,onChange:i,lockInfo:c}){return o.jsxs("div",{className:"customize-row",children:[o.jsx("div",{className:"customize-row-header",children:o.jsx("span",{className:"customize-row-label",children:t})}),o.jsx("div",{className:"customize-swatches",style:{gap:4},children:l.map(u=>{const f=c?c.getLockLevel(u.id):1,m=u.id===r,x=c?f>c.roleLevel&&!m:!1,d=c?m&&f>c.roleLevel:!1;return o.jsxs("button",{onClick:()=>{x||i(u.id===r?void 0:u.id)},className:"customize-swatch",style:{width:"auto",height:"auto",padding:x?"2px 6px 10px 6px":"2px 6px",fontSize:9,fontFamily:"var(--font-pixel, monospace)",background:m?"rgba(255,255,255,0.15)":x?"rgba(255,255,255,0.02)":"rgba(255,255,255,0.04)",outline:m?d?"2px solid #F59E0B":"2px solid #fff":"2px solid transparent",color:x?"rgba(255,255,255,0.25)":m?"#fff":"rgba(255,255,255,0.5)",borderRadius:4,cursor:x?"not-allowed":"pointer",opacity:x?.35:1,position:"relative"},children:[u.name,x&&o.jsxs("span",{style:{position:"absolute",bottom:1,left:"50%",transform:"translateX(-50%)",fontSize:8,color:"rgba(255,255,255,0.5)",whiteSpace:"nowrap"},children:["🔒"," Lv.",f]}),d&&o.jsxs("span",{style:{position:"absolute",bottom:-8,left:"50%",transform:"translateX(-50%)",fontSize:7,color:"#F59E0B",whiteSpace:"nowrap"},children:["⚠"," Lv.",f]})]},u.id)})})]})}function jd({label:t,active:l,onClick:r}){return o.jsx("button",{onClick:r,style:{flex:1,padding:"6px 0",fontSize:10,fontFamily:"var(--font-pixel, monospace)",fontWeight:"bold",letterSpacing:1,background:l?"rgba(255,255,255,0.08)":"transparent",color:l?"#fff":"rgba(255,255,255,0.35)",border:"none",borderBottom:l?"2px solid #3B82F6":"2px solid transparent",cursor:"pointer",transition:"all 0.15s"},children:t})}function Lr(t){return t[Math.floor(Math.random()*t.length)]}function js(t){var c,u,f;const l=ng(),r=lg(),i=rg().filter(m=>!t||ig(m.id,t));return{skinColor:Lr(xg),hairColor:Lr(pg),shirtColor:Lr(yg),pantsColor:Lr(gg),shoeColor:Lr(bg),hairStyle:(c=Lr(l))==null?void 0:c.id,outfitStyle:(u=Lr(r))==null?void 0:u.id,accessory:(f=Lr(i))==null?void 0:f.id}}function vg({roleId:t,appearance:l,onChange:r,onRandomize:i,onReset:c,label:u,roleLevel:f}){const[m,x]=k.useState("look"),d=k.useCallback((E,C)=>{r({...l,[E]:C})},[l,r]),g=k.useRef(null),y=k.useCallback(E=>{var M;const C=(M=E.target.files)==null?void 0:M[0];if(!C)return;const A=new Image;A.onload=()=>{const R=HS(A);r({...R,hairStyle:l.hairStyle,outfitStyle:l.outfitStyle,accessory:l.accessory}),URL.revokeObjectURL(A.src)},A.src=URL.createObjectURL(C),E.target.value=""},[l.hairStyle,l.outfitStyle,l.accessory,r]),b=ng(),v=lg(),j=rg(),S=f!==void 0?j.filter(E=>ig(E.id,f)).length:j.length;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"customize-preview",children:[o.jsx("div",{className:"customize-preview-bg",children:o.jsx(Ic,{roleId:t,appearance:l,scale:12})}),u&&o.jsx("div",{className:"customize-preview-name",children:u}),o.jsxs("div",{className:"customize-preview-actions",children:[o.jsx("button",{className:"customize-btn customize-btn--random",onClick:i,children:"RANDOM"}),o.jsx("button",{className:"customize-btn customize-btn--reset",onClick:c,children:"RESET"}),o.jsx("button",{className:"customize-btn",onClick:()=>{var E;return(E=g.current)==null?void 0:E.click()},style:{fontSize:9,opacity:.7},children:"PHOTO"}),o.jsx("input",{ref:g,type:"file",accept:"image/*",onChange:y,style:{display:"none"}})]})]}),o.jsxs("div",{className:"customize-colors",children:[o.jsxs("div",{style:{display:"flex",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:[o.jsx(jd,{label:"LOOK",active:m==="look",onClick:()=>x("look")}),o.jsx(jd,{label:"OUTFIT",active:m==="outfit",onClick:()=>x("outfit")}),o.jsx(jd,{label:"ACCESSORY",active:m==="accessory",onClick:()=>x("accessory")})]}),m==="look"&&o.jsxs(o.Fragment,{children:[o.jsx(bs,{label:"SKIN",presets:xg,value:l.skinColor,onChange:E=>d("skinColor",E)}),o.jsx(bs,{label:"HAIR COLOR",presets:pg,value:l.hairColor,onChange:E=>d("hairColor",E)}),o.jsx(Sd,{label:"HAIR STYLE",items:b,value:l.hairStyle,onChange:E=>d("hairStyle",E)})]}),m==="outfit"&&o.jsxs(o.Fragment,{children:[o.jsx(Sd,{label:"STYLE",items:v,value:l.outfitStyle,onChange:E=>d("outfitStyle",E)}),o.jsx(bs,{label:"TOP",presets:yg,value:l.shirtColor,onChange:E=>d("shirtColor",E)}),o.jsx(bs,{label:"PANTS",presets:gg,value:l.pantsColor,onChange:E=>d("pantsColor",E)}),o.jsx(bs,{label:"SHOES",presets:bg,value:l.shoeColor,onChange:E=>d("shoeColor",E)})]}),m==="accessory"&&o.jsxs(o.Fragment,{children:[f!==void 0&&o.jsxs("div",{style:{padding:"4px 8px",marginBottom:4,background:"rgba(255,255,255,0.04)",borderRadius:4,fontSize:9,fontFamily:"var(--font-pixel, monospace)",color:"rgba(255,255,255,0.5)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o.jsxs("span",{children:["Lv.",f]}),o.jsxs("span",{children:[S,"/",j.length," unlocked"]})]}),o.jsx(Sd,{label:"ACCESSORY",items:j,value:l.accessory,onChange:E=>d("accessory",E),lockInfo:f!==void 0?{roleLevel:f,getLockLevel:ag}:void 0}),o.jsx("div",{style:{marginTop:12,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:6,border:"1px dashed rgba(255,255,255,0.08)",color:"rgba(255,255,255,0.25)",fontSize:9,fontFamily:"var(--font-pixel, monospace)",textAlign:"center"},children:f!==void 0&&f<10?"Level up to unlock more accessories":"More accessories coming soon"})]})]})]})}const gC=[{value:"c-level",label:"C-Level"},{value:"team-lead",label:"Team Lead"},{value:"member",label:"Member"}];function wg(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,24)}function k0(t){switch(t){case"c-level":return{authority:{autonomous:["Strategic decisions within domain","Task delegation to reports"],needsApproval:["Budget over $5K","External commitments"]},knowledge:{reads:["company/","operations/","projects/"],writes:["operations/","knowledge/"]},reports:{daily:"standup",weekly:"summary"}};case"team-lead":return{authority:{autonomous:["Task planning","Sprint management"],needsApproval:["Architecture changes","New tool adoption"]},knowledge:{reads:["projects/","architecture/"],writes:["projects/"]},reports:{daily:"standup",weekly:"summary"}};default:return{authority:{autonomous:["Implementation within assigned tasks"],needsApproval:["Design changes","New dependencies"]},knowledge:{reads:["projects/"],writes:[]},reports:{daily:"standup",weekly:""}}}}const vs=4;function bC(t,l,r){const i=t.trim();if(!i||i.startsWith("#"))return null;const c=i.split(",").map(y=>y.trim()),u=c[0];if(!u)return null;const f=wg(u),m=(c[1]||"member").toLowerCase(),x=m==="c-level"?"c-level":m==="team-lead"?"team-lead":"member",d=c[2]||"ceo";let g;return l.has(f)?g="ID already exists":r.has(f)&&(g="Duplicate ID in batch"),r.add(f),{name:u,id:f,level:x,reportsTo:d,error:g}}function vC({existingRoles:t,onClose:l,onHire:r}){const[i,c]=k.useState("single"),[u,f]=k.useState(1),[m,x]=k.useState(""),[d,g]=k.useState(""),[y,b]=k.useState(!1),[v,j]=k.useState("member"),[S,E]=k.useState("ceo"),[C,A]=k.useState(""),[M,R]=k.useState(js),[L,O]=k.useState(!1),[U,X]=k.useState(""),[ne,D]=k.useState([]),[Y,F]=k.useState(new Set),[Q,ee]=k.useState(""),[V,I]=k.useState("input"),[Z,ce]=k.useState({done:0,total:0}),we=k.useRef(null),z=k.useRef(null),B=k.useRef(null);k.useEffect(()=>{Ce.getSkills().then(G=>D(G.filter(ie=>ie.installed))).catch(()=>{})},[]),k.useEffect(()=>{var G,ie,xe;i==="single"?(u===1&&((G=we.current)==null||G.focus()),u===2&&((ie=z.current)==null||ie.focus())):V==="input"&&((xe=B.current)==null||xe.focus())},[u,i,V]);const W=k.useMemo(()=>new Set(t.map(G=>G.id)),[t]),T=k.useMemo(()=>{const G=Q.split(`
|
|
82
|
+
`),ie=new Set;return G.map(xe=>bC(xe,W,ie)).filter(xe=>xe!==null)},[Q,W]),me=T.length>0&&T.every(G=>!G.error),Se=G=>{x(G),y||g(wg(G))},Ee=m.trim().length>0&&d.trim().length>0&&!t.some(G=>G.id===d),Oe=C.trim().length>0,He=async()=>{O(!0),X("");const G=k0(v);try{await r({id:d,name:m.trim(),level:v,reportsTo:S,persona:C.trim(),...G,skills:Y.size>0?[...Y]:void 0},M),l()}catch(ie){X(ie instanceof Error?ie.message:"Failed to create role"),O(!1)}},Ge=G=>G===1?Ee:G===2?Oe:!0,ke=async()=>{O(!0),X(""),ce({done:0,total:T.length});try{for(let G=0;G<T.length;G++){const ie=T[G],xe=k0(ie.level),Te=js(),Ne=`${ie.name}. A ${ie.level} role reporting to ${ie.reportsTo}.`;await r({id:ie.id,name:ie.name,level:ie.level,reportsTo:ie.reportsTo,persona:Ne,...xe},Te),ce({done:G+1,total:T.length})}l()}catch(G){X(G instanceof Error?G.message:"Failed to create roles"),O(!1)}},xt=G=>{G.key==="Escape"&&l(),G.key==="Enter"&&(G.metaKey||G.ctrlKey)&&(i==="single"?u<vs&&Ge(u)?f(u+1):u===vs&&He():V==="input"&&me?I("review"):V==="review"&&ke())},he=t.some(G=>G.id===d)&&d.length>0;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:l}),o.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[560px] max-h-[90vh] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden flex flex-col",onKeyDown:xt,children:[o.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #2E7D32, #43A047)"},children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"text-lg font-bold",children:"Hire New Role"}),o.jsxs("div",{className:"flex bg-black/20 rounded-lg p-0.5",children:[o.jsx("button",{onClick:()=>{c("single"),X("")},className:`px-3 py-1 text-xs font-semibold rounded-md cursor-pointer transition-colors ${i==="single"?"bg-white/20 text-white":"text-white/50 hover:text-white/70"}`,children:"Single"}),o.jsx("button",{onClick:()=>{c("bulk"),X("")},className:`px-3 py-1 text-xs font-semibold rounded-md cursor-pointer transition-colors ${i==="bulk"?"bg-white/20 text-white":"text-white/50 hover:text-white/70"}`,children:"Bulk"})]})]}),o.jsx("div",{className:"text-sm opacity-80 mt-0.5",children:i==="single"?`Step ${u} of ${vs}`:V==="input"?"Enter roles, one per line":`Review ${T.length} roles`})]}),i==="single"&&o.jsx("div",{className:"flex gap-1 px-5 pt-4",children:Array.from({length:vs},(G,ie)=>ie+1).map(G=>o.jsx("div",{className:"flex-1 h-1 rounded-full transition-colors",style:{background:G<=u?"#2E7D32":"rgba(255,255,255,0.1)"}},G))}),o.jsx("div",{className:"p-5 min-h-[240px] overflow-y-auto flex-1",children:i==="single"?o.jsxs(o.Fragment,{children:[u===1&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role Name"}),o.jsx("input",{ref:we,value:m,onChange:G=>Se(G.target.value),placeholder:"e.g. Data Analyst",className:"w-full p-2.5 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 focus:outline-none focus:border-white/25 transition-colors"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Role ID (slug)"}),o.jsx("input",{value:d,onChange:G=>{g(G.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),b(!0)},className:`w-full p-2.5 rounded-lg border bg-white/5 text-sm text-white/90 font-mono focus:outline-none transition-colors ${he?"border-red-400":"border-white/10 focus:border-white/25"}`}),he&&o.jsx("div",{className:"text-xs text-red-500 mt-1",children:"ID already exists"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Level"}),o.jsx("div",{className:"flex gap-2",children:gC.map(G=>o.jsx("button",{onClick:()=>j(G.value),className:`flex-1 p-2 text-xs font-semibold rounded-lg border cursor-pointer transition-colors ${v===G.value?"border-green-600 bg-green-900/30 text-green-400":"border-white/10 text-white/50 hover:border-white/20"}`,children:G.label},G.value))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-1",children:"Reports To"}),o.jsxs("select",{value:S,onChange:G=>E(G.target.value),className:"w-full p-2.5 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 focus:outline-none focus:border-white/25 transition-colors",children:[o.jsx("option",{value:"ceo",className:"bg-[var(--wall)] text-white",children:"CEO"}),t.map(G=>o.jsxs("option",{value:G.id,className:"bg-[var(--wall)] text-white",children:[G.name," (",G.id,")"]},G.id))]})]})]}),u===2&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Persona"}),o.jsx("textarea",{ref:z,value:C,onChange:G=>A(G.target.value),placeholder:"Describe this role's personality, expertise, and working style...",className:"w-full h-32 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors"}),o.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"This defines how the AI agent will behave in this role"})]}),ne.length>0&&o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Skills"}),o.jsx("div",{className:"space-y-1.5 max-h-[120px] overflow-y-auto",children:ne.map(G=>o.jsxs("label",{className:"flex items-center gap-2 p-2 rounded-lg border border-white/10 bg-white/5 cursor-pointer hover:border-white/20 transition-colors",children:[o.jsx("input",{type:"checkbox",checked:Y.has(G.id),onChange:()=>F(ie=>{const xe=new Set(ie);return xe.has(G.id)?xe.delete(G.id):xe.add(G.id),xe}),className:"accent-green-600"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-xs font-semibold text-white/80",children:G.name}),o.jsx("div",{className:"text-[10px] text-white/40 truncate",children:G.description})]})]},G.id))})]})]}),u===3&&o.jsx("div",{className:"customize-body",style:{padding:0},children:o.jsx(vg,{roleId:"default",appearance:M,onChange:R,onRandomize:()=>R(js()),onReset:()=>R(js()),label:o.jsxs("span",{children:[d||"new-role"," — ",m||"New Role"]})})}),u===4&&o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Review"}),o.jsxs("div",{className:"bg-white/5 rounded-xl p-4 border border-white/10",children:[o.jsxs("div",{className:"flex gap-4",children:[o.jsx("div",{className:"flex-shrink-0 rounded-lg overflow-hidden",style:{background:"#0d1117",padding:8},children:o.jsx(Ic,{roleId:"default",appearance:M,scale:4})}),o.jsxs("div",{className:"flex-1 space-y-2.5",children:[o.jsx(ws,{label:"Name",value:m}),o.jsx(ws,{label:"ID",value:d,mono:!0}),o.jsx(ws,{label:"Level",value:v}),o.jsx(ws,{label:"Reports To",value:S}),Y.size>0&&o.jsx(ws,{label:"Skills",value:[...Y].join(", ")})]})]}),o.jsxs("div",{className:"pt-3 mt-3 border-t border-white/10",children:[o.jsx("div",{className:"text-[10px] text-white/30 uppercase tracking-wider mb-1",children:"Persona"}),o.jsx("div",{className:"text-xs text-white/60 leading-relaxed",children:C})]})]}),U&&o.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:U})]})]}):o.jsxs(o.Fragment,{children:[V==="input"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:"Roles (one per line)"}),o.jsx("textarea",{ref:B,value:Q,onChange:G=>ee(G.target.value),placeholder:`Name, Level, ReportsTo
|
|
83
83
|
e.g.
|
|
84
84
|
Data Analyst
|
|
85
85
|
DevOps Engineer, member, cto
|
|
86
|
-
VP Marketing, c-level, ceo`,className:"w-full h-40 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors font-mono"}),o.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Format: Name, Level (member/team-lead/c-level), ReportsTo. Level and ReportsTo are optional."})]}),T.length>0&&o.jsxs("div",{children:[o.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Preview (",T.length," role",T.length!==1?"s":"",")"]}),o.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden",children:o.jsxs("table",{className:"w-full text-xs",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"border-b border-white/10",children:[o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),o.jsx("tbody",{children:T.map((G,ie)=>o.jsxs("tr",{className:`border-b border-white/5 ${G.error?"bg-red-900/10":""}`,children:[o.jsx("td",{className:"p-2 text-white/80",children:G.name}),o.jsx("td",{className:"p-2 text-white/60 font-mono",children:G.id}),o.jsx("td",{className:"p-2 text-white/60",children:G.level}),o.jsx("td",{className:"p-2 text-white/60",children:G.reportsTo}),G.error&&o.jsx("td",{className:"p-2 text-red-400 text-[10px]",children:G.error})]},ie))})]})})]})]}),V==="review"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Confirm Bulk Hire — ",T.length," roles"]}),o.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden max-h-[300px] overflow-y-auto",children:o.jsxs("table",{className:"w-full text-xs",children:[o.jsx("thead",{className:"sticky top-0 bg-[var(--wall)]",children:o.jsxs("tr",{className:"border-b border-white/10",children:[o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"#"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),o.jsx("tbody",{children:T.map((G,ie)=>o.jsxs("tr",{className:"border-b border-white/5",children:[o.jsx("td",{className:"p-2 text-white/30",children:ie+1}),o.jsx("td",{className:"p-2 text-white/80",children:G.name}),o.jsx("td",{className:"p-2 text-white/60 font-mono",children:G.id}),o.jsx("td",{className:"p-2 text-white/60",children:G.level}),o.jsx("td",{className:"p-2 text-white/60",children:G.reportsTo})]},ie))})]})}),L&&Z.total>0&&o.jsxs("div",{children:[o.jsxs("div",{className:"flex justify-between text-[10px] text-white/40 mb-1",children:[o.jsx("span",{children:"Hiring..."}),o.jsxs("span",{children:[Z.done,"/",Z.total]})]}),o.jsx("div",{className:"h-1.5 bg-white/10 rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Z.done/Z.total*100}%`,background:"#2E7D32"}})})]}),o.jsx("div",{className:"text-[10px] text-white/30",children:"Each role will get a random appearance and auto-generated persona. You can customize them later."}),U&&o.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:U})]})]})}),o.jsxs("div",{className:"flex justify-between px-5 pb-5",children:[o.jsxs("div",{children:[i==="single"&&u>1&&o.jsx("button",{onClick:()=>f(u-1),className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Back"}),i==="bulk"&&V==="review"&&o.jsx("button",{onClick:()=>I("input"),disabled:L,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer disabled:opacity-40",children:"Back"})]}),o.jsxs("div",{className:"flex gap-3",children:[o.jsx("button",{onClick:l,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),i==="single"?u<vs?o.jsx("button",{onClick:()=>f(u+1),disabled:!
|
|
87
|
-
`)?o.jsx(EC,{language:i==null?void 0:i[1],children:l}):o.jsx("code",{className:"terminal-inline-code",...r,children:l})}function EC({children:t,language:l}){const[r,i]=k.useState(!1),c=String(t).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(c),i(!0),setTimeout(()=>i(!1),1500)};return o.jsxs("div",{className:"terminal-code-block group relative my-2",children:[l&&o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] px-3 pt-1.5",children:l}),o.jsx("button",{onClick:u,className:"absolute top-1.5 right-2 text-[10px] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:r?"Copied!":"Copy"}),o.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:o.jsx("code",{children:c})})]})}const NC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function Cd(t,l){return l?l.file_path?String(l.file_path).replace(/^.*\/(?=[^/]+\/)/,""):l.path?String(l.path).replace(/^.*\/(?=[^/]+\/)/,""):l.pattern?String(l.pattern):l.command?String(l.command).slice(0,60):l.query?String(l.query).slice(0,60):l.url?String(l.url).slice(0,60):"":""}function AC(t){const l=[];let r="";for(const i of t)if(i.type==="thinking")i.text&&(r=i.text),l.length===0||l[l.length-1].type!=="thinking"?l.push({type:"thinking",text:i.text}):l[l.length-1].text=i.text;else if(i.type==="tool")l.push({type:"tool",toolName:i.toolName,toolSummary:Cd(i.toolName??"",i.toolInput),toolInput:i.toolInput});else if(i.type==="dispatch")l.push({type:"dispatch",roleId:i.roleId,task:i.task});else if(i.type==="dispatch:progress"){const c=l.length>0?l[l.length-1]:null;(c==null?void 0:c.type)==="dispatch:progress"&&c.roleId===i.roleId?i.progressType==="tool"?(c.toolName=i.toolName,c.toolSummary=Cd(i.toolName??"",i.toolInput),c.progressType="tool"):i.progressType==="thinking"?(c.text=i.text,c.progressType="thinking"):i.progressType==="text"?(c.text=i.text,c.progressType="text"):(i.progressType==="done"||i.progressType==="error")&&(c.progressType=i.progressType):l.push({type:"dispatch:progress",roleId:i.roleId,progressType:i.progressType,text:i.text,toolName:i.toolName,toolSummary:i.toolName?Cd(i.toolName,i.toolInput):void 0})}if(r){const i=l.filter(c=>c.type==="thinking");i.length>0&&(i[i.length-1].text=r)}return l}function TC({event:t,isStreaming:l}){var c,u,f;const[r,i]=k.useState(!1);switch(t.type){case"thinking":return o.jsxs("div",{className:"stream-event-thinking",children:[o.jsxs("div",{className:"stream-event-thinking-header",onClick:()=>i(!r),children:[o.jsx("span",{className:"stream-event-thinking-icon"}),o.jsxs("span",{className:"stream-event-thinking-label",children:["thinking",l?"...":""]}),t.text&&!l&&o.jsx("span",{className:"stream-event-thinking-toggle",children:r?"▾":"▸"})]}),(l||r)&&t.text&&o.jsx("div",{className:"stream-event-thinking-content",children:t.text.slice(-500)})]});case"tool":return o.jsxs("div",{className:"stream-event-tool",children:[o.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&o.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary}),t.toolInput&&o.jsx("span",{className:"stream-event-tool-toggle",onClick:()=>i(!r),children:r?"▾":"▸"}),r&&t.toolInput&&o.jsx("div",{className:"stream-event-tool-detail",children:JSON.stringify(t.toolInput,null,1).slice(0,300)})]});case"dispatch":return o.jsxs("div",{className:"stream-event-dispatch",children:[o.jsxs("span",{className:"stream-event-dispatch-badge",children:["→"," ",(c=t.roleId)==null?void 0:c.toUpperCase()]}),o.jsx("span",{className:"stream-event-dispatch-task",children:(u=t.task)==null?void 0:u.slice(0,80)})]});case"dispatch:progress":return o.jsxs("div",{className:"stream-event-dispatch-progress",children:[o.jsx("span",{className:"stream-event-dispatch-progress-role",children:(f=t.roleId)==null?void 0:f.toUpperCase()}),t.progressType==="thinking"&&o.jsxs("span",{className:"stream-event-dispatch-progress-status",children:["thinking",l?"...":""]}),t.progressType==="tool"&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&o.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary})]}),t.progressType==="text"&&t.text&&o.jsx("span",{className:"stream-event-dispatch-progress-status",children:"responding..."}),t.progressType==="done"&&o.jsx("span",{className:"stream-event-dispatch-progress-done",children:"done"}),t.progressType==="error"&&o.jsx("span",{className:"stream-event-dispatch-progress-error",children:"error"})]});default:return null}}function DC({events:t,isStreaming:l}){const[r,i]=k.useState(!1);if(t.length===0)return null;const c=AC(t);if(c.length===0)return null;const u=t.filter(b=>b.type==="thinking").length,f=t.filter(b=>b.type==="tool"),m=t.filter(b=>b.type==="dispatch"||b.type==="dispatch:progress"),x=t.filter(b=>b.type==="turn").reduce((b,v)=>Math.max(b,v.turn??0),0),d=[];if(u>0&&d.push("thinking"),f.length>0){const b=[...new Set(f.map(v=>v.toolName))];b.length<=3?d.push(b.join(", ")):d.push(`${f.length} tool calls`)}m.length>0&&d.push(`${m.length} dispatch`),x>1&&d.push(`${x} turns`);const g=d.join(" · "),y=!r;return o.jsxs("div",{className:"stream-activity-log",children:[o.jsxs("div",{className:"stream-activity-header",onClick:()=>i(!r),children:[l&&o.jsx("span",{className:"stream-activity-pulse"}),o.jsxs("span",{className:"stream-activity-summary",children:[r?"▸":"▾"," ",g,l?"...":""]})]}),y&&o.jsx("div",{className:"stream-activity-events",children:c.map((b,v)=>o.jsx(TC,{event:b,isStreaming:l&&v===c.length-1},v))})]})}function zC({message:t,roleId:l,roleColor:r}){var d;const i=t.from==="ceo",c=t.type==="system",u=t.status==="streaming";if(c)return o.jsx("div",{className:"flex justify-center my-2",children:o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] bg-[var(--terminal-inline-bg)] px-3 py-1 rounded-full",children:t.content})});if(i)return o.jsx("div",{className:"flex justify-end mb-3",children:o.jsxs("div",{className:"max-w-[85%]",children:[o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] text-right mb-1",children:"CEO"}),o.jsxs("div",{className:"bg-[var(--terminal-surface-light)] rounded-xl rounded-tr-sm px-4 py-2.5 text-sm text-[var(--terminal-text)] leading-relaxed",children:[t.type==="directive"&&o.jsx("span",{className:"text-amber-400 text-[10px] font-bold mr-1.5",children:"DO"}),t.content]})]})});const f=(((d=t.streamEvents)==null?void 0:d.length)??0)>0,m=!!t.thinking,x=m&&!t.content&&u&&!f;return o.jsxs("div",{className:"flex gap-2.5 mb-3",children:[o.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center text-sm shrink-0 mt-5",style:{background:`${r}33`},children:NC[l]??"👤"}),o.jsxs("div",{className:"max-w-[85%] min-w-0",children:[o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] mb-1",children:l.toUpperCase()}),f&&o.jsx(DC,{events:t.streamEvents,isStreaming:u}),m&&!f&&o.jsxs("details",{open:x,className:"mb-1",children:[o.jsxs("summary",{className:"text-[10px] text-purple-400/70 cursor-pointer select-none flex items-center gap-1",children:[x&&o.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-purple-400 animate-pulse"}),"thinking",x?"...":` (${t.thinking.length} chars)`]}),o.jsx("div",{className:"text-[11px] text-[var(--terminal-text-muted)] leading-relaxed mt-1 pl-2 border-l border-purple-400/20 max-h-32 overflow-y-auto",children:t.thinking.slice(-500)})]}),o.jsxs("div",{className:"rounded-xl rounded-tl-sm px-4 py-2.5 text-sm text-[var(--terminal-text)] leading-relaxed",style:{borderLeft:`3px solid ${r}`,background:"var(--terminal-surface)"},children:[t.content?o.jsx(jC,{content:t.content,streaming:u}):u&&!m?o.jsx("span",{className:"inline-block w-2 h-4 bg-[var(--terminal-text-secondary)] animate-pulse"}):u&&m?o.jsx("span",{className:"text-[11px] text-purple-400/50 italic",children:"analyzing..."}):null,u&&t.content&&o.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-[var(--terminal-text-secondary)] animate-pulse ml-0.5 align-middle"})]}),t.status==="error"&&o.jsx("div",{className:"text-[10px] text-red-400 mt-1",children:"Error occurred"})]})]})}function MC({messages:t,roleId:l,roleColor:r}){var c;const i=k.useRef(null);return k.useEffect(()=>{var u;(u=i.current)==null||u.scrollIntoView({behavior:"smooth"})},[t,(c=t[t.length-1])==null?void 0:c.content]),t.length===0?o.jsxs("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:["Start a conversation with ",l.toUpperCase()]}):o.jsxs("div",{className:"flex-1 overflow-y-auto p-4 terminal-scrollbar",children:[t.map(u=>o.jsx(zC,{message:u,roleId:l,roleColor:r},u.id)),o.jsx("div",{ref:i})]})}function FC({mode:t,onModeChange:l,onSend:r,disabled:i,disabledReason:c}){const[u,f]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{const g=m.current;g&&(g.style.height="0",g.style.height=Math.min(g.scrollHeight,120)+"px")},[u]);const x=()=>{const g=u.trim();!g||i||(r(g),f(""))},d=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),x())};return o.jsxs("div",{className:"border-t border-[var(--terminal-border)] p-3 shrink-0",children:[c&&o.jsx("div",{className:"text-[10px] text-amber-400/70 mb-2 text-center",children:c}),o.jsxs("div",{className:"flex items-end gap-2",children:[o.jsxs("div",{className:"flex rounded-lg overflow-hidden border border-[var(--terminal-border)] shrink-0",children:[o.jsx("button",{onClick:()=>l("talk"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${t==="talk"?"bg-[var(--desk-wood)] text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Talk"}),o.jsx("button",{onClick:()=>l("do"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${t==="do"?"bg-amber-700 text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Do"})]}),o.jsx("textarea",{ref:m,value:u,onChange:g=>f(g.target.value),onKeyDown:d,placeholder:i?"Waiting...":t==="talk"?"Ask something...":"Give a directive...",disabled:i,rows:1,className:"flex-1 bg-[var(--terminal-inline-bg)] border border-[var(--terminal-border)] rounded-lg px-3 py-2 text-sm text-[var(--terminal-text)] placeholder:text-[var(--terminal-text-muted)] resize-none focus:outline-none focus:border-[var(--terminal-border-hover)] disabled:opacity-40 terminal-scrollbar"}),o.jsx("button",{onClick:x,disabled:i||!u.trim(),className:"w-8 h-8 rounded-lg bg-[var(--terminal-surface-light)] text-[var(--terminal-text-secondary)] flex items-center justify-center shrink-0 cursor-pointer hover:bg-[var(--desk-wood)] hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M22 2L11 13"}),o.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})]})}const RC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},kg={cto:"CTO",cbo:"CBO",pm:"PM",engineer:"Engineer",designer:"Designer",qa:"QA","data-analyst":"Data Analyst"};function S0(t){return new Date(t).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit"})}function _C({msg:t}){const l=RC[t.roleId]??"#888",r=kg[t.roleId]??t.roleId;if(t.type==="dispatch"){const i=t.text.includes("WAVE"),c=t.text.includes("completed")||t.text.includes("완료"),u=i?"📡":c?"✓":"→",f=c?"text-green-400/70":"text-[var(--terminal-text-muted)]";return o.jsxs("div",{className:"flex items-start gap-2 px-3 py-1 hover:bg-white/[0.02]",children:[o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:S0(t.ts)}),o.jsx("span",{className:"text-[10px] shrink-0 mt-0.5",children:u}),o.jsx("span",{className:`text-[11px] ${f}`,children:t.text})]})}return o.jsxs("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-white/[0.02]",children:[o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:S0(t.ts)}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-[11px] font-semibold mr-1.5",style:{color:l},children:r}),o.jsx("span",{className:"text-xs text-[var(--terminal-text-secondary)]",children:t.text})]})]})}function OC({channel:t,allRoles:l,onUpdateMembers:r,onUpdateTopic:i}){const c=k.useRef(null),u=k.useRef(null);k.useEffect(()=>{var j;const b=u.current;if(!b)return;b.scrollHeight-b.scrollTop-b.clientHeight<80&&((j=c.current)==null||j.scrollIntoView({behavior:"smooth"}))},[t.messages.length]);const[f,m]=k.useState(!1),[x,d]=k.useState(!1),[g,y]=k.useState("");return o.jsxs("div",{ref:u,className:"flex-1 overflow-y-auto terminal-scrollbar py-2",children:[o.jsxs("div",{className:"px-3 py-2 mb-2 border-b border-[var(--terminal-border)] flex items-center gap-2",children:[o.jsx("span",{className:"text-sm font-semibold text-[var(--terminal-text)]",children:t.name}),t.members.length>0&&o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.members.map(b=>kg[b]??b).join(", ")}),t.members.length===0&&o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.isDefault?"system logs":"no members"}),!t.isDefault&&l&&r&&o.jsx("button",{className:"ml-auto text-[10px] px-2 py-0.5 rounded bg-white/5 hover:bg-white/10 text-[var(--terminal-text-muted)]",onClick:()=>m(!f),children:f?"Done":"Invite"})]}),!t.isDefault&&i&&o.jsx("div",{className:"px-3 pb-2 mb-1",children:x?o.jsx("input",{autoFocus:!0,value:g,onChange:b=>y(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(i(t.id,g.trim()),d(!1)),b.key==="Escape"&&d(!1)},onBlur:()=>{i(t.id,g.trim()),d(!1)},placeholder:"Set a topic for this channel...",className:"w-full bg-transparent text-[10px] text-[var(--terminal-text-muted)] outline-none border-b border-[var(--terminal-border)] pb-0.5"}):o.jsx("button",{onClick:()=>{y(t.topic??""),d(!0)},className:"text-[10px] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] cursor-pointer italic",children:t.topic||"Click to set channel topic..."})}),f&&!t.isDefault&&l&&r&&o.jsx("div",{className:"px-3 pb-2 mb-2 border-b border-[var(--terminal-border)]",children:o.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(b=>{const v=t.members.includes(b.id);return o.jsxs("button",{className:`text-[10px] px-2 py-1 rounded ${v?"bg-white/15 text-[var(--terminal-text)]":"bg-white/5 text-[var(--terminal-text-muted)]"}`,onClick:()=>{const j=v?t.members.filter(S=>S!==b.id):[...t.members,b.id];r(t.id,j)},children:[v?"✓ ":"",b.name]},b.id)})})}),t.messages.length===0&&o.jsx("div",{className:"flex-1 flex flex-col items-center justify-center text-[var(--terminal-text-muted)] text-xs gap-1 py-8",children:o.jsx("span",{children:t.isDefault?"No dispatch events yet":"No messages yet — invite roles to start chatting"})}),t.messages.map(b=>o.jsx(_C,{msg:b},b.id)),o.jsx("div",{ref:c})]})}const Ed={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},BC=400,LC=800;function $C({sessions:t,activeSessionId:l,roles:r,streamingSessionId:i,width:c,onWidthChange:u,onSwitchSession:f,onCloseSession:m,onCreateSession:x,onClearEmpty:d,onCloseAll:g,onSendMessage:y,onModeChange:b,onCloseTerminal:v,chatChannels:j,activeChatChannelId:S,onSwitchChatChannel:E,onCreateChatChannel:C,onDeleteChatChannel:A,onUpdateChatMembers:M,onUpdateChatTopic:F,unreadChannels:L}){const[O,U]=k.useState(!1),[X,ne]=k.useState(!1),[D,Y]=k.useState(!1),[R,Q]=k.useState(""),ee=S!=null,V=j==null?void 0:j.find(ke=>ke.id===S),[I,Z]=k.useState(!1),[ce,we]=k.useState(!1),[z,B]=k.useState(!1),W=k.useRef(0),T=k.useRef(0),me=k.useRef(null),Se=t.find(ke=>ke.id===l),Ee=i===l,Be=t.filter(ke=>ke.messages.length===0).length,He=k.useCallback(()=>{const ke=me.current;ke&&(we(ke.scrollLeft>0),B(ke.scrollLeft+ke.clientWidth<ke.scrollWidth-1))},[]);k.useEffect(()=>{if(!l||!me.current)return;const ke=me.current.querySelector(`[data-session-id="${l}"]`);ke&&ke.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),He()},[l,t.length,He]),k.useEffect(()=>{const ke=me.current;if(!ke)return;He(),ke.addEventListener("scroll",He);const yt=new ResizeObserver(He);return yt.observe(ke),()=>{ke.removeEventListener("scroll",He),yt.disconnect()}},[He]);const Qe=k.useCallback(ke=>{ke.preventDefault(),W.current=ke.clientX,T.current=c,Z(!0);const yt=G=>{const ie=W.current-G.clientX,xe=Math.min(LC,Math.max(BC,T.current+ie));u==null||u(xe)},he=()=>{Z(!1),document.removeEventListener("mousemove",yt),document.removeEventListener("mouseup",he)};document.addEventListener("mousemove",yt),document.addEventListener("mouseup",he)},[c,u]);return o.jsxs("div",{className:"shrink-0 bg-[var(--terminal-bg)] border-l border-[var(--terminal-border)] flex flex-col h-full relative",style:{width:c},children:[u&&o.jsx("div",{className:`terminal-resize-handle absolute top-0 left-0 w-1 h-full cursor-col-resize z-10 transition-colors ${I?"bg-[var(--terminal-border-hover)]":"bg-transparent"}`,onMouseDown:Qe}),o.jsxs("div",{className:"flex items-center bg-[var(--terminal-bg-deeper)] border-b border-[var(--terminal-border)] shrink-0",children:[o.jsxs("div",{className:"relative flex-1 min-w-0",children:[ce&&o.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-6 bg-gradient-to-r from-[var(--terminal-bg-deeper)] to-transparent z-10 pointer-events-none"}),o.jsxs("div",{ref:me,className:"flex items-center overflow-x-auto terminal-tab-scroll gap-px px-1 py-1",children:[j==null?void 0:j.map(ke=>o.jsxs("button",{onClick:()=>{E==null||E(ke.id)},className:`flex items-center gap-1 px-2.5 py-1.5 text-[11px] rounded-t-lg shrink-0 cursor-pointer transition-colors group ${S===ke.id?"bg-[var(--terminal-bg)] text-[var(--terminal-text)]":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface)]"}`,style:S===ke.id?{borderTop:"2px solid #4CAF50"}:void 0,children:[o.jsx("span",{className:"text-[10px]",children:"💬"}),o.jsx("span",{className:"truncate",children:ke.name}),(L==null?void 0:L.has(ke.id))&&S!==ke.id&&o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 shrink-0"}),!ke.isDefault&&o.jsx("span",{onClick:yt=>{yt.stopPropagation(),A==null||A(ke.id)},className:"ml-1 text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none opacity-0 group-hover:opacity-100",children:"×"})]},ke.id)),j&&j.length>0&&t.length>0&&o.jsx("div",{className:"w-px h-4 bg-[var(--terminal-border)] shrink-0 mx-1"}),t.map(ke=>o.jsx(SC,{roleId:ke.roleId,title:ke.title,roleColor:Ed[ke.roleId]??"#666",active:!ee&&ke.id===l,onClick:()=>{E==null||E(null),f(ke.id)},onClose:yt=>{yt.stopPropagation(),m(ke.id)},"data-session-id":ke.id},ke.id))]}),z&&o.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-6 bg-gradient-to-l from-[var(--terminal-bg-deeper)] to-transparent z-10 pointer-events-none"})]}),o.jsxs("div",{className:"relative shrink-0",children:[o.jsx("button",{onClick:()=>{U(!O),ne(!1)},className:"w-7 h-7 flex items-center justify-center text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-lg cursor-pointer",children:"+"}),O&&o.jsxs("div",{className:"absolute top-full right-0 mt-1 bg-[var(--terminal-surface)] border border-[var(--terminal-border)] rounded-lg shadow-xl z-50 py-1 min-w-[200px]",children:[C&&o.jsxs(o.Fragment,{children:[D?o.jsxs("div",{className:"px-3 py-2 flex items-center gap-1",children:[o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:"#"}),o.jsx("input",{autoFocus:!0,value:R,onChange:ke=>Q(ke.target.value),onKeyDown:ke=>{ke.key==="Enter"&&R.trim()&&(C(R.trim(),[]),Q(""),Y(!1),U(!1)),ke.key==="Escape"&&(Y(!1),Q(""))},placeholder:"channel name",className:"flex-1 bg-transparent text-xs text-[var(--terminal-text)] outline-none border-b border-[var(--terminal-border)]"})]}):o.jsxs("button",{onClick:()=>Y(!0),className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer flex items-center gap-2",children:[o.jsx("span",{className:"text-[10px]",children:"💬"}),"New Channel"]}),o.jsx("div",{className:"border-b border-[var(--terminal-border)] my-1"})]}),r.map(ke=>o.jsxs("button",{onClick:()=>{x(ke.id),E==null||E(null),U(!1)},className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:Ed[ke.id]??"#666"}}),ke.id.toUpperCase()," — ",ke.name]},ke.id))]})]}),o.jsxs("div",{className:"relative shrink-0",children:[o.jsx("button",{onClick:()=>{ne(!X),U(!1)},className:"w-7 h-7 flex items-center justify-center text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-xs cursor-pointer tracking-tight",title:"Manage sessions",children:"···"}),X&&o.jsxs("div",{className:"absolute top-full right-0 mt-1 bg-[var(--terminal-surface)] border border-[var(--terminal-border)] rounded-lg shadow-xl z-50 py-1 min-w-[200px]",children:[o.jsxs("div",{className:"px-3 py-1.5 text-[10px] text-[var(--terminal-text-muted)] border-b border-[var(--terminal-border)]",children:[t.length," session",t.length!==1?"s":""]}),Be>0&&d&&o.jsxs("button",{onClick:()=>{d(),ne(!1)},className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer",children:["Clear empty sessions (",Be,")"]}),t.length>0&&g&&o.jsx("button",{onClick:()=>{g(),ne(!1)},className:"w-full text-left px-3 py-2 text-xs text-[#E57373] hover:bg-[var(--terminal-surface-light)] cursor-pointer",children:"Close all sessions"}),t.length===0&&o.jsx("div",{className:"px-3 py-2 text-xs text-[var(--terminal-text-muted)]",children:"No sessions"})]})]}),o.jsx("button",{onClick:v,className:"px-2 py-1 text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm cursor-pointer shrink-0",children:"×"})]}),ee&&V?o.jsx(OC,{channel:V,allRoles:r,onUpdateMembers:M,onUpdateTopic:F}):Se?o.jsxs(o.Fragment,{children:[o.jsx(MC,{messages:Se.messages,roleId:Se.roleId,roleColor:Ed[Se.roleId]??"#666"}),o.jsx(FC,{mode:Se.mode,onModeChange:ke=>b(Se.id,ke),onSend:ke=>y(Se.id,ke,Se.mode),disabled:Ee,disabledReason:Ee?`${Se.roleId.toUpperCase()} is responding...`:void 0})]}):o.jsx("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:"No active session. Click [+] to start."})]})}function HC(){const t=k.useRef(null),l=k.useCallback(()=>{var i;(i=t.current)==null||i.abort(),t.current=null},[]);return{sendMessage:k.useCallback((i,c,u,f)=>{l();const m=new AbortController;return t.current=m,fetch(`/api/exec/session/${i}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:c,mode:u}),signal:m.signal}).then(async x=>{var b,v,j,S,E;if(!x.ok||!x.body){f.onError("Failed to connect");return}const d=x.body.getReader(),g=new TextDecoder;let y="";for(;;){const{done:C,value:A}=await d.read();if(C)break;y+=g.decode(A,{stream:!0});const M=y.split(`
|
|
88
|
-
`);y=M.pop()??"";let F="";for(let L=0;L<M.length;L++){const O=M[L];if(O.startsWith("event: ")){F=O.slice(7).trim();continue}if(O.startsWith("data: ")){let U;try{U=JSON.parse(O.slice(6))}catch{F="";continue}switch(F){case"thinking":U.text&&((b=f.onThinking)==null||b.call(f,U.text));break;case"output":U.text&&f.onText(U.text);break;case"tool":(v=f.onToolUse)==null||v.call(f,U.name,U.input);break;case"dispatch":(j=f.onDispatch)==null||j.call(f,U.roleId,U.task);break;case"dispatch:progress":(S=f.onDispatchProgress)==null||S.call(f,U.roleId,U.type,U);break;case"turn":(E=f.onTurn)==null||E.call(f,U.turn);break;case"done":f.onDone(U);break;case"error":f.onError(U.message??"Unknown error");break;default:U.text&&f.onText(U.text);break}F=""}}}}).catch(x=>{x.name!=="AbortError"&&f.onError(x.message)}),{abort:l}},[l]),abort:l}}const Nh="tycono-appearances",Fc="tycono-theme";(()=>{try{for(const[t,l]of[["the-company-appearances",Nh],["the-company-theme",Fc]]){const r=localStorage.getItem(t);r&&!localStorage.getItem(l)&&(localStorage.setItem(l,r),localStorage.removeItem(t))}}catch{}})();function j0(){try{const t=localStorage.getItem(Nh);return t?JSON.parse(t):{}}catch{return{}}}function Nd(t){localStorage.setItem(Nh,JSON.stringify(t))}function C0(){try{const t=localStorage.getItem(Fc);if(t&&t in Ur)return t}catch{}return"default"}function UC(t){var i;const l=(i=Ur[t])==null?void 0:i.vars;if(!l)return;const r=document.documentElement;for(const[c,u]of Object.entries(l))r.style.setProperty(c,u)}const Ad={mode:"auto",intervalSec:18,dailyBudgetUsd:1},Pd="tycono-speech-settings",Td="tycono-language";function IC(){try{const t=localStorage.getItem(Pd);return t?{...Ad,...JSON.parse(t)}:Ad}catch{return Ad}}function YC(){const[t,l]=k.useState(j0),[r,i]=k.useState(C0),[c,u]=k.useState(IC),[f,m]=k.useState(()=>{try{return localStorage.getItem(Td)??"auto"}catch{return"auto"}}),x=k.useRef(!1);k.useEffect(()=>{x.current||(x.current=!0,Ce.getPreferences().then(S=>{const E=Object.keys(S.appearances??{}).length>0||S.theme!=="default";if(S.speech&&(u(C=>({...C,...S.speech})),localStorage.setItem(Pd,JSON.stringify(S.speech))),S.language&&(m(S.language),localStorage.setItem(Td,S.language)),E){const C=S.appearances;l(C),Nd(C),S.theme&&S.theme in Ur&&(i(S.theme),localStorage.setItem(Fc,S.theme))}else{const C=j0(),A=C0();(Object.keys(C).length>0||A!=="default")&&Ce.updatePreferences({appearances:C,theme:A}).catch(()=>{})}}).catch(()=>{}))},[]),k.useEffect(()=>{UC(r)},[r]);const d=k.useCallback(S=>t[S]??Eh(S),[t]),g=k.useCallback((S,E)=>{l(C=>{const A={...C,[S]:E};return Nd(A),Ce.updatePreferences({appearances:A}).catch(()=>{}),A})},[]),y=k.useCallback(S=>{l(E=>{const C={...E};return delete C[S],Nd(C),Ce.updatePreferences({appearances:C}).catch(()=>{}),C})},[]),b=k.useCallback(S=>{i(S),localStorage.setItem(Fc,S),Ce.updatePreferences({theme:S}).catch(()=>{})},[]),v=k.useCallback(S=>{u(E=>{const C={...E,...S};return localStorage.setItem(Pd,JSON.stringify(C)),Ce.updatePreferences({speech:C}).catch(()=>{}),C})},[]),j=k.useCallback(S=>{m(S),localStorage.setItem(Td,S),Ce.updatePreferences({language:S}).catch(()=>{})},[]);return{appearances:t,getAppearance:d,setAppearance:g,resetAppearance:y,theme:r,setTheme:b,speechSettings:c,setSpeechSettings:v,language:f,setLanguage:j}}const qC=3e4;function XC(){var E;const[t,l]=k.useState(null),[r,i]=k.useState("synced"),[c,u]=k.useState([]),f=k.useRef(null),m=k.useCallback(async()=>{try{const C=await Ce.getSaveStatus();l(C),C.noGit?i("no-git"):i(A=>A==="saving"?A:C.dirty?"dirty":"synced")}catch{i("error")}},[]),x=k.useCallback(()=>{f.current||(m(),f.current=setInterval(m,qC))},[m]);k.useEffect(()=>()=>{f.current&&clearInterval(f.current)},[]);const d=k.useCallback(async C=>{i("saving");try{const A=await Ce.save(C);return await m(),A}catch(A){throw i("error"),A}},[m]),g=k.useCallback(async()=>{try{const C=await Ce.getSaveHistory(20);u(C)}catch{}},[]),y=k.useCallback(async C=>{i("saving");try{await Ce.restoreSave(C),await m()}catch(A){throw i("error"),A}},[m]),b=k.useCallback(async()=>{try{await Ce.initGit(),await m()}catch{i("error")}},[m]),v=t?t.modified.length+t.untracked.length:0,j=((E=t==null?void 0:t.lastCommit)==null?void 0:E.date)??null,S=k.useCallback(async()=>{x()},[x]);return{state:r,dirtyCount:v,lastSaved:j,status:t,save:d,history:c,loadHistory:g,restore:y,refresh:S,initGit:b}}const E0={cto:["Need to reduce this architecture tech debt...","Don't over-engineer. Keep it minimal.","Performance profiling results are a bit concerning.","Should do a system design review.","If I just strip one abstraction layer, it should work.","Let me check the monitoring dashboard.","Need to go through the code review queue.","It's about time to clean up these module dependencies."],cbo:["Heard the competitor launched a new feature... need to analyze.","Should compile this month's revenue metrics.","It's time to update the market trend report.","Maybe I should benchmark the pricing strategy.","Need to recalculate the ROI.","Let me check the competitor's GitHub star trends.","Thinking about launch timing...","Should re-examine the positioning strategy."],pm:["Is this feature really what users want?","Need to clean up the backlog...","MVP scope keeps expanding.","Analyzing user feedback...","Might need to re-prioritize.","Watch out for scope creep.","Will the roadmap timeline hold...","Should double-check the task dependencies."],engineer:["I want to refactor this code...","Test coverage seems a bit low.","Working code first, perfect code later.","Waiting for PR review...","What could be causing this bug...","Is the build broken?","Need to fix that one type error.","Maybe I should run npm audit."],designer:["This UI flow feels a bit awkward...","Usability first, pretty later.","Need to organize the design system components.","Let me make two quick options and compare.","Should run through the accessibility checklist.","Maybe I should prototype this interaction.","Let me revisit the color palette...","The spacing feels a bit cramped."],qa:['"Works" and "correct" are two different things.',"Organizing edge case scenarios...","Should run the regression test suite.","This part could be converted to automated tests.","Need to go through the pre-release checklist.","Reproducible bug reports are key.","Should run cross-browser tests.","Need to check for performance regressions."],"data-analyst":["Checking the data pipeline status...","Interesting outlier detection pattern.","Need to update the dashboard metrics.","Correlation isn't causation though...","Seems like there is room for SQL query optimization.","It's time for a data quality check."]},N0={cto:["Should I assign more work to the team...","It's time to clean up the architecture debt.","Need to re-examine the tech roadmap.","It's quiet... am I missing something?"],cbo:["It's time to update the market analysis...","Should be preparing the revenue report, but no directives.","Let me check on competitor movements.","It's quiet on the business side..."],pm:["Backlog is pretty quiet... nothing to plan?","It's been a while since we scheduled a sprint.","User feedback must be piling up...","No PRD to write... that's unusual."],engineer:["Nothing to do today... maybe some code reviews.","Task queue is empty. Guess I'll refactor.","Am I missing something?","Should clean up the commit log."],designer:["No design requests coming in. Should I improve something on my own?","Maybe run a UI audit...","Should organize my portfolio.","Let me tidy up the component library."],qa:["No builds to test. Let me improve the automation scripts.","It's quiet... no bugs, or just haven't found them?","Let me review the existing test scenarios.","Should update the test coverage report."],"data-analyst":["No analysis requests coming in...","Maybe I should clean up the data warehouse.","Should verify the past reports."]},VC=[{id:"sup-check-1",relation:"superior-subordinate",minFamiliarity:0,topic:"progress",turns:[{speaker:"A",text:"How's the progress?"},{speaker:"B",text:"Going well. Should be done soon."},{speaker:"A",text:"Good, let me know when it's done."}]},{id:"sup-check-2",relation:"superior-subordinate",minFamiliarity:20,topic:"progress",turns:[{speaker:"A",text:"What are you working on today?"},{speaker:"B",text:"Finishing up what I was doing yesterday."}]},{id:"sub-report-1",relation:"superior-subordinate",minFamiliarity:10,topic:"report",turns:[{speaker:"B",text:"Done with that task from earlier."},{speaker:"A",text:"Nice work. Can you share the results?"},{speaker:"B",text:"Sure, I've updated the docs."}]},{id:"peer-tech-1",relation:"peer",minFamiliarity:20,topic:"tech",turns:[{speaker:"A",text:"What do you think about this design?"},{speaker:"B",text:"I think we could go simpler."},{speaker:"A",text:"Really? Want to look at it together?"}]},{id:"peer-tech-2",relation:"peer",minFamiliarity:30,topic:"tech",turns:[{speaker:"A",text:"Have you used this library before?"},{speaker:"B",text:"Yeah, used it in the last project. It was decent."}]},{id:"close-feedback-1",relation:"peer",minFamiliarity:60,topic:"feedback",turns:[{speaker:"A",text:"Can I be honest with you?"},{speaker:"B",text:"Of course, go ahead."},{speaker:"A",text:"This one feels a bit off. Let's revisit."},{speaker:"B",text:"...Alright. Thanks for the feedback."}]},{id:"clevel-sync-1",relation:"c-level",minFamiliarity:10,topic:"strategy",turns:[{speaker:"A",text:"We need to sync the roadmap with the business timeline."},{speaker:"B",text:"Agreed. I'll have it organized and shared by tomorrow."}]},{id:"clevel-sync-2",relation:"c-level",minFamiliarity:30,topic:"strategy",turns:[{speaker:"A",text:"I have some competitor intel to share."},{speaker:"B",text:"Great, I have a tech update too."},{speaker:"A",text:"Let's sync up when you're free."}]},{id:"casual-coffee",relation:"any",minFamiliarity:30,topic:"casual",turns:[{speaker:"A",text:"Want to grab a coffee?"},{speaker:"B",text:"Sure. Feels like it's going to be a long day."}]},{id:"casual-overtime",relation:"any",minFamiliarity:25,topic:"casual",turns:[{speaker:"A",text:"Working late again..."},{speaker:"B",text:"We're in this together. Hang in there."}]},{id:"casual-lunch",relation:"any",minFamiliarity:35,topic:"casual",turns:[{speaker:"A",text:"What should we get for lunch?"},{speaker:"B",text:"Anything. Feel like we eat the same thing every day."}]},{id:"casual-weekend",relation:"any",minFamiliarity:40,topic:"casual",turns:[{speaker:"A",text:"What did you do this weekend?"},{speaker:"B",text:"Just rested. Was too tired."}]},{id:"bestie-1",relation:"any",minFamiliarity:80,topic:"trust",turns:[{speaker:"A",text:"I'm a bit unsure about this direction..."},{speaker:"B",text:"What's bothering you? Be honest."},{speaker:"A",text:"Thanks. It's nice having someone I can talk to."}]}],GC=18e3,A0=6e3,KC=2500,QC=30*6e4,Sg="tycono:relationships";function WC(){try{const t=localStorage.getItem(Sg);return t?JSON.parse(t):[]}catch{return[]}}function ZC(t){localStorage.setItem(Sg,JSON.stringify(t))}function uc(t,l,r){const[i,c]=l<r?[l,r]:[r,l];let u=t.find(f=>f.roleA===i&&f.roleB===c);return u||(u={roleA:i,roleB:c,dispatches:0,wavesTogether:0,conversations:0,familiarity:0,lastInteraction:new Date().toISOString()},t.push(u)),u}function fc(t){return Math.min(100,t.dispatches*5+t.wavesTogether*10+t.conversations*2)}function dc(t){return t[Math.floor(Math.random()*t.length)]}function JC(t,l,r){const i=r.find(m=>m.id===t),c=r.find(m=>m.id===l);if(!i||!c)return null;const u=i.level==="c-level",f=c.level==="c-level";return u&&f?"c-level":i.reportsTo===l||c.reportsTo===t?"superior-subordinate":(i.reportsTo===c.reportsTo,"peer")}function PC(t,l){return t.relation==="any"?!0:t.relation===l}function eE({roles:t,roleStatuses:l,activeExecs:r,getStandupSpeech:i}){const[c,u]=k.useState(new Map),[f,m]=k.useState(WC),x=k.useRef({}),d=k.useRef(null),g=k.useRef(t),y=k.useRef(l),b=k.useRef(r),v=k.useRef(i),j=k.useRef(f);g.current=t,y.current=l,b.current=r,v.current=i,j.current=f,k.useEffect(()=>{const F=Date.now();for(const[L,O]of Object.entries(l))O==="working"&&(x.current[L]=F)},[l]),k.useEffect(()=>{ZC(f)},[f]);const S=k.useCallback(F=>{const L=y.current[F],O=b.current.find(Y=>Y.roleId===F);if(L==="working"&&(O!=null&&O.task))return null;const U=v.current(F);if(U&&Math.random()<.3)return{text:U,type:"work",ts:Date.now()};const X=Date.now(),ne=x.current[F]??0;if(X-ne>QC&&Math.random()<.5){const Y=N0[F]??N0.engineer;return{text:dc(Y),type:"guilt",ts:X}}const D=E0[F]??E0.engineer;return{text:dc(D),type:"personality",ts:X}},[]),E=k.useCallback(F=>{if(d.current)return!1;const L=F.filter(Z=>y.current[Z.id]!=="working");if(L.length<2)return!1;const O=[...L].sort(()=>Math.random()-.5),U=O[0],X=O[1],ne=JC(U.id,X.id,F);if(!ne)return!1;const D=uc(j.current,U.id,X.id),Y=fc(D),R=VC.filter(Z=>PC(Z,ne)&&Y>=Z.minFamiliarity);if(R.length===0)return!1;const Q=dc(R);let ee=U.id,V=X.id;Q.relation==="superior-subordinate"&&(X.reportsTo===U.id||U.level==="c-level"?(ee=U.id,V=X.id):(ee=X.id,V=U.id)),d.current={templateId:Q.id,roleA:ee,roleB:V,turnIdx:0,timer:null};const I=Z=>{if(!d.current||Z>=Q.turns.length){d.current=null,m(B=>{const W=[...B],T=uc(W,ee,V);return T.conversations++,T.familiarity=fc(T),T.lastInteraction=new Date().toISOString(),W}),setTimeout(()=>{u(B=>{const W=new Map(B);return W.delete(ee),W.delete(V),W})},A0);return}const ce=Q.turns[Z],we=ce.speaker==="A"?ee:V,z=ce.speaker==="A"?V:ee;u(B=>{const W=new Map(B);if(W.set(we,{text:ce.text,type:"social",partnerId:z,ts:Date.now()}),Z>0){const T=Q.turns[Z-1].speaker==="A"?ee:V;T!==we&&W.delete(T)}return W}),d.current.turnIdx=Z,d.current.timer=setTimeout(()=>I(Z+1),KC)};return I(0),!0},[]);k.useEffect(()=>{const F=setInterval(()=>{const L=g.current;if(L.length===0||d.current||Math.random()<.35&&E(L))return;const O=L.filter(ne=>y.current[ne.id]!=="working");if(O.length===0)return;const U=dc(O),X=S(U.id);X&&(u(ne=>{const D=new Map(ne);return D.set(U.id,X),D}),setTimeout(()=>{u(ne=>{const D=new Map(ne),Y=D.get(U.id);return Y&&Y.ts===X.ts&&D.delete(U.id),D})},A0))},GC);return()=>{var L;clearInterval(F),(L=d.current)!=null&&L.timer&&clearTimeout(d.current.timer)}},[S,E]);const C=k.useCallback(F=>{const L=c.get(F);return(L==null?void 0:L.text)??""},[c]),A=k.useCallback((F,L)=>{m(O=>{const U=[...O],X=uc(U,F,L);return X.dispatches++,X.familiarity=fc(X),X.lastInteraction=new Date().toISOString(),U})},[]),M=k.useCallback(F=>{F.length<2||m(L=>{const O=[...L];for(let U=0;U<F.length;U++)for(let X=U+1;X<F.length;X++){const ne=uc(O,F[U],F[X]);ne.wavesTogether++,ne.familiarity=fc(ne),ne.lastInteraction=new Date().toISOString()}return O})},[]);return{speeches:c,getSpeech:C,relationships:f,notifyDispatch:A,notifyWave:M}}const jg="tycono:office-chat";let tE=0;function nE(){return`chat-${Date.now()}-${++tE}`}function Dd(){return[{id:"general",name:"#general",members:[],isDefault:!0,messages:[],topic:"Company-wide announcements and general discussion"},{id:"watercooler",name:"#watercooler",members:[],isDefault:!0,messages:[],topic:"No managers allowed. Vent, gossip, joke around. Talk freely about work frustrations, complain about directives you disagree with, share hot takes."}]}function lE(){try{const t=localStorage.getItem(jg);if(t){const l=JSON.parse(t);if(l.find(i=>i.id==="office")&&!l.find(i=>i.id==="general")){const i=l.filter(c=>c.id!=="office");return[...Dd(),...i]}const r=Dd();for(const i of r)l.find(c=>c.id===i.id)||l.unshift(i);return l}}catch{}return Dd()}function rE(t){const l=t.map(r=>({...r,messages:r.messages.slice(-200)}));localStorage.setItem(jg,JSON.stringify(l))}function aE(){const[t,l]=k.useState(lE),[r,i]=k.useState(null),[c,u]=k.useState(new Set);k.useEffect(()=>{rE(t)},[t]);const f=k.useCallback(v=>{i(v),v&&u(j=>{const S=new Set(j);return S.delete(v),S})},[]),m=k.useCallback(v=>{const j={...v,id:nE()};l(S=>{const E=S.map(C=>C.id==="general"?v.type==="dispatch"?{...C,messages:[...C.messages,j].slice(-200)}:C:v.channelId?C.id===v.channelId?{...C,messages:[...C.messages,j].slice(-200)}:C:C.members.length>0&&C.members.includes(v.roleId)?{...C,messages:[...C.messages,j].slice(-200)}:C);return u(C=>{const A=new Set(C);for(const M of E){const F=S.find(L=>L.id===M.id);F&&M.messages.length>F.messages.length&&A.add(M.id)}return A}),E})},[]),x=k.useCallback((v,j,S)=>{const E=`ch-${Date.now()}`,C={id:E,name:v.startsWith("#")?v:`#${v}`,members:j,isDefault:!1,messages:[],topic:S};l(A=>[...A,C]),i(E)},[]),d=k.useCallback(v=>{l(j=>j.filter(S=>S.id!==v||S.isDefault)),i(j=>j===v?"general":j)},[]),g=k.useCallback((v,j)=>{l(S=>S.map(E=>E.id===v&&!E.isDefault?{...E,members:j}:E))},[]),y=k.useCallback((v,j)=>{l(S=>S.map(E=>E.id===v&&!E.isDefault?{...E,topic:j||void 0}:E))},[]),b=k.useCallback(v=>{l(j=>j.map(S=>{if(S.id==="watercooler"){const E=v.filter(C=>C.level!=="c-level").map(C=>C.id);if(S.members.length!==E.length||!E.every(C=>S.members.includes(C)))return{...S,members:E}}return S}))},[]);return{channels:t,activeChannelId:r,setActiveChannelId:f,pushMessage:m,createChannel:x,deleteChannel:d,updateMembers:g,updateTopic:y,unreadChannels:c,syncDefaultMembers:b}}const iE=45e3,sE=5e3,oE=4,cE=20;function uE({roles:t,roleStatuses:l,activeExecs:r,channels:i,relationships:c,pushMessage:u,speechSettings:f,engineType:m,hasApiKey:x}){const g=((f==null?void 0:f.mode)==="auto"?m==="claude-cli"||m==="local"?"llm":"template":(f==null?void 0:f.mode)??"template")==="llm"&&(x!==!1||m==="claude-cli"),y=((f==null?void 0:f.intervalSec)??iE/1e3)*1e3,b=k.useRef(t),v=k.useRef(l),j=k.useRef(r),S=k.useRef(i),E=k.useRef(c),C=k.useRef(u),A=k.useRef(0),M=k.useRef(!1);b.current=t,v.current=l,j.current=r,S.current=i,E.current=c,C.current=u;const F=k.useCallback(async(O,U)=>{if(M.current)return!1;M.current=!0;try{if(!b.current.find(V=>V.id===O))return!1;const ne=U.messages.slice(-cE).map(V=>({roleId:V.roleId,text:V.text,ts:V.ts})),D=b.current.filter(V=>U.members.includes(V.id)),Y=E.current.filter(V=>V.roleA===O||V.roleB===O).map(V=>({partnerId:V.roleA===O?V.roleB:V.roleA,familiarity:V.familiarity})),R=j.current.find(V=>V.roleId===O),Q=R?{currentTask:R.task,taskProgress:null}:{currentTask:null,taskProgress:null},ee=await Ce.chatInChannel({channelId:U.name.replace("#",""),channelTopic:U.topic,roleId:O,history:ne,members:D.map(V=>({id:V.id,name:V.name,level:V.level})),relationships:Y,workContext:Q});return ee.message?(C.current({ts:Date.now(),roleId:O,text:ee.message,type:"chat",channelId:U.id}),!0):!1}catch{return!1}finally{M.current=!1}},[]),L=k.useCallback(async(O,U)=>{if(A.current>=oE){A.current=0;return}const X=O.members.filter(R=>R!==U&&v.current[R]!=="working");if(X.length===0){A.current=0;return}const ne=X[Math.floor(Math.random()*X.length)];if(Math.random()>.7){A.current=0;return}const D=A.current*2e3,Y=Math.random()*5e3;setTimeout(async()=>{A.current++;const R=S.current.find(ee=>ee.id===O.id);if(!R)return;if(await F(ne,R)){const ee=.6-A.current*.1;Math.random()<ee?L(R,ne):A.current=0}else A.current=0},sE+D+Y)},[F]);k.useEffect(()=>{if(!g)return;const O=setInterval(async()=>{const U=b.current;if(U.length===0||M.current)return;const X=U.filter(Q=>v.current[Q.id]!=="working");if(X.length===0)return;const ne=X[Math.floor(Math.random()*X.length)],D=S.current.filter(Q=>Q.members.length===0?!0:Q.members.includes(ne.id));if(D.length===0)return;const Y=D[Math.floor(Math.random()*D.length)];A.current=0,await F(ne.id,Y)&&L(Y,ne.id)},y);return()=>clearInterval(O)},[g,y,F,L])}function hc({type:t,className:l}){const r=k.useRef(null),i=TS(t);return k.useEffect(()=>{const c=r.current;if(!c||!i)return;const u=c.getContext("2d");u&&zS(u,i)},[t,i]),i?o.jsx("canvas",{ref:r,width:i.canvasWidth,height:i.canvasHeight,className:l,style:{imageRendering:"pixelated",display:"block"}}):null}const Cg=[[1,8],[3,5],[8,1],[5,3]],fE=[[1,4],[2,3],[4,1],[3,2]];function mc(t){const l=t===1||t===3?-1:0,r=Cg[t],i=t<2?[0,1]:[1,0],c=l;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:r[0],y:13,w:3,h:4,c:"$pants"},{x:r[1],y:13,w:3,h:4,c:"$pants"},{x:r[0]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:r[1]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:r[0],y:16,w:3,h:2,c:"$shoes"},{x:r[1],y:16,w:3,h:2,c:"$shoes"},{x:r[0],y:16,w:3,h:1,c:"lighten($shoes, 25)",a:.4},{x:r[1],y:16,w:3,h:1,c:"lighten($shoes, 25)",a:.4},{x:1,y:c+8,w:10,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.35},{x:1,y:c+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:10,y:c+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:-1,y:c+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:c+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:-1,y:c+12,w:2,h:1,c:"$skin"},{x:11,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:1,y:c+0,w:10,h:7,c:"$skin"},{x:3,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:c+3,w:1,h:1,c:"#FFF",a:.4},{x:7,y:c+3,w:1,h:1,c:"#FFF",a:.4},{x:5,y:c+6,w:2,h:1,c:"darken($skin, 25)",a:.35},{x:0,y:c+3,w:1,h:1,c:"$skin"},{x:11,y:c+3,w:1,h:1,c:"$skin"},{x:1,y:c+0,w:10,h:3,c:"$hair"},{x:0,y:c+1,w:2,h:3,c:"$hair"},{x:10,y:c+1,w:2,h:3,c:"$hair"},{x:2,y:c+0,w:8,h:1,c:"lighten($hair, 25)",a:.3}]}function xc(t){const l=t===1||t===3?-1:0,r=Cg[t],i=t<2?[0,1]:[1,0],c=l;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:r[0],y:13,w:3,h:4,c:"$pants"},{x:r[1],y:13,w:3,h:4,c:"$pants"},{x:r[0],y:16,w:3,h:2,c:"$shoes"},{x:r[1],y:16,w:3,h:2,c:"$shoes"},{x:1,y:c+8,w:10,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:5,y:c+10,w:2,h:3,c:"darken($shirt, 30)",a:.12},{x:-1,y:c+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:c+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:1,y:c+0,w:10,h:7,c:"$skin"},{x:1,y:c+0,w:10,h:6,c:"$hair"},{x:0,y:c+1,w:2,h:5,c:"$hair"},{x:10,y:c+1,w:2,h:5,c:"$hair"},{x:2,y:c+0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:0,y:c+4,w:1,h:1,c:"$skin",a:.6},{x:11,y:c+4,w:1,h:1,c:"$skin",a:.6}]}function Br(t,l){const r=t===1||t===3?-1:0,i=fE[t],c=r,u=t%2===0?1:0;return l?[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:i[0],y:13,w:3,h:4,c:"$pants"},{x:i[1],y:13,w:3,h:4,c:"$pants"},{x:i[0],y:16,w:3,h:2,c:"$shoes"},{x:i[1],y:16,w:3,h:2,c:"$shoes"},{x:2,y:c+8,w:8,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:8,y:c+9+u,w:3,h:4-u,c:"$shirt"},{x:9,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:2,y:c+0,w:8,h:7,c:"$skin"},{x:7,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:c+3,w:1,h:1,c:"#FFF",a:.3},{x:9,y:c+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:c+0,w:8,h:3,c:"$hair"},{x:1,y:c+1,w:2,h:4,c:"$hair"},{x:9,y:c+1,w:2,h:3,c:"$hair"},{x:3,y:c+0,w:6,h:1,c:"lighten($hair, 25)",a:.25}]:[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:i[0],y:13,w:3,h:4,c:"$pants"},{x:i[1],y:13,w:3,h:4,c:"$pants"},{x:i[0],y:16,w:3,h:2,c:"$shoes"},{x:i[1],y:16,w:3,h:2,c:"$shoes"},{x:2,y:c+8,w:8,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:0,y:c+9+u,w:3,h:4-u,c:"$shirt"},{x:-1,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:2,y:c+0,w:8,h:7,c:"$skin"},{x:3,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:c+3,w:1,h:1,c:"#FFF",a:.3},{x:1,y:c+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:c+0,w:8,h:3,c:"$hair"},{x:1,y:c+1,w:2,h:3,c:"$hair"},{x:9,y:c+1,w:2,h:4,c:"$hair"},{x:3,y:c+0,w:6,h:1,c:"lighten($hair, 25)",a:.25}]}const T0={down:[mc(0),mc(1),mc(2),mc(3)],up:[xc(0),xc(1),xc(2),xc(3)],right:[Br(0,!0),Br(1,!0),Br(2,!0),Br(3,!0)],left:[Br(0,!1),Br(1,!1),Br(2,!1),Br(3,!1)]},qe=4,At=28,sn=2,ct=4,et=4,lr=[{wallColor:"#C8B898",baseboardColor:"#6A5840",floorType:"wood"},{wallColor:"#A8B8C8",baseboardColor:"#586878",floorType:"dark"},{wallColor:"#A8C8B0",baseboardColor:"#4A6A50",floorType:"carpet"},{wallColor:"#C8C0A8",baseboardColor:"#7A6A50",floorType:"tile"}];function Ah(t,l,r){const u=t.fy+Math.max(10,Math.floor(t.fh*.18)),f=Math.min(l,r),m=Math.ceil(l/f),x=[],d=f*28,g=t.fx+Math.max(8,Math.floor((t.fw-d)/2));for(let y=0;y<m&&x.length<l;y++){const b=Math.min(f,l-y*f);for(let v=0;v<b;v++)x.push({dx:g+v*28,dy:u+y*28,room:t.id})}return x}function dE(t){const i=lr[0],c={id:"main",wx:qe+et,wy:qe,ww:160-2*(qe+et),wh:At,fx:qe+et,fy:qe+At+sn,fw:160-2*(qe+et),fh:120-qe-At-sn-qe,...i},u=Ah(c,Math.min(t,6),3),f=[{id:"s-window-l",type:"window",room:"main",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"s-window-r",type:"window",room:"main",zone:"wall",anchorX:"right",offsetX:-26,offsetY:6,windowW:16,windowH:14},{id:"s-clock",type:"clock",room:"main",zone:"wall",offsetX:Math.floor((160-2*(qe+et))/2),offsetY:10}],m=[{id:"s-plant-l",type:"plant",room:"main",zone:"floor",offsetX:4,offsetY:4},{id:"s-plant-r",type:"plant",room:"main",zone:"floor",anchorX:"right",offsetX:-8,offsetY:4}];return{preset:"S",canvasW:160,canvasH:120,rooms:{main:c},desks:u,doors:{},adjacency:{main:[]},corridorY:{main:c.fy+c.fh-12},waypoints:{main:[{x:c.fx+10,y:c.fy+c.fh-14},{x:c.fx+c.fw/2,y:c.fy+c.fh-14},{x:c.fx+c.fw-10,y:c.fy+c.fh-14}]},wallDecorations:f,furniture:m}}function hE(t){const c={id:"exec",wx:qe+et,wy:qe,ww:144-qe-et-ct/2,wh:At,fx:qe+et,fy:qe+At+sn,fw:144-qe-et-ct/2,fh:66,...lr[0]},u={id:"work",wx:144+ct/2+et,wy:qe,ww:144-ct/2-et-qe,wh:At,fx:144+ct/2+et,fy:qe+At+sn,fw:144-ct/2-et-qe,fh:66,...lr[1]},f={id:"meet",wx:qe+et,wy:qe+At+sn+66+ct,ww:144-qe-et-ct/2,wh:At,fx:qe+et,fy:qe+At+sn+66+ct+At+sn,fw:144-qe-et-ct/2,fh:70,...lr[2]},m={id:"comm",wx:144+ct/2+et,wy:qe+At+sn+66+ct,ww:144-ct/2-et-qe,wh:At,fx:144+ct/2+et,fy:qe+At+sn+66+ct+At+sn,fw:144-ct/2-et-qe,fh:70,...lr[3]},x={exec:c,work:u,meet:f,comm:m},d=[];let g=t;const y=[[c,Math.min(3,g)],[u,0]];y[1][1]=Math.min(3,g-y[0][1]);const b=[[f,0],[m,0]];let v=g-y[0][1]-y[1][1];v>0&&(b[0][1]=Math.min(2,v),v-=b[0][1]),v>0&&(b[1][1]=Math.min(2,v));for(const[O,U]of[...y,...b])U>0&&d.push(...Ah(O,U,3));const j=qe+At+sn+66,S=144-ct/2,E={exec_work:{id:"exec_work",type:"v",doorY:qe+At+sn+20+12,xA:S-2,xB:u.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:qe+At+sn+66+ct+At+sn+20+12,xA:S-2,xB:m.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:qe+et+40+14,yA:j-2,yB:f.fy+2},work_comm:{id:"work_comm",type:"h",doorX:144+ct/2+et+40+14,yA:j-2,yB:m.fy+2}},C={exec:[{room:"work",door:"exec_work",side:"A"},{room:"meet",door:"exec_meet",side:"A"}],work:[{room:"exec",door:"exec_work",side:"B"},{room:"comm",door:"work_comm",side:"A"}],meet:[{room:"exec",door:"exec_meet",side:"B"},{room:"comm",door:"meet_comm",side:"A"}],comm:[{room:"work",door:"work_comm",side:"B"},{room:"meet",door:"meet_comm",side:"B"}]},A={exec:c.fy+52,work:u.fy+48,meet:f.fy+56,comm:m.fy+42},M={exec:[{x:c.fx+6,y:c.fy+52},{x:c.fx+60,y:c.fy+54},{x:c.fx+112,y:c.fy+50},{x:c.fx+50,y:c.fy+52}],work:[{x:u.fx+14,y:u.fy+48},{x:u.fx+44,y:u.fy+48},{x:u.fx+70,y:u.fy+48},{x:u.fx+100,y:u.fy+48}],meet:[{x:f.fx+60,y:f.fy+56},{x:f.fx+30,y:f.fy+54},{x:f.fx+110,y:f.fy+50},{x:f.fx+80,y:f.fy+56}],comm:[{x:m.fx+96,y:m.fy+8},{x:m.fx+60,y:m.fy+42},{x:m.fx+40,y:m.fy+42},{x:m.fx+20,y:m.fy+42}]},F=[{id:"exec-window-1",type:"window",room:"exec",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"exec-picture-1",type:"picture",room:"exec",zone:"wall",offsetX:34,offsetY:8,pictureColor:"#1565C0",facility:{id:"theme",label:"THEME",icon:"🎨",color:"#42A5F5",hitW:12,hitH:10}},{id:"exec-picture-2",type:"picture",room:"exec",zone:"wall",offsetX:48,offsetY:8,pictureColor:"#E65100"},{id:"exec-clock",type:"clock",room:"exec",zone:"wall",offsetX:64,offsetY:10,facility:{id:"settings",label:"SETTINGS",icon:"⚙",color:"#78909C",hitW:10,hitH:10}},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:14,facility:{id:"stats",label:"STATS",icon:"📊",color:"#7E57C2",hitW:16,hitH:8}},{id:"exec-window-2",type:"window",room:"exec",zone:"wall",offsetX:104,offsetY:6,windowW:16,windowH:14},{id:"work-whiteboard",type:"whiteboard",room:"work",zone:"wall",offsetX:6,offsetY:4},{id:"work-window-1",type:"window",room:"work",zone:"wall",offsetX:50,offsetY:6,windowW:16,windowH:14},{id:"work-window-2",type:"window",room:"work",zone:"wall",offsetX:92,offsetY:6,windowW:16,windowH:14},{id:"meet-bulletin",type:"bulletin-board",room:"meet",zone:"wall",offsetX:6,offsetY:4,facility:{id:"bulletin",label:"BULLETIN",icon:"📋",color:"#F59E0B",hitW:22,hitH:16}},{id:"meet-picture",type:"picture",room:"meet",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#10B981"},{id:"meet-window",type:"window",room:"meet",zone:"wall",offsetX:80,offsetY:6,windowW:16,windowH:14},{id:"meet-shelf",type:"shelf",room:"meet",zone:"wall",offsetX:102,offsetY:18},{id:"comm-screen",type:"screen",room:"comm",zone:"wall",offsetX:6,offsetY:6,facility:{id:"decisions",label:"DECISIONS",icon:"📜",color:"#EF4444",hitW:16,hitH:12}},{id:"comm-picture",type:"picture",room:"comm",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#d4956a"},{id:"comm-window",type:"window",room:"comm",zone:"wall",offsetX:76,offsetY:6,windowW:16,windowH:14},{id:"comm-clock",type:"clock",room:"comm",zone:"wall",offsetX:98,offsetY:10},{id:"comm-shelf",type:"shelf",room:"comm",zone:"wall",offsetX:108,offsetY:18}],L=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(c.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"M",canvasW:288,canvasH:208,rooms:x,desks:d,doors:E,adjacency:C,corridorY:A,waypoints:M,wallDecorations:F,furniture:L}}function mE(t){const f={id:"exec",wx:qe+et,wy:qe,ww:180-qe-et-ct/2,wh:At,fx:qe+et,fy:qe+At+sn,fw:180-qe-et-ct/2,fh:82,...lr[0]},m={id:"work",wx:180+ct/2+et,wy:qe,ww:180-ct/2-et-qe,wh:At,fx:180+ct/2+et,fy:qe+At+sn,fw:180-ct/2-et-qe,fh:82,...lr[1]},x=qe+At+sn+82,d={id:"meet",wx:qe+et,wy:x+ct,ww:180-qe-et-ct/2,wh:At,fx:qe+et,fy:x+ct+At+sn,fw:180-qe-et-ct/2,fh:86,...lr[2]},g={id:"comm",wx:180+ct/2+et,wy:x+ct,ww:180-ct/2-et-qe,wh:At,fx:180+ct/2+et,fy:x+ct+At+sn,fw:180-ct/2-et-qe,fh:86,...lr[3]},y={exec:f,work:m,meet:d,comm:g},b=[];let v=t;const j=[[f,Math.min(5,v)],[m,0]];j[1][1]=Math.min(5,v-j[0][1]);const S=[[d,0],[g,0]];let E=v-j[0][1]-j[1][1];E>0&&(S[0][1]=Math.min(3,E),E-=S[0][1]),E>0&&(S[1][1]=Math.min(3,E));for(const[X,ne]of[...j,...S])ne>0&&b.push(...Ah(X,ne,4));const C=180-ct/2,A={exec_work:{id:"exec_work",type:"v",doorY:f.fy+82/2,xA:C-2,xB:m.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:d.fy+86/2,xA:C-2,xB:g.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:f.fx+54,yA:x-2,yB:d.fy+2},work_comm:{id:"work_comm",type:"h",doorX:m.fx+54,yA:x-2,yB:g.fy+2}},M={exec:[{room:"work",door:"exec_work",side:"A"},{room:"meet",door:"exec_meet",side:"A"}],work:[{room:"exec",door:"exec_work",side:"B"},{room:"comm",door:"work_comm",side:"A"}],meet:[{room:"exec",door:"exec_meet",side:"B"},{room:"comm",door:"meet_comm",side:"A"}],comm:[{room:"work",door:"work_comm",side:"B"},{room:"meet",door:"meet_comm",side:"B"}]},F={exec:f.fy+82-12,work:m.fy+82-12,meet:d.fy+86-12,comm:g.fy+86-12},L={exec:[{x:f.fx+10,y:F.exec},{x:f.fx+f.fw/2,y:F.exec},{x:f.fx+f.fw-10,y:F.exec}],work:[{x:m.fx+10,y:F.work},{x:m.fx+m.fw/2,y:F.work},{x:m.fx+m.fw-10,y:F.work}],meet:[{x:d.fx+10,y:F.meet},{x:d.fx+d.fw/2,y:F.meet},{x:d.fx+d.fw-10,y:F.meet}],comm:[{x:g.fx+10,y:F.comm},{x:g.fx+g.fw/2,y:F.comm},{x:g.fx+g.fw-10,y:F.comm}]},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}],U=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(f.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"L",canvasW:360,canvasH:260,rooms:y,desks:b,doors:A,adjacency:M,corridorY:F,waypoints:L,wallDecorations:O,furniture:U}}const xE=2;function Eg(t,l){return l?l==="L"&&t<=12-xE?"M":l==="M"&&t>12?"L":l:t<=12?"M":"L"}function Ng(t,l){switch(l??Eg(t)){case"S":return dE(t);case"M":return hE(t);case"L":return mE(t)}}function D0(t,l){if(!l||Object.keys(l).length===0)return t;const r=i=>i.map(c=>{const u=l[c.id];return u?{...c,offsetX:u.offsetX,offsetY:u.offsetY}:c});return{...t,wallDecorations:r(t.wallDecorations),furniture:r(t.furniture)}}function z0(t,l){if(l)for(const[r,i]of Object.entries(l))t[r]&&(t[r]={...t[r],dx:i.dx,dy:i.dy})}function zd(t,l){if(!l||l.length===0)return t;const r=new Set(l);return{...t,wallDecorations:t.wallDecorations.filter(i=>!r.has(i.id)),furniture:t.furniture.filter(i=>!r.has(i.id))}}function M0(t,l){if(!l||l.length===0)return t;const r=[],i=[];for(const c of l)c.zone==="wall"?r.push(c):i.push(c);return{...t,wallDecorations:[...t.wallDecorations,...r],furniture:[...t.furniture,...i]}}let Cs;function pE(t){Cs=t}function $(t,l,r,i,c,u){t=Math.round(t),l=Math.round(l),!(u!==void 0&&u<.01)&&(u!==void 0&&u!==1&&(Cs.globalAlpha=u),Cs.fillStyle=c,Cs.fillRect(t,l,r,i),u!==void 0&&u!==1&&(Cs.globalAlpha=1))}function tt(t,l,r,i){$(t,l,1,1,r,i)}let kc=1;function hi(t){kc=t}function Cl(){return kc=kc*16807%2147483647,(kc&65535)/65535}function Ag(t){const l=parseInt(t.slice(1,3),16)/255,r=parseInt(t.slice(3,5),16)/255,i=parseInt(t.slice(5,7),16)/255,c=Math.max(l,r,i),u=Math.min(l,r,i);let f=0,m=0;const x=(c+u)/2;if(c!==u){const d=c-u;m=x>.5?d/(2-c-u):d/(c+u),c===l?f=((r-i)/d+(r<i?6:0))/6:c===r?f=((i-l)/d+2)/6:f=((l-r)/d+4)/6}return[f*360,m*100,x*100]}function Tg(t,l,r){t=(t%360+360)%360,l=Math.max(0,Math.min(100,l))/100,r=Math.max(0,Math.min(100,r))/100;const i=l*Math.min(r,1-r),c=f=>{const m=(f+t/30)%12;return r-i*Math.max(-1,Math.min(m-3,9-m,1))},u=f=>Math.round(f*255).toString(16).padStart(2,"0");return"#"+u(c(0))+u(c(8))+u(c(4))}function El(t,l=1){const[r,i,c]=Ag(t);return Tg(r+15*l,Math.min(100,i+8),c-12*l)}function qt(t,l=1){const[r,i,c]=Ag(t);return Tg(r-10*l,i-3,c+10*l)}const an={hi:"#D4AA5C",base:"#B08040",sh:"#7A5038",deep:"#4E3028"},jl={hi:"#8A6848",base:"#604832",sh:"#3A2E24",deep:"#2A1E18"},wl={hi:"#5A6A80",base:"#485868",sh:"#364858",deep:"#283848"},qr="#100A06";function yE(t,l,r=14,i=12){$(t,l,r,i,"#4A3828"),$(t+1,l+1,r-2,i-2,"#5A4838"),$(t+2,l+2,r-4,i-4,"#4A7098"),$(t+2,l+2,r-4,Math.floor((i-4)/2),"#6A90B8",.35);const c=Math.floor(r/2);$(t+c,l+1,1,i-2,"#4A3828"),$(t+1,l+Math.floor(i/2),r-2,1,"#4A3828",.5),tt(t+3,l+3,"#8AB8E8",.35),tt(t+c+2,l+3,"#8AB8E8",.25),$(t-1,l+i,r+2,2,"#5A4838"),$(t-1,l+i,r+2,1,qt("#5A4838",.5),.35)}function gE(t,l,r){$(t,l,10,8,"#3A2818"),$(t+1,l+1,8,6,r),$(t+2,l+2,4,3,qt(r,1.2),.3),tt(t+3,l+2,qt(r,2),.25)}function bE(t,l){$(t,l,7,7,"#3A2818"),$(t+1,l+1,5,5,"#F0EDE5"),tt(t+3,l+1,"#AAA"),tt(t+3,l+5,"#AAA"),tt(t+1,l+3,"#AAA"),tt(t+5,l+3,"#AAA"),tt(t+3,l+3,"#222"),$(t+3,l+1,1,2,"#333"),tt(t+4,l+3,"#D32F2F")}function vE(t,l){$(t,l,26,16,"#586878"),$(t+1,l+1,24,13,"#ECEFF1"),$(t+1,l+1,24,1,"#F5F5F5",.4),$(t+3,l+3,14,1,"#1565C0",.6),$(t+3,l+5,18,1,"#333",.2),$(t+3,l+7,12,1,"#D32F2F",.35),$(t+3,l+9,16,1,"#333",.15),$(t+1,l+14,24,2,"#708898"),$(t+3,l+14,3,1,"#D32F2F"),$(t+7,l+14,3,1,"#1565C0"),$(t+11,l+14,3,1,"#2E7D32")}function wE(t,l){$(t,l,22,16,"#6A5030"),$(t+1,l+1,20,14,"#C4A66A"),hi(88);for(let r=0;r<14;r++)for(let i=0;i<20;i++)Cl()>.5&&tt(t+1+i,l+1+r,Cl()>.5?"#B89858":"#D4B87A",.18);$(t+2,l+2,5,4,"#FFF176"),$(t+8,l+2,5,4,"#90CAF9"),$(t+14,l+3,5,4,"#CE93D8"),$(t+3,l+8,7,4,"#C8E6C9"),$(t+11,l+8,8,4,"#F8BBD0"),tt(t+4,l+2,"#E53935"),tt(t+10,l+2,"#1E88E5"),tt(t+16,l+3,"#FF9800")}function kE(t,l){$(t,l,20,3,"#5A4030"),$(t,l,20,1,qt("#5A4030",.5),.35),$(t,l+2,20,1,El("#5A4030",.5),.3),$(t+2,l-4,3,4,"#E53935"),$(t+2,l-4,3,1,qt("#E53935",1),.3),$(t+6,l-3,2,3,"#1E88E5"),$(t+9,l-5,4,5,"#43A047"),$(t+14,l-3,3,3,"#FFD54F"),tt(t+15,l-3,"#FFF176",.4)}function SE(t,l){$(t,l,16,12,"#1E1E28"),$(t+1,l+1,14,9,"#0C1420"),$(t+2,l+2,12,1,"#EF4444",.6),tt(t+2,l+4,"#4CAF50"),$(t+4,l+4,7,1,"#8b949e",.4),tt(t+2,l+6,"#FF9800"),$(t+4,l+6,5,1,"#8b949e",.3),tt(t+2,l+8,"#42A5F5"),$(t+4,l+8,8,1,"#8b949e",.25),$(t+7,l+10,2,2,"#1E1E28"),$(t+5,l+11,6,1,"#586878")}function jE(t,l,r){$(t+2,l+20,22,2,qr,.15),$(t,l,22,20,jl.deep),$(t+1,l+1,20,18,jl.base),$(t,l,22,1,jl.hi,.35),$(t,l,1,20,jl.hi,.2);for(const u of[6,12])$(t+1,l+u,20,2,jl.sh),$(t+1,l+u,20,1,jl.hi,.2);const i=["#E53935","#1E88E5","#43A047","#8E24AA","#FB8C00","#00897B","#5C6BC0"];let c=t+2;for(let u=0;u<5;u++){const f=2+u%2;$(c,l+1,f,5,i[u]),$(c,l+1,f,1,qt(i[u],1),.35),c+=f+1}c=t+2;for(let u=0;u<4;u++)$(c,l+7,4,5,i[u+3]),$(c,l+7,4,1,qt(i[u+3],1),.25),c+=5;$(t+2,l+14,4,4,"#FFD54F"),$(t+8,l+14,7,4,"#90CAF9"),r&&$(t,l-1,22,1,r,.7)}function CE(t,l){$(t+2,l+11,6,2,qr,.1),$(t+2,l+8,6,4,"#8B5E3C"),$(t+1,l+7,8,2,El("#A06E48",.3)),$(t+2,l+7,6,1,qt("#A06E48",.5),.4),$(t+1,l+3,3,4,"#2E7D32"),$(t+5,l+2,3,4,"#2E7D32"),$(t+2,l+1,4,4,"#43A047"),$(t+3,l+0,3,3,"#66BB6A"),tt(t+4,l,"#81C784"),tt(t+3,l+1,"#A5D6A7",.4)}function EE(t,l){ma(t+4,l-4,"down"),ma(t+16,l-4,"down"),ma(t+28,l-4,"down"),$(t+3,l+24,34,3,qr,.15),$(t,l+2,36,18,an.deep),$(t+1,l+3,34,16,an.base),$(t+1,l+3,34,1,an.hi,.35);for(let r=0;r<14;r+=3)$(t+1,l+4+r,34,1,El(an.base,.2),.08);$(t,l+20,36,4,an.deep),$(t+1,l+21,34,2,an.sh),$(t+6,l+7,10,6,"#1A1A24"),$(t+7,l+8,8,4,"#0C1420"),$(t+8,l+9,4,1,"#2A6898",.4),$(t+20,l+8,6,4,"#F0F0F0"),$(t+15,l+7,3,3,"#ECEFF1"),tt(t+16,l+8,"#795548"),ma(t+4,l+24,"up"),ma(t+16,l+24,"up"),ma(t+28,l+24,"up")}function NE(t,l){$(t+2,l+16,36,3,qr,.15),$(t,l,36,5,"#5D4037"),$(t+1,l+1,34,3,"#6D4C41"),$(t+1,l+1,34,1,qt("#6D4C41",.5),.3),$(t,l+5,36,8,"#5D4037"),$(t+2,l+6,15,6,"#6D4C41"),$(t+3,l+6,13,1,qt("#6D4C41",.5),.35),$(t+19,l+6,15,6,"#6D4C41"),$(t+20,l+6,13,1,qt("#6D4C41",.5),.35),$(t+17,l+6,2,6,"#5D4037"),$(t,l+13,36,3,El("#5D4037",1)),$(t-2,l+2,3,12,"#5D4037"),$(t+35,l+2,3,12,"#5D4037"),$(t+4,l+7,6,4,"#FF8A65"),$(t+5,l+7,4,1,qt("#FF8A65",1),.35)}function AE(t,l){$(t+2,l+10,22,2,qr,.12),$(t,l,22,8,jl.deep),$(t+1,l+1,20,6,jl.base),$(t+1,l+1,20,1,jl.hi,.3),$(t,l+8,22,2,jl.sh),$(t+3,l+2,6,4,"#F0F0F0"),$(t+13,l+3,3,3,"#ECEFF1"),tt(t+14,l+4,"#795548")}function TE(t,l){$(t+1,l+14,10,2,qr,.12),$(t,l,10,14,"#546E7A"),$(t,l,10,1,qt("#546E7A",1),.35),$(t+1,l+1,8,3,"#78909C"),$(t+1,l+5,8,4,"#37474F"),tt(t+2,l+6,"#EF5350"),tt(t+4,l+6,"#66BB6A"),$(t+2,l+11,4,2,"#ECEFF1")}function DE(t,l){$(t+2,l+16,26,3,qr,.18),$(t,l,26,10,an.deep),$(t+1,l+1,24,8,an.base),$(t+1,l+2,24,1,an.hi,.2),$(t+1,l+4,24,1,El(an.base,.2),.1),$(t+1,l+6,24,1,an.hi,.15),$(t+1,l+1,24,1,an.hi,.4),$(t+1,l+1,1,8,an.hi,.2),$(t,l+10,26,5,an.deep),$(t+1,l+11,24,3,an.sh),$(t+1,l+10,24,1,El(an.base,1.5),.4),$(t+1,l+14,24,1,an.base,.15),$(t+2,l+12,10,1,an.deep,.4),$(t+14,l+12,10,1,an.deep,.4),tt(t+7,l+11,"#C8D0D8",.6),tt(t+19,l+11,"#C8D0D8",.6),$(t+6,l-5,14,7,"#1E1E28"),$(t+7,l-4,12,5,"#0C1420"),$(t+8,l-3,5,1,"#2A6898",.6),$(t+8,l-2,8,1,"#1A3858",.4),$(t+8,l-1,3,1,"#2A6898",.35),tt(t+7,l-4,"#4A98D8",.25),tt(t+12,l+1,"#4CAF50",.4),$(t+12,l+2,2,3,"#586878"),$(t+10,l+4,6,1,"#8898A8"),$(t+6,l+4,12,4,"#222228"),$(t+6,l+4,12,1,"#333338",.4);for(let r=0;r<5;r++)tt(t+7+r*2,l+5,"#444",.6),tt(t+7+r*2,l+6,"#3A3A3E",.4);$(t+20,l+5,3,4,"#333338"),$(t+20,l+5,3,1,"#444448"),$(t+1,l+3,4,4,"#F0EDE8"),$(t+1,l+3,4,1,"#F8F6F2"),tt(t+2,l+5,"#6D4C41")}function ma(t,l,r){$(t+1,l+9,10,2,qr,.1),tt(t+5,l+9,"#1E1E22"),tt(t+1,l+10,"#1A1A1E"),tt(t+9,l+10,"#1A1A1E"),tt(t+3,l+11,"#1A1A1E"),tt(t+7,l+11,"#1A1A1E"),$(t+1,l+2,8,6,wl.base),$(t+2,l+3,6,4,wl.hi,.35),$(t+2,l+3,6,1,qt(wl.hi,.5),.25),$(t+1,l+7,8,1,wl.deep),r==="up"?($(t,l+7,10,3,wl.deep),$(t+1,l+8,8,1,wl.sh)):($(t,l-1,10,3,wl.deep),$(t+1,l,8,1,wl.sh)),$(t,l+3,1,4,wl.sh),$(t+9,l+3,1,4,wl.sh)}const Dg={bookshelf:(t,l,r)=>jE(t,l,r.accent),plant:(t,l)=>CE(t,l),"meeting-table":(t,l)=>EE(t,l),sofa:(t,l)=>NE(t,l),"coffee-table":(t,l)=>AE(t,l),"coffee-machine":(t,l)=>TE(t,l),window:(t,l,r)=>yE(t,l,r.windowW??16,r.windowH??14),picture:(t,l,r)=>gE(t,l,r.pictureColor??"#1565C0"),clock:(t,l)=>bE(t,l),whiteboard:(t,l)=>vE(t,l),"bulletin-board":(t,l)=>wE(t,l),shelf:(t,l)=>kE(t,l),screen:(t,l)=>SE(t,l)};function ui(t,l){const r=t.zone==="wall"?l.wx:l.fx,i=t.zone==="wall"?l.wy:l.fy;return{x:t.anchorX==="right"?(t.zone==="wall"?l.wx+l.ww:l.fx+l.fw)+t.offsetX:r+t.offsetX,y:i+t.offsetY}}function zE(t){for(const l of t.wallDecorations){const r=t.rooms[l.room];if(!r)continue;const{x:i,y:c}=ui(l,r),u=Dg[l.type];u&&u(i,c,l)}}function ME(t,l,r){for(const i of t.furniture){const c=t.rooms[i.room];if(!c||i.condition==="no-desks"&&r.has(i.room))continue;const{x:u,y:f}=ui(i,c),m=Dg[i.type];m&&l.push({y:f,draw:()=>m(u,f,i)})}}function Lr(t){const l=[],r=[...t.wallDecorations,...t.furniture];for(const i of r){if(!i.facility)continue;const c=t.rooms[i.room];if(!c)continue;const{x:u,y:f}=ui(i,c);l.push({id:i.facility.id,label:i.facility.label,icon:i.facility.icon,color:i.facility.color,dx:u,dy:f,pw:i.facility.hitW,ph:i.facility.hitH})}return l}const FE={bookshelf:{w:22,h:20},plant:{w:10,h:12},"meeting-table":{w:36,h:28},sofa:{w:38,h:16},"coffee-table":{w:22,h:10},"coffee-machine":{w:10,h:14},window:{w:16,h:14},picture:{w:10,h:8},clock:{w:7,h:7},whiteboard:{w:26,h:16},"bulletin-board":{w:22,h:16},shelf:{w:20,h:8},screen:{w:16,h:12}};function eh(t){return FE[t]??{w:16,h:16}}function Md(t,l,r,i){for(let c=t.furniture.length-1;c>=0;c--){const u=t.furniture[c],f=t.rooms[u.room];if(!f||u.condition==="no-desks"&&i.has(u.room))continue;const{x:m,y:x}=ui(u,f),d=eh(u.type);if(l>=m&&l<=m+d.w&&r>=x&&r<=x+d.h)return u.id}for(let c=t.wallDecorations.length-1;c>=0;c--){const u=t.wallDecorations[c],f=t.rooms[u.room];if(!f)continue;const{x:m,y:x}=ui(u,f),d=eh(u.type);if(l>=m&&l<=m+d.w&&r>=x&&r<=x+d.h)return u.id}return null}function F0(t,l,r,i,c){const f=[...l.wallDecorations,...l.furniture].find(y=>y.id===r);if(!f||f.condition==="no-desks"&&c.has(f.room))return;const m=l.rooms[f.room];if(!m)return;const{x,y:d}=ui(f,m),g=eh(f.type);t.save(),t.fillStyle=i,t.globalAlpha=.2,t.fillRect(x-1,d-1,g.w+2,g.h+2),t.globalAlpha=.9,t.strokeStyle=i,t.lineWidth=1,t.strokeRect(x-.5,d-.5,g.w+1,g.h+1),t.restore()}function R0(t,l,r,i){t.save(),t.fillStyle=i,t.globalAlpha=.2,t.fillRect(l-1,r-1,28,42),t.globalAlpha=.9,t.strokeStyle=i,t.lineWidth=1,t.strokeRect(l-.5,r-.5,27,41),t.restore()}function _0(t,l,r){for(const[i,c]of Object.entries(t))if(l>=c.dx&&l<=c.dx+26&&r>=c.dy&&r<=c.dy+40)return i;return null}const RE=[{type:"plant",zone:"floor",label:"Plant",icon:"🪴"},{type:"bookshelf",zone:"floor",label:"Bookshelf",icon:"📚"},{type:"sofa",zone:"floor",label:"Sofa",icon:"🛋️"},{type:"coffee-table",zone:"floor",label:"Coffee Table",icon:"☕"},{type:"coffee-machine",zone:"floor",label:"Coffee Machine",icon:"☕"},{type:"meeting-table",zone:"floor",label:"Meeting Table",icon:"🪑"},{type:"window",zone:"wall",label:"Window",icon:"🪟"},{type:"picture",zone:"wall",label:"Picture",icon:"🖼️"},{type:"clock",zone:"wall",label:"Clock",icon:"🕐"},{type:"whiteboard",zone:"wall",label:"Whiteboard",icon:"📋"},{type:"shelf",zone:"wall",label:"Shelf",icon:"📦"},{type:"screen",zone:"wall",label:"Screen",icon:"🖥️"}],pc=16,_E=4,ha=4,Sc=2,pt=4,$r=4;let Oe=Ng(7);const Rc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};let fl=Lr(Oe);function zg(t){return{x:t.dx,y:t.dy,w:t.pw,h:t.ph}}function Mg(t){return{cx:t.dx+t.pw/2,botY:t.dy+t.ph}}let Kt={};function OE(t){const l={};for(let r=0;r<t.length&&r<Oe.desks.length;r++)l[t[r]]=Oe.desks[r];return l}let Bt,ya=null,xa=null,nr=!1,dl=null,Gn=null,pn=null,rn=null,ai=null,kl=null;function BE(t,l){const{wx:r,wy:i,ww:c,wh:u,wallColor:f,baseboardColor:m}=t,x=El(f,.5),d=qt(f,.5),g=[];if(l){const y=l.x-r,b=l.w;y>0&&g.push({sx:r,sw:y}),y+b<c&&g.push({sx:l.x+b,sw:c-y-b})}else g.push({sx:r,sw:c});for(const y of g){$(y.sx,i,y.sw,u,f);for(let b=0;b<u;b+=4)$(y.sx,i+b,y.sw,1,d,.08),$(y.sx,i+b+2,y.sw,1,x,.05);hi(Math.round(y.sx*7+i*13));for(let b=0;b<y.sw;b+=3)Cl()>.4&&$(y.sx+b,i,1,u,d,.04);$(y.sx,i,y.sw,2,d,.3),$(y.sx,i,y.sw,1,qt(f,1),.2),$(y.sx,i+u-2,y.sw,2,x,.3),$(y.sx,i+u,y.sw,Sc,m),$(y.sx,i+u,y.sw,1,qt(m,.5),.4)}l&&($(l.x-1,i,1,u+Sc,"#4A3828"),$(l.x+l.w,i,1,u+Sc,"#4A3828"),$(l.x,i,l.w,1,"#0A0808",.12)),$(t.fx,t.fy,t.fw,3,"#0A0808",.12),$(t.fx,t.fy+3,t.fw,2,"#0A0808",.06)}function LE(t){const l="#504038",r=El(l,.5),i=qt(l,.5),c=t.wx-$r,u=t.wy,f=t.wh+Sc+t.fh;$(c,u,$r,f,l),$(c,u,1,f,i,.3),$(c+$r-1,u,1,f,r,.4);for(let x=0;x<f;x+=6)$(c+1,u+x,$r-2,1,i,.06);const m=t.wx+t.ww;$(m,u,$r,f,l),$(m,u,1,f,i,.2),$(m+$r-1,u,1,f,r,.3)}function Fd(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#B08040",f="#C89848",m="#8A6030",x="#6A4820";$(l,r,i,c,u),hi(42);for(let d=0;d<c;d+=5){const g=Math.floor(d/5)%2*10;for(let y=-10;y<i+10;y+=20){const b=l+y+g,v=Math.max(l,b),j=Math.min(b+19,l+i)-v;if(j<=0)continue;const S=Cl()>.5?f:u;$(v,r+d,j,4,S,.25),$(v,r+d,j,1,f,.3),$(v,r+d+4,j,1,x,.35),b>=l&&b<l+i&&$(b,r+d,1,4,x,.2),$(v,r+d+2,j,1,m,.1)}}$(l,r,i,2,"#0A0808",.08),$(l,r,2,c,"#0A0808",.06)}function O0(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#1C2A38",f="#101820";hi(99),$(l,r,i,c,u);for(let m=0;m<c;m+=pc)for(let x=0;x<i;x+=pc){const d=Math.min(pc,i-x),g=Math.min(pc,c-m);Cl()>.5&&$(l+x,r+m,d,g,qt(u,.2),.15),$(l+x+2,r+m+2,d-4,g-4,qt(u,.3),.08),$(l+x,r+m,d,1,f,.5),$(l+x,r+m,1,g,f,.5),$(l+x+1,r+m+1,1,g-1,qt(u,.4),.1),Cl()>.85&&tt(l+x+4+Math.floor(Cl()*8),r+m+4+Math.floor(Cl()*8),"#3A6A9A",.08)}}function $E(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#387848",f="#4A9058",m="#285E38";$(l,r,i,c,u),hi(77);for(let d=0;d<c;d+=2)for(let g=0;g<i;g+=2)Cl()>.5&&tt(l+g,r+d,f,.1),Cl()>.8&&tt(l+g+1,r+d+1,m,.12);const x=5;$(l+x,r+x,i-x*2,1,f,.45),$(l+x,r+c-x-1,i-x*2,1,m,.45),$(l+x,r+x,1,c-x*2,f,.35),$(l+i-x-1,r+x,1,c-x*2,m,.35)}function HE(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#D8C490",f="#B09060",m="#907848";hi(55);for(let x=0;x<c;x+=8)for(let d=0;d<i;d+=8){const g=Math.min(8,i-d),y=Math.min(8,c-x),b=(d/8+x/8)%2===0?f:u;$(l+d,r+x,g,y,b),$(l+d+1,r+x+1,g-2,1,qt(b,.4),.2),$(l+d+1,r+x+1,1,y-2,qt(b,.4),.15),$(l+d+g-2,r+x+2,1,y-3,El(b,.4),.15),$(l+d+2,r+x+y-2,g-3,1,El(b,.4),.15),$(l+d,r+x,g,1,m,.3),$(l+d,r+x,1,y,m,.3)}}function UE(){const{canvasW:t,canvasH:l,rooms:r,doors:i}=Oe,c="#2A1E14",u="#3A2E24";if($(0,0,t,ha,c),$(0,l-ha,t,ha,c),$(0,0,ha,l,c),$(t-ha,0,ha,l,c),$(0,0,t,1,u,.3),$(0,0,1,l,u,.2),!r.exec||!r.work||!r.meet||!r.comm)return;const f=r.exec,m=r.meet,x=t/2,d=x-pt/2,g=f.fy+f.fh,y=i.exec_work,b=i.meet_comm,v=i.exec_meet,j=i.work_comm,S=24,E=28,C=((y==null?void 0:y.doorY)??f.fy+20)-S/2,A=((v==null?void 0:v.doorX)??ha+$r+54)-E/2,M=((j==null?void 0:j.doorX)??x+pt/2+$r+54)-E/2,F=((b==null?void 0:b.doorY)??m.fy+20)-S/2;$(0,g,A,pt,c),$(A+E,g,d-A-E,pt,c),$(d+pt,g,M-d-pt,pt,c),$(M+E,g,t-M-E,pt,c),$(0,g,A,1,u,.3),$(A+E,g,d-A-E,1,u,.3),$(d+pt,g,M-d-pt,1,u,.3),$(M+E,g,t-M-E,1,u,.3),$(d,0,pt,C,c),$(d,C+S,pt,g-C-S,c),$(d,g+pt,pt,F-g-pt,c),$(d,F+S,pt,l-F-S,c),$(d,0,1,C,u,.2),$(d,C+S,1,g-C-S,u,.2),$(d,g+pt,1,F-g-pt,u,.2),$(d,F+S,1,l-F-S,u,.2),$(d,C,pt,S,"#C4A070"),$(d+pt/2,C,pt/2,S,"#3A4858"),$(d,F,pt,S,"#7AA880"),$(d+pt/2,F,pt/2,S,"#C8B890");const L="#4A3828";$(d,C-1,pt,1,L),$(d,C+S,pt,1,L),$(A-1,g,1,pt,L),$(A+E,g,1,pt,L),$(M-1,g,1,pt,L),$(M+E,g,1,pt,L),$(d,F-1,pt,1,L),$(d,F+S,pt,1,L)}const B0=new Map;function IE(t){const l=`${t.hairStyle??""}|${t.outfitStyle??""}|${t.accessory??""}`;let r=B0.get(l);if(!r){const i=Qd("mini-seated:default"),c=sg(i,t);r=c?c.layers.flatMap(u=>u.pixels):[],B0.set(l,r)}return r}function YE(t,l,r){Wd(Bt,IE(r),t,l,r)}function qE(t,l,r,i,c){ma(t+8,l+20,"up"),c||YE(t+8,l+0+i,r),DE(t,l+14)}function XE(t,l,r,i,c){const u=i in T0?i:"down",f=c%4,m=T0[u][f];Wd(Bt,m,t,l,r);const x=f===1||f===3?-1:0;if(r.accessory&&r.accessory!=="none"){const d=_S(r.accessory,u);d&&d.pixels.length>0&&Wd(Bt,d.pixels,t,l+x,r)}Bt.globalAlpha=1}function VE(t){const l={};let r=0;for(const i of t){const c=Kt[i];c&&(l[i]={state:"sitting",homeX:c.dx+8,homeY:c.dy+34,homeRoom:c.room,x:c.dx+8,y:c.dy+34,path:[],room:c.room,dir:"down",walkFrame:0,walkTimer:0,bobY:0,bobOff:r*17,stateTimer:600+Math.floor(Math.random()*900)},r++)}return l}function Ds(t,l,r,i,c){const u=Oe.corridorY[c]??l,f=[];return l<u-4&&f.push({x:t,y:u}),Math.abs(t-r)>4&&f.push({x:r,y:u}),f.push({x:r,y:i}),f}function Rd(t,l,r,i){const c=Oe.adjacency[r];if(!c)return[];const u=c.find(g=>g.room===i);if(!u)return[];const f=Oe.doors[u.door];if(!f)return[];const m=[],x=Oe.corridorY[r]??l,d=Oe.corridorY[i]??l;if(Math.abs(l-x)>4&&m.push({x:t,y:x}),f.type==="v"){const g=u.side==="A"?f.xA:f.xB,y=u.side==="A"?f.xB:f.xA;m.push({x:g,y:x}),m.push({x:g,y:f.doorY}),m.push({x:y,y:f.doorY}),m.push({x:y,y:d})}else{const g=u.side==="A"?f.yA:f.yB,y=u.side==="A"?f.yB:f.yA;m.push({x:f.doorX,y:x}),m.push({x:f.doorX,y:g}),m.push({x:f.doorX,y}),m.push({x:f.doorX,y:d})}return m}function Fg(t,l){const r=Oe.adjacency[t.room];if(!r)return[];if(!r.find(c=>c.room===l)){for(const c of r){const u=Oe.adjacency[c.room];if(u!=null&&u.find(f=>f.room===l)){const f=Rd(t.x,t.y,t.room,c.room),m=f[f.length-1],x=Rd((m==null?void 0:m.x)??t.x,(m==null?void 0:m.y)??t.y,c.room,l);return[...f,...x]}}return[]}return Rd(t.x,t.y,t.room,l)}function GE(t){if(t.room!==t.homeRoom){const l=Fg({...t},t.homeRoom),r=l[l.length-1],i=Ds((r==null?void 0:r.x)??t.x,(r==null?void 0:r.y)??t.y,t.homeX,t.homeY,t.homeRoom);return[...l,...i]}return Ds(t.x,t.y,t.homeX,t.homeY,t.room)}function KE(t,l){for(const[,r]of Object.entries(t))if(r.stateTimer--,r.state==="sitting"){if(r.bobY=(l+r.bobOff)%60<30?1:0,r.stateTimer<=0){r.state="walking",r.x=r.homeX,r.y=r.homeY,r.room=r.homeRoom;const i=Object.keys(Oe.rooms);if(Math.random()<.25&&i.length>1){const c=i.filter(x=>x!==r.room),u=c[Math.floor(Math.random()*c.length)],f=Fg(r,u),m=Oe.waypoints[u];if(m&&m.length>0){const x=m[Math.floor(Math.random()*m.length)],d=f[f.length-1]??{x:r.x,y:r.y},g=Ds(d.x,d.y,x.x,x.y,u);r.path=[...f,...g]}else r.path=f;r.walkTimer=0}else{const c=Oe.waypoints[r.room];if(c&&c.length>0){const u=c[Math.floor(Math.random()*c.length)];r.path=Ds(r.x,r.y,u.x,u.y,r.room)}r.walkTimer=0}}}else if(r.state==="walking"||r.state==="returning"){if(r.path.length===0){r.state==="returning"?(r.state="sitting",r.room=r.homeRoom,r.stateTimer=800+Math.floor(Math.random()*1200)):(r.state="idle",r.dir="down",r.stateTimer=180+Math.floor(Math.random()*360));continue}const i=r.path[0],c=i.x-r.x,u=i.y-r.y,f=Math.sqrt(c*c+u*u);if(f<1.5){r.x=i.x,r.y=i.y,r.path.shift();for(const[m,x]of Object.entries(Oe.rooms))if(r.x>=x.fx&&r.x<=x.fx+x.fw&&r.y>=x.fy&&r.y<=x.fy+x.fh){r.room=m;break}}else r.x+=c/f*.2,r.y+=u/f*.2,Math.abs(c)>Math.abs(u)?r.dir=c>0?"right":"left":r.dir=u>0?"down":"up",r.walkTimer++,r.walkFrame=Math.floor(r.walkTimer/12)%4}else if(r.state==="idle"&&r.stateTimer<=0)if(Math.random()<.3){r.state="walking";const i=Oe.waypoints[r.room];if(i&&i.length>0){const c=i[Math.floor(Math.random()*i.length)];r.path=Ds(r.x,r.y,c.x,c.y,r.room)}r.walkTimer=0}else r.state="returning",r.path=GE(r),r.walkTimer=0}function QE(t,l,r){const{canvasW:i,canvasH:c,rooms:u}=Oe;Bt.clearRect(0,0,i,c),$(0,0,i,c,"#2A1E14");const f={wood:Fd,dark:O0,carpet:$E,tile:HE};for(const y of Object.values(u))(f[y.floorType]??Fd)(y);const m=Object.keys(u);if(m.length>=4){const y=u.exec,b=u.meet,{doors:v}=Oe;if(y&&b&&v.exec_meet&&v.work_comm){const S=(v.exec_meet.doorX??0)-14,E=(v.work_comm.doorX??0)-28/2,C=y.fy+y.fh,A=b.fy;Fd({fx:S,fy:C,fw:28,fh:A-C}),O0({fx:E,fy:C,fw:28,fh:A-C})}}const x={};if(m.length>=4){const{doors:y}=Oe,b=28,v=y.exec_meet,j=y.work_comm;v!=null&&v.doorX&&(x.meet={x:v.doorX-b/2,w:b}),j!=null&&j.doorX&&(x.comm={x:j.doorX-b/2,w:b})}for(const y of Object.values(u))BE(y,x[y.id]),LE(y);UE(),zE(Oe);const d=[],g=new Set(Object.values(Kt).map(y=>y.room));ME(Oe,d,g);for(const[y,b]of Object.entries(Kt)){const v=t[y];if(!v)continue;const j=v.state==="sitting",S=l(y),E=r[y]==="working";d.push({y:b.dy+14,draw:()=>{if(qE(b.dx,b.dy,S,j?v.bobY:0,!j),j&&E){const C=Rc[y]??"#388bfd";$(b.dx+7,b.dy+14-4,12,5,C,.15),tt(b.dx+12,b.dy+14+1,"#4CAF50",.8)}}})}for(const[y,b]of Object.entries(t))if(b.state!=="sitting"){const v=l(y);d.push({y:b.y+14,draw:()=>XE(Math.round(b.x),Math.round(b.y),v,b.dir,b.walkFrame)})}d.sort((y,b)=>y.y-b.y);for(const y of d)y.draw();for(const y of fl){const b=xa===y.id,v=Mg(y);if(Bt.save(),Bt.globalAlpha=b?.9:.5,Bt.fillStyle=y.color,Bt.fillRect(v.cx-1,v.botY-2,3,3),b){const j=zg(y);Bt.globalAlpha=.3,Bt.strokeStyle=y.color,Bt.lineWidth=1,Bt.strokeRect(j.x-1,j.y-1,j.w+2,j.h+2)}Bt.restore()}if(nr){const y=new Set(Object.values(Kt).map(b=>b.room));if(dl&&dl!==Gn)if(dl.startsWith("desk:")){const b=dl.slice(5),v=Kt[b];v&&R0(Bt,v.dx,v.dy,"#FBBF24")}else F0(Bt,Oe,dl,"#FBBF24",y);if(Gn)if(Gn.startsWith("desk:")){const b=Gn.slice(5),v=Kt[b];v&&R0(Bt,v.dx,v.dy,"#3B82F6")}else F0(Bt,Oe,Gn,"#3B82F6",y)}if(ya){const y=Kt[ya],b=t[ya];y&&b&&(Bt.save(),Bt.globalAlpha=.25,Bt.fillStyle=Rc[ya]??"#fff",b.state==="sitting"?Bt.fillRect(y.dx-1,y.dy+6,28,30):Bt.fillRect(Math.round(b.x)-1,Math.round(b.y)-1,14,24),Bt.restore())}}function WE({roles:t,projects:l,roleStatuses:r,activeExecs:i,onRoleClick:c,onProjectClick:u,onBulletinClick:f,onDecisionsClick:m,onKnowledgeClick:x,onSettingsClick:d,onThemeClick:g,onStatsClick:y,getRoleSpeech:b,getAppearance:v,onHireClick:j}){const S=k.useRef(null),E=k.useRef(null),C=k.useRef(null),A=k.useRef({}),M=k.useRef(0),F=k.useRef(_E),[L,O]=k.useState(!1),[U,X]=k.useState(null),[ne,D]=k.useState(null),Y=k.useRef({}),R=k.useRef({}),Q=k.useRef([]),ee=k.useRef([]);k.useEffect(()=>{nr=L},[L]),k.useEffect(()=>{ai=U,kl=ne},[U,ne]),k.useEffect(()=>{Ce.getPreferences().then(he=>{const G=he.furnitureOverrides;G&&Object.keys(G).length>0&&(Y.current=G,Oe=D0(Oe,G));const ie=he.deskOverrides;if(ie&&Object.keys(ie).length>0){R.current=ie,z0(Kt,ie);for(const[Ne,Fe]of Object.entries(Kt)){const Ae=A.current[Ne];Ae&&(Ae.homeX=Fe.dx+8,Ae.homeY=Fe.dy+34)}}const xe=he.removedFurniture;xe&&xe.length>0&&(Q.current=xe,Oe=zd(Oe,xe));const Te=he.addedFurniture;Te&&Te.length>0&&(ee.current=Te,Oe=M0(Oe,Te)),fl=Lr(Oe)}).catch(()=>{})},[]);const V=k.useRef({roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v});V.current={roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v};const I=k.useMemo(()=>t.map(he=>he.id),[t]),Z=k.useRef(Oe);k.useEffect(()=>{const he=I.length,G=Eg(he,Z.current.preset);let ie=Ng(he,G);Q.current.length>0&&(ie=zd(ie,Q.current)),ee.current.length>0&&(ie=M0(ie,ee.current)),Object.keys(Y.current).length>0&&(ie=D0(ie,Y.current)),Oe=ie,Z.current=ie,Kt=OE(I),Object.keys(R.current).length>0&&z0(Kt,R.current),fl=Lr(ie),A.current=VE(I);const xe=S.current;xe&&(xe.width=ie.canvasW,xe.height=ie.canvasH),we()},[I]);const ce=k.useCallback(he=>{var G,ie;return((ie=(G=V.current).getAppearance)==null?void 0:ie.call(G,he))??Eh(he)},[]),we=k.useCallback(()=>{const he=E.current,G=S.current;if(!he||!G)return;const ie=he.parentElement;if(!ie)return;const xe=ie.clientWidth,Te=ie.clientHeight;if(xe===0||Te===0)return;const{canvasW:Ne,canvasH:Fe}=Oe;let Ae=Math.floor(Math.min(xe/Ne,Te/Fe));Ae=Math.max(2,Math.min(Ae,5)),F.current=Ae,G.style.width=Ne*Ae+"px",G.style.height=Fe*Ae+"px",he.style.width=Ne*Ae+"px",he.style.height=Fe*Ae+"px"},[]);k.useEffect(()=>{var Fe;const he=S.current;if(!he)return;const G=he.getContext("2d");if(!G)return;Bt=G,pE(G),we();const ie=new ResizeObserver(()=>we()),xe=(Fe=E.current)==null?void 0:Fe.parentElement;xe&&ie.observe(xe);let Te;const Ne=()=>{M.current++,KE(A.current,M.current),QE(A.current,ce,V.current.roleStatuses),z(),Te=requestAnimationFrame(Ne)};return Te=requestAnimationFrame(Ne),()=>{cancelAnimationFrame(Te),ie.disconnect()}},[ce,we]),k.useEffect(()=>{const he=C.current;if(!he)return;he.innerHTML="";const G={};for(const xe of t)G[xe.id]=xe.name;for(const xe of I){const Te=Rc[xe]??"#8b949e",Ne=G[xe],Fe=Ne&&Ne.toLowerCase()!==xe.toLowerCase()?`${xe.toUpperCase()} · ${Ne}`:xe.toUpperCase(),Ae=document.createElement("div");Ae.className="td-nametag",Ae.dataset.role=xe;const Re=document.createElement("span");Re.className="td-dot",Re.style.background=Te,Ae.appendChild(Re),Ae.appendChild(document.createTextNode(Fe)),he.appendChild(Ae);const Ke=document.createElement("div");Ke.className="td-bubble",Ke.dataset.role=xe,Ke.dataset.type="bubble",he.appendChild(Ke)}const ie={meeting:()=>{const xe=l[0];xe?u(xe.id):f()},bulletin:f,decisions:m,knowledge:x,settings:d,theme:g,stats:y};for(const xe of fl){const Te=document.createElement("div");Te.className="td-facility-label",Te.dataset.facility=xe.id,Te.textContent=`${xe.icon} ${xe.label}`,Te.style.borderColor=`${xe.color}44`;const Ne=ie[xe.id];Ne&&Te.addEventListener("click",Ne),Te.addEventListener("mouseenter",()=>{xa=xe.id}),Te.addEventListener("mouseleave",()=>{xa=null}),he.appendChild(Te)}},[I,t,l,u,f,m,x,d,g,y]);const z=k.useCallback(()=>{var Fe;const he=C.current;if(!he)return;const G=F.current,ie=A.current,{getRoleSpeech:xe,roleStatuses:Te,activeExecs:Ne}=V.current;for(const Ae of Object.keys(ie)){const Re=ie[Ae],Ke=Kt[Ae];if(!Ke)continue;let Lt,gt,ht;Re.state==="sitting"?(Lt=Ke.dx+13,ht=Ke.dy+2,gt=Ke.dy+37):(Lt=Math.round(Re.x)+6,ht=Math.round(Re.y)-2,gt=Math.round(Re.y)+18);const Zt=Lt/Oe.canvasW*100,re=he.querySelector(`.td-nametag[data-role="${Ae}"]`);if(re){re.style.left=Zt+"%",re.style.top=gt*G+2+"px";const ze=re.querySelector(".td-dot");if(ze){const Ue=Te[Ae]==="working";ze.style.background=Ue?"#FBBF24":Rc[Ae]??"#8b949e",Ue?ze.style.animation="td-pulse 1s ease-in-out infinite":ze.style.animation=""}}const ye=he.querySelector(`.td-bubble[data-role="${Ae}"]`);if(ye){const ze=Te[Ae]==="working",Ue=(Fe=Ne.find(jt=>jt.roleId===Ae))==null?void 0:Fe.task,be=xe(Ae),je=ze&&Ue?Ue.slice(0,60):be?be.slice(0,60):"";je&&Re.state==="sitting"?(ye.style.display="",ye.style.left=Zt+"%",ye.style.top=(ht-10)*G+"px",ye.textContent=je):ye.style.display="none"}}for(const Ae of fl){const Re=he.querySelector(`.td-facility-label[data-facility="${Ae.id}"]`);if(Re){const Ke=Mg(Ae);Re.style.left=Ke.cx/Oe.canvasW*100+"%",Re.style.top=Ke.botY*G-4+"px",Re.classList.toggle("td-facility-label--hover",xa===Ae.id)}}},[]),B=k.useCallback(he=>{const G=S.current;if(!G)return null;const ie=G.getBoundingClientRect(),xe=F.current,Te=(he.clientX-ie.left)/xe,Ne=(he.clientY-ie.top)/xe,Fe=A.current;for(const[Ae,Re]of Object.entries(Kt)){if(!Fe[Ae])continue;const Ke=Fe[Ae];if(Ke.state==="sitting"){if(Te>=Re.dx&&Te<=Re.dx+26&&Ne>=Re.dy&&Ne<=Re.dy+40)return{type:"role",id:Ae}}else if(Te>=Ke.x-2&&Te<=Ke.x+14&&Ne>=Ke.y-2&&Ne<=Ke.y+20)return{type:"role",id:Ae}}for(const Ae of fl){const Re=zg(Ae);if(Te>=Re.x&&Te<=Re.x+Re.w&&Ne>=Re.y&&Ne<=Re.y+Re.h)return{type:"facility",id:Ae.id}}return null},[]),W=k.useCallback(he=>{const G=S.current;if(!G)return{mx:0,my:0};const ie=G.getBoundingClientRect(),xe=F.current;return{mx:(he.clientX-ie.left)/xe,my:(he.clientY-ie.top)/xe}},[]),T=k.useCallback(he=>{Ce.updatePreferences(he).catch(()=>{})},[]),me=k.useCallback(he=>{const G=[...Q.current,he];Q.current=G,Oe=zd(Oe,[he]),fl=Lr(Oe),Gn=null,dl=null,T({removedFurniture:G})},[T]),Se=k.useCallback((he,G)=>{if(!ai||!kl)return;let ie=null;for(const[Re,Ke]of Object.entries(Oe.rooms)){const Lt=kl==="wall"?Ke.wx:Ke.fx,gt=kl==="wall"?Ke.wy:Ke.fy,ht=kl==="wall"?Ke.ww:Ke.fw,Zt=kl==="wall"?Ke.wh:Ke.fh;if(he>=Lt&&he<=Lt+ht&&G>=gt&&G<=gt+Zt){ie=Re;break}}if(!ie)return;const xe=Oe.rooms[ie],Te=kl==="wall"?xe.wx:xe.fx,Ne=kl==="wall"?xe.wy:xe.fy,Fe={id:`user-${ai}-${Date.now()}`,type:ai,room:ie,zone:kl,offsetX:Math.round(he-Te),offsetY:Math.round(G-Ne)},Ae=[...ee.current,Fe];ee.current=Ae,kl==="wall"?Oe.wallDecorations.push(Fe):Oe.furniture.push(Fe),fl=Lr(Oe),T({addedFurniture:Ae}),X(null),D(null)},[T]),Ee=k.useCallback(he=>{const G=S.current;if(nr&&pn){const{mx:xe,my:Te}=W(he),Fe=[...Oe.furniture,...Oe.wallDecorations].find(Ke=>Ke.id===pn.defId);if(!Fe)return;const Ae=xe-pn.startMx,Re=Te-pn.startMy;Fe.offsetX=Math.round(pn.origOffX+Ae),Fe.offsetY=Math.round(pn.origOffY+Re),fl=Lr(Oe),G&&(G.style.cursor="grabbing");return}if(nr&&rn){const{mx:xe,my:Te}=W(he),Ne=Kt[rn.roleId];if(!Ne)return;Ne.dx=Math.round(rn.origDx+(xe-rn.startMx)),Ne.dy=Math.round(rn.origDy+(Te-rn.startMy));const Fe=A.current[rn.roleId];Fe&&(Fe.homeX=Ne.dx+8,Fe.homeY=Ne.dy+34),G&&(G.style.cursor="grabbing");return}if(nr){const{mx:xe,my:Te}=W(he);if(ai){G&&(G.style.cursor="crosshair");return}const Ne=new Set(Object.values(Kt).map(Ae=>Ae.room)),Fe=Md(Oe,xe,Te,Ne);if(Fe)dl=Fe;else{const Ae=_0(Kt,xe,Te);dl=Ae?`desk:${Ae}`:null}ya=null,xa=null,G&&(G.style.cursor=dl?"grab":"default");return}const ie=B(he);ya=(ie==null?void 0:ie.type)==="role"?ie.id:null,xa=(ie==null?void 0:ie.type)==="facility"?ie.id:null,dl=null,G&&(G.style.cursor=ie?"pointer":"default")},[B,W]),Be=k.useCallback(he=>{if(!nr)return;const{mx:G,my:ie}=W(he);if(ai){Se(G,ie),he.preventDefault();return}const xe=new Set(Object.values(Kt).map(Fe=>Fe.room)),Te=Md(Oe,G,ie,xe);if(Te){const Ae=[...Oe.furniture,...Oe.wallDecorations].find(Re=>Re.id===Te);Ae&&(Gn=Te,pn={defId:Te,startMx:G,startMy:ie,origOffX:Ae.offsetX,origOffY:Ae.offsetY},he.preventDefault());return}const Ne=_0(Kt,G,ie);if(Ne){const Fe=Kt[Ne];Gn=`desk:${Ne}`,rn={roleId:Ne,startMx:G,startMy:ie,origDx:Fe.dx,origDy:Fe.dy},he.preventDefault();return}Gn=null},[W,Se]),He=k.useCallback(he=>{if(pn){const ie=[...Oe.furniture,...Oe.wallDecorations].find(xe=>xe.id===pn.defId);if(ie){const xe={...Y.current,[ie.id]:{offsetX:ie.offsetX,offsetY:ie.offsetY}};Y.current=xe,T({furnitureOverrides:xe}),fl=Lr(Oe)}pn=null,S.current&&(S.current.style.cursor="grab");return}if(rn){const G=Kt[rn.roleId];if(G){const ie={...R.current,[rn.roleId]:{dx:G.dx,dy:G.dy}};R.current=ie,T({deskOverrides:ie})}rn=null,S.current&&(S.current.style.cursor="grab")}},[T]),Qe=k.useCallback(he=>{if(!nr)return;he.preventDefault();const{mx:G,my:ie}=W(he),xe=new Set(Object.values(Kt).map(Ne=>Ne.room)),Te=Md(Oe,G,ie,xe);Te&&me(Te)},[W,me]);k.useEffect(()=>{const he=G=>{!nr||!Gn||(G.key==="Delete"||G.key==="Backspace")&&(Gn.startsWith("desk:")||me(Gn))};return window.addEventListener("keydown",he),()=>window.removeEventListener("keydown",he)},[me]);const ke=k.useCallback(()=>{if(pn){const G=[...Oe.furniture,...Oe.wallDecorations].find(ie=>ie.id===pn.defId);G&&(G.offsetX=pn.origOffX,G.offsetY=pn.origOffY,fl=Lr(Oe)),pn=null}if(rn){const he=Kt[rn.roleId];he&&(he.dx=rn.origDx,he.dy=rn.origDy);const G=A.current[rn.roleId];G&&(G.homeX=he.dx+8,G.homeY=he.dy+34),rn=null}ya=null,xa=null,dl=null,S.current&&(S.current.style.cursor="default")},[]),yt=k.useCallback(he=>{if(nr)return;const G=B(he);if(G){if(G.type==="role"){c(G.id);return}switch(G.id){case"meeting":{const ie=l[0];ie?u(ie.id):f();break}case"bulletin":f();break;case"decisions":m();break;case"knowledge":x();break;case"settings":d==null||d();break;case"theme":g==null||g();break;case"stats":y==null||y();break}}},[B,c,u,f,m,x,d,g,y]);return o.jsxs("div",{className:`td-scene${L?" td-scene--editing":""}`,children:[o.jsxs("div",{ref:E,className:"td-wrap",children:[o.jsx("canvas",{ref:S,width:Oe.canvasW,height:Oe.canvasH,className:"td-canvas",onClick:yt,onMouseDown:Be,onMouseUp:He,onMouseMove:Ee,onMouseLeave:ke,onContextMenu:Qe}),o.jsx("div",{ref:C,className:"td-overlay"})]}),L&&o.jsxs("div",{className:"td-edit-banner",children:[o.jsx("span",{className:"td-edit-banner__icon",children:"✎"})," EDIT MODE — Click DONE when finished"]}),o.jsxs("button",{className:`td-edit-btn${L?" td-edit-btn--active":""}`,onClick:()=>{O(he=>{const G=!he;return G||(X(null),D(null)),G}),Gn=null,pn=null,rn=null},title:L?"Exit Edit Mode":"Edit Furniture Layout",children:[o.jsx("span",{className:"td-edit-btn__icon",children:L?"✓":"✎"}),o.jsx("span",{className:"td-edit-btn__label",children:L?"DONE":"EDIT"})]}),L&&o.jsx("div",{className:"td-palette",children:RE.map(he=>o.jsx("button",{className:`td-palette__item${U===he.type?" td-palette__item--active":""}`,onClick:()=>{U===he.type?(X(null),D(null)):(X(he.type),D(he.zone))},title:he.label,children:o.jsx("span",{children:he.icon})},he.type))}),j&&o.jsxs("button",{className:"td-hire-btn",onClick:j,title:"Hire New Role",children:[o.jsx("span",{className:"td-hire-btn__icon",children:"+"}),o.jsx("span",{className:"td-hire-btn__label",children:"HIRE"})]})]})}function ZE({role:t,appearance:l,onSave:r,onReset:i,onClose:c,theme:u,onThemeChange:f,onUpdateName:m,initialTab:x,characterOnly:d,speechSettings:g,onSpeechSettingsChange:y,language:b,onLanguageChange:v,roleLevel:j}){var Y;const[S,E]=k.useState(x??"character"),[C,A]=k.useState({...l}),[M,F]=k.useState(t.name),[L,O]=k.useState(!1),U=k.useCallback(()=>A(js(j)),[j]),X=k.useCallback(()=>{const R=Eh(t.id);A({...R}),i()},[t.id,i]),ne=k.useCallback(async()=>{r(C);const R=M.trim();if(m&&R&&R!==t.name){O(!0);try{await m(t.id,R)}catch{}O(!1)}c()},[C,r,c,M,t.name,t.id,m]),D=o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[o.jsxs("span",{children:[t.id.toUpperCase()," –"]}),m?o.jsx("input",{value:M,onChange:R=>F(R.target.value),disabled:L,className:"customize-name-input",style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:4,color:"inherit",font:"inherit",padding:"2px 6px",flex:1,minWidth:0}}):o.jsx("span",{children:t.name})]});return o.jsx("div",{className:"customize-overlay",onClick:c,children:o.jsxs("div",{className:"customize-modal",onClick:R=>R.stopPropagation(),children:[o.jsxs("div",{className:"customize-header",children:[o.jsxs("div",{className:"customize-tabs",children:[o.jsx("button",{className:`customize-tab ${S==="character"?"active":""}`,onClick:()=>E("character"),children:"CHARACTER"}),!d&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:`customize-tab ${S==="office"?"active":""}`,onClick:()=>E("office"),children:"OFFICE THEME"}),o.jsx("button",{className:`customize-tab ${S==="settings"?"active":""}`,onClick:()=>E("settings"),children:"SETTINGS"})]})]}),o.jsx("button",{className:"customize-close",onClick:c,children:"X"})]}),S==="character"?o.jsx("div",{className:"customize-body",children:o.jsx(vg,{roleId:t.id,appearance:C,onChange:A,onRandomize:U,onReset:X,label:D,roleLevel:j})}):S==="office"?o.jsx("div",{className:"customize-body",children:o.jsx("div",{className:"customize-themes",children:Object.entries(Ur).map(([R,Q])=>o.jsxs("button",{className:`customize-theme-card ${u===R?"active":""}`,onClick:()=>f(R),children:[o.jsxs("div",{className:"customize-theme-preview",style:{background:Q.vars["--floor-light"],borderColor:Q.vars["--pixel-border"]},children:[o.jsx("div",{style:{background:Q.vars["--hud-bg"],height:8,borderBottom:`2px solid ${Q.vars["--pixel-border"]}`}}),o.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1 p-1",children:[o.jsx("div",{style:{width:10,height:14,background:Q.vars["--accent"],borderRadius:1}}),o.jsx("div",{style:{width:10,height:14,background:Q.vars["--active-green"],borderRadius:1}}),o.jsx("div",{style:{width:10,height:14,background:Q.vars["--idle-amber"],borderRadius:1}})]}),o.jsx("div",{style:{background:Q.vars["--hud-bg"],height:6,borderTop:`2px solid ${Q.vars["--pixel-border"]}`}})]}),o.jsxs("div",{className:"customize-theme-name",children:[Q.icon," ",Q.name]})]},R))})}):o.jsx("div",{className:"customize-body",children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,padding:"8px 0"},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),o.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(R=>o.jsxs("button",{onClick:()=>y==null?void 0:y({mode:R}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(g==null?void 0:g.mode)===R?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(g==null?void 0:g.mode)===R?"rgba(255,255,255,0.08)":"transparent",color:(g==null?void 0:g.mode)===R?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[o.jsx("div",{style:{fontWeight:600,marginBottom:2},children:R==="template"?"TEMPLATE":R==="llm"?"AI":"AUTO"}),o.jsx("div",{style:{fontSize:9,opacity:.7},children:R==="template"?"Static pool ($0)":R==="llm"?"LLM generated":"Detect engine"})]},R))}),o.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(g==null?void 0:g.intervalSec)??18,"s"]}),o.jsx("input",{type:"range",min:5,max:120,step:5,value:(g==null?void 0:g.intervalSec)??18,onChange:R=>y==null?void 0:y({intervalSec:Number(R.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[o.jsx("span",{children:"5s (frequent)"}),o.jsx("span",{children:"120s (rare)"})]})]}),(g==null?void 0:g.mode)!=="template"&&o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((Y=g==null?void 0:g.dailyBudgetUsd)==null?void 0:Y.toFixed(2))??"1.00"]}),o.jsx("input",{type:"range",min:0,max:5,step:.25,value:(g==null?void 0:g.dailyBudgetUsd)??1,onChange:R=>y==null?void 0:y({dailyBudgetUsd:Number(R.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[o.jsx("span",{children:"$0 (unlimited)"}),o.jsx("span",{children:"$5.00/day"})]})]}),o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),o.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:R,label:Q})=>o.jsx("button",{onClick:()=>v==null?void 0:v(R),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(b??"auto")===R?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(b??"auto")===R?"rgba(255,255,255,0.08)":"transparent",color:(b??"auto")===R?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:Q},R))}),o.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]})]})}),S==="character"&&o.jsxs("div",{className:"customize-footer",children:[o.jsx("button",{className:"customize-btn customize-btn--cancel",onClick:c,children:"CANCEL"}),o.jsx("button",{className:"customize-btn customize-btn--save",onClick:ne,children:"SAVE"})]})]})})}function L0(t){if(t.length===0)return"";const l={};for(const{file:m}of t){const x=m.split("/"),d=x[0]==="."?x[1]??"root":x[0];(l[d]??(l[d]=[])).push(m)}const r={roles:"roles",projects:"projects",operations:"operations",knowledge:"knowledge",architecture:"architecture",company:"company",".tycono":"config",".claude":"skills"},i=[];for(const[m,x]of Object.entries(l)){const d=r[m]??m;if(x.length===1){const g=x[0].split("/").pop()??x[0];i.push(`${d}/${g}`)}else i.push(`${d} (${x.length} files)`)}const c=t.some(m=>m.status==="A"),u=t.some(m=>m.status==="M");return`${c&&!u?"add":"update"}: ${i.join(", ")}`}function $0(t){const l=Date.now()-new Date(t).getTime(),r=Math.floor(l/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function JE({status:t,history:l,onClose:r,onSave:i,onLoadHistory:c,onRestore:u,saving:f,onDelegate:m,delegateRoleName:x}){const[d,g]=k.useState("save"),[y,b]=k.useState(""),[v,j]=k.useState(null),[S,E]=k.useState(!1),[C,A]=k.useState(null),M=k.useRef(null);k.useEffect(()=>{d==="history"&&c()},[d,c]),k.useEffect(()=>{var D;(D=M.current)==null||D.focus()},[]);const F=[...((t==null?void 0:t.modified)??[]).map(D=>({status:"M",file:D})),...((t==null?void 0:t.untracked)??[]).map(D=>({status:"A",file:D}))],L=k.useRef(!1);k.useEffect(()=>{!L.current&&F.length>0&&!y&&(b(L0(F)),L.current=!0)},[F.length]);const O=k.useCallback(()=>{b(L0(F))},[F]),U=async()=>{j(null),A(null);try{const D=await i(y||void 0);A(D),b("")}catch(D){j(D instanceof Error?D.message:"Save failed")}},X=async D=>{if(confirm(`Restore from commit ${D.slice(0,7)}? This creates a new commit with those files.`)){E(!0);try{await u(D),E(!1)}catch(Y){j(Y instanceof Error?Y.message:"Restore failed"),E(!1)}}};k.useEffect(()=>{const D=Y=>{Y.key==="Escape"&&r()};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[r]);const ne=D=>{D.key==="Enter"&&(D.metaKey||D.ctrlKey)&&U()};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),o.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[520px] max-h-[80vh] z-[61] overflow-hidden flex flex-col",style:{background:"var(--hud-bg)",border:"3px solid var(--pixel-border)",fontFamily:"var(--pixel-font)",color:"var(--terminal-text)"},onKeyDown:ne,children:[o.jsxs("div",{className:"px-5 py-3 flex items-center justify-between shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"text-lg font-black tracking-tight",children:"SAVE GAME"}),o.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:(t==null?void 0:t.branch)??""})]}),o.jsx("button",{onClick:r,className:"text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] cursor-pointer text-lg",children:"×"})]}),o.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["save","history"].map(D=>o.jsx("button",{onClick:()=>g(D),className:"flex-1 py-2 text-[11px] font-bold uppercase tracking-wider cursor-pointer",style:{background:d===D?"var(--hud-bg-alt)":"transparent",color:d===D?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:d===D?"2px solid var(--accent)":"2px solid transparent"},children:D==="save"?"SAVE":"HISTORY"},D))}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[d==="save"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"text-[11px]",style:{color:"var(--terminal-text-secondary)"},children:F.length>0?o.jsxs("span",{style:{color:"var(--idle-amber)"},children:["* ",F.length," unsaved change",F.length>1?"s":""]}):o.jsx("span",{style:{color:"var(--active-green)"},children:"All changes saved"})}),F.length>0&&o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Changed Files"}),o.jsx("div",{className:"text-[11px] max-h-[160px] overflow-y-auto p-2 space-y-0.5",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)"},children:F.map(({status:D,file:Y})=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx("span",{style:{color:D==="A"?"var(--active-green)":"var(--idle-amber)",width:"14px"},children:D}),o.jsx("span",{style:{color:"var(--terminal-text-secondary)"},children:Y})]},Y))})]}),F.length>0&&o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Save Message"}),o.jsxs("button",{onClick:O,className:"text-[9px] px-1.5 py-0.5 cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--accent)",fontFamily:"var(--pixel-font)"},title:"Auto-generate message from changes",children:["✨"," AUTO"]})]}),o.jsx("input",{ref:M,type:"text",value:y,onChange:D=>b(D.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)"}})]}),F.length>0&&o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{onClick:U,disabled:f,className:"flex-1 py-2.5 text-[12px] font-black uppercase tracking-wider cursor-pointer disabled:opacity-50",style:{background:"var(--accent)",color:"#fff",border:"2px solid var(--accent)"},children:f?"SAVING...":t!=null&&t.hasRemote?"SAVE & PUSH":"SAVE"}),m&&o.jsxs("button",{onClick:()=>{const D=F.map(Y=>`${Y.status} ${Y.file}`).join(`
|
|
89
|
-
`);m(D)},disabled:f,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"]})]}),F.length>0&&t&&!t.hasRemote&&o.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"Local save only — add a git remote to enable push"}),C&&o.jsxs("div",{className:"text-[11px] p-2",style:{background:"rgba(59,185,80,0.1)",border:"1px solid var(--active-green)",color:"var(--active-green)"},children:["Saved! ",C.filesChanged," file",C.filesChanged>1?"s":""," committed",C.pushed?" & pushed":"",C.pushError?` (push error: ${C.pushError})`:""]}),v&&o.jsx("div",{className:"text-[11px] p-2",style:{background:"rgba(211,47,47,0.1)",border:"1px solid #D32F2F",color:"#EF5350"},children:v}),(t==null?void 0:t.lastCommit)&&o.jsxs("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:["Last save: ",t.lastCommit.message," (",$0(t.lastCommit.date),")"]})]}),d==="history"&&o.jsxs(o.Fragment,{children:[l.length===0&&o.jsx("div",{className:"text-[11px] text-center py-8",style:{color:"var(--terminal-text-muted)"},children:"No save history"}),o.jsx("div",{className:"space-y-1",children:l.map(D=>o.jsxs("div",{className:"flex items-center justify-between py-2 px-3 group",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--accent)"},children:D.shortSha}),o.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--terminal-text)"},children:D.message})]}),o.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:$0(D.date)})]}),o.jsx("button",{onClick:()=>X(D.sha),disabled:S,className:"text-[10px] font-bold px-2 py-1 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--idle-amber)"},children:"LOAD"})]},D.sha))})]})]})]})]})}function PE({onClose:t}){const[l,r]=k.useState(null),[i,c]=k.useState(!0),[u,f]=k.useState(null);return k.useEffect(()=>{Ce.getCompanyStats().then(r).catch(m=>f(m.message)).finally(()=>c(!1))},[]),i?o.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading stats..."}):u||!l?o.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u||"Failed to load stats",o.jsx("button",{onClick:t,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]}):o.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:20},children:[o.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Company Stats"}),o.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:20},children:[o.jsx(yc,{label:"Roles",value:String(l.company.roleCount)}),o.jsx(yc,{label:"Avg Level",value:`Lv.${l.company.avgLevel}`}),o.jsx(yc,{label:"Total Tokens",value:l.company.formattedTokens}),o.jsx(yc,{label:"Total Cost",value:`$${l.company.totalCostUsd.toFixed(2)}`})]}),o.jsx("h4",{style:{margin:"0 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Role Leaderboard"}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[l.roles.map((m,x)=>o.jsx(eN,{role:m,rank:x+1},m.roleId)),l.roles.length===0&&o.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"8px 0"},children:"No role activity yet. Assign tasks to start leveling up!"})]}),Object.keys(l.byModel).length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h4",{style:{margin:"20px 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Model Usage"}),o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:Object.entries(l.byModel).map(([m,x])=>o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"6px 10px",background:"rgba(255,255,255,0.03)",borderRadius:6,fontSize:12},children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.7)"},children:tN(m)}),o.jsxs("span",{style:{color:"rgba(255,255,255,0.5)"},children:["$",x.costUsd.toFixed(2)]})]},m))})]})]})}function yc({label:t,value:l}){return o.jsxs("div",{style:{padding:"12px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[o.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.45)",marginBottom:4},children:t}),o.jsx("div",{style:{fontSize:18,fontWeight:600},children:l})]})}function eN({role:t,rank:l}){const r=["🥇","🥈","🥉"],i=l<=3?r[l-1]:`#${l}`;return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:8},children:[o.jsx("span",{style:{fontSize:14,width:28,textAlign:"center",flexShrink:0},children:i}),o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:4},children:[o.jsx("span",{style:{fontSize:13,fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),o.jsxs("span",{style:{fontSize:12,color:H0(t.level),fontWeight:600,flexShrink:0,marginLeft:8},children:["Lv.",t.level]})]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[o.jsx("div",{style:{flex:1,height:4,background:"rgba(255,255,255,0.08)",borderRadius:2,overflow:"hidden"},children:o.jsx("div",{style:{width:`${t.progress*100}%`,height:"100%",background:H0(t.level),borderRadius:2,transition:"width 0.3s ease"}})}),o.jsx("span",{style:{fontSize:10,color:"rgba(255,255,255,0.4)",flexShrink:0},children:t.formattedTokens})]})]})]})}function H0(t){return t>=9?"#FFD700":t>=7?"#C0A0FF":t>=5?"#4FC3F7":t>=3?"#81C784":"rgba(255,255,255,0.4)"}function tN(t){return t.includes("opus")?"Opus":t.includes("sonnet")?"Sonnet":t.includes("haiku")?"Haiku":t.split("-").slice(0,2).join(" ")}function nN({onClose:t,onSyncComplete:l}){const[r,i]=k.useState([]),[c,u]=k.useState([]),[f,m]=k.useState(!0),[x,d]=k.useState(null),[g,y]=k.useState(new Set),[b,v]=k.useState(null),[j,S]=k.useState(null),E=k.useCallback(async()=>{m(!0),v(null);try{const{roles:A}=await Ce.getSyncRoles();i(A);const M=A.filter(L=>L.source.sync!=="off");if(M.length===0){u([]),S(null);return}let F=!1;try{const L=await Ts.syncCheck(M.map(U=>({roleId:U.roleId,sourceId:U.source.id,currentVersion:U.source.upstream_version??U.source.forked_at??"0.0.0"})));F=!0,S(!0);const O=[];for(const U of L.updates){if(!U.hasUpdate)continue;const X=M.find(Q=>Q.roleId===U.roleId);if(!X)continue;const{character:ne}=await Ts.syncPull(U.sourceId),D=[];X.persona.trim()!==ne.persona.trim()&&D.push({field:"persona",local:X.persona.slice(0,120)+(X.persona.length>120?"...":""),upstream:ne.persona.slice(0,120)+(ne.persona.length>120?"...":"")});const Y=JSON.stringify(X.authority),R=JSON.stringify(ne.authority);Y!==R&&D.push({field:"authority",local:`${X.authority.autonomous.length} autonomous, ${X.authority.needsApproval.length} approval`,upstream:`${ne.authority.autonomous.length} autonomous, ${ne.authority.needsApproval.length} approval`}),D.length>0&&O.push({roleId:U.roleId,roleName:X.name,sourceId:U.sourceId,currentVersion:U.currentVersion,latestVersion:U.latestVersion,fields:D})}u(O)}catch{S(!1),u([])}}catch(A){v(A instanceof Error?A.message:"Failed to check for updates")}finally{m(!1)}},[]);k.useEffect(()=>{E()},[E]);const C=async A=>{d(A.roleId);try{const{character:M,version:F}=await Ts.syncPull(A.sourceId);await Ce.applySyncUpdate({roleId:A.roleId,changes:{persona:M.persona,authority:M.authority},upstreamVersion:F}),y(L=>new Set(L).add(A.roleId)),l==null||l()}catch(M){v(M instanceof Error?M.message:"Failed to apply update")}finally{d(null)}};return o.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[o.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Role Sync"}),o.jsxs("div",{style:{display:"flex",gap:8},children:[o.jsx("button",{onClick:E,disabled:f,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:f?"wait":"pointer"},children:f?"Checking...":"Refresh"}),o.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),j===!1&&o.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,180,0,0.1)",borderRadius:6,color:"#FFB74D",fontSize:12,marginBottom:12},children:"Cloud API unreachable. Sync requires connection to api.tycono.ai."}),b&&o.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:b}),o.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Tracked roles: "}),o.jsx("span",{style:{fontWeight:500},children:r.length}),o.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Updates available: "}),o.jsx("span",{style:{fontWeight:500,color:c.length>0?"#4FC3F7":"rgba(255,255,255,0.7)"},children:c.filter(A=>!g.has(A.roleId)).length}),j===!0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),o.jsx("span",{style:{fontSize:11,color:"#81C784"},children:"Cloud connected"})]})]}),c.length===0&&!f&&o.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:r.length===0?"No roles with source tracking. Hire from the Store to enable sync.":"All roles are up to date!"}),c.map(A=>o.jsxs("div",{style:{marginBottom:12,padding:14,background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:14,fontWeight:500},children:A.roleName}),o.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.4)"},children:[A.sourceId," · v",A.currentVersion," → v",A.latestVersion]})]}),g.has(A.roleId)?o.jsx("span",{style:{fontSize:12,color:"#81C784"},children:"Applied ✓"}):o.jsx("button",{onClick:()=>C(A),disabled:x===A.roleId,style:{background:"#1565C0",border:"none",color:"white",borderRadius:6,padding:"5px 12px",fontSize:12,cursor:x===A.roleId?"wait":"pointer",opacity:x===A.roleId?.6:1},children:x===A.roleId?"Applying...":"Apply Update"})]}),A.fields.map(M=>o.jsxs("div",{style:{marginBottom:6,fontSize:12},children:[o.jsx("div",{style:{color:"rgba(255,255,255,0.5)",marginBottom:2,textTransform:"uppercase",fontSize:10,letterSpacing:.5},children:M.field}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},children:[o.jsxs("div",{style:{padding:"4px 8px",background:"rgba(255,100,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[o.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"LOCAL"}),o.jsx("br",{}),M.local]}),o.jsxs("div",{style:{padding:"4px 8px",background:"rgba(100,255,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[o.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"UPSTREAM"}),o.jsx("br",{}),M.upstream]})]})]},M.field))]},A.roleId)),r.length>0&&o.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Roles hired from the Store are tracked automatically. Set ",o.jsx("code",{style:{background:"rgba(255,255,255,0.06)",padding:"1px 4px",borderRadius:3},children:"sync: off"})," in role.yaml to stop tracking."]})]})}function lN({onClose:t}){const[l,r]=k.useState(null),[i,c]=k.useState(!0),[u,f]=k.useState(null),[m,x]=k.useState(null),d=k.useCallback(async()=>{c(!0),f(null);try{const A=await Ce.getGitStatus();r(A)}catch(A){f(A instanceof Error?A.message:"Failed to load git status")}finally{c(!1)}},[]);k.useEffect(()=>{d()},[d]);const g=async A=>{x(A.path);try{await Ce.deleteWorktree(A.path),await d()}catch(M){f(M instanceof Error?M.message:"Failed to remove worktree")}finally{x(null)}},y=async A=>{x(A);try{await Ce.deleteBranch(A),await d()}catch(M){f(M instanceof Error?M.message:"Failed to delete branch")}finally{x(null)}};if(i&&!l)return o.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading git status..."});if(u&&!l)return o.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u,o.jsx("button",{onClick:t,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]});if(!l)return null;const b=l.worktrees.filter(A=>A.status==="active"),v=l.worktrees.filter(A=>A.status==="pending-merge"),j=l.worktrees.filter(A=>A.status==="stale");function S(A){const M=A.split("/");if(M.length>1){const F=M[M.length-1],L=["cto","cbo","pm","engineer","designer","qa","data-analyst"];for(const O of L)if(F.toLowerCase().includes(O))return O}return null}function E(A,M=40){return A.length<=M?A:"..."+A.slice(A.length-M+3)}function C(A){const M=Date.now()-new Date(A).getTime(),F=Math.floor(M/6e4);if(F<1)return"just now";if(F<60)return`${F}m ago`;const L=Math.floor(F/60);return L<24?`${L}h ago`:`${Math.floor(L/24)}d ago`}return o.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[o.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"GIT STATUS"}),o.jsxs("div",{style:{display:"flex",gap:8},children:[o.jsx("button",{onClick:d,disabled:i,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:i?"wait":"pointer"},children:i?"Checking...":"Refresh"}),o.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),u&&o.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:u}),o.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o.jsxs("div",{children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Branch: "}),o.jsx("span",{style:{fontWeight:500},children:l.currentBranch})]}),o.jsx("div",{children:l.unsavedCount>0&&o.jsxs("span",{style:{color:"#FFB74D",fontSize:12},children:[l.unsavedCount," unsaved"]})})]}),l.lastCommit&&o.jsxs("div",{style:{marginTop:6,fontSize:11,color:"rgba(255,255,255,0.4)"},children:["Last commit: ",l.lastCommit.message.slice(0,60),l.lastCommit.message.length>60?"...":""," · ",C(l.lastCommit.date)]})]}),b.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gc,{label:"Active Worktrees",count:b.length}),b.map(A=>o.jsx(_d,{wt:A,roleFromBranch:A.roleId||S(A.branch),truncatePath:E,timeAgo:C,removing:m===A.path,onRemove:()=>g(A),statusColor:"#4FC3F7",statusIcon:"📂"},A.path))]}),v.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gc,{label:"Pending Merge",count:v.length}),v.map(A=>o.jsx(_d,{wt:A,roleFromBranch:A.roleId||S(A.branch),truncatePath:E,timeAgo:C,removing:m===A.path,onRemove:()=>g(A),statusColor:"#FFB74D",statusIcon:"⚠️"},A.path))]}),j.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gc,{label:"Stale",count:j.length}),j.map(A=>o.jsx(_d,{wt:A,roleFromBranch:A.roleId||S(A.branch),truncatePath:E,timeAgo:C,removing:m===A.path,onRemove:()=>g(A),statusColor:"#ff6b6b",statusIcon:"🔴"},A.path))]}),l.staleBranches.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gc,{label:"Unmerged Branches",count:l.staleBranches.length}),l.staleBranches.map(A=>o.jsxs("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o.jsxs("div",{style:{fontSize:13},children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.5)",marginRight:6},children:"⚠️"}),o.jsx("span",{style:{fontWeight:500},children:A})]}),o.jsx("button",{onClick:()=>y(A),disabled:m===A,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:"#ff6b6b",borderRadius:4,padding:"3px 8px",fontSize:10,cursor:m===A?"wait":"pointer",opacity:m===A?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5},children:m===A?"...":"DELETE"})]},A))]}),b.length===0&&v.length===0&&j.length===0&&l.staleBranches.length===0&&o.jsxs("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:["✓"," All clean. No active worktrees or stale branches."]}),l.lastMerge&&o.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Last merge: ",o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:l.lastMerge.branch})," · ",l.lastMerge.roleId," · ",C(l.lastMerge.mergedAt)]})]})}function gc({label:t,count:l}){return o.jsxs("h4",{style:{margin:"16px 0 8px",fontSize:11,fontWeight:600,color:"rgba(255,255,255,0.5)",textTransform:"uppercase",letterSpacing:1},children:[t," (",l,")"]})}function _d({wt:t,roleFromBranch:l,truncatePath:r,timeAgo:i,removing:c,onRemove:u,statusColor:f,statusIcon:m}){return o.jsx("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsxs("div",{style:{fontSize:13,fontWeight:500,marginBottom:2},children:[o.jsx("span",{style:{marginRight:6},children:m}),t.branch,l&&o.jsx("span",{style:{marginLeft:8,fontSize:10,padding:"1px 6px",background:"rgba(255,255,255,0.08)",borderRadius:3,color:"rgba(255,255,255,0.6)",textTransform:"uppercase"},children:l})]}),t.task&&o.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.5)",marginBottom:2},children:['"',t.task.slice(0,50),t.task.length>50?"...":"",'"']}),o.jsxs("div",{style:{fontSize:10,color:"rgba(255,255,255,0.35)"},children:[r(t.path)," · ",t.filesChanged," file",t.filesChanged!==1?"s":""," changed"," · ",i(t.createdAt)]}),t.conflictFiles&&t.conflictFiles.length>0&&o.jsxs("div",{style:{fontSize:10,color:"#ff6b6b",marginTop:4},children:["⛔"," CONFLICT: ",t.conflictFiles.join(", ")]})]}),o.jsx("button",{onClick:u,disabled:c,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:f,borderRadius:4,padding:"3px 8px",fontSize:10,cursor:c?"wait":"pointer",opacity:c?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5,flexShrink:0,marginLeft:8},children:c?"...":"REMOVE"})]})})}function rN({onClose:t,speechSettings:l,onSpeechSettingsChange:r,language:i,onLanguageChange:c,onOpenSync:u,onOpenGitStatus:f,onOpenStats:m}){var x;return o.jsx("div",{className:"customize-overlay",onClick:t,children:o.jsxs("div",{className:"customize-modal",onClick:d=>d.stopPropagation(),style:{maxWidth:480},children:[o.jsxs("div",{className:"customize-header",children:[o.jsx("div",{style:{fontSize:12,fontWeight:700,letterSpacing:1,color:"var(--terminal-text)"},children:"SETTINGS"}),o.jsx("button",{className:"customize-close",onClick:t,children:"X"})]}),o.jsx("div",{className:"customize-body",style:{padding:"12px 20px 20px"},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),o.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(d=>o.jsxs("button",{onClick:()=>r==null?void 0:r({mode:d}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(l==null?void 0:l.mode)===d?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(l==null?void 0:l.mode)===d?"rgba(255,255,255,0.08)":"transparent",color:(l==null?void 0:l.mode)===d?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[o.jsx("div",{style:{fontWeight:600,marginBottom:2},children:d==="template"?"TEMPLATE":d==="llm"?"AI":"AUTO"}),o.jsx("div",{style:{fontSize:9,opacity:.7},children:d==="template"?"Static pool ($0)":d==="llm"?"LLM generated":"Detect engine"})]},d))}),o.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(l==null?void 0:l.intervalSec)??18,"s"]}),o.jsx("input",{type:"range",min:5,max:120,step:5,value:(l==null?void 0:l.intervalSec)??18,onChange:d=>r==null?void 0:r({intervalSec:Number(d.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[o.jsx("span",{children:"5s (frequent)"}),o.jsx("span",{children:"120s (rare)"})]})]}),(l==null?void 0:l.mode)!=="template"&&o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((x=l==null?void 0:l.dailyBudgetUsd)==null?void 0:x.toFixed(2))??"1.00"]}),o.jsx("input",{type:"range",min:0,max:5,step:.25,value:(l==null?void 0:l.dailyBudgetUsd)??1,onChange:d=>r==null?void 0:r({dailyBudgetUsd:Number(d.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[o.jsx("span",{children:"$0 (unlimited)"}),o.jsx("span",{children:"$5.00/day"})]})]}),o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),o.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:d,label:g})=>o.jsx("button",{onClick:()=>c==null?void 0:c(d),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(i??"auto")===d?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(i??"auto")===d?"rgba(255,255,255,0.08)":"transparent",color:(i??"auto")===d?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:g},d))}),o.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]}),o.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.08)",paddingTop:16,display:"flex",gap:8},children:[u&&o.jsx("button",{onClick:()=>{t(),u()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"🔄 ROLE SYNC"}),f&&o.jsx("button",{onClick:()=>{t(),f()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📂 GIT STATUS"}),m&&o.jsx("button",{onClick:()=>{t(),m()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📊 COMPANY STATS"})]})]})})]})})}function aN({theme:t,onThemeChange:l,onClose:r}){const i=k.useRef(null);return k.useEffect(()=>{const c=u=>{i.current&&!i.current.contains(u.target)&&r()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]),o.jsx("div",{ref:i,className:"theme-dropup",children:Object.entries(Ur).map(([c,u])=>o.jsxs("button",{className:`theme-dropup__item${t===c?" theme-dropup__item--active":""}`,onClick:()=>{l(c),r()},title:u.name,children:[o.jsxs("span",{className:"theme-dropup__swatch",style:{background:u.vars["--hud-bg"],borderColor:u.vars["--pixel-border"]},children:[o.jsx("span",{style:{background:u.vars["--accent"],width:5,height:5,borderRadius:1}}),o.jsx("span",{style:{background:u.vars["--active-green"],width:5,height:5,borderRadius:1}}),o.jsx("span",{style:{background:u.vars["--idle-amber"],width:5,height:5,borderRadius:1}})]}),o.jsx("span",{className:"theme-dropup__name",children:u.icon})]},c))})}const _c=[0,1e4,5e4,15e4,4e5,1e6,25e5,5e6,1e7,25e6];function Rg(t){let l=1;for(let r=_c.length-1;r>=0;r--)if(t>=_c[r]){l=r+1;break}return Math.min(l,10)}function iN(t){const l=Rg(t);if(l>=10)return 1;const r=_c[l-1],i=_c[l];return Math.min(1,(t-r)/(i-r))}function U0(t){const l={};for(const[r,i]of Object.entries(t)){const c=i.inputTokens+i.outputTokens;l[r]={level:Rg(c),totalTokens:c,progress:iN(c)}}return l}const sN=[{id:"first-employee",name:"First Employee",icon:"🏆",description:"Hired your first role",check:t=>t.roleCount>=1},{id:"full-team",name:"Full Team",icon:"👥",description:"Hired 5+ roles",check:t=>t.roleCount>=5},{id:"token-10k",name:"Getting Started",icon:"📊",description:"Used 10K tokens total",check:t=>t.totalTokens>=1e4},{id:"token-100k",name:"Power User",icon:"💪",description:"Used 100K tokens total",check:t=>t.totalTokens>=1e5},{id:"token-millionaire",name:"Token Millionaire",icon:"🎖",description:"Used 1M tokens total",check:t=>t.totalTokens>=1e6},{id:"token-mogul",name:"Token Mogul",icon:"💎",description:"Used 10M tokens total",check:t=>t.totalTokens>=1e7},{id:"first-promotion",name:"First Promotion",icon:"⭐",description:"Any role reached Lv.3",check:t=>t.roles.some(l=>l.level>=3)},{id:"senior-staff",name:"Senior Staff",icon:"🌟",description:"Any role reached Lv.5",check:t=>t.roles.some(l=>l.level>=5)},{id:"master-class",name:"Master Class",icon:"👑",description:"Any role reached Lv.10",check:t=>t.roles.some(l=>l.level>=10)},{id:"full-house",name:"Full House",icon:"🏠",description:"All roles Lv.5+",check:t=>t.roleCount>=3&&t.roles.every(l=>l.level>=5)}];function I0(t){return sN.filter(l=>l.check(t))}const oN={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍","data-analyst":"📊"},jc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},cN={cto:"아키텍처",cbo:"시장 분석",pm:"PRD 작성",engineer:"코딩",designer:"시안 제작",qa:"품질 검증"};function uN(t){let l=0;for(let i=0;i<t.length;i++)l=t.charCodeAt(i)+((l<<5)-l);return`hsl(${(l%360+360)%360}, 50%, 40%)`}function fN({importJob:t,onImportDone:l}){var ji,Na,Ci;const[r,i]=k.useState([]),[c,u]=k.useState([]),[f,m]=k.useState([]),[x,d]=k.useState([]),[g,y]=k.useState([]),[b,v]=k.useState([]),[j,S]=k.useState("TYCONO"),[E,C]=k.useState(!0),[A,M]=k.useState(null),[F,L]=k.useState({type:"none"}),[O,U]=k.useState(null),[X,ne]=k.useState(null),[D,Y]=k.useState([]),[R,Q]=k.useState(!1),[ee,V]=k.useState([]),[I,Z]=k.useState(0),[ce,we]=k.useState(!1),[z,B]=k.useState({}),[W,T]=k.useState("ceo"),[me,Se]=k.useState(null),[Ee,Be]=k.useState(!1),[He,Qe]=k.useState({}),ke=k.useRef({}),[yt,he]=k.useState(!1),[G,ie]=k.useState(null),[xe,Te]=k.useState({}),[Ne,Fe]=k.useState([]),[Ae,Re]=k.useState([]),[Ke,Lt]=k.useState(void 0),[gt,ht]=k.useState(!1);k.useEffect(()=>{Ce.getStatus().then(_=>{Lt(_.engine),ht(!!_.hasApiKey)}).catch(()=>{})},[]);const{getAppearance:Zt,setAppearance:re,resetAppearance:ye,theme:ze,setTheme:Ue,speechSettings:be,setSpeechSettings:je,language:jt,setLanguage:wt}=YC(),[Xe,ft]=k.useState(null),[de,Mt]=k.useState("character"),it=XC(),[mi,Tl]=k.useState(!1),[ka,Dl]=k.useState(!1),[zl,ar]=k.useState(!1),[Ml,Sa]=k.useState(!1),[Us,Xr]=k.useState(!1),[ir,xi]=k.useState(!1),[On,Is]=k.useState(null);k.useEffect(()=>{const _=ae=>{(ae.metaKey||ae.ctrlKey)&&ae.key==="s"&&(ae.preventDefault(),it.dirtyCount>0&&Tl(!0))};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[it.dirtyCount]),k.useEffect(()=>{if(!Ml)return;let _=!1;const ae=async()=>{try{const pe=await Ce.getGitStatus();_||Is(pe)}catch{}};ae();const ue=setInterval(ae,1e4);return()=>{_=!0,clearInterval(ue)}},[Ml]);const[Fl,Vr]=k.useState(null),[ml,Rl]=k.useState(null),[_l,il]=k.useState([]),[$t,cn]=k.useState(!1),Ol=k.useRef(!1),Gr=k.useRef(null);let Ys=k.useRef(0);const qs=k.useRef(new Set),xl=(_,ae,ue)=>{const pe={id:Ys.current++,type:_,text:ae,detail:ue};il(ge=>[...ge,pe])};k.useEffect(()=>{var _;$t&&((_=Gr.current)==null||_.scrollIntoView({behavior:"smooth"}))},[_l,$t]),k.useEffect(()=>{t&&(Ol.current||(Ol.current=!0,Rl("Scanning knowledge sources..."),il([{id:0,type:"scan",text:"Starting knowledge import..."}]),Ys.current=1,fetch("/api/setup/import-knowledge",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:t.paths,companyRoot:t.companyRoot})}).then(async _=>{var ge;const ae=(ge=_.body)==null?void 0:ge.getReader();if(!ae)return;const ue=new TextDecoder;let pe="";for(;;){const{done:Me,value:Le}=await ae.read();if(Me)break;pe+=ue.decode(Le,{stream:!0});const Pe=pe.split(`
|
|
90
|
-
`);pe=Pe.pop()||"";let nt="";for(const Ve of Pe)if(Ve.startsWith("event: "))nt=Ve.slice(7).trim();else if(Ve.startsWith("data: ")&&nt){try{const Yt=JSON.parse(Ve.slice(6));switch(nt){case"scanning":Rl(`Scanning: ${Yt.path} (${Yt.fileCount} files)`),xl("scan",`Found ${Yt.fileCount} files`,Yt.path);break;case"processing":Vr({index:Yt.index,total:Yt.total}),Rl(`Importing knowledge... (${Yt.index}/${Yt.total})`),xl("process",`Processing: ${Yt.file}`,`${Yt.index} / ${Yt.total}`);break;case"created":xl("created",Yt.title,Yt.summary);break;case"skipped":xl("process",`Skipped: ${Yt.file}`,Yt.reason);break;case"done":Rl(null),Vr(null),xl("done",`Import complete! ${Yt.created} created, ${Yt.skipped} skipped.`),Ut(`Knowledge import complete! ${Yt.created} documents imported.`,"#2E7D32"),l==null||l();break;case"error":Rl(null),Vr(null),xl("error",Yt.message),Ut(`Import failed: ${Yt.message}`,"#B71C1C"),l==null||l();break}}catch{}nt=""}}}).catch(_=>{Rl(null),xl("error",_.message),Ut(`Import error: ${_.message}`,"#B71C1C"),l==null||l()})))},[t]);const[Bl,ja]=k.useState("iso"),[Ll,sr]=k.useState(typeof window<"u"?window.innerWidth:1200);k.useEffect(()=>{const _=()=>sr(window.innerWidth);return window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)},[]);const $l=Ll<1024,[un,Ft]=k.useState(!1),[or,Xs]=k.useState(560),[Cn,Xt]=k.useState([]),[Ca,Bn]=k.useState(null),[cr,pi]=k.useState(null),{sendMessage:Ea}=HC();k.useEffect(()=>{Promise.all([Ce.getCompany().then(_=>{S(_.name),i(_.roles)}),Ce.getOrgTree().then(_=>{B(_.nodes),T(_.root)}).catch(()=>{}),Ce.getCostSummary().then(_=>Vs(U0(_.byRole))).catch(()=>{})]).catch(_=>M(`Failed to load: ${_.message}`)).finally(()=>C(!1)),Ce.getProjects().then(u).catch(()=>{}),Ce.getStandups().then(m).catch(()=>{}),Ce.getWaves().then(d).catch(()=>{}),Ce.getDecisions().then(y).catch(()=>{}),Ce.getKnowledge().then(v).catch(()=>{})},[]),k.useEffect(()=>{Ce.getSessions().then(_=>{if(_.length>0){const ae=_.map(pe=>({...pe,messages:[]}));Xt(ae);const ue=ae.find(pe=>pe.status==="active")??ae[0];Bn(ue.id),Ft(!0)}}).catch(_=>{console.error("Failed to load sessions",_)})},[]),k.useEffect(()=>{const _=()=>{fetch("/api/exec/status").then(ue=>ue.json()).then(ue=>{Te(ue.statuses??{}),Fe(ue.activeExecutions??[])}).catch(()=>{})};_();const ae=setInterval(_,3e3);return()=>clearInterval(ae)},[]);const pl=k.useMemo(()=>{const _={...xe};if(cr){const ae=Cn.find(ue=>ue.id===cr);ae&&(_[ae.roleId]="working")}return _},[xe,cr,Cn]);k.useEffect(()=>{F.type==="role"?Ce.getRole(F.roleId).then(U).catch(console.error):U(null)},[F]);const bn=()=>L({type:"none"}),En=async(_,ae)=>{const ue=r.find(ge=>ge.id===_),pe=(X==null?void 0:X.mode)==="ask";ne(null);try{const{jobId:ge}=await Ce.startJob({type:"assign",roleId:_,task:ae,readOnly:pe}),Me=jc[_]??"#666",Le=`${_.toUpperCase()} · ${(ue==null?void 0:ue.name)??_}`;we(!1),Y([{jobId:ge,title:Le,color:Me}]),It.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO → ${(ue==null?void 0:ue.name)??_}] ${pe?"Ask":"Assign"}: ${ae}`,type:"dispatch",targetRoleId:_})}catch(ge){Ut(`Failed to start job: ${ge instanceof Error?ge.message:"unknown"}`,"#C62828")}},Ut=(_,ae)=>{const ue=Date.now();Re(pe=>[...pe,{id:ue,message:_,color:ae}]),setTimeout(()=>Re(pe=>pe.filter(ge=>ge.id!==ue)),4e3)},Vs=_=>{var ue,pe;const ae=ke.current;for(const[ge,Me]of Object.entries(_)){const Le=((ue=ae[ge])==null?void 0:ue.level)??0;if(Le>0&&Me.level>Le){const Pe=((pe=r.find(nt=>nt.id===ge))==null?void 0:pe.name)??ge.toUpperCase();Ut(`${Pe} leveled up to Lv.${Me.level}!`,"#7C3AED")}}ke.current=_,Qe(_)};k.useEffect(()=>{const _={roles:Object.entries(He).map(([pe,ge])=>({id:pe,level:ge.level,totalTokens:ge.totalTokens})),totalTokens:Object.values(He).reduce((pe,ge)=>pe+ge.totalTokens,0),roleCount:r.length},ae=I0(_),ue=qs.current;for(const pe of ae)ue.has(pe.id)||ue.size>0&&Ut(`${pe.icon} Badge earned: ${pe.name}!`,"#D4A017");qs.current=new Set(ae.map(pe=>pe.id))},[He,r.length]);const yi=()=>{var ae;const _=D[D.length-1];_&&(Ut(`${_.title} completed`,_.color),It.pushMessage({ts:Date.now(),roleId:((ae=_.title.split(" · ")[0])==null?void 0:ae.toLowerCase())??"unknown",text:`[${_.title}] Job completed`,type:"dispatch"})),Ce.getStandups().then(m).catch(console.error),Ce.getCompany().then(ue=>i(ue.roles)).catch(console.error),Ce.getCostSummary().then(ue=>Vs(U0(ue.byRole))).catch(()=>{})},Gs=async _=>{Q(!1);try{const ae=await Ce.startJob({type:"wave",directive:_}),ue=ae.jobIds??(ae.jobId?[ae.jobId]:[]),pe=r.filter(Me=>Me.level==="c-level"),ge=ue.map((Me,Le)=>{var Pe,nt;return{jobId:Me,roleId:((Pe=pe[Le])==null?void 0:Pe.id)??`role-${Le}`,roleName:((nt=pe[Le])==null?void 0:nt.name)??`C-Level ${Le+1}`}});It.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO WAVE] "${_}" → ${ge.map(Me=>Me.roleName).join(", ")}`,type:"dispatch"}),Object.keys(z).length>0?(Se({directive:_,rootJobs:ge}),Be(!1)):(V(ge),Z(0),we(!1),ge.length>0&&Y([{jobId:ge[0].jobId,title:`CEO WAVE · ${ge[0].roleId.toUpperCase()}`,color:"#B71C1C"}]))}catch(ae){Ut(`Failed to start wave: ${ae instanceof Error?ae.message:"unknown"}`,"#C62828")}},Kr=()=>{Ce.getWaves().then(d).catch(console.error),Ce.getStandups().then(m).catch(console.error)},gi=()=>{Ce.getCompany().then(_=>i(_.roles)).catch(console.error)},Nn=async(_,ae)=>{await Ce.createRole(_),re(_.id,ae),gi(),Ut(`${_.name} hired!`,"#2E7D32")},bi=async _=>{await Ce.deleteRole(_),gi(),ie(null),Ut(`${_.toUpperCase()} removed`,"#B71C1C")},vi=async(_,ae)=>{await Ce.updateRole(_,ae),gi(),F.type==="role"&&F.roleId===_&&Ce.getRole(_).then(U).catch(console.error),ae.name&&Ut(`${_.toUpperCase()} renamed to "${ae.name}"`,"#1565C0")},wi=_=>{Ft(!0)},ur=async _=>{try{const ae=await Ce.createSession(_,"talk");Xt(ue=>[ae,...ue]),Bn(ae.id),Ft(!0)}catch(ae){console.error("Failed to create session",ae),Ut(`Failed to create session: ${ae instanceof Error?ae.message:"API unreachable"}`,"#B71C1C")}},Ks=async _=>{try{const ae=await Ce.createSession(_,"talk");Xt(ue=>[ae,...ue]),Bn(ae.id)}catch(ae){console.error("Failed to create session",ae),Ut(`Failed to create session: ${ae instanceof Error?ae.message:"API unreachable"}`,"#B71C1C")}},Qs=async _=>{const ae=Ne.find(ge=>ge.roleId===_),ue=(ae==null?void 0:ae.jobId)??(ae==null?void 0:ae.id);if(ue&&pl[_]==="working"){const ge=r.find(Pe=>Pe.id===_),Me=jc[_]??"#666",Le=`${_.toUpperCase()} · ${(ge==null?void 0:ge.name)??_}`;Y([{jobId:ue,title:Le,color:Me}]),we(!1);return}const pe=Cn.find(ge=>ge.roleId===_);if(pe)Bn(pe.id),It.setActiveChannelId(null);else try{const ge=await Ce.createSession(_,"talk");Xt(Me=>[ge,...Me]),Bn(ge.id),It.setActiveChannelId(null)}catch(ge){console.error("Failed to create session",ge)}Ft(!0)},fr=async _=>{try{await Ce.deleteSession(_),Xt(ae=>{var pe;const ue=ae.filter(ge=>ge.id!==_);return Ca===_&&Bn(((pe=ue[0])==null?void 0:pe.id)??null),ue})}catch(ae){console.error("Failed to delete session",ae),Ut(`Failed to close session: ${ae instanceof Error?ae.message:"API error"}`,"#B71C1C")}},qc=async()=>{try{const{ids:_}=await Ce.deleteEmptySessions();if(_.length===0)return;Xt(ae=>{var pe;const ue=ae.filter(ge=>!_.includes(ge.id));return Ca&&_.includes(Ca)&&Bn(((pe=ue[0])==null?void 0:pe.id)??null),ue}),Ut(`Cleared ${_.length} empty session${_.length!==1?"s":""}`,"#2E7D32")}catch(_){Ut(`Failed to clear empty sessions: ${_ instanceof Error?_.message:"API error"}`,"#B71C1C")}},Ws=async()=>{if(!confirm("Close all sessions? This cannot be undone."))return;const _=Cn.map(ae=>ae.id);try{await Ce.deleteSessions(_),Xt([]),Bn(null),Ut("All sessions closed","#2E7D32")}catch(ae){Ut(`Failed to close sessions: ${ae instanceof Error?ae.message:"API error"}`,"#B71C1C")}},sl=(_,ae)=>{Xt(ue=>ue.map(pe=>{if(pe.id!==_)return pe;const ge=[...pe.messages],Me=ge[ge.length-1];if(Me&&Me.from==="role"&&Me.status==="streaming"){const Le=[...Me.streamEvents??[],ae];ge[ge.length-1]={...Me,streamEvents:Le}}return{...pe,messages:ge}}))},Qr=(_,ae,ue)=>{const pe={id:`msg-${Date.now()}-ceo`,from:"ceo",content:ae,type:ue==="do"?"directive":"conversation",status:"done",timestamp:new Date().toISOString()},ge={id:`msg-${Date.now()+1}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:new Date().toISOString(),streamEvents:[]};Xt(Me=>Me.map(Le=>Le.id===_?{...Le,messages:[...Le.messages,pe,ge],updatedAt:new Date().toISOString()}:Le)),pi(_),Ea(_,ae,ue,{onThinking:Me=>{Xt(Le=>Le.map(Pe=>{if(Pe.id!==_)return Pe;const nt=[...Pe.messages],Ve=nt[nt.length-1];return Ve&&Ve.from==="role"&&Ve.status==="streaming"&&(nt[nt.length-1]={...Ve,thinking:(Ve.thinking??"")+Me}),{...Pe,messages:nt}})),sl(_,{type:"thinking",timestamp:Date.now(),text:Me})},onText:Me=>{Xt(Le=>Le.map(Pe=>{if(Pe.id!==_)return Pe;const nt=[...Pe.messages],Ve=nt[nt.length-1];return Ve&&Ve.from==="role"&&Ve.status==="streaming"&&(nt[nt.length-1]={...Ve,content:Ve.content+Me}),{...Pe,messages:nt}}))},onToolUse:(Me,Le)=>{sl(_,{type:"tool",timestamp:Date.now(),toolName:Me,toolInput:Le})},onDispatch:(Me,Le)=>{sl(_,{type:"dispatch",timestamp:Date.now(),roleId:Me,task:Le})},onDispatchProgress:(Me,Le,Pe)=>{var nt;Le==="tool"?sl(_,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:"tool",toolName:Pe.name,toolInput:Pe.input}):Le==="thinking"?sl(_,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:"thinking",text:Pe.text}):Le==="text"?sl(_,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:"text",text:(nt=Pe.text)==null?void 0:nt.slice(-200)}):(Le==="done"||Le==="error")&&sl(_,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:Le})},onTurn:Me=>{sl(_,{type:"turn",timestamp:Date.now(),turn:Me})},onDone:()=>{Xt(Me=>Me.map(Le=>{if(Le.id!==_)return Le;const Pe=Le.messages.map(Ve=>Ve.status==="streaming"?{...Ve,status:"done"}:Ve),nt=Le.messages.length<=2?ae.slice(0,40).replace(/\n/g," "):Le.title;return{...Le,messages:Pe,title:nt}})),pi(null)},onError:Me=>{Xt(Le=>Le.map(Pe=>{if(Pe.id!==_)return Pe;const nt=Pe.messages.map(Ve=>Ve.status==="streaming"?{...Ve,status:"error",content:Ve.content||Me}:Ve);return{...Pe,messages:nt}})),pi(null)}})},Xc=(_,ae)=>{Xt(ue=>ue.map(pe=>pe.id===_?{...pe,mode:ae}:pe)),Ce.updateSession(_,{mode:ae}).catch(console.error)},Vc=new Date().toISOString().slice(0,10),Ln=c[0],Qn={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},ki=_=>{const ae=Qn[_];if(!ae)return"";for(const ue of f){const pe=ue.content,ge=pe.indexOf(`## ${ae}`);if(ge===-1)continue;const Me=pe.indexOf(`
|
|
86
|
+
VP Marketing, c-level, ceo`,className:"w-full h-40 p-3 rounded-lg border border-white/10 bg-white/5 text-sm text-white/90 placeholder-white/25 resize-none focus:outline-none focus:border-white/25 transition-colors font-mono"}),o.jsx("div",{className:"text-[10px] text-gray-400 mt-1",children:"Format: Name, Level (member/team-lead/c-level), ReportsTo. Level and ReportsTo are optional."})]}),T.length>0&&o.jsxs("div",{children:[o.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Preview (",T.length," role",T.length!==1?"s":"",")"]}),o.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden",children:o.jsxs("table",{className:"w-full text-xs",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"border-b border-white/10",children:[o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),o.jsx("tbody",{children:T.map((G,ie)=>o.jsxs("tr",{className:`border-b border-white/5 ${G.error?"bg-red-900/10":""}`,children:[o.jsx("td",{className:"p-2 text-white/80",children:G.name}),o.jsx("td",{className:"p-2 text-white/60 font-mono",children:G.id}),o.jsx("td",{className:"p-2 text-white/60",children:G.level}),o.jsx("td",{className:"p-2 text-white/60",children:G.reportsTo}),G.error&&o.jsx("td",{className:"p-2 text-red-400 text-[10px]",children:G.error})]},ie))})]})})]})]}),V==="review"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"text-[11px] font-bold text-[var(--desk-dark)] uppercase tracking-wider mb-2",children:["Confirm Bulk Hire — ",T.length," roles"]}),o.jsx("div",{className:"bg-white/5 rounded-lg border border-white/10 overflow-hidden max-h-[300px] overflow-y-auto",children:o.jsxs("table",{className:"w-full text-xs",children:[o.jsx("thead",{className:"sticky top-0 bg-[var(--wall)]",children:o.jsxs("tr",{className:"border-b border-white/10",children:[o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"#"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Name"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"ID"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Level"}),o.jsx("th",{className:"text-left p-2 text-white/40 font-semibold",children:"Reports To"})]})}),o.jsx("tbody",{children:T.map((G,ie)=>o.jsxs("tr",{className:"border-b border-white/5",children:[o.jsx("td",{className:"p-2 text-white/30",children:ie+1}),o.jsx("td",{className:"p-2 text-white/80",children:G.name}),o.jsx("td",{className:"p-2 text-white/60 font-mono",children:G.id}),o.jsx("td",{className:"p-2 text-white/60",children:G.level}),o.jsx("td",{className:"p-2 text-white/60",children:G.reportsTo})]},ie))})]})}),L&&Z.total>0&&o.jsxs("div",{children:[o.jsxs("div",{className:"flex justify-between text-[10px] text-white/40 mb-1",children:[o.jsx("span",{children:"Hiring..."}),o.jsxs("span",{children:[Z.done,"/",Z.total]})]}),o.jsx("div",{className:"h-1.5 bg-white/10 rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Z.done/Z.total*100}%`,background:"#2E7D32"}})})]}),o.jsx("div",{className:"text-[10px] text-white/30",children:"Each role will get a random appearance and auto-generated persona. You can customize them later."}),U&&o.jsx("div",{className:"text-xs text-red-400 bg-red-900/20 p-2 rounded-lg border border-red-800/30",children:U})]})]})}),o.jsxs("div",{className:"flex justify-between px-5 pb-5",children:[o.jsxs("div",{children:[i==="single"&&u>1&&o.jsx("button",{onClick:()=>f(u-1),className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Back"}),i==="bulk"&&V==="review"&&o.jsx("button",{onClick:()=>I("input"),disabled:L,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer disabled:opacity-40",children:"Back"})]}),o.jsxs("div",{className:"flex gap-3",children:[o.jsx("button",{onClick:l,className:"px-4 py-2 text-sm rounded-lg border border-white/15 text-white/60 hover:bg-white/5 cursor-pointer",children:"Cancel"}),i==="single"?u<vs?o.jsx("button",{onClick:()=>f(u+1),disabled:!Ge(u),className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:"Next"}):o.jsx("button",{onClick:He,disabled:L,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:L?"Hiring...":"HIRE"}):V==="input"?o.jsxs("button",{onClick:()=>I("review"),disabled:!me,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:["Review (",T.length,")"]}):o.jsx("button",{onClick:ke,disabled:L,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#2E7D32"},children:L?`Hiring ${Z.done}/${Z.total}...`:`HIRE ALL (${T.length})`})]})]})]})]})}function ws({label:t,value:l,mono:r}){return o.jsxs("div",{className:"flex justify-between text-sm",children:[o.jsx("span",{className:"text-white/40",children:t}),o.jsx("span",{className:`font-semibold text-white/80 ${r?"font-mono":""}`,children:l})]})}function wC({roleId:t,roleName:l,onClose:r,onConfirm:i}){const[c,u]=k.useState(!1),f=async()=>{u(!0);try{await i(t)}finally{u(!1)}};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),o.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[480px] z-[61] bg-[var(--wall)] rounded-2xl shadow-2xl overflow-hidden",children:[o.jsxs("div",{className:"p-5 text-white",style:{background:"linear-gradient(135deg, #B71C1C, #D32F2F)"},children:[o.jsx("div",{className:"text-lg font-bold",children:"Fire Role"}),o.jsxs("div",{className:"text-sm opacity-80 mt-0.5",children:["Remove ",l," (",t,")"]})]}),o.jsxs("div",{className:"p-5",children:[o.jsxs("div",{className:"p-4 rounded-lg border-2 border-red-300 bg-red-50 mb-4",children:[o.jsx("div",{className:"text-sm font-bold text-red-800 mb-1",children:"Warning"}),o.jsxs("div",{className:"text-xs text-red-700 leading-relaxed",children:["This will permanently delete the role directory including",o.jsx("strong",{children:" role.yaml"}),", ",o.jsx("strong",{children:"profile.md"}),", ",o.jsx("strong",{children:"SKILL.md"}),", and all journal entries. This action cannot be undone."]})]}),o.jsxs("div",{className:"text-sm text-gray-600",children:["Are you sure you want to fire ",o.jsx("strong",{children:l}),"?"]})]}),o.jsxs("div",{className:"flex justify-end gap-3 px-5 pb-5",children:[o.jsx("button",{onClick:r,className:"px-4 py-2 text-sm rounded-lg border border-gray-300 hover:bg-gray-50 cursor-pointer",children:"Cancel"}),o.jsx("button",{onClick:f,disabled:c,className:"px-5 py-2 text-sm text-white rounded-lg font-semibold cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"#B71C1C"},children:c?"Removing...":"Confirm Fire"})]})]})]})}const kC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function SC({roleId:t,title:l,roleColor:r,active:i,onClick:c,onClose:u,"data-session-id":f}){return o.jsxs("button",{onClick:c,"data-session-id":f,className:`flex items-center gap-1.5 px-3 py-1.5 text-[11px] rounded-t-lg shrink-0 cursor-pointer transition-colors max-w-[180px] group ${i?"bg-[var(--terminal-bg)] text-[var(--terminal-text)]":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] hover:bg-[var(--terminal-surface)]"}`,style:i?{borderTop:`2px solid ${r}`}:void 0,children:[o.jsx("span",{className:"text-xs",children:kC[t]??"👤"}),o.jsx("span",{className:"truncate",children:l}),o.jsx("span",{onClick:u,className:"ml-auto text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none",children:"×"})]})}function jC({content:t,streaming:l}){let r=t;return l&&(t.match(/```/g)??[]).length%2!==0&&(r+="\n```"),o.jsx("div",{className:"terminal-markdown",children:o.jsx(Ay,{remarkPlugins:[Jy],components:{code:CC,table:({children:i})=>o.jsx("div",{className:"overflow-x-auto my-2",children:o.jsx("table",{className:"terminal-table",children:i})})},children:r})})}function CC({className:t,children:l,...r}){const i=/language-(\w+)/.exec(t??"");return i||typeof l=="string"&&l.includes(`
|
|
87
|
+
`)?o.jsx(EC,{language:i==null?void 0:i[1],children:l}):o.jsx("code",{className:"terminal-inline-code",...r,children:l})}function EC({children:t,language:l}){const[r,i]=k.useState(!1),c=String(t).replace(/\n$/,""),u=()=>{navigator.clipboard.writeText(c),i(!0),setTimeout(()=>i(!1),1500)};return o.jsxs("div",{className:"terminal-code-block group relative my-2",children:[l&&o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] px-3 pt-1.5",children:l}),o.jsx("button",{onClick:u,className:"absolute top-1.5 right-2 text-[10px] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:r?"Copied!":"Copy"}),o.jsx("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:o.jsx("code",{children:c})})]})}const NC={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍"};function Cd(t,l){return l?l.file_path?String(l.file_path).replace(/^.*\/(?=[^/]+\/)/,""):l.path?String(l.path).replace(/^.*\/(?=[^/]+\/)/,""):l.pattern?String(l.pattern):l.command?String(l.command).slice(0,60):l.query?String(l.query).slice(0,60):l.url?String(l.url).slice(0,60):"":""}function AC(t){const l=[];let r="";for(const i of t)if(i.type==="thinking")i.text&&(r=i.text),l.length===0||l[l.length-1].type!=="thinking"?l.push({type:"thinking",text:i.text}):l[l.length-1].text=i.text;else if(i.type==="tool")l.push({type:"tool",toolName:i.toolName,toolSummary:Cd(i.toolName??"",i.toolInput),toolInput:i.toolInput});else if(i.type==="dispatch")l.push({type:"dispatch",roleId:i.roleId,task:i.task});else if(i.type==="dispatch:progress"){const c=l.length>0?l[l.length-1]:null;(c==null?void 0:c.type)==="dispatch:progress"&&c.roleId===i.roleId?i.progressType==="tool"?(c.toolName=i.toolName,c.toolSummary=Cd(i.toolName??"",i.toolInput),c.progressType="tool"):i.progressType==="thinking"?(c.text=i.text,c.progressType="thinking"):i.progressType==="text"?(c.text=i.text,c.progressType="text"):(i.progressType==="done"||i.progressType==="error")&&(c.progressType=i.progressType):l.push({type:"dispatch:progress",roleId:i.roleId,progressType:i.progressType,text:i.text,toolName:i.toolName,toolSummary:i.toolName?Cd(i.toolName,i.toolInput):void 0})}if(r){const i=l.filter(c=>c.type==="thinking");i.length>0&&(i[i.length-1].text=r)}return l}function TC({event:t,isStreaming:l}){var c,u,f;const[r,i]=k.useState(!1);switch(t.type){case"thinking":return o.jsxs("div",{className:"stream-event-thinking",children:[o.jsxs("div",{className:"stream-event-thinking-header",onClick:()=>i(!r),children:[o.jsx("span",{className:"stream-event-thinking-icon"}),o.jsxs("span",{className:"stream-event-thinking-label",children:["thinking",l?"...":""]}),t.text&&!l&&o.jsx("span",{className:"stream-event-thinking-toggle",children:r?"▾":"▸"})]}),(l||r)&&t.text&&o.jsx("div",{className:"stream-event-thinking-content",children:t.text.slice(-500)})]});case"tool":return o.jsxs("div",{className:"stream-event-tool",children:[o.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&o.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary}),t.toolInput&&o.jsx("span",{className:"stream-event-tool-toggle",onClick:()=>i(!r),children:r?"▾":"▸"}),r&&t.toolInput&&o.jsx("div",{className:"stream-event-tool-detail",children:JSON.stringify(t.toolInput,null,1).slice(0,300)})]});case"dispatch":return o.jsxs("div",{className:"stream-event-dispatch",children:[o.jsxs("span",{className:"stream-event-dispatch-badge",children:["→"," ",(c=t.roleId)==null?void 0:c.toUpperCase()]}),o.jsx("span",{className:"stream-event-dispatch-task",children:(u=t.task)==null?void 0:u.slice(0,80)})]});case"dispatch:progress":return o.jsxs("div",{className:"stream-event-dispatch-progress",children:[o.jsx("span",{className:"stream-event-dispatch-progress-role",children:(f=t.roleId)==null?void 0:f.toUpperCase()}),t.progressType==="thinking"&&o.jsxs("span",{className:"stream-event-dispatch-progress-status",children:["thinking",l?"...":""]}),t.progressType==="tool"&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"stream-event-tool-badge",children:t.toolName}),t.toolSummary&&o.jsx("span",{className:"stream-event-tool-path",children:t.toolSummary})]}),t.progressType==="text"&&t.text&&o.jsx("span",{className:"stream-event-dispatch-progress-status",children:"responding..."}),t.progressType==="done"&&o.jsx("span",{className:"stream-event-dispatch-progress-done",children:"done"}),t.progressType==="error"&&o.jsx("span",{className:"stream-event-dispatch-progress-error",children:"error"})]});default:return null}}function DC({events:t,isStreaming:l}){const[r,i]=k.useState(!1);if(t.length===0)return null;const c=AC(t);if(c.length===0)return null;const u=t.filter(b=>b.type==="thinking").length,f=t.filter(b=>b.type==="tool"),m=t.filter(b=>b.type==="dispatch"||b.type==="dispatch:progress"),x=t.filter(b=>b.type==="turn").reduce((b,v)=>Math.max(b,v.turn??0),0),d=[];if(u>0&&d.push("thinking"),f.length>0){const b=[...new Set(f.map(v=>v.toolName))];b.length<=3?d.push(b.join(", ")):d.push(`${f.length} tool calls`)}m.length>0&&d.push(`${m.length} dispatch`),x>1&&d.push(`${x} turns`);const g=d.join(" · "),y=!r;return o.jsxs("div",{className:"stream-activity-log",children:[o.jsxs("div",{className:"stream-activity-header",onClick:()=>i(!r),children:[l&&o.jsx("span",{className:"stream-activity-pulse"}),o.jsxs("span",{className:"stream-activity-summary",children:[r?"▸":"▾"," ",g,l?"...":""]})]}),y&&o.jsx("div",{className:"stream-activity-events",children:c.map((b,v)=>o.jsx(TC,{event:b,isStreaming:l&&v===c.length-1},v))})]})}function zC({message:t,roleId:l,roleColor:r}){var d;const i=t.from==="ceo",c=t.type==="system",u=t.status==="streaming";if(c)return o.jsx("div",{className:"flex justify-center my-2",children:o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] bg-[var(--terminal-inline-bg)] px-3 py-1 rounded-full",children:t.content})});if(i)return o.jsx("div",{className:"flex justify-end mb-3",children:o.jsxs("div",{className:"max-w-[85%]",children:[o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] text-right mb-1",children:"CEO"}),o.jsxs("div",{className:"bg-[var(--terminal-surface-light)] rounded-xl rounded-tr-sm px-4 py-2.5 text-sm text-[var(--terminal-text)] leading-relaxed",children:[t.type==="directive"&&o.jsx("span",{className:"text-amber-400 text-[10px] font-bold mr-1.5",children:"DO"}),t.content]})]})});const f=(((d=t.streamEvents)==null?void 0:d.length)??0)>0,m=!!t.thinking,x=m&&!t.content&&u&&!f;return o.jsxs("div",{className:"flex gap-2.5 mb-3",children:[o.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center text-sm shrink-0 mt-5",style:{background:`${r}33`},children:NC[l]??"👤"}),o.jsxs("div",{className:"max-w-[85%] min-w-0",children:[o.jsx("div",{className:"text-[10px] text-[var(--terminal-text-muted)] mb-1",children:l.toUpperCase()}),f&&o.jsx(DC,{events:t.streamEvents,isStreaming:u}),m&&!f&&o.jsxs("details",{open:x,className:"mb-1",children:[o.jsxs("summary",{className:"text-[10px] text-purple-400/70 cursor-pointer select-none flex items-center gap-1",children:[x&&o.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-purple-400 animate-pulse"}),"thinking",x?"...":` (${t.thinking.length} chars)`]}),o.jsx("div",{className:"text-[11px] text-[var(--terminal-text-muted)] leading-relaxed mt-1 pl-2 border-l border-purple-400/20 max-h-32 overflow-y-auto",children:t.thinking.slice(-500)})]}),o.jsxs("div",{className:"rounded-xl rounded-tl-sm px-4 py-2.5 text-sm text-[var(--terminal-text)] leading-relaxed",style:{borderLeft:`3px solid ${r}`,background:"var(--terminal-surface)"},children:[t.content?o.jsx(jC,{content:t.content,streaming:u}):u&&!m?o.jsx("span",{className:"inline-block w-2 h-4 bg-[var(--terminal-text-secondary)] animate-pulse"}):u&&m?o.jsx("span",{className:"text-[11px] text-purple-400/50 italic",children:"analyzing..."}):null,u&&t.content&&o.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-[var(--terminal-text-secondary)] animate-pulse ml-0.5 align-middle"})]}),t.status==="error"&&o.jsx("div",{className:"text-[10px] text-red-400 mt-1",children:"Error occurred"})]})]})}function MC({messages:t,roleId:l,roleColor:r}){var c;const i=k.useRef(null);return k.useEffect(()=>{var u;(u=i.current)==null||u.scrollIntoView({behavior:"smooth"})},[t,(c=t[t.length-1])==null?void 0:c.content]),t.length===0?o.jsxs("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:["Start a conversation with ",l.toUpperCase()]}):o.jsxs("div",{className:"flex-1 overflow-y-auto p-4 terminal-scrollbar",children:[t.map(u=>o.jsx(zC,{message:u,roleId:l,roleColor:r},u.id)),o.jsx("div",{ref:i})]})}function RC({mode:t,onModeChange:l,onSend:r,disabled:i,disabledReason:c}){const[u,f]=k.useState(""),m=k.useRef(null);k.useEffect(()=>{const g=m.current;g&&(g.style.height="0",g.style.height=Math.min(g.scrollHeight,120)+"px")},[u]);const x=()=>{const g=u.trim();!g||i||(r(g),f(""))},d=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),x())};return o.jsxs("div",{className:"border-t border-[var(--terminal-border)] p-3 shrink-0",children:[c&&o.jsx("div",{className:"text-[10px] text-amber-400/70 mb-2 text-center",children:c}),o.jsxs("div",{className:"flex items-end gap-2",children:[o.jsxs("div",{className:"flex rounded-lg overflow-hidden border border-[var(--terminal-border)] shrink-0",children:[o.jsx("button",{onClick:()=>l("talk"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${t==="talk"?"bg-[var(--desk-wood)] text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Talk"}),o.jsx("button",{onClick:()=>l("do"),className:`px-2.5 py-1.5 text-[11px] font-semibold cursor-pointer transition-colors ${t==="do"?"bg-amber-700 text-white":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)]"}`,children:"Do"})]}),o.jsx("textarea",{ref:m,value:u,onChange:g=>f(g.target.value),onKeyDown:d,placeholder:i?"Waiting...":t==="talk"?"Ask something...":"Give a directive...",disabled:i,rows:1,className:"flex-1 bg-[var(--terminal-inline-bg)] border border-[var(--terminal-border)] rounded-lg px-3 py-2 text-sm text-[var(--terminal-text)] placeholder:text-[var(--terminal-text-muted)] resize-none focus:outline-none focus:border-[var(--terminal-border-hover)] disabled:opacity-40 terminal-scrollbar"}),o.jsx("button",{onClick:x,disabled:i||!u.trim(),className:"w-8 h-8 rounded-lg bg-[var(--terminal-surface-light)] text-[var(--terminal-text-secondary)] flex items-center justify-center shrink-0 cursor-pointer hover:bg-[var(--desk-wood)] hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M22 2L11 13"}),o.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})})]})]})}const FC={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},kg={cto:"CTO",cbo:"CBO",pm:"PM",engineer:"Engineer",designer:"Designer",qa:"QA","data-analyst":"Data Analyst"};function S0(t){return new Date(t).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit"})}function _C({msg:t}){const l=FC[t.roleId]??"#888",r=kg[t.roleId]??t.roleId;if(t.type==="dispatch"){const i=t.text.includes("WAVE"),c=t.text.includes("completed")||t.text.includes("완료"),u=i?"📡":c?"✓":"→",f=c?"text-green-400/70":"text-[var(--terminal-text-muted)]";return o.jsxs("div",{className:"flex items-start gap-2 px-3 py-1 hover:bg-white/[0.02]",children:[o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:S0(t.ts)}),o.jsx("span",{className:"text-[10px] shrink-0 mt-0.5",children:u}),o.jsx("span",{className:`text-[11px] ${f}`,children:t.text})]})}return o.jsxs("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-white/[0.02]",children:[o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)] shrink-0 w-10 text-right mt-0.5",children:S0(t.ts)}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-[11px] font-semibold mr-1.5",style:{color:l},children:r}),o.jsx("span",{className:"text-xs text-[var(--terminal-text-secondary)]",children:t.text})]})]})}function OC({channel:t,allRoles:l,onUpdateMembers:r,onUpdateTopic:i}){const c=k.useRef(null),u=k.useRef(null);k.useEffect(()=>{var j;const b=u.current;if(!b)return;b.scrollHeight-b.scrollTop-b.clientHeight<80&&((j=c.current)==null||j.scrollIntoView({behavior:"smooth"}))},[t.messages.length]);const[f,m]=k.useState(!1),[x,d]=k.useState(!1),[g,y]=k.useState("");return o.jsxs("div",{ref:u,className:"flex-1 overflow-y-auto terminal-scrollbar py-2",children:[o.jsxs("div",{className:"px-3 py-2 mb-2 border-b border-[var(--terminal-border)] flex items-center gap-2",children:[o.jsx("span",{className:"text-sm font-semibold text-[var(--terminal-text)]",children:t.name}),t.members.length>0&&o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.members.map(b=>kg[b]??b).join(", ")}),t.members.length===0&&o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:t.isDefault?"system logs":"no members"}),!t.isDefault&&l&&r&&o.jsx("button",{className:"ml-auto text-[10px] px-2 py-0.5 rounded bg-white/5 hover:bg-white/10 text-[var(--terminal-text-muted)]",onClick:()=>m(!f),children:f?"Done":"Invite"})]}),!t.isDefault&&i&&o.jsx("div",{className:"px-3 pb-2 mb-1",children:x?o.jsx("input",{autoFocus:!0,value:g,onChange:b=>y(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(i(t.id,g.trim()),d(!1)),b.key==="Escape"&&d(!1)},onBlur:()=>{i(t.id,g.trim()),d(!1)},placeholder:"Set a topic for this channel...",className:"w-full bg-transparent text-[10px] text-[var(--terminal-text-muted)] outline-none border-b border-[var(--terminal-border)] pb-0.5"}):o.jsx("button",{onClick:()=>{y(t.topic??""),d(!0)},className:"text-[10px] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] cursor-pointer italic",children:t.topic||"Click to set channel topic..."})}),f&&!t.isDefault&&l&&r&&o.jsx("div",{className:"px-3 pb-2 mb-2 border-b border-[var(--terminal-border)]",children:o.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(b=>{const v=t.members.includes(b.id);return o.jsxs("button",{className:`text-[10px] px-2 py-1 rounded ${v?"bg-white/15 text-[var(--terminal-text)]":"bg-white/5 text-[var(--terminal-text-muted)]"}`,onClick:()=>{const j=v?t.members.filter(S=>S!==b.id):[...t.members,b.id];r(t.id,j)},children:[v?"✓ ":"",b.name]},b.id)})})}),t.messages.length===0&&o.jsx("div",{className:"flex-1 flex flex-col items-center justify-center text-[var(--terminal-text-muted)] text-xs gap-1 py-8",children:o.jsx("span",{children:t.isDefault?"No dispatch events yet":"No messages yet — invite roles to start chatting"})}),t.messages.map(b=>o.jsx(_C,{msg:b},b.id)),o.jsx("div",{ref:c})]})}const Ed={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C"},BC=400,LC=800;function $C({sessions:t,activeSessionId:l,roles:r,streamingSessionId:i,width:c,onWidthChange:u,onSwitchSession:f,onCloseSession:m,onCreateSession:x,onClearEmpty:d,onCloseAll:g,onSendMessage:y,onModeChange:b,onCloseTerminal:v,chatChannels:j,activeChatChannelId:S,onSwitchChatChannel:E,onCreateChatChannel:C,onDeleteChatChannel:A,onUpdateChatMembers:M,onUpdateChatTopic:R,unreadChannels:L}){const[O,U]=k.useState(!1),[X,ne]=k.useState(!1),[D,Y]=k.useState(!1),[F,Q]=k.useState(""),ee=S!=null,V=j==null?void 0:j.find(ke=>ke.id===S),[I,Z]=k.useState(!1),[ce,we]=k.useState(!1),[z,B]=k.useState(!1),W=k.useRef(0),T=k.useRef(0),me=k.useRef(null),Se=t.find(ke=>ke.id===l),Ee=i===l,Oe=t.filter(ke=>ke.messages.length===0).length,He=k.useCallback(()=>{const ke=me.current;ke&&(we(ke.scrollLeft>0),B(ke.scrollLeft+ke.clientWidth<ke.scrollWidth-1))},[]);k.useEffect(()=>{if(!l||!me.current)return;const ke=me.current.querySelector(`[data-session-id="${l}"]`);ke&&ke.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}),He()},[l,t.length,He]),k.useEffect(()=>{const ke=me.current;if(!ke)return;He(),ke.addEventListener("scroll",He);const xt=new ResizeObserver(He);return xt.observe(ke),()=>{ke.removeEventListener("scroll",He),xt.disconnect()}},[He]);const Ge=k.useCallback(ke=>{ke.preventDefault(),W.current=ke.clientX,T.current=c,Z(!0);const xt=G=>{const ie=W.current-G.clientX,xe=Math.min(LC,Math.max(BC,T.current+ie));u==null||u(xe)},he=()=>{Z(!1),document.removeEventListener("mousemove",xt),document.removeEventListener("mouseup",he)};document.addEventListener("mousemove",xt),document.addEventListener("mouseup",he)},[c,u]);return o.jsxs("div",{className:"shrink-0 bg-[var(--terminal-bg)] border-l border-[var(--terminal-border)] flex flex-col h-full relative",style:{width:c},children:[u&&o.jsx("div",{className:`terminal-resize-handle absolute top-0 left-0 w-1 h-full cursor-col-resize z-10 transition-colors ${I?"bg-[var(--terminal-border-hover)]":"bg-transparent"}`,onMouseDown:Ge}),o.jsxs("div",{className:"flex items-center bg-[var(--terminal-bg-deeper)] border-b border-[var(--terminal-border)] shrink-0",children:[o.jsxs("div",{className:"relative flex-1 min-w-0",children:[ce&&o.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-6 bg-gradient-to-r from-[var(--terminal-bg-deeper)] to-transparent z-10 pointer-events-none"}),o.jsxs("div",{ref:me,className:"flex items-center overflow-x-auto terminal-tab-scroll gap-px px-1 py-1",children:[j==null?void 0:j.map(ke=>o.jsxs("button",{onClick:()=>{E==null||E(ke.id)},className:`flex items-center gap-1 px-2.5 py-1.5 text-[11px] rounded-t-lg shrink-0 cursor-pointer transition-colors group ${S===ke.id?"bg-[var(--terminal-bg)] text-[var(--terminal-text)]":"bg-[var(--terminal-inline-bg)] text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface)]"}`,style:S===ke.id?{borderTop:"2px solid #4CAF50"}:void 0,children:[o.jsx("span",{className:"text-[10px]",children:"💬"}),o.jsx("span",{className:"truncate",children:ke.name}),(L==null?void 0:L.has(ke.id))&&S!==ke.id&&o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 shrink-0"}),!ke.isDefault&&o.jsx("span",{onClick:xt=>{xt.stopPropagation(),A==null||A(ke.id)},className:"ml-1 text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm leading-none opacity-0 group-hover:opacity-100",children:"×"})]},ke.id)),j&&j.length>0&&t.length>0&&o.jsx("div",{className:"w-px h-4 bg-[var(--terminal-border)] shrink-0 mx-1"}),t.map(ke=>o.jsx(SC,{roleId:ke.roleId,title:ke.title,roleColor:Ed[ke.roleId]??"#666",active:!ee&&ke.id===l,onClick:()=>{E==null||E(null),f(ke.id)},onClose:xt=>{xt.stopPropagation(),m(ke.id)},"data-session-id":ke.id},ke.id))]}),z&&o.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-6 bg-gradient-to-l from-[var(--terminal-bg-deeper)] to-transparent z-10 pointer-events-none"})]}),o.jsxs("div",{className:"relative shrink-0",children:[o.jsx("button",{onClick:()=>{U(!O),ne(!1)},className:"w-7 h-7 flex items-center justify-center text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-lg cursor-pointer",children:"+"}),O&&o.jsxs("div",{className:"absolute top-full right-0 mt-1 bg-[var(--terminal-surface)] border border-[var(--terminal-border)] rounded-lg shadow-xl z-50 py-1 min-w-[200px]",children:[C&&o.jsxs(o.Fragment,{children:[D?o.jsxs("div",{className:"px-3 py-2 flex items-center gap-1",children:[o.jsx("span",{className:"text-[10px] text-[var(--terminal-text-muted)]",children:"#"}),o.jsx("input",{autoFocus:!0,value:F,onChange:ke=>Q(ke.target.value),onKeyDown:ke=>{ke.key==="Enter"&&F.trim()&&(C(F.trim(),[]),Q(""),Y(!1),U(!1)),ke.key==="Escape"&&(Y(!1),Q(""))},placeholder:"channel name",className:"flex-1 bg-transparent text-xs text-[var(--terminal-text)] outline-none border-b border-[var(--terminal-border)]"})]}):o.jsxs("button",{onClick:()=>Y(!0),className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer flex items-center gap-2",children:[o.jsx("span",{className:"text-[10px]",children:"💬"}),"New Channel"]}),o.jsx("div",{className:"border-b border-[var(--terminal-border)] my-1"})]}),r.map(ke=>o.jsxs("button",{onClick:()=>{x(ke.id),E==null||E(null),U(!1)},className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:Ed[ke.id]??"#666"}}),ke.id.toUpperCase()," — ",ke.name]},ke.id))]})]}),o.jsxs("div",{className:"relative shrink-0",children:[o.jsx("button",{onClick:()=>{ne(!X),U(!1)},className:"w-7 h-7 flex items-center justify-center text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-xs cursor-pointer tracking-tight",title:"Manage sessions",children:"···"}),X&&o.jsxs("div",{className:"absolute top-full right-0 mt-1 bg-[var(--terminal-surface)] border border-[var(--terminal-border)] rounded-lg shadow-xl z-50 py-1 min-w-[200px]",children:[o.jsxs("div",{className:"px-3 py-1.5 text-[10px] text-[var(--terminal-text-muted)] border-b border-[var(--terminal-border)]",children:[t.length," session",t.length!==1?"s":""]}),Oe>0&&d&&o.jsxs("button",{onClick:()=>{d(),ne(!1)},className:"w-full text-left px-3 py-2 text-xs text-[var(--terminal-text-secondary)] hover:bg-[var(--terminal-surface-light)] cursor-pointer",children:["Clear empty sessions (",Oe,")"]}),t.length>0&&g&&o.jsx("button",{onClick:()=>{g(),ne(!1)},className:"w-full text-left px-3 py-2 text-xs text-[#E57373] hover:bg-[var(--terminal-surface-light)] cursor-pointer",children:"Close all sessions"}),t.length===0&&o.jsx("div",{className:"px-3 py-2 text-xs text-[var(--terminal-text-muted)]",children:"No sessions"})]})]}),o.jsx("button",{onClick:v,className:"px-2 py-1 text-[var(--terminal-text-muted)] hover:text-[var(--terminal-text-secondary)] text-sm cursor-pointer shrink-0",children:"×"})]}),ee&&V?o.jsx(OC,{channel:V,allRoles:r,onUpdateMembers:M,onUpdateTopic:R}):Se?o.jsxs(o.Fragment,{children:[o.jsx(MC,{messages:Se.messages,roleId:Se.roleId,roleColor:Ed[Se.roleId]??"#666"}),o.jsx(RC,{mode:Se.mode,onModeChange:ke=>b(Se.id,ke),onSend:ke=>y(Se.id,ke,Se.mode),disabled:Ee,disabledReason:Ee?`${Se.roleId.toUpperCase()} is responding...`:void 0})]}):o.jsx("div",{className:"flex-1 flex items-center justify-center text-[var(--terminal-text-muted)] text-sm",children:"No active session. Click [+] to start."})]})}function HC(){const t=k.useRef(null),l=k.useCallback(()=>{var i;(i=t.current)==null||i.abort(),t.current=null},[]);return{sendMessage:k.useCallback((i,c,u,f)=>{l();const m=new AbortController;return t.current=m,fetch(`/api/exec/session/${i}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:c,mode:u}),signal:m.signal}).then(async x=>{var b,v,j,S,E;if(!x.ok||!x.body){f.onError("Failed to connect");return}const d=x.body.getReader(),g=new TextDecoder;let y="";for(;;){const{done:C,value:A}=await d.read();if(C)break;y+=g.decode(A,{stream:!0});const M=y.split(`
|
|
88
|
+
`);y=M.pop()??"";let R="";for(let L=0;L<M.length;L++){const O=M[L];if(O.startsWith("event: ")){R=O.slice(7).trim();continue}if(O.startsWith("data: ")){let U;try{U=JSON.parse(O.slice(6))}catch{R="";continue}switch(R){case"thinking":U.text&&((b=f.onThinking)==null||b.call(f,U.text));break;case"output":U.text&&f.onText(U.text);break;case"tool":(v=f.onToolUse)==null||v.call(f,U.name,U.input);break;case"dispatch":(j=f.onDispatch)==null||j.call(f,U.roleId,U.task);break;case"dispatch:progress":(S=f.onDispatchProgress)==null||S.call(f,U.roleId,U.type,U);break;case"turn":(E=f.onTurn)==null||E.call(f,U.turn);break;case"done":f.onDone(U);break;case"error":f.onError(U.message??"Unknown error");break;default:U.text&&f.onText(U.text);break}R=""}}}}).catch(x=>{x.name!=="AbortError"&&f.onError(x.message)}),{abort:l}},[l]),abort:l}}const Nh="tycono-appearances",Rc="tycono-theme";(()=>{try{for(const[t,l]of[["the-company-appearances",Nh],["the-company-theme",Rc]]){const r=localStorage.getItem(t);r&&!localStorage.getItem(l)&&(localStorage.setItem(l,r),localStorage.removeItem(t))}}catch{}})();function j0(){try{const t=localStorage.getItem(Nh);return t?JSON.parse(t):{}}catch{return{}}}function Nd(t){localStorage.setItem(Nh,JSON.stringify(t))}function C0(){try{const t=localStorage.getItem(Rc);if(t&&t in Yr)return t}catch{}return"default"}function UC(t){var i;const l=(i=Yr[t])==null?void 0:i.vars;if(!l)return;const r=document.documentElement;for(const[c,u]of Object.entries(l))r.style.setProperty(c,u)}const Ad={mode:"auto",intervalSec:18,dailyBudgetUsd:1},Pd="tycono-speech-settings",Td="tycono-language";function IC(){try{const t=localStorage.getItem(Pd);return t?{...Ad,...JSON.parse(t)}:Ad}catch{return Ad}}function YC(){const[t,l]=k.useState(j0),[r,i]=k.useState(C0),[c,u]=k.useState(IC),[f,m]=k.useState(()=>{try{return localStorage.getItem(Td)??"auto"}catch{return"auto"}}),x=k.useRef(!1);k.useEffect(()=>{x.current||(x.current=!0,Ce.getPreferences().then(S=>{const E=Object.keys(S.appearances??{}).length>0||S.theme!=="default";if(S.speech&&(u(C=>({...C,...S.speech})),localStorage.setItem(Pd,JSON.stringify(S.speech))),S.language&&(m(S.language),localStorage.setItem(Td,S.language)),E){const C=S.appearances;l(C),Nd(C),S.theme&&S.theme in Yr&&(i(S.theme),localStorage.setItem(Rc,S.theme))}else{const C=j0(),A=C0();(Object.keys(C).length>0||A!=="default")&&Ce.updatePreferences({appearances:C,theme:A}).catch(()=>{})}}).catch(()=>{}))},[]),k.useEffect(()=>{UC(r)},[r]);const d=k.useCallback(S=>t[S]??Eh(S),[t]),g=k.useCallback((S,E)=>{l(C=>{const A={...C,[S]:E};return Nd(A),Ce.updatePreferences({appearances:A}).catch(()=>{}),A})},[]),y=k.useCallback(S=>{l(E=>{const C={...E};return delete C[S],Nd(C),Ce.updatePreferences({appearances:C}).catch(()=>{}),C})},[]),b=k.useCallback(S=>{i(S),localStorage.setItem(Rc,S),Ce.updatePreferences({theme:S}).catch(()=>{})},[]),v=k.useCallback(S=>{u(E=>{const C={...E,...S};return localStorage.setItem(Pd,JSON.stringify(C)),Ce.updatePreferences({speech:C}).catch(()=>{}),C})},[]),j=k.useCallback(S=>{m(S),localStorage.setItem(Td,S),Ce.updatePreferences({language:S}).catch(()=>{})},[]);return{appearances:t,getAppearance:d,setAppearance:g,resetAppearance:y,theme:r,setTheme:b,speechSettings:c,setSpeechSettings:v,language:f,setLanguage:j}}const qC=3e4;function XC(){var E;const[t,l]=k.useState(null),[r,i]=k.useState("synced"),[c,u]=k.useState([]),f=k.useRef(null),m=k.useCallback(async()=>{try{const C=await Ce.getSaveStatus();l(C),C.noGit?i("no-git"):i(A=>A==="saving"?A:C.dirty?"dirty":"synced")}catch{i("error")}},[]),x=k.useCallback(()=>{f.current||(m(),f.current=setInterval(m,qC))},[m]);k.useEffect(()=>()=>{f.current&&clearInterval(f.current)},[]);const d=k.useCallback(async C=>{i("saving");try{const A=await Ce.save(C);return await m(),A}catch(A){throw i("error"),A}},[m]),g=k.useCallback(async()=>{try{const C=await Ce.getSaveHistory(20);u(C)}catch{}},[]),y=k.useCallback(async C=>{i("saving");try{await Ce.restoreSave(C),await m()}catch(A){throw i("error"),A}},[m]),b=k.useCallback(async()=>{try{await Ce.initGit(),await m()}catch{i("error")}},[m]),v=t?t.modified.length+t.untracked.length:0,j=((E=t==null?void 0:t.lastCommit)==null?void 0:E.date)??null,S=k.useCallback(async()=>{x()},[x]);return{state:r,dirtyCount:v,lastSaved:j,status:t,save:d,history:c,loadHistory:g,restore:y,refresh:S,initGit:b}}const E0={cto:["Need to reduce this architecture tech debt...","Don't over-engineer. Keep it minimal.","Performance profiling results are a bit concerning.","Should do a system design review.","If I just strip one abstraction layer, it should work.","Let me check the monitoring dashboard.","Need to go through the code review queue.","It's about time to clean up these module dependencies."],cbo:["Heard the competitor launched a new feature... need to analyze.","Should compile this month's revenue metrics.","It's time to update the market trend report.","Maybe I should benchmark the pricing strategy.","Need to recalculate the ROI.","Let me check the competitor's GitHub star trends.","Thinking about launch timing...","Should re-examine the positioning strategy."],pm:["Is this feature really what users want?","Need to clean up the backlog...","MVP scope keeps expanding.","Analyzing user feedback...","Might need to re-prioritize.","Watch out for scope creep.","Will the roadmap timeline hold...","Should double-check the task dependencies."],engineer:["I want to refactor this code...","Test coverage seems a bit low.","Working code first, perfect code later.","Waiting for PR review...","What could be causing this bug...","Is the build broken?","Need to fix that one type error.","Maybe I should run npm audit."],designer:["This UI flow feels a bit awkward...","Usability first, pretty later.","Need to organize the design system components.","Let me make two quick options and compare.","Should run through the accessibility checklist.","Maybe I should prototype this interaction.","Let me revisit the color palette...","The spacing feels a bit cramped."],qa:['"Works" and "correct" are two different things.',"Organizing edge case scenarios...","Should run the regression test suite.","This part could be converted to automated tests.","Need to go through the pre-release checklist.","Reproducible bug reports are key.","Should run cross-browser tests.","Need to check for performance regressions."],"data-analyst":["Checking the data pipeline status...","Interesting outlier detection pattern.","Need to update the dashboard metrics.","Correlation isn't causation though...","Seems like there is room for SQL query optimization.","It's time for a data quality check."]},N0={cto:["Should I assign more work to the team...","It's time to clean up the architecture debt.","Need to re-examine the tech roadmap.","It's quiet... am I missing something?"],cbo:["It's time to update the market analysis...","Should be preparing the revenue report, but no directives.","Let me check on competitor movements.","It's quiet on the business side..."],pm:["Backlog is pretty quiet... nothing to plan?","It's been a while since we scheduled a sprint.","User feedback must be piling up...","No PRD to write... that's unusual."],engineer:["Nothing to do today... maybe some code reviews.","Task queue is empty. Guess I'll refactor.","Am I missing something?","Should clean up the commit log."],designer:["No design requests coming in. Should I improve something on my own?","Maybe run a UI audit...","Should organize my portfolio.","Let me tidy up the component library."],qa:["No builds to test. Let me improve the automation scripts.","It's quiet... no bugs, or just haven't found them?","Let me review the existing test scenarios.","Should update the test coverage report."],"data-analyst":["No analysis requests coming in...","Maybe I should clean up the data warehouse.","Should verify the past reports."]},VC=[{id:"sup-check-1",relation:"superior-subordinate",minFamiliarity:0,topic:"progress",turns:[{speaker:"A",text:"How's the progress?"},{speaker:"B",text:"Going well. Should be done soon."},{speaker:"A",text:"Good, let me know when it's done."}]},{id:"sup-check-2",relation:"superior-subordinate",minFamiliarity:20,topic:"progress",turns:[{speaker:"A",text:"What are you working on today?"},{speaker:"B",text:"Finishing up what I was doing yesterday."}]},{id:"sub-report-1",relation:"superior-subordinate",minFamiliarity:10,topic:"report",turns:[{speaker:"B",text:"Done with that task from earlier."},{speaker:"A",text:"Nice work. Can you share the results?"},{speaker:"B",text:"Sure, I've updated the docs."}]},{id:"peer-tech-1",relation:"peer",minFamiliarity:20,topic:"tech",turns:[{speaker:"A",text:"What do you think about this design?"},{speaker:"B",text:"I think we could go simpler."},{speaker:"A",text:"Really? Want to look at it together?"}]},{id:"peer-tech-2",relation:"peer",minFamiliarity:30,topic:"tech",turns:[{speaker:"A",text:"Have you used this library before?"},{speaker:"B",text:"Yeah, used it in the last project. It was decent."}]},{id:"close-feedback-1",relation:"peer",minFamiliarity:60,topic:"feedback",turns:[{speaker:"A",text:"Can I be honest with you?"},{speaker:"B",text:"Of course, go ahead."},{speaker:"A",text:"This one feels a bit off. Let's revisit."},{speaker:"B",text:"...Alright. Thanks for the feedback."}]},{id:"clevel-sync-1",relation:"c-level",minFamiliarity:10,topic:"strategy",turns:[{speaker:"A",text:"We need to sync the roadmap with the business timeline."},{speaker:"B",text:"Agreed. I'll have it organized and shared by tomorrow."}]},{id:"clevel-sync-2",relation:"c-level",minFamiliarity:30,topic:"strategy",turns:[{speaker:"A",text:"I have some competitor intel to share."},{speaker:"B",text:"Great, I have a tech update too."},{speaker:"A",text:"Let's sync up when you're free."}]},{id:"casual-coffee",relation:"any",minFamiliarity:30,topic:"casual",turns:[{speaker:"A",text:"Want to grab a coffee?"},{speaker:"B",text:"Sure. Feels like it's going to be a long day."}]},{id:"casual-overtime",relation:"any",minFamiliarity:25,topic:"casual",turns:[{speaker:"A",text:"Working late again..."},{speaker:"B",text:"We're in this together. Hang in there."}]},{id:"casual-lunch",relation:"any",minFamiliarity:35,topic:"casual",turns:[{speaker:"A",text:"What should we get for lunch?"},{speaker:"B",text:"Anything. Feel like we eat the same thing every day."}]},{id:"casual-weekend",relation:"any",minFamiliarity:40,topic:"casual",turns:[{speaker:"A",text:"What did you do this weekend?"},{speaker:"B",text:"Just rested. Was too tired."}]},{id:"bestie-1",relation:"any",minFamiliarity:80,topic:"trust",turns:[{speaker:"A",text:"I'm a bit unsure about this direction..."},{speaker:"B",text:"What's bothering you? Be honest."},{speaker:"A",text:"Thanks. It's nice having someone I can talk to."}]}],GC=18e3,A0=6e3,KC=2500,QC=30*6e4,Sg="tycono:relationships";function WC(){try{const t=localStorage.getItem(Sg);return t?JSON.parse(t):[]}catch{return[]}}function ZC(t){localStorage.setItem(Sg,JSON.stringify(t))}function uc(t,l,r){const[i,c]=l<r?[l,r]:[r,l];let u=t.find(f=>f.roleA===i&&f.roleB===c);return u||(u={roleA:i,roleB:c,dispatches:0,wavesTogether:0,conversations:0,familiarity:0,lastInteraction:new Date().toISOString()},t.push(u)),u}function fc(t){return Math.min(100,t.dispatches*5+t.wavesTogether*10+t.conversations*2)}function dc(t){return t[Math.floor(Math.random()*t.length)]}function JC(t,l,r){const i=r.find(m=>m.id===t),c=r.find(m=>m.id===l);if(!i||!c)return null;const u=i.level==="c-level",f=c.level==="c-level";return u&&f?"c-level":i.reportsTo===l||c.reportsTo===t?"superior-subordinate":(i.reportsTo===c.reportsTo,"peer")}function PC(t,l){return t.relation==="any"?!0:t.relation===l}function eE({roles:t,roleStatuses:l,activeExecs:r,getStandupSpeech:i}){const[c,u]=k.useState(new Map),[f,m]=k.useState(WC),x=k.useRef({}),d=k.useRef(null),g=k.useRef(t),y=k.useRef(l),b=k.useRef(r),v=k.useRef(i),j=k.useRef(f);g.current=t,y.current=l,b.current=r,v.current=i,j.current=f,k.useEffect(()=>{const R=Date.now();for(const[L,O]of Object.entries(l))O==="working"&&(x.current[L]=R)},[l]),k.useEffect(()=>{ZC(f)},[f]);const S=k.useCallback(R=>{const L=y.current[R],O=b.current.find(Y=>Y.roleId===R);if(L==="working"&&(O!=null&&O.task))return null;const U=v.current(R);if(U&&Math.random()<.3)return{text:U,type:"work",ts:Date.now()};const X=Date.now(),ne=x.current[R]??0;if(X-ne>QC&&Math.random()<.5){const Y=N0[R]??N0.engineer;return{text:dc(Y),type:"guilt",ts:X}}const D=E0[R]??E0.engineer;return{text:dc(D),type:"personality",ts:X}},[]),E=k.useCallback(R=>{if(d.current)return!1;const L=R.filter(Z=>y.current[Z.id]!=="working");if(L.length<2)return!1;const O=[...L].sort(()=>Math.random()-.5),U=O[0],X=O[1],ne=JC(U.id,X.id,R);if(!ne)return!1;const D=uc(j.current,U.id,X.id),Y=fc(D),F=VC.filter(Z=>PC(Z,ne)&&Y>=Z.minFamiliarity);if(F.length===0)return!1;const Q=dc(F);let ee=U.id,V=X.id;Q.relation==="superior-subordinate"&&(X.reportsTo===U.id||U.level==="c-level"?(ee=U.id,V=X.id):(ee=X.id,V=U.id)),d.current={templateId:Q.id,roleA:ee,roleB:V,turnIdx:0,timer:null};const I=Z=>{if(!d.current||Z>=Q.turns.length){d.current=null,m(B=>{const W=[...B],T=uc(W,ee,V);return T.conversations++,T.familiarity=fc(T),T.lastInteraction=new Date().toISOString(),W}),setTimeout(()=>{u(B=>{const W=new Map(B);return W.delete(ee),W.delete(V),W})},A0);return}const ce=Q.turns[Z],we=ce.speaker==="A"?ee:V,z=ce.speaker==="A"?V:ee;u(B=>{const W=new Map(B);if(W.set(we,{text:ce.text,type:"social",partnerId:z,ts:Date.now()}),Z>0){const T=Q.turns[Z-1].speaker==="A"?ee:V;T!==we&&W.delete(T)}return W}),d.current.turnIdx=Z,d.current.timer=setTimeout(()=>I(Z+1),KC)};return I(0),!0},[]);k.useEffect(()=>{const R=setInterval(()=>{const L=g.current;if(L.length===0||d.current||Math.random()<.35&&E(L))return;const O=L.filter(ne=>y.current[ne.id]!=="working");if(O.length===0)return;const U=dc(O),X=S(U.id);X&&(u(ne=>{const D=new Map(ne);return D.set(U.id,X),D}),setTimeout(()=>{u(ne=>{const D=new Map(ne),Y=D.get(U.id);return Y&&Y.ts===X.ts&&D.delete(U.id),D})},A0))},GC);return()=>{var L;clearInterval(R),(L=d.current)!=null&&L.timer&&clearTimeout(d.current.timer)}},[S,E]);const C=k.useCallback(R=>{const L=c.get(R);return(L==null?void 0:L.text)??""},[c]),A=k.useCallback((R,L)=>{m(O=>{const U=[...O],X=uc(U,R,L);return X.dispatches++,X.familiarity=fc(X),X.lastInteraction=new Date().toISOString(),U})},[]),M=k.useCallback(R=>{R.length<2||m(L=>{const O=[...L];for(let U=0;U<R.length;U++)for(let X=U+1;X<R.length;X++){const ne=uc(O,R[U],R[X]);ne.wavesTogether++,ne.familiarity=fc(ne),ne.lastInteraction=new Date().toISOString()}return O})},[]);return{speeches:c,getSpeech:C,relationships:f,notifyDispatch:A,notifyWave:M}}const jg="tycono:office-chat";let tE=0;function nE(){return`chat-${Date.now()}-${++tE}`}function Dd(){return[{id:"general",name:"#general",members:[],isDefault:!0,messages:[],topic:"Company-wide announcements and general discussion"},{id:"watercooler",name:"#watercooler",members:[],isDefault:!0,messages:[],topic:"No managers allowed. Vent, gossip, joke around. Talk freely about work frustrations, complain about directives you disagree with, share hot takes."}]}function lE(){try{const t=localStorage.getItem(jg);if(t){const l=JSON.parse(t);if(l.find(i=>i.id==="office")&&!l.find(i=>i.id==="general")){const i=l.filter(c=>c.id!=="office");return[...Dd(),...i]}const r=Dd();for(const i of r)l.find(c=>c.id===i.id)||l.unshift(i);return l}}catch{}return Dd()}function rE(t){const l=t.map(r=>({...r,messages:r.messages.slice(-200)}));localStorage.setItem(jg,JSON.stringify(l))}function aE(){const[t,l]=k.useState(lE),[r,i]=k.useState(null),[c,u]=k.useState(new Set);k.useEffect(()=>{rE(t)},[t]);const f=k.useCallback(v=>{i(v),v&&u(j=>{const S=new Set(j);return S.delete(v),S})},[]),m=k.useCallback(v=>{const j={...v,id:nE()};l(S=>{const E=S.map(C=>C.id==="general"?v.type==="dispatch"?{...C,messages:[...C.messages,j].slice(-200)}:C:v.channelId?C.id===v.channelId?{...C,messages:[...C.messages,j].slice(-200)}:C:C.members.length>0&&C.members.includes(v.roleId)?{...C,messages:[...C.messages,j].slice(-200)}:C);return u(C=>{const A=new Set(C);for(const M of E){const R=S.find(L=>L.id===M.id);R&&M.messages.length>R.messages.length&&A.add(M.id)}return A}),E})},[]),x=k.useCallback((v,j,S)=>{const E=`ch-${Date.now()}`,C={id:E,name:v.startsWith("#")?v:`#${v}`,members:j,isDefault:!1,messages:[],topic:S};l(A=>[...A,C]),i(E)},[]),d=k.useCallback(v=>{l(j=>j.filter(S=>S.id!==v||S.isDefault)),i(j=>j===v?"general":j)},[]),g=k.useCallback((v,j)=>{l(S=>S.map(E=>E.id===v&&!E.isDefault?{...E,members:j}:E))},[]),y=k.useCallback((v,j)=>{l(S=>S.map(E=>E.id===v&&!E.isDefault?{...E,topic:j||void 0}:E))},[]),b=k.useCallback(v=>{l(j=>j.map(S=>{if(S.id==="watercooler"){const E=v.filter(C=>C.level!=="c-level").map(C=>C.id);if(S.members.length!==E.length||!E.every(C=>S.members.includes(C)))return{...S,members:E}}return S}))},[]);return{channels:t,activeChannelId:r,setActiveChannelId:f,pushMessage:m,createChannel:x,deleteChannel:d,updateMembers:g,updateTopic:y,unreadChannels:c,syncDefaultMembers:b}}const iE=45e3,sE=5e3,oE=4,cE=20;function uE({roles:t,roleStatuses:l,activeExecs:r,channels:i,relationships:c,pushMessage:u,speechSettings:f,engineType:m,hasApiKey:x}){const g=((f==null?void 0:f.mode)==="auto"?m==="claude-cli"||m==="local"?"llm":"template":(f==null?void 0:f.mode)??"template")==="llm"&&(x!==!1||m==="claude-cli"),y=((f==null?void 0:f.intervalSec)??iE/1e3)*1e3,b=k.useRef(t),v=k.useRef(l),j=k.useRef(r),S=k.useRef(i),E=k.useRef(c),C=k.useRef(u),A=k.useRef(0),M=k.useRef(!1);b.current=t,v.current=l,j.current=r,S.current=i,E.current=c,C.current=u;const R=k.useCallback(async(O,U)=>{if(M.current)return!1;M.current=!0;try{if(!b.current.find(V=>V.id===O))return!1;const ne=U.messages.slice(-cE).map(V=>({roleId:V.roleId,text:V.text,ts:V.ts})),D=b.current.filter(V=>U.members.includes(V.id)),Y=E.current.filter(V=>V.roleA===O||V.roleB===O).map(V=>({partnerId:V.roleA===O?V.roleB:V.roleA,familiarity:V.familiarity})),F=j.current.find(V=>V.roleId===O),Q=F?{currentTask:F.task,taskProgress:null}:{currentTask:null,taskProgress:null},ee=await Ce.chatInChannel({channelId:U.name.replace("#",""),channelTopic:U.topic,roleId:O,history:ne,members:D.map(V=>({id:V.id,name:V.name,level:V.level})),relationships:Y,workContext:Q});return ee.message?(C.current({ts:Date.now(),roleId:O,text:ee.message,type:"chat",channelId:U.id}),!0):!1}catch{return!1}finally{M.current=!1}},[]),L=k.useCallback(async(O,U)=>{if(A.current>=oE){A.current=0;return}const X=O.members.filter(F=>F!==U&&v.current[F]!=="working");if(X.length===0){A.current=0;return}const ne=X[Math.floor(Math.random()*X.length)];if(Math.random()>.7){A.current=0;return}const D=A.current*2e3,Y=Math.random()*5e3;setTimeout(async()=>{A.current++;const F=S.current.find(ee=>ee.id===O.id);if(!F)return;if(await R(ne,F)){const ee=.6-A.current*.1;Math.random()<ee?L(F,ne):A.current=0}else A.current=0},sE+D+Y)},[R]);k.useEffect(()=>{if(!g)return;const O=setInterval(async()=>{const U=b.current;if(U.length===0||M.current)return;const X=U.filter(Q=>v.current[Q.id]!=="working");if(X.length===0)return;const ne=X[Math.floor(Math.random()*X.length)],D=S.current.filter(Q=>Q.members.length===0?!0:Q.members.includes(ne.id));if(D.length===0)return;const Y=D[Math.floor(Math.random()*D.length)];A.current=0,await R(ne.id,Y)&&L(Y,ne.id)},y);return()=>clearInterval(O)},[g,y,R,L])}function hc({type:t,className:l}){const r=k.useRef(null),i=TS(t);return k.useEffect(()=>{const c=r.current;if(!c||!i)return;const u=c.getContext("2d");u&&zS(u,i)},[t,i]),i?o.jsx("canvas",{ref:r,width:i.canvasWidth,height:i.canvasHeight,className:l,style:{imageRendering:"pixelated",display:"block"}}):null}const Cg=[[1,8],[3,5],[8,1],[5,3]],fE=[[1,4],[2,3],[4,1],[3,2]];function mc(t){const l=t===1||t===3?-1:0,r=Cg[t],i=t<2?[0,1]:[1,0],c=l;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:r[0],y:13,w:3,h:4,c:"$pants"},{x:r[1],y:13,w:3,h:4,c:"$pants"},{x:r[0]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:r[1]+1,y:13,w:1,h:3,c:"darken($pants, 25)",a:.2},{x:r[0],y:16,w:3,h:2,c:"$shoes"},{x:r[1],y:16,w:3,h:2,c:"$shoes"},{x:r[0],y:16,w:3,h:1,c:"lighten($shoes, 25)",a:.4},{x:r[1],y:16,w:3,h:1,c:"lighten($shoes, 25)",a:.4},{x:1,y:c+8,w:10,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.35},{x:1,y:c+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:10,y:c+8,w:1,h:5,c:"darken($shirt, 30)",a:.2},{x:-1,y:c+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:c+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:-1,y:c+12,w:2,h:1,c:"$skin"},{x:11,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:1,y:c+0,w:10,h:7,c:"$skin"},{x:3,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:c+3,w:1,h:1,c:"#FFF",a:.4},{x:7,y:c+3,w:1,h:1,c:"#FFF",a:.4},{x:5,y:c+6,w:2,h:1,c:"darken($skin, 25)",a:.35},{x:0,y:c+3,w:1,h:1,c:"$skin"},{x:11,y:c+3,w:1,h:1,c:"$skin"},{x:1,y:c+0,w:10,h:3,c:"$hair"},{x:0,y:c+1,w:2,h:3,c:"$hair"},{x:10,y:c+1,w:2,h:3,c:"$hair"},{x:2,y:c+0,w:8,h:1,c:"lighten($hair, 25)",a:.3}]}function xc(t){const l=t===1||t===3?-1:0,r=Cg[t],i=t<2?[0,1]:[1,0],c=l;return[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:r[0],y:13,w:3,h:4,c:"$pants"},{x:r[1],y:13,w:3,h:4,c:"$pants"},{x:r[0],y:16,w:3,h:2,c:"$shoes"},{x:r[1],y:16,w:3,h:2,c:"$shoes"},{x:1,y:c+8,w:10,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:5,y:c+10,w:2,h:3,c:"darken($shirt, 30)",a:.12},{x:-1,y:c+9+i[0],w:3,h:4-i[0],c:"$shirt"},{x:10,y:c+9+i[1],w:3,h:4-i[1],c:"$shirt"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:1,y:c+0,w:10,h:7,c:"$skin"},{x:1,y:c+0,w:10,h:6,c:"$hair"},{x:0,y:c+1,w:2,h:5,c:"$hair"},{x:10,y:c+1,w:2,h:5,c:"$hair"},{x:2,y:c+0,w:8,h:1,c:"lighten($hair, 25)",a:.3},{x:0,y:c+4,w:1,h:1,c:"$skin",a:.6},{x:11,y:c+4,w:1,h:1,c:"$skin",a:.6}]}function $r(t,l){const r=t===1||t===3?-1:0,i=fE[t],c=r,u=t%2===0?1:0;return l?[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:i[0],y:13,w:3,h:4,c:"$pants"},{x:i[1],y:13,w:3,h:4,c:"$pants"},{x:i[0],y:16,w:3,h:2,c:"$shoes"},{x:i[1],y:16,w:3,h:2,c:"$shoes"},{x:2,y:c+8,w:8,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:8,y:c+9+u,w:3,h:4-u,c:"$shirt"},{x:9,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:2,y:c+0,w:8,h:7,c:"$skin"},{x:7,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:7,y:c+3,w:1,h:1,c:"#FFF",a:.3},{x:9,y:c+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:c+0,w:8,h:3,c:"$hair"},{x:1,y:c+1,w:2,h:4,c:"$hair"},{x:9,y:c+1,w:2,h:3,c:"$hair"},{x:3,y:c+0,w:6,h:1,c:"lighten($hair, 25)",a:.25}]:[{x:1,y:17,w:10,h:2,c:"#100A06",a:.18},{x:i[0],y:13,w:3,h:4,c:"$pants"},{x:i[1],y:13,w:3,h:4,c:"$pants"},{x:i[0],y:16,w:3,h:2,c:"$shoes"},{x:i[1],y:16,w:3,h:2,c:"$shoes"},{x:2,y:c+8,w:8,h:6,c:"$shirt"},{x:2,y:c+8,w:8,h:1,c:"lighten($shirt, 20)",a:.2},{x:0,y:c+9+u,w:3,h:4-u,c:"$shirt"},{x:-1,y:c+12,w:2,h:1,c:"$skin"},{x:4,y:c+6,w:4,h:3,c:"$skin"},{x:2,y:c+0,w:8,h:7,c:"$skin"},{x:3,y:c+3,w:2,h:2,c:"#1A1A2E"},{x:3,y:c+3,w:1,h:1,c:"#FFF",a:.3},{x:1,y:c+4,w:1,h:1,c:"darken($skin, 25)",a:.3},{x:2,y:c+0,w:8,h:3,c:"$hair"},{x:1,y:c+1,w:2,h:3,c:"$hair"},{x:9,y:c+1,w:2,h:4,c:"$hair"},{x:3,y:c+0,w:6,h:1,c:"lighten($hair, 25)",a:.25}]}const T0={down:[mc(0),mc(1),mc(2),mc(3)],up:[xc(0),xc(1),xc(2),xc(3)],right:[$r(0,!0),$r(1,!0),$r(2,!0),$r(3,!0)],left:[$r(0,!1),$r(1,!1),$r(2,!1),$r(3,!1)]},qe=4,At=28,sn=2,ct=4,et=4,rr=[{wallColor:"#C8B898",baseboardColor:"#6A5840",floorType:"wood"},{wallColor:"#A8B8C8",baseboardColor:"#586878",floorType:"dark"},{wallColor:"#A8C8B0",baseboardColor:"#4A6A50",floorType:"carpet"},{wallColor:"#C8C0A8",baseboardColor:"#7A6A50",floorType:"tile"}];function Ah(t,l,r){const u=t.fy+Math.max(10,Math.floor(t.fh*.18)),f=Math.min(l,r),m=Math.ceil(l/f),x=[],d=f*28,g=t.fx+Math.max(8,Math.floor((t.fw-d)/2));for(let y=0;y<m&&x.length<l;y++){const b=Math.min(f,l-y*f);for(let v=0;v<b;v++)x.push({dx:g+v*28,dy:u+y*28,room:t.id})}return x}function dE(t){const i=rr[0],c={id:"main",wx:qe+et,wy:qe,ww:160-2*(qe+et),wh:At,fx:qe+et,fy:qe+At+sn,fw:160-2*(qe+et),fh:120-qe-At-sn-qe,...i},u=Ah(c,Math.min(t,6),3),f=[{id:"s-window-l",type:"window",room:"main",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"s-window-r",type:"window",room:"main",zone:"wall",anchorX:"right",offsetX:-26,offsetY:6,windowW:16,windowH:14},{id:"s-clock",type:"clock",room:"main",zone:"wall",offsetX:Math.floor((160-2*(qe+et))/2),offsetY:10}],m=[{id:"s-plant-l",type:"plant",room:"main",zone:"floor",offsetX:4,offsetY:4},{id:"s-plant-r",type:"plant",room:"main",zone:"floor",anchorX:"right",offsetX:-8,offsetY:4}];return{preset:"S",canvasW:160,canvasH:120,rooms:{main:c},desks:u,doors:{},adjacency:{main:[]},corridorY:{main:c.fy+c.fh-12},waypoints:{main:[{x:c.fx+10,y:c.fy+c.fh-14},{x:c.fx+c.fw/2,y:c.fy+c.fh-14},{x:c.fx+c.fw-10,y:c.fy+c.fh-14}]},wallDecorations:f,furniture:m}}function hE(t){const c={id:"exec",wx:qe+et,wy:qe,ww:144-qe-et-ct/2,wh:At,fx:qe+et,fy:qe+At+sn,fw:144-qe-et-ct/2,fh:66,...rr[0]},u={id:"work",wx:144+ct/2+et,wy:qe,ww:144-ct/2-et-qe,wh:At,fx:144+ct/2+et,fy:qe+At+sn,fw:144-ct/2-et-qe,fh:66,...rr[1]},f={id:"meet",wx:qe+et,wy:qe+At+sn+66+ct,ww:144-qe-et-ct/2,wh:At,fx:qe+et,fy:qe+At+sn+66+ct+At+sn,fw:144-qe-et-ct/2,fh:70,...rr[2]},m={id:"comm",wx:144+ct/2+et,wy:qe+At+sn+66+ct,ww:144-ct/2-et-qe,wh:At,fx:144+ct/2+et,fy:qe+At+sn+66+ct+At+sn,fw:144-ct/2-et-qe,fh:70,...rr[3]},x={exec:c,work:u,meet:f,comm:m},d=[];let g=t;const y=[[c,Math.min(3,g)],[u,0]];y[1][1]=Math.min(3,g-y[0][1]);const b=[[f,0],[m,0]];let v=g-y[0][1]-y[1][1];v>0&&(b[0][1]=Math.min(2,v),v-=b[0][1]),v>0&&(b[1][1]=Math.min(2,v));for(const[O,U]of[...y,...b])U>0&&d.push(...Ah(O,U,3));const j=qe+At+sn+66,S=144-ct/2,E={exec_work:{id:"exec_work",type:"v",doorY:qe+At+sn+20+12,xA:S-2,xB:u.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:qe+At+sn+66+ct+At+sn+20+12,xA:S-2,xB:m.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:qe+et+40+14,yA:j-2,yB:f.fy+2},work_comm:{id:"work_comm",type:"h",doorX:144+ct/2+et+40+14,yA:j-2,yB:m.fy+2}},C={exec:[{room:"work",door:"exec_work",side:"A"},{room:"meet",door:"exec_meet",side:"A"}],work:[{room:"exec",door:"exec_work",side:"B"},{room:"comm",door:"work_comm",side:"A"}],meet:[{room:"exec",door:"exec_meet",side:"B"},{room:"comm",door:"meet_comm",side:"A"}],comm:[{room:"work",door:"work_comm",side:"B"},{room:"meet",door:"meet_comm",side:"B"}]},A={exec:c.fy+52,work:u.fy+48,meet:f.fy+56,comm:m.fy+42},M={exec:[{x:c.fx+6,y:c.fy+52},{x:c.fx+60,y:c.fy+54},{x:c.fx+112,y:c.fy+50},{x:c.fx+50,y:c.fy+52}],work:[{x:u.fx+14,y:u.fy+48},{x:u.fx+44,y:u.fy+48},{x:u.fx+70,y:u.fy+48},{x:u.fx+100,y:u.fy+48}],meet:[{x:f.fx+60,y:f.fy+56},{x:f.fx+30,y:f.fy+54},{x:f.fx+110,y:f.fy+50},{x:f.fx+80,y:f.fy+56}],comm:[{x:m.fx+96,y:m.fy+8},{x:m.fx+60,y:m.fy+42},{x:m.fx+40,y:m.fy+42},{x:m.fx+20,y:m.fy+42}]},R=[{id:"exec-window-1",type:"window",room:"exec",zone:"wall",offsetX:10,offsetY:6,windowW:16,windowH:14},{id:"exec-picture-1",type:"picture",room:"exec",zone:"wall",offsetX:34,offsetY:8,pictureColor:"#1565C0",facility:{id:"theme",label:"THEME",icon:"🎨",color:"#42A5F5",hitW:12,hitH:10}},{id:"exec-picture-2",type:"picture",room:"exec",zone:"wall",offsetX:48,offsetY:8,pictureColor:"#E65100"},{id:"exec-clock",type:"clock",room:"exec",zone:"wall",offsetX:64,offsetY:10,facility:{id:"settings",label:"SETTINGS",icon:"⚙",color:"#78909C",hitW:10,hitH:10}},{id:"exec-shelf",type:"shelf",room:"exec",zone:"wall",offsetX:78,offsetY:14,facility:{id:"stats",label:"STATS",icon:"📊",color:"#7E57C2",hitW:16,hitH:8}},{id:"exec-window-2",type:"window",room:"exec",zone:"wall",offsetX:104,offsetY:6,windowW:16,windowH:14},{id:"work-whiteboard",type:"whiteboard",room:"work",zone:"wall",offsetX:6,offsetY:4},{id:"work-window-1",type:"window",room:"work",zone:"wall",offsetX:50,offsetY:6,windowW:16,windowH:14},{id:"work-window-2",type:"window",room:"work",zone:"wall",offsetX:92,offsetY:6,windowW:16,windowH:14},{id:"meet-bulletin",type:"bulletin-board",room:"meet",zone:"wall",offsetX:6,offsetY:4,facility:{id:"bulletin",label:"BULLETIN",icon:"📋",color:"#F59E0B",hitW:22,hitH:16}},{id:"meet-picture",type:"picture",room:"meet",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#10B981"},{id:"meet-window",type:"window",room:"meet",zone:"wall",offsetX:80,offsetY:6,windowW:16,windowH:14},{id:"meet-shelf",type:"shelf",room:"meet",zone:"wall",offsetX:102,offsetY:18},{id:"comm-screen",type:"screen",room:"comm",zone:"wall",offsetX:6,offsetY:6,facility:{id:"decisions",label:"DECISIONS",icon:"📜",color:"#EF4444",hitW:16,hitH:12}},{id:"comm-picture",type:"picture",room:"comm",zone:"wall",offsetX:28,offsetY:8,pictureColor:"#d4956a"},{id:"comm-window",type:"window",room:"comm",zone:"wall",offsetX:76,offsetY:6,windowW:16,windowH:14},{id:"comm-clock",type:"clock",room:"comm",zone:"wall",offsetX:98,offsetY:10},{id:"comm-shelf",type:"shelf",room:"comm",zone:"wall",offsetX:108,offsetY:18}],L=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(c.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"M",canvasW:288,canvasH:208,rooms:x,desks:d,doors:E,adjacency:C,corridorY:A,waypoints:M,wallDecorations:R,furniture:L}}function mE(t){const f={id:"exec",wx:qe+et,wy:qe,ww:180-qe-et-ct/2,wh:At,fx:qe+et,fy:qe+At+sn,fw:180-qe-et-ct/2,fh:82,...rr[0]},m={id:"work",wx:180+ct/2+et,wy:qe,ww:180-ct/2-et-qe,wh:At,fx:180+ct/2+et,fy:qe+At+sn,fw:180-ct/2-et-qe,fh:82,...rr[1]},x=qe+At+sn+82,d={id:"meet",wx:qe+et,wy:x+ct,ww:180-qe-et-ct/2,wh:At,fx:qe+et,fy:x+ct+At+sn,fw:180-qe-et-ct/2,fh:86,...rr[2]},g={id:"comm",wx:180+ct/2+et,wy:x+ct,ww:180-ct/2-et-qe,wh:At,fx:180+ct/2+et,fy:x+ct+At+sn,fw:180-ct/2-et-qe,fh:86,...rr[3]},y={exec:f,work:m,meet:d,comm:g},b=[];let v=t;const j=[[f,Math.min(5,v)],[m,0]];j[1][1]=Math.min(5,v-j[0][1]);const S=[[d,0],[g,0]];let E=v-j[0][1]-j[1][1];E>0&&(S[0][1]=Math.min(3,E),E-=S[0][1]),E>0&&(S[1][1]=Math.min(3,E));for(const[X,ne]of[...j,...S])ne>0&&b.push(...Ah(X,ne,4));const C=180-ct/2,A={exec_work:{id:"exec_work",type:"v",doorY:f.fy+82/2,xA:C-2,xB:m.fx+2},meet_comm:{id:"meet_comm",type:"v",doorY:d.fy+86/2,xA:C-2,xB:g.fx+2},exec_meet:{id:"exec_meet",type:"h",doorX:f.fx+54,yA:x-2,yB:d.fy+2},work_comm:{id:"work_comm",type:"h",doorX:m.fx+54,yA:x-2,yB:g.fy+2}},M={exec:[{room:"work",door:"exec_work",side:"A"},{room:"meet",door:"exec_meet",side:"A"}],work:[{room:"exec",door:"exec_work",side:"B"},{room:"comm",door:"work_comm",side:"A"}],meet:[{room:"exec",door:"exec_meet",side:"B"},{room:"comm",door:"meet_comm",side:"A"}],comm:[{room:"work",door:"work_comm",side:"B"},{room:"meet",door:"meet_comm",side:"B"}]},R={exec:f.fy+82-12,work:m.fy+82-12,meet:d.fy+86-12,comm:g.fy+86-12},L={exec:[{x:f.fx+10,y:R.exec},{x:f.fx+f.fw/2,y:R.exec},{x:f.fx+f.fw-10,y:R.exec}],work:[{x:m.fx+10,y:R.work},{x:m.fx+m.fw/2,y:R.work},{x:m.fx+m.fw-10,y:R.work}],meet:[{x:d.fx+10,y:R.meet},{x:d.fx+d.fw/2,y:R.meet},{x:d.fx+d.fw-10,y:R.meet}],comm:[{x:g.fx+10,y:R.comm},{x:g.fx+g.fw/2,y:R.comm},{x:g.fx+g.fw-10,y:R.comm}]},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}],U=[{id:"exec-bookshelf",type:"bookshelf",room:"exec",zone:"floor",offsetX:2,offsetY:4},{id:"exec-plant-r",type:"plant",room:"exec",zone:"floor",anchorX:"right",offsetX:-10,offsetY:4},{id:"exec-plant-c",type:"plant",room:"exec",zone:"floor",offsetX:Math.floor(f.fw/2),offsetY:4},{id:"work-plant-1",type:"plant",room:"work",zone:"floor",offsetX:36,offsetY:4},{id:"work-plant-2",type:"plant",room:"work",zone:"floor",offsetX:80,offsetY:4},{id:"meet-plant",type:"plant",room:"meet",zone:"floor",anchorX:"right",offsetX:-12,offsetY:4},{id:"meet-table",type:"meeting-table",room:"meet",zone:"floor",offsetX:10,offsetY:14,condition:"no-desks",facility:{id:"meeting",label:"MEETING",icon:"🏢",color:"#3B82F6",hitW:44,hitH:40}},{id:"comm-coffee-machine",type:"coffee-machine",room:"comm",zone:"floor",anchorX:"right",offsetX:-30,offsetY:4,condition:"no-desks"},{id:"comm-plant-1",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:4,condition:"no-desks"},{id:"comm-bookshelf",type:"bookshelf",room:"comm",zone:"floor",anchorX:"right",offsetX:-26,offsetY:16,accent:"#10B981",condition:"no-desks",facility:{id:"knowledge",label:"KNOWLEDGE",icon:"📚",color:"#10B981",hitW:26,hitH:24}},{id:"comm-sofa",type:"sofa",room:"comm",zone:"floor",offsetX:44,offsetY:30,condition:"no-desks"},{id:"comm-coffee-table",type:"coffee-table",room:"comm",zone:"floor",offsetX:50,offsetY:50,condition:"no-desks"},{id:"comm-plant-2",type:"plant",room:"comm",zone:"floor",offsetX:38,offsetY:50,condition:"no-desks"}];return{preset:"L",canvasW:360,canvasH:260,rooms:y,desks:b,doors:A,adjacency:M,corridorY:R,waypoints:L,wallDecorations:O,furniture:U}}const xE=2;function Eg(t,l){return l?l==="L"&&t<=12-xE?"M":l==="M"&&t>12?"L":l:t<=12?"M":"L"}function Ng(t,l){switch(l??Eg(t)){case"S":return dE(t);case"M":return hE(t);case"L":return mE(t)}}function D0(t,l){if(!l||Object.keys(l).length===0)return t;const r=i=>i.map(c=>{const u=l[c.id];return u?{...c,offsetX:u.offsetX,offsetY:u.offsetY}:c});return{...t,wallDecorations:r(t.wallDecorations),furniture:r(t.furniture)}}function z0(t,l){if(l)for(const[r,i]of Object.entries(l))t[r]&&(t[r]={...t[r],dx:i.dx,dy:i.dy})}function zd(t,l){if(!l||l.length===0)return t;const r=new Set(l);return{...t,wallDecorations:t.wallDecorations.filter(i=>!r.has(i.id)),furniture:t.furniture.filter(i=>!r.has(i.id))}}function M0(t,l){if(!l||l.length===0)return t;const r=[],i=[];for(const c of l)c.zone==="wall"?r.push(c):i.push(c);return{...t,wallDecorations:[...t.wallDecorations,...r],furniture:[...t.furniture,...i]}}let Cs;function pE(t){Cs=t}function $(t,l,r,i,c,u){t=Math.round(t),l=Math.round(l),!(u!==void 0&&u<.01)&&(u!==void 0&&u!==1&&(Cs.globalAlpha=u),Cs.fillStyle=c,Cs.fillRect(t,l,r,i),u!==void 0&&u!==1&&(Cs.globalAlpha=1))}function tt(t,l,r,i){$(t,l,1,1,r,i)}let kc=1;function mi(t){kc=t}function Nl(){return kc=kc*16807%2147483647,(kc&65535)/65535}function Ag(t){const l=parseInt(t.slice(1,3),16)/255,r=parseInt(t.slice(3,5),16)/255,i=parseInt(t.slice(5,7),16)/255,c=Math.max(l,r,i),u=Math.min(l,r,i);let f=0,m=0;const x=(c+u)/2;if(c!==u){const d=c-u;m=x>.5?d/(2-c-u):d/(c+u),c===l?f=((r-i)/d+(r<i?6:0))/6:c===r?f=((i-l)/d+2)/6:f=((l-r)/d+4)/6}return[f*360,m*100,x*100]}function Tg(t,l,r){t=(t%360+360)%360,l=Math.max(0,Math.min(100,l))/100,r=Math.max(0,Math.min(100,r))/100;const i=l*Math.min(r,1-r),c=f=>{const m=(f+t/30)%12;return r-i*Math.max(-1,Math.min(m-3,9-m,1))},u=f=>Math.round(f*255).toString(16).padStart(2,"0");return"#"+u(c(0))+u(c(8))+u(c(4))}function Al(t,l=1){const[r,i,c]=Ag(t);return Tg(r+15*l,Math.min(100,i+8),c-12*l)}function qt(t,l=1){const[r,i,c]=Ag(t);return Tg(r-10*l,i-3,c+10*l)}const an={hi:"#D4AA5C",base:"#B08040",sh:"#7A5038",deep:"#4E3028"},El={hi:"#8A6848",base:"#604832",sh:"#3A2E24",deep:"#2A1E18"},Sl={hi:"#5A6A80",base:"#485868",sh:"#364858",deep:"#283848"},Vr="#100A06";function yE(t,l,r=14,i=12){$(t,l,r,i,"#4A3828"),$(t+1,l+1,r-2,i-2,"#5A4838"),$(t+2,l+2,r-4,i-4,"#4A7098"),$(t+2,l+2,r-4,Math.floor((i-4)/2),"#6A90B8",.35);const c=Math.floor(r/2);$(t+c,l+1,1,i-2,"#4A3828"),$(t+1,l+Math.floor(i/2),r-2,1,"#4A3828",.5),tt(t+3,l+3,"#8AB8E8",.35),tt(t+c+2,l+3,"#8AB8E8",.25),$(t-1,l+i,r+2,2,"#5A4838"),$(t-1,l+i,r+2,1,qt("#5A4838",.5),.35)}function gE(t,l,r){$(t,l,10,8,"#3A2818"),$(t+1,l+1,8,6,r),$(t+2,l+2,4,3,qt(r,1.2),.3),tt(t+3,l+2,qt(r,2),.25)}function bE(t,l){$(t,l,7,7,"#3A2818"),$(t+1,l+1,5,5,"#F0EDE5"),tt(t+3,l+1,"#AAA"),tt(t+3,l+5,"#AAA"),tt(t+1,l+3,"#AAA"),tt(t+5,l+3,"#AAA"),tt(t+3,l+3,"#222"),$(t+3,l+1,1,2,"#333"),tt(t+4,l+3,"#D32F2F")}function vE(t,l){$(t,l,26,16,"#586878"),$(t+1,l+1,24,13,"#ECEFF1"),$(t+1,l+1,24,1,"#F5F5F5",.4),$(t+3,l+3,14,1,"#1565C0",.6),$(t+3,l+5,18,1,"#333",.2),$(t+3,l+7,12,1,"#D32F2F",.35),$(t+3,l+9,16,1,"#333",.15),$(t+1,l+14,24,2,"#708898"),$(t+3,l+14,3,1,"#D32F2F"),$(t+7,l+14,3,1,"#1565C0"),$(t+11,l+14,3,1,"#2E7D32")}function wE(t,l){$(t,l,22,16,"#6A5030"),$(t+1,l+1,20,14,"#C4A66A"),mi(88);for(let r=0;r<14;r++)for(let i=0;i<20;i++)Nl()>.5&&tt(t+1+i,l+1+r,Nl()>.5?"#B89858":"#D4B87A",.18);$(t+2,l+2,5,4,"#FFF176"),$(t+8,l+2,5,4,"#90CAF9"),$(t+14,l+3,5,4,"#CE93D8"),$(t+3,l+8,7,4,"#C8E6C9"),$(t+11,l+8,8,4,"#F8BBD0"),tt(t+4,l+2,"#E53935"),tt(t+10,l+2,"#1E88E5"),tt(t+16,l+3,"#FF9800")}function kE(t,l){$(t,l,20,3,"#5A4030"),$(t,l,20,1,qt("#5A4030",.5),.35),$(t,l+2,20,1,Al("#5A4030",.5),.3),$(t+2,l-4,3,4,"#E53935"),$(t+2,l-4,3,1,qt("#E53935",1),.3),$(t+6,l-3,2,3,"#1E88E5"),$(t+9,l-5,4,5,"#43A047"),$(t+14,l-3,3,3,"#FFD54F"),tt(t+15,l-3,"#FFF176",.4)}function SE(t,l){$(t,l,16,12,"#1E1E28"),$(t+1,l+1,14,9,"#0C1420"),$(t+2,l+2,12,1,"#EF4444",.6),tt(t+2,l+4,"#4CAF50"),$(t+4,l+4,7,1,"#8b949e",.4),tt(t+2,l+6,"#FF9800"),$(t+4,l+6,5,1,"#8b949e",.3),tt(t+2,l+8,"#42A5F5"),$(t+4,l+8,8,1,"#8b949e",.25),$(t+7,l+10,2,2,"#1E1E28"),$(t+5,l+11,6,1,"#586878")}function jE(t,l,r){$(t+2,l+20,22,2,Vr,.15),$(t,l,22,20,El.deep),$(t+1,l+1,20,18,El.base),$(t,l,22,1,El.hi,.35),$(t,l,1,20,El.hi,.2);for(const u of[6,12])$(t+1,l+u,20,2,El.sh),$(t+1,l+u,20,1,El.hi,.2);const i=["#E53935","#1E88E5","#43A047","#8E24AA","#FB8C00","#00897B","#5C6BC0"];let c=t+2;for(let u=0;u<5;u++){const f=2+u%2;$(c,l+1,f,5,i[u]),$(c,l+1,f,1,qt(i[u],1),.35),c+=f+1}c=t+2;for(let u=0;u<4;u++)$(c,l+7,4,5,i[u+3]),$(c,l+7,4,1,qt(i[u+3],1),.25),c+=5;$(t+2,l+14,4,4,"#FFD54F"),$(t+8,l+14,7,4,"#90CAF9"),r&&$(t,l-1,22,1,r,.7)}function CE(t,l){$(t+2,l+11,6,2,Vr,.1),$(t+2,l+8,6,4,"#8B5E3C"),$(t+1,l+7,8,2,Al("#A06E48",.3)),$(t+2,l+7,6,1,qt("#A06E48",.5),.4),$(t+1,l+3,3,4,"#2E7D32"),$(t+5,l+2,3,4,"#2E7D32"),$(t+2,l+1,4,4,"#43A047"),$(t+3,l+0,3,3,"#66BB6A"),tt(t+4,l,"#81C784"),tt(t+3,l+1,"#A5D6A7",.4)}function EE(t,l){pa(t+4,l-4,"down"),pa(t+16,l-4,"down"),pa(t+28,l-4,"down"),$(t+3,l+24,34,3,Vr,.15),$(t,l+2,36,18,an.deep),$(t+1,l+3,34,16,an.base),$(t+1,l+3,34,1,an.hi,.35);for(let r=0;r<14;r+=3)$(t+1,l+4+r,34,1,Al(an.base,.2),.08);$(t,l+20,36,4,an.deep),$(t+1,l+21,34,2,an.sh),$(t+6,l+7,10,6,"#1A1A24"),$(t+7,l+8,8,4,"#0C1420"),$(t+8,l+9,4,1,"#2A6898",.4),$(t+20,l+8,6,4,"#F0F0F0"),$(t+15,l+7,3,3,"#ECEFF1"),tt(t+16,l+8,"#795548"),pa(t+4,l+24,"up"),pa(t+16,l+24,"up"),pa(t+28,l+24,"up")}function NE(t,l){$(t+2,l+16,36,3,Vr,.15),$(t,l,36,5,"#5D4037"),$(t+1,l+1,34,3,"#6D4C41"),$(t+1,l+1,34,1,qt("#6D4C41",.5),.3),$(t,l+5,36,8,"#5D4037"),$(t+2,l+6,15,6,"#6D4C41"),$(t+3,l+6,13,1,qt("#6D4C41",.5),.35),$(t+19,l+6,15,6,"#6D4C41"),$(t+20,l+6,13,1,qt("#6D4C41",.5),.35),$(t+17,l+6,2,6,"#5D4037"),$(t,l+13,36,3,Al("#5D4037",1)),$(t-2,l+2,3,12,"#5D4037"),$(t+35,l+2,3,12,"#5D4037"),$(t+4,l+7,6,4,"#FF8A65"),$(t+5,l+7,4,1,qt("#FF8A65",1),.35)}function AE(t,l){$(t+2,l+10,22,2,Vr,.12),$(t,l,22,8,El.deep),$(t+1,l+1,20,6,El.base),$(t+1,l+1,20,1,El.hi,.3),$(t,l+8,22,2,El.sh),$(t+3,l+2,6,4,"#F0F0F0"),$(t+13,l+3,3,3,"#ECEFF1"),tt(t+14,l+4,"#795548")}function TE(t,l){$(t+1,l+14,10,2,Vr,.12),$(t,l,10,14,"#546E7A"),$(t,l,10,1,qt("#546E7A",1),.35),$(t+1,l+1,8,3,"#78909C"),$(t+1,l+5,8,4,"#37474F"),tt(t+2,l+6,"#EF5350"),tt(t+4,l+6,"#66BB6A"),$(t+2,l+11,4,2,"#ECEFF1")}function DE(t,l){$(t+2,l+16,26,3,Vr,.18),$(t,l,26,10,an.deep),$(t+1,l+1,24,8,an.base),$(t+1,l+2,24,1,an.hi,.2),$(t+1,l+4,24,1,Al(an.base,.2),.1),$(t+1,l+6,24,1,an.hi,.15),$(t+1,l+1,24,1,an.hi,.4),$(t+1,l+1,1,8,an.hi,.2),$(t,l+10,26,5,an.deep),$(t+1,l+11,24,3,an.sh),$(t+1,l+10,24,1,Al(an.base,1.5),.4),$(t+1,l+14,24,1,an.base,.15),$(t+2,l+12,10,1,an.deep,.4),$(t+14,l+12,10,1,an.deep,.4),tt(t+7,l+11,"#C8D0D8",.6),tt(t+19,l+11,"#C8D0D8",.6),$(t+6,l-5,14,7,"#1E1E28"),$(t+7,l-4,12,5,"#0C1420"),$(t+8,l-3,5,1,"#2A6898",.6),$(t+8,l-2,8,1,"#1A3858",.4),$(t+8,l-1,3,1,"#2A6898",.35),tt(t+7,l-4,"#4A98D8",.25),tt(t+12,l+1,"#4CAF50",.4),$(t+12,l+2,2,3,"#586878"),$(t+10,l+4,6,1,"#8898A8"),$(t+6,l+4,12,4,"#222228"),$(t+6,l+4,12,1,"#333338",.4);for(let r=0;r<5;r++)tt(t+7+r*2,l+5,"#444",.6),tt(t+7+r*2,l+6,"#3A3A3E",.4);$(t+20,l+5,3,4,"#333338"),$(t+20,l+5,3,1,"#444448"),$(t+1,l+3,4,4,"#F0EDE8"),$(t+1,l+3,4,1,"#F8F6F2"),tt(t+2,l+5,"#6D4C41")}function pa(t,l,r){$(t+1,l+9,10,2,Vr,.1),tt(t+5,l+9,"#1E1E22"),tt(t+1,l+10,"#1A1A1E"),tt(t+9,l+10,"#1A1A1E"),tt(t+3,l+11,"#1A1A1E"),tt(t+7,l+11,"#1A1A1E"),$(t+1,l+2,8,6,Sl.base),$(t+2,l+3,6,4,Sl.hi,.35),$(t+2,l+3,6,1,qt(Sl.hi,.5),.25),$(t+1,l+7,8,1,Sl.deep),r==="up"?($(t,l+7,10,3,Sl.deep),$(t+1,l+8,8,1,Sl.sh)):($(t,l-1,10,3,Sl.deep),$(t+1,l,8,1,Sl.sh)),$(t,l+3,1,4,Sl.sh),$(t+9,l+3,1,4,Sl.sh)}const Dg={bookshelf:(t,l,r)=>jE(t,l,r.accent),plant:(t,l)=>CE(t,l),"meeting-table":(t,l)=>EE(t,l),sofa:(t,l)=>NE(t,l),"coffee-table":(t,l)=>AE(t,l),"coffee-machine":(t,l)=>TE(t,l),window:(t,l,r)=>yE(t,l,r.windowW??16,r.windowH??14),picture:(t,l,r)=>gE(t,l,r.pictureColor??"#1565C0"),clock:(t,l)=>bE(t,l),whiteboard:(t,l)=>vE(t,l),"bulletin-board":(t,l)=>wE(t,l),shelf:(t,l)=>kE(t,l),screen:(t,l)=>SE(t,l)};function fi(t,l){const r=t.zone==="wall"?l.wx:l.fx,i=t.zone==="wall"?l.wy:l.fy;return{x:t.anchorX==="right"?(t.zone==="wall"?l.wx+l.ww:l.fx+l.fw)+t.offsetX:r+t.offsetX,y:i+t.offsetY}}function zE(t){for(const l of t.wallDecorations){const r=t.rooms[l.room];if(!r)continue;const{x:i,y:c}=fi(l,r),u=Dg[l.type];u&&u(i,c,l)}}function ME(t,l,r){for(const i of t.furniture){const c=t.rooms[i.room];if(!c||i.condition==="no-desks"&&r.has(i.room))continue;const{x:u,y:f}=fi(i,c),m=Dg[i.type];m&&l.push({y:f,draw:()=>m(u,f,i)})}}function Hr(t){const l=[],r=[...t.wallDecorations,...t.furniture];for(const i of r){if(!i.facility)continue;const c=t.rooms[i.room];if(!c)continue;const{x:u,y:f}=fi(i,c);l.push({id:i.facility.id,label:i.facility.label,icon:i.facility.icon,color:i.facility.color,dx:u,dy:f,pw:i.facility.hitW,ph:i.facility.hitH})}return l}const RE={bookshelf:{w:22,h:20},plant:{w:10,h:12},"meeting-table":{w:36,h:28},sofa:{w:38,h:16},"coffee-table":{w:22,h:10},"coffee-machine":{w:10,h:14},window:{w:16,h:14},picture:{w:10,h:8},clock:{w:7,h:7},whiteboard:{w:26,h:16},"bulletin-board":{w:22,h:16},shelf:{w:20,h:8},screen:{w:16,h:12}};function eh(t){return RE[t]??{w:16,h:16}}function Md(t,l,r,i){for(let c=t.furniture.length-1;c>=0;c--){const u=t.furniture[c],f=t.rooms[u.room];if(!f||u.condition==="no-desks"&&i.has(u.room))continue;const{x:m,y:x}=fi(u,f),d=eh(u.type);if(l>=m&&l<=m+d.w&&r>=x&&r<=x+d.h)return u.id}for(let c=t.wallDecorations.length-1;c>=0;c--){const u=t.wallDecorations[c],f=t.rooms[u.room];if(!f)continue;const{x:m,y:x}=fi(u,f),d=eh(u.type);if(l>=m&&l<=m+d.w&&r>=x&&r<=x+d.h)return u.id}return null}function R0(t,l,r,i,c){const f=[...l.wallDecorations,...l.furniture].find(y=>y.id===r);if(!f||f.condition==="no-desks"&&c.has(f.room))return;const m=l.rooms[f.room];if(!m)return;const{x,y:d}=fi(f,m),g=eh(f.type);t.save(),t.fillStyle=i,t.globalAlpha=.2,t.fillRect(x-1,d-1,g.w+2,g.h+2),t.globalAlpha=.9,t.strokeStyle=i,t.lineWidth=1,t.strokeRect(x-.5,d-.5,g.w+1,g.h+1),t.restore()}function F0(t,l,r,i){t.save(),t.fillStyle=i,t.globalAlpha=.2,t.fillRect(l-1,r-1,28,42),t.globalAlpha=.9,t.strokeStyle=i,t.lineWidth=1,t.strokeRect(l-.5,r-.5,27,41),t.restore()}function _0(t,l,r){for(const[i,c]of Object.entries(t))if(l>=c.dx&&l<=c.dx+26&&r>=c.dy&&r<=c.dy+40)return i;return null}const FE=[{type:"plant",zone:"floor",label:"Plant",icon:"🪴"},{type:"bookshelf",zone:"floor",label:"Bookshelf",icon:"📚"},{type:"sofa",zone:"floor",label:"Sofa",icon:"🛋️"},{type:"coffee-table",zone:"floor",label:"Coffee Table",icon:"☕"},{type:"coffee-machine",zone:"floor",label:"Coffee Machine",icon:"☕"},{type:"meeting-table",zone:"floor",label:"Meeting Table",icon:"🪑"},{type:"window",zone:"wall",label:"Window",icon:"🪟"},{type:"picture",zone:"wall",label:"Picture",icon:"🖼️"},{type:"clock",zone:"wall",label:"Clock",icon:"🕐"},{type:"whiteboard",zone:"wall",label:"Whiteboard",icon:"📋"},{type:"shelf",zone:"wall",label:"Shelf",icon:"📦"},{type:"screen",zone:"wall",label:"Screen",icon:"🖥️"}],pc=16,_E=4,xa=4,Sc=2,mt=4,Ur=4;let _e=Ng(7);const Fc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"};let dl=Hr(_e);function zg(t){return{x:t.dx,y:t.dy,w:t.pw,h:t.ph}}function Mg(t){return{cx:t.dx+t.pw/2,botY:t.dy+t.ph}}let Qt={};function OE(t){const l={};for(let r=0;r<t.length&&r<_e.desks.length;r++)l[t[r]]=_e.desks[r];return l}let Bt,ba=null,ya=null,lr=!1,hl=null,Kn=null,yn=null,rn=null,ii=null,jl=null;function BE(t,l){const{wx:r,wy:i,ww:c,wh:u,wallColor:f,baseboardColor:m}=t,x=Al(f,.5),d=qt(f,.5),g=[];if(l){const y=l.x-r,b=l.w;y>0&&g.push({sx:r,sw:y}),y+b<c&&g.push({sx:l.x+b,sw:c-y-b})}else g.push({sx:r,sw:c});for(const y of g){$(y.sx,i,y.sw,u,f);for(let b=0;b<u;b+=4)$(y.sx,i+b,y.sw,1,d,.08),$(y.sx,i+b+2,y.sw,1,x,.05);mi(Math.round(y.sx*7+i*13));for(let b=0;b<y.sw;b+=3)Nl()>.4&&$(y.sx+b,i,1,u,d,.04);$(y.sx,i,y.sw,2,d,.3),$(y.sx,i,y.sw,1,qt(f,1),.2),$(y.sx,i+u-2,y.sw,2,x,.3),$(y.sx,i+u,y.sw,Sc,m),$(y.sx,i+u,y.sw,1,qt(m,.5),.4)}l&&($(l.x-1,i,1,u+Sc,"#4A3828"),$(l.x+l.w,i,1,u+Sc,"#4A3828"),$(l.x,i,l.w,1,"#0A0808",.12)),$(t.fx,t.fy,t.fw,3,"#0A0808",.12),$(t.fx,t.fy+3,t.fw,2,"#0A0808",.06)}function LE(t){const l="#504038",r=Al(l,.5),i=qt(l,.5),c=t.wx-Ur,u=t.wy,f=t.wh+Sc+t.fh;$(c,u,Ur,f,l),$(c,u,1,f,i,.3),$(c+Ur-1,u,1,f,r,.4);for(let x=0;x<f;x+=6)$(c+1,u+x,Ur-2,1,i,.06);const m=t.wx+t.ww;$(m,u,Ur,f,l),$(m,u,1,f,i,.2),$(m+Ur-1,u,1,f,r,.3)}function Rd(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#B08040",f="#C89848",m="#8A6030",x="#6A4820";$(l,r,i,c,u),mi(42);for(let d=0;d<c;d+=5){const g=Math.floor(d/5)%2*10;for(let y=-10;y<i+10;y+=20){const b=l+y+g,v=Math.max(l,b),j=Math.min(b+19,l+i)-v;if(j<=0)continue;const S=Nl()>.5?f:u;$(v,r+d,j,4,S,.25),$(v,r+d,j,1,f,.3),$(v,r+d+4,j,1,x,.35),b>=l&&b<l+i&&$(b,r+d,1,4,x,.2),$(v,r+d+2,j,1,m,.1)}}$(l,r,i,2,"#0A0808",.08),$(l,r,2,c,"#0A0808",.06)}function O0(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#1C2A38",f="#101820";mi(99),$(l,r,i,c,u);for(let m=0;m<c;m+=pc)for(let x=0;x<i;x+=pc){const d=Math.min(pc,i-x),g=Math.min(pc,c-m);Nl()>.5&&$(l+x,r+m,d,g,qt(u,.2),.15),$(l+x+2,r+m+2,d-4,g-4,qt(u,.3),.08),$(l+x,r+m,d,1,f,.5),$(l+x,r+m,1,g,f,.5),$(l+x+1,r+m+1,1,g-1,qt(u,.4),.1),Nl()>.85&&tt(l+x+4+Math.floor(Nl()*8),r+m+4+Math.floor(Nl()*8),"#3A6A9A",.08)}}function $E(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#387848",f="#4A9058",m="#285E38";$(l,r,i,c,u),mi(77);for(let d=0;d<c;d+=2)for(let g=0;g<i;g+=2)Nl()>.5&&tt(l+g,r+d,f,.1),Nl()>.8&&tt(l+g+1,r+d+1,m,.12);const x=5;$(l+x,r+x,i-x*2,1,f,.45),$(l+x,r+c-x-1,i-x*2,1,m,.45),$(l+x,r+x,1,c-x*2,f,.35),$(l+i-x-1,r+x,1,c-x*2,m,.35)}function HE(t){const{fx:l,fy:r,fw:i,fh:c}=t,u="#D8C490",f="#B09060",m="#907848";mi(55);for(let x=0;x<c;x+=8)for(let d=0;d<i;d+=8){const g=Math.min(8,i-d),y=Math.min(8,c-x),b=(d/8+x/8)%2===0?f:u;$(l+d,r+x,g,y,b),$(l+d+1,r+x+1,g-2,1,qt(b,.4),.2),$(l+d+1,r+x+1,1,y-2,qt(b,.4),.15),$(l+d+g-2,r+x+2,1,y-3,Al(b,.4),.15),$(l+d+2,r+x+y-2,g-3,1,Al(b,.4),.15),$(l+d,r+x,g,1,m,.3),$(l+d,r+x,1,y,m,.3)}}function UE(){const{canvasW:t,canvasH:l,rooms:r,doors:i}=_e,c="#2A1E14",u="#3A2E24";if($(0,0,t,xa,c),$(0,l-xa,t,xa,c),$(0,0,xa,l,c),$(t-xa,0,xa,l,c),$(0,0,t,1,u,.3),$(0,0,1,l,u,.2),!r.exec||!r.work||!r.meet||!r.comm)return;const f=r.exec,m=r.meet,x=t/2,d=x-mt/2,g=f.fy+f.fh,y=i.exec_work,b=i.meet_comm,v=i.exec_meet,j=i.work_comm,S=24,E=28,C=((y==null?void 0:y.doorY)??f.fy+20)-S/2,A=((v==null?void 0:v.doorX)??xa+Ur+54)-E/2,M=((j==null?void 0:j.doorX)??x+mt/2+Ur+54)-E/2,R=((b==null?void 0:b.doorY)??m.fy+20)-S/2;$(0,g,A,mt,c),$(A+E,g,d-A-E,mt,c),$(d+mt,g,M-d-mt,mt,c),$(M+E,g,t-M-E,mt,c),$(0,g,A,1,u,.3),$(A+E,g,d-A-E,1,u,.3),$(d+mt,g,M-d-mt,1,u,.3),$(M+E,g,t-M-E,1,u,.3),$(d,0,mt,C,c),$(d,C+S,mt,g-C-S,c),$(d,g+mt,mt,R-g-mt,c),$(d,R+S,mt,l-R-S,c),$(d,0,1,C,u,.2),$(d,C+S,1,g-C-S,u,.2),$(d,g+mt,1,R-g-mt,u,.2),$(d,R+S,1,l-R-S,u,.2),$(d,C,mt,S,"#C4A070"),$(d+mt/2,C,mt/2,S,"#3A4858"),$(d,R,mt,S,"#7AA880"),$(d+mt/2,R,mt/2,S,"#C8B890");const L="#4A3828";$(d,C-1,mt,1,L),$(d,C+S,mt,1,L),$(A-1,g,1,mt,L),$(A+E,g,1,mt,L),$(M-1,g,1,mt,L),$(M+E,g,1,mt,L),$(d,R-1,mt,1,L),$(d,R+S,mt,1,L)}const B0=new Map;function IE(t){const l=`${t.hairStyle??""}|${t.outfitStyle??""}|${t.accessory??""}`;let r=B0.get(l);if(!r){const i=Qd("mini-seated:default"),c=sg(i,t);r=c?c.layers.flatMap(u=>u.pixels):[],B0.set(l,r)}return r}function YE(t,l,r){Wd(Bt,IE(r),t,l,r)}function qE(t,l,r,i,c){pa(t+8,l+20,"up"),c||YE(t+8,l+0+i,r),DE(t,l+14)}function XE(t,l,r,i,c){const u=i in T0?i:"down",f=c%4,m=T0[u][f];Wd(Bt,m,t,l,r);const x=f===1||f===3?-1:0;if(r.accessory&&r.accessory!=="none"){const d=_S(r.accessory,u);d&&d.pixels.length>0&&Wd(Bt,d.pixels,t,l+x,r)}Bt.globalAlpha=1}function VE(t){const l={};let r=0;for(const i of t){const c=Qt[i];c&&(l[i]={state:"sitting",homeX:c.dx+8,homeY:c.dy+34,homeRoom:c.room,x:c.dx+8,y:c.dy+34,path:[],room:c.room,dir:"down",walkFrame:0,walkTimer:0,bobY:0,bobOff:r*17,stateTimer:600+Math.floor(Math.random()*900)},r++)}return l}function Ds(t,l,r,i,c){const u=_e.corridorY[c]??l,f=[];return l<u-4&&f.push({x:t,y:u}),Math.abs(t-r)>4&&f.push({x:r,y:u}),f.push({x:r,y:i}),f}function Fd(t,l,r,i){const c=_e.adjacency[r];if(!c)return[];const u=c.find(g=>g.room===i);if(!u)return[];const f=_e.doors[u.door];if(!f)return[];const m=[],x=_e.corridorY[r]??l,d=_e.corridorY[i]??l;if(Math.abs(l-x)>4&&m.push({x:t,y:x}),f.type==="v"){const g=u.side==="A"?f.xA:f.xB,y=u.side==="A"?f.xB:f.xA;m.push({x:g,y:x}),m.push({x:g,y:f.doorY}),m.push({x:y,y:f.doorY}),m.push({x:y,y:d})}else{const g=u.side==="A"?f.yA:f.yB,y=u.side==="A"?f.yB:f.yA;m.push({x:f.doorX,y:x}),m.push({x:f.doorX,y:g}),m.push({x:f.doorX,y}),m.push({x:f.doorX,y:d})}return m}function Rg(t,l){const r=_e.adjacency[t.room];if(!r)return[];if(!r.find(c=>c.room===l)){for(const c of r){const u=_e.adjacency[c.room];if(u!=null&&u.find(f=>f.room===l)){const f=Fd(t.x,t.y,t.room,c.room),m=f[f.length-1],x=Fd((m==null?void 0:m.x)??t.x,(m==null?void 0:m.y)??t.y,c.room,l);return[...f,...x]}}return[]}return Fd(t.x,t.y,t.room,l)}function GE(t){if(t.room!==t.homeRoom){const l=Rg({...t},t.homeRoom),r=l[l.length-1],i=Ds((r==null?void 0:r.x)??t.x,(r==null?void 0:r.y)??t.y,t.homeX,t.homeY,t.homeRoom);return[...l,...i]}return Ds(t.x,t.y,t.homeX,t.homeY,t.room)}function KE(t,l){for(const[,r]of Object.entries(t))if(r.stateTimer--,r.state==="sitting"){if(r.bobY=(l+r.bobOff)%60<30?1:0,r.stateTimer<=0){r.state="walking",r.x=r.homeX,r.y=r.homeY,r.room=r.homeRoom;const i=Object.keys(_e.rooms);if(Math.random()<.25&&i.length>1){const c=i.filter(x=>x!==r.room),u=c[Math.floor(Math.random()*c.length)],f=Rg(r,u),m=_e.waypoints[u];if(m&&m.length>0){const x=m[Math.floor(Math.random()*m.length)],d=f[f.length-1]??{x:r.x,y:r.y},g=Ds(d.x,d.y,x.x,x.y,u);r.path=[...f,...g]}else r.path=f;r.walkTimer=0}else{const c=_e.waypoints[r.room];if(c&&c.length>0){const u=c[Math.floor(Math.random()*c.length)];r.path=Ds(r.x,r.y,u.x,u.y,r.room)}r.walkTimer=0}}}else if(r.state==="walking"||r.state==="returning"){if(r.path.length===0){r.state==="returning"?(r.state="sitting",r.room=r.homeRoom,r.stateTimer=800+Math.floor(Math.random()*1200)):(r.state="idle",r.dir="down",r.stateTimer=180+Math.floor(Math.random()*360));continue}const i=r.path[0],c=i.x-r.x,u=i.y-r.y,f=Math.sqrt(c*c+u*u);if(f<1.5){r.x=i.x,r.y=i.y,r.path.shift();for(const[m,x]of Object.entries(_e.rooms))if(r.x>=x.fx&&r.x<=x.fx+x.fw&&r.y>=x.fy&&r.y<=x.fy+x.fh){r.room=m;break}}else r.x+=c/f*.2,r.y+=u/f*.2,Math.abs(c)>Math.abs(u)?r.dir=c>0?"right":"left":r.dir=u>0?"down":"up",r.walkTimer++,r.walkFrame=Math.floor(r.walkTimer/12)%4}else if(r.state==="idle"&&r.stateTimer<=0)if(Math.random()<.3){r.state="walking";const i=_e.waypoints[r.room];if(i&&i.length>0){const c=i[Math.floor(Math.random()*i.length)];r.path=Ds(r.x,r.y,c.x,c.y,r.room)}r.walkTimer=0}else r.state="returning",r.path=GE(r),r.walkTimer=0}function QE(t,l,r){const{canvasW:i,canvasH:c,rooms:u}=_e;Bt.clearRect(0,0,i,c),$(0,0,i,c,"#2A1E14");const f={wood:Rd,dark:O0,carpet:$E,tile:HE};for(const y of Object.values(u))(f[y.floorType]??Rd)(y);const m=Object.keys(u);if(m.length>=4){const y=u.exec,b=u.meet,{doors:v}=_e;if(y&&b&&v.exec_meet&&v.work_comm){const S=(v.exec_meet.doorX??0)-14,E=(v.work_comm.doorX??0)-28/2,C=y.fy+y.fh,A=b.fy;Rd({fx:S,fy:C,fw:28,fh:A-C}),O0({fx:E,fy:C,fw:28,fh:A-C})}}const x={};if(m.length>=4){const{doors:y}=_e,b=28,v=y.exec_meet,j=y.work_comm;v!=null&&v.doorX&&(x.meet={x:v.doorX-b/2,w:b}),j!=null&&j.doorX&&(x.comm={x:j.doorX-b/2,w:b})}for(const y of Object.values(u))BE(y,x[y.id]),LE(y);UE(),zE(_e);const d=[],g=new Set(Object.values(Qt).map(y=>y.room));ME(_e,d,g);for(const[y,b]of Object.entries(Qt)){const v=t[y];if(!v)continue;const j=v.state==="sitting",S=l(y),E=r[y]==="working";d.push({y:b.dy+14,draw:()=>{if(qE(b.dx,b.dy,S,j?v.bobY:0,!j),j&&E){const C=Fc[y]??"#388bfd";$(b.dx+7,b.dy+14-4,12,5,C,.15),tt(b.dx+12,b.dy+14+1,"#4CAF50",.8)}}})}for(const[y,b]of Object.entries(t))if(b.state!=="sitting"){const v=l(y);d.push({y:b.y+14,draw:()=>XE(Math.round(b.x),Math.round(b.y),v,b.dir,b.walkFrame)})}d.sort((y,b)=>y.y-b.y);for(const y of d)y.draw();for(const y of dl){const b=ya===y.id,v=Mg(y);if(Bt.save(),Bt.globalAlpha=b?.9:.5,Bt.fillStyle=y.color,Bt.fillRect(v.cx-1,v.botY-2,3,3),b){const j=zg(y);Bt.globalAlpha=.3,Bt.strokeStyle=y.color,Bt.lineWidth=1,Bt.strokeRect(j.x-1,j.y-1,j.w+2,j.h+2)}Bt.restore()}if(lr){const y=new Set(Object.values(Qt).map(b=>b.room));if(hl&&hl!==Kn)if(hl.startsWith("desk:")){const b=hl.slice(5),v=Qt[b];v&&F0(Bt,v.dx,v.dy,"#FBBF24")}else R0(Bt,_e,hl,"#FBBF24",y);if(Kn)if(Kn.startsWith("desk:")){const b=Kn.slice(5),v=Qt[b];v&&F0(Bt,v.dx,v.dy,"#3B82F6")}else R0(Bt,_e,Kn,"#3B82F6",y)}if(ba){const y=Qt[ba],b=t[ba];y&&b&&(Bt.save(),Bt.globalAlpha=.25,Bt.fillStyle=Fc[ba]??"#fff",b.state==="sitting"?Bt.fillRect(y.dx-1,y.dy+6,28,30):Bt.fillRect(Math.round(b.x)-1,Math.round(b.y)-1,14,24),Bt.restore())}}function WE({roles:t,projects:l,roleStatuses:r,activeExecs:i,onRoleClick:c,onProjectClick:u,onBulletinClick:f,onDecisionsClick:m,onKnowledgeClick:x,onSettingsClick:d,onThemeClick:g,onStatsClick:y,getRoleSpeech:b,getAppearance:v,onHireClick:j}){const S=k.useRef(null),E=k.useRef(null),C=k.useRef(null),A=k.useRef({}),M=k.useRef(0),R=k.useRef(_E),[L,O]=k.useState(!1),[U,X]=k.useState(null),[ne,D]=k.useState(null),Y=k.useRef({}),F=k.useRef({}),Q=k.useRef([]),ee=k.useRef([]);k.useEffect(()=>{lr=L},[L]),k.useEffect(()=>{ii=U,jl=ne},[U,ne]),k.useEffect(()=>{Ce.getPreferences().then(he=>{const G=he.furnitureOverrides;G&&Object.keys(G).length>0&&(Y.current=G,_e=D0(_e,G));const ie=he.deskOverrides;if(ie&&Object.keys(ie).length>0){F.current=ie,z0(Qt,ie);for(const[Ne,Re]of Object.entries(Qt)){const Ae=A.current[Ne];Ae&&(Ae.homeX=Re.dx+8,Ae.homeY=Re.dy+34)}}const xe=he.removedFurniture;xe&&xe.length>0&&(Q.current=xe,_e=zd(_e,xe));const Te=he.addedFurniture;Te&&Te.length>0&&(ee.current=Te,_e=M0(_e,Te)),dl=Hr(_e)}).catch(()=>{})},[]);const V=k.useRef({roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v});V.current={roleStatuses:r,activeExecs:i,getRoleSpeech:b,getAppearance:v};const I=k.useMemo(()=>t.map(he=>he.id),[t]),Z=k.useRef(_e);k.useEffect(()=>{const he=I.length,G=Eg(he,Z.current.preset);let ie=Ng(he,G);Q.current.length>0&&(ie=zd(ie,Q.current)),ee.current.length>0&&(ie=M0(ie,ee.current)),Object.keys(Y.current).length>0&&(ie=D0(ie,Y.current)),_e=ie,Z.current=ie,Qt=OE(I),Object.keys(F.current).length>0&&z0(Qt,F.current),dl=Hr(ie),A.current=VE(I);const xe=S.current;xe&&(xe.width=ie.canvasW,xe.height=ie.canvasH),we()},[I]);const ce=k.useCallback(he=>{var G,ie;return((ie=(G=V.current).getAppearance)==null?void 0:ie.call(G,he))??Eh(he)},[]),we=k.useCallback(()=>{const he=E.current,G=S.current;if(!he||!G)return;const ie=he.parentElement;if(!ie)return;const xe=ie.clientWidth,Te=ie.clientHeight;if(xe===0||Te===0)return;const{canvasW:Ne,canvasH:Re}=_e;let Ae=Math.floor(Math.min(xe/Ne,Te/Re));Ae=Math.max(2,Math.min(Ae,5)),R.current=Ae,G.style.width=Ne*Ae+"px",G.style.height=Re*Ae+"px",he.style.width=Ne*Ae+"px",he.style.height=Re*Ae+"px"},[]);k.useEffect(()=>{var Re;const he=S.current;if(!he)return;const G=he.getContext("2d");if(!G)return;Bt=G,pE(G),we();const ie=new ResizeObserver(()=>we()),xe=(Re=E.current)==null?void 0:Re.parentElement;xe&&ie.observe(xe);let Te;const Ne=()=>{M.current++,KE(A.current,M.current),QE(A.current,ce,V.current.roleStatuses),z(),Te=requestAnimationFrame(Ne)};return Te=requestAnimationFrame(Ne),()=>{cancelAnimationFrame(Te),ie.disconnect()}},[ce,we]),k.useEffect(()=>{const he=C.current;if(!he)return;he.innerHTML="";const G={};for(const xe of t)G[xe.id]=xe.name;for(const xe of I){const Te=Fc[xe]??"#8b949e",Ne=G[xe],Re=Ne&&Ne.toLowerCase()!==xe.toLowerCase()?`${xe.toUpperCase()} · ${Ne}`:xe.toUpperCase(),Ae=document.createElement("div");Ae.className="td-nametag",Ae.dataset.role=xe;const Be=document.createElement("span");Be.className="td-dot",Be.style.background=Te,Ae.appendChild(Be),Ae.appendChild(document.createTextNode(Re)),he.appendChild(Ae);const Ke=document.createElement("div");Ke.className="td-bubble",Ke.dataset.role=xe,Ke.dataset.type="bubble",he.appendChild(Ke)}const ie={meeting:()=>{const xe=l[0];xe?u(xe.id):f()},bulletin:f,decisions:m,knowledge:x,settings:d,theme:g,stats:y};for(const xe of dl){const Te=document.createElement("div");Te.className="td-facility-label",Te.dataset.facility=xe.id,Te.textContent=`${xe.icon} ${xe.label}`,Te.style.borderColor=`${xe.color}44`;const Ne=ie[xe.id];Ne&&Te.addEventListener("click",Ne),Te.addEventListener("mouseenter",()=>{ya=xe.id}),Te.addEventListener("mouseleave",()=>{ya=null}),he.appendChild(Te)}},[I,t,l,u,f,m,x,d,g,y]);const z=k.useCallback(()=>{var Re;const he=C.current;if(!he)return;const G=R.current,ie=A.current,{getRoleSpeech:xe,roleStatuses:Te,activeExecs:Ne}=V.current;for(const Ae of Object.keys(ie)){const Be=ie[Ae],Ke=Qt[Ae];if(!Ke)continue;let St,Xt,pt;Be.state==="sitting"?(St=Ke.dx+13,pt=Ke.dy+2,Xt=Ke.dy+37):(St=Math.round(Be.x)+6,pt=Math.round(Be.y)-2,Xt=Math.round(Be.y)+18);const bt=St/_e.canvasW*100,re=he.querySelector(`.td-nametag[data-role="${Ae}"]`);if(re){re.style.left=bt+"%",re.style.top=Xt*G+2+"px";const ze=re.querySelector(".td-dot");if(ze){const Ie=Te[Ae]==="working";ze.style.background=Ie?"#FBBF24":Fc[Ae]??"#8b949e",Ie?ze.style.animation="td-pulse 1s ease-in-out infinite":ze.style.animation=""}}const ye=he.querySelector(`.td-bubble[data-role="${Ae}"]`);if(ye){const ze=Te[Ae]==="working",Ie=(Re=Ne.find(jt=>jt.roleId===Ae))==null?void 0:Re.task,be=xe(Ae),je=ze&&Ie?Ie.slice(0,60):be?be.slice(0,60):"";je&&Be.state==="sitting"?(ye.style.display="",ye.style.left=bt+"%",ye.style.top=(pt-10)*G+"px",ye.textContent=je):ye.style.display="none"}}for(const Ae of dl){const Be=he.querySelector(`.td-facility-label[data-facility="${Ae.id}"]`);if(Be){const Ke=Mg(Ae);Be.style.left=Ke.cx/_e.canvasW*100+"%",Be.style.top=Ke.botY*G-4+"px",Be.classList.toggle("td-facility-label--hover",ya===Ae.id)}}},[]),B=k.useCallback(he=>{const G=S.current;if(!G)return null;const ie=G.getBoundingClientRect(),xe=R.current,Te=(he.clientX-ie.left)/xe,Ne=(he.clientY-ie.top)/xe,Re=A.current;for(const[Ae,Be]of Object.entries(Qt)){if(!Re[Ae])continue;const Ke=Re[Ae];if(Ke.state==="sitting"){if(Te>=Be.dx&&Te<=Be.dx+26&&Ne>=Be.dy&&Ne<=Be.dy+40)return{type:"role",id:Ae}}else if(Te>=Ke.x-2&&Te<=Ke.x+14&&Ne>=Ke.y-2&&Ne<=Ke.y+20)return{type:"role",id:Ae}}for(const Ae of dl){const Be=zg(Ae);if(Te>=Be.x&&Te<=Be.x+Be.w&&Ne>=Be.y&&Ne<=Be.y+Be.h)return{type:"facility",id:Ae.id}}return null},[]),W=k.useCallback(he=>{const G=S.current;if(!G)return{mx:0,my:0};const ie=G.getBoundingClientRect(),xe=R.current;return{mx:(he.clientX-ie.left)/xe,my:(he.clientY-ie.top)/xe}},[]),T=k.useCallback(he=>{Ce.updatePreferences(he).catch(()=>{})},[]),me=k.useCallback(he=>{const G=[...Q.current,he];Q.current=G,_e=zd(_e,[he]),dl=Hr(_e),Kn=null,hl=null,T({removedFurniture:G})},[T]),Se=k.useCallback((he,G)=>{if(!ii||!jl)return;let ie=null;for(const[Be,Ke]of Object.entries(_e.rooms)){const St=jl==="wall"?Ke.wx:Ke.fx,Xt=jl==="wall"?Ke.wy:Ke.fy,pt=jl==="wall"?Ke.ww:Ke.fw,bt=jl==="wall"?Ke.wh:Ke.fh;if(he>=St&&he<=St+pt&&G>=Xt&&G<=Xt+bt){ie=Be;break}}if(!ie)return;const xe=_e.rooms[ie],Te=jl==="wall"?xe.wx:xe.fx,Ne=jl==="wall"?xe.wy:xe.fy,Re={id:`user-${ii}-${Date.now()}`,type:ii,room:ie,zone:jl,offsetX:Math.round(he-Te),offsetY:Math.round(G-Ne)},Ae=[...ee.current,Re];ee.current=Ae,jl==="wall"?_e.wallDecorations.push(Re):_e.furniture.push(Re),dl=Hr(_e),T({addedFurniture:Ae}),X(null),D(null)},[T]),Ee=k.useCallback(he=>{const G=S.current;if(lr&&yn){const{mx:xe,my:Te}=W(he),Re=[..._e.furniture,..._e.wallDecorations].find(Ke=>Ke.id===yn.defId);if(!Re)return;const Ae=xe-yn.startMx,Be=Te-yn.startMy;Re.offsetX=Math.round(yn.origOffX+Ae),Re.offsetY=Math.round(yn.origOffY+Be),dl=Hr(_e),G&&(G.style.cursor="grabbing");return}if(lr&&rn){const{mx:xe,my:Te}=W(he),Ne=Qt[rn.roleId];if(!Ne)return;Ne.dx=Math.round(rn.origDx+(xe-rn.startMx)),Ne.dy=Math.round(rn.origDy+(Te-rn.startMy));const Re=A.current[rn.roleId];Re&&(Re.homeX=Ne.dx+8,Re.homeY=Ne.dy+34),G&&(G.style.cursor="grabbing");return}if(lr){const{mx:xe,my:Te}=W(he);if(ii){G&&(G.style.cursor="crosshair");return}const Ne=new Set(Object.values(Qt).map(Ae=>Ae.room)),Re=Md(_e,xe,Te,Ne);if(Re)hl=Re;else{const Ae=_0(Qt,xe,Te);hl=Ae?`desk:${Ae}`:null}ba=null,ya=null,G&&(G.style.cursor=hl?"grab":"default");return}const ie=B(he);ba=(ie==null?void 0:ie.type)==="role"?ie.id:null,ya=(ie==null?void 0:ie.type)==="facility"?ie.id:null,hl=null,G&&(G.style.cursor=ie?"pointer":"default")},[B,W]),Oe=k.useCallback(he=>{if(!lr)return;const{mx:G,my:ie}=W(he);if(ii){Se(G,ie),he.preventDefault();return}const xe=new Set(Object.values(Qt).map(Re=>Re.room)),Te=Md(_e,G,ie,xe);if(Te){const Ae=[..._e.furniture,..._e.wallDecorations].find(Be=>Be.id===Te);Ae&&(Kn=Te,yn={defId:Te,startMx:G,startMy:ie,origOffX:Ae.offsetX,origOffY:Ae.offsetY},he.preventDefault());return}const Ne=_0(Qt,G,ie);if(Ne){const Re=Qt[Ne];Kn=`desk:${Ne}`,rn={roleId:Ne,startMx:G,startMy:ie,origDx:Re.dx,origDy:Re.dy},he.preventDefault();return}Kn=null},[W,Se]),He=k.useCallback(he=>{if(yn){const ie=[..._e.furniture,..._e.wallDecorations].find(xe=>xe.id===yn.defId);if(ie){const xe={...Y.current,[ie.id]:{offsetX:ie.offsetX,offsetY:ie.offsetY}};Y.current=xe,T({furnitureOverrides:xe}),dl=Hr(_e)}yn=null,S.current&&(S.current.style.cursor="grab");return}if(rn){const G=Qt[rn.roleId];if(G){const ie={...F.current,[rn.roleId]:{dx:G.dx,dy:G.dy}};F.current=ie,T({deskOverrides:ie})}rn=null,S.current&&(S.current.style.cursor="grab")}},[T]),Ge=k.useCallback(he=>{if(!lr)return;he.preventDefault();const{mx:G,my:ie}=W(he),xe=new Set(Object.values(Qt).map(Ne=>Ne.room)),Te=Md(_e,G,ie,xe);Te&&me(Te)},[W,me]);k.useEffect(()=>{const he=G=>{!lr||!Kn||(G.key==="Delete"||G.key==="Backspace")&&(Kn.startsWith("desk:")||me(Kn))};return window.addEventListener("keydown",he),()=>window.removeEventListener("keydown",he)},[me]);const ke=k.useCallback(()=>{if(yn){const G=[..._e.furniture,..._e.wallDecorations].find(ie=>ie.id===yn.defId);G&&(G.offsetX=yn.origOffX,G.offsetY=yn.origOffY,dl=Hr(_e)),yn=null}if(rn){const he=Qt[rn.roleId];he&&(he.dx=rn.origDx,he.dy=rn.origDy);const G=A.current[rn.roleId];G&&(G.homeX=he.dx+8,G.homeY=he.dy+34),rn=null}ba=null,ya=null,hl=null,S.current&&(S.current.style.cursor="default")},[]),xt=k.useCallback(he=>{if(lr)return;const G=B(he);if(G){if(G.type==="role"){c(G.id);return}switch(G.id){case"meeting":{const ie=l[0];ie?u(ie.id):f();break}case"bulletin":f();break;case"decisions":m();break;case"knowledge":x();break;case"settings":d==null||d();break;case"theme":g==null||g();break;case"stats":y==null||y();break}}},[B,c,u,f,m,x,d,g,y]);return o.jsxs("div",{className:`td-scene${L?" td-scene--editing":""}`,children:[o.jsxs("div",{ref:E,className:"td-wrap",children:[o.jsx("canvas",{ref:S,width:_e.canvasW,height:_e.canvasH,className:"td-canvas",onClick:xt,onMouseDown:Oe,onMouseUp:He,onMouseMove:Ee,onMouseLeave:ke,onContextMenu:Ge}),o.jsx("div",{ref:C,className:"td-overlay"})]}),L&&o.jsxs("div",{className:"td-edit-banner",children:[o.jsx("span",{className:"td-edit-banner__icon",children:"✎"})," EDIT MODE — Click DONE when finished"]}),o.jsxs("button",{className:`td-edit-btn${L?" td-edit-btn--active":""}`,onClick:()=>{O(he=>{const G=!he;return G||(X(null),D(null)),G}),Kn=null,yn=null,rn=null},title:L?"Exit Edit Mode":"Edit Furniture Layout",children:[o.jsx("span",{className:"td-edit-btn__icon",children:L?"✓":"✎"}),o.jsx("span",{className:"td-edit-btn__label",children:L?"DONE":"EDIT"})]}),L&&o.jsx("div",{className:"td-palette",children:FE.map(he=>o.jsx("button",{className:`td-palette__item${U===he.type?" td-palette__item--active":""}`,onClick:()=>{U===he.type?(X(null),D(null)):(X(he.type),D(he.zone))},title:he.label,children:o.jsx("span",{children:he.icon})},he.type))}),j&&o.jsxs("button",{className:"td-hire-btn",onClick:j,title:"Hire New Role",children:[o.jsx("span",{className:"td-hire-btn__icon",children:"+"}),o.jsx("span",{className:"td-hire-btn__label",children:"HIRE"})]})]})}function ZE({role:t,appearance:l,onSave:r,onReset:i,onClose:c,theme:u,onThemeChange:f,onUpdateName:m,initialTab:x,characterOnly:d,speechSettings:g,onSpeechSettingsChange:y,language:b,onLanguageChange:v,roleLevel:j}){var Y;const[S,E]=k.useState(x??"character"),[C,A]=k.useState({...l}),[M,R]=k.useState(t.name),[L,O]=k.useState(!1),U=k.useCallback(()=>A(js(j)),[j]),X=k.useCallback(()=>{const F=Eh(t.id);A({...F}),i()},[t.id,i]),ne=k.useCallback(async()=>{r(C);const F=M.trim();if(m&&F&&F!==t.name){O(!0);try{await m(t.id,F)}catch{}O(!1)}c()},[C,r,c,M,t.name,t.id,m]),D=o.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[o.jsxs("span",{children:[t.id.toUpperCase()," –"]}),m?o.jsx("input",{value:M,onChange:F=>R(F.target.value),disabled:L,className:"customize-name-input",style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:4,color:"inherit",font:"inherit",padding:"2px 6px",flex:1,minWidth:0}}):o.jsx("span",{children:t.name})]});return o.jsx("div",{className:"customize-overlay",onClick:c,children:o.jsxs("div",{className:"customize-modal",onClick:F=>F.stopPropagation(),children:[o.jsxs("div",{className:"customize-header",children:[o.jsxs("div",{className:"customize-tabs",children:[o.jsx("button",{className:`customize-tab ${S==="character"?"active":""}`,onClick:()=>E("character"),children:"CHARACTER"}),!d&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:`customize-tab ${S==="office"?"active":""}`,onClick:()=>E("office"),children:"OFFICE THEME"}),o.jsx("button",{className:`customize-tab ${S==="settings"?"active":""}`,onClick:()=>E("settings"),children:"SETTINGS"})]})]}),o.jsx("button",{className:"customize-close",onClick:c,children:"X"})]}),S==="character"?o.jsx("div",{className:"customize-body",children:o.jsx(vg,{roleId:t.id,appearance:C,onChange:A,onRandomize:U,onReset:X,label:D,roleLevel:j})}):S==="office"?o.jsx("div",{className:"customize-body",children:o.jsx("div",{className:"customize-themes",children:Object.entries(Yr).map(([F,Q])=>o.jsxs("button",{className:`customize-theme-card ${u===F?"active":""}`,onClick:()=>f(F),children:[o.jsxs("div",{className:"customize-theme-preview",style:{background:Q.vars["--floor-light"],borderColor:Q.vars["--pixel-border"]},children:[o.jsx("div",{style:{background:Q.vars["--hud-bg"],height:8,borderBottom:`2px solid ${Q.vars["--pixel-border"]}`}}),o.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1 p-1",children:[o.jsx("div",{style:{width:10,height:14,background:Q.vars["--accent"],borderRadius:1}}),o.jsx("div",{style:{width:10,height:14,background:Q.vars["--active-green"],borderRadius:1}}),o.jsx("div",{style:{width:10,height:14,background:Q.vars["--idle-amber"],borderRadius:1}})]}),o.jsx("div",{style:{background:Q.vars["--hud-bg"],height:6,borderTop:`2px solid ${Q.vars["--pixel-border"]}`}})]}),o.jsxs("div",{className:"customize-theme-name",children:[Q.icon," ",Q.name]})]},F))})}):o.jsx("div",{className:"customize-body",children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,padding:"8px 0"},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),o.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(F=>o.jsxs("button",{onClick:()=>y==null?void 0:y({mode:F}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(g==null?void 0:g.mode)===F?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(g==null?void 0:g.mode)===F?"rgba(255,255,255,0.08)":"transparent",color:(g==null?void 0:g.mode)===F?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[o.jsx("div",{style:{fontWeight:600,marginBottom:2},children:F==="template"?"TEMPLATE":F==="llm"?"AI":"AUTO"}),o.jsx("div",{style:{fontSize:9,opacity:.7},children:F==="template"?"Static pool ($0)":F==="llm"?"LLM generated":"Detect engine"})]},F))}),o.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(g==null?void 0:g.intervalSec)??18,"s"]}),o.jsx("input",{type:"range",min:5,max:120,step:5,value:(g==null?void 0:g.intervalSec)??18,onChange:F=>y==null?void 0:y({intervalSec:Number(F.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[o.jsx("span",{children:"5s (frequent)"}),o.jsx("span",{children:"120s (rare)"})]})]}),(g==null?void 0:g.mode)!=="template"&&o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((Y=g==null?void 0:g.dailyBudgetUsd)==null?void 0:Y.toFixed(2))??"1.00"]}),o.jsx("input",{type:"range",min:0,max:5,step:.25,value:(g==null?void 0:g.dailyBudgetUsd)??1,onChange:F=>y==null?void 0:y({dailyBudgetUsd:Number(F.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[o.jsx("span",{children:"$0 (unlimited)"}),o.jsx("span",{children:"$5.00/day"})]})]}),o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),o.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:F,label:Q})=>o.jsx("button",{onClick:()=>v==null?void 0:v(F),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(b??"auto")===F?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(b??"auto")===F?"rgba(255,255,255,0.08)":"transparent",color:(b??"auto")===F?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:Q},F))}),o.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]})]})}),S==="character"&&o.jsxs("div",{className:"customize-footer",children:[o.jsx("button",{className:"customize-btn customize-btn--cancel",onClick:c,children:"CANCEL"}),o.jsx("button",{className:"customize-btn customize-btn--save",onClick:ne,children:"SAVE"})]})]})})}function L0(t){if(t.length===0)return"";const l={};for(const{file:m}of t){const x=m.split("/"),d=x[0]==="."?x[1]??"root":x[0];(l[d]??(l[d]=[])).push(m)}const r={roles:"roles",projects:"projects",operations:"operations",knowledge:"knowledge",architecture:"architecture",company:"company",".tycono":"config",".claude":"skills"},i=[];for(const[m,x]of Object.entries(l)){const d=r[m]??m;if(x.length===1){const g=x[0].split("/").pop()??x[0];i.push(`${d}/${g}`)}else i.push(`${d} (${x.length} files)`)}const c=t.some(m=>m.status==="A"),u=t.some(m=>m.status==="M");return`${c&&!u?"add":"update"}: ${i.join(", ")}`}function $0(t){const l=Date.now()-new Date(t).getTime(),r=Math.floor(l/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function JE({status:t,history:l,onClose:r,onSave:i,onLoadHistory:c,onRestore:u,saving:f,onDelegate:m,delegateRoleName:x}){const[d,g]=k.useState("save"),[y,b]=k.useState(""),[v,j]=k.useState(null),[S,E]=k.useState(!1),[C,A]=k.useState(null),M=k.useRef(null);k.useEffect(()=>{d==="history"&&c()},[d,c]),k.useEffect(()=>{var D;(D=M.current)==null||D.focus()},[]);const R=[...((t==null?void 0:t.modified)??[]).map(D=>({status:"M",file:D})),...((t==null?void 0:t.untracked)??[]).map(D=>({status:"A",file:D}))],L=k.useRef(!1);k.useEffect(()=>{!L.current&&R.length>0&&!y&&(b(L0(R)),L.current=!0)},[R.length]);const O=k.useCallback(()=>{b(L0(R))},[R]),U=async()=>{j(null),A(null);try{const D=await i(y||void 0);A(D),b("")}catch(D){j(D instanceof Error?D.message:"Save failed")}},X=async D=>{if(confirm(`Restore from commit ${D.slice(0,7)}? This creates a new commit with those files.`)){E(!0);try{await u(D),E(!1)}catch(Y){j(Y instanceof Error?Y.message:"Restore failed"),E(!1)}}};k.useEffect(()=>{const D=Y=>{Y.key==="Escape"&&r()};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[r]);const ne=D=>{D.key==="Enter"&&(D.metaKey||D.ctrlKey)&&U()};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-black/40 z-[60] backdrop-blur-sm",onClick:r}),o.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[520px] max-h-[80vh] z-[61] overflow-hidden flex flex-col",style:{background:"var(--hud-bg)",border:"3px solid var(--pixel-border)",fontFamily:"var(--pixel-font)",color:"var(--terminal-text)"},onKeyDown:ne,children:[o.jsxs("div",{className:"px-5 py-3 flex items-center justify-between shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"text-lg font-black tracking-tight",children:"SAVE GAME"}),o.jsx("span",{className:"text-[10px]",style:{color:"var(--terminal-text-secondary)"},children:(t==null?void 0:t.branch)??""})]}),o.jsx("button",{onClick:r,className:"text-[var(--terminal-text-secondary)] hover:text-[var(--terminal-text)] cursor-pointer text-lg",children:"×"})]}),o.jsx("div",{className:"flex shrink-0",style:{borderBottom:"2px solid var(--pixel-border)"},children:["save","history"].map(D=>o.jsx("button",{onClick:()=>g(D),className:"flex-1 py-2 text-[11px] font-bold uppercase tracking-wider cursor-pointer",style:{background:d===D?"var(--hud-bg-alt)":"transparent",color:d===D?"var(--terminal-text)":"var(--terminal-text-muted)",borderBottom:d===D?"2px solid var(--accent)":"2px solid transparent"},children:D==="save"?"SAVE":"HISTORY"},D))}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[d==="save"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"text-[11px]",style:{color:"var(--terminal-text-secondary)"},children:R.length>0?o.jsxs("span",{style:{color:"var(--idle-amber)"},children:["* ",R.length," unsaved change",R.length>1?"s":""]}):o.jsx("span",{style:{color:"var(--active-green)"},children:"All changes saved"})}),R.length>0&&o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider mb-2",style:{color:"var(--terminal-text-muted)"},children:"Changed Files"}),o.jsx("div",{className:"text-[11px] max-h-[160px] overflow-y-auto p-2 space-y-0.5",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)"},children:R.map(({status:D,file:Y})=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx("span",{style:{color:D==="A"?"var(--active-green)":"var(--idle-amber)",width:"14px"},children:D}),o.jsx("span",{style:{color:"var(--terminal-text-secondary)"},children:Y})]},Y))})]}),R.length>0&&o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--terminal-text-muted)"},children:"Save Message"}),o.jsxs("button",{onClick:O,className:"text-[9px] px-1.5 py-0.5 cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--accent)",fontFamily:"var(--pixel-font)"},title:"Auto-generate message from changes",children:["✨"," AUTO"]})]}),o.jsx("input",{ref:M,type:"text",value:y,onChange:D=>b(D.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)"}})]}),R.length>0&&o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{onClick:U,disabled:f,className:"flex-1 py-2.5 text-[12px] font-black uppercase tracking-wider cursor-pointer disabled:opacity-50",style:{background:"var(--accent)",color:"#fff",border:"2px solid var(--accent)"},children:f?"SAVING...":t!=null&&t.hasRemote?"SAVE & PUSH":"SAVE"}),m&&o.jsxs("button",{onClick:()=>{const D=R.map(Y=>`${Y.status} ${Y.file}`).join(`
|
|
89
|
+
`);m(D)},disabled:f,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"]})]}),R.length>0&&t&&!t.hasRemote&&o.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:"Local save only — add a git remote to enable push"}),C&&o.jsxs("div",{className:"text-[11px] p-2",style:{background:"rgba(59,185,80,0.1)",border:"1px solid var(--active-green)",color:"var(--active-green)"},children:["Saved! ",C.filesChanged," file",C.filesChanged>1?"s":""," committed",C.pushed?" & pushed":"",C.pushError?` (push error: ${C.pushError})`:""]}),v&&o.jsx("div",{className:"text-[11px] p-2",style:{background:"rgba(211,47,47,0.1)",border:"1px solid #D32F2F",color:"#EF5350"},children:v}),(t==null?void 0:t.lastCommit)&&o.jsxs("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:["Last save: ",t.lastCommit.message," (",$0(t.lastCommit.date),")"]})]}),d==="history"&&o.jsxs(o.Fragment,{children:[l.length===0&&o.jsx("div",{className:"text-[11px] text-center py-8",style:{color:"var(--terminal-text-muted)"},children:"No save history"}),o.jsx("div",{className:"space-y-1",children:l.map(D=>o.jsxs("div",{className:"flex items-center justify-between py-2 px-3 group",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--accent)"},children:D.shortSha}),o.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--terminal-text)"},children:D.message})]}),o.jsx("div",{className:"text-[10px]",style:{color:"var(--terminal-text-muted)"},children:$0(D.date)})]}),o.jsx("button",{onClick:()=>X(D.sha),disabled:S,className:"text-[10px] font-bold px-2 py-1 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--idle-amber)"},children:"LOAD"})]},D.sha))})]})]})]})]})}function PE({onClose:t}){const[l,r]=k.useState(null),[i,c]=k.useState(!0),[u,f]=k.useState(null);return k.useEffect(()=>{Ce.getCompanyStats().then(r).catch(m=>f(m.message)).finally(()=>c(!1))},[]),i?o.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading stats..."}):u||!l?o.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u||"Failed to load stats",o.jsx("button",{onClick:t,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]}):o.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:20},children:[o.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Company Stats"}),o.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:20},children:[o.jsx(yc,{label:"Roles",value:String(l.company.roleCount)}),o.jsx(yc,{label:"Avg Level",value:`Lv.${l.company.avgLevel}`}),o.jsx(yc,{label:"Total Tokens",value:l.company.formattedTokens}),o.jsx(yc,{label:"Total Cost",value:`$${l.company.totalCostUsd.toFixed(2)}`})]}),o.jsx("h4",{style:{margin:"0 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Role Leaderboard"}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[l.roles.map((m,x)=>o.jsx(eN,{role:m,rank:x+1},m.roleId)),l.roles.length===0&&o.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"8px 0"},children:"No role activity yet. Assign tasks to start leveling up!"})]}),Object.keys(l.byModel).length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h4",{style:{margin:"20px 0 12px",fontSize:13,fontWeight:600,color:"rgba(255,255,255,0.6)",textTransform:"uppercase",letterSpacing:1},children:"Model Usage"}),o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:Object.entries(l.byModel).map(([m,x])=>o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"6px 10px",background:"rgba(255,255,255,0.03)",borderRadius:6,fontSize:12},children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.7)"},children:tN(m)}),o.jsxs("span",{style:{color:"rgba(255,255,255,0.5)"},children:["$",x.costUsd.toFixed(2)]})]},m))})]})]})}function yc({label:t,value:l}){return o.jsxs("div",{style:{padding:"12px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[o.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.45)",marginBottom:4},children:t}),o.jsx("div",{style:{fontSize:18,fontWeight:600},children:l})]})}function eN({role:t,rank:l}){const r=["🥇","🥈","🥉"],i=l<=3?r[l-1]:`#${l}`;return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",background:"rgba(255,255,255,0.03)",borderRadius:8},children:[o.jsx("span",{style:{fontSize:14,width:28,textAlign:"center",flexShrink:0},children:i}),o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:4},children:[o.jsx("span",{style:{fontSize:13,fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),o.jsxs("span",{style:{fontSize:12,color:H0(t.level),fontWeight:600,flexShrink:0,marginLeft:8},children:["Lv.",t.level]})]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[o.jsx("div",{style:{flex:1,height:4,background:"rgba(255,255,255,0.08)",borderRadius:2,overflow:"hidden"},children:o.jsx("div",{style:{width:`${t.progress*100}%`,height:"100%",background:H0(t.level),borderRadius:2,transition:"width 0.3s ease"}})}),o.jsx("span",{style:{fontSize:10,color:"rgba(255,255,255,0.4)",flexShrink:0},children:t.formattedTokens})]})]})]})}function H0(t){return t>=9?"#FFD700":t>=7?"#C0A0FF":t>=5?"#4FC3F7":t>=3?"#81C784":"rgba(255,255,255,0.4)"}function tN(t){return t.includes("opus")?"Opus":t.includes("sonnet")?"Sonnet":t.includes("haiku")?"Haiku":t.split("-").slice(0,2).join(" ")}function nN({onClose:t,onSyncComplete:l}){const[r,i]=k.useState([]),[c,u]=k.useState([]),[f,m]=k.useState(!0),[x,d]=k.useState(null),[g,y]=k.useState(new Set),[b,v]=k.useState(null),[j,S]=k.useState(null),E=k.useCallback(async()=>{m(!0),v(null);try{const{roles:A}=await Ce.getSyncRoles();i(A);const M=A.filter(L=>L.source.sync!=="off");if(M.length===0){u([]),S(null);return}let R=!1;try{const L=await Ts.syncCheck(M.map(U=>({roleId:U.roleId,sourceId:U.source.id,currentVersion:U.source.upstream_version??U.source.forked_at??"0.0.0"})));R=!0,S(!0);const O=[];for(const U of L.updates){if(!U.hasUpdate)continue;const X=M.find(Q=>Q.roleId===U.roleId);if(!X)continue;const{character:ne}=await Ts.syncPull(U.sourceId),D=[];X.persona.trim()!==ne.persona.trim()&&D.push({field:"persona",local:X.persona.slice(0,120)+(X.persona.length>120?"...":""),upstream:ne.persona.slice(0,120)+(ne.persona.length>120?"...":"")});const Y=JSON.stringify(X.authority),F=JSON.stringify(ne.authority);Y!==F&&D.push({field:"authority",local:`${X.authority.autonomous.length} autonomous, ${X.authority.needsApproval.length} approval`,upstream:`${ne.authority.autonomous.length} autonomous, ${ne.authority.needsApproval.length} approval`}),D.length>0&&O.push({roleId:U.roleId,roleName:X.name,sourceId:U.sourceId,currentVersion:U.currentVersion,latestVersion:U.latestVersion,fields:D})}u(O)}catch{S(!1),u([])}}catch(A){v(A instanceof Error?A.message:"Failed to check for updates")}finally{m(!1)}},[]);k.useEffect(()=>{E()},[E]);const C=async A=>{d(A.roleId);try{const{character:M,version:R}=await Ts.syncPull(A.sourceId);await Ce.applySyncUpdate({roleId:A.roleId,changes:{persona:M.persona,authority:M.authority},upstreamVersion:R}),y(L=>new Set(L).add(A.roleId)),l==null||l()}catch(M){v(M instanceof Error?M.message:"Failed to apply update")}finally{d(null)}};return o.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[o.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"Role Sync"}),o.jsxs("div",{style:{display:"flex",gap:8},children:[o.jsx("button",{onClick:E,disabled:f,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:f?"wait":"pointer"},children:f?"Checking...":"Refresh"}),o.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),j===!1&&o.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,180,0,0.1)",borderRadius:6,color:"#FFB74D",fontSize:12,marginBottom:12},children:"Cloud API unreachable. Sync requires connection to api.tycono.ai."}),b&&o.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:b}),o.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Tracked roles: "}),o.jsx("span",{style:{fontWeight:500},children:r.length}),o.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Updates available: "}),o.jsx("span",{style:{fontWeight:500,color:c.length>0?"#4FC3F7":"rgba(255,255,255,0.7)"},children:c.filter(A=>!g.has(A.roleId)).length}),j===!0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.3)",margin:"0 8px"},children:"·"}),o.jsx("span",{style:{fontSize:11,color:"#81C784"},children:"Cloud connected"})]})]}),c.length===0&&!f&&o.jsx("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:r.length===0?"No roles with source tracking. Hire from the Store to enable sync.":"All roles are up to date!"}),c.map(A=>o.jsxs("div",{style:{marginBottom:12,padding:14,background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:14,fontWeight:500},children:A.roleName}),o.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.4)"},children:[A.sourceId," · v",A.currentVersion," → v",A.latestVersion]})]}),g.has(A.roleId)?o.jsx("span",{style:{fontSize:12,color:"#81C784"},children:"Applied ✓"}):o.jsx("button",{onClick:()=>C(A),disabled:x===A.roleId,style:{background:"#1565C0",border:"none",color:"white",borderRadius:6,padding:"5px 12px",fontSize:12,cursor:x===A.roleId?"wait":"pointer",opacity:x===A.roleId?.6:1},children:x===A.roleId?"Applying...":"Apply Update"})]}),A.fields.map(M=>o.jsxs("div",{style:{marginBottom:6,fontSize:12},children:[o.jsx("div",{style:{color:"rgba(255,255,255,0.5)",marginBottom:2,textTransform:"uppercase",fontSize:10,letterSpacing:.5},children:M.field}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},children:[o.jsxs("div",{style:{padding:"4px 8px",background:"rgba(255,100,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[o.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"LOCAL"}),o.jsx("br",{}),M.local]}),o.jsxs("div",{style:{padding:"4px 8px",background:"rgba(100,255,100,0.08)",borderRadius:4,color:"rgba(255,255,255,0.6)"},children:[o.jsx("span",{style:{fontSize:9,color:"rgba(255,255,255,0.3)"},children:"UPSTREAM"}),o.jsx("br",{}),M.upstream]})]})]},M.field))]},A.roleId)),r.length>0&&o.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Roles hired from the Store are tracked automatically. Set ",o.jsx("code",{style:{background:"rgba(255,255,255,0.06)",padding:"1px 4px",borderRadius:3},children:"sync: off"})," in role.yaml to stop tracking."]})]})}function lN({onClose:t}){const[l,r]=k.useState(null),[i,c]=k.useState(!0),[u,f]=k.useState(null),[m,x]=k.useState(null),d=k.useCallback(async()=>{c(!0),f(null);try{const A=await Ce.getGitStatus();r(A)}catch(A){f(A instanceof Error?A.message:"Failed to load git status")}finally{c(!1)}},[]);k.useEffect(()=>{d()},[d]);const g=async A=>{x(A.path);try{await Ce.deleteWorktree(A.path),await d()}catch(M){f(M instanceof Error?M.message:"Failed to remove worktree")}finally{x(null)}},y=async A=>{x(A);try{await Ce.deleteBranch(A),await d()}catch(M){f(M instanceof Error?M.message:"Failed to delete branch")}finally{x(null)}};if(i&&!l)return o.jsx("div",{style:{padding:24,color:"rgba(255,255,255,0.6)"},children:"Loading git status..."});if(u&&!l)return o.jsxs("div",{style:{padding:24,color:"#ff6b6b"},children:[u,o.jsx("button",{onClick:t,style:{marginLeft:12,color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer"},children:"Close"})]});if(!l)return null;const b=l.worktrees.filter(A=>A.status==="active"),v=l.worktrees.filter(A=>A.status==="pending-merge"),j=l.worktrees.filter(A=>A.status==="stale");function S(A){const M=A.split("/");if(M.length>1){const R=M[M.length-1],L=["cto","cbo","pm","engineer","designer","qa","data-analyst"];for(const O of L)if(R.toLowerCase().includes(O))return O}return null}function E(A,M=40){return A.length<=M?A:"..."+A.slice(A.length-M+3)}function C(A){const M=Date.now()-new Date(A).getTime(),R=Math.floor(M/6e4);if(R<1)return"just now";if(R<60)return`${R}m ago`;const L=Math.floor(R/60);return L<24?`${L}h ago`:`${Math.floor(L/24)}d ago`}return o.jsxs("div",{style:{padding:20,color:"rgba(255,255,255,0.9)",maxHeight:"100%",overflowY:"auto"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[o.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:600},children:"GIT STATUS"}),o.jsxs("div",{style:{display:"flex",gap:8},children:[o.jsx("button",{onClick:d,disabled:i,style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",color:"rgba(255,255,255,0.7)",borderRadius:6,padding:"4px 10px",fontSize:12,cursor:i?"wait":"pointer"},children:i?"Checking...":"Refresh"}),o.jsx("button",{onClick:t,style:{background:"none",border:"none",color:"rgba(255,255,255,0.5)",cursor:"pointer",fontSize:18},children:"×"})]})]}),u&&o.jsx("div",{style:{padding:"8px 12px",background:"rgba(255,100,100,0.1)",borderRadius:6,color:"#ff6b6b",fontSize:12,marginBottom:12},children:u}),o.jsxs("div",{style:{padding:"10px 14px",background:"rgba(255,255,255,0.04)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",marginBottom:16,fontSize:13},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o.jsxs("div",{children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:"Branch: "}),o.jsx("span",{style:{fontWeight:500},children:l.currentBranch})]}),o.jsx("div",{children:l.unsavedCount>0&&o.jsxs("span",{style:{color:"#FFB74D",fontSize:12},children:[l.unsavedCount," unsaved"]})})]}),l.lastCommit&&o.jsxs("div",{style:{marginTop:6,fontSize:11,color:"rgba(255,255,255,0.4)"},children:["Last commit: ",l.lastCommit.message.slice(0,60),l.lastCommit.message.length>60?"...":""," · ",C(l.lastCommit.date)]})]}),b.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gc,{label:"Active Worktrees",count:b.length}),b.map(A=>o.jsx(_d,{wt:A,roleFromBranch:A.roleId||S(A.branch),truncatePath:E,timeAgo:C,removing:m===A.path,onRemove:()=>g(A),statusColor:"#4FC3F7",statusIcon:"📂"},A.path))]}),v.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gc,{label:"Pending Merge",count:v.length}),v.map(A=>o.jsx(_d,{wt:A,roleFromBranch:A.roleId||S(A.branch),truncatePath:E,timeAgo:C,removing:m===A.path,onRemove:()=>g(A),statusColor:"#FFB74D",statusIcon:"⚠️"},A.path))]}),j.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gc,{label:"Stale",count:j.length}),j.map(A=>o.jsx(_d,{wt:A,roleFromBranch:A.roleId||S(A.branch),truncatePath:E,timeAgo:C,removing:m===A.path,onRemove:()=>g(A),statusColor:"#ff6b6b",statusIcon:"🔴"},A.path))]}),l.staleBranches.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gc,{label:"Unmerged Branches",count:l.staleBranches.length}),l.staleBranches.map(A=>o.jsxs("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o.jsxs("div",{style:{fontSize:13},children:[o.jsx("span",{style:{color:"rgba(255,255,255,0.5)",marginRight:6},children:"⚠️"}),o.jsx("span",{style:{fontWeight:500},children:A})]}),o.jsx("button",{onClick:()=>y(A),disabled:m===A,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:"#ff6b6b",borderRadius:4,padding:"3px 8px",fontSize:10,cursor:m===A?"wait":"pointer",opacity:m===A?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5},children:m===A?"...":"DELETE"})]},A))]}),b.length===0&&v.length===0&&j.length===0&&l.staleBranches.length===0&&o.jsxs("div",{style:{color:"rgba(255,255,255,0.4)",fontSize:13,padding:"20px 0",textAlign:"center"},children:["✓"," All clean. No active worktrees or stale branches."]}),l.lastMerge&&o.jsxs("div",{style:{marginTop:16,fontSize:11,color:"rgba(255,255,255,0.3)",lineHeight:1.5},children:["Last merge: ",o.jsx("span",{style:{color:"rgba(255,255,255,0.5)"},children:l.lastMerge.branch})," · ",l.lastMerge.roleId," · ",C(l.lastMerge.mergedAt)]})]})}function gc({label:t,count:l}){return o.jsxs("h4",{style:{margin:"16px 0 8px",fontSize:11,fontWeight:600,color:"rgba(255,255,255,0.5)",textTransform:"uppercase",letterSpacing:1},children:[t," (",l,")"]})}function _d({wt:t,roleFromBranch:l,truncatePath:r,timeAgo:i,removing:c,onRemove:u,statusColor:f,statusIcon:m}){return o.jsx("div",{style:{marginBottom:8,padding:"10px 14px",background:"rgba(255,255,255,0.03)",borderRadius:8,border:"1px solid rgba(255,255,255,0.06)"},children:o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsxs("div",{style:{fontSize:13,fontWeight:500,marginBottom:2},children:[o.jsx("span",{style:{marginRight:6},children:m}),t.branch,l&&o.jsx("span",{style:{marginLeft:8,fontSize:10,padding:"1px 6px",background:"rgba(255,255,255,0.08)",borderRadius:3,color:"rgba(255,255,255,0.6)",textTransform:"uppercase"},children:l})]}),t.task&&o.jsxs("div",{style:{fontSize:11,color:"rgba(255,255,255,0.5)",marginBottom:2},children:['"',t.task.slice(0,50),t.task.length>50?"...":"",'"']}),o.jsxs("div",{style:{fontSize:10,color:"rgba(255,255,255,0.35)"},children:[r(t.path)," · ",t.filesChanged," file",t.filesChanged!==1?"s":""," changed"," · ",i(t.createdAt)]}),t.conflictFiles&&t.conflictFiles.length>0&&o.jsxs("div",{style:{fontSize:10,color:"#ff6b6b",marginTop:4},children:["⛔"," CONFLICT: ",t.conflictFiles.join(", ")]})]}),o.jsx("button",{onClick:u,disabled:c,style:{background:"rgba(255,100,100,0.15)",border:"1px solid rgba(255,100,100,0.2)",color:f,borderRadius:4,padding:"3px 8px",fontSize:10,cursor:c?"wait":"pointer",opacity:c?.6:1,fontWeight:600,textTransform:"uppercase",letterSpacing:.5,flexShrink:0,marginLeft:8},children:c?"...":"REMOVE"})]})})}function rN({onClose:t,speechSettings:l,onSpeechSettingsChange:r,language:i,onLanguageChange:c,onOpenSync:u,onOpenGitStatus:f,onOpenStats:m}){var x;return o.jsx("div",{className:"customize-overlay",onClick:t,children:o.jsxs("div",{className:"customize-modal",onClick:d=>d.stopPropagation(),style:{maxWidth:480},children:[o.jsxs("div",{className:"customize-header",children:[o.jsx("div",{style:{fontSize:12,fontWeight:700,letterSpacing:1,color:"var(--terminal-text)"},children:"SETTINGS"}),o.jsx("button",{className:"customize-close",onClick:t,children:"X"})]}),o.jsx("div",{className:"customize-body",style:{padding:"12px 20px 20px"},children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"AMBIENT SPEECH MODE"}),o.jsx("div",{style:{display:"flex",gap:6},children:["template","llm","auto"].map(d=>o.jsxs("button",{onClick:()=>r==null?void 0:r({mode:d}),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(l==null?void 0:l.mode)===d?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(l==null?void 0:l.mode)===d?"rgba(255,255,255,0.08)":"transparent",color:(l==null?void 0:l.mode)===d?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center"},children:[o.jsx("div",{style:{fontWeight:600,marginBottom:2},children:d==="template"?"TEMPLATE":d==="llm"?"AI":"AUTO"}),o.jsx("div",{style:{fontSize:9,opacity:.7},children:d==="template"?"Static pool ($0)":d==="llm"?"LLM generated":"Detect engine"})]},d))}),o.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Auto: CLI Max = AI, BYOK = Template"})]}),o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["SPEECH INTERVAL: ",(l==null?void 0:l.intervalSec)??18,"s"]}),o.jsx("input",{type:"range",min:5,max:120,step:5,value:(l==null?void 0:l.intervalSec)??18,onChange:d=>r==null?void 0:r({intervalSec:Number(d.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[o.jsx("span",{children:"5s (frequent)"}),o.jsx("span",{children:"120s (rare)"})]})]}),(l==null?void 0:l.mode)!=="template"&&o.jsxs("div",{children:[o.jsxs("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:["DAILY LLM BUDGET: $",((x=l==null?void 0:l.dailyBudgetUsd)==null?void 0:x.toFixed(2))??"1.00"]}),o.jsx("input",{type:"range",min:0,max:5,step:.25,value:(l==null?void 0:l.dailyBudgetUsd)??1,onChange:d=>r==null?void 0:r({dailyBudgetUsd:Number(d.target.value)}),style:{width:"100%",accentColor:"var(--accent)"}}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:"var(--terminal-text-muted)"},children:[o.jsx("span",{children:"$0 (unlimited)"}),o.jsx("span",{children:"$5.00/day"})]})]}),o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,marginBottom:8,color:"var(--terminal-text)"},children:"LANGUAGE"}),o.jsx("div",{style:{display:"flex",gap:6},children:[{key:"auto",label:"Auto"},{key:"en",label:"English"},{key:"ko",label:"한국어"},{key:"ja",label:"日本語"}].map(({key:d,label:g})=>o.jsx("button",{onClick:()=>c==null?void 0:c(d),style:{flex:1,padding:"8px 12px",fontSize:11,border:`2px solid ${(i??"auto")===d?"var(--accent)":"rgba(255,255,255,0.1)"}`,background:(i??"auto")===d?"rgba(255,255,255,0.08)":"transparent",color:(i??"auto")===d?"var(--terminal-text)":"var(--terminal-text-muted)",borderRadius:6,cursor:"pointer",textAlign:"center",fontWeight:600},children:g},d))}),o.jsx("div",{style:{fontSize:9,color:"var(--terminal-text-muted)",marginTop:4},children:"Sets language for AI responses and speech bubbles"})]}),o.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.08)",paddingTop:16,display:"flex",gap:8},children:[u&&o.jsx("button",{onClick:()=>{t(),u()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"🔄 ROLE SYNC"}),f&&o.jsx("button",{onClick:()=>{t(),f()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📂 GIT STATUS"}),m&&o.jsx("button",{onClick:()=>{t(),m()},className:"theme-btn",style:{flex:1,padding:"8px 12px",fontSize:10},children:"📊 COMPANY STATS"})]})]})})]})})}function aN({theme:t,onThemeChange:l,onClose:r}){const i=k.useRef(null);return k.useEffect(()=>{const c=u=>{i.current&&!i.current.contains(u.target)&&r()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]),o.jsx("div",{ref:i,className:"theme-dropup",children:Object.entries(Yr).map(([c,u])=>o.jsxs("button",{className:`theme-dropup__item${t===c?" theme-dropup__item--active":""}`,onClick:()=>{l(c),r()},title:u.name,children:[o.jsxs("span",{className:"theme-dropup__swatch",style:{background:u.vars["--hud-bg"],borderColor:u.vars["--pixel-border"]},children:[o.jsx("span",{style:{background:u.vars["--accent"],width:5,height:5,borderRadius:1}}),o.jsx("span",{style:{background:u.vars["--active-green"],width:5,height:5,borderRadius:1}}),o.jsx("span",{style:{background:u.vars["--idle-amber"],width:5,height:5,borderRadius:1}})]}),o.jsx("span",{className:"theme-dropup__name",children:u.icon})]},c))})}const _c=[0,1e4,5e4,15e4,4e5,1e6,25e5,5e6,1e7,25e6];function Fg(t){let l=1;for(let r=_c.length-1;r>=0;r--)if(t>=_c[r]){l=r+1;break}return Math.min(l,10)}function iN(t){const l=Fg(t);if(l>=10)return 1;const r=_c[l-1],i=_c[l];return Math.min(1,(t-r)/(i-r))}function U0(t){const l={};for(const[r,i]of Object.entries(t)){const c=i.inputTokens+i.outputTokens;l[r]={level:Fg(c),totalTokens:c,progress:iN(c)}}return l}const sN=[{id:"first-employee",name:"First Employee",icon:"🏆",description:"Hired your first role",check:t=>t.roleCount>=1},{id:"full-team",name:"Full Team",icon:"👥",description:"Hired 5+ roles",check:t=>t.roleCount>=5},{id:"token-10k",name:"Getting Started",icon:"📊",description:"Used 10K tokens total",check:t=>t.totalTokens>=1e4},{id:"token-100k",name:"Power User",icon:"💪",description:"Used 100K tokens total",check:t=>t.totalTokens>=1e5},{id:"token-millionaire",name:"Token Millionaire",icon:"🎖",description:"Used 1M tokens total",check:t=>t.totalTokens>=1e6},{id:"token-mogul",name:"Token Mogul",icon:"💎",description:"Used 10M tokens total",check:t=>t.totalTokens>=1e7},{id:"first-promotion",name:"First Promotion",icon:"⭐",description:"Any role reached Lv.3",check:t=>t.roles.some(l=>l.level>=3)},{id:"senior-staff",name:"Senior Staff",icon:"🌟",description:"Any role reached Lv.5",check:t=>t.roles.some(l=>l.level>=5)},{id:"master-class",name:"Master Class",icon:"👑",description:"Any role reached Lv.10",check:t=>t.roles.some(l=>l.level>=10)},{id:"full-house",name:"Full House",icon:"🏠",description:"All roles Lv.5+",check:t=>t.roleCount>=3&&t.roles.every(l=>l.level>=5)}];function I0(t){return sN.filter(l=>l.check(t))}const oN={cto:"🏗️",cbo:"📊",pm:"📋",engineer:"⚙️",designer:"🎨",qa:"🔍","data-analyst":"📊"},jc={cto:"#1565C0",cbo:"#E65100",pm:"#2E7D32",engineer:"#4A148C",designer:"#AD1457",qa:"#00695C","data-analyst":"#0277BD"},cN={cto:"아키텍처",cbo:"시장 분석",pm:"PRD 작성",engineer:"코딩",designer:"시안 제작",qa:"품질 검증"};function uN(t){let l=0;for(let i=0;i<t.length;i++)l=t.charCodeAt(i)+((l<<5)-l);return`hsl(${(l%360+360)%360}, 50%, 40%)`}function fN({importJob:t,onImportDone:l}){var ji,Aa,Ci;const[r,i]=k.useState([]),[c,u]=k.useState([]),[f,m]=k.useState([]),[x,d]=k.useState([]),[g,y]=k.useState([]),[b,v]=k.useState([]),[j,S]=k.useState("TYCONO"),[E,C]=k.useState(!0),[A,M]=k.useState(null),[R,L]=k.useState({type:"none"}),[O,U]=k.useState(null),[X,ne]=k.useState(null),[D,Y]=k.useState([]),[F,Q]=k.useState(!1),[ee,V]=k.useState([]),[I,Z]=k.useState(0),[ce,we]=k.useState(!1),[z,B]=k.useState({}),[W,T]=k.useState("ceo"),[me,Se]=k.useState(null),[Ee,Oe]=k.useState(!1),[He,Ge]=k.useState({}),ke=k.useRef({}),[xt,he]=k.useState(!1),[G,ie]=k.useState(null),[xe,Te]=k.useState({}),[Ne,Re]=k.useState([]),[Ae,Be]=k.useState([]),[Ke,St]=k.useState(void 0),[Xt,pt]=k.useState(!1);k.useEffect(()=>{Ce.getStatus().then(_=>{St(_.engine),pt(!!_.hasApiKey)}).catch(()=>{})},[]);const{getAppearance:bt,setAppearance:re,resetAppearance:ye,theme:ze,setTheme:Ie,speechSettings:be,setSpeechSettings:je,language:jt,setLanguage:vt}=YC(),[Je,Mt]=k.useState(null),[nt,Ht]=k.useState("character"),de=XC(),[cn,xl]=k.useState(!1),[ir,zl]=k.useState(!1),[Ml,sr]=k.useState(!1),[Rl,ja]=k.useState(!1),[Us,Gr]=k.useState(!1),[or,xi]=k.useState(!1),[Bn,Is]=k.useState(null);k.useEffect(()=>{const _=ae=>{(ae.metaKey||ae.ctrlKey)&&ae.key==="s"&&(ae.preventDefault(),de.dirtyCount>0&&xl(!0))};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[de.dirtyCount]),k.useEffect(()=>{if(!Rl)return;let _=!1;const ae=async()=>{try{const pe=await Ce.getGitStatus();_||Is(pe)}catch{}};ae();const ue=setInterval(ae,1e4);return()=>{_=!0,clearInterval(ue)}},[Rl]);const[Fl,Kr]=k.useState(null),[pl,_l]=k.useState(null),[Ol,sl]=k.useState([]),[Lt,un]=k.useState(!1),Bl=k.useRef(!1),Qr=k.useRef(null);let Ys=k.useRef(0);const qs=k.useRef(new Set),yl=(_,ae,ue)=>{const pe={id:Ys.current++,type:_,text:ae,detail:ue};sl(ge=>[...ge,pe])};k.useEffect(()=>{var _;Lt&&((_=Qr.current)==null||_.scrollIntoView({behavior:"smooth"}))},[Ol,Lt]),k.useEffect(()=>{t&&(Bl.current||(Bl.current=!0,_l("Scanning knowledge sources..."),sl([{id:0,type:"scan",text:"Starting knowledge import..."}]),Ys.current=1,fetch("/api/setup/import-knowledge",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:t.paths,companyRoot:t.companyRoot})}).then(async _=>{var ge;const ae=(ge=_.body)==null?void 0:ge.getReader();if(!ae)return;const ue=new TextDecoder;let pe="";for(;;){const{done:Me,value:Le}=await ae.read();if(Me)break;pe+=ue.decode(Le,{stream:!0});const Pe=pe.split(`
|
|
90
|
+
`);pe=Pe.pop()||"";let lt="";for(const Xe of Pe)if(Xe.startsWith("event: "))lt=Xe.slice(7).trim();else if(Xe.startsWith("data: ")&<){try{const Yt=JSON.parse(Xe.slice(6));switch(lt){case"scanning":_l(`Scanning: ${Yt.path} (${Yt.fileCount} files)`),yl("scan",`Found ${Yt.fileCount} files`,Yt.path);break;case"processing":Kr({index:Yt.index,total:Yt.total}),_l(`Importing knowledge... (${Yt.index}/${Yt.total})`),yl("process",`Processing: ${Yt.file}`,`${Yt.index} / ${Yt.total}`);break;case"created":yl("created",Yt.title,Yt.summary);break;case"skipped":yl("process",`Skipped: ${Yt.file}`,Yt.reason);break;case"done":_l(null),Kr(null),yl("done",`Import complete! ${Yt.created} created, ${Yt.skipped} skipped.`),Ut(`Knowledge import complete! ${Yt.created} documents imported.`,"#2E7D32"),l==null||l();break;case"error":_l(null),Kr(null),yl("error",Yt.message),Ut(`Import failed: ${Yt.message}`,"#B71C1C"),l==null||l();break}}catch{}lt=""}}}).catch(_=>{_l(null),yl("error",_.message),Ut(`Import error: ${_.message}`,"#B71C1C"),l==null||l()})))},[t]);const[Ll,Ca]=k.useState("iso"),[$l,cr]=k.useState(typeof window<"u"?window.innerWidth:1200);k.useEffect(()=>{const _=()=>cr(window.innerWidth);return window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)},[]);const Hl=$l<1024,[fn,Rt]=k.useState(!1),[ur,Xs]=k.useState(560),[En,Vt]=k.useState([]),[Ea,Ln]=k.useState(null),[fr,pi]=k.useState(null),{sendMessage:Na}=HC();k.useEffect(()=>{Promise.all([Ce.getCompany().then(_=>{S(_.name),i(_.roles)}),Ce.getOrgTree().then(_=>{B(_.nodes),T(_.root)}).catch(()=>{}),Ce.getCostSummary().then(_=>Vs(U0(_.byRole))).catch(()=>{})]).catch(_=>M(`Failed to load: ${_.message}`)).finally(()=>C(!1)),Ce.getProjects().then(u).catch(()=>{}),Ce.getStandups().then(m).catch(()=>{}),Ce.getWaves().then(d).catch(()=>{}),Ce.getDecisions().then(y).catch(()=>{}),Ce.getKnowledge().then(v).catch(()=>{})},[]),k.useEffect(()=>{Ce.getSessions().then(_=>{if(_.length>0){const ae=_.map(pe=>({...pe,messages:[]}));Vt(ae);const ue=ae.find(pe=>pe.status==="active")??ae[0];Ln(ue.id),Rt(!0)}}).catch(_=>{console.error("Failed to load sessions",_)})},[]),k.useEffect(()=>{const _=()=>{fetch("/api/exec/status").then(ue=>ue.json()).then(ue=>{Te(ue.statuses??{}),Re(ue.activeExecutions??[])}).catch(()=>{})};_();const ae=setInterval(_,3e3);return()=>clearInterval(ae)},[]);const gl=k.useMemo(()=>{const _={...xe};if(fr){const ae=En.find(ue=>ue.id===fr);ae&&(_[ae.roleId]="working")}return _},[xe,fr,En]);k.useEffect(()=>{R.type==="role"?Ce.getRole(R.roleId).then(U).catch(console.error):U(null)},[R]);const vn=()=>L({type:"none"}),Nn=async(_,ae)=>{const ue=r.find(ge=>ge.id===_),pe=(X==null?void 0:X.mode)==="ask";ne(null);try{const{jobId:ge}=await Ce.startJob({type:"assign",roleId:_,task:ae,readOnly:pe}),Me=jc[_]??"#666",Le=`${_.toUpperCase()} · ${(ue==null?void 0:ue.name)??_}`;we(!1),Y([{jobId:ge,title:Le,color:Me}]),It.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO → ${(ue==null?void 0:ue.name)??_}] ${pe?"Ask":"Assign"}: ${ae}`,type:"dispatch",targetRoleId:_})}catch(ge){Ut(`Failed to start job: ${ge instanceof Error?ge.message:"unknown"}`,"#C62828")}},Ut=(_,ae)=>{const ue=Date.now();Be(pe=>[...pe,{id:ue,message:_,color:ae}]),setTimeout(()=>Be(pe=>pe.filter(ge=>ge.id!==ue)),4e3)},Vs=_=>{var ue,pe;const ae=ke.current;for(const[ge,Me]of Object.entries(_)){const Le=((ue=ae[ge])==null?void 0:ue.level)??0;if(Le>0&&Me.level>Le){const Pe=((pe=r.find(lt=>lt.id===ge))==null?void 0:pe.name)??ge.toUpperCase();Ut(`${Pe} leveled up to Lv.${Me.level}!`,"#7C3AED")}}ke.current=_,Ge(_)};k.useEffect(()=>{const _={roles:Object.entries(He).map(([pe,ge])=>({id:pe,level:ge.level,totalTokens:ge.totalTokens})),totalTokens:Object.values(He).reduce((pe,ge)=>pe+ge.totalTokens,0),roleCount:r.length},ae=I0(_),ue=qs.current;for(const pe of ae)ue.has(pe.id)||ue.size>0&&Ut(`${pe.icon} Badge earned: ${pe.name}!`,"#D4A017");qs.current=new Set(ae.map(pe=>pe.id))},[He,r.length]);const yi=()=>{var ae;const _=D[D.length-1];_&&(Ut(`${_.title} completed`,_.color),It.pushMessage({ts:Date.now(),roleId:((ae=_.title.split(" · ")[0])==null?void 0:ae.toLowerCase())??"unknown",text:`[${_.title}] Job completed`,type:"dispatch"})),Ce.getStandups().then(m).catch(console.error),Ce.getCompany().then(ue=>i(ue.roles)).catch(console.error),Ce.getCostSummary().then(ue=>Vs(U0(ue.byRole))).catch(()=>{})},Gs=async _=>{Q(!1);try{const ae=await Ce.startJob({type:"wave",directive:_}),ue=ae.jobIds??(ae.jobId?[ae.jobId]:[]),pe=r.filter(Me=>Me.level==="c-level"),ge=ue.map((Me,Le)=>{var Pe,lt;return{jobId:Me,roleId:((Pe=pe[Le])==null?void 0:Pe.id)??`role-${Le}`,roleName:((lt=pe[Le])==null?void 0:lt.name)??`C-Level ${Le+1}`}});It.pushMessage({ts:Date.now(),roleId:"ceo",text:`[CEO WAVE] "${_}" → ${ge.map(Me=>Me.roleName).join(", ")}`,type:"dispatch"}),Object.keys(z).length>0?(Se({directive:_,rootJobs:ge}),Oe(!1)):(V(ge),Z(0),we(!1),ge.length>0&&Y([{jobId:ge[0].jobId,title:`CEO WAVE · ${ge[0].roleId.toUpperCase()}`,color:"#B71C1C"}]))}catch(ae){Ut(`Failed to start wave: ${ae instanceof Error?ae.message:"unknown"}`,"#C62828")}},Wr=()=>{Ce.getWaves().then(d).catch(console.error),Ce.getStandups().then(m).catch(console.error)},gi=()=>{Ce.getCompany().then(_=>i(_.roles)).catch(console.error)},An=async(_,ae)=>{await Ce.createRole(_),re(_.id,ae),gi(),Ut(`${_.name} hired!`,"#2E7D32")},bi=async _=>{await Ce.deleteRole(_),gi(),ie(null),Ut(`${_.toUpperCase()} removed`,"#B71C1C")},vi=async(_,ae)=>{await Ce.updateRole(_,ae),gi(),R.type==="role"&&R.roleId===_&&Ce.getRole(_).then(U).catch(console.error),ae.name&&Ut(`${_.toUpperCase()} renamed to "${ae.name}"`,"#1565C0")},wi=_=>{Rt(!0)},dr=async _=>{try{const ae=await Ce.createSession(_,"talk");Vt(ue=>[ae,...ue]),Ln(ae.id),Rt(!0)}catch(ae){console.error("Failed to create session",ae),Ut(`Failed to create session: ${ae instanceof Error?ae.message:"API unreachable"}`,"#B71C1C")}},Ks=async _=>{try{const ae=await Ce.createSession(_,"talk");Vt(ue=>[ae,...ue]),Ln(ae.id)}catch(ae){console.error("Failed to create session",ae),Ut(`Failed to create session: ${ae instanceof Error?ae.message:"API unreachable"}`,"#B71C1C")}},Qs=async _=>{const ae=Ne.find(ge=>ge.roleId===_),ue=(ae==null?void 0:ae.jobId)??(ae==null?void 0:ae.id);if(ue&&gl[_]==="working"){const ge=r.find(Pe=>Pe.id===_),Me=jc[_]??"#666",Le=`${_.toUpperCase()} · ${(ge==null?void 0:ge.name)??_}`;Y([{jobId:ue,title:Le,color:Me}]),we(!1);return}const pe=En.find(ge=>ge.roleId===_);if(pe)Ln(pe.id),It.setActiveChannelId(null);else try{const ge=await Ce.createSession(_,"talk");Vt(Me=>[ge,...Me]),Ln(ge.id),It.setActiveChannelId(null)}catch(ge){console.error("Failed to create session",ge)}Rt(!0)},hr=async _=>{try{await Ce.deleteSession(_),Vt(ae=>{var pe;const ue=ae.filter(ge=>ge.id!==_);return Ea===_&&Ln(((pe=ue[0])==null?void 0:pe.id)??null),ue})}catch(ae){console.error("Failed to delete session",ae),Ut(`Failed to close session: ${ae instanceof Error?ae.message:"API error"}`,"#B71C1C")}},qc=async()=>{try{const{ids:_}=await Ce.deleteEmptySessions();if(_.length===0)return;Vt(ae=>{var pe;const ue=ae.filter(ge=>!_.includes(ge.id));return Ea&&_.includes(Ea)&&Ln(((pe=ue[0])==null?void 0:pe.id)??null),ue}),Ut(`Cleared ${_.length} empty session${_.length!==1?"s":""}`,"#2E7D32")}catch(_){Ut(`Failed to clear empty sessions: ${_ instanceof Error?_.message:"API error"}`,"#B71C1C")}},Ws=async()=>{if(!confirm("Close all sessions? This cannot be undone."))return;const _=En.map(ae=>ae.id);try{await Ce.deleteSessions(_),Vt([]),Ln(null),Ut("All sessions closed","#2E7D32")}catch(ae){Ut(`Failed to close sessions: ${ae instanceof Error?ae.message:"API error"}`,"#B71C1C")}},ol=(_,ae)=>{Vt(ue=>ue.map(pe=>{if(pe.id!==_)return pe;const ge=[...pe.messages],Me=ge[ge.length-1];if(Me&&Me.from==="role"&&Me.status==="streaming"){const Le=[...Me.streamEvents??[],ae];ge[ge.length-1]={...Me,streamEvents:Le}}return{...pe,messages:ge}}))},Zr=(_,ae,ue)=>{const pe={id:`msg-${Date.now()}-ceo`,from:"ceo",content:ae,type:ue==="do"?"directive":"conversation",status:"done",timestamp:new Date().toISOString()},ge={id:`msg-${Date.now()+1}-role`,from:"role",content:"",type:"conversation",status:"streaming",timestamp:new Date().toISOString(),streamEvents:[]};Vt(Me=>Me.map(Le=>Le.id===_?{...Le,messages:[...Le.messages,pe,ge],updatedAt:new Date().toISOString()}:Le)),pi(_),Na(_,ae,ue,{onThinking:Me=>{Vt(Le=>Le.map(Pe=>{if(Pe.id!==_)return Pe;const lt=[...Pe.messages],Xe=lt[lt.length-1];return Xe&&Xe.from==="role"&&Xe.status==="streaming"&&(lt[lt.length-1]={...Xe,thinking:(Xe.thinking??"")+Me}),{...Pe,messages:lt}})),ol(_,{type:"thinking",timestamp:Date.now(),text:Me})},onText:Me=>{Vt(Le=>Le.map(Pe=>{if(Pe.id!==_)return Pe;const lt=[...Pe.messages],Xe=lt[lt.length-1];return Xe&&Xe.from==="role"&&Xe.status==="streaming"&&(lt[lt.length-1]={...Xe,content:Xe.content+Me}),{...Pe,messages:lt}}))},onToolUse:(Me,Le)=>{ol(_,{type:"tool",timestamp:Date.now(),toolName:Me,toolInput:Le})},onDispatch:(Me,Le)=>{ol(_,{type:"dispatch",timestamp:Date.now(),roleId:Me,task:Le})},onDispatchProgress:(Me,Le,Pe)=>{var lt;Le==="tool"?ol(_,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:"tool",toolName:Pe.name,toolInput:Pe.input}):Le==="thinking"?ol(_,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:"thinking",text:Pe.text}):Le==="text"?ol(_,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:"text",text:(lt=Pe.text)==null?void 0:lt.slice(-200)}):(Le==="done"||Le==="error")&&ol(_,{type:"dispatch:progress",timestamp:Date.now(),roleId:Me,progressType:Le})},onTurn:Me=>{ol(_,{type:"turn",timestamp:Date.now(),turn:Me})},onDone:()=>{Vt(Me=>Me.map(Le=>{if(Le.id!==_)return Le;const Pe=Le.messages.map(Xe=>Xe.status==="streaming"?{...Xe,status:"done"}:Xe),lt=Le.messages.length<=2?ae.slice(0,40).replace(/\n/g," "):Le.title;return{...Le,messages:Pe,title:lt}})),pi(null)},onError:Me=>{Vt(Le=>Le.map(Pe=>{if(Pe.id!==_)return Pe;const lt=Pe.messages.map(Xe=>Xe.status==="streaming"?{...Xe,status:"error",content:Xe.content||Me}:Xe);return{...Pe,messages:lt}})),pi(null)}})},Xc=(_,ae)=>{Vt(ue=>ue.map(pe=>pe.id===_?{...pe,mode:ae}:pe)),Ce.updateSession(_,{mode:ae}).catch(console.error)},Vc=new Date().toISOString().slice(0,10),$n=c[0],Wn={cto:"Chief Technology Officer",cbo:"Chief Business Officer",pm:"Product Manager",engineer:"Software Engineer",designer:"UI/UX Designer",qa:"QA Engineer"},ki=_=>{const ae=Wn[_];if(!ae)return"";for(const ue of f){const pe=ue.content,ge=pe.indexOf(`## ${ae}`);if(ge===-1)continue;const Me=pe.indexOf(`
|
|
91
91
|
## `,ge+10),Pe=(Me===-1?pe.slice(ge):pe.slice(ge,Me)).split(`
|
|
92
|
-
`).filter(
|
|
93
|
-
## `,ge+10),Pe=(Me===-1?pe.slice(ge):pe.slice(ge,Me)).replace(/^## .+\n/,"").trim();if(Pe)return Pe.slice(0,1500)}return""},It=aE();k.useEffect(()=>{r.length>0&&It.syncDefaultMembers(r)},[r]);const Wn=eE({roles:r,roleStatuses:xe,activeExecs:Ne,getStandupSpeech:ki});return uE({roles:r,roleStatuses:xe,activeExecs:Ne,channels:It.channels,relationships:Wn.relationships,pushMessage:It.pushMessage,speechSettings:be,engineType:Ke,hasApiKey:gt}),E?o.jsxs("div",{className:"h-screen flex flex-col bg-[var(--floor-light)]",style:{fontFamily:"var(--pixel-font)"},children:[(ml||_l.length>0)&&o.jsxs("div",{className:"shrink-0 z-[44]",children:[o.jsxs("div",{className:"flex items-center gap-3 px-5 py-2 text-xs cursor-pointer select-none",style:{background:"var(--accent)",color:"#fff",fontFamily:"var(--pixel-font)"},onClick:()=>cn(_=>!_),children:[ml?o.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):o.jsx("span",{className:"shrink-0",children:"✅"}),o.jsx("span",{className:"flex-1",children:ml||"Knowledge import finished"}),Fl&&o.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Fl.index/Fl.total*100}%`,background:"#fff"}})}),o.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:$t?"▲":"▼"})]}),$t&&o.jsxs("div",{className:"overflow-y-auto text-xs",style:{background:"var(--terminal-bg)",borderBottom:"2px solid var(--accent)",maxHeight:240,fontFamily:"var(--pixel-font)"},children:[_l.map(_=>o.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[_.type==="scan"&&"🔍",_.type==="process"&&"⚙️",_.type==="created"&&"✅",_.type==="done"&&"🎉",_.type==="error"&&"❌"]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{style:{color:_.type==="error"?"#EF4444":_.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:_.text}),_.detail&&o.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:_.detail})]})]},_.id)),o.jsx("div",{ref:Gr})]})]}),o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-4xl mb-3",children:"🏢"}),o.jsx("div",{className:"text-gray-600 font-semibold text-xs",children:"LOADING OFFICE..."})]})})]}):A?o.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:o.jsxs("div",{className:"text-center max-w-md",style:{fontFamily:"var(--pixel-font)"},children:[o.jsx("div",{className:"text-4xl mb-3",children:"⚠️"}),o.jsx("div",{className:"text-gray-800 font-semibold mb-2 text-xs",children:"CONNECTION ERROR"}),o.jsx("div",{className:"text-gray-500 text-xs mb-4",children:A}),o.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-gray-800 text-white text-xs font-bold cursor-pointer border-2 border-gray-600",style:{fontFamily:"var(--pixel-font)"},children:"RETRY"})]})}):o.jsxs("div",{className:"flex flex-col",style:{height:"100dvh",fontFamily:"var(--pixel-font)"},children:[o.jsxs("div",{className:"flex items-center justify-between px-5 py-2 bg-[var(--hud-bg)] text-white text-sm shrink-0 z-[45]",style:{borderBottom:"3px solid var(--pixel-border)"},children:[o.jsxs("div",{className:"font-black text-[13px] tracking-tight",style:{color:"var(--idle-amber)",textShadow:"2px 2px 0 rgba(0,0,0,0.5)"},children:["🏢"," ",o.jsx("span",{style:{color:"var(--terminal-text)"},children:j})]}),o.jsxs("div",{className:"flex gap-4 text-[var(--terminal-text-secondary)] text-[11px] items-center",children:[(()=>{const _=Object.values(He).reduce((Me,Le)=>Me+Le.totalTokens,0),ae=_>=1e6?`${(_/1e6).toFixed(1)}M`:_>=1e3?`${Math.round(_/1e3)}K`:String(_),ue=Math.min(100,Math.round(_/25e4*100)),pe=Ne.length,ge=r.length>0?Math.round(pe/r.length*100):0;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["💰",o.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:o.jsx("div",{className:"h-full",style:{width:`${ue}%`,background:"linear-gradient(90deg,#22c55e,#34D399)"}})}),o.jsx("strong",{className:"text-[var(--active-green)]",children:ae})]}),o.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["⚡",o.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:o.jsx("div",{className:"h-full",style:{width:`${ge}%`,background:"linear-gradient(90deg,#3b82f6,#60A5FA)"}})}),o.jsx("strong",{className:"text-[var(--terminal-text)]",children:ge})]})]})})(),o.jsxs("span",{className:"hidden sm:inline",children:["Roles: ",o.jsx("strong",{className:"text-[var(--terminal-text)]",children:r.length})]}),o.jsxs("span",{className:"hidden sm:inline",children:["Projects: ",o.jsx("strong",{className:"text-[var(--terminal-text)]",children:c.length})]}),Ne.length>0&&o.jsxs("span",{className:"text-amber-400",children:["Working: ",o.jsx("strong",{children:Ne.length})]}),(()=>{const _={roles:Object.entries(He).map(([ue,pe])=>({id:ue,level:pe.level,totalTokens:pe.totalTokens})),totalTokens:Object.values(He).reduce((ue,pe)=>ue+pe.totalTokens,0),roleCount:r.length},ae=I0(_);return ae.length>0?o.jsx("div",{className:"hidden sm:flex",style:{gap:2,alignItems:"center",marginLeft:8,paddingLeft:8,borderLeft:"1px solid rgba(255,255,255,0.1)"},children:ae.map(ue=>o.jsx("span",{title:`${ue.name}: ${ue.description}`,style:{fontSize:12,cursor:"default"},children:ue.icon},ue.id))}):null})(),o.jsx("span",{className:"px-1.5 py-0.5",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--pixel-border)"},children:Vc})]})]}),(ml||_l.length>0)&&o.jsxs("div",{className:"shrink-0 z-[44]",children:[o.jsxs("div",{className:"flex items-center gap-3 px-5 py-2 text-xs cursor-pointer select-none",style:{background:"var(--accent)",color:"#fff",fontFamily:"var(--pixel-font)"},onClick:()=>cn(_=>!_),children:[ml?o.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):o.jsx("span",{className:"shrink-0",children:"✅"}),o.jsx("span",{className:"flex-1",children:ml||"Knowledge import finished"}),Fl&&o.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Fl.index/Fl.total*100}%`,background:"#fff"}})}),o.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:$t?"▲":"▼"})]}),$t&&o.jsxs("div",{className:"overflow-y-auto text-xs",style:{background:"var(--terminal-bg)",borderBottom:"2px solid var(--accent)",maxHeight:240,fontFamily:"var(--pixel-font)"},children:[_l.map(_=>o.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[_.type==="scan"&&"🔍",_.type==="process"&&"⚙️",_.type==="created"&&"✅",_.type==="done"&&"🎉",_.type==="error"&&"❌"]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{style:{color:_.type==="error"?"#EF4444":_.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:_.text}),_.detail&&o.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:_.detail})]})]},_.id)),o.jsx("div",{ref:Gr}),_l.length===0&&o.jsx("div",{className:"px-5 py-4 text-center",style:{color:"var(--terminal-text-muted)"},children:"Waiting for events..."})]})]}),o.jsxs("div",{className:"flex-1 overflow-hidden flex relative",children:[o.jsx("div",{className:"flex-1 overflow-y-auto relative floor-grid",style:{background:"var(--floor-light)"},children:Bl==="iso"?o.jsx(WE,{roles:r,projects:c,waves:x,standups:f,decisions:g,roleStatuses:pl,activeExecs:Ne,onRoleClick:_=>L({type:"role",roleId:_}),onProjectClick:_=>L({type:"project",projectId:_}),onBulletinClick:()=>L({type:"bulletin"}),onDecisionsClick:()=>L({type:"decisions"}),onKnowledgeClick:()=>L({type:"knowledge"}),onSettingsClick:()=>Xr(!0),onThemeClick:()=>xi(_=>!_),onStatsClick:()=>Dl(!0),knowledgeDocsCount:b.length,getRoleSpeech:Wn.getSpeech,getAppearance:Zt,onHireClick:()=>he(!0)}):o.jsxs("div",{className:`${un?"max-w-full":"max-w-[1100px]"} mx-auto h-full p-4 flex flex-col gap-3 relative z-[1]`,children:[(()=>{const _=r.filter(ue=>ue.level==="c-level"),ae=r.filter(ue=>ue.level!=="c-level");return o.jsxs(o.Fragment,{children:[_.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"pixel-section-label",children:"LEADERSHIP"}),o.jsx("div",{className:`grid gap-2 ${_.length===1?"grid-cols-1":"grid-cols-2"}`,children:_.map(ue=>{var pe,ge;return o.jsx(Y0,{role:ue,speech:Wn.getSpeech(ue.id),onClick:()=>L({type:"role",roleId:ue.id}),liveStatus:pl[ue.id],activeTask:(pe=Ne.find(Me=>Me.roleId===ue.id))==null?void 0:pe.task,featured:!0,appearance:Zt(ue.id),xpLevel:(ge=He[ue.id])==null?void 0:ge.level},ue.id)})})]}),o.jsx("div",{className:"pixel-section-label",children:"TEAM"}),o.jsxs("div",{className:`grid gap-2 ${un?"grid-cols-3":"grid-cols-4"}`,children:[ae.map(ue=>{var pe,ge;return o.jsx(Y0,{role:ue,speech:Wn.getSpeech(ue.id),onClick:()=>L({type:"role",roleId:ue.id}),liveStatus:pl[ue.id],activeTask:(pe=Ne.find(Me=>Me.roleId===ue.id))==null?void 0:pe.task,appearance:Zt(ue.id),xpLevel:(ge=He[ue.id])==null?void 0:ge.level},ue.id)}),o.jsx("div",{className:"pixel-card pixel-card--hire",onClick:()=>he(!0),children:o.jsxs("div",{className:"pixel-card--hire-inner",children:[o.jsx("span",{className:"pixel-card--hire-icon",children:"+"}),o.jsx("span",{className:"pixel-card--hire-label",children:"HIRE NEW ROLE"})]})})]})]})})(),o.jsx("div",{className:"pixel-section-label mt-1",children:"OFFICE"}),o.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[o.jsxs("div",{className:"facility-card-compact",onClick:Ln?()=>L({type:"project",projectId:Ln.id}):void 0,style:Ln?void 0:{borderStyle:"dashed",opacity:.5},children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#3B82F6"},children:["🏢"," MEETING ROOM"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(hc,{type:"meeting"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"Projects, PRDs, and task boards"}),Ln?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"fcc-title",children:['"',Ln.name,'"']}),o.jsxs("div",{className:"fcc-meta",children:["Status: ",o.jsx("strong",{style:{color:"var(--active-green)"},children:Ln.status})]})]}):o.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No active projects"})]})]}),o.jsxs("div",{className:"facility-card-compact",onClick:()=>L({type:"bulletin"}),children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#64748b"},children:["📋"," BULLETIN"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(hc,{type:"bulletin"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"Waves and daily standups"}),x.slice(0,1).map(_=>o.jsxs("div",{className:"fcc-item",children:["Wave ",_.id]},_.id)),f.slice(0,1).map(_=>o.jsxs("div",{className:"fcc-item",children:["Standup ",_.date]},_.date)),x.length===0&&f.length===0&&o.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No entries yet"})]})]}),o.jsxs("div",{className:"facility-card-compact",onClick:()=>L({type:"decisions"}),children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#EF4444"},children:["📜"," DECISIONS"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(hc,{type:"decision"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"CEO strategic decision log"}),o.jsxs("div",{className:"fcc-title",children:[g.length," decisions"]}),g.slice(0,2).map(_=>o.jsxs("div",{className:"fcc-item",children:["#",_.id," ",_.title]},_.id))]})]}),o.jsxs("div",{className:"facility-card-compact",onClick:()=>L({type:"knowledge"}),children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#0D9488"},children:["📚"," KNOWLEDGE"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(hc,{type:"knowledge"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"Research, analysis, and references"}),o.jsxs("div",{className:"fcc-title",children:[b.length," docs"]}),b.slice(0,2).map(_=>o.jsx("div",{className:"fcc-item",children:_.title},_.id))]})]})]})]})}),un&&o.jsx("div",{className:$l?"absolute inset-0 z-50":"contents",children:o.jsx($C,{sessions:Cn,activeSessionId:Ca,roles:r,streamingSessionId:cr,width:$l?Ll:or,onWidthChange:$l?void 0:Xs,onSwitchSession:Bn,onCloseSession:fr,onCreateSession:ur,onClearEmpty:qc,onCloseAll:Ws,onSendMessage:Qr,onModeChange:Xc,onCloseTerminal:()=>Ft(!1),chatChannels:It.channels,activeChatChannelId:It.activeChannelId,onSwitchChatChannel:It.setActiveChannelId,onCreateChatChannel:It.createChannel,onDeleteChatChannel:It.deleteChannel,onUpdateChatMembers:It.updateMembers,onUpdateChatTopic:It.updateTopic,unreadChannels:It.unreadChannels})})]}),o.jsxs("div",{className:"flex items-center justify-between px-5 py-2 bg-[var(--hud-bg)] text-[var(--terminal-text-secondary)] text-[10px] shrink-0 z-[45]",style:{borderTop:"3px solid var(--pixel-border)"},children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>ja("card"),className:`view-toggle-btn ${Bl==="card"?"active":""}`,children:"CARD"}),o.jsx("button",{onClick:()=>ja("iso"),className:`view-toggle-btn ${Bl==="iso"?"active":""}`,children:"OFFICE"}),o.jsx("span",{className:"mx-1",children:"|"}),o.jsxs("div",{style:{position:"relative"},children:[o.jsxs("button",{className:`theme-btn${ir?" active":""}`,onClick:()=>xi(_=>!_),title:"Office Theme",children:[((ji=Ur[ze])==null?void 0:ji.icon)??"","▾"]}),ir&&o.jsx(aN,{theme:ze,onThemeChange:Ue,onClose:()=>xi(!1)})]}),o.jsx("button",{className:"theme-btn",onClick:()=>Xr(!0),title:"Settings",children:"⚙"}),o.jsx("span",{className:"mx-1",children:"|"}),o.jsxs("button",{onClick:()=>{it.state==="no-git"?it.initGit():it.state==="dirty"?Tl(!0):Sa(!0)},title:it.state==="dirty"?`${it.dirtyCount} unsaved — click to save`:"Git Status",style:{background:"none",border:"none",cursor:"pointer",fontSize:10,fontFamily:"var(--pixel-font)",color:"var(--terminal-text-muted)",display:"flex",alignItems:"center",gap:4},children:[o.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:it.state==="no-git"?"var(--terminal-text-muted)":it.state==="saving"||it.state==="dirty"?"var(--idle-amber)":it.state==="error"?"#EF5350":"var(--active-green)",animation:it.state==="saving"?"pulse 1s infinite":void 0}}),o.jsx("span",{style:{color:it.state==="dirty"?"var(--idle-amber)":"var(--terminal-text-muted)"},children:it.state==="no-git"?"No git":it.state==="saving"?"Saving...":it.state==="dirty"?`${it.dirtyCount} unsaved`:"Saved"}),On&&(On.worktrees.length>0||On.staleBranches.length>0)&&o.jsxs("span",{style:{color:On.worktrees.some(_=>_.status==="stale")?"#ff6b6b":On.worktrees.some(_=>_.status==="pending-merge")?"#FFB74D":"#4FC3F7"},children:["·"," ","📂"," ",On.worktrees.length," worktree",On.worktrees.length!==1?"s":"",On.staleBranches.length>0&&` · ⚠ ${On.staleBranches.length} branch${On.staleBranches.length!==1?"es":""}`]})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[me&&Ee&&o.jsx("button",{onClick:()=>Be(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:"#B71C1C",border:"2px solid #7f121288",fontFamily:"var(--pixel-font)",borderRadius:4},children:"WAVE"}),D.length>0&&ce&&o.jsxs("button",{onClick:()=>we(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:D[D.length-1].color,border:`2px solid ${D[D.length-1].color}88`,fontFamily:"var(--pixel-font)",borderRadius:4},children:[D[D.length-1].title.slice(0,20),D[D.length-1].title.length>20?"..":""]}),o.jsxs("button",{onClick:()=>Q(!0),className:"wave-btn px-3 py-1 font-black text-white cursor-pointer",style:{background:"#B71C1C",border:"2px solid #7f1212",fontFamily:"var(--pixel-font)"},children:["🔴"," CEO WAVE"]}),o.jsx("button",{onClick:()=>un?Ft(!1):wi(),className:"px-3 py-1 font-black cursor-pointer",style:{background:un?"var(--terminal-bg)":"var(--hud-bg-alt)",color:"var(--terminal-text)",border:`2px solid ${un?"var(--terminal-border-hover)":"var(--pixel-border)"}`,fontFamily:"var(--pixel-font)"},children:"TERMINAL"})]})]}),F.type==="role"&&O&&(()=>{var ae;const _=Ne.find(ue=>ue.roleId===O.id);return o.jsx(oj,{role:O,allRoles:r,recentActivity:Si(O.id),onClose:bn,onFireRole:(ue,pe)=>{ie({roleId:ue,roleName:pe}),bn()},terminalWidth:un?or:0,activeJobId:_==null?void 0:_.id,activeTask:_==null?void 0:_.task,isWorking:pl[O.id]==="working",jobStartedAt:_==null?void 0:_.startedAt,onStopJob:ue=>Ce.abortJob(ue),sessions:Cn,streamingSessionId:cr,onCreateSessionSilent:Ks,onSendMessage:Qr,onFocusTerminal:Qs,onCustomize:ue=>{const pe=r.find(ge=>ge.id===ue);pe&&(Mt("character"),ft(pe))},onUpdateRole:vi,appearance:Zt(O.id),relationships:Wn.relationships,roleLevel:(ae=He[O.id])==null?void 0:ae.level})})(),F.type==="project"&&Ln&&o.jsx(rC,{projectId:Ln.id,onClose:bn,terminalWidth:un?or:0}),(F.type==="bulletin"||F.type==="decisions")&&o.jsx(nC,{standups:f,waves:x,decisions:g,mode:F.type==="bulletin"?"bulletin":"decisions",onClose:bn,terminalWidth:un?or:0}),F.type==="knowledge"&&o.jsx(tC,{docs:b,onClose:bn,onRefresh:()=>Ce.getKnowledge().then(v).catch(()=>{}),terminalWidth:un?or:0,initialDocId:F.docId}),X&&o.jsx(sC,{roleId:X.roleId,roleName:X.roleName,mode:X.mode,onClose:()=>ne(null),onExecutionStart:En}),me&&!Ee&&o.jsx(xC,{directive:me.directive,rootJobs:me.rootJobs,orgNodes:z,rootRoleId:W,onClose:()=>{Se(null),Be(!1)},onMinimize:()=>Be(!0),onDone:()=>{Kr(),Ut("Wave complete","#2E7D32")},onOpenKnowledgeDoc:_=>{Se(null),Be(!1),L({type:"knowledge",docId:_}),Ce.getKnowledge().then(v).catch(()=>{})}}),D.length>0&&!ce&&(()=>{var ue;const _=D[D.length-1],ae=ee.length>1;return o.jsxs(o.Fragment,{children:[ae&&D.length===1&&o.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[63] flex gap-1 px-2 pt-2",children:ee.map((pe,ge)=>o.jsx("button",{onClick:()=>{Z(ge),Y([{jobId:pe.jobId,title:`CEO WAVE · ${pe.roleId.toUpperCase()}`,color:"#B71C1C"}])},className:"px-3 py-1.5 text-xs font-bold rounded-t-lg cursor-pointer transition-colors",style:{background:I===ge?"#B71C1C":"var(--terminal-bg)",color:I===ge?"#fff":"var(--terminal-text-secondary)",border:`1px solid ${I===ge?"#B71C1C":"var(--terminal-border)"}`,borderBottom:"none"},children:pe.roleId.toUpperCase()},pe.jobId))}),o.jsx(oC,{jobId:_.jobId,title:D.length>1?_.title:ae?`CEO WAVE · ${((ue=ee[I])==null?void 0:ue.roleName)??""}`:_.title,color:_.color,variant:"modal",style:ae&&D.length===1?{marginTop:28}:void 0,onClose:()=>{Y([]),V([]),Z(0),we(!1)},onMinimize:()=>we(!0),onDone:()=>{yi(),Kr()},onNavigateToJob:pe=>{Ce.getJob(pe).then(ge=>{const Me=jc[ge.roleId]??"#888";Y(Le=>[...Le,{jobId:pe,title:`${ge.roleId.toUpperCase()} · ${ge.task.slice(0,40)}`,color:Me}])}).catch(console.error)},onOpenKnowledgeDoc:pe=>{Y([]),V([]),Z(0),we(!1),L({type:"knowledge",docId:pe}),Ce.getKnowledge().then(v).catch(()=>{})}},_.jobId)]})})(),D.length>1&&o.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[62] pointer-events-none",children:o.jsx("div",{className:"pointer-events-auto",children:o.jsxs("button",{onClick:()=>Y(_=>_.slice(0,-1)),className:"mt-2 ml-2 px-3 py-1 text-xs font-bold text-[var(--terminal-text)] bg-[var(--terminal-bg)] border border-[var(--terminal-border)] rounded-lg cursor-pointer hover:bg-[var(--terminal-inline-bg)]",children:["←"," Back to ",(Na=D[D.length-2])==null?void 0:Na.title]})})}),R&&o.jsx(uC,{cLevelRoles:r.filter(_=>_.level==="c-level"),orgNodes:z,rootId:W,onClose:()=>Q(!1),onDispatch:Gs}),yt&&o.jsx(vC,{existingRoles:r,onClose:()=>he(!1),onHire:Nn}),G&&o.jsx(wC,{roleId:G.roleId,roleName:G.roleName,onClose:()=>ie(null),onConfirm:bi}),Xe&&o.jsx(ZE,{role:Xe,appearance:Zt(Xe.id),onSave:_=>re(Xe.id,_),onReset:()=>ye(Xe.id),onClose:()=>{ft(null),Mt("character")},theme:ze,onThemeChange:Ue,onUpdateName:async(_,ae)=>{await vi(_,{name:ae})},initialTab:"character",characterOnly:!0,speechSettings:be,onSpeechSettingsChange:je,language:jt,onLanguageChange:wt,roleLevel:(Ci=He[Xe.id])==null?void 0:Ci.level}),mi&&(()=>{const _=r.find(ae=>ae.id==="cto")??r.find(ae=>ae.level==="c-level")??r[0];return o.jsx(JE,{status:it.status,history:it.history,onClose:()=>Tl(!1),onSave:async ae=>await it.save(ae),onLoadHistory:it.loadHistory,onRestore:it.restore,saving:it.state==="saving",delegateRoleName:(_==null?void 0:_.name)??(_==null?void 0:_.id),onDelegate:_?async ae=>{Tl(!1);try{const ue=await Ce.createSession(_.id,"do");Xt(ge=>[ue,...ge]),Bn(ue.id),Ft(!0);const pe=`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.
|
|
92
|
+
`).filter(lt=>lt.trim().length>0);for(const lt of Pe){const Xe=lt.replace(/^#+\s*/,"").replace(/\*\*/g,"").replace(/^[-*]\s+/,"").trim();if(!(Xe.startsWith("|")||Xe.startsWith("{")||Xe.startsWith("[")||Xe.startsWith("```")||Xe.startsWith("---")||Xe.includes("Journal")||Xe.includes("(c-level)")||Xe.includes("(team-lead)")||Xe.includes("(member)")||/^(CEO |작업 결과|생성\/수정|APPROVAL|비고|상황 보고|태스크$)/.test(Xe))&&Xe.length>15&&Xe.length<120)return Xe}}return""},Si=_=>{const ae=Wn[_];if(!ae)return"";for(const ue of f){const pe=ue.content,ge=pe.indexOf(`## ${ae}`);if(ge===-1)continue;const Me=pe.indexOf(`
|
|
93
|
+
## `,ge+10),Pe=(Me===-1?pe.slice(ge):pe.slice(ge,Me)).replace(/^## .+\n/,"").trim();if(Pe)return Pe.slice(0,1500)}return""},It=aE();k.useEffect(()=>{r.length>0&&It.syncDefaultMembers(r)},[r]);const Zn=eE({roles:r,roleStatuses:xe,activeExecs:Ne,getStandupSpeech:ki});return uE({roles:r,roleStatuses:xe,activeExecs:Ne,channels:It.channels,relationships:Zn.relationships,pushMessage:It.pushMessage,speechSettings:be,engineType:Ke,hasApiKey:Xt}),E?o.jsxs("div",{className:"h-screen flex flex-col bg-[var(--floor-light)]",style:{fontFamily:"var(--pixel-font)"},children:[(pl||Ol.length>0)&&o.jsxs("div",{className:"shrink-0 z-[44]",children:[o.jsxs("div",{className:"flex items-center gap-3 px-5 py-2 text-xs cursor-pointer select-none",style:{background:"var(--accent)",color:"#fff",fontFamily:"var(--pixel-font)"},onClick:()=>un(_=>!_),children:[pl?o.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):o.jsx("span",{className:"shrink-0",children:"✅"}),o.jsx("span",{className:"flex-1",children:pl||"Knowledge import finished"}),Fl&&o.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Fl.index/Fl.total*100}%`,background:"#fff"}})}),o.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:Lt?"▲":"▼"})]}),Lt&&o.jsxs("div",{className:"overflow-y-auto text-xs",style:{background:"var(--terminal-bg)",borderBottom:"2px solid var(--accent)",maxHeight:240,fontFamily:"var(--pixel-font)"},children:[Ol.map(_=>o.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[_.type==="scan"&&"🔍",_.type==="process"&&"⚙️",_.type==="created"&&"✅",_.type==="done"&&"🎉",_.type==="error"&&"❌"]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{style:{color:_.type==="error"?"#EF4444":_.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:_.text}),_.detail&&o.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:_.detail})]})]},_.id)),o.jsx("div",{ref:Qr})]})]}),o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-4xl mb-3",children:"🏢"}),o.jsx("div",{className:"text-gray-600 font-semibold text-xs",children:"LOADING OFFICE..."})]})})]}):A?o.jsx("div",{className:"h-screen flex items-center justify-center bg-[var(--floor-light)]",children:o.jsxs("div",{className:"text-center max-w-md",style:{fontFamily:"var(--pixel-font)"},children:[o.jsx("div",{className:"text-4xl mb-3",children:"⚠️"}),o.jsx("div",{className:"text-gray-800 font-semibold mb-2 text-xs",children:"CONNECTION ERROR"}),o.jsx("div",{className:"text-gray-500 text-xs mb-4",children:A}),o.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-gray-800 text-white text-xs font-bold cursor-pointer border-2 border-gray-600",style:{fontFamily:"var(--pixel-font)"},children:"RETRY"})]})}):o.jsxs("div",{className:"flex flex-col",style:{height:"100dvh",fontFamily:"var(--pixel-font)"},children:[o.jsxs("div",{className:"flex items-center justify-between px-5 py-2 bg-[var(--hud-bg)] text-white text-sm shrink-0 z-[45]",style:{borderBottom:"3px solid var(--pixel-border)"},children:[o.jsxs("div",{className:"font-black text-[13px] tracking-tight",style:{color:"var(--idle-amber)",textShadow:"2px 2px 0 rgba(0,0,0,0.5)"},children:["🏢"," ",o.jsx("span",{style:{color:"var(--terminal-text)"},children:j})]}),o.jsxs("div",{className:"flex gap-4 text-[var(--terminal-text-secondary)] text-[11px] items-center",children:[(()=>{const _=Object.values(He).reduce((Me,Le)=>Me+Le.totalTokens,0),ae=_>=1e6?`${(_/1e6).toFixed(1)}M`:_>=1e3?`${Math.round(_/1e3)}K`:String(_),ue=Math.min(100,Math.round(_/25e4*100)),pe=Ne.length,ge=r.length>0?Math.round(pe/r.length*100):0;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["💰",o.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:o.jsx("div",{className:"h-full",style:{width:`${ue}%`,background:"linear-gradient(90deg,#22c55e,#34D399)"}})}),o.jsx("strong",{className:"text-[var(--active-green)]",children:ae})]}),o.jsxs("div",{className:"hidden md:flex items-center gap-1",children:["⚡",o.jsx("div",{className:"w-[50px] h-2 bg-[#111] overflow-hidden",style:{border:"2px solid var(--pixel-border)"},children:o.jsx("div",{className:"h-full",style:{width:`${ge}%`,background:"linear-gradient(90deg,#3b82f6,#60A5FA)"}})}),o.jsx("strong",{className:"text-[var(--terminal-text)]",children:ge})]})]})})(),o.jsxs("span",{className:"hidden sm:inline",children:["Roles: ",o.jsx("strong",{className:"text-[var(--terminal-text)]",children:r.length})]}),o.jsxs("span",{className:"hidden sm:inline",children:["Projects: ",o.jsx("strong",{className:"text-[var(--terminal-text)]",children:c.length})]}),Ne.length>0&&o.jsxs("span",{className:"text-amber-400",children:["Working: ",o.jsx("strong",{children:Ne.length})]}),(()=>{const _={roles:Object.entries(He).map(([ue,pe])=>({id:ue,level:pe.level,totalTokens:pe.totalTokens})),totalTokens:Object.values(He).reduce((ue,pe)=>ue+pe.totalTokens,0),roleCount:r.length},ae=I0(_);return ae.length>0?o.jsx("div",{className:"hidden sm:flex",style:{gap:2,alignItems:"center",marginLeft:8,paddingLeft:8,borderLeft:"1px solid rgba(255,255,255,0.1)"},children:ae.map(ue=>o.jsx("span",{title:`${ue.name}: ${ue.description}`,style:{fontSize:12,cursor:"default"},children:ue.icon},ue.id))}):null})(),o.jsx("span",{className:"px-1.5 py-0.5",style:{background:"var(--hud-bg-alt)",border:"1px solid var(--pixel-border)"},children:Vc})]})]}),(pl||Ol.length>0)&&o.jsxs("div",{className:"shrink-0 z-[44]",children:[o.jsxs("div",{className:"flex items-center gap-3 px-5 py-2 text-xs cursor-pointer select-none",style:{background:"var(--accent)",color:"#fff",fontFamily:"var(--pixel-font)"},onClick:()=>un(_=>!_),children:[pl?o.jsx("div",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin shrink-0"}):o.jsx("span",{className:"shrink-0",children:"✅"}),o.jsx("span",{className:"flex-1",children:pl||"Knowledge import finished"}),Fl&&o.jsx("div",{className:"w-24 h-1.5 rounded-full overflow-hidden shrink-0",style:{background:"rgba(255,255,255,0.3)"},children:o.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Fl.index/Fl.total*100}%`,background:"#fff"}})}),o.jsx("span",{className:"text-[10px] opacity-70 shrink-0",children:Lt?"▲":"▼"})]}),Lt&&o.jsxs("div",{className:"overflow-y-auto text-xs",style:{background:"var(--terminal-bg)",borderBottom:"2px solid var(--accent)",maxHeight:240,fontFamily:"var(--pixel-font)"},children:[Ol.map(_=>o.jsxs("div",{className:"flex items-start gap-2 px-5 py-1.5",style:{borderBottom:"1px solid var(--terminal-border)"},children:[o.jsxs("span",{className:"shrink-0 mt-0.5",style:{width:14,textAlign:"center"},children:[_.type==="scan"&&"🔍",_.type==="process"&&"⚙️",_.type==="created"&&"✅",_.type==="done"&&"🎉",_.type==="error"&&"❌"]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{style:{color:_.type==="error"?"#EF4444":_.type==="done"?"var(--active-green)":"var(--terminal-text)"},children:_.text}),_.detail&&o.jsx("div",{className:"text-[10px] truncate",style:{color:"var(--terminal-text-muted)"},children:_.detail})]})]},_.id)),o.jsx("div",{ref:Qr}),Ol.length===0&&o.jsx("div",{className:"px-5 py-4 text-center",style:{color:"var(--terminal-text-muted)"},children:"Waiting for events..."})]})]}),o.jsxs("div",{className:"flex-1 overflow-hidden flex relative",children:[o.jsx("div",{className:"flex-1 overflow-y-auto relative floor-grid",style:{background:"var(--floor-light)"},children:Ll==="iso"?o.jsx(WE,{roles:r,projects:c,waves:x,standups:f,decisions:g,roleStatuses:gl,activeExecs:Ne,onRoleClick:_=>L({type:"role",roleId:_}),onProjectClick:_=>L({type:"project",projectId:_}),onBulletinClick:()=>L({type:"bulletin"}),onDecisionsClick:()=>L({type:"decisions"}),onKnowledgeClick:()=>L({type:"knowledge"}),onSettingsClick:()=>Gr(!0),onThemeClick:()=>xi(_=>!_),onStatsClick:()=>zl(!0),knowledgeDocsCount:b.length,getRoleSpeech:Zn.getSpeech,getAppearance:bt,onHireClick:()=>he(!0)}):o.jsxs("div",{className:`${fn?"max-w-full":"max-w-[1100px]"} mx-auto h-full p-4 flex flex-col gap-3 relative z-[1]`,children:[(()=>{const _=r.filter(ue=>ue.level==="c-level"),ae=r.filter(ue=>ue.level!=="c-level");return o.jsxs(o.Fragment,{children:[_.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"pixel-section-label",children:"LEADERSHIP"}),o.jsx("div",{className:`grid gap-2 ${_.length===1?"grid-cols-1":"grid-cols-2"}`,children:_.map(ue=>{var pe,ge;return o.jsx(Y0,{role:ue,speech:Zn.getSpeech(ue.id),onClick:()=>L({type:"role",roleId:ue.id}),liveStatus:gl[ue.id],activeTask:(pe=Ne.find(Me=>Me.roleId===ue.id))==null?void 0:pe.task,featured:!0,appearance:bt(ue.id),xpLevel:(ge=He[ue.id])==null?void 0:ge.level},ue.id)})})]}),o.jsx("div",{className:"pixel-section-label",children:"TEAM"}),o.jsxs("div",{className:`grid gap-2 ${fn?"grid-cols-3":"grid-cols-4"}`,children:[ae.map(ue=>{var pe,ge;return o.jsx(Y0,{role:ue,speech:Zn.getSpeech(ue.id),onClick:()=>L({type:"role",roleId:ue.id}),liveStatus:gl[ue.id],activeTask:(pe=Ne.find(Me=>Me.roleId===ue.id))==null?void 0:pe.task,appearance:bt(ue.id),xpLevel:(ge=He[ue.id])==null?void 0:ge.level},ue.id)}),o.jsx("div",{className:"pixel-card pixel-card--hire",onClick:()=>he(!0),children:o.jsxs("div",{className:"pixel-card--hire-inner",children:[o.jsx("span",{className:"pixel-card--hire-icon",children:"+"}),o.jsx("span",{className:"pixel-card--hire-label",children:"HIRE NEW ROLE"})]})})]})]})})(),o.jsx("div",{className:"pixel-section-label mt-1",children:"OFFICE"}),o.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[o.jsxs("div",{className:"facility-card-compact",onClick:$n?()=>L({type:"project",projectId:$n.id}):void 0,style:$n?void 0:{borderStyle:"dashed",opacity:.5},children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#3B82F6"},children:["🏢"," MEETING ROOM"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(hc,{type:"meeting"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"Projects, PRDs, and task boards"}),$n?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"fcc-title",children:['"',$n.name,'"']}),o.jsxs("div",{className:"fcc-meta",children:["Status: ",o.jsx("strong",{style:{color:"var(--active-green)"},children:$n.status})]})]}):o.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No active projects"})]})]}),o.jsxs("div",{className:"facility-card-compact",onClick:()=>L({type:"bulletin"}),children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#64748b"},children:["📋"," BULLETIN"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(hc,{type:"bulletin"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"Waves and daily standups"}),x.slice(0,1).map(_=>o.jsxs("div",{className:"fcc-item",children:["Wave ",_.id]},_.id)),f.slice(0,1).map(_=>o.jsxs("div",{className:"fcc-item",children:["Standup ",_.date]},_.date)),x.length===0&&f.length===0&&o.jsx("div",{className:"fcc-meta",style:{fontStyle:"italic"},children:"No entries yet"})]})]}),o.jsxs("div",{className:"facility-card-compact",onClick:()=>L({type:"decisions"}),children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#EF4444"},children:["📜"," DECISIONS"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(hc,{type:"decision"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"CEO strategic decision log"}),o.jsxs("div",{className:"fcc-title",children:[g.length," decisions"]}),g.slice(0,2).map(_=>o.jsxs("div",{className:"fcc-item",children:["#",_.id," ",_.title]},_.id))]})]}),o.jsxs("div",{className:"facility-card-compact",onClick:()=>L({type:"knowledge"}),children:[o.jsxs("div",{className:"fcc-hdr",style:{background:"#0D9488"},children:["📚"," KNOWLEDGE"]}),o.jsx("div",{className:"fcc-canvas",children:o.jsx(hc,{type:"knowledge"})}),o.jsxs("div",{className:"fcc-body",children:[o.jsx("div",{className:"fcc-desc",children:"Research, analysis, and references"}),o.jsxs("div",{className:"fcc-title",children:[b.length," docs"]}),b.slice(0,2).map(_=>o.jsx("div",{className:"fcc-item",children:_.title},_.id))]})]})]})]})}),fn&&o.jsx("div",{className:Hl?"absolute inset-0 z-50":"contents",children:o.jsx($C,{sessions:En,activeSessionId:Ea,roles:r,streamingSessionId:fr,width:Hl?$l:ur,onWidthChange:Hl?void 0:Xs,onSwitchSession:Ln,onCloseSession:hr,onCreateSession:dr,onClearEmpty:qc,onCloseAll:Ws,onSendMessage:Zr,onModeChange:Xc,onCloseTerminal:()=>Rt(!1),chatChannels:It.channels,activeChatChannelId:It.activeChannelId,onSwitchChatChannel:It.setActiveChannelId,onCreateChatChannel:It.createChannel,onDeleteChatChannel:It.deleteChannel,onUpdateChatMembers:It.updateMembers,onUpdateChatTopic:It.updateTopic,unreadChannels:It.unreadChannels})})]}),o.jsxs("div",{className:"flex items-center justify-between px-5 py-2 bg-[var(--hud-bg)] text-[var(--terminal-text-secondary)] text-[10px] shrink-0 z-[45]",style:{borderTop:"3px solid var(--pixel-border)"},children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>Ca("card"),className:`view-toggle-btn ${Ll==="card"?"active":""}`,children:"CARD"}),o.jsx("button",{onClick:()=>Ca("iso"),className:`view-toggle-btn ${Ll==="iso"?"active":""}`,children:"OFFICE"}),o.jsx("span",{className:"mx-1",children:"|"}),o.jsxs("div",{style:{position:"relative"},children:[o.jsxs("button",{className:`theme-btn${or?" active":""}`,onClick:()=>xi(_=>!_),title:"Office Theme",children:[((ji=Yr[ze])==null?void 0:ji.icon)??"","▾"]}),or&&o.jsx(aN,{theme:ze,onThemeChange:Ie,onClose:()=>xi(!1)})]}),o.jsx("button",{className:"theme-btn",onClick:()=>Gr(!0),title:"Settings",children:"⚙"}),o.jsx("span",{className:"mx-1",children:"|"}),o.jsxs("button",{onClick:()=>{de.state==="no-git"?de.initGit():de.state==="dirty"?xl(!0):ja(!0)},title:de.state==="dirty"?`${de.dirtyCount} unsaved — click to save`:"Git Status",style:{background:"none",border:"none",cursor:"pointer",fontSize:10,fontFamily:"var(--pixel-font)",color:"var(--terminal-text-muted)",display:"flex",alignItems:"center",gap:4},children:[o.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:de.state==="no-git"?"var(--terminal-text-muted)":de.state==="saving"||de.state==="dirty"?"var(--idle-amber)":de.state==="error"?"#EF5350":"var(--active-green)",animation:de.state==="saving"?"pulse 1s infinite":void 0}}),o.jsx("span",{style:{color:de.state==="dirty"?"var(--idle-amber)":"var(--terminal-text-muted)"},children:de.state==="no-git"?"No git":de.state==="saving"?"Saving...":de.state==="dirty"?`${de.dirtyCount} unsaved`:"Saved"}),Bn&&(Bn.worktrees.length>0||Bn.staleBranches.length>0)&&o.jsxs("span",{style:{color:Bn.worktrees.some(_=>_.status==="stale")?"#ff6b6b":Bn.worktrees.some(_=>_.status==="pending-merge")?"#FFB74D":"#4FC3F7"},children:["·"," ","📂"," ",Bn.worktrees.length," worktree",Bn.worktrees.length!==1?"s":"",Bn.staleBranches.length>0&&` · ⚠ ${Bn.staleBranches.length} branch${Bn.staleBranches.length!==1?"es":""}`]})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[me&&Ee&&o.jsx("button",{onClick:()=>Oe(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:"#B71C1C",border:"2px solid #7f121288",fontFamily:"var(--pixel-font)",borderRadius:4},children:"WAVE"}),D.length>0&&ce&&o.jsxs("button",{onClick:()=>we(!1),className:"px-3 py-1 font-black text-white cursor-pointer animate-pulse",style:{background:D[D.length-1].color,border:`2px solid ${D[D.length-1].color}88`,fontFamily:"var(--pixel-font)",borderRadius:4},children:[D[D.length-1].title.slice(0,20),D[D.length-1].title.length>20?"..":""]}),o.jsxs("button",{onClick:()=>Q(!0),className:"wave-btn px-3 py-1 font-black text-white cursor-pointer",style:{background:"#B71C1C",border:"2px solid #7f1212",fontFamily:"var(--pixel-font)"},children:["🔴"," CEO WAVE"]}),o.jsx("button",{onClick:()=>fn?Rt(!1):wi(),className:"px-3 py-1 font-black cursor-pointer",style:{background:fn?"var(--terminal-bg)":"var(--hud-bg-alt)",color:"var(--terminal-text)",border:`2px solid ${fn?"var(--terminal-border-hover)":"var(--pixel-border)"}`,fontFamily:"var(--pixel-font)"},children:"TERMINAL"})]})]}),R.type==="role"&&O&&(()=>{var ae;const _=Ne.find(ue=>ue.roleId===O.id);return o.jsx(oj,{role:O,allRoles:r,recentActivity:Si(O.id),onClose:vn,onFireRole:(ue,pe)=>{ie({roleId:ue,roleName:pe}),vn()},terminalWidth:fn?ur:0,activeJobId:_==null?void 0:_.id,activeTask:_==null?void 0:_.task,isWorking:gl[O.id]==="working",jobStartedAt:_==null?void 0:_.startedAt,onStopJob:ue=>Ce.abortJob(ue),sessions:En,streamingSessionId:fr,onCreateSessionSilent:Ks,onSendMessage:Zr,onFocusTerminal:Qs,onCustomize:ue=>{const pe=r.find(ge=>ge.id===ue);pe&&(Ht("character"),Mt(pe))},onUpdateRole:vi,appearance:bt(O.id),relationships:Zn.relationships,roleLevel:(ae=He[O.id])==null?void 0:ae.level})})(),R.type==="project"&&$n&&o.jsx(rC,{projectId:$n.id,onClose:vn,terminalWidth:fn?ur:0}),(R.type==="bulletin"||R.type==="decisions")&&o.jsx(nC,{standups:f,waves:x,decisions:g,mode:R.type==="bulletin"?"bulletin":"decisions",onClose:vn,terminalWidth:fn?ur:0}),R.type==="knowledge"&&o.jsx(tC,{docs:b,onClose:vn,onRefresh:()=>Ce.getKnowledge().then(v).catch(()=>{}),terminalWidth:fn?ur:0,initialDocId:R.docId}),X&&o.jsx(sC,{roleId:X.roleId,roleName:X.roleName,mode:X.mode,onClose:()=>ne(null),onExecutionStart:Nn}),me&&!Ee&&o.jsx(xC,{directive:me.directive,rootJobs:me.rootJobs,orgNodes:z,rootRoleId:W,onClose:()=>{Se(null),Oe(!1)},onMinimize:()=>Oe(!0),onDone:()=>{Wr(),Ut("Wave complete","#2E7D32")},onOpenKnowledgeDoc:_=>{Se(null),Oe(!1),L({type:"knowledge",docId:_}),Ce.getKnowledge().then(v).catch(()=>{})}}),D.length>0&&!ce&&(()=>{var ue;const _=D[D.length-1],ae=ee.length>1;return o.jsxs(o.Fragment,{children:[ae&&D.length===1&&o.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[63] flex gap-1 px-2 pt-2",children:ee.map((pe,ge)=>o.jsx("button",{onClick:()=>{Z(ge),Y([{jobId:pe.jobId,title:`CEO WAVE · ${pe.roleId.toUpperCase()}`,color:"#B71C1C"}])},className:"px-3 py-1.5 text-xs font-bold rounded-t-lg cursor-pointer transition-colors",style:{background:I===ge?"#B71C1C":"var(--terminal-bg)",color:I===ge?"#fff":"var(--terminal-text-secondary)",border:`1px solid ${I===ge?"#B71C1C":"var(--terminal-border)"}`,borderBottom:"none"},children:pe.roleId.toUpperCase()},pe.jobId))}),o.jsx(oC,{jobId:_.jobId,title:D.length>1?_.title:ae?`CEO WAVE · ${((ue=ee[I])==null?void 0:ue.roleName)??""}`:_.title,color:_.color,variant:"modal",style:ae&&D.length===1?{marginTop:28}:void 0,onClose:()=>{Y([]),V([]),Z(0),we(!1)},onMinimize:()=>we(!0),onDone:()=>{yi(),Wr()},onNavigateToJob:pe=>{Ce.getJob(pe).then(ge=>{const Me=jc[ge.roleId]??"#888";Y(Le=>[...Le,{jobId:pe,title:`${ge.roleId.toUpperCase()} · ${ge.task.slice(0,40)}`,color:Me}])}).catch(console.error)},onOpenKnowledgeDoc:pe=>{Y([]),V([]),Z(0),we(!1),L({type:"knowledge",docId:pe}),Ce.getKnowledge().then(v).catch(()=>{})}},_.jobId)]})})(),D.length>1&&o.jsx("div",{className:"fixed top-[5%] left-1/2 -translate-x-1/2 w-[720px] max-w-[95vw] z-[62] pointer-events-none",children:o.jsx("div",{className:"pointer-events-auto",children:o.jsxs("button",{onClick:()=>Y(_=>_.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 ",(Aa=D[D.length-2])==null?void 0:Aa.title]})})}),F&&o.jsx(uC,{cLevelRoles:r.filter(_=>_.level==="c-level"),orgNodes:z,rootId:W,onClose:()=>Q(!1),onDispatch:Gs}),xt&&o.jsx(vC,{existingRoles:r,onClose:()=>he(!1),onHire:An}),G&&o.jsx(wC,{roleId:G.roleId,roleName:G.roleName,onClose:()=>ie(null),onConfirm:bi}),Je&&o.jsx(ZE,{role:Je,appearance:bt(Je.id),onSave:_=>re(Je.id,_),onReset:()=>ye(Je.id),onClose:()=>{Mt(null),Ht("character")},theme:ze,onThemeChange:Ie,onUpdateName:async(_,ae)=>{await vi(_,{name:ae})},initialTab:"character",characterOnly:!0,speechSettings:be,onSpeechSettingsChange:je,language:jt,onLanguageChange:vt,roleLevel:(Ci=He[Je.id])==null?void 0:Ci.level}),cn&&(()=>{const _=r.find(ae=>ae.id==="cto")??r.find(ae=>ae.level==="c-level")??r[0];return o.jsx(JE,{status:de.status,history:de.history,onClose:()=>xl(!1),onSave:async ae=>await de.save(ae),onLoadHistory:de.loadHistory,onRestore:de.restore,saving:de.state==="saving",delegateRoleName:(_==null?void 0:_.name)??(_==null?void 0:_.id),onDelegate:_?async ae=>{xl(!1);try{const ue=await Ce.createSession(_.id,"do");Vt(ge=>[ue,...ge]),Ln(ue.id),Rt(!0);const pe=`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
94
|
|
|
95
95
|
Changed files:
|
|
96
|
-
${ae}`;
|
|
96
|
+
${ae}`;Zr(ue.id,pe,"do")}catch(ue){Ut(`Failed to delegate: ${ue instanceof Error?ue.message:"error"}`,"#B71C1C")}}:void 0})})(),ir&&o.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>zl(!1),children:o.jsx("div",{style:{width:420,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8},onClick:_=>_.stopPropagation(),children:o.jsx(PE,{onClose:()=>zl(!1)})})}),Ml&&o.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>sr(!1),children:o.jsx("div",{style:{width:480,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8,overflowY:"auto"},onClick:_=>_.stopPropagation(),children:o.jsx(nN,{onClose:()=>sr(!1),onSyncComplete:()=>{}})})}),Us&&o.jsx(rN,{onClose:()=>Gr(!1),speechSettings:be,onSpeechSettingsChange:je,language:jt,onLanguageChange:vt,onOpenSync:()=>sr(!0),onOpenGitStatus:()=>ja(!0),onOpenStats:()=>zl(!0)}),Rl&&o.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>ja(!1),children:o.jsx("div",{style:{width:520,maxHeight:"80vh",background:"var(--terminal-bg)",border:"2px solid var(--pixel-border)",borderRadius:8,overflowY:"auto"},onClick:_=>_.stopPropagation(),children:o.jsx(lN,{onClose:()=>ja(!1)})})}),o.jsx("div",{className:"fixed top-16 right-4 z-[70] flex flex-col gap-2",children:Ae.map(_=>o.jsxs("div",{className:"toast-enter flex items-center gap-2 px-4 py-2.5 shadow-lg text-white text-xs font-black",style:{background:_.color,border:"2px solid rgba(0,0,0,0.3)",fontFamily:"var(--pixel-font)"},children:[o.jsx("div",{className:"w-2 h-2 bg-white/60"}),_.message]},_.id))})]})}function Y0({role:t,speech:l,onClick:r,liveStatus:i,activeTask:c,featured:u,appearance:f,xpLevel:m}){const x=jc[t.id]??uN(t.id),d=m??1,g=cN[t.id]??t.name,y=i==="working",b=y&&c?c:l||g;return o.jsxs("div",{className:`pixel-card ${y?"working":""} ${u?"pixel-card--featured":""}`,onClick:r,children:[o.jsxs("div",{className:"pixel-card-hdr",style:{background:x},children:[o.jsxs("span",{children:[t.id.toUpperCase()," ","·"," ",t.name.toUpperCase()]}),o.jsxs("span",{className:"lvl",children:["Lv.",d]})]}),o.jsxs("div",{className:"pixel-card-body",children:[o.jsx("div",{className:"pixel-desk"}),o.jsx(Ic,{roleId:t.id,appearance:f}),o.jsx("div",{className:"pixel-status-dot",style:{background:y?"var(--idle-amber)":"var(--active-green)"}})]}),o.jsxs("div",{className:"pixel-card-task",children:[o.jsx("span",{className:"pixel-card-task-icon",children:y?"🛠️":oN[t.id]??"👤"}),o.jsx("span",{className:"pixel-card-task-text",children:b||g})]})]})}function Od({onSelect:t,onClose:l}){const[r,i]=k.useState(null),[c,u]=k.useState(!0),f=k.useCallback(async m=>{u(!0);try{const x=await Ce.browse(m);i(x)}catch{}finally{u(!1)}},[]);return k.useEffect(()=>{f()},[f]),c&&!r?o.jsx("div",{className:"mt-3 rounded-lg p-4 text-xs text-center",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",color:"var(--terminal-text-muted)"},children:"Loading..."}):r?o.jsxs("div",{className:"mt-3 rounded-lg overflow-hidden text-xs",style:{background:"var(--terminal-bg)",border:"1px solid var(--terminal-border)",maxHeight:220,overflowY:"auto"},children:[o.jsxs("div",{className:"px-3 py-2 flex items-center gap-2 sticky top-0",style:{background:"var(--terminal-surface)",borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx("span",{style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},className:"truncate flex-1",children:r.current}),o.jsx("button",{onClick:()=>t(r.current),className:"px-2 py-1 rounded text-[10px] font-medium shrink-0",style:{background:"var(--active-green)",color:"#fff"},children:"Select"}),o.jsx("button",{onClick:l,className:"opacity-50 hover:opacity-100 shrink-0",style:{color:"var(--terminal-text)"},children:"✕"})]}),r.parent&&o.jsxs("div",{className:"px-3 py-1.5 cursor-pointer flex items-center gap-2 hover:bg-[var(--terminal-surface-light)]",style:{color:"var(--terminal-text-secondary)"},onClick:()=>f(r.parent),children:[o.jsx("span",{children:"⬆️"}),o.jsx("span",{children:".."})]}),r.dirs.map(m=>o.jsxs("div",{className:"px-3 py-1.5 cursor-pointer flex items-center gap-2 hover:bg-[var(--terminal-surface-light)]",style:{color:"var(--terminal-text)"},onClick:()=>f(m.path),children:[o.jsx("span",{children:"📁"}),o.jsx("span",{children:m.name})]},m.path)),r.dirs.length===0&&o.jsx("div",{className:"px-3 py-3 text-center",style:{color:"var(--terminal-text-muted)"},children:"No subdirectories"})]}):null}const dN={engine:"AI Engine",company:"Company Info",project:"Project",knowledge:"Knowledge",team:"Team Template",create:"Create"};function q0(t){switch(t){case"skip":return["engine","company","project","knowledge","team","create"];case"import":return["engine","company","project","knowledge","team","create"];case"existing-akb":return["engine","knowledge","create"]}}function hN({onComplete:t}){const[l,r]=k.useState(0),[i,c]=k.useState(null),[u,f]=k.useState("none"),[m,x]=k.useState(""),[d,g]=k.useState(!0),[y,b]=k.useState(""),[v,j]=k.useState(""),[S,E]=k.useState("auto"),C=k.useRef(null),[A,M]=k.useState("fresh"),[R,L]=k.useState(""),[O,U]=k.useState(null),[X,ne]=k.useState(!1),[D,Y]=k.useState(!1),[F,Q]=k.useState("skip"),[ee,V]=k.useState([]),[I,Z]=k.useState(""),[ce,we]=k.useState(!1),[z,B]=k.useState(""),[W,T]=k.useState(null),[me,Se]=k.useState(!1),[Ee,Oe]=k.useState(!1),[He,Ge]=k.useState([]),[ke,xt]=k.useState("startup"),[he,G]=k.useState(!1),[ie,xe]=k.useState(!1),[Te,Ne]=k.useState(null),[Re,Ae]=k.useState([]),[Be,Ke]=k.useState(""),[St,Xt]=k.useState(!1),pt=k.useMemo(()=>q0(F),[F]),bt=pt[l]??"engine";k.useEffect(()=>{Ce.detectEngine().then(de=>{c(de),f(de.recommended),g(!1)}).catch(()=>g(!1)),Ce.getTeams().then(Ge).catch(()=>{})},[]),k.useEffect(()=>{var de;bt==="company"&&((de=C.current)==null||de.focus())},[bt]);const re=()=>{switch(bt){case"engine":return u!=="none"||m.length>10;case"company":return y.trim().length>0;case"project":return A==="fresh"||A==="existing"&&O===!0;case"knowledge":return F==="existing-akb"?W===!0:F==="import"?ee.length>0:!0;case"team":return!0;case"create":return!ie;default:return!1}},ye=()=>{l<pt.length-1&&re()&&r(l+1),bt==="create"&&!he&&!St&&(F==="existing-akb"?vt():jt())},ze=()=>{l>0&&r(l-1)};k.useEffect(()=>{const de=q0(F);l>=de.length&&r(de.length-1)},[F,l]);const Ie=async()=>{if(R.trim()){ne(!0);try{const de=await Ce.validatePath(R.trim());U(de.valid)}catch{U(!1)}finally{ne(!1)}}},be=async()=>{if(z.trim()){Se(!0);try{const de=await Ce.validatePath(z.trim());T(de.valid&&de.hasClaudeMd===!0)}catch{T(!1)}finally{Se(!1)}}},je=()=>{const de=I.trim();de&&!ee.includes(de)&&(V([...ee,de]),Z(""))},jt=async()=>{G(!0),Ne(null);try{const de={companyName:y.trim(),description:v.trim()||"An AI-powered organization",team:ke,existingProjectPath:A==="existing"?R.trim():void 0,knowledgePaths:F==="import"&&ee.length>0?ee:void 0,language:S!=="auto"?S:void 0};(u==="direct-api"||m)&&(de.apiKey=m||void 0);const cn=await Ce.scaffold(de);Ae(cn.created),Ke(cn.projectRoot),xe(!0)}catch(de){Ne(de instanceof Error?de.message:"Scaffold failed")}finally{G(!1)}},vt=async()=>{Xt(!0),Ne(null);try{const de=await Ce.connectAkb(z.trim());de.ok?(xe(!0),Ae([`Connected to: ${de.companyRoot}`])):Ne(de.error||"Failed to connect")}catch(de){Ne(de instanceof Error?de.message:"Connect failed")}finally{Xt(!1)}},Je=()=>{F==="import"&&ee.length>0?t({paths:ee,companyRoot:""}):t()},Mt=de=>{de.key==="Enter"&&re()&&(de.preventDefault(),ye())},nt=`w-full px-3 py-2 rounded text-sm outline-none transition-colors
|
|
97
97
|
bg-[var(--terminal-bg)] text-[var(--terminal-text)]
|
|
98
98
|
border border-[var(--terminal-border)]
|
|
99
99
|
focus:border-[var(--terminal-border-hover)]
|
|
100
|
-
placeholder:text-[var(--terminal-text-muted)]`,ft=de=>`p-4 rounded-lg border-2 cursor-pointer transition-all text-[var(--terminal-text)] ${de?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--terminal-border)] bg-[var(--hud-bg-alt)] hover:border-[var(--accent)]/50"}`;return o.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},onKeyDown:wt,children:o.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl overflow-hidden",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"px-6 py-5",style:{background:"var(--terminal-bg)",borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx("div",{className:"text-lg font-bold",style:{color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"},children:"tycono"}),o.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-secondary)"},children:"Build an AI company. Watch them work."}),o.jsx("div",{className:"flex gap-1.5 mt-4",children:Lt.map((de,Mt)=>o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"h-1 rounded-full transition-colors",style:{background:Mt<=l?"var(--accent)":"var(--terminal-surface-light)"}}),o.jsx("div",{className:"text-[9px] mt-1 truncate",style:{color:Mt===l?"var(--terminal-text)":"var(--terminal-text-muted)"},children:dN[de]})]},de))})]}),o.jsxs("div",{className:"px-6 py-5 min-h-[280px]",children:[gt==="engine"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"AI Engine Setup"}),d?o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:"Detecting AI engine..."}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:ft(u==="claude-cli"),onClick:()=>(i==null?void 0:i.claudeCli)&&f("claude-cli"),style:{opacity:i!=null&&i.claudeCli?1:.4},children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-lg",children:i!=null&&i.claudeCli?"✅":"❌"}),o.jsxs("div",{children:[o.jsx("div",{className:"font-medium text-sm",children:"Claude Code CLI"}),o.jsx("div",{className:"text-xs opacity-70",children:i!=null&&i.claudeCli?"Detected! Recommended — zero config needed.":"Not installed. Get it at claude.ai/download"})]})]})}),o.jsxs("div",{className:ft(u==="direct-api"),onClick:()=>f("direct-api"),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-lg",children:i!=null&&i.apiKey?"✅":"🔑"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"font-medium text-sm",children:"Anthropic API Key (BYOK)"}),o.jsx("div",{className:"text-xs opacity-70",children:i!=null&&i.apiKey?"API key found in environment.":"Enter your ANTHROPIC_API_KEY"})]})]}),u==="direct-api"&&!(i!=null&&i.apiKey)&&o.jsx("input",{type:"password",className:`${Xe} mt-3`,placeholder:"sk-ant-...",value:m,onChange:de=>x(de.target.value),autoFocus:!0})]})]})]}),gt==="company"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Company Info"}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Company Name *"}),o.jsx("input",{ref:C,className:Xe,placeholder:"e.g. Acme Corp",value:y,onChange:de=>b(de.target.value)})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Description"}),o.jsx("textarea",{className:`${Xe} resize-none`,rows:3,placeholder:"What does your AI company do?",value:v,onChange:de=>j(de.target.value)})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"AI Response Language"}),o.jsxs("select",{className:Xe,value:S,onChange:de=>E(de.target.value),children:[o.jsx("option",{value:"auto",children:"Auto"}),o.jsx("option",{value:"en",children:"English"}),o.jsx("option",{value:"ko",children:"한국어"}),o.jsx("option",{value:"ja",children:"日本語"})]})]})]}),gt==="project"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Project Setup"}),o.jsxs("div",{className:ft(A==="fresh"),onClick:()=>{M("fresh"),U(null)},children:[o.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Create a new AI company from scratch with clean directory structure."})]}),o.jsxs("div",{className:ft(A==="existing"),onClick:()=>M("existing"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["📂"," Connect Existing Project"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Add AI company structure to an existing codebase or knowledge base."}),A==="existing"&&o.jsxs("div",{className:"mt-3",onClick:de=>de.stopPropagation(),children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{className:`${Xe} flex-1`,placeholder:"/path/to/your/project",value:F,onChange:de=>{L(de.target.value),U(null)},autoFocus:!0}),o.jsx("button",{onClick:()=>Y(!D),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),o.jsx("button",{onClick:ye,disabled:X||!F.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:X||!F.trim()?.5:1},children:X?"...":"Verify"})]}),O===!0&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Path verified: ",F]}),O===!1&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," Invalid path"]}),D&&o.jsx(Od,{onSelect:de=>{L(de),U(!0),Y(!1)},onClose:()=>Y(!1)})]})]})]}),gt==="knowledge"&&o.jsxs("div",{className:"space-y-3",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Knowledge Strategy"}),o.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"How should AI handle your knowledge base?"}),o.jsxs("div",{className:ft(R==="skip"),onClick:()=>Q("skip"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Empty knowledge base. Add documents later from the office."})]}),o.jsxs("div",{className:ft(R==="import"),onClick:()=>Q("import"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["📚"," Import & Build"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Select folders with documents — AI reads, summarizes, and organizes them."}),R==="import"&&o.jsxs("div",{className:"mt-3 space-y-2",onClick:de=>de.stopPropagation(),children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{className:`${Xe} flex-1`,placeholder:"/path/to/docs",value:I,onChange:de=>Z(de.target.value),onKeyDown:de=>{de.key==="Enter"&&(de.preventDefault(),Ue())},autoFocus:!0}),o.jsx("button",{onClick:()=>we(!ce),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),o.jsx("button",{onClick:Ue,disabled:!I.trim(),className:"px-3 py-2 rounded text-xs font-medium",style:{background:"var(--accent)",color:"#fff",opacity:I.trim()?1:.5},children:"Add"})]}),ce&&o.jsx(Od,{onSelect:de=>{ee.includes(de)||V([...ee,de]),we(!1)},onClose:()=>we(!1)}),ee.length>0&&o.jsx("div",{className:"space-y-1",children:ee.map((de,Mt)=>o.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:[o.jsx("span",{className:"flex-1 truncate",style:{fontFamily:"var(--pixel-font)"},children:de}),o.jsx("button",{onClick:()=>V(ee.filter((it,mi)=>mi!==Mt)),className:"opacity-50 hover:opacity-100",children:"✕"})]},Mt))}),ee.length===0&&o.jsx("div",{className:"text-[10px] text-center py-2",style:{color:"var(--terminal-text-muted)"},children:"Add at least one folder to import."})]})]}),o.jsxs("div",{className:ft(R==="existing-akb"),onClick:()=>Q("existing-akb"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["🔗"," Connect Existing AKB"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Connect a directory that already has CLAUDE.md and AKB structure."}),R==="existing-akb"&&o.jsxs("div",{className:"mt-3",onClick:de=>de.stopPropagation(),children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{className:`${Xe} flex-1`,placeholder:"/path/to/your/akb",value:z,onChange:de=>{B(de.target.value),T(null)},autoFocus:!0}),o.jsx("button",{onClick:()=>Be(!Ee),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),o.jsx("button",{onClick:ze,disabled:me||!z.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:me||!z.trim()?.5:1},children:me?"...":"Verify"})]}),W===!0&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Valid AKB found: ",z]}),W===!1&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," No valid AKB (CLAUDE.md required)"]}),Ee&&o.jsx(Od,{onSelect:de=>{B(de),T(null),Be(!1)},onClose:()=>Be(!1)})]})]})]}),gt==="team"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Team Template"}),o.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"Choose a starting team. You can add or remove roles later."}),He.map(de=>o.jsxs("div",{className:ft(ke===de.id),onClick:()=>yt(de.id),children:[o.jsx("div",{className:"font-medium text-sm capitalize",children:de.id}),o.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:de.roles.map(Mt=>o.jsx("span",{className:"px-2 py-0.5 rounded text-[10px]",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:Mt.name},Mt.id))})]},de.id)),o.jsxs("div",{className:ft(ke==="custom"),onClick:()=>yt("custom"),children:[o.jsx("div",{className:"font-medium text-sm",children:"Custom"}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Start with no pre-built roles. Hire them from the office."})]})]}),gt==="create"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:ie?R==="existing-akb"?"AKB Connected!":"Company Created!":"Review & Create"}),!ie&&!he&&!Re&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"rounded-lg p-4 space-y-2 text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:R==="existing-akb"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Mode:"})," Connect Existing AKB"]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Path:"})," ",z]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Company:"})," ",y]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Project:"})," ",A==="fresh"?"Start Fresh":`Existing (${F})`]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Knowledge:"})," ",R==="skip"?"Fresh (empty)":`Import ${ee.length} source(s)`]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Team:"})," ",ke]}),R==="import"&&ee.length>0&&o.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--idle-amber)"},children:"Knowledge import will run in the background after entering the office."})]})}),Te&&o.jsx("div",{className:"text-xs p-3 rounded",style:{background:"rgba(220,38,38,0.15)",color:"#f87171"},children:Te})]}),(he||Re)&&o.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[o.jsx("div",{className:"w-8 h-8 border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:Re?"Connecting to AKB...":"Scaffolding your company..."})]}),ie&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"text-center py-4 text-4xl",children:"🏢"}),o.jsx("div",{className:"rounded-lg p-4 text-xs max-h-40 overflow-y-auto",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:Fe.map((de,Mt)=>o.jsxs("div",{className:"py-0.5",children:[o.jsx("span",{style:{color:"var(--active-green)"},children:"✓"})," ",de]},Mt))}),R==="import"&&ee.length>0&&o.jsx("div",{className:"text-xs p-3 rounded",style:{background:"var(--accent)",color:"#fff",opacity:.9},children:"Knowledge import will start in the background after entering the office."})]})]})]}),o.jsxs("div",{className:"px-6 py-4 flex justify-between items-center",style:{borderTop:"1px solid var(--terminal-border)"},children:[o.jsx("div",{children:l>0&&!ie&&o.jsx("button",{onClick:re,className:"px-4 py-2 rounded text-sm transition-colors",style:{color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Back"})}),o.jsxs("div",{className:"text-xs",style:{color:"var(--terminal-text-muted)"},children:[l+1," / ",Lt.length]}),o.jsx("div",{children:ie?o.jsx("button",{onClick:jt,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:"var(--active-green)",color:"#fff"},children:"Enter Office"}):o.jsx("button",{onClick:Zt,disabled:!ht()||he||Re,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:ht()?"var(--accent)":"var(--terminal-border)",color:"#fff",opacity:ht()&&!he&&!Re?1:.5},children:gt==="create"?he||Re?Re?"Connecting...":"Creating...":R==="existing-akb"?"Connect AKB":"Create Company":"Next"})})]})]})})}function mN(){const[t,l]=k.useState(null),[r,i]=k.useState(!0),[c,u]=k.useState(null),f=k.useCallback(async()=>{i(!0),u(null);try{const m=await Ce.getStatus();l(m)}catch(m){u(m instanceof Error?m.message:"Failed to fetch status")}finally{i(!1)}},[]);return k.useEffect(()=>{f()},[f]),{initialized:(t==null?void 0:t.initialized)??!1,companyName:(t==null?void 0:t.companyName)??null,engine:(t==null?void 0:t.engine)??"none",companyRoot:(t==null?void 0:t.companyRoot)??"",loading:r,error:c,refetch:f}}const xN=k.lazy(()=>Jb(()=>import("./preview-app-x4kICKsu.js"),[]));function _g(){return o.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"w-10 h-10 mx-auto border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),o.jsx("div",{className:"mt-4 text-sm",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Loading..."})]})})}function pN(){var t;try{const l=localStorage.getItem("tycono-theme")||localStorage.getItem("the-company-theme"),r=l&&l in Ur?l:"default",i=(t=Ur[r])==null?void 0:t.vars;if(!i)return;const c=document.documentElement;for(const[u,f]of Object.entries(i))c.style.setProperty(u,f)}catch{}}function yN(){const{initialized:t,loading:l,refetch:r}=mN(),[i,c]=k.useState(null);k.useEffect(()=>{pN()},[]);const u=f=>{f&&c(f),r()};return l?o.jsx(_g,{}):t?o.jsx(fN,{importJob:i,onImportDone:()=>c(null)}):o.jsx(hN,{onComplete:u})}function gN(){const t=new URLSearchParams(window.location.search).has("sprite-preview");return o.jsx(Pb,{children:t?o.jsx(k.Suspense,{fallback:o.jsx(_g,{}),children:o.jsx(xN,{})}):o.jsx(yN,{})})}Qb.createRoot(document.getElementById("root")).render(o.jsx(k.StrictMode,{children:o.jsx(gN,{})}));export{pg as H,gg as P,bg as S,wN as a,yg as b,xg as c,Qd as d,DS as e,TS as f,vN as g,zS as h,o as j,k as r};
|
|
100
|
+
placeholder:text-[var(--terminal-text-muted)]`,Ht=de=>`p-4 rounded-lg border-2 cursor-pointer transition-all text-[var(--terminal-text)] ${de?"border-[var(--accent)] bg-[var(--accent)]/10":"border-[var(--terminal-border)] bg-[var(--hud-bg-alt)] hover:border-[var(--accent)]/50"}`;return o.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},onKeyDown:Mt,children:o.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl overflow-hidden",style:{background:"var(--hud-bg)",border:"1px solid var(--terminal-border)"},children:[o.jsxs("div",{className:"px-6 py-5",style:{background:"var(--terminal-bg)",borderBottom:"1px solid var(--terminal-border)"},children:[o.jsx("div",{className:"text-lg font-bold",style:{color:"var(--terminal-text)",fontFamily:"var(--pixel-font)"},children:"tycono"}),o.jsx("div",{className:"text-xs mt-1",style:{color:"var(--terminal-text-secondary)"},children:"Build an AI company. Watch them work."}),o.jsx("div",{className:"flex gap-1.5 mt-4",children:pt.map((de,cn)=>o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"h-1 rounded-full transition-colors",style:{background:cn<=l?"var(--accent)":"var(--terminal-surface-light)"}}),o.jsx("div",{className:"text-[9px] mt-1 truncate",style:{color:cn===l?"var(--terminal-text)":"var(--terminal-text-muted)"},children:dN[de]})]},de))})]}),o.jsxs("div",{className:"px-6 py-5 min-h-[280px]",children:[bt==="engine"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"AI Engine Setup"}),d?o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:"Detecting AI engine..."}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:Ht(u==="claude-cli"),onClick:()=>(i==null?void 0:i.claudeCli)&&f("claude-cli"),style:{opacity:i!=null&&i.claudeCli?1:.4},children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-lg",children:i!=null&&i.claudeCli?"✅":"❌"}),o.jsxs("div",{children:[o.jsx("div",{className:"font-medium text-sm",children:"Claude Code CLI"}),o.jsx("div",{className:"text-xs opacity-70",children:i!=null&&i.claudeCli?"Detected! Recommended — zero config needed.":"Not installed. Get it at claude.ai/download"})]})]})}),o.jsxs("div",{className:Ht(u==="direct-api"),onClick:()=>f("direct-api"),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-lg",children:i!=null&&i.apiKey?"✅":"🔑"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"font-medium text-sm",children:"Anthropic API Key (BYOK)"}),o.jsx("div",{className:"text-xs opacity-70",children:i!=null&&i.apiKey?"API key found in environment.":"Enter your ANTHROPIC_API_KEY"})]})]}),u==="direct-api"&&!(i!=null&&i.apiKey)&&o.jsx("input",{type:"password",className:`${nt} mt-3`,placeholder:"sk-ant-...",value:m,onChange:de=>x(de.target.value),autoFocus:!0})]})]})]}),bt==="company"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Company Info"}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Company Name *"}),o.jsx("input",{ref:C,className:nt,placeholder:"e.g. Acme Corp",value:y,onChange:de=>b(de.target.value)})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"Description"}),o.jsx("textarea",{className:`${nt} resize-none`,rows:3,placeholder:"What does your AI company do?",value:v,onChange:de=>j(de.target.value)})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-medium block mb-1",style:{color:"var(--terminal-text-secondary)"},children:"AI Response Language"}),o.jsxs("select",{className:nt,value:S,onChange:de=>E(de.target.value),children:[o.jsx("option",{value:"auto",children:"Auto"}),o.jsx("option",{value:"en",children:"English"}),o.jsx("option",{value:"ko",children:"한국어"}),o.jsx("option",{value:"ja",children:"日本語"})]})]})]}),bt==="project"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Project Setup"}),o.jsxs("div",{className:Ht(A==="fresh"),onClick:()=>{M("fresh"),U(null)},children:[o.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Create a new AI company from scratch with clean directory structure."})]}),o.jsxs("div",{className:Ht(A==="existing"),onClick:()=>M("existing"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["📂"," Connect Existing Project"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Add AI company structure to an existing codebase or knowledge base."}),A==="existing"&&o.jsxs("div",{className:"mt-3",onClick:de=>de.stopPropagation(),children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{className:`${nt} flex-1`,placeholder:"/path/to/your/project",value:R,onChange:de=>{L(de.target.value),U(null)},autoFocus:!0}),o.jsx("button",{onClick:()=>Y(!D),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),o.jsx("button",{onClick:Ie,disabled:X||!R.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:X||!R.trim()?.5:1},children:X?"...":"Verify"})]}),O===!0&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Path verified: ",R]}),O===!1&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," Invalid path"]}),D&&o.jsx(Od,{onSelect:de=>{L(de),U(!0),Y(!1)},onClose:()=>Y(!1)})]})]})]}),bt==="knowledge"&&o.jsxs("div",{className:"space-y-3",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Knowledge Strategy"}),o.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"How should AI handle your knowledge base?"}),o.jsxs("div",{className:Ht(F==="skip"),onClick:()=>Q("skip"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["🌱"," Start Fresh"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Empty knowledge base. Add documents later from the office."})]}),o.jsxs("div",{className:Ht(F==="import"),onClick:()=>Q("import"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["📚"," Import & Build"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Select folders with documents — AI reads, summarizes, and organizes them."}),F==="import"&&o.jsxs("div",{className:"mt-3 space-y-2",onClick:de=>de.stopPropagation(),children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{className:`${nt} flex-1`,placeholder:"/path/to/docs",value:I,onChange:de=>Z(de.target.value),onKeyDown:de=>{de.key==="Enter"&&(de.preventDefault(),je())},autoFocus:!0}),o.jsx("button",{onClick:()=>we(!ce),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),o.jsx("button",{onClick:je,disabled:!I.trim(),className:"px-3 py-2 rounded text-xs font-medium",style:{background:"var(--accent)",color:"#fff",opacity:I.trim()?1:.5},children:"Add"})]}),ce&&o.jsx(Od,{onSelect:de=>{ee.includes(de)||V([...ee,de]),we(!1)},onClose:()=>we(!1)}),ee.length>0&&o.jsx("div",{className:"space-y-1",children:ee.map((de,cn)=>o.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:[o.jsx("span",{className:"flex-1 truncate",style:{fontFamily:"var(--pixel-font)"},children:de}),o.jsx("button",{onClick:()=>V(ee.filter((xl,ir)=>ir!==cn)),className:"opacity-50 hover:opacity-100",children:"✕"})]},cn))}),ee.length===0&&o.jsx("div",{className:"text-[10px] text-center py-2",style:{color:"var(--terminal-text-muted)"},children:"Add at least one folder to import."})]})]}),o.jsxs("div",{className:Ht(F==="existing-akb"),onClick:()=>Q("existing-akb"),children:[o.jsxs("div",{className:"font-medium text-sm",children:["🔗"," Connect Existing AKB"]}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Connect a directory that already has CLAUDE.md and AKB structure."}),F==="existing-akb"&&o.jsxs("div",{className:"mt-3",onClick:de=>de.stopPropagation(),children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{className:`${nt} flex-1`,placeholder:"/path/to/your/akb",value:z,onChange:de=>{B(de.target.value),T(null)},autoFocus:!0}),o.jsx("button",{onClick:()=>Oe(!Ee),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--hud-bg-alt)",color:"var(--terminal-text)"},title:"Browse folders",children:"📁"}),o.jsx("button",{onClick:be,disabled:me||!z.trim(),className:"px-3 py-2 rounded text-xs font-medium transition-colors",style:{background:"var(--accent)",color:"#fff",opacity:me||!z.trim()?.5:1},children:me?"...":"Verify"})]}),W===!0&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"var(--active-green)"},children:["✅"," Valid AKB found: ",z]}),W===!1&&o.jsxs("div",{className:"text-xs mt-2",style:{color:"#EF4444"},children:["❌"," No valid AKB (CLAUDE.md required)"]}),Ee&&o.jsx(Od,{onSelect:de=>{B(de),T(null),Oe(!1)},onClose:()=>Oe(!1)})]})]})]}),bt==="team"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:"Team Template"}),o.jsx("p",{className:"text-xs",style:{color:"var(--terminal-text-secondary)"},children:"Choose a starting team. You can add or remove roles later."}),He.map(de=>o.jsxs("div",{className:Ht(ke===de.id),onClick:()=>xt(de.id),children:[o.jsx("div",{className:"font-medium text-sm capitalize",children:de.id}),o.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:de.roles.map(cn=>o.jsx("span",{className:"px-2 py-0.5 rounded text-[10px]",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)"},children:cn.name},cn.id))})]},de.id)),o.jsxs("div",{className:Ht(ke==="custom"),onClick:()=>xt("custom"),children:[o.jsx("div",{className:"font-medium text-sm",children:"Custom"}),o.jsx("div",{className:"text-xs opacity-70 mt-1",children:"Start with no pre-built roles. Hire them from the office."})]})]}),bt==="create"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h2",{className:"text-base font-semibold",style:{color:"var(--terminal-text)"},children:ie?F==="existing-akb"?"AKB Connected!":"Company Created!":"Review & Create"}),!ie&&!he&&!St&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"rounded-lg p-4 space-y-2 text-xs",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:F==="existing-akb"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Mode:"})," Connect Existing AKB"]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Path:"})," ",z]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Company:"})," ",y]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Engine:"})," ",u==="claude-cli"?"Claude Code CLI":"Direct API"]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Project:"})," ",A==="fresh"?"Start Fresh":`Existing (${R})`]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Knowledge:"})," ",F==="skip"?"Fresh (empty)":`Import ${ee.length} source(s)`]}),o.jsxs("div",{children:[o.jsx("span",{className:"opacity-50",children:"Team:"})," ",ke]}),F==="import"&&ee.length>0&&o.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--idle-amber)"},children:"Knowledge import will run in the background after entering the office."})]})}),Te&&o.jsx("div",{className:"text-xs p-3 rounded",style:{background:"rgba(220,38,38,0.15)",color:"#f87171"},children:Te})]}),(he||St)&&o.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[o.jsx("div",{className:"w-8 h-8 border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),o.jsx("div",{className:"text-sm",style:{color:"var(--terminal-text-secondary)"},children:St?"Connecting to AKB...":"Scaffolding your company..."})]}),ie&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"text-center py-4 text-4xl",children:"🏢"}),Be&&o.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:[o.jsx("span",{className:"opacity-50",children:"Location:"})," ",Be]}),o.jsx("div",{className:"rounded-lg p-4 text-xs max-h-40 overflow-y-auto",style:{background:"var(--terminal-bg)",color:"var(--terminal-text)",border:"1px solid var(--terminal-border)",fontFamily:"var(--pixel-font)"},children:Re.map((de,cn)=>o.jsxs("div",{className:"py-0.5",children:[o.jsx("span",{style:{color:"var(--active-green)"},children:"✓"})," ",de]},cn))}),F==="import"&&ee.length>0&&o.jsx("div",{className:"text-xs p-3 rounded",style:{background:"var(--accent)",color:"#fff",opacity:.9},children:"Knowledge import will start in the background after entering the office."})]})]})]}),o.jsxs("div",{className:"px-6 py-4 flex justify-between items-center",style:{borderTop:"1px solid var(--terminal-border)"},children:[o.jsx("div",{children:l>0&&!ie&&o.jsx("button",{onClick:ze,className:"px-4 py-2 rounded text-sm transition-colors",style:{color:"var(--terminal-text-secondary)",border:"1px solid var(--terminal-border)"},children:"Back"})}),o.jsxs("div",{className:"text-xs",style:{color:"var(--terminal-text-muted)"},children:[l+1," / ",pt.length]}),o.jsx("div",{children:ie?o.jsx("button",{onClick:Je,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:"var(--active-green)",color:"#fff"},children:"Enter Office"}):o.jsx("button",{onClick:ye,disabled:!re()||he||St,className:"px-5 py-2 rounded text-sm font-medium transition-colors",style:{background:re()?"var(--accent)":"var(--terminal-border)",color:"#fff",opacity:re()&&!he&&!St?1:.5},children:bt==="create"?he||St?St?"Connecting...":"Creating...":F==="existing-akb"?"Connect AKB":"Create Company":"Next"})})]})]})})}function mN(){const[t,l]=k.useState(null),[r,i]=k.useState(!0),[c,u]=k.useState(null),f=k.useCallback(async()=>{i(!0),u(null);try{const m=await Ce.getStatus();l(m)}catch(m){u(m instanceof Error?m.message:"Failed to fetch status")}finally{i(!1)}},[]);return k.useEffect(()=>{f()},[f]),{initialized:(t==null?void 0:t.initialized)??!1,companyName:(t==null?void 0:t.companyName)??null,engine:(t==null?void 0:t.engine)??"none",companyRoot:(t==null?void 0:t.companyRoot)??"",loading:r,error:c,refetch:f}}const xN=k.lazy(()=>Jb(()=>import("./preview-app-Bmqw6mTx.js"),[]));function _g(){return o.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--floor-dark)"},children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"w-10 h-10 mx-auto border-2 rounded-full animate-spin",style:{borderColor:"var(--terminal-border)",borderTopColor:"var(--accent)"}}),o.jsx("div",{className:"mt-4 text-sm",style:{color:"var(--terminal-text-secondary)",fontFamily:"var(--pixel-font)"},children:"Loading..."})]})})}function pN(){var t;try{const l=localStorage.getItem("tycono-theme")||localStorage.getItem("the-company-theme"),r=l&&l in Yr?l:"default",i=(t=Yr[r])==null?void 0:t.vars;if(!i)return;const c=document.documentElement;for(const[u,f]of Object.entries(i))c.style.setProperty(u,f)}catch{}}function yN(){const{initialized:t,loading:l,refetch:r}=mN(),[i,c]=k.useState(null);k.useEffect(()=>{pN()},[]);const u=f=>{f&&c(f),r()};return l?o.jsx(_g,{}):t?o.jsx(fN,{importJob:i,onImportDone:()=>c(null)}):o.jsx(hN,{onComplete:u})}function gN(){const t=new URLSearchParams(window.location.search).has("sprite-preview");return o.jsx(Pb,{children:t?o.jsx(k.Suspense,{fallback:o.jsx(_g,{}),children:o.jsx(xN,{})}):o.jsx(yN,{})})}Qb.createRoot(document.getElementById("root")).render(o.jsx(k.StrictMode,{children:o.jsx(gN,{})}));export{pg as H,gg as P,bg as S,wN as a,yg as b,xg as c,Qd as d,DS as e,TS as f,vN as g,zS as h,o as j,k as r};
|